diff --git a/.gitignore b/.gitignore index 3d6abfc9ea..1d485231df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,8 @@ # manually added cronscript cronpull.sh -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -*.csproj +# Ignore Visual Studio solution files. +# Calamity uses a project file but not a solution file. *.sln # User-specific files diff --git a/Backgrounds/AstralDesertSurfaceBGStyle.cs b/Backgrounds/AstralDesertSurfaceBGStyle.cs index 181f0d7222..d5ef0d60c7 100644 --- a/Backgrounds/AstralDesertSurfaceBGStyle.cs +++ b/Backgrounds/AstralDesertSurfaceBGStyle.cs @@ -5,6 +5,7 @@ using Terraria.Graphics.Effects; using Terraria; using Terraria.ModLoader; using Microsoft.Xna.Framework; +using CalamityMod.Skies; namespace CalamityMod.Backgrounds { @@ -80,7 +81,7 @@ namespace CalamityMod.Backgrounds 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); + var bgWidthScaled = (int)((float)SkyTextureRefs.AstralDesertSurfaceMiddle.Value.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) @@ -91,7 +92,7 @@ namespace CalamityMod.Backgrounds { 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); + Main.spriteBatch.Draw(SkyTextureRefs.AstralDesertSurfaceMiddle.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralDesertSurfaceMiddle.Value.Width, SkyTextureRefs.AstralDesertSurfaceMiddle.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } @@ -99,7 +100,7 @@ namespace CalamityMod.Backgrounds bgParallax = 0.43; bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - bgWidthScaled = (int)((float)CalamityMod.AstralDesertSurfaceClose.Width * bgScale); + bgWidthScaled = (int)((float)SkyTextureRefs.AstralDesertSurfaceClose.Value.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) @@ -113,7 +114,7 @@ namespace CalamityMod.Backgrounds { 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); + Main.spriteBatch.Draw(SkyTextureRefs.AstralDesertSurfaceClose.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralDesertSurfaceClose.Value.Width, SkyTextureRefs.AstralDesertSurfaceClose.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } } diff --git a/Backgrounds/AstralSnowSurfaceBGStyle.cs b/Backgrounds/AstralSnowSurfaceBGStyle.cs index 239fc427b3..7300b8c7e3 100644 --- a/Backgrounds/AstralSnowSurfaceBGStyle.cs +++ b/Backgrounds/AstralSnowSurfaceBGStyle.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Terraria.GameContent.UI.States; +using CalamityMod.Skies; namespace CalamityMod.Backgrounds { @@ -82,7 +83,7 @@ namespace CalamityMod.Backgrounds 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); + var bgWidthScaled = (int)((float)SkyTextureRefs.AstralSnowSurfaceMiddle.Value.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) @@ -93,7 +94,7 @@ namespace CalamityMod.Backgrounds { 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); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSnowSurfaceMiddle.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSnowSurfaceMiddle.Value.Width, SkyTextureRefs.AstralSnowSurfaceMiddle.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } @@ -101,7 +102,7 @@ namespace CalamityMod.Backgrounds bgParallax = 0.43; bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceClose.Width * bgScale); + bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceClose.Value.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) @@ -115,15 +116,15 @@ namespace CalamityMod.Backgrounds { 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); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceClose.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceClose.Value.Width, SkyTextureRefs.AstralSurfaceClose.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceCloseGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceCloseGlow.Value.Width, SkyTextureRefs.AstralSurfaceCloseGlow.Value.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); + bgWidthScaled = (int)(SkyTextureRefs.AstralSurfaceFront.Value.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) @@ -137,8 +138,8 @@ namespace CalamityMod.Backgrounds { 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); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFront.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFront.Value.Width, SkyTextureRefs.AstralSurfaceFront.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFrontGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFrontGlow.Value.Width, SkyTextureRefs.AstralSurfaceFrontGlow.Value.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); } } } diff --git a/Backgrounds/AstralSurfaceBGStyle.cs b/Backgrounds/AstralSurfaceBGStyle.cs index bc53eed640..c32d475687 100644 --- a/Backgrounds/AstralSurfaceBGStyle.cs +++ b/Backgrounds/AstralSurfaceBGStyle.cs @@ -5,6 +5,7 @@ using System; using Terraria.Graphics.Effects; using Terraria; using Terraria.ModLoader; +using CalamityMod.Skies; namespace CalamityMod.Backgrounds { @@ -86,7 +87,7 @@ namespace CalamityMod.Backgrounds 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 + var bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceMiddle.Value.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) @@ -98,8 +99,8 @@ namespace CalamityMod.Backgrounds 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); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceMiddle.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceMiddle.Value.Width, SkyTextureRefs.AstralSurfaceMiddle.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceMiddleGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceMiddleGlow.Value.Width, SkyTextureRefs.AstralSurfaceMiddleGlow.Value.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); } } @@ -109,7 +110,7 @@ namespace CalamityMod.Backgrounds bgParallax = 0.43; bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceClose.Width * bgScale); + bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceClose.Value.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) @@ -123,8 +124,8 @@ namespace CalamityMod.Backgrounds { 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); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceClose.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceClose.Value.Width, SkyTextureRefs.AstralSurfaceClose.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceCloseGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceCloseGlow.Value.Width, SkyTextureRefs.AstralSurfaceCloseGlow.Value.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); } } @@ -134,7 +135,7 @@ namespace CalamityMod.Backgrounds bgParallax = 0.49; bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - bgWidthScaled = (int)(CalamityMod.AstralSurfaceFront.Width * bgScale); + bgWidthScaled = (int)(SkyTextureRefs.AstralSurfaceFront.Value.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) @@ -148,8 +149,8 @@ namespace CalamityMod.Backgrounds { 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); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFront.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFront.Value.Width, SkyTextureRefs.AstralSurfaceFront.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFrontGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFrontGlow.Value.Width, SkyTextureRefs.AstralSurfaceFrontGlow.Value.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); } } } diff --git a/Backgrounds/AstralUG0.png b/Backgrounds/AstralUG0.png index 8e436e758b..dce8a3ae1f 100644 Binary files a/Backgrounds/AstralUG0.png and b/Backgrounds/AstralUG0.png differ diff --git a/Backgrounds/AstralUG1.png b/Backgrounds/AstralUG1.png index 478e62a308..697df413cf 100644 Binary files a/Backgrounds/AstralUG1.png and b/Backgrounds/AstralUG1.png differ diff --git a/Backgrounds/AstralUG2.png b/Backgrounds/AstralUG2.png index 1641e95d7b..3e77d6a2f2 100644 Binary files a/Backgrounds/AstralUG2.png and b/Backgrounds/AstralUG2.png differ diff --git a/Backgrounds/AstralUG3.png b/Backgrounds/AstralUG3.png index 5baacb89cb..7cf25fbff6 100644 Binary files a/Backgrounds/AstralUG3.png and b/Backgrounds/AstralUG3.png differ diff --git a/Backgrounds/AstralUG4_0.png b/Backgrounds/AstralUG4_0.png index 73f3bad550..1140e6875a 100644 Binary files a/Backgrounds/AstralUG4_0.png and b/Backgrounds/AstralUG4_0.png differ diff --git a/Backgrounds/AstralUG4_1.png b/Backgrounds/AstralUG4_1.png index bf9978ceeb..36c91a0ee8 100644 Binary files a/Backgrounds/AstralUG4_1.png and b/Backgrounds/AstralUG4_1.png differ diff --git a/Backgrounds/AstralUG4_2.png b/Backgrounds/AstralUG4_2.png index b36e95b213..cb5b86584b 100644 Binary files a/Backgrounds/AstralUG4_2.png and b/Backgrounds/AstralUG4_2.png differ diff --git a/Backgrounds/AstralUndergroundBGStyle.cs b/Backgrounds/AstralUndergroundBGStyle.cs index f3c9455798..20cc1d0d5b 100644 --- a/Backgrounds/AstralUndergroundBGStyle.cs +++ b/Backgrounds/AstralUndergroundBGStyle.cs @@ -5,10 +5,42 @@ namespace CalamityMod.Backgrounds { public class AstralUndergroundBGStyle : ModUndergroundBackgroundStyle { + private int AUBG0; + private int AUBG1; + private int AUBG2; + private int AUBG3; + + private int AUBG4_0; + private int AUBG4_1; + private int AUBG4_2; + + public override void SetStaticDefaults() + { + if (Main.dedServ) + return; + + AUBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG0"); + AUBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG1"); + AUBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG2"); + AUBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG3"); + + AUBG4_0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG4_0"); + AUBG4_1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG4_1"); + AUBG4_2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG4_2"); + } + public override void FillTextureArray(int[] textureSlots) { - 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()); + textureSlots[0] = AUBG0; + textureSlots[1] = AUBG1; + textureSlots[2] = AUBG2; + textureSlots[3] = AUBG3; + textureSlots[4] = Main.hellBackStyle switch + { + 0 => AUBG4_0, + 1 => AUBG4_1, + _ => AUBG4_2 + }; } } } diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs index cfd743dd4f..11b86c7d67 100644 --- a/Backgrounds/SunkenSeaBGStyle.cs +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -5,13 +5,28 @@ namespace CalamityMod.Backgrounds { public class SunkenSeaBGStyle : ModUndergroundBackgroundStyle { + private int SSBG0; + private int SSBG1; + private int SSBG2; + private int SSBG3; + + public override void SetStaticDefaults() + { + if (Main.dedServ) + return; + + SSBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG0"); + SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG1"); + SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG2"); + SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG3"); + } + public override void FillTextureArray(int[] textureSlots) { - for (int i = 0; i <= 3; i++) - { - textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - //textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString()); - } + textureSlots[0] = SSBG0; + textureSlots[1] = SSBG1; + textureSlots[2] = SSBG2; + textureSlots[3] = SSBG3; } } } diff --git a/Backgrounds/SunkenSeaBurrowsBG.cs b/Backgrounds/SunkenSeaBurrowsBG.cs index e096f3fdfd..bff3bd212f 100644 --- a/Backgrounds/SunkenSeaBurrowsBG.cs +++ b/Backgrounds/SunkenSeaBurrowsBG.cs @@ -3,26 +3,52 @@ using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using ReLogic.Content; +using Terraria.ID; namespace CalamityMod.Backgrounds { - internal static class SunkenSeaBurrowsBG + public class SunkenSeaBurrowsBG : ModSystem { - public static void Load() + public override void Load() { if (Main.dedServ) { return; } - On_Main.DrawBackgroundBlackFill += DrawBurrowsBG; + On_Main.DrawBackgroundBlackFill += On_Main_DrawBackgroundBlackFill; } - public static float Transparency; + /// + /// This code runs because there is a system in vanilla that causes backgrounds to not draw if lighting is too low. + /// That would be fine, the problem arises because sloped tiles still block light the same way normal tiles do. + /// Which means that the background will occasionally be blocked by slopes as though said slopes were full squares. + /// This is a hacky method that sets the light level of every sloped tile *AT LEAST* high enough to render the background while in the Burrows. + /// + /// ENNWAY's note: + /// if this doesn't get fixed in 1.4.5 i am throwing really big rocks at unsuspecting re logic employees + /// + public override void PreUpdatePlayers() + { + if (!Main.dedServ && Main.LocalPlayer.InModBiome()) + { + for (int i = 0; i < Main.screenWidth / 16; i++) + { + for (int j = 0; j < Main.screenWidth / 16; j++) + { + Point pos = (Main.screenPosition / 16).ToPoint() + new Point(i, j); - public static float TransitionSpeed => 0.02f; + if (Main.tile[pos.X, pos.Y].Slope != SlopeType.Solid) + { + Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.1f); + } + } + } + } + } - private static void DrawBurrowsBG(On_Main.orig_DrawBackgroundBlackFill orig, Main self) + private void On_Main_DrawBackgroundBlackFill(On_Main.orig_DrawBackgroundBlackFill orig, Main self) { if (Main.gameMenu || Main.screenPosition.Y + Main.screenHeight < ((int)Main.worldSurface) * 16f) { @@ -33,7 +59,16 @@ namespace CalamityMod.Backgrounds orig(self); - if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) + DrawBurrowsBG(); + } + + public static float Transparency; + + public static float TransitionSpeed => 0.02f; + + private static void DrawBurrowsBG() + { + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) { Transparency += TransitionSpeed; @@ -75,54 +110,54 @@ namespace CalamityMod.Backgrounds switch (Layers) { case 0: - { - zero.Y += 800f; - break; - } + { + zero.Y += 800f; + break; + } case 1: - { - zero.Y += 200f; - break; - } + { + zero.Y += 200f; + break; + } case 2: - { - zero.Y += 450f; - break; - } + { + zero.Y += 450f; + break; + } case 3: - { - zero.Y += 45f; - break; - } + { + zero.Y += 45f; + break; + } case 4: - { - zero.Y += 45f; - break; - } + { + zero.Y += 45f; + break; + } } vector2 *= Scale; zero.Y -= num; float LoopWidth = Scale * rectangle.Width; - //float LoopHeight = Scale * rectangle.Height; + float LoopHeight = Scale * rectangle.Height; int LoopX = (int)((vector.X * vector3.X - vector2.X + zero.X - (Main.screenWidth >> 1)) / LoopWidth); - //int LoopY = (int)((vector.Y * vector3.Y - vector2.Y + zero.Y - (Main.screenWidth >> 1)) / LoopWidth); + int LoopY = (int)((vector.Y * vector3.Y - vector2.Y + zero.Y - (Main.screenWidth >> 1)) / LoopWidth); - //for (int i = LoopY - 2; i < LoopY + 4 + (int)(Main.screenWidth / LoopHeight); i++) - //{ + for (int i = LoopY - 2; i < LoopY + 4 + (int)(Main.screenWidth / LoopHeight); i++) + { for (int j = LoopX - 2; j < LoopX + 4 + (int)(Main.screenWidth / LoopWidth); j++) { Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), ((Main.LocalPlayer.Center.Y / 16f) - 90) * 16f) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero; var frame = rectangle; - var color = Color.MediumTurquoise * Transparency; + var color = Color.White * Transparency; Main.spriteBatch.Draw(BGTexture, drawPosition, frame, color, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f); } - //} + } } } } } -} \ No newline at end of file +} diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 1db3befd52..226bf39ba5 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -1,14 +1,12 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Items.Weapons.Ranged; 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; @@ -19,6 +17,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,8 +25,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Balancing { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class BalancingChangesManager + public sealed class BalancingChangesManager : ModSystem { internal static List UniversalBalancingChanges = null; internal static List NPCSpecificBalancingChanges = null; @@ -36,7 +34,7 @@ namespace CalamityMod.Balancing // For ease of change, changes that are not exclusive to one specific weapon are not bundled into one line if they share the same resistance factor. // To give an example of this, Thanatos having a 50% resist to Chicken Cannon and Prismatic Breaker should be two distinct lines with a 0.5x factor instead of hamfisting them all // into one single resist that may have to be split later. - internal static void Load() + public override void SetStaticDefaults() { // Dirty shorthand for true melee resists, because they're super common and other class resists aren't. IBalancingRule ResistTrueMelee(float f) => new ClassResistBalancingRule(f, TrueMeleeDamageClass.Instance); @@ -54,12 +52,18 @@ namespace CalamityMod.Balancing bool MushroomSpearFilter(Projectile p) => p.type == ProjectileID.Mushroom && Main.player[p.owner].ActiveItem().type == ItemID.MushroomSpear; + bool OrichalcumPetalFilter(Projectile p) => + p.type == ProjectileID.FlowerPetal && Main.player[p.owner].onHitPetal; + bool SpectreMaskSetBonusFilter(Projectile p) => p.type == ProjectileID.SpectreWrath && Main.player[p.owner].ghostHurt; bool AotCThrowCombo(Projectile p) => p.type == ProjectileType() && (p.ai[0] == 2 || p.ai[0] == 3); + bool HiveBeeFilter(Projectile p) => + p.type == ProjectileType() && Main.player[p.owner].ActiveItem().type == ItemType(); + UniversalBalancingChanges = new List() { // Nerf Crystal bullet shards by 45% @@ -78,6 +82,9 @@ namespace CalamityMod.Balancing // Nerf Mushroom Spear projectiles by 50%. Do(new ProjectileSpecificRequirementBalancingRule(0.5f, MushroomSpearFilter)), + // Nerf Orichalcum armor set bonus petals by 25%. + Do(new ProjectileSpecificRequirementBalancingRule(0.75f, OrichalcumPetalFilter)), + // Nerf Spectre Mask set bonus projectiles by 50%. Do(new ProjectileSpecificRequirementBalancingRule(0.5f, SpectreMaskSetBonusFilter)), @@ -87,12 +94,12 @@ namespace CalamityMod.Balancing #region Desert Scourge // 25% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DesertScourgeIDs, Do(ResistTrueMelee(0.75f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(DesertScourgeIDList.List, Do(ResistTrueMelee(0.8f)))); #endregion #region Crabulon - // 50% resist to true melee. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), ResistTrueMelee(0.5f))); + // 25% resist to true melee. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), ResistTrueMelee(0.8f))); #endregion #region Brain of Cthulhu: Creepers @@ -105,18 +112,18 @@ namespace CalamityMod.Balancing #region Eater of Worlds // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(EaterOfWorldsIDList.List, Do(ResistTrueMelee(0.5f)))); // 50% resist to Demon Scythe. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); + NPCSpecificBalancingChanges.AddRange(Bundle(EaterOfWorldsIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); // 40% resist to Sky Glaze. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(EaterOfWorldsIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); #endregion #region The Perforators // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.PerforatorIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(PerforatorWormIDList.List, Do(ResistTrueMelee(0.5f)))); #endregion #region Wall of Flesh @@ -126,72 +133,69 @@ namespace CalamityMod.Balancing #region Aquatic Scourge // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(ResistTrueMelee(0.5f)))); // 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)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); // 50% resist to Dormant Brimseeker. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Mounted Scanner. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); // 30% resist to Meowthrower. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 25% resist to Snowstorm Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, 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)))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(ResistTrueMelee(0.5f)))); // 50% resist to Adamantite Throwing Axe's lightning. // See Aquatic Scourge comment. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Dormant Brimseeker. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 45% resist to Mounted Scanner. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); // 30% resist to Meowthrower. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - // 25% resist to SHPC. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + // 25% resist to Avalanche's Ice Bombs and shards. + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); // 25% resist to Snowstorm Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); #endregion #region Astrum Aureus // 30% resist to The Ballista's greatarrows. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + + // 30% resist to Whitewater. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), 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())))); + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.DukeFishron, Do(new ProjectileSpecificRequirementBalancingRule(1.2f, HiveBeeFilter)))); - // 35% vulnerability to Resurrection Butterfly. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.DukeFishron, Do(new ProjectileResistBalancingRule(1.35f, ProjectileType(), ProjectileType())))); + // 25% vulnerability to Resurrection Butterfly. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.DukeFishron, Do(new ProjectileResistBalancingRule(1.25f, ProjectileType(), ProjectileType())))); #endregion #region Empress of Light @@ -204,28 +208,31 @@ namespace CalamityMod.Balancing #region Ravager // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(ResistTrueMelee(0.5f)))); // 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 50% resist to Whitewater. + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType(), ProjectileType())))); // 35% resist to Flying Dragon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); // 30% resist to Aurora Blazer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Flak Kraken. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 25% resist to Lucrecia. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 20% resist to The Hive. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); #endregion #region Lunatic Cultist @@ -240,49 +247,46 @@ namespace CalamityMod.Balancing // 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType(), ProjectileType())))); // 70% resist to Charged Blaster Cannon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.ChargedBlasterLaser)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.ChargedBlasterLaser)))); // 70% resist to Stardust Dragon Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); - - // 65% resist to Atlantis (Atlantis gaming!). - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); // 55% resist to Flak Kraken. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType())))); // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(ResistTrueMelee(0.5f)))); + + // 50% resist to Atlantis (Atlantis gaming!). + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Aurora Blazer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 35% resist to Aerial Bane. + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2BetsyArrow)))); // 35% resist to Ballistic Poison Bomb's clouds. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 35% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 20% resist to Cluster Rocket fragments. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.ClusterFragmentsI, ProjectileID.ClusterFragmentsII)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.ClusterFragmentsI, ProjectileID.ClusterFragmentsII)))); #endregion #region Moon Lord // 20% resist to The Hive's nuke. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); - - // 20% resist to Mercurial Tides (True Biome Blade). - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); #endregion #region Profaned Guardians @@ -291,10 +295,7 @@ namespace CalamityMod.Balancing #endregion #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. + // 35% resist to Vanishing Point. This thing desperately needs a rework. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType()))); #endregion @@ -302,28 +303,37 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), ResistTrueMelee(0.5f))); + // 50% resist to Galactus Blade. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.5f, ProjectileType()))); + // 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)))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(ResistTrueMelee(0.5f)))); // 50% resist to Dazzling Stabber Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 50% resist to Last Prism. + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.LastPrismLaser)))); // 50% resist to Legion of Celestia. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Tactician's Trump Card's explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 25% resist to Molten Amputator's blobs. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + // 40% resist to Devil's Sunrise's slashes. + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + + // 35% resist to Event Horizon. + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); #endregion #region Old Duke @@ -332,167 +342,168 @@ namespace CalamityMod.Balancing #endregion #region The Devourer of Gods - // 80% resist to Wave Pounder. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.2f, ProjectileType())))); + // 65% resist to Wave Pounder. + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); - // 50% resist to Eidolic Wail. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 35% resist to Sulphuric Acid Cannon's explosions. + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 35% resist to Venusian Trident's explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); + // 35% resist to Venusian Trident. + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 25% resist to Corinth Prime's Grenades. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + // 25% resist to Corinth Prime's grenades. + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.75f, 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 15% vulnerability to Time Bolt stealth strikes. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType())))); #endregion The Devourer of Gods #region Yharon + // 15% resist to The Old Reaper's stealth strike rain. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + // 15% resist to Time Bolt. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); #endregion #region Exo Mechs: Ares - // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(ResistTrueMelee(0.5f)))); - // 30% resist to Dynamic Pursuer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); // 25% resist to Aetherflux Cannon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + + // 25% resist to Prismatic Breaker's deathray. + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 20% resist to the Spin Throw part of the Ark of the Cosmos' combo. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, AotCThrowCombo)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, AotCThrowCombo)))); // 20% resist to Dragon Rage projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, DragonRageFilter)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, DragonRageFilter)))); // 20% resist to Eclipse's Fall. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); // 20% resist to Rancor. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Yharim's Crystal. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Zenith. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FinalFractal)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FinalFractal)))); #endregion #region Exo Mechs: Artemis and Apollo // Artemis and Apollo have to be defined here because they aren't a pre-existing list. // 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's mini spears. - NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType())))); + // Commented out since they currently have no resists. + // int[] exoTwins = new int[] { NPCType(), NPCType() }; #endregion #region Exo Mechs: Thanatos // 65% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(ResistTrueMelee(0.35f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(ResistTrueMelee(0.35f)))); // 65% resist to The Enforcer's projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 65% resist to The Final Dawn's lunge. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 65% resist to Stellar Torus Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 60% resist to Dynamic Pursuer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileType(), ProjectileType())))); // 50% resist to Chicken Cannon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Omicron's beam. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Vehemence's skulls. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Yharim's Crystal. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 45% resist to Prismatic Breaker's deathray. + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); // 45% resist to Wrathwing's stealth strike fireballs. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); - - // 35% resist to Prismatic Breaker's laser beam. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); // 30% resist to Eclipse's Fall. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Sirius. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Ultima's rays. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType())))); // 25% resist to the Spin Throw part of the Ark of the Cosmos' combo. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, AotCThrowCombo)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, AotCThrowCombo)))); // 25% resist to Dragon Rage projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, DragonRageFilter)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, DragonRageFilter)))); // 25% resist to Gael's Greatsword's big skulls. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, BigGaelsSkullFilter)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 25% resist to Zenith. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal)))); // 20% resist to The Anomaly's Nanogun's bomb explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Eradicator's beams. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, 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())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 15% resist to The Final Dawn's AoE sweep flames. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + + // 15% resist to Dragon's Breath's beam of fire. + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to God Slayer Slugs. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to Gruesome Eminence. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to Luminite Bullets. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileID.MoonlordBullet)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileID.MoonlordBullet)))); #endregion #region Supreme Calamitas: Brimstone Hearts + // 34% resist to Celestus' mini scythes. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.66f, ProjectileType()))); + // 30% resist to Supernova. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType()))); @@ -504,11 +515,11 @@ namespace CalamityMod.Balancing #endregion #region Supreme Calamitas: Soul Seekers - // 85% resist to Chicken Cannon. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.15f, ProjectileType()))); + // 80% resist to Chicken Cannon. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.2f, ProjectileType()))); - // 50% resist to Subsuming Vortex. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType(), ProjectileType()))); + // 40% resist to Subsuming Vortex. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType(), ProjectileType()))); // 40% resist to Supernova. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType()))); @@ -518,19 +529,10 @@ namespace CalamityMod.Balancing // 25% resist to Yharim's Crystal. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.75f, ProjectileType()))); - - // 10% resist to Celestus. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType(), ProjectileType()))); - - // 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()))); #endregion } - internal static void Unload() + public override void Unload() { UniversalBalancingChanges = null; NPCSpecificBalancingChanges = null; diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 4b931a4b1f..590cc74fcd 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -3,11 +3,11 @@ 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; + // When the relevant config is enabled: Multiplies the player's movement speed by 1.5x at all times + internal static readonly float DefaultMoveSpeedBoost = 1.5f; - // When the relevant config is enabled: Increases the player's base jump height by 10% - internal static readonly float ConfigBoostedBaseJumpHeight = 5.51f; // vanilla = 5.01f + // When the relevant config is enabled: Increases the player's base jump speed by 13.97% (allows you to jump 7 blocks) + internal static readonly float ConfigBoostedBaseJumpSpeed = 5.71f; // vanilla = 5.01f // When the relevant config is enabled: Allows the player to hold the Down button (S by default) to fast fall. // This is the multiplier for the player's gravity (downwards acceleration) while holding Down. @@ -32,7 +32,7 @@ // Altered run acceleration multiplier provided by Soaring Insignia via IL edit // This is a const because it replaces a hardcoded value in vanilla - internal const float SoaringInsigniaRunAccelerationMultiplier = 1.1f; // Vanilla = 1.75f + internal const float SoaringInsigniaRunAccelerationMultiplier = 1.25f; // Vanilla = 1.75f #endregion #region Immunity Frames @@ -62,17 +62,17 @@ // Dodge cooldowns (in frames) // TODO -- Some of these could be moved to the respective item files - internal static readonly int BeltDodgeCooldownMin = 900; + internal static readonly int BeltDodgeCooldownMin = 1200; internal static readonly int BeltDodgeCooldownMax = 5400; - internal static readonly int BrainDodgeCooldownMin = 900; + internal static readonly int BrainDodgeCooldownMin = 1200; internal static readonly int BrainDodgeCooldownMax = 5400; - internal static readonly int AmalgamDodgeCooldownMin = 900; + internal static readonly int AmalgamDodgeCooldownMin = 1200; internal static readonly int AmalgamDodgeCooldownMax = 5400; - internal static readonly int MirrorDodgeCooldownMin = 900; + internal static readonly int MirrorDodgeCooldownMin = 1200; internal static readonly int MirrorDodgeCooldownMax = 5400; - internal static readonly int DaedalusReflectCooldownMin = 900; + internal static readonly int DaedalusReflectCooldownMin = 1200; internal static readonly int DaedalusReflectCooldownMax = 5400; - internal static readonly int EvolutionReflectCooldownMin = 900; + internal static readonly int EvolutionReflectCooldownMin = 1200; internal static readonly int EvolutionReflectCooldownMax = 5400; #endregion diff --git a/BiomeManagers/AbyssLayer1Biome.cs b/BiomeManagers/AbyssLayer1Biome.cs index a3b73e8f4b..8d852ea389 100644 --- a/BiomeManagers/AbyssLayer1Biome.cs +++ b/BiomeManagers/AbyssLayer1Biome.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Placeables.FurnitureAbyss; using CalamityMod.Systems; +using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -46,7 +47,7 @@ namespace CalamityMod.BiomeManagers } // Temporarily use sulphur for now - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SulphuricDepthsWater"); + public override ModWaterStyle WaterStyle => SulphuricDepthsWater.Instance; public override int BiomeTorchItemType => ModContent.ItemType(); public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer1Icon"; diff --git a/BiomeManagers/AbyssLayer2Biome.cs b/BiomeManagers/AbyssLayer2Biome.cs index cf20c66664..7f520a6835 100644 --- a/BiomeManagers/AbyssLayer2Biome.cs +++ b/BiomeManagers/AbyssLayer2Biome.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Placeables.FurnitureAbyss; using CalamityMod.Systems; +using CalamityMod.Waters; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -20,7 +21,7 @@ namespace CalamityMod.BiomeManagers } } - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/UpperAbyssWater"); + public override ModWaterStyle WaterStyle => UpperAbyssWater.Instance; public override int BiomeTorchItemType => ModContent.ItemType(); public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer2Icon"; diff --git a/BiomeManagers/AbyssLayer3Biome.cs b/BiomeManagers/AbyssLayer3Biome.cs index 5fa549ef5b..f9ad0fc426 100644 --- a/BiomeManagers/AbyssLayer3Biome.cs +++ b/BiomeManagers/AbyssLayer3Biome.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Placeables.FurnitureAbyss; using CalamityMod.Systems; +using CalamityMod.Waters; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -20,7 +21,7 @@ namespace CalamityMod.BiomeManagers } } - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/MiddleAbyssWater"); + public override ModWaterStyle WaterStyle => MiddleAbyssWater.Instance; public override int BiomeTorchItemType => ModContent.ItemType(); public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer3Icon"; diff --git a/BiomeManagers/AbyssLayer4Biome.cs b/BiomeManagers/AbyssLayer4Biome.cs index de29933f2d..8a2de62e0e 100644 --- a/BiomeManagers/AbyssLayer4Biome.cs +++ b/BiomeManagers/AbyssLayer4Biome.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Placeables.FurnitureAbyss; using CalamityMod.Systems; +using CalamityMod.Waters; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -20,7 +21,7 @@ namespace CalamityMod.BiomeManagers } } - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/VoidWater"); + public override ModWaterStyle WaterStyle => VoidWater.Instance; public override int BiomeTorchItemType => ModContent.ItemType(); public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer4Icon"; diff --git a/BiomeManagers/AstralInfectionBiome.cs b/BiomeManagers/AstralInfectionBiome.cs index 980d34e0da..75f0c03b52 100644 --- a/BiomeManagers/AstralInfectionBiome.cs +++ b/BiomeManagers/AstralInfectionBiome.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; +using CalamityMod.Waters; using Terraria; using Terraria.GameContent.Events; using Terraria.ID; @@ -9,7 +10,7 @@ namespace CalamityMod.BiomeManagers { public class AstralInfectionBiome : ModBiome { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); + public override ModWaterStyle WaterStyle => AstralWater.Instance; public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle { diff --git a/BiomeManagers/BasaltGullyBiome.cs b/BiomeManagers/BasaltGullyBiome.cs new file mode 100644 index 0000000000..5f4b388829 --- /dev/null +++ b/BiomeManagers/BasaltGullyBiome.cs @@ -0,0 +1,9 @@ +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class BasaltGullyBiome : ModBiome + { + + } +} diff --git a/BiomeManagers/FloralParadiseBiome.cs b/BiomeManagers/FloralParadiseBiome.cs index 9789259705..bfe9d45095 100644 --- a/BiomeManagers/FloralParadiseBiome.cs +++ b/BiomeManagers/FloralParadiseBiome.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Waters; using Terraria; using Terraria.ModLoader; @@ -6,7 +7,7 @@ namespace CalamityMod.BiomeManagers { public class FloralParadiseBiome : ModBiome { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/FloralParadiseWater"); + public override ModWaterStyle WaterStyle => FloralParadiseWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/FloralParadiseBGStyle"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; diff --git a/BiomeManagers/SunkenSeaBurrowsBiome.cs b/BiomeManagers/GleamingBurrowsBiome.cs similarity index 86% rename from BiomeManagers/SunkenSeaBurrowsBiome.cs rename to BiomeManagers/GleamingBurrowsBiome.cs index a0980ce333..94bd09ac08 100644 --- a/BiomeManagers/SunkenSeaBurrowsBiome.cs +++ b/BiomeManagers/GleamingBurrowsBiome.cs @@ -1,14 +1,15 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; +using CalamityMod.Waters; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.BiomeManagers { - public class SunkenSeaBurrowsBiome : ModBiome + public class GleamingBurrowsBiome : ModBiome { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaBurrowsWater"); + public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; @@ -23,7 +24,7 @@ namespace CalamityMod.BiomeManagers bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; - return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 500 && MoreThanReefs && MoreThanPolyp; + return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 1000 && MoreThanReefs && MoreThanPolyp; } } } diff --git a/BiomeManagers/SunkenSeaPolypBiome.cs b/BiomeManagers/PolypForestBiome.cs similarity index 87% rename from BiomeManagers/SunkenSeaPolypBiome.cs rename to BiomeManagers/PolypForestBiome.cs index 3c2fdeaeda..b440b5d7a9 100644 --- a/BiomeManagers/SunkenSeaPolypBiome.cs +++ b/BiomeManagers/PolypForestBiome.cs @@ -1,14 +1,15 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; +using CalamityMod.Waters; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.BiomeManagers { - public class SunkenSeaPolypBiome : ModBiome + public class PolypForestBiome : ModBiome { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaPolypWater"); + public override ModWaterStyle WaterStyle => SunkenSeaPolypWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; @@ -23,7 +24,7 @@ namespace CalamityMod.BiomeManagers bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; - return BiomeTileCounterSystem.SunkenSeaPolypTiles > 500 && MoreThanReefs && MoreThanBurrows; + return BiomeTileCounterSystem.SunkenSeaPolypTiles > 1000 && MoreThanReefs && MoreThanBurrows; } } } diff --git a/BiomeManagers/SunkenSeaReefsBiome.cs b/BiomeManagers/RadiantReefsBiome.cs similarity index 87% rename from BiomeManagers/SunkenSeaReefsBiome.cs rename to BiomeManagers/RadiantReefsBiome.cs index d9d7fe0c79..7dd90a03fb 100644 --- a/BiomeManagers/SunkenSeaReefsBiome.cs +++ b/BiomeManagers/RadiantReefsBiome.cs @@ -1,14 +1,15 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; +using CalamityMod.Waters; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.BiomeManagers { - public class SunkenSeaReefsBiome : ModBiome + public class RadiantReefsBiome : ModBiome { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaReefsWater"); + public override ModWaterStyle WaterStyle => SunkenSeaReefsWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; @@ -23,7 +24,7 @@ namespace CalamityMod.BiomeManagers bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; - return BiomeTileCounterSystem.SunkenSeaReefsTiles > 500 && MoreThanBurrows && MoreThanPolyp; + return BiomeTileCounterSystem.SunkenSeaReefsTiles > 1000 && MoreThanBurrows && MoreThanPolyp; } } } diff --git a/BiomeManagers/SulphurousSeaBiome.cs b/BiomeManagers/SulphurousSeaBiome.cs index fb170f3449..0ca4be3feb 100644 --- a/BiomeManagers/SulphurousSeaBiome.cs +++ b/BiomeManagers/SulphurousSeaBiome.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; +using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -14,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 ModWaterStyle WaterStyle => Main.zenithWorld ? PissWater.Instance : SulphuricWater.Instance; 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; @@ -30,6 +31,7 @@ namespace CalamityMod.BiomeManagers if (!CalamityPlayer.areThereAnyDamnBosses) { bool acidRain = AcidRainEvent.AcidRainEventIsOngoing; + bool normalRain = Main.cloudAlpha > 0f; // Acid Rain themes if (acidRain) @@ -41,9 +43,18 @@ namespace CalamityMod.BiomeManagers // Regular Sulphur Sea themes, when Acid Rain is not occurring else - music = !Main.dayTime - ? CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaNight") ?? MusicID.Desert // Nighttime - : CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaDay") ?? MusicID.Desert; // Daytime + { + if (normalRain) + { + music = CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaRain") ?? MusicID.Desert; // Normal Rain + } + else + { + music = !Main.dayTime + ? CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaNight") ?? MusicID.Desert // Nighttime + : CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaDay") ?? MusicID.Desert; // Daytime + } + } } return music; diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs index eda95f35b0..8db1305e22 100644 --- a/BiomeManagers/SunkenSeaBiome.cs +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -67,8 +67,8 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 500 || BiomeTileCounterSystem.SunkenSeaPolypTiles > 500 || - BiomeTileCounterSystem.SunkenSeaReefsTiles > 500 || BiomeTileCounterSystem.SunkenSeaShoresTiles > 500; + return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 1000 || BiomeTileCounterSystem.SunkenSeaPolypTiles > 1000 || + BiomeTileCounterSystem.SunkenSeaReefsTiles > 1000 || BiomeTileCounterSystem.SunkenSeaShoresTiles > 1000; } } } diff --git a/BiomeManagers/SunkenSeaShoresBiome.cs b/BiomeManagers/TimelessShoresBiome.cs similarity index 72% rename from BiomeManagers/SunkenSeaShoresBiome.cs rename to BiomeManagers/TimelessShoresBiome.cs index 4f6252a37b..cb44c6cdc8 100644 --- a/BiomeManagers/SunkenSeaShoresBiome.cs +++ b/BiomeManagers/TimelessShoresBiome.cs @@ -1,14 +1,15 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; +using CalamityMod.Waters; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.BiomeManagers { - public class SunkenSeaShoresBiome : ModBiome + public class TimelessShoresBiome : ModBiome { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaShoresWater"); + public override ModWaterStyle WaterStyle => SunkenSeaShoresWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; @@ -20,7 +21,10 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return BiomeTileCounterSystem.SunkenSeaShoresTiles > 500; + bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; + bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; + + return BiomeTileCounterSystem.SunkenSeaShoresTiles > 1000 && MoreThanPolyp && MoreThanReefs; } } } diff --git a/Buffs/Alcohol/AlcoholPoisoning.cs b/Buffs/Alcohol/AlcoholPoisoning.cs index d130aaf523..1461d14361 100644 --- a/Buffs/Alcohol/AlcoholPoisoning.cs +++ b/Buffs/Alcohol/AlcoholPoisoning.cs @@ -11,7 +11,10 @@ namespace CalamityMod.Buffs.Alcohol Main.debuff[Type] = true; Main.buffNoSave[Type] = true; Main.buffNoTimeDisplay[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + // The nurse technically cannot get rid of this debuff by herself, as it reapplies immediately after if you have alcohol left + // But she also cleanses excess alcohol if you have Alcohol Poisoning (see CalamityPlayer.PostNurseHeal) + // Removing this set means she costs 1 debuff worth of cost to remove excess alcohol + // BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/AlcoholPoisoning.png b/Buffs/Alcohol/AlcoholPoisoning.png index 7c001df28c..224cdd155d 100644 Binary files a/Buffs/Alcohol/AlcoholPoisoning.png and b/Buffs/Alcohol/AlcoholPoisoning.png differ diff --git a/Buffs/Alcohol/FabsolVodkaBuff.cs b/Buffs/Alcohol/CirrusVodkaBuff.cs similarity index 83% rename from Buffs/Alcohol/FabsolVodkaBuff.cs rename to Buffs/Alcohol/CirrusVodkaBuff.cs index b74e8639c1..cf33f6dd41 100644 --- a/Buffs/Alcohol/FabsolVodkaBuff.cs +++ b/Buffs/Alcohol/CirrusVodkaBuff.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { - public class FabsolVodkaBuff : ModBuff + public class CirrusVodkaBuff : ModBuff { public override void SetStaticDefaults() { @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Alcohol public override void Update(Player player, ref int buffIndex) { - player.Calamity().fabsolVodka = true; + player.Calamity().cirrusVodka = true; } } } diff --git a/Buffs/Alcohol/FabsolVodkaBuff.png b/Buffs/Alcohol/CirrusVodkaBuff.png similarity index 100% rename from Buffs/Alcohol/FabsolVodkaBuff.png rename to Buffs/Alcohol/CirrusVodkaBuff.png diff --git a/Buffs/Alcohol/Trippy.cs b/Buffs/Alcohol/Trippy.cs index e791bdd796..21b5357e8e 100644 --- a/Buffs/Alcohol/Trippy.cs +++ b/Buffs/Alcohol/Trippy.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Potions.Alcohol; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class Trippy : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(OddMushroom.DamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 37acd3132c..c09847564f 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -1,6 +1,6 @@ using CalamityMod.Balancing; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -48,6 +48,12 @@ namespace CalamityMod.Buffs { player.moveSpeed -= 0.1f; } + else if (type == BuffID.Tipsy) + { + player.statDefense += 4; + player.GetCritChance() -= 2; + player.GetAttackSpeed() -= 0.1f; + } else if (type == BuffID.WellFed) { player.moveSpeed -= 0.15f; @@ -96,6 +102,10 @@ namespace CalamityMod.Buffs { player.GetDamage() -= 0.2f; } + else if (type == BuffID.Werewolf) + { + player.GetAttackSpeed() -= 0.051f; + } } public override void Update(int type, NPC npc, ref int buffIndex) @@ -104,7 +114,7 @@ namespace CalamityMod.Buffs { if (npc.Calamity().webbed < npc.buffTime[buffIndex]) npc.Calamity().webbed = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().webbed; npc.DelBuff(buffIndex); buffIndex--; @@ -113,7 +123,7 @@ namespace CalamityMod.Buffs { if (npc.Calamity().slowed < npc.buffTime[buffIndex]) npc.Calamity().slowed = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().slowed; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/DamageOverTime/AstralInfectionDebuff.png b/Buffs/DamageOverTime/AstralInfectionDebuff.png index 7b06cdb73f..857b6629de 100644 Binary files a/Buffs/DamageOverTime/AstralInfectionDebuff.png and b/Buffs/DamageOverTime/AstralInfectionDebuff.png differ diff --git a/Buffs/DamageOverTime/BrainRot.png b/Buffs/DamageOverTime/BrainRot.png index f242db9951..3210eece1e 100644 Binary files a/Buffs/DamageOverTime/BrainRot.png and b/Buffs/DamageOverTime/BrainRot.png differ diff --git a/Buffs/DamageOverTime/BurningBlood.cs b/Buffs/DamageOverTime/BurningBlood.cs index 4e93df4ebc..e8d988b9a4 100644 --- a/Buffs/DamageOverTime/BurningBlood.cs +++ b/Buffs/DamageOverTime/BurningBlood.cs @@ -63,10 +63,10 @@ namespace CalamityMod.Buffs.DamageOverTime { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, Main.rand.NextBool(8) ? 296 : 5, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.25f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.3f; - Main.dust[dust].velocity.Y -= 0.5f; + Dust blood = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, Main.rand.NextBool(8) ? 296 : 5, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.25f); + blood.noGravity = true; + blood.velocity *= 1.3f; + blood.velocity.Y -= 0.5f; } Lighting.AddLight(npc.Center, 0.08f, 0f, 0f); } diff --git a/Buffs/DamageOverTime/CrushDepth.cs b/Buffs/DamageOverTime/CrushDepth.cs index 094c92c425..b10bc709aa 100644 --- a/Buffs/DamageOverTime/CrushDepth.cs +++ b/Buffs/DamageOverTime/CrushDepth.cs @@ -53,15 +53,15 @@ namespace CalamityMod.Buffs.DamageOverTime } // Blue n black dust - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, Main.rand.NextBool(3) ? 104 : 186, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.4f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.75f; - Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; + Dust water = Dust.NewDustDirect(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, Main.rand.NextBool(3) ? 104 : 186, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.4f); + water.noGravity = true; + water.velocity *= 0.75f; + water.velocity.X *= 0.75f; + water.velocity.Y -= 1f; if (Main.rand.NextBool(4)) { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.2f; + water.noGravity = false; + water.scale *= 0.2f; } } @@ -84,15 +84,15 @@ namespace CalamityMod.Buffs.DamageOverTime BloodParticle blood = new BloodParticle(npcSize, bloodVelocity, bloodLifetime, bloodScale, bloodColor); GeneralParticleHandler.SpawnParticle(blood); } - int dust = Dust.NewDust(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, Main.rand.NextBool(3) ? 104 : 186, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.4f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.75f; - Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; + Dust water = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, Main.rand.NextBool(3) ? 104 : 186, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.4f); + water.noGravity = true; + water.velocity *= 0.75f; + water.velocity.X = water.velocity.X * 0.75f; + water.velocity.Y = water.velocity.Y - 1f; if (Main.rand.NextBool(4)) { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.2f; + water.noGravity = false; + water.scale *= 0.2f; } } } diff --git a/Buffs/DamageOverTime/DemonicFlames.cs b/Buffs/DamageOverTime/DemonicFlames.cs new file mode 100644 index 0000000000..7b35b79c72 --- /dev/null +++ b/Buffs/DamageOverTime/DemonicFlames.cs @@ -0,0 +1,78 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class DemonicFlames : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().demonicFlames = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().demonicFlames < npc.buffTime[buffIndex]) + npc.Calamity().demonicFlames = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + + internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) + { + Player Player = drawInfo.drawPlayer; + + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, ModContent.DustType()); + dust.noGravity = true; + dust.velocity = new Vector2(0, Main.rand.NextFloat(-4f, -8f)).RotatedByRandom(0.3f) + Player.velocity; + dust.scale = Main.rand.NextFloat(0.8f, 1.2f); + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.noLightEmittence = true; + for (int i = 0; i < 2; i++) + { + Vector2 sparkVel = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-1f, -3f)); + Particle sparks = new VelChangingSpark(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Player.height / 2), sparkVel + Player.velocity, new Vector2(-sparkVel.X * 0.5f, sparkVel.Y * 2) * 3.5f, "CalamityMod/Particles/SmallBloom", Main.rand.Next(13, 20 + 1), Main.rand.NextFloat(0.1f, 0.25f) * 0.5f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.45f, 0.055f); + GeneralParticleHandler.SpawnParticle(sparks); + } + } + Lighting.AddLight(Player.Center, Color.MediumOrchid.ToVector3()); + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, ModContent.DustType()); + dust.noGravity = true; + dust.velocity = new Vector2(0, Main.rand.NextFloat(-4f, -8f)).RotatedByRandom(0.3f) + npc.velocity; + dust.scale = Main.rand.NextFloat(0.8f, 1.2f); + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.noLightEmittence = true; + for (int i = 0; i < 2; i++) + { + Vector2 sparkVel = new Vector2(Main.rand.NextFloat(-npc.width / 6, npc.width / 6), Main.rand.NextFloat(-npc.height / 20, -npc.height / 17)); + Particle sparks = new VelChangingSpark(npc.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), npc.height / 2) + sparkVel * 0.5f, sparkVel + npc.velocity, new Vector2(-sparkVel.X * 0.5f, sparkVel.Y * 2) * 3.5f, "CalamityMod/Particles/SmallBloom", Main.rand.Next(13, 20 + 1), Main.rand.NextFloat(0.1f, 0.25f) * MathHelper.Lerp(Math.Max(npc.height, npc.width) / 120, 0.5f, 0.7f), (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.3f, 0.055f); + GeneralParticleHandler.SpawnParticle(sparks); + } + } + Lighting.AddLight(npc.Center, Color.MediumOrchid.ToVector3()); + } + } +} diff --git a/Buffs/DamageOverTime/DemonicFlames.png b/Buffs/DamageOverTime/DemonicFlames.png new file mode 100644 index 0000000000..a7fdaa84cc Binary files /dev/null and b/Buffs/DamageOverTime/DemonicFlames.png differ diff --git a/Buffs/DamageOverTime/HadopelagicPressure.cs b/Buffs/DamageOverTime/HadopelagicPressure.cs new file mode 100644 index 0000000000..f4edd97b85 --- /dev/null +++ b/Buffs/DamageOverTime/HadopelagicPressure.cs @@ -0,0 +1,86 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class HadopelagicPressure : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().hPressure = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().hPressure < npc.buffTime[buffIndex]) + npc.Calamity().hPressure = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + + internal static void DrawEffects(PlayerDrawSet drawInfo) + { + Player Player = drawInfo.drawPlayer; + // Blue n black dust + Dust water = Dust.NewDustDirect(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 390, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.4f); + water.noGravity = true; + water.velocity *= 0.75f; + water.velocity.X *= 0.75f; + water.velocity.Y -= 1f; + if (Main.rand.NextBool(4)) + { + water.noGravity = false; + water.scale *= 0.5f; + } + if (Main.rand.NextBool(4)) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(Player.Calamity().RandomDebuffVisualSpot, new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-3f, -4f)), Main.rand.NextBool() ? Color.DeepSkyBlue : Color.MediumBlue, new Vector2(0.8f, 1), 0, 0.09f, 0f, 45); + GeneralParticleHandler.SpawnParticle(pulse); + } + if (Main.rand.NextBool(10)) + { + Color smokeColor = Color.MediumBlue; + Particle smoke = new HeavySmokeParticle(Player.Calamity().RandomDebuffVisualSpot, new Vector2(2f, 2f).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.7f), smokeColor, 40, Main.rand.NextFloat(0.3f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); + if (Main.rand.NextBool(13)) + { + Color smokeColor = Color.MediumBlue; + Particle smoke = new HeavySmokeParticle(npcSize, new Vector2(2f, 2f).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.7f), smokeColor, 40, Main.rand.NextFloat(0.3f, 0.4f) + (0.00000013f * npc.width * npc.height), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + Dust water = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, 360, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.4f); + water.noGravity = true; + water.velocity *= 0.75f; + water.velocity.X = water.velocity.X * 0.75f; + water.velocity.Y = water.velocity.Y - 1f; + if (Main.rand.NextBool(4)) + { + water.noGravity = false; + water.scale *= 0.5f; + } + if (Main.rand.NextBool(6)) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(npcSize, new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-4.5f, -6f)), Main.rand.NextBool() ? Color.DeepSkyBlue : Color.MediumBlue, new Vector2(1f), 0, 0.12f + (0.0000007f * npc.width * npc.height), 0f, 35); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + } +} diff --git a/Buffs/DamageOverTime/HadopelagicPressure.png b/Buffs/DamageOverTime/HadopelagicPressure.png new file mode 100644 index 0000000000..ac56060a69 Binary files /dev/null and b/Buffs/DamageOverTime/HadopelagicPressure.png differ diff --git a/Buffs/DamageOverTime/HeavyBleeding.cs b/Buffs/DamageOverTime/HeavyBleeding.cs new file mode 100644 index 0000000000..340845ce9e --- /dev/null +++ b/Buffs/DamageOverTime/HeavyBleeding.cs @@ -0,0 +1,74 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class HeavyBleeding : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().heavybleeding = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().heavybleeding < npc.buffTime[buffIndex]) + npc.Calamity().heavybleeding = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + internal static void DrawEffects(PlayerDrawSet drawInfo) + { + Player player = drawInfo.drawPlayer; + var modPlayer = player.Calamity(); + + if (Main.rand.NextBool(3)) + { + Vector2 randVel = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f); + Dust dust = Dust.NewDustPerfect(modPlayer.RandomDebuffVisualSpot, 5, randVel * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.6f, 0.9f)); + dust.noGravity = false; + Particle spark = new AltSparkParticle(modPlayer.RandomDebuffVisualSpot, randVel + new Vector2(0, -4), true, 12, Main.rand.NextFloat(0.25f, 0.6f), Color.DarkRed * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(8)) + { + Particle spark = new GlowOrbParticle(modPlayer.RandomDebuffVisualSpot, new Vector2(0, 4) * Main.rand.NextFloat(0.5f, 0.7f), true, 16, Main.rand.NextFloat(0.55f, 0.8f), Color.DarkRed * 0.8f, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + 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 randVel = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f); + if (Main.rand.NextBool(5)) + { + Particle spark = new AltSparkParticle(npcSize, randVel + new Vector2(0, -4), true, 12, Main.rand.NextFloat(0.25f, 0.6f), Color.DarkRed * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Dust dust = Dust.NewDustPerfect(npcSize, 5, randVel * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.2f, 0.6f)); + dust.noGravity = false; + } + if (Main.rand.NextBool(8)) + { + Particle spark = new GlowOrbParticle(npcSize, new Vector2(0, 4) * Main.rand.NextFloat(0.5f, 0.7f), true, 16, Main.rand.NextFloat(0.55f, 0.8f), Color.DarkRed * 0.8f, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } +} diff --git a/Buffs/DamageOverTime/HeavyBleeding.png b/Buffs/DamageOverTime/HeavyBleeding.png new file mode 100644 index 0000000000..b5e2e69651 Binary files /dev/null and b/Buffs/DamageOverTime/HeavyBleeding.png differ diff --git a/Buffs/DamageOverTime/HolyFlames.cs b/Buffs/DamageOverTime/HolyFlames.cs index ca809682e8..c4936b2e2a 100644 --- a/Buffs/DamageOverTime/HolyFlames.cs +++ b/Buffs/DamageOverTime/HolyFlames.cs @@ -45,10 +45,10 @@ 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, 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; + Dust fire = Dust.NewDustDirect(dustCorner, Player.width + 4, Player.height + 4, DustID.GemTopaz, dustVel.X, dustVel.Y); + fire.noGravity = true; + fire.scale = Main.rand.NextFloat(0.7f, 1.2f); + fire.alpha = 235; } } @@ -66,10 +66,10 @@ 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, 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; + Dust fire = Dust.NewDustDirect(dustCorner, npc.width + 4, npc.height + 4, DustID.GemTopaz, dustVel.X, dustVel.Y); + fire.noGravity = true; + fire.scale = Main.rand.NextFloat(0.7f, 1.2f); + fire.alpha = 235; } Lighting.AddLight(npc.position, 0.25f, 0.25f, 0.1f); } diff --git a/Buffs/DamageOverTime/MiracleBlight.png b/Buffs/DamageOverTime/MiracleBlight.png index aec924f6c9..325fdab6d6 100644 Binary files a/Buffs/DamageOverTime/MiracleBlight.png and b/Buffs/DamageOverTime/MiracleBlight.png differ diff --git a/Buffs/DamageOverTime/Nightwither.cs b/Buffs/DamageOverTime/Nightwither.cs index 553cfc013b..a6d24f65c1 100644 --- a/Buffs/DamageOverTime/Nightwither.cs +++ b/Buffs/DamageOverTime/Nightwither.cs @@ -37,17 +37,17 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.NextBool(hasDebuffResistance ? 4 : 2)) { Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); - CritSpark spark = new CritSpark(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, (hasDebuffResistance ? 0.4f : 0.8f), 15, 2f, 1.9f); + CritSpark spark = new CritSpark(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Cyan : Color.Turquoise, Color.PaleTurquoise, (hasDebuffResistance ? 0.4f : 0.8f), 15, 2f, 1.9f); GeneralParticleHandler.SpawnParticle(spark); } for (int i = 0; i < (hasDebuffResistance ? 1 : 2); i++) { Vector2 dustCorner = Player.position - 2f * Vector2.One; Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); - int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, Main.rand.NextBool(4) ? 160 : 206, dustVel.X, dustVel.Y); - Main.dust[d].noGravity = true; - Main.dust[d].scale = hasDebuffResistance ? Main.rand.NextFloat(0.3f, 0.4f) : Main.rand.NextFloat(0.5f, 0.7f); - Main.dust[d].alpha = 235; + Dust moonDust = Dust.NewDustDirect(dustCorner, Player.width + 4, Player.height + 4, Main.rand.NextBool(4) ? 300 : 323, dustVel.X, dustVel.Y); + moonDust.noGravity = true; + moonDust.scale = hasDebuffResistance ? Main.rand.NextFloat(0.3f, 0.3f) : Main.rand.NextFloat(0.5f, 0.5f); + moonDust.alpha = 235; } } @@ -57,17 +57,17 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.NextBool(3)) { Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); - CritSpark spark = new CritSpark(npcSize, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, 0.8f, 15, 2f, 1.9f); + CritSpark spark = new CritSpark(npcSize, Vect, Main.rand.NextBool() ? Color.Cyan : Color.Turquoise, Color.PaleTurquoise, 0.8f, 15, 2f, 1.9f); GeneralParticleHandler.SpawnParticle(spark); } for (int i = 0; i < 2; i++) { Vector2 dustCorner = npc.position - 2f * Vector2.One; Vector2 dustVel = npc.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); - int d = Dust.NewDust(dustCorner, npc.width + 4, npc.height + 4, Main.rand.NextBool(4) ? 160 : 206, dustVel.X, dustVel.Y); - Main.dust[d].noGravity = true; - Main.dust[d].scale = Main.rand.NextFloat(0.6f, 0.8f); - Main.dust[d].alpha = 235; + Dust moonDust = Dust.NewDustDirect(dustCorner, npc.width + 4, npc.height + 4, Main.rand.NextBool(4) ? 300 : 323, dustVel.X, dustVel.Y); + moonDust.noGravity = true; + moonDust.scale = Main.rand.NextFloat(0.5f, 0.5f); + moonDust.alpha = 235; } } } diff --git a/Buffs/DamageOverTime/Nightwither.png b/Buffs/DamageOverTime/Nightwither.png index 7a68497f9b..648834aa00 100644 Binary files a/Buffs/DamageOverTime/Nightwither.png and b/Buffs/DamageOverTime/Nightwither.png differ diff --git a/Buffs/DamageOverTime/RancorBurn.cs b/Buffs/DamageOverTime/RancorBurn.cs deleted file mode 100644 index cab69f7bf8..0000000000 --- a/Buffs/DamageOverTime/RancorBurn.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.DamageOverTime -{ - public class RancorBurn : ModBuff - { - public override void SetStaticDefaults() - { - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - if (npc.Calamity().RancorBurnTime < npc.buffTime[buffIndex]) - npc.Calamity().RancorBurnTime = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; - } - } -} diff --git a/Buffs/DamageOverTime/RancorBurn.png b/Buffs/DamageOverTime/RancorBurn.png deleted file mode 100644 index f7e99e7e26..0000000000 Binary files a/Buffs/DamageOverTime/RancorBurn.png and /dev/null differ diff --git a/Buffs/DamageOverTime/RiptideDebuff.cs b/Buffs/DamageOverTime/RiptideDebuff.cs index 44ab9c9d92..62816f8004 100644 --- a/Buffs/DamageOverTime/RiptideDebuff.cs +++ b/Buffs/DamageOverTime/RiptideDebuff.cs @@ -36,11 +36,11 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.NextBool(14)) { - 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; - drawInfo.DustCache.Add(dust); + Dust dust = Dust.NewDustDirect(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); + dust.noGravity = false; + dust.velocity *= 1.2f; + dust.velocity.Y += 0.8f; + drawInfo.DustCache.Add(dust.dustIndex); } if (Main.rand.NextBool(9)) { diff --git a/Buffs/DamageOverTime/SearingLava.png b/Buffs/DamageOverTime/SearingLava.png index 8506acdaad..04b9685d42 100644 Binary files a/Buffs/DamageOverTime/SearingLava.png and b/Buffs/DamageOverTime/SearingLava.png differ diff --git a/Buffs/DamageOverTime/Shadowflame.cs b/Buffs/DamageOverTime/Shadowflame.cs index c67307c354..d97c8889ed 100644 --- a/Buffs/DamageOverTime/Shadowflame.cs +++ b/Buffs/DamageOverTime/Shadowflame.cs @@ -30,15 +30,15 @@ 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, 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; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 3f; + Dust flame = Dust.NewDustDirect(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); + flame.noGravity = true; + flame.velocity *= 0.75f; + flame.velocity.X *= 0.75f; + flame.velocity.Y -= 3f; if (Main.rand.NextBool(4)) { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.3f; + flame.noGravity = false; + flame.scale *= 0.3f; } } } diff --git a/Buffs/DamageOverTime/Shred.cs b/Buffs/DamageOverTime/Shred.cs index 4cdc780be8..d46d375305 100644 --- a/Buffs/DamageOverTime/Shred.cs +++ b/Buffs/DamageOverTime/Shred.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.NPCs; using CalamityMod.Particles; +using CalamityMod.Projectiles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -12,8 +13,8 @@ namespace CalamityMod.Buffs.DamageOverTime { internal const int StackFalloffFrames = 320; - // 150 DPS (30x5) per stack may seem low, but it gets boosted by ranged stats and can supercrit. - internal static int BaseDamage = 30; + // This deals 600 DPS per stack, is boosted by ranged stats and can supercrit. + internal static int BaseDamage = 120; internal static int FramesPerDamageTick = 12; public override void SetStaticDefaults() @@ -62,15 +63,20 @@ namespace CalamityMod.Buffs.DamageOverTime // This cannot be done with SimpleStrikeNPC because that would not allow for supercrits. int bleedTickDamage = (int)applicator.GetTotalDamage().ApplyTo(BaseDamage * cgn.somaShredStacks); Projectile tick = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), bleedTickDamage, 0f, applicator.whoAmI, target.whoAmI); + tick.DamageType = DamageClass.Ranged; // Uncommon for DirectStrikes, but it needs to be able to crit. - tick.Calamity().supercritHits = -1; + + // All ticks of Shred have a 3x base crit multiplier and have supercrits enabled. + CalamityGlobalProjectile cgp = tick.Calamity(); + cgp.supercritHits = -1; + cgp.bonusCritDamage += 1f; } } } internal static void DrawEffects(Player player) { - + // TODO -- Players inflicted with Shred don't display any visuals. } // Enemies suffering from Soma Prime's Shred spray blood like Violence diff --git a/Buffs/DamageOverTime/SulphuricPoisoning.cs b/Buffs/DamageOverTime/SulphuricPoisoning.cs index ebf3b5af1d..f71550c714 100644 --- a/Buffs/DamageOverTime/SulphuricPoisoning.cs +++ b/Buffs/DamageOverTime/SulphuricPoisoning.cs @@ -45,15 +45,15 @@ 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, 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; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; + Dust microbe = Dust.NewDustDirect(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); + microbe.noGravity = true; + microbe.velocity *= 0.75f; + microbe.velocity.X *= 0.75f; + microbe.velocity.Y -= 1f; if (Main.rand.NextBool(4)) { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.2f; + microbe.noGravity = false; + microbe.scale *= 0.2f; } if (Main.rand.NextBool(5)) { @@ -68,15 +68,15 @@ 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, 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; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; + Dust microbe = Dust.NewDustDirect(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)); + microbe.noGravity = true; + microbe.velocity *= 0.75f; + microbe.velocity.X *= 0.75f; + microbe.velocity.Y -= 1f; if (Main.rand.NextBool(4)) { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.4f; + microbe.noGravity = false; + microbe.scale *= 0.4f; } if (Main.rand.NextBool()) { diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs new file mode 100644 index 0000000000..72910c2fa8 --- /dev/null +++ b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs @@ -0,0 +1,80 @@ +using CalamityMod.Dusts; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class TrueVulnerabilityHex : ModBuff + { + // The visual number displayed in ticks as the enemy takes damage. + public const int TickNumber = 666; + + // The exact amount True Vulnerability Hex reduces NPC life regen by. + public const int DPS = TickNumber * 6; // -3996 life regen, 1998 DPS + + 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().trueVHex = true; + + public override void Update(NPC npc, ref int buffIndex) + { + CalamityGlobalNPC cgn = npc.Calamity(); + if (cgn.trueVulnerabilityHex < npc.buffTime[buffIndex]) + { + cgn.trueVulnerabilityHex = npc.buffTime[buffIndex]; + // Set the remaining time of the fire drawer to be exactly right. + if (cgn.VulnerabilityHexFireDrawer != null) + cgn.VulnerabilityHexFireDrawer.SetLifetime = cgn.VulnerabilityHexFireDrawer.LocalTimer + cgn.trueVulnerabilityHex; + } + + // Apply immunity timer. + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) + cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.trueVulnerabilityHex; + + // Destroy the vanilla buff, we don't use it. + npc.DelBuff(buffIndex); + buffIndex--; + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + if (Main.rand.NextBool()) + { + Vector2 position = new(npc.position.X + Main.rand.NextFloat(npc.width), npc.position.Y + Main.rand.NextFloat(npc.height)); + VoidSparkParticle voidSpark = new(position, -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 10f) * Main.rand.NextFloat(10f, 18f), false, 20, Main.rand.NextFloat(0.02f, 0.05f), Main.rand.NextBool() ? Color.Black : Color.Lerp(Color.Red, Color.Magenta, 0.35f)); + GeneralParticleHandler.SpawnParticle(voidSpark); + } + } + + internal static void DrawEffects(PlayerDrawSet drawInfo) + { + Player Player = drawInfo.drawPlayer; + + if (Main.rand.NextBool()) + { + VoidSparkParticle spark2 = new VoidSparkParticle(Player.Calamity().RandomDebuffVisualSpot, -Vector2.UnitY * Main.rand.NextFloat(6f, 10f), false, Main.rand.Next(18, 27), Main.rand.NextFloat(0.015f, 0.045f), Main.rand.NextBool() ? Color.Black : 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.6f, 0.7f); + dust.velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(0.5f, 2.5f); + if (dust.type == 261) + dust.color = Color.Lerp(Color.Orange, Color.White, Main.rand.NextFloat()); + + } + } +} diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.png b/Buffs/DamageOverTime/TrueVulnerabilityHex.png new file mode 100644 index 0000000000..2793cfdc04 Binary files /dev/null and b/Buffs/DamageOverTime/TrueVulnerabilityHex.png differ diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index ef80343f1c..f4dd7d5fee 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -26,7 +27,7 @@ namespace CalamityMod.Buffs.DamageOverTime { if (npc.Calamity().vaporfied < npc.buffTime[buffIndex]) npc.Calamity().vaporfied = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().vaporfied; npc.DelBuff(buffIndex); buffIndex--; @@ -48,16 +49,16 @@ namespace CalamityMod.Buffs.DamageOverTime }); if (Main.rand.NextBool(4)) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, dustType, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; + Dust dust = Dust.NewDustDirect(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, dustType, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); + dust.noGravity = true; + dust.velocity *= 1.8f; + dust.velocity.Y -= 0.5f; if (Main.rand.NextBool(4)) { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; + dust.noGravity = false; + dust.scale *= 0.5f; } - drawInfo.DustCache.Add(dust); + drawInfo.DustCache.Add(dust.dustIndex); } } @@ -76,14 +77,14 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, dustType, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; + Dust dust = Dust.NewDustDirect(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, dustType, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3f); + dust.noGravity = true; + dust.velocity *= 1.8f; + dust.velocity.Y -= 0.5f; if (Main.rand.NextBool(4)) { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; + dust.noGravity = false; + dust.scale *= 0.5f; } } } diff --git a/Buffs/DamageOverTime/Voidfrost.cs b/Buffs/DamageOverTime/Voidfrost.cs new file mode 100644 index 0000000000..8452f0b9cb --- /dev/null +++ b/Buffs/DamageOverTime/Voidfrost.cs @@ -0,0 +1,81 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class Voidfrost : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().voidfrost = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().voidfrost < npc.buffTime[buffIndex]) + npc.Calamity().voidfrost = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + + internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) + { + Player Player = drawInfo.drawPlayer; + + if (Main.rand.NextBool(5)) + { + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + SnowflakeSparkle snowflake = new SnowflakeSparkle(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, 0.4f, 15, 2f, 1.9f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + if (Main.rand.NextBool(40)) + { + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + MediumMistParticle mist = new MediumMistParticle(Player.Calamity().RandomDebuffVisualSpot, Vect, new Color(172, 238, 255), new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f); + GeneralParticleHandler.SpawnParticle(mist); + } + Vector2 dustCorner = Player.position - 2f * Vector2.One; + Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); + Dust dust = Dust.NewDustDirect(dustCorner, Player.width + 4, Player.height + 4, Main.rand.NextBool(4) ? 20 : 113, dustVel.X, dustVel.Y); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1f, 0.3f); + dust.alpha = 10; + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); + if (Main.rand.NextBool(5)) + { + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + SnowflakeSparkle snowflake = new SnowflakeSparkle(npcSize, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, 0.8f, 15, 2f, 1.9f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + if (Main.rand.NextBool(40)) + { + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + MediumMistParticle mist = new MediumMistParticle(npcSize, Vect, new Color(172, 238, 255), new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f); + GeneralParticleHandler.SpawnParticle(mist); + } + + Vector2 dustCorner = npc.position - 2f * Vector2.One; + Vector2 dustVel = npc.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); + Dust dust = Dust.NewDustDirect(dustCorner, npc.width + 4, npc.height + 4, Main.rand.NextBool(4) ? 20 : 113, dustVel.X, dustVel.Y); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1f, 0.3f); + dust.alpha = 10; + } + } +} diff --git a/Buffs/DamageOverTime/Voidfrost.png b/Buffs/DamageOverTime/Voidfrost.png new file mode 100644 index 0000000000..7a68497f9b Binary files /dev/null and b/Buffs/DamageOverTime/Voidfrost.png differ diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 6ea2f5c298..45c6a98946 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -1,24 +1,24 @@ -using CalamityMod.NPCs; +using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; 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 { public class VulnerabilityHex : ModBuff { - // This is the visual number displayed in ticks as the enemy takes damage from this debuff. + // The visual number displayed in ticks as the enemy takes damage. public const int TickNumber = 666; - // This is the exact DPS dealt by Vulnerability Hex to NPCs. - public const int DPS = TickNumber * 4; // 2664 DPS + // The exact amount Vulnerability Hex reduces NPC life regen by. + public const int DPS = TickNumber * 4; // -2664 life regen, 1332 DPS - public const int CalamityDuration = 24; + public const int CalamityDuration = 60; public const int AflameDuration = 120; public override void SetStaticDefaults() @@ -44,7 +44,7 @@ namespace CalamityMod.Buffs.DamageOverTime } // Apply immunity timer. - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.vulnerabilityHex; // Destroy the vanilla buff, we don't use it. @@ -61,7 +61,7 @@ namespace CalamityMod.Buffs.DamageOverTime GeneralParticleHandler.SpawnParticle(spark2); } - Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, Main.rand.NextBool() ? 261 :(int)CalamityDusts.Brimstone); + 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) diff --git a/Buffs/DamageOverTime/VulnerabilityHex.png b/Buffs/DamageOverTime/VulnerabilityHex.png index 2793cfdc04..c547bc2e18 100644 Binary files a/Buffs/DamageOverTime/VulnerabilityHex.png and b/Buffs/DamageOverTime/VulnerabilityHex.png differ diff --git a/Buffs/Mounts/AndromedaBuff.cs b/Buffs/Mounts/AndromedaBuff.cs index e352ea4940..34b4fb6ce9 100644 --- a/Buffs/Mounts/AndromedaBuff.cs +++ b/Buffs/Mounts/AndromedaBuff.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Buffs.Mounts public override void Update(Player player, ref int buffIndex) { // Disables crouching with the Crouch, Crawl, and Roll Mod - Mod crouchMod = CalamityMod.Instance.crouchMod; + Mod crouchMod = ExternalMods.crouchMod; if (crouchMod != null) { // Mod Call inputs diff --git a/Buffs/Mounts/ExoTankBuff.cs b/Buffs/Mounts/ExoTankBuff.cs new file mode 100644 index 0000000000..4512f85452 --- /dev/null +++ b/Buffs/Mounts/ExoTankBuff.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.Mounts; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Mounts +{ + public class ExoTankBuff : ModBuff + { + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.mount.SetMount(ModContent.MountType(), player); + player.buffTime[buffIndex] = 10; + } + } +} diff --git a/Buffs/Mounts/ExoTankBuff.png b/Buffs/Mounts/ExoTankBuff.png new file mode 100644 index 0000000000..f5986ce912 Binary files /dev/null and b/Buffs/Mounts/ExoTankBuff.png differ diff --git a/Buffs/Placeables/CirrusBlueCandleBuff.cs b/Buffs/Placeables/CirrusBlueCandleBuff.cs index 1080599c10..96900379fe 100644 --- a/Buffs/Placeables/CirrusBlueCandleBuff.cs +++ b/Buffs/Placeables/CirrusBlueCandleBuff.cs @@ -1,15 +1,12 @@ -using Terraria; +using CalamityMod.Items.Placeables.Furniture; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables { public class CirrusBlueCandleBuff : ModBuff - { - public static float MoveSpeedBoost = 0.1f; - public static double WingTimeBoost = 0.1D; - public static float AccelerationBoost = 0.1f; - + { public override void SetStaticDefaults() { // These settings are standard for a "opt-in eternal" buff, which has the following properties: @@ -28,7 +25,7 @@ namespace CalamityMod.Buffs.Placeables // Implementation is partially performed elsewhere using the blueCandle bool. public override void Update(Player player, ref int buffIndex) { - player.moveSpeed += MoveSpeedBoost; + player.moveSpeed += WeightlessCandle.MoveSpeedBoost; player.Calamity().blueCandle = true; } } diff --git a/Buffs/Placeables/CirrusPinkCandleBuff.cs b/Buffs/Placeables/CirrusPinkCandleBuff.cs index 8cf6bc1437..9701a42348 100644 --- a/Buffs/Placeables/CirrusPinkCandleBuff.cs +++ b/Buffs/Placeables/CirrusPinkCandleBuff.cs @@ -6,8 +6,6 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusPinkCandleBuff : ModBuff { - public static double PercentHealthPerSecond = 0.004D; - public override void SetStaticDefaults() { // These settings are standard for a "opt-in eternal" buff, which has the following properties: diff --git a/Buffs/Placeables/CirrusPurpleCandleBuff.cs b/Buffs/Placeables/CirrusPurpleCandleBuff.cs index 3ad0e23b18..1ac263a413 100644 --- a/Buffs/Placeables/CirrusPurpleCandleBuff.cs +++ b/Buffs/Placeables/CirrusPurpleCandleBuff.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Items.Placeables.Furniture; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -6,8 +7,6 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusPurpleCandleBuff : ModBuff { - public static float DefenseRatioBonus = 0.1f; - public override void SetStaticDefaults() { // These settings are standard for a "opt-in eternal" buff, which has the following properties: @@ -30,7 +29,7 @@ namespace CalamityMod.Buffs.Placeables // then multiply it by the ratio between the two. // A + B = A * ((A+B/A) float currentEffectiveness = player.DefenseEffectiveness.Value; - float desiredEffectiveness = currentEffectiveness + DefenseRatioBonus; + float desiredEffectiveness = currentEffectiveness + ResilientCandle.DefenseRatioBonus; player.DefenseEffectiveness *= desiredEffectiveness / currentEffectiveness; } } diff --git a/Buffs/Placeables/CirrusYellowCandleBuff.cs b/Buffs/Placeables/CirrusYellowCandleBuff.cs index 1b5f9a7f96..8728f074dc 100644 --- a/Buffs/Placeables/CirrusYellowCandleBuff.cs +++ b/Buffs/Placeables/CirrusYellowCandleBuff.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Items.Placeables.Furniture; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.NPC; @@ -7,8 +8,6 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusYellowCandleBuff : ModBuff { - public static float ExtraChipDamageRatio = 0.07f; - public override void SetStaticDefaults() { // These settings are standard for a "opt-in eternal" buff, which has the following properties: @@ -30,7 +29,7 @@ namespace CalamityMod.Buffs.Placeables // Yellow Candle is implemented as a dirty modifier. internal static void ModifyHitInfo_Spite(ref HitInfo info) { - int damageBoost = (int)(info.SourceDamage * ExtraChipDamageRatio); + int damageBoost = (int)(info.SourceDamage * SpitefulCandle.ExtraChipDamageRatio); info.Damage += damageBoost; } } diff --git a/Buffs/Placeables/CorruptionEffigyBuff.cs b/Buffs/Placeables/CorruptionEffigyBuff.cs index e4d2e0a39f..8214914087 100644 --- a/Buffs/Placeables/CorruptionEffigyBuff.cs +++ b/Buffs/Placeables/CorruptionEffigyBuff.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables @@ -7,10 +8,11 @@ namespace CalamityMod.Buffs.Placeables { public override void SetStaticDefaults() { + Main.buffNoSave[Type] = false; Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = false; + Main.persistentBuff[Type] = true; Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Placeables/CrimsonEffigyBuff.cs b/Buffs/Placeables/CrimsonEffigyBuff.cs index a26c9e3f4e..6cfdcee075 100644 --- a/Buffs/Placeables/CrimsonEffigyBuff.cs +++ b/Buffs/Placeables/CrimsonEffigyBuff.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables @@ -7,10 +8,11 @@ namespace CalamityMod.Buffs.Placeables { public override void SetStaticDefaults() { + Main.buffNoSave[Type] = false; Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = false; + Main.persistentBuff[Type] = true; Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Potions/CalciumBuff.cs b/Buffs/Potions/CalciumBuff.cs index 0a55b80590..5ec698247a 100644 --- a/Buffs/Potions/CalciumBuff.cs +++ b/Buffs/Potions/CalciumBuff.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Potions; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions { public class CalciumBuff : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(CalciumPotion.KnockbackResistance.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/Potions/CalciumBuff.png b/Buffs/Potions/CalciumBuff.png index dc627f4c5b..bbbc41c9d1 100644 Binary files a/Buffs/Potions/CalciumBuff.png and b/Buffs/Potions/CalciumBuff.png differ diff --git a/Buffs/Potions/GravityNormalizerBuff.png b/Buffs/Potions/GravityNormalizerBuff.png index ebeb4393ac..51f4014f22 100644 Binary files a/Buffs/Potions/GravityNormalizerBuff.png and b/Buffs/Potions/GravityNormalizerBuff.png differ diff --git a/Buffs/Potions/PhotosynthesisBuff.cs b/Buffs/Potions/PhotosynthesisBuff.cs index 202952cb86..db53347ad2 100644 --- a/Buffs/Potions/PhotosynthesisBuff.cs +++ b/Buffs/Potions/PhotosynthesisBuff.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Potions; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions { public class PhotosynthesisBuff : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(PhotosynthesisPotion.IncreasedHeartHeal); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/Potions/ShadowBuff.cs b/Buffs/Potions/ShadowBuff.cs index 72ee6c1d8b..d06152f5f2 100644 --- a/Buffs/Potions/ShadowBuff.cs +++ b/Buffs/Potions/ShadowBuff.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Potions; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions { public class ShadowBuff : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(ShadowPotion.StealthRegenBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; @@ -15,7 +19,7 @@ namespace CalamityMod.Buffs.Potions public override void Update(Player player, ref int buffIndex) { player.Calamity().shadow = true; - if (player.yoraiz0rEye < 2 && CalamityConfig.Instance.StealthInvisibility) + if (player.yoraiz0rEye < 2 && CalamityClientConfig.Instance.StealthInvisibility) player.yoraiz0rEye = 2; } } diff --git a/Buffs/Potions/Soaring.cs b/Buffs/Potions/Soaring.cs index bb5e481442..a9a75af3c5 100644 --- a/Buffs/Potions/Soaring.cs +++ b/Buffs/Potions/Soaring.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Potions; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions { public class Soaring : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(SoaringPotion.FlightBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/Potions/TeslaBuff.cs b/Buffs/Potions/TeslaBuff.cs deleted file mode 100644 index e5a8fac63b..0000000000 --- a/Buffs/Potions/TeslaBuff.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class TeslaBuff : ModBuff - { - public override void SetStaticDefaults() - { - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tesla = true; - } - } -} diff --git a/Buffs/StatBuffs/AbsorberRegen.cs b/Buffs/StatBuffs/AbsorberRegen.cs index 21e8bbfd57..67e4321129 100644 --- a/Buffs/StatBuffs/AbsorberRegen.cs +++ b/Buffs/StatBuffs/AbsorberRegen.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class AbsorberRegen : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(TheAbsorber.AuraRegenBoost.ToRegenPerSecond(), TheAbsorber.AuraDamageBoost.ToPercent(), TheAbsorber.AuraDamageReductionBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs index 41164d0898..b5deec51c2 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs @@ -13,6 +14,11 @@ namespace CalamityMod.Buffs.StatBuffs Main.buffNoSave[Type] = true; } + public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) + { + tip = base.Description.Format((AbyssalDivingSuit.PlatesAllDamageReduction - Main.LocalPlayer.Calamity().abyssalDivingSuitPlateHits * AbyssalDivingSuit.PlatesHitDecay).ToPercent()); + } + public override void Update(Player player, ref int buffIndex) { player.Calamity().abyssalDivingSuitPlates = true; diff --git a/Buffs/StatBuffs/AdrenalineMode.cs b/Buffs/StatBuffs/AdrenalineMode.cs index 2f5a6dfbb2..c74fdafa69 100644 --- a/Buffs/StatBuffs/AdrenalineMode.cs +++ b/Buffs/StatBuffs/AdrenalineMode.cs @@ -23,6 +23,11 @@ namespace CalamityMod.Buffs.StatBuffs player.Calamity().AdrenalineTrail = true; } + public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) + { + tip = base.Description.Format((1f + Main.LocalPlayer.Calamity().GetAdrenalineDamage()).Round()); + } + internal static void DrawEffects(PlayerDrawSet drawInfo) { Player Player = drawInfo.drawPlayer; @@ -35,12 +40,11 @@ namespace CalamityMod.Buffs.StatBuffs { int dustID = ModContent.DustType(); Vector2 dustVel = Player.velocity * 0.5f; - int idx = Dust.NewDust(Main.rand.NextBool(5) ? drawInfo.Position : drawInfo.Position - Player.velocity * 1.5f, Player.width, Player.height, dustID, dustVel.X, dustVel.Y); - Dust d = Main.dust[idx]; - d.scale = Main.rand.NextFloat(0.4f, 1.2f); - d.noGravity = true; - d.noLight = false; - drawInfo.DustCache.Add(idx); + Dust dust = Dust.NewDustDirect(Main.rand.NextBool(5) ? drawInfo.Position : drawInfo.Position - Player.velocity * 1.5f, Player.width, Player.height, dustID, dustVel.X, dustVel.Y); + dust.scale = Main.rand.NextFloat(0.4f, 1.2f); + dust.noGravity = true; + dust.noLight = false; + drawInfo.DustCache.Add(dust.dustIndex); } } } diff --git a/Buffs/StatBuffs/AeolianEarthBuff.cs b/Buffs/StatBuffs/AeolianEarthBuff.cs index 642c8fa8bf..b421b65b33 100644 --- a/Buffs/StatBuffs/AeolianEarthBuff.cs +++ b/Buffs/StatBuffs/AeolianEarthBuff.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Weapons.Magic; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class AeolianEarthBuff : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(PrimordialAncient.BuffDamageReductionBoost.ToPercent(), PrimordialAncient.BuffDamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.buffNoTimeDisplay[Type] = false; diff --git a/Buffs/StatBuffs/AquaticHeartWaterSpeed.cs b/Buffs/StatBuffs/AquaticHeartWaterSpeed.cs index 280f8f2f62..2a8341dc4a 100644 --- a/Buffs/StatBuffs/AquaticHeartWaterSpeed.cs +++ b/Buffs/StatBuffs/AquaticHeartWaterSpeed.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class AquaticHeartWaterSpeed : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(AquaticHeart.WaterSpeedBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/StatBuffs/BossEffects.cs b/Buffs/StatBuffs/BossEffects.cs index 46022d0e27..e32088eaa6 100644 --- a/Buffs/StatBuffs/BossEffects.cs +++ b/Buffs/StatBuffs/BossEffects.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - if (CalamityConfig.Instance.BossZen) + if (CalamityServerConfig.Instance.BossZen) tip = tip.Replace(":", ":\n" + this.GetLocalizedValue("ZenDescription")); } } diff --git a/Buffs/StatBuffs/BrutalCarnage.cs b/Buffs/StatBuffs/BrutalCarnage.cs index fc1c643160..bcb31db8f7 100644 --- a/Buffs/StatBuffs/BrutalCarnage.cs +++ b/Buffs/StatBuffs/BrutalCarnage.cs @@ -1,10 +1,14 @@ using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class BrutalCarnage : ModBuff { + public static float MeleeDamageBoost = 0.2f; + public override LocalizedText Description => base.Description.WithFormatArgs(MeleeDamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/StatBuffs/CoralSymbiosis.cs b/Buffs/StatBuffs/CoralSymbiosis.cs index 0a3e8851bf..f6292a4461 100644 --- a/Buffs/StatBuffs/CoralSymbiosis.cs +++ b/Buffs/StatBuffs/CoralSymbiosis.cs @@ -1,11 +1,14 @@ using CalamityMod.Items.Weapons.Magic; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class CoralSymbiosis : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(CoralSpout.SymbiosisDamageBuff); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/StatBuffs/EmpyreanRage.cs b/Buffs/StatBuffs/EmpyreanRage.cs deleted file mode 100644 index 9315409e24..0000000000 --- a/Buffs/StatBuffs/EmpyreanRage.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatBuffs -{ - public class EmpyreanRage : ModBuff - { - public override void SetStaticDefaults() - { - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().xRage = true; - } - } -} diff --git a/Buffs/StatBuffs/EmpyreanRage.png b/Buffs/StatBuffs/EmpyreanRage.png deleted file mode 100644 index 5db048a016..0000000000 Binary files a/Buffs/StatBuffs/EmpyreanRage.png and /dev/null differ diff --git a/Buffs/StatBuffs/Encased.cs b/Buffs/StatBuffs/Encased.cs index 251d0489a8..34013fef8b 100644 --- a/Buffs/StatBuffs/Encased.cs +++ b/Buffs/StatBuffs/Encased.cs @@ -3,12 +3,15 @@ using CalamityMod.Items.Accessories; using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class Encased : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(PermafrostsConcoction.EncasedDefenseBoost, PermafrostsConcoction.EncasedAllDamageReduction.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/StatBuffs/Encased.png b/Buffs/StatBuffs/Encased.png index e42acb62f5..d557d22cab 100644 Binary files a/Buffs/StatBuffs/Encased.png and b/Buffs/StatBuffs/Encased.png differ diff --git a/Buffs/StatBuffs/GreenJellyRegen.cs b/Buffs/StatBuffs/GreenJellyRegen.cs index 79347cf7ef..004de05df0 100644 --- a/Buffs/StatBuffs/GreenJellyRegen.cs +++ b/Buffs/StatBuffs/GreenJellyRegen.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class GreenJellyRegen : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(GrandGelatin.AuraRegenBoost.ToRegenPerSecond()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/StatBuffs/HallowedRuneDefense.cs b/Buffs/StatBuffs/HallowedRuneDefense.cs index 769359d05e..f307c99e49 100644 --- a/Buffs/StatBuffs/HallowedRuneDefense.cs +++ b/Buffs/StatBuffs/HallowedRuneDefense.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class HallowedRuneDefense : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(HallowedRune.DefenseBoost, HallowedRune.DamageReductionBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; @@ -15,8 +19,8 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.statDefense += 8; - player.endurance += 0.04f; // TODO -- is this applied too late to be affected by the DR softcap? + player.statDefense += HallowedRune.DefenseBoost; + player.endurance += HallowedRune.DamageReductionBoost; // TODO -- is this applied too late to be affected by the DR softcap? } } } diff --git a/Buffs/StatBuffs/HallowedRunePower.cs b/Buffs/StatBuffs/HallowedRunePower.cs index 227723e448..f99ddd9cc2 100644 --- a/Buffs/StatBuffs/HallowedRunePower.cs +++ b/Buffs/StatBuffs/HallowedRunePower.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class HallowedRunePower : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(HallowedRune.SummonDamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; @@ -16,7 +20,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { player.Calamity().hallowedPower = true; - player.GetDamage() += 0.1f; + player.GetDamage() += HallowedRune.SummonDamageBoost; } } } diff --git a/Buffs/StatBuffs/IceShieldBuff.cs b/Buffs/StatBuffs/IceShieldBuff.cs index 3678d17394..b652f9f936 100644 --- a/Buffs/StatBuffs/IceShieldBuff.cs +++ b/Buffs/StatBuffs/IceShieldBuff.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class IceShieldBuff : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(AquaticHeart.IceShieldAllDamageReduction.ToPercent()); + public override void SetStaticDefaults() { Main.buffNoTimeDisplay[Type] = true; diff --git a/Buffs/StatBuffs/KamiBuff.cs b/Buffs/StatBuffs/KamiBuff.cs index 00520d718e..1f0a06c940 100644 --- a/Buffs/StatBuffs/KamiBuff.cs +++ b/Buffs/StatBuffs/KamiBuff.cs @@ -1,14 +1,15 @@ using CalamityMod.Items.Weapons.Typeless; using Terraria; using Terraria.Audio; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class KamiBuff : ModBuff { - public const float RunSpeedBoost = 0.15f; - public const float RunAccelerationBoost = 0.15f; + public override LocalizedText Description => base.Description.WithFormatArgs(YanmeisKnife.RunSpeedBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/StatBuffs/Mushy.cs b/Buffs/StatBuffs/Mushy.cs index 350a64dbcf..23ae4f785c 100644 --- a/Buffs/StatBuffs/Mushy.cs +++ b/Buffs/StatBuffs/Mushy.cs @@ -1,12 +1,17 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class Mushy : ModBuff { + public static int DefenseBoost = 8; + public static int RegenBoost = 2; + public override LocalizedText Description => base.Description.WithFormatArgs(DefenseBoost, RegenBoost.ToRegenPerSecond()); + public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/StatBuffs/PhantomicEmpowerment.cs b/Buffs/StatBuffs/PhantomicEmpowerment.cs index 73fb24895c..4599d4e18f 100644 --- a/Buffs/StatBuffs/PhantomicEmpowerment.cs +++ b/Buffs/StatBuffs/PhantomicEmpowerment.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class PhantomicEmpowerment : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(PhantomicArtifact.SummonDamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; @@ -15,7 +19,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetDamage() += 0.1f; + player.GetDamage() += PhantomicArtifact.SummonDamageBoost; } } } diff --git a/Buffs/StatBuffs/PhantomicShield.cs b/Buffs/StatBuffs/PhantomicShield.cs index 9a502b69dd..dc8d920fad 100644 --- a/Buffs/StatBuffs/PhantomicShield.cs +++ b/Buffs/StatBuffs/PhantomicShield.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class PhantomicShield : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(PhantomicArtifact.DefenseBoost, PhantomicArtifact.DamageReductionBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; @@ -15,8 +19,8 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.endurance += 0.05f; // TODO -- is this applied too late to be affected by the DR softcap? - player.statDefense += 10; + player.endurance += PhantomicArtifact.DamageReductionBoost; // TODO -- is this applied too late to be affected by the DR softcap? + player.statDefense += PhantomicArtifact.DefenseBoost; } } } diff --git a/Buffs/StatBuffs/PinkJellyRegen.cs b/Buffs/StatBuffs/PinkJellyRegen.cs index 37cb15cc06..d03d159e14 100644 --- a/Buffs/StatBuffs/PinkJellyRegen.cs +++ b/Buffs/StatBuffs/PinkJellyRegen.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class PinkJellyRegen : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(LifeJelly.AuraRegenBoost.ToRegenPerSecond()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/StatBuffs/ProfanedCrystalBuff.cs b/Buffs/StatBuffs/ProfanedCrystalBuff.cs index 2663398aae..4f3e0b657d 100644 --- a/Buffs/StatBuffs/ProfanedCrystalBuff.cs +++ b/Buffs/StatBuffs/ProfanedCrystalBuff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player.Calamity().profanedCrystalBuffs) { bool empowered = player.Calamity().pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered; diff --git a/Buffs/StatBuffs/RageMode.cs b/Buffs/StatBuffs/RageMode.cs index dda0a33f09..393123c108 100644 --- a/Buffs/StatBuffs/RageMode.cs +++ b/Buffs/StatBuffs/RageMode.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -6,12 +7,15 @@ using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class RageMode : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs((1f + BalancingConstants.DefaultRageDamageBoost).ToString("N2")); + public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/StatBuffs/ReaverRage.cs b/Buffs/StatBuffs/ReaverRage.cs index 5406617ea4..11e38a84f4 100644 --- a/Buffs/StatBuffs/ReaverRage.cs +++ b/Buffs/StatBuffs/ReaverRage.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Armor.Reaver; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class ReaverRage : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(ReaverHeadTank.ReaverRageDefenseBoost, ReaverHeadTank.ReaverRageDamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; diff --git a/Buffs/StatBuffs/SandsWindBuff.cs b/Buffs/StatBuffs/SandsWindBuff.cs index 9a6052ad2d..bfdb2b619e 100644 --- a/Buffs/StatBuffs/SandsWindBuff.cs +++ b/Buffs/StatBuffs/SandsWindBuff.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Weapons.Magic; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class SandsWindBuff : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(PrimordialEarth.BuffDefenseBoost, PrimordialEarth.BuffDamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.buffNoTimeDisplay[Type] = false; diff --git a/Buffs/StatBuffs/SpiritDefense.cs b/Buffs/StatBuffs/SpiritDefense.cs index 86933e4e2b..664de50b2b 100644 --- a/Buffs/StatBuffs/SpiritDefense.cs +++ b/Buffs/StatBuffs/SpiritDefense.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class SpiritDefense : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(SpiritGlyph.DefenseBoost, SpiritGlyph.DamageReductionBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; @@ -15,8 +19,8 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.statDefense += 6; - player.endurance += 0.03f; // TODO -- is this applied too late to be affected by the DR softcap? + player.statDefense += SpiritGlyph.DefenseBoost; + player.endurance += SpiritGlyph.DamageReductionBoost; // TODO -- is this applied too late to be affected by the DR softcap? } } } diff --git a/Buffs/StatBuffs/SpiritPower.cs b/Buffs/StatBuffs/SpiritPower.cs index abc18fed2b..2233f93857 100644 --- a/Buffs/StatBuffs/SpiritPower.cs +++ b/Buffs/StatBuffs/SpiritPower.cs @@ -1,10 +1,14 @@ -using Terraria; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class SpiritPower : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs(SpiritGlyph.SummonDamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = false; @@ -15,7 +19,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetDamage() += 0.1f; + player.GetDamage() += SpiritGlyph.SummonDamageBoost; } } } diff --git a/Buffs/StatBuffs/TarraLifeRegen.cs b/Buffs/StatBuffs/TarraLifeRegen.cs index c2e48518e0..a38a9bd7f3 100644 --- a/Buffs/StatBuffs/TarraLifeRegen.cs +++ b/Buffs/StatBuffs/TarraLifeRegen.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Buffs.StatBuffs if (Main.rand.NextBool(10)) { - 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; - drawInfo.DustCache.Add(dust); + Dust dust = Dust.NewDustDirect(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); + dust.noGravity = true; + dust.velocity *= 0.75f; + dust.velocity.Y -= 0.35f; + drawInfo.DustCache.Add(dust.dustIndex); } } } diff --git a/Buffs/StatBuffs/TarraLifeRegen.png b/Buffs/StatBuffs/TarraLifeRegen.png index c4899950bb..a204331e7d 100644 Binary files a/Buffs/StatBuffs/TarraLifeRegen.png and b/Buffs/StatBuffs/TarraLifeRegen.png differ diff --git a/Buffs/StatBuffs/TarragonCloak.cs b/Buffs/StatBuffs/TarragonCloak.cs index 7c8b6be557..bcd5138b3d 100644 --- a/Buffs/StatBuffs/TarragonCloak.cs +++ b/Buffs/StatBuffs/TarragonCloak.cs @@ -1,11 +1,15 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { public class TarragonCloak : ModBuff { + public static double ContactDamageReduction = 0.5D; + public override LocalizedText Description => base.Description.WithFormatArgs(ContactDamageReduction.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/StatDebuffs/AbsorberAffliction.cs b/Buffs/StatDebuffs/AbsorberAffliction.cs index f916745edd..f166ee030d 100644 --- a/Buffs/StatDebuffs/AbsorberAffliction.cs +++ b/Buffs/StatDebuffs/AbsorberAffliction.cs @@ -27,16 +27,21 @@ namespace CalamityMod.Buffs.StatDebuffs { Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); - DirectionalPulseRing pulse = new DirectionalPulseRing(npcSize, Vector2.Zero, Main.rand.NextBool(3) ? Color.PaleGreen : Color.DarkSeaGreen, new Vector2(Main.rand.NextFloat(0.5f, 1.5f), Main.rand.NextFloat(0.5f, 1.5f)), 0, Main.rand.NextFloat(0.03f, 0.17f), 0f, 35); - GeneralParticleHandler.SpawnParticle(pulse); + Color fxColor = Color.Lerp(Color.DarkSeaGreen, Color.MediumSeaGreen, Main.rand.NextFloat(1f)); + + if (Main.rand.NextBool(3)) + { + Particle fx = new CustomSpark(npcSize, Vector2.UnitY * Main.rand.NextFloat(4, -4), "CalamityMod/Particles/Sparkle", false, (int)(Main.rand.Next(16, 26 + 1)), Main.rand.NextFloat(1.5f, 2f), fxColor, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: Main.rand.NextFloat(0.1f, 0.3f) + 0.3f); + GeneralParticleHandler.SpawnParticle(fx); + } if (Main.rand.Next(5) >= 0) { - int dust = Dust.NewDust(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, ModContent.DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 2.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity.Y -= 1.8f; - Main.dust[dust].velocity.Y *= 2.5f; - Main.dust[dust].noGravity = true; + Dust dust = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, ModContent.DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, Main.rand.NextFloat(0.8f, 1.8f)); + dust.noGravity = true; + dust.velocity.Y -= 1.8f; + dust.velocity.Y *= 2.5f; + dust.color = Main.rand.NextBool(3) ? Color.PaleGreen : Color.DarkSeaGreen; } } } diff --git a/Buffs/StatDebuffs/DoGExtremeGravity.cs b/Buffs/StatDebuffs/DoGExtremeGravity.cs index 902e5a3429..dff7c395f3 100644 --- a/Buffs/StatDebuffs/DoGExtremeGravity.cs +++ b/Buffs/StatDebuffs/DoGExtremeGravity.cs @@ -1,11 +1,16 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs { public class DoGExtremeGravity : ModBuff { + public static int MaxFlightTimeCap = 400; + public static float FlightTimeLossPercent = 0.25f; + public override LocalizedText Description => base.Description.WithFormatArgs(FlightTimeLossPercent.ToPercent()); + public override void SetStaticDefaults() { Main.buffNoTimeDisplay[Type] = true; diff --git a/Buffs/StatDebuffs/Enraged.cs b/Buffs/StatDebuffs/Enraged.cs index 864193368e..2d7ba02d4b 100644 --- a/Buffs/StatDebuffs/Enraged.cs +++ b/Buffs/StatDebuffs/Enraged.cs @@ -1,11 +1,15 @@ -using Terraria; +using CalamityMod.Items.Armor.Demonshade; +using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs { public class Enraged : ModBuff { + public override LocalizedText Description => base.Description.WithFormatArgs((1D + DemonshadeHelm.MultDamageBoost).ToString(), (1D + DemonshadeHelm.MultDamageTakenBoost).ToString()); + public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/StatDebuffs/Eutrophication.cs b/Buffs/StatDebuffs/Eutrophication.cs index fe7bb2c1f3..0f99d11480 100644 --- a/Buffs/StatDebuffs/Eutrophication.cs +++ b/Buffs/StatDebuffs/Eutrophication.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -26,7 +27,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().eutrophication < npc.buffTime[buffIndex]) npc.Calamity().eutrophication = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().eutrophication; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/FishAlert.png b/Buffs/StatDebuffs/FishAlert.png index b146b8b1bb..bd62958abd 100644 Binary files a/Buffs/StatDebuffs/FishAlert.png and b/Buffs/StatDebuffs/FishAlert.png differ diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.cs b/Buffs/StatDebuffs/GalvanicCorrosion.cs index 0d6639ee28..d8b4a6e77c 100644 --- a/Buffs/StatDebuffs/GalvanicCorrosion.cs +++ b/Buffs/StatDebuffs/GalvanicCorrosion.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().tesla < npc.buffTime[buffIndex]) npc.Calamity().tesla = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tesla; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index d1c0ed7639..ffbb2a810b 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -26,7 +27,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().gState < npc.buffTime[buffIndex]) npc.Calamity().gState = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().gState; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/IcarusFolly.cs b/Buffs/StatDebuffs/IcarusFolly.cs index aa460be72e..eba22b4121 100644 --- a/Buffs/StatDebuffs/IcarusFolly.cs +++ b/Buffs/StatDebuffs/IcarusFolly.cs @@ -3,12 +3,17 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs { public class IcarusFolly : ModBuff { + public static int MaxFlightTimeCap = 400; + public static float FlightTimeLossPercent = 0.34f; + public override LocalizedText Description => base.Description.WithFormatArgs(FlightTimeLossPercent.ToPercent()); + public override void SetStaticDefaults() { Main.debuff[Type] = true; @@ -28,11 +33,11 @@ namespace CalamityMod.Buffs.StatDebuffs if (Main.rand.NextBool(12)) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, (int)CalamityDusts.ProfanedFire, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - drawInfo.DustCache.Add(dust); + Dust dust = Dust.NewDustDirect(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, (int)CalamityDusts.ProfanedFire, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); + dust.noGravity = true; + dust.velocity *= 1.8f; + dust.velocity.Y -= 0.5f; + drawInfo.DustCache.Add(dust.dustIndex); } } } diff --git a/Buffs/StatDebuffs/KamiFlu.cs b/Buffs/StatDebuffs/KamiFlu.cs index 859091d167..a4f3908529 100644 --- a/Buffs/StatDebuffs/KamiFlu.cs +++ b/Buffs/StatDebuffs/KamiFlu.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; @@ -6,10 +7,6 @@ namespace CalamityMod.Buffs.StatDebuffs { public class KamiFlu : ModBuff { - public const float MultiplicativeDamageReduction = 0.8f; - // Hard-cap for npc speed when afflicted with this debuff. Does not affect certain NPCs and does not affect any bosses (Basically only works on boss minions). - public const float MaxNPCSpeed = 16f; - public override void SetStaticDefaults() { Main.debuff[Type] = true; @@ -21,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().kamiFlu < npc.buffTime[buffIndex]) npc.Calamity().kamiFlu = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().kamiFlu; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/PearlAura.cs b/Buffs/StatDebuffs/PearlAura.cs index b7b27ee3df..ed0232c4b2 100644 --- a/Buffs/StatDebuffs/PearlAura.cs +++ b/Buffs/StatDebuffs/PearlAura.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -19,5 +21,16 @@ namespace CalamityMod.Buffs.StatDebuffs npc.DelBuff(buffIndex); buffIndex--; } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + if (Main.rand.NextBool(4)) + { + int dustType = Main.rand.NextBool() ? DustID.GemSapphire : DustID.BlueCrystalShard; + Vector2 dustVelocity = Vector2.UnitX.RotatedBy(Main.rand.NextFloat(-MathHelper.Pi / 12f, 0f)) * (Main.rand.NextBool() ? -1f : 1f); + Dust theDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, dustType, dustVelocity.X, dustVelocity.Y); + theDust.noGravity = true; + } + } } } diff --git a/Buffs/StatDebuffs/ProfanedWeakness.cs b/Buffs/StatDebuffs/ProfanedWeakness.cs index 4a2a558c3b..e9d61ddd1a 100644 --- a/Buffs/StatDebuffs/ProfanedWeakness.cs +++ b/Buffs/StatDebuffs/ProfanedWeakness.cs @@ -1,5 +1,8 @@ -using Terraria; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Terraria; using Terraria.ModLoader; +using Microsoft.Xna.Framework; namespace CalamityMod.Buffs.StatDebuffs { @@ -11,5 +14,29 @@ namespace CalamityMod.Buffs.StatDebuffs Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; } + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().relicOfResilienceWeakness < npc.buffTime[buffIndex]) + npc.Calamity().relicOfResilienceWeakness = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); + + if (Main.rand.NextBool(5)) + { + Particle spark = new CustomSpark(npcSize, Vector2.Zero, "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(9, 22 + 1), Main.rand.NextFloat(0.4f, 0.8f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), new Vector2(1.1f, 0.8f), false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, ModContent.DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, Main.rand.NextFloat(0.9f, 1.7f)); + dust.noGravity = Main.rand.NextBool(3); + dust.color = Main.rand.NextBool() ? Color.Sienna : Color.Goldenrod; + } + } } } diff --git a/Buffs/StatDebuffs/TemporalSadness.cs b/Buffs/StatDebuffs/TemporalSadness.cs index 329546014b..b3eb4099dc 100644 --- a/Buffs/StatDebuffs/TemporalSadness.cs +++ b/Buffs/StatDebuffs/TemporalSadness.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().tSad < npc.buffTime[buffIndex]) npc.Calamity().tSad = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tSad; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/TimeDistortion.cs b/Buffs/StatDebuffs/TimeDistortion.cs index 4156fa9434..95a1cf23fa 100644 --- a/Buffs/StatDebuffs/TimeDistortion.cs +++ b/Buffs/StatDebuffs/TimeDistortion.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().timeSlow < npc.buffTime[buffIndex]) npc.Calamity().timeSlow = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().timeSlow; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/WitherDebuff.cs b/Buffs/StatDebuffs/WitherDebuff.cs index 9a0a5a9e55..bc161eae70 100644 --- a/Buffs/StatDebuffs/WitherDebuff.cs +++ b/Buffs/StatDebuffs/WitherDebuff.cs @@ -1,12 +1,14 @@ -using Terraria; +using CalamityMod.Items.Weapons.Melee; +using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs { public class WitherDebuff : ModBuff { - public static int DefenseReduction = 20; + public override LocalizedText Description => base.Description.WithFormatArgs(RemsRevenge.WitherDefenseReduction); public override void SetStaticDefaults() { diff --git a/Buffs/Summon/AbandonedSlimeBuff.cs b/Buffs/Summon/AbandonedSlimeBuff.cs index 7ffb20bb40..d8cf35e9ea 100644 --- a/Buffs/Summon/AbandonedSlimeBuff.cs +++ b/Buffs/Summon/AbandonedSlimeBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon; -using Terraria; +using CalamityMod.Projectiles.Summon; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class AbandonedSlimeBuff : ModBuff + public class AbandonedSlimeBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.aSlime = true; - } - if (!modPlayer.aSlime) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.aSlime; } } diff --git a/Buffs/Summon/AmphibiansGuitarBuff.cs b/Buffs/Summon/AmphibiansGuitarBuff.cs new file mode 100644 index 0000000000..ea872eb159 --- /dev/null +++ b/Buffs/Summon/AmphibiansGuitarBuff.cs @@ -0,0 +1,32 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class AmphibiansGuitarBuff : 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.AmphibiansGuitarBool = true; + + if (!modPlayer.AmphibiansGuitarBool) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + player.buffTime[buffIndex] = 18000; + } + } +} diff --git a/Buffs/Summon/AmphibiansGuitarBuff.png b/Buffs/Summon/AmphibiansGuitarBuff.png new file mode 100644 index 0000000000..ac1ec03d0a Binary files /dev/null and b/Buffs/Summon/AmphibiansGuitarBuff.png differ diff --git a/Buffs/Summon/AncientMineralSharkBuff.cs b/Buffs/Summon/AncientMineralSharkBuff.cs index 14df6894cd..420894ce2e 100644 --- a/Buffs/Summon/AncientMineralSharkBuff.cs +++ b/Buffs/Summon/AncientMineralSharkBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class AncientMineralSharkBuff : ModBuff + public class AncientMineralSharkBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.apexShark = true; - } - if (!modPlayer.apexShark) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.apexShark; } } diff --git a/Buffs/Summon/AquaticStar.cs b/Buffs/Summon/AquaticStar.cs index 114c4c7817..c5d53efb0a 100644 --- a/Buffs/Summon/AquaticStar.cs +++ b/Buffs/Summon/AquaticStar.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class AquaticStar : ModBuff + public class AquaticStar : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.aquaticStar = true; - if (!modPlayer.aquaticStar) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - player.buffTime[buffIndex] = 18000; - } + protected override ref bool MinionBool => ref BuffModdedOwner.aquaticStar; } } diff --git a/Buffs/Summon/AstralProbeBuff.cs b/Buffs/Summon/AstralProbeBuff.cs index fcd8bab67b..89795f563e 100644 --- a/Buffs/Summon/AstralProbeBuff.cs +++ b/Buffs/Summon/AstralProbeBuff.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class AstralProbeBuff : ModBuff + public class AstralProbeBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.astralProbe = true; - if (!modPlayer.astralProbe) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - player.buffTime[buffIndex] = 18000; - } + protected override ref bool MinionBool => ref BuffModdedOwner.astralProbe; } } diff --git a/Buffs/Summon/BabyBloodCrawlerBuff.cs b/Buffs/Summon/BabyBloodCrawlerBuff.cs index 5946f92508..6c7170b7b0 100644 --- a/Buffs/Summon/BabyBloodCrawlerBuff.cs +++ b/Buffs/Summon/BabyBloodCrawlerBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Buffs.Summon { - public class BabyBloodCrawlerBuff : ModBuff + public class BabyBloodCrawlerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.scabRipper = true; - } - if (!modPlayer.scabRipper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.scabRipper; } } diff --git a/Buffs/Summon/BabySlimeGodBuff.cs b/Buffs/Summon/BabySlimeGodBuff.cs index 35346bdbdc..c596e06060 100644 --- a/Buffs/Summon/BabySlimeGodBuff.cs +++ b/Buffs/Summon/BabySlimeGodBuff.cs @@ -1,38 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BabySlimeGodBuff : ModBuff + public class BabySlimeGodBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sGod = true; - } - else if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sGod = true; - } - if (!modPlayer.sGod) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sGod; } } diff --git a/Buffs/Summon/BabyStormlionBuff.cs b/Buffs/Summon/BabyStormlionBuff.cs index 4de612baef..694c4dad63 100644 --- a/Buffs/Summon/BabyStormlionBuff.cs +++ b/Buffs/Summon/BabyStormlionBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BabyStormlionBuff : ModBuff + public class BabyStormlionBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.stormjaw = true; - } - if (!modPlayer.stormjaw) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.stormjaw; } } diff --git a/Buffs/Summon/BaseSummonBuff.cs b/Buffs/Summon/BaseSummonBuff.cs new file mode 100644 index 0000000000..9fede4e1a2 --- /dev/null +++ b/Buffs/Summon/BaseSummonBuff.cs @@ -0,0 +1,56 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + /// + /// An abstract class that gives the baseline code needed to make a buff dedicated to a minion. + /// + public abstract class BaseSummonBuff : ModBuff + { + /// + /// The correspondent minion's ID of this buff. + /// + protected abstract int MinionProjectileType { get; } + + /// + /// The correspondent boolean field of this minion. + /// + protected abstract ref bool MinionBool { get; } + + /// + /// The that possesses this buff (Read-only). + /// + protected Player BuffOwner { get; private set; } + + /// + /// The that possesses this buff (Read-only). + /// + protected CalamityPlayer BuffModdedOwner { get; private set; } + + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + BuffOwner ??= player; + BuffModdedOwner ??= player.Calamity(); + + if (player.ownedProjectileCounts[MinionProjectileType] > 0) + MinionBool = true; + + if (!MinionBool) + { + player.DelBuff(buffIndex); + buffIndex--; + } + + else + player.buffTime[buffIndex] = 18000; + } + } +} diff --git a/Buffs/Summon/BelladonnaSpiritBuff.cs b/Buffs/Summon/BelladonnaSpiritBuff.cs index 61ba9bfa29..5ffac7dd80 100644 --- a/Buffs/Summon/BelladonnaSpiritBuff.cs +++ b/Buffs/Summon/BelladonnaSpiritBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BelladonnaSpiritBuff : ModBuff + public class BelladonnaSpiritBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.belladonaSpirit = true; - } - if (!modPlayer.belladonaSpirit) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.belladonaSpirit; } } diff --git a/Buffs/Summon/BlackHawkBuff.cs b/Buffs/Summon/BlackHawkBuff.cs index 5ec4851c76..984828a8bc 100644 --- a/Buffs/Summon/BlackHawkBuff.cs +++ b/Buffs/Summon/BlackHawkBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BlackHawkBuff : ModBuff + public class BlackHawkBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.blackhawk = true; - } - if (!modPlayer.blackhawk) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.blackhawk; } } diff --git a/Buffs/Summon/BrimseekerBuff.cs b/Buffs/Summon/BrimseekerBuff.cs index f8d9f9d31d..13d4d0a053 100644 --- a/Buffs/Summon/BrimseekerBuff.cs +++ b/Buffs/Summon/BrimseekerBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BrimseekerBuff : ModBuff + public class BrimseekerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.brimseeker = true; - } - if (!modPlayer.brimseeker) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.brimseeker; } } diff --git a/Buffs/Summon/BrimstoneWaifu.cs b/Buffs/Summon/BrimstoneWaifu.cs index 73e099a09a..f6b12d5477 100644 --- a/Buffs/Summon/BrimstoneWaifu.cs +++ b/Buffs/Summon/BrimstoneWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BrimstoneWaifu : ModBuff + public class BrimstoneWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.bWaifu = true; - } - if (!modPlayer.bWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.bWaifu; } } diff --git a/Buffs/Summon/BrittleStar.cs b/Buffs/Summon/BrittleStar.cs index 9104dec42f..34c1c8cd7e 100644 --- a/Buffs/Summon/BrittleStar.cs +++ b/Buffs/Summon/BrittleStar.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BrittleStar : ModBuff + public class BrittleStar : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.brittleStar = true; - } - if (!modPlayer.brittleStar) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.brittleStar; } } diff --git a/Buffs/Summon/BrittleStar.png b/Buffs/Summon/BrittleStar.png index 30f00daabc..3ae1924e0d 100644 Binary files a/Buffs/Summon/BrittleStar.png and b/Buffs/Summon/BrittleStar.png differ diff --git a/Buffs/Summon/CalamarisLamentBuff.cs b/Buffs/Summon/CalamarisLamentBuff.cs index 1d02c46246..d29b919f3e 100644 --- a/Buffs/Summon/CalamarisLamentBuff.cs +++ b/Buffs/Summon/CalamarisLamentBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CalamarisLamentBuff : ModBuff + public class CalamarisLamentBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.CalamarisLament = true; - } - if (!modPlayer.CalamarisLament) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.CalamarisLament; } } diff --git a/Buffs/Summon/CausticStaffBuff.cs b/Buffs/Summon/CausticStaffBuff.cs index 25a4672d32..9b817c2c00 100644 --- a/Buffs/Summon/CausticStaffBuff.cs +++ b/Buffs/Summon/CausticStaffBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CausticStaffBuff : ModBuff + public class CausticStaffBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.causticDragon = true; - } - if (!modPlayer.causticDragon) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.causticDragon; } } diff --git a/Buffs/Summon/CinderBlossomBuff.cs b/Buffs/Summon/CinderBlossomBuff.cs index 8133494739..9e5f3e71a0 100644 --- a/Buffs/Summon/CinderBlossomBuff.cs +++ b/Buffs/Summon/CinderBlossomBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CinderBlossomBuff : ModBuff + public class CinderBlossomBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cinderBlossom = true; - } - if (!modPlayer.cinderBlossom) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cinderBlossom; } } diff --git a/Buffs/Summon/CloudyWaifu.cs b/Buffs/Summon/CloudyWaifu.cs index 0cb6162e05..4b342af8c1 100644 --- a/Buffs/Summon/CloudyWaifu.cs +++ b/Buffs/Summon/CloudyWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CloudyWaifu : ModBuff + public class CloudyWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cWaifu = true; - } - if (!modPlayer.cWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cWaifu; } } diff --git a/Buffs/Summon/Corroslime.cs b/Buffs/Summon/Corroslime.cs index c8c15edb91..ca5b6d02ee 100644 --- a/Buffs/Summon/Corroslime.cs +++ b/Buffs/Summon/Corroslime.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Corroslime : ModBuff + public class Corroslime : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cSlime = true; - } - if (!modPlayer.cSlime) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cSlime; } } diff --git a/Buffs/Summon/CorvidHarbringerBuff.cs b/Buffs/Summon/CorvidHarbringerBuff.cs index 504458767f..7b44a698e1 100644 --- a/Buffs/Summon/CorvidHarbringerBuff.cs +++ b/Buffs/Summon/CorvidHarbringerBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CorvidHarbringerBuff : ModBuff + public class CorvidHarbringerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.powerfulRaven = true; - } - if (!modPlayer.powerfulRaven) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.powerfulRaven; } } diff --git a/Buffs/Summon/CosmicEnergy.cs b/Buffs/Summon/CosmicEnergy.cs index bd29028601..5cf78293ff 100644 --- a/Buffs/Summon/CosmicEnergy.cs +++ b/Buffs/Summon/CosmicEnergy.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CosmicEnergy : ModBuff + public class CosmicEnergy : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cEnergy = true; - } - if (!modPlayer.cEnergy) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cEnergy; } } diff --git a/Buffs/Summon/CosmicViperEngineBuff.cs b/Buffs/Summon/CosmicViperEngineBuff.cs index 836dc2da24..a23c4e0a2a 100644 --- a/Buffs/Summon/CosmicViperEngineBuff.cs +++ b/Buffs/Summon/CosmicViperEngineBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CosmicViperEngineBuff : ModBuff + public class CosmicViperEngineBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cosmicViper = true; - } - if (!modPlayer.cosmicViper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cosmicViper; } } diff --git a/Buffs/Summon/CosmilampBuff.cs b/Buffs/Summon/CosmilampBuff.cs index 635914f27e..9333a1892d 100644 --- a/Buffs/Summon/CosmilampBuff.cs +++ b/Buffs/Summon/CosmilampBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CosmilampBuff : ModBuff + public class CosmilampBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cLamp = true; - } - if (!modPlayer.cLamp) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cLamp; } } diff --git a/Buffs/Summon/CosmilampBuff.png b/Buffs/Summon/CosmilampBuff.png index 71e298b541..41a50f7e2c 100644 Binary files a/Buffs/Summon/CosmilampBuff.png and b/Buffs/Summon/CosmilampBuff.png differ diff --git a/Buffs/Summon/Crimslime.cs b/Buffs/Summon/Crimslime.cs index b6d36ff83e..dc08297928 100644 --- a/Buffs/Summon/Crimslime.cs +++ b/Buffs/Summon/Crimslime.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Crimslime : ModBuff + public class Crimslime : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cSlime2 = true; - } - if (!modPlayer.cSlime2) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cSlime2; } } diff --git a/Buffs/Summon/DaedalusCrystalBuff.cs b/Buffs/Summon/DaedalusCrystalBuff.cs index e6450fb54d..5d98c76e42 100644 --- a/Buffs/Summon/DaedalusCrystalBuff.cs +++ b/Buffs/Summon/DaedalusCrystalBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DaedalusCrystalBuff : ModBuff + public class DaedalusCrystalBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.dCrystal = true; - } - if (!modPlayer.dCrystal) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.dCrystal; } } diff --git a/Buffs/Summon/DaedalusGolemBuff.cs b/Buffs/Summon/DaedalusGolemBuff.cs index ca584568e4..ecab151fcb 100644 --- a/Buffs/Summon/DaedalusGolemBuff.cs +++ b/Buffs/Summon/DaedalusGolemBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DaedalusGolemBuff : ModBuff + public class DaedalusGolemBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.daedalusGolem = true; - } - if (!modPlayer.daedalusGolem) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.daedalusGolem; } } diff --git a/Buffs/Summon/DankCreeperBuff.cs b/Buffs/Summon/DankCreeperBuff.cs index bac55737b5..f9ad39b3e8 100644 --- a/Buffs/Summon/DankCreeperBuff.cs +++ b/Buffs/Summon/DankCreeperBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DankCreeperBuff : ModBuff + public class DankCreeperBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.dCreeper = true; - } - if (!modPlayer.dCreeper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.dCreeper; } } diff --git a/Buffs/Summon/DazzlingStabberBuff.cs b/Buffs/Summon/DazzlingStabberBuff.cs index a2a20e32df..b380a4f623 100644 --- a/Buffs/Summon/DazzlingStabberBuff.cs +++ b/Buffs/Summon/DazzlingStabberBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DazzlingStabberBuff : ModBuff + public class DazzlingStabberBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.providenceStabber = true; - } - if (!modPlayer.providenceStabber) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.providenceStabber; } } diff --git a/Buffs/Summon/DazzlingStabberBuff.png b/Buffs/Summon/DazzlingStabberBuff.png index 4a2ab50bd6..81d9861087 100644 Binary files a/Buffs/Summon/DazzlingStabberBuff.png and b/Buffs/Summon/DazzlingStabberBuff.png differ diff --git a/Buffs/Summon/DemonshadeSetDevilBuff.cs b/Buffs/Summon/DemonshadeSetDevilBuff.cs index 506ed146eb..b9c589fc3a 100644 --- a/Buffs/Summon/DemonshadeSetDevilBuff.cs +++ b/Buffs/Summon/DemonshadeSetDevilBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Typeless; -using Terraria; +using CalamityMod.Projectiles.Typeless; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DemonshadeSetDevilBuff : ModBuff + public class DemonshadeSetDevilBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.rDevil = true; - } - if (!modPlayer.rDevil) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.rDevil; } } diff --git a/Buffs/Summon/EndoCooperBuff.cs b/Buffs/Summon/EndoCooperBuff.cs index 325948b2b1..0ec41d737c 100644 --- a/Buffs/Summon/EndoCooperBuff.cs +++ b/Buffs/Summon/EndoCooperBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class EndoCooperBuff : ModBuff + public class EndoCooperBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.endoCooper = true; - } - if (!modPlayer.endoCooper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.endoCooper; } } diff --git a/Buffs/Summon/EndoHydraBuff.cs b/Buffs/Summon/EndoHydraBuff.cs index 0bb3a54736..9e4e9effa3 100644 --- a/Buffs/Summon/EndoHydraBuff.cs +++ b/Buffs/Summon/EndoHydraBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class EndoHydraBuff : ModBuff + public class EndoHydraBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.endoHydra = true; - } - if (!modPlayer.endoHydra) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.endoHydra; } } diff --git a/Buffs/Summon/EntropysVigilBuff.cs b/Buffs/Summon/EntropysVigilBuff.cs index 9020e0e294..9fe6f6ced4 100644 --- a/Buffs/Summon/EntropysVigilBuff.cs +++ b/Buffs/Summon/EntropysVigilBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class EntropysVigilBuff : ModBuff + public class EntropysVigilBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cEyes = true; - } - if (!modPlayer.cEyes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cEyes; } } diff --git a/Buffs/Summon/EyeOfNightBuff.cs b/Buffs/Summon/EyeOfNightBuff.cs index 871b2d486f..3e9945b097 100644 --- a/Buffs/Summon/EyeOfNightBuff.cs +++ b/Buffs/Summon/EyeOfNightBuff.cs @@ -1,32 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class EyeOfNightBuff : ModBuff + public class EyeOfNightBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.eyeOfNight = true; - - if (modPlayer.eyeOfNight) - player.buffTime[buffIndex] = 18000; - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.eyeOfNight; } } diff --git a/Buffs/Summon/FieryDraconidBuff.cs b/Buffs/Summon/FieryDraconidBuff.cs index 023fd17a96..ae9c404d43 100644 --- a/Buffs/Summon/FieryDraconidBuff.cs +++ b/Buffs/Summon/FieryDraconidBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FieryDraconidBuff : ModBuff + public class FieryDraconidBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.aChicken = true; - } - if (!modPlayer.aChicken) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.aChicken; } } diff --git a/Buffs/Summon/FlarebatBuff.cs b/Buffs/Summon/FlarebatBuff.cs new file mode 100644 index 0000000000..7be2c4732c --- /dev/null +++ b/Buffs/Summon/FlarebatBuff.cs @@ -0,0 +1,12 @@ +using CalamityMod.Projectiles.Summon; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class FlarebatBuff : BaseSummonBuff + { + protected override int MinionProjectileType => ModContent.ProjectileType(); + + protected override ref bool MinionBool => ref BuffModdedOwner.FlarebatBool; + } +} diff --git a/Buffs/Summon/FlarebatBuff.png b/Buffs/Summon/FlarebatBuff.png new file mode 100644 index 0000000000..7ead34d654 Binary files /dev/null and b/Buffs/Summon/FlarebatBuff.png differ diff --git a/Buffs/Summon/FleshBallBuff.cs b/Buffs/Summon/FleshBallBuff.cs index a4bcc5b39a..18f8fa6cc1 100644 --- a/Buffs/Summon/FleshBallBuff.cs +++ b/Buffs/Summon/FleshBallBuff.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FleshBallBuff : ModBuff + public class FleshBallBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.fleshBall = true; - - if (modPlayer.fleshBall) - player.buffTime[buffIndex] = 18000; - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.fleshBall; } } diff --git a/Buffs/Summon/FlowersOfMortalityBuff.cs b/Buffs/Summon/FlowersOfMortalityBuff.cs index a89d37c19a..c1b03ad87a 100644 --- a/Buffs/Summon/FlowersOfMortalityBuff.cs +++ b/Buffs/Summon/FlowersOfMortalityBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FlowersOfMortalityBuff : ModBuff + public class FlowersOfMortalityBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.flowersOfMortality = true; - - if (!modPlayer.flowersOfMortality) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.flowersOfMortality; } } diff --git a/Buffs/Summon/FrostBlossomBuff.cs b/Buffs/Summon/FrostBlossomBuff.cs index 8f21d5f3e8..c7ecb20539 100644 --- a/Buffs/Summon/FrostBlossomBuff.cs +++ b/Buffs/Summon/FrostBlossomBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FrostBlossomBuff : ModBuff + public class FrostBlossomBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.frostBlossom = true; - } - if (!modPlayer.frostBlossom) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.frostBlossom; } } diff --git a/Buffs/Summon/FrostbatBuff.cs b/Buffs/Summon/FrostbatBuff.cs new file mode 100644 index 0000000000..6bc6421c8d --- /dev/null +++ b/Buffs/Summon/FrostbatBuff.cs @@ -0,0 +1,12 @@ +using CalamityMod.Projectiles.Summon; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class FrostbatBuff : BaseSummonBuff + { + protected override int MinionProjectileType => ModContent.ProjectileType(); + + protected override ref bool MinionBool => ref BuffModdedOwner.FrostbatBool; + } +} diff --git a/Buffs/Summon/FrostbatBuff.png b/Buffs/Summon/FrostbatBuff.png new file mode 100644 index 0000000000..c67a052b2f Binary files /dev/null and b/Buffs/Summon/FrostbatBuff.png differ diff --git a/Buffs/Summon/FungalClumpBuff.cs b/Buffs/Summon/FungalClumpBuff.cs index c8a3a4549e..789a4cb10c 100644 --- a/Buffs/Summon/FungalClumpBuff.cs +++ b/Buffs/Summon/FungalClumpBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Typeless; -using Terraria; +using CalamityMod.Projectiles.Typeless; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FungalClumpBuff : ModBuff + public class FungalClumpBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.fClump = true; - } - if (!modPlayer.fClump) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.fClump; } } diff --git a/Buffs/Summon/GammaHydraBuff.cs b/Buffs/Summon/GammaHydraBuff.cs index df1f299ec1..c568d7cc91 100644 --- a/Buffs/Summon/GammaHydraBuff.cs +++ b/Buffs/Summon/GammaHydraBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class GammaHydraBuff : ModBuff + public class GammaHydraBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.gammaHead = true; - } - if (!modPlayer.gammaHead) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.gammaHead; } } diff --git a/Buffs/Summon/GastricAberrationBuff.cs b/Buffs/Summon/GastricAberrationBuff.cs index e9b3abaf1a..647614065e 100644 --- a/Buffs/Summon/GastricAberrationBuff.cs +++ b/Buffs/Summon/GastricAberrationBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class GastricAberrationBuff : ModBuff + public class GastricAberrationBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.gastricBelcher = true; - } - if (!modPlayer.gastricBelcher) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.gastricBelcher; } } diff --git a/Buffs/Summon/HauntedDishesBuff.cs b/Buffs/Summon/HauntedDishesBuff.cs index d46bd34697..786db9d8ba 100644 --- a/Buffs/Summon/HauntedDishesBuff.cs +++ b/Buffs/Summon/HauntedDishesBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class HauntedDishesBuff : ModBuff + public class HauntedDishesBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.hauntedDishes = true; - } - if (!modPlayer.hauntedDishes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.hauntedDishes; } } diff --git a/Buffs/Summon/HermitCrab.cs b/Buffs/Summon/HermitCrab.cs index 56b92d5bea..8d154acb76 100644 --- a/Buffs/Summon/HermitCrab.cs +++ b/Buffs/Summon/HermitCrab.cs @@ -1,36 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class HermitCrab : ModBuff + public class HermitCrab : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.hCrab = true; - } - - if (!modPlayer.hCrab) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.hCrab; } } diff --git a/Buffs/Summon/Herring.cs b/Buffs/Summon/Herring.cs index 4824c98315..50b2a661e2 100644 --- a/Buffs/Summon/Herring.cs +++ b/Buffs/Summon/Herring.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Herring : ModBuff + public class Herring : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.herring = true; - } - if (!modPlayer.herring) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.herring; } } diff --git a/Buffs/Summon/HowlTrio.cs b/Buffs/Summon/HowlTrio.cs index 262846cd50..c5b2aa85ba 100644 --- a/Buffs/Summon/HowlTrio.cs +++ b/Buffs/Summon/HowlTrio.cs @@ -1,38 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class HowlTrio : ModBuff + public class HowlTrio : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - int howl = ModContent.ProjectileType(); - int calcifer = ModContent.ProjectileType(); - int turnip = ModContent.ProjectileType(); - if (player.ownedProjectileCounts[howl] > 0 || player.ownedProjectileCounts[calcifer] > 0 || player.ownedProjectileCounts[turnip] > 0) - { - modPlayer.howlTrio = true; - } - if (!modPlayer.howlTrio) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.howlTrio; } } diff --git a/Buffs/Summon/HydrothermicVentBuff.cs b/Buffs/Summon/HydrothermicVentBuff.cs index a4e32b31e5..12b336d0d9 100644 --- a/Buffs/Summon/HydrothermicVentBuff.cs +++ b/Buffs/Summon/HydrothermicVentBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class HydrothermicVentBuff : ModBuff + public class HydrothermicVentBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cSpirit = true; - } - if (!modPlayer.cSpirit) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cSpirit; } } diff --git a/Buffs/Summon/IceClasperBuff.cs b/Buffs/Summon/IceClasperBuff.cs index 8c25f49849..d5961ee0a2 100644 --- a/Buffs/Summon/IceClasperBuff.cs +++ b/Buffs/Summon/IceClasperBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class IceClasperBuff : ModBuff + public class IceClasperBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.IceClasperBool = true; - } - if (!modPlayer.IceClasperBool) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.IceClasperBool; } } diff --git a/Buffs/Summon/IgneousExaltationBuff.cs b/Buffs/Summon/IgneousExaltationBuff.cs index 3c12f97a0c..99c69b9529 100644 --- a/Buffs/Summon/IgneousExaltationBuff.cs +++ b/Buffs/Summon/IgneousExaltationBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class IgneousExaltationBuff : ModBuff + public class IgneousExaltationBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.igneousExaltation = true; - } - if (!modPlayer.providenceStabber) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.igneousExaltation; } } diff --git a/Buffs/Summon/KalandraMirrorBuff.cs b/Buffs/Summon/KalandraMirrorBuff.cs index 6882b77d11..ba298f547d 100644 --- a/Buffs/Summon/KalandraMirrorBuff.cs +++ b/Buffs/Summon/KalandraMirrorBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; -using Terraria; +using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class KalandraMirrorBuff : ModBuff + public class KalandraMirrorBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.KalandraMirror = true; - } - if (!modPlayer.KalandraMirror) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.KalandraMirror; } } diff --git a/Buffs/Summon/KingofConstellationsBuff.cs b/Buffs/Summon/KingofConstellationsBuff.cs index bb837dd790..8d26d427b6 100644 --- a/Buffs/Summon/KingofConstellationsBuff.cs +++ b/Buffs/Summon/KingofConstellationsBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class KingofConstellationsBuff : ModBuff + public class KingofConstellationsBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.celestialDragons = true; - } - if (!modPlayer.celestialDragons) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.celestialDragons; } } diff --git a/Buffs/Summon/LegionofCelestiaBuff.cs b/Buffs/Summon/LegionofCelestiaBuff.cs index 9157620388..507bc2ee3b 100644 --- a/Buffs/Summon/LegionofCelestiaBuff.cs +++ b/Buffs/Summon/LegionofCelestiaBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class LegionofCelestiaBuff : ModBuff + public class LegionofCelestiaBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.eAxe = true; - } - if (!modPlayer.eAxe) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.eAxe; } } diff --git a/Buffs/Summon/LegionofCelestiaBuff.png b/Buffs/Summon/LegionofCelestiaBuff.png index de0d03d3fb..cc01f8a964 100644 Binary files a/Buffs/Summon/LegionofCelestiaBuff.png and b/Buffs/Summon/LegionofCelestiaBuff.png differ diff --git a/Buffs/Summon/LilPlaguebringerBuff.cs b/Buffs/Summon/LilPlaguebringerBuff.cs index 2fee31b83f..cb8777825a 100644 --- a/Buffs/Summon/LilPlaguebringerBuff.cs +++ b/Buffs/Summon/LilPlaguebringerBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class LilPlaguebringerBuff : ModBuff + public class LilPlaguebringerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.plaguebringerPatronSummon = true; - } - if (!modPlayer.plaguebringerPatronSummon) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.plaguebringerPatronSummon; } } diff --git a/Buffs/Summon/LiliesOfFinalityBuff.cs b/Buffs/Summon/LiliesOfFinalityBuff.cs index 77fe068705..0ffd82caec 100644 --- a/Buffs/Summon/LiliesOfFinalityBuff.cs +++ b/Buffs/Summon/LiliesOfFinalityBuff.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class LiliesOfFinalityBuff : ModBuff + public class LiliesOfFinalityBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - 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; - } + protected override ref bool MinionBool => ref BuffModdedOwner.LiliesOfFinalityBool; } } diff --git a/Buffs/Summon/MagicHatBuff.cs b/Buffs/Summon/MagicHatBuff.cs index c0533f5edd..5a51f5acf6 100644 --- a/Buffs/Summon/MagicHatBuff.cs +++ b/Buffs/Summon/MagicHatBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon.Umbrella; -using Terraria; +using CalamityMod.Projectiles.Summon.Umbrella; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MagicHatBuff : ModBuff + public class MagicHatBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.magicHat = true; - } - if (!modPlayer.magicHat) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.magicHat; } } diff --git a/Buffs/Summon/Mechworm.cs b/Buffs/Summon/Mechworm.cs index 8bfb0258da..56abef6ff2 100644 --- a/Buffs/Summon/Mechworm.cs +++ b/Buffs/Summon/Mechworm.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Mechworm : ModBuff + public class Mechworm : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.mWorm = true; - } - if (!modPlayer.mWorm) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.mWorm; } } diff --git a/Buffs/Summon/MidnightSunBuff.cs b/Buffs/Summon/MidnightSunBuff.cs index 60b6001716..bf240c6dca 100644 --- a/Buffs/Summon/MidnightSunBuff.cs +++ b/Buffs/Summon/MidnightSunBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MidnightSunBuff : ModBuff + public class MidnightSunBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.midnightUFO = true; - } - if (!modPlayer.midnightUFO) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.midnightUFO; } } diff --git a/Buffs/Summon/MiniPlaguebringerBuff.cs b/Buffs/Summon/MiniPlaguebringerBuff.cs index 2e983f4e9c..6a392f2b2b 100644 --- a/Buffs/Summon/MiniPlaguebringerBuff.cs +++ b/Buffs/Summon/MiniPlaguebringerBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MiniPlaguebringerBuff : ModBuff + public class MiniPlaguebringerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.plaguebringerMK2 = true; - } - if (!modPlayer.plaguebringerMK2) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.plaguebringerMK2; } } diff --git a/Buffs/Summon/MiniatureEyeofCthulhu.cs b/Buffs/Summon/MiniatureEyeofCthulhu.cs index 26b7572d75..4a734fa477 100644 --- a/Buffs/Summon/MiniatureEyeofCthulhu.cs +++ b/Buffs/Summon/MiniatureEyeofCthulhu.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MiniatureEyeofCthulhu : ModBuff + public class MiniatureEyeofCthulhu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.deathstareEyeball = true; - } - if (!modPlayer.deathstareEyeball) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.deathstareEyeball; } } diff --git a/Buffs/Summon/MoonFistBuff.cs b/Buffs/Summon/MoonFistBuff.cs index 0b3203fd67..40a2b47adf 100644 --- a/Buffs/Summon/MoonFistBuff.cs +++ b/Buffs/Summon/MoonFistBuff.cs @@ -1,32 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MoonFistBuff : ModBuff + public class MoonFistBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.MoonFist = true; - - if (!modPlayer.MoonFist) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - player.buffTime[buffIndex] = 18000; - } + protected override ref bool MinionBool => ref BuffModdedOwner.MoonFist; } } diff --git a/Buffs/Summon/MountedScannerBuff.cs b/Buffs/Summon/MountedScannerBuff.cs index 9331a145d5..d19c356926 100644 --- a/Buffs/Summon/MountedScannerBuff.cs +++ b/Buffs/Summon/MountedScannerBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; -using Terraria; +using CalamityMod.Projectiles.DraedonsArsenal; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MountedScannerBuff : ModBuff + public class MountedScannerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.mountedScanner = true; - } - if (!modPlayer.mountedScanner) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.mountedScanner; } } diff --git a/Buffs/Summon/MutatedTruffleBuff.cs b/Buffs/Summon/MutatedTruffleBuff.cs index 29d7821362..5cd530461c 100644 --- a/Buffs/Summon/MutatedTruffleBuff.cs +++ b/Buffs/Summon/MutatedTruffleBuff.cs @@ -1,36 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - [LegacyName("MiniOldDukeBuff")] - public class MutatedTruffleBuff : ModBuff + public class MutatedTruffleBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.MutatedTruffleBool = true; - } - if (!modPlayer.MutatedTruffleBool) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.MutatedTruffleBool; } } diff --git a/Buffs/Summon/PerditionBuff.cs b/Buffs/Summon/PerditionBuff.cs index adbde7de97..76e7264e60 100644 --- a/Buffs/Summon/PerditionBuff.cs +++ b/Buffs/Summon/PerditionBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class PerditionBuff : ModBuff + public class PerditionBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.perditionBeacon = true; - - if (!modPlayer.perditionBeacon) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.perditionBeacon; } } diff --git a/Buffs/Summon/Phantom.cs b/Buffs/Summon/Phantom.cs index 3c81ee95a1..5d982724ee 100644 --- a/Buffs/Summon/Phantom.cs +++ b/Buffs/Summon/Phantom.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Phantom : ModBuff + public class Phantom : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.pGuy = true; - } - if (!modPlayer.pGuy) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.pGuy; } } diff --git a/Buffs/Summon/PlantationStaffBuff.cs b/Buffs/Summon/PlantationStaffBuff.cs index 9e64b840e2..6e19a8e54e 100644 --- a/Buffs/Summon/PlantationStaffBuff.cs +++ b/Buffs/Summon/PlantationStaffBuff.cs @@ -1,36 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - [LegacyName("PlantationBuff")] - public class PlantationStaffBuff : ModBuff + public class PlantationStaffBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.PlantationSummon = true; - } - if (!modPlayer.PlantationSummon) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.PlantationSummon; } } diff --git a/Buffs/Summon/PoleWarperBuff.cs b/Buffs/Summon/PoleWarperBuff.cs index 476d028e59..cc5361b6c8 100644 --- a/Buffs/Summon/PoleWarperBuff.cs +++ b/Buffs/Summon/PoleWarperBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; -using Terraria; +using CalamityMod.Projectiles.DraedonsArsenal; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class PoleWarperBuff : ModBuff + public class PoleWarperBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.poleWarper = true; - } - if (!modPlayer.poleWarper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.poleWarper; } } diff --git a/Buffs/Summon/ProfanedSoulGuardians.cs b/Buffs/Summon/ProfanedSoulGuardians.cs index f2f6e8c700..1c2222eada 100644 --- a/Buffs/Summon/ProfanedSoulGuardians.cs +++ b/Buffs/Summon/ProfanedSoulGuardians.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Buffs.Summon public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player.Calamity().profanedCrystal && !player.Calamity().profanedCrystalBuffs) tip = this.GetLocalizedValue("VanityDescription"); } diff --git a/Buffs/Summon/PuffWarriorBuff.cs b/Buffs/Summon/PuffWarriorBuff.cs index 9636a62808..8890252448 100644 --- a/Buffs/Summon/PuffWarriorBuff.cs +++ b/Buffs/Summon/PuffWarriorBuff.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class PuffWarriorBuff : ModBuff + public class PuffWarriorBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.puffWarrior = true; - - if (modPlayer.puffWarrior) - player.buffTime[buffIndex] = 18000; - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.puffWarrior; } } diff --git a/Buffs/Summon/ResurrectionButterflyBuff.cs b/Buffs/Summon/ResurrectionButterflyBuff.cs index 96a073b840..2642c412fc 100644 --- a/Buffs/Summon/ResurrectionButterflyBuff.cs +++ b/Buffs/Summon/ResurrectionButterflyBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ResurrectionButterflyBuff : ModBuff + public class ResurrectionButterflyBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.resButterfly = true; - } - if (!modPlayer.resButterfly) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.resButterfly; } } diff --git a/Buffs/Summon/SageSpiritBuff.cs b/Buffs/Summon/SageSpiritBuff.cs index d015b77085..878496cc6a 100644 --- a/Buffs/Summon/SageSpiritBuff.cs +++ b/Buffs/Summon/SageSpiritBuff.cs @@ -1,32 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SageSpiritBuff : ModBuff + public class SageSpiritBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.sageSpirit = true; - - if (modPlayer.sageSpirit) - player.buffTime[buffIndex] = 18000; - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sageSpirit; } } diff --git a/Buffs/Summon/Sandnado.cs b/Buffs/Summon/Sandnado.cs index 1d9377bc51..17cec419b3 100644 --- a/Buffs/Summon/Sandnado.cs +++ b/Buffs/Summon/Sandnado.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Sandnado : ModBuff + public class Sandnado : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sandnado = true; - } - if (!modPlayer.sandnado) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sandnado; } } diff --git a/Buffs/Summon/SandyHealingWaifu.cs b/Buffs/Summon/SandyHealingWaifu.cs index 810741be2a..9d57de49d4 100644 --- a/Buffs/Summon/SandyHealingWaifu.cs +++ b/Buffs/Summon/SandyHealingWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SandyHealingWaifu : ModBuff + public class SandyHealingWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.dWaifu = true; - } - if (!modPlayer.dWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.dWaifu; } } diff --git a/Buffs/Summon/SandyWaifu.cs b/Buffs/Summon/SandyWaifu.cs index 6fd6d1e31c..383abea36f 100644 --- a/Buffs/Summon/SandyWaifu.cs +++ b/Buffs/Summon/SandyWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SandyWaifu : ModBuff + public class SandyWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sWaifu = true; - } - if (!modPlayer.sWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sWaifu; } } diff --git a/Buffs/Summon/SarosPossessionBuff.cs b/Buffs/Summon/SarosPossessionBuff.cs index f61ba0bcb5..74791c651f 100644 --- a/Buffs/Summon/SarosPossessionBuff.cs +++ b/Buffs/Summon/SarosPossessionBuff.cs @@ -1,30 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SarosPossessionBuff : ModBuff + public class SarosPossessionBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.saros = true; - if (!modPlayer.saros) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - player.buffTime[buffIndex] = 18000; - } + protected override ref bool MinionBool => ref BuffModdedOwner.saros; } } diff --git a/Buffs/Summon/SeaSnailBuff.cs b/Buffs/Summon/SeaSnailBuff.cs index 0068dd0252..da471bc5ad 100644 --- a/Buffs/Summon/SeaSnailBuff.cs +++ b/Buffs/Summon/SeaSnailBuff.cs @@ -1,37 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SeaSnailBuff : ModBuff + public class SeaSnailBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - - - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.victideSnail = true; - } - - if (!modPlayer.victideSnail) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.victideSnail; } } diff --git a/Buffs/Summon/SeashineSwordBuff.cs b/Buffs/Summon/SeashineSwordBuff.cs new file mode 100644 index 0000000000..c45048954a --- /dev/null +++ b/Buffs/Summon/SeashineSwordBuff.cs @@ -0,0 +1,12 @@ +using CalamityMod.Projectiles.Summon; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class SeashineSwordBuff : BaseSummonBuff + { + protected override int MinionProjectileType => ModContent.ProjectileType(); + + protected override ref bool MinionBool => ref BuffModdedOwner.seashineSwordBuff; + } +} diff --git a/Buffs/Summon/SeashineSwordBuff.png b/Buffs/Summon/SeashineSwordBuff.png new file mode 100644 index 0000000000..a7b9a06f29 Binary files /dev/null and b/Buffs/Summon/SeashineSwordBuff.png differ diff --git a/Buffs/Summon/SepulcherMinionBuff.cs b/Buffs/Summon/SepulcherMinionBuff.cs index 3e96b328fa..c86abb9f8a 100644 --- a/Buffs/Summon/SepulcherMinionBuff.cs +++ b/Buffs/Summon/SepulcherMinionBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SepulcherMinionBuff : ModBuff + public class SepulcherMinionBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.sepulcher = true; - - if (!modPlayer.sepulcher) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sepulcher; } } diff --git a/Buffs/Summon/ShellfishBuff.cs b/Buffs/Summon/ShellfishBuff.cs index 816d6898ec..21f0239407 100644 --- a/Buffs/Summon/ShellfishBuff.cs +++ b/Buffs/Summon/ShellfishBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ShellfishBuff : ModBuff + public class ShellfishBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.shellfish = true; - } - if (!modPlayer.shellfish) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.shellfish; } } diff --git a/Buffs/Summon/SilvaCrystalBuff.cs b/Buffs/Summon/SilvaCrystalBuff.cs index 4479924b97..b14e48e499 100644 --- a/Buffs/Summon/SilvaCrystalBuff.cs +++ b/Buffs/Summon/SilvaCrystalBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SilvaCrystalBuff : ModBuff + public class SilvaCrystalBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sCrystal = true; - } - if (!modPlayer.sCrystal) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sCrystal; } } diff --git a/Buffs/Summon/SiriusBuff.cs b/Buffs/Summon/SiriusBuff.cs index 8f4ebc9d7f..565ab99d06 100644 --- a/Buffs/Summon/SiriusBuff.cs +++ b/Buffs/Summon/SiriusBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SiriusBuff : ModBuff + public class SiriusBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sirius = true; - } - if (!modPlayer.sirius) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sirius; } } diff --git a/Buffs/Summon/SkeletalDragonsBuff.cs b/Buffs/Summon/SkeletalDragonsBuff.cs index 36b2bd44d2..780d050c64 100644 --- a/Buffs/Summon/SkeletalDragonsBuff.cs +++ b/Buffs/Summon/SkeletalDragonsBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SkeletalDragonsBuff : ModBuff + public class SkeletalDragonsBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.dragonFamily = true; - } - if (!modPlayer.dragonFamily) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.dragonFamily; } } diff --git a/Buffs/Summon/SmallSkeletonBuff.cs b/Buffs/Summon/SmallSkeletonBuff.cs index 8c743ac30a..4c10193d9b 100644 --- a/Buffs/Summon/SmallSkeletonBuff.cs +++ b/Buffs/Summon/SmallSkeletonBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SmallSkeletonBuff : ModBuff + public class SmallSkeletonBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.necrosteocytesDudes = true; - } - if (!modPlayer.necrosteocytesDudes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.necrosteocytesDudes; } } diff --git a/Buffs/Summon/SnakeEyesBuff.cs b/Buffs/Summon/SnakeEyesBuff.cs index ed4c1729cd..f1486caacd 100644 --- a/Buffs/Summon/SnakeEyesBuff.cs +++ b/Buffs/Summon/SnakeEyesBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; -using Terraria; +using CalamityMod.Projectiles.DraedonsArsenal; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SnakeEyesBuff : ModBuff + public class SnakeEyesBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.snakeEyes = true; - } - if (!modPlayer.snakeEyes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.snakeEyes; } } diff --git a/Buffs/Summon/SolarGodSpiritBuff.cs b/Buffs/Summon/SolarGodSpiritBuff.cs index f085c6f8f5..1a35780269 100644 --- a/Buffs/Summon/SolarGodSpiritBuff.cs +++ b/Buffs/Summon/SolarGodSpiritBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SolarGodSpiritBuff : ModBuff + public class SolarGodSpiritBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.SPG = true; - } - if (!modPlayer.SPG) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.SPG; } } diff --git a/Buffs/Summon/SolarSpirit.cs b/Buffs/Summon/SolarSpirit.cs index c7f813a3eb..1deef86122 100644 --- a/Buffs/Summon/SolarSpirit.cs +++ b/Buffs/Summon/SolarSpirit.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SolarSpirit : ModBuff + public class SolarSpirit : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.SP = true; - } - if (!modPlayer.SP) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.SP; } } diff --git a/Buffs/Summon/SoulSeekerBuff.cs b/Buffs/Summon/SoulSeekerBuff.cs index b4ffd374ba..92966b7398 100644 --- a/Buffs/Summon/SoulSeekerBuff.cs +++ b/Buffs/Summon/SoulSeekerBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SoulSeekerBuff : ModBuff + public class SoulSeekerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.soulSeeker = true; - - if (!modPlayer.soulSeeker) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.soulSeeker; } } diff --git a/Buffs/Summon/StarSwallowerBuff.cs b/Buffs/Summon/StarSwallowerBuff.cs index dc4183712e..63d8e3765b 100644 --- a/Buffs/Summon/StarSwallowerBuff.cs +++ b/Buffs/Summon/StarSwallowerBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; -using Terraria; +using CalamityMod.Projectiles.DraedonsArsenal; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class StarSwallowerBuff : ModBuff + public class StarSwallowerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.starSwallowerPetFroge = true; - } - if (!modPlayer.starSwallowerPetFroge) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.starSwallowerPetFroge; } } diff --git a/Buffs/Summon/StellarTorusBuff.cs b/Buffs/Summon/StellarTorusBuff.cs index 76014bda39..41b25ab6b9 100644 --- a/Buffs/Summon/StellarTorusBuff.cs +++ b/Buffs/Summon/StellarTorusBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class StellarTorusBuff : ModBuff + public class StellarTorusBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.StellarTorus = true; - } - if (!modPlayer.StellarTorus) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.StellarTorus; } } diff --git a/Buffs/Summon/TacticalPlagueEngineBuff.cs b/Buffs/Summon/TacticalPlagueEngineBuff.cs index f4f6c8c00e..f1cccfd0e7 100644 --- a/Buffs/Summon/TacticalPlagueEngineBuff.cs +++ b/Buffs/Summon/TacticalPlagueEngineBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class TacticalPlagueEngineBuff : ModBuff + public class TacticalPlagueEngineBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.plagueEngine = true; - } - if (!modPlayer.plagueEngine) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.plagueEngine; } } diff --git a/Buffs/Summon/TundraFlameBlossomsBuff.cs b/Buffs/Summon/TundraFlameBlossomsBuff.cs index d9494c1f34..6758b79bb5 100644 --- a/Buffs/Summon/TundraFlameBlossomsBuff.cs +++ b/Buffs/Summon/TundraFlameBlossomsBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class TundraFlameBlossomsBuff : ModBuff + public class TundraFlameBlossomsBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.tundraFlameBlossom = true; - } - if (!modPlayer.tundraFlameBlossom) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.tundraFlameBlossom; } } diff --git a/Buffs/Summon/ValkyrieBuff.cs b/Buffs/Summon/ValkyrieBuff.cs index 374e2750e1..8f40f8cd7f 100644 --- a/Buffs/Summon/ValkyrieBuff.cs +++ b/Buffs/Summon/ValkyrieBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ValkyrieBuff : ModBuff + public class ValkyrieBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.aValkyrie = true; - } - if (!modPlayer.aValkyrie) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.aValkyrie; } } diff --git a/Buffs/Summon/VileFeederBuff.cs b/Buffs/Summon/VileFeederBuff.cs index abfd558b11..8620989cde 100644 --- a/Buffs/Summon/VileFeederBuff.cs +++ b/Buffs/Summon/VileFeederBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class VileFeederBuff : ModBuff + public class VileFeederBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.vileFeeder = true; - } - if (!modPlayer.vileFeeder) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.vileFeeder; } } diff --git a/Buffs/Summon/ViridVanguardBuff.cs b/Buffs/Summon/ViridVanguardBuff.cs index 8e26caefc8..51ea3391d7 100644 --- a/Buffs/Summon/ViridVanguardBuff.cs +++ b/Buffs/Summon/ViridVanguardBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ViridVanguardBuff : ModBuff + public class ViridVanguardBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.ViridVanguard = true; - } - if (!modPlayer.ViridVanguard) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.ViridVanguard; } } diff --git a/Buffs/Summon/ViriliBuff.cs b/Buffs/Summon/ViriliBuff.cs index 62b871cbff..58d382b1c6 100644 --- a/Buffs/Summon/ViriliBuff.cs +++ b/Buffs/Summon/ViriliBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ViriliBuff : ModBuff + public class ViriliBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.virili = true; - } - if (!modPlayer.virili) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.virili; } } diff --git a/Buffs/Summon/WaterWaifu.cs b/Buffs/Summon/WaterWaifu.cs index 49a08c65cd..413f5de434 100644 --- a/Buffs/Summon/WaterWaifu.cs +++ b/Buffs/Summon/WaterWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class WaterWaifu : ModBuff + public class WaterWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.slWaifu = true; - } - if (!modPlayer.slWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.slWaifu; } } diff --git a/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs b/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs index 8d52209e5a..a83ecaf402 100644 --- a/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs +++ b/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Summon.Whips public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; bool empowered = player.Calamity().pscState == (int)ProfanedSoulCrystalState.Empowered; if (empowered) { diff --git a/Buffs/Summon/WitherBlossomsBuff.cs b/Buffs/Summon/WitherBlossomsBuff.cs index 297bb0468a..af59819366 100644 --- a/Buffs/Summon/WitherBlossomsBuff.cs +++ b/Buffs/Summon/WitherBlossomsBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class WitherBlossomsBuff : ModBuff + public class WitherBlossomsBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.witherBlossom = true; - - if (!modPlayer.witherBlossom) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.witherBlossom; } } diff --git a/Buffs/Summon/WulfrumDroidBuff.cs b/Buffs/Summon/WulfrumDroidBuff.cs index feb60ab4a4..6f4cc17b5c 100644 --- a/Buffs/Summon/WulfrumDroidBuff.cs +++ b/Buffs/Summon/WulfrumDroidBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class WulfrumDroidBuff : ModBuff + public class WulfrumDroidBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.wDroid = true; - } - if (!modPlayer.wDroid) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.wDroid; } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index d6bf2153d4..1dbe674969 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4,6 +4,8 @@ using System.Linq; using CalamityMod.Balancing; using CalamityMod.BiomeManagers; using CalamityMod.Buffs; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; @@ -15,18 +17,27 @@ using CalamityMod.Events; using CalamityMod.FluidSimulation; using CalamityMod.Items; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor; +using CalamityMod.Items.Armor.Auric; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.Brimflame; +using CalamityMod.Items.Armor.Daedalus; using CalamityMod.Items.Armor.Demonshade; +using CalamityMod.Items.Armor.Empyrean; using CalamityMod.Items.Armor.LunicCorps; using CalamityMod.Items.Armor.OmegaBlue; using CalamityMod.Items.Armor.PlagueReaper; using CalamityMod.Items.Armor.Silva; +using CalamityMod.Items.Armor.SnowRuffian; +using CalamityMod.Items.Armor.Victide; using CalamityMod.Items.Dyes; using CalamityMod.Items.Mounts; using CalamityMod.Items.Mounts.Minecarts; using CalamityMod.Items.PermanentBoosters; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.DraedonsArsenal; @@ -34,6 +45,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Weapons.Typeless; using CalamityMod.NPCs; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.Particles; @@ -45,17 +57,21 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameInput; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using Terraria.Utilities.Terraria.Utilities; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.CalPlayer { @@ -64,62 +80,104 @@ namespace CalamityMod.CalPlayer #region Variables #region No Category + /// If true, there is a boss NPC active in the world. Primary bool for checking effects that only occur if a boss is alive. public static bool areThereAnyDamnBosses = false; + /// If true, there is an event actively occuring near the player. Solely used for preventing Silva Revive's cooldown from decreasing. public static bool areThereAnyDamnEvents = false; + public float calamityBonusLuck = 0f; + /// Custom variable for tracking if the player has Potion Sickness. Used for adding Potion Sickness to the Cooldown Rack. public bool potionSick = false; + /// Custom variable for tracking how long the player has had Potion Sickness. Solely used for triggering the aura effects of Life Jelly and its upgrades. public int timePotionSick; public bool drawBossHPBar = true; public float stealthUIAlpha = 1f; public float SulphWaterUIOpacity = 1f; + /// Used to determine whether or not extra information should be displayed on the Boss Health Bar. public bool shouldDrawSmallText = true; + /// Used by The Evolution to store the type of the projectile that hit the player when its reflect is triggered. public int projTypeJustHitBy; + /// Unused variable, formerly used for displaying special SCal dialogue. public int sCalDeathCount = 0; + /// public int sCalKillCount = 0; public int actualMaxLife = 0; + /// Constant variable used for how long Chaos State is inflicted by Rod of Discord while a boss is alive. public static int chaosStateDuration = 900; + /// Constant variable used for how long Chaos State is inflicted by Normality Relocator while a boss is alive. public static int chaosStateDuration_NR = 1200; + /// Used by Sky Stabber and Gods' Paranoia to delete spiky balls when using right-click. public bool killSpikyBalls = false; public float KameiTrailXScale = 0.1f; public int KameiBladeUseDelay = 0; + /// Stores the positions of the player within the previous 4 frames. Used for drawing trail effects. public Vector2[] OldPositions = new Vector2[4]; public double contactDamageReduction = 0D; public double projectileDamageReduction = 0D; - public const float projectileMeleeWeaponMeleeSpeedMultiplier = 0f; - public bool brimlashBusterBoost = false; - public int evilSmasherBoost = 0; - public int hellbornBoost = 0; + public int hellbornShots = 0; public int searedPanCounter = 0; public int searedPanTimer = 0; + /// Used to get around the hardcoded Potion Sickness duration to allow Hadal Stew's reduced duration. public int potionTimer = 0; public bool cirrusDress = false; + /// If set to true, prevents all player dashes. Used by Ball and Chain, and Stygian Shield. public bool blockAllDashes = false; + /// Used by Flamsteed Ring to reset the player's hitbox size after dismounting. public bool resetHeightandWidth = false; + /// If set to true, completely disables ALL life regeneration effects. Used by Omega Blue armor. public bool noLifeRegen = false; public bool reducedDaybrokenDamage = false; public bool reducedNightwitherDamage = false; public float rangedAmmoCost = 1f; public float healingPotionMultiplier = 1f; + /// + /// Tracks whether or not the player is currently holding Gael's Greatsword.
+ /// Used to toggle the ability to use its unique Rage attack. + ///
public bool heldGaelsLastFrame = false; + /// + /// Tracks whether or not the player currently has Draedon's Heart equipped.
+ /// Used to reset Adrenaline when (un)equipped to prevent exploits. + ///
internal bool hadNanomachinesLastFrame = false; + public bool combHair; public bool disableVoodooSpawns = false; public bool disablePerfCystSpawns = false; public bool disableHiveCystSpawns = false; public bool disableNaturalScourgeSpawns = false; public bool disableAnahitaSpawns = false; + public int whitewaterHeal = 0; + /// Used for toggling Calamity's blazing cursor effect. public bool blazingCursorDamage = false; + /// + ///
+ /// This variable is enabled if the accessory is in vanity, granting only the visuals. + ///
public bool blazingCursorVisuals = false; public float blazingMouseAuraFade = 0f; + /// + /// General variable used for controlling the strength of screenshake this player is experiencing. Measured in pixels of offset that can be applied to the screen.
+ /// When setting this, be sure to only set it if its current value is less than the value to set, to prevent overriding an ongoing stronger screenshake with a weaker one. + ///
public float GeneralScreenShakePower = 0f; + /// Set to true when this player receives the Brimstone Locus from speaking to the Brimstone Witch for the first time. public bool GivenBrimstoneLocus = false; public DoGCartSegment[] DoGCartSegments = new DoGCartSegment[DoGCartMount.SegmentCount]; public float SmoothenedMinecartRotation; + /// + /// Set to true when a weapon performs a lunge attack, such as Biome Blade's Pure Clarity attunement.
+ /// Massively increases the player's max fall speed, and prevents fall damage. + ///
public bool LungingDown = false; + /// + /// Variable set before the player is teleported to the Underworld for Wall of Flesh in Boss Rush.
+ /// Used to teleport them back to their previous position after Wall of Flesh is defeated. + ///
public Vector2? BossRushReturnPosition = null; public float moveSpeedBonus = 0f; public int momentumCapacitorTime = 0; + /// A multiplier on the player's movement speed applied while using Momentum Capacitor. public float momentumCapacitorBoost = 0f; - public int plagueTaintedSMGDroneCooldown = 0; #endregion #region Speedrun Timer @@ -136,13 +194,30 @@ namespace CalamityMod.CalPlayer public int CurrentlyViewedFactoryID = -1; public int CurrentlyViewedChargerID = -1; public int CurrentlyViewedHologramID = -1; + public int CurrentlyViewedCanvasID = -1; + public int CurrentlyViewedCanvasType = -1; // -1 = None. 0 = 2023. 1 = 2024. public string CurrentlyViewedHologramText; #endregion - #region External variables -- Only set by Mod.Call + #region External variables -- Not used by Calamity, only via Mod.Call or reflection public int externalAbyssLight = 0; + public float externalBreathLossMultBoost = 0f; + public float externalBreathTickBoost = 0f; + public float externalFlightTimeMultBoost = 0f; + + // 25FEB2025: Ozzatron: per request, there are now three-state controls for enabling or disabling rippers + public bool? externalRageEnabled = null; + public bool? externalAdrenalineEnabled = null; + public bool externalColdImmunity = false; public bool externalHeatImmunity = false; + + // 25FEB2025: Ozzatron: per request, there is now an external bool for Auric Rejection immunity + public bool externalAuricRejectionImmunity = false; + + // 27AUG2024: Ozzatron: per request, there is now an external bool for per-player defense damage immunity + public bool externalDefenseDamageImmunity = false; + // NOTE -- With the Armageddon item removed from Calamity, this bool can only be set by other mods public bool disableAllDodges = false; #endregion @@ -180,57 +255,111 @@ namespace CalamityMod.CalPlayer #region Timer and Counter public int gaelSwipes = 0; public int arsenalCooldown = 0; + public int killModeCooldown = 0; + public bool demonSwordKillMode = false; + public bool exaltedKillMode => (demonSwordKillMode && Player.ActiveItem().type == ModContent.ItemType()); + public bool devilsDevastationKillMode => (demonSwordKillMode && Player.ActiveItem().type == ModContent.ItemType()); + /// + /// Tracks Dragoon Drizzlefish's "gel feed" mechanic in Get fixed boi.
+ /// Consuming Gel adds 1 to this counter, up to a maximum of 6, and using the weapon has a random chance to decrement the counter.
+ /// The weapon's damage is multiplied by the value in this counter. + ///
public int dragoonDrizzlefishGelBoost = 1; public int deadSunCounter = 6; public int DragonsBreathAudioCooldown = 0; public int DragonsBreathAudioCooldown2 = 0; public int PhotoAudioCooldown = 0; public int PhotoTimer = 90; + /// Cooldown variable used to add a delay between Anahita's Arpeggio uses. public int arpeggioCooldown = 0; + /// Cooldown variable which prevents using Burning Sea during its "burn-out" mechanic. + public int burningSeaBurnOut = 0; + /// + /// How many stacks of Evil Smasher's boost the player has. This increases the weapon's damage, use speed, and knockback.
+ /// Getting hit decreases this by 1. Switching to a different item resets this to 0. + ///
+ public int evilSmasherBoost = 0; + /// Cooldown variable for spawning Plague Tainted SMG's drones from left-click bullets. + public int plagueTaintedSMGDroneCooldown = 0; + /// + /// If true, this player's Brittle Star Staff minions are in their orbiting mode.
+ /// While in this mode, they orbit around the player, do not break on hits, and increase defense. + ///
public bool brittleStarBuffMode = false; + /// If set to true, initiates the dash ability of Speed Blaster or Superradiant Slaughterer. public bool sBlasterDashActivated = false; public int saharaSlicersBolts = 0; public int oceanCrestTimer = 0; + /// Pwnagehammer's hit counter, used to track when to spawn its empowered hammer. public int Holyhammer = 0; + /// Fallen Paladin's Hammer's hit counter, used to track when to spawn its empowered hammer. public int PHAThammer = 0; + /// Stellar Contempt's hit counter, used to track when to spawn its empowered hammer. public int StellarHammer = 0; + /// Galaxy Smasher's hit counter, used to track when to spawn its empowered hammer. public int GalaxyHammer = 0; + /// Variable used to apply Ontological Despoiler's nerfs when continuously using a single firing mode. + public bool despoilerNerf = false; + public int amputatorBuff = 0; + public int rOfResilienceCooldown = 0; + public int rOfResilienceEffect = 0; + public int rOfResilienceOrbitOffset = 0; + /// + /// Variable which tracks how many shots Norfleet has fired. Used to determine when to recharge.
+ /// Also used to trigger its "cheater" easter egg when attempting to fire more than 3 consecutive shots. + ///
public int NorfleetCounter = 0; public int hideOfDeusMeleeBoostTimer = 0; + /// + /// The player's alcohol level. Increased by 1 for each alcohol the player has drank, 2 for Everclear.
+ /// Is this value is greater than 3, the player is inflicted with Alcohol Poisoning. + ///
public int alcoholPoisonLevel = 0; - public int modStealthTimer; public int dashTimeMod; + /// + /// Timer variable which tracks how long the player has spent outside of Providence's border radius, in frames.
+ /// Used to scale the damage of the Holy Inferno debuff. + ///
public int hInfernoBoost = 0; public int packetTimer = 0; public int navyRodAuraTimer = 0; - public int brimLoreInfernoTimer = 0; + /// Timer variable used to time when Hydrothermic armor's set bonus inferno ring deals damage to targets. + public int hydrothermicInfernoTimer = 0; + /// Timer variable used to time when Tarragon armor's set bonus life aura deals damage to targets. public int tarraLifeAuraTimer = 0; public int bloodflareHeartTimer = 300; + /// Counter variable used to determine when to spawn Dragon Rage's fireballs. Fireballs are spawned after 10 hits. public int dragonRageHits = 0; + /// Cooldown variable for Dragon Rage's fireball spawning to prevent spamming projectiles when hitting multiple enemies simultaneously. public int dragonRageCooldown = 0; - public float modStealth = 1f; public float aquaticBoostMax = 10000f; + /// + /// Counter variable which controls Aquatic Emblem's stat boosts while underwater.
+ /// This counter starts at , and is decremented by 2 for every frame the player remains underwater, reaching maximum boosts when it hits 0. + ///
public float aquaticBoost = 0f; public int galileoCooldown = 0; - public int soundCooldown = 0; + /// Used to track Prideful Hunter's Planar Ripper's movement speed boost, along with its visual effects. public int planarSpeedBoost = 0; public int profanedSoulWeaponUsage = 0; public int profanedSoulWeaponType = 0; - public int hurtSoundTimer = 0; + /// Counter variable used to track how many hits have been landed with The Dance of Light, for the purposes of triggering its blinding flash attack. public int danceOfLightCharge = 0; - public int shadowPotCooldown = 0; + /// Cooldown variable used to prevent DoG from spamming combat text messages when hitting the player. public int dogTextCooldown = 0; public float auralisStealthCounter = 0f; public int auralisAuroraCounter = 0; public int auralisAuroraCooldown = 0; public int auralisAurora = 0; + /// + /// Counter variable used to track Necro armor's set bonus temporary revive.
+ /// When the player receives fatal damage, this value is set to 0, and then increments on each frame. + ///
public int necroReviveCounter = -1; public int hideOfDeusTimer = 0; public int murasamaHitCooldown = 0; public int giantShellPostHit = 0; public int tortShellPostHit = 0; - public int spiritOriginBullseyeShootCountdown = 0; - public int spiritOriginConvertedCrit = 0; public int RustyMedallionCooldown = 0; public int MiniSwamerCooldown = 0; public float SulphWaterPoisoningLevel; @@ -253,6 +382,9 @@ namespace CalamityMod.CalPlayer #endregion #region Sound + /// General sound cooldown variable. Used by The Microwave and Gastric Belcher Staff. + public int soundCooldown = 0; + public int hurtSoundTimer = 0; public bool playRogueStealthSound = false; public int fullRageSoundCountdownTimer = 0; private const int FullRageSoundDelay = 300; // The "Rage full" sound cannot play for 5 seconds after Rage has filled. This stops it from jittering. @@ -280,25 +412,52 @@ namespace CalamityMod.CalPlayer #endregion #region Rogue + /// The player's current rogue stealth value.
+ /// Note that the player's displayed stealth value is 100x the internal value. For example, a value of 0.1f means having 10 stealth. + ///
public float rogueStealth = 0f; + /// + /// The player's maximum rogue stealth value, from armor and accessories.
+ /// Note that the player's displayed stealth value is 100x the internal value. For example, a value of 0.1f means having 10 max stealth. + ///
public float rogueStealthMax = 0f; + /// A multiplier to the player's stealth generation when standing still. public float stealthGenStandstill = 1f; + /// A multiplier to the player's stealth generation when moving. public float stealthGenMoving = 1f; public int flatStealthLossReduction = 0; public const float StealthAccelerationCap = 1.5f; public float stealthAcceleration = 1f; public bool stealthStrikeThisFrame = false; + /// + /// If true, stealth strikes only require 50% of the player's max stealth to perform.
+ /// Used by Dark Matter Sheath and Eclipse Mirror. + ///
public bool stealthStrikeHalfCost = false; + /// + /// If true, stealth strikes only require 75% of the player's max stealth to perform.
+ /// Used by Ruin Medallion. + ///
public bool stealthStrike75Cost = false; + /// + /// If true, stealth strikes only require 85% of the player's max stealth to perform.
+ /// Used by Coin of Deceit. + ///
public bool stealthStrike85Cost = false; + /// If true, this player is wearing a rogue or all-class armor set. This bool is required in order to use rogue stealth. public bool wearingRogueArmor = false; + /// The sum of the player's stealth generation boosts from accessory modifiers. public float accStealthGenBoost = 0f; // TODO -- Stealth needs to be its own damage class so that stealth bonuses only apply to stealth strikes - public float stealthDamage = 0f; // This is extra Rogue Damage that is only added for stealth strikes. + /// + /// The extra damage boost for rogue stealth strikes.
+ /// This is obtained from a formula derived from the player's current stealth, the weapon's use time, and the player's stealth generation boosts. + ///
+ public float stealthDamage = 0f; + /// An additional damage multiplier applied to rogue stealth strikes. Used by Filthy Glove and its upgrades, and Rotten Dogtooth. public double bonusStealthDamage = 0; public float rogueVelocity = 1f; - public float rogueAmmoCost = 1f; #endregion #region Mount @@ -308,8 +467,11 @@ namespace CalamityMod.CalPlayer public bool crysthamyr = false; public bool ExoChair = false; public AndromedaPlayerState andromedaState; + /// + /// Andromeda Cripple is inflicted on the player if they dismount Flamsteed Ring while a boss is alive.
+ /// This severely slows movement and prevents the weapon from being used for its duration. + ///
public int andromedaCripple; - public const float UnicornSpeedNerfPower = 0.8f; #endregion #region Pet @@ -321,6 +483,7 @@ namespace CalamityMod.CalPlayer public bool plaguebringerBab = false; public bool rotomPet = false; public bool ladShark = false; + /// If greater than 0, causes this player to constantly spawn heart gores. public int ladHearts = 0; public bool sparks = false; public bool sirenPet = false; @@ -331,7 +494,6 @@ namespace CalamityMod.CalPlayer public bool bearPet = false; public bool kendra = false; public bool trashMan = false; - public int trashManChest = -1; public bool astrophage = false; public bool flakPet = false; public bool babyGhostBell = false; @@ -346,77 +508,122 @@ namespace CalamityMod.CalPlayer #endregion #region Rage - public bool RageEnabled => CalamityWorld.revenge || shatteredCommunity; + /// + /// If true, enables the Rage mechanic. This is normally Revengeance-exclusive, but can also be enabled by Shattered Community.
+ /// Rage is gained from staying close to enemies, or passively by using certain accessories.
+ /// When the bar is filled, Rage can be activated to provide a small damage boost over a longer duration. + ///
+ public bool RageEnabled + { + get + { + if (externalRageEnabled.HasValue) + return externalRageEnabled.Value; + return CalamityWorld.revenge || shatteredCommunity; + } + } public bool rageModeActive = false; + /// The player's current Rage level. Expressed as a percentage of maximum Rage. public float rage = 0f; public float rageMax = 100f; // 0 to 100% by default + /// + /// The duration which Rage Mode lasts.
+ /// Starts at 9 seconds, and is increased by 1 second for each upgrade, up to a maximum of 12 seconds. + ///
public int RageDuration = BalancingConstants.DefaultRageDuration; + /// Used by Shattered Community as a short cooldown for gaining Rage when taking damage. public int rageGainCooldown = 0; + /// + /// Counter variable used as a delay before the player starts losing Rage.
+ /// The player will start losing Rage if they do not generate Rage, hit an enemy, or take damage for 10 seconds. + ///
public int rageCombatFrames = 0; public float RageDamageBoost = BalancingConstants.DefaultRageDamageBoost; #endregion #region Adrenaline - public bool AdrenalineEnabled => CalamityWorld.revenge || draedonsHeart; + /// + /// If true, enables the Adrenaline mechanic. This is normally Revengeance-exclusive, but can also be enabled by Draedon's Heart.
+ /// Adrenaline is gained by avoiding taking damage while a boss is alive.
+ /// When the bar is filled, Adrenaline can be activated to provide a large damage boost over a short duration. + ///
+ public bool AdrenalineEnabled + { + get + { + if (externalAdrenalineEnabled.HasValue) + return externalAdrenalineEnabled.Value; + return CalamityWorld.revenge || draedonsHeart; + } + } public bool adrenalineModeActive = false; public bool AdrenalineTrail = false; + /// The player's current Adrenaline level. Expressed as a percentage of maximum Adrenaline. public float adrenaline = 0f; public float adrenalineMax = 100f; // 0 to 100% by default + /// Used as a short cooldown when the player takes damage before Adrenaline can begin charging again. public int adrenalinePauseTimer = 0; + /// Constant variable representing the duration which Adrenaline Mode lasts. public int AdrenalineDuration = CalamityUtils.SecondsToFrames(5); + /// Constant variable representing the duration it takes to fully charge Adrenaline. public int AdrenalineChargeTime = CalamityUtils.SecondsToFrames(30); + /// Constant variable representing the duration it takes for Adrenaline to empty if no boss is alive. public int AdrenalineFadeTime = CalamityUtils.SecondsToFrames(2); #endregion #region Defense Damage - // Ratio at which mitigated damage is converted into defense damage. - // This is a significant rework, so the ratio is much higher than the previous 0.1 / 10%. - // The net difference between incoming damage and final taken damage is what is multiplied by this ratio. - // - // Example: You have 200 defense and 25% DR and get hit for 576, on Expert. - // - // Incoming damage = 576 - // Defense reduction = 0.75 * 200 = 150 - // Damage after defense = 426 - // DR reduction = 0.25 * 426 = 106.5 - // Damage after DR = 319.5 (rounds down to 319) - // - // Net Difference = 576 - 319 = 257 - // Defense Damage = 257 * 0.3333 = 85.6581 (rounds up to 86) - // - // The player then loses 86 defense. - // DR is lost according to the ratio of defense lost versus total defense. - // In this case, that ratio is 86 / 200 = 0.43. - // The player loses 0.43 * 0.25 = 10.75% DR. + /// + /// Ratio at which mitigated damage is converted into defense damage.
+ /// The net difference between incoming damage and final taken damage is what is multiplied by this ratio.
+ /// + /// For example, if the player has 200 defense and 25% DR and gets hit for 576 damage, on Expert: + /// + /// Incoming damage = 576 + /// Defense reduction = 0.75 * 200 = 150 + /// Damage after defense = 426 + /// DR reduction = 0.25 * 426 = 106.5 + /// Damage after DR = 319.5 (rounds down to 319) + /// + /// Net Difference = 576 - 319 = 257 + /// Defense Damage = 257 * 0.3333 = 85.6581 (rounds up to 86) + /// + /// The player then loses 86 defense.
+ /// DR is lost according to the ratio of defense lost versus total defense.
+ /// In this case, that ratio is 86 / 200 = 0.43. The player loses 0.43 * 0.25 = 10.75% DR. + ///
public double defenseDamageRatio = BalancingConstants.DefaultDefenseDamageRatio; - // Current effect of defense damage, calculated as total defense damage lerped to zero over the recovery time. + /// Current effect of defense damage, calculated as total defense damage lerped to zero over the recovery time. public int CurrentDefenseDamage => (int)(totalDefenseDamage * ((float)defenseDamageRecoveryFrames / totalDefenseDamageRecoveryFrames)); - // Total defense damage inflicted. This number keeps increasing if the player is repeatedly hit during the recovery period. + /// Total defense damage inflicted. This number keeps increasing if the player is repeatedly hit during the recovery period. internal int totalDefenseDamage = 0; - // Defense damage from a single hit recovers in 60 frames, no matter how big the hit was. - // If you get hit AGAIN before you have fully recovered, 60 more frames are added to your recovery timer! + /// + /// Defense damage from a single hit recovers in 60 frames, no matter how big the hit was.
+ /// If you get hit AGAIN before you have fully recovered, 60 more frames are added to your recovery timer. + ///
internal const int DefenseDamageBaseRecoveryTime = 60; - - // The maximum possible recovery time is 15 seconds. This is to prevent annoyance where godmode defense damage never goes away. + /// + /// The maximum possible recovery time is 15 seconds.
+ /// This is to prevent annoyance where God Mode defense damage never goes away. + ///
internal const int DefenseDamageMaxRecoveryTime = 900; - - // How many frames the player will continue to be recovering from defense damage. + /// How many frames the player will continue to be recovering from defense damage. internal int defenseDamageRecoveryFrames = 0; - // The total timer of defense damage recovery that the player is currently suffering from. + /// The total timer of defense damage recovery that the player is currently suffering from. internal int totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime; - // Defense damage does not start recovering for a certain number of frames after iframes end. + /// The number of frames after immunity frames end before defense damage can start recovering. internal const int DefenseDamageRecoveryDelay = 10; - - // The current timer for how long the player must wait before defense damage begins recovering. + /// The current timer for how long the player must wait before defense damage begins recovering. internal int defenseDamageDelayFrames = 0; - // Temporary bool for whether the current instance of incoming damage to the player is one that inflicts defense damage. - // Bloodflare Core ignores this and makes every single instance of incoming damage apply defense damage. + /// + /// Temporary bool for whether the current instance of incoming damage to the player is one that inflicts defense damage.
+ /// Bloodflare Core ignores this and makes every single instance of incoming damage apply defense damage. + ///
public bool nextHitDealsDefenseDamage = false; #endregion @@ -441,7 +648,7 @@ namespace CalamityMod.CalPlayer internal float lunicCorpsShieldPartialRechargeProgress = 0f; internal bool playedLunicCorpsShieldSound = false; - //Profaned soul shield applies to psa and psc, with differing max hps for each + // Profaned soul shield applies to psa and psc, with differing max hps for each public int pSoulShieldDurability = 0; public bool pSoulShieldVisible = false; internal bool playedProfanedSoulShieldSound = false; @@ -454,41 +661,79 @@ namespace CalamityMod.CalPlayer #endregion #region Abyss + /// The amount of breath lost on each tick while in the Abyss. public float abyssBreathLossStat = 0; + /// The rate at which breath is lost while in the Abyss. public float abyssBreathLossRateStat = 0; + /// The rate at which health is decreased after running out of breath while in the Abyss. public int abyssLifeLostAtZeroBreathStat = 0; + /// The amount which defense is reduced while in the Abyss. public int abyssDefenseLossStat = 0; #endregion #region Permanent Buff + /// If true, the player has spawned in Punch Card through its one-time chat easter egg. + public bool spawnedPunchCard = false; + /// If true, the player has consumed Celestial Onion. public bool extraAccessoryML = false; - public bool eCore = false; - public bool pHeart = false; + /// If true, the player has consumed Comet Shard. public bool cShard = false; - public bool mFruit = false; + /// If true, the player has consumed Ethereal Core. + public bool eCore = false; + /// If true, the player has consumed Phantom Heart. + public bool pHeart = false; + /// If true, the player has consumed Sanguine Tangerine. public bool sTangerine = false; + /// If true, the player has consumed Miracle Fruit. + public bool mFruit = false; + /// If true, the player has consumed Tainted Cloudberry. public bool tCloudberry = false; + /// If true, the player has consumed Sacred Strawberry. public bool sStrawberry = false; + /// If true, the player has consumed Nimble Bounder. public bool nimbleBounderBoost = false; public bool revJamDrop = false; + /// If true, the player has consumed Mushroom Plasma Root. public bool rageBoostOne = false; + /// If true, the player has consumed Infernal Blood. public bool rageBoostTwo = false; + /// If true, the player has consumed Red Lightning Container. public bool rageBoostThree = false; + /// If true, the player has consumed Electrolyte Gel Pack. public bool adrenalineBoostOne = false; + /// If true, the player has consumed Starlight Fuel Cell. public bool adrenalineBoostTwo = false; + /// If true, the player has consumed Ectoheart. public bool adrenalineBoostThree = false; + /// Used to heal the player to full health on respawn. public bool healToFull = false; #endregion #region Accessory public bool shieldOfTheHighRulerDashVelocityBoosted = false; public bool luxorsGift = false; + public bool luxorHit = false; + public bool luxorsGiftVanity = false; public bool fungalSymbiote = false; public bool trinketOfChi = false; public bool gladiatorSword = false; + public int gladiatorTimer = 0; public bool unstableGraniteCore = false; public bool regenator = false; + public float regenatorDamage = 0; public bool theBee = false; + public bool arcFlashRing = false; + public bool arcFlashRingVisual = false; + public bool bGlassBand = false; // Obsidian band + public bool bGlassBandVisual = false; + public int bGlassbandCooldown = 0; + public bool batholithBangle = false; // Granite band + public bool batholithBangleVisual = false; + public int batholithBangleCooldown = 0; + public bool protolithBangle = false; // Marble band + public bool protolithBangleVisual = false; + public int protolithBangleCooldown = 0; + /// Used to prevent dodges from triggering The Bee's full health damage reduction cooldown. public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; public bool alluringBait = false; @@ -496,41 +741,59 @@ namespace CalamityMod.CalPlayer public bool fishingStation = false; public bool rBrain = false; public bool bloodyWormTooth = false; + /// NOT the primary Affliction variable, used instead for the Afflicted buff which is given to teammates. public bool afflicted = false; public bool chiRegen = false; public bool affliction = false; public bool stressPills = false; public bool laudanum = false; public bool heartOfDarkness = false; + /// Used to buff the Profaned Guardian Relic drops while using Profaned Soul Crystal. + public bool profanedSoulRelicBuff = false; public bool draedonsHeart = false; public bool vexation = false; public bool dodgeScarf = false; public bool evasionScarf = false; public bool badgeOfBravery = false; - public bool warbannerOfTheSun = false; + public bool WarbanneroftheRighteous = false; + public bool warbannerGlow = false; + public bool tesla = false; + public bool teslaVisuals = true; public bool cryogenSoul = false; public bool ascendantInsignia = false; public int ascendantInsigniaBuffTime = 0; public int ascendantInsigniaCooldown = 0; public bool ascendantTrail = false; public bool frozenWingsCold = false; + public bool flameWingsHeat = false; + /// Used to toggle dust spawned while swinging, through accessory visibility. public bool magmaStoneVisuals = true; public bool eGauntlet = false; - public bool eGauntletVisuals = true; // Used to control dust spawned when swinging - public int gloveLevel = 0; // Used to prevent glove stacking - public bool alreadyHasFrogLeg = false; // Used to prevent Frog Leg tinker stacking + /// + public bool eGauntletVisuals = true; + /// + /// Used to prevent melee speed stacking with Feral Claws and its upgrades.
+ /// Feral Claws = 1, Power Glove = 2, Mechanical Glove = 3, Fire Gauntlet = 4, Elemental Gauntlet = 5 + ///
+ public int gloveLevel = 0; + public bool alreadyHasFrogLeg = false; // Unused, intended to prevent Frog Leg tinker stacking public bool eTalisman = false; + /// Counter variable used for spawning Statis' Void Sash's scythes when dashing. public int statisTimer = 0; public bool nucleogenesis = false; public bool nuclearFuelRod = false; - public bool nCore = false; + public bool nebulousCore = false; public bool deepDiver = false; public bool abyssalDivingSuitPlates = false; public int abyssalDivingSuitPlateHits = 0; public bool aquaticHeartWaterBuff = false; public bool aquaticHeartIce = false; - public bool aSpark = false; + public bool ilSpark = false; public bool transformer = false; + public bool transformerVisual = false; + public int transformerCooldown = 0; + public int transformerDelay = 0; + public int transformerStoredKills = 0; public bool hideOfDeus = false; public bool dAmulet = false; public bool rampartOfDeities = false; @@ -543,22 +806,30 @@ namespace CalamityMod.CalPlayer public bool honeyDewHalveDebuffs = false; public bool livingDewHalveDebuffs = false; public int jewelBonusDefense = 0; - public float pulseCounter = 0; // Toxic Heart - public float pulseRate = 1; // Toxic Heart + /// + /// Counter variable for spawning Toxic Heart's pulses.
+ /// Incremented on every frame by , and when it reaches 420, it is reset and a pulse is spawned. + ///
+ public float pulseCounter = 0; + /// + /// The rate at which is incremented, and thus how often Toxic Heart's pulses are spawned.
+ /// This value scales with how low the player's life regeneration is. + ///
+ public float pulseRate = 1; public bool aAmpoule = false; public bool rOoze = false; - public bool JustWasDebuffed = false; public bool fBarrier = false; public bool aBrain = false; public bool amalgam = false; public bool raiderTalisman = false; - public float raiderCritBonus = RaidersTalisman.RaiderBonus; + public float raiderCritLifespan = 0f; public int raiderSoundCooldown = 0; public bool gSabaton = false; public int gSabatonHotkeyHoldTime = 0; public int gSabatonFall = 0; public bool gSabatonFalling = false; public int gSabatonTempJumpSpeed = 0; + public bool rOfDelivarenceRam = false; public bool sGlyph = false; public bool sRegen = false; public bool tracersDust = false; @@ -567,7 +838,6 @@ namespace CalamityMod.CalPlayer public bool tracersElysian = false; public bool tracersSeraph = false; public bool frostFlare = false; - public bool uberBees = false; public bool evolution = false; public int evolutionLifeRegenCounter = 0; public bool nanotech = false; @@ -576,6 +846,7 @@ namespace CalamityMod.CalPlayer public bool holyMinions = false; public bool alchFlask = false; public bool toxicHeart = false; + public bool toxicHeartVisuals = false; public bool abaddon = false; public bool aeroStone = false; @@ -601,31 +872,45 @@ namespace CalamityMod.CalPlayer public bool crownJewel = false; public bool infectedJewel = false; public bool purity = false; + /// If true, reduces the damage of electricity debuffs by 50%. public bool eleResist = false; public int PurityHealSlowdownFrames = 0; public bool harpyRing = false; public bool angelTreads = false; - public bool harpyWingBoost = false; //harpy wings + harpy ring + /// Counter variable used for automatically re-engaging Vortex armor's stealth with Vortex Booster. + public int vortexBoosterStealthDelay = 0; + /// Makes Flesh Knuckles and its upgrades increase the player's max health by 45. public bool fleshKnuckles = false; public bool ironBoots = false; public bool depthCharm = false; public bool anechoicPlating = false; + /// Used for increasing light level in the Abyss. public bool jellyfishNecklace = false; + /// Calamity's Fairy Boots effect; makes fairies spawn around you which give stats. public bool fairyBoots = false; + /// Calamity's Flame Waker Boots effect; multiplies heat debuff damage and makes attacks inflict On Fire. public bool flameWakerBoots = false; - public int bootLevel = 0; //Used to prevent Flame Waker and Hellfire Treads stacking + /// Calamity's Hellfire Treads effect; multiplies heat debuff damage and makes attacks inflict Hellfire. public bool hellfireTreads = false; - public bool abyssalAmulet = false; + /// + /// Used to prevent heat debuff damage stacking with Flame Waker Boots and Hellfire Treads.
+ /// Flame Waker Boots = 1, Hellfire Treads = 2 + ///
+ public int bootLevel = 0; + public bool sSpiritAmulet = false; + public int sSpiritAmuletTimer = 0; + public bool sSpiritAmuletVisual = false; public bool lumenousAmulet = false; public bool oceanCrest = false; public bool aquaticEmblem = false; public bool spiritOrigin = false; public bool spiritOriginVanity = false; + public int spiritOriginCritBoost = 0; public bool darkSunRing = false; public bool crawCarapace = false; public bool baroclaw = false; - public bool HasReducedDashFirstFrame = false; public bool HasIncreasedDashFirstFrame = false; + public bool IsFirstDashFrame = true; public bool voidOfCalamity = false; public bool voidOfExtinction = false; public bool eArtifact = false; @@ -633,13 +918,20 @@ namespace CalamityMod.CalPlayer public bool auricSArtifact = false; public bool pSoulArtifact = false; public bool giantPearl = false; + public bool shieldOfTheOcean = false; + public int shieldOfTheOceanParry = 0; + public bool shieldOfTheOceanEmpoweredParry = false; public bool normalityRelocator = false; public bool flameLickedShell = false; public int flameLickedShellParry = 0; public bool flameLickedShellEmpoweredParry = false; public bool Pauldron = false; + public bool XykVisualsBlue = false; + public bool XykVisualsOrange = false; public bool manaOverloader = false; + /// Used for allowing Calamity slimes to be affected by Royal Gel. public bool royalGel = false; + /// Used for implementing its synergy with Snow armor. public bool handWarmer = false; public bool ursaSergeant = false; public bool ursaSergeantVisual = false; @@ -654,6 +946,7 @@ namespace CalamityMod.CalPlayer public bool blazingCoreEmpoweredParry = false; public bool voltaicJelly = false; public bool jellyChargedBattery = false; + /// General cooldown for accessories which spawn projectiles on minion hits. public float summonProjCooldown; public bool sandWaifu = false; public bool sandWaifuVanity = false; @@ -684,8 +977,11 @@ namespace CalamityMod.CalPlayer public bool bloodyGlove = false; public bool filthyGlove = false; public bool sandCloak = false; + /// Solely used for granting the acceleration boost while within Sand Cloak's veil. Other stat boosts are directly given by the projectile. + public bool getSandCloakAccelBoost = false; public bool spectralVeil = false; public int spectralVeilImmunity = 0; + /// Check for if the player has Plagued Fuel Pack OR Blunder Booster equipped. public bool hasJetpack = false; public bool plaguedFuelPack = false; public bool blunderBooster = false; @@ -703,13 +999,21 @@ namespace CalamityMod.CalPlayer public int hallowedRuneCooldown = 0; public bool phantomicArtifact = false; public int phantomicBulwarkCooldown = 0; - public int phantomicHeartRegen = 0; // 0 = can spawn, 720 = regen applied, 600 = regen stops and 10 sec cd before it can spawn again + /// + /// Controls the state of Phantomic Artifact's Phantomic Regen boost.
+ /// When the heart is spawned, this variable is set to 1000. When the heart is touched, it is set to 720 and decrements every frame.
+ /// Life regeneration is increased while between 600 and 720, with a 10 second cooldown afterwards represented by being below 600. + ///
+ public int phantomicHeartRegen = 0; public bool silvaWings = false; - public int icicleCooldown = 0; + public int silvaWingsLifeRegenTimer = 0; + /// General cooldown variable for spawning projectiles from wing bonus effects. Used by Soul of Cryogen, Harpy Wings, Tattered Fairy Wings, and Festive Wings. + public int wingProjectileCooldown = 0; public bool RustyMedallionDroplets = false; - public bool MiniSwarmers = false; public bool noStupidNaturalARSpawns = false; + /// Used for animating Void Concentration Staff's draw layer. public int voidFrameCounter = 0; + /// public int voidFrame = 0; public bool rottenDogTooth = false; public bool angelicAlliance = false; @@ -718,14 +1022,19 @@ namespace CalamityMod.CalPlayer public bool ChaosStone = false; public bool CryoStone = false; public bool CryoStoneVanity = false; + /// Used for spawning Quiver of Nihility's void fields. public bool voidField = false; public bool copyrightInfringementShield = false; #endregion #region Armor Set + public int ArmorSetBonusKeyHeldTimer; + /// Calamity's Silver armor set bonus; taking over 20 damage heals 10 health if you avoid damage for 2 seconds. public bool silverMedkit = false; public int silverMedkitTimer = 0; + /// Calamity's Gold armor set bonus; makes enemies drop Gold Coins. public bool goldArmorGoldDrops = false; + /// Calamity's Mining armor set bonus; gives a chance for extra items to drop when mining ores. public bool miningSet = false; public int miningSetCooldown = 0; public bool desertProwler = false; @@ -733,10 +1042,16 @@ namespace CalamityMod.CalPlayer public bool forbiddenCirclet = false; public int forbiddenCooldown = 0; public int tornadoCooldown = 0; - public bool eskimoSet = false; //vanilla armor - public bool meteorSet = false; //vanilla armor, for space gun nerf - public bool necroSet = false; //vanilla armor - public bool frostSet = false; //vanilla armor + /// Calamity's Snow armor set bonus; reduces cold enemy damage and increases cold debuff damage. + public bool eskimoSet = false; + /// Calamity's Rain armor set bonus; gives jump speed and makes jumps create a splash. + public bool rainSet = false; + /// Calamity's Meteor armor set bonus; makes all magic guns cost 33% mana instead of Space Gun costing 0 mana. + public bool meteorSet = false; + /// Calamity's Necro armor set bonus; gives a temporary 10 second revive when the player is killed before actually dying. + public bool necroSet = false; + /// Calamity's Frost armor set bonus; gives a combined 20% damage boost split between melee and ranged based on distance from the closest enemy. + public bool frostSet = false; public bool victideSet = false; public bool victideSummoner = false; public bool sulphurSet = false; @@ -783,10 +1098,13 @@ namespace CalamityMod.CalPlayer public bool brimflameFrenzy = false; public bool lunicCorpsSet = false; public bool lunicCorpsLegs = false; + /// Demonshade Breastplate's life regeneration boost. public bool shadeRegen = false; + /// Demonshade Greaves' movement speed boost. public bool shadowSpeed = false; public bool dsSetBonus = false; public bool auricBoost = false; + public bool auricSetMelee = false; public bool daedalusReflect = false; public bool daedalusSplit = false; public bool titanHeartSet = false; @@ -804,11 +1122,14 @@ namespace CalamityMod.CalPlayer public bool fathomSwarmerVisage = false; public bool fathomSwarmerBreastplate = false; public bool fathomSwarmerTail = false; + /// Used for animating Fathom Swarmer armor's tail layer. public int tailFrameUp = 0; + /// public int tailFrame = 0; public bool astralStarRain = false; public int astralStarRainCooldown = 0; public int AbaddonCooldown = 0; + public int VoidCooldown = 0; public int ursaSergeantCooldown = 0; public int AlchFlaskCooldown = 0; public bool plagueReaper = false; @@ -829,27 +1150,41 @@ namespace CalamityMod.CalPlayer public int silvaMageCooldown = 0; public bool silvaSummon = false; public bool hasSilvaEffect = false; - public static int silvaReviveDuration = 480; + /// Constant variable representing the duration of Silva armor's revive, in frames. + public const int silvaReviveDuration = 300; public int silvaCountdown = silvaReviveDuration; public bool auricSet = false; public bool omegaBlueChestplate = false; public bool omegaBlueSet = false; public bool omegaBlueHentai = false; + /// Aerospec armor's summoner set bonus minion. public bool valkyrie = false; + /// Statigel armor's summoner set bonus minion. public bool slimeGod = false; - public bool molluskSet = false; + public bool molluskHelmet = false; + public bool molluskChest = false; + public bool molluskLegs = false; public bool fearmongerSet = false; public int fearmongerRegenFrames = 0; public bool daedalusCrystal = false; + /// Hydrothermic armor's summoner set bonus minion. public bool chaosSpirit = false; + /// Demonshade armor's set bonus minion. public bool redDevil = false; public bool GemTechSet = false; + /// Calamity's Cobalt armor set bonus; increases damage and crit chance based on how fast the player is moving. public bool CobaltSet = false; + /// Calamity's Mythril armor set bonus; hits spawn additional homing mythril flares. public bool MythrilSet = false; public int MythrilFlareSpawnCountdown = 0; + /// Calamity's Adamantite armor set bonus; adds half of DR to crit chance, and makes landing hits give a stacking defense boost. public bool AdamantiteSet = false; public int AdamantiteSetDecayDelay = 0; public int ChlorophyteHealDelay = 0; + /// + /// If true, the player is wearing a post-Moon Lord summoner armor set.
+ /// Currently unused. + ///
public bool WearingPostMLSummonerSet = false; private float adamantiteSetDefenseBoostInterpolant; @@ -891,38 +1226,48 @@ namespace CalamityMod.CalPlayer public bool irradiated = false; public bool bFlames = false; public bool weakBrimstoneFlames = false; + public bool demonicFlames = false; public bool gsInferno = false; public bool astralInfection = false; + /// Plague debuff. public bool pFlames = false; public bool hFlames = false; public bool hInferno = false; public bool gState = false; public bool bBlood = false; public bool brainRot = false; + public bool heavybleeding = false; public bool laceration = false; public bool elementalMix = false; public bool icarusFolly = false; public bool weakPetrification = false; public bool vHex = false; + public bool trueVHex = false; public bool DoGExtremeGravity = false; public bool warped = false; public bool cDepth = false; public bool rTide = false; + public bool hPressure = false; public bool fishAlert = false; public bool clamity = false; public bool NOU = false; public bool absorberAffliction = false; public bool sulphurPoison = false; public bool nightwither = false; + public bool voidfrost = false; public bool eutrophication = false; - public bool iCantBreathe = false; //Frozen Lungs debuff + /// Frozen Lungs debuff. + public bool iCantBreathe = false; + /// Searing Lava debuff. public bool cragsLava = false; public bool vaporfied = false; public bool banishingFire = false; public bool wither = false; public bool ManaBurn = false; + /// Counter variable used to prevent the player from being inflicted with another immobilizing debuff for a short time after being inflicted with one. public int ImmobilityDebuffImmunityTimer = 0; + /// Constant variable representing the time in which players cannot be inflicted with another immobilizing debuff, in frames. public const int ImmobilityDebuffImmunityTimerMax = 300; public const int SulphSeaWaterSafetyTime = 720; @@ -937,9 +1282,11 @@ namespace CalamityMod.CalPlayer public bool corrEffigy = false; public bool crimEffigy = false; public bool decayEffigy = false; + /// Reaver Rage buff. public bool rRage = false; + /// Tarra Life buff. public bool tRegen = false; - public bool xRage = false; + /// Empyrean Wrath buff. public bool xWrath = false; public bool graxDefense = false; public bool encased = false; @@ -949,12 +1296,13 @@ namespace CalamityMod.CalPlayer public bool zen = false; public bool isNearbyBoss = false; public bool flaskBrimstone = false; - public bool fabsolVodka = false; + public bool cirrusVodka = false; public bool mushy = false; public bool PinkJellyRegen = false; public bool GreenJellyRegen = false; public bool AbsorberRegen = false; public bool cFreeze = false; + /// Used for increasing light level in the Abyss. public bool shine = false; public bool anechoicCoating = false; public bool enraged = false; @@ -969,7 +1317,6 @@ namespace CalamityMod.CalPlayer public bool astralInjection = false; public bool gravityNormalizer = false; public bool flaskHoly = false; - public bool tesla = false; public bool galvanicCorrosion = false; public bool sulphurskin = false; public bool baguette = false; @@ -999,7 +1346,12 @@ namespace CalamityMod.CalPlayer public bool pinkCandle = false; public double pinkCandleHealFraction = 0D; public bool yellowCandle = false; + /// If true, the player has consumed Odd Mushroom. Controls drawing its rainbow fake clones of NPCs and projectiles. public bool trippy = false; + /// + /// Used to control the number and position of Odd Mushroom's fake clones. There are three levels of severity.
+ /// The first draws 4 clones in diagonals. The second draws 12 clones, 4 on diagonals and the other 8 surrounding them. The third draws 16 clones, arranged entirely around the player. + ///
public int trippyLevel = 1; public bool amidiasBlessing = false; public bool bloodfinBoost = false; @@ -1010,13 +1362,19 @@ namespace CalamityMod.CalPlayer public bool avertorBonus = false; public bool divineBless = false; public bool infiniteFlight = false; + /// + /// Counter variable for natural decay of Haste buffs from Chronomancer's Scythe.
+ /// If the player does not collect a clock powerup for 5 seconds, they will lose a stack of Haste. + ///
public int hasteCounter = 0; + /// How many stacks of the Haste buff the player has, from Chronomancer's Scythe. public int hasteLevel = 0; #endregion #region Minion public bool wDroid = false; public bool resButterfly = false; + /// Staff of the Mechworm. public bool mWorm = false; public bool IceClasperBool = false; public bool magicHat = false; @@ -1024,55 +1382,85 @@ namespace CalamityMod.CalPlayer public bool blackhawk = false; public bool cosmicViper = false; public bool CalamarisLament = false; + /// Entropy's Vigil. public bool cEyes = false; + /// Corroslime Staff. public bool cSlime = false; + /// Crimslime Staff. public bool cSlime2 = false; + /// Abandoned Slime Staff. public bool aSlime = false; public bool brittleStar = false; public bool aquaticStar = false; + /// Sun Spirit Staff. public bool SP = false; public bool dCreeper = false; public bool bClot = false; public bool eAxe = false; public bool endoCooper = false; + /// Vengeful Sun Staff. public bool SPG = false; public bool sirius = false; + /// Yharon's Kindle Staff. public bool aChicken = false; public bool cLamp = false; + /// Ethereal Subjugator. public bool pGuy = false; public bool sandnado = false; public bool PlantationSummon = false; public bool astralProbe = false; + /// Profaned Soul Artifact/Crystal guardians. public bool pSoulGuardians = false; - public bool cEnergy = false; + /// Counter variable used for healing the player by Profaned Soul Artifact's healer guardian. public int healCounter = 300; + /// Cosmic Immaterializer. + public bool cEnergy = false; public bool shellfish = false; + /// Enchanted Conch. public bool hCrab = false; + /// Heart of the Elements. public bool allWaifus = false; + /// Hearts of the Elements; however, the minions will not attack. public bool allWaifusVanity = false; + /// Silva armor's Silva Crystal. public bool sCrystal = false; + /// Elemental in a Bottle. public bool sWaifu = false; + /// Rare Elemental in a Bottle. public bool dWaifu = false; + /// Eye of the Storm. public bool cWaifu = false; + /// Rose Stone. public bool bWaifu = false; + /// Pearl of Enthrallment. public bool slWaifu = false; public bool fClump = false; + /// Demonshade armor's Red Devil. public bool rDevil = false; + /// Aerospec armor's Valkyrie. public bool aValkyrie = false; public bool apexShark = false; public bool gastricBelcher = false; public bool hauntedDishes = false; public bool stormjaw = false; + /// Statigel armor's Baby Paladin. public bool sGod = false; public bool victideSnail = false; + /// Hydrothermic armor's Vent. public bool cSpirit = false; + /// Reaver armor's Reaver Orb. public bool rOrb = false; + /// Daedalus armor's Daedalus Crystal. public bool dCrystal = false; public bool endoHydra = false; + /// Corvid Harbinger Staff. public bool powerfulRaven = false; + /// Dragonblood Disgorger. public bool dragonFamily = false; public bool providenceStabber = false; + public bool seashineSwordBuff = false; public bool saros = false; + /// Fuel Cell Bundle. public bool plaguebringerMK2 = false; public bool igneousExaltation = false; public bool GlacialEmbrace = false; @@ -1117,23 +1505,31 @@ namespace CalamityMod.CalPlayer public bool KalandraMirror = false; public bool StellarTorus = false; public bool LiliesOfFinalityBool = false; + public bool FlarebatBool = false; + public bool FrostbatBool = false; + public bool AmphibiansGuitarBool = false; #endregion #region Biome - public bool ZoneCalamity => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneAstral => Player.InModBiome(ModContent.GetInstance()) && !ZoneAbyss; - public bool ZoneSunkenSea => ZoneSunkenBurrows || ZoneSunkenSeaReefs || ZoneSunkenSeaPolyp || ZoneSunkenSeaShores; - public bool ZoneSunkenBurrows => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneSunkenSeaReefs => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneSunkenSeaPolyp => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneSunkenSeaShores => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneSulphur => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneSunkenSea => ZoneTimelessShores || ZoneRadiantReefs || ZonePolypForest || ZoneGleamingBurrows || ZoneBasaltGully; + public bool ZoneTimelessShores => Player.InModBiome(); + public bool ZonePolypForest => Player.InModBiome(); + public bool ZoneRadiantReefs => Player.InModBiome(); + public bool ZoneGleamingBurrows => Player.InModBiome(); + public bool ZoneBasaltGully => Player.InModBiome(); + + public bool ZoneSulphur => Player.InModBiome(); public bool ZoneAbyss => ZoneAbyssLayer1 || ZoneAbyssLayer2 || ZoneAbyssLayer3 || ZoneAbyssLayer4; - public bool ZoneAbyssLayer1 => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneAbyssLayer2 => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneAbyssLayer3 => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneAbyssLayer4 => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneFloralParadise => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneAbyssLayer1 => Player.InModBiome(); + public bool ZoneAbyssLayer2 => Player.InModBiome(); + public bool ZoneAbyssLayer3 => Player.InModBiome(); + public bool ZoneAbyssLayer4 => Player.InModBiome(); + + public bool ZoneFloralParadise => Player.InModBiome(); + + public bool ZoneCalamity => Player.InModBiome(); + + public bool ZoneAstral => Player.InModBiome() && !ZoneAbyss; public bool InAnyCalamityBiome => ZoneAbyss || ZoneCalamity || ZoneFloralParadise || ZoneSulphur || ZoneSunkenSea || ZoneAstral; @@ -1179,27 +1575,48 @@ namespace CalamityMod.CalPlayer public bool omegaBlueTransformationForce; public bool omegaBlueTransformationPower; public bool ghostBracelet; + public bool punchCard; #endregion #region Calamitas Enchant Effects + /// If true, the player is holding an item with the Indignant enchantment. public bool cursedSummonsEnchant = false; + /// If true, the player is holding an item with the Aflame enchantment. public bool flamingItemEnchant = false; + /// If true, the player is holding an item with the Oblatory enchantment. public bool lifeManaEnchant = false; + /// If true, the player is holding an item with the Resentful enchantment. public bool farProximityRewardEnchant = false; + /// If true, the player is holding an item with the Bloodthirsty enchantment. public bool closeProximityRewardEnchant = false; + /// If true, the player is holding an item with the Ephemeral enchantment. public bool dischargingItemEnchant = false; + /// If true, the player is holding an item with the Hellbound enchantment. public bool explosiveMinionsEnchant = false; + /// If true, the player is holding an item with the Tainted enchantment. public bool bladeArmEnchant = false; + /// If true, the player is holding an item with the Traitorous enchantment. public bool manaMonsterEnchant = false; + /// If true, the player is holding an item with the Withering enchantment. public bool witheringWeaponEnchant = false; public bool witheredDebuff = false; + /// + /// Counter variable which controls negative life regeneration from the Withered debuff.
+ /// Increments every frame a weapon with the Withering enchantment is held, and decrements vice versa. + ///
public int witheredWeaponHoldTime = 0; + /// + /// How much damage was dealt by a weapon with the Withering enchantment.
+ /// Used to determine what percentage of the hit to heal back. + ///
public int witheringDamageDone = 0; + /// If true, the player is holding an item with the Persecuted enchantment. public bool persecutedEnchant = false; public int persecutedEnchantSummonTimer = 0; + /// If true, the player is holding an item with the Lecherous enchantment. public bool lecherousOrbEnchant = false; public bool awaitingLecherousOrbSpawn = false; #endregion Calamitas Enchant Effects @@ -1254,19 +1671,19 @@ namespace CalamityMod.CalPlayer private Vector2 oldMouseWorld; /// - /// Set this to true if you need to recieve updates on right clicks from players and sync them in mp. - /// Automatically resets itself after sending an update - /// <\summary> + /// Set this to true if you need to receive updates on right clicks from players and sync them in multiplayer.
+ /// Automatically resets itself after sending an update. + ///
public bool rightClickListener = false; /// - /// Set this to true if you need to recieve updates on the position of the player's mouse and sync them in mp. - /// Automatically resets itself after sending an update - /// <\summary> + /// Set this to true if you need to receive updates on the position of the player's mouse and sync them in multiplayer.
+ /// Automatically resets itself after sending an update. + ///
public bool mouseWorldListener = false; /// - /// Set this to true if you need to recieve updates on the rotation of the mouse to the player. This sends updates less frequently than the more tight tolerance mouseWorldListener - /// Automatically resets itself after sending an update - /// <\summary> + /// Set this to true if you need to receive updates on the rotation of the mouse to the player. This sends updates less frequently the tighter the tolerance of mouseWorldListener.
+ /// Automatically resets itself after sending an update. + ///
public bool mouseRotationListener = false; public bool syncMouseControls = false; @@ -1277,6 +1694,7 @@ namespace CalamityMod.CalPlayer #region Saving And Loading public override void Initialize() { + spawnedPunchCard = false; extraAccessoryML = false; eCore = false; mFruit = false; @@ -1330,6 +1748,7 @@ namespace CalamityMod.CalPlayer public override void SaveData(TagCompound tag) { var boost = new List(); + boost.AddWithCondition("spawnedPunchCard", spawnedPunchCard); boost.AddWithCondition("extraAccessoryML", extraAccessoryML); boost.AddWithCondition("etherealCore", eCore); boost.AddWithCondition("miracleFruit", mFruit); @@ -1381,7 +1800,7 @@ namespace CalamityMod.CalPlayer 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); + TimeSpan newSessionTotal = previousSessionTotal.Add(SpeedrunTimerSystem.Elapsed); long totalTicks = newSessionTotal.Ticks; // Save all cooldowns which are marked as persisting through save/load. @@ -1421,6 +1840,7 @@ namespace CalamityMod.CalPlayer public override void LoadData(TagCompound tag) { var boost = tag.GetList("boost"); + spawnedPunchCard = boost.Contains("spawnedPunchCard"); extraAccessoryML = boost.Contains("extraAccessoryML"); eCore = boost.Contains("etherealCore"); mFruit = boost.Contains("miracleFruit"); @@ -1541,8 +1961,8 @@ namespace CalamityMod.CalPlayer Player.statLifeMax2 += 45; int percentMaxLifeIncrease = 0; - if (ZoneAbyss && (abyssalAmulet || lumenousAmulet)) - percentMaxLifeIncrease += lumenousAmulet ? 25 : 10; + if (ZoneAbyss && lumenousAmulet) + percentMaxLifeIncrease += 25; // Blood Pact and Chalice of the Blood God stack their HP bonuses if you want to equip both if (bloodPact) @@ -1564,10 +1984,13 @@ namespace CalamityMod.CalPlayer // Max health reductions if (crimEffigy) - Player.statLifeMax2 = (int)(Player.statLifeMax2 * 0.9); + Player.statLifeMax2 = (int)(Player.statLifeMax2 * (1f - CrimsonEffigy.MaxHealthLossPercent)); ResetRogueStealth(); + calamityBonusLuck = 0f; + combHair = false; + // Reset adrenaline duration to default. If Draedon's Heart is equipped, it'll change itself every frame. AdrenalineDuration = CalamityUtils.SecondsToFrames(5); @@ -1575,17 +1998,23 @@ namespace CalamityMod.CalPlayer contactDamageReduction = 0D; projectileDamageReduction = 0D; rogueVelocity = 1f; - rogueAmmoCost = 1f; accStealthGenBoost = 0f; DashID = string.Empty; + externalAbyssLight = 0; + externalBreathLossMultBoost = 0f; + externalBreathTickBoost = 0f; + externalFlightTimeMultBoost = 0f; + externalRageEnabled = externalAdrenalineEnabled = null; externalColdImmunity = externalHeatImmunity = false; + externalDefenseDamageImmunity = false; + externalAuricRejectionImmunity = false; + alcoholPoisonLevel = 0; noLifeRegen = false; // Shields. Has to intentionally be above resetting accessories and armor or the shields would clear instantly - drawnAnyShieldThisFrame = false; if (!roverDrive) RoverDriveShieldDurability = 0; if (!lunicCorpsSet) @@ -1651,7 +2080,7 @@ namespace CalamityMod.CalPlayer dodgeScarf = false; evasionScarf = false; - nCore = false; + nebulousCore = false; godSlayer = false; godSlayerDamage = false; @@ -1664,6 +2093,7 @@ namespace CalamityMod.CalPlayer auricSet = false; auricBoost = false; + auricSetMelee = false; GemTechSet = false; @@ -1677,7 +2107,9 @@ namespace CalamityMod.CalPlayer omegaBlueSet = false; omegaBlueHentai = false; - molluskSet = false; + molluskHelmet = false; + molluskChest = false; + molluskLegs = false; fearmongerSet = false; ataxiaBolt = false; @@ -1699,6 +2131,7 @@ namespace CalamityMod.CalPlayer blazingCursorVisuals = false; luxorsGift = false; + luxorsGiftVanity = false; fungalSymbiote = false; trinketOfChi = false; gladiatorSword = false; @@ -1706,6 +2139,10 @@ namespace CalamityMod.CalPlayer regenator = false; deepDiver = false; theBee = false; + arcFlashRing = false; + arcFlashRingVisual = false; + bGlassBand = false; + bGlassBandVisual = false; alluringBait = false; enchantedPearl = false; fishingStation = false; @@ -1713,9 +2150,11 @@ namespace CalamityMod.CalPlayer bloodyWormTooth = false; vexation = false; badgeOfBravery = false; - warbannerOfTheSun = false; - aSpark = false; + WarbanneroftheRighteous = false; + warbannerGlow = false; + ilSpark = false; transformer = false; + transformerVisual = false; hideOfDeus = false; dAmulet = false; rampartOfDeities = false; @@ -1733,14 +2172,16 @@ namespace CalamityMod.CalPlayer aBrain = false; amalgam = false; frostFlare = false; - uberBees = false; evolution = false; nanotech = false; deadshotBrooch = false; + tesla = false; + teslaVisuals = true; cryogenSoul = false; ascendantInsignia = false; ascendantTrail = false; frozenWingsCold = false; + flameWingsHeat = false; magmaStoneVisuals = true; eGauntlet = false; eGauntletVisuals = true; @@ -1750,10 +2191,12 @@ namespace CalamityMod.CalPlayer nucleogenesis = false; nuclearFuelRod = false; heartOfDarkness = false; + profanedSoulRelicBuff = false; shadowMinions = false; holyMinions = false; alchFlask = false; toxicHeart = false; + toxicHeartVisuals = false; abaddon = false; aeroStone = false; lifejelly = false; @@ -1774,14 +2217,10 @@ namespace CalamityMod.CalPlayer purity = false; harpyRing = false; angelTreads = false; - harpyWingBoost = false; //harpy wings + harpy ring fleshKnuckles = false; darkSunRing = false; crawCarapace = false; baroclaw = false; - gShell = false; - lAmbergris = false; - tortShell = false; voidOfCalamity = false; voidOfExtinction = false; eArtifact = false; @@ -1789,9 +2228,12 @@ namespace CalamityMod.CalPlayer auricSArtifact = false; pSoulArtifact = false; giantPearl = false; + shieldOfTheOcean = false; normalityRelocator = false; flameLickedShell = false; Pauldron = false; + XykVisualsBlue = false; + XykVisualsOrange = false; manaOverloader = false; royalGel = false; handWarmer = false; @@ -1824,7 +2266,6 @@ namespace CalamityMod.CalPlayer silvaWings = false; corrosiveSpine = false; RustyMedallionDroplets = false; - MiniSwarmers = false; rottenDogTooth = false; angelicAlliance = false; BloomStoneRegen = false; @@ -1864,13 +2305,15 @@ namespace CalamityMod.CalPlayer fairyBoots = false; flameWakerBoots = false; hellfireTreads = false; - abyssalAmulet = false; + sSpiritAmulet = false; lumenousAmulet = false; oceanCrest = false; aquaticEmblem = false; + if (!spiritOrigin) + spiritOriginCritBoost = 0; spiritOrigin = false; spiritOriginVanity = false; - spiritOriginConvertedCrit = 0; + astralStarRain = false; @@ -1886,10 +2329,11 @@ namespace CalamityMod.CalPlayer miningSet = false; miningSetCooldown = 0; - eskimoSet = false; //vanilla armor - meteorSet = false; //vanilla armor, for Space Gun nerf - necroSet = false; //vanilla armor - frostSet = false; //vanilla armor + eskimoSet = false; + rainSet = false; + meteorSet = false; + necroSet = false; + frostSet = false; victideSet = false; victideSummoner = false; @@ -1975,6 +2419,7 @@ namespace CalamityMod.CalPlayer witheredDebuff = false; absorberAffliction = false; weakBrimstoneFlames = false; + demonicFlames = false; gsInferno = false; astralInfection = false; pFlames = false; @@ -1983,14 +2428,17 @@ namespace CalamityMod.CalPlayer gState = false; bBlood = false; brainRot = false; + heavybleeding = false; laceration = false; elementalMix = false; icarusFolly = false; vHex = false; + trueVHex = false; DoGExtremeGravity = false; warped = false; cDepth = false; rTide = false; + hPressure = false; fishAlert = false; clamity = false; NOU = false; @@ -1998,6 +2446,7 @@ namespace CalamityMod.CalPlayer snowmanNoseless = false; sulphurPoison = false; nightwither = false; + voidfrost = false; eutrophication = false; iCantBreathe = false; cragsLava = false; @@ -2013,7 +2462,6 @@ namespace CalamityMod.CalPlayer crimEffigy = false; decayEffigy = false; rRage = false; - xRage = false; xWrath = false; graxDefense = false; encased = false; @@ -2033,14 +2481,13 @@ namespace CalamityMod.CalPlayer astralInjection = false; gravityNormalizer = false; flaskHoly = false; - tesla = false; galvanicCorrosion = false; sulphurskin = false; baguette = false; trippy = false; amidiasBlessing = false; flaskBrimstone = false; - fabsolVodka = false; + cirrusVodka = false; shine = false; anechoicCoating = false; mushy = false; @@ -2081,6 +2528,7 @@ namespace CalamityMod.CalPlayer pinkCandle = false; yellowCandle = false; + #region Minion Reset Effects wDroid = false; resButterfly = false; mWorm = false; @@ -2157,6 +2605,7 @@ namespace CalamityMod.CalPlayer powerfulRaven = false; dragonFamily = false; providenceStabber = false; + seashineSwordBuff = false; plaguebringerMK2 = false; igneousExaltation = false; GlacialEmbrace = false; @@ -2201,6 +2650,10 @@ namespace CalamityMod.CalPlayer KalandraMirror = false; StellarTorus = false; LiliesOfFinalityBool = false; + FlarebatBool = false; + FrostbatBool = false; + AmphibiansGuitarBool = false; + #endregion /* Spawn blockers from back when they used to work by being favorited and not a toggleable item noStupidNaturalARSpawns = false @@ -2233,6 +2686,7 @@ namespace CalamityMod.CalPlayer omegaBlueTransformation = omegaBlueTransformationForce = omegaBlueTransformationPower = false; ghostBracelet = false; + punchCard = false; rageModeActive = false; adrenalineModeActive = false; @@ -2281,13 +2735,14 @@ namespace CalamityMod.CalPlayer #region Screen Position Movements public override void ModifyScreenPosition() { - if (CalamityConfig.Instance.ScreenshakePower == 0) + // CIT 08FEB2025: Photosensitivity config also disables screenshake + if (CalamityClientConfig.Instance.ScreenshakePower == 0 || CalamityClientConfig.Instance.Photosensitivity) return; if (GeneralScreenShakePower > 0f) { - Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower * CalamityConfig.Instance.ScreenshakePower, GeneralScreenShakePower * CalamityConfig.Instance.ScreenshakePower); - GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityConfig.Instance.ScreenshakePower); + Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower, GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower); + GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityClientConfig.Instance.ScreenshakePower); } } #endregion @@ -2319,10 +2774,12 @@ namespace CalamityMod.CalPlayer foreach (string cdID in removedCooldowns) cooldowns.Remove(cdID); - SyncCooldownDictionary(Main.netMode == NetmodeID.Server); + SyncCooldownDictionary(Main.dedServ); } } + calamityBonusLuck = 0f; + #region Defense Damage totalDefenseDamage = 0; defenseDamageRecoveryFrames = 0; @@ -2332,15 +2789,16 @@ namespace CalamityMod.CalPlayer bloodflareCoreRemainingHealOverTime = 0; #endregion - #region Debuffs + #region Buffs, Debuffs, Counters, and Nonsense heldGaelsLastFrame = false; gaelSwipes = 0; + whitewaterHeal = 0; + luxorHit = false; arsenalCooldown = 0; andromedaState = AndromedaPlayerState.Inactive; planarSpeedBoost = 0; galileoCooldown = 0; soundCooldown = 0; - shadowPotCooldown = 0; dogTextCooldown = 0; auralisStealthCounter = 0f; auralisAuroraCounter = 0; @@ -2352,26 +2810,39 @@ namespace CalamityMod.CalPlayer RustyMedallionCooldown = 0; SulphWaterPoisoningLevel = 0f; holyInfernoFadeIntensity = 0f; - spiritOriginConvertedCrit = 0; + spiritOriginCritBoost = 0; rage = 0f; adrenaline = 0f; - raiderCritBonus = 0f; + raiderCritLifespan = 0f; raiderSoundCooldown = 0; gSabatonHotkeyHoldTime = 0; gSabatonFall = 0; gSabatonFalling = false; gSabatonTempJumpSpeed = 0; + rOfDelivarenceRam = false; astralStarRainCooldown = 0; AbaddonCooldown = 0; - ursaSergeantCooldown = 0; + VoidCooldown = 0; AlchFlaskCooldown = 0; ascendantInsigniaCooldown = 0; + transformerCooldown = 0; + transformerDelay = 0; + transformerStoredKills = 0; silvaMageCooldown = 0; bloodflareMageCooldown = 0; tarraRangedCooldown = 0; hideOfDeusMeleeBoostTimer = 0; + rOfResilienceCooldown = 0; + rOfResilienceEffect = 0; + demonSwordKillMode = false; + externalAbyssLight = 0; + externalBreathLossMultBoost = 0f; + externalBreathTickBoost = 0f; + externalFlightTimeMultBoost = 0f; externalColdImmunity = externalHeatImmunity = false; + externalDefenseDamageImmunity = false; + dragonRageHits = 0; dragonRageCooldown = 0; spectralVeilImmunity = 0; @@ -2382,7 +2853,7 @@ namespace CalamityMod.CalPlayer killSpikyBalls = false; scuttlerCooldown = 0; rogueCrownCooldown = 0; - icicleCooldown = 0; + wingProjectileCooldown = 0; statisTimer = 0; hallowedRuneCooldown = 0; sulphurBubbleCooldown = 0; @@ -2407,6 +2878,7 @@ namespace CalamityMod.CalPlayer witheredDebuff = false; absorberAffliction = false; weakBrimstoneFlames = false; + demonicFlames = false; gsInferno = false; astralInfection = false; pFlames = false; @@ -2415,14 +2887,17 @@ namespace CalamityMod.CalPlayer gState = false; bBlood = false; brainRot = false; + heavybleeding = false; laceration = false; elementalMix = false; icarusFolly = false; vHex = false; + trueVHex = false; DoGExtremeGravity = false; warped = false; cDepth = false; rTide = false; + hPressure = false; fishAlert = false; clamity = false; NOU = false; @@ -2430,6 +2905,7 @@ namespace CalamityMod.CalPlayer abyssalDivingSuitPlateHits = 0; sulphurPoison = false; nightwither = false; + voidfrost = false; eutrophication = false; iCantBreathe = false; cragsLava = false; @@ -2449,7 +2925,6 @@ namespace CalamityMod.CalPlayer stealthDamage = 0f; bonusStealthDamage = 0; rogueVelocity = 1f; - rogueAmmoCost = 1f; #endregion #region UI @@ -2481,7 +2956,6 @@ namespace CalamityMod.CalPlayer corrEffigy = false; crimEffigy = false; rRage = false; - xRage = false; xWrath = false; kamiBoost = false; graxDefense = false; @@ -2503,12 +2977,11 @@ namespace CalamityMod.CalPlayer astralInjection = false; gravityNormalizer = false; flaskHoly = false; - tesla = false; galvanicCorrosion = false; sulphurskin = false; baguette = false; flaskBrimstone = false; - fabsolVodka = false; + cirrusVodka = false; shine = false; anechoicCoating = false; mushy = false; @@ -2575,6 +3048,7 @@ namespace CalamityMod.CalPlayer godSlayerDashHotKeyPressed = false; SpeedBlasterDashStarted = false; auricBoost = false; + auricSetMelee = false; silvaSet = false; silvaMage = false; silvaSummon = false; @@ -2591,7 +3065,9 @@ namespace CalamityMod.CalPlayer ChlorophyteHealDelay = 0; omegaBlueChestplate = false; omegaBlueSet = false; - molluskSet = false; + molluskHelmet = false; + molluskChest = false; + molluskLegs = false; fearmongerSet = false; daedalusReflect = false; daedalusSplit = false; @@ -2638,10 +3114,11 @@ namespace CalamityMod.CalPlayer forbiddenCirclet = false; forbiddenCooldown = 0; tornadoCooldown = 0; - eskimoSet = false; //vanilla armor - meteorSet = false; //vanilla armor, for Space Gun nerf - necroSet = false; //vanilla armor - frostSet = false; //vanilla armor + eskimoSet = false; + rainSet = false; + meteorSet = false; + necroSet = false; + frostSet = false; victideSet = false; aeroSet = false; sulphurSet = false; @@ -2671,6 +3148,8 @@ namespace CalamityMod.CalPlayer tracersDust = false; elysianWingsDust = false; GemTechState.OnDeathEffects(); + shieldOfTheOceanParry = 0; + shieldOfTheOceanEmpoweredParry = false; blazingCoreParry = 0; blazingCoreEmpoweredParry = false; blazingCoreSuccessfulParry = 0; @@ -2690,21 +3169,24 @@ namespace CalamityMod.CalPlayer CurrentlyViewedFactoryID = -1; CurrentlyViewedChargerID = -1; CurrentlyViewedHologramID = -1; + CurrentlyViewedCanvasID = -1; CurrentlyViewedHologramText = string.Empty; #endregion KameiBladeUseDelay = 0; - brimlashBusterBoost = false; AdrenalineTrail = false; ascendantTrail = false; evilSmasherBoost = 0; - hellbornBoost = 0; + burningSeaBurnOut = 0; + hellbornShots = 0; searedPanCounter = 0; searedPanTimer = 0; potionTimer = 0; persecutedEnchantSummonTimer = 0; momentumCapacitorTime = 0; momentumCapacitorBoost = 0f; + vortexBoosterStealthDelay = 0; + silvaWingsLifeRegenTimer = 0; LungingDown = false; chaliceBleedoutBuffer = 0D; @@ -2716,13 +3198,13 @@ namespace CalamityMod.CalPlayer // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list // The boss rush visual failure effect has no meaningful source and passes no meaningful information. var source = Player.GetSource_None(); - if (Player.whoAmI == 0 && !CalamityGlobalNPC.AnyLivingPlayers() && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) == 0) - Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + if (Player.whoAmI == 0 && !CalamityGlobalNPC.AnyLivingPlayers() && CalamityUtils.CountProjectiles(ProjectileType()) == 0) + Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType(), 0, 0f); } // Respawn the player faster // 3 seconds normally and configurable while a boss is alive between 15 and 60 seconds - int respawnTimerSet = areThereAnyDamnBosses ? (CalamityConfig.Instance.PlayerRespawnTime_BossAlive * 60) : 180; + int respawnTimerSet = areThereAnyDamnBosses ? (CalamityServerConfig.Instance.PlayerRespawnTime_BossAlive * 60) : 180; if (Player.respawnTimer > respawnTimerSet) Player.respawnTimer = respawnTimerSet; } @@ -2739,7 +3221,7 @@ namespace CalamityMod.CalPlayer } if (!mediumCoreDeath) - yield return createItem(ModContent.ItemType()); + yield return createItem(ItemType()); } #endregion @@ -2762,13 +3244,40 @@ namespace CalamityMod.CalPlayer if (ascendantInsignia && Main.myPlayer == Player.whoAmI && CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - Projectile.NewProjectileDirect(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + var source = Player.GetSource_Accessory(FindAccessory(ItemType())); + Projectile.NewProjectile(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ProjectileType(), 0, 0f); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate")); ascendantInsigniaCooldown = 2400; ascendantInsigniaBuffTime = 240; //4 seconds } + int numOfBlobs = Player.ownedProjectileCounts[ModContent.ProjectileType()]; + if (transformer && numOfBlobs > 0 && Main.myPlayer == Player.whoAmI && CalamityKeybinds.TransformerHotKey.JustPressed && transformerCooldown <= 0 && true) // Add check if projectiles are active + { + // Go fire all the blobs + int cooldownTime = 300; + transformerCooldown = cooldownTime; + Player.AddCooldown(TransformerCooldown.ID, cooldownTime); + + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType()) + { + projectile.localAI[0] = 5; + } + } + if (transformerVisual) + { + SoundStyle activate = new("CalamityMod/Sounds/Item/NullShot"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(activate with { Volume = 0.3f, Pitch = 0.2f + i * 0.3f, MaxInstances = -1 }, Player.Center); + Particle orb2 = new CustomPulse(Player.Center, Vector2.Zero, Color.DodgerBlue, "CalamityMod/Particles/BloomRingThinLarge", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.2f, 20); + GeneralParticleHandler.SpawnParticle(orb2); + } + + } + //Only increment hotkey holdtime if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset hold time to zero if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != Player.oldVelocity.Y) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { @@ -2817,7 +3326,7 @@ namespace CalamityMod.CalPlayer if (CalamityKeybinds.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == Player.whoAmI && !divineBless && !Player.HasCooldown(Cooldowns.DivineBless.ID)) { int seconds = CalamityUtils.SecondsToFrames(15f); - Player.AddBuff(ModContent.BuffType(), seconds, false); + Player.AddBuff(BuffType(), seconds, false); SoundEngine.PlaySound(AngelicAlliance.ActivationSound, Player.Center); // Spawn an archangel for every minion you have @@ -2832,33 +3341,16 @@ namespace CalamityMod.CalPlayer angelAmt += 1f; } - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory(FindAccessory(ItemType())); for (int projIndex = 0; projIndex < angelAmt; projIndex++) { Projectile proj = Main.projectile[projIndex]; float start = 360f / angelAmt; - int damage = Player.ApplyArmorAccDamageBonusesTo(proj.damage / 10); - 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; + 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, ProjectileType(), proj.damage / 10, proj.knockBack / 10f, Player.whoAmI, Main.rand.Next(180), projIndex * start); + Player.HealPlayer(2); } } - if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.1f && - wearingRogueArmor && rogueStealthMax > 0 && !Player.HasCooldown(Cooldowns.SandCloak.ID)) - { - Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(30)); - - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - rogueStealth -= rogueStealthMax * 0.1f; - int damage = Player.ApplyArmorAccDamageBonusesTo(7); - - int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 8, Player.whoAmI); - Main.projectile[veil].Center = Player.Center; - SoundEngine.PlaySound(SoundID.Item45, Player.Center); - } if (CalamityKeybinds.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0) { @@ -2895,9 +3387,9 @@ namespace CalamityMod.CalPlayer Vector2 step = teleportOffset / numDust; for (int i = 0; i < numDust; i++) { - 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; + Dust dust = Dust.NewDustDirect(Player.Center - (step * i), 1, 1, DustID.VilePowder, step.X, step.Y); + dust.noGravity = true; + dust.noLight = true; } spectralVeilImmunity = SpectralVeil.VeilIFrames; @@ -2916,190 +3408,105 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item34, Player.Center); } - // TODO -- It would be nice if triggerable set bonuses used interfaces instead of having to go through this large if chain. + if (CalamityKeybinds.AmmoCycleHotkey.JustPressed && deadshotBrooch) + { + SoundEngine.PlaySound(SoundID.Item149, Player.Center); + + // I could've made this so simple on myself, but no, I felt the need to make things convenient for the users... + // First we need to determine the bounds for what we're swapping. + int ammoType = Player.HeldItem.useAmmo; + int lastSlot, firstSlot; + for (lastSlot = 57; lastSlot >= 54; lastSlot--) + { + if (!Player.inventory[lastSlot].IsAir && Player.inventory[lastSlot].ammo == ammoType) + break; + } + for (firstSlot = 54; firstSlot <= 57; firstSlot++) + { + if (!Player.inventory[firstSlot].IsAir && Player.inventory[firstSlot].ammo == ammoType) + break; + } + // If firstSlot = lastSlot, then there is only one ammo in ammo slots, so don't do anything. + if (firstSlot != lastSlot) + { + int tempType = Player.inventory[lastSlot].type; + int tempStack = Player.inventory[lastSlot].stack; + // This list tracks the favorited status of the ammo slots. Since swapping the slots around fucks with the favorite status it must be manually set. + List favorited = []; + for (int z = 54; z <= 57; z++) + favorited.Add(!Player.inventory[z].IsAir && Player.inventory[z].favorited); + + // It is impossible for lastSlot to equal 54 and firstSlot to not equal 54. + for (int i = lastSlot; i >= 55; i--) + { + if (Player.inventory[i].IsAir || Player.inventory[i].ammo != ammoType) + continue; + + // If the slot we're interested in is the lower bound of our ammos, set it to the temp values and don't run anything else. + if (i == firstSlot) + { + Player.inventory[i].SetDefaults(tempType); + Player.inventory[i].stack = tempStack; + Player.inventory[i].favorited = favorited[lastSlot - 54]; + continue; + } + + // Find the next slot that has ammo in it. + int nextSlot; + for (nextSlot = i - 1; nextSlot >= 54; nextSlot--) + { + if (!Player.inventory[nextSlot].IsAir && Player.inventory[nextSlot].ammo == ammoType) + break; + } + + // Set this slot to what is in that slot. + Player.inventory[i].SetDefaults(Player.inventory[nextSlot].type); + Player.inventory[i].stack = Player.inventory[nextSlot].stack; + Player.inventory[i].favorited = favorited[nextSlot - 54]; + } + + // Handles swapping the ammo that is in the first slot. + if (firstSlot == 54) + { + Player.inventory[54].SetDefaults(tempType); + Player.inventory[54].stack = tempStack; + Player.inventory[54].favorited = favorited[lastSlot - 54]; + } + + // Produce a visual effect showing the top ammo that you swapped to. + int visualType = Player.inventory[firstSlot].type; + Texture2D ammoTex = TextureAssets.Item[visualType].Value; + int frameAmt = Main.itemAnimations[visualType] == null ? 1 : ammoTex.Height / Main.itemAnimations[visualType].GetFrame(ammoTex).Height; + CustomSprite ammoVisual = new(Player.Center - Vector2.UnitY * 20f, -Vector2.UnitY * 7f, 30, ammoTex, 1f, Color.White, 0f, false, false, frameAmt); + GeneralParticleHandler.SpawnParticle(ammoVisual); + } + } + if (CalamityKeybinds.ArmorSetBonusHotKey.JustPressed) { - if (brimflameSet && !Player.HasCooldown(BrimflameFrenzy.ID)) - { - if (Player.whoAmI == Main.myPlayer) - { - if (brimflameFrenzy) - { - brimflameFrenzy = false; - Player.ClearBuff(ModContent.BuffType()); - } - else - { - brimflameFrenzy = true; - Player.AddBuff(ModContent.BuffType(), 10 * 60, true); - SoundEngine.PlaySound(BrimflameScowl.ActivationSound, Player.Center); - for (int i = 0; i < 36; i++) - { - int brimDust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); - Main.dust[brimDust].velocity *= 3f; - Main.dust[brimDust].scale *= 1.15f; - } - int dustAmt = 36; - for (int j = 0; j < dustAmt; j++) - { - Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; - dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; - Vector2 dustVelocity = dustRotation - Player.Center; - int brimDust2 = Dust.NewDust(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f); - Main.dust[brimDust2].noGravity = true; - Main.dust[brimDust2].noLight = true; - Main.dust[brimDust2].velocity = dustVelocity; - } - } - } - } - if (tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID) && !tarragonCloak) - { - if (Player.whoAmI == Main.myPlayer) - { - Player.AddBuff(ModContent.BuffType(), 602, false); - } - } - if (bloodflareRanged && !Player.HasCooldown(BloodflareRangedSet.ID)) - { - if (Player.whoAmI == Main.myPlayer) - Player.AddCooldown(BloodflareRangedSet.ID, 1800); + PlayerLoader.ArmorSetBonusActivated(Player); - 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.Necroplasm, 0f, 0f, 0, default, 1f); - Main.dust[dust].velocity *= 3f; - Main.dust[dust].scale *= 1.15f; - } - int dustAmt = 36; - for (int d = 0; d < dustAmt; d++) - { - 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.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; - } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; + // Activate vanilla set bonuses + if (Player.setVortex && !Player.mount.Active) + Player.vortexStealthActive = !Player.vortexStealthActive; - int damage = (int)(Player.GetTotalDamage().ApplyTo(300f)); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); - - if (Player.whoAmI == Main.myPlayer) - { - var source = Player.GetSource_Misc("1"); - for (int i = 0; i < 8; i++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - float randomSpeed = (float)Main.rand.Next(1, 7); - float randomSpeed2 = (float)Main.rand.Next(1, 7); - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int soul = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); - if (soul.WithinBounds(Main.maxProjectiles)) - Main.projectile[soul].DamageType = DamageClass.Generic; - int soul2 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); - if (soul2.WithinBounds(Main.maxProjectiles)) - Main.projectile[soul2].DamageType = DamageClass.Generic; - } - } - } - if (omegaBlueSet && !Player.HasCooldown(OmegaBlue.ID)) + if (Player.setForbidden) { - if (Player.whoAmI == Main.myPlayer) - { - Player.AddBuff(ModContent.BuffType(), 300, false); - } - Player.AddCooldown(OmegaBlue.ID, 1800); - SoundEngine.PlaySound(OmegaBlueHelmet.ActivationSound, Player.Center); - for (int i = 0; i < 66; i++) - { - 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; - Main.dust[d].velocity *= 6.6f; - } - } - if (dsSetBonus) - { - SoundEngine.PlaySound(DemonshadeHelm.ActivationSound, Player.Center); - for (int i = 0; i < 36; i++) - { - int brimDust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); - Main.dust[brimDust].velocity *= 3f; - Main.dust[brimDust].scale *= 1.15f; - } - int dustAmt = 36; - for (int j = 0; j < dustAmt; j++) - { - Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; - dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; - Vector2 dustVelocity = dustRotation - Player.Center; - int brimDust2 = Dust.NewDust(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f); - Main.dust[brimDust2].noGravity = true; - Main.dust[brimDust2].noLight = true; - Main.dust[brimDust2].velocity = dustVelocity; - } - if (Player.whoAmI == Main.myPlayer) - { - Player.AddBuff(ModContent.BuffType(), 600, false); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - foreach (NPC npc in Main.ActiveNPCs) - { - if (!npc.friendly && !npc.dontTakeDamage && Vector2.Distance(Player.Center, npc.Center) <= 3000f) - npc.AddBuff(ModContent.BuffType(), 600, false); - } - } - } - if (plagueReaper && !Player.HasCooldown(PlagueBlackout.ID)) - { - SoundEngine.PlaySound(PlagueReaperMask.ActivationSound, Player.Center); - Player.AddCooldown(PlagueBlackout.ID, 1800); - } - if (forbiddenCirclet && forbiddenCooldown <= 0) - { - forbiddenCooldown = 45; - int stormMana = (int)(ForbiddenCirclet.manaCost * Player.manaCost); - if (Player.statMana < stormMana) - { - if (Player.manaFlower) - { - Player.QuickMana(); - } - } - if (Player.statMana >= stormMana && !Player.silence) - { - var source = Player.GetSource_Misc("1"); - Player.manaRegenDelay = (int)Player.maxRegenDelay; - Player.statMana -= stormMana; + Player.MinionRestTargetAim(); - // To compute Forbidden Circlet tornado damage, create a fake stat modifier on the spot which combines both classes. - StatModifier forbidden = Player.GetTotalDamage().CombineWith(Player.GetDamage()); - int damage = (int)forbidden.ApplyTo(ForbiddenCirclet.tornadoBaseDmg); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); - - float kBack = Player.GetTotalKnockback().ApplyTo(ForbiddenCirclet.tornadoBaseKB); - - if (Player.whoAmI == Main.myPlayer) - { - int mark = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, kBack, Player.whoAmI); - if (mark.WithinBounds(Main.maxProjectiles)) - Main.projectile[mark].DamageType = DamageClass.Generic; - } - } + if (!Player.setForbiddenCooldownLocked) + Player.CommandForbiddenStorm(); } - if (prismaticSet && !Player.HasCooldown(PrismaticLaser.ID) && prismaticLasers <= 0) - prismaticLasers = CalamityUtils.SecondsToFrames(35f); } + if (CalamityKeybinds.ArmorSetBonusHotKey.Current) + { + ArmorSetBonusKeyHeldTimer++; + PlayerLoader.ArmorSetBonusHeld(Player, ArmorSetBonusKeyHeldTimer); + } + else + ArmorSetBonusKeyHeldTimer = 0; + if (CalamityKeybinds.AccessoryParryHotKey.JustPressed) { if (blazingCore && blazingCoreParry == 0 && blazingCoreSuccessfulParry == 0) @@ -3107,33 +3514,39 @@ namespace CalamityMod.CalPlayer //minor cheese prevention with standing on a spike with later game gear spamming parry :skull: //because of ordering, if they do not have the cooldown, it will not check the projectile array. Likewise if there are no bosses alive. //Furthermore, Enumerable#Any is lightweight and returns immediately if a single object matches it's predicate - if (!Player.HasCooldown(ParryCooldown.ID) || Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + if (!Player.HasCooldown(ParryCooldown.ID) || Player.ownedProjectileCounts[ProjectileType()] == 0) { GeneralScreenShakePower = 3.5f; blazingCoreParry = 30; SoundEngine.PlaySound(BlazingCore.ParryActivateSound, Player.Center); var mySourceIsIMadeItUp = Player.GetSource_FromThis(); - int blazingSun = Projectile.NewProjectile(mySourceIsIMadeItUp, Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); + int blazingSun = Projectile.NewProjectile(mySourceIsIMadeItUp, Player.Center, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); Main.projectile[blazingSun].Center = Player.Center; - int blazingSun2 = Projectile.NewProjectile(mySourceIsIMadeItUp, Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); + int blazingSun2 = Projectile.NewProjectile(mySourceIsIMadeItUp, Player.Center, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); Main.projectile[blazingSun2].Center = Player.Center; } } else if (flameLickedShell && flameLickedShellParry == 0) { - if (!Player.HasCooldown(ParryCooldown.ID) || Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + if (!Player.HasCooldown(ParryCooldown.ID) || Player.ownedProjectileCounts[ProjectileType()] == 0) { GeneralScreenShakePower = 2.5f; SoundEngine.PlaySound(ProfanedGuardianDefender.RockShieldSpawnSound, Player.Center); flameLickedShellParry = FlameLickedShell.flameLickedParry; } } + else if (shieldOfTheOcean && shieldOfTheOceanParry == 0) + { + GeneralScreenShakePower = 2f; + SoundEngine.PlaySound(ShieldoftheOcean.TriggerSound, Player.Center); + shieldOfTheOceanParry = ShieldoftheOcean.ParryTime; + } } // Trigger for pressing the God Slayer dash key if (CalamityKeybinds.GodSlayerDashHotKey.JustPressed) { - if (godSlayer && (Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && !Player.HasCooldown(GodSlayerDash.ID) && Player.dashDelay == 0) + if (godSlayer && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && !Player.HasCooldown(GodSlayerDash.ID) && Player.dashDelay == 0) { godSlayerDashHotKeyPressed = true; } @@ -3151,7 +3564,7 @@ namespace CalamityMod.CalPlayer if (Player.Calamity().SpeedBlasterDashStarted || (Player.dashDelay != 0 && (Player.Calamity().LastUsedDashID == SuperradiantSawDash.ID || Player.Calamity().LastUsedDashID == SpeedBlasterDash.ID))) { - Player.Calamity().DeferredDashID = Player.ActiveItem().type == ModContent.ItemType() ? SuperradiantSawDash.ID : SpeedBlasterDash.ID; + Player.Calamity().DeferredDashID = Player.ActiveItem().type == ItemType() ? SuperradiantSawDash.ID : SpeedBlasterDash.ID; Player.dash = 0; } @@ -3159,7 +3572,7 @@ namespace CalamityMod.CalPlayer if (CalamityKeybinds.RageHotKey.JustPressed) { // Gael's Greatsword replaces Rage Mode with an uber skull attack - if (!(Player.HasCooldown(Cooldowns.GaelsRage.ID)) && Player.ActiveItem().type == ModContent.ItemType() && rage > 0f) + if (!(Player.HasCooldown(Cooldowns.GaelsRage.ID)) && Player.ActiveItem().type == ItemType() && rage > 0f) { SoundEngine.PlaySound(SilvaHeadSummon.DispelSound, Player.Center); @@ -3168,12 +3581,12 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 30; i++) { float angle = MathHelper.TwoPi * i / 30f; - 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, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1f); - Main.dust[dustIndex].velocity *= 2.25f; - Main.dust[dustIndex].noGravity = true; + Dust dust = Dust.NewDustDirect(Player.position, 120, 120, DustID.Rain_BloodMoon, 0f, 0f, 0, default, 2f); + dust.noGravity = true; + dust.velocity *= 4f; + dust = Dust.NewDustDirect(Player.position, 120, 120, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1f); + dust.velocity *= 2.25f; + dust.noGravity = true; Dust.NewDust(Player.Center + angle.ToRotationVector2() * 160f, 0, 0, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1f); } @@ -3189,7 +3602,7 @@ namespace CalamityMod.CalPlayer float angle = MathHelper.TwoPi * i / skullCount; Vector2 initialVelocity = angle.ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(12f)) * skullSpeed * new Vector2(0.82f, 1.5f) * Main.rand.NextFloat(0.8f, 1.2f) * (i < skullCount / 2 ? 0.25f : 1f); - int projectileIndex = Projectile.NewProjectile(source, Player.Center + initialVelocity * 3f, initialVelocity, ModContent.ProjectileType(), damage, 2f, Player.whoAmI); + int projectileIndex = Projectile.NewProjectile(source, Player.Center + initialVelocity * 3f, initialVelocity, ProjectileType(), damage, 2f, Player.whoAmI); Main.projectile[projectileIndex].tileCollide = false; Main.projectile[projectileIndex].localAI[1] = (Main.projectile[projectileIndex].velocity.Y < 0f).ToInt(); if (projectileIndex.WithinBounds(Main.maxProjectiles)) @@ -3205,7 +3618,7 @@ namespace CalamityMod.CalPlayer if (rage >= rageMax && !rageModeActive) { // Rage duration isn't calculated here because the buff keeps itself alive automatically as long as the player has Rage left. - Player.AddBuff(ModContent.BuffType(), 2); + Player.AddBuff(BuffType(), 2); // Play Rage Activation sound if (Player.whoAmI == Main.myPlayer) @@ -3234,7 +3647,7 @@ namespace CalamityMod.CalPlayer { if (adrenaline == adrenalineMax && !adrenalineModeActive) { - Player.AddBuff(ModContent.BuffType(), AdrenalineDuration); + Player.AddBuff(BuffType(), AdrenalineDuration); SoundStyle ActivationSound = draedonsHeart ? NanomachinesActivationSound : AdrenalineActivationSound; @@ -3263,7 +3676,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < dustPerSegment; ++i) { bool electricity = Main.rand.NextBool(4); - int dustID = electricity ? (Main.rand.NextBool() ? 132 : 131) : ModContent.DustType(); + int dustID = electricity ? (Main.rand.NextBool() ? 132 : 131) : DustType(); float interpolant = i + 0.5f; float spreadSpeed = Main.rand.NextFloat(0.5f, maxDustVelSpread); @@ -3292,6 +3705,178 @@ namespace CalamityMod.CalPlayer } } } + + public override void ArmorSetBonusActivated() + { + // TODO -- It would be nice if triggerable set bonuses used interfaces instead of having to go through this large if chain. + if (brimflameSet && !Player.HasCooldown(BrimflameFrenzy.ID)) + { + if (Player.whoAmI == Main.myPlayer) + { + if (brimflameFrenzy) + { + brimflameFrenzy = false; + Player.ClearBuff(BuffType()); + } + else + { + brimflameFrenzy = true; + Player.AddBuff(BuffType(), 10 * 60, true); + SoundEngine.PlaySound(BrimflameScowl.ActivationSound, Player.Center); + for (int i = 0; i < 36; i++) + { + Dust brimDust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + brimDust.velocity *= 3f; + brimDust.scale *= 1.15f; + } + int dustAmt = 36; + for (int j = 0; j < dustAmt; j++) + { + Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; + Vector2 dustVelocity = dustRotation - Player.Center; + Dust brimDust2 = Dust.NewDustDirect(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f); + brimDust2.noGravity = true; + brimDust2.noLight = true; + brimDust2.velocity = dustVelocity; + } + } + } + } + if (tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID) && !tarragonCloak) + { + if (Player.whoAmI == Main.myPlayer) + { + Player.AddBuff(BuffType(), 602, false); + } + } + if (bloodflareRanged && !Player.HasCooldown(BloodflareRangedSet.ID)) + { + if (Player.whoAmI == Main.myPlayer) + Player.AddCooldown(BloodflareRangedSet.ID, 1800); + + SoundEngine.PlaySound(BloodflareHeadRanged.ActivationSound, Player.Center); + for (int d = 0; d < 64; d++) + { + Dust dust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); + dust.velocity *= 3f; + dust.scale *= 1.15f; + } + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) + { + 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; + Dust phanto = Dust.NewDustDirect(source + dustVel, 0, 0, (int)CalamityDusts.Necroplasm, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); + phanto.noGravity = true; + phanto.noLight = true; + phanto.velocity = dustVel; + } + + if (Player.whoAmI == Main.myPlayer) + { + var source = Player.GetSource_Misc("1"); + int damage = (int)(Player.GetTotalDamage().ApplyTo(300f)); + for (int i = 0; i < 16; i++) + { + float ai1 = Main.rand.NextFloat() + 0.5f; + Vector2 circleVel = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * Main.rand.NextFloat(5f, 8f); + int soul = Projectile.NewProjectile(source, Player.Center, circleVel, ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].DamageType = DamageClass.Generic; + } + } + } + if (omegaBlueSet && !Player.HasCooldown(OmegaBlue.ID)) + { + if (Player.whoAmI == Main.myPlayer) + { + Player.AddBuff(BuffType(), 300, false); + } + Player.AddCooldown(OmegaBlue.ID, 1800); + SoundEngine.PlaySound(OmegaBlueHelmet.ActivationSound, Player.Center); + for (int i = 0; i < 66; i++) + { + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 2.6f); + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 1f; + dust.velocity *= 6.6f; + } + } + if (dsSetBonus) + { + SoundEngine.PlaySound(DemonshadeHelm.ActivationSound, Player.Center); + for (int i = 0; i < 36; i++) + { + Dust brimDust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + brimDust.velocity *= 3f; + brimDust.scale *= 1.15f; + } + int dustAmt = 36; + for (int j = 0; j < dustAmt; j++) + { + Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; + Vector2 dustVelocity = dustRotation - Player.Center; + Dust brimDust2 = Dust.NewDustDirect(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f); + brimDust2.noGravity = true; + brimDust2.noLight = true; + brimDust2.velocity = dustVelocity; + } + if (Player.whoAmI == Main.myPlayer) + { + Player.AddBuff(BuffType(), 600, false); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + foreach (NPC npc in Main.ActiveNPCs) + { + if (!npc.friendly && !npc.dontTakeDamage && Vector2.Distance(Player.Center, npc.Center) <= 3000f) + npc.AddBuff(BuffType(), 600, false); + } + } + } + if (plagueReaper && !Player.HasCooldown(PlagueBlackout.ID)) + { + SoundEngine.PlaySound(PlagueReaperMask.ActivationSound, Player.Center); + Player.AddCooldown(PlagueBlackout.ID, 1800); + } + if (forbiddenCirclet && forbiddenCooldown <= 0) + { + forbiddenCooldown = 45; + int stormMana = (int)(ForbiddenCirclet.manaCost * Player.manaCost); + if (Player.statMana < stormMana) + { + if (Player.manaFlower) + { + Player.QuickMana(); + } + } + if (Player.statMana >= stormMana && !Player.silence) + { + var source = Player.GetSource_Misc("1"); + Player.manaRegenDelay = (int)Player.maxRegenDelay; + Player.statMana -= stormMana; + + // To compute Forbidden Circlet tornado damage, create a fake stat modifier on the spot which combines both classes. + StatModifier forbidden = Player.GetTotalDamage().CombineWith(Player.GetDamage()); + int damage = (int)forbidden.ApplyTo(ForbiddenCirclet.tornadoBaseDmg); + + float kBack = Player.GetTotalKnockback().ApplyTo(ForbiddenCirclet.tornadoBaseKB); + + if (Player.whoAmI == Main.myPlayer) + { + int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); + if (mark.WithinBounds(Main.maxProjectiles)) + Main.projectile[mark].DamageType = DamageClass.Generic; + } + } + } + if (prismaticSet && !Player.HasCooldown(PrismaticLaser.ID) && prismaticLasers <= 0) + prismaticLasers = CalamityUtils.SecondsToFrames(35f); + } #endregion #region TeleportMethods @@ -3336,7 +3921,7 @@ namespace CalamityMod.CalPlayer player.StopVanityActions(false); player.RemoveAllGrapplingHooks(); player.Teleport(pos, style); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) RemoteClient.CheckSection(player.whoAmI, player.Center); NetMessage.SendData(MessageID.TeleportEntity, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, style, 0, 0); player.velocity = Vector2.Zero; @@ -3346,44 +3931,44 @@ namespace CalamityMod.CalPlayer // Make some dust for (int index = 0; index < 100; ++index) { - 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; + Dust.NewDust(player.position, player.width, player.height, DustID.TeleportationPotion, player.velocity.X * 0.1f, player.velocity.Y * 0.1f, 150, Color.Cyan, 1.2f); } 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, DustID.TeleportationPotion); - Main.dust[idx].scale = Main.rand.NextFloat(0.2f, 0.7f); + Dust dust = Dust.NewDustDirect(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.TeleportationPotion); + dust.scale = Main.rand.NextFloat(0.2f, 0.7f); if (k < 10) - Main.dust[idx].scale += 0.25f; + dust.scale += 0.25f; if (k < 5) - Main.dust[idx].scale += 0.25f; + dust.scale += 0.25f; } for (int k = 0; k < 50; k++) { - int idx = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.DungeonSpirit); - Main.dust[idx].noGravity = true; + Dust dust = Dust.NewDustDirect(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.DungeonSpirit); + dust.noGravity = true; for (int i = 0; i < 5; i++) { if (Main.rand.NextBool(3)) - Main.dust[idx].velocity *= 0.75f; + dust.velocity *= 0.75f; } if (Main.rand.NextBool(3)) { - Main.dust[idx].velocity *= 2f; - Main.dust[idx].scale *= 1.2f; + dust.velocity *= 2f; + dust.scale *= 1.2f; } if (Main.rand.NextBool(3)) { - Main.dust[idx].velocity *= 2f; - Main.dust[idx].scale *= 1.2f; + dust.velocity *= 2f; + dust.scale *= 1.2f; } if (Main.rand.NextBool()) { - Main.dust[idx].fadeIn = Main.rand.NextFloat(0.75f, 1f); - Main.dust[idx].scale = Main.rand.NextFloat(0.25f, 0.75f); + dust.fadeIn = Main.rand.NextFloat(0.75f, 1f); + dust.scale = Main.rand.NextFloat(0.25f, 0.75f); } - Main.dust[idx].scale *= 0.8f; + dust.scale *= 0.8f; } if (playSound) @@ -3395,14 +3980,14 @@ namespace CalamityMod.CalPlayer public override void UpdateEquips() { // TODO -- why is boss health bar code in Player.UpdateEquips and not a ModSystem - CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; + CalamityClientConfig.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) + if (CalamityServerConfig.Instance.FasterTilePlacement) { Player.tileSpeed += 0.5f; Player.wallSpeed += 0.5f; @@ -3416,35 +4001,35 @@ namespace CalamityMod.CalPlayer //Life Jelly regen aura spawn when using a healing potion if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && lifejelly && !GrandGelatin) - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); //Cleansing Jelly cleansing aura spawn when using a healing potion if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && cleansingjelly && !GrandGelatin) { - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); } //Grand Gellatin regen and cleansing aura spawn when using a healing potion if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && GrandGelatin && !absorber) { - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); } //Absorber's regen, cleansing, and buffing aura spawn when using a healing potion if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && absorber) { - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); } if (snowman) { if (Player.whoAmI == Main.myPlayer && !snowmanNoseless) - Player.AddBuff(ModContent.BuffType(), 60, true); + Player.AddBuff(BuffType(), 60, true); } if (abyssalDivingSuit) { - Player.AddBuff(ModContent.BuffType(), 60, true); + Player.AddBuff(BuffType(), 60, true); if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(DivingPlatesBroken.ID)) { - Player.AddBuff(ModContent.BuffType(), 2); + Player.AddBuff(BuffType(), 2); } if (Player.whoAmI == Main.myPlayer && Player.active && abyssalDivingSuitPlateHits < 3) @@ -3464,29 +4049,29 @@ namespace CalamityMod.CalPlayer if (aquaticHeart) { - Player.AddBuff(ModContent.BuffType(), 60, true); + Player.AddBuff(BuffType(), 60, true); } if (aquaticHeart && NPC.downedBoss3) { if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(AquaticHeartIceShield.ID)) { - Player.AddBuff(ModContent.BuffType(), 2); + Player.AddBuff(BuffType(), 2); } } if (profanedCrystal) { - Player.AddBuff(ModContent.BuffType(), 60, true); + Player.AddBuff(BuffType(), 60, true); } if (gSabaton) { if (Player.whoAmI == Main.myPlayer) { - //While holding hotkey, but before slam, bring Y velocity closer to 0 + // While holding hotkey, but before slam, bring Y velocity closer to 0 if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime != 0 && !gSabatonFalling) { Player.velocity.Y *= (60 - (gSabatonHotkeyHoldTime / 2f)) / 60f; } - //Play sound a bit early so it goes in time with the fall + // Play sound a bit early so it goes in time with the fall if (gSabatonHotkeyHoldTime == 15 && !gSabatonFalling) { SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/GravistarCharge") { Volume = 0.3f }); @@ -3495,9 +4080,11 @@ namespace CalamityMod.CalPlayer if (gSabatonHotkeyHoldTime == 30) { gSabatonFalling = true; + Player.velocity.Y = 0.01f; } - //Cancel fall and don't give 'on ground' effects if on rope, on mount, grappled, or tongued - if (Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) + // Cancel fall and don't give 'on ground' effects if on rope, on mount, grappled, or tongued + // Also cancel fall if the player has upwards Y velocity (Goodbye Inner Tube cheese) + if (Player.velocity.Y < 0f || Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) { gSabatonFall = 0; gSabatonFalling = false; @@ -3506,27 +4093,27 @@ namespace CalamityMod.CalPlayer { SpawnGravistarParticle(); - //Cap time converted to damage at 2 seconds + // Cap time converted to damage at 2 seconds if (gSabatonFall < 120) gSabatonFall++; Player.maxFallSpeed = 40f; Player.gravity = 1.3f; - //If the player can fly during the fall, the physics gets a bit funky + // If the player can fly during the fall, the physics gets a bit funky Player.controlJump = false; - //Check if player hit some form of solid resistance (the ground) + // Check if player hit some form of solid resistance (the ground) if (Player.oldVelocity.Y == Player.velocity.Y) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory(FindAccessory(ItemType())); //Spawn explosion. ai[0] is used for transferring the recorded falling time - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.CalcIntDamage(InterstellarStompers.SlamDamage)); + int damage = Player.CalcIntDamage(InterstellarStompers.SlamDamage); - Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 4f, Player.whoAmI, gSabatonFall); + Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType(), damage, 4f, Player.whoAmI, gSabatonFall); gSabatonFall = 0; gSabatonFalling = false; - //Temporary jump speed is granted for 40 frames + // Temporary jump speed is granted for 40 frames gSabatonTempJumpSpeed = 40; } } @@ -3537,6 +4124,10 @@ namespace CalamityMod.CalPlayer gSabatonFall = 0; gSabatonFalling = false; } + + // Reset The Evolution's same projectile DR if unequipped or the cooldown ends + if (!evolution || !Player.HasCooldown(GlobalDodge.ID)) + projTypeJustHitBy = -1; } #endregion @@ -3574,7 +4165,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Player.dye.Length; i++) { - if (Player.dye[i].type == ModContent.ItemType()) + if (Player.dye[i].type == ItemType()) GameShaders.Armor.GetSecondaryShader(Player.dye[i].dye, Player)?.UseColor(GetCurrentMoonlightDyeColor()); } @@ -3659,7 +4250,7 @@ namespace CalamityMod.CalPlayer #region PostUpdateBuffs public override void PostUpdateBuffs() { - if (Player.whoAmI == Main.myPlayer && CalamityConfig.Instance.VanillaCooldownDisplay) + if (Player.whoAmI == Main.myPlayer && CalamityClientConfig.Instance.VanillaCooldownDisplay) { if (Player.whoAmI == Main.myPlayer && Player.potionDelay != 0) potionSick = true; @@ -3779,7 +4370,7 @@ namespace CalamityMod.CalPlayer #region Shop Restrictions public override bool CanSellItem(NPC vendor, Item[] shopInventory, Item item) { - if (item.type == ModContent.ItemType()) + if (item.type == ItemType()) return DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs; //no easy moneycoins for post doggo/yhar return base.CanSellItem(vendor, shopInventory, item); } @@ -3796,15 +4387,19 @@ namespace CalamityMod.CalPlayer (shadowSpeed ? 0.5f : 0f) + (stressPills ? 0.05f : 0f) + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + - (aquaticHeartWaterBuff ? 0.15f : 0f) + + (aquaticHeartWaterBuff ? AquaticHeart.WaterSpeedBoost : 0f) + + (laudanum && Player.HasBuff(BuffID.VortexDebuff) ? 0.15f : 0f) + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + - (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + + (kamiBoost ? YanmeisKnife.RunAccelerationBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + - (nimbleBounderBoost ? 0.1f : 0f) + - (blueCandle ? CirrusBlueCandleBuff.AccelerationBoost : 0f) + + (getSandCloakAccelBoost ? 0.75f : 0f) + + (nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) + + (ascendantInsignia ? 0.25f : 0f ) + // Added to Soaring Insignia's 1.25x multiplier to get 1.5x + (blueCandle ? WeightlessCandle.AccelerationBoost : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + + //(exaltedKillMode ? 7f : devilsDevastationKillMode ? 11f : 0) + (hasteLevel * 0.05f); float runSpeedMult = 1f + @@ -3812,14 +4407,15 @@ namespace CalamityMod.CalPlayer (shadowSpeed ? 0.5f : 0f) + (stressPills ? 0.05f : 0f) + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + - (aquaticHeartWaterBuff ? 0.15f : 0f) + + (aquaticHeartWaterBuff ? AquaticHeart.WaterSpeedBoost : 0f) + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + - (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + + (kamiBoost ? YanmeisKnife.RunSpeedBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + - (nimbleBounderBoost ? 0.1f : 0f) + + (nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + + //(exaltedKillMode ? 0.4f : devilsDevastationKillMode ? 0.7f : 0) + (hasteLevel * 0.05f); if ((Player.slippy || Player.slippy2) && Player.iceSkate) @@ -3885,9 +4481,6 @@ namespace CalamityMod.CalPlayer #region Get Weapon Damage And KB public override void ModifyWeaponDamage(Item item, ref StatModifier damage) { - if (fungalSymbiote && CalamityLists.MushroomWeaponIDs.Contains(item.type)) - damage += 0.1f; - if (item.CountsAsClass()) { // Apply weapon modifier stealth strike damage bonus @@ -3900,43 +4493,49 @@ namespace CalamityMod.CalPlayer public override void ModifyWeaponKnockback(Item item, ref StatModifier knockback) { + // Adding to StatModifier adds to the additive multiplier bool rogue = item.CountsAsClass(); - if (auricBoost) - knockback.Flat += item.knockBack * ((1f - modStealth) * 0.5f); if (whiskey) - knockback.Flat += item.knockBack * 0.2f; + knockback += Whiskey.KnockbackBoost; if (tequila && Main.dayTime) - knockback += item.knockBack * 0.1f; + knockback += Tequila.KnockbackBoost; if (tequilaSunrise && Main.dayTime) - knockback += item.knockBack * 0.2f; + knockback += TequilaSunrise.KnockbackBoost; if (moscowMule) - knockback += item.knockBack * 0.5f; + knockback += MoscowMule.KnockbackBoost; if (titanHeartMask && rogue) - knockback += item.knockBack * 0.05f; + knockback += 0.05f; if (titanHeartMantle && rogue) - knockback += item.knockBack * 0.05f; + knockback += 0.05f; if (titanHeartBoots && rogue) - knockback += item.knockBack * 0.05f; + knockback += 0.05f; if (titanHeartSet && rogue) - knockback += item.knockBack * 0.2f; + knockback += 0.2f; if (titanHeartSet && StealthStrikeAvailable() && rogue) - knockback += item.knockBack; + knockback += 1f; + } + #endregion + + #region Modify Luck + public override void ModifyLuck(ref float luck) + { + luck += calamityBonusLuck; } #endregion #region Modify Mana Cost public override void ModifyManaCost(Item item, ref float reduce, ref float mult) { - if (CalamityLists.MagicGunIDs.Contains(item.type) && meteorSet) + if (MagicGunIDList.Includes(item.type) && meteorSet) { mult *= 0.33f; } @@ -3953,14 +4552,14 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(20)) { int confettiDust = Main.rand.Next(139, 143); - int confetti = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, confettiDust, Player.velocity.X, Player.velocity.Y, 0, new Color(), 1.2f); - Main.dust[confetti].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); - Main.dust[confetti].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); - Main.dust[confetti].velocity.X += Main.rand.Next(-50, 51) * 0.05f; - Main.dust[confetti].velocity.Y += Main.rand.Next(-50, 51) * 0.05f; - Main.dust[confetti].scale *= (float)(1.0 + Main.rand.Next(-30, 31) * 0.01); + Dust confetti = Dust.NewDustDirect(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, confettiDust, Player.velocity.X, Player.velocity.Y, 0, new Color(), 1.2f); + confetti.velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + confetti.velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + confetti.velocity.X += Main.rand.Next(-50, 51) * 0.05f; + confetti.velocity.Y += Main.rand.Next(-50, 51) * 0.05f; + confetti.scale *= (float)(1.0 + Main.rand.Next(-30, 31) * 0.01); } - if (Main.rand.NextBool(40) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(40) && !Main.dedServ) { int confettiGore = Main.rand.Next(276, 283); int confetti = Gore.NewGore(Player.GetSource_ItemUse(item), new Vector2(hitbox.X, hitbox.Y), Player.velocity, confettiGore, 1f); @@ -3975,7 +4574,7 @@ namespace CalamityMod.CalPlayer if (item.CountsAsClass()) { var source = Player.GetSource_ItemUse(item); - if (fungalSymbiote && CalamityLists.MushroomWeaponIDs.Contains(item.type) && Player.whoAmI == Main.myPlayer) + if (fungalSymbiote && Player.HasBuff(BuffType()) && Player.whoAmI == Main.myPlayer) { if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.1) || Player.itemAnimation == (int)(Player.itemAnimationMax * 0.3) || @@ -4052,7 +4651,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool(3) ? 114 : ModContent.DustType(), Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, Main.rand.NextFloat(0.3f, 1f)); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool(3) ? 114 : DustType(), Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, Main.rand.NextFloat(0.3f, 1f)); } } if (flaskCrumbling) @@ -4066,8 +4665,8 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(3)) { - 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; + Dust rainbow = Dust.NewDustDirect(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); + rainbow.noGravity = true; } } if (dsSetBonus) @@ -4082,6 +4681,15 @@ namespace CalamityMod.CalPlayer #endregion #region Shoot + // Brimflame Frenzy disables mana potion mana recovery + // This also covers all Quick Hotkeys + public override bool CanUseItem(Item item) + { + if (item.healMana > 0 && brimflameFrenzy) + return false; + return base.CanUseItem(item); + } + public override bool Shoot(Item item, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) { if (bladeArmEnchant) @@ -4089,9 +4697,10 @@ namespace CalamityMod.CalPlayer if (veneratedLocket) { + var LocketSource = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); if (item.CountsAsClass()) { - if (!CalamityLists.VeneratedLocketBanlist.Contains(item.type)) + if (!VeneratedLocketBanList.Includes(item.type)) { float veneratedCloneSpeed = item.shootSpeed; Vector2 realPlayerPos = Player.RotatedRelativePoint(Player.MountedCenter, true); @@ -4134,9 +4743,8 @@ namespace CalamityMod.CalPlayer float speedY5 = veneratedCloneYPos + (float)Main.rand.Next(-30, 31) * 0.02f; // 08DEC2023: Ozzatron: Locket + Old Fashioned may need to be a corner case. We should probably just rework Locket instead. - int locketDamage = Player.ApplyArmorAccDamageBonusesTo((int)(damage * 0.07f)); - - int p = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, locketDamage, knockBack * 0.5f, Player.whoAmI); + int locketDamage = (int)(damage * 0.07f); + int p = Projectile.NewProjectile(LocketSource, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, locketDamage, knockBack * 0.5f, Player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) { @@ -4145,9 +4753,9 @@ 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 == ItemType()) Main.projectile[p].ai[1] = 1f; //MUST BE 1 OTHERWISE CLONES GENERATE STEALTH AAAAAAAAAAA - if (item.type == ModContent.ItemType()) + if (item.type == ItemType()) Main.projectile[p].ai[0] = -1f; } @@ -4155,7 +4763,6 @@ namespace CalamityMod.CalPlayer { int knifeCount = 12; int knifeDamage = (int)Player.GetTotalDamage().ApplyTo(55); - knifeDamage = Player.ApplyArmorAccDamageBonusesTo(knifeDamage); float angleStep = MathHelper.TwoPi / knifeCount; float speed = 14f; @@ -4166,7 +4773,7 @@ namespace CalamityMod.CalPlayer velocity2 = velocity2.RotatedBy(angleStep * i); int knifeCol = Main.rand.Next(0, 2); - int knife = Projectile.NewProjectile(source, Player.Center, velocity2, ModContent.ProjectileType(), knifeDamage, 0f, Player.whoAmI, knifeCol, 0); + int knife = Projectile.NewProjectile(LocketSource, Player.Center, velocity2, ProjectileType(), knifeDamage, 0f, Player.whoAmI, knifeCol, 0); if (knife.WithinBounds(Main.maxProjectiles)) Main.projectile[knife].DamageType = DamageClass.Generic; } @@ -4178,12 +4785,13 @@ namespace CalamityMod.CalPlayer { if (item.CountsAsClass()) { + var MedallionSource = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); int d = (int)Player.GetTotalDamage().ApplyTo(RustyMedallion.AcidDropBaseDamage); - d = Player.ApplyArmorAccDamageBonusesTo(d); - 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); + Vector2 mouse = Player.ClampedMouseWorld(); + Vector2 startingPosition = mouse - Vector2.UnitY.RotatedByRandom(0.3f) * 1250f; + Vector2 directionToMouse = (mouse - startingPosition).SafeNormalize(Vector2.UnitX); + int drop = Projectile.NewProjectile(MedallionSource, startingPosition, directionToMouse * 15f, ProjectileType(), d, 0f, Player.whoAmI, 3); if (drop.WithinBounds(Main.maxProjectiles)) { Main.projectile[drop].penetrate = 2; @@ -4192,18 +4800,6 @@ namespace CalamityMod.CalPlayer RustyMedallionCooldown = RustyMedallion.AcidCreationCooldown; } } - - 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 @@ -4211,6 +4807,66 @@ namespace CalamityMod.CalPlayer #region Frame Effects public override void FrameEffects() { + // Mannequin frame effects + // These "players" never load Calamity's equippable bools so they need to be manually loaded + if (Player.isDisplayDollOrInanimate) + { + // Body + if (Player.armor[1].type == ModContent.ItemType()) + Player.body = EquipLoader.GetEquipSlot(Mod, "AuricTeslaBodyArmor", EquipType.Body); + else if (Player.armor[1].type == ModContent.ItemType()) + Player.body = EquipLoader.GetEquipSlot(Mod, "DaedalusBreastplate", EquipType.Body); + else if (Player.armor[1].type == ModContent.ItemType()) + Player.body = EquipLoader.GetEquipSlot(Mod, "EmpyreanCloak", EquipType.Body); + else if (Player.armor[1].type == ModContent.ItemType()) + Player.body = EquipLoader.GetEquipSlot(Mod, "SnowRuffianChestplate", EquipType.Body); + else if (Player.armor[1].type == ModContent.ItemType()) + Player.body = EquipLoader.GetEquipSlot(Mod, "VictideBreastplate", EquipType.Body); + + // Legs + if (Player.armor[2].type == ModContent.ItemType()) + Player.legs = EquipLoader.GetEquipSlot(Mod, "VictideGreaves", EquipType.Legs); + + // Set Bonus + if (Player.armor[0].type == ModContent.ItemType() + && Player.armor[1].type == ModContent.ItemType() + && Player.armor[2].type == ModContent.ItemType()) + snowRuffianSet = true; + + // Accessories + for (int i = 3; i < 8; i++) + { + Item vanity = Player.armor[i]; + + if (vanity.type == ModContent.ItemType()) + Player.GetModPlayer().transformationActive = true; + if (vanity.type == ModContent.ItemType()) + abyssalDivingSuitForce = true; + if (vanity.type == ModContent.ItemType()) + aquaticHeartForce = true; + if (vanity.type == ModContent.ItemType()) + Player.GetModPlayer().vanityEquipped = true; + if (vanity.type == ModContent.ItemType()) + ghostBracelet = true; + if (vanity.type == ModContent.ItemType()) + Player.GetModPlayer().vanityEquipped = true; + if (vanity.type == ModContent.ItemType()) + Player.GetModPlayer().vanityEquipped = true; + if (vanity.type == ModContent.ItemType()) + snowmanForce = true; + if (vanity.type == ModContent.ItemType()) + profanedCrystalForce = true; + if (vanity.type == ModContent.ItemType()) + punchCard = true; + if (vanity.type == ModContent.ItemType()) + Player.GetModPlayer().vanityEquipped = true; + if (vanity.type == ModContent.ItemType()) + Player.GetModPlayer().vanityEquipped = true; + if (vanity.type == ModContent.ItemType()) + Player.GetModPlayer().vanityEquipped = true; + } + } + if (Player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || Player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) { @@ -4296,6 +4952,12 @@ namespace CalamityMod.CalPlayer Player.body = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Body); Player.head = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Head); } + if (punchCard) + { + Player.legs = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Legs); + Player.body = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Body); + Player.head = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Head); + } if (snowRuffianSet) { @@ -4385,13 +5047,10 @@ namespace CalamityMod.CalPlayer if (meteorSet) Player.spaceGun = false; - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (Player.ownedProjectileCounts[ProjectileType()] > 0) Player.yoraiz0rEye = 0; - if (Player.HeldItem != null && Player.HeldItem.type == ItemID.FalconBlade) - Player.moveSpeed += 0.2f; - - int totalMoonlightDyes = Player.dye.Count(dyeItem => dyeItem.type == ModContent.ItemType()); + int totalMoonlightDyes = Player.dye.Count(dyeItem => dyeItem.type == ItemType()); if (totalMoonlightDyes > 0) { // Initialize the aurora drawer. @@ -4499,7 +5158,7 @@ namespace CalamityMod.CalPlayer #region Anomaly's Nanogun Kill Sound public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) { - if (Player.whoAmI == Main.myPlayer && Player.ActiveItem().type == ModContent.ItemType()) + if (Player.whoAmI == Main.myPlayer && Player.ActiveItem().type == ItemType()) { if (Main.rand.NextBool(20)) SoundEngine.PlaySound(IjiDeathSound, Player.Center); @@ -4517,7 +5176,7 @@ namespace CalamityMod.CalPlayer var source = nurse.GetSource_FromThis("Calamity_GetFixedBoiNurseExtinctionMeteor"); if (Player.whoAmI == Main.myPlayer) { - int proj = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), 9999, 10f, Player.whoAmI); + int proj = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType(), 9999, 10f, Player.whoAmI); if (Main.projectile[proj].whoAmI.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].timeLeft = 10; @@ -4541,52 +5200,75 @@ namespace CalamityMod.CalPlayer public override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price) { - // Nurse costs scale as the game progresses. - // Base: 300 3 silver - // EoC: 900 9 silver - // Skeletron: 1200 12 silver - // Hardmode: 2400 24 silver - // Any Mech Boss: 4000 40 silver - // Plantera/Cal: 6000 60 silver - // Golem: 9000 90 silver - // Fish/PBG/Rav: 12000 1 gold 20 silver - // Moon Lord: 20000 2 gold - // Providence: 32000 3 gold 20 silver - // DoG: 60000 6 gold - // Yharon: 90000 9 gold + // Seemlessly apply progression scaling on top of vanilla's scaling logic + // In order to do this, we need to cancel out vanilla's currently active multiplier to account for possible non-linearity + // Golem (vanilla): 200x 2 gold (per 100 HP or 1 debuff) + // Moon Lord: 250x 2 gold 50 silver + // Providence: 300x 3 gold + // DoG: 400x 4 gold + // Yharon: 500x 5 gold + // Exo Mechs/SCal: 600x 6 gold if (price > 0) { - // start with a vanilla cost of zero instead of 3 silver - price -= Item.buyPrice(0, 0, 3, 0); - - if (DownedBossSystem.downedYharon) - price += Item.buyPrice(0, 9, 0, 0); - else if (DownedBossSystem.downedDoG) - price += Item.buyPrice(0, 6, 0, 0); - else if (DownedBossSystem.downedProvidence) - price += Item.buyPrice(0, 3, 20, 0); - else if (NPC.downedMoonlord) - price += Item.buyPrice(0, 2, 0, 0); - else if (NPC.downedFishron || DownedBossSystem.downedPlaguebringer || DownedBossSystem.downedRavager) - price += Item.buyPrice(0, 1, 20, 0); - else if (NPC.downedGolemBoss) - price += Item.buyPrice(0, 0, 90, 0); - else if (NPC.downedPlantBoss || DownedBossSystem.downedCalamitasClone) - price += Item.buyPrice(0, 0, 60, 0); - else if (NPC.downedMechBossAny) - price += Item.buyPrice(0, 0, 40, 0); - else if (Main.hardMode) - price += Item.buyPrice(0, 0, 24, 0); - else if (NPC.downedBoss3) - price += Item.buyPrice(0, 0, 12, 0); - else if (NPC.downedBoss1) - price += Item.buyPrice(0, 0, 6, 0); - else - price += Item.buyPrice(0, 0, 3, 0); - if (areThereAnyDamnBosses) price *= 5; + + if (DownedBossSystem.downedExoMechs || DownedBossSystem.downedCalamitas) + price *= 600; + else if (DownedBossSystem.downedYharon) + price *= 500; + else if (DownedBossSystem.downedDoG) + price *= 400; + else if (DownedBossSystem.downedProvidence) + price *= 300; + else if (NPC.downedMoonlord) + price *= 250; + else // If none of Calamity's scaling logic applies, do not do any calculations to cancel off vanilla's price multiplier + return; + + int vanillaPriceMult = 1; + if (NPC.downedGolemBoss) + vanillaPriceMult = 200; + else if (NPC.downedPlantBoss) + vanillaPriceMult = 150; + else if (NPC.downedMechBossAny) + vanillaPriceMult = 100; + else if (Main.hardMode) + vanillaPriceMult = 60; + else if (NPC.downedBoss3 || NPC.downedQueenBee) + vanillaPriceMult = 25; + else if (NPC.downedBoss2) + vanillaPriceMult = 10; + else if (NPC.downedBoss1) + vanillaPriceMult = 3; + price /= vanillaPriceMult; + } + } + + public override void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price) + { + // Remove excess alcohol + if (removeDebuffs && alcoholPoisonLevel > (cirrusDress ? 5 : 3)) + { + List Alcohol = new List(); + for (int i = 0; i < Player.MaxBuffs; i++) + { + int buff = Player.buffType[i]; + if (AlcoholsDict.TryGet(buff, out int level)) + Alcohol.Insert(0, new int[] { i, level }); + } + + int poison = alcoholPoisonLevel; + do + { + // Obtain the index:level relationship + int[] relation = Alcohol[0]; + Player.DelBuff(relation[0]); // Remove the alcohol + poison -= relation[1]; // Cancel the poison level + Alcohol.RemoveAt(0); + } + while (poison > (cirrusDress ? 5 : 3)); } } #endregion @@ -4663,6 +5345,14 @@ namespace CalamityMod.CalPlayer if ((it.IsAir || !it.CountsAsClass()) && GemTechSet && GemTechState.IsRedGemActive) playerUsingWeapon = false; + // Molten Amputator consumes stealth in a special way + if (it.type == ModContent.ItemType()) + playerUsingWeapon = false; + + // Shock Grenade consumes stealth in a special way + if (it.type == ModContent.ItemType()) + playerUsingWeapon = false; + // Animation check depends on whether the item is "clockwork", like Clockwork Assault Rifle. // "Clockwork" weapons can chain-fire multiple stealth strikes (really only 2 max) until you run out of stealth. bool animationCheck = it.useAnimation == it.useTime @@ -4722,11 +5412,11 @@ namespace CalamityMod.CalPlayer private float UpdateStealthGenStats() { - int finalDawnProjCount = Player.ownedProjectileCounts[ModContent.ProjectileType()] + - Player.ownedProjectileCounts[ModContent.ProjectileType()] + - Player.ownedProjectileCounts[ModContent.ProjectileType()] + - Player.ownedProjectileCounts[ModContent.ProjectileType()] + - Player.ownedProjectileCounts[ModContent.ProjectileType()]; + int finalDawnProjCount = Player.ownedProjectileCounts[ProjectileType()] + + Player.ownedProjectileCounts[ProjectileType()] + + Player.ownedProjectileCounts[ProjectileType()] + + Player.ownedProjectileCounts[ProjectileType()] + + Player.ownedProjectileCounts[ProjectileType()]; // If you are actively using an item, you cannot gain stealth. if (Player.itemAnimation > 0 || finalDawnProjCount > 0) @@ -4734,8 +5424,8 @@ namespace CalamityMod.CalPlayer if (shadow) { - stealthGenStandstill += 0.08f; - stealthGenMoving += 0.08f; + stealthGenStandstill += ShadowPotion.StealthRegenBoost; + stealthGenMoving += ShadowPotion.StealthRegenBoost; } if (eArtifact) @@ -4846,7 +5536,7 @@ namespace CalamityMod.CalPlayer break; if (p.owner == Player.whoAmI && p.friendly) { - bool attack = p.type == ModContent.ProjectileType(); + bool attack = p.type == ProjectileType(); if (attack) { int numSpears = profanedCrystalBuffs ? 12 : 6; @@ -4855,7 +5545,7 @@ namespace CalamityMod.CalPlayer for (int x = 0; x < numSpears; x++) { float angle = MathHelper.TwoPi / numSpears * x; - int proj = Projectile.NewProjectile(source, p.Center, angle.ToRotationVector2().RotatedBy(Math.Atan(-45f)) * 8f, ModContent.ProjectileType(), dam, 0f, Player.whoAmI, pscState, 0f); + int proj = Projectile.NewProjectile(source, p.Center, angle.ToRotationVector2().RotatedBy(Math.Atan(-45f)) * 8f, ProjectileType(), dam, 0f, Player.whoAmI, pscState, 0f); Main.projectile[proj].originalDamage = dam; } spearsFired++; @@ -4933,11 +5623,11 @@ namespace CalamityMod.CalPlayer // Enabling the config while a player is loaded will show the timer immediately. // But it won't start running until you save and quit and re-enter a world. - if (CalamityConfig.Instance.SpeedrunTimer) - CalamityMod.SpeedrunTimer.Restart(); + if (CalamityClientConfig.Instance.SpeedrunTimer) + SpeedrunTimerSystem.Restart(); - bool showWikiMessage = CalamityConfig.Instance.WikiStatusMessage; - bool showVCMMMessage = CalamityConfig.Instance.VCMMStatusMessage && !CalamityMod.Instance.VCMMAvailable; + bool showWikiMessage = CalamityClientConfig.Instance.WikiStatusMessage; + bool showVCMMMessage = CalamityClientConfig.Instance.VCMMStatusMessage && !ExternalMods.VCMMAvailable; bool showStartupMessages = showWikiMessage || showVCMMMessage; // Set a random delay between 12 and 20 seconds. When this delay hits zero, startup messages display diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 5c45619b75..a2e591296b 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -1,9 +1,11 @@ using System; using CalamityMod.Balancing; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.Dashes; using CalamityMod.EntitySources; using CalamityMod.Enums; using CalamityMod.Items.Mounts; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -21,7 +23,7 @@ namespace CalamityMod.CalPlayer { get { - return (String.IsNullOrEmpty(dashID) && Player.dashType == 0 && CalamityConfig.Instance.DefaultDashEnabled) ? DefaultDash.ID : dashID; //gives default dash ONLY if no custom or vanilla dash. + return (String.IsNullOrEmpty(dashID) && Player.dashType == 0 && CalamityServerConfig.Instance.DefaultDashEnabled) ? DefaultDash.ID : dashID; //gives default dash ONLY if no custom or vanilla dash. } set => dashID = value; } @@ -51,8 +53,7 @@ namespace CalamityMod.CalPlayer } // Neither scarf can be used if either is on cooldown - // TODO -- Why do the two scarves not use the same cooldown? They're both called "Scarf Cooldown". - if (playerDashing && DashID == CounterScarfDash.ID && Player.dashDelay < 0 && dodgeScarf && !(Player.HasCooldown(Cooldowns.CounterScarf.ID) || Player.HasCooldown(Cooldowns.EvasionScarf.ID))) + if (playerDashing && DashID == CounterScarfDash.ID && Player.dashDelay < 0 && dodgeScarf && !Player.HasCooldown(Cooldowns.ScarfCooldown.ID)) { CounterScarfDodge(); return true; @@ -90,10 +91,10 @@ namespace CalamityMod.CalPlayer // Duplicated from the way TML edits vanilla ram dash damage (and Shield of Cthulhu) int dashDamage = (int)Player.GetTotalDamage(hitContext.damageClass).ApplyTo(hitContext.BaseDamage); - float dashKB = Player.GetTotalKnockback(hitContext.damageClass).ApplyTo(hitContext.BaseKnockback); - bool rollCrit = Main.rand.Next(100) < Player.GetTotalCritChance(hitContext.damageClass); + + Projectile ram = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), dashDamage, 0f, Player.whoAmI, n.whoAmI); + ram.DamageType = hitContext.damageClass; - Player.ApplyDamageToNPC(n, dashDamage, dashKB, hitContext.HitDirection, rollCrit, hitContext.damageClass, true); if (n.Calamity().dashImmunityTime[Player.whoAmI] < 12) n.Calamity().dashImmunityTime[Player.whoAmI] = 12; @@ -117,7 +118,7 @@ namespace CalamityMod.CalPlayer dashDelayToApply = BalancingConstants.UniversalShieldSlamCooldown; else if (UsedDash.CollisionType == DashCollisionType.ShieldBonk) dashDelayToApply = BalancingConstants.UniversalShieldBonkCooldown; - if (DashID == "Deep Diver") + if (DashID == DeepDiverDash.ID) dashDelayToApply = 23; float dashSpeed = 12f; @@ -129,10 +130,11 @@ namespace CalamityMod.CalPlayer // Handle mid-dash effects. UsedDash.MidDashEffects(Player, ref dashSpeed, ref dashSpeedDecelerationFactor, ref runSpeedDecelerationFactor); - if (UsedDash.IsOmnidirectional && VerticalOmnidashTimer < 25) + int VerticalOmnidashCap = DashID == GodslayerArmorDash.ID ? 120 : 25; + if (UsedDash.IsOmnidirectional && VerticalOmnidashTimer < VerticalOmnidashCap) { VerticalOmnidashTimer++; - if (VerticalOmnidashTimer >= 25) + if (VerticalOmnidashTimer >= VerticalOmnidashCap) { Player.dashDelay = dashDelayToApply; // Stop the player from going flying @@ -142,6 +144,9 @@ namespace CalamityMod.CalPlayer if (HasCustomDash) { + // Vortex Booster automatically re-engages Vortex armor's stealth after a delay when dashing + if (Player.wingsLogic == (int)VanillaWingID.WingsVortex && Player.vortexStealthActive) + vortexBoosterStealthDelay = 60; Player.vortexStealthActive = false; // Decide the player's facing direction. @@ -151,6 +156,9 @@ namespace CalamityMod.CalPlayer // Handle mid-dash movement. if (UsedDash.IsOmnidirectional) { + if (DashID == GodslayerArmorDash.ID) + return; + if (Player.velocity.Length() > dashSpeed) { Player.velocity *= dashSpeedDecelerationFactor; @@ -385,6 +393,29 @@ namespace CalamityMod.CalPlayer return justDashed; } + public bool HandleGodSlayerDash(out DashDirection direction) + { + bool justDashed = false; + direction = DashDirection.Directionless; + + // God Slayer armor's dash will dash towards the player's cursor. + // 14NOV2024: Ozzatron: Intentionally does not use clamped mouse position so that player dash direction is not strangely bent on larger screens. + Vector2 dashVel = Main.MouseWorld - Player.Center; + dashVel = dashVel.SafeNormalize(Vector2.UnitX) * UsedDash.CalculateDashSpeed(Player); + + Player.velocity = dashVel; + + if (dashTimeMod > 0) + { + justDashed = true; + dashTimeMod = 0; + } + else + dashTimeMod = 15; + + return justDashed; + } + public bool DoADash(float dashSpeed) { bool justDashed; @@ -396,7 +427,9 @@ namespace CalamityMod.CalPlayer dashTimeMod -= (dashTimeMod > 0).ToDirectionInt(); // Determine dash times. - if (omnidirectionalDash) + if (DashID == GodslayerArmorDash.ID) + justDashed = HandleGodSlayerDash(out direction); + else if (omnidirectionalDash) justDashed = HandleOmnidirectionalDash(out direction); else justDashed = HandleHorizontalDash(out direction); @@ -462,6 +495,7 @@ namespace CalamityMod.CalPlayer if (WorldGen.SolidOrSlopedTile(upwardTilePoint.X, upwardTilePoint.Y) || WorldGen.SolidOrSlopedTile(aheadTilePoint.X, aheadTilePoint.Y)) Player.velocity.X /= 2f; + Player.timeSinceLastDashStarted = 0; Player.dashDelay = -1; } @@ -486,6 +520,22 @@ namespace CalamityMod.CalPlayer DoMountDashDamage(damageHitbox, damage, knockback, NPCImmuneTime, playerImmuneTime); } + if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed) + { + Rectangle damageHitbox = Player.getRect(); + + if (Player.direction == 1) + damageHitbox.Offset(Player.width - 1, 0); + + damageHitbox.Width = 2; + damageHitbox.Inflate(6, 12); + float damage = Player.GetTotalDamage().ApplyTo(ExoTank.DashDamage); + float knockback = 10f; + int NPCImmuneTime = 30; + int playerImmuneTime = 6; + DoMountDashDamage(damageHitbox, damage, knockback, NPCImmuneTime, playerImmuneTime); + } + if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed / 2f) { Rectangle damageHitbox = Player.getRect(); @@ -534,14 +584,18 @@ namespace CalamityMod.CalPlayer if (myRect.Intersects(npcHitbox) && (n.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, n.position, n.width, n.height))) { int hitDirection = Math.Sign(Player.velocity.X); - + // Use the player's facing direction as a fallback if they are not making any horizontal movement. if (hitDirection == 0) hitDirection = Player.direction; - // TODO -- This should probably use DirectStrike? + Vector2 hitVelocity = new Vector2(2 * hitDirection, 0); // Projectile velocity will determine the hit directon of direct strikes + if (Player.whoAmI == Main.myPlayer) - Player.ApplyDamageToNPC(n, (int)Damage, Knockback, hitDirection, false); + { + Projectile ram = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), n.Center, hitVelocity, ModContent.ProjectileType(), (int)Damage, Knockback, Player.whoAmI, n.whoAmI); + ram.DamageType = DamageClass.Summon; + } // 17APR2024: Ozzatron: Dash iframes are not boosted by Cross Necklace at all and are fixed. n.Calamity().dashImmunityTime[Player.whoAmI] = NPCImmuneTime; diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 0541f5665e..eaaeda1189 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -4,8 +4,10 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.DrawLayers; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -27,7 +29,7 @@ namespace CalamityMod.CalPlayer return; // Remove shoe drawing effects if special legs are meant to be drawn. - if (CalamityLists.legOverrideList.Contains(Player.legs)) + if (LegOverrideList.Includes(Player.legs)) { PlayerDrawLayers.Shoes.Hide(); } @@ -110,7 +112,7 @@ namespace CalamityMod.CalPlayer } // 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) + if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && Player.townNPCs < 3f && CalamityClientConfig.Instance.StealthInvisibility) { // A translucent orchid color, the rogue class color float colorValue = calamityPlayer.rogueStealth / calamityPlayer.rogueStealthMax * 0.9f; //0 to 0.9 @@ -131,10 +133,10 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool()) { - 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); + Dust dust = Dust.NewDustDirect(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); + dust.noGravity = true; + dust.velocity *= 0.5f; + drawInfo.DustCache.Add(dust.dustIndex); } } } @@ -146,10 +148,10 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool()) { - 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); + Dust dust = Dust.NewDustDirect(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); + dust.noGravity = true; + dust.velocity *= 0.5f; + drawInfo.DustCache.Add(dust.dustIndex); } } } @@ -166,10 +168,10 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool()) { - 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); + Dust dust = Dust.NewDustDirect(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); + dust.noGravity = true; + dust.velocity *= 0.5f; + drawInfo.DustCache.Add(dust.dustIndex); } } } @@ -230,6 +232,9 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.daybroken && drawInfo.shadow == 0f) Daybroken.DrawEffects(drawInfo, reducedDaybrokenDamage); + if (calamityPlayer.demonicFlames && drawInfo.shadow == 0f) + DemonicFlames.DrawEffects(drawInfo); + if (calamityPlayer.dragonFire && drawInfo.shadow == 0f) Dragonfire.DrawEffects(drawInfo); @@ -251,14 +256,23 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.gsInferno && drawInfo.shadow == 0f) GodSlayerInferno.DrawEffects(drawInfo); + if (calamityPlayer.heavybleeding && drawInfo.shadow == 0f) + HeavyBleeding.DrawEffects(drawInfo); + // Holy Flames, Holy Inferno and Banishing Fire share the same visual effects if (drawInfo.shadow == 0f && (calamityPlayer.hFlames || calamityPlayer.hInferno || calamityPlayer.banishingFire)) HolyFlames.DrawEffects(drawInfo); + if (calamityPlayer.hPressure && drawInfo.shadow == 0f) + HadopelagicPressure.DrawEffects(drawInfo); + // Icarus' Folly has visual effects but they are mutually exclusive with all Holy Flames variations to prevent visual clutter else if (calamityPlayer.icarusFolly && drawInfo.shadow == 0f) IcarusFolly.DrawEffects(drawInfo); + if (calamityPlayer.laceration && drawInfo.shadow == 0f) + Laceration.DrawEffects(drawInfo); + if (calamityPlayer.miracleBlight && drawInfo.shadow == 0f) MiracleBlight.DrawEffects(drawInfo); @@ -288,12 +302,18 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.tRegen && drawInfo.shadow == 0f) TarraLifeRegen.DrawEffects(drawInfo); + if (calamityPlayer.trueVHex && drawInfo.shadow == 0f) + TrueVulnerabilityHex.DrawEffects(drawInfo); + if (calamityPlayer.vaporfied && drawInfo.shadow == 0f) Vaporfied.DrawEffects(drawInfo); if (calamityPlayer.vermillionFlux && drawInfo.shadow == 0f) VermillionFlux.DrawEffects(drawInfo); + if (calamityPlayer.voidfrost && drawInfo.shadow == 0f) + Voidfrost.DrawEffects(drawInfo); + if (calamityPlayer.vHex && drawInfo.shadow == 0f) VulnerabilityHex.DrawEffects(drawInfo); #endregion @@ -326,11 +346,11 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, Main.rand.NextBool(8) ? 296 : 5, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.25f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.3f; - Main.dust[dust].velocity.Y -= 0.5f; - drawInfo.DustCache.Add(dust); + Dust dust = Dust.NewDustDirect(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, Main.rand.NextBool(8) ? 296 : 5, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.25f); + dust.noGravity = true; + dust.velocity *= 1.3f; + dust.velocity.Y -= 0.5f; + drawInfo.DustCache.Add(dust.dustIndex); } if (Main.rand.NextBool(16)) { @@ -358,7 +378,7 @@ namespace CalamityMod.CalPlayer } // Some extraneous and probably undocumented visual effect caused by the heart lad pet thing - if ((calamityPlayer.ladHearts > 0) && !Player.loveStruck && Main.netMode != NetmodeID.Server && drawInfo.shadow == 0f) + if ((calamityPlayer.ladHearts > 0) && !Player.loveStruck && !Main.dedServ && drawInfo.shadow == 0f) { if (Main.rand.NextBool(5)) { @@ -455,7 +475,8 @@ namespace CalamityMod.CalPlayer ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; List tankTextures = new List() { @@ -474,7 +495,8 @@ namespace CalamityMod.CalPlayer ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_Shadethrower").Value, ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_BloodBoiler").Value, ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_PristineFury").Value, - ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_AuroraBlazer").Value + ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_AuroraBlazer").Value, + ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_PurgeGuzzler").Value }; if (tankItems.Contains(item.type) || drawPlayer.Calamity().plaguebringerCarapace) { diff --git a/CalPlayer/CalamityPlayerDrawParameters.cs b/CalPlayer/CalamityPlayerDrawParameters.cs new file mode 100644 index 0000000000..a270396544 --- /dev/null +++ b/CalPlayer/CalamityPlayerDrawParameters.cs @@ -0,0 +1,189 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.LunicCorps; +using CalamityMod.Packets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.CalPlayer +{ + // This should be a thing for reason: + // - Draw call invoke faster than Player.Update on different thread + // - Therefore draw call often gets default value for shield charge or such, results in flickering bug + // So we calculate those value as same rate as Player.Update and does NOT reset between updates + public struct CalamityPlayerDrawingParameters + { + // Profaned Shield (Profaned Soul Artifact / Profaned Soul Crystal) + public float ProfanedShieldCharge; + public Color ProfanedShieldColor; + + // The Sponge Shield + public float SpongeShieldCharge; + + // RoverDrive Shield + public float RoverShieldCharge; + + // Lunic Corps + public float LunicShieldCharge; + + public static bool operator ==(CalamityPlayerDrawingParameters left, CalamityPlayerDrawingParameters right) + { + if (left.RoverShieldCharge != right.RoverShieldCharge) return false; + if (left.LunicShieldCharge != right.LunicShieldCharge) return false; + if (left.ProfanedShieldCharge != right.ProfanedShieldCharge) return false; + if (left.ProfanedShieldColor != right.ProfanedShieldColor) return false; + if (left.SpongeShieldCharge != right.SpongeShieldCharge) return false; + return true; + } + + public static bool operator !=(CalamityPlayerDrawingParameters left, CalamityPlayerDrawingParameters right) + { + return !(left == right); + } + + public override readonly bool Equals(object obj) => base.Equals(obj); + public override readonly int GetHashCode() => base.GetHashCode(); + } + + public partial class CalamityPlayer : ModPlayer + { + public CalamityPlayerDrawingParameters drawingParameters; + private CalamityPlayerDrawingParameters drawingParameters_LastNetSyncValue; + private int drawingParameters_NetSyncCountdown = 0; + + private void UpdateDrawingParameters() + { + // Non-Owner should receive update via network! + if (Player.whoAmI == Main.myPlayer) + { + UpdateDrawParameter_RoverDriveShield(); + UpdateDrawParameter_LunicCorps(); + UpdateDrawParameter_ProfanedShield(); + UpdateDrawParameter_TheSponge(); + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (drawingParameters_NetSyncCountdown > 0) + { + drawingParameters_NetSyncCountdown--; + return; + } + + if (drawingParameters != drawingParameters_LastNetSyncValue) + { + drawingParameters_NetSyncCountdown = 8; + drawingParameters_LastNetSyncValue = drawingParameters; + SyncPlayerDrawParameterPacket.Send(this); + } + } + } + } + + #region RoverDrive Shield + private void UpdateDrawParameter_RoverDriveShield() + { + bool isVanityOnly = roverDriveShieldVisible && !roverDrive; + bool shieldExists = isVanityOnly || RoverDriveShieldDurability > 0; + if (roverDriveShieldVisible && shieldExists) + { + float visualShieldStrength = 1f; + if (!isVanityOnly) + { + float shieldDurabilityRatio = RoverDriveShieldDurability / (float)RoverDrive.ShieldDurabilityMax; + visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); + } + + drawingParameters.RoverShieldCharge = visualShieldStrength; + } + else + { + drawingParameters.RoverShieldCharge = -1.0f; + } + } + #endregion + + #region LunicCorps Shield + private void UpdateDrawParameter_LunicCorps() + { + if (LunicCorpsShieldDurability > 0) + { + float shieldDurabilityRatio = LunicCorpsShieldDurability / (float)LunicCorpsHelmet.ShieldDurabilityMax; + float visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); + + drawingParameters.LunicShieldCharge = visualShieldStrength; + } + else + { + drawingParameters.LunicShieldCharge = -1.0f; + } + } + #endregion + + #region Profaned Shield (Profaned Soul Artifact / Profaned Soul Crystal) + private void UpdateDrawParameter_ProfanedShield() + { + bool isVanityOnly = pSoulShieldVisible && !pSoulArtifact; + bool shouldNotDraw = andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion: + bool shieldExists = isVanityOnly || pSoulShieldDurability > 0; + if (pSoulShieldVisible && !shouldNotDraw && shieldExists) + { + ProfanedSoulCrystal.DetermineTransformationEligibility(Player); + var psState = (int)ProfanedSoulCrystal.GetPscStateFor(Player, profanedCrystalAnim >= 0); + var psc = profanedCrystalBuffs || (profanedCrystalAnim >= 0 && psState >= (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Buffs); + + float visualShieldStrength = 1f; + if (!isVanityOnly) + { + float max = psc ? ProfanedSoulCrystal.ShieldDurabilityMax : ProfanedSoulArtifact.ShieldDurabilityMax; + float shieldDurabilityRatio = pSoulShieldDurability / max; + visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); + } + + Color shieldColor = ProfanedSoulCrystal.GetColorForPsc(psState, Main.dayTime); + if (psState >= (int)(ProfanedSoulCrystal.ProfanedSoulCrystalState.Buffs)) + { + bool tester = ProfanedSoulCrystal.contributorNames.Any(name => name.Equals(Player.name)); + shieldColor = tester ? CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25) * 0.8f, 6f) : + ProfanedSoulCrystal.GetLerpedColorForPsc(this); + } + drawingParameters.ProfanedShieldColor = shieldColor; + drawingParameters.ProfanedShieldCharge = visualShieldStrength; + } + else + { + drawingParameters.ProfanedShieldCharge = -1.0f; + drawingParameters.ProfanedShieldColor = Color.White; + } + } + #endregion + + #region Sponge Shield + private void UpdateDrawParameter_TheSponge() + { + bool isVanityOnly = spongeShieldVisible && !sponge; + bool shieldExists = isVanityOnly || SpongeShieldDurability > 0; + if (spongeShieldVisible && shieldExists) + { + float visualShieldStrength = 1f; + if (!isVanityOnly) + { + float shieldDurabilityRatio = SpongeShieldDurability / (float)TheSponge.ShieldDurabilityMax; + visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); + } + + drawingParameters.SpongeShieldCharge = visualShieldStrength; + } + else + { + drawingParameters.SpongeShieldCharge = -1.0f; + } + } + #endregion + } +} diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index b43276306b..39f6fdc933 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -8,13 +9,14 @@ using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Fishing.SulphurCatches; using CalamityMod.Items.Fishing.SunkenSeaCatches; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs; using CalamityMod.NPCs.OldDuke; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -27,20 +29,78 @@ namespace CalamityMod.CalPlayer { public partial class CalamityPlayer : ModPlayer { + #region Modify Fishing Attempt + public override void ModifyFishingAttempt(ref FishingAttempt attempt) + { + if (enchantedPearl) + { + // If the player fails to roll a crate naturally and has Enchanted Pearl, reroll + // Stacking with existing probability, it should increase chances by 15% (12.5% with Crate Potion) + if (!attempt.crate) + attempt.crate = Main.rand.NextBool(6); + + // If the player does get a crate (can be from the reroll above), give it increased chances of being rarer + if (attempt.crate) + { + int uncommonRate = Math.Clamp(240 / attempt.fishingLevel, 3, 240); // Iron/Mythril (originally 300) + attempt.uncommon = Main.rand.NextBool(uncommonRate); + + // These roll result bools are individually stored for the rarifying visuals + int rareRate = Math.Clamp(840 / attempt.fishingLevel, 4, 840); // Biome (originally 1050) + bool rareRoll = Main.rand.NextBool(rareRate); + attempt.rare = rareRoll; + + int veryRareRate = Math.Clamp(1800 / attempt.fishingLevel, 5, 1800); // Golden/Titanium (originally 2250) + bool veryRareRoll = Main.rand.NextBool(veryRareRate); + attempt.veryrare = veryRareRoll; + + Vector2 basePos = new Vector2(attempt.X * 16f, attempt.Y * 16f); + if (rareRoll || veryRareRoll) + { + for (int i = 0; i < 8; i++) + { + Vector2 position = basePos + Vector2.UnitX * Main.rand.NextFloat(-16f, 16f); + Vector2 velocity = (Vector2.UnitY * Main.rand.NextFloat(-12f, -9f)).RotatedByRandom(MathHelper.ToRadians(18f)); + float scale = Main.rand.NextFloat(0.5f, 1.5f); + CritSpark spark = new(position, velocity, Color.White, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), scale, 36, 0.2f, scale * 2f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + for (int i = 0; i < 6; i++) + { + Vector2 position = basePos + Vector2.UnitX * Main.rand.NextFloat(-16f, 16f); + Vector2 velocity = (Vector2.UnitY * Main.rand.NextFloat(-3f, -0.5f)).RotatedByRandom(MathHelper.ToRadians(12f)); + PearlParticle pearl = new(position, velocity, false, 24, Main.rand.NextFloat(0.5f, 1f), Main.hslToRgb(Main.rand.NextFloat(), 1f, (rareRoll || veryRareRoll) ? 0.75f : 1f)); + GeneralParticleHandler.SpawnParticle(pearl); + } + } + } + } + #endregion + #region Catch Fish public override void CatchFish(FishingAttempt attempt, ref int itemDrop, ref int npcSpawn, ref AdvancedPopupRequest sonar, ref Vector2 sonarPosition) { + // If vanilla catches an enemy, just immediately cancel + if (npcSpawn > 0) + return; + int bait = attempt.playerFishingConditions.BaitItemType; - int power = attempt.playerFishingConditions.BaitPower + attempt.playerFishingConditions.PolePower; + int power = attempt.fishingLevel; int questFish = attempt.questFish; int poolSize = attempt.waterTilesCount; - bool water = !attempt.inHoney && !attempt.inLava; bool lava = attempt.inLava; bool honey = attempt.inHoney; - // If vanilla catches an enemy, just cancel - if (npcSpawn > 0) - return; + bool sky = attempt.heightLevel == 0; + bool surface = attempt.heightLevel == 1; + bool underground = attempt.heightLevel == 2; + bool cavern = attempt.heightLevel == 3; + bool underworld = attempt.heightLevel == 4; + + // Custom rate; increased by Enchanted Pearl + bool grabBagFish = attempt.uncommon && Main.rand.Next(100) < (enchantedPearl ? 30 : 15); // Set up for allowing fishing in the Sulphurous Sea Point point = Player.Center.ToTileCoordinates(); @@ -58,538 +118,215 @@ namespace CalamityMod.CalPlayer if (ZoneAbyss || ZoneSulphur) canSulphurFish = true; - // Old Duke spawn - if (canSulphurFish && bait == ModContent.ItemType() && water && !BossRushEvent.BossRushActive) - { - CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); - } - - // 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; - - // 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) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneCalamity && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneCalamity && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - - // Handle Alluring Bait's increased chance for Potion Material fish - if (alluringBait) - { - int chanceForPotionFish = 1000 / power; - - if (chanceForPotionFish < 3) - chanceForPotionFish = 3; - - if (Main.rand.NextBool(chanceForPotionFish)) - { - List fishList = new List(); - - if (lava) - { - fishList.AddWithCondition(ItemID.FlarefinKoi, !ZoneCalamity); - fishList.AddWithCondition(ItemID.Obsidifish, !ZoneCalamity); - fishList.AddWithCondition(ModContent.ItemType(), ZoneCalamity); - fishList.AddWithCondition(ModContent.ItemType(), ZoneCalamity); - } - else if (water) - { - if (Player.ZoneDirtLayerHeight || Player.ZoneRockLayerHeight) - { - fishList.Add(ItemID.ArmoredCavefish); - fishList.Add(ItemID.Stinkfish); - fishList.Add(ItemID.SpecularFish); - fishList.AddWithCondition(ItemID.ChaosFish, Player.ZoneHallow); - fishList.AddWithCondition(ItemID.VariegatedLardfish, Player.ZoneJungle); - } - if (Player.ZoneOverworldHeight || Player.ZoneSkyHeight) - { - fishList.AddWithCondition(ItemID.DoubleCod, Player.ZoneJungle); - } - fishList.AddWithCondition(ItemID.FrostMinnow, Player.ZoneSnow); - fishList.AddWithCondition(ItemID.Ebonkoi, Player.ZoneCorrupt); - fishList.AddWithCondition(ItemID.CrimsonTigerfish, Player.ZoneCrimson); - fishList.AddWithCondition(ItemID.Hemopiranha, Player.ZoneCrimson); - fishList.AddWithCondition(ItemID.PrincessFish, Player.ZoneHallow); - fishList.AddWithCondition(ItemID.Prismite, Player.ZoneHallow); - fishList.AddWithCondition(ItemID.Damselfish, Player.ZoneSkyHeight); - fishList.AddWithCondition(ModContent.ItemType(), ZoneAstral); - fishList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); - fishList.AddWithCondition(ModContent.ItemType(), !Main.dayTime && !Player.ZoneSkyHeight); - } - - if (fishList.Any()) - { - int fishAmt = fishList.Count; - int caughtFish = fishList[Main.rand.Next(fishAmt)]; - itemDrop = caughtFish; - return; - } - } - } - - // Handle the increased chance of crates from Enchanted Pearl and the Supreme Fishing Station - if (enchantedPearl || fishingStation) - { - int chanceForCrates = (enchantedPearl ? 10 : 0) + - (fishingStation ? 10 : 0); - - int poolSizeAmt = poolSize / 10; - if (poolSizeAmt > 100) - poolSizeAmt = 100; - - int fishingPowerDivisor = power + poolSizeAmt; - - int chanceForIronCrate = 1000 / fishingPowerDivisor; - int chanceForBiomeCrate = 2000 / fishingPowerDivisor; - int chanceForGoldCrate = 3000 / fishingPowerDivisor; - int chanceForRareItems = 4000 / fishingPowerDivisor; - - if (chanceForIronCrate < 3) - chanceForIronCrate = 3; - - if (chanceForBiomeCrate < 4) - chanceForBiomeCrate = 4; - - if (chanceForGoldCrate < 5) - chanceForGoldCrate = 5; - - if (chanceForRareItems < 6) - chanceForRareItems = 6; - - if (lava) - { - if (Main.rand.Next(100) < chanceForCrates) - { - if (Main.rand.NextBool(chanceForBiomeCrate)) - { - if (ZoneCalamity) - 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(); - } - } - } - - if (water) - { - if (Main.rand.Next(100) < chanceForCrates) - { - if (Main.rand.NextBool(chanceForRareItems) && enchantedPearl && fishingStation && Player.cratePotion) - { - List rareItemList = new List(); - - if (canSulphurFish) - { - switch (Main.rand.Next(2)) - { - case 0: - rareItemList.Add(ModContent.ItemType()); - break; - case 1: - rareItemList.Add(ModContent.ItemType()); - break; - } - } - if (ZoneAstral) - { - switch (Main.rand.Next(3)) - { - case 0: - rareItemList.Add(ModContent.ItemType()); - break; - case 1: - rareItemList.Add(ModContent.ItemType()); - break; - case 2: - rareItemList.Add(ModContent.ItemType()); - break; - } - } - if (ZoneSunkenSea) - { - switch (Main.rand.Next(3)) - { - case 0: - rareItemList.Add(ModContent.ItemType()); - break; - 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)) - { - rareItemList.Add(ItemID.ScalyTruffle); - } - rareItemList.AddWithCondition(ItemID.Toxikarp, Player.ZoneCorrupt); - rareItemList.AddWithCondition(ItemID.Bladetongue, Player.ZoneCrimson); - rareItemList.AddWithCondition(ItemID.CrystalSerpent, Player.ZoneHallow); - - if (rareItemList.Any()) - { - int rareItemAmt = rareItemList.Count; - int caughtRareItem = rareItemList[Main.rand.Next(rareItemAmt)]; - itemDrop = caughtRareItem; - } - } - else if (Main.rand.NextBool(chanceForGoldCrate)) - { - itemDrop = Main.hardMode ? ItemID.GoldenCrateHard : ItemID.GoldenCrate; - } - else if (Main.rand.NextBool(chanceForBiomeCrate)) - { - List biomeCrateList = new List(); - - 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); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.DungeonFishingCrateHard : ItemID.DungeonFishingCrate, Player.ZoneDungeon); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.JungleFishingCrateHard : ItemID.JungleFishingCrate, Player.ZoneJungle); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.FloatingIslandFishingCrateHard : ItemID.FloatingIslandFishingCrate, Player.ZoneSkyHeight); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.FrozenCrateHard : ItemID.FrozenCrate, Player.ZoneSnow); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.OasisCrateHard : ItemID.OasisCrate, Player.ZoneDesert && !Player.ZoneBeach); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.OceanCrateHard : ItemID.OceanCrate, Player.ZoneBeach); - - if (biomeCrateList.Any()) - { - int biomeCrateAmt = biomeCrateList.Count; - int caughtBiomeCrate = biomeCrateList[Main.rand.Next(biomeCrateAmt)]; - itemDrop = caughtBiomeCrate; - } - } - else if (Main.rand.NextBool(chanceForIronCrate)) - { - itemDrop = Main.hardMode ? ItemID.IronCrateHard : ItemID.IronCrate; - } - else - { - itemDrop = Main.hardMode ? ItemID.WoodenCrateHard : ItemID.WoodenCrate; - } - return; - } - } - } - - 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 = 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 - }; - if (keepCatchList.Contains(itemDrop)) - { - return; - } - - if ((Player.ZoneCrimson || Player.ZoneCorrupt) && Player.ZoneRockLayerHeight && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneHallow && Player.ZoneRockLayerHeight && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneSkyHeight && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); - } - } - - // Increased chance of Enchanted Starfish if you don't have maximum mana - if (Player.ZoneOverworldHeight && !Main.dayTime) - { - int chance = Player.statManaMax < 200 ? 5 : 20; - if (attempt.uncommon && Main.rand.NextBool(chance)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (!Player.ZoneSkyHeight && !Main.dayTime) - { - if (attempt.uncommon && Main.rand.NextBool(10)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneOverworldHeight && Main.dayTime) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneRockLayerHeight) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneSnow && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - // Lower chance of Spadefish in Hardmode - if (Player.ZoneDirtLayerHeight) - { - int chance = Main.hardMode ? 10 : 2; - if (attempt.veryrare && Main.rand.NextBool(chance)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedLeviathan && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) - { - itemDrop = ModContent.ItemType(); - } - - if (Player.ZoneOverworldHeight && Main.bloodMoon) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (ZoneAstral) // Astral Infection, fishing in water - { - if (attempt.legendary) - { - int legendaryCatch = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }); - itemDrop = legendaryCatch; - } - else if (attempt.uncommon || attempt.rare || attempt.veryrare) - { - int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }); - itemDrop = uncommonCatch; - } - else - { - itemDrop = ModContent.ItemType(); - return; - } - } - - if (ZoneSunkenSea) // Sunken Sea, fishing in water - { - if (attempt.legendary) - { - 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)]; - } - else if (attempt.veryrare) - { - itemDrop = ModContent.ItemType(); - } - else if (attempt.uncommon || attempt.rare) - { - itemDrop = ModContent.ItemType(); - } - else - { - itemDrop = ModContent.ItemType(); - return; - } - } - - // 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())) - { - itemDrop = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType() - }); - } - else if (attempt.common) - { - itemDrop = ModContent.ItemType(); - } - } - - /*if (canSulphurFish && (bait.type == ItemID.GoldWorm || bait.type == ItemID.GoldGrasshopper || bait.type == ItemID.GoldButterfly) && power > 150) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityGlobalNPC.OldDukeSpawn(player.whoAmI, ModContent.NPCType()); - } - else - { - NetMessage.SendData(61, -1, -1, null, player.whoAmI, (float)ModContent.NPCType(), 0f, 0f, 0, 0, 0); - } - switch (Main.rand.Next(4)) - { - case 0: itemDrop = ModContent.ItemType(); break; //movement acc - case 1: itemDrop = ModContent.ItemType(); break; //regen acc - case 2: itemDrop = ModContent.ItemType(); break; //defense acc - case 3: itemDrop = ModContent.ItemType(); break; //light pet - } - return; - }*/ - } - + // Fishing in lava overrides the rest of logic if (lava) { - if (ZoneCalamity) // Brimstone Crags, fishing in lava + // Don't do anything if you can't fish in lava + if (!attempt.CanFishInLava) + return; + + if (ZoneCalamity) { - if (attempt.crate) - { + // Crates have highest priority + if (attempt.crate && attempt.rare) itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - } else if (attempt.legendary) - { itemDrop = ModContent.ItemType(); - } - // 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) - { + else if (DownedBossSystem.downedProvidence && ((attempt.rare && Main.rand.NextBool(2)) || (attempt.uncommon && Main.rand.NextBool(4)))) itemDrop = ModContent.ItemType(); - } - else if (attempt.uncommon || attempt.rare) + // Quest fish hover around this priority + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (grabBagFish && Main.hardMode) + itemDrop = ModContent.ItemType(); + else if (attempt.rare) { List uncommonCatches = new List() { ModContent.ItemType(), ModContent.ItemType() }; - uncommonCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); itemDrop = uncommonCatches[Main.rand.Next(uncommonCatches.Count)]; } + // Lava fish usually don't have plentiful catches but we can be more lenient else - { itemDrop = ModContent.ItemType(); - } } + return; + } + + // Honey also overrides logic but we have nothing to catch from honey... for now + if (honey) + return; + + // Old Duke spawn + if (canSulphurFish && bait == ModContent.ItemType() && !BossRushEvent.BossRushActive) + { + CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); + } + + // Ignore catches if it's junk + if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan || itemDrop == ItemID.JojaCola) + return; + + if (attempt.crate) + { + // This can override Golden/Titanium Crates, but so do vanilla biome crates + // Those are still obtainable if the catch is very rare/legendary but not rare (fishing oddities) + if (attempt.rare) + { + 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; + } + + // Ignore all top priority legendary vanilla catches + List keepCatchList = new List() + { + ItemID.CombatBook, + ItemID.DreadoftheRedSea, + ItemID.FrogLeg, + ItemID.BalloonPufferfish, + ItemID.ZephyrFish + }; + if (keepCatchList.Contains(itemDrop)) + return; + + // Add top priorities of our own + if (DownedBossSystem.downedLeviathan && attempt.legendary && poolSize > 1000) + { + itemDrop = ModContent.ItemType(); + return; + } + + if (grabBagFish) + { + if (surface && Main.bloodMoon) + itemDrop = ModContent.ItemType(); + else if (surface && Main.dayTime) + itemDrop = ModContent.ItemType(); + else if (cavern) + itemDrop = ModContent.ItemType(); + if (Main.hardMode) + { + // Fish of Light/Night are evenly split with Gemfish + if ((Player.ZoneCrimson || Player.ZoneCorrupt) && cavern && Main.rand.NextBool()) + itemDrop = ModContent.ItemType(); + else if (Player.ZoneHallow && cavern && Main.rand.NextBool()) + itemDrop = ModContent.ItemType(); + else if (Player.ZoneSnow) + itemDrop = ModContent.ItemType(); + else if (sky) + itemDrop = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + } + } + + // Increased chance of Enchanted Starfish if you don't have maximum mana + if (surface && !Main.dayTime) // Surface + { + int chance = (Player.ConsumedManaCrystals >= Player.ManaCrystalMax) ? 20 : 5; + if (attempt.uncommon && Main.rand.NextBool(chance)) + itemDrop = ModContent.ItemType(); + + if (attempt.uncommon && Main.rand.NextBool(10)) + itemDrop = ModContent.ItemType(); + } + + // Lower chance of Spadefish in Hardmode + if (underground) // Underground + { + int chance = Main.hardMode ? 10 : 2; + if (attempt.veryrare && Main.rand.NextBool(chance)) + { + itemDrop = ModContent.ItemType(); + } + } + + if (ZoneAstral) + { + if (attempt.legendary) + { + int legendaryCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }); + itemDrop = legendaryCatch; + } + else if (attempt.veryrare) + itemDrop = ModContent.ItemType(); + else if (attempt.uncommon || attempt.rare) + { + int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + }); + itemDrop = uncommonCatch; + } + else + itemDrop = ModContent.ItemType(); + return; + } + if (ZoneSunkenSea) + { + // If the player is overlapping with the desert, split the catches + if (Player.ZoneDesert && Main.rand.NextBool()) + return; + + if (attempt.legendary) + { + List legendaryCatches = + [ + ModContent.ItemType() + ]; + + legendaryCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); + itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; + } + else if (attempt.veryrare) + { + List veryRareCatches = + [ + ModContent.ItemType() + ]; + + veryRareCatches.AddWithCondition(ModContent.ItemType(), DownedBossSystem.downedDesertScourge); + veryRareCatches.AddWithCondition(ModContent.ItemType(), DownedBossSystem.downedDesertScourge); + itemDrop = veryRareCatches[Main.rand.Next(veryRareCatches.Count)]; + } + // Quest fish hover around this priority + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (attempt.uncommon || attempt.rare) + itemDrop = ModContent.ItemType(); + else + itemDrop = ModContent.ItemType(); + return; + } + // There is no complete fishing pool here, so most of it is vanilla default + if (canSulphurFish) + { + if (attempt.legendary) + { + itemDrop = ModContent.ItemType(); + } + else if (attempt.common && Main.rand.NextBool()) + itemDrop = ModContent.ItemType(); } } #endregion @@ -597,12 +334,13 @@ namespace CalamityMod.CalPlayer #region Get Fishing Level public override void GetFishingLevel(Item fishingRod, Item bait, ref float fishingLevel) { + // Note: This is calculated after equipments (Rod, Bait, Potions, etc) and before modifications (Chum Buckets, Luck) if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type == ModContent.ItemType()) - fishingLevel = fishingLevel * 1.1f; + fishingLevel = fishingLevel * ArcturusAstroidean.FishingPowerBiomeMult; if (Player.ZoneSnow && fishingRod.type == ModContent.ItemType()) - fishingLevel = fishingLevel * 1.1f; + fishingLevel = fishingLevel * VerstaltiteFishingRod.FishingPowerBiomeMult; if (Player.ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) - fishingLevel = fishingLevel * 1.1f; + fishingLevel = fishingLevel * HeronRod.FishingPowerBiomeMult; // Prevent the player from fishing if they have the Bloodworm if (bait.type == ModContent.ItemType()) @@ -634,9 +372,10 @@ namespace CalamityMod.CalPlayer } #endregion - #region Get Fishing Level + #region Modify Caught Fish public override void ModifyCaughtFish(Item fish) { + // Increases the yield of potion ingredient fish with Alluring Bait if (alluringBait) { List fishList = new List() @@ -663,10 +402,7 @@ namespace CalamityMod.CalPlayer }; if (fishList.Contains(fish.type)) - { - // Increase the yield by 1 or 2 - fish.stack += Main.rand.NextBool() ? 1 : 2; - } + fish.stack += Main.rand.Next(1, 3 + 1); } } #endregion diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 97b482764a..dcc2c5d56e 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.Cooldowns; @@ -20,34 +19,30 @@ using CalamityMod.Items.Armor.LunicCorps; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Mounts; -using CalamityMod.Items.Tools; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; -using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; -using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.Chat; using Terraria.DataStructures; -using Terraria.GameContent.Events; -using Terraria.Graphics.Renderers; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; @@ -72,12 +67,12 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 20; 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; - Main.dust[sVeilDustIndex2].noLight = false; + Dust sVeilDust1 = Dust.NewDustDirect(Player.Center, 1, 1, DustID.VilePowder, sVeilDustDir.X * j, sVeilDustDir.Y * j); + Dust sVeilDust2 = Dust.NewDustDirect(Player.Center, 1, 1, DustID.VilePowder, -sVeilDustDir.X * j, -sVeilDustDir.Y * j); + sVeilDust1.noGravity = false; + sVeilDust1.noLight = false; + sVeilDust2.noGravity = false; + sVeilDust2.noLight = false; } SoundEngine.PlaySound(SilvaHeadSummon.DispelSound, Player.Center); @@ -95,8 +90,7 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 30; j++) { - int num = Dust.NewDust(Player.position, Player.width, Player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num]; + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); dust.position.X += Main.rand.Next(-20, 21); dust.position.Y += Main.rand.Next(-20, 21); dust.velocity *= 0.4f; @@ -114,16 +108,8 @@ namespace CalamityMod.CalPlayer private void CounterScarfDodge() { - if (evasionScarf) - { - int duration = CalamityUtils.SecondsToFrames(30); - Player.AddCooldown(Cooldowns.EvasionScarf.ID, duration); - } - else - { - int duration = CalamityUtils.SecondsToFrames(30); - Player.AddCooldown(Cooldowns.CounterScarf.ID, duration); - } + int duration = CalamityUtils.SecondsToFrames(30); + Player.AddCooldown(ScarfCooldown.ID, duration, true, evasionScarf ? "evasionscarf" : "counterscarf"); // 17APR2024: Ozzatron: Counter Scarf is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. int counterScarfIFrames = Player.ComputeDodgeIFrames(); @@ -131,8 +117,7 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 100; j++) { - int scarfDodgeDust = Dust.NewDust(Player.position, Player.width, Player.height, DustID.LifeDrain, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[scarfDodgeDust]; + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.LifeDrain, 0f, 0f, 100, default, 2f); dust.position.X += Main.rand.Next(-20, 21); dust.position.Y += Main.rand.Next(-20, 21); dust.velocity *= 0.4f; @@ -175,7 +160,6 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 10; i++) { int damage = (int)Player.GetTotalDamage().ApplyTo(55); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); int lumenyl = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), ModContent.ProjectileType(), damage, 0, Player.whoAmI); Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); @@ -216,8 +200,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item68, Player.Center); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - int damage = (int)Player.GetTotalDamage().ApplyTo(2750); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); + int damage = (int)Player.GetTotalDamage().ApplyTo(2000); int eclipse = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Player.whoAmI); if (eclipse.WithinBounds(Main.maxProjectiles)) @@ -254,6 +237,12 @@ namespace CalamityMod.CalPlayer } } + // Xyk vanity death animation + if (XykVisualsBlue || XykVisualsOrange) + { + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), Main.zenithWorld ? Main.rand.Next(5000, 50000 + 1) : 0, 0, Player.whoAmI); + } + if (hInferno) { foreach (NPC n in Main.ActiveNPCs) @@ -263,14 +252,13 @@ namespace CalamityMod.CalPlayer } } - if (nCore && !Player.HasCooldown(Cooldowns.NebulousCore.ID)) + if (nebulousCore && !Player.HasCooldown(Cooldowns.NebulousCore.ID)) { SoundEngine.PlaySound(SoundID.Item67, Player.Center); for (int j = 0; j < 50; j++) { - int nebulousReviveDust = Dust.NewDust(Player.position, Player.width, Player.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[nebulousReviveDust]; + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); dust.position.X += Main.rand.Next(-20, 21); dust.position.Y += Main.rand.Next(-20, 21); dust.velocity *= 0.9f; @@ -287,12 +275,7 @@ namespace CalamityMod.CalPlayer chaliceBleedoutBuffer = 0D; chaliceDamagePointPartialProgress = 0D; } - - Player.statLife += 100; - Player.HealEffect(100); - - if (Player.statLife > Player.statLifeMax2) - Player.statLife = Player.statLifeMax2; + Player.HealPlayer(100); Player.AddCooldown(Cooldowns.NebulousCore.ID, CalamityUtils.SecondsToFrames(90)); return false; @@ -311,17 +294,7 @@ namespace CalamityMod.CalPlayer if (silvaCountdown == silvaReviveDuration && !hasSilvaEffect) { SoundEngine.PlaySound(SilvaHeadSummon.ActivationSound, Player.Center); - Player.AddBuff(ModContent.BuffType(), silvaReviveDuration); - - if (silvaWings) - { - Player.statLife += Player.statLifeMax2 / 2; - Player.HealEffect(Player.statLifeMax2 / 2); - - if (Player.statLife > Player.statLifeMax2) - Player.statLife = Player.statLifeMax2; - } } hasSilvaEffect = true; @@ -363,9 +336,9 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 60; i++) { - 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; + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.GemSapphire, 0f, 0f, 0, default, 2.5f); + dust.noGravity = true; + dust.velocity *= 5f; } return false; @@ -458,6 +431,10 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainRot" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); } + if (heavybleeding) + { + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HeavyBleeding" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + } if (laceration) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Laceration" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); @@ -474,7 +451,11 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Riptide" + Main.rand.Next(1, 2 + 1)).Format(Player.name)); } - if (bFlames || weakBrimstoneFlames) + if (hPressure) + { + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HadopelagicPressure" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + } + if (bFlames || weakBrimstoneFlames || demonicFlames) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrimstoneFlames" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); } @@ -498,10 +479,6 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ManaBurn").Format(Player.name)); } - if (alcoholPoisonLevel > (cirrusDress ? 5 : 3)) - { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AlcoholSmall").Format(Player.name)); - } if (witheredDebuff) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Withered").Format(Player.name)); @@ -541,7 +518,7 @@ namespace CalamityMod.CalPlayer // Demonshade enrage if (enraged) - totalDamageMult += 1.25f; + totalDamageMult += DemonshadeHelm.MultDamageBoost; // Withering enchantment when it's draining your HP if (witheredDebuff && witheringWeaponEnchant) totalDamageMult += 0.6f; @@ -557,47 +534,55 @@ namespace CalamityMod.CalPlayer if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; - // Excalibur and True Excalibur deal +100% damage to targets above 75% HP. - if (item.type == ItemID.Excalibur || item.type == ItemID.TrueExcalibur) - { - if (target.life > (int)(target.lifeMax * 0.75)) - modifiers.ScalingBonusDamage += 1f; - } - - // Titanium Sword deals up to +15% damage based on the target's knockback resistance. - if (item.type == ItemID.TitaniumSword) - { - float knockbackResistBonus = 0.15f * (1f - target.knockBackResist); - modifiers.ScalingBonusDamage += knockbackResistBonus; - } - - // Antlion Claw, Bone Sword and Breaker Blade ignore 50% of the enemy's defense. - if (item.type == ItemID.AntlionClaw || item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) - { - modifiers.ScalingArmorPenetration += 0.5f; - } - - // Stylish Scissors, all Phaseblades and all Phasesabers ignore 100% of the enemy's defense. - 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) - { - modifiers.ScalingArmorPenetration += 1f; - } - // Frost Armor's rework gives +X% melee damage and +Y% ranged damage based on distance, where X+Y = 15. if (frostSet) { // 0f = point blank, 1f = max range or further - float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.player[Main.myPlayer].Center), true); + float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.LocalPlayer.Center), true); if (item.CountsAsClass()) { float meleeBoost = MathHelper.Lerp(0f, FrostArmorSetChange.ProximityBoost, 1 - DistanceInterpolant); modifiers.SourceDamage += meleeBoost; + + if (meleeBoost >= FrostArmorSetChange.ProximityBoost * 0.5f) + { + float intensity = meleeBoost / FrostArmorSetChange.ProximityBoost; + SoundEngine.PlaySound(Cryogen.HitSound with { Volume = intensity - 0.2f }, Player.Center); + } + if (meleeBoost > 0f) + { + int count = (int)(30f * meleeBoost); + for (int i = 0; i < count; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (5f + 100f * meleeBoost); + float scale = Main.rand.NextFloat(0.5f, 1f) + 0.5f * meleeBoost / FrostArmorSetChange.ProximityBoost; + Particle sparkle = new CritSpark(target.Center, velocity, Color.White, Color.DodgerBlue, scale, 15, 0.1f, scale * 2f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } } else if (item.CountsAsClass()) { float rangedBoost = MathHelper.Lerp(0f, FrostArmorSetChange.ProximityBoost, DistanceInterpolant); modifiers.SourceDamage += rangedBoost; + + if (rangedBoost >= FrostArmorSetChange.ProximityBoost * 0.5f) + { + float intensity = rangedBoost / FrostArmorSetChange.ProximityBoost; + SoundEngine.PlaySound(Cryogen.HitSound with { Volume = intensity - 0.2f }, Player.Center); + } + if (rangedBoost > 0f) + { + int count = (int)(30f * rangedBoost); + for (int i = 0; i < count; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (5f + 100f * rangedBoost); + float scale = Main.rand.NextFloat(0.5f, 1f) + 0.5f * rangedBoost / FrostArmorSetChange.ProximityBoost; + Particle sparkle = new CritSpark(target.Center, velocity, Color.White, Color.DodgerBlue, scale, 15, 0.1f, scale * 2f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } } } } @@ -615,7 +600,7 @@ namespace CalamityMod.CalPlayer // Demonshade enrage if (enraged) - totalDamageMult += 1.25f; + totalDamageMult += DemonshadeHelm.MultDamageBoost; // Withering enchantment when it's draining your HP if (witheredDebuff && witheringWeaponEnchant) totalDamageMult += 0.6f; @@ -640,14 +625,7 @@ namespace CalamityMod.CalPlayer if (screwdriver) { if (proj.penetrate > 1 || proj.penetrate == -1) - modifiers.ScalingBonusDamage += 0.05f; - } - - // Excalibur and True Excalibur deal +100% damage to targets above 75% HP. - if (proj.type == ProjectileID.Excalibur || proj.type == ProjectileID.TrueExcalibur) - { - if (target.life > (int)(target.lifeMax * 0.75)) - modifiers.ScalingBonusDamage += 1f; + modifiers.ScalingBonusDamage += Screwdriver.PiercingDamageBuff; } // Calamity buffs Inferno Fork by 20%. This is multiplicative because it's supposed to be a buff to the weapon's base damage. @@ -655,35 +633,55 @@ namespace CalamityMod.CalPlayer if (proj.type == ProjectileID.InfernoFriendlyBlast) modifiers.SourceDamage *= 1.2f; - // Gungnir deals +100% damage to targets above 75% HP. - if (proj.type == ProjectileID.Gungnir) - { - if (target.life > (int)(target.lifeMax * 0.75)) - modifiers.ScalingBonusDamage += 1f; - } - - // Titanium Trident deals up to +15% damage based on the target's knockback resistance. - if (proj.type == ProjectileID.TitaniumTrident) - { - float knockbackResistBonus = 0.15f * (1f - target.knockBackResist); - modifiers.ScalingBonusDamage += knockbackResistBonus; - } - // Frost Armor's rework gives +X% melee damage and +Y% ranged damage based on distance, where X+Y = 15. if (frostSet) { // 0f = point blank, 1f = max range or further - float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.player[Main.myPlayer].Center), true); + float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.LocalPlayer.Center), true); if (proj.CountsAsClass()) { float meleeBoost = MathHelper.Lerp(0f, FrostArmorSetChange.ProximityBoost, 1 - DistanceInterpolant); modifiers.SourceDamage += meleeBoost; + + if (meleeBoost >= FrostArmorSetChange.ProximityBoost * 0.5f) + { + float intensity = meleeBoost / FrostArmorSetChange.ProximityBoost; + SoundEngine.PlaySound(Cryogen.HitSound with { Volume = intensity - 0.2f }, Player.Center); + } + if (meleeBoost > 0f) + { + int count = (int)(30f * meleeBoost); + for (int i = 0; i < count; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (5f + 100f * meleeBoost); + float scale = Main.rand.NextFloat(0.5f, 1f) + 0.5f * meleeBoost / FrostArmorSetChange.ProximityBoost; + Particle sparkle = new CritSpark(target.Center, velocity, Color.White, Color.DodgerBlue, scale, 15, 0.1f, scale * 2f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } } else if (proj.CountsAsClass()) { float rangedBoost = MathHelper.Lerp(0f, FrostArmorSetChange.ProximityBoost, DistanceInterpolant); modifiers.SourceDamage += rangedBoost; + + if (rangedBoost >= FrostArmorSetChange.ProximityBoost * 0.5f) + { + float intensity = rangedBoost / FrostArmorSetChange.ProximityBoost; + SoundEngine.PlaySound(Cryogen.HitSound with { Volume = intensity - 0.2f }, Player.Center); + } + if (rangedBoost > 0f) + { + int count = (int)(30f * rangedBoost); + for (int i = 0; i < count; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (5f + 100f * rangedBoost); + float scale = Main.rand.NextFloat(0.5f, 1f) + 0.5f * rangedBoost / FrostArmorSetChange.ProximityBoost; + Particle sparkle = new CritSpark(target.Center, velocity, Color.White, Color.DodgerBlue, scale, 15, 0.1f, scale * 2f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } } } @@ -700,7 +698,7 @@ namespace CalamityMod.CalPlayer { Item heldItem = Player.ActiveItem(); - if (CalamityUtils.ShouldTriggerSummonPenalty(Player, heldItem) && !CalamityLists.DisabledSummonerNerfMinions.Contains(proj.type)) + if (CalamityUtils.ShouldTriggerSummonPenalty(Player, heldItem) && !DisabledSummonerNerfMinionList.Includes(proj.type)) modifiers.FinalDamage *= BalancingConstants.SummonerCrossClassNerf; } } @@ -709,6 +707,9 @@ namespace CalamityMod.CalPlayer #region Modify Hit By NPC public override void ModifyHitByNPC(NPC npc, ref Player.HurtModifiers modifiers) { + if (npc.Calamity().antlionCloudDebuffTimer > 0) + modifiers.SourceDamage *= AntlionSkewer.CloudDamageDebuffMult; + // Enemies deal less contact damage while sick, due to being weakened. if (npc.poisoned) { @@ -785,6 +786,9 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= damageReductionFromWhisperingDeath; } + if (trueVHex) + modifiers.SourceDamage *= 1.15f; + // // At this point, the player is guaranteed to be hit if there is no dodge. // The amount of damage that will be dealt is yet to be determined. @@ -795,7 +799,7 @@ namespace CalamityMod.CalPlayer contactDamageReduction += 0.5; if (tarragonCloak && tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID)) - contactDamageReduction += 0.5; + contactDamageReduction += Buffs.StatBuffs.TarragonCloak.ContactDamageReduction; if (bloodflareMelee && bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) contactDamageReduction += 0.5; @@ -803,12 +807,6 @@ namespace CalamityMod.CalPlayer if (npc.Calamity().tSad > 0) contactDamageReduction += 0.5; - if (npc.Calamity().relicOfResilienceWeakness > 0) - { - contactDamageReduction += Items.Weapons.Typeless.RelicOfResilience.WeaknessDR; - npc.Calamity().relicOfResilienceWeakness = 0; - } - if (eskimoSet) { if (npc.coldDamage) @@ -824,13 +822,13 @@ namespace CalamityMod.CalPlayer contactDamageReduction += 0.15; if (abyssalDivingSuitPlates) - contactDamageReduction += 0.15 - abyssalDivingSuitPlateHits * 0.03; + contactDamageReduction += AbyssalDivingSuit.PlatesAllDamageReduction - abyssalDivingSuitPlateHits * AbyssalDivingSuit.PlatesHitDecay; if (aquaticHeartIce) - contactDamageReduction += 0.2; + contactDamageReduction += AquaticHeart.IceShieldAllDamageReduction; if (encased) - contactDamageReduction += 0.3; + contactDamageReduction += PermafrostsConcoction.EncasedAllDamageReduction; if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && Player.ActiveItem().type == ModContent.ItemType()) contactDamageReduction += 0.5; @@ -866,7 +864,7 @@ namespace CalamityMod.CalPlayer contactDamageReduction -= 0.1; if (corrEffigy) - contactDamageReduction -= 0.05; + contactDamageReduction -= CorruptionEffigy.DamageReductionLoss; // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% if (contactDamageReduction > 0D) @@ -910,9 +908,7 @@ namespace CalamityMod.CalPlayer #region Modify Hit By Proj public override void ModifyHitByProjectile(Projectile proj, ref Player.HurtModifiers modifiers) { - // TODO -- Evolution dodge isn't actually a dodge and you'll still get hit for 1. - // 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) + if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { double dodgeDamageGateValuePercent = 0.05; int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); @@ -934,6 +930,7 @@ namespace CalamityMod.CalPlayer { proj.hostile = false; proj.friendly = true; + proj.damage *= 10; proj.velocity *= -2f; proj.extraUpdates += 1; proj.penetrate = 1; @@ -942,7 +939,7 @@ namespace CalamityMod.CalPlayer int evolutionIFrames = Player.ComputeReflectIFrames(); Player.GiveUniversalIFrames(evolutionIFrames, true); - modifiers.SetMaxDamage(1); + modifiers.Cancel(); evolutionLifeRegenCounter = 300; projTypeJustHitBy = proj.type; @@ -962,6 +959,9 @@ namespace CalamityMod.CalPlayer projectileDamageReduction += 0.2; } + if (trueVHex) + modifiers.SourceDamage *= 1.15f; + if (auralisAuroraCounter >= 300) { modifiers.SourceDamage.Flat -= 100; @@ -1038,16 +1038,10 @@ namespace CalamityMod.CalPlayer if (evolution) { if (proj.type == projTypeJustHitBy) - projectileDamageReduction += 0.15; + projectileDamageReduction += 0.2; } - if (transformer) - { - if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) - projectileDamageReduction += 0.5; - } - - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) + if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { // Daedalus Reflect counts as a reflect but doesn't actually stop you from taking damage if (daedalusReflect && !disableAllDodges && !evolution && !Player.HasCooldown(GlobalDodge.ID)) @@ -1063,13 +1057,13 @@ namespace CalamityMod.CalPlayer projectileDamageReduction += 0.15; if (abyssalDivingSuitPlates) - projectileDamageReduction += 0.15 - abyssalDivingSuitPlateHits * 0.03; + projectileDamageReduction += AbyssalDivingSuit.PlatesAllDamageReduction - abyssalDivingSuitPlateHits * AbyssalDivingSuit.PlatesHitDecay; if (aquaticHeartIce) - projectileDamageReduction += 0.2; + projectileDamageReduction += AquaticHeart.IceShieldAllDamageReduction; if (encased) - projectileDamageReduction += 0.3; + projectileDamageReduction += PermafrostsConcoction.EncasedAllDamageReduction; if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && Player.ActiveItem().type == ModContent.ItemType()) projectileDamageReduction += 0.5; @@ -1123,7 +1117,7 @@ namespace CalamityMod.CalPlayer projectileDamageReduction -= 0.1; if (corrEffigy) - projectileDamageReduction -= 0.05; + projectileDamageReduction -= CorruptionEffigy.DamageReductionLoss; // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% if (projectileDamageReduction > 0D) @@ -1174,109 +1168,103 @@ namespace CalamityMod.CalPlayer // ModifyHit (Flesh Totem effect happens here) -> Hurt (includes dodges) -> OnHit // As such, to avoid cooldowns proccing from dodge hits, do it here if (fleshTotem && !Player.HasCooldown(Cooldowns.FleshTotem.ID) && hurtInfo.Damage > 0) - Player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20), true, "default"); - - // Same thing with The Bee - if (theBee && shouldTriggerBeeCooldown) - { - shouldTriggerBeeCooldown = false; - if (hurtInfo.Damage > 0) - theBeeCooldown = TheBee.CooldownLength; - } + Player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20)); if (NPC.AnyNPCs(ModContent.NPCType())) Player.AddBuff(ModContent.BuffType(), 15, true); - if (ursaSergeant) - { - ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); - Player.AddBuff(ModContent.BuffType(), 150); - for (int i = 0; i < 9; i++) - { - Particle spark2 = new LineParticle(Player.Center, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 20, Main.rand.NextFloat(0.5f, 1.1f), Main.rand.NextBool() ? Color.Coral : Color.DarkTurquoise); - GeneralParticleHandler.SpawnParticle(spark2); - Dust dust2 = Dust.NewDustPerfect(Player.Center, 267, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f)); - dust2.scale = Main.rand.NextFloat(0.75f, 1.2f); - dust2.noGravity = true; - dust2.color = Main.rand.NextBool() ? Color.Coral : Color.DarkTurquoise; - } - } - if (crawCarapace) { npc.AddBuff(ModContent.BuffType(), 900); + Vector2 pushVel = Utils.DirectionTo(Player.Center, npc.Center) * 7; if (!npc.dontTakeDamage) { - int onHitDamage = Player.CalcIntDamage(40); - Player.ApplyDamageToNPC(npc, onHitDamage, 0f, 0, false); + int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(40); + Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); } SoundEngine.PlaySound(SoundID.NPCHit33 with { Volume = 0.5f }, Player.Center); + + for (int i = 0; i < 10; i++) + { + float accuracy = Main.rand.NextFloat(-0.4f, 0.4f); + float powerMult = (1 - Math.Abs(accuracy)); + + Vector2 dustVel = (pushVel).SafeNormalize(Vector2.UnitY).RotatedBy(accuracy * 2) * Main.rand.NextFloat(4, 7) * powerMult; + Vector2 fxPos = Player.Center + dustVel; + + Dust dust = Dust.NewDustPerfect(fxPos, Main.rand.NextBool(4) ? 249 : 115, dustVel, 0, default, Main.rand.NextFloat(0.75f, 1.2f)); + dust.noGravity = true; + dust.noGravity = true; + dust.fadeIn = 1f; + } } if (baroclaw) { - npc.AddBuff(ModContent.BuffType(), 900); - npc.AddBuff(ModContent.BuffType(), 900); + Vector2 pushVel = Utils.DirectionTo(Player.Center, npc.Center) * 15; if (!npc.dontTakeDamage) { - int onHitDamage = Player.CalcIntDamage(250); - Player.ApplyDamageToNPC(npc, onHitDamage, 0f, 0, false); + int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(250); + Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, -1f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); + + npc.AddBuff(ModContent.BuffType(), 900); + npc.AddBuff(ModContent.BuffType(), 900); } SoundEngine.PlaySound(BaroclawHit, Player.Center); - Vector2 bloodSpawnPosition = Player.Center + Main.rand.NextVector2Circular(Player.width, Player.height) * 0.04f; - Vector2 splatterDirection = (Player.Center - bloodSpawnPosition).SafeNormalize(Vector2.UnitY); - for (int i = 0; i < 9; i++) + + for (int i = 0; i < 17; i++) { - int sparkLifetime = Main.rand.Next(12, 18); - float sparkScale = Main.rand.NextFloat(0.8f, 1f) * 0.955f; - Color sparkColor = Color.Lerp(Color.RoyalBlue, Color.DarkBlue, Main.rand.NextFloat(0.7f)); - sparkColor = Color.Lerp(sparkColor, Color.RoyalBlue, Main.rand.NextFloat()); - Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 25f); - sparkVelocity.Y -= 5.5f; - SparkParticle spark = new SparkParticle(Player.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); - GeneralParticleHandler.SpawnParticle(spark); + float accuracy = Main.rand.NextFloat(-0.55f, 0.55f); + float powerMult = (1 - Math.Abs(accuracy)); + Vector2 fxVel = (pushVel).SafeNormalize(Vector2.UnitY).RotatedBy(accuracy) * Main.rand.NextFloat(5, 12) * powerMult; + Vector2 dustVel = (pushVel).SafeNormalize(Vector2.UnitY).RotatedBy(accuracy * 2) * Main.rand.NextFloat(10, 20) * powerMult; + Vector2 fxPos = Player.Center + fxVel; + Color fxColor = Color.Lerp(Color.RoyalBlue, Color.DarkBlue, Main.rand.NextFloat(1f)); + + Particle fx = new CustomSpark(fxPos, fxVel, "CalamityMod/Particles/PointParticle", false, (int)(Main.rand.Next(22, 40 + 1) * powerMult), Main.rand.NextFloat(1.95f, 2.2f) * powerMult, fxColor, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: Main.rand.NextFloat(0.1f, 0.3f) + (1 - powerMult) * 0.3f); + GeneralParticleHandler.SpawnParticle(fx); + + if (i % 3 == 0) + { + Dust dust = Dust.NewDustPerfect(fxPos, 278, dustVel, 0, default, Main.rand.NextFloat(0.75f, 1.1f)); + dust.noGravity = true; + dust.color = Color.Gold; + dust.noGravity = false; + } } } if (absorber) { - npc.AddBuff(ModContent.BuffType(), 900); + Vector2 pushVel = Utils.DirectionTo(Player.Center, npc.Center) * 22; if (!npc.dontTakeDamage) { - int onHitDamage = Player.CalcIntDamage(350); - Player.ApplyDamageToNPC(npc, onHitDamage, 0f, 0, false); + int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(350); + Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, -1, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); + + npc.AddBuff(ModContent.BuffType(), 900); } SoundEngine.PlaySound(AbsorberHit, Player.Center); - Vector2 bloodSpawnPosition = Player.Center + Main.rand.NextVector2Circular(Player.width, Player.height) * 0.04f; - Vector2 splatterDirection = (Player.Center - bloodSpawnPosition).SafeNormalize(Vector2.UnitY); - for (int i = 0; i < 12; i++) + + for (int i = 0; i < 25; i++) { - int sparkLifetime = Main.rand.Next(11, 16); - float sparkScale = Main.rand.NextFloat(1.8f, 2.8f) * 0.955f; - Color sparkColor = Color.Lerp(Color.DarkSeaGreen, Color.MediumSeaGreen, Main.rand.NextFloat(0.7f)); - sparkColor = Color.Lerp(sparkColor, Color.DarkSeaGreen, Main.rand.NextFloat()); - Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 25f); - sparkVelocity.Y -= 4.7f; - SparkParticle spark = new SparkParticle(Player.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); - GeneralParticleHandler.SpawnParticle(spark); + float accuracy = Main.rand.NextFloat(-0.7f, 0.7f); + float powerMult = (1 - Math.Abs(accuracy)); + Vector2 fxVel = (pushVel).SafeNormalize(Vector2.UnitY).RotatedBy(accuracy) * Main.rand.NextFloat(10, 18) * powerMult; + Vector2 dustVel = (pushVel).SafeNormalize(Vector2.UnitY).RotatedBy(accuracy * 2) * Main.rand.NextFloat(15, 30) * powerMult; + Vector2 fxPos = Player.Center + fxVel; + Color fxColor = Color.Lerp(Color.DarkSeaGreen, Color.MediumSeaGreen, Main.rand.NextFloat(1f)); + + Particle fx = new CustomSpark(fxPos, fxVel, "CalamityMod/Particles/Sparkle", false, (int)(Main.rand.Next(32, 50 + 1) * powerMult), Main.rand.NextFloat(2.25f, 2.5f) * powerMult, fxColor, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: Main.rand.NextFloat(0.1f, 0.3f) + (1 - powerMult) * 0.3f); + GeneralParticleHandler.SpawnParticle(fx); + + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.95f, 2.1f)); + dust.noGravity = true; + dust.color = fxColor; } } - if (alchFlask) - { - for (int i = 0; i < 9; i++) - { - int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(15); - seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); - - Projectile bee = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f), ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); - bee.ArmorPenetration = 35; - bee.penetrate = 6; - bee.extraUpdates = 2; - bee.timeLeft = 600; - } - Player.AddBuff(BuffID.Honey, 900); - } + OnHitByCombat(hurtInfo); } public override void OnHitByProjectile(Projectile proj, Player.HurtInfo hurtInfo) @@ -1292,27 +1280,18 @@ namespace CalamityMod.CalPlayer if (!hasIFrames && !Player.creativeGodMode) nextHitDealsDefenseDamage |= proj.Calamity().DealsDefenseDamage; - if (sulphurSet && !proj.friendly && hurtInfo.Damage > 0) + // CIT 15FEB2025: This code previously tried to use Main.npc[proj.owner] to find the NPC the projectile came from. + // This doesn't work because the server owns NPC-spawned projectiles. + // All projectiles spawned from hostile NPCs are now fed the index of the NPC into ParentNPCIndex, so that these can work. + if (!proj.friendly && hurtInfo.Damage > 0 && proj.Calamity().ParentNPCIndex != -1) { - if (Main.player[proj.owner] is null) + if (Main.npc[proj.Calamity().ParentNPCIndex].active) { - if (!Main.npc[proj.owner].friendly) - Main.npc[proj.owner].AddBuff(BuffID.Poisoned, 60); - } - else - { - Player p = Main.player[proj.owner]; - if (p.hostile && Player.hostile && (Player.team != p.team || p.team == 0)) - p.AddBuff(BuffID.Poisoned, 60); - } - } - - // Apply The Bee cooldown, must be applied here so that it does not apply on dodges - if (theBee && shouldTriggerBeeCooldown) - { - shouldTriggerBeeCooldown = false; - if (hurtInfo.Damage > 0) - theBeeCooldown = TheBee.CooldownLength; + if (sulphurSet) + Main.npc[proj.Calamity().ParentNPCIndex].AddBuff(BuffID.Poisoned, 60); + if (ilSpark) + Main.npc[proj.Calamity().ParentNPCIndex].Calamity().shocked = 120; + } } if (proj.hostile && hurtInfo.Damage > 0) @@ -1467,25 +1446,8 @@ namespace CalamityMod.CalPlayer } // As these reflects do not cancel damage, they need to be in OnHit rather than ModifyHit - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && hurtInfo.Damage > 0) + if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && hurtInfo.Damage > 0) { - // The Transformer can reflect bullets - if (transformer) - { - if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) - { - proj.hostile = false; - proj.friendly = true; - proj.velocity *= -1f; - proj.damage = (int)Player.GetBestClassDamage().ApplyTo(proj.damage * 8); - proj.penetrate = 1; - - // 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); @@ -1521,15 +1483,85 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(ModContent.BuffType(), 15, true); } + + OnHitByCombat(hurtInfo); + } + + // Shortcut for applying hit effects when hit by either an NPC or projectile + // Reminder that external sources ie. forcefully called hurt functions, hazards (thorns, spikes, lava) are not valid + public void OnHitByCombat(Player.HurtInfo hurtInfo) + { + // Apply The Bee cooldown, must be applied here so that it does not apply on dodges + if (theBee && shouldTriggerBeeCooldown) + { + shouldTriggerBeeCooldown = false; + if (hurtInfo.Damage > 0) + theBeeCooldown = TheBee.CooldownLength; + } + + if (rOfResilienceCooldown == 0 && rOfResilienceEffect > 0) + { + int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + rOfResilienceCooldown = cooldownTime; + Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); + SoundStyle youGotHit = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); + SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); + } + + if (alchFlask) + { + for (int i = 0; i < 9; i++) + { + int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(15); + + Projectile bee = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f), ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + bee.ArmorPenetration = 35; + bee.penetrate = 6; + bee.extraUpdates = 2; + bee.timeLeft = 600; + } + Player.AddBuff(BuffID.Honey, 900); + } + + if (ursaSergeant) + { + ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); + Player.AddBuff(ModContent.BuffType(), 150); + for (int i = 0; i < 9; i++) + { + Particle spark2 = new LineParticle(Player.Center, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 20, Main.rand.NextFloat(0.5f, 1.1f), Main.rand.NextBool() ? Color.Coral : Color.DarkTurquoise); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust2 = Dust.NewDustPerfect(Player.Center, 267, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f)); + dust2.scale = Main.rand.NextFloat(0.75f, 1.2f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Coral : Color.DarkTurquoise; + } + } + + if (corrosiveSpine) + { + int cloudCount = 3; + for (int i = 0; i < cloudCount; i++) + { + float speed = 2f; + int damage = 40; + int cloud = Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); + if (cloud.WithinBounds(Main.maxProjectiles)) + Main.projectile[cloud].DamageType = DamageClass.Generic; + } + } } #endregion #region Free and Consumable Dodge Hooks public override bool FreeDodge(Player.HurtInfo info) { - // 22AUG2023: Ozzatron: god slayer damage resistance removed due to it being strong enough to godmode rev yharon // If the incoming damage is somehow less than 1 (TML doesn't allow this, but...), the hit is completely ignored. - if (info.Damage < 1 /* || (godSlayerDamage && info.Damage <= 80) */) + if (info.Damage < 1) + return true; + + // Silva armor revive provides complete immunity. + if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) return true; // If this hit was marked to be completely ignored due to shield absorption, then process Adrenaline changes and ignore it. @@ -1558,7 +1590,7 @@ namespace CalamityMod.CalPlayer Rectangle npcHitbox = n.getRect(); if ((Player.getRect()).Intersects(npcHitbox) && (n.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, n.position, n.width, n.height))) { - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.CalcIntDamage(InterstellarStompers.PassthroughDamage)); + int damage = Player.CalcIntDamage(InterstellarStompers.PassthroughDamage); Projectile.NewProjectile(Player.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Main.myPlayer); @@ -1573,6 +1605,30 @@ namespace CalamityMod.CalPlayer } } + if (rOfDelivarenceRam) + { + foreach (NPC n in Main.ActiveNPCs) + { + // Ignore critters with the Guide to Critter Companionship + if (Player.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type]) + continue; + + if (!n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0) + { + Rectangle npcHitbox = n.getRect(); + if ((Player.getRect()).Intersects(npcHitbox) && (n.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, n.position, n.width, n.height))) + { + // 17APR2024: Ozzatron: This item 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.GiveUniversalIFrames(InterstellarStompers.PassthroughIFrames, false); + + return true; + } + } + } + } + // If no other effects occurred, run vanilla code return base.FreeDodge(info); } @@ -1592,7 +1648,7 @@ namespace CalamityMod.CalPlayer { double maxCooldownDurationDamagePercent = 0.5; int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); - + // Just in case... if (maxCooldownDurationDamageValue <= 0) maxCooldownDurationDamageValue = 1; @@ -1638,16 +1694,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) && info.Damage >= dodgeDamageGateValue) + if (!Player.HasCooldown(GlobalDodge.ID) && actualDamageTaken >= dodgeDamageGateValue) { if (eclipseMirror) { - EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); + EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken); return true; } else if (abyssalMirror) { - AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); + AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken); return true; } } @@ -1659,6 +1715,10 @@ namespace CalamityMod.CalPlayer #region Modify Hurt public override void ModifyHurt(ref Player.HurtModifiers modifiers) { + // Calcium Potion knockback reduction + if (calcium) + modifiers.Knockback *= (1f - CalciumPotion.KnockbackResistance); + // Handles energy shields and Boss Rush, in that order modifiers.ModifyHurtInfo += ModifyHurtInfo_Calamity; @@ -1733,8 +1793,8 @@ namespace CalamityMod.CalPlayer double damageMult = 1D; if (dArtifact) // Dimensional Soul Artifact increases incoming damage by 15%. damageMult += 0.15; - if (enraged) // Demonshade Enrage increases incoming damage by 25%. - damageMult += 0.25; + if (enraged) // Demonshade Enrage + damageMult += DemonshadeHelm.MultDamageTakenBoost; modifiers.SourceDamage *= (float)damageMult; #endregion @@ -1756,11 +1816,40 @@ namespace CalamityMod.CalPlayer blazingCoreEmpoweredParry = true; - modifiers.SetMaxDamage(1); //ONLY REDUCE DAMAGE IF NOT ON COOLDOWN + modifiers.Cancel(); modifiers.DisableSound(); //prevents hurt sound from playing, had no idea this was a thing } SoundEngine.PlaySound(BlazingCore.ParrySuccessSound, Player.Center); + + float power = 2; + for (int i = 0; i < (int)(20 * power); i++) + { + if (Main.rand.NextBool()) + { + Particle spark = new CustomSpark(Player.Center, ((new Vector2(19, 19) * power).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 47, Main.rand.NextFloat(1.15f, 1.3f) * power, Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + bool isSpark = Main.rand.NextBool(5); + Dust dust = Dust.NewDustPerfect(Player.Center, isSpark ? 278 : ModContent.DustType(), ((new Vector2(15, 15) * power).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.15f) * power * (isSpark ? 0.5f : 1); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + if (isSpark) + dust.noGravity = false; + else + dust.noLightEmittence = true; + } + } + + Particle orb1 = new CustomPulse(Player.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1f, 0.8f), 0, 0, 0.14f * power, 25); + GeneralParticleHandler.SpawnParticle(orb1); + + Particle orb2 = new CustomPulse(Player.Center, Vector2.Zero, Color.Khaki, "CalamityMod/Particles/BloomRing", new Vector2(1f, 0.5f), 0, 0, 2.1f * power, 25); + GeneralParticleHandler.SpawnParticle(orb2); + blazingCoreSuccessfulParry = 60; Player.AddCooldown(ParryCooldown.ID, 60 * 30, false, "blazingcore"); //cooldown is frames in seconds multiplied by the desired amount of seconds } @@ -1789,6 +1878,23 @@ namespace CalamityMod.CalPlayer FlameLickedShell.handleParry(Player); } } + else if (shieldOfTheOceanParry >= 12) + { + if (!Player.HasCooldown(ParryCooldown.ID)) + { + // Shield of the Ocean is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + int shieldParryIFrames = Player.ComputeParryIFrames(); + Player.GiveUniversalIFrames(shieldParryIFrames, true); + + shieldOfTheOceanEmpoweredParry = true; + modifiers.FinalDamage *= 0.4f; // 60% DR + modifiers.DisableSound(); + } + + SoundEngine.PlaySound(Main.zenithWorld ? ShieldoftheOcean.ParrySoundGFB : ShieldoftheOcean.ParrySound, Player.Center); + Player.AddCooldown(ParryCooldown.ID, 1200, false, "shieldoftheocean"); + ShieldoftheOcean.ActivateParry(Player); + } } private void ModifyHurtInfo_Calamity(ref Player.HurtInfo info) @@ -2073,11 +2179,14 @@ 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. + // Defense damage is not applied if the player has iframes or godmode. bool hitCanApplyDefenseDamage = nextHitDealsDefenseDamage || bloodflareCore; + bool defenseDamageShouldApply = hitCanApplyDefenseDamage && !hasIFrames && !Player.creativeGodMode; - if (hitCanApplyDefenseDamage && !hasIFrames && !Player.creativeGodMode) + // 15AUG2024: Ozzatron: External flag which completely disables defense damage. This overrides Bloodflare Core. + bool externalFlagsAppropriate = !CalamityMod.ExternalFlag_DisableDefenseDamage && !externalDefenseDamageImmunity; + + if (defenseDamageShouldApply && externalFlagsAppropriate) { double halfDefense = Player.statDefense / 2.0; int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage; @@ -2160,12 +2269,25 @@ namespace CalamityMod.CalPlayer } #endregion - modStealth = 1f; - // Give Rage combat frames because being hurt counts as combat. if (RageEnabled) rageCombatFrames = BalancingConstants.RageCombatDelayTime; + // Regenator has been CANCLED on TWITTER.COM!!!! (Just keeping this here since it's a neat effect and I'll probably yoink it for something else later) + if (regenator && false) + { + // Projectile damage and count is based on source damage of the hit + float hitPower = (hurtInfo.SourceDamage / (Player.statLifeMax2 * 0.5f)); + int projCount = (int)MathHelper.Clamp((15 * hitPower), 2, 15) * 2; // they come out in pairs of 2 + int projBonusDamage = (int)(hurtInfo.SourceDamage * 0.5f); + int projDamage = (int)Player.GetBestClassDamage().ApplyTo(20 + projBonusDamage); + for (int i = 0; i < projCount; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / projCount).ToRotationVector2() * (i % 2 == 0 ? 0.75f : 1f) * 10; + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, vel.RotatedBy(-0.2f * (i % 2 == 0 ? -1 : 1)), ModContent.ProjectileType(), projDamage, 0f, Player.whoAmI, 0, (i % 2 == 0 ? -1 : 1), -5); + } + } + // Hide of Astrum Deus' melee boost if (hideOfDeus) { @@ -2197,15 +2319,13 @@ namespace CalamityMod.CalPlayer if (daedalusAbsorb && Main.rand.NextBool(10)) { int healAmt = (int)(hurtInfo.Damage / 2D); - Player.statLife += healAmt; - Player.HealEffect(healAmt); + Player.HealPlayer(healAmt); } if (absorber) { - int healAmt = (int)(hurtInfo.Damage / 20D); - Player.statLife += healAmt; - Player.HealEffect(healAmt); + int healAmt = (int)(hurtInfo.Damage * TheAbsorber.DamageTakenHealedPercent); + Player.HealPlayer(healAmt); } if (witheringDamageDone > 0) @@ -2214,8 +2334,7 @@ namespace CalamityMod.CalPlayer if (healCompenstationRatio > 1D) healCompenstationRatio = 1D; int healCompensation = (int)(healCompenstationRatio * hurtInfo.Damage); - Player.statLife += (int)(healCompenstationRatio * hurtInfo.Damage); - Player.HealEffect(healCompensation); + Player.HealPlayer((int)(healCompenstationRatio * hurtInfo.Damage)); Player.AddBuff(ModContent.BuffType(), 1080); witheringDamageDone = 0; } @@ -2229,8 +2348,6 @@ namespace CalamityMod.CalPlayer if (evilSmasherBoost > 0) evilSmasherBoost -= 1; - hellbornBoost = 0; - if (trinketOfChi) chiBuffTimer = 0; @@ -2240,7 +2357,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item96, Player.Center); } - if (gShell) //5 seconds of no dash reduction and reduced defense + if (gShell) //3 seconds of no dash reduction and reduced defense { if (giantShellPostHit == 0) { @@ -2257,10 +2374,10 @@ namespace CalamityMod.CalPlayer dust.scale = Main.rand.NextFloat(1.5f, 1.2f); } } - giantShellPostHit = 300; + giantShellPostHit = 180; } - if (tortShell) //5 seconds of no dash reduction and reduced defense + if (tortShell) //3 seconds of no dash reduction and reduced defense { if (tortShellPostHit == 0) { @@ -2277,7 +2394,7 @@ namespace CalamityMod.CalPlayer dust.scale = Main.rand.NextFloat(1.6f, 2.2f); } } - tortShellPostHit = 300; + tortShellPostHit = 180; } if (abyssalDivingSuitPlates && hurtInfo.Damage > 50) @@ -2300,22 +2417,22 @@ namespace CalamityMod.CalPlayer for (int d = 0; d < 20; d++) { - int dust = Dust.NewDust(Player.position, Player.width, Player.height, DustID.Smoke, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 3f; + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.Smoke, 0f, 0f, 100, default, 2f); + dust.velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + dust.scale = 0.5f; + dust.fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int d = 0; d < 35; d++) { - 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, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; + Dust fire = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.Torch, 0f, 0f, 100, default, 3f); + fire.noGravity = true; + fire.velocity *= 5f; + fire = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.Torch, 0f, 0f, 100, default, 2f); + fire.velocity *= 2f; } } } @@ -2327,21 +2444,21 @@ namespace CalamityMod.CalPlayer for (int d = 0; d < 10; d++) { - int ice = Dust.NewDust(Player.position, Player.width, Player.height, DustID.IceRod, 0f, 0f, 100, default, 2f); - Main.dust[ice].velocity *= 3f; + Dust ice = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.IceRod, 0f, 0f, 100, default, 2f); + ice.velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[ice].scale = 0.5f; - Main.dust[ice].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + ice.scale = 0.5f; + ice.fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } for (int d = 0; d < 15; d++) { - 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, DustID.IceRod, 0f, 0f, 100, default, 2f); - Main.dust[ice].velocity *= 2f; + Dust ice = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.IceRod, 0f, 0f, 100, default, 3f); + ice.noGravity = true; + ice.velocity *= 5f; + ice = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.IceRod, 0f, 0f, 100, default, 2f); + ice.velocity *= 2f; } } @@ -2351,7 +2468,6 @@ namespace CalamityMod.CalPlayer } else if (xerocSet) { - Player.AddBuff(ModContent.BuffType(), 180); Player.AddBuff(ModContent.BuffType(), 180); } else if (reaverDefense) @@ -2404,15 +2520,15 @@ namespace CalamityMod.CalPlayer if (npcDist < range) { - float duration = Main.rand.Next(300 + (int)hurtInfo.Damage / 3, 480 + (int)hurtInfo.Damage / 2); - npc.AddBuff(BuffID.Confused, (int)duration, false); + int duration = Main.rand.Next(300 + hurtInfo.Damage / 3, 480 + hurtInfo.Damage / 2); + npc.AddBuff(BuffID.Confused, duration, false); if (amalgam) { - npc.AddBuff(BuffID.Venom, (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); + npc.AddBuff(BuffID.Venom, duration); + npc.AddBuff(ModContent.BuffType(), duration); + npc.AddBuff(ModContent.BuffType(), duration); + npc.AddBuff(ModContent.BuffType(), duration); + npc.AddBuff(ModContent.BuffType(), duration); } } } @@ -2425,7 +2541,7 @@ namespace CalamityMod.CalPlayer if (Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { - foreach(Projectile p in Main.ActiveProjectiles) + foreach (Projectile p in Main.ActiveProjectiles) { if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI) { @@ -2442,7 +2558,7 @@ namespace CalamityMod.CalPlayer if (Player.wingsLogic == (int)VanillaWingID.BoneWings) { // Drop some bones for visual effects - if (Main.netMode != NetmodeID.Server && Player.wingTime > 0) + if (!Main.dedServ && Player.wingTime > 0) { var source = Player.GetSource_Accessory(FindAccessory(ItemID.BoneWings)); for (int i = 0; i < 6; i++) @@ -2478,14 +2594,17 @@ namespace CalamityMod.CalPlayer else Player.immuneTime += iFramesToAdd; + // Similar handle to 1.4 Star Cloak: these hits ie. spikes or lava cannot activate hit effects + if (hurtInfo.CooldownCounter != -1 && hurtInfo.CooldownCounter != 1) + return; + if (aeroSet && hurtInfo.Damage > 25) { // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list var source = Player.GetSource_OnHurt(hurtInfo.DamageSource, AerospecBreastplate.FeatherEntitySourceContext); for (int n = 0; n < 4; n++) { - int featherDamage = (int)Player.GetBestClassDamage().ApplyTo(35); - featherDamage = Player.ApplyArmorAccDamageBonusesTo(featherDamage); + int featherDamage = (int)Player.GetBestClassDamage().ApplyTo(30); CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), featherDamage, 1f, Player.whoAmI); } @@ -2496,10 +2615,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item74, Player.Center); int blazeDamage = (int)Player.GetBestClassDamage().ApplyTo(25); - blazeDamage = Player.ApplyArmorAccDamageBonusesTo(blazeDamage); - 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); for (int n = 0; n < 12; n++) @@ -2513,8 +2629,8 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); for (int n = 0; n < 3; n++) { - int deificStarDamage = (int)Player.GetBestClassDamage().ApplyTo(130); - deificStarDamage = Player.ApplyArmorAccDamageBonusesTo(deificStarDamage); + int baseDamage = 130 * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1); + int deificStarDamage = (int)Player.GetBestClassDamage().ApplyTo(baseDamage); Projectile star = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.StarVeilStar, deificStarDamage, 4f, Player.whoAmI); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) @@ -2525,36 +2641,34 @@ namespace CalamityMod.CalPlayer } } } - if (aSpark) + if (ilSpark) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - if (hurtInfo.Damage > 0) + SoundEngine.PlaySound(SoundID.Item93, Player.Center); + + // Only visual effects are done here + // The actual spark spawning is now handled with the shocked variable in CalamityGlobalNPC + + SeaFoamParticle boom = new(Player.Center, Vector2.Zero, new Color(89, 239, 247), new Color(56, 158, 209), 1f, 200f, Main.rand.NextBool() ? -1f : 1f); + GeneralParticleHandler.SpawnParticle(boom); + + for (int e = 0; e < 6; e++) { - SoundEngine.PlaySound(SoundID.Item93, Player.Center); + Vector2 dustVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(4.5f, 5.25f); + Dust electric = Dust.NewDustPerfect(Player.Center, DustID.Electric, dustVel, Scale: 0.75f); + electric.noGravity = true; + } + } + if (rBrain) + { + if (!(CalamityUtils.AnyProjectiles(ModContent.ProjectileType()) || CalamityUtils.AnyProjectiles(ModContent.ProjectileType()))) + { + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + int effectStrength = amalgam ? 3 : aBrain ? 2 : 1; + int effectDamage = amalgam ? 400 : aBrain ? 35 : 15; + effectDamage = (int)Player.GetBestClassDamage().ApplyTo(effectDamage); - // Start with base damage, then apply the best damage class you can - int sDamage = 6; - if (transformer) - sDamage += 42; - sDamage = (int)Player.GetBestClassDamage().ApplyTo(sDamage); - sDamage = Player.ApplyArmorAccDamageBonusesTo(sDamage); - - if (Player.whoAmI == Main.myPlayer) - { - float sparkCount = transformer ? 10f : 8f; - for (float i = 0f; i < sparkCount; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / sparkCount).ToRotationVector2() * 5f; - Projectile spark = Projectile.NewProjectileDirect(source, Player.Center, velocity, ModContent.ProjectileType(), sDamage, 1.25f, Player.whoAmI); - spark.timeLeft = 120; - if (transformer) - { - spark.timeLeft = 240; - spark.extraUpdates = 1; - spark.penetrate = 10; - } - } - } + Vector2 spawnerVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 40f) * 12.5f; + Projectile.NewProjectile(source, Player.Center, spawnerVelocity, ModContent.ProjectileType(), effectDamage, 0f, Player.whoAmI, 0f, 0f, effectStrength); } } if (inkBomb && !abyssalMirror && !eclipseMirror) @@ -2580,7 +2694,6 @@ namespace CalamityMod.CalPlayer { SoundEngine.PlaySound(SoundID.Item74, Player.Center); int eDamage = (int)Player.GetBestClassDamage().ApplyTo(230); - eDamage = Player.ApplyArmorAccDamageBonusesTo(eDamage); if (Player.whoAmI == Main.myPlayer) Projectile.NewProjectile(fuckYouBitch, Player.Center, Vector2.Zero, ModContent.ProjectileType(), eDamage, 1f, Player.whoAmI, 0f, 0f); @@ -2597,21 +2710,15 @@ namespace CalamityMod.CalPlayer double deltaAngle = spread / 8f; double offsetAngle; int sDamage = (int)Player.GetTotalDamage().ApplyTo(60); - sDamage = Player.ApplyArmorAccDamageBonusesTo(sDamage); if (Player.whoAmI == Main.myPlayer) { - for (int i = 0; i < 8; i++) + for (int i = 0; i < 16; i++) { - float randomSpeed = Main.rand.Next(1, 7); - float randomSpeed2 = Main.rand.Next(1, 7); - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int shard = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ProjectileID.CrystalShard, sDamage, 1f, Player.whoAmI, 0f, 0f); - int shard2 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ProjectileID.CrystalShard, sDamage, 1f, Player.whoAmI, 0f, 0f); + Vector2 circleVel = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * Main.rand.NextFloat(5f, 8f); + int shard = Projectile.NewProjectile(source, Player.Center, circleVel, ProjectileID.CrystalShard, sDamage, 1f, Player.whoAmI); if (shard.WithinBounds(Main.maxProjectiles)) Main.projectile[shard].DamageType = DamageClass.Generic; - if (shard2.WithinBounds(Main.maxProjectiles)) - Main.projectile[shard2].DamageType = DamageClass.Generic; } } } @@ -2622,7 +2729,6 @@ namespace CalamityMod.CalPlayer if (hurtInfo.Damage > 0) { int rDamage = (int)Player.GetBestClassDamage().ApplyTo(240); - rDamage = Player.ApplyArmorAccDamageBonusesTo(rDamage); if (Player.whoAmI == Main.myPlayer) Projectile.NewProjectile(source, Player.Center.X, Player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), rDamage, 0f, Player.whoAmI, 0f, 0f); @@ -2638,7 +2744,7 @@ namespace CalamityMod.CalPlayer double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int shrapnelDamage = Player.ApplyArmorAccDamageBonusesTo(Player.CalcIntDamage(675)); + int shrapnelDamage = Player.CalcIntDamage(675); if (Player.whoAmI == Main.myPlayer) { for (int i = 0; i < 4; i++) @@ -2658,8 +2764,7 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_OnHurt(hurtInfo.DamageSource, DemonshadeHelm.ShadowScytheEntitySourceContext); for (int l = 0; l < 2; l++) { - int shadowbeamDamage = (int)Player.GetBestClassDamage().ApplyTo(3000); - shadowbeamDamage = Player.ApplyArmorAccDamageBonusesTo(shadowbeamDamage); + int shadowbeamDamage = (int)Player.GetBestClassDamage().ApplyTo(300); Projectile beam = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.ShadowBeamFriendly, shadowbeamDamage, 7f, Player.whoAmI); if (beam.whoAmI.WithinBounds(Main.maxProjectiles)) @@ -2671,8 +2776,7 @@ namespace CalamityMod.CalPlayer } for (int l = 0; l < 5; l++) { - int scytheDamage = (int)Player.GetBestClassDamage().ApplyTo(5000); - scytheDamage = Player.ApplyArmorAccDamageBonusesTo(scytheDamage); + int scytheDamage = (int)Player.GetBestClassDamage().ApplyTo(500); Projectile scythe = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.DemonScythe, scytheDamage, 7f, Player.whoAmI); if (scythe.whoAmI.WithinBounds(Main.maxProjectiles)) @@ -2786,7 +2890,7 @@ namespace CalamityMod.CalPlayer { NetMessage.SendPlayerDeath(Player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { ChatHelper.BroadcastChatMessage(deathText, new Color(225, 25, 25)); } @@ -2892,13 +2996,18 @@ namespace CalamityMod.CalPlayer ApplyDefenseDamageInternal(defenseDamageTaken); } - // Actually applies defense damage. Cannot be called externally. + // Actually applies defense damage. Really should not be called externally. private void ApplyDefenseDamageInternal(int defenseDamage, bool showVisuals = true) { // If zero defense damage is being dealt, don't waste your time or display a grey 0. if (defenseDamage <= 0) return; - + + // There are two flags which disable the application of defense damage. If either is true, don't do anything. + bool externalFlagsAppropriate = !CalamityMod.ExternalFlag_DisableDefenseDamage && !externalDefenseDamageImmunity; + if (!externalFlagsAppropriate) + return; + // Can be dynamically reduced by Adamantite set bonus and maybe other future effects. int defenseDamageTaken = defenseDamage; diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index ff672e4da5..d686181a32 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -3,12 +3,19 @@ using System.Linq; using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Placeables; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.Cooldowns; +using CalamityMod.Enums; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Wings; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; -using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -16,7 +23,6 @@ using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.CalPlayer { @@ -90,26 +96,31 @@ namespace CalamityMod.CalPlayer } // Whispering Death sets positive regen to zero but doesn't actually deal any damage - ApplyDoTDebuff(wDeath, 0); + ApplyDoTDebuff(wDeath, 0, laudanum); ApplyDoTDebuff(irradiated, 4, purity); - int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0); + int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0) - (corrosiveSpine ? 2 : 0); ApplyDoTDebuff(sulphurPoison, sulphurDoT, purity); ApplyDoTDebuff(rTide, 6, purity); ApplyDoTDebuff(weakBrimstoneFlames, 7); ApplyDoTDebuff(bBlood, 8, purity); ApplyDoTDebuff(brainRot, 8, purity); - ApplyDoTDebuff(laceration, 12, purity); + ApplyDoTDebuff(heavybleeding, 30, purity); + ApplyDoTDebuff(laceration, 40, purity); ApplyDoTDebuff(vaporfied, 8, purity); int staticDoT = ((Player.controlLeft || Player.controlRight) ? 12 : 3) / (eleResist ? 2 : 1); ApplyDoTDebuff(staticDischarge, staticDoT, purity); ApplyDoTDebuff(bFlames, abaddon ? 10 : 30, purity); + ApplyDoTDebuff(demonicFlames, 33, purity); ApplyDoTDebuff(daybroken, reducedDaybrokenDamage ? 20 : 40, purity); ApplyDoTDebuff(nightwither, reducedNightwitherDamage ? 20 : 40, purity); ApplyDoTDebuff(hFlames, 40, purity); + ApplyDoTDebuff(voidfrost, 40, purity); ApplyDoTDebuff(vHex, 35); + ApplyDoTDebuff(trueVHex, 50); ApplyDoTDebuff(cDepth, 18, purity); - ApplyDoTDebuff(astralInfection, 24, infectedJewel || purity); + ApplyDoTDebuff(astralInfection, 24, infectedJewel || hideOfDeus || purity); + ApplyDoTDebuff(hPressure, 40, purity); ApplyDoTDebuff(pFlames, alchFlask ? 10 : 30, purity); ApplyDoTDebuff(cragsLava, 30); ApplyDoTDebuff(shadowflame, 30, purity); @@ -138,9 +149,13 @@ namespace CalamityMod.CalPlayer if (CalamityGlobalNPC.aquaticScourge >= 0 && Main.zenithWorld) { NPC AS = Main.npc[CalamityGlobalNPC.aquaticScourge]; - //if the player is 50 blocks or more away from the head - if (AS.life < AS.lifeMax) //Only poison when damaged - ASPoisonLevel = Utils.GetLerpValue(800f, 1600f, Vector2.Distance(Player.Center, AS.Center), true); + float scoogDistance = Vector2.Distance(Player.Center, AS.Center); + // GFB Aquatic Scourge poisons you if: + // 1. You are over 50 blocks away from the head + // 2. You are under 250 blocks away from the head (so that people halfway across the world aren't getting killed for no reason) + // 3. Aquatic Scourge has been damaged + if (AS.life < AS.lifeMax && scoogDistance < 4000f) + ASPoisonLevel = Utils.GetLerpValue(800f, 1600f, scoogDistance, true); } bool ASPoisoning = ASPoisonLevel > 0f; @@ -149,11 +164,13 @@ namespace CalamityMod.CalPlayer float increment = 1f / SulphSeaWaterSafetyTime; //No way to mitigate AS Poisoning if (ASPoisoning) - increment *= 4f + (8f * ASPoisonLevel); + increment *= 3f + (6f * ASPoisonLevel); if (sulphurskin && !ASPoisoning) increment *= 0.5f; if (sulphurSet && !ASPoisoning) increment *= 0.5f; + if (corrosiveSpine && !ASPoisoning) + increment *= 0.5f; if (ZoneAbyssLayer1 && !ASPoisoning) increment *= 0.33f; @@ -169,118 +186,60 @@ namespace CalamityMod.CalPlayer #endregion #region Alcohol + for (int l = 0; l < Player.MaxBuffs; l++) + { + int buff = Player.buffType[l]; + if (AlcoholsDict.TryGet(buff, out var level)) + alcoholPoisonLevel += level; + } if (vodka) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 1; - } + totalNegativeLifeRegen += Vodka.RegenLoss; if (redWine) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 1; - if (baguette) - totalNegativeLifeRegen += 3; - } - if (grapeBeer) - { - alcoholPoisonLevel++; - } + totalNegativeLifeRegen += baguette ? Baguette.RedWineBuffedRegenLoss : RedWine.RegenLoss; if (moonshine) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 1; - } - if (rum) - { - alcoholPoisonLevel++; - } - if (fabsolVodka) - { - alcoholPoisonLevel++; - } + totalNegativeLifeRegen += Moonshine.RegenLoss; if (fireball) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 1; - } - if (whiskey) - { - alcoholPoisonLevel++; - } + totalNegativeLifeRegen += Fireball.RegenLoss; if (everclear) - { - alcoholPoisonLevel += 2; - totalNegativeLifeRegen += 10; - } + totalNegativeLifeRegen += Everclear.RegenLoss; if (bloodyMary) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 4; - } + totalNegativeLifeRegen += BloodyMary.RegenLoss; if (tequila) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 1; - } + totalNegativeLifeRegen += Tequila.RegenLoss; if (tequilaSunrise) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 2; - } + totalNegativeLifeRegen += TequilaSunrise.RegenLoss; if (screwdriver) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 1; - } - if (caribbeanRum) - { - alcoholPoisonLevel++; - } - if (cinnamonRoll) - { - alcoholPoisonLevel++; - } - if (oldFashioned) - { - alcoholPoisonLevel++; - } + totalNegativeLifeRegen += Screwdriver.RegenLoss; if (margarita) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 1; - } + totalNegativeLifeRegen += Margarita.RegenLoss; if (starBeamRye) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 2; - } + totalNegativeLifeRegen += StarBeamRye.RegenLoss; if (moscowMule) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 4; - } + totalNegativeLifeRegen += MoscowMule.RegenLoss; if (whiteWine) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 1; - } + totalNegativeLifeRegen += WhiteWine.RegenLoss; if (evergreenGin) - { - alcoholPoisonLevel++; - totalNegativeLifeRegen += 1; - } - if (Player.tipsy) - { - alcoholPoisonLevel++; - } + totalNegativeLifeRegen += EvergreenGin.RegenLoss; + // Blanket effect for all alcohols + if (alcoholPoisonLevel > 0) + { + // This applies the tipsy eyes effect + Player.tipsy = true; + + // This one is checked through a buff so we have to counter that + if (!Player.HasBuff(BuffID.Tipsy)) + Player.fishingSkill += 5; + + } if (alcoholPoisonLevel > (cirrusDress ? 5 : 3)) { // Independently of Calamity's nerfs to Nebula life regen, it is disabled entirely by alcohol poisoning. Player.nebulaLevelLife = 0; + // This has to last over 60 frames for the nurse to count the debuff, so... if (Player.whoAmI == Main.myPlayer) - Player.AddBuff(ModContent.BuffType(), 2, false); + Player.AddBuff(ModContent.BuffType(), 61, false); if (Player.lifeRegen > 0) Player.lifeRegen = 0; @@ -374,11 +333,11 @@ namespace CalamityMod.CalPlayer int buffID = Player.buffType[l]; if (Player.buffTime[l] <= 2) continue; - bool shouldHalveDuration = CalamityLists.sicknessDebuffList.Contains(buffID); + bool shouldHalveDuration = SicknessDebuffsList.Includes(buffID); if (livingDewHalveDebuffs) - shouldHalveDuration |= CalamityLists.fireDebuffList.Contains(buffID); + shouldHalveDuration |= FireDebuffsList.Includes(buffID); if (purity) - shouldHalveDuration |= CalamityLists.debuffList.Contains(buffID); + shouldHalveDuration |= DebuffsList.Includes(buffID); if (shouldHalveDuration) --Player.buffTime[l]; @@ -390,7 +349,7 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer && Player.miscCounter % 15 == 0) // Flat 4 health per second { if (!noLifeRegen) - Player.statLife += 1; + Player.HealPlayer(1, HealTextType.None); } } @@ -398,15 +357,15 @@ namespace CalamityMod.CalPlayer { if (Player.lifeRegen < 0) { - if (Player.lifeRegenTime < 1800) - Player.lifeRegenTime = 1800; + if (Player.lifeRegenTime < Bloodfin.DebuffedRegenTimeFloor) + Player.lifeRegenTime = Bloodfin.DebuffedRegenTimeFloor; - Player.lifeRegen += 10; + Player.lifeRegen += Bloodfin.DebuffedRegenBoost; } else { - Player.lifeRegen += 5; - Player.lifeRegenTime += 10; + Player.lifeRegen += Bloodfin.RegenBoost; + Player.lifeRegenTime += Bloodfin.RegenTimeBoost; } if (bloodfinTimer > 0) @@ -414,15 +373,15 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer && bloodfinTimer <= 0) { - bloodfinTimer = 30; + bloodfinTimer = Bloodfin.FramesForExtraRegen; - if (Player.statLife < (int)(Player.statLifeMax2 * 0.75) && !noLifeRegen) - Player.statLife += 1; + if (Player.statLife < (int)(Player.statLifeMax2 * Bloodfin.ExtraRegenHealthThreshold) && !noLifeRegen) + Player.HealPlayer(1, HealTextType.None); } } // Permafrost's Concoction increases life regen while afflicted with a fire debuff - if (permafrostsConcoction && Player.buffType.Any(CalamityLists.fireDebuffList.Contains)) + if (permafrostsConcoction && Player.buffType.Any(FireDebuffsList.Includes)) { if (Player.lifeRegenTime < 1800) Player.lifeRegenTime = 1800; @@ -442,7 +401,7 @@ namespace CalamityMod.CalPlayer if (purity) { int intendedPurityDefense = 0; - int currentDebuffs = Player.buffType.Count(CalamityLists.debuffList.Contains); + int currentDebuffs = Player.buffType.Count(DebuffsList.List.Contains); if (currentDebuffs > 0) { // Healing rate is normally 5 HP/s (+1 every 12 frames) @@ -450,10 +409,10 @@ namespace CalamityMod.CalPlayer int healFrameCadence = 12; // Healing slows down after 5 seconds (300 frames) debuffed. For every 15 frames thereafter the cadence slows - // There is no upper limit to how slow it can get and it can take a very long time to reset to normal + // The upper limit to how slow it can get is after 15 seconds (900 frames) int punishmentFrames = PurityHealSlowdownFrames - 300; - //lowest punishment is three full seconds between the one health heal - if (healFrameCadence < 180) + //lowest punishment is a little under a second between the one health heal + if (healFrameCadence < 52) healFrameCadence += (punishmentFrames < 0) ? 0 : punishmentFrames / 15; if (Player.miscCounter % healFrameCadence == healFrameCadence - 1) @@ -467,7 +426,8 @@ namespace CalamityMod.CalPlayer jewelBonusDefense = intendedPurityDefense; // Count up total frames spent healing for slowdown. - ++PurityHealSlowdownFrames; + if (PurityHealSlowdownFrames < 900) + ++PurityHealSlowdownFrames; } // If the defense should be ticking down to some lower value, do that. @@ -495,7 +455,7 @@ namespace CalamityMod.CalPlayer // If the player has any debuffs, give the extra life regen and defense // More defense is given for each additional debuff int intendedJewelDefense = 0; - int currentDebuffs = Player.buffType.Count(CalamityLists.debuffList.Contains); + int currentDebuffs = Player.buffType.Count(DebuffsList.List.Contains); if (currentDebuffs > 0) { Player.lifeRegen += 4; @@ -522,7 +482,7 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += 2; // If any debuff is detected, provide even more life regen and massively accelerate it - if (Player.buffType.Any(CalamityLists.debuffList.Contains)) + if (Player.buffType.Any(DebuffsList.List.Contains)) { Player.lifeRegen += 3; if (Player.lifeRegenTime < 1800) @@ -543,7 +503,7 @@ namespace CalamityMod.CalPlayer // Yes, really, there's a list of conditions under which life regen doesn't work // even if it's life regen that normally works during a damage over time debuff. // - // 1. No life regen bool (Blood Boiler usage or wearing Omega Blue armor) + // 1. No life regen bool (Omega Blue armor) // 2. Being too far from Providence cocoon ("Holy Inferno") // 3. Air drowning in the Abyss // @@ -609,16 +569,13 @@ namespace CalamityMod.CalPlayer public override void UpdateLifeRegen() { if (rum) - Player.lifeRegen += 2; + Player.lifeRegen += Rum.RegenBoost; if (caribbeanRum) - Player.lifeRegen += 2; - - if (aChicken) - Player.lifeRegen += 1; + Player.lifeRegen += CaribbeanRum.RegenBoost; if (mushy) - Player.lifeRegen += 2; + Player.lifeRegen += Mushy.RegenBoost; if (permafrostsConcoction) { @@ -634,19 +591,19 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += 3; if (sRegen) - Player.lifeRegen += 2; + Player.lifeRegen += SpiritGlyph.RegenBoost; if (PinkJellyRegen) - Player.lifeRegen += 4; + Player.lifeRegen += LifeJelly.AuraRegenBoost; if (GreenJellyRegen) - Player.lifeRegen += 5; + Player.lifeRegen += Items.Accessories.GrandGelatin.AuraRegenBoost; if (AbsorberRegen) - Player.lifeRegen += 6; + Player.lifeRegen += TheAbsorber.AuraRegenBoost; if (hallowedRegen) - Player.lifeRegen += 3; + Player.lifeRegen += HallowedRune.RegenBoost; if (affliction || afflicted) Player.lifeRegen += 1; @@ -654,10 +611,12 @@ namespace CalamityMod.CalPlayer if (trinketOfChi || chiRegen) Player.lifeRegen += 2; + // Remember this is for 5 seconds after triggering a reflect with a long cooldown if (evolutionLifeRegenCounter > 0) { - Player.lifeRegenTime += 2; - Player.lifeRegen += 2; + Player.lifeRegen += 12; + if (Player.lifeRegenTime < 3600f) + Player.lifeRegenTime = 3600f; } if (darkSunRing) @@ -668,17 +627,17 @@ namespace CalamityMod.CalPlayer if (phantomicHeartRegen <= 720 && phantomicHeartRegen >= 600) { - Player.lifeRegen += 2; + Player.lifeRegen += PhantomicArtifact.RegenBoost; if (Main.rand.NextBool()) { - 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; + Dust regen = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.Blood, 0f, 0f, 200, new Color(99, 54, 84), 2f); + regen.noGravity = true; + regen.fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); - Main.dust[regen].velocity = velocity; + regen.velocity = velocity; velocity.Normalize(); velocity *= 34f; - Main.dust[regen].position = Player.Center - velocity; + regen.position = Player.Center - velocity; } } @@ -689,17 +648,12 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = Player.buffType[l]; - lesserEffect = CalamityLists.alcoholList.Contains(hasBuff); + lesserEffect = AlcoholsDict.TryGet(hasBuff, out var a); } if (Player.lifeRegen < 0) Player.lifeRegen += lesserEffect ? 1 : regenBoost; } - if (regenator) - { - Player.lifeRegenTime += 3; - Player.lifeRegen += 12; - } if (handWarmer && eskimoSet) { Player.lifeRegen += 2; @@ -725,17 +679,33 @@ namespace CalamityMod.CalPlayer Player.lifeRegenTime += 4; } + if (silvaWings) + { + if (Player.velocity.Y == 0f || Player.wingTime == Player.wingTimeMax) + silvaWingsLifeRegenTimer = 0; + else + { + silvaWingsLifeRegenTimer++; + if (silvaWingsLifeRegenTimer > SilvaWings.LifeRegenTimerMax) + silvaWingsLifeRegenTimer = SilvaWings.LifeRegenTimerMax; + } + + // Life regen boost scales up to 8 HP/s based on how long you stay in the air without resetting flight time + int lifeRegenBoost = (int)MathHelper.Lerp(0f, 16f, silvaWingsLifeRegenTimer / (float)SilvaWings.LifeRegenTimerMax); + Player.lifeRegen += lifeRegenBoost; + } + else + silvaWingsLifeRegenTimer = 0; + if (pinkCandle && !noLifeRegen) { // Every frame, add up 1/60th of the healing value (0.4% max HP per second) - pinkCandleHealFraction += Player.statLifeMax2 * CirrusPinkCandleBuff.PercentHealthPerSecond / 60; + pinkCandleHealFraction += Player.statLifeMax2 * VigorousCandle.PercentHealthPerSecond / 60; if (pinkCandleHealFraction >= 1D) { pinkCandleHealFraction = 0D; - - if (Player.statLife < Player.statLifeMax2) - Player.statLife++; + Player.HealPlayer(1, HealTextType.None); } } else @@ -746,7 +716,7 @@ namespace CalamityMod.CalPlayer reaverRegenCooldown = 0; if (Player.statLife != Player.statLifeMax2 && !noLifeRegen) - Player.statLife += 1; + Player.HealPlayer(1, HealTextType.None); } if (BloomStoneRegen) @@ -763,8 +733,7 @@ namespace CalamityMod.CalPlayer 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; + bool anyStandingStillLifeRegen = shadeRegen || cFreeze || honeyDewWorking || aAmpoule || purity; // Divides all negative life regen by two before applying any other effects. if (anyStandingStillLifeRegen && Player.lifeRegen < 0) @@ -773,32 +742,31 @@ namespace CalamityMod.CalPlayer // Spawn dust of some flavor while actually regenerating, aAmpule and purity have a slightly different looking style if (Player.lifeRegen > 0 && Player.statLife < actualMaxLife) { - int dustType = shadeRegen ? 173 : cFreeze ? 67 : honeyDewWorking ? DustID.Honey2 : photosynthesis ? 244 : aAmpoule ? 228 : purity ? 187 : -1; + int dustType = shadeRegen ? 173 : cFreeze ? 67 : honeyDewWorking ? DustID.Honey2 : aAmpoule ? 228 : purity ? 187 : -1; bool dustSpawnRolled = Main.rand.Next(30000) < Player.lifeRegenTime || purity ? Main.rand.NextBool() : aAmpoule ? Main.rand.NextBool(4) : Main.rand.NextBool(30); if (dustType != -1 && dustSpawnRolled) { - int regen = Dust.NewDust(Player.position, Player.width, Player.height, dustType, 0f, 0f, purity || aAmpoule ? 80 : 200, default, purity || aAmpoule ? 0.5f : 1f); - Main.dust[regen].noGravity = true; - Main.dust[regen].fadeIn = 1.3f; + Dust regen = Dust.NewDustDirect(Player.position, Player.width, Player.height, dustType, 0f, 0f, purity || aAmpoule ? 80 : 200, default, purity || aAmpoule ? 0.5f : 1f); + regen.noGravity = true; + regen.fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); - Main.dust[regen].velocity = velocity; + regen.velocity = velocity; velocity.Normalize(); velocity *= purity || aAmpoule ? 55f : 34f; - Main.dust[regen].position = Player.Center - velocity; + regen.position = Player.Center - velocity; } } // Actually apply "standing still" regeneration (the stats are granted even at full health) - float regenTimeNeededForTurboRegen = shadeRegen ? 40f : cFreeze ? 60f : honeyDewWorking ? 90f : photosynthesis ? 90f : aAmpoule ? 90f : purity ? 60f : -1f; + float regenTimeNeededForTurboRegen = shadeRegen ? 40f : cFreeze ? 60f : honeyDewWorking ? 90f : aAmpoule ? 90f : purity ? 60f : -1f; // 4 = vanilla Shiny Stone - int turboRegenPower = shadeRegen || cFreeze || purity ? 4 : honeyDewWorking || aAmpoule ? 3 : photosynthesis ? 1 : -1; + int turboRegenPower = shadeRegen || cFreeze || purity ? 4 : honeyDewWorking || aAmpoule ? 3 : -1; if (turboRegenPower > 0) { // After a brief delay determined by your form of standing still regen, min-cap life regen time at 1800 / 3600. - // Photosynthesis Potion does not do this at night. - if (Player.lifeRegenTime > regenTimeNeededForTurboRegen && Player.lifeRegenTime < 1800f && !onlyPhotosynthesisAtNight) + if (Player.lifeRegenTime > regenTimeNeededForTurboRegen && Player.lifeRegenTime < 1800f) Player.lifeRegenTime = 1800f; Player.lifeRegen += turboRegenPower; @@ -808,36 +776,13 @@ namespace CalamityMod.CalPlayer } #endregion - // The Camper counteracts the regen loss while moving horizontally - if (camper && (Player.velocity.X != 0 && Player.grappling[0] <= 0)) - { - // Vanilla base regen rate which gets boosted when resting - // The first 6 boosts increment every 300 frames, up to 6 at 1800 - // Then, the last 3 boosts increment every 600 frames, up to 9 at 3600 which is the cap - int baseRegenRate = (int)(Math.Clamp(Player.lifeRegenTime / 300f, 0f, 6f) + Math.Clamp((Player.lifeRegenTime - 1800f) / 600f, 0f, 3f)); - // Normally 1.25 while resting and 0.5 while not - Player.lifeRegen += (int)(baseRegenRate * 0.75f); - - if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool()) - { - 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); - Main.dust[regen].velocity = velocity; - velocity.Normalize(); - velocity *= 34f; - Main.dust[regen].position = Player.Center - velocity; - } - } - // Life regen soft cap. if (Player.statLife < actualMaxLife) { // The soft cap doesn't apply if the player is not moving and not using a weapon while having any of the following: - // Shiny Stone, Cosmic Freeze buff from the Cosmic Discharge, Demonshade Armor, Photosynthesis Potion buff or The Camper. + // Shiny Stone, Cosmic Freeze buff from the Cosmic Discharge, Demonshade Armor, Regenator, or The Camper. int baseLifeRegenBoost = 4; - bool noLifeRegenCap = (Player.shinyStone || cFreeze || shadeRegen || photosynthesis || camper) && + bool noLifeRegenCap = (Player.shinyStone || cFreeze || shadeRegen || camper || regenator) && Player.StandingStill() && Player.itemAnimation == 0; if (!noLifeRegenCap) @@ -872,19 +817,42 @@ namespace CalamityMod.CalPlayer } } + if (regenator) // Gives special regen of it's own, but disables all regular life regen + { + if (Player.miscCounter % 7 == 0 && Player.statLife < (int)(Player.statLifeMax2 * 0.5f)) + Player.HealPlayer(1, HealTextType.None); + + // Boost life regen time quite a bit. + // This is so that in events and such where small hits are common, your damage boost isn't completley negated + if (Player.lifeRegenTime < 3600) + Player.lifeRegenTime += 10; + } + else + regenatorDamage = 0; + if (toxicHeart) // Since it needs to know your life regen, it must be placed here { + float minLifeRegen = -20; // Fastest rate + float maxLifeRegen = 15; // Slowest rate int auraDamage = (int)Player.GetBestClassDamage().ApplyTo(200); - auraDamage = Player.ApplyArmorAccDamageBonusesTo(auraDamage); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - pulseRate = Utils.Remap(Player.lifeRegen, -30, 10, 20, 1, true); + float lifeRegenRate = Utils.Remap(Player.lifeRegen, minLifeRegen, maxLifeRegen, 20, 1, true); + + if (pulseRate < lifeRegenRate) // Jump to fastest pulse rate and slowly slow down if life regen increases + pulseRate = lifeRegenRate; + else + pulseRate = MathHelper.Lerp(pulseRate, lifeRegenRate, 0.002f); + if (pulseCounter >= 420) { - Projectile.NewProjectileDirect(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, Player.whoAmI, 0, 0, 0); + Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, Player.whoAmI, 0, 0, 0); pulseCounter = 0; - float soundVolume = Utils.Remap(Player.lifeRegen, -30, 10, 1f, 0.3f, true); - SoundStyle heartbeat = new("CalamityMod/Sounds/Item/Heartbeat"); - SoundEngine.PlaySound(heartbeat with { Volume = soundVolume, PitchVariance = 0.2f }, Player.Center); + if (toxicHeartVisuals) + { + float soundVolume = Utils.Remap(Player.lifeRegen, minLifeRegen, maxLifeRegen, 1f, 0.3f, true); + SoundStyle heartbeat = new("CalamityMod/Sounds/Item/Heartbeat"); + SoundEngine.PlaySound(heartbeat with { Volume = soundVolume, PitchVariance = 0.2f }, Player.Center); + } } else { @@ -893,5 +861,58 @@ namespace CalamityMod.CalPlayer } } #endregion + + public override void NaturalLifeRegen(ref float regen) + { + // The Camper counteracts the regen loss while moving horizontally + if (camper && (Player.velocity.X != 0 && Player.grappling[0] <= 0)) + { + // Normally 1.25 while resting and 0.5 while not so we apply this cancelling multiplier + regen *= 2.5f; + + if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool()) + { + Dust heart = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.HeartCrystal, 0f, 0f, 200, Color.OrangeRed, 1f); + heart.noGravity = true; + heart.fadeIn = 1.3f; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); + heart.velocity = velocity; + velocity.Normalize(); + velocity *= 34f; + heart.position = Player.Center - velocity; + } + } + + // Regenator trades all positive regen for damage, and caps your health gain at 50% + if (regenator) + { + int finalRegen = Player.lifeRegen + (int)Math.Round(regen * (Player.statLifeMax2 / 400f * 0.85f + 0.15f)); + finalRegen = (int)Math.Max(finalRegen, 0); + + // Rapid Healing increments RegenCount directly so it needs to be manually added + // It also works while debuffs are active so the same logic applies here + if (Player.palladiumRegen) + finalRegen += 4; + + regenatorDamage = (finalRegen * 1.75f) * 0.01f; + Player.GetDamage() += regenatorDamage; + + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; + if (regen > 0f) + regen = 0f; + if (Player.lifeRegenCount > 0) + Player.lifeRegenCount = 0; + + //Hard-lock the player's health to 50%. + //No lifesteal, no regen, no healing pots + if (Player.statLife >= (int)(Player.statLifeMax2 * 0.5f)) + { + Player.statLife = (int)(Player.statLifeMax2 * 0.5f); + Player.moonLeech = true; + healingPotionMultiplier = 0; + } + } + } } } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 5fee384695..64f5c79438 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Placeables; -using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; @@ -12,7 +10,9 @@ using CalamityMod.Cooldowns; using CalamityMod.CustomRecipes; using CalamityMod.DataStructures; using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Events; +using CalamityMod.ExtraTextures; using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; @@ -23,6 +23,7 @@ using CalamityMod.Items.Armor.Hydrothermic; using CalamityMod.Items.Armor.LunicCorps; using CalamityMod.Items.Armor.OmegaBlue; using CalamityMod.Items.Armor.Prismatic; +using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Armor.Wulfrum; @@ -30,38 +31,44 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Dyes; using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Mounts.Minecarts; +using CalamityMod.Items.PermanentBoosters; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.Tools; using CalamityMod.Items.VanillaArmorChanges; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Typeless; using CalamityMod.NPCs; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Packets; using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Pets; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureAuric; -using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.UI; using CalamityMod.World; using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil; using ReLogic.Content; using Terraria; using Terraria.Audio; @@ -83,11 +90,9 @@ namespace CalamityMod.CalPlayer { // No category - // Give the player a 24% jump speed boost while wings are equipped, otherwise grant 4% more jump speed so that players can jump 7 tiles high + // Give the player a 20% jump speed boost while wings are equipped if (Player.wingsLogic > 0) - Player.jumpSpeedBoost += 1.2f; - else if (CalamityConfig.Instance.FasterJumpSpeed) - Player.jumpSpeedBoost += 0.2f; + Player.jumpSpeedBoost += 1f; // Decrease the counter on Fearmonger set turbo regeneration if (fearmongerRegenFrames > 0) @@ -155,6 +160,9 @@ namespace CalamityMod.CalPlayer // Handle Androomba's Right Click function AndroombaRightClick(); + // Drawing parameters + UpdateDrawingParameters(); + // Update all particle sets for items. // This must be done here instead of in the item logic because these sets are not properly instanced // in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items. @@ -183,23 +191,12 @@ namespace CalamityMod.CalPlayer } } - // After everything else, if Daawnlight Spirit Origin is equipped, set ranged crit to the base 4%. - // Store all the crit so it can be used in damage calculations. - if (spiritOrigin) - { - // player.rangedCrit already contains the crit stat of the held item, no need to grab it separately. - // Don't store the base 4% because you're not removing it. - spiritOriginConvertedCrit = (int)(Player.GetTotalCritChance() - 4); - Player.GetCritChance() = -spiritOriginConvertedCrit; - } - - if (Player.ActiveItem().type == ModContent.ItemType()) - heldGaelsLastFrame = true; - if (Player.ActiveItem().type != ModContent.ItemType()) saharaSlicersBolts = 0; // De-equipping Gael's Greatsword deletes all rage. + if (Player.ActiveItem().type == ModContent.ItemType()) + heldGaelsLastFrame = true; else if (heldGaelsLastFrame) { heldGaelsLastFrame = false; @@ -221,127 +218,259 @@ namespace CalamityMod.CalPlayer if (WulfrumHat.PowerModeEngaged(Player, out _)) Player.moveSpeed *= 0.8f; - if (gShell) + // First Frame dash effects + bool dashStart = (Player.dashDelay == -1 && IsFirstDashFrame); + int dir = MathF.Sign(Player.velocity.X); + + if (((gShell && giantShellPostHit == 0) || (tortShell && tortShellPostHit == 0)) && dashStart) { - //reduce player dash velocity as long as you didn't just get hit - if (Player.dashDelay == -1 && giantShellPostHit == 0) + Player.velocity.X *= 0.9f; + } + + if ((devilsDevastationKillMode || exaltedKillMode) && !Player.mount.Active) + { + float fxScale = 1; + if (exaltedKillMode) { - if (!HasReducedDashFirstFrame) + if (Player.wingTime > 0 && Player.miscCounter % 2 == 0) + Player.wingTime++; + + if (Player.miscCounter % 4 == 0) + Player.HealPlayer(1, HealTextType.None); + + if (Player.dashDelay > 0) // Reduced dash cooldown { - Player.velocity.X *= 0.9f; - HasReducedDashFirstFrame = true; + Player.dashDelay = 0; + } + if (Player.dashDelay == -1) + { + fxScale = 1.5f; } } else - HasReducedDashFirstFrame = false; + { + if (Player.wingTime > 0 && Player.miscCounter % 3 == 0) + Player.wingTime += 2; + + if (Player.miscCounter % 5 == 0) + Player.HealPlayer(2, HealTextType.None); + + if (Player.dashDelay > 0) // Reduced dash cooldown + { + Player.dashDelay = 0; + } + if (Player.dashDelay == -1) + { + fxScale = 1.5f; + } + } + + if (Player.velocity.Length() > 2) + { + if (Main.rand.NextBool(3)) + { + Particle spark2 = new CustomSpark(Player.Center + Main.rand.NextVector2Circular(20, 20), -Player.velocity * Main.rand.NextFloat(0.3f, 0.8f) * fxScale, "CalamityMod/Particles/DemonSigilParticle", false, 22, Main.rand.NextFloat(0.2f, 0.3f) * fxScale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.8f, new Vector2(1, 1), true, false, 0, false, false, fxScale - 1); + GeneralParticleHandler.SpawnParticle(spark2); + } + else + { + // Spawn in a helix-style pattern + float sine = (float)Math.Sin(Player.miscCounter * 0.575f / MathHelper.Pi); + for (int i = 0; i < 2; i++) + { + Vector2 offset = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f; + float scale = Main.rand.NextFloat(0.8f, 1.6f) * fxScale; + + Dust dust2 = Dust.NewDustPerfect(Player.Center + offset * (i == 0 ? -1 : 1) * fxScale, ModContent.DustType(), Player.velocity * Main.rand.NextFloat(0.2f, 0.5f)); + dust2.noGravity = true; + dust2.scale = scale; + dust2.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + } + } + } + + Lighting.AddLight(Player.Center, Color.MediumOrchid.ToVector3()); } if (lAmbergris) { + if (dashStart) + { + Player.velocity.X *= 1.2f; + int damage = (int)Player.GetBestClassDamage().ApplyTo(LeviathanAmbergris.ambergrisDashDamage); + + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); + } + if (Player.miscCounter % 3 == 2 && Player.dashDelay > 0) // Reduced dash cooldown by 33% Player.dashDelay--; if (Player.dashDelay == -1)// TODO: prevent working with special dashes, this was inconsitent with my old solution so I didn't keep it. not huge deal) { - if (!HasIncreasedDashFirstFrame) - { - Player.velocity.X *= 1.2f; - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.GetBestClassDamage().ApplyTo(75)); - - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 20f, Player.whoAmI); - HasIncreasedDashFirstFrame = true; - } float numberOfDusts = 10f; float rotFactor = 180f / numberOfDusts; for (int i = 0; i < numberOfDusts; i++) { float rot = MathHelper.ToRadians(i * rotFactor); - Vector2 offset = new Vector2(Player.velocity.X * Player.direction * 0.7f + 6f, 0).RotatedBy(rot * Main.rand.NextFloat(4f, 5f)); + Vector2 offset = new Vector2(Player.velocity.X * dir * 0.7f + 6f, 0).RotatedBy(rot * Main.rand.NextFloat(4f, 5f)); Vector2 velOffset = Vector2.Zero; Dust dust = Dust.NewDustPerfect(Player.Center + offset + Player.velocity, Main.rand.NextBool() ? 160 : 307, 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 = (Player.velocity.X * dir * 0.08f); } if (Player.miscCounter % 4 == 0) { - float sparkscale = (Player.velocity.X * Player.direction * 0.07f); - Vector2 SparkVelocity1 = Player.velocity.RotatedBy(Player.direction * 2, default) * 0.1f - Player.velocity / 2f; - LineParticle spark = new LineParticle(Player.Center + Player.velocity.RotatedBy(2f * Player.direction) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue); + float sparkscale = (Player.velocity.X * dir * 0.07f); + Vector2 SparkVelocity1 = Player.velocity.RotatedBy(dir * 2, default) * 0.1f - Player.velocity / 2f; + LineParticle spark = new LineParticle(Player.Center + Player.velocity.RotatedBy(2f * dir) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue); GeneralParticleHandler.SpawnParticle(spark); - Vector2 SparkVelocity2 = Player.velocity.RotatedBy(Player.direction * -2, default) * 0.1f - Player.velocity / 2f; - LineParticle spark2 = new LineParticle(Player.Center + Player.velocity.RotatedBy(-2f * Player.direction) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue); + Vector2 SparkVelocity2 = Player.velocity.RotatedBy(dir * -2, default) * 0.1f - Player.velocity / 2f; + LineParticle spark2 = new LineParticle(Player.Center + Player.velocity.RotatedBy(-2f * dir) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue); GeneralParticleHandler.SpawnParticle(spark2); } if (Player.miscCounter % 4 == 0 && Player.velocity != Vector2.Zero) //every other frame spawn the hitbox { - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.GetBestClassDamage().ApplyTo(90)); + int damage = (int)Player.GetBestClassDamage().ApplyTo(LeviathanAmbergris.ambergrisDashDamage); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); } } - else - HasIncreasedDashFirstFrame = false; } if (Pauldron) { + if (dashStart) + { + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with { Volume = 0.4f, PitchVariance = 0.4f }, Player.Center); + int damage = (int)Player.GetBestClassDamage().ApplyTo(SlagsplitterPauldron.PauldronSlamDamage); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Player.whoAmI); + } if (Player.dashDelay == -1)// TODO: prevent working with special dashes, this was inconsitent with my old solution so I didn't keep it. not huge deal) { + int damage = (int)Player.GetBestClassDamage().ApplyTo(SlagsplitterPauldron.PauldronSlamDamage); 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); - 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); - HasReducedDashFirstFrame = true; - } + float numberOfDusts = 10f; float rotFactor = 180f / numberOfDusts; for (int i = 0; i < numberOfDusts; i++) { float rot = MathHelper.ToRadians(i * rotFactor); - Vector2 offset = new Vector2(MathF.Min(Player.velocity.X * Player.direction * 0.7f + 8f, 20f), 0).RotatedBy(rot * Main.rand.NextFloat(4f, 5f)); + Vector2 offset = new Vector2(MathF.Min(Player.velocity.X * dir * 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 = MathF.Min(Player.velocity.X * Player.direction * 0.08f, 1.2f); + dust.scale = MathF.Min(Player.velocity.X * dir * 0.08f, 1.2f); } - 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); + float sparkscale = MathF.Min(Player.velocity.X * dir * 0.08f, 1.2f); + Vector2 SparkVelocity1 = Player.velocity.RotatedBy(dir * -3, default) * 0.1f - Player.velocity / 2f; + SparkParticle spark = new SparkParticle(Player.Center + Player.velocity.RotatedBy(2f * dir) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark); - Vector2 SparkVelocity2 = Player.velocity.RotatedBy(Player.direction * 3, default) * 0.1f - Player.velocity / 2f; - SparkParticle spark2 = new SparkParticle(Player.Center + Player.velocity.RotatedBy(-2f * Player.direction) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); + Vector2 SparkVelocity2 = Player.velocity.RotatedBy(dir * 3, default) * 0.1f - Player.velocity / 2f; + SparkParticle spark2 = new SparkParticle(Player.Center + Player.velocity.RotatedBy(-2f * dir) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark2); if (Player.miscCounter % 6 == 0 && Player.velocity != Vector2.Zero) { - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.GetBestClassDamage().ApplyTo(170)); - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 10f, Player.whoAmI); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), SlagsplitterPauldron.PauldronSlamDamage, 0, Player.whoAmI); } } - else - HasReducedDashFirstFrame = false; } - if (tortShell) + if (XykVisualsBlue || XykVisualsOrange) { - //reduce player dash velocity as long as you didn't just get hit - if (Player.dashDelay == -1 && tortShellPostHit == 0) + bool Orange = XykVisualsOrange; + Color effectColor = Orange ? Color.Gold : Color.DodgerBlue; + + float rate = Main.GlobalTimeWrappedHourly * 22; + List eColors = new List() { - if (!HasReducedDashFirstFrame) + Orange ? Color.OrangeRed : Color.DodgerBlue, + Orange ? Color.Gold : Color.Cyan, + Orange ? Color.Orange : Color.RoyalBlue + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + effectColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (dashStart) + { + SoundStyle dash = new("CalamityMod/Sounds/Item/DashSound"); + SoundEngine.PlaySound(dash with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0f, 0.2f) + (Orange ? 0 : 0.2f) }, Player.Center); + if (Orange) { - Player.velocity.X *= 0.9f; - HasReducedDashFirstFrame = true; + Particle spark1 = new CustomPulse(Player.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0.45f, 0.25f, 47); + GeneralParticleHandler.SpawnParticle(spark1); + + Particle spark2 = new CustomPulse(Player.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0, 0.8f, 17); + GeneralParticleHandler.SpawnParticle(spark2); + } + else + { + Particle spark1 = new CustomPulse(Player.Center, Player.velocity * 0.3f, effectColor, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1f), Player.velocity.ToRotation(), 0, 1f, 24); + GeneralParticleHandler.SpawnParticle(spark1); + + Particle spark2 = new CustomPulse(Player.Center, Player.velocity * 0.5f, effectColor, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), Player.velocity.ToRotation(), 0, 0.75f, 17); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + if (Player.dashDelay == -1) + { + float sparkscale1 = MathF.Min(Player.velocity.X * dir * 0.08f, 1.2f); + Vector2 SparkVelocity1 = -Player.velocity.SafeNormalize(Vector2.UnitX) * 5; + + if (!Orange) + { + float sine = (float)Math.Sin(Player.miscCounter * 0.875f / MathHelper.Pi); + + Vector2 offset = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 17f; + + Particle spark1 = new GlowSparkParticle(Player.Center + offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, false, 25, 0.04f * sparkscale1, effectColor * 0.9f, new Vector2(0.8f, 0.3f), true, false, 0.4f); + GeneralParticleHandler.SpawnParticle(spark1); + Particle spark2 = new GlowSparkParticle(Player.Center - offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, false, 25, 0.04f * sparkscale1, effectColor * 0.9f, new Vector2(1, 0.3f), true, false, 0.4f); + GeneralParticleHandler.SpawnParticle(spark2); + } + else + { + float sparkscale2 = MathF.Min(Player.velocity.X * dir * 0.07f, 1.1f); + Vector2 SparkVelocity2 = Player.velocity.RotatedBy(dir * 2.5f, default) * 0.1f - Player.velocity / 2f; + Particle spark = new LineParticle(Player.Center + (Player.velocity.SafeNormalize(Vector2.UnitX) * 15).RotatedBy(2f * dir) * 1.5f, SparkVelocity2, false, 10, sparkscale2, effectColor); + GeneralParticleHandler.SpawnParticle(spark); + Vector2 SparkVelocity3 = Player.velocity.RotatedBy(dir * -2.5f, default) * 0.1f - Player.velocity / 2f; + Particle spark2 = new LineParticle(Player.Center + (Player.velocity.SafeNormalize(Vector2.UnitX) * 15).RotatedBy(-2f * dir) * 1.5f, SparkVelocity3, false, 10, sparkscale2, effectColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(Player.Center + Main.rand.NextVector2Circular(20, 30) + SparkVelocity1, 267, SparkVelocity1 * Main.rand.NextFloat(0.5f, 3f) * sparkscale1, 0, default, Main.rand.NextFloat(0.7f, 1.1f) * sparkscale1); + dust.noGravity = true; + dust.color = effectColor; + + Dust dust2 = Dust.NewDustPerfect(Player.Center + Main.rand.NextVector2Circular(20, 30) + SparkVelocity1, 10, SparkVelocity1 * Main.rand.NextFloat(0.5f, 3f) * sparkscale1, 0, default, Main.rand.NextFloat(0.9f, 1.4f) * sparkscale1); + dust2.noGravity = true; } } - else - HasReducedDashFirstFrame = false; } + + if (sandCloak && dashStart) + { + // Spawn sand veil when dashing if it does not exist and you do not have the cooldown + if (!(CalamityUtils.AnyProjectiles(ModContent.ProjectileType()) || Player.HasCooldown(Cooldowns.SandCloak.ID))) + { + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 13, 2.5f, Player.whoAmI); + SoundEngine.PlaySound(SoundID.Item45, Player.Center); + } + } + + if (Player.dashDelay == -1) + IsFirstDashFrame = false; + else + IsFirstDashFrame = true; } #endregion @@ -455,7 +584,7 @@ namespace CalamityMod.CalPlayer // If they're a boss, reduce the boss distance. // Boss distance will always be >= enemy distance, so there's no need to do another check. // Worm boss body and tail segments are not counted as bosses for this calculation. - if (npc.IsABoss() && !CalamityLists.noRageWormSegmentList.Contains(npc.type)) + if (npc.IsABoss() && !NoRageWormSegmentList.Includes(npc.type)) bossDistance = hitboxEdgeDist; } } @@ -544,23 +673,22 @@ namespace CalamityMod.CalPlayer adrenalineDiff = -adrenalineMax / AdrenalineDuration; // If using Draedon's Heart, you get healing instead of damage. - if (draedonsHeart) + // 26AUG2024: Ozzatron: Cut Draedon's Heart healing in half by making it heal every other frame. + if (draedonsHeart && Player.miscCounter % 2 == 1) { - Player.statLife += DraedonsHeart.NanomachinesHealPerFrame; - if (Player.statLife >= Player.statLifeMax2) - Player.statLife = Player.statLifeMax2; + Player.HealPlayer(DraedonsHeart.NanomachinesHealPerFrame, HealTextType.None); // Old Draedon's Heart dust effect from its standing still regen. Works just fine. int dustID = DustID.TerraBlade; { - int regen = Dust.NewDust(Player.position, Player.width, Player.height, dustID, 0f, 0f, 200, default, 1f); - Main.dust[regen].noGravity = true; - Main.dust[regen].fadeIn = 1.3f; + Dust regen = Dust.NewDustDirect(Player.position, Player.width, Player.height, dustID, 0f, 0f, 200, default, 1f); + regen.noGravity = true; + regen.fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); - Main.dust[regen].velocity = velocity; + regen.velocity = velocity; velocity.Normalize(); velocity *= 34f; - Main.dust[regen].position = Player.Center - velocity; + regen.position = Player.Center - velocity; } } } @@ -642,8 +770,7 @@ namespace CalamityMod.CalPlayer if (Player.velocity.Length() == 0f) return; - Dust dust; - dust = Main.dust[Dust.NewDust(Player.Center, 16, 16, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + Dust dust = Dust.NewDustDirect(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; @@ -662,9 +789,17 @@ namespace CalamityMod.CalPlayer Player.AddBuff(BuffID.Burning, 2); } - // Auric Ore causes an Auric Rejection unless you are wearing Auric Armor + // Auric Ore causes an Auric Rejection unless you are wearing Auric Armor or have God Mode // Auric Rejection causes an electrical explosion that yeets the player a considerable distance - if ((tile.TileType == auricOreID && !(auricSet || tracersSeraph)) || tile.TileType == auricRepulserID) + // CIT 17AUG2024: Despite providing full invulnerability, Silva armor revive intentionally does not prevent Auric rejection's yeeting. + // 25FEB2025 Ozzatron: Added external bool to control Auric Rejection immunity from the ore. + bool rejectionImmunity = auricSet || tracersSeraph || Player.creativeGodMode || externalAuricRejectionImmunity; + bool oreRejection = (tile.TileType == auricOreID) && !rejectionImmunity; + + // Repulsers always perform this effect because they are player-placed tiles made for this exact purpose + bool repulserRejection = tile.TileType == auricRepulserID; + + if (oreRejection || repulserRejection) { // Cut grappling hooks so the player is surely thrown Player.RemoveAllGrapplingHooks(); @@ -706,21 +841,53 @@ namespace CalamityMod.CalPlayer if (!blazingCursorDamage) return; - // miscCounter is used to limit Calamity's hit rate. - int framesPerHit = 5; - if (Player.miscCounter % framesPerHit != 1) + // 14NOV2024: Ozzatron: was not sure whether to let Calamity function outside normal cursor range. decided on no + // + // Check whether the mouse cursor is within the acceptable clamped range. If it's not, don't allow for damage. + Vector2 mouseTruePosition = Player.Calamity().mouseWorld; + Vector2 mouseClampedPosition = Player.ClampedMouseWorld(); + if (mouseTruePosition != mouseClampedPosition) return; - Rectangle sigilHitbox = Utils.CenteredRectangle(Main.MouseWorld, new Vector2(35f, 62f)); + Rectangle sigilHitbox = Utils.CenteredRectangle(mouseClampedPosition, new Vector2(35f, 62f)); int sigilDamage = (int)Player.GetBestClassDamage().ApplyTo(Calamity.BaseDamage); - sigilDamage = Player.ApplyArmorAccDamageBonusesTo(sigilDamage); bool brightenedSigil = false; foreach (NPC target in Main.ActiveNPCs) { - if (!target.Hitbox.Intersects(sigilHitbox) || target.immortal || target.dontTakeDamage || target.townNPC || NPCID.Sets.ActsLikeTownNPC[target.type] || NPCID.Sets.CountsAsCritter[target.type]) + if (!target.Hitbox.Intersects(sigilHitbox) || target.immortal || target.dontTakeDamage || target.friendly || NPCID.Sets.CountsAsCritter[target.type]) continue; + // Increment the cursor focus counter. Note this actually has a net of increasing by 2 per frame, due to the 1 per frame falloff in GlobalNPC. + // If this counter reaches 300 (which takes 2.5 seconds without interruptions), True VHex is activated. + if (target.Calamity().cursorFocus < CalamityGlobalNPC.cursorFocusMax) + { + target.Calamity().cursorFocus += 3; + + // Draw an expanding orb effect on the cursor based on the cursor focus value. + float cursorFocusRatio = target.Calamity().cursorFocus / (float)CalamityGlobalNPC.cursorFocusMax; + StrongBloom indicator = new(mouseClampedPosition, Vector2.Zero, Color.Lerp(Color.Magenta, Color.Red, cursorFocusRatio), cursorFocusRatio * 0.7f, 2); + GeneralParticleHandler.SpawnParticle(indicator); + + if (target.Calamity().cursorFocus >= CalamityGlobalNPC.cursorFocusMax) + { + target.Calamity().trueVulnerabilityHex = target.Calamity().vulnerabilityHex >= 300 ? target.Calamity().vulnerabilityHex : 300; + target.Calamity().vulnerabilityHex = 0; + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/WeaponEnchant"), target.Center); + + for (int i = 0; i < 18; i++) + { + Vector2 orbVel = new Vector2(15, 15).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.33f, 1f); + GlowOrbParticle orb = new(target.Center + orbVel, orbVel, false, 60, Main.rand.NextFloat(0.95f, 1.75f), Color.Lerp(Color.Red, Color.Magenta, 0.3f)); + GeneralParticleHandler.SpawnParticle(orb); + } + } + } + + // miscCounter is used to limit Calamity's hit rate. + if (Player.miscCounter % Calamity.FramesPerHit != 1) + return; + // Brighten the sigil because it is dealing damage. This can only happen once per hit event. if (!brightenedSigil) { @@ -735,8 +902,10 @@ namespace CalamityMod.CalPlayer // Enable crits by setting the sigil's damage class to be whatever the player's strongest damage class is. sigilStrike.DamageType = Player.GetBestClass(); - // Incinerate the target with Vulnerability Hex. - target.AddBuff(ModContent.BuffType(), VulnerabilityHex.CalamityDuration); + // Incinerate the target with either Vulnerability Hex or True Vulnerability Hex, depending on current cursor focus. + // This adds 8 to the buff duration, which results in a net increase of 3 frames every time damage is dealt, due to damage occurring every 5 frames. + int buffToInflict = target.Calamity().trueVulnerabilityHex > 0 ? ModContent.BuffType() : ModContent.BuffType(); + target.AddBuff(buffToInflict, target.Calamity().trueVulnerabilityHex > 0 ? target.Calamity().trueVulnerabilityHex + 8 : target.Calamity().vulnerabilityHex < VulnerabilityHex.CalamityDuration ? VulnerabilityHex.CalamityDuration : target.Calamity().vulnerabilityHex + 8); // Make some fancy dust to indicate damage is being done. for (int j = 0; j < 12; j++) @@ -753,12 +922,27 @@ namespace CalamityMod.CalPlayer private void MiscEffects() { - // Update Carpet textures - if (Main.netMode != NetmodeID.Server && Player.whoAmI == Main.myPlayer) + // Update textures + if (!Main.dedServ && Player.whoAmI == Main.myPlayer) { - Asset carpetAuric = ModContent.Request("CalamityMod/ExtraTextures/AuricCarpet"); - Asset carpetOriginal = CalamityMod.carpetOriginal; + Asset carpetAuric = ExtraTextureRefs.FlyingCarpetAuric; + Asset carpetOriginal = ExtraTextureRefs.FlyingCarpetVanilla; TextureAssets.FlyingCarpet = (auricSet ? carpetAuric : carpetOriginal); + + for (int l = 0; l < Player.MaxBuffs; l++) + { + if (Player.buffType[l] != BuffID.Lucky) + continue; + + if (Player.buffTime[l] > CalamityUtils.SecondsToFrames(600f)) + TextureAssets.Buff[BuffID.Lucky] = ExtraTextureRefs.LuckIconGreater; + else if (Player.buffTime[l] > CalamityUtils.SecondsToFrames(300f)) + TextureAssets.Buff[BuffID.Lucky] = ExtraTextureRefs.LuckIconVanilla; + else + TextureAssets.Buff[BuffID.Lucky] = ExtraTextureRefs.LuckIconLesser; + + break; + } } // Calculate/reset DoG cart rotations based on whether the DoG cart is in use. @@ -875,9 +1059,22 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); if (Main.myPlayer == Player.whoAmI && target.WithinRange(Player.Center, 2000f)) + { Projectile.NewProjectile(source, target.Center, Vector2.Zero, bullseyeType, 0, 0f, Player.whoAmI, target.whoAmI); - if (spiritOriginBullseyeShootCountdown <= 0) - spiritOriginBullseyeShootCountdown = 45; + + foreach (var proj in Main.ActiveProjectiles) + { + if (proj.owner != Player.whoAmI || proj.type != ModContent.ProjectileType()) + continue; + + DaawnlightSpiritOriginMinion dsoPet = proj.ModProjectile(); + dsoPet.Projectile.spriteDirection = MathF.Sign(dsoPet.Projectile.Center.X - target.Center.X); + if (dsoPet.CurrentAnimation != DaawnlightSpiritOriginMinion.AnimationState.Pointing) + dsoPet.CurrentAnimation = DaawnlightSpiritOriginMinion.AnimationState.Pointing; + + break; + } + } } } @@ -924,8 +1121,8 @@ namespace CalamityMod.CalPlayer { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = Player.buffType[l]; - if (Player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + int buffID = Player.buffType[l]; + if (Player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) Player.buffTime[l]--; } } @@ -975,7 +1172,7 @@ namespace CalamityMod.CalPlayer { Player.buffImmune[ModContent.BuffType()] = true; } - if (CalamityConfig.Instance.ChilledWaterRework) + if (CalamityServerConfig.Instance.ChilledWaterRework) { if (Main.expertMode && Player.ZoneSnow && Player.wet && !Player.lavaWet && !Player.honeyWet) { @@ -993,13 +1190,7 @@ namespace CalamityMod.CalPlayer } } - // Extra DoT in the lava of the crags. Negated by Flame-licked Shell. - if (Player.lavaWet) - { - if (ZoneCalamity && !flameLickedShell) - Player.AddBuff(ModContent.BuffType(), 2, false); - } - else + if (!Player.lavaWet) { if (Player.lavaImmune) { @@ -1098,7 +1289,7 @@ namespace CalamityMod.CalPlayer Player.noFallDmg = true; } - if (CalamityConfig.Instance.FasterFallHotkey) + if (CalamityClientConfig.Instance.FasterFallHotkey) { // Allow the player to double their gravity (but NOT max fall speed!) by holding the down button while in midair. bool holdingDown = Player.controlDown && !Player.controlJump; @@ -1128,7 +1319,7 @@ namespace CalamityMod.CalPlayer } // Increase Rope climb velocities, if enabled - if (CalamityConfig.Instance.FasterRopeClimbSpeed) + if (CalamityServerConfig.Instance.FasterRopeClimbSpeed) { if (Player.pulley) { @@ -1213,7 +1404,6 @@ namespace CalamityMod.CalPlayer if (!tentaclesPresent[i]) { int damage = (int)Player.GetBestClassDamage().ApplyTo(390); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); var source = Player.GetSource_FromThis(OmegaBlueHelmet.TentacleEntitySourceContext); Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; @@ -1233,6 +1423,17 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() += critUp; } + // Rain armor set effects + if (rainSet) + { + if (Player.jump == 15 && Player.whoAmI == Main.myPlayer) // This is technically the frame after you start jumping from the ground + { + bool rainBoost = Player.Center.Y < Main.worldSurface * 16.0 && Main.raining; + int damage = (int)Player.GetBestClassDamage().ApplyTo(30 * (rainBoost ? 2f : 1)); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Vector2.UnitY * 26, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Main.myPlayer); + } + } + bool profanedSoulBuffs = profanedCrystalBuffs || (!profanedCrystal && pSoulArtifact) || (profanedCrystal && DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs); // Guardian bonuses @@ -1250,10 +1451,7 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { - Player.statLife += 15; - Player.HealEffect(15); - if (Player.statLife > Player.statLifeMax2) - Player.statLife = Player.statLifeMax2; + Player.HealPlayer(15); if (profanedCrystal) { @@ -1280,12 +1478,12 @@ namespace CalamityMod.CalPlayer if (i % dustDivisor == 0) { currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations); - 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; - Main.dust[holyDust].scale = 1f; - Main.dust[holyDust].fadeIn = Main.rand.NextFloat() * 2f; + Dust holyDust = Dust.NewDustDirect(currentDustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); + holyDust.position = currentDustPos; + holyDust.velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * healerDustVel * (0.8f + Main.rand.NextFloat() * 0.4f) + Player.velocity; + holyDust.noGravity = true; + holyDust.scale = 1f; + holyDust.fadeIn = Main.rand.NextFloat() * 2f; Dust dustClone = Dust.CloneDust(holyDust); Dust extraDust = dustClone; extraDust.scale /= 2f; @@ -1300,6 +1498,234 @@ namespace CalamityMod.CalPlayer } } + // The fire boots debuff boosts + if (hellfireTreads) + bootLevel = 2; + else if (flameWakerBoots) + bootLevel = 1; + else + bootLevel = 0; + + if (rOfResilienceEffect > 0) + rOfResilienceEffect--; + if (Player.HeldItem.type == ModContent.ItemType()) // All players close to a player holding RoR get the benefits + { + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && !Player.dead) + { + Projectile relic = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI); + } + for (int index = 0; index < Main.player.Length; index++) + { + Player fella = Main.player[index]; + if (Utils.Distance(fella.Center, Player.Center) < 650 && fella.team == Player.team) + { + fella.Calamity().rOfResilienceEffect = (fella != Player ? 480 : 2); + } + } + } + if (rOfResilienceEffect > 0) + { + if (Player.Calamity().mouseRight && rOfResilienceCooldown == 0) + { + int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + rOfResilienceCooldown = cooldownTime; + Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); + SoundStyle y = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); + SoundEngine.PlaySound(y with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); + } + + // Adds a floor for defense and dr at 150 and 10% respectivley, will not ignore defense damage + if (Player.Calamity().rOfResilienceCooldown > 300 || Player.Calamity().rOfResilienceCooldown == 0) + { + float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? 1 : Utils.GetLerpValue(300, 600, Player.Calamity().rOfResilienceCooldown, true)); + int maxDefFloor = (int)(150 * fadeStats); + float MaxDRFloor = 0.10f * fadeStats; + if (Player.statDefense < maxDefFloor) + Player.statDefense += maxDefFloor - Player.statDefense; + if (Player.endurance < MaxDRFloor) + Player.endurance += MaxDRFloor - Player.endurance; + } + + int numOfShards = 0; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] == 0 && projectile.owner == Player.whoAmI) + { + numOfShards++; + } + } + if (Player.miscCounter % (Player.Calamity().profanedSoulRelicBuff ? 4 : 8) == 0 && numOfShards < (Player.Calamity().profanedSoulRelicBuff ? 75 : 30) && Player.Calamity().rOfResilienceCooldown == 0) + { + if (numOfShards == 0) + { + rOfResilienceOrbitOffset = Main.rand.Next(0, 100 + 1); + SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = -0.3f }, Player.Center); + } + int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(420); + Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1); + } + } + if (rOfResilienceCooldown > 0) + rOfResilienceCooldown--; + + if (transformer && Player.Calamity().transformerCooldown == 0 && transformerDelay == 0) // The code for this acursed thing took much... MUCH, too long to make + { + float zoneSize = 150; + int blobDamage = (int)Player.GetBestClassDamage().ApplyTo(TheTransformer.blobDamage); + int numOfBlobs = Player.ownedProjectileCounts[ModContent.ProjectileType()]; + if (numOfBlobs >= TheTransformer.blobCap && !Main.zenithWorld) + Player.Calamity().transformerStoredKills = 0; + if (Player.Calamity().transformerStoredKills > 0 && (numOfBlobs < TheTransformer.blobCap || Main.zenithWorld)) + { + transformerDelay = 2; + + int layer = (int)(Utils.GetLerpValue(0, 10, numOfBlobs + 1) + 0.9f); + Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(0, 16).RotatedByRandom(MathHelper.Pi), ModContent.ProjectileType(), blobDamage, 0f, Player.whoAmI, layer, numOfBlobs + 1); + + if (Player.Calamity().transformerVisual) + { + Particle orb2 = new CustomPulse(Player.Center, Vector2.Zero, Color.LightSkyBlue, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.5f, 11); + GeneralParticleHandler.SpawnParticle(orb2); + + SoundStyle transform = new("CalamityMod/Sounds/Item/NullImpact"); + SoundEngine.PlaySound(transform with { Volume = 0.1f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) + numOfBlobs * 0.015f, MaxInstances = -1 }, Player.Center); + } + + foreach (Projectile p in Main.ActiveProjectiles) + { + float angleMax = MathHelper.ToRadians(360 * layer); + if (numOfBlobs == 0) + angleMax = 0f; + + if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI) + { + float insanityValue = ((p.ai[1] % 10) + 1); + if (p.ai[0] == layer) + p.ai[2] = insanityValue / CalamityUtils.CountOwnedProjectiles(ModContent.ProjectileType(), Player.whoAmI) * (angleMax) - (angleMax) / 2f; + + p.netUpdate = true; + } + } + Player.Calamity().transformerStoredKills--; + } + else + { + // GFB changes are that projectiles slow and have lifetime decay when in the aura, also they can add charges way faster than normal, deal more damage the more you collect, and the number of blobs is uncapped + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Main.zenithWorld && Vector2.Distance(Player.Center, projectile.Center) <= zoneSize && projectile.active && projectile.hostile) + { + projectile.velocity = Vector2.Lerp(projectile.velocity, Utils.DirectionTo(Player.Center, projectile.Center) * 4, Utils.GetLerpValue(300, 230, projectile.timeLeft, true)); + projectile.timeLeft = (int)MathHelper.Lerp(projectile.timeLeft, 0, 0.25f); + if (projectile.damage > 1) + projectile.damage = (int)(projectile.damage * 0.85f); + projectile.friendly = true; + } + + if (Vector2.Distance(Player.Center, projectile.Center) <= zoneSize && projectile.active && projectile.hostile && projectile.Calamity().TransformerTimer == 0 && (numOfBlobs < TheTransformer.blobCap || Main.zenithWorld) && transformerDelay == 0) + { + transformerDelay = 2; // 2 frame delay between projectile transformation + + projectile.Calamity().TransformerTimer = Main.zenithWorld ? 3 : 30; + + int layer = (int)(Utils.GetLerpValue(0, 10, numOfBlobs + 1) + 0.9f); + Projectile.NewProjectileDirect(Player.GetSource_FromThis(), projectile.Center, projectile.velocity.SafeNormalize(Vector2.UnitX) * 16f, ModContent.ProjectileType(), blobDamage, 0f, Player.whoAmI, layer, numOfBlobs + 1); + + if (Player.Calamity().transformerVisual) + { + Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.LightSkyBlue, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.5f, 11); + GeneralParticleHandler.SpawnParticle(orb2); + + SoundStyle transform = new("CalamityMod/Sounds/Item/NullImpact"); + SoundEngine.PlaySound(transform with { Volume = 0.1f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) + numOfBlobs * 0.015f, MaxInstances = -1 }, projectile.Center); + } + + float index = 1f; + foreach (Projectile p in Main.ActiveProjectiles) + { + float angleMax = MathHelper.ToRadians(360 * layer); + if (numOfBlobs == 0) + angleMax = 0f; + + if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI) + { + float insanityValue = ((p.ai[1] % 10) + 1); + if (p.ai[0] == layer) + p.ai[2] = insanityValue / CalamityUtils.CountOwnedProjectiles(ModContent.ProjectileType(), Player.whoAmI) * (angleMax) - (angleMax) / 2f; + + p.netUpdate = true; + index++; + } + } + + } + } + } + } + if (transformerDelay > 0) + transformerDelay--; + + if (sSpiritAmulet) + { + int spawnTime = 65; // Time between energy spawns + int energyCap = 8; // Max number of energies that can be alive at a time + + Projectile projectile = null; + if (Player.dashDelay == -1) // When the player dashes, make all the energies exit idle phase + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[2] == 0 && projectile.owner == Player.whoAmI) + { + projectile.ai[2] = 5; + } + } + sSpiritAmuletTimer = -spawnTime; // The spawn cooldown after launching energies is twice as long + } + int numOfEnergy = 0; + for (int x = 0; x < Main.maxProjectiles; x++) // Get a count of energies in idle mode + { + projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[2] == 0 && projectile.owner == Player.whoAmI) + numOfEnergy++; + } + if (sSpiritAmuletTimer >= spawnTime) + { + if (numOfEnergy < energyCap) + { + int energyDamage = (int)Player.GetBestClassDamage().ApplyTo(22); + Projectile energy = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, (Vector2.One * 4).RotatedByRandom(Math.PI), ModContent.ProjectileType(), energyDamage, 0f, Player.whoAmI, 0, numOfEnergy); + if (numOfEnergy + 1 == energyCap && Player.Calamity().sSpiritAmuletVisual) + { + SoundStyle transform = new("CalamityMod/Sounds/Item/WaterSplash1"); + SoundEngine.PlaySound(transform with { Volume = 0.25f, Pitch = 0.9f, MaxInstances = -1 }, Player.Center); + + for (int i = 0; i <= 14; i++) + { + Vector2 vel = (Vector2.One * 5).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.4f, 1.2f); + + Dust dust2 = Dust.NewDustPerfect(Player.Center, ModContent.DustType(), vel); + dust2.scale = Main.rand.NextFloat(0.8f, 1.4f); + dust2.noGravity = false; + dust2.alpha = 180; + dust2.color = Main.rand.NextBool() ? Color.Turquoise : Color.Aquamarine; + dust2.noLight = true; + dust2.noLightEmittence = true; + } + } + } + sSpiritAmuletTimer = 0; + } + else if (!Player.dead) + { + sSpiritAmuletTimer++; + } + } + if (unstableGraniteCore) { zapActivity += 1; @@ -1323,7 +1749,7 @@ namespace CalamityMod.CalPlayer { unstableSelectedTarget = Main.npc[target]; unstableSelectedTarget.Calamity().arcZapCooldown = 18; - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.GetBestClassDamage().ApplyTo(18)); + int damage = (int)Player.GetBestClassDamage().ApplyTo(18); Projectile.NewProjectile(Player.GetSource_FromThis(), new Vector2(Player.Center.X, Player.Center.Y - 20f), new Vector2(0f, -2f), ModContent.ProjectileType(), damage, 0f, Player.whoAmI, target, 3f); target = -1; @@ -1362,6 +1788,25 @@ namespace CalamityMod.CalPlayer } } + if (whitewaterHeal > 0) + { + if (whitewaterHeal % 15 == 0) + Player.HealPlayer(1); + whitewaterHeal--; + + Vector2 vel = (MathHelper.TwoPi * whitewaterHeal * Player.direction / 25).ToRotationVector2() * 3f; + for (int i = -1; i <= 1; i += 2) + { + Dust c = Dust.NewDustPerfect(Player.Center + vel * 4 * i, ModContent.DustType()); + c.velocity = vel * i; + c.scale = Main.rand.NextFloat(0.9f, 1f); + c.noGravity = true; + c.alpha = 150; + c.color = Color.SkyBlue; + c.noLightEmittence = true; + } + } + // Tick all cooldowns. // Depending on the code for each individual cooldown, this isn't guaranteed to do anything. // It may not tick down the timer or not do anything at all. @@ -1386,7 +1831,7 @@ namespace CalamityMod.CalPlayer { handler.OnCompleted(); if (handler.EndSound != null && handler.ShouldPlayEndSound) - SoundEngine.PlaySound(handler.EndSound.GetValueOrDefault()); + SoundEngine.PlaySound(handler.EndSound.GetValueOrDefault(), Player.Center); expiredCooldowns.Add(id); } } @@ -1398,7 +1843,7 @@ namespace CalamityMod.CalPlayer // If any cooldowns were removed, send a cooldown removal packet that lists all cooldowns to remove. if (expiredCooldowns.Count > 0) - SyncCooldownRemoval(Main.netMode == NetmodeID.Server, expiredCooldowns); + SyncCooldownRemoval(Main.dedServ, expiredCooldowns); // Grant the player 5 seconds of immunity to immobilizing debuffs after an immobilizing debuff wears off. if (Player.stoned || Player.frozen || Player.webbed || gState) @@ -1416,8 +1861,12 @@ namespace CalamityMod.CalPlayer if (arsenalCooldown > 0) arsenalCooldown--; + if (killModeCooldown > 0) + killModeCooldown--; if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) ascendantInsigniaCooldown--; + if (transformerCooldown > 0) + transformerCooldown--; if (DragonsBreathAudioCooldown > 0) DragonsBreathAudioCooldown--; if (DragonsBreathAudioCooldown2 > 0) @@ -1432,8 +1881,6 @@ namespace CalamityMod.CalPlayer plagueTaintedSMGDroneCooldown--; if (momentumCapacitorTime > 0) --momentumCapacitorTime; - if (spiritOriginBullseyeShootCountdown > 0) - spiritOriginBullseyeShootCountdown--; if (phantomicHeartRegen > 0 && phantomicHeartRegen < 1000) phantomicHeartRegen--; if (phantomicBulwarkCooldown > 0) @@ -1442,22 +1889,30 @@ namespace CalamityMod.CalPlayer KameiBladeUseDelay--; if (galileoCooldown > 0) galileoCooldown--; + if (gladiatorTimer > 0) + gladiatorTimer--; if (dragonRageCooldown > 0) dragonRageCooldown--; if (soundCooldown > 0) soundCooldown--; - if (shadowPotCooldown > 0) - shadowPotCooldown--; - if (raiderCritBonus > 0f) - raiderCritBonus -= RaidersTalisman.RaiderBonus / (float)CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); + if (raiderCritLifespan > 0f) + raiderCritLifespan--; if (raiderSoundCooldown > 0) raiderSoundCooldown--; if (astralStarRainCooldown > 0) astralStarRainCooldown--; if (AbaddonCooldown > 0) AbaddonCooldown--; + if (VoidCooldown > 0) + VoidCooldown--; if (ursaSergeantCooldown > 0) ursaSergeantCooldown--; + if (bGlassbandCooldown > 0) + bGlassbandCooldown--; + if (batholithBangleCooldown > 0) + batholithBangleCooldown--; + if (protolithBangleCooldown > 0) + protolithBangleCooldown--; if (AlchFlaskCooldown > 0) AlchFlaskCooldown--; if (tarraRangedCooldown > 0) @@ -1492,8 +1947,14 @@ namespace CalamityMod.CalPlayer evolutionLifeRegenCounter--; if (hurtSoundTimer > 0) hurtSoundTimer--; - if (icicleCooldown > 0) - icicleCooldown--; + if (wingProjectileCooldown > 0) + wingProjectileCooldown--; + if (vortexBoosterStealthDelay > 0) + { + vortexBoosterStealthDelay--; + if (vortexBoosterStealthDelay == 1) + Player.vortexStealthActive = true; + } if (statisTimer > 0 && Player.dashDelay >= 0) statisTimer = 0; if (hallowedRuneCooldown > 0) @@ -1516,8 +1977,17 @@ namespace CalamityMod.CalPlayer hideOfDeusTimer--; if (murasamaHitCooldown > 0) murasamaHitCooldown--; - if (hellbornBoost > 0) - hellbornBoost--; + if (burningSeaBurnOut > 0) + { + burningSeaBurnOut--; + if (Main.rand.NextBool()) + { + Vector2 dustSpawnPos = Player.position + new Vector2(Main.rand.NextFloat(Player.width), 0f); + Vector2 dustVelocity = -Vector2.UnitY * Main.rand.NextFloat(3f, 6f); + Dust burnOutDust = Dust.NewDustPerfect(dustSpawnPos, (int)CalamityDusts.Brimstone, dustVelocity); + burnOutDust.noGravity = true; + } + } if (persecutedEnchantSummonTimer < 1800) persecutedEnchantSummonTimer++; else @@ -1567,10 +2037,25 @@ namespace CalamityMod.CalPlayer else if (blazingCoreParry > 0) BlazingCore.HandleParryCountdown(Player); } - else if (flameLickedShell && flameLickedShellParry > 0) + else if (blazingCoreParry > 0) + blazingCoreParry--; + else if (flameLickedShellParry > 0) { - FlameLickedShell.HandleParryCountdown(Player); + if (flameLickedShell) + FlameLickedShell.HandleParryCountdown(Player); + else + flameLickedShellParry--; } + if (shieldOfTheOceanParry > 0) + { + if (shieldOfTheOcean) + ShieldoftheOcean.HandleParryCountdown(Player); + else + shieldOfTheOceanParry--; + } + + if (!flameLickedShell && flameLickedShellParry > 0) + flameLickedShellParry--; // Silver Armor "Medkit" effect if (silverMedkitTimer > 0) @@ -1578,10 +2063,7 @@ namespace CalamityMod.CalPlayer --silverMedkitTimer; if (silverMedkitTimer == 0) { - Player.HealEffect(SilverArmorSetChange.SetBonusHealAmount, true); - Player.statLife += SilverArmorSetChange.SetBonusHealAmount; - if (Player.statLife > Player.statLifeMax2) - Player.statLife = Player.statLifeMax2; + Player.HealPlayer(SilverArmorSetChange.SetBonusHealAmount); SilverArmorSetChange.OnHealEffects(Player); } @@ -1633,7 +2115,7 @@ namespace CalamityMod.CalPlayer // God Slayer Armor dash debuff immunity if (DashID == GodSlayerDash.ID && Player.dashDelay < 0) { - foreach (int debuff in CalamityLists.debuffList) + foreach (int debuff in DebuffsList.List) Player.buffImmune[debuff] = true; } @@ -1693,7 +2175,10 @@ namespace CalamityMod.CalPlayer Player.statLife = upperHealthLimit; if (necroReviveCounter >= NecroArmorSetChange.PostMortemDuration * 60) + { Player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.NecroRevive").Format(Player.name)), 1000, -1); + necroReviveCounter = -1; + } else if (necroReviveCounter % 60 == 59) SoundEngine.PlaySound(NecroArmorSetChange.TimerSound, Player.Center); } @@ -1701,9 +2186,13 @@ namespace CalamityMod.CalPlayer // Silva invincibility effects if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) { - foreach (int debuff in CalamityLists.debuffList) + // You become immune to all debuffs + foreach (int debuff in DebuffsList.List) Player.buffImmune[debuff] = true; + // Prevent thorns effects from being abused during invincibility + Player.thorns = 0f; + silvaCountdown -= 1; if (silvaCountdown <= 0) { @@ -1713,15 +2202,15 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 2; j++) { - 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; - Main.dust[green].noGravity = true; - Main.dust[green].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[green].shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); + Dust green = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.ChlorophyteWeapon, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + green.position.X += (float)Main.rand.Next(-20, 21); + green.position.Y += (float)Main.rand.Next(-20, 21); + green.velocity *= 0.9f; + green.noGravity = true; + green.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + green.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); if (Main.rand.NextBool()) - Main.dust[green].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + green.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; } } if (!Player.HasCooldown(SilvaRevive.ID) && hasSilvaEffect && silvaCountdown <= 0 && !areThereAnyDamnBosses && !areThereAnyDamnEvents) @@ -1773,12 +2262,12 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = Player.buffType[l]; - if (Player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType()) + int buffID = Player.buffType[l]; + if (Player.buffTime[l] <= 2 && buffID == ModContent.BuffType()) if (Player.whoAmI == Main.myPlayer) - Player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(25)); - bool shouldAffect = CalamityLists.debuffList.Contains(hasBuff); + bool shouldAffect = DebuffsList.Includes(buffID); if (shouldAffect) Player.GetDamage() += 0.1f; } @@ -1815,26 +2304,25 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 2; j++) { - int blood = Dust.NewDust(Player.position, Player.width, Player.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[blood]; - dust.position.X += (float)Main.rand.Next(-20, 21); - dust.position.Y += (float)Main.rand.Next(-20, 21); - dust.velocity *= 0.9f; - dust.noGravity = true; - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); + Dust blood = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.Blood, 0f, 0f, 100, default, 2f); + blood.position.X += (float)Main.rand.Next(-20, 21); + blood.position.Y += (float)Main.rand.Next(-20, 21); + blood.velocity *= 0.9f; + blood.noGravity = true; + blood.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + blood.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); if (Main.rand.NextBool()) - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + blood.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; } } } // Raider Talisman bonus - if (raiderTalisman && !StealthStrikeAvailable()) - Player.GetCritChance() += raiderCritBonus; + if (raiderTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) + Player.GetCritChance() += RaidersTalisman.RaiderBonus; if (kamiBoost) - Player.GetDamage() += 0.15f; + Player.GetDamage() += YanmeisKnife.DamageBoost; if (avertorBonus) Player.GetDamage() += 0.1f; @@ -1857,16 +2345,16 @@ namespace CalamityMod.CalPlayer // Absorber bonus if (absorber) { - Player.moveSpeed += 0.12f; - Player.jumpSpeedBoost += 0.6f; - Player.thorns += 3.5f; + Player.moveSpeed += TheAbsorber.MoveSpeedBoost; + Player.jumpSpeedBoost += TheAbsorber.JumpSpeedBoost; + Player.thorns += TheAbsorber.ThornsBoost; } // Nimble Bounder bonus if (nimbleBounderBoost) { - Player.moveSpeed += 0.05f; - Player.jumpSpeedBoost += 0.25f; + Player.moveSpeed += NimbleBounder.MoveSpeedBoost; + Player.jumpSpeedBoost += NimbleBounder.JumpSpeedBoost; } // Affliction bonus @@ -1919,14 +2407,14 @@ namespace CalamityMod.CalPlayer if (encased) { - Player.statDefense += 30; + Player.statDefense += PermafrostsConcoction.EncasedDefenseBoost; Player.frozen = true; Player.velocity.X = 0f; Player.velocity.Y = -0.4f; // Should negate gravity - int ice = Dust.NewDust(Player.position, Player.width, Player.height, DustID.GemSapphire); - Main.dust[ice].noGravity = true; - Main.dust[ice].velocity *= 2f; + Dust ice = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.GemSapphire); + ice.noGravity = true; + ice.velocity *= 2f; Player.buffImmune[BuffID.Frozen] = true; Player.buffImmune[BuffID.Chilled] = true; @@ -1958,7 +2446,7 @@ namespace CalamityMod.CalPlayer } // Vortex Armor nerf - if (Player.vortexStealthActive) + if (Player.vortexStealthActive && Player.ActiveItem().type != ItemID.PsychoKnife) { Player.GetDamage() -= (1f - Player.stealth) * 0.4f; // Change 80 to 40 Player.GetCritChance() -= (int)((1f - Player.stealth) * 5f); // Change 20 to 15 @@ -1983,10 +2471,6 @@ namespace CalamityMod.CalPlayer } } - // Calcium Potion buff - if (calcium) - Player.noFallDmg = true; - // Ceaseless Hunger Potion buff if (ceaselessHunger) { @@ -2061,7 +2545,6 @@ namespace CalamityMod.CalPlayer lightningVel.Normalize(); lightningVel *= Main.rand.NextFloat(1f, 2f); int damage = (int)Player.GetTotalDamage().ApplyTo(30); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); int projectile = Projectile.NewProjectile(source, Player.Center, lightningVel, ModContent.ProjectileType(), damage, 0, Player.whoAmI, Main.rand.Next(2), 0f); Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); @@ -2071,10 +2554,10 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 3; i++) { - 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; + Dust dust = Dust.NewDustDirect(Player.Center, 1, 1, DustID.RedTorch, Player.velocity.X * -0.1f, Player.velocity.Y * -0.1f, 100, default, 3.5f); + dust.noGravity = true; + dust.velocity *= 1.2f; + dust.velocity.Y -= 0.15f; } } else if (plaguedFuelPack) @@ -2087,7 +2570,6 @@ namespace CalamityMod.CalPlayer cloudVelocity.Normalize(); cloudVelocity *= Main.rand.NextFloat(0f, 1f); int damage = (int)Player.GetTotalDamage().ApplyTo(20); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); int projectile = Projectile.NewProjectile(source, Player.Center, cloudVelocity, ModContent.ProjectileType(), damage, 0, Player.whoAmI, 0, 0); Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); @@ -2097,10 +2579,10 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 3; i++) { - 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; + Dust dust = Dust.NewDustDirect(Player.Center, 1, 1, DustID.GemEmerald, Player.velocity.X * -0.1f, Player.velocity.Y * -0.1f, 100, default, 3.5f); + dust.noGravity = true; + dust.velocity *= 1.2f; + dust.velocity.Y -= 0.15f; } } } @@ -2145,6 +2627,14 @@ namespace CalamityMod.CalPlayer omegaBlueCD.timeLeft = 1500; } + bool hasKillMode = cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); + if (hasKillMode && killModeCD.timeLeft > KillMode.cooldownMax && !(Player.ActiveItem().type == ModContent.ItemType() || Player.ActiveItem().type == ModContent.ItemType() || Player.ActiveItem().type == ModContent.ItemType())) + { + killModeCD.timeLeft = KillMode.cooldownMax - 1; + Player.Calamity().killModeCooldown = KillMode.cooldownMax - 1; + Player.Calamity().demonSwordKillMode = false; + } + bool hasPlagueBlackoutCD = cooldowns.TryGetValue(PlagueBlackout.ID, out CooldownInstance plagueBlackoutCD); if (!plagueReaper && hasPlagueBlackoutCD && plagueBlackoutCD.timeLeft > 1500) plagueBlackoutCD.timeLeft = 1500; @@ -2173,7 +2663,7 @@ namespace CalamityMod.CalPlayer #region Biome Effects public void DrawPollenInFloralParadise() { - if (!ZoneFloralParadise || !Main.rand.NextBool(7) || Main.netMode == NetmodeID.Server) + if (!ZoneFloralParadise || !Main.rand.NextBool(7) || Main.dedServ) return; for (int i = 0; i < 15; i++) @@ -2265,24 +2755,30 @@ namespace CalamityMod.CalPlayer double breathLoss = Main.remixWorld ? (point.Y < abyssLevel1 ? 50D * depthRatioFromAbyssLayer1 : 0D) : (point.Y > abyssLevel1 ? 50D * depthRatioFromAbyssLayer1 : 0D); // Breath Loss Multiplier, depending on gear - double breathLossMult = 1D - - (Player.gills ? 0.2 : 0D) - // 0.8 - (oceanCrest ? 0.2 : 0D) - // 0.8 - (victideSet ? 0.2 : 0D) - // 0.8 - (Player.accDivingHelm ? 0.25 : 0D) - // 0.75 - (Player.arcticDivingGear ? 0.25 : 0D) - // 0.75 - (aquaticEmblem ? 0.25 : 0D) - // 0.75 - (Player.accMerman ? 0.3 : 0D) - // 0.7 - (reaverExplore ? 0.3 : 0D) - // 0.7 - ((aquaticHeart && NPC.downedBoss3) ? 0.3 : 0D) - // 0.7 - (abyssalDivingSuit ? 0.3 : 0D); // 0.7 + // 27AUG2024: Ozzatron: fixed this being subtractive like mining speed. now doesn't stack exponentially + // It is now a multiplier for the time it takes to lose any unit amount of breath + double breathLossTimeMult = 1D + + (Player.gills ? 0.2 : 0D) + // 1.2 + (oceanCrest ? 0.2 : 0D) + // 1.2 + (victideSet ? 0.2 : 0D) + // 1.2 + (Player.accDivingHelm ? 0.25 : 0D) + // 1.25 + (Player.arcticDivingGear ? 0.25 : 0D) + // 1.25 + (aquaticEmblem ? 0.25 : 0D) + // 1.25 + (Player.accMerman ? 0.3 : 0D) + // 1.3 + (reaverExplore ? 0.3 : 0D) + // 1.3 + ((aquaticHeart && NPC.downedBoss3) ? 0.3 : 0D) + // 1.3 + (abyssalDivingSuit ? 0.3 : 0D) + // 1.3 + externalBreathLossMultBoost; + + // Invert the breath loss time multiplier, to get the multiplier for the speed at which breath is actually lost + double breathLossMult = 1D / breathLossTimeMult; // Limit the multiplier to 5% if (breathLossMult < 0.05) breathLossMult = 0.05; // Reduce breath lost while at zero breath, depending on gear - breathLoss *= breathLossMult; + breathLoss *= breathLossTimeMult; // Record the final breath loss for the stat meter abyssBreathLossStat = (float)breathLoss; @@ -2340,7 +2836,8 @@ namespace CalamityMod.CalPlayer (Player.accMerman ? 15D : 0D) + // 55 (victideSet ? 5D : 0D) + // 60 ((aquaticHeart && NPC.downedBoss3) ? 15D : 0D) + // 75 - (abyssalDivingSuit ? 15D : 0D); // 90 + (abyssalDivingSuit ? 15D : 0D) + // 90 + externalBreathTickBoost; // Limit the multiplier to 50 if (tickMult > 50D) @@ -2352,16 +2849,23 @@ namespace CalamityMod.CalPlayer // Record the final breath loss rate for the stat meter abyssBreathLossRateStat = (float)tick; + float resistanceSlowdownFactor = 1f; + // Reduce breath over ticks (frames) - abyssBreathCD++; - if (abyssBreathCD >= (int)tick) + abyssBreathCD++; + if (abyssBreathCD >= (int)(tick * resistanceSlowdownFactor)) { // Reset modded breath variable abyssBreathCD = 0; // Reduce breath if (Player.breath > 0) - Player.breath -= (int)(cDepth ? breathLoss + 1D : breathLoss); + { + Player.breath -= (int)(cDepth && !depthCharm ? breathLoss + 1D : breathLoss); + + if (hPressure) + resistanceSlowdownFactor -= (int)(!abyssalDivingSuit ? 1.2f : 0.5f); + } } // If breath is greater than 0 and player has gills or is merfolk, balance out the effects by reducing breath @@ -2528,7 +3032,7 @@ namespace CalamityMod.CalPlayer Player.moveSpeed -= (1f - aquaticBoost * 0.0001f) * 0.1f; } else - aquaticBoost = aquaticBoostMax; modStealth = 1f; + aquaticBoost = aquaticBoostMax; if (Player.ActiveItem().type == ModContent.ItemType() && Player.StandingStill(0.1f)) { @@ -2536,7 +3040,7 @@ namespace CalamityMod.CalPlayer auralisStealthCounter++; bool usingScope = false; - if (!Main.gameMenu && Main.netMode != NetmodeID.Server) + if (!Main.gameMenu && !Main.dedServ) { if (Player.noThrow <= 0 && !Player.lastMouseInterface || !(Main.CurrentPan == Vector2.Zero)) { @@ -2563,6 +3067,14 @@ namespace CalamityMod.CalPlayer auralisAuroraCounter = 0; auralisAuroraCooldown = CalamityUtils.SecondsToFrames(30f); } + else if (auralisAuroraCounter > chargeDuration) + { + for (int i = -1; i <= 1; i += 2) + { + GlowSquareParticle fancySquares = new(Player.Center, Vector2.Zero, false, 2, 6.25f, new Color(92, 89, 251), true, MathHelper.ToRadians(auralisAuroraCounter * 2f * i)); + GeneralParticleHandler.SpawnParticle(fancySquares); + } + } if (auralisAuroraCounter > 0 && auralisAuroraCounter < chargeDuration && !usingScope) auralisAuroraCounter--; @@ -2585,20 +3097,20 @@ 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, 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; + Dust blue = Dust.NewDustDirect(source + dustVel, 0, 0, DustID.Vortex, dustVel.X, dustVel.Y, 100, default, 1.2f); + blue.noGravity = true; + blue.noLight = false; + blue.velocity = dustVel; } for (int d = 0; d < dustAmt; d++) { 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, 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; + Dust green = Dust.NewDustDirect(source + dustVel, 0, 0, DustID.TerraBlade, dustVel.X, dustVel.Y, 100, default, 1.2f); + green.noGravity = true; + green.noLight = false; + green.velocity = dustVel; } } auralisAuroraCounter = 0; @@ -2613,7 +3125,7 @@ namespace CalamityMod.CalPlayer if (gravityNormalizer) { Player.buffImmune[BuffID.VortexDebuff] = true; - if (Player.InSpace()) + if (Player.ReducedSpaceGravity()) { Player.gravity = Player.defaultGravity; if (Player.wet) @@ -2622,6 +3134,8 @@ namespace CalamityMod.CalPlayer Player.gravity = 0.1f; else if (Player.merman) Player.gravity = 0.3f; + else if (Player.trident && !Player.lavaWet) + Player.gravity = Player.controlUp ? 0.1f : 0.25f; else Player.gravity = 0.2f; } @@ -2664,7 +3178,7 @@ namespace CalamityMod.CalPlayer if (astralInjection) { if (Player.statMana < Player.statManaMax2) - Player.statMana += 2; + Player.statMana += AstralInjection.ManaPerFrame; if (Player.statMana > Player.statManaMax2) Player.statMana = Player.statManaMax2; } @@ -2674,26 +3188,26 @@ namespace CalamityMod.CalPlayer if (rRage) { - Player.GetDamage() += 0.1f; - Player.statDefense += 5; + Player.GetDamage() += ReaverHeadTank.ReaverRageDamageBoost; + Player.statDefense += ReaverHeadTank.ReaverRageDefenseBoost; } - if (xRage) - Player.GetDamage() += 0.1f; - if (xWrath) + { + Player.GetDamage() += 0.1f; Player.GetCritChance() += 5; + } if (graxDefense) { - Player.statDefense += 30; - Player.endurance += 0.1f; - Player.GetDamage() += 0.15f; + Player.statDefense += Grax.DefenseBoost; + Player.endurance += Grax.DamageReductionBoost; + Player.GetDamage() += Grax.DamageBoost; } if (brutalCarnage) { - Player.GetDamage() += 0.2f; + Player.GetDamage() += BrutalCarnage.MeleeDamageBoost; } // Trinket of Chi bonus @@ -2718,8 +3232,8 @@ namespace CalamityMod.CalPlayer if (AbsorberRegen) { - Player.GetDamage() += 0.08f; - Player.endurance += 0.05f; + Player.GetDamage() += TheAbsorber.AuraDamageBoost; + Player.endurance += TheAbsorber.AuraDamageReductionBoost; } if (crawCarapace) @@ -2760,7 +3274,7 @@ namespace CalamityMod.CalPlayer if (tortShellPostHit > 0) { - Player.statDefense -= 10; + Player.statDefense -= 8; tortShellPostHit--; } else @@ -2789,10 +3303,7 @@ namespace CalamityMod.CalPlayer // Bloodflare Core's heal over time if (bloodflareCore && bloodflareCoreRemainingHealOverTime > 0 && Player.miscCounter % BloodflareCore.HealFrameCooldown == 0) { - Player.statLife += 1; - Player.HealEffect(1, false); - if (Player.statLife > Player.statLifeMax2) - Player.statLife = Player.statLifeMax2; + Player.HealPlayer(1, HealTextType.Local); // Produce an implosion of blood themed dust so it's obvious an effect is occurring for (int i = 0; i < 3; ++i) @@ -2809,10 +3320,10 @@ namespace CalamityMod.CalPlayer --bloodflareCoreRemainingHealOverTime; } - // 50% movement speed bonus so that you don't feel like a snail in the early game + // Multiplies base movement speed by 1.5x so that you don't feel like a snail in the early game // Disabled while Overhaul is enabled, because Overhaul does very similar things to make movement more snappy - if (CalamityMod.Instance.overhaul is null && CalamityConfig.Instance.FasterBaseSpeed) - Player.moveSpeed += BalancingConstants.DefaultMoveSpeedBoost; + if (ExternalMods.overhaul is null && CalamityServerConfig.Instance.FasterBaseSpeed) + Player.maxRunSpeed *= 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 @@ -2822,39 +3333,39 @@ namespace CalamityMod.CalPlayer if (cirrusDress) Player.moveSpeed -= 0.2f; - if (fabsolVodka) - Player.GetDamage() += 0.08f; + if (cirrusVodka) + Player.GetDamage() += CirrusVodka.DamageBoost; if (vodka) { - Player.GetDamage() += 0.06f; + Player.GetDamage() += Vodka.DamageBoost; Player.GetCritChance() += Vodka.CritBoost; } if (moonshine) { - Player.statDefense += 10; - Player.endurance += 0.03f; + Player.statDefense += Moonshine.DefenseBoost; + Player.endurance += Moonshine.DamageReductionBoost; } if (rum) - Player.moveSpeed += 0.1f; + Player.moveSpeed += Rum.MoveSpeedBoost; if (whiskey) { - Player.GetDamage() += 0.04f; + Player.GetDamage() += Whiskey.DamageBoost; Player.GetCritChance() += Whiskey.CritBoost; } if (everclear) - Player.GetDamage() += 0.25f; + Player.GetDamage() += Everclear.DamageBoost; if (bloodyMary) { if (Main.bloodMoon) { - Player.GetDamage() += 0.1f; - Player.moveSpeed += 0.1f; + Player.GetDamage() += BloodyMary.DamageBoost; + Player.moveSpeed += BloodyMary.MoveSpeedBoost; } } @@ -2862,7 +3373,7 @@ namespace CalamityMod.CalPlayer { if (Main.dayTime) { - Player.statDefense += 5; + Player.statDefense += Tequila.DefenseBoost; Player.GetCritChance() += Tequila.CritBoost; } } @@ -2871,63 +3382,55 @@ namespace CalamityMod.CalPlayer { if (Main.dayTime) { - Player.statDefense += 10; + Player.statDefense += TequilaSunrise.DefenseBoost; Player.GetCritChance() += TequilaSunrise.CritBoost; } } if (caribbeanRum) - Player.moveSpeed += 0.1f; + Player.moveSpeed += CaribbeanRum.MoveSpeedBoost; if (cinnamonRoll) { - Player.manaRegenDelay--; - Player.manaRegenBonus += 10; + Player.manaRegenDelayBonus += CinnamonRoll.ManaRegenDelayBonus; + Player.manaRegenBonus += CinnamonRoll.ManaRegenBonus; } if (starBeamRye) { - Player.GetDamage() += 0.08f; - Player.manaCost *= 0.9f; - Player.statManaMax2 += 50; + Player.GetDamage() += StarBeamRye.MagicDamageBoost; + Player.manaCost *= (1f - StarBeamRye.ManaCostReduction); + Player.statManaMax2 += StarBeamRye.MaxManaBoost; } if (moscowMule) { - Player.GetDamage() += 0.09f; + Player.GetDamage() += MoscowMule.DamageBoost; Player.GetCritChance() += MoscowMule.CritBoost; } - if (oldFashioned) - Player.GetDamage() -= OldFashioned.DamageStatReduction; - if (whiteWine) - Player.GetDamage() += 0.08f; - - // Adjustment to the Tipsy debuff - if (Player.tipsy) - { - Player.statDefense += 4; - Player.GetCritChance() -= 2; - Player.GetAttackSpeed() -= 0.1f; - } + Player.GetDamage() += WhiteWine.MagicDamageBoost; if (giantPearl) { - if (Main.netMode != NetmodeID.MultiplayerClient && !areThereAnyDamnBosses) + if (Main.netMode != NetmodeID.MultiplayerClient) { foreach (NPC npc in Main.ActiveNPCs) { if (npc.friendly || npc.dontTakeDamage) continue; float distance = (npc.Center - Player.Center).Length(); - if (distance < 120f) + if (distance < GiantPearl.AuraRadius) + { npc.AddBuff(ModContent.BuffType(), 20, false); + npc.Calamity().pearlAuraOwner = Player.whoAmI; + } } } } - if (CalamityLists.highTestFishList.Contains(Player.ActiveItem().type)) + if (HighTestFishingPoleList.Includes(Player.ActiveItem().type)) Player.accFishingLine = true; if (planarSpeedBoost != 0) @@ -2955,16 +3458,16 @@ namespace CalamityMod.CalPlayer // Flight time boosts double flightTimeMult = 1D + - (ZoneAstral ? 0.05 : 0D) + (harpyRing ? 0.2 : 0D) + (reaverSpeed ? 0.1 : 0D) + (angelTreads ? 0.1 : 0D) + - (blueCandle ? CirrusBlueCandleBuff.WingTimeBoost : 0D) + - (soaring ? 0.1 : 0D) + + (blueCandle ? WeightlessCandle.WingTimeBoost : 0D) + + (soaring ? SoaringPotion.FlightBoost : 0D) + (prismaticGreaves ? 0.1 : 0D) + (plagueReaper ? 0.05 : 0D) + - (ascendantInsignia ? 0.05 : 0D) + // Added to soaring insignia's flight to get 30% - (Player.empressBrooch ? 0.25 : 0D); + (ascendantInsignia ? 0.17 : 0D) + // Added to soaring insignia's flight to get 50% + (Player.empressBrooch ? 0.33 : 0D) + + externalFlightTimeMultBoost; if (community) { @@ -2980,13 +3483,6 @@ namespace CalamityMod.CalPlayer if (shatteredCommunity) flightTimeMult += 0.2f; - if (profanedCrystalBuffs) - { - bool offenseBuffs = pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Buffs || (Main.dayTime && !Player.wet) || Player.lavaWet; - if (offenseBuffs || pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered) - flightTimeMult += 0.1; - } - // Reaver Tank set nuke flight time if (reaverDefense) flightTimeMult -= 0.3f; @@ -2996,24 +3492,17 @@ namespace CalamityMod.CalPlayer Player.wingTimeMax = (int)(Player.wingTimeMax * flightTimeMult); if (vHex) - { Player.statDefense -= 20; - if (Player.wingTimeMax < 0) - Player.wingTimeMax = 0; - - Player.wingTimeMax = (int)(Player.wingTimeMax * 0.75); - } - if (icarusFolly) { if (Player.wingTimeMax < 0) Player.wingTimeMax = 0; - if (Player.wingTimeMax > 400) - Player.wingTimeMax = 400; + if (Player.wingTimeMax > IcarusFolly.MaxFlightTimeCap) + Player.wingTimeMax = IcarusFolly.MaxFlightTimeCap; - Player.wingTimeMax = (int)(Player.wingTimeMax * 0.66); + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - IcarusFolly.FlightTimeLossPercent)); } if (DoGExtremeGravity) @@ -3021,21 +3510,24 @@ namespace CalamityMod.CalPlayer if (Player.wingTimeMax < 0) Player.wingTimeMax = 0; - if (Player.wingTimeMax > 400) - Player.wingTimeMax = 400; + if (Player.wingTimeMax > Buffs.StatDebuffs.DoGExtremeGravity.MaxFlightTimeCap) + Player.wingTimeMax = Buffs.StatDebuffs.DoGExtremeGravity.MaxFlightTimeCap; - Player.wingTimeMax = (int)(Player.wingTimeMax * 0.75); + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - Buffs.StatDebuffs.DoGExtremeGravity.FlightTimeLossPercent)); } if (bounding) { - Player.jumpSpeedBoost += 0.25f; - Player.jumpHeight += 10; - Player.extraFall += 25; + Player.jumpSpeedBoost += BoundingPotion.JumpSpeedBoost; + Player.jumpHeight += (int)(BoundingPotion.JumpHeightPercentBoost * 15); } if (mushy) - Player.statDefense += 6; + { + Player.statDefense += Mushy.DefenseBoost; + if (fungalSymbiote) + Player.GetDamage() += 0.1f; + } if (omniscience) { @@ -3051,10 +3543,10 @@ namespace CalamityMod.CalPlayer Player.lifeMagnet = true; } - if (wDeath && !purity) + if (wDeath && !laudanum && !purity) Player.GetDamage() -= 0.2f; - if (astralInfection && !(infectedJewel || purity)) + if (astralInfection && !(infectedJewel || hideOfDeus || purity)) Player.GetDamage() -= 0.1f; if (pFlames && !purity) @@ -3070,7 +3562,7 @@ namespace CalamityMod.CalPlayer if (wither && !purity) { - Player.statDefense -= WitherDebuff.DefenseReduction; + Player.statDefense -= RemsRevenge.WitherDefenseReduction; } if (gState) @@ -3087,8 +3579,12 @@ namespace CalamityMod.CalPlayer if ((vaporfied && !purity) || galvanicCorrosion) Player.velocity *= 0.98f; - if (molluskSet) - Player.velocity.X *= 0.985f; + if (molluskHelmet) + Player.velocity.X *= 0.994f; + if (molluskChest) + Player.velocity.X *= 0.994f; + if (molluskLegs) + Player.velocity.X *= 0.994f; if ((warped || caribbeanRum) && !Player.slowFall && !Player.mount.Active) { @@ -3098,14 +3594,14 @@ namespace CalamityMod.CalPlayer if (corrEffigy) { - Player.moveSpeed += 0.1f; - Player.GetCritChance() += 10; + Player.moveSpeed += CorruptionEffigy.MoveSpeedBoost; + Player.GetCritChance() += CorruptionEffigy.CritBoost; } if (crimEffigy) { - Player.GetDamage() += 0.15f; - Player.statDefense += 10; + Player.GetDamage() += CrimsonEffigy.DamageBoost; + Player.statDefense += CrimsonEffigy.DefenseBoost; } // The player's true max life value with Calamity adjustments @@ -3120,14 +3616,6 @@ namespace CalamityMod.CalPlayer if (manaOverloader) Player.GetDamage() += 0.06f; - if (rBrain) - { - if (Player.statLife <= (int)(Player.statLifeMax2 * 0.75)) - Player.GetDamage() += 0.1f; - if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) - Player.moveSpeed -= 0.05f; - } - if (bloodyWormTooth) { Player.GetDamage() += 0.1f; @@ -3140,13 +3628,13 @@ namespace CalamityMod.CalPlayer if (sandsWindBuff) { - Player.GetDamage() += 0.12f; - Player.statDefense += 12; + Player.GetDamage() += PrimordialEarth.BuffDamageBoost; + Player.statDefense += PrimordialEarth.BuffDefenseBoost; } if (aeolianEarthBuff) { - Player.GetDamage() += 0.18f; - Player.endurance += 0.08f; + Player.GetDamage() += PrimordialAncient.BuffDamageBoost; + Player.endurance += PrimordialAncient.BuffDamageReductionBoost; } if (frostFlare) @@ -3204,15 +3692,13 @@ namespace CalamityMod.CalPlayer { float ai1 = I * 120; - // 08DEC2023: Ozzatron: Bloodflare mines spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = Player.ApplyArmorAccDamageBonusesTo(3750); - int damage = Player.CalcIntDamage(baseDamage); + int damage = (int)Player.CalcIntDamage(3750); int projectile = Projectile.NewProjectile(source, Player.Center.X + (float)(Math.Sin(I * 120) * 550), Player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, ModContent.ProjectileType(), damage, 1f, Player.whoAmI, ai1, 0f); if (projectile.WithinBounds(Main.maxProjectiles)) { - Main.projectile[projectile].originalDamage = baseDamage; + Main.projectile[projectile].originalDamage = 3750; Main.projectile[projectile].DamageType = DamageClass.Generic; } } @@ -3228,9 +3714,7 @@ namespace CalamityMod.CalPlayer } if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Silva Crystals spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = Player.ApplyArmorAccDamageBonusesTo(600); - var damage = (int)Player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)Player.GetTotalDamage().ApplyTo(600); 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)) @@ -3275,7 +3759,7 @@ namespace CalamityMod.CalPlayer // If the timer rolls over, it's time to deal damage. Only run this code for the client which is wearing the armor. if (tarraLifeAuraTimer == 0 && Player.whoAmI == Main.myPlayer) { - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.CalcDamage(120)); + int damage = (int)Player.CalcDamage(120); // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list var source = Player.GetSource_FromThis(TarragonHeadSummon.LifeAuraEntitySourceContext); @@ -3287,7 +3771,7 @@ namespace CalamityMod.CalPlayer continue; if (Vector2.Distance(Player.Center, npc.Center) <= range) - Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); + Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); } } } @@ -3314,7 +3798,7 @@ namespace CalamityMod.CalPlayer continue; if (Vector2.Distance(Player.Center, npc.Center) <= range) - Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); + Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); // Occasionally spawn cute sparks so it looks like an electrical aura if (Main.rand.NextBool(10)) @@ -3334,13 +3818,13 @@ namespace CalamityMod.CalPlayer const int FramesPerHit = 30; // Constantly increment the timer every frame. - brimLoreInfernoTimer = (brimLoreInfernoTimer + 1) % FramesPerHit; + hydrothermicInfernoTimer = (hydrothermicInfernoTimer + 1) % FramesPerHit; // Only run this code for the client which is wearing the armor. // Brimstone flames is applied every single frame, but direct damage is only dealt twice per second. if (Player.whoAmI == Main.myPlayer) { - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.GetBestClassDamage().ApplyTo(50)); + int damage = (int)Player.GetBestClassDamage().ApplyTo(50); // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list var source = Player.GetSource_FromThis(HydrothermicArmor.InfernoPotionEntitySourceContext); @@ -3354,8 +3838,8 @@ namespace CalamityMod.CalPlayer if (Vector2.Distance(Player.Center, npc.Center) <= range) { npc.AddBuff(ModContent.BuffType(), 120); - if (brimLoreInfernoTimer == 0) - Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); + if (hydrothermicInfernoTimer == 0) + Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); } } } @@ -3381,7 +3865,7 @@ namespace CalamityMod.CalPlayer Player.GetDamage() *= 1.2f; if (trippy) - Player.GetDamage() += 0.5f; + Player.GetDamage() += OddMushroom.DamageBoost; if (eArtifact) { @@ -3406,7 +3890,6 @@ namespace CalamityMod.CalPlayer int guardianAmt = 1; float babCheck = profanedCrystal ? 1f : 0f; int babDamage = profanedCrystal ? 346 : 52; - babDamage = Player.ApplyArmorAccDamageBonusesTo(babDamage); if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) { @@ -3430,39 +3913,44 @@ namespace CalamityMod.CalPlayer } } - if (profanedCrystalBuffs) + if (profanedCrystal) { - if (Player.whoAmI == Main.myPlayer) + ProfanedSoulCrystal.DetermineTransformationEligibility(Player); + var calPlayer = Player.Calamity(); + bool vanity = calPlayer.pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Vanity; + if (!vanity) { - bool empowered = pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered; + + bool empowered = calPlayer.pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered; + bool night = empowered || calPlayer.pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Enraged; + bool day = empowered || calPlayer.pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Buffs; + Player.lavaImmune = true; Player.fireWalk = true; - Player.buffImmune[ModContent.BuffType()] = Main.dayTime || empowered; - Player.buffImmune[ModContent.BuffType()] = !Main.dayTime || empowered; + Player.buffImmune[ModContent.BuffType()] = true; Player.buffImmune[BuffID.OnFire] = true; Player.buffImmune[BuffID.Burning] = true; Player.buffImmune[BuffID.Daybreak] = true; - bool offenseBuffs = (Main.dayTime && !Player.wet) || Player.lavaWet || empowered; - if (offenseBuffs) + + if (Player.wingTimeMax > 0) + Player.wingTimeMax = (int)(Player.wingTimeMax * 1.1D); + Player.GetDamage() += 0.15f; + if (day) { - Player.GetDamage() += 0.15f; Player.GetKnockback() += 0.15f; Player.moveSpeed += 0.1f; - if (!empowered) - Player.statDefense -= 15; Player.ignoreWater = true; Player.GetAttackSpeed(DamageClass.SummonMeleeSpeed) += 1f; //this only ever affects psc whip and should not be problematic } - else if (empowered || !offenseBuffs) + else if (night) { Player.endurance += 0.05f; Player.statDefense += 15; Player.lifeRegen += 5; } - 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); + if (!calPlayer.ZoneAbyss) //No abyss memes. + Lighting.AddLight(Player.Center, night ? 1.2f : day ? 1f : 0.2f, night ? 0.21f : day ? 0.2f : 0.01f, 0); } } @@ -3505,7 +3993,7 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.CalcDamage(30)); + int damage = (int)Player.CalcDamage(30); if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, 0f, 0f); @@ -3535,11 +4023,24 @@ namespace CalamityMod.CalPlayer if (check) { // 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); + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + int damage = (int)Player.GetBestClassDamage().ApplyTo(12); if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); } + + // Reduce duration of Static Discharge + for (int l = 0; l < Player.MaxBuffs; l++) + { + if (Player.buffType[l] == ModContent.BuffType()) + { + if (Player.buffTime[l] > 2) + { + Player.buffTime[l]--; + break; + } + } + } } } else if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) @@ -3562,7 +4063,6 @@ namespace CalamityMod.CalPlayer { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); int damage = (int)Player.GetBestClassDamage().ApplyTo(70); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); if (Player.whoAmI == Main.myPlayer && Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); @@ -3584,9 +4084,10 @@ namespace CalamityMod.CalPlayer { float shootSpeed = 18f; int dmg = (int)Player.GetTotalDamage().ApplyTo(30); - dmg = Player.ApplyArmorAccDamageBonusesTo(dmg); Vector2 startPos = Player.RotatedRelativePoint(Player.MountedCenter, true); + + // 14NOV2024: Ozzatron: clamped mouse position is inappropriate to apply here due to excessive use of decompiled vanilla shitcode Vector2 velocity = Main.MouseWorld - startPos; if (Player.gravDir == -1f) { @@ -3664,10 +4165,10 @@ 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, 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; + Dust dusty = Dust.NewDustDirect(source + dustVel, 0, 0, DustID.RainbowMk2, dustVel.X * 1f, dustVel.Y * 1f, 100, color, 1f); + dusty.noGravity = true; + dusty.noLight = true; + dusty.velocity = dustVel; } } @@ -3704,24 +4205,26 @@ namespace CalamityMod.CalPlayer { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = Player.buffType[l]; - if (CalamityLists.amalgamBuffList.Contains(hasBuff)) + int buffID = Player.buffType[l]; + if (AmalgamBuffList.Includes(buffID)) { if (amalgam) { // Every other frame, increase the buff timer by one frame. Thus, the buff lasts twice as long. - if (Player.miscCounter % 2 == 0) + // CIT 1NOV2024: Amalgam does not add to the buff time if it's at 2 or lower, + // to prevent buff duration showing when using infinite buff features from other mods. + if (Player.miscCounter % 2 == 0 && Player.buffTime[l] > 2) Player.buffTime[l] += 1; // Buffs will not go away when you die, to prevent wasting potions. - if (!Main.persistentBuff[hasBuff]) - Main.persistentBuff[hasBuff] = true; + if (!Main.persistentBuff[buffID]) + Main.persistentBuff[buffID] = true; } else { // Reset buff persistence if Amalgam is removed. - if (Main.persistentBuff[hasBuff] && !CalamityLists.persistentBuffList.Contains(hasBuff)) - Main.persistentBuff[hasBuff] = false; + if (Main.persistentBuff[buffID] && !PersistentBuffList.Includes(buffID)) + Main.persistentBuff[buffID] = false; } } } @@ -3730,50 +4233,64 @@ namespace CalamityMod.CalPlayer // Laudanum boosts if (laudanum) { + // Laudanum removes immunity to debuffs that it counters, so that you can get inflicted with them + int[] buffsAffected = [ModContent.BuffType(), ModContent.BuffType(), BuffID.VortexDebuff, BuffID.Ichor, BuffID.Bleeding, + BuffID.Chilled, BuffID.BrokenArmor, BuffID.Weak, BuffID.Slow, BuffID.Confused, BuffID.Cursed, BuffID.Silenced, BuffID.Blackout, BuffID.Darkness]; + + for (int i = 0; i < buffsAffected.Length; i++) + Player.buffImmune[buffsAffected[i]] = false; + if (Main.myPlayer == Player.whoAmI) { for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = Player.buffType[l]; - if (hasBuff == ModContent.BuffType() || hasBuff == BuffID.Obstructed || - hasBuff == BuffID.Ichor || hasBuff == BuffID.Chilled || hasBuff == BuffID.BrokenArmor || hasBuff == BuffID.Weak || - hasBuff == BuffID.Slow || hasBuff == BuffID.Confused || hasBuff == BuffID.Blackout || hasBuff == BuffID.Darkness) + if (buffsAffected.Contains(hasBuff)) { // Every other frame, increase the buff timer by one frame. Thus, the buff lasts twice as long. if (Player.miscCounter % 2 == 0) Player.buffTime[l] += 1; } - // See later as Laud cancels out the normal effects + // Calamity buffs cannot be handled inside the switch case + // Their negative effects are canceled out earlier if (hasBuff == ModContent.BuffType()) + Player.statDefense += ArmorCrunch.DefenseReduction; // +15 net defense + else if (hasBuff == ModContent.BuffType()) { - // +15 defense - Player.statDefense += ArmorCrunch.DefenseReduction; + Player.lifeRegenCount += 5; + Player.GetDamage() += 0.2f; } switch (hasBuff) { - case BuffID.Obstructed: - Player.headcovered = false; - Player.statDefense += 50; - Player.GetDamage() += 0.5f; - Player.GetCritChance() += 25; + case BuffID.VortexDebuff: + Player.vortexDebuff = false; + Player.moveSpeed += 0.2f; + Player.jumpSpeedBoost += 1f; + // Also gives acceleration, which is done in PostUpdateRunSpeeds break; case BuffID.Ichor: - Player.statDefense += 40; + Player.statDefense += 40; // +25 net defense + break; + case BuffID.Bleeding: + Player.bleed = false; + Player.lifeRegen += 4; + Player.lifeRegenTime += 4; break; case BuffID.Chilled: Player.chilled = false; - Player.moveSpeed *= 1.3f; + Player.moveSpeed *= 1.25f; break; case BuffID.BrokenArmor: Player.brokenArmor = false; Player.statDefense += (int)(Player.statDefense * 0.25); break; case BuffID.Weak: - Player.GetDamage() += 0.151f; - Player.statDefense += 14; - Player.moveSpeed += 0.3f; + Player.GetDamage() += 0.051f; // Cancel melee damage nerf, add 10% all damage + Player.GetDamage() += 0.1f; + Player.statDefense += 14; // +10 net defense + Player.moveSpeed += 0.25f; // +15% net move speed break; case BuffID.Slow: Player.slow = false; @@ -3781,21 +4298,25 @@ namespace CalamityMod.CalPlayer break; case BuffID.Confused: Player.confused = false; - Player.statDefense += 30; - Player.GetDamage() += 0.25f; - Player.GetCritChance() += 10; + Player.statDefense += 50; + break; + case BuffID.Cursed: + Player.cursed = false; + if (Player.mount.Type != MountID.Drill) // DCU also uses the noItems variable, make sure to not break that + Player.noItems = false; + Player.GetDamage() += 0.1f; + break; + case BuffID.Silenced: + Player.silence = false; + Player.GetDamage() += 0.1f; break; case BuffID.Blackout: Player.blackout = false; - Player.statDefense += 30; - Player.GetDamage() += 0.25f; - Player.GetCritChance() += 10; + Player.GetCritChance() += 15; break; case BuffID.Darkness: Player.blind = false; - Player.statDefense += 15; - Player.GetDamage() += 0.1f; - Player.GetCritChance() += 5; + Player.GetCritChance() += 10; break; } } @@ -3810,8 +4331,7 @@ namespace CalamityMod.CalPlayer int numDust = 2; for (int i = 0; i < numDust; i++) { - int dustIndex = Dust.NewDust(Player.position, Player.width, Player.height, DustID.VilePowder, 0f, 0f); - Dust dust = Main.dust[dustIndex]; + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.VilePowder, 0f, 0f); dust.position.X += Main.rand.Next(-5, 6); dust.position.Y += Main.rand.Next(-5, 6); dust.velocity *= 0.2f; @@ -4105,7 +4625,7 @@ namespace CalamityMod.CalPlayer // Apply defense damage Player.statDefense -= currentDefenseDamage; - + } // Defense can never be reduced below zero, no matter what @@ -4114,40 +4634,40 @@ namespace CalamityMod.CalPlayer // Multiplicative defense reductions. // These are done last because they need to be after the defense lower cap at 0. - if (fabsolVodka) + if (cirrusVodka) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.05); + Player.statDefense -= (int)(Player.statDefense * CirrusVodka.DefenseLossPercent); } if (vodka) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.05); + Player.statDefense -= (int)(Player.statDefense * Vodka.DefenseLossPercent); } if (grapeBeer) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.03); + Player.statDefense -= (int)(Player.statDefense * GrapeBeer.DefenseLossPercent); } if (rum) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.05); + Player.statDefense -= (int)(Player.statDefense * Rum.DefenseLossPercent); } if (whiskey) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.05); + Player.statDefense -= (int)(Player.statDefense * Whiskey.DefenseLossPercent); } if (everclear) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.3); + Player.statDefense -= (int)(Player.statDefense * Everclear.DefenseLossPercent); } if (bloodyMary) @@ -4155,41 +4675,41 @@ namespace CalamityMod.CalPlayer if (Main.bloodMoon) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.04); + Player.statDefense -= (int)(Player.statDefense * BloodyMary.DefenseLossPercent); } } if (caribbeanRum) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.1); + Player.statDefense -= (int)(Player.statDefense * CaribbeanRum.DefenseLossPercent); } if (cinnamonRoll) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.1); + Player.statDefense -= (int)(Player.statDefense * CinnamonRoll.DefenseLossPercent); } if (margarita) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.06); + Player.statDefense -= (int)(Player.statDefense * Margarita.DefenseLossPercent); } if (starBeamRye) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.06); + Player.statDefense -= (int)(Player.statDefense * StarBeamRye.DefenseLossPercent); } if (whiteWine) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.06); + Player.statDefense -= (int)(Player.statDefense * WhiteWine.DefenseLossPercent); } - if (Player.tipsy) + if (Player.HasBuff(BuffID.Tipsy)) { if (Player.statDefense > 0) Player.statDefense -= (int)(Player.statDefense * 0.05); @@ -4243,27 +4763,27 @@ namespace CalamityMod.CalPlayer Player.endurance -= 0.1f; if (corrEffigy) - Player.endurance -= 0.05f; + Player.endurance -= CorruptionEffigy.DamageReductionLoss; } #endregion #region Text Chat Messages private void HandleTextChatMessages() { - if (Player.whoAmI != Main.myPlayer || Main.netMode == NetmodeID.Server) + if (Player.whoAmI != Main.myPlayer || Main.dedServ) return; if (startMessageDisplayDelay >= 0) { if (startMessageDisplayDelay == 0) { - if (CalamityConfig.Instance.WikiStatusMessage) + if (CalamityClientConfig.Instance.WikiStatusMessage) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus1"); CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus2"); } - if (CalamityConfig.Instance.VCMMStatusMessage && !CalamityMod.Instance.VCMMAvailable) + if (CalamityClientConfig.Instance.VCMMStatusMessage && !ExternalMods.VCMMAvailable) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.VCMMStatus"); } @@ -4404,11 +4924,7 @@ namespace CalamityMod.CalPlayer } else { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncAndroombaSolution); - netMessage.Write(npc.whoAmI); - netMessage.Write(soltype); - netMessage.Send(); + SyncAndroombaSolutionPacket.Send(npc.ModNPC(), soltype); } if (npc.ai[0] == 0f) { @@ -4418,14 +4934,10 @@ namespace CalamityMod.CalPlayer } else { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncAndroombaAI); - netMessage.Write(npc.whoAmI); - netMessage.Write(1); - netMessage.Send(); + SyncAndroombaAIPacket.Send(npc.ModNPC(), phase: 1); } } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } } @@ -4469,7 +4981,7 @@ namespace CalamityMod.CalPlayer if (item.type == ModContent.ItemType()) CalamityUtils.ConsumeItemViaQuickBuff(Player, item, HadalStew.BuffType, HadalStew.BuffDuration, true); if (item.type == ModContent.ItemType()) - CalamityUtils.ConsumeItemViaQuickBuff(Player, item, Margarita.BuffType, Margarita.BuffDuration, false); + CalamityUtils.ConsumeItemViaQuickBuff(Player, item, Margarita.BuffType, CalamityUtils.MinutesToFrames(Margarita.MinuteDuration), false); } } } diff --git a/CalPlayer/CalamityPlayerNetcode.cs b/CalPlayer/CalamityPlayerNetcode.cs index 16df37c22c..0981541481 100644 --- a/CalPlayer/CalamityPlayerNetcode.cs +++ b/CalPlayer/CalamityPlayerNetcode.cs @@ -1,6 +1,8 @@ using System.Collections.Generic; using System.IO; +using System.Linq; using CalamityMod.Cooldowns; +using CalamityMod.Packets; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,219 +14,50 @@ namespace CalamityMod.CalPlayer #region Standard Syncs internal const int GlobalSyncPacketTimer = 15; - internal void StandardSync() - { - SyncRage(false); - SyncAdrenaline(false); - SyncDefenseDamage(false); - } - private void EnterWorldSync() { StandardSync(); } + internal void StandardSync() + { + RageSyncPacket.Send(this); + AdrenalineSyncPacket.Send(this); + DefenseDamageSyncPacket.Send(this); + } + internal void MouseControlsSync() { - SyncRightClick(false); - SyncMousePosition(false); + RightClickSyncPacket.Send(this); + MousePositionSyncPacket.Send(this); } #endregion #region Creating and Sending Packets - public void SyncDefenseDamage(bool server) - { - ModPacket packet = Mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.DefenseDamageSync); - packet.Write(Player.whoAmI); - packet.Write(totalDefenseDamage); - packet.Write(defenseDamageRecoveryFrames); - packet.Write(totalDefenseDamageRecoveryFrames); - packet.Write(defenseDamageDelayFrames); - Player.SendPacket(packet, server); - } - - public void SyncRage(bool server) - { - ModPacket packet = Mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.RageSync); - packet.Write(Player.whoAmI); - packet.Write(rage); - packet.Write(rageCombatFrames); - Player.SendPacket(packet, server); - } - - public void SyncAdrenaline(bool server) - { - ModPacket packet = Mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.AdrenalineSync); - packet.Write(Player.whoAmI); - packet.Write(adrenaline); - Player.SendPacket(packet, server); - } - public void SyncCooldownAddition(bool server, CooldownInstance cd) { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.CooldownAddition); - packet.Write(Player.whoAmI); - cd.Write(packet); - Player.SendPacket(packet, server); + + CooldownAdditionPacket.Send(this, cd); } public void SyncCooldownRemoval(bool server, IList cooldownIDs) { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.CooldownRemoval); - packet.Write(Player.whoAmI); - packet.Write(cooldownIDs.Count); - foreach (string id in cooldownIDs) - packet.Write(CooldownRegistry.Get(id).netID); - Player.SendPacket(packet, server); + + CooldownRemovalPacket.Send(this, cooldownIDs.Select(id => CooldownRegistry.Get(id).netID).ToArray()); } public void SyncCooldownDictionary(bool server) { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(1024); - packet.Write((byte)CalamityModMessageType.SyncCooldownDictionary); - packet.Write(Player.whoAmI); - packet.Write(cooldowns.Count); - foreach (CooldownInstance cd in cooldowns.Values) - cd.Write(packet); - Player.SendPacket(packet, server); + + SyncCooldownDictionaryPacket.Send(this); } - public void SyncRightClick(bool server) - { - ModPacket packet = Mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.RightClickSync); - packet.Write(Player.whoAmI); - packet.Write(mouseRight); - Player.SendPacket(packet, server); - } - public void SyncMousePosition(bool server) - { - ModPacket packet = Mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.MousePositionSync); - packet.Write(Player.whoAmI); - packet.WriteVector2(mouseWorld); - Player.SendPacket(packet, server); - } - - #endregion - - #region Reading and Handling Packets - internal void HandleRage(BinaryReader reader) - { - rage = reader.ReadSingle(); - rageCombatFrames = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - SyncRage(true); - } - - internal void HandleAdrenaline(BinaryReader reader) - { - adrenaline = reader.ReadSingle(); - if (Main.netMode == NetmodeID.Server) - SyncAdrenaline(true); - } - - internal void HandleCooldownAddition(BinaryReader reader) - { - // The player ID and message ID are already read. The only remaining data is the serialization of the cooldown instance. - CooldownInstance instance = new CooldownInstance(reader); - - // Actually assign this freshly synced cooldown to the appropriate player. - string id = CooldownRegistry.registry[instance.netID].ID; - cooldowns[id] = instance; - } - - internal void HandleCooldownRemoval(BinaryReader reader) - { - int count = reader.ReadInt32(); - for (int i = 0; i < count; ++i) - { - ushort netID = reader.ReadUInt16(); - cooldowns.Remove(CooldownRegistry.registry[netID].ID); - } - } - - internal void HandleCooldownDictionary(BinaryReader reader) - { - int count = reader.ReadInt32(); - if (count <= 0) - return; - - // Cooldown dictionary packets are just a span of serialized cooldown instances. So each one can be read exactly as with a single cooldown. - Dictionary syncedCooldowns = new Dictionary(count); - for (int i = 0; i < count; ++i) - { - CooldownInstance instance = new CooldownInstance(reader); - syncedCooldowns[instance.netID] = instance; - } - - HashSet localIDs = new HashSet(); - foreach (CooldownInstance localInstance in cooldowns.Values) - localIDs.Add(localInstance.netID); - - HashSet syncedIDs = new HashSet(); - foreach (ushort syncedID in syncedCooldowns.Keys) - syncedIDs.Add(syncedID); - - HashSet combinedIDSet = new HashSet(); - combinedIDSet.UnionWith(localIDs); - combinedIDSet.UnionWith(syncedIDs); - - foreach (ushort netID in combinedIDSet) - { - bool existsLocally = localIDs.Contains(netID); - bool existsRemotely = syncedIDs.Contains(netID); - string id = CooldownRegistry.registry[netID].ID; - - // Exists locally but not remotely = cull -- destroy the local copy. - if (existsLocally && !existsRemotely) - cooldowns.Remove(id); - // Exists remotely but not locally = add -- insert into the dictionary. - else if (existsRemotely && !existsLocally) - cooldowns[id] = syncedCooldowns[netID]; - // Exists in both places = update -- update timing fields but don't replace the instance. - else if (existsLocally && existsRemotely) - { - CooldownInstance localInstance = cooldowns[id]; - localInstance.duration = syncedCooldowns[netID].duration; - localInstance.timeLeft = syncedCooldowns[netID].timeLeft; - } - } - } - - internal void HandleDefenseDamage(BinaryReader reader) - { - totalDefenseDamage = reader.ReadInt32(); - defenseDamageRecoveryFrames = reader.ReadInt32(); - totalDefenseDamageRecoveryFrames = reader.ReadInt32(); - defenseDamageDelayFrames = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - SyncDefenseDamage(true); - } - - internal void HandleRightClick(BinaryReader reader) - { - mouseRight = reader.ReadBoolean(); - if (Main.netMode == NetmodeID.Server) - SyncRightClick(true); - } - internal void HandleMousePosition(BinaryReader reader) - { - mouseWorld = reader.ReadVector2(); - if (Main.netMode == NetmodeID.Server) - SyncMousePosition(true); - } #endregion } } diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 2c192904f9..699a106462 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -7,13 +7,11 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; -using CalamityMod.EntitySources; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Prismatic; using CalamityMod.Items.Armor.Reaver; +using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; @@ -26,12 +24,14 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; -using MonoMod.Cil; +using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using static System.Net.Mime.MediaTypeNames; using static Terraria.ModLoader.ModContent; namespace CalamityMod.CalPlayer @@ -59,9 +59,10 @@ namespace CalamityMod.CalPlayer return; // Handle on-hit melee effects for the gem tech armor set. - GemTechState.MeleeOnHitEffects(target); + if (item.CountsAsClass()) + GemTechState.MeleeOnHitEffects(target); - // Handle on-hit melee effects for the mythril armor set. + // Handle on-hit melee effects for the mythril armor set. (all class inclusive) MythrilArmorSetChange.OnHitEffects(target, damageDone, Player); if (witheringWeaponEnchant) @@ -74,59 +75,23 @@ namespace CalamityMod.CalPlayer target.Calamity().IncreasedColdEffects_FrozenWings = frozenWingsCold; target.Calamity().IncreasedColdEffects_CryoStone = CryoStone; - target.Calamity().IncreasedElectricityEffects_Transformer = transformer; + target.Calamity().IncreasedElectricityEffects_Unused = false; target.Calamity().IncreasedHeatEffects_Fireball = fireball; target.Calamity().IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; - target.Calamity().IncreasedHeatEffects_FlameWakerBoots = flameWakerBoots; - target.Calamity().IncreasedHeatEffects_HellfireTreads = hellfireTreads; + target.Calamity().IncreasedHeatEffects_FireBoots = bootLevel; + target.Calamity().IncreasedHeatEffects_FlameWings = flameWingsHeat; target.Calamity().IncreasedSicknessEffects_ToxicHeart = toxicHeart; + target.Calamity().IncreasedWaterEffects_Amulet1 = sSpiritAmulet; + target.Calamity().IncreasedWaterEffects_Amulet2 = false; + target.Calamity().IncreasedSicknessAndWaterEffects_EvergreenGin = evergreenGin; + target.Calamity().IncreasedSicknessAndWaterEffects_CorrosiveSpine = corrosiveSpine; switch (item.type) { - case ItemID.CobaltSword: - target.Calamity().cobaltNerfTimer = CalamityGlobalNPC.cobaltAndMythrilNerfTime; - break; - - case ItemID.PalladiumSword: - if (Player.moonLeech) - return; - Player.lifeRegenTime += 2; - break; - - case ItemID.MythrilSword: - target.Calamity().mythrilNerfTimer = CalamityGlobalNPC.cobaltAndMythrilNerfTime; - break; - - case ItemID.OrichalcumSword: - if (Player.petalTimer > 0) - Player.petalTimer /= 2; - break; - - case ItemID.AdamantiteSword: - float slowDownMult = 0.5f; - if (CalamityLists.enemyImmunityList.Contains(target.type) || target.boss) - slowDownMult = 0.95f; - target.velocity *= slowDownMult; - break; - - case ItemID.CandyCaneSword: - - if (Player.moonLeech || Player.lifeSteal <= 0f || target.lifeMax <= 5) - return; - - 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: target.AddBuff(BuffType(), 120); break; @@ -172,20 +137,49 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.OnFire3, 120); } + bool targetIsDummy = target.type == NPCID.TargetDummy || target.type == NPCType(); + ItemLifesteal(target, item, damageDone); - ItemOnHit(item, damageDone, target.Center, hit.Crit, target.IsAnEnemy(false, true)); + ItemOnHit(item, damageDone, target.Center, hit.Crit, target.IsAnEnemy(false, true), targetIsDummy); NPCDebuffs(target, item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass()); - // 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); - // Ursa Sergeant slash cooldown is reset on kill if (ursaSergeant && target.life <= 0 && target.realLife == -1) ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); + if (bGlassBand && bGlassbandCooldown == 0) + { + var source = item.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); + Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; + Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); + bGlassbandCooldown = BlackGlassBand.cooldown; + } + if (luxorsGift) + luxorHit = true; + + // Transformer gives +2 blobs on kill, which are stored then given to you one by one (so it can't spawn more than one on a single frame) + if (transformer && Player.Calamity().transformerCooldown == 0 && target.life <= 0 && target.realLife == -1) + { + Player.Calamity().transformerStoredKills += (!Main.zenithWorld ? 2 : 10); + } + + // Arc Flash Ring lightning strike (Remember to change the one for projectile hits if applicable when you change this one!) + // This one has a lot less limits than the projectile one, but that's because vanilla broadsword code is limiting (wow so surprising) + if (arcFlashRing && (Main.rand.Next(0, 100) < 6)) + { + var source = item.GetSource_FromThis(); + int damage = (int)((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)); // 400% damage (uneffected by crits) + Vector2 position = target.Center + new Vector2(0, -750); + + Projectile.NewProjectile(source, position, new Vector2(0, 10), ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI); + } + + // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). + if (targetIsDummy) + return; + + if (rageModeActive && shatteredCommunity) + Player.GetModPlayer().AccumulateRageDamage(damageDone); } #endregion @@ -202,11 +196,11 @@ namespace CalamityMod.CalPlayer GemTechState.MeleeOnHitEffects(target); // Handle on-hit ranged effects for the gem tech armor set. - if (proj.CountsAsClass() && proj.type != ModContent.ProjectileType()) + if (proj.CountsAsClass() && proj.type != ProjectileType()) GemTechState.RangedOnHitEffects(target, proj.damage); // Handle on-hit projectiles effects for the mythril armor set. - if (proj.type != ModContent.ProjectileType()) + if (proj.type != ProjectileType()) MythrilArmorSetChange.OnHitEffects(target, damageDone, Player); if (witheringWeaponEnchant) @@ -216,58 +210,23 @@ namespace CalamityMod.CalPlayer cgn.IncreasedColdEffects_FrozenWings = frozenWingsCold; cgn.IncreasedColdEffects_CryoStone = CryoStone; - cgn.IncreasedElectricityEffects_Transformer = transformer; + cgn.IncreasedElectricityEffects_Unused = false; cgn.IncreasedHeatEffects_Fireball = fireball; cgn.IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; - cgn.IncreasedHeatEffects_HellfireTreads = hellfireTreads; + cgn.IncreasedHeatEffects_FireBoots = bootLevel; + cgn.IncreasedHeatEffects_FlameWings = flameWingsHeat; cgn.IncreasedSicknessEffects_ToxicHeart = toxicHeart; + cgn.IncreasedWaterEffects_Amulet1 = sSpiritAmulet; + cgn.IncreasedWaterEffects_Amulet2 = false; + cgn.IncreasedSicknessAndWaterEffects_EvergreenGin = evergreenGin; + cgn.IncreasedSicknessAndWaterEffects_CorrosiveSpine = corrosiveSpine; switch (proj.type) { - case ProjectileID.CobaltNaginata: - target.Calamity().cobaltNerfTimer = CalamityGlobalNPC.cobaltAndMythrilNerfTime; - break; - - case ProjectileID.PalladiumPike: - if (Player.moonLeech) - return; - Player.lifeRegenTime += 2; - break; - - case ProjectileID.MythrilHalberd: - target.Calamity().mythrilNerfTimer = CalamityGlobalNPC.cobaltAndMythrilNerfTime; - break; - - case ProjectileID.OrichalcumHalberd: - if (Player.petalTimer > 0) - Player.petalTimer /= 2; - break; - - case ProjectileID.AdamantiteGlaive: - float slowDownMult = 0.5f; - if (CalamityLists.enemyImmunityList.Contains(target.type) || target.boss) - slowDownMult = 0.95f; - target.velocity *= slowDownMult; - break; - - case ProjectileID.FruitcakeChakram: - - if (Player.moonLeech || Main.player[Main.myPlayer].lifeSteal <= 0f || target.lifeMax <= 5) - return; - - 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: target.AddBuff(BuffID.OnFire3, 180); break; @@ -292,7 +251,17 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 60); break; + case ProjectileID.ButchersChainsaw: + case ProjectileID.MechanicalPiranha: + target.AddBuff(BuffType(), 180); + break; + + case ProjectileID.LunarFlare: + target.AddBuff(BuffType(), 180); + break; + case ProjectileID.Cascade: + case ProjectileID.FlamingMace: target.AddBuff(BuffID.OnFire, 60); break; @@ -346,20 +315,70 @@ namespace CalamityMod.CalPlayer // Ursa Sergeant slash cooldown is reset on kill if (ursaSergeant && target.life <= 0 && target.realLife == -1) - ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); + ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - UrsaSergeant.CooldownReducedPerKill, 0, UrsaSergeant.MaxCooldown); + if (bGlassBand && bGlassbandCooldown == 0) + { + var source = proj.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); + Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; + Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); + bGlassbandCooldown = BlackGlassBand.cooldown; + } + if (luxorsGift && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType()) + luxorHit = true; + + // Transformer gives +2 blobs on kill, which are stored then given to you one by one (so it can't spawn more than one on a single frame) + if (transformer && Player.Calamity().transformerCooldown == 0 && target.life <= 0 && target.realLife == -1) + { + Player.Calamity().transformerStoredKills += (!Main.zenithWorld ? 2 : 10); + } + + CalamityGlobalProjectile globalProj = proj.Calamity(); + // Arc Flash Ring lightning strike (Remember to change the one for item hits if applicable when you change this one!) + // Minions ignore the chance penalty on penetration + bool spawnChance = (Main.rand.Next(0, 100) < MathHelper.Clamp(6 - proj.numHits, (proj.minion ? 6 : 1), 6)); + if (arcFlashRing && spawnChance && proj.type != ProjectileType() && globalProj.spawnArcFlash) + { + proj.active = true; // Okay so if a projectile manually kills itself on hit, it totally breaks the bolts. to prevent this we set them to active + + var source = proj.GetSource_FromThis(); + int damage = (int)((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)); // 400% damage (uneffected by crits) + Vector2 position = target.Center + new Vector2(0, -750); + + Projectile bolt = Projectile.NewProjectileDirect(source, position, new Vector2(0, 10), ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI); + bolt.DamageType = hit.DamageType; + + globalProj.spawnArcFlash = false; + // This is really only used for long lasting projectiles and contact damage minions + globalProj.arcFlashCooldown = 90; + } if (!proj.npcProj && !proj.trap && proj.friendly) { - if ((plaguebringerCarapace || uberBees) && CalamityLists.friendlyBeeList.Contains(proj.type)) + if (plaguebringerCarapace && FriendlyBeesList.Includes(proj.type)) target.AddBuff(BuffType(), 300); // All projectiles fired from Soma Prime are marked using CalamityGlobalProjectile CalamityGlobalProjectile cgp = proj.Calamity(); if (cgp.appliesSomaShred) { - target.AddBuff(BuffType(), 320); - // This information cannot be transferred through the buff, but is necessary to calculate damage - cgn.somaShredApplicator = Player.whoAmI; + // 08MAR2025: Ozzatron: Obsessive Warframe accuracy. + // Typical endgame Soma Prime builds have a 5% chance to apply debuff, then 30% extra chance if it's a crit, rolled separately. + bool actuallyApplyShred = false; + if (Main.rand.NextFloat() < 0.05f) + actuallyApplyShred = true; + if (hit.Crit && Main.rand.NextFloat() < 0.3f) + actuallyApplyShred = true; + + if (actuallyApplyShred) + { + target.AddBuff(BuffType(), 320); + // This information cannot be transferred through the buff, but is necessary to calculate damage + cgn.somaShredApplicator = Player.whoAmI; + + // 08MAR2025: Ozzatron: God Slayer Slugs can no longer apply Shred multiple times. + cgp.appliesSomaShred = false; + } } // Similarly, all shots from Animosity are also marked @@ -427,8 +446,8 @@ namespace CalamityMod.CalPlayer } int onHitDamage = Player.CalcIntDamage(0.2f * proj.damage); - Player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); - + Projectile shock = Projectile.NewProjectileDirect(proj.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, Player.whoAmI, target.whoAmI); + shock.DamageType = proj.DamageType; SoundStyle hitSound = new("CalamityMod/Sounds/Item/ElectricHit"); SoundEngine.PlaySound(hitSound with { Volume = 0.2f, Pitch = 0.7f, PitchVariance = 0.2f }, proj.Center); } @@ -476,7 +495,8 @@ namespace CalamityMod.CalPlayer } int onHitDamage = Player.CalcIntDamage(0.2f * proj.damage); - Player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); + Projectile blast = Projectile.NewProjectileDirect(proj.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, Player.whoAmI, target.whoAmI); + blast.DamageType = proj.DamageType; SoundStyle hitSound = new("CalamityMod/Sounds/Item/HadalUrnClose"); SoundEngine.PlaySound(hitSound with { Volume = 0.4f, Pitch = 0.4f, PitchVariance = 0.2f }, proj.Center); @@ -494,10 +514,10 @@ namespace CalamityMod.CalPlayer } int heal = (int)Math.Round(hit.Damage * 0.035); - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ProjectileType(), BalancingConstants.LifeStealRange); } if ((cgp.betterLifeBullet1 || cgp.betterLifeBullet2) && proj.numHits == 0) @@ -514,21 +534,23 @@ namespace CalamityMod.CalPlayer } int heal = (int)Math.Round(hit.Damage * 0.01); - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.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); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ProjectileType(), BalancingConstants.LifeStealRange); } } + bool targetIsDummy = target.type == NPCID.TargetDummy || target.type == NPCType(); + ProjLifesteal(target, proj, damageDone, hit.Crit); - ProjOnHit(proj, target.Center, hit.Crit, target.IsAnEnemy(false)); + ProjOnHit(proj, target.Center, hit.Crit, target.IsAnEnemy(false), targetIsDummy); NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), true, proj.noEnchantments); // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). - if (target.type == NPCID.TargetDummy || target.type == NPCType()) + if (targetIsDummy) return; if (rageModeActive && shatteredCommunity) @@ -538,7 +560,7 @@ namespace CalamityMod.CalPlayer #endregion #region Item - public void ItemOnHit(Item item, int damage, Vector2 position, bool crit, bool npcCheck) + public void ItemOnHit(Item item, int damage, Vector2 position, bool crit, bool npcCheck, bool targetIsDummy) { var source = Player.GetSource_ItemUse(item); if (!item.CountsAsClass() && Player.meleeEnchant == 7) @@ -553,7 +575,6 @@ namespace CalamityMod.CalPlayer { hideOfDeusTimer = 10; int bulwarkStarDamage = (int)Player.GetTotalDamage().ApplyTo(320); - bulwarkStarDamage = Player.ApplyArmorAccDamageBonusesTo(bulwarkStarDamage); for (int n = 0; n < 3; n++) CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), bulwarkStarDamage, 5f, Player.whoAmI); @@ -572,7 +593,6 @@ namespace CalamityMod.CalPlayer }); int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120); - astralStarDamage = Player.ApplyArmorAccDamageBonusesTo(astralStarDamage); Projectile star = CalamityUtils.ProjectileRain(source, position, 400f, 100f, 500f, 800f, 12f, projectileType, astralStarDamage, 5f, Player.whoAmI); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) @@ -589,24 +609,10 @@ namespace CalamityMod.CalPlayer { // Ataxia True Melee Geysers: 15%, softcap starts at 300 base damage int geyserDamage = CalamityUtils.DamageSoftCap(damage * 0.15, 45); - geyserDamage = Player.ApplyArmorAccDamageBonusesTo(geyserDamage); Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), geyserDamage, 2f, Player.whoAmI, 0f, 0f); } - if (soaring) - { - double useTimeMultiplier = 0.85 + (item.useTime * item.useAnimation / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost - double wingTimeFraction = Player.wingTimeMax / 20D; - // TODO -- this scaling function is probably totally screwed. What is it supposed to do? - double meleeStatMultiplier = (double)(Player.GetTotalDamage().Additive * (float)(Player.GetTotalCritChance() / 10f)); - - if (Player.wingTime < Player.wingTimeMax) - Player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); - - if (Player.wingTime > Player.wingTimeMax) - Player.wingTime = Player.wingTimeMax; - } if (bloodflareMelee && item.CountsAsClass() && bloodflareMeleeHits < 15 && !bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) bloodflareMeleeHits++; } @@ -615,7 +621,7 @@ namespace CalamityMod.CalPlayer #endregion #region Proj On Hit - public void ProjOnHit(Projectile proj, Vector2 position, bool crit, bool npcCheck) + public void ProjOnHit(Projectile proj, Vector2 position, bool crit, bool npcCheck, bool targetIsDummy) { CalamityGlobalProjectile modProj = proj.Calamity(); var source = proj.GetSource_FromThis(); @@ -625,13 +631,12 @@ namespace CalamityMod.CalPlayer if (!proj.CountsAsClass() && !proj.CountsAsClass() && Player.meleeEnchant == 7) Projectile.NewProjectile(source, position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner); - if (alchFlask && AlchFlaskCooldown == 0 && proj.type != ModContent.ProjectileType()) + if (alchFlask && AlchFlaskCooldown == 0 && proj.type != ProjectileType()) { int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(10); - seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); Vector2 seekerVelocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f); - Projectile bee = Projectile.NewProjectileDirect(source, position, seekerVelocity, ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + Projectile bee = Projectile.NewProjectileDirect(source, position, seekerVelocity, ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); bee.ArmorPenetration = 20; bee.penetrate = 2; bee.extraUpdates = 1; @@ -661,7 +666,6 @@ namespace CalamityMod.CalPlayer }); int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120); - astralStarDamage = Player.ApplyArmorAccDamageBonusesTo(astralStarDamage); Projectile star = CalamityUtils.ProjectileRain(source, position, 400f, 100f, 500f, 800f, 25f, projectileType, astralStarDamage, 5f, Player.whoAmI); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) @@ -670,25 +674,31 @@ namespace CalamityMod.CalPlayer } } - if (abaddon && crit && AbaddonCooldown <= 0) + if (abaddon && crit && AbaddonCooldown <= 0 && !voidOfExtinction) { AbaddonCooldown = 15; - int AbaddonExploDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.03f, 25); - Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), AbaddonExploDamage, 0f, Player.whoAmI); + int AbaddonExploDamage = (int)Player.GetBestClassDamage().ApplyTo(Abaddon.AbaddonExploDamage); + Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), AbaddonExploDamage, 0f, Player.whoAmI); + } + + if (voidOfExtinction && crit && VoidCooldown <= 0) + { + VoidCooldown = 15; + int VoidExploDamage = (int)Player.GetBestClassDamage().ApplyTo(VoidofExtinction.VoidExploDamage); + Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), VoidExploDamage, 0f, Player.whoAmI); } if (ursaSergeant && ursaSergeantCooldown <= 0) { - ursaSergeantCooldown = 300; + ursaSergeantCooldown = UrsaSergeant.MaxCooldown; - int ursaSlashdamage = (int)Player.GetBestClassDamage().ApplyTo(333); - ursaSlashdamage = Player.ApplyArmorAccDamageBonusesTo(ursaSlashdamage); + int ursaSlashdamage = (int)Player.GetBestClassDamage().ApplyTo(UrsaSergeant.BaseSwipeDamage); - Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), ursaSlashdamage, 0f, Player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), ursaSlashdamage, 0f, Player.whoAmI); } if (proj.CountsAsClass()) - MeleeOnHit(proj, modProj, position, crit, npcCheck); + MeleeOnHit(proj, modProj, position, crit, npcCheck, targetIsDummy); if (proj.CountsAsClass()) RangedOnHit(proj, modProj, position, crit, npcCheck); if (proj.CountsAsClass()) @@ -700,32 +710,17 @@ namespace CalamityMod.CalPlayer } #region Melee - private void MeleeOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + private void MeleeOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck, bool targetIsDummy) { var source = proj.GetSource_FromThis(); Item heldItem = Player.ActiveItem(); if (proj.IsTrueMelee()) { - if (soaring) - { - double useTimeMultiplier = 0.85 + (heldItem.useTime * heldItem.useAnimation / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost - double wingTimeFraction = Player.wingTimeMax / 20D; - - // TODO -- this scaling function is probably totally screwed. What is it supposed to do? - double meleeStatMultiplier = (double)(Player.GetTotalDamage().Additive * (float)(Player.GetTotalCritChance() / 10f)); - - if (Player.wingTime < Player.wingTimeMax) - Player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); - - if (Player.wingTime > Player.wingTimeMax) - Player.wingTime = Player.wingTimeMax; - } if (hideOfDeus && hideOfDeusTimer == 0) { hideOfDeusTimer = 10; int bulwarkStarDamage = (int)Player.GetTotalDamage().ApplyTo(320); - bulwarkStarDamage = Player.ApplyArmorAccDamageBonusesTo(bulwarkStarDamage); for (int n = 0; n < 3; n++) CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), bulwarkStarDamage, 5f, Player.whoAmI); @@ -738,7 +733,6 @@ namespace CalamityMod.CalPlayer { // Ataxia Melee Geysers: 15%, softcap starts at 240 base damage int geyserDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.15, 36); - geyserDamage = Player.ApplyArmorAccDamageBonusesTo(geyserDamage); Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), geyserDamage, 0f, Player.whoAmI, 0f, 0f); } @@ -761,7 +755,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < 2; l++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int leafDamage = Player.ApplyArmorAccDamageBonusesTo(0.25f * proj.damage); + int leafDamage = (int)(0.25f * proj.damage); int leaf = Projectile.NewProjectile(source, position, velocity, ProjectileID.Leaf, leafDamage, 0f, Player.whoAmI); if (leaf.WithinBounds(Main.maxProjectiles)) { @@ -774,12 +768,20 @@ namespace CalamityMod.CalPlayer for (int projCount = 0; projCount < 2; projCount++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int energyDamage = Player.ApplyArmorAccDamageBonusesTo(0.33f * proj.damage); + int energyDamage = (int)(0.33f * proj.damage); Projectile.NewProjectile(source, proj.Center, velocity, ProjectileType(), energyDamage, 0f, proj.owner); } } } } + if (dynamoStemCells && MiniSwamerCooldown <= 0 && proj.CountsAsClass()) + { + MiniSwamerCooldown = DynamoStemCells.MiniSwamerCooldown; + + Vector2 velocity = proj.velocity.SafeNormalize(Vector2.UnitY) * 19; + int MiniSwamerDamage = (int)Player.GetTotalDamage().ApplyTo(DynamoStemCells.MiniSwamerDamage); + Projectile.NewProjectile(source, Player.Center, velocity, ProjectileType(), MiniSwamerDamage, 2f, proj.owner); + } } #endregion @@ -789,7 +791,7 @@ namespace CalamityMod.CalPlayer var source = proj.GetSource_FromThis(); if (ataxiaMage && ataxiaDmg <= 0) { - int orbDamage = Player.ApplyArmorAccDamageBonusesTo(proj.damage * 0.6f); + int orbDamage = (int)(proj.damage * 0.6f); CalamityUtils.SpawnOrb(proj, orbDamage, ProjectileType(), 800f, 20f); int cooldown = (int)(orbDamage * 0.5); @@ -805,9 +807,9 @@ namespace CalamityMod.CalPlayer { bloodflareMageCooldown = 120; // Bloodflare Mage Explosion: 50%, softcap starts at 500 base damage to not overly punish slow weapons - int bloodflareFireballDamage = Player.ApplyArmorAccDamageBonusesTo(CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250)); + int bloodflareFireballDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250); - int fire = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), bloodflareFireballDamage, 0f, Player.whoAmI, 0f, 0f, 1f); + int fire = Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), bloodflareFireballDamage, 0f, Player.whoAmI, 0f, 0f, 1f); if (fire.WithinBounds(Main.maxProjectiles)) { Main.projectile[fire].DamageType = DamageClass.Generic; @@ -820,7 +822,7 @@ namespace CalamityMod.CalPlayer silvaMageCooldown = 300; 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)); + int silvaBurstDamage = CalamityUtils.DamageSoftCap(800.0 + 0.6 * proj.damage, 1400); Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), silvaBurstDamage, 8f, Player.whoAmI); } } @@ -860,7 +862,6 @@ namespace CalamityMod.CalPlayer if (Player.ownedProjectileCounts[ProjectileType()] < 3 && Main.rand.NextBool(10)) { int damage = (int)Player.GetTotalDamage().ApplyTo(100); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); Projectile.NewProjectile(source, proj.position, proj.velocity, ProjectileType(), damage, 1f, Player.whoAmI); } } @@ -917,28 +918,24 @@ namespace CalamityMod.CalPlayer if (nucleogenesis) { int apparatusDamage = (int)Player.GetTotalDamage().ApplyTo(60); - apparatusDamage = Player.ApplyArmorAccDamageBonusesTo(apparatusDamage); Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), apparatusDamage, 4f, proj.owner); summonProjCooldown = 100f; } else if (starbusterCore) { int starburstDamage = (int)Player.GetTotalDamage().ApplyTo(40); - starburstDamage = Player.ApplyArmorAccDamageBonusesTo(starburstDamage); Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), starburstDamage, 3.5f, proj.owner); summonProjCooldown = 60f; } else if (nuclearFuelRod) { int nuclearDamage = (int)Player.GetTotalDamage().ApplyTo(20); - nuclearDamage = Player.ApplyArmorAccDamageBonusesTo(nuclearDamage); Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), nuclearDamage, 0f, proj.owner); summonProjCooldown = 60f; } else if (jellyChargedBattery) { int batteryDamage = (int)Player.GetTotalDamage().ApplyTo(15); - batteryDamage = Player.ApplyArmorAccDamageBonusesTo(batteryDamage); CalamityUtils.SpawnOrb(proj, batteryDamage, ProjectileType(), 800f, 15f); summonProjCooldown = 60f; } @@ -952,7 +949,6 @@ namespace CalamityMod.CalPlayer Vector2 spawnPosition = position - new Vector2(0f, 920f).RotatedByRandom(0.3f); float speed = Main.rand.NextFloat(17f, 23f); int hallowedDamage = (int)Player.GetTotalDamage().ApplyTo(50); - hallowedDamage = Player.ApplyArmorAccDamageBonusesTo(hallowedDamage); Projectile.NewProjectile(source, spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), hallowedDamage, 3f, proj.owner); } } @@ -968,7 +964,6 @@ namespace CalamityMod.CalPlayer 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); int projectileIndex = Projectile.NewProjectile(spawnSource, proj.Center.X, proj.Center.Y, 0f, 0f, ProjectileType(), damage, 15f, Main.myPlayer, 10f, 9f); //First overload seems to deal with timing, second is segment amount if (projectileIndex.WithinBounds(Main.maxProjectiles)) Main.projectile[projectileIndex].netUpdate = true; @@ -983,33 +978,33 @@ namespace CalamityMod.CalPlayer { case 0: // Exodus Rogue Stars: 80% - int starDamage = Player.ApplyArmorAccDamageBonusesTo(proj.damage * 0.8f); + int starDamage = (int)(proj.damage * 0.8f); CalamityUtils.SpawnOrb(proj, starDamage, ProjectileType(), 800f, Main.rand.Next(15, 30)); xerocDmg += (int)(starDamage * 0.5f); break; case 1: // Exodus Rogue Orbs: 60% - int orbDamage = Player.ApplyArmorAccDamageBonusesTo(proj.damage * 0.6f); + int orbDamage = (int)(proj.damage * 0.6f); CalamityUtils.SpawnOrb(proj, orbDamage, ProjectileType(), 800f, 30f); xerocDmg += (int)(orbDamage * 0.5f); break; case 2: // Exodus Rogue Fire: 15% - int fireDamage = Player.ApplyArmorAccDamageBonusesTo(proj.damage * 0.15f); + int fireDamage = (int)(proj.damage * 0.15f); Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), fireDamage, 0f, proj.owner, 0f, 0f); break; case 3: // Exodus Rogue Blast: 20% - int blastDamage = Player.ApplyArmorAccDamageBonusesTo(proj.damage * 0.2f); + int blastDamage = (int)(proj.damage * 0.2f); Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), blastDamage, 0f, proj.owner, 0f, 0f); break; case 4: // Exodus Rogue Bubble: 60% - int bubbleDamage = Player.ApplyArmorAccDamageBonusesTo(proj.damage * 0.6f); + int bubbleDamage = (int)(proj.damage * 0.6f); CalamityUtils.SpawnOrb(proj, bubbleDamage, ProjectileType(), 800f, 15f); xerocDmg += (int)(bubbleDamage * 0.5); break; @@ -1028,15 +1023,13 @@ namespace CalamityMod.CalPlayer { Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (position - source) / 40f; - int damage = (int)Player.GetTotalDamage().ApplyTo(120); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); + int damage = (int)Player.GetTotalDamage().ApplyTo(95); Projectile.NewProjectile(spawnSource, source, velocity, ProjectileType(), damage, 3f, proj.owner); } } else if (moonCrown) { int lunarFlareDamage = (int)Player.GetTotalDamage().ApplyTo(MoonstoneCrown.BaseDamage); - lunarFlareDamage = Player.ApplyArmorAccDamageBonusesTo(lunarFlareDamage); float lunarFlareKB = 3f; for (int i = 0; i < 3; i++) @@ -1058,7 +1051,6 @@ namespace CalamityMod.CalPlayer Vector2 velocity = new Vector2(speedX, speedY); int featherDamage = (int)Player.GetTotalDamage().ApplyTo(25); - featherDamage = Player.ApplyArmorAccDamageBonusesTo(featherDamage); int feather = Projectile.NewProjectile(spawnSource, source, velocity, ProjectileType(), featherDamage, 3f, proj.owner); if (feather.WithinBounds(Main.maxProjectiles)) @@ -1081,7 +1073,6 @@ namespace CalamityMod.CalPlayer xVector *= 10f; yVector *= 10f; int damage = (int)Player.GetTotalDamage().ApplyTo(40); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); int eater = Projectile.NewProjectile(spawnSource, proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), damage, proj.knockBack, proj.owner); if (eater.WithinBounds(Main.maxProjectiles)) @@ -1093,68 +1084,21 @@ namespace CalamityMod.CalPlayer if (titanHeartSet && modProj.stealthStrike && titanCooldown <= 0 && modProj.stealthStrikeHitCount < 3) { int damage = (int)Player.GetTotalDamage().ApplyTo(40); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), damage, proj.knockBack, proj.owner, 1f, 0f); SoundEngine.PlaySound(SoundID.Item14, proj.Center); - for (int dustexplode = 0; dustexplode < 360; dustexplode++) + for (int dustexplode = 0; dustexplode < 180; dustexplode++) { - Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); - int d = Dust.NewDust(proj.Center, proj.width, proj.height, Main.rand.NextBool() ? DustType() : DustType(), dustd.X, dustd.Y, 100, default, 1f); - Main.dust[d].noGravity = true; - Main.dust[d].position = proj.Center; - Main.dust[d].velocity *= 0.1f; + Vector2 dustd = Vector2.One.RotatedBy(MathHelper.ToRadians(dustexplode * 2)) * 1.7f; + Dust dust = Dust.NewDustPerfect(proj.Center, Main.rand.NextBool() ? DustType() : DustType(), dustd, Alpha: 100); + dust.noGravity = true; } titanCooldown = 15; } - if (corrosiveSpine && modProj.stealthStrikeHitCount < 3 && (Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()]) < 3) - { - for (int i = 0; i < 3; i++) - { - if (Main.rand.NextBool()) - { - int type = -1; - switch (Main.rand.Next(15)) - { - case 0: - type = ProjectileType(); - break; - case 1: - type = ProjectileType(); - break; - case 2: - type = ProjectileType(); - break; - } - - if (type != -1) - { - int damage = (int)Player.GetTotalDamage().ApplyTo(22); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); - - float speed = Main.rand.NextFloat(5f, 11f); - int cloud = Projectile.NewProjectile(spawnSource, position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, damage, proj.knockBack, Player.whoAmI); - if (cloud.WithinBounds(Main.maxProjectiles)) - Main.projectile[cloud].DamageType = DamageClass.Generic; - } - } - } - } - - if (shadow && shadowPotCooldown <= 0 && modProj.stealthStrikeHitCount < 3) - { - int randrot = Main.rand.Next(-30, 391); - Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); - int soul = Projectile.NewProjectile(spawnSource, proj.Center, SoulSpeed, ProjectileType(), (int)(proj.damage * 0.1), 3f, proj.owner, 0f, 0f); - if (soul.WithinBounds(Main.maxProjectiles)) - Main.projectile[soul].DamageType = DamageClass.Generic; - shadowPotCooldown = 30; - } - if (raiderTalisman && modProj.stealthStrike) { - raiderCritBonus = RaidersTalisman.RaiderBonus; + raiderCritLifespan = CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); if (raiderSoundCooldown <= 0) { SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, Player.Center); @@ -1169,7 +1113,6 @@ namespace CalamityMod.CalPlayer { // Umbraphile Rogue Blasts: 20%, softcap starts at 50 base damage int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.20, 50); - umbraBlastDamage = Player.ApplyArmorAccDamageBonusesTo(umbraBlastDamage); Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), umbraBlastDamage, 0f, Player.whoAmI); } @@ -1179,7 +1122,6 @@ namespace CalamityMod.CalPlayer { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); int damage = (int)Player.GetTotalDamage().ApplyTo(9); - damage = Player.ApplyArmorAccDamageBonusesTo(damage); int spark = Projectile.NewProjectile(spawnSource, position, velocity, ProjectileType(), damage, 0f, Player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) @@ -1202,7 +1144,7 @@ namespace CalamityMod.CalPlayer { if (eGauntlet) { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); } if (ataxiaFire) { @@ -1254,23 +1196,15 @@ namespace CalamityMod.CalPlayer { target.AddBuff(BuffType(), 120); } - if (corrosiveSpine) - { - target.AddBuff(BuffID.Poisoned, 240); - } } if (summon) { if (pSoulArtifact && !profanedCrystal) target.AddBuff(BuffType(), 300); - if (profanedCrystalBuffs) + if (profanedCrystal && (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) { - bool empowered = pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered; - if (empowered || Main.dayTime) - target.AddBuff(BuffType(), 600); - if (empowered || !Main.dayTime) - target.AddBuff(BuffType(), 600); + target.AddBuff(BuffType(), 600); } if (divineBless) @@ -1285,7 +1219,7 @@ namespace CalamityMod.CalPlayer //20% chance for Voltaic Jelly if (Main.rand.NextBool(starTaintedGenerator ? 1 : 5)) { - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffType(), 60); } } @@ -1300,17 +1234,22 @@ namespace CalamityMod.CalPlayer if (frostFlare) CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn2); if (omegaBlueChestplate) - target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 180); if (sulphurSet) target.AddBuff(BuffID.Poisoned, 60); - if (abyssalAmulet) + if (ilSpark && Player.IsUnderwater()) { - CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + int duration = 60; + target.AddBuff(BuffType(), duration); } if (lumenousAmulet) { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); } + if (corrosiveSpine) + { + target.AddBuff(BuffType(), 120); + } if (alchFlask) { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); @@ -1343,11 +1282,16 @@ namespace CalamityMod.CalPlayer if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { + float healPower = 10 * Utils.GetLerpValue(300, 0, gladiatorTimer, true); 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 (healPower >= 1) + { + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); + gladiatorTimer = 300; + } } - if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) + if (Main.LocalPlayer.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()) @@ -1359,7 +1303,7 @@ namespace CalamityMod.CalPlayer cooldownMult = 0f; float cooldown = damage * cooldownMult; - Main.player[Main.myPlayer].lifeSteal -= cooldown; + Main.LocalPlayer.lifeSteal -= cooldown; } if (vampiricTalisman && proj.CountsAsClass() && crit) @@ -1478,12 +1422,12 @@ namespace CalamityMod.CalPlayer if (bloodflareMelee && item.CountsAsClass() && target.lifeMax > 5) { - if (target.IsAnEnemy(false) && Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech) + if (target.IsAnEnemy(false) && Main.LocalPlayer.lifeSteal > 0f && !Player.moonLeech) { int heal = 4; - if (!Main.player[Main.myPlayer].moonLeech) + if (!Main.LocalPlayer.moonLeech) { - Main.player[Main.myPlayer].lifeSteal -= heal * BalancingConstants.LifeStealSetBonusCooldownMultiplier; + Main.LocalPlayer.lifeSteal -= heal * BalancingConstants.LifeStealSetBonusCooldownMultiplier; float lowestHealthCheck = 0f; int healTarget = Player.whoAmI; @@ -1509,22 +1453,27 @@ namespace CalamityMod.CalPlayer if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { + float healPower = 10 * Utils.GetLerpValue(300, 0, gladiatorTimer, true); target.Calamity().gladiatorOnKill = false; - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ModContent.ProjectileType(), 0, 0f); + if (healPower >= 1) + { + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); + gladiatorTimer = 300; + } } if (reaverDefense) { - if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) + if (Main.LocalPlayer.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) + if (heal > 0 && !Main.LocalPlayer.moonLeech) { - Main.player[Main.myPlayer].lifeSteal -= heal * BalancingConstants.LifeStealReaverTankCooldownMultiplier; + Main.LocalPlayer.lifeSteal -= heal * BalancingConstants.LifeStealReaverTankCooldownMultiplier; float lowestHealthCheck = 0f; int healTarget = Player.whoAmI; diff --git a/CalPlayer/Dashes/AsgardianAegisDash.cs b/CalPlayer/Dashes/AsgardianAegisDash.cs index 162f1275bf..e3797e4f2d 100644 --- a/CalPlayer/Dashes/AsgardianAegisDash.cs +++ b/CalPlayer/Dashes/AsgardianAegisDash.cs @@ -77,14 +77,12 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.PlayerImmunityFrames = AsgardianAegis.ShieldSlamIFrames; // Define damage parameters. - int dashDamage = AsgardianAegis.ShieldSlamDamage; hitContext.damageClass = DamageClass.Melee; - hitContext.BaseDamage = player.ApplyArmorAccDamageBonusesTo(dashDamage); + hitContext.BaseDamage = AsgardianAegis.ShieldSlamDamage; hitContext.BaseKnockback = AsgardianAegis.ShieldSlamKnockback; // On-hit Cosmic Dash Explosion int explosionDamage = (int)player.GetBestClassDamage().ApplyTo(AsgardianAegis.RamExplosionDamage); - explosionDamage = player.ApplyArmorAccDamageBonusesTo(explosionDamage); Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, AsgardianAegis.RamExplosionKnockback, Main.myPlayer, 3f, 0f); npc.AddBuff(ModContent.BuffType(), 300); } diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index 499d16ebcb..34262feeae 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -61,9 +61,8 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.PlayerImmunityFrames = AsgardsValor.ShieldSlamIFrames; // Define damage parameters. - int dashDamage = AsgardsValor.ShieldSlamDamage; hitContext.damageClass = DamageClass.Melee; - hitContext.BaseDamage = player.ApplyArmorAccDamageBonusesTo(dashDamage); + hitContext.BaseDamage = AsgardsValor.ShieldSlamDamage; hitContext.BaseKnockback = AsgardsValor.ShieldSlamKnockback; int Dusts = 12; diff --git a/CalPlayer/Dashes/DeepDiverDash.cs b/CalPlayer/Dashes/DeepDiverDash.cs index 6ec6a025e8..d28627ac48 100644 --- a/CalPlayer/Dashes/DeepDiverDash.cs +++ b/CalPlayer/Dashes/DeepDiverDash.cs @@ -100,9 +100,8 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.PlayerImmunityFrames = DeepDiver.ShieldSlamIFrames; // Define damage parameters. - int dashDamage = DeepDiver.ShieldSlamDamage; hitContext.damageClass = DamageClass.Melee; - hitContext.BaseDamage = player.ApplyArmorAccDamageBonusesTo(dashDamage); + hitContext.BaseDamage = DeepDiver.ShieldSlamDamage; hitContext.BaseKnockback = DeepDiver.ShieldSlamKnockback; } } diff --git a/CalPlayer/Dashes/ElysianAegisDash.cs b/CalPlayer/Dashes/ElysianAegisDash.cs index 4b9c9d6509..8ff41a5806 100644 --- a/CalPlayer/Dashes/ElysianAegisDash.cs +++ b/CalPlayer/Dashes/ElysianAegisDash.cs @@ -9,7 +9,6 @@ using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -using static Humanizer.In; namespace CalamityMod.CalPlayer.Dashes { @@ -48,6 +47,11 @@ namespace CalamityMod.CalPlayer.Dashes dust.velocity = -player.velocity * Main.rand.NextFloat(0.6f, 1.4f); dust.scale = Main.rand.NextFloat(0.9f, 1.4f); dust.noGravity = true; + if (d < 1) + { + Particle spark = new CustomSpark(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.25f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.4f, 0.5f)); + GeneralParticleHandler.SpawnParticle(spark); + } } // Dash at a faster speed than the default value. dashSpeed = 14f; @@ -74,14 +78,12 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.PlayerImmunityFrames = ElysianAegis.ShieldSlamIFrames; // Define damage parameters. - int dashDamage = ElysianAegis.ShieldSlamDamage; hitContext.damageClass = DamageClass.Melee; - hitContext.BaseDamage = player.ApplyArmorAccDamageBonusesTo(dashDamage); + hitContext.BaseDamage = ElysianAegis.ShieldSlamDamage; hitContext.BaseKnockback = ElysianAegis.ShieldSlamKnockback; // On-hit Supreme Holy Explosion int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(ElysianAegis.RamExplosionDamage); - supremeExplosionDamage = player.ApplyArmorAccDamageBonusesTo(supremeExplosionDamage); Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), supremeExplosionDamage, ElysianAegis.RamExplosionKnockback, Main.myPlayer, 1f, 0f); npc.AddBuff(ModContent.BuffType(), 300); } diff --git a/CalPlayer/Dashes/GodslayerArmorDash.cs b/CalPlayer/Dashes/GodslayerArmorDash.cs index d06e8a5402..5452bc59ae 100644 --- a/CalPlayer/Dashes/GodslayerArmorDash.cs +++ b/CalPlayer/Dashes/GodslayerArmorDash.cs @@ -32,7 +32,7 @@ namespace CalamityMod.CalPlayer.Dashes public float Size = 2.2f; public bool SoundOnce = true; - public override float CalculateDashSpeed(Player player) => 80f; + public override float CalculateDashSpeed(Player player) => 40f; public override void OnDashEffects(Player player) { @@ -57,11 +57,16 @@ namespace CalamityMod.CalPlayer.Dashes Dashsound.Position = player.Center; Time++; - Size -= 0.04f; + Size -= 0.01f; + + // Constantly update the player's velocity direction. + Vector2 dashVel = Main.MouseWorld - player.Center; + dashVel = dashVel.SafeNormalize(Vector2.UnitX) * CalculateDashSpeed(player); + player.velocity = dashVel; // Fall way, way, faster than usual. player.maxFallSpeed = 50f; - if (Time < 20) + if (Time < 115) { Particle jaws = new Jaws(player.Center + player.velocity * 0.5f, player.velocity, Color.Fuchsia, new Vector2(0.8f, 1f), player.velocity.ToRotation() + MathHelper.PiOver2, Size, Size, 2); GeneralParticleHandler.SpawnParticle(jaws); @@ -70,7 +75,7 @@ namespace CalamityMod.CalPlayer.Dashes } float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(2f, 2.5f, Time, true)); - for (int i = 0; i < 9; i++) + for (int i = 0; i < 3; i++) { float offsetRotationAngle = player.velocity.ToRotation() + Time / 20f; float radius = (30f + (float)Math.Cos(Time / 3f) * 24f) * radiusFactor; @@ -84,21 +89,24 @@ namespace CalamityMod.CalPlayer.Dashes dust2.noGravity = true; } - float sparkscale = Size * 1.3f; - Vector2 SparkVelocity1 = player.velocity.RotatedBy(player.direction * -4, default) * 0.08f - player.velocity / 2f; - SparkParticle spark = new SparkParticle(player.Center + player.velocity.RotatedBy(2f * player.direction) * 1.2f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool(3) ? Color.Aqua : Color.Fuchsia); - GeneralParticleHandler.SpawnParticle(spark); - Vector2 SparkVelocity2 = player.velocity.RotatedBy(player.direction * 4, default) * 0.08f - player.velocity / 2f; - SparkParticle spark2 = new SparkParticle(player.Center + player.velocity.RotatedBy(-2f * player.direction) * 1.2f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool(3) ? Color.Aqua : Color.Fuchsia); - GeneralParticleHandler.SpawnParticle(spark2); + if (Time % 2 == 0) + { + float sparkscale = Size * 1.3f; + Vector2 SparkVelocity1 = player.velocity.RotatedBy(player.direction * -4, default) * 0.08f - player.velocity / 2f; + SparkParticle spark = new SparkParticle(player.Center + player.velocity.RotatedBy(2f * player.direction) * 1.2f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool(3) ? Color.Aqua : Color.Fuchsia); + GeneralParticleHandler.SpawnParticle(spark); + Vector2 SparkVelocity2 = player.velocity.RotatedBy(player.direction * 4, default) * 0.08f - player.velocity / 2f; + SparkParticle spark2 = new SparkParticle(player.Center + player.velocity.RotatedBy(-2f * player.direction) * 1.2f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool(3) ? Color.Aqua : Color.Fuchsia); + GeneralParticleHandler.SpawnParticle(spark2); + } - if (Time > 20 && Time < 100) + if (Time > 115 && Time < 200) { Particle pulse = new DirectionalPulseRing(player.Center - player.velocity * 0.52f, player.velocity / 1.5f, Color.Fuchsia, new Vector2(1f, 2f), player.velocity.ToRotation(), 0.82f, 0.32f, 60); GeneralParticleHandler.SpawnParticle(pulse); Particle pulse2 = new DirectionalPulseRing(player.Center - player.velocity * 0.40f, player.velocity / 1.5f * 0.9f, Color.Aqua, new Vector2(0.8f, 1.5f), player.velocity.ToRotation(), 0.58f, 0.28f, 50); GeneralParticleHandler.SpawnParticle(pulse2); - Time = 111; + Time = 222; } // Dash at a much, much faster speed than the default value. @@ -132,9 +140,8 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.PlayerImmunityFrames = AsgardianAegis.ShieldSlamIFrames; // Define damage parameters. - int dashDamage = 3000; hitContext.damageClass = player.GetBestClass(); - hitContext.BaseDamage = player.ApplyArmorAccDamageBonusesTo(dashDamage); + hitContext.BaseDamage = 3000; hitContext.BaseKnockback = 15f; // God Slayer Dash intentionally does not use the vanilla function for collision attack iframes. diff --git a/CalPlayer/Dashes/OrnateShieldDash.cs b/CalPlayer/Dashes/OrnateShieldDash.cs index 16da12241f..9c94df600a 100644 --- a/CalPlayer/Dashes/OrnateShieldDash.cs +++ b/CalPlayer/Dashes/OrnateShieldDash.cs @@ -51,9 +51,8 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.PlayerImmunityFrames = OrnateShield.ShieldSlamIFrames; // Define damage parameters. - int dashDamage = OrnateShield.ShieldSlamDamage; hitContext.damageClass = DamageClass.Melee; - hitContext.BaseDamage = player.ApplyArmorAccDamageBonusesTo(dashDamage); + hitContext.BaseDamage = OrnateShield.ShieldSlamDamage; hitContext.BaseKnockback = OrnateShield.ShieldSlamKnockback; npc.AddBuff(BuffID.Frostburn2, 180); //Great, Frostbite is ACTUALLY called Frostburn 2 diff --git a/CalPlayer/Dashes/PlaguebringerArmorDash.cs b/CalPlayer/Dashes/PlaguebringerArmorDash.cs index 82d5619337..df2248ff57 100644 --- a/CalPlayer/Dashes/PlaguebringerArmorDash.cs +++ b/CalPlayer/Dashes/PlaguebringerArmorDash.cs @@ -64,9 +64,8 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.PlayerImmunityFrames = AsgardsValor.ShieldSlamIFrames; // Define damage parameters. - int dashDamage = 50; hitContext.damageClass = DamageClass.Summon; - hitContext.BaseDamage = player.ApplyArmorAccDamageBonusesTo(dashDamage); + hitContext.BaseDamage = 50; hitContext.BaseKnockback = 3f; } } diff --git a/CalPlayer/Dashes/PlayerDashManager.cs b/CalPlayer/Dashes/PlayerDashManager.cs index 724292f85f..38fa36d109 100644 --- a/CalPlayer/Dashes/PlayerDashManager.cs +++ b/CalPlayer/Dashes/PlayerDashManager.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; using Terraria; +using Terraria.ModLoader; using Terraria.ModLoader.Core; namespace CalamityMod.CalPlayer.Dashes { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class PlayerDashManager + public sealed class PlayerDashManager : ModSystem { internal static Dictionary DashIdentificationTable = new(); @@ -41,28 +41,20 @@ namespace CalamityMod.CalPlayer.Dashes } - internal static void Load() + public override void OnModLoad() { DashIdentificationTable = new(); - Type baseType = typeof(PlayerDashEffect); - Type[] types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); - foreach (Type type in types) + ReflectionHelper.IterateCalamityTypes(action: type => { - // Ignore any types which are not dash effects or are abstract. - // This eliminates the PlayerDashEffect template type, which cannot have instances. - if (!type.IsSubclassOf(baseType) || type.IsAbstract) - continue; - - // Use reflection to get the static ID manually. This shouldn't be a performance problem, as this only happens at load-time. string id = (string)type.GetProperty("ID").GetValue(null); PlayerDashEffect dashEffect = (PlayerDashEffect)Activator.CreateInstance(type); DashIdentificationTable[id] = dashEffect; - } + }); } - internal static void Unload() + public override void Unload() { DashIdentificationTable = null; } diff --git a/CalPlayer/Dashes/StatisNinjaBeltDash.cs b/CalPlayer/Dashes/StatisNinjaBeltDash.cs new file mode 100644 index 0000000000..a0253e7f77 --- /dev/null +++ b/CalPlayer/Dashes/StatisNinjaBeltDash.cs @@ -0,0 +1,57 @@ +using CalamityMod.Enums; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.CalPlayer.Dashes +{ + public class StatisNinjaBeltDash : PlayerDashEffect + { + public static new string ID => "Statis' Ninja Belt"; + public override DashCollisionType CollisionType => DashCollisionType.NoCollision; + public override bool IsOmnidirectional => false; + public int Time = 0; + + public override float CalculateDashSpeed(Player player) => 20f; + + public override void OnDashEffects(Player player) + { + Time = 0; + for (int i = 0; i < 12; i++) + { + Vector2 smokePos = player.Center + new Vector2(Main.rand.Next(-player.width, player.width), Main.rand.Next(-player.height, player.height)) * 0.8f; + Vector2 smokeVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.25f, 1.75f); + HeavySmokeParticle onDashSmoke = new(smokePos, smokeVel, Color.Gray, 30, 0.5f, 0.75f, 0.2f * Main.rand.NextFloatDirection()); + GeneralParticleHandler.SpawnParticle(onDashSmoke); + } + } + + public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) + { + Time++; + if (Time % 3 == 0) + { + int colorType = Main.rand.Next(3); + Color smokeColor = Color.White; + switch (colorType) + { + case 0: + smokeColor = Color.Gray; + break; + case 1: + smokeColor = new Color(28, 75, 163); + break; + case 2: + smokeColor = new Color(195, 0, 255); + break; + } + + Vector2 smokePos = player.Center - (player.velocity * 1.25f) + Main.rand.NextVector2Circular(10, 20); + float smokeScale = player.velocity.X * 0.045f; + HeavySmokeParticle midDashSmoke = new(smokePos, player.velocity * 0.2f, smokeColor, 20, smokeScale, 0.75f, 0.2f * Main.rand.NextFloatDirection(), true); + GeneralParticleHandler.SpawnParticle(midDashSmoke); + } + } + } +} diff --git a/CalPlayer/Dashes/StatisVoidSashDash.cs b/CalPlayer/Dashes/StatisVoidSashDash.cs index 4a09578ad0..e1931be364 100644 --- a/CalPlayer/Dashes/StatisVoidSashDash.cs +++ b/CalPlayer/Dashes/StatisVoidSashDash.cs @@ -41,7 +41,6 @@ namespace CalamityMod.CalPlayer.Dashes if (Main.myPlayer == player.whoAmI && player.Calamity().statisTimer % 5 == 0) { 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); ; if (scythe.WithinBounds(Main.maxProjectiles)) diff --git a/CalPlayer/DrawLayers/Backpack_PurgeGuzzler.png b/CalPlayer/DrawLayers/Backpack_PurgeGuzzler.png new file mode 100644 index 0000000000..c28e1f7fe7 Binary files /dev/null and b/CalPlayer/DrawLayers/Backpack_PurgeGuzzler.png differ diff --git a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs new file mode 100644 index 0000000000..18ca428d85 --- /dev/null +++ b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs @@ -0,0 +1,106 @@ +using CalamityMod.Items.Accessories.Vanity; +using System; +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; + +namespace CalamityMod.CalPlayer.DrawLayers +{ + public class CombHairSparkleLayer : PlayerDrawLayer + { + public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.LeinforsHairShampoo); + + public override bool IsHeadLayer => true; + + public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + + // Specific hair drawing requirements: Hair must be drawing with 20% lightness, and you're not bald + bool canReceiveHairSparkles = (drawInfo.fullHair || drawInfo.hatHair || drawInfo.drawsBackHairWithoutHeadgear || drawPlayer.head == -1 || drawPlayer.head == 0) && Main.rgbToHsl(drawInfo.colorHead).Z > 0.2f; + bool baldHairStyles = drawPlayer.hair == 15 || drawPlayer.hair == 76; + return drawInfo.shadow == 0f && !drawPlayer.dead && !drawInfo.headOnlyRender && modPlayer.combHair && canReceiveHairSparkles && !baldHairStyles; + } + + protected override void Draw(ref PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + + // 5% chance per frame any of this draws + if (!Main.rand.NextBool(20)) + return; + + // Search through the equipped index for the comb. We need this to get the right dye + int dyeIndex = -1; + for (int i = 0; i < 20; i++) + { + if (drawPlayer.armor[i].type == ModContent.ItemType()) + { + dyeIndex = i; + break; + } + } + var shader = GameShaders.Armor.GetSecondaryShader(dyeIndex == -1 ? 0 : drawPlayer.dye[dyeIndex % 10].dye, drawPlayer); + + // Now detect if there are chests nearby + int LeftRange = Utils.Clamp((int)drawPlayer.MountedCenter.X / 16 - 50, 2, Main.maxTilesX - 2); + int RightRange = Utils.Clamp((int)drawPlayer.MountedCenter.X / 16 + 50, 2, Main.maxTilesX - 2); + int TopRange = Utils.Clamp((int)drawPlayer.MountedCenter.Y / 16 - 50, 2, Main.maxTilesY - 2); + int BottomRange = Utils.Clamp((int)drawPlayer.MountedCenter.Y / 16 + 50, 2, Main.maxTilesY - 2); + + float range = 50000f; + Vector2 ChestPosition = Vector2.Zero; + for (int i = LeftRange; i <= RightRange; i++) + { + for (int j = TopRange; j <= BottomRange; j++) + { + int PotentialChest = Chest.FindChestByGuessing(i, j); + if (PotentialChest != -1 && !TileID.Sets.BasicDresser[Main.tile[i, j].TileType]) + { + // Adjust position ot the center of the chest + Chest chest = Main.chest[PotentialChest]; + Vector2 chestCenter = new Vector2(chest.x + 1, chest.y + 1) * 16f; + float distance = Vector2.Distance(chestCenter, drawPlayer.MountedCenter); + + if (distance < range) + { + range = distance; + ChestPosition = chestCenter; + } + } + } + } + + if (!drawInfo.hatHair || Main.rand.NextBool()) + { + Rectangle area = drawInfo.hatHair ? Utils.CenteredRectangle(drawInfo.Position + drawPlayer.Size * 0.5f + new Vector2(drawPlayer.direction * -10, drawPlayer.gravDir * -10f), new Vector2(5f, 5f)) + : Utils.CenteredRectangle(drawInfo.Position + drawPlayer.Size * 0.5f + new Vector2(0f, drawPlayer.gravDir * -20f), new Vector2(20f, 14f)); + + Dust sparkle = Dust.NewDustDirect(area.TopLeft(), area.Width, area.Height, DustID.GoldCoin, Alpha: 150, Scale: 0.3f); + sparkle.fadeIn = 1f; + sparkle.velocity = ChestPosition == Vector2.Zero ? (sparkle.velocity * 0.1f) : (ChestPosition - sparkle.position).SafeNormalize(Vector2.Zero) * 0.2f; + sparkle.noLight = true; + sparkle.shader = shader; + drawInfo.DustCache.Add(sparkle.dustIndex); + } + + // Back hair + if (drawPlayer.velocity.X != 0f && drawInfo.backHairDraw) + { + Rectangle areaB = Utils.CenteredRectangle(drawInfo.Position + drawPlayer.Size * 0.5f + new Vector2(drawPlayer.direction * -14, 0f), new Vector2(4f, 30f)); + Dust sparkleB = Dust.NewDustDirect(areaB.TopLeft(), areaB.Width, areaB.Height, DustID.GoldCoin, Alpha: 150, Scale: 0.3f); + sparkleB.fadeIn = 1f; + sparkleB.velocity = ChestPosition == Vector2.Zero ? (sparkleB.velocity * 0.1f) : (ChestPosition - sparkleB.position).SafeNormalize(Vector2.Zero) * 0.2f; + sparkleB.noLight = true; + sparkleB.shader = shader; + drawInfo.DustCache.Add(sparkleB.dustIndex); + } + } + } +} diff --git a/CalPlayer/DrawLayers/EncasementParryLayer.cs b/CalPlayer/DrawLayers/EncasementParryLayer.cs index 28e75b3674..c0ffbb8c29 100644 --- a/CalPlayer/DrawLayers/EncasementParryLayer.cs +++ b/CalPlayer/DrawLayers/EncasementParryLayer.cs @@ -12,11 +12,12 @@ namespace CalamityMod.CalPlayer.DrawLayers public enum EncasementType { BlazingCore, - FlameLickedShell + FlameLickedShell, + ShieldoftheOcean } public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.FrontAccFront); //me when the player layer is called front acc front :skull: - public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.blazingCore ? EncasementType.BlazingCore : EncasementType.FlameLickedShell; + public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.blazingCore ? EncasementType.BlazingCore : modPlayer.flameLickedShell ? EncasementType.FlameLickedShell : EncasementType.ShieldoftheOcean; public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) { @@ -28,6 +29,7 @@ namespace CalamityMod.CalPlayer.DrawLayers { EncasementType.BlazingCore => visible && modPlayer.blazingCoreParry > 0, EncasementType.FlameLickedShell => visible && modPlayer.flameLickedShellParry > 0, + EncasementType.ShieldoftheOcean => visible && modPlayer.shieldOfTheOceanParry > 0, _ => false }; return visible; @@ -56,6 +58,12 @@ namespace CalamityMod.CalPlayer.DrawLayers defaultOpacity = 0.875f; scale = 1.2f; break; + case EncasementType.ShieldoftheOcean: + tex += "OceanShieldBubble"; + currentParry = calPlayer.shieldOfTheOceanParry; + defaultOpacity = 0.7f; + scale = 1.3f; + break; default: //should never be this option tex += "BlazingCoreCrystal"; currentParry = 0; @@ -70,8 +78,8 @@ namespace CalamityMod.CalPlayer.DrawLayers 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); + int maxParry = 30; // All parries currently last 30 frames. If this changes, this too should change. + float colorIntensity = currentParry >= 12 ? defaultOpacity : 1f - Utils.GetLerpValue(maxParry, 0f, currentParry, true); SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; drawInfo.DrawDataCache.Add(new DrawData(texture, drawPos, null, Color.White * colorIntensity, 0f, texture.Size() * 0.75f, scale, spriteEffects, 0)); } diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index 92ecc32019..029b50fe1b 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -46,6 +46,8 @@ namespace CalamityMod.CalPlayer.DrawLayers 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/ChromaticEruptionGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow").Value; else if (itemType == ModContent.ItemType()) @@ -66,6 +68,10 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/FatesRevealGlow").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/GalactusBladeGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Summon/LegionofCelestiaGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value; else if (itemType == ModContent.ItemType()) @@ -80,6 +86,8 @@ namespace CalamityMod.CalPlayer.DrawLayers 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/Melee/StarburstShivGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexSmallGlow").Value; else if (itemType == ModContent.ItemType()) @@ -90,6 +98,10 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/VernalBolterGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/VividClarityGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/TelluricGlareGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/BlissfulBombardierGlow").Value; if (glowMask == default) return; diff --git a/CalPlayer/DrawLayers/OceanShieldBubble.png b/CalPlayer/DrawLayers/OceanShieldBubble.png new file mode 100644 index 0000000000..e98f8c6037 Binary files /dev/null and b/CalPlayer/DrawLayers/OceanShieldBubble.png differ diff --git a/CalamityConditions.cs b/CalamityConditions.cs index 8cce78968e..7d7f2705c8 100644 --- a/CalamityConditions.cs +++ b/CalamityConditions.cs @@ -14,12 +14,6 @@ namespace CalamityMod predicate ); } - - // - // Config based conditions - // - - public static readonly Condition PotionSellingConfig = Create("PotionConfig", () => CalamityConfig.Instance.PotionSelling); // // Player conditions @@ -56,7 +50,7 @@ namespace CalamityMod public static readonly Condition DownedAquaticScourge = Create("Drops.DownedAS", () => DownedBossSystem.downedAquaticScourge); public static readonly Condition DownedBrimstoneElemental = Create("Drops.DownedBrim", () => DownedBossSystem.downedBrimstoneElemental); public static readonly Condition DownedCalamitasClone = Create("Drops.DownedCal", () => DownedBossSystem.downedCalamitasClone); - public static readonly Condition DownedLeviathan = Create("Drops.DownedLebi", () => DownedBossSystem.downedLeviathan); + public static readonly Condition DownedLeviathan = Create("Drops.DownedLevi", () => DownedBossSystem.downedLeviathan); public static readonly Condition DownedAstrumAureus = Create("Drops.DownedAureus", () => DownedBossSystem.downedAstrumAureus); public static readonly Condition DownedPlaguebringer = Create("Drops.DownedPBG", () => DownedBossSystem.downedPlaguebringer); public static readonly Condition DownedRavager = Create("Drops.DownedRav", () => DownedBossSystem.downedRavager); diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 9633a4a45b..ffe552857b 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -1,33 +1,62 @@ using System.ComponentModel; +using System.Reflection; using System.Runtime.Serialization; using CalamityMod.UI; using CalamityMod.UI.DraedonsArsenal; using CalamityMod.UI.Rippers; using CalamityMod.UI.SulphurousWaterMeter; using Terraria; +using Terraria.Localization; +using Terraria.ModLoader; using Terraria.ModLoader.Config; namespace CalamityMod { [BackgroundColor(49, 32, 36, 216)] - public class CalamityConfig : ModConfig + public class CalamityClientConfig : ModConfig { - public static CalamityConfig Instance; + public static CalamityClientConfig Instance; - // TODO -- Not all Calamity config settings should be considered client side. - // There are many configs which are server side and should stay that way. public override ConfigScope Mode => ConfigScope.ClientSide; - public override bool AcceptClientChanges(ModConfig pendingConfig, int whoAmI, ref string message) => true; // Clamps values that would cause ugly problems if loaded directly without sanitization. [OnDeserialized] internal void ClampValues(StreamingContext context) { - BossHealthBoost = Utils.Clamp(BossHealthBoost, MinBossHealthBoost, MaxBossHealthBoost); RipperMeterShake = Utils.Clamp(RipperMeterShake, MinMeterShake, MaxMeterShake); ParticleLimit = (int)Utils.Clamp(ParticleLimit, MinParticleLimit, MaxParticleLimit); } + internal static void SaveConfig() + { + // There is no current way to manually save a mod configuration file in tModLoader. + // The method which saves mod config files is private in ConfigManager, so reflection is used to invoke it. + try + { + MethodInfo saveMethodInfo = typeof(ConfigManager).GetMethod("Save", BindingFlags.Static | BindingFlags.NonPublic); + if (saveMethodInfo is not null) + saveMethodInfo.Invoke(null, [Instance]); + else + CalamityMod.Instance.Logger.Error("TML ConfigManager.Save reflection failed. Method signature has changed. Notify Calamity Devs if you see this in your log."); + } + catch + { + CalamityMod.Instance.Logger.Error("An error occurred while manually saving Calamity mod configuration. This may be due to a complex mod conflict. It is safe to ignore this error."); + } + } + + #region Multi-Threading Settings + [Header("Multithreading")] + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(0f, 2f)] + [DefaultValue(0f)] + [Increment(1f)] + [DrawTicks] + public float SunkenSeaMultiThreading { get; set; } + #endregion + #region Graphics Changes [Header("Graphics")] @@ -35,9 +64,13 @@ namespace CalamityMod [DefaultValue(true)] public bool Afterimages { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + public bool Photosensitivity { get; set; } + [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] - public bool NewVanillaTextures { get; set; } + public bool EnableVanillaTextureEdits { get; set; } private const int MinParticleLimit = 500; private const int MaxParticleLimit = 10000; @@ -48,10 +81,6 @@ namespace CalamityMod [DefaultValue(5000)] public int ParticleLimit { get; set; } - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - public bool BossesStopWeather { get; set; } - [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(0f, 10f)] @@ -61,6 +90,13 @@ namespace CalamityMod [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool StealthInvisibility { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [DefaultValue(1.0f)] + [Range(0.0f, 1.0f)] + public float EnergyShieldOpacity { get; set; } + #endregion #region UI Changes @@ -106,6 +142,33 @@ namespace CalamityMod [DefaultValue(true)] public bool StealthMeter { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool ChargeMeter { get; set; } + + private const float MinMeterShake = 0f; + private const float MaxMeterShake = 4f; + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(MinMeterShake, MaxMeterShake)] + [Increment(1f)] + [DrawTicks] + [DefaultValue(2f)] + public float RipperMeterShake { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + public bool SpeedrunTimer { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool FlightBar { get; set; } + #endregion + + #region Meter Positions + [Header("MeterPositions")] + [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(0f, 100f)] @@ -130,10 +193,6 @@ namespace CalamityMod [DefaultValue(SulphurousWaterMeterUI.DefaultPosY)] public float SulphuricWaterMeterPosY { get; set; } - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool ChargeMeter { get; set; } - [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(0f, 100f)] @@ -147,8 +206,28 @@ namespace CalamityMod public float ChargeMeterPosY { get; set; } [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - public bool SpeedrunTimer { get; set; } + [SliderColor(224, 165, 56, 128)] + [Range(0f, 100f)] + [DefaultValue(RipperUI.DefaultRagePosX)] + public float RageMeterPosX { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(0f, 100f)] + [DefaultValue(RipperUI.DefaultRagePosY)] + public float RageMeterPosY { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(0f, 100f)] + [DefaultValue(RipperUI.DefaultAdrenPosX)] + public float AdrenalineMeterPosX { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(0f, 100f)] + [DefaultValue(RipperUI.DefaultAdrenPosY)] + public float AdrenalineMeterPosY { get; set; } [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] @@ -162,10 +241,6 @@ namespace CalamityMod [DefaultValue(SpeedrunTimerUI.DefaultTimerPosY)] public float SpeedrunTimerPosY { get; set; } - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool FlightBar { get; set; } - [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(0f, 100f)] @@ -206,7 +281,37 @@ namespace CalamityMod [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool FasterFallHotkey { get; set; } + #endregion + } + [BackgroundColor(49, 32, 36, 216)] + public class CalamityServerConfig : ModConfig + { + public static CalamityServerConfig Instance; + public override ConfigScope Mode => ConfigScope.ServerSide; + public override bool AcceptClientChanges(ModConfig pendingConfig, int whoAmI, ref NetworkText message) + { + if (whoAmI == 0) + { + return true; + } + if (whoAmI != 0) + { + message = CalamityUtils.GetText("Configs.CalamityServerConfig.Denied").ToNetworkText(); + return false; + } + return false; + } + + // Clamps values that would cause ugly problems if loaded directly without sanitization. + [OnDeserialized] + internal void ClampValues(StreamingContext context) + { + BossHealthBoost = Utils.Clamp(BossHealthBoost, MinBossHealthBoost, MaxBossHealthBoost); + } + + [Header("Gameplay")] + #region General Gameplay Changes [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool RemoveReforgeRNG { get; set; } @@ -221,10 +326,6 @@ namespace CalamityMod [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] - public bool PotionSelling { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] public bool TownNPCsSpawnAtNight { get; set; } private const int MinTownNPCSpawnMultiplier = 1; @@ -257,6 +358,10 @@ namespace CalamityMod [DrawTicks] [DefaultValue(MinBossHealthBoost)] public float BossHealthBoost { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + public bool BossesStopWeather { get; set; } #endregion #region Default Player Stat Boosts @@ -274,10 +379,6 @@ namespace CalamityMod [DefaultValue(true)] public bool FasterRopeClimbSpeed { get; set; } - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool HigherJumpHeight { get; set; } - [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool FasterJumpSpeed { get; set; } @@ -306,44 +407,5 @@ namespace CalamityMod [DefaultValue(false)] public bool ForceTownSafety { get; set; } #endregion - - #region Revengeance Mode Changes - [Header("Revengeance")] - - private const float MinMeterShake = 0f; - private const float MaxMeterShake = 4f; - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(MinMeterShake, MaxMeterShake)] - [Increment(1f)] - [DrawTicks] - [DefaultValue(2f)] - public float RipperMeterShake { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(0f, 100f)] - [DefaultValue(RipperUI.DefaultRagePosX)] - public float RageMeterPosX { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(0f, 100f)] - [DefaultValue(RipperUI.DefaultRagePosY)] - public float RageMeterPosY { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(0f, 100f)] - [DefaultValue(RipperUI.DefaultAdrenPosX)] - public float AdrenalineMeterPosX { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(0f, 100f)] - [DefaultValue(RipperUI.DefaultAdrenPosY)] - public float AdrenalineMeterPosY { get; set; } - #endregion } } diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index 9c86183e9e..c09e181762 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -6,6 +6,7 @@ namespace CalamityMod { public static ModKeybind AccessoryParryHotKey { get; private set; } public static ModKeybind AdrenalineHotKey { get; private set; } + public static ModKeybind AmmoCycleHotkey { get; private set; } public static ModKeybind AngelicAllianceHotKey { get; private set; } public static ModKeybind ArmorSetBonusHotKey { get; private set; } public static ModKeybind AscendantInsigniaHotKey { get; private set; } @@ -16,14 +17,15 @@ namespace CalamityMod public static ModKeybind GravistarSabatonHotkey { get; private set; } public static ModKeybind NormalityRelocatorHotKey { get; private set; } public static ModKeybind RageHotKey { get; private set; } - public static ModKeybind SandCloakHotkey { get; private set; } public static ModKeybind SpectralVeilHotKey { get; private set; } + public static ModKeybind TransformerHotKey { get; private set; } public override void Load() { // Register keybinds AccessoryParryHotKey = KeybindLoader.RegisterKeybind(Mod, "ActivateAccessoryParry", "N"); AdrenalineHotKey = KeybindLoader.RegisterKeybind(Mod, "AdrenalineMode", "B"); + AmmoCycleHotkey = KeybindLoader.RegisterKeybind(Mod, "AmmoCycle", "Mouse3"); AngelicAllianceHotKey = KeybindLoader.RegisterKeybind(Mod, "AngelicAllianceBlessing", "G"); ArmorSetBonusHotKey = KeybindLoader.RegisterKeybind(Mod, "ArmorSetBonus", "Y"); AscendantInsigniaHotKey = KeybindLoader.RegisterKeybind(Mod, "AscendantInsigniaHotKey", "K"); @@ -34,14 +36,15 @@ namespace CalamityMod 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"); + TransformerHotKey = KeybindLoader.RegisterKeybind(Mod, "TransformerHotKey", "K"); } public override void Unload() { AccessoryParryHotKey = null; AdrenalineHotKey = null; + AmmoCycleHotkey = null; AngelicAllianceHotKey = null; ArmorSetBonusHotKey = null; AscendantInsigniaHotKey = null; @@ -52,8 +55,8 @@ namespace CalamityMod GravistarSabatonHotkey = null; NormalityRelocatorHotKey = null; RageHotKey = null; - SandCloakHotkey = null; SpectralVeilHotKey = null; + TransformerHotKey = null; } } } diff --git a/CalamityLists.cs b/CalamityLists.cs deleted file mode 100644 index 45e4b359df..0000000000 --- a/CalamityLists.cs +++ /dev/null @@ -1,2822 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Buffs; -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Buffs.Cooldowns; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Potions; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Vanity; -using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Fishing.FishingRods; -using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Items.Tools; -using CalamityMod.Items.TreasureBags; -using CalamityMod.Items.Weapons.DraedonsArsenal; -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.NPCs.Abyss; -using CalamityMod.NPCs.AcidRain; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.Astral; -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.Crabulon; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Artemis; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.NPCs.GreatSandShark; -using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.PlagueEnemies; -using CalamityMod.NPCs.Polterghast; -using CalamityMod.NPCs.PrimordialWyrm; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.Signus; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.Yharon; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Melee.MaceFlails; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Projectiles.Typeless; -using CalamityMod.Tiles.LivingFire; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod -{ - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public class CalamityLists - { - public static IList donatorList; - public static List projectileDestroyExceptionList; - public static List enemyImmunityList; - public static List confusionEnemyList; - public static List dungeonEnemyBuffList; - public static List dungeonProjectileBuffList; - public static List bossHPScaleList; - public static List friendlyBeeList; - public static List debuffList; - public static List fireDebuffList; - public static List sicknessDebuffList; - public static List alcoholList; - public static List spearAutoreuseList; - public static List pumpkinMoonBuffList; - public static List frostMoonBuffList; - public static List eclipseBuffList; - public static List eventProjectileBuffList; - public static List noRageWormSegmentList; - public static List needsDebuffIconDisplayList; - public static List scopedWeaponList; - public static List highTestFishList; - public static List forceItemList; - public static List livingFireBlockList; - public static List amalgamBuffList; - public static List persistentBuffList; - public static List MagicGunIDs; - public static List MushroomWeaponIDs; - public static List MushroomProjectileIDs; - public static List BlacklistedWeaponsWithToolPower; - - // Some of these lists of enemies are unused, but were difficult to create. Many of these common enemy types have a ton of variants. - public static List zombieList; - public static List demonEyeList; - public static List skeletonList; - public static List angryBonesList; - public static List hornetList; - public static List mossHornetList; - public static List minibossList; - - public static List pierceResistList; - public static List pierceResistExceptionLeviAureusList; - public static List pierceResistExceptionList; - - public static List AstrumDeusIDs; - public static List DevourerOfGodsIDs; - public static List CosmicGuardianIDs; - public static List AquaticScourgeIDs; - public static List PerforatorIDs; - public static List DesertScourgeIDs; - public static List EaterofWorldsIDs; - public static List SlimeGodIDs; - public static List DeathModeSplittingWormIDs; - public static List DestroyerIDs; - public static List ThanatosIDs; - public static List AresIDs; - public static List SkeletronPrimeIDs; - public static List StormWeaverIDs; - public static List RavagerIDs; - public static List GolemIDs; - public static List BoundNPCIDs; - - public static List GrenadeResistIDs; - public static List ZeroContactDamageNPCList; - public static List HardmodeNPCNerfList; - - public static SortedDictionary BossRushHPChanges; - public static SortedDictionary BossValues; - public static SortedDictionary bossTypes; - - public static List legOverrideList; - - public static List kamiDebuffColorImmuneList; - - public static Dictionary EncryptedSchematicIDRelationship; - - public static List DisabledSummonerNerfItems; - public static List DisabledSummonerNerfMinions; - - public static List VeneratedLocketBanlist; //To ban projectiles from locket, mainly spikeballs altho Toasty asked me to add mod calls for adding stuff like Dreamtastic - - public static void LoadLists() - { - donatorList = new List() - { - "Vorbis", - "SoloMael", - "Chaotic Reks", - "The Buildmonger", - "YuH", - "Littlepiggy", - "LompL", - "Lilith", - "Ben Shapiro", - "Frederik", - "Faye", - "Gibb50", - "Braden", - "Hannes", - "profoundmango69", - "Jack", - "Hans Volter", - "Krankwagon", - "MishiroUsui", - "pixlgray", - "Arkhine", - "Lodude", - "DevAesthetic", - "Mister Winchester", - "Zacky", - "Veine", - "Javyz", - "Shifter", - "Crysthamyr", - "Elfinlocks", - "Ein", - "2Larry2", - "Jenonen", - "Dodu", - "Arti", - "Tervastator", - "Luis", - "Alexander", - "BakaQing", - "Taylor", - "Xaphlactus", - "MajinBagel", - "Bendy", - "Rando Calrissian", - "Tails the Fox 92", - "Bread", - "Minty Candy", - "Preston", - "MovingTarget_086", - "Shiro", - "Chip", - "Taylor", - "ShotgunAngel", - "Sandblast", - "ThomasThePencil", - "Aero (Aero#4599)", - "Shirosity", // used to be GlitchOut - "Daawnz", - "CrabBar", - "Yatagarasu", - "Jarod", - "Zombieh", - "MingWhy", - "Random Weeb", - "Afzofa", - "Eragon3942", - "TheBlackHand", - "william", - "Samuel", - "Christopher", - "DemoN K!ng", - "Malik", - "Ryan Baker-Ortiz", - "Aleksanders", - "TheSilverGhost", - "Lucazii", - "Shay", - "Prism", - "BobIsNotMyRealName", - "Guwahavel", - "Azura", - "Joshua", - "Doveda", - "William", - "Arche", - "DevilSunrise", - "Yanmei", - "Chaos", - "Ryan", - "Fish Repairs", - "Melvin", - "Vroomy Has -3,000 IQ", - "The Goliath", - "DaPyRo", - "Takeru", - "Circuit-Jay", - "Commmander Frostbite", - "cytokat", - "Cameron", - "Orudeon", - "BumbleDoge", - "Naglfar", - "Helixas", - "Vetus", - "High Charity", - "Devonte", - "Cerberus", - "Brendan", - "Victor", - "KAT-G307", - "Tombarry Expresserino", - "Drip Veezy", - "Glaid", - "Apotheosis", - "Bladesaber", - "Devon", - "Ruthoranium", - "cocodezi_", - "Mendzey", - "GameRDheAsianSandwich", - "Tobias", - "Streakist", - "Eisaya", - "Xenocrona", - "RKMoon", - "Eternal Silence", - "Jeff", - "Beta165", - "DanYami", - "Xenocrona", - "Ari", - "cosmickalamity", - "xd Ow0", - "Darren", - "Florian", - "dawn thunder", - "asdf935", - "GentSkeleton", - "Fizzlpoprock", - "Pigeon", - "Aleksh", - "Just a random guy", - "Dee", - "Æthereal", - "Broken Faucet", - "Sarcosuchus", - "Marissa443", - "Warlok", - "JackShizz", - "NebulaMagePlays", - "Primpy", - "Thys", - "Min", - "Wodernet", - "Pedro", - "Depressed Dad Gaming", - "Snowy", - "Stormone", - "Mobian", - "Rinja", - "Check pins", - "Dakota", - "Neoplasmatic", - "False", - "Whitegiraffe", - "Drakkece", - "Levi", - "Izuna", - "djsnj20", - "pyobbo", - "Alec", - "The Illustrious Sqouinchuousor", - "Moist Lad", - "TwanTheGOAT", - "3x1t_5tyl3", - "Will", - "SpookyNinja", - "Boomdiada", - "Culex", - "Rossadon", - "Ben", - "hubert thieblot", - "NepNep", - "Nanaki", - "CrimsonCrips", - "Lagohz", - "Timon", - "F00d Demon", - "Olkothan", - "Vmar98", - "Dasdruid", - "Cinder", - "Brutzli", - "Yhashtur", - "Zekai", - "Doug", - "Uberransy", - "KurlozClown", - "Nemesis 041", - "Asheel", - "Hayden", - "Lightedflare", - "Lady Shira", - "Devin", - "Qelrin", - "Thomas", - "Ne'er Dowell", - "Potion Man", - "martyrdomination", - "Destructoid", - "Coolguystorm YT", - "Wolfmaw", - "yiumik", - "Destiny Stallcup", - "GreenBerry", - "SolsticeUnlimitd", - "darkhawke", - "oracle", - "YumeiSenshi", - "Cameron", - "Toxin", - "Fweepachino", - "DESPACITO", - "Altzeus", - "Ryan", - "Spider region", - "WinterTire", - "Nycro", - "Bewearium", - "William", - "HellGoat2", - "116taj", - "CaineSenpai", - "Suicide Dreams", - "Roxas", - "Obsoleek", - "Jetpat3", - "GreenTea", - "Woah", - "Ryaegos", - "Popsickle Yoshi", - "Arcadia", - "JensB__", - "Nuclei", - "Picasso's Bean", - "Corn M. Cobb", - "kgh8090", - "Luke", - "Barbara", - "Alexis", - "Soko", - "Albino gonkvader", - "Monic", - "Slim", - "ChaosChaos", - "Deallly", - "Jeff", - "vcf55", - "Kazurgundu", - "Jheybyrd", - "Kipluck", - "SCONICBOOM", - "Mr.Matter", - "Billy", - "jjth0m3", - "GTW High Cube", - "Sabrina", - "Potato - Stego", - "Perditio Astrum", - "MaxingOut", - "SharZz", - "Allegro", - "hoosfire", - "Lauren", - "Ultra Succ", - "Ethan", - "Pacnysam", - "dummyAzure", - "Jaykob", - "Goblin", - "NoOneElse", - "Nicholas", - "Toasty", - "oli saer", - "Blobby6799", - "Domrinth", - "zombieseatflesh7", - "Shiny", - "Whale", - "The Infinity", - "MrCreamen", - "TemperedAether", - "LucasTwocas", - "JustLonelyPi", - "Brian", - "Ashton", - "Rolandark", - "Ally2Cute", - "Dionysos", - "Plant Waifu", - "fire", - "Charles", - "Kaden", - "Dr. Pawsworth", - "Jackson", - "Freakish", - "Ashamper", - "Kinzoku", - "Elementari", - "The Wolf Commando", - "Jordan", - "Jessire", - "Ashton", - "callisto", - "velneu", - "Mathuantie", - "Robert", - "Matias", - "T E R M I N A T O R", - "apotofkoolaid", - "Matthew", - "Terrarian Dragon", - "Pomelo", - "Thomas", - "Iconic Parker Gaming", - "Jaydon", - "Aidan", - "Avery", - "yayoi", - "Splotchycrib", - "GIGA MAN", - "Eric", - "Merubel", - "Smug", - "Lime-Wars l 1", - "WillyDilly", - "xAqult", - "Himakaze", - "Face", - "Carboniferous", - "James", - "Taitou1", - "Yumi", - "NEBULA", - "Blackbluue", - "Alex", - "Ruben", - "Rixu", - "Antonie", - "Zerimore", - "Oblivionisbruh", - "Loser", - "Patrick", - "Magic Love", - "gluten tag", - "RetroRed", - "Katherine", - "SoyScoutSmasher", - "Jersey", - "Reiter splash", - "Conner", - "Ekun", - "Driser", - "bikmin", - "MittoMan", - "Pyromaniac146", - "Eddie Spaghetti", - "Colin", - "ZyferDex_", - "LumiEvi", - "Anish", - "MissMudflaps", - "Valkyrie", - "anglerraptor", - "Scribbles", - "Pneuma", - "OrrangProto", - "Tomat (Stevie)", - "That Katsafaros", - "PsychoGrizzly", - "Dayne", - "Hargestar", - "The Pyro", - "Lucas", - "Superbeepig", - "Larry That Barry", - "Monti", - "StarryFox", - "Kevin", - "Poopifier Poopifly", - "Lacuna", - "Nathan", - "Handburger", - "XusTingo9", - "Underlost", - "julius", - "Mark", - "Habb", - "Reanamet", - "Empress Vega", - "Team", - "GP", - "Xsiana", - "NyanLegacy215", - "ethan", - "Trinity Series", - "M001NG", - "WrathOfOlympus", - "dennis", - "Darkweb", - "Chaozhi", - "Mars", - "Elijah", - "Tezguin", - "Shpee", - "Archie", - "Meow", - "CosmicStarIight", - "Alfragiste", - "Number1piratepan", - "Noah", - "Max Kim", - "Anton", - "edm vibes", - "Hunter", - "Doodled_lynx", - "3en", - "Kiyotu", - "Aero", - "Iguy", - "병현 송", - "Tyler", - "Leonidas", - "GregTheSpinarak", - "Cheddar", - "Alex N", - "Magicoal", - "Seanツ", - "Ariscottle", - "Kevin", - "OnTheAirPogs", - "Zerafir", - "Bill", - "Starmitzy", - "FaeLoPondering", - "Brian", - "Smart2004", - "sherk", - "Squishy", - "Ash", - "rawpie2", - "Hokojin", - "sk", - "Done", - "MeanieG", - "Sanctuary", - "Landon", - "Moonicento", - "Hayden", - "Steven", - "Hana", - "Mikabul", - "Nathaniel", - "Brutus", - "EdelVollMilch", - "garfu", - "NuT NiTe", - "adain", - "Dylan", - "Lucas", - "Arthur", - "sweatingdishes", - "pomp neigh", - "Proffesor prostate", - "Saladify", - "26-4-1", - "VeryMasterNinja", - "Vorbis", - "Nyapano", - "Shadoku", - "allosar", - "jes", - "Paltham", - "Fartein", - "Derdjin", - "A_Normal_Person", - "Duck Satan", - "Jalapeno9", - "Grylken", - "Nexus", - "KJ", - "Goober", - "ChAoS DiScOrD", - "Mayhem", - "Zombified _G", - "Madd Cat", - "Natalie", - "Solaire", - "Dakota C", - "The Davester", - "Jose", - "Him", - "Umberto", - "Lance", - "Navigator", - "Ferret4T", - "Rooki", - "LvL-94", - "Feels Fishy", - "Korb Orb", - "Calcium Comrade", - "Talmadge", - "ddoogg88 tdog", - "CasualNoLifer", - "Bossy Punch", - "Creamy", - "Tyler", - "topnormal", - "Gilded Gryphon", - "Nightskyflyer", - "Schlarfblrfsch", - "MrNobody", - "Aden C.N.", - "zombie wolf", - "n0tacat", - "Marko", - "dexxer65", - "DeLordeyeee", - "Kaledoulas", - "Mohammad", - "Skeli_G", - "Arcxus", - "Sigil", - "Dull", - "DjackV", - "Misinput", - "Gameology", - "KugelBlitz", - "TheGreatSako", - "Joep", - "Rottingwood", - "anything5000", - "Gretchen", - "Spirit Shield", - "Briny_Coffee", - "_Skeggy_", - "just akkolite", - "J.U.N.E.S", - "Bruggs", - "Vimek Xol", - "Oceanman232", - "Sadouken", - "srxe", - "ProfessorWinston", - "OctolingGrimm", - "Cole", - "Markie", - "Met Vox", - "Tweee", - "Kaimonick", - "Chow Chow", - "drenmus!", - "Nitronium Productions", - "Goomfrontlut", - "Akkolite", - "Shaun", - "Bruh.PNG", - "James", - "Lord_Lucerne", - "Ulmod", - "Adamko", - "Gamma Freya", - "Finnrua", - "Maskedmilo", - "RockRecker39", - "Konorango", - "Indeciiissive", - "Curtis", - "Ponynator", - "Crippling-Ambition", - "TitaniumLlama", - "OriginForme487", - "FishBread", - "Real mystlc", - "Levi", - "jc.", - "Medi", - "Jakob", - "Borb9834", - "Georgios", - "KeL", - "Cody", - "Cristian(Mihaii)", - "Marco", - "RuskieThe3rd", - "BreachNClear747", - "happy thoughts", - "Azure", - "theHoopty", - "porglesupreme", - "XDkilljoy65XX", - "Mr. Bones", - "dawnboi", - "Joe", - "Sailor Jolt", - "SomeRando", - "Nuclear Chaos", - "Jankle", - "The Roborex", - "everquartz", - "discokittie", - "IsaacInsomnia", - "xElectrix_", - "Forge", - "MiyoshiEira", - "thebettercat", - "Darthlego", - "Azzilan", - "Griffin", - "LucasHM", - "ChrigTopher", - "Colin V", - "Scrumlet", - "Darkus", - "Homunculus Derelictus", - "Professor Pissington", - "Buppercups - Roblox", - "Pusheen_", - "Patrera" - }; - - projectileDestroyExceptionList = new List() - { - //holdout projectiles - ProjectileID.Phantasm, - ProjectileID.VortexBeater, - ProjectileID.DD2PhoenixBow, - ProjectileID.LastPrism, - ProjectileID.LastPrismLaser, - ProjectileID.LaserMachinegun, - ProjectileID.ChargedBlasterCannon, - ProjectileID.MedusaHead, - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - // Some hostile boss projectiles - ProjectileID.SaucerDeathray, - ProjectileID.PhantasmalDeathray, - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - - 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, - NPCID.Deerclops, - NPCID.WallofFlesh, - NPCID.WallofFleshEye, - NPCID.PirateShipCannon, - NPCID.QueenSlimeBoss, - NPCID.Probe, - NPCID.Retinazer, - NPCID.Spazmatism, - NPCType(), - NPCID.SkeletronPrime, - NPCType(), - NPCID.PrimeCannon, - NPCID.PrimeSaw, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.Plantera, - NPCID.PlanterasTentacle, - NPCType(), - NPCID.HallowBoss, - NPCID.Everscream, - NPCID.SantaNK1, - NPCID.IceQueen, - NPCID.MourningWood, - NPCID.Pumpking, - NPCID.Mothron, - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.MartianSaucerCore, - NPCID.MartianSaucerCannon, - NPCID.MartianSaucerTurret, - NPCID.DukeFishron, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.CultistBoss, - NPCID.CultistDragonHead, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.AncientCultistSquidhead, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCID.MoonLordCore, - NPCID.MoonLordFreeEye, - NPCID.DD2WyvernT1, - NPCID.DD2WyvernT2, - NPCID.DD2WyvernT3, - NPCID.DD2DarkMageT1, - NPCID.DD2DarkMageT3, - NPCID.DD2SkeletonT1, - NPCID.DD2SkeletonT3, - NPCID.DD2WitherBeastT2, - NPCID.DD2WitherBeastT3, - NPCID.DD2DrakinT2, - NPCID.DD2DrakinT3, - NPCID.DD2KoboldWalkerT2, - NPCID.DD2KoboldWalkerT3, - NPCID.DD2KoboldFlyerT2, - NPCID.DD2KoboldFlyerT3, - NPCID.DD2OgreT2, - NPCID.DD2OgreT3, - NPCID.DD2Betsy, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - confusionEnemyList = new List() - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - dungeonEnemyBuffList = new List() - { - NPCID.SkeletonSniper, - NPCID.TacticalSkeleton, - NPCID.SkeletonCommando, - NPCID.Paladin, - NPCID.GiantCursedSkull, - NPCID.BoneLee, - NPCID.DiabolistWhite, - NPCID.DiabolistRed, - NPCID.NecromancerArmored, - NPCID.Necromancer, - NPCID.RaggedCasterOpenCoat, - NPCID.RaggedCaster, - NPCID.HellArmoredBonesSword, - NPCID.HellArmoredBonesMace, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBones, - NPCID.BlueArmoredBonesSword, - NPCID.BlueArmoredBonesNoPants, - NPCID.BlueArmoredBonesMace, - NPCID.BlueArmoredBones, - NPCID.RustyArmoredBonesSwordNoArmor, - NPCID.RustyArmoredBonesSword, - NPCID.RustyArmoredBonesFlail, - NPCID.RustyArmoredBonesAxe - }; - - dungeonProjectileBuffList = new List() - { - ProjectileID.PaladinsHammerHostile, - ProjectileID.ShadowBeamHostile, - ProjectileID.InfernoHostileBolt, - ProjectileID.InfernoHostileBlast, - ProjectileID.LostSoulHostile, - ProjectileID.SniperBullet, - ProjectileID.RocketSkeleton, - ProjectileID.BulletDeadeye, - ProjectileID.Shadowflames - }; - - bossHPScaleList = new List() - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.SkeletronHand, - NPCID.WallofFleshEye, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.PrimeSaw, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - }; - //Many more are added later with AddRange - - friendlyBeeList = new List() - { - ProjectileID.GiantBee, - ProjectileID.Bee, - ProjectileID.Wasp, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - - debuffList = new List() - { - BuffID.Poisoned, - BuffID.Darkness, - BuffID.Cursed, - BuffID.OnFire, - BuffID.Bleeding, - BuffID.Confused, - BuffID.Slow, - BuffID.Weak, - BuffID.Silenced, - BuffID.BrokenArmor, - BuffID.CursedInferno, - BuffID.Frostburn, - BuffID.Chilled, - BuffID.Frozen, - BuffID.Burning, - BuffID.Suffocation, - BuffID.Ichor, - BuffID.Venom, - BuffID.Blackout, - BuffID.Electrified, - BuffID.Rabies, - BuffID.Webbed, - BuffID.Stoned, - BuffID.Dazed, - BuffID.VortexDebuff, - BuffID.WitheredArmor, - BuffID.WitheredWeapon, - BuffID.OgreSpit, - BuffID.BetsysCurse, - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - // BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType() - }; - - fireDebuffList = new List() - { - BuffID.OnFire, - BuffID.OnFire3, // Hellfire - BuffID.Burning, // Touching meteorite ore or hellstone without obsidian skull - BuffID.CursedInferno, - BuffID.ShadowFlame, // Vanilla Shadowflame, can normally never be applied to players - BuffType(), // Calamity Shadowflame copy for players - BuffType(), // Crags lava - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), // Aflame enchant self damage - BuffType(), - }; - - sicknessDebuffList = new List() - { - BuffID.Poisoned, - BuffID.Venom, - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType() - }; - - alcoholList = new List() - { - BuffID.Tipsy, - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType() - }; - - spearAutoreuseList = new List() - { - ItemID.AdamantiteGlaive, - ItemID.ChlorophytePartisan, - ItemID.CobaltNaginata, - ItemID.DarkLance, - ItemID.MonkStaffT2, - ItemID.Gungnir, - ItemID.MushroomSpear, - ItemID.MythrilHalberd, - ItemID.NorthPole, - ItemID.ObsidianSwordfish, - ItemID.OrichalcumHalberd, - ItemID.PalladiumPike, - ItemID.Spear, - ItemID.Swordfish, - ItemID.TheRottedFork, - ItemID.TitaniumTrident, - ItemID.Trident, - ItemID.ThunderSpear - }; - - pumpkinMoonBuffList = new List() - { - NPCID.Scarecrow1, - NPCID.Scarecrow2, - NPCID.Scarecrow3, - NPCID.Scarecrow4, - NPCID.Scarecrow5, - NPCID.Scarecrow6, - NPCID.Scarecrow7, - NPCID.Scarecrow8, - NPCID.Scarecrow9, - NPCID.Scarecrow10, - NPCID.HeadlessHorseman, - NPCID.MourningWood, - NPCID.Splinterling, - NPCID.Pumpking, - NPCID.PumpkingBlade, - NPCID.Hellhound, - NPCID.Poltergeist - }; - - frostMoonBuffList = new List() - { - NPCID.ZombieElf, - NPCID.ZombieElfBeard, - NPCID.ZombieElfGirl, - NPCID.PresentMimic, - NPCID.GingerbreadMan, - NPCID.Yeti, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.ElfCopter, - NPCID.Nutcracker, - NPCID.NutcrackerSpinning, - NPCID.ElfArcher, - NPCID.Krampus, - NPCID.Flocko - }; - - eclipseBuffList = new List() - { - NPCID.Eyezor, - NPCID.Reaper, - NPCID.Frankenstein, - NPCID.SwampThing, - NPCID.Vampire, - NPCID.VampireBat, - NPCID.Butcher, - NPCID.CreatureFromTheDeep, - NPCID.Fritz, - NPCID.Nailhead, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.DrManFly, - NPCID.ThePossessed, - NPCID.Mothron, - NPCID.MothronEgg, - NPCID.MothronSpawn - }; - - eventProjectileBuffList = new List() - { - ProjectileID.FlamingWood, - ProjectileID.GreekFire1, - ProjectileID.GreekFire2, - ProjectileID.GreekFire3, - ProjectileID.FlamingScythe, - ProjectileID.FlamingArrow, - ProjectileID.PineNeedleHostile, - ProjectileID.OrnamentHostile, - ProjectileID.OrnamentHostileShrapnel, - ProjectileID.FrostWave, - ProjectileID.FrostShard, - ProjectileID.Missile, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.BulletDeadeye, - ProjectileID.EyeLaser, - ProjectileID.Nail, - ProjectileID.DrManFlyFlask - }; - - noRageWormSegmentList = new List() - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - needsDebuffIconDisplayList = new List() - { - NPCID.TargetDummy, - NPCID.WallofFleshEye, - NPCType() - }; - - // TODO -- override HoldItem => Player.accFishingLine = true; on these items, just like the scope fix... - highTestFishList = new List() - { - ItemID.GoldenFishingRod, - ItemType(), - ItemType() - }; - - forceItemList = 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(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemID.HotlineFishingHook, - ItemID.BottomlessBucket, - ItemID.SuperAbsorbantSponge, - ItemID.FishingPotion, - ItemID.SonarPotion, - ItemID.CratePotion, - ItemID.AnglerTackleBag, - ItemID.HighTestFishingLine, - ItemID.TackleBox, - ItemID.AnglerEarring, - ItemID.FishermansGuide, - ItemID.WeatherRadio, - ItemID.Sextant, - ItemID.AnglerHat, - ItemID.AnglerVest, - ItemID.AnglerPants, - ItemID.GoldenBugNet, - ItemID.FishronWings, - ItemID.Flairon, - ItemID.Tsunami, - ItemID.BubbleGun, - ItemID.RazorbladeTyphoon, - ItemID.TempestStaff, - ItemID.FishronBossBag, - ItemID.Coral, - ItemID.Seashell, - ItemID.Starfish, - ItemID.SoulofSight, - ItemID.GreaterHealingPotion, - ItemID.SuperHealingPotion - }; - - livingFireBlockList = new List() - { - TileType(), - TileType(), - TileType(), - TileID.LivingFire, - TileID.LivingCursedFire, - TileID.LivingDemonFire, - TileID.LivingFrostFire, - TileID.LivingIchor, - TileID.LivingUltrabrightFire - }; - - amalgamBuffList = new List() - { - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffID.ObsidianSkin, - BuffID.Regeneration, - BuffID.Swiftness, - BuffID.Gills, - BuffID.Ironskin, - BuffID.ManaRegeneration, - BuffID.MagicPower, - BuffID.Featherfall, - BuffID.Spelunker, - BuffID.Invisibility, - BuffID.Shine, - BuffID.NightOwl, - BuffID.Battle, - BuffID.Thorns, - BuffID.WaterWalking, - BuffID.Archery, - BuffID.Hunter, - BuffID.Gravitation, - BuffID.Tipsy, - BuffID.WellFed, - BuffID.WellFed2, - BuffID.WellFed3, - BuffID.Honey, - BuffID.WeaponImbueVenom, - BuffID.WeaponImbueCursedFlames, - BuffID.WeaponImbueFire, - BuffID.WeaponImbueGold, - BuffID.WeaponImbueIchor, - BuffID.WeaponImbueNanites, - BuffID.WeaponImbueConfetti, - BuffID.WeaponImbuePoison, - BuffID.Lucky, - BuffID.Mining, - BuffID.Heartreach, - BuffID.Calm, - BuffID.Builder, - BuffID.Titan, - BuffID.Flipper, - BuffID.Summoning, - BuffID.Dangersense, - BuffID.AmmoReservation, - BuffID.Lifeforce, - BuffID.Endurance, - BuffID.Rage, - BuffID.Inferno, - BuffID.Wrath, - BuffID.Lovestruck, - BuffID.Stinky, - BuffID.Fishing, - BuffID.Sonar, - BuffID.Crate, - BuffID.Warmth, - BuffID.SugarRush - }; - - persistentBuffList = new List() - { - BuffType(), - BuffType(), - BuffType(), - BuffID.WeaponImbueVenom, - BuffID.WeaponImbueCursedFlames, - BuffID.WeaponImbueFire, - BuffID.WeaponImbueGold, - BuffID.WeaponImbueIchor, - BuffID.WeaponImbueNanites, - BuffID.WeaponImbueConfetti, - 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(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemID.Hammush, - ItemID.MushroomSpear, - ItemID.Shroomerang - }; - - MushroomProjectileIDs = new List() - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileID.TruffleSpore, - ProjectileID.MushroomSpear, - ProjectileID.Shroomerang - }; - - // This list intentionally does not contain Grax. - BlacklistedWeaponsWithToolPower = new List() - { - ItemID.ButchersChainsaw, - ItemID.LucyTheAxe, - ItemID.Rockfish, - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - }; - - zombieList = new List() - { - NPCID.Zombie, - NPCID.ArmedZombie, - NPCID.BaldZombie, - NPCID.PincushionZombie, - NPCID.ArmedZombiePincussion, // what is this spelling - NPCID.SlimedZombie, - NPCID.ArmedZombieSlimed, - NPCID.SwampZombie, - NPCID.ArmedZombieSwamp, - NPCID.TwiggyZombie, - NPCID.ArmedZombieTwiggy, - NPCID.FemaleZombie, - NPCID.ArmedZombieCenx, - NPCID.ZombieRaincoat, - NPCID.ZombieEskimo, - NPCID.ArmedZombieEskimo, - NPCID.BigRainZombie, - NPCID.SmallRainZombie, - NPCID.BigFemaleZombie, - NPCID.SmallFemaleZombie, - NPCID.BigTwiggyZombie, - NPCID.SmallTwiggyZombie, - NPCID.BigSwampZombie, - NPCID.SmallSwampZombie, - NPCID.BigSlimedZombie, - NPCID.SmallSlimedZombie, - NPCID.BigPincushionZombie, - NPCID.SmallPincushionZombie, - NPCID.BigBaldZombie, - NPCID.SmallBaldZombie, - NPCID.BigZombie, - NPCID.SmallZombie, - NPCID.MaggotZombie - // halloween zombies not included because they don't drop shackles or zombie arms - }; - - demonEyeList = new List() - { - NPCID.DemonEye, - NPCID.CataractEye, - NPCID.SleepyEye, - NPCID.DialatedEye, // it is spelled "dilated" - NPCID.GreenEye, - NPCID.PurpleEye, - NPCID.DemonEyeOwl, - NPCID.DemonEyeSpaceship, - NPCID.DemonEye2, - NPCID.PurpleEye2, - NPCID.GreenEye2, - NPCID.DialatedEye2, - NPCID.SleepyEye2, - NPCID.CataractEye2 - }; - - skeletonList = new List() - { - NPCID.Skeleton, - NPCID.HeadacheSkeleton, - NPCID.MisassembledSkeleton, - NPCID.PantlessSkeleton, - NPCID.BoneThrowingSkeleton, - NPCID.BoneThrowingSkeleton2, - NPCID.BoneThrowingSkeleton3, - NPCID.BoneThrowingSkeleton4, - NPCID.BigPantlessSkeleton, - NPCID.SmallPantlessSkeleton, - NPCID.BigMisassembledSkeleton, - NPCID.SmallMisassembledSkeleton, - NPCID.BigHeadacheSkeleton, - NPCID.SmallHeadacheSkeleton, - NPCID.BigSkeleton, - NPCID.SmallSkeleton, - - //Note: These skeletons don't count for Skeleton Banner for some god forsaken reason - NPCID.SkeletonTopHat, - NPCID.SkeletonAstonaut, - NPCID.SkeletonAlien, - - //Other skeleton types - NPCID.ArmoredSkeleton, - NPCID.HeavySkeleton, - NPCID.SkeletonArcher, - NPCID.GreekSkeleton, - NPCID.SporeSkeleton - }; - - angryBonesList = new List() - { - NPCID.AngryBones, - NPCID.AngryBonesBig, - NPCID.AngryBonesBigMuscle, - NPCID.AngryBonesBigHelmet, - NPCID.BigBoned, - NPCID.ShortBones - }; - - hornetList = new List() - { - NPCID.BigHornetStingy, - NPCID.LittleHornetStingy, - NPCID.BigHornetSpikey, - NPCID.LittleHornetSpikey, - NPCID.BigHornetLeafy, - NPCID.LittleHornetLeafy, - NPCID.BigHornetHoney, - NPCID.LittleHornetHoney, - NPCID.BigHornetFatty, - NPCID.LittleHornetFatty, - NPCID.BigStinger, - NPCID.LittleStinger, - NPCID.Hornet, - NPCID.HornetFatty, - NPCID.HornetHoney, - NPCID.HornetLeafy, - NPCID.HornetSpikey, - NPCID.HornetStingy - }; - - mossHornetList = new List() - { - NPCID.MossHornet, - NPCID.TinyMossHornet, - NPCID.LittleMossHornet, - NPCID.BigMossHornet, - NPCID.GiantMossHornet - }; - - minibossList = new List() - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.Pumpking, - NPCID.MourningWood, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.Everscream, - NPCID.DD2Betsy, - NPCID.Mothron, - NPCID.MartianSaucer, - NPCID.MartianSaucerCannon, - NPCID.MartianSaucerCore, - NPCID.MartianSaucerTurret, - }; - - pierceResistList = new List() - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - pierceResistExceptionLeviAureusList = new List() - { - ProjectileID.NettleBurstEnd, - ProjectileID.NettleBurstLeft, - ProjectileID.NettleBurstRight, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - - pierceResistExceptionList = new List() - { - ProjectileID.Arkhalis, - ProjectileID.ChargedBlasterLaser, - ProjectileID.ClingerStaff, - ProjectileID.FinalFractal, - ProjectileID.FlyingKnife, - ProjectileID.LastPrismLaser, - ProjectileID.MechanicalPiranha, - ProjectileID.MonkStaffT3, - ProjectileID.PiercingStarlight, - ProjectileID.Terragrim, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - }; - - // Lists of enemies that resist piercing to some extent (mostly worms). - // Could prove useful for other things as well. - - AstrumDeusIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; - - DevourerOfGodsIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; - - CosmicGuardianIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; - - AquaticScourgeIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - PerforatorIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - bossHPScaleList.AddRange(PerforatorIDs); - - DesertScourgeIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; - - EaterofWorldsIDs = new List - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail - }; - - SlimeGodIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - bossHPScaleList.AddRange(SlimeGodIDs); - - DeathModeSplittingWormIDs = new List - { - NPCID.DuneSplicerHead, - NPCID.DuneSplicerBody, - NPCID.DuneSplicerTail, - NPCID.DiggerHead, - NPCID.DiggerBody, - NPCID.DiggerTail, - NPCID.SeekerHead, - NPCID.SeekerBody, - NPCID.SeekerTail - }; - - DestroyerIDs = new List - { - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail - }; - - ThanatosIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - AresIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - SkeletronPrimeIDs = new List - { - NPCID.SkeletronPrime, - NPCType(), - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeSaw, - NPCID.PrimeVice - }; - - StormWeaverIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; - - // Purposefully does not include the freed head - RavagerIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - bossHPScaleList.AddRange(RavagerIDs); - - GolemIDs = new List - { - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistLeft, - NPCID.GolemFistRight - }; - - GrenadeResistIDs = new List - { - ProjectileID.Grenade, - ProjectileID.StickyGrenade, - ProjectileID.BouncyGrenade, - ProjectileID.Bomb, - ProjectileID.StickyBomb, - ProjectileID.BouncyBomb, - ProjectileID.Dynamite, - ProjectileID.StickyDynamite, - ProjectileID.BouncyDynamite, - ProjectileID.Explosives, - ProjectileID.ExplosiveBunny, - ProjectileID.PartyGirlGrenade, - ProjectileID.BombFish, - ProjectileID.Beenade, - ProjectileID.Bee, - ProjectileID.GiantBee, - ProjectileType(), - ProjectileID.ScarabBomb - }; - - 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, - NPCID.CultistArcherBlue, - NPCID.DesertDjinn, - NPCID.DiabolistRed, - NPCID.DiabolistWhite, - NPCID.Gastropod, - NPCID.IceElemental, - NPCID.IchorSticker, - NPCID.Necromancer, - NPCID.NecromancerArmored, - NPCID.RaggedCaster, - NPCID.RaggedCasterOpenCoat, - NPCID.RuneWizard, - NPCID.SkeletonArcher, - NPCID.SkeletonCommando, - NPCID.SkeletonSniper, - NPCID.TacticalSkeleton, - NPCID.Clown, - NPCID.GoblinArcher, - NPCID.GoblinSorcerer, - NPCID.GoblinSummoner, - NPCID.PirateCrossbower, - NPCID.PirateDeadeye, - NPCID.PirateCaptain, - NPCID.SnowmanGangsta, - NPCID.SnowBalla, - 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, - NPCID.MartianSaucerCore, - NPCID.MartianSaucerTurret, - NPCID.Probe, - NPCID.CultistBoss, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.MoonLordFreeEye, - NPCID.BloodSquid, - NPCID.PlanterasHook, - 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% - HardmodeNPCNerfList = new List - { - NPCID.AnglerFish, - NPCID.AngryTrapper, - NPCID.Arapaima, - NPCID.BlackRecluse, - NPCID.BlackRecluseWall, - NPCID.BloodJelly, - NPCID.FungoFish, - NPCID.GreenJellyfish, - NPCID.Clinger, - NPCID.ArmoredSkeleton, - NPCID.ArmoredViking, - NPCID.Mummy, - NPCID.DarkMummy, - NPCID.LightMummy, - NPCID.BloodFeeder, - NPCID.DesertBeast, - NPCID.ChaosElemental, - NPCID.BloodMummy, - NPCID.CorruptSlime, - NPCID.Slimeling, - NPCID.Corruptor, - NPCID.Crimslime, - NPCID.BigCrimslime, - NPCID.LittleCrimslime, - NPCID.CrimsonAxe, - NPCID.CursedHammer, - NPCID.Derpling, - NPCID.Herpling, - NPCID.DiggerHead, - NPCID.DesertGhoul, - NPCID.DesertGhoulCorruption, - NPCID.DesertGhoulCrimson, - NPCID.DesertGhoulHallow, - NPCID.DuneSplicerHead, - NPCID.EnchantedSword, - NPCID.FloatyGross, - NPCID.GiantBat, - NPCID.GiantFlyingFox, - NPCID.FungiSpore, - NPCID.GiantTortoise, - NPCID.IceTortoise, - NPCID.HoppinJack, - NPCID.Mimic, - NPCID.IlluminantBat, - NPCID.IlluminantSlime, - NPCID.JungleCreeper, - NPCID.JungleCreeperWall, - NPCID.DesertLamiaDark, - NPCID.DesertLamiaLight, - NPCID.BigMossHornet, - NPCID.GiantMossHornet, - NPCID.LittleMossHornet, - NPCID.MossHornet, - NPCID.TinyMossHornet, - NPCID.Moth, - NPCID.PigronCorruption, - NPCID.PigronCrimson, - NPCID.PigronHallow, - NPCID.Pixie, - NPCID.PossessedArmor, - NPCID.RockGolem, - NPCID.DesertScorpionWalk, - NPCID.DesertScorpionWall, - NPCID.Slimer, - NPCID.Slimer2, - NPCID.ToxicSludge, - NPCID.Unicorn, - NPCID.WanderingEye, - NPCID.Werewolf, - NPCID.Wolf, - NPCID.SeekerHead, - NPCID.Wraith, - NPCID.ChatteringTeethBomb, - NPCID.IceGolem, - NPCID.RainbowSlime, - NPCID.SandShark, - NPCID.SandsharkCorrupt, - NPCID.SandsharkCrimson, - NPCID.SandsharkHallow, - NPCID.ShadowFlameApparition, - NPCID.Parrot, - NPCID.PirateCorsair, - NPCID.PirateDeckhand, - NPCID.PirateGhost, - NPCID.BlueArmoredBonesMace, - NPCID.BlueArmoredBonesSword, - NPCID.BoneLee, - NPCID.DungeonSpirit, - NPCID.FlyingSnake, - NPCID.HellArmoredBones, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBonesSword, - NPCID.MisterStabby, - NPCID.Butcher, - NPCID.CreatureFromTheDeep, - NPCID.DeadlySphere, - NPCID.Frankenstein, - NPCID.Fritz, - NPCID.Psycho, - NPCID.Reaper, - NPCID.SwampThing, - NPCID.ThePossessed, - NPCID.Vampire, - NPCID.VampireBat, - NPCID.HeadlessHorseman, - NPCID.Hellhound, - NPCID.Poltergeist, - NPCID.Scarecrow1, - NPCID.Scarecrow2, - NPCID.Scarecrow3, - NPCID.Scarecrow4, - NPCID.Scarecrow5, - NPCID.Scarecrow6, - NPCID.Scarecrow7, - NPCID.Scarecrow8, - NPCID.Scarecrow9, - NPCID.Scarecrow10, - NPCID.Splinterling, - NPCID.Flocko, - NPCID.GingerbreadMan, - NPCID.Krampus, - NPCID.Nutcracker, - NPCID.NutcrackerSpinning, - NPCID.PresentMimic, - NPCID.Yeti, - NPCID.ZombieElf, - NPCID.ZombieElfBeard, - NPCID.ZombieElfGirl, - NPCID.BloodEelHead, - NPCID.GoblinShark, - NPCID.EyeballFlyingFish, - NPCID.ZombieMerman - }; - - BoundNPCIDs = new List - { - NPCID.BoundGoblin, - NPCID.BoundWizard, - NPCID.BoundMechanic, - NPCID.SleepingAngler, - NPCID.BartenderUnconscious, - NPCID.WebbedStylist, - NPCID.GolferRescue - }; - - // Collections - BossRushHPChanges = new SortedDictionary - { - // Tier 1 - { NPCID.KingSlime, 300000 }, // 30 seconds - { NPCID.BlueSlime, 3600 }, - { NPCID.SlimeSpiked, 7200 }, - { NPCID.GreenSlime, 2700 }, - { NPCID.RedSlime, 5400 }, - { NPCID.PurpleSlime, 7200 }, - { NPCID.YellowSlime, 6300 }, - { NPCID.IceSlime, 4500 }, - { 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 }, - { NPCID.EaterofWorldsTail, 10000 }, - - { NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers - { 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 - - { NPCID.SkeletronHead, 150000 }, // 30 seconds - { NPCID.SkeletronHand, 60000 }, - - { 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 - { NPCID.QueenSlimeMinionBlue, 6000 }, - { NPCID.QueenSlimeMinionPink, 6000 }, - { NPCID.QueenSlimeMinionPurple, 5000 }, - - { NPCID.Spazmatism, 150000 }, // 30 seconds - { NPCID.Retinazer, 125000 }, - { NPCType(), 137500 }, - - { NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start - { NPCID.TheDestroyerBody, 250000 }, - { NPCID.TheDestroyerTail, 250000 }, - { 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, 5000 }, - { NPCType(), 5000 }, - - // Tier 3 - { NPCID.Golem, 50000 }, // 30 seconds - { NPCID.GolemHead, 30000 }, - { NPCID.GolemHeadFree, 30000 }, - { NPCID.GolemFistLeft, 25000 }, - { NPCID.GolemFistRight, 25000 }, - - { NPCID.HallowBoss, 200000 }, // 30 seconds - - { NPCID.DukeFishron, 290000 }, // 30 seconds - - { NPCID.CultistBoss, 220000 }, // 30 seconds - { NPCID.CultistDragonHead, 60000 }, - { NPCID.CultistDragonBody1, 60000 }, - { NPCID.CultistDragonBody2, 60000 }, - { NPCID.CultistDragonBody3, 60000 }, - { NPCID.CultistDragonBody4, 60000 }, - { NPCID.CultistDragonTail, 60000 }, - { NPCID.AncientCultistSquidhead, 50000 }, - - { NPCID.MoonLordCore, 160000 }, // 1 minute - { NPCID.MoonLordHand, 45000 }, - { NPCID.MoonLordHead, 60000 }, - { NPCID.MoonLordLeechBlob, 800 } - - // 9.5 minutes in total for vanilla Boss Rush bosses - }; - - BossValues = new SortedDictionary - { - { NPCID.KingSlime, Item.buyPrice(0, 5) }, - { NPCID.EyeofCthulhu, Item.buyPrice(0, 10) }, - { NPCID.QueenBee, Item.buyPrice(0, 15) }, - { NPCID.SkeletronHead, Item.buyPrice(0, 20) }, - { NPCID.Deerclops, Item.buyPrice(0, 20) }, - { NPCID.WallofFlesh, Item.buyPrice(0, 25) }, - { NPCID.QueenSlimeBoss, Item.buyPrice(0, 30) }, - { NPCID.Spazmatism, Item.buyPrice(0, 40) }, - { NPCID.Retinazer, Item.buyPrice(0, 40) }, - { NPCID.TheDestroyer, Item.buyPrice(0, 40) }, - { NPCID.SkeletronPrime, Item.buyPrice(0, 40) }, - { NPCID.Plantera, Item.buyPrice(0, 50) }, - { NPCID.HallowBoss, Item.buyPrice(0, 60) }, - { NPCID.Golem, Item.buyPrice(0, 60) }, - { NPCID.DukeFishron, Item.buyPrice(0, 75) }, - { NPCID.CultistBoss, Item.buyPrice(1) }, - { NPCID.MoonLordCore, Item.buyPrice(1, 50) } - }; - - bossTypes = new SortedDictionary() - { - { NPCID.KingSlime, 1 }, - { NPCType(), 2 }, - { NPCID.EyeofCthulhu, 3 }, - { NPCType(), 4 }, - { NPCID.EaterofWorldsHead, 5 }, - { NPCID.EaterofWorldsBody, 5 }, - { NPCID.EaterofWorldsTail, 5 }, - { NPCID.BrainofCthulhu, 6 }, - { NPCType(), 7 }, - { NPCType(), 8 }, - { NPCID.QueenBee, 9 }, - { NPCID.SkeletronHead, 10 }, - { NPCType(), 11 }, - { NPCType(), 11 }, - { NPCType(), 11 }, - { NPCID.WallofFlesh, 12 }, - { NPCType(), 13 }, - { NPCID.Retinazer, 14 }, - { NPCID.Spazmatism, 14 }, - { NPCType(), 15 }, - { NPCID.TheDestroyer, 16 }, - { NPCType(), 17 }, - { NPCID.SkeletronPrime, 18 }, - { NPCType(), 19 }, - { NPCID.Plantera, 20 }, - { NPCType(), 21 }, - { NPCType(), 21 }, - { NPCType(), 22 }, - { NPCID.Golem, 23 }, - { NPCType(), 24 }, - { NPCID.DukeFishron, 25 }, - { NPCType(), 26 }, - { NPCID.CultistBoss, 27 }, - { NPCType(), 28 }, - { NPCID.MoonLordCore, 29 }, - { NPCType(), 30 }, - { NPCType(), 31 }, - { NPCType(), 32 }, - { NPCType(), 33 }, - { NPCType(), 34 }, - { NPCType(), 35 }, - { NPCType(), 36 }, - { NPCType(), 37 }, - { NPCType(), 38 }, - { NPCType(), 39 }, - { NPCType(), 40 }, - { NPCType(), 41 }, - { NPCType(), 41 }, - { NPCType(), 41 }, - { NPCType(), 41 }, - { NPCID.QueenSlimeBoss, 42 }, - { NPCID.HallowBoss, 43 }, - { NPCID.Deerclops, 44 } - }; - - legOverrideList = new List() - { - EquipLoader.GetEquipSlot(CalamityMod.Instance, "ProfanedSoulCrystal", EquipType.Legs), - EquipLoader.GetEquipSlot(CalamityMod.Instance, "AquaticHeart", EquipType.Legs), - //CalamityMod.Instance.GetEquipSlot("SirenLeg", EquipType.Legs), whate even was SirenLeg vs SirenLegAlt? - EquipLoader.GetEquipSlot(CalamityMod.Instance, "Popo", EquipType.Legs) - }; - - // Duke Fishron and Old Duke phase 3 becomes way too easy if you can make him stop being invisible with Yanmei's Knife. - // This is a list so that other NPCs can be added as necessary. - // IT DOES NOT make them immune to the debuff, just stops them from being recolored. - kamiDebuffColorImmuneList = new List() - { - NPCID.DukeFishron, - NPCType() - }; - - EncryptedSchematicIDRelationship = new Dictionary() - { - [1] = ItemType(), - [2] = ItemType(), - [3] = ItemType(), - [4] = ItemType(), - }; - - DisabledSummonerNerfItems = new(); - DisabledSummonerNerfMinions = new(); - - VeneratedLocketBanlist = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - }; - } - - public static void UnloadLists() - { - donatorList = null; - projectileDestroyExceptionList = null; - enemyImmunityList = null; - confusionEnemyList = null; - dungeonEnemyBuffList = null; - dungeonProjectileBuffList = null; - bossHPScaleList = null; - friendlyBeeList = null; - debuffList = null; - fireDebuffList = null; - sicknessDebuffList = null; - alcoholList = null; - spearAutoreuseList = null; - pumpkinMoonBuffList = null; - frostMoonBuffList = null; - eclipseBuffList = null; - eventProjectileBuffList = null; - noRageWormSegmentList = null; - needsDebuffIconDisplayList = null; - scopedWeaponList = null; - highTestFishList = null; - forceItemList = null; - livingFireBlockList = null; - amalgamBuffList = null; - persistentBuffList = null; - MagicGunIDs = null; - MushroomWeaponIDs = null; - MushroomProjectileIDs = null; - BlacklistedWeaponsWithToolPower = null; - - zombieList = null; - demonEyeList = null; - skeletonList = null; - angryBonesList = null; - hornetList = null; - mossHornetList = null; - minibossList = null; - pierceResistList = null; - pierceResistExceptionLeviAureusList = null; - pierceResistExceptionList = null; - - AstrumDeusIDs = null; - DevourerOfGodsIDs = null; - CosmicGuardianIDs = null; - AquaticScourgeIDs = null; - PerforatorIDs = null; - DesertScourgeIDs = null; - EaterofWorldsIDs = null; - SlimeGodIDs = null; - DeathModeSplittingWormIDs = null; - DestroyerIDs = null; - ThanatosIDs = null; - AresIDs = null; - SkeletronPrimeIDs = null; - StormWeaverIDs = null; - RavagerIDs = null; - GolemIDs = null; - BoundNPCIDs = null; - GrenadeResistIDs = null; - ZeroContactDamageNPCList = null; - HardmodeNPCNerfList = null; - - BossRushHPChanges?.Clear(); - BossRushHPChanges = null; - BossValues?.Clear(); - BossValues = null; - bossTypes?.Clear(); - bossTypes = null; - - legOverrideList = null; - - kamiDebuffColorImmuneList = null; - - EncryptedSchematicIDRelationship = null; - - DisabledSummonerNerfItems = null; - DisabledSummonerNerfMinions = null; - - VeneratedLocketBanlist = null; - } - } -} diff --git a/CalamityMod.cs b/CalamityMod.cs index a2417977f0..04444e41f5 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1,70 +1,14 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; -using CalamityMod.Balancing; -using CalamityMod.CalPlayer; -using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Cooldowns; -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; -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.Crabulon; -using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Artemis; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Leviathan; -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; -using CalamityMod.NPCs.Signus; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.Yharon; using CalamityMod.Particles; using CalamityMod.Projectiles; -using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Schematics; -using CalamityMod.Skies; -using CalamityMod.UI; -using CalamityMod.UI.CalamitasEnchants; -using CalamityMod.UI.DraedonsArsenal; -using CalamityMod.UI.Rippers; -using CalamityMod.Waters; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.GameContent; -using Terraria.GameContent.Dyes; -using Terraria.Graphics.Effects; -using Terraria.Graphics.Shaders; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Config; @@ -74,408 +18,53 @@ namespace CalamityMod { public class CalamityMod : Mod { - // TODO -- A huge amount of random floating variables exist here. - // These should all be moved to other files, whether that's CalamityLists or brand new ModSystems. - // It is best to have a ton of small ModSystems. - - // Boss Spawners - public static int ghostKillCount = 0; - public static int sharkKillCount = 0; - - public static Asset carpetOriginal; - - // Astral Sky/BG - public static Texture2D AstralSky; - public static Texture2D AstralSurfaceFront; - public static Texture2D AstralSurfaceFrontGlow; - public static Texture2D AstralSurfaceClose; - public static Texture2D AstralSurfaceCloseGlow; - public static Texture2D AstralSurfaceMiddle; - public static Texture2D AstralSurfaceMiddleGlow; - - // Astral Desert Sky/BG - public static Texture2D AstralDesertSurfaceClose; - public static Texture2D AstralDesertSurfaceMiddle; - - // Astral Snow Sky/BG - public static Texture2D AstralSnowSurfaceMiddle; - - // Sulphur Sea Sky/BG - public static Texture2D SulphurSeaSky; - public static Texture2D SulphurSeaSkyFront; - public static Texture2D SulphurSeaSurface; - - // Destroyer glowmasks - public static Asset[] DestroyerGlowmasks = new Asset[3]; - - // Probe glowmask - public static Asset ProbeGlowmask; - - // 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; - - // Speedrun timer - internal static Stopwatch SpeedrunTimer = new Stopwatch(); - + #region External Flags // 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; + // External flag to disable Defense Damage + // This can be edited by other mods using reflection if desired + // Note that this flag trumps Bloodflare Core and will stop that accessory from working properly. + // There is also a means to disable defense damage on a per-player basis. + public static bool ExternalFlag_DisableDefenseDamage = false; + #endregion - // TODO -- Mod references should be contained in a ModSystem (example name "ModLoadedChecker") - - // This is Calamity's official music mod, CalamityModMusic. It is now a hard dependency. - internal Mod musicMod = null; - internal bool MusicAvailable => musicMod is not null; - - // This is Vanilla Calamity Mod Music, internally named UnCalamityModMusic. - // VCMM is an official music add-on. Unlike the main music mod, it is not a dependency. - internal Mod vcmm = null; - internal bool VCMMAvailable => vcmm is not null; - - // 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; - internal Mod soa = null; - internal Mod subworldLibrary = null; - internal Mod summonersAssociation = null; - internal Mod thorium = null; - internal Mod varia = null; - internal Mod wikithis = null; - - //hell background - //private List loadCache; + internal static CalamityMod Instance => _Instance ??= ModContent.GetInstance(); + private static CalamityMod _Instance; #region Load public override void Load() { - Instance = this; - - carpetOriginal = TextureAssets.FlyingCarpet; - - // If any of these mods aren't loaded, it will simply keep them as null. - musicMod = null; - ModLoader.TryGetMod("CalamityModMusic", out musicMod); - vcmm = null; - ModLoader.TryGetMod("UnCalamityModMusic", out vcmm); - - ancientsAwakened = null; - 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; - ModLoader.TryGetMod("TerrariaOverhaul", out overhaul); - redemption = null; - ModLoader.TryGetMod("Redemption", out redemption); - soa = null; - ModLoader.TryGetMod("SacredTools", out soa); - subworldLibrary = null; - ModLoader.TryGetMod("SubworldLibrary", out subworldLibrary); - summonersAssociation = null; - ModLoader.TryGetMod("SummonersAssociation", out summonersAssociation); - thorium = null; - ModLoader.TryGetMod("ThoriumMod", out thorium); - varia = null; - ModLoader.TryGetMod("Varia", out varia); - wikithis = null; - ModLoader.TryGetMod("Wikithis", out wikithis); - // Initialize the EnemyStats struct as early as it is safe to do so NPCStats.Load(); - // Initialize Calamity Lists so they may be used elsewhere immediately - CalamityLists.LoadLists(); - - // Initialize Calamity Balance, since it is tightly coupled with the remaining lists + // Initialize Calamity Balance, since it is tightly coupled with the remaining systems CalamityGlobalItem.LoadTweaks(); CalamityGlobalProjectile.LoadTweaks(); - // Mount balancing occurs during runtime and is undone when Calamity is unloaded. - Mount.mounts[MountID.Unicorn].dashSpeed *= CalamityPlayer.UnicornSpeedNerfPower; - Mount.mounts[MountID.Unicorn].runSpeed *= CalamityPlayer.UnicornSpeedNerfPower; - - // Buff DCU's pickaxe power to equal PML pickaxe capabilities - Mount.drillPickPower = 225; - - // Make Graveyard biomes require more Gravestones - SceneMetrics.GraveyardTileMax = 60; - SceneMetrics.GraveyardTileMin = 40; - SceneMetrics.GraveyardTileThreshold = 52; - if (!Main.dedServ) { - LoadClient(); - GeneralParticleHandler.Load(); - PrimitiveRenderer.Initialize(); - ForegroundDrawing.ForegroundManager.Load(); - - // Wikithis support - WeakReferenceSupport.WikiThisSupport(); + // This must be done separately from immediate loading, as loading is now multithreaded. + // However, render targets and certain other graphical objects can only be created on the main thread. + Main.QueueMainThreadAction(() => Main.OnPreDraw += PrepareRenderTargets); } - - CooldownRegistry.Load(); - BossRushEvent.Load(); - // TODO -- As ModBossBarStyle is a ModType, its Load function does not need to be called directly here. - BossHealthBarManager.Load(this); - EnchantmentManager.LoadAllEnchantments(); - VanillaArmorChangeManager.Load(); - SetupVanillaDR(); - SetupBossKillTimes(); - SchematicManager.Load(); - CustomLavaManagement.Load(); - Attunement.Load(); - BalancingChangesManager.Load(); - BaseIdleHoldoutProjectile.LoadAll(); - PlayerDashManager.Load(); - } - - private void LoadClient() - { - // Astral Sky/BG - AstralSky = ModContent.Request("CalamityMod/Skies/AstralSky", 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/Backgrounds/AstralDesertSurfaceClose", AssetRequestMode.ImmediateLoad).Value; - AstralDesertSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralDesertSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; - - //Astral Snow Sky/BG - AstralSnowSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralSnowSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; - - // 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); - - // Probe glowmask - ProbeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/ProbeGlow", 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(); - - Filters.Scene["CalamityMod:CalamitasRun3"] = new Filter(new CalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.6f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:CalamitasRun3"] = new CalSky(); - - Filters.Scene["CalamityMod:PlaguebringerGoliath"] = new Filter(new PbGScreenShaderData("FilterMiniTower").UseColor(0.2f, 0.6f, 0.2f).UseOpacity(0.35f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:PlaguebringerGoliath"] = new PbGSky(); - - Filters.Scene["CalamityMod:Yharon"] = new Filter(new YScreenShaderData("FilterMiniTower").UseColor(1f, 0.4f, 0f).UseOpacity(0.75f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Yharon"] = new YSky(); - - 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(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); - SkyManager.Instance["CalamityMod:Signus"] = new SignusSky(); - - Filters.Scene["CalamityMod:BossRush"] = new Filter(new BossRushScreenShader("FilterMiniTower").UseOpacity(0.75f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:BossRush"] = new BossRushSky(); - - Filters.Scene["CalamityMod:ExoMechs"] = new Filter(new ExoMechsScreenShaderData("FilterMiniTower").UseColor(ExoMechsSky.DrawColor).UseOpacity(0.25f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:ExoMechs"] = new ExoMechsSky(); - - Filters.Scene["CalamityMod:MonolithAccursed"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:MonolithAccursed"] = new MonolithSky(); - - // Normal intensity is 4f - Texture2D DistortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/BlobbyNoise", AssetRequestMode.ImmediateLoad).Value; - Filters.Scene["CalamityMod:DrunkCrabulon"] = new Filter(new DrunkCrabScreenShaderData("FilterHeatDistortion").UseImage(DistortionTexture, 0, null).UseIntensity(20f), EffectPriority.VeryHigh); - - Filters.Scene["CalamityMod:BrimstoneCrag"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0f).UseOpacity(0f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:BrimstoneCrag"] = new BrimstoneCragSky(); - - SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); - SkyManager.Instance["CalamityMod:SulphurSea"] = new SulphurSeaSky(); - SkyManager.Instance["CalamityMod:Cryogen"] = new CryogenSky(); - SkyManager.Instance["CalamityMod:StormWeaverFlash"] = new StormWeaverFlashSky(); - - CalamityShaders.LoadShaders(); - - // This must be done separately from immediate loading, as loading is now multithreaded. - // However, render targets and certain other graphical objects can only be created on the main thread. - Main.QueueMainThreadAction(() => - { - Main.OnPreDraw += PrepareRenderTargets; - }); - - RipperUI.Load(); - StealthUI.Load(); - ChargeMeterUI.Load(); - FlightBar.Load(); - - // TODO -- Is this not possible to place in ModNPC.Load or ModNPC.SetStaticDefaults ? - // Centralizing head texture registration like this seems absurdly stiff - Apollo.LoadHeadIcons(); - Artemis.LoadHeadIcons(); - Cryogen.LoadHeadIcons(); - DevourerofGodsHead.LoadHeadIcons(); - DevourerofGodsBody.LoadHeadIcons(); - DevourerofGodsTail.LoadHeadIcons(); - HiveMind.LoadHeadIcons(); - Polterghast.LoadHeadIcons(); - StormWeaverHead.LoadHeadIcons(); - SupremeCalamitas.LoadHeadIcons(); - ThanatosHead.LoadHeadIcons(); - ThanatosBody1.LoadHeadIcons(); - ThanatosBody2.LoadHeadIcons(); - ThanatosTail.LoadHeadIcons(); - - // TODO -- Is this not possible to place in ModItem.Load or ModItem.SetStaticDefaults ? - // Centralizing hair dye shaders like this seems absurdly stiff - GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax)))); - GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax)))); - GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => - { - float flightTimeInterpolant = player.wingTime / player.wingTimeMax; - if (player.mount.Active) - flightTimeInterpolant = 1f; - else if (float.IsInfinity(flightTimeInterpolant) || float.IsNaN(flightTimeInterpolant)) - flightTimeInterpolant = 0f; - - return Color.Lerp(player.hairColor, new Color(139, 205, 255), flightTimeInterpolant); - })); - GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => - { - float stealthInterpolant = player.Calamity().rogueStealth / player.Calamity().rogueStealthMax; - if (float.IsInfinity(stealthInterpolant) || float.IsNaN(stealthInterpolant)) - stealthInterpolant = 0f; - - return Color.Lerp(player.hairColor, new Color(186, 85, 211), stealthInterpolant); - })); - - InvasionProgressUIManager.LoadGUIs(); } #endregion #region Unload public override void Unload() { - musicMod = null; - vcmm = null; - - ancientsAwakened = null; - bossChecklist = null; - coloredDamageTypes = null; - crouchMod = null; - dialogueTweak = null; - fargos = null; - luminance = null; - magicStorage = null; - overhaul = null; - redemption = null; - soa = null; - subworldLibrary = null; - summonersAssociation = null; - thorium = null; - varia = null; - wikithis = null; - - AstralSky = null; - - DRValues?.Clear(); - DRValues = null; - bossKillTimes?.Clear(); - bossKillTimes = null; - - BalancingChangesManager.Unload(); - Attunement.Unload(); - EnchantmentManager.UnloadAllEnchantments(); - VanillaArmorChangeManager.Unload(); - CalamityLists.UnloadLists(); NPCStats.Unload(); CalamityGlobalItem.UnloadTweaks(); CalamityGlobalProjectile.UnloadTweaks(); - PopupGUIManager.UnloadGUIs(); - InvasionProgressUIManager.UnloadGUIs(); - BossRushEvent.Unload(); - SchematicManager.Unload(); - CustomLavaManagement.Unload(); - CooldownRegistry.Unload(); - PlayerDashManager.Unload(); - Main.QueueMainThreadAction(() => { Main.OnPreDraw -= PrepareRenderTargets; }); - RipperUI.Unload(); - StealthUI.Unload(); - ChargeMeterUI.Unload(); - FlightBar.Unload(); - - if (!Main.dedServ) - { - TextureAssets.FlyingCarpet = carpetOriginal; - GeneralParticleHandler.Unload(); - } - - Mount.mounts[MountID.Unicorn].dashSpeed /= CalamityPlayer.UnicornSpeedNerfPower; - Mount.mounts[MountID.Unicorn].runSpeed /= CalamityPlayer.UnicornSpeedNerfPower; - - Mount.drillPickPower = 210; - - SceneMetrics.GraveyardTileMax = 36; - SceneMetrics.GraveyardTileMin = 16; - SceneMetrics.GraveyardTileThreshold = 28; - - carpetOriginal = null; - - Instance = null; + _Instance = null; base.Unload(); } #endregion @@ -489,258 +78,18 @@ namespace CalamityMod } #endregion Render Target Management - #region Force ModConfig save (Reflection) - internal static void SaveConfig(CalamityConfig cfg) - { - // There is no current way to manually save a mod configuration file in tModLoader. - // The method which saves mod config files is private in ConfigManager, so reflection is used to invoke it. - try - { - MethodInfo saveMethodInfo = typeof(ConfigManager).GetMethod("Save", BindingFlags.Static | BindingFlags.NonPublic); - if (saveMethodInfo is not null) - saveMethodInfo.Invoke(null, new object[] { cfg }); - else - Instance.Logger.Error("TML ConfigManager.Save reflection failed. Method signature has changed. Notify Calamity Devs if you see this in your log."); - } - catch - { - Instance.Logger.Error("An error occurred while manually saving Calamity mod configuration. This may be due to a complex mod conflict. It is safe to ignore this error."); - } - } - #endregion - - #region Vanilla Enemy DR - private void SetupVanillaDR() - { - DRValues = new SortedDictionary { - { NPCID.AngryBonesBig, 0.2f }, - { NPCID.AngryBonesBigHelmet, 0.2f }, - { NPCID.AngryBonesBigMuscle, 0.2f }, - { NPCID.AnomuraFungus, 0.1f }, - { NPCID.Antlion, 0.1f }, - { NPCID.Arapaima, 0.1f }, - { NPCID.ArmoredSkeleton, 0.15f }, - { NPCID.ArmoredViking, 0.1f }, - { NPCID.BigMimicCorruption, 0.3f }, - { NPCID.BigMimicCrimson, 0.3f }, - { NPCID.BigMimicHallow, 0.3f }, - { NPCID.BigMimicJungle, 0.3f }, // unused vanilla enemy - { NPCID.BlueArmoredBones, 0.2f }, - { NPCID.BlueArmoredBonesMace, 0.2f }, - { NPCID.BlueArmoredBonesNoPants, 0.2f }, - { NPCID.BlueArmoredBonesSword, 0.2f }, - { NPCID.BoneLee, 0.2f }, - { NPCID.Crab, 0.05f }, - { NPCID.Crawdad, 0.2f }, - { NPCID.Crawdad2, 0.2f }, - { NPCID.CultistBoss, 0.15f }, - { NPCID.Deerclops, 0.05f }, - { NPCID.DD2Betsy, 0.1f }, - { NPCID.DD2OgreT2, 0.1f }, - { NPCID.DD2OgreT3, 0.15f }, - { NPCID.DeadlySphere, 0.4f }, - { NPCID.DiabolistRed, 0.2f }, - { NPCID.DiabolistWhite, 0.2f }, - { NPCID.DukeFishron, 0.15f }, - { NPCID.DungeonGuardian, 0.9f }, - { NPCID.DungeonSpirit, 0.2f }, - { NPCID.ElfCopter, 0.15f }, - { NPCID.Everscream, 0.1f }, - { NPCID.FlyingAntlion, 0.05f }, - { NPCID.GiantCursedSkull, 0.2f }, - { NPCID.GiantShelly, 0.2f }, - { NPCID.GiantShelly2, 0.2f }, - { NPCID.GiantTortoise, 0.35f }, - { NPCID.Golem, 0.25f }, - { NPCID.GolemFistLeft, 0.25f }, - { NPCID.GolemFistRight, 0.25f }, - { NPCID.GolemHead, 0.25f }, - { NPCID.GolemHeadFree, 0.25f }, - { NPCID.GraniteFlyer, 0.1f }, - { NPCID.GraniteGolem, 0.15f }, - { NPCID.GreekSkeleton, 0.1f }, - { NPCID.HellArmoredBones, 0.2f }, - { NPCID.HellArmoredBonesMace, 0.2f }, - { NPCID.HellArmoredBonesSpikeShield, 0.2f }, - { NPCID.HellArmoredBonesSword, 0.2f }, - { NPCID.IceGolem, 0.1f }, - { NPCID.IceQueen, 0.1f }, - { NPCID.IceTortoise, 0.35f }, - { NPCID.HeadlessHorseman, 0.05f }, - { NPCID.MartianDrone, 0.2f }, - { NPCID.MartianSaucer, 0.2f }, - { NPCID.MartianSaucerCannon, 0.2f }, - { NPCID.MartianSaucerCore, 0.2f }, - { NPCID.MartianSaucerTurret, 0.2f }, - { NPCID.MartianTurret, 0.2f }, - { NPCID.MartianWalker, 0.35f }, - { NPCID.Mimic, 0.3f }, - { NPCID.MoonLordCore, 0.15f }, - { NPCID.MoonLordHand, 0.15f }, - { NPCID.MoonLordHead, 0.15f }, - { NPCID.Mothron, 0.2f }, - { NPCID.MothronEgg, 0.5f }, - { NPCID.MourningWood, 0.1f }, - { NPCID.Necromancer, 0.2f }, - { NPCID.NecromancerArmored, 0.2f }, - { NPCID.Paladin, 0.45f }, - { NPCID.PirateCaptain, 0.05f }, - { NPCID.PirateShipCannon, 0.15f }, - { NPCID.Plantera, 0.15f }, - { NPCID.PlanterasTentacle, 0.1f }, - { NPCID.HallowBoss, 0.15f }, - { NPCID.PossessedArmor, 0.25f }, - { NPCID.PresentMimic, 0.3f }, - { NPCID.PrimeCannon, 0.2f }, - { NPCID.PrimeLaser, 0.2f }, - { NPCID.PrimeSaw, 0.2f }, - { NPCID.PrimeVice, 0.2f }, - { NPCID.Probe, 0.2f }, - { NPCID.Pumpking, 0.1f }, - { NPCID.QueenBee, 0.05f }, - { NPCID.RaggedCaster, 0.2f }, - { NPCID.RaggedCasterOpenCoat, 0.2f }, - { NPCID.Retinazer, 0.2f }, - { NPCID.RustyArmoredBonesAxe, 0.2f }, - { NPCID.RustyArmoredBonesFlail, 0.2f }, - { NPCID.RustyArmoredBonesSword, 0.2f }, - { NPCID.RustyArmoredBonesSwordNoArmor, 0.2f }, - { NPCID.SandElemental, 0.1f }, - { NPCID.SantaNK1, 0.35f }, - { NPCID.SeaSnail, 0.05f }, - { NPCID.SkeletonArcher, 0.1f }, - { NPCID.SkeletonCommando, 0.2f }, - { NPCID.SkeletonSniper, 0.2f }, - { NPCID.SkeletronHand, 0.05f }, - { NPCID.SkeletronHead, 0.05f }, - { NPCID.SkeletronPrime, 0.2f }, - { NPCID.Spazmatism, 0.2f }, - { NPCID.TacticalSkeleton, 0.2f }, - { NPCID.TheDestroyer, 0.1f }, - { NPCID.TheDestroyerBody, 0.2f }, - { NPCID.TheDestroyerTail, 0.35f }, - { NPCID.TheHungry, 0.1f }, - { NPCID.UndeadViking, 0.1f }, - { NPCID.WalkingAntlion, 0.1f }, - { NPCID.WallofFlesh, 0.5f }, - }; - } - #endregion - - #region Boss Kill Times - private void SetupBossKillTimes() - { - // Kill times are measured exactly in frames. - // 60 frames = 1 second - // 3600 frames = 1 minute - bossKillTimes = new SortedDictionary { - // - // VANILLA BOSSES - // - { 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, 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) - { NPCID.SkeletronHead, 9000 }, // 2:30 (150 seconds) - { NPCID.WallofFlesh, 7200 }, // 2:00 (120 seconds) - { NPCID.WallofFleshEye, 7200 }, - { NPCID.QueenSlimeBoss, 7200 }, // 2:00 (120 seconds) - { NPCID.Spazmatism, 10800 }, // 3:00 (180 seconds) - { NPCID.Retinazer, 10800 }, - { NPCID.TheDestroyer, 10800 }, // 3:00 (180 seconds) - { NPCID.TheDestroyerBody, 10800 }, - { NPCID.TheDestroyerTail, 10800 }, - { NPCID.SkeletronPrime, 10800 }, // 3:00 (180 seconds) - { NPCID.Plantera, 10800 }, // 3:00 (180 seconds) - { NPCID.HallowBoss, 10800 }, // 3:00 (180 seconds) - { NPCID.Golem, 9000 }, // 2:30 (150 seconds) - { NPCID.GolemHead, 3600 }, // 1:00 (60 seconds) - { NPCID.DukeFishron, 9000 }, // 2:30 (150 seconds) - { NPCID.CultistBoss, 9000 }, // 2:30 (150 seconds) - { NPCID.MoonLordCore, 14400 }, // 4:00 (240 seconds) - { NPCID.MoonLordHand, 7200 }, // 2:00 (120 seconds) - { NPCID.MoonLordHead, 7200 }, // 2:00 (120 seconds) - - // - // CALAMITY BOSSES - // - { 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) - { ModContent.NPCType(), 9000 }, // 2:30 (150 seconds) -- total length of Slime God fight - { ModContent.NPCType(), 4500 }, // 1:15 (75 seconds) - { ModContent.NPCType(), 4500 }, // 1:15 (75 seconds) - { ModContent.NPCType(), 4500 }, // 1:15 (75 seconds) -- split slimes should spawn at 1:15 and die at around 2:30 - { ModContent.NPCType(), 4500 }, // 1:15 (75 seconds) - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) - { ModContent.NPCType(), 9000 }, // 2:30 (150 seconds) - { ModContent.NPCType(), 9000 }, - { ModContent.NPCType(), 9000 }, - { ModContent.NPCType(), 9000 }, - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) - { ModContent.NPCType(), 14400 }, // 4:00 (240 seconds) - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) - { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) -- first phase is 1:00 - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) - { ModContent.NPCType(), 5400 }, // 1:30 (90 seconds) - { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) - { ModContent.NPCType(), 14400 }, // 4:00 (240 seconds) - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) - { ModContent.NPCType(), 1200 }, // 0:20 (20 seconds) - { ModContent.NPCType(), 8100 }, // 2:15 (135 seconds) - { ModContent.NPCType(), 8100 }, - { ModContent.NPCType(), 8100 }, - { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) - { ModContent.NPCType(), 14400 }, // 4:00 (240 seconds) - { ModContent.NPCType(), 14400 }, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30 - { ModContent.NPCType(), 14400 }, - { ModContent.NPCType(), 14700 }, // 4:05 (245 seconds) -- he spends 5 seconds invincible where you can't do anything - { ModContent.NPCType(), 21600 }, // 6:00 (360 seconds) - { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 21600 }, // 6:00 (360 seconds) - { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 21600 }, // 6:00 (360 seconds) - { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 18000 }, // 5:00 (300 seconds) - { ModContent.NPCType(), 18000 } // 5:00 (300 seconds) - }; - } - #endregion - #region Music // This function returns an available Calamity Music Mod track, or null if the Calamity Music Mod is not available. - public int? GetMusicFromMusicMod(string songFilename) => MusicAvailable ? MusicLoader.GetMusicSlot(musicMod, "Sounds/Music/" + songFilename) : null; + public int? GetMusicFromMusicMod(string songFilename) => ExternalMods.MusicAvailable ? MusicLoader.GetMusicSlot(ExternalMods.musicMod, "Sounds/Music/" + songFilename) : null; // This function returns an available VCMM track, or null if VCMM is not available. // Unlike the main Music Mod, VCMM is hierarchical. - public int? GetMusicFromVCMM(string songPath) => VCMMAvailable ? MusicLoader.GetMusicSlot(vcmm, "Assets/" + songPath) : null; + public int? GetMusicFromVCMM(string songPath) => ExternalMods.VCMMAvailable ? MusicLoader.GetMusicSlot(ExternalMods.vcmm, "Assets/" + songPath) : null; #endregion #region Mod Support - public override void PostSetupContent() => WeakReferenceSupport.Setup(); - public override object Call(params object[] args) => ModCalls.Call(args); #endregion @@ -775,16 +124,6 @@ namespace CalamityMod } #endregion - #region Stop Rain - public static void StopRain() - { - if (!Main.raining) - return; - Main.raining = false; - CalamityNetcode.SyncWorld(); - } - #endregion - #region Netcode public override void HandlePacket(BinaryReader reader, int whoAmI) => CalamityNetcode.HandlePacket(this, reader, whoAmI); #endregion diff --git a/CalamityMod.csproj b/CalamityMod.csproj new file mode 100644 index 0000000000..5aadf21dce --- /dev/null +++ b/CalamityMod.csproj @@ -0,0 +1,13 @@ + + + + + CalamityMod + net8.0 + AnyCPU + latest + + + + + \ No newline at end of file diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index c498f8c37c..b40c85cbda 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -1,11 +1,18 @@ using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices.JavaScript; using CalamityMod.Events; using CalamityMod.Items; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Packets; using CalamityMod.Systems; using CalamityMod.TileEntities; using CalamityMod.World; @@ -14,311 +21,104 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.Core; namespace CalamityMod { - public class CalamityNetcode + public class CalamityNetcode : ModSystem { + private static CalamityPacket[] _PacketRegistry; + + public override void OnModLoad() + { + _PacketRegistry = new CalamityPacket[256]; // This should allow to use 0-255 range (full byte range) + + ReflectionHelper.IterateEveryModsTypes(action: type => + { + try + { + if (Activator.CreateInstance(type) is not CalamityPacket packetHandler) + return; + + var msgType = packetHandler.MessageType; + var existingHandler = _PacketRegistry[msgType]; + if (existingHandler != null) + { + CalamityMod.Instance.Logger.Error($"Packet instance has already registered by other type!" + + $" [Failed On: '{type.FullName}'" + + $" Current Owner: '{existingHandler.GetType().FullName}'," + + $" msgTypeToRegister: '{msgType}']"); + return; + } + + _PacketRegistry[packetHandler.MessageType] = packetHandler; + + var instanceProperty = type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic); + if (instanceProperty is not null) + { + if (instanceProperty.PropertyType.IsAssignableFrom(type)) + { + instanceProperty.SetValue(null, packetHandler); + packetHandler._Prop_Static_Instance = instanceProperty; // We saving this for Unload Steps + } + else + { + CalamityMod.Instance.Logger.Error($"Packet instance's 'Instance' property is not asssignable with given type!" + + $" [Failed On: '{type.FullName}']"); + } + } + + // We should not print error message if "Instance" property is missing + // Addons still can assign them with OnLoaded overload, and it's up to their implementation + // Still, Calamity's Standard is having "Instance" property for every packet types + + packetHandler.OnLoaded(); + } + catch (Exception e) + { + CalamityMod.Instance.Logger.Error($"Exception was thrown while loading for Packets! {e}"); + return; + } + }); + } + + public override void OnModUnload() + { + if (_PacketRegistry is not null) + { + foreach (var packetHandler in _PacketRegistry) + { + if (packetHandler is null) + continue; + + packetHandler.OnUnloaded(); + packetHandler._Prop_Static_Instance?.SetValue(null, null); + packetHandler._Prop_Static_Instance = null; + } + + _PacketRegistry = null; + } + } + public static void HandlePacket(Mod mod, BinaryReader reader, int whoAmI) { try { CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); - switch (msgType) + var packetHandler = _PacketRegistry[(byte)msgType]; + if (packetHandler is not null) + { + packetHandler.HandlePacket(in reader, whoAmI); + } + else { - // - // Player mechanic syncs - // - - case CalamityModMessageType.DefenseDamageSync: - Main.player[reader.ReadInt32()].Calamity().HandleDefenseDamage(reader); - break; - case CalamityModMessageType.RageSync: - Main.player[reader.ReadInt32()].Calamity().HandleRage(reader); - break; - case CalamityModMessageType.AdrenalineSync: - Main.player[reader.ReadInt32()].Calamity().HandleAdrenaline(reader); - break; - case CalamityModMessageType.CooldownAddition: - Main.player[reader.ReadInt32()].Calamity().HandleCooldownAddition(reader); - break; - case CalamityModMessageType.CooldownRemoval: - Main.player[reader.ReadInt32()].Calamity().HandleCooldownRemoval(reader); - break; - case CalamityModMessageType.SyncCooldownDictionary: - Main.player[reader.ReadInt32()].Calamity().HandleCooldownDictionary(reader); - break; - - // - // 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 - byte npcIdx = reader.ReadByte(); - float ai0 = reader.ReadSingle(); - float ai1 = reader.ReadSingle(); - float ai2 = reader.ReadSingle(); - float ai3 = reader.ReadSingle(); - - // If the NPC in question isn't valid, don't do anything. - NPC npc = Main.npc[npcIdx]; - if (!npc.active) - break; - - CalamityGlobalNPC cgn = npc.Calamity(); - cgn.newAI[0] = ai0; - cgn.newAI[1] = ai1; - cgn.newAI[2] = ai2; - cgn.newAI[3] = ai3; - break; - - case CalamityModMessageType.SyncVanillaNPCLocalAIArray: - // Read the entire packet regardless of anything - byte npcIdx2 = reader.ReadByte(); - float localAI0 = reader.ReadSingle(); - float localAI1 = reader.ReadSingle(); - float localAI2 = reader.ReadSingle(); - float localAI3 = reader.ReadSingle(); - - // If the NPC in question isn't valid, don't do anything. - NPC npc2 = Main.npc[npcIdx2]; - if (!npc2.active) - break; - - npc2.localAI[0] = localAI0; - npc2.localAI[1] = localAI1; - npc2.localAI[2] = localAI2; - npc2.localAI[3] = localAI3; - break; - - case CalamityModMessageType.SpawnSuperDummy: - int x = reader.ReadInt32(); - int y = reader.ReadInt32(); - // Not strictly necessary, but helps prevent unnecessary packetstorm in MP - 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); - } - 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(); - break; - - // - // General syncs for entities - // - - case CalamityModMessageType.SpawnNPCOnPlayer: - x = reader.ReadInt32(); - y = reader.ReadInt32(); - int npcType = reader.ReadInt32(); - int player = reader.ReadInt32(); - Vector2 spawnPosition = reader.ReadVector2(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int spawnedNPC = NPC.NewNPC(new EntitySource_WorldEvent(), x, y, npcType, Target: player); - NetMessage.SendData(MessageID.SyncNPC, -1, player, null, spawnedNPC); - } - break; - - case CalamityModMessageType.SyncNPCMotionDataToServer: - int npcIndex = reader.ReadInt32(); - Vector2 center = reader.ReadVector2(); - Vector2 velocity = reader.ReadVector2(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.npc[npcIndex].Center = center; - Main.npc[npcIndex].velocity = velocity; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npcIndex); - } - break; - - // - // Tile Entities - // - - case CalamityModMessageType.UnlockAbyssChests: - Abyss.UnlockAllAbyssChests(); - break; - case CalamityModMessageType.PowerCellFactory: - TEPowerCellFactory.ReadSyncPacket(mod, reader); - break; - case CalamityModMessageType.ChargingStationStandard: - TEChargingStation.ReadSyncPacket(mod, reader); - break; - case CalamityModMessageType.ChargingStationItemChange: - TEChargingStation.ReadItemSyncPacket(mod, reader); - break; - case CalamityModMessageType.Turret: - TEBaseTurret.ReadSyncPacket(mod, reader); - break; - case CalamityModMessageType.LabHologramProjector: - TELabHologramProjector.ReadSyncPacket(mod, reader); - break; - case CalamityModMessageType.UpdateCodebreakerConstituents: - TECodebreaker.ReadConstituentsUpdateSync(mod, reader); - break; - case CalamityModMessageType.UpdateCodebreakerContainedStuff: - TECodebreaker.ReadContainmentSync(mod, reader); - break; - case CalamityModMessageType.UpdateCodebreakerDecryptCountdown: - TECodebreaker.ReadDecryptCountdownSync(mod, reader); - break; - - // - // Boss Rush - // - - case CalamityModMessageType.BossRushStage: - int stage = reader.ReadInt32(); - BossRushEvent.BossRushStage = stage; - break; - case CalamityModMessageType.BossRushStartTimer: - BossRushEvent.StartTimer = reader.ReadInt32(); - break; - case CalamityModMessageType.BossRushEndTimer: - BossRushEvent.EndTimer = reader.ReadInt32(); - break; - case CalamityModMessageType.EndBossRush: - BossRushEvent.EndEffects(); - break; - case CalamityModMessageType.BRHostileProjKillSync: - int countdown3 = reader.ReadInt32(); - BossRushEvent.HostileProjectileKillCounter = countdown3; - break; - - // - // Acid Rain - // - - case CalamityModMessageType.AcidRainSync: - AcidRainEvent.AcidRainEventIsOngoing = reader.ReadBoolean(); - AcidRainEvent.AccumulatedKillPoints = reader.ReadInt32(); - AcidRainEvent.TimeSinceLastAcidRainKill = reader.ReadInt32(); - break; - case CalamityModMessageType.AcidRainOldDukeSummonSync: - AcidRainEvent.HasTriedToSummonOldDuke = reader.ReadBoolean(); - break; - case CalamityModMessageType.EncounteredOldDukeSync: - AcidRainEvent.OldDukeHasBeenEncountered = reader.ReadBoolean(); - break; - - // - // Draedon Summoner stuff - // - case CalamityModMessageType.CodebreakerSummonStuff: - CalamityWorld.DraedonSummonCountdown = reader.ReadInt32(); - CalamityWorld.DraedonSummonPosition = reader.ReadVector2(); - CalamityWorld.DraedonMechdusa = reader.ReadBoolean(); - break; - case CalamityModMessageType.ExoMechSelection: - CalamityWorld.DraedonMechToSummon = (ExoMech)reader.ReadInt32(); - break; - - // - // Mouse control syncs - // - - case CalamityModMessageType.RightClickSync: - Main.player[reader.ReadInt32()].Calamity().HandleRightClick(reader); - break; - case CalamityModMessageType.MousePositionSync: - Main.player[reader.ReadInt32()].Calamity().HandleMousePosition(reader); - break; - - - // - // Difficulty syncs - // - - case CalamityModMessageType.SyncDifficulties: - int sender = reader.ReadInt32(); - CalamityWorld.revenge = reader.ReadBoolean(); - CalamityWorld.death = reader.ReadBoolean(); - //TODO - Something so that other mods that hijack the difficulty ui can also use the remainder of the reader to have their own shit - - if (Main.netMode == NetmodeID.Server) - SyncCalamityWorldDifficulties(sender); - break; - - // - // Music event syncs - // - case CalamityModMessageType.MusicEventSyncRequest: - MusicEventSystem.FulfillSyncRequest(whoAmI); - break; - - case CalamityModMessageType.MusicEventSyncResponse: - MusicEventSystem.ReceiveSyncResponse(reader); - break; - // // Default case: with no idea how long the packet is, we can't safely read data. // Throw an exception now instead of allowing the network stream to corrupt. // - default: - CalamityMod.Instance.Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}."); - throw new Exception("Failed to parse Calamity packet: Invalid Calamity packet ID."); + + CalamityMod.Instance.Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}."); + throw new Exception("Failed to parse Calamity packet: Invalid Calamity packet ID."); } } catch (Exception e) @@ -336,23 +136,60 @@ namespace CalamityMod public static void SyncWorld() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.WorldData); } + /// + /// Shorthand Method for SyncNPC + /// + /// This Equals to: + /// + /// if (Main.dedServ and npc != null) + /// NetMessage.SendData(MessageID.SyncNPC, ...) + /// + /// + public static void SyncNPC(NPC npcToSync, int toClient = -1, int ignoreClient = -1) + { + if (!Main.dedServ) + return; + + if (npcToSync is null) + return; + + var npcWhoAmI = npcToSync.whoAmI; + if (npcWhoAmI < 0 || npcWhoAmI >= Main.maxNPCs) + return; + + NetMessage.SendData(MessageID.SyncNPC, toClient, ignoreClient, null, npcWhoAmI); + } + + /// + /// Shorthand Method for SyncNPC + /// + /// This Equals to: + /// + /// if (Main.dedServ and npcWhoAmI in valid range) + /// NetMessage.SendData(MessageID.SyncNPC, ...) + /// + /// + public static void SyncNPC(int npcWhoAmI, int toClient = -1, int ignoreClient = -1) + { + if (!Main.dedServ) + return; + + if (npcWhoAmI < 0 || npcWhoAmI >= Main.maxNPCs) + return; + + NetMessage.SendData(MessageID.SyncNPC, toClient, ignoreClient, null, npcWhoAmI); + } + public static void SyncCalamityWorldDifficulties(int sender) { if (Main.netMode == NetmodeID.SinglePlayer) return; - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncDifficulties); - netMessage.Write(sender); - netMessage.Write(CalamityWorld.revenge); - netMessage.Write(CalamityWorld.death); - - //TODO - Let other mods also add their own bits in that sync. Ideally would be done through the difficultystem itself - netMessage.Send(-1, sender); + SyncDifficultiesPacket.Send(); } public static void NewNPC_ClientSide(Vector2 spawnPosition, int npcType, Player player) @@ -362,14 +199,10 @@ namespace CalamityMod NPC.NewNPC(new EntitySource_WorldEvent(), (int)spawnPosition.X, (int)spawnPosition.Y, npcType, Target: player.whoAmI); return; } - - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SpawnNPCOnPlayer); - netMessage.Write((int)spawnPosition.X); - netMessage.Write((int)spawnPosition.Y); - netMessage.Write(npcType); - netMessage.Write(player.whoAmI); - netMessage.Send(); + else if (Main.netMode == NetmodeID.MultiplayerClient) + { + SpawnNPCOnPlayerPacket.Send(player, (int)spawnPosition.X, (int)spawnPosition.Y, npcType); + } } } @@ -392,14 +225,17 @@ namespace CalamityMod SyncAndroombaSolution, SyncAndroombaAI, SyncSlabCrabAI, - ServersideSpawnOldDuke, - ArmoredDiggerCountdownSync, // TODO -- remove this mechanic entirely + PlaceAltCritter, ProvidenceDyeConditionSync, // TODO -- this packetstorms if you hit Provi with spam weapons. It should ONLY send a packet if the status changes. PSCChallengeSync, // TODO -- once you've failed the PSC challenge this packetstorms // General things for entities SpawnNPCOnPlayer, + SpawnBossOnPosition, SyncNPCMotionDataToServer, + SyncNPCPosAndRotOnly, + SyncNPCDemonicFlamesDamage, + SyncNPCDemonSwordImpales, // Tile Entities PowerCellFactory, @@ -411,6 +247,7 @@ namespace CalamityMod UpdateCodebreakerContainedStuff, UpdateCodebreakerDecryptCountdown, UnlockAbyssChests, + UpdateCanvasPainting, // Draedon Summoner CodebreakerSummonStuff, @@ -437,6 +274,15 @@ namespace CalamityMod // Music events MusicEventSyncRequest, - MusicEventSyncResponse + MusicEventSyncResponse, + + // Bandit Reforge Refund + BanditStolenMoneySync, + WantToRefundReforges, + + // Player Draw Effect Parameters + SyncPlayerDrawParameter, + + Reserved = 150 } } diff --git a/Cooldowns/BloodGodTotem.png b/Cooldowns/BloodGodTotem.png deleted file mode 100644 index c833d47380..0000000000 Binary files a/Cooldowns/BloodGodTotem.png and /dev/null differ diff --git a/Cooldowns/BloodGodTotemOutline.png b/Cooldowns/BloodGodTotemOutline.png deleted file mode 100644 index 53801a79de..0000000000 Binary files a/Cooldowns/BloodGodTotemOutline.png and /dev/null differ diff --git a/Cooldowns/BloodGodTotemOverlay.png b/Cooldowns/BloodGodTotemOverlay.png deleted file mode 100644 index 55a71cfc5d..0000000000 Binary files a/Cooldowns/BloodGodTotemOverlay.png and /dev/null differ diff --git a/Cooldowns/ChaosState.cs b/Cooldowns/ChaosState.cs index 4759b9b42c..a049141f3d 100644 --- a/Cooldowns/ChaosState.cs +++ b/Cooldowns/ChaosState.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Cooldowns { public static new string ID => "ChaosState"; - public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && instance.player.chaosState; + public override bool ShouldDisplay => CalamityClientConfig.Instance.VanillaCooldownDisplay && instance.player.chaosState; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); public override string Texture => "CalamityMod/Cooldowns/ChaosState" + skinTexture; public override Color OutlineColor => outlineColor; diff --git a/Cooldowns/CooldownInstance.cs b/Cooldowns/CooldownInstance.cs index b21e8f7c15..ca8d98120a 100644 --- a/Cooldowns/CooldownInstance.cs +++ b/Cooldowns/CooldownInstance.cs @@ -60,6 +60,17 @@ namespace CalamityMod.Cooldowns AssignHandler(cd); } + internal CooldownInstance(Player player, ushort netID, int duration, int timeLeft) + { + this.netID = netID; + this.player = player; + this.duration = duration; + this.timeLeft = timeLeft; + + string id = CooldownRegistry.registry[netID].ID; + AssignHandler(CooldownRegistry.Get(id)); + } + /// /// Creates a cooldown instance from serialized binary data, used in netcode. /// diff --git a/Cooldowns/CooldownRegistry.cs b/Cooldowns/CooldownRegistry.cs index 53822657c1..d74cf6cd11 100644 --- a/Cooldowns/CooldownRegistry.cs +++ b/Cooldowns/CooldownRegistry.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader.Core; namespace CalamityMod.Cooldowns { // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public class CooldownRegistry + public sealed class CooldownRegistry : ModSystem { // Indexed by ushort netID. Contains every registered cooldown. // Cooldowns are given netIDs when they are registered. @@ -18,7 +18,7 @@ namespace CalamityMod.Cooldowns private static Dictionary nameToNetID = null; - public static void Load() + public override void Load() { registry = new Cooldown[defaultSize]; nameToNetID = new Dictionary(defaultSize); @@ -60,7 +60,7 @@ namespace CalamityMod.Cooldowns #endregion } - public static void RegisterModCooldowns() + public override void OnModLoad() { Type baseHandlerType = typeof(CooldownHandler); foreach (Mod mod in ModLoader.Mods) @@ -87,7 +87,7 @@ namespace CalamityMod.Cooldowns } } - public static void Unload() + public override void Unload() { registry = null; nameToNetID?.Clear(); diff --git a/Cooldowns/CounterScarf.cs b/Cooldowns/CounterScarf.cs deleted file mode 100644 index ddb548d6b2..0000000000 --- a/Cooldowns/CounterScarf.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; - -namespace CalamityMod.Cooldowns -{ - public class CounterScarf : CooldownHandler - { - public static new string ID => "CounterScarf"; - - public override bool ShouldDisplay => true; - public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); - public override string Texture => "CalamityMod/Cooldowns/CounterScarf"; - public override Color OutlineColor => Color.Lerp(new Color(255, 115, 178), new Color(255, 76, 76), (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f); - public override Color CooldownStartColor => new Color(194, 75, 97); - public override Color CooldownEndColor => new Color(255, 76, 76); - } -} diff --git a/Cooldowns/DSOCritCooldown.png b/Cooldowns/DSOCritCooldown.png new file mode 100644 index 0000000000..7f0b95db4d Binary files /dev/null and b/Cooldowns/DSOCritCooldown.png differ diff --git a/Cooldowns/DSOCritCooldownOutline.png b/Cooldowns/DSOCritCooldownOutline.png new file mode 100644 index 0000000000..bd0757812c Binary files /dev/null and b/Cooldowns/DSOCritCooldownOutline.png differ diff --git a/Cooldowns/DSOCritCooldownOverlay.png b/Cooldowns/DSOCritCooldownOverlay.png new file mode 100644 index 0000000000..26f2bebb40 Binary files /dev/null and b/Cooldowns/DSOCritCooldownOverlay.png differ diff --git a/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs b/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs new file mode 100644 index 0000000000..84f3cfd089 --- /dev/null +++ b/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs @@ -0,0 +1,48 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.Localization; +using static CalamityMod.Items.Accessories.DaawnlightSpiritOrigin; + +namespace CalamityMod.Cooldowns +{ + public class DaawnlightSpiritOriginExtraCrit : CooldownHandler + { + public static new string ID => "DSOCritCooldown"; + + // If the player doesn't have DSO, this cooldown should not appear. + public override bool ShouldDisplay => instance.player.GetModPlayer().spiritOrigin; + + private float ExtraCritChance => instance.player.GetModPlayer().spiritOriginCritBoost; + + private float TextXOffset => (ExtraCritChance > 99 ? -24 : ExtraCritChance > 9 ? -20 : -16) * TextScale; + private Vector2 TextPosition => new(TextXOffset , 25); + private Color TextColor => Color.Lerp(Color.White , Color.Tomato , Utils.GetLerpValue(CritDecayThreshold - 10 , CritDecayThreshold , instance.player.GetModPlayer().spiritOriginCritBoost , false)); + private Color TextBorderColor = Color.Black; + private float TextScale => Utils.Remap(ExtraCritChance, 0, CritDecayThreshold, 1f, 1.5f); + + public override bool CanTickDown => false; + + public override Color CooldownStartColor => new(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + public override Color CooldownEndColor => new(Main.DiscoB, Main.DiscoR, Main.DiscoG); + + public override string Texture => "CalamityMod/Cooldowns/" + ID; + + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + + public override void DrawExpanded(SpriteBatch spriteBatch , Vector2 position , float opacity , float scale) + { + base.DrawExpanded(spriteBatch , position , opacity , scale); + CalamityUtils.DrawBorderStringEightWay(spriteBatch , FontAssets.MouseText.Value , $"+{ExtraCritChance}%" , position + TextPosition , TextColor , TextBorderColor , TextScale); + } + + public override void DrawCompact(SpriteBatch spriteBatch , Vector2 position , float opacity , float scale) + { + base.DrawCompact(spriteBatch , position , opacity , scale); + CalamityUtils.DrawBorderStringEightWay(spriteBatch , FontAssets.MouseText.Value , $"+{ExtraCritChance}%" , position + TextPosition , TextColor , TextBorderColor , TextScale); + } + } +} diff --git a/Cooldowns/EvasionScarf.cs b/Cooldowns/EvasionScarf.cs deleted file mode 100644 index 14b4aae1a2..0000000000 --- a/Cooldowns/EvasionScarf.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; - -namespace CalamityMod.Cooldowns -{ - public class EvasionScarf : CooldownHandler - { - public static new string ID => "EvasionScarf"; - public override bool ShouldDisplay => true; - public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); - public override string Texture => "CalamityMod/Cooldowns/EvasionScarf"; - public override Color OutlineColor => Color.Lerp(new Color(255, 194, 150), new Color(255, 160, 150), (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f); - public override Color CooldownStartColor => new Color(132, 23, 32); - public override Color CooldownEndColor => new Color(164, 52, 45); - } -} diff --git a/Cooldowns/FleshTotem.cs b/Cooldowns/FleshTotem.cs index 878eb99bb5..8b1fe7812f 100644 --- a/Cooldowns/FleshTotem.cs +++ b/Cooldowns/FleshTotem.cs @@ -9,37 +9,9 @@ namespace CalamityMod.Cooldowns public override bool ShouldDisplay => true; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); - public override string Texture => "CalamityMod/Cooldowns/" + skinTexture; - 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 FleshTotem() : this("") { } - public FleshTotem(string skin) - { - switch (skin) - { - // TODO -- UNUSED, Core of the Blood God no longer exists. - case "bloodgod": - skinTexture = "BloodGodTotem"; - outlineColor = new Color(255, 162, 205); - cooldownColorStart = new Color(193, 205, 255); - cooldownColorEnd = new Color(255, 193, 219); - break; - - default: - skinTexture = "FleshTotem"; - outlineColor = new Color(157, 248, 234); - cooldownColorStart = new Color(111, 169, 241); - cooldownColorEnd = new Color(111, 169, 241); - break; - } - } + public override string Texture => "CalamityMod/Cooldowns/FleshTotem"; + public override Color OutlineColor => new Color(157, 248, 234); + public override Color CooldownStartColor => new Color(111, 169, 241); + public override Color CooldownEndColor => new Color(111, 169, 241); } } diff --git a/Cooldowns/HellbornShots.cs b/Cooldowns/HellbornShots.cs new file mode 100644 index 0000000000..b421fc8b98 --- /dev/null +++ b/Cooldowns/HellbornShots.cs @@ -0,0 +1,49 @@ +using System; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.Localization; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class HellbornShots : CooldownHandler + { + public float CompletionPercentage => MathF.Round(instance.Completion * 100); + private bool IsEmpty => CompletionPercentage == 100; + private float TextXOffset => -5.4f; + private Vector2 TextPosition => new(TextXOffset, 15); + private Color TextColor => Color.Gold; + private Color TextBorderColor = Color.DarkRed; + + public static new string ID => "HellbornShots"; + public override bool CanTickDown => false; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType(); + public override string Texture => "CalamityMod/Cooldowns/" + ID; + + public override Color CooldownStartColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.Red, Color.SlateGray, instance.Completion); + public override Color CooldownEndColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.Gold, Color.SlateGray, instance.Completion); + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.player.Calamity().hellbornShots.ToString(), position + TextPosition, TextColor, TextBorderColor); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawCompact(spriteBatch, position, opacity, scale); + + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.player.Calamity().hellbornShots.ToString(), position + TextPosition, TextColor, TextBorderColor); + } + } +} diff --git a/Cooldowns/HellbornShots.png b/Cooldowns/HellbornShots.png new file mode 100644 index 0000000000..e60077601e Binary files /dev/null and b/Cooldowns/HellbornShots.png differ diff --git a/Projectiles/Melee/GalaxySmasherMini.png b/Cooldowns/HellbornShotsOutline.png similarity index 65% rename from Projectiles/Melee/GalaxySmasherMini.png rename to Cooldowns/HellbornShotsOutline.png index 3931f7748e..94bf4c490a 100644 Binary files a/Projectiles/Melee/GalaxySmasherMini.png and b/Cooldowns/HellbornShotsOutline.png differ diff --git a/Projectiles/Melee/GalaxySmasherEcho.png b/Cooldowns/HellbornShotsOverlay.png similarity index 59% rename from Projectiles/Melee/GalaxySmasherEcho.png rename to Cooldowns/HellbornShotsOverlay.png index a8e4ed6442..4ff8f97677 100644 Binary files a/Projectiles/Melee/GalaxySmasherEcho.png and b/Cooldowns/HellbornShotsOverlay.png differ diff --git a/Cooldowns/HolyProtection.cs b/Cooldowns/HolyProtection.cs new file mode 100644 index 0000000000..57e4c1a3eb --- /dev/null +++ b/Cooldowns/HolyProtection.cs @@ -0,0 +1,17 @@ +using Microsoft.Xna.Framework; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class HolyProtection : CooldownHandler + { + public static new string ID => "HolyProtection"; + + public override bool ShouldDisplay => CalamityClientConfig.Instance.VanillaCooldownDisplay; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/HolyProtection"; + public override Color OutlineColor => Color.Orange; + public override Color CooldownStartColor => Color.Lerp(Color.Yellow, Color.White, 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(Color.Yellow, Color.White, 1 - instance.Completion); + } +} diff --git a/Cooldowns/HolyProtection.png b/Cooldowns/HolyProtection.png new file mode 100644 index 0000000000..7199c46518 Binary files /dev/null and b/Cooldowns/HolyProtection.png differ diff --git a/Cooldowns/HolyProtectionOutline.png b/Cooldowns/HolyProtectionOutline.png new file mode 100644 index 0000000000..f148c9f02f Binary files /dev/null and b/Cooldowns/HolyProtectionOutline.png differ diff --git a/Cooldowns/HolyProtectionOverlay.png b/Cooldowns/HolyProtectionOverlay.png new file mode 100644 index 0000000000..7f1e396eb2 Binary files /dev/null and b/Cooldowns/HolyProtectionOverlay.png differ diff --git a/Cooldowns/KillMode.cs b/Cooldowns/KillMode.cs new file mode 100644 index 0000000000..6735a94ae1 --- /dev/null +++ b/Cooldowns/KillMode.cs @@ -0,0 +1,62 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.Localization; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class KillMode : CooldownHandler + { + public static new string ID => "KillMode"; + public override bool ShouldDisplay => true; + public static int cooldownMax = 300; + public static int buffMax = 180; + public override LocalizedText DisplayName => CalamityUtils.GetText("UI.Cooldowns.KillMode" + (instance.timeLeft > cooldownMax ? "Active" : "Cooldown")); + public override string Texture => "CalamityMod/Cooldowns/KillMode"; + public override string OutlineTexture => "CalamityMod/Cooldowns/KillModeOutline"; + public override string OverlayTexture => "CalamityMod/Cooldowns/KillModeOverlay"; + public override Color OutlineColor => instance.timeLeft > cooldownMax ? Color.MediumOrchid : Color.BlueViolet; + public override Color CooldownStartColor => instance.timeLeft > cooldownMax ? Color.Lerp(Color.Indigo, Color.DarkMagenta, (instance.timeLeft - cooldownMax) / buffMax) : Color.MediumOrchid; + public override Color CooldownEndColor => instance.timeLeft > cooldownMax ? Color.Lerp(Color.BlueViolet, Color.DarkOrchid, (instance.timeLeft - cooldownMax) / buffMax) : Color.DarkOrchid; + public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/DemonSwordKillModeOffCooldown"); + + //Charge down at first, and then charge back up + private float AdjustedCompletion => instance.timeLeft > cooldownMax ? Utils.GetLerpValue(cooldownMax, cooldownMax + buffMax, instance.timeLeft) : Utils.GetLerpValue(cooldownMax, 0, instance.timeLeft); + public override void Tick() + { + + } + public override void ApplyBarShaders(float opacity) + { + //Use the adjusted completion + GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + Texture2D sprite = Request(Texture).Value; + Texture2D outline = Request(OutlineTexture).Value; + Texture2D overlay = Request(OverlayTexture).Value; + + //Draw the outline + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the icon + spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the small overlay + int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion); + Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight); + spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Cooldowns/KillMode.png b/Cooldowns/KillMode.png new file mode 100644 index 0000000000..cc835514cb Binary files /dev/null and b/Cooldowns/KillMode.png differ diff --git a/Cooldowns/KillModeOutline.png b/Cooldowns/KillModeOutline.png new file mode 100644 index 0000000000..649f58d6e8 Binary files /dev/null and b/Cooldowns/KillModeOutline.png differ diff --git a/Cooldowns/KillModeOverlay.png b/Cooldowns/KillModeOverlay.png new file mode 100644 index 0000000000..e3e02deb83 Binary files /dev/null and b/Cooldowns/KillModeOverlay.png differ diff --git a/Cooldowns/OmegaBlue.cs b/Cooldowns/OmegaBlue.cs index 179509e020..6399514371 100644 --- a/Cooldowns/OmegaBlue.cs +++ b/Cooldowns/OmegaBlue.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Cooldowns { for (int i = 0; i < 66; i++) { - 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; - Main.dust[d].velocity *= 6.6f; + Dust dust = Dust.NewDustDirect(instance.player.position, instance.player.width, instance.player.height, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 2.6f); + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 1f; + dust.velocity *= 6.6f; } } diff --git a/Cooldowns/ParryCooldown.cs b/Cooldowns/ParryCooldown.cs index e7cdbb218b..c226732eb7 100644 --- a/Cooldowns/ParryCooldown.cs +++ b/Cooldowns/ParryCooldown.cs @@ -38,6 +38,13 @@ namespace CalamityMod.Cooldowns cooldownColorStart = Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - (instance?.Completion ?? 0)); cooldownColorEnd = Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - (instance?.Completion ?? 0)); break;*/ + case "shieldoftheocean": + // skinTexture = "ShieldOfTheOceanParry"; + skinTexture = "ParryCooldown"; + outlineColor = Color.White; + cooldownColorStart = new Color(233, 111, 165); + cooldownColorEnd = new Color(105, 139, 148); + break; default: skinTexture = "ParryCooldown"; outlineColor = Color.White; diff --git a/Cooldowns/PlagueBlackout.cs b/Cooldowns/PlagueBlackout.cs index e63253123b..824b240000 100644 --- a/Cooldowns/PlagueBlackout.cs +++ b/Cooldowns/PlagueBlackout.cs @@ -28,9 +28,9 @@ namespace CalamityMod.Cooldowns int h = instance.player.height; for (int i = 0; i < 66; i++) { - 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; + Dust dust = Dust.NewDustDirect(pos, w, h, DustID.GemEmerald, 0, 0, 100, default, 1.5f); + dust.noGravity = true; + dust.velocity *= 6.6f; } } diff --git a/Cooldowns/PotionSickness.cs b/Cooldowns/PotionSickness.cs index 2127706e4e..d7a8708f80 100644 --- a/Cooldowns/PotionSickness.cs +++ b/Cooldowns/PotionSickness.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Cooldowns public class PotionSickness : CooldownHandler { public static new string ID => "PotionSickness"; - public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && instance.player.potionDelay > 0; + public override bool ShouldDisplay => CalamityClientConfig.Instance.VanillaCooldownDisplay && instance.player.potionDelay > 0; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); public override string Texture => "CalamityMod/Cooldowns/PotionSickness"; public override Color OutlineColor => new Color(255, 142, 165); diff --git a/Cooldowns/RelicOfResilience.cs b/Cooldowns/RelicOfResilienceCooldown.cs similarity index 77% rename from Cooldowns/RelicOfResilience.cs rename to Cooldowns/RelicOfResilienceCooldown.cs index fe76048f4e..18da908039 100644 --- a/Cooldowns/RelicOfResilience.cs +++ b/Cooldowns/RelicOfResilienceCooldown.cs @@ -3,12 +3,12 @@ using Terraria.Localization; namespace CalamityMod.Cooldowns { - public class RelicOfResilience : CooldownHandler + public class RelicOfResilienceCooldown : CooldownHandler { - public static new string ID => "RelicOfResilience"; + public static new string ID => "RelicOfResilienceCooldown"; public override bool ShouldDisplay => true; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); - public override string Texture => "CalamityMod/Cooldowns/RelicOfResilience"; + public override string Texture => "CalamityMod/Cooldowns/RelicOfResilienceCooldown"; public override Color OutlineColor => new Color(255, 191, 73); public override Color CooldownStartColor => new Color(122, 66, 59); public override Color CooldownEndColor => new Color(165, 103, 87); diff --git a/Cooldowns/RelicOfResilience.png b/Cooldowns/RelicOfResilienceCooldown.png similarity index 100% rename from Cooldowns/RelicOfResilience.png rename to Cooldowns/RelicOfResilienceCooldown.png diff --git a/Cooldowns/RelicOfResilienceOutline.png b/Cooldowns/RelicOfResilienceCooldownOutline.png similarity index 100% rename from Cooldowns/RelicOfResilienceOutline.png rename to Cooldowns/RelicOfResilienceCooldownOutline.png diff --git a/Cooldowns/RelicOfResilienceOverlay.png b/Cooldowns/RelicOfResilienceCooldownOverlay.png similarity index 100% rename from Cooldowns/RelicOfResilienceOverlay.png rename to Cooldowns/RelicOfResilienceCooldownOverlay.png diff --git a/Cooldowns/ScarfCooldown.cs b/Cooldowns/ScarfCooldown.cs new file mode 100644 index 0000000000..2b61a01e4f --- /dev/null +++ b/Cooldowns/ScarfCooldown.cs @@ -0,0 +1,45 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class ScarfCooldown : CooldownHandler + { + public static new string ID => "ScarfCooldown"; + + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/" + skinTexture; + 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 ScarfCooldown() : this("") { } + public ScarfCooldown(string skin) + { + switch (skin) + { + case "evasionscarf": + skinTexture = "EvasionScarf"; + outlineColor = Color.Lerp(new Color(255, 194, 150), new Color(255, 160, 150), (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f); + cooldownColorStart = new Color(132, 23, 32); + cooldownColorEnd = new Color(164, 52, 45); + break; + default: + skinTexture = "CounterScarf"; + outlineColor = Color.Lerp(new Color(255, 115, 178), new Color(255, 76, 76), (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f); + cooldownColorStart = new Color(194, 75, 97); + cooldownColorEnd = new Color(255, 76, 76); + break; + } + } + } +} diff --git a/Cooldowns/TransformerCooldown.cs b/Cooldowns/TransformerCooldown.cs new file mode 100644 index 0000000000..c6a5a82a6b --- /dev/null +++ b/Cooldowns/TransformerCooldown.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class TransformerCooldown : CooldownHandler + { + public static new string ID => "TransformerCooldown"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/TransformerCooldown"; + public override Color OutlineColor => Color.AliceBlue; + public override Color CooldownStartColor => Color.Lerp(Color.SlateBlue, Color.DodgerBlue, 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(Color.SlateGray, Color.Cyan, 1 - instance.Completion); + } +} diff --git a/Cooldowns/TransformerCooldown.png b/Cooldowns/TransformerCooldown.png new file mode 100644 index 0000000000..afe05264e6 Binary files /dev/null and b/Cooldowns/TransformerCooldown.png differ diff --git a/Cooldowns/TransformerCooldownOutline.png b/Cooldowns/TransformerCooldownOutline.png new file mode 100644 index 0000000000..de6396f8a3 Binary files /dev/null and b/Cooldowns/TransformerCooldownOutline.png differ diff --git a/Cooldowns/TransformerCooldownOverlay.png b/Cooldowns/TransformerCooldownOverlay.png new file mode 100644 index 0000000000..d717ab943b Binary files /dev/null and b/Cooldowns/TransformerCooldownOverlay.png differ diff --git a/Cooldowns/WarbanneroftheRighteousBuff.cs b/Cooldowns/WarbanneroftheRighteousBuff.cs new file mode 100644 index 0000000000..78ddea9b66 --- /dev/null +++ b/Cooldowns/WarbanneroftheRighteousBuff.cs @@ -0,0 +1,49 @@ +using System; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.Localization; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class WarbanneroftheRighteousBuff : CooldownHandler + { + public float CompletionPercentage => Utils.GetLerpValue(80, 0, instance.timeLeft); + private bool IsEmpty => CompletionPercentage == 0; + private float TextXOffset => (instance.timeLeft <= 20 ? -11 : -18f); + private Vector2 TextPosition => new(TextXOffset, 15); + private Color TextColor => Color.White; + private Color TextBorderColor => Color.Black; + + public static new string ID => "WarbanneroftheRighteousBuff"; + public override bool CanTickDown => false; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override bool ShouldDisplay => instance.player.Calamity().WarbanneroftheRighteous; + public override string Texture => "CalamityMod/Cooldowns/" + ID; + + public override Color CooldownStartColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.SlateGray, Color.DarkGoldenrod, CompletionPercentage); + public override Color CooldownEndColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.SlateGray, Color.Gold, CompletionPercentage); + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, (-instance.timeLeft + 20).ToString() + "%", position + TextPosition, TextColor, TextBorderColor); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawCompact(spriteBatch, position, opacity, scale); + + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, (-instance.timeLeft + 20).ToString() + "%", position + TextPosition, TextColor, TextBorderColor); + } + } +} diff --git a/Cooldowns/WarbanneroftheRighteousBuff.png b/Cooldowns/WarbanneroftheRighteousBuff.png new file mode 100644 index 0000000000..66ada2beb1 Binary files /dev/null and b/Cooldowns/WarbanneroftheRighteousBuff.png differ diff --git a/Cooldowns/WarbanneroftheRighteousBuffOutline.png b/Cooldowns/WarbanneroftheRighteousBuffOutline.png new file mode 100644 index 0000000000..5549f1b6fb Binary files /dev/null and b/Cooldowns/WarbanneroftheRighteousBuffOutline.png differ diff --git a/Cooldowns/WarbanneroftheRighteousBuffOverlay.png b/Cooldowns/WarbanneroftheRighteousBuffOverlay.png new file mode 100644 index 0000000000..9d47c29f53 Binary files /dev/null and b/Cooldowns/WarbanneroftheRighteousBuffOverlay.png differ diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 10b5087a54..683b8a49b1 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Enums; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -13,8 +15,8 @@ namespace CalamityMod.DataStructures { public enum AttunementID : byte { - Default, Hot, Cold, Tropical, Evil, //Broken biome blade - TrueDefault, TrueHot, TrueCold, TrueTropical, TrueEvil, Holy, Astral, Marine, //Biome blade + Default, Hot, Cold, Evil, //Broken biome blade + TrueDefault, TrueHot, TrueCold, TrueTropical, TrueEvil, Holy, //Biome blade Whirlwind, FlailBlade, SuperPogo, Shockwave, //True biome blade Phoenix, Aries, Polaris, Andromeda //Galaxia } @@ -27,8 +29,8 @@ namespace CalamityMod.DataStructures public static void Load() { 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 DefaultAttunement(), new HotAttunement(), new ColdAttunement(), new EvilAttunement(), + new TrueDefaultAttunement(), new TrueHotAttunement(), new TrueColdAttunement(), new TrueTropicalAttunement(), new TrueEvilAttunement(), new HolyAttunement(), new WhirlwindAttunement(), new FlailBladeAttunement(), new SuperPogoAttunement(), new ShockwaveAttunement(), new PhoenixAttunement(), new AriesAttunement(), new PolarisAttunement(), new AndromedaAttunement(), null @@ -97,13 +99,13 @@ namespace CalamityMod.DataStructures public override void ApplyStats(Item item) { - item.channel = false; - item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.Swing; - item.shoot = ProjectileType(); - item.shootSpeed = 12f; - item.UseSound = SoundID.Item1; - item.noMelee = false; + item.channel = true; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.Shoot; + item.shoot = ProjectileType(); + item.shootSpeed = 0f; + item.UseSound = null; + item.noMelee = true; } } public class HotAttunement : Attunement @@ -177,31 +179,6 @@ namespace CalamityMod.DataStructures } } - public class TropicalAttunement : Attunement - { - public TropicalAttunement() - { - id = AttunementID.Tropical; - tooltipColor = new Color(162, 200, 85); - - energyParticleEdgeColor = new Color(53, 112, 4); - energyParticleCenterColor = new Color(131, 173, 39); - } - - public override float DamageMultiplier => BrokenBiomeBlade.TropicalAttunement_BaseDamage / (float)BrokenBiomeBlade.BaseDamage; - - public override void ApplyStats(Item item) - { - item.channel = false; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Swing; - item.shoot = ProjectileType(); - item.shootSpeed = 30; - item.UseSound = null; - item.noMelee = true; - } - } - public class EvilAttunement : Attunement { public EvilAttunement() @@ -241,7 +218,7 @@ namespace CalamityMod.DataStructures public TrueDefaultAttunement() { id = AttunementID.TrueDefault; - tooltipColor = new Color(171, 180, 73); + tooltipColor = new Color(201, 220, 93); energyParticleEdgeColor = new Color(117, 126, 72); energyParticleCenterColor = new Color(200, 184, 136); @@ -251,13 +228,13 @@ namespace CalamityMod.DataStructures public override void ApplyStats(Item item) { - item.channel = false; - item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.Swing; - item.shoot = ProjectileType(); - item.shootSpeed = 12f; - item.UseSound = SoundID.Item1; - item.noMelee = false; + item.channel = true; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.Shoot; + item.shoot = ProjectileType(); + item.shootSpeed = 0f; + item.UseSound = null; + item.noMelee = true; } } public class TrueHotAttunement : Attunement @@ -432,55 +409,6 @@ namespace CalamityMod.DataStructures item.noMelee = true; } } - - public class AstralAttunement : Attunement - { - public AstralAttunement() - { - id = AttunementID.Astral; - tooltipColor = new Color(91, 73, 196); - - energyParticleEdgeColor = new Color(58, 56, 165); - energyParticleCenterColor = new Color(153, 120, 255); - } - - public override float DamageMultiplier => TrueBiomeBlade.AstralAttunement_BaseDamage / (float)TrueBiomeBlade.BaseDamage; - public override void ApplyStats(Item item) - { - item.channel = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Thrust; - item.shoot = ProjectileType(); - item.shootSpeed = 12f; - item.UseSound = null; - item.noMelee = true; - } - } - - public class MarineAttunement : Attunement - { - public MarineAttunement() - { - id = AttunementID.Marine; - tooltipColor = new Color(61, 103, 209); - - energyParticleEdgeColor = new Color(27, 59, 101); - energyParticleCenterColor = new Color(27, 112643, 255); - } - - public override float DamageMultiplier => TrueBiomeBlade.MarineAttunement_BaseDamage / (float)TrueBiomeBlade.BaseDamage; - - public override void ApplyStats(Item item) - { - item.channel = false; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Thrust; - item.shoot = ProjectileType(); - item.shootSpeed = 12f; - item.UseSound = null; - item.noMelee = true; - } - } #endregion #region True Biome Blade Attunements @@ -490,7 +418,7 @@ namespace CalamityMod.DataStructures { id = AttunementID.Whirlwind; tooltipColor = new Color(220, 105, 197); - tooltipColor2 = new Color(171, 239, 113); + tooltipColor2 = new Color(132, 70, 232); } public override float DamageMultiplier => OmegaBiomeBlade.WhirlwindAttunement_BaseDamage / (float)OmegaBiomeBlade.BaseDamage; @@ -508,13 +436,14 @@ 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.NextBool(2)) + if (Procced) { - SoundEngine.PlaySound(SoundID.Item78); int damage = (int)player.GetTotalDamage().ApplyTo(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage); - Projectile beamSword = Projectile.NewProjectileDirect(source, player.Center, player.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), damage, 10f, player.whoAmI, 1f); - beamSword.timeLeft = 50; - UseTimer++; + // 14NOV2024: Ozzatron: clamped mouse world unnecessary here, just used for direction + Vector2 velocity = (Main.MouseWorld - player.Center).SafeNormalize(Vector2.UnitX) * 15f; + Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0f, player.whoAmI); + + Procced = false; } } } @@ -581,8 +510,7 @@ namespace CalamityMod.DataStructures { if (!player.moonLeech) { - player.statLife += OmegaBiomeBlade.SuperPogoAttunement_PassiveLifeSteal; - player.HealEffect(OmegaBiomeBlade.SuperPogoAttunement_PassiveLifeSteal); + player.HealPlayer(OmegaBiomeBlade.SuperPogoAttunement_PassiveLifeSteal); } Procced = false; @@ -595,7 +523,7 @@ namespace CalamityMod.DataStructures public ShockwaveAttunement() { id = AttunementID.Shockwave; - tooltipColor = new Color(132, 109, 233); + tooltipColor = new Color(71, 191, 71); tooltipColor2 = new Color(122, 213, 233); } @@ -606,7 +534,7 @@ namespace CalamityMod.DataStructures item.channel = true; item.noUseGraphic = true; item.useStyle = ItemUseStyleID.Shoot; - item.shoot = ProjectileType(); + item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; item.noMelee = true; @@ -617,7 +545,7 @@ namespace CalamityMod.DataStructures if (UseTimer % 120 == 119) { int damage = (int)player.GetTotalDamage().ApplyTo(OmegaBiomeBlade.ShockwaveAttunement_PassiveBaseDamage); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType(), damage, 10f, player.whoAmI, 1f); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType(), damage, 10f, player.whoAmI, 2f); UseTimer++; } } @@ -649,16 +577,7 @@ namespace CalamityMod.DataStructures item.shootSpeed = 12f; item.UseSound = null; item.noMelee = true; - } - - public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) - { - if (UseTimer % 500 == 449) - { - SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); - UseTimer++; - } + item.reuseDelay = 30; } } @@ -683,16 +602,7 @@ namespace CalamityMod.DataStructures item.shootSpeed = 12f; item.UseSound = null; item.noMelee = true; - } - - public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) - { - if (UseTimer % 500 == 449) - { - SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); - UseTimer++; - } + item.reuseDelay = 30; } } @@ -717,16 +627,7 @@ namespace CalamityMod.DataStructures item.shootSpeed = 12f; item.UseSound = null; item.noMelee = true; - } - - public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) - { - if (UseTimer % 500 == 449) - { - SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType(), FourSeasonsGalaxia.CancerPassiveDamage, 0f, player.whoAmI, 0f); - UseTimer++; - } + item.reuseDelay = 12; } } @@ -752,16 +653,7 @@ namespace CalamityMod.DataStructures item.shootSpeed = 12f; item.UseSound = null; item.noMelee = true; - } - - public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) - { - if (UseTimer % 500 == 449) - { - SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType(), FourSeasonsGalaxia.CancerPassiveDamage, 0f, player.whoAmI, 0f); - UseTimer++; - } + item.reuseDelay = 30; } } diff --git a/DataStructures/GemTechArmorState.cs b/DataStructures/GemTechArmorState.cs index 8cdc3cc0d4..9ec1260c35 100644 --- a/DataStructures/GemTechArmorState.cs +++ b/DataStructures/GemTechArmorState.cs @@ -149,7 +149,6 @@ namespace CalamityMod.DataStructures return; int damage = (int)Owner.GetTotalDamage().ApplyTo(GemTechHeadgear.MeleeShardBaseDamage); - damage = Owner.ApplyArmorAccDamageBonusesTo(damage); for (int i = 0; i < 14; i++) { @@ -167,7 +166,6 @@ namespace CalamityMod.DataStructures return; int damage = CalamityUtils.DamageSoftCap((int)(hitDamage * 0.32f), 400); - damage = Owner.ApplyArmorAccDamageBonusesTo(damage); Vector2 spawnPosition = Owner.Center + Main.rand.NextVector2Circular(Owner.width, Owner.height) * 1.35f; Vector2 shootVelocity = (target.Center - spawnPosition) * 0.04f; @@ -277,7 +275,6 @@ namespace CalamityMod.DataStructures // Softcap the damage. This is done primarily to dampen stealth interactions. gemDamage = CalamityUtils.DamageSoftCap(gemDamage, GemTechHeadgear.GemDamageSoftcapThreshold); - gemDamage = Owner.ApplyArmorAccDamageBonusesTo(gemDamage); if (Main.myPlayer == OwnerIndex) Projectile.NewProjectile(Owner.GetSource_ItemUse(Owner.ActiveItem()), gemPosition, Vector2.Zero, ModContent.ProjectileType(), gemDamage, 0f, OwnerIndex, 0f, (int)GemThatShouldBeLost); diff --git a/DataStructures/IDyeableShaderRenderer.cs b/DataStructures/IDyeableShaderRenderer.cs index bdae07c587..cb63c9937f 100644 --- a/DataStructures/IDyeableShaderRenderer.cs +++ b/DataStructures/IDyeableShaderRenderer.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework.Graphics; +using Terraria; namespace CalamityMod.DataStructures { @@ -14,6 +15,11 @@ namespace CalamityMod.DataStructures public const float SpongeShieldDepth = 4f; #endregion + /// + /// Owner of this Renderer Item + /// + public int OwnerPlayer { get; set; } + /// /// The draw depth of the renderer. This is used to draw them in descending order; higher values are drawn first. /// diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 34e2e51c80..e1ebbd3f93 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -611,6 +611,7 @@ namespace CalamityMod { 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[] { 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[] { 34, 52, 68, 80, 120 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, @@ -638,15 +639,14 @@ namespace CalamityMod 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.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[] { 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[] { 50, 108, 132, 156, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 152, 172, 192, 300 } },*/ + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 50, 108, 132, 156, 234 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, { 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 } }, @@ -707,13 +707,13 @@ namespace CalamityMod { 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[] { 72, 132, 160, 188, 282 } }, + { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 60, 120, 140, 180, 270 } }, { 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.Fireball), new int[] { 60, 120, 140, 180, 270 } }, { 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.Fireball), new int[] { 60, 120, 140, 180, 270 } }, { 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 } }, @@ -726,7 +726,7 @@ namespace CalamityMod { 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[] { 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 } }, diff --git a/Dusts/LightDust.cs b/Dusts/LightDust.cs new file mode 100644 index 0000000000..d0f83ba587 --- /dev/null +++ b/Dusts/LightDust.cs @@ -0,0 +1,48 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class LightDust : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + dust.rotation += MathF.Sign(dust.velocity.X); + dust.velocity *= 0.98f; + if (dust.noGravity) + dust.scale += 0.02f; + else + dust.scale -= 0.01f; + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + return true; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0); + if (!dust.noLight) + { + Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Dusts/LightDust.png b/Dusts/LightDust.png new file mode 100644 index 0000000000..d4653059dc Binary files /dev/null and b/Dusts/LightDust.png differ diff --git a/Dusts/VoidDust.cs b/Dusts/VoidDust.cs new file mode 100644 index 0000000000..793f7b826d --- /dev/null +++ b/Dusts/VoidDust.cs @@ -0,0 +1,47 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class VoidDust : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + dust.rotation += MathF.Sign(dust.velocity.X); + dust.velocity *= 0.98f; + if (dust.noGravity) + dust.scale += 0.02f; + else + dust.scale -= 0.01f; + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + return true; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + if (!dust.noLight) + { + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0); + } + Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Dusts/VoidDust.png b/Dusts/VoidDust.png new file mode 100644 index 0000000000..76e3a0b6c5 Binary files /dev/null and b/Dusts/VoidDust.png differ diff --git a/Dusts/VoidDustInverted.cs b/Dusts/VoidDustInverted.cs new file mode 100644 index 0000000000..d5df7d199f --- /dev/null +++ b/Dusts/VoidDustInverted.cs @@ -0,0 +1,50 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class VoidDustInverted : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + dust.rotation += MathF.Sign(dust.velocity.X); + dust.velocity *= 0.98f; + if (dust.noGravity) + dust.scale += 0.02f; + else + dust.scale -= 0.01f; + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + return true; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + + Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + Texture2D bloom2 = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; + + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0); + + Main.EntitySpriteDraw(bloom2, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom2.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0); + if (!dust.noLight) + Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Dusts/VoidDustInverted.png b/Dusts/VoidDustInverted.png new file mode 100644 index 0000000000..76e3a0b6c5 Binary files /dev/null and b/Dusts/VoidDustInverted.png differ diff --git a/Dusts/WaterSplash/AstralSplash.cs b/Dusts/WaterSplash/AstralSplash.cs new file mode 100644 index 0000000000..6fcb24f6c3 --- /dev/null +++ b/Dusts/WaterSplash/AstralSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class AstralSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/AstralSplash.png b/Dusts/WaterSplash/AstralSplash.png new file mode 100644 index 0000000000..839409589d Binary files /dev/null and b/Dusts/WaterSplash/AstralSplash.png differ diff --git a/Dusts/WaterSplash/BasaltGullySplash.cs b/Dusts/WaterSplash/BasaltGullySplash.cs new file mode 100644 index 0000000000..cfacf07640 --- /dev/null +++ b/Dusts/WaterSplash/BasaltGullySplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class BasaltGullySplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/BasaltGullySplash.png b/Dusts/WaterSplash/BasaltGullySplash.png new file mode 100644 index 0000000000..0f62af547c Binary files /dev/null and b/Dusts/WaterSplash/BasaltGullySplash.png differ diff --git a/Dusts/WaterSplash/CragsLavaSplash.cs b/Dusts/WaterSplash/CragsLavaSplash.cs new file mode 100644 index 0000000000..907f65c969 --- /dev/null +++ b/Dusts/WaterSplash/CragsLavaSplash.cs @@ -0,0 +1,178 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics.PackedVector; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class CragsLavaSplash : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.velocity.Y = -0.5f; + } + + public override bool Update(Dust dust) + { + if (dust.scale > 10f) + { + dust.active = false; + } + Dust.lavaBubbles++; + dust.position += dust.velocity; + if (!dust.noGravity) + { + dust.velocity.Y += 0.1f; + } + if (dust.noGravity) + { + dust.scale += 0.03f; + if (dust.scale < 1f) + { + dust.velocity.Y += 0.075f; + } + dust.velocity.X *= 1.08f; + if (dust.velocity.X > 0f) + { + dust.rotation += 0.01f; + } + else + { + dust.rotation -= 0.01f; + } + float num109 = dust.scale * 0.6f; + if (num109 > 1f) + { + num109 = 1f; + } + Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f + 1f), num109 * (2.5f / 4), num109 * (1.1f / 4), num109 * (0.1f / 4)); + } + else + { + if (!Collision.WetCollision(new Vector2(dust.position.X, dust.position.Y - 8f), 4, 4)) + { + dust.scale = 0f; + } + else + { + dust.alpha += Main.rand.Next(2); + if (dust.alpha > 255) + { + dust.scale = 0f; + } + dust.velocity.Y = -0.5f; + dust.alpha++; + dust.scale -= 0.01f; + dust.velocity.Y = -0.2f; + dust.velocity.X += (float)Main.rand.Next(-10, 10) * 0.002f; + if ((double)dust.velocity.X < -0.25) + { + dust.velocity.X = -0.25f; + } + if ((double)dust.velocity.X > 0.25) + { + dust.velocity.X = 0.25f; + } + } + float num3 = dust.scale * 0.3f + 0.4f; + if (num3 > 1f) + { + num3 = 1f; + } + Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num3 * (2.5f / 4), num3 * (1.1f / 4), num3 * (0.1f / 4)); + } + dust.rotation += dust.velocity.X * 0.5f; + if (dust.fadeIn > 0f && dust.fadeIn < 100f) + { + dust.scale += 0.03f; + if (dust.scale > dust.fadeIn) + { + dust.fadeIn = 0f; + } + } + dust.scale -= 0.01f; + if (dust.noGravity) + { + dust.velocity *= 0.92f; + if (dust.fadeIn == 0f) + { + dust.scale -= 0.04f; + } + } + if (dust.position.Y > Main.screenPosition.Y + (float)Main.screenHeight) + { + dust.active = false; + } + float num17 = 0.1f; + if ((double)Dust.dCount == 0.5) + { + dust.scale -= 0.001f; + } + if ((double)Dust.dCount == 0.6) + { + dust.scale -= 0.0025f; + } + if ((double)Dust.dCount == 0.7) + { + dust.scale -= 0.005f; + } + if ((double)Dust.dCount == 0.8) + { + dust.scale -= 0.01f; + } + if ((double)Dust.dCount == 0.9) + { + dust.scale -= 0.02f; + } + if ((double)Dust.dCount == 0.5) + { + num17 = 0.11f; + } + if ((double)Dust.dCount == 0.6) + { + num17 = 0.13f; + } + if ((double)Dust.dCount == 0.7) + { + num17 = 0.16f; + } + if ((double)Dust.dCount == 0.8) + { + num17 = 0.22f; + } + if ((double)Dust.dCount == 0.9) + { + num17 = 0.25f; + } + if (dust.scale < num17) + { + dust.active = false; + } + return false; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) + { + float num = (float)(255 - dust.alpha) / 255f; + int num4; + int num3; + int num2; + num = (num + 3f) / 4f; + num4 = (int)((int)lightColor.R * num); + num3 = (int)((int)lightColor.G * num); + num2 = (int)((int)lightColor.B * num); + int num6 = lightColor.A - dust.alpha; + if (num6 < 0) + { + num6 = 0; + } + if (num6 > 255) + { + num6 = 255; + } + return new Color(num4, num3, num2, num6); + } + } +} diff --git a/Dusts/WaterSplash/CragsLavaSplash.png b/Dusts/WaterSplash/CragsLavaSplash.png new file mode 100644 index 0000000000..dbe3be3c65 Binary files /dev/null and b/Dusts/WaterSplash/CragsLavaSplash.png differ diff --git a/Dusts/WaterSplash/MiddleAbyssSplash.cs b/Dusts/WaterSplash/MiddleAbyssSplash.cs new file mode 100644 index 0000000000..319e596446 --- /dev/null +++ b/Dusts/WaterSplash/MiddleAbyssSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class MiddleAbyssSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/MiddleAbyssSplash.png b/Dusts/WaterSplash/MiddleAbyssSplash.png new file mode 100644 index 0000000000..b368be985f Binary files /dev/null and b/Dusts/WaterSplash/MiddleAbyssSplash.png differ diff --git a/Dusts/WaterSplash/SplashDust.cs b/Dusts/WaterSplash/SplashDust.cs new file mode 100644 index 0000000000..f74eac1125 --- /dev/null +++ b/Dusts/WaterSplash/SplashDust.cs @@ -0,0 +1,20 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public abstract class SplashDust : ModDust + { + public override void SetStaticDefaults() + { + UpdateType = 33; + } + + public override void OnSpawn(Dust dust) + { + dust.alpha = 170; + dust.velocity *= 0.5f; + dust.velocity.Y += 1f; + } + } +} diff --git a/Dusts/WaterSplash/SulphuricDepthsSplash.cs b/Dusts/WaterSplash/SulphuricDepthsSplash.cs new file mode 100644 index 0000000000..840863230f --- /dev/null +++ b/Dusts/WaterSplash/SulphuricDepthsSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class SulphuricDepthsSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/SulphuricDepthsSplash.png b/Dusts/WaterSplash/SulphuricDepthsSplash.png new file mode 100644 index 0000000000..c5a9a06c5d Binary files /dev/null and b/Dusts/WaterSplash/SulphuricDepthsSplash.png differ diff --git a/Dusts/WaterSplash/SulphuricSplash.cs b/Dusts/WaterSplash/SulphuricSplash.cs new file mode 100644 index 0000000000..0cd8705c76 --- /dev/null +++ b/Dusts/WaterSplash/SulphuricSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class SulphuricSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/SulphuricSplash.png b/Dusts/WaterSplash/SulphuricSplash.png new file mode 100644 index 0000000000..580c4485fc Binary files /dev/null and b/Dusts/WaterSplash/SulphuricSplash.png differ diff --git a/Dusts/WaterSplash/SunkenSeaBurrowsSplash.cs b/Dusts/WaterSplash/SunkenSeaBurrowsSplash.cs new file mode 100644 index 0000000000..1565575956 --- /dev/null +++ b/Dusts/WaterSplash/SunkenSeaBurrowsSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class SunkenSeaBurrowsSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/SunkenSeaBurrowsSplash.png b/Dusts/WaterSplash/SunkenSeaBurrowsSplash.png new file mode 100644 index 0000000000..757363fb4c Binary files /dev/null and b/Dusts/WaterSplash/SunkenSeaBurrowsSplash.png differ diff --git a/Dusts/WaterSplash/SunkenSeaPolypSplash.cs b/Dusts/WaterSplash/SunkenSeaPolypSplash.cs new file mode 100644 index 0000000000..0bf3151240 --- /dev/null +++ b/Dusts/WaterSplash/SunkenSeaPolypSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class SunkenSeaPolypSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/SunkenSeaPolypSplash.png b/Dusts/WaterSplash/SunkenSeaPolypSplash.png new file mode 100644 index 0000000000..0bebd2f523 Binary files /dev/null and b/Dusts/WaterSplash/SunkenSeaPolypSplash.png differ diff --git a/Dusts/WaterSplash/SunkenSeaReefsSplash.cs b/Dusts/WaterSplash/SunkenSeaReefsSplash.cs new file mode 100644 index 0000000000..d2e707e0a6 --- /dev/null +++ b/Dusts/WaterSplash/SunkenSeaReefsSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class SunkenSeaReefsSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/SunkenSeaReefsSplash.png b/Dusts/WaterSplash/SunkenSeaReefsSplash.png new file mode 100644 index 0000000000..a5025980ca Binary files /dev/null and b/Dusts/WaterSplash/SunkenSeaReefsSplash.png differ diff --git a/Dusts/WaterSplash/SunkenSeaShoresSplash.cs b/Dusts/WaterSplash/SunkenSeaShoresSplash.cs new file mode 100644 index 0000000000..3864ebca8b --- /dev/null +++ b/Dusts/WaterSplash/SunkenSeaShoresSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class SunkenSeaShoresSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/SunkenSeaShoresSplash.png b/Dusts/WaterSplash/SunkenSeaShoresSplash.png new file mode 100644 index 0000000000..de8432f920 Binary files /dev/null and b/Dusts/WaterSplash/SunkenSeaShoresSplash.png differ diff --git a/Dusts/WaterSplash/UpperAbyssSplash.cs b/Dusts/WaterSplash/UpperAbyssSplash.cs new file mode 100644 index 0000000000..715e5467b6 --- /dev/null +++ b/Dusts/WaterSplash/UpperAbyssSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class UpperAbyssSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/UpperAbyssSplash.png b/Dusts/WaterSplash/UpperAbyssSplash.png new file mode 100644 index 0000000000..09400057b8 Binary files /dev/null and b/Dusts/WaterSplash/UpperAbyssSplash.png differ diff --git a/Dusts/WaterSplash/VoidSplash.cs b/Dusts/WaterSplash/VoidSplash.cs new file mode 100644 index 0000000000..0e046fa962 --- /dev/null +++ b/Dusts/WaterSplash/VoidSplash.cs @@ -0,0 +1,9 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class VoidSplash : SplashDust + { + } +} diff --git a/Dusts/WaterSplash/VoidSplash.png b/Dusts/WaterSplash/VoidSplash.png new file mode 100644 index 0000000000..3177c26e7c Binary files /dev/null and b/Dusts/WaterSplash/VoidSplash.png differ diff --git a/Effects/BordernadoFire.fx b/Effects/BordernadoFire.fx index 44d9e2dec8..057d5b1112 100644 --- a/Effects/BordernadoFire.fx +++ b/Effects/BordernadoFire.fx @@ -58,6 +58,7 @@ float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 opacity *= pow(sin(coords.y * 3.141), lerp(1, 4, pow(coords.x, 2))); opacity *= fadeMapColor.r * 1.5 + 1; opacity *= lerp(0.4, 0.9, fadeMapColor.r); + opacity *= uOpacity; float3 transformColor = lerp(float3(1, 205 / 255.0, 119 / 255.0), float3(1, 76 / 255.0, 79 / 255.0), fadeMapColor.r); color.rgb = lerp(color.rgb, transformColor, fadeMapColor.r); diff --git a/Effects/BordernadoFire.xnb b/Effects/BordernadoFire.xnb index 053e44de32..4b38ad5eb0 100644 Binary files a/Effects/BordernadoFire.xnb and b/Effects/BordernadoFire.xnb differ diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 10fef4e0ab..2a5c4cd5f2 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -4,11 +4,13 @@ using ReLogic.Content; using Terraria; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; +using Terraria.ModLoader; namespace CalamityMod.Effects { // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public class CalamityShaders + [Autoload(Side = ModSide.Client)] + public sealed class CalamityShaders : ModSystem { private const string ShaderPath = "Effects/"; internal const string CalamityShaderPrefix = "CalamityMod:"; @@ -51,7 +53,7 @@ namespace CalamityMod.Effects // Scarlet Devil main spear glowing trail. BEWARE: Is reused by many other items! internal static Effect ScarletDevilShader; - // Yharon border suns (or flame pillars?) unsure. it's one or the other. maybe both + // Yharon border flame pillar trail. internal static Effect BordernadoFireShader; // Photon Ripper hardlight teeth trail shader @@ -87,7 +89,7 @@ namespace CalamityMod.Effects // Clips a sprite along a fixed plane. Used by Stream Gouge to have half-spears come out of portals. internal static Effect IntersectionClipShader; - // Used by Dom's Bladecrest Oathsword. Appears to govern the swing animation. + // Was previously used by Dom's Bladecrest Oathsword. Appears to govern the swing animation. internal static Effect LocalLinearTransformationShader; // UNUSED -- Probably leftover from Dominic's experiments with applying shaders to primitives (arbitrary GPU-rendered triangles) @@ -99,13 +101,13 @@ namespace CalamityMod.Effects // Exoblade's melee slash trails. Also used by Terratomere internal static Effect ExobladeSlashShader; - // Exoblade's projectile on-hit "aniume slash marks". Also used by Terratomere + // Exoblade's projectile on-hit "anime slash marks". Also used by Terratomere internal static Effect ExobladePierceShader; - // Used by Subsuming Vortex's various vortices. Draws the main vortices + // Used by Subsuming Vortex's various vortices. Draws the main vortices. BEWARE: Reused by Burning Sea's fireball. internal static Effect ExoVortexShader; - // Used by Subsuming Vortex's side vortices. Draws the swirling energy tendrils. + // Used by Subsuming Vortex's small vortices. Draws the trailing energy tendrils. internal static Effect SideStreakTrailShader; // Used by Heavenly Gale's hardlight arrows. @@ -204,38 +206,8 @@ namespace CalamityMod.Effects 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 - private static void RegisterMiscShader(Effect shader, string passName, string registrationName) + public override void PostSetupContent() { - Ref shaderPointer = new(shader); - MiscShaderData passParamRegistration = new(shaderPointer, passName); - GameShaders.Misc[$"{CalamityShaderPrefix}{registrationName}"] = passParamRegistration; - } - - private static void RegisterSceneFilter(ScreenShaderData passReg, string registrationName, EffectPriority priority = EffectPriority.High) - { - string prefixedRegistrationName = $"{CalamityShaderPrefix}{registrationName}"; - Filters.Scene[prefixedRegistrationName] = new Filter(passReg, priority); - Filters.Scene[prefixedRegistrationName].Load(); - } - - // Shorthand to register a loaded shader in Terraria's graphics engine - // All shaders registered this way are accessible under Filters.Scene - // They will use the prefix described above - private static void RegisterScreenShader(Effect shader, string passName, string registrationName, EffectPriority priority = EffectPriority.High) - { - Ref shaderPointer = new(shader); - ScreenShaderData passParamRegistration = new(shaderPointer, passName); - RegisterSceneFilter(passParamRegistration, registrationName, priority); - } - - public static void LoadShaders() - { - if (Main.dedServ) - return; - AssetRepository calAss = CalamityMod.Instance.Assets; // Shorthand to load shaders immediately. @@ -437,5 +409,32 @@ namespace CalamityMod.Effects RegisterMiscShader(TeslaTrailShader, "TrailPass", "TeslaTrail"); #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 + private static void RegisterMiscShader(Effect shader, string passName, string registrationName) + { + Ref shaderPointer = new(shader); + MiscShaderData passParamRegistration = new(shaderPointer, passName); + GameShaders.Misc[$"{CalamityShaderPrefix}{registrationName}"] = passParamRegistration; + } + + private static void RegisterSceneFilter(ScreenShaderData passReg, string registrationName, EffectPriority priority = EffectPriority.High) + { + string prefixedRegistrationName = $"{CalamityShaderPrefix}{registrationName}"; + Filters.Scene[prefixedRegistrationName] = new Filter(passReg, priority); + Filters.Scene[prefixedRegistrationName].Load(); + } + + // Shorthand to register a loaded shader in Terraria's graphics engine + // All shaders registered this way are accessible under Filters.Scene + // They will use the prefix described above + private static void RegisterScreenShader(Effect shader, string passName, string registrationName, EffectPriority priority = EffectPriority.High) + { + Ref shaderPointer = new(shader); + ScreenShaderData passParamRegistration = new(shaderPointer, passName); + RegisterSceneFilter(passParamRegistration, registrationName, priority); + } } } diff --git a/Effects/Dyes/AcidRainDyeShader.fx b/Effects/Dyes/AcidRainDyeShader.fx new file mode 100644 index 0000000000..b1b70d1a13 --- /dev/null +++ b/Effects/Dyes/AcidRainDyeShader.fx @@ -0,0 +1,44 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + // pixelate the effect + float2 pixelationFactor = 2 / uImageSize0; + float2 noiseCoords = floor(coords / pixelationFactor) * pixelationFactor; + + float3 greene = uSecondaryColor; + + float2 framedCoords = (noiseCoords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * float2(0.7, 0.025); + float2 modifiedCoords = framedCoords; + modifiedCoords.y -= uTime * 0.025; // Cause the effect to travel downwards + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + float4 color = tex2D(uImage0, coords); + + float3 finalColor = lerp(uSecondaryColor, float3(noiseColor.r, noiseColor.g, noiseColor.b), noiseColor); // Applies green to the noise + + return float4(finalColor, 1) * color * sampleColor * float4(greene.rgb, 1); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/AcidRainDyeShader.xnb b/Effects/Dyes/AcidRainDyeShader.xnb new file mode 100644 index 0000000000..b64ffb3acc Binary files /dev/null and b/Effects/Dyes/AcidRainDyeShader.xnb differ diff --git a/Effects/Dyes/DaedalusDyeShader.fx b/Effects/Dyes/DaedalusDyeShader.fx new file mode 100644 index 0000000000..fd338cf85f --- /dev/null +++ b/Effects/Dyes/DaedalusDyeShader.fx @@ -0,0 +1,46 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float time = (sin(uTime) * 0.5 + 0.25); + float4 color = tex2D(uImage0, coords); + + float4 blue = float4(uColor, 1); + float4 purple = float4(181 / 255.0, 45 / 255.0, 196 / 255.0, 1); + + + float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * 0.4; + float2 modifiedCoords = framedCoords; + modifiedCoords.y += uTime * 0.02; // Cause the effect to travel upwards + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + + float4 lerped = lerp(blue, purple, noiseColor + time); // shift between blue and purple according to the noise + float4 dotted = dot(color.rgb, 0.5); // grayscale + + return float4(dotted * lerped.rgb, color.a) * sampleColor; +} + +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/DaedalusDyeShader.xnb b/Effects/Dyes/DaedalusDyeShader.xnb new file mode 100644 index 0000000000..b9e6c2855c Binary files /dev/null and b/Effects/Dyes/DaedalusDyeShader.xnb differ diff --git a/Effects/Dyes/ElementalDyeShader.fx b/Effects/Dyes/ElementalDyeShader.fx index 1bce69bfa1..dadb798260 100644 --- a/Effects/Dyes/ElementalDyeShader.fx +++ b/Effects/Dyes/ElementalDyeShader.fx @@ -25,21 +25,23 @@ float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD { float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw; float4 color = tex2D(uImage0, coords); - float time = (sin(uTime + framedCoords.x * sin(uTime + 3.141 * framedCoords.x) + 1.5707 * framedCoords.y) * 0.5 + 0.5) * 6; + float time = (sin(uTime + framedCoords.x * sin(uTime + 3.141 * framedCoords.x) + 1.5707 * framedCoords.y) * 0.5 + 0.5) * 8; float timeFloored = floor(time); - float3 colors[6] = + float3 colors[8] = { float3(241, 149, 49), // Solar float3(88, 201, 169), // Vortex float3(102, 200, 249), // Stardust float3(226, 76, 239) * 0.7, // Nebula + float3(201, 22, 112), // Rogue + float3(226, 76, 239) * 0.7, // Nebula float3(102, 200, 249), // Stardust float3(88, 201, 169) // Vortex }; // Use a multi-lerp to fade between colors and then base them on a trig-based time step. - color.rgb *= lerp(colors[timeFloored] / 255.0, colors[(timeFloored + 1) % 6] / 255.0, time / 6) * 1.6; + color.rgb *= lerp(colors[timeFloored] / 255.0, colors[(timeFloored + 1) % 8] / 255.0, time / 8) * 1.6; return color * sampleColor; } technique Technique1 diff --git a/Effects/Dyes/ElementalDyeShader.xnb b/Effects/Dyes/ElementalDyeShader.xnb index a058d35d1e..aae72a8590 100644 Binary files a/Effects/Dyes/ElementalDyeShader.xnb and b/Effects/Dyes/ElementalDyeShader.xnb differ diff --git a/Effects/Dyes/LivingShardDyeShader.fx b/Effects/Dyes/LivingShardDyeShader.fx new file mode 100644 index 0000000000..19d3efd920 --- /dev/null +++ b/Effects/Dyes/LivingShardDyeShader.fx @@ -0,0 +1,38 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw ; + float2 modifiedCoords = framedCoords; + modifiedCoords += uTime * 0.1; // Cause the effect to travel upwards + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + float4 color = tex2D(uImage0, coords); + + float3 finalColor = lerp(uSecondaryColor, uColor, noiseColor); // Applies green to the noise + + return float4(finalColor, 1) * color * sampleColor; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/LivingShardDyeShader.xnb b/Effects/Dyes/LivingShardDyeShader.xnb new file mode 100644 index 0000000000..202639fd8a Binary files /dev/null and b/Effects/Dyes/LivingShardDyeShader.xnb differ diff --git a/Effects/Dyes/MeldDyeShader.fx b/Effects/Dyes/MeldDyeShader.fx new file mode 100644 index 0000000000..325bf78f04 --- /dev/null +++ b/Effects/Dyes/MeldDyeShader.fx @@ -0,0 +1,77 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float2 Pixelate(float2 uv) +{ + int multi = sin(uTime * 0.1) * 200 + 200; + int2 var = int2(uv.x * multi, uv.y * multi); + //var = round(var); + return float2((float) var.x / multi, (float) var.y / multi); +} + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + // pixelate the coordinates + float2 pixelationFactor = 2 / uImageSize0; + float2 noiseCoords = floor(coords / pixelationFactor) * pixelationFactor; + + float time = sin(uTime) * 0.5; + float4 color = tex2D(uImage0, coords); + + float4 black = float4(0, 0, 0, 1); + float4 blue = float4(89 / 255.0, 70 / 255.0, 111 / 255.0, 1); + + // coords scale in size and position over time + float2 framedCoords = (noiseCoords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * (0.4 + time * 0.05); + float2 modifiedCoords = framedCoords + float2(uTime * 0.02, 1 + sin(uTime) * 0.02); + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)) * 0.5; // black noise + + float4 noiseColor2 = tex2D(uImage1, frac(modifiedCoords)) * 0.25; // green noise + + if (color.a == 0) + return 0; + + // outlines are black + if (any(color)) + { + float2 pixelSize = 1 / uImageSize0; + if (!any(tex2D(uImage0, coords + float2(pixelSize.x * 2, 0))) || + !any(tex2D(uImage0, coords + float2(-pixelSize.x * 2, 0))) || + !any(tex2D(uImage0, coords + float2(0, pixelSize.y * 2))) || + !any(tex2D(uImage0, coords + float2(0, -pixelSize.y * 2)))) + { + return color * sampleColor * black; + } + } + + float4 lerped = lerp(black, float4(uColor.rgb, 1), noiseColor); // shift between brown and orange according to the noise + float4 dotted = dot(color.rgb, 0.5); // grayscale + float3 blackandblue = (lerped.rgb + blue.rgb) / 4; // blue and shifting black combined + float4 greentoblack = float4(lerp(blackandblue * dotted.rgb, uSecondaryColor.rgb, noiseColor2.rgb), color.a); // shift between the blue black mix and green + + return float4(greentoblack.rgb, color.a) * sampleColor; +} + +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/MeldDyeShader.xnb b/Effects/Dyes/MeldDyeShader.xnb new file mode 100644 index 0000000000..f2e17a05be Binary files /dev/null and b/Effects/Dyes/MeldDyeShader.xnb differ diff --git a/Effects/Dyes/NecromanticDyeShader.fx b/Effects/Dyes/NecromanticDyeShader.fx new file mode 100644 index 0000000000..336399fba6 --- /dev/null +++ b/Effects/Dyes/NecromanticDyeShader.fx @@ -0,0 +1,50 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + // pixelate the effect + float2 pixelationFactor = 2 / uImageSize0; + float2 noiseCoords = floor(coords / pixelationFactor) * pixelationFactor; + + float3 greene = float3(0 / 255.0, 237 / 255.0, 28 / 255.0); + + float2 framedCoords = (noiseCoords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * 0.2; + float2 modifiedCoords = framedCoords; + modifiedCoords.y += uTime * 0.75; // Cause the effect to travel upwards + + float2 framedCoords2 = (noiseCoords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * 0.3; + float2 modifiedCoords2 = framedCoords2; + modifiedCoords2.y -= uTime * 0.5; // Cause the effect to travel upwards + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + float4 noiseColor2 = tex2D(uImage1, frac(modifiedCoords2)); + float4 color = tex2D(uImage0, coords); + + float3 finalColor = lerp(uColor, uSecondaryColor, noiseColor * 2); // Applies light blue to the noise + float3 finalColor2 = lerp(uColor, uSecondaryColor, noiseColor2 * 2); // Applies light blue to the noise + + return float4((finalColor + finalColor2) / 2.0, 1) * color * sampleColor; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/NecromanticDyeShader.xnb b/Effects/Dyes/NecromanticDyeShader.xnb new file mode 100644 index 0000000000..eedbd4e4a5 Binary files /dev/null and b/Effects/Dyes/NecromanticDyeShader.xnb differ diff --git a/Effects/Dyes/PlagueGooDyeShader.fx b/Effects/Dyes/PlagueGooDyeShader.fx new file mode 100644 index 0000000000..ffee4bca97 --- /dev/null +++ b/Effects/Dyes/PlagueGooDyeShader.fx @@ -0,0 +1,47 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float BlendMode_ColorBurn(float base, float blend) +{ + if (base > 1.0) + return 1.0; + else if (blend <= 0.0) + return 0.0; + else + return 1.0 - min(1.0, (1.0 - base) / blend); +} + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * 0.1; + float2 modifiedCoords = framedCoords; + modifiedCoords.y += uTime * 0.02; // Cause the effect to travel upwards + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + float4 color = tex2D(uImage0, coords); + + return float4(BlendMode_ColorBurn(color.r, uColor.r), BlendMode_ColorBurn(color.g, uColor.g), BlendMode_ColorBurn(color.b, uColor.b), color.a) * noiseColor * sampleColor; +} + +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/PlagueGooDyeShader.xnb b/Effects/Dyes/PlagueGooDyeShader.xnb new file mode 100644 index 0000000000..502501930a Binary files /dev/null and b/Effects/Dyes/PlagueGooDyeShader.xnb differ diff --git a/Effects/Dyes/PlaguePlateDyeShader.fx b/Effects/Dyes/PlaguePlateDyeShader.fx new file mode 100644 index 0000000000..014e0117d7 --- /dev/null +++ b/Effects/Dyes/PlaguePlateDyeShader.fx @@ -0,0 +1,44 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + float4 ret = color * sampleColor * float4(uColor, 1); + if (any(color)) + { + float2 pixelSize = 1 / uImageSize0; + // Only the top 2 pixels before air are colored yellow + if (!any(tex2D(uImage0, coords + float2(0, -pixelSize.y * 4))) || + !any(tex2D(uImage0, coords + float2(0, -pixelSize.y * 2)))) + { + ret = color * sampleColor * float4(uColor.rgb, 1); + } + else + ret = color * sampleColor * float4(uSecondaryColor.rgb, 1); + return ret; + } + return float4(0, 0, 0, 0); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/PlaguePlateDyeShader.xnb b/Effects/Dyes/PlaguePlateDyeShader.xnb new file mode 100644 index 0000000000..42bef8a8a1 Binary files /dev/null and b/Effects/Dyes/PlaguePlateDyeShader.xnb differ diff --git a/Effects/Dyes/ProfanedCrystalDyeShader.fx b/Effects/Dyes/ProfanedCrystalDyeShader.fx new file mode 100644 index 0000000000..f0e357446f --- /dev/null +++ b/Effects/Dyes/ProfanedCrystalDyeShader.fx @@ -0,0 +1,48 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + float a = color.a * sampleColor.a; + if (any(color)) + { + float2 pixelSize = 1 / uImageSize0; + if (!any(tex2D(uImage0, coords + float2(pixelSize.x * 2, 0))) || + !any(tex2D(uImage0, coords + float2(-pixelSize.x * 2, 0))) || + !any(tex2D(uImage0, coords + float2(0, pixelSize.y * 2))) || + !any(tex2D(uImage0, coords + float2(0, -pixelSize.y * 2)))) + { + return color * sampleColor; + } + } + + if (((color.r + color.g + color.b) / 3) > 0.3) + return float4(uColor, 1) + color * sampleColor; + else + return color * sampleColor; +} + +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/ProfanedCrystalDyeShader.xnb b/Effects/Dyes/ProfanedCrystalDyeShader.xnb new file mode 100644 index 0000000000..c3559dbd62 Binary files /dev/null and b/Effects/Dyes/ProfanedCrystalDyeShader.xnb differ diff --git a/Effects/Dyes/ProfanedRockDyeShader.fx b/Effects/Dyes/ProfanedRockDyeShader.fx new file mode 100644 index 0000000000..b980bd0934 --- /dev/null +++ b/Effects/Dyes/ProfanedRockDyeShader.fx @@ -0,0 +1,44 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float time = (sin(uTime) * 0.5 + 0.25); + float4 color = tex2D(uImage0, coords); + + float4 brown = float4(uColor, 1); + float4 orange = float4(uSecondaryColor, 1); + + float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * 0.75; + float2 modifiedCoords = framedCoords; + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + + float4 lerped = lerp(brown, orange, noiseColor + time); // shift between brown and orange according to the noise + float4 dotted = dot(color.rgb, 0.5); // grayscale + + return float4(dotted * lerped.rgb, color.a) * sampleColor; +} + +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/ProfanedRockDyeShader.xnb b/Effects/Dyes/ProfanedRockDyeShader.xnb new file mode 100644 index 0000000000..7619c74801 Binary files /dev/null and b/Effects/Dyes/ProfanedRockDyeShader.xnb differ diff --git a/Effects/Dyes/ScoriaDyeShader.fx b/Effects/Dyes/ScoriaDyeShader.fx new file mode 100644 index 0000000000..1631e11601 --- /dev/null +++ b/Effects/Dyes/ScoriaDyeShader.fx @@ -0,0 +1,64 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float betterSaturate(float var) +{ + if (var > 1) + return 1; + else if (var < 0) + return 0; + else + return var; +} + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float time = (sin(uTime * 2) * 0.5); + float timeSaturated = betterSaturate(time); + float4 color = tex2D(uImage0, coords); + + float4 brown = float4(uColor, 1); + float4 orange = float4(uSecondaryColor, 1); + float4 blue = float4(85 / 255.0, 140 / 255.0, 194 / 245.0, 1); + + + float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * 0.75; + float2 modifiedCoords = framedCoords + float2(uTime * 0.02, 0); + + float2 framedCoords2 = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * 0.5; + float2 modifiedCoords2 = framedCoords2 + float2(uTime * 0.02 + 1, 1); + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + float4 noiseColor2 = tex2D(uImage1, frac(modifiedCoords2)); + + float a = color.a * sampleColor.a; + + float4 lerped = lerp(brown, orange, noiseColor - 0.5); // shift between brown and orange according to the noise + float4 finallerp = lerp(lerped, blue, noiseColor2 - 0.5); // shift between blue and brorange according to the other noise + float4 dotted = dot(color.rgb, 0.5); // grayscale + + return float4(dotted * finallerp.rgb, color.a) * sampleColor; +} + +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/ScoriaDyeShader.xnb b/Effects/Dyes/ScoriaDyeShader.xnb new file mode 100644 index 0000000000..419ea8e6c8 Binary files /dev/null and b/Effects/Dyes/ScoriaDyeShader.xnb differ diff --git a/Effects/Dyes/SilvaDyeShader.fx b/Effects/Dyes/SilvaDyeShader.fx new file mode 100644 index 0000000000..af7ad134e6 --- /dev/null +++ b/Effects/Dyes/SilvaDyeShader.fx @@ -0,0 +1,44 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + float4 ret = color * sampleColor * float4(uColor, 1); + if (any(color)) + { + float2 pixelSize = 1 / uImageSize0; + // Only the top 2 pixels before air are colored yellow + if (!any(tex2D(uImage0, coords + float2(0, -pixelSize.y * 4))) || + !any(tex2D(uImage0, coords + float2(0, -pixelSize.y * 2)))) + { + ret = color * sampleColor * float4(uSecondaryColor.rgb, 1); + } + else + ret = color * sampleColor * float4(uColor.rgb, 1); + return lerp(ret, float4(uSecondaryColor.rgb, ret.a), sin(uTime * 3) * 0.1); + } + return float4(0, 0, 0, 0); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/SilvaDyeShader.xnb b/Effects/Dyes/SilvaDyeShader.xnb new file mode 100644 index 0000000000..7da5768b6a Binary files /dev/null and b/Effects/Dyes/SilvaDyeShader.xnb differ diff --git a/Effects/Dyes/TarragonDyeShader.fx b/Effects/Dyes/TarragonDyeShader.fx new file mode 100644 index 0000000000..e7f7d8db58 --- /dev/null +++ b/Effects/Dyes/TarragonDyeShader.fx @@ -0,0 +1,38 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * float2(0.7, 0.05); + float2 modifiedCoords = framedCoords; + //modifiedCoords.y -= uTime * 0.1; // Cause the effect to travel upwards + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + float4 color = tex2D(uImage0, coords); + + float3 finalColor = lerp(uSecondaryColor, float3(noiseColor.r, noiseColor.g, noiseColor.b), 0.5); // Applies green to the noise + + return float4(finalColor, 1) * color * 1.8 * sampleColor * float4(uColor.rgb, 1); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/TarragonDyeShader.xnb b/Effects/Dyes/TarragonDyeShader.xnb new file mode 100644 index 0000000000..3177fcd55e Binary files /dev/null and b/Effects/Dyes/TarragonDyeShader.xnb differ diff --git a/Effects/Dyes/WulfrumDyeShader.fx b/Effects/Dyes/WulfrumDyeShader.fx new file mode 100644 index 0000000000..f957622a1d --- /dev/null +++ b/Effects/Dyes/WulfrumDyeShader.fx @@ -0,0 +1,38 @@ +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; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw * 0.5; + float2 modifiedCoords = framedCoords; + modifiedCoords.y += uTime * 0.05; // Cause the effect to travel upwards + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + float4 color = tex2D(uImage0, coords); + + float3 finalColor = lerp(uColor, float3(noiseColor.r, noiseColor.g, noiseColor.b), 0.5); // Applies green to the noise + + return float4(finalColor, 1) * color * 1.8 * sampleColor; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/WulfrumDyeShader.xnb b/Effects/Dyes/WulfrumDyeShader.xnb new file mode 100644 index 0000000000..c2f1188598 Binary files /dev/null and b/Effects/Dyes/WulfrumDyeShader.xnb differ diff --git a/Effects/ExoVortexShader.fx b/Effects/ExoVortexShader.fx index a56cd1b0c0..13d37e76ba 100644 --- a/Effects/ExoVortexShader.fx +++ b/Effects/ExoVortexShader.fx @@ -24,7 +24,7 @@ float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD float swirlCosine = sin(swirlRotation + 1.5707); float2x2 swirlRotationMatrix = float2x2(swirlCosine, -swirlSine, swirlSine, swirlCosine); float2 swirlCoordinates = mul(centeredCoords, swirlRotationMatrix) + 0.5; - return tex2D(uImage0, swirlCoordinates) * sampleColor * swirlColorFade; + return tex2D(uImage0, swirlCoordinates) * float4(sampleColor.rgb, uOpacity) * swirlColorFade; } technique Technique1 { diff --git a/Effects/ExoVortexShader.xnb b/Effects/ExoVortexShader.xnb index 9c2cdf2d16..7970937746 100644 Binary files a/Effects/ExoVortexShader.xnb and b/Effects/ExoVortexShader.xnb differ diff --git a/Enums/HardmodeCrateType.cs b/Enums/HardmodeCrateType.cs new file mode 100644 index 0000000000..6febfd2600 --- /dev/null +++ b/Enums/HardmodeCrateType.cs @@ -0,0 +1,9 @@ +namespace CalamityMod.Enums +{ + public enum HardmodeCrateType + { + Biome, + Mythril, + Titanium + } +} diff --git a/Enums/HealTextType.cs b/Enums/HealTextType.cs new file mode 100644 index 0000000000..fe69a25da0 --- /dev/null +++ b/Enums/HealTextType.cs @@ -0,0 +1,9 @@ +namespace CalamityMod.Enums +{ + public enum HealTextType + { + None, + Local, + Broadcast + } +} diff --git a/Enums/SunkenSeaBiomeFlags.cs b/Enums/SunkenSeaBiomeFlags.cs new file mode 100644 index 0000000000..60de02c354 --- /dev/null +++ b/Enums/SunkenSeaBiomeFlags.cs @@ -0,0 +1,19 @@ +using System; + +namespace CalamityMod.Enums +{ + /// + /// The flags corresponding for the possible spawns for a Sunken Sea NPC. + /// + [Flags] + public enum SunkenSeaBiomeFlags : byte + { + None = 0, + UndergroundDesert = 1, + TimelessShores = 2, + RadiantReefs = 4, + PolypForest = 8, + GleamingBurrows = 16, + BasaltGully = 32, + } +} diff --git a/Enums/VanillaWingID.cs b/Enums/VanillaWingID.cs index d6951d0d70..1604736eea 100644 --- a/Enums/VanillaWingID.cs +++ b/Enums/VanillaWingID.cs @@ -2,57 +2,51 @@ { public enum VanillaWingID { - FledglingWings = 46, - // Early HM Wings DemonWings = 1, AngelWings = 2, - FairyWings = 6, - FinWings = 25, - // Post-Mech Wings + RedsWings = 3, Jetpack = 4, ButterflyWings = 5, + FairyWings = 6, HarpyWings = 7, + BoneWings = 8, FlameWings = 9, FrozenWings = 10, + SpectreWings = 11, + SteampunkWings = 12, + LeafWings = 13, BatWings = 14, BeeWings = 15, - // Post-Plantera Wings - BoneWings = 8, - SpectreWings = 11, - LeafWings = 13, - Hoverboard = 22, - MothronWings = 27, - // Post-Golem Wings - BeetleWings = 24, - SteampunkWings = 12, - TatteredFairyWings = 20, - SpookyWings = 21, - FestiveWings = 23, - FishronWings = 26, - RainbowWings = 44, // Empress Wings - BetsyWings = 37, - // Post-Moon Lord Wings - WingsSolar = 29, - WingsNebula = 30, - WingsVortex = 31, - WingsStardust = 32, - LongRainbowTrailWings = 45, // Celestial Starboard - // Dev Wings - RedsWings = 3, DTownsWings = 16, WillsWings = 17, CrownosWings = 18, CenxsWings = 19, + TatteredFairyWings = 20, + SpookyWings = 21, + Hoverboard = 22, + FestiveWings = 23, + BeetleWings = 24, + FinWings = 25, + FishronWings = 26, + MothronWings = 27, BejeweledValkyrieWing = 28, // Lazure's Barrier Platform + WingsSolar = 29, + WingsVortex = 30, + WingsNebula = 31, + WingsStardust = 32, Yoraiz0rWings = 33, // Yoraiz0r's Spell JimsWings = 34, SkiphsWings = 35, LokisWings = 36, + BetsyWings = 37, ArkhalisWings = 38, LeinforsWings = 39, GhostarsWings = 40, SafemanWings = 41, FoodBarbarianWings = 42, GroxTheGreatWings = 43, + RainbowWings = 44, // Empress Wings + LongRainbowTrailWings = 45, // Celestial Starboard + FledglingWings = 46, } } diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index a56fbe8ce2..d408942aa2 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.OldDuke; +using CalamityMod.Packets; using CalamityMod.Projectiles.Boss; using CalamityMod.UI; using CalamityMod.World; @@ -59,7 +60,7 @@ namespace CalamityMod.Events public static Dictionary PossibleMinibossesPolter = new(); - public static List AllMinibosses => PossibleMinibossesAS.Select(miniboss => miniboss.Key).ToList().Concat(PossibleMinibossesPolter.Select(miniboss => miniboss.Key)).Distinct().ToList(); + public static List AllMinibosses => PossibleMinibossesAS.Select(miniboss => miniboss.Key).Concat(PossibleMinibossesPolter.Select(miniboss => miniboss.Key)).Distinct().ToList(); public static bool AnyRainMinibosses { @@ -297,7 +298,7 @@ namespace CalamityMod.Events int playerClosestToAbyss = Player.FindClosest(new Vector2(Abyss.AtLeftSideOfWorld ? 0 : Main.maxTilesX * 16, (int)Main.worldSurface), 0, 0); Player closestToAbyss = Main.player[playerClosestToAbyss]; if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(closestToAbyss.Center.X - (Abyss.AtLeftSideOfWorld ? 0 : Main.maxTilesX * 16)) <= 12000f) - Projectile.NewProjectile(source, closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero, ModContent.ProjectileType(), 120, 8f, Main.myPlayer); + Projectile.NewProjectile(source, closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero, ModContent.ProjectileType(), 0, 8f, Main.myPlayer); } } } @@ -330,36 +331,17 @@ namespace CalamityMod.Events DownedBossSystem.downedAquaticScourgeAcidRain = DownedBossSystem.downedAquaticScourge; } HasTriedToSummonOldDuke = false; - CalamityMod.StopRain(); + CalamityWorld.StopRain(); } CalamityNetcode.SyncWorld(); - // You will be tempted to turn this into a single if conditional. - // Don't do this. Doing so has caused so much misery, with various things being read instead - // of the correct thing, like booleans being mixed up in the sending and receiving process. - // In short, leave this alone. - if (Main.netMode == NetmodeID.Server) + // Flow: 2024/09/06 + // Salute for the one who wrote 3 if conditional block after experiencing immeasurable torment with packet generations + if (Main.dedServ) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.AcidRainSync); - netMessage.Write(AcidRainEventIsOngoing); - netMessage.Write(AccumulatedKillPoints); - netMessage.Write(TimeSinceLastAcidRainKill); - netMessage.Send(); - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.AcidRainOldDukeSummonSync); - netMessage.Write(HasTriedToSummonOldDuke); - netMessage.Send(); - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.EncounteredOldDukeSync); - netMessage.Write(OldDukeHasBeenEncountered); - netMessage.Send(); + AcidRainSyncPacket.Send(); + AcidRainOldDukeSummonSyncPacket.Send(); + EncounteredOldDukeSyncPacket.Send(); } } } diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index c702f6da53..d3bf603ee5 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -34,10 +34,12 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; +using CalamityMod.Packets; using CalamityMod.Projectiles.Typeless; using CalamityMod.Skies; using CalamityMod.Systems; using CalamityMod.UI.DraedonSummoning; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -50,8 +52,7 @@ using ArtemisBoss = CalamityMod.NPCs.ExoMechs.Artemis.Artemis; namespace CalamityMod.Events { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public class BossRushEvent + public sealed class BossRushEvent : ModSystem { public enum TimeChangeContext { @@ -135,7 +136,7 @@ namespace CalamityMod.Events public static readonly SoundStyle VictorySound = new("CalamityMod/Sounds/Custom/BossRush/BossRushVictory"); #region Loading and Unloading - public static void Load() + public override void OnModLoad() { BossIDsAfterDeath = new Dictionary(); @@ -454,7 +455,7 @@ namespace CalamityMod.Events }; } - public static void Unload() + public override void Unload() { Bosses = null; BossIDsAfterDeath = null; @@ -488,7 +489,7 @@ namespace CalamityMod.Events return -1; } int tier = CurrentTier; - if (CalamityMod.Instance.MusicAvailable) + if (ExternalMods.MusicAvailable) { // Boss Rush music for tier 5 doesn't exist if (tier > 4) @@ -540,12 +541,9 @@ namespace CalamityMod.Events if (HostileProjectileKillCounter == 1) CalamityUtils.KillAllHostileProjectiles(); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BRHostileProjKillSync); - netMessage.Write(HostileProjectileKillCounter); - netMessage.Send(); + BRHostileProjKillSyncPacket.Send(); } } } @@ -559,12 +557,9 @@ namespace CalamityMod.Events if (BossRushStage != 0) { BossRushStage = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(BossRushStage); - netMessage.Send(); + BossRushStagePacket.Send(); } } return; @@ -595,7 +590,7 @@ namespace CalamityMod.Events // Change time as necessary. if (Bosses[BossRushStage].ToChangeTimeTo != TimeChangeContext.None) - CalamityUtils.ChangeTime(Bosses[BossRushStage].ToChangeTimeTo == TimeChangeContext.Day); + CalamityWorld.ResetTime(Bosses[BossRushStage].ToChangeTimeTo == TimeChangeContext.Day); // Play a special boss roar sound by default. if (!Bosses[BossRushStage].UsesSpecialSound) @@ -633,9 +628,7 @@ namespace CalamityMod.Events } else { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.EndBossRush); - netMessage.Send(); + EndBossRushPacket.Send(); } } @@ -663,20 +656,11 @@ namespace CalamityMod.Events CalamityUtils.KillAllHostileProjectiles(); CalamityNetcode.SyncWorld(); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(BossRushStage); - netMessage.Send(); - var netMessage2 = CalamityMod.Instance.GetPacket(); - netMessage2.Write((byte)CalamityModMessageType.BossRushStartTimer); - netMessage2.Write(StartTimer); - netMessage2.Send(); - var netMessage3 = CalamityMod.Instance.GetPacket(); - netMessage3.Write((byte)CalamityModMessageType.BossRushEndTimer); - netMessage3.Write(EndTimer); - netMessage3.Send(); + BossRushStagePacket.Send(); + BossRushStartTimerPacket.Send(); + BossRushEndTimerPacket.Send(); } } @@ -761,16 +745,10 @@ namespace CalamityMod.Events } // Sync the stage and progress of Boss Rush whenever a relevant boss dies. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(BossRushStage); - netMessage.Send(); - var netMessage2 = mod.GetPacket(); - netMessage2.Write((byte)CalamityModMessageType.BRHostileProjKillSync); - netMessage2.Write(HostileProjectileKillCounter); - netMessage2.Send(); + BossRushStagePacket.Send(); + BRHostileProjKillSyncPacket.Send(); } BossRushSky.CurrentInterest = 0.85f; @@ -798,25 +776,19 @@ namespace CalamityMod.Events public static void SyncStartTimer(int time) { StartTimer = time; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) return; - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStartTimer); - netMessage.Write(StartTimer); - netMessage.Send(); + BossRushStartTimerPacket.Send(); } public static void SyncEndTimer(int time) { EndTimer = time; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) return; - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushEndTimer); - netMessage.Write(EndTimer); - netMessage.Send(); + BossRushEndTimerPacket.Send(); } #endregion } diff --git a/ExtraJumps/SulphurJump.cs b/ExtraJumps/SulphurJump.cs index 4c0866b529..eef2cbb6c1 100644 --- a/ExtraJumps/SulphurJump.cs +++ b/ExtraJumps/SulphurJump.cs @@ -47,7 +47,6 @@ namespace CalamityMod.ExtraJumps { var source = player.GetSource_Misc("0"); int damage = (int)player.GetTotalDamage().ApplyTo(20); - damage = player.ApplyArmorAccDamageBonusesTo(damage); int bubble = Projectile.NewProjectile(source, new Vector2(player.position.X, player.position.Y + (player.gravDir == -1f ? 20 : -20)), Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1f, 0f); if (bubble.WithinBounds(Main.maxProjectiles)) diff --git a/ExtraTextures/Bestiary/AquaticScourge_Bestiary.png b/ExtraTextures/Bestiary/AquaticScourge_Bestiary.png deleted file mode 100644 index aae7fca94e..0000000000 Binary files a/ExtraTextures/Bestiary/AquaticScourge_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/ArmoredDigger_Bestiary.png b/ExtraTextures/Bestiary/ArmoredDigger_Bestiary.png deleted file mode 100644 index e0fb638d67..0000000000 Binary files a/ExtraTextures/Bestiary/ArmoredDigger_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/AstrumDeus_Bestiary.png b/ExtraTextures/Bestiary/AstrumDeus_Bestiary.png deleted file mode 100644 index 58dd541f69..0000000000 Binary files a/ExtraTextures/Bestiary/AstrumDeus_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/CosmicGuardian_Bestiary.png b/ExtraTextures/Bestiary/CosmicGuardian_Bestiary.png deleted file mode 100644 index 9f46bc2836..0000000000 Binary files a/ExtraTextures/Bestiary/CosmicGuardian_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/DevourerofGods_Bestiary.png b/ExtraTextures/Bestiary/DevourerofGods_Bestiary.png deleted file mode 100644 index abe0519bc4..0000000000 Binary files a/ExtraTextures/Bestiary/DevourerofGods_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/EidolonWyrm_Bestiary.png b/ExtraTextures/Bestiary/EidolonWyrm_Bestiary.png deleted file mode 100644 index fa399c67e7..0000000000 Binary files a/ExtraTextures/Bestiary/EidolonWyrm_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/GulperEel_Bestiary.png b/ExtraTextures/Bestiary/GulperEel_Bestiary.png deleted file mode 100644 index 85eab7d9db..0000000000 Binary files a/ExtraTextures/Bestiary/GulperEel_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/Oarfish_Bestiary.png b/ExtraTextures/Bestiary/Oarfish_Bestiary.png deleted file mode 100644 index acc08a6575..0000000000 Binary files a/ExtraTextures/Bestiary/Oarfish_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/PerforatorLarge_Bestiary.png b/ExtraTextures/Bestiary/PerforatorLarge_Bestiary.png deleted file mode 100644 index 58875863e6..0000000000 Binary files a/ExtraTextures/Bestiary/PerforatorLarge_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/PerforatorMedium_Bestiary.png b/ExtraTextures/Bestiary/PerforatorMedium_Bestiary.png deleted file mode 100644 index 4598f54e7a..0000000000 Binary files a/ExtraTextures/Bestiary/PerforatorMedium_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/PerforatorSmall_Bestiary.png b/ExtraTextures/Bestiary/PerforatorSmall_Bestiary.png deleted file mode 100644 index afbd009ae8..0000000000 Binary files a/ExtraTextures/Bestiary/PerforatorSmall_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/PrimordialWyrm_Bestiary.png b/ExtraTextures/Bestiary/PrimordialWyrm_Bestiary.png deleted file mode 100644 index 4adc7140e5..0000000000 Binary files a/ExtraTextures/Bestiary/PrimordialWyrm_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/SeaSerpent_Bestiary.png b/ExtraTextures/Bestiary/SeaSerpent_Bestiary.png deleted file mode 100644 index 55dd91d297..0000000000 Binary files a/ExtraTextures/Bestiary/SeaSerpent_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/SlimeGod_Bestiary.png b/ExtraTextures/Bestiary/SlimeGod_Bestiary.png new file mode 100644 index 0000000000..dbe7056e82 Binary files /dev/null and b/ExtraTextures/Bestiary/SlimeGod_Bestiary.png differ diff --git a/ExtraTextures/Bestiary/StormWeaver_Bestiary.png b/ExtraTextures/Bestiary/StormWeaver_Bestiary.png deleted file mode 100644 index 05e198b74b..0000000000 Binary files a/ExtraTextures/Bestiary/StormWeaver_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/Thanatos_Bestiary.png b/ExtraTextures/Bestiary/Thanatos_Bestiary.png deleted file mode 100644 index 63f8dc97a9..0000000000 Binary files a/ExtraTextures/Bestiary/Thanatos_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/ChadPrime_Head_Boss.png b/ExtraTextures/ChadPrime_Head_Boss.png new file mode 100644 index 0000000000..313edebc2c Binary files /dev/null and b/ExtraTextures/ChadPrime_Head_Boss.png differ diff --git a/Projectiles/Rogue/ExplosiveSun.png b/ExtraTextures/ExplosiveSun.png similarity index 100% rename from Projectiles/Rogue/ExplosiveSun.png rename to ExtraTextures/ExplosiveSun.png diff --git a/Projectiles/Rogue/ExplosiveSun2.png b/ExtraTextures/ExplosiveSun2.png similarity index 100% rename from Projectiles/Rogue/ExplosiveSun2.png rename to ExtraTextures/ExplosiveSun2.png diff --git a/Projectiles/Rogue/ExplosiveSun3.png b/ExtraTextures/ExplosiveSun3.png similarity index 100% rename from Projectiles/Rogue/ExplosiveSun3.png rename to ExtraTextures/ExplosiveSun3.png diff --git a/ExtraTextures/ExtraTextureRefs.cs b/ExtraTextures/ExtraTextureRefs.cs new file mode 100644 index 0000000000..bc86cb89a7 --- /dev/null +++ b/ExtraTextures/ExtraTextureRefs.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.ExtraTextures +{ + [Autoload(Side = ModSide.Client)] + public class ExtraTextureRefs : ModSystem + { + // Destroyer glowmasks + public static Asset DestroyerHeadGlowmask; + public static Asset DestroyerBodyGlowmask; + public static Asset DestroyerTailGlowmask; + public static Asset ProbeGlowmask; + + // Master Rev+ Skeletron Prime + public static Asset ChadPrime; + public static Asset ChadPrimeEyeGlowmask; + + // WoF, These are not "exactly" the ExtraTextures. But + public static Asset WallOfFleshEyeGlowmask; + public static Asset WallOfFleshDemonSickleTexture; + + // Flying Carpet Replacements + public static Asset FlyingCarpetVanilla; + public static Asset FlyingCarpetAuric; + + // Lucky Buff icon replacements + public static Asset LuckIconGreater; + public static Asset LuckIconVanilla; + public static Asset LuckIconLesser; + + // Particles + public static Asset CircularSmear; + public static Asset CircularSmearFire1; + public static Asset CircularSmearFire2; + public static Asset CircularSmearFire3; + + // Boss Heads + // I know it's not exactly a Texture2D but it belongs to ExtraTextures. + public static int BossHeadIndex_ChadPrime; + + public override void Load() + { + string chadPrimeIconPath = "CalamityMod/ExtraTextures/ChadPrime_Head_Boss"; + BossHeadIndex_ChadPrime = CalamityMod.Instance.AddBossHeadTexture(chadPrimeIconPath, -1); + } + + + // TODO: - Every other ExtraTextures Reference could be move in here + public override void OnModLoad() + { + DestroyerHeadGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow", AssetRequestMode.AsyncLoad); + DestroyerBodyGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad); + DestroyerTailGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad); + + ProbeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/ProbeGlow", AssetRequestMode.AsyncLoad); + + ChadPrime = ModContent.Request("CalamityMod/ExtraTextures/ChadPrime", AssetRequestMode.AsyncLoad); + ChadPrimeEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/ChadPrimeHeadGlow", AssetRequestMode.AsyncLoad); + + WallOfFleshEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow", AssetRequestMode.AsyncLoad); + WallOfFleshDemonSickleTexture = ModContent.Request("CalamityMod/Projectiles/Melee/ForbiddenOathbladeProjectile", AssetRequestMode.AsyncLoad); + + FlyingCarpetVanilla = TextureAssets.FlyingCarpet; + FlyingCarpetAuric = ModContent.Request("CalamityMod/ExtraTextures/AuricCarpet", AssetRequestMode.AsyncLoad); + + LuckIconGreater = ModContent.Request("CalamityMod/ExtraTextures/VanillaBuffs/LuckyGreater", AssetRequestMode.AsyncLoad); + LuckIconVanilla = TextureAssets.Buff[BuffID.Lucky]; + LuckIconLesser = ModContent.Request("CalamityMod/ExtraTextures/VanillaBuffs/LuckyLesser", AssetRequestMode.AsyncLoad); + + CircularSmear = ModContent.Request("CalamityMod/Particles/CircularSmear", AssetRequestMode.AsyncLoad); + CircularSmearFire1 = ModContent.Request("CalamityMod/Particles/CircularSmearFire1", AssetRequestMode.AsyncLoad); + CircularSmearFire2 = ModContent.Request("CalamityMod/Particles/CircularSmearFire2", AssetRequestMode.AsyncLoad); + CircularSmearFire3 = ModContent.Request("CalamityMod/Particles/CircularSmearFire3", AssetRequestMode.AsyncLoad); + } + + public override void Unload() + { + if (!Main.dedServ) + { + TextureAssets.FlyingCarpet = FlyingCarpetVanilla; + TextureAssets.Buff[BuffID.Lucky] = LuckIconVanilla; + } + } + } +} diff --git a/ExtraTextures/GreyscaleGradients/Bark.png b/ExtraTextures/GreyscaleGradients/Bark.png new file mode 100644 index 0000000000..7e78c45341 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/Bark.png differ diff --git a/ExtraTextures/GreyscaleGradients/OrnatePattern.png b/ExtraTextures/GreyscaleGradients/OrnatePattern.png new file mode 100644 index 0000000000..379093fbb1 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/OrnatePattern.png differ diff --git a/ExtraTextures/GreyscaleGradients/Veins.png b/ExtraTextures/GreyscaleGradients/Veins.png new file mode 100644 index 0000000000..61b0379fe4 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/Veins.png differ diff --git a/ExtraTextures/GreyscaleGradients/VoronoiShapes3.png b/ExtraTextures/GreyscaleGradients/VoronoiShapes3.png new file mode 100644 index 0000000000..f61a7a788e Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/VoronoiShapes3.png differ diff --git a/ExtraTextures/Jesus.png b/ExtraTextures/Jesus.png new file mode 100644 index 0000000000..8750d55c55 Binary files /dev/null and b/ExtraTextures/Jesus.png differ diff --git a/ExtraTextures/Lasers/BirbAuraEnd.png b/ExtraTextures/Lasers/BirbAuraEnd.png deleted file mode 100644 index 4003d549d6..0000000000 Binary files a/ExtraTextures/Lasers/BirbAuraEnd.png and /dev/null differ diff --git a/ExtraTextures/Lasers/BirbAuraEndpoints.png b/ExtraTextures/Lasers/BirbAuraEndpoints.png new file mode 100644 index 0000000000..bf4bfa8594 Binary files /dev/null and b/ExtraTextures/Lasers/BirbAuraEndpoints.png differ diff --git a/ExtraTextures/Lasers/BirbAuraStart.png b/ExtraTextures/Lasers/BirbAuraStart.png deleted file mode 100644 index 1a999c374d..0000000000 Binary files a/ExtraTextures/Lasers/BirbAuraStart.png and /dev/null differ diff --git a/ExtraTextures/Lasers/FancyBeamEnd.png b/ExtraTextures/Lasers/FancyBeamEnd.png new file mode 100644 index 0000000000..22e2bd4835 Binary files /dev/null and b/ExtraTextures/Lasers/FancyBeamEnd.png differ diff --git a/ExtraTextures/Lasers/FancyBeamMiddle.png b/ExtraTextures/Lasers/FancyBeamMiddle.png new file mode 100644 index 0000000000..f04936e41d Binary files /dev/null and b/ExtraTextures/Lasers/FancyBeamMiddle.png differ diff --git a/ExtraTextures/Lasers/FancyBeamStart.png b/ExtraTextures/Lasers/FancyBeamStart.png new file mode 100644 index 0000000000..7e60c6f086 Binary files /dev/null and b/ExtraTextures/Lasers/FancyBeamStart.png differ diff --git a/ExtraTextures/Lasers/PrismaticRayEnd.png b/ExtraTextures/Lasers/PrismaticRayEnd.png new file mode 100644 index 0000000000..a9612f488d Binary files /dev/null and b/ExtraTextures/Lasers/PrismaticRayEnd.png differ diff --git a/ExtraTextures/Lasers/PrismaticRayMid.png b/ExtraTextures/Lasers/PrismaticRayMid.png new file mode 100644 index 0000000000..8dfbb685a3 Binary files /dev/null and b/ExtraTextures/Lasers/PrismaticRayMid.png differ diff --git a/ExtraTextures/Lasers/ProvidenceHolyRayStart.png b/ExtraTextures/Lasers/ProvidenceHolyRayStart.png new file mode 100644 index 0000000000..efbc766d6c Binary files /dev/null and b/ExtraTextures/Lasers/ProvidenceHolyRayStart.png differ diff --git a/ExtraTextures/Lasers/TauCannonBeamEnd.png b/ExtraTextures/Lasers/TauCannonBeamEnd.png new file mode 100644 index 0000000000..25dc989374 Binary files /dev/null and b/ExtraTextures/Lasers/TauCannonBeamEnd.png differ diff --git a/ExtraTextures/Lasers/TauCannonBeamMiddle.png b/ExtraTextures/Lasers/TauCannonBeamMiddle.png new file mode 100644 index 0000000000..ade1934adf Binary files /dev/null and b/ExtraTextures/Lasers/TauCannonBeamMiddle.png differ diff --git a/ExtraTextures/Lasers/TauCannonBeamStart.png b/ExtraTextures/Lasers/TauCannonBeamStart.png new file mode 100644 index 0000000000..bb074904bb Binary files /dev/null and b/ExtraTextures/Lasers/TauCannonBeamStart.png differ diff --git a/ExtraTextures/VanillaBuffs/LuckyGreater.png b/ExtraTextures/VanillaBuffs/LuckyGreater.png new file mode 100644 index 0000000000..76441d55cd Binary files /dev/null and b/ExtraTextures/VanillaBuffs/LuckyGreater.png differ diff --git a/ExtraTextures/VanillaBuffs/LuckyLesser.png b/ExtraTextures/VanillaBuffs/LuckyLesser.png new file mode 100644 index 0000000000..95ed2f505f Binary files /dev/null and b/ExtraTextures/VanillaBuffs/LuckyLesser.png differ diff --git a/FluidSimulation/FluidField.cs b/FluidSimulation/FluidField.cs index 03910f257f..eed9ca02fe 100644 --- a/FluidSimulation/FluidField.cs +++ b/FluidSimulation/FluidField.cs @@ -60,7 +60,7 @@ namespace CalamityMod.FluidSimulation { get { - if (Main.netMode != NetmodeID.Server && basicShader is null) + if (!Main.dedServ && basicShader is null) { basicShader = new BasicEffect(Main.instance.GraphicsDevice) { @@ -231,7 +231,7 @@ namespace CalamityMod.FluidSimulation { // Everything here involves heavy manipulation of render targets to work. Doing any of that on the server // would certainly result in a crash due to a lack of a graphics device. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; if (!ShouldUpdate) diff --git a/FluidSimulation/FluidFieldState.cs b/FluidSimulation/FluidFieldState.cs index e2825f3fd3..9dfa619573 100644 --- a/FluidSimulation/FluidFieldState.cs +++ b/FluidSimulation/FluidFieldState.cs @@ -26,7 +26,7 @@ namespace CalamityMod.FluidSimulation public FluidFieldState(int size, SurfaceFormat fieldContents = SurfaceFormat.Color) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Size = size; diff --git a/Fonts/CodebreakerDialog.xnb b/Fonts/CodebreakerDialog.xnb index f488541ef9..eef588aef5 100644 Binary files a/Fonts/CodebreakerDialog.xnb and b/Fonts/CodebreakerDialog.xnb differ diff --git a/Fonts/Wingdings.xnb b/Fonts/Wingdings.xnb new file mode 100644 index 0000000000..a487f2746c Binary files /dev/null and b/Fonts/Wingdings.xnb differ diff --git a/ForegroundDrawing/ForegroundManager.cs b/ForegroundDrawing/ForegroundManager.cs deleted file mode 100644 index 88259a63b5..0000000000 --- a/ForegroundDrawing/ForegroundManager.cs +++ /dev/null @@ -1,53 +0,0 @@ -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; - -namespace CalamityMod.ForegroundDrawing -{ - interface IForegroundTile - { - void ForegroundDraw(int x, int y, SpriteBatch spriteBatch); - } - - public static class ForegroundManager - { - private static List _foregroundElements; - private static int _foregroundElementCount; - - internal static void Load() - { - _foregroundElements = new List(1000); - _foregroundElementCount = 0; - } - - public static void AddForegroundDrawingPoint(int x, int y) - { - _foregroundElements.Add(new Point(x, y)); - _foregroundElementCount++; - } - - - public static void DrawTiles() - { - for (int i = 0; i < _foregroundElementCount; i++) - { - ushort type = Main.tile[_foregroundElements[i]].TileType; - if (TileLoader.GetTile(type) is IForegroundTile fgTile) - fgTile.ForegroundDraw(_foregroundElements[i].X, _foregroundElements[i].Y, Main.spriteBatch); - } - } - - public static void ClearTiles() - { - _foregroundElements.Clear(); - _foregroundElementCount = 0; - } - } -} diff --git a/Gores/AstralWaterDroplet.cs b/Gores/AstralWaterDroplet.cs deleted file mode 100644 index 0022de1b56..0000000000 --- a/Gores/AstralWaterDroplet.cs +++ /dev/null @@ -1,167 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -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; - gore.behindTiles = true; - gore.timeLeft = Gore.goreTime * 3; - } - - public override bool Update(Gore gore) - { - if ((double)gore.position.Y < Main.worldSurface * 16.0 + 8.0) - { - gore.alpha = 0; - } - else - { - gore.alpha = 100; - } - int goreFrameDelay = 4; - gore.frameCounter++; - if (gore.frame <= 4) - { - int goreXPos = (int)(gore.position.X / 16f); - int goreYPos = (int)(gore.position.Y / 16f) - 1; - if (WorldGen.InWorld(goreXPos, goreYPos, 0) && !Main.tile[goreXPos, goreYPos].HasTile) - { - gore.active = false; - } - if (gore.frame == 0) - { - goreFrameDelay = 24 + Main.rand.Next(256); - } - if (gore.frame == 1) - { - goreFrameDelay = 24 + Main.rand.Next(256); - } - if (gore.frame == 2) - { - goreFrameDelay = 24 + Main.rand.Next(256); - } - if (gore.frame == 3) - { - goreFrameDelay = 24 + Main.rand.Next(96); - } - if (gore.frame == 5) - { - goreFrameDelay = 16 + Main.rand.Next(64); - } - if ((int)gore.frameCounter >= goreFrameDelay) - { - gore.frameCounter = 0; - gore.frame += 1; - if (gore.frame == 5 && Main.netMode != NetmodeID.Server) - { - int astralWater = Gore.NewGore(new EntitySource_Misc("0"), gore.position, gore.velocity, gore.type, 1f); - Main.gore[astralWater].frame = 9; - Main.gore[astralWater].velocity *= 0f; - } - } - } - else if (gore.frame <= 6) - { - goreFrameDelay = 8; - if ((int)gore.frameCounter >= goreFrameDelay) - { - gore.frameCounter = 0; - gore.frame += 1; - if (gore.frame == 7) - { - gore.active = false; - } - } - } - else if (gore.frame <= 9) - { - goreFrameDelay = 6; - gore.velocity.Y += 0.2f; - if ((double)gore.velocity.Y < 0.5) - { - gore.velocity.Y = 0.5f; - } - if (gore.velocity.Y > 12f) - { - gore.velocity.Y = 12f; - } - if ((int)gore.frameCounter >= goreFrameDelay) - { - gore.frameCounter = 0; - gore.frame += 1; - } - if (gore.frame > 9) - { - gore.frame = 7; - } - } - else - { - gore.velocity.Y += 0.1f; - if ((int)gore.frameCounter >= goreFrameDelay) - { - gore.frameCounter = 0; - gore.frame += 1; - } - gore.velocity *= 0f; - if (gore.frame > 14) - { - gore.active = false; - } - } - - Vector2 goreVelCheck = gore.velocity; - gore.velocity = Collision.TileCollision(gore.position, gore.velocity, 16, 14, false, false, 1); - if (gore.velocity != goreVelCheck) - { - if (gore.frame < 10) - { - gore.frame = 10; - gore.frameCounter = 0; - if (gore.type != 716 && gore.type != 717 && gore.type != 943) - { - SoundEngine.PlaySound(SoundID.Drip, gore.position + Vector2.One * 8); - } - } - } - else if (Collision.WetCollision(gore.position + gore.velocity, 16, 14)) - { - if (gore.frame < 10) - { - gore.frame = 10; - gore.frameCounter = 0; - if (gore.type != 716 && gore.type != 717 && gore.type != 943) - { - SoundEngine.PlaySound(SoundID.Drip, gore.position + Vector2.One * 8); - } - ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(gore.position + new Vector2(8f, 8f), 1f, RippleShape.Square, 0f); - } - int goreTileX = (int)(gore.position.X + 8f) / 16; - int goreTileY = (int)(gore.position.Y + 14f) / 16; - if (Main.tile[goreTileX, goreTileY] != null && Main.tile[goreTileX, goreTileY].LiquidAmount > 0) - { - gore.velocity *= 0f; - gore.position.Y = (float)(goreTileY * 16 - (int)(Main.tile[goreTileX, goreTileY].LiquidAmount / 16)); - } - } - - return true; - } - } -} diff --git a/Gores/BucketZombie/BucketZombie.png b/Gores/BucketZombie/BucketZombie.png new file mode 100644 index 0000000000..ad58d14616 Binary files /dev/null and b/Gores/BucketZombie/BucketZombie.png differ diff --git a/Gores/BucketZombie/BucketZombie2.png b/Gores/BucketZombie/BucketZombie2.png new file mode 100644 index 0000000000..f79aecdb51 Binary files /dev/null and b/Gores/BucketZombie/BucketZombie2.png differ diff --git a/Gores/BucketZombie/BucketZombie3.png b/Gores/BucketZombie/BucketZombie3.png new file mode 100644 index 0000000000..5706ea8e3d Binary files /dev/null and b/Gores/BucketZombie/BucketZombie3.png differ diff --git a/Gores/BucketZombie/BucketZombie4.png b/Gores/BucketZombie/BucketZombie4.png new file mode 100644 index 0000000000..fc15e70c5d Binary files /dev/null and b/Gores/BucketZombie/BucketZombie4.png differ diff --git a/Gores/CladCrab/CladCrab.png b/Gores/CladCrab/CladCrab.png new file mode 100644 index 0000000000..1671a2d983 Binary files /dev/null and b/Gores/CladCrab/CladCrab.png differ diff --git a/Gores/CladCrab/CladCrab2.png b/Gores/CladCrab/CladCrab2.png new file mode 100644 index 0000000000..dbf0208c30 Binary files /dev/null and b/Gores/CladCrab/CladCrab2.png differ diff --git a/Gores/CladCrab/CladCrab3.png b/Gores/CladCrab/CladCrab3.png new file mode 100644 index 0000000000..463bed6400 Binary files /dev/null and b/Gores/CladCrab/CladCrab3.png differ diff --git a/Gores/CladCrab/CladCrab4.png b/Gores/CladCrab/CladCrab4.png new file mode 100644 index 0000000000..968ab44748 Binary files /dev/null and b/Gores/CladCrab/CladCrab4.png differ diff --git a/Gores/FrostcrushValariGore1.png b/Gores/FrostcrushValariGore1.png new file mode 100644 index 0000000000..dd5419f07c Binary files /dev/null and b/Gores/FrostcrushValariGore1.png differ diff --git a/Gores/FrostcrushValariGore2.png b/Gores/FrostcrushValariGore2.png new file mode 100644 index 0000000000..0e8d76aeb7 Binary files /dev/null and b/Gores/FrostcrushValariGore2.png differ diff --git a/Gores/HauntedChum/ChumBone1.png b/Gores/HauntedChum/ChumBone1.png new file mode 100644 index 0000000000..86bff0e329 Binary files /dev/null and b/Gores/HauntedChum/ChumBone1.png differ diff --git a/Gores/HauntedChum/ChumBone2.png b/Gores/HauntedChum/ChumBone2.png new file mode 100644 index 0000000000..58961d2094 Binary files /dev/null and b/Gores/HauntedChum/ChumBone2.png differ diff --git a/Gores/HauntedChum/HauntedChum.png b/Gores/HauntedChum/HauntedChum.png new file mode 100644 index 0000000000..11b9e1f220 Binary files /dev/null and b/Gores/HauntedChum/HauntedChum.png differ diff --git a/Gores/HauntedChum/HauntedChumMouth.png b/Gores/HauntedChum/HauntedChumMouth.png new file mode 100644 index 0000000000..6fa25c049e Binary files /dev/null and b/Gores/HauntedChum/HauntedChumMouth.png differ diff --git a/Gores/KylieGore1.png b/Gores/KylieGore1.png new file mode 100644 index 0000000000..d6066fc50a Binary files /dev/null and b/Gores/KylieGore1.png differ diff --git a/Gores/KylieGore2.png b/Gores/KylieGore2.png new file mode 100644 index 0000000000..a32dd8c3fe Binary files /dev/null and b/Gores/KylieGore2.png differ diff --git a/Gores/PrimordialWyrm.png b/Gores/PrimordialWyrm.png index 47ff0d6882..522f1ada80 100644 Binary files a/Gores/PrimordialWyrm.png and b/Gores/PrimordialWyrm.png differ diff --git a/Gores/PrimordialWyrm2.png b/Gores/PrimordialWyrm2.png index 5865d4738c..d88d87e0b1 100644 Binary files a/Gores/PrimordialWyrm2.png and b/Gores/PrimordialWyrm2.png differ diff --git a/Gores/PrimordialWyrm3.png b/Gores/PrimordialWyrm3.png index d228a18507..bc749075a1 100644 Binary files a/Gores/PrimordialWyrm3.png and b/Gores/PrimordialWyrm3.png differ diff --git a/Gores/PrimordialWyrm4.png b/Gores/PrimordialWyrm4.png index e93425c1eb..93b7dfb647 100644 Binary files a/Gores/PrimordialWyrm4.png and b/Gores/PrimordialWyrm4.png differ diff --git a/Gores/PrimordialWyrm5.png b/Gores/PrimordialWyrm5.png new file mode 100644 index 0000000000..f8dc0b3736 Binary files /dev/null and b/Gores/PrimordialWyrm5.png differ diff --git a/Gores/Shroomble/Shroomble.png b/Gores/Shroomble/Shroomble.png new file mode 100644 index 0000000000..5f5d8912ae Binary files /dev/null and b/Gores/Shroomble/Shroomble.png differ diff --git a/Gores/Shroomble/Shroomble2.png b/Gores/Shroomble/Shroomble2.png new file mode 100644 index 0000000000..783adc9f75 Binary files /dev/null and b/Gores/Shroomble/Shroomble2.png differ diff --git a/Gores/Shroomble/Shroomble3.png b/Gores/Shroomble/Shroomble3.png new file mode 100644 index 0000000000..7a0cb88f26 Binary files /dev/null and b/Gores/Shroomble/Shroomble3.png differ diff --git a/Gores/SkeletronPrimes_RevMaster/ChadPrime1.png b/Gores/SkeletronPrimes_RevMaster/ChadPrime1.png new file mode 100644 index 0000000000..07f2e01333 Binary files /dev/null and b/Gores/SkeletronPrimes_RevMaster/ChadPrime1.png differ diff --git a/Gores/SkeletronPrimes_RevMaster/ChadPrime2.png b/Gores/SkeletronPrimes_RevMaster/ChadPrime2.png new file mode 100644 index 0000000000..303ac4ccde Binary files /dev/null and b/Gores/SkeletronPrimes_RevMaster/ChadPrime2.png differ diff --git a/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_1.png b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_1.png new file mode 100644 index 0000000000..860fd8b8c2 Binary files /dev/null and b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_1.png differ diff --git a/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_2.png b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_2.png new file mode 100644 index 0000000000..613ee6e5e1 Binary files /dev/null and b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_2.png differ diff --git a/Gores/SunkenSea/Probesnout/Probesnout1.png b/Gores/SunkenSea/Probesnout/Probesnout1.png new file mode 100644 index 0000000000..c0b8f8adb0 Binary files /dev/null and b/Gores/SunkenSea/Probesnout/Probesnout1.png differ diff --git a/Gores/SunkenSea/Probesnout/Probesnout2.png b/Gores/SunkenSea/Probesnout/Probesnout2.png new file mode 100644 index 0000000000..3de6b17ddb Binary files /dev/null and b/Gores/SunkenSea/Probesnout/Probesnout2.png differ diff --git a/Gores/SunkenSea/Probesnout/Probesnout3.png b/Gores/SunkenSea/Probesnout/Probesnout3.png new file mode 100644 index 0000000000..c8f50fa486 Binary files /dev/null and b/Gores/SunkenSea/Probesnout/Probesnout3.png differ diff --git a/Gores/SunkenSea/Probesnout/Probesnout4.png b/Gores/SunkenSea/Probesnout/Probesnout4.png new file mode 100644 index 0000000000..cf0133ad3c Binary files /dev/null and b/Gores/SunkenSea/Probesnout/Probesnout4.png differ diff --git a/Gores/SunkenSea/Probesnout/ProbesnoutGold1.png b/Gores/SunkenSea/Probesnout/ProbesnoutGold1.png new file mode 100644 index 0000000000..d31b36eb5b Binary files /dev/null and b/Gores/SunkenSea/Probesnout/ProbesnoutGold1.png differ diff --git a/Gores/SunkenSea/Probesnout/ProbesnoutGold2.png b/Gores/SunkenSea/Probesnout/ProbesnoutGold2.png new file mode 100644 index 0000000000..03ffdc3538 Binary files /dev/null and b/Gores/SunkenSea/Probesnout/ProbesnoutGold2.png differ diff --git a/Gores/SunkenSea/Probesnout/ProbesnoutGold3.png b/Gores/SunkenSea/Probesnout/ProbesnoutGold3.png new file mode 100644 index 0000000000..6bef3c6981 Binary files /dev/null and b/Gores/SunkenSea/Probesnout/ProbesnoutGold3.png differ diff --git a/Gores/SunkenSea/Probesnout/ProbesnoutGold4.png b/Gores/SunkenSea/Probesnout/ProbesnoutGold4.png new file mode 100644 index 0000000000..3585353385 Binary files /dev/null and b/Gores/SunkenSea/Probesnout/ProbesnoutGold4.png differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon1.png b/Gores/SunkenSea/Sharkoon/Sharkoon1.png new file mode 100644 index 0000000000..a397daba9c Binary files /dev/null and b/Gores/SunkenSea/Sharkoon/Sharkoon1.png differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon2.png b/Gores/SunkenSea/Sharkoon/Sharkoon2.png new file mode 100644 index 0000000000..a43f486c3a Binary files /dev/null and b/Gores/SunkenSea/Sharkoon/Sharkoon2.png differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon3.png b/Gores/SunkenSea/Sharkoon/Sharkoon3.png new file mode 100644 index 0000000000..37ded0e054 Binary files /dev/null and b/Gores/SunkenSea/Sharkoon/Sharkoon3.png differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon4.png b/Gores/SunkenSea/Sharkoon/Sharkoon4.png new file mode 100644 index 0000000000..14c6732baf Binary files /dev/null and b/Gores/SunkenSea/Sharkoon/Sharkoon4.png differ diff --git a/Gores/SunkenSea/Sharkoon/SharkoonSmall1.png b/Gores/SunkenSea/Sharkoon/SharkoonSmall1.png new file mode 100644 index 0000000000..5d5a8ff043 Binary files /dev/null and b/Gores/SunkenSea/Sharkoon/SharkoonSmall1.png differ diff --git a/Gores/SunkenSea/Sharkoon/SharkoonSmall2.png b/Gores/SunkenSea/Sharkoon/SharkoonSmall2.png new file mode 100644 index 0000000000..a50626462c Binary files /dev/null and b/Gores/SunkenSea/Sharkoon/SharkoonSmall2.png differ diff --git a/Gores/WaterDroplet/AstralWaterDroplet.cs b/Gores/WaterDroplet/AstralWaterDroplet.cs new file mode 100644 index 0000000000..0add03de05 --- /dev/null +++ b/Gores/WaterDroplet/AstralWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class AstralWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/AstralWaterDroplet.png b/Gores/WaterDroplet/AstralWaterDroplet.png similarity index 100% rename from Gores/AstralWaterDroplet.png rename to Gores/WaterDroplet/AstralWaterDroplet.png diff --git a/Gores/WaterDroplet/BasaltGullyWaterDroplet.cs b/Gores/WaterDroplet/BasaltGullyWaterDroplet.cs new file mode 100644 index 0000000000..4e8b5d780c --- /dev/null +++ b/Gores/WaterDroplet/BasaltGullyWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class BasaltGullyWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/BasaltGullyWaterDroplet.png b/Gores/WaterDroplet/BasaltGullyWaterDroplet.png new file mode 100644 index 0000000000..cccc396c80 Binary files /dev/null and b/Gores/WaterDroplet/BasaltGullyWaterDroplet.png differ diff --git a/Gores/WaterDroplet/CragsLavaDroplet.cs b/Gores/WaterDroplet/CragsLavaDroplet.cs new file mode 100644 index 0000000000..3841f789d3 --- /dev/null +++ b/Gores/WaterDroplet/CragsLavaDroplet.cs @@ -0,0 +1,11 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Gores.WaterDroplet +{ + public class CragsLavaDroplet : LiquidDropletGore + { + public override bool lavaDroplet => true; + + public override Vector3 lavaColor => new Vector3(2.5f, 1.1f, 0.1f); + } +} diff --git a/Gores/WaterDroplet/CragsLavaDroplet.png b/Gores/WaterDroplet/CragsLavaDroplet.png new file mode 100644 index 0000000000..5a62700a83 Binary files /dev/null and b/Gores/WaterDroplet/CragsLavaDroplet.png differ diff --git a/Gores/WaterDroplet/LiquidDropletGore.cs b/Gores/WaterDroplet/LiquidDropletGore.cs new file mode 100644 index 0000000000..f99d0b6c4b --- /dev/null +++ b/Gores/WaterDroplet/LiquidDropletGore.cs @@ -0,0 +1,201 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Gores.WaterDroplet +{ + public abstract class LiquidDropletGore : ModGore + { + public virtual bool lavaDroplet => false; + + public virtual Vector3 lavaColor => new Vector3(0, 0, 0); + + public override void SetStaticDefaults() + { + ChildSafety.SafeGore[Type] = true; + } + + public override void OnSpawn(Gore gore, IEntitySource source) + { + gore.numFrames = 15; + gore.behindTiles = true; + gore.timeLeft = Gore.goreTime * 3; + } + + public override bool Update(Gore gore) + { + gore.alpha = gore.position.Y < (Main.worldSurface * 16.0) + 8.0 + ? 0 + : 100; + + int frameDuration = 4; + gore.frameCounter += 1; + if (gore.frame <= 4) + { + int tileX = (int)(gore.position.X / 16f); + int tileY = (int)(gore.position.Y / 16f) - 1; + if (WorldGen.InWorld(tileX, tileY) && !Main.tile[tileX, tileY].HasTile) + { + gore.active = false; + } + + if (gore.frame == 0 || gore.frame == 1 || gore.frame == 2) + { + frameDuration = 24 + Main.rand.Next(256); + } + + if (gore.frame == 3) + { + frameDuration = 24 + Main.rand.Next(96); + } + + if (gore.frameCounter >= frameDuration) + { + gore.frameCounter = 0; + gore.frame += 1; + if (gore.frame == 5) + { + int droplet = Gore.NewGore(new EntitySource_Misc("0"), gore.position, gore.velocity, gore.type); + Main.gore[droplet].frame = 9; + Main.gore[droplet].velocity *= 0f; + } + } + } + else if (gore.frame <= 6) + { + frameDuration = 8; + if (gore.frameCounter >= frameDuration) + { + gore.frameCounter = 0; + gore.frame += 1; + if (gore.frame == 7) + { + gore.active = false; + } + } + } + else if (gore.frame <= 9) + { + frameDuration = 6; + gore.velocity.Y += 0.2f; + if (gore.velocity.Y < 0.5f) + { + gore.velocity.Y = 0.5f; + } + + if (gore.velocity.Y > 12f) + { + gore.velocity.Y = 12f; + } + + if (gore.frameCounter >= frameDuration) + { + gore.frameCounter = 0; + gore.frame += 1; + } + + if (gore.frame > 9) + { + gore.frame = 7; + } + } + else + { + gore.velocity.Y += 0.1f; + if (gore.frameCounter >= frameDuration) + { + gore.frameCounter = 0; + gore.frame += 1; + } + + gore.velocity *= 0f; + if (gore.frame > 14) + { + gore.active = false; + } + } + + if (lavaDroplet) + { + float num24 = 1f; + float num25 = 1f; + float num26 = 1f; + float num27 = 0.6f; + num27 *= gore.frame switch + { + 0 => 0.1f, + 1 => 0.2f, + 2 => 0.3f, + 3 => 0.4f, + 4 => 0.5f, + 5 => 0.4f, + 6 => 0.2f, + 7 => 0.5f, + 8 => 0.5f, + 9 => 0.5f, + 10 => 0.5f, + 11 => 0.4f, + 12 => 0.3f, + 13 => 0.2f, + 14 => 0.1f, + _ => 0.0f, + }; + num24 = (lavaColor.X / 4) * num27; //R + num25 = (lavaColor.Y / 4) * num27; //G + num26 = (lavaColor.Z / 4) * num27; //B + Lighting.AddLight(gore.position + new Vector2(8f, 8f), num24, num25, num26); + } + + Vector2 oldVelocity = gore.velocity; + gore.velocity = Collision.TileCollision(gore.position, gore.velocity, 16, 14); + if (gore.velocity != oldVelocity) + { + if (gore.frame < 10) + { + gore.frame = 10; + gore.frameCounter = 0; + if (!lavaDroplet) + { + SoundEngine.PlaySound(SoundID.Drip, gore.position + new Vector2(8, 8)); + } + } + } + else if (Collision.WetCollision(gore.position + gore.velocity, 16, 14)) + { + if (gore.frame < 10) + { + gore.frame = 10; + gore.frameCounter = 0; + if (!lavaDroplet) + { + SoundEngine.PlaySound(SoundID.Drip, gore.position + new Vector2(8, 8)); + } + } + + int tileX = (int)(gore.position.X + 8f) / 16; + int tileY = (int)(gore.position.Y + 14f) / 16; + if (Main.tile[tileX, tileY] != null && Main.tile[tileX, tileY].LiquidAmount > 0) + { + gore.velocity *= 0f; + gore.position.Y = (tileY * 16) - (Main.tile[tileX, tileY].LiquidAmount / 16); + } + } + + gore.position += gore.velocity; + return false; + } + + public override Color? GetAlpha(Gore gore, Color lightColor) + { + if (lavaDroplet) + { + return new Color(255, 255, 255, 200); + } + return null; + } + } +} diff --git a/Gores/WaterDroplet/MiddleAbyssWaterDroplet.cs b/Gores/WaterDroplet/MiddleAbyssWaterDroplet.cs new file mode 100644 index 0000000000..73728d4332 --- /dev/null +++ b/Gores/WaterDroplet/MiddleAbyssWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class MiddleAbyssWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/MiddleAbyssWaterDroplet.png b/Gores/WaterDroplet/MiddleAbyssWaterDroplet.png new file mode 100644 index 0000000000..235b55d951 Binary files /dev/null and b/Gores/WaterDroplet/MiddleAbyssWaterDroplet.png differ diff --git a/Gores/WaterDroplet/SulphuricDepthsWaterDroplet.cs b/Gores/WaterDroplet/SulphuricDepthsWaterDroplet.cs new file mode 100644 index 0000000000..9ec9af54e6 --- /dev/null +++ b/Gores/WaterDroplet/SulphuricDepthsWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class SulphuricDepthsWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/SulphuricDepthsWaterDroplet.png b/Gores/WaterDroplet/SulphuricDepthsWaterDroplet.png new file mode 100644 index 0000000000..62e2e4e345 Binary files /dev/null and b/Gores/WaterDroplet/SulphuricDepthsWaterDroplet.png differ diff --git a/Gores/WaterDroplet/SulphuricWaterDroplet.cs b/Gores/WaterDroplet/SulphuricWaterDroplet.cs new file mode 100644 index 0000000000..e99e2fcc07 --- /dev/null +++ b/Gores/WaterDroplet/SulphuricWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class SulphuricWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/SulphuricWaterDroplet.png b/Gores/WaterDroplet/SulphuricWaterDroplet.png new file mode 100644 index 0000000000..4a72522aff Binary files /dev/null and b/Gores/WaterDroplet/SulphuricWaterDroplet.png differ diff --git a/Gores/WaterDroplet/SunkenSeaBurrowsWaterDroplet.cs b/Gores/WaterDroplet/SunkenSeaBurrowsWaterDroplet.cs new file mode 100644 index 0000000000..a77978bb98 --- /dev/null +++ b/Gores/WaterDroplet/SunkenSeaBurrowsWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class SunkenSeaBurrowsWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/SunkenSeaBurrowsWaterDroplet.png b/Gores/WaterDroplet/SunkenSeaBurrowsWaterDroplet.png new file mode 100644 index 0000000000..a513f6f6b9 Binary files /dev/null and b/Gores/WaterDroplet/SunkenSeaBurrowsWaterDroplet.png differ diff --git a/Gores/WaterDroplet/SunkenSeaPolypWaterDroplet.cs b/Gores/WaterDroplet/SunkenSeaPolypWaterDroplet.cs new file mode 100644 index 0000000000..2004a6c9d1 --- /dev/null +++ b/Gores/WaterDroplet/SunkenSeaPolypWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class SunkenSeaPolypWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/SunkenSeaPolypWaterDroplet.png b/Gores/WaterDroplet/SunkenSeaPolypWaterDroplet.png new file mode 100644 index 0000000000..2bbd66c27d Binary files /dev/null and b/Gores/WaterDroplet/SunkenSeaPolypWaterDroplet.png differ diff --git a/Gores/WaterDroplet/SunkenSeaReefsWaterDroplet.cs b/Gores/WaterDroplet/SunkenSeaReefsWaterDroplet.cs new file mode 100644 index 0000000000..edb17bf94e --- /dev/null +++ b/Gores/WaterDroplet/SunkenSeaReefsWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class SunkenSeaReefsWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/SunkenSeaReefsWaterDroplet.png b/Gores/WaterDroplet/SunkenSeaReefsWaterDroplet.png new file mode 100644 index 0000000000..56ada8005f Binary files /dev/null and b/Gores/WaterDroplet/SunkenSeaReefsWaterDroplet.png differ diff --git a/Gores/WaterDroplet/SunkenSeaShoresWaterDroplet.cs b/Gores/WaterDroplet/SunkenSeaShoresWaterDroplet.cs new file mode 100644 index 0000000000..d4b1c59216 --- /dev/null +++ b/Gores/WaterDroplet/SunkenSeaShoresWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class SunkenSeaShoresWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/SunkenSeaShoresWaterDroplet.png b/Gores/WaterDroplet/SunkenSeaShoresWaterDroplet.png new file mode 100644 index 0000000000..31e0013537 Binary files /dev/null and b/Gores/WaterDroplet/SunkenSeaShoresWaterDroplet.png differ diff --git a/Gores/WaterDroplet/UpperAbyssWaterDroplet.cs b/Gores/WaterDroplet/UpperAbyssWaterDroplet.cs new file mode 100644 index 0000000000..52d68f19ea --- /dev/null +++ b/Gores/WaterDroplet/UpperAbyssWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class UpperAbyssWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/UpperAbyssWaterDroplet.png b/Gores/WaterDroplet/UpperAbyssWaterDroplet.png new file mode 100644 index 0000000000..1b6552138e Binary files /dev/null and b/Gores/WaterDroplet/UpperAbyssWaterDroplet.png differ diff --git a/Gores/WaterDroplet/VoidWaterDroplet.cs b/Gores/WaterDroplet/VoidWaterDroplet.cs new file mode 100644 index 0000000000..daf1abf2d7 --- /dev/null +++ b/Gores/WaterDroplet/VoidWaterDroplet.cs @@ -0,0 +1,6 @@ +namespace CalamityMod.Gores.WaterDroplet +{ + public class VoidWaterDroplet : LiquidDropletGore + { + } +} diff --git a/Gores/WaterDroplet/VoidWaterDroplet.png b/Gores/WaterDroplet/VoidWaterDroplet.png new file mode 100644 index 0000000000..caa2b6f97a Binary files /dev/null and b/Gores/WaterDroplet/VoidWaterDroplet.png differ diff --git a/Graphics/Metaballs/BloodBoilerMetaball.cs b/Graphics/Metaballs/BloodBoilerMetaball.cs index d5d29fd0c8..86bf43c440 100644 --- a/Graphics/Metaballs/BloodBoilerMetaball.cs +++ b/Graphics/Metaballs/BloodBoilerMetaball.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Graphics.Metaballs public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; - public override Color EdgeColor => Color.DarkRed; + public override Color EdgeColor => Color.Red with { A = 0 }; public override void Update() { @@ -85,7 +85,7 @@ namespace CalamityMod.Graphics.Metaballs public override void DrawInstances() { float pureRedIntensity = 0.15f; - float opacity = 0.5f; + float opacity = 1f; Texture2D tex = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; foreach (BloodBoilerParticle particle in Particles) diff --git a/Graphics/Metaballs/BloodBoilerMetaball2.cs b/Graphics/Metaballs/BloodBoilerMetaball2.cs index 873604126a..a6034d5219 100644 --- a/Graphics/Metaballs/BloodBoilerMetaball2.cs +++ b/Graphics/Metaballs/BloodBoilerMetaball2.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Graphics.Metaballs public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; - public override Color EdgeColor => Color.DarkRed; + public override Color EdgeColor => Color.Red with { A = 0 }; public override void Update() { @@ -85,7 +85,7 @@ namespace CalamityMod.Graphics.Metaballs public override void DrawInstances() { float pureRedIntensity = 0.15f; - float opacity = 0.3f; + float opacity = 1f; Texture2D tex = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; foreach (BloodBoilerParticle2 particle in Particles) diff --git a/Graphics/Metaballs/GalaxyMetaball.cs b/Graphics/Metaballs/GalaxyMetaball.cs new file mode 100644 index 0000000000..4d93ed1020 --- /dev/null +++ b/Graphics/Metaballs/GalaxyMetaball.cs @@ -0,0 +1,103 @@ +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; + +namespace CalamityMod.Graphics.Metaballs +{ + public class GalaxyMetaball : Metaball + { + public class CosmicParticle + { + public float Size; + + public Vector2 Velocity; + + public Vector2 Center; + + public CosmicParticle(Vector2 center, Vector2 velocity, float size) + { + Center = center; + Velocity = velocity; + Size = size; + } + + public void Update() + { + Center += Velocity; + Velocity *= 0.96f; + Size *= 0.91f; + } + } + + public static Asset LayerAsset + { + get; + private set; + } + + public static List Particles + { + get; + private set; + } = new(); + + public override bool AnythingToDraw => Particles.Any(); + + public override IEnumerable Layers + { + get + { + yield return LayerAsset.Value; + } + } + + public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs; + + public override Color EdgeColor => Color.Lerp(Color.DarkBlue, Color.Black, 0.75f); + + public override void Load() + { + if (Main.dedServ) + return; + + // Load the layer asset wrapper. + LayerAsset = ModContent.Request($"CalamityMod/Graphics/Metaballs/StreamGougeLayer", AssetRequestMode.ImmediateLoad); + } + + public override void Update() + { + // Update all particle instances. + // Once sufficiently small, they vanish. + for (int i = 0; i < Particles.Count; i++) + Particles[i].Update(); + Particles.RemoveAll(p => p.Size <= 2f); + } + + public static void SpawnParticle(Vector2 position, Vector2 velocity, float size) => + Particles.Add(new(position, velocity, size)); + + // Make the texture scroll. + public override Vector2 CalculateManualOffsetForLayer(int layerIndex) + { + return Vector2.UnitX * Main.GlobalTimeWrappedHourly * 0.037f; + } + + public override void DrawInstances() + { + Texture2D tex = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + + foreach (CosmicParticle particle in Particles) + { + Vector2 drawPosition = particle.Center - Main.screenPosition; + Vector2 origin = tex.Size() * 0.5f; + Vector2 scale = Vector2.One * particle.Size / tex.Size(); + Main.spriteBatch.Draw(tex, drawPosition, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Graphics/Metaballs/GruesomeMetaball.cs b/Graphics/Metaballs/GruesomeMetaball.cs index 3a67d24c7c..0c281d7e5f 100644 --- a/Graphics/Metaballs/GruesomeMetaball.cs +++ b/Graphics/Metaballs/GruesomeMetaball.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Graphics.Metaballs public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Load layer assets. diff --git a/Graphics/Metaballs/Metaball.cs b/Graphics/Metaballs/Metaball.cs index 0ad632f8ae..be9d5556bf 100644 --- a/Graphics/Metaballs/Metaball.cs +++ b/Graphics/Metaballs/Metaball.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Graphics.Metaballs MetaballManager.metaballs.Add(this); // Disallow render target creation on servers. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Generate render targets. diff --git a/Graphics/Metaballs/PhotoMetaball3.cs b/Graphics/Metaballs/PhotoMetaball3.cs index 9ddc7f2e1c..cfb21ea60d 100644 --- a/Graphics/Metaballs/PhotoMetaball3.cs +++ b/Graphics/Metaballs/PhotoMetaball3.cs @@ -62,16 +62,18 @@ namespace CalamityMod.Graphics.Metaballs Particles[i].Update(); Particles.RemoveAll(p => p.Size <= 2f); - if (Time % 10 == 0) + List eColors = new List() { - sparkColor = Main.rand.Next(4) switch - { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, - }; - } + Color.OrangeRed, + Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen + }; + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); } // Copied from Rancor Lava metaballs, since these need to be additive metaballs. diff --git a/Graphics/Metaballs/StreamGougeMetaball.cs b/Graphics/Metaballs/StreamGougeMetaball.cs index 0099af636c..0f31626192 100644 --- a/Graphics/Metaballs/StreamGougeMetaball.cs +++ b/Graphics/Metaballs/StreamGougeMetaball.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Graphics.Metaballs public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Load the layer asset wrapper. diff --git a/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs index 928c64bfd4..66fa36a79d 100644 --- a/Graphics/Primitives/PrimitiveRenderer.cs +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics.Shaders; +using Terraria.ModLoader; namespace CalamityMod.Graphics.Primitives { @@ -19,7 +20,8 @@ namespace CalamityMod.Graphics.Primitives /// If you wish to use pixelation, you MUST make the NPC/Projectile inherit and use instead of predraw..
/// You can also optionally specify a render layer with . It is by default. /// - public static class PrimitiveRenderer + [Autoload(Side = ModSide.Client)] + public sealed class PrimitiveRenderer : ModSystem { #region Static Members private static DynamicVertexBuffer VertexBuffer; @@ -46,7 +48,7 @@ namespace CalamityMod.Graphics.Primitives private static short IndicesIndex; - internal static void Initialize() + public override void OnModLoad() { Main.QueueMainThreadAction(() => { diff --git a/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs index f01c539a2f..3b4b977c61 100644 --- a/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using CalamityMod.DataStructures; @@ -36,21 +37,20 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers #region Loading public override void Load() { - if (Main.netMode == NetmodeID.Server) - return; - - Targets = new(); - Dyes = new(); - RenderersToDrawThisFrame = new(); + Targets = []; + Dyes = []; + RenderersToDrawThisFrame = []; } public override void Unload() { - if (Main.netMode == NetmodeID.Server) - return; - + Targets?.Clear(); Targets = null; + + Dyes?.Clear(); Dyes = null; + + RenderersToDrawThisFrame?.Clear(); RenderersToDrawThisFrame = null; } #endregion @@ -60,22 +60,34 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers { orig(self, isNotInVanitySlot, isSetToHidden, armorItem, dyeItem); + if (Main.dedServ) + return; + if (armorItem.ModItem is not IDyeableShaderRenderer drawer) return; - // Store the dye in the slot. + // Store the dye and player in the slot. + drawer.OwnerPlayer = self?.whoAmI ?? Main.maxPlayers; Dyes[drawer] = GameShaders.Armor.GetShaderFromItemId(dyeItem.type); } internal static void CheckVanityDetour(On_Player.orig_ApplyEquipVanity_Item orig, Player self, Item currentItem) { orig(self, currentItem); + + if (Main.dedServ) + return; + CheckIfEquipIsValid(currentItem, false); } internal static void CheckAccessoryDetour(On_Player.orig_ApplyEquipFunctional orig, Player self, Item currentItem, bool hideVisual) { orig(self, currentItem, hideVisual); + + if (Main.dedServ) + return; + CheckIfEquipIsValid(currentItem, hideVisual); } @@ -83,6 +95,9 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers { orig(self, i); + if (Main.dedServ) + return; + // Check each armor piece in the same manner as tMod. // If the entire set is equipped, and it is a renderer, it will be marked as valid. Item head = self.armor[0]; @@ -103,6 +118,9 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers private static void CheckIfEquipIsValid(Item item, bool hideVisual) { + if (Main.dedServ) + return; + // Difficulty mode checks. if ((item.expertOnly && !Main.expertMode) || (item.masterOnly && !Main.masterMode)) return; @@ -120,9 +138,15 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers private static void MarkAsValid(IDyeableShaderRenderer renderer) { - // If it doesn't have a dictonary entry, create one. - if (!Targets.ContainsKey(renderer)) - Main.QueueMainThreadAction(() => Targets[renderer] = new(true, ManagedRenderTarget.CreateScreenSizedTarget)); + if (Main.dedServ) + return; + + Main.QueueMainThreadAction(() => + { + // If it doesn't have a dictonary entry, create one. + if (!Targets.ContainsKey(renderer)) + Main.QueueMainThreadAction(() => Targets[renderer] = new(true, ManagedRenderTarget.CreateScreenSizedTarget)); + }); // Mark this item as drawable this frame. RenderersToDrawThisFrame.AddWithCondition(renderer, renderer.ShouldDrawDyeableShader); @@ -131,12 +155,18 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers #region Updates/Drawing // Clear the list at the beginning of each update, to ensure its only populated by correct ones. - public override void PreUpdate() => RenderersToDrawThisFrame.Clear(); + public override void PreUpdate() + { + RenderersToDrawThisFrame?.Clear(); + } public override void DrawToTarget(SpriteBatch spriteBatch) { + if (Main.dedServ) + return; + // Leave if nothing to draw. - if (!RenderersToDrawThisFrame.Any()) + if (RenderersToDrawThisFrame.Count <= 0) return; // Sort the list by draw order. @@ -155,25 +185,29 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers public override void DrawTarget(SpriteBatch spriteBatch) { - // Leave if nothing to draw. - if (!RenderersToDrawThisFrame.Any()) + if (Main.dedServ) return; - foreach (var renderer in RenderersToDrawThisFrame) + // Leave if nothing to draw. + if (RenderersToDrawThisFrame.Count <= 0) + return; + + var matrix = Main.GameViewMatrix.TransformationMatrix; + Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.AlphaBlend, null, matrix, () => { - if (!Targets.TryGetValue(renderer, out var target)) - continue; + foreach (var renderer in RenderersToDrawThisFrame) + { + if (!Targets.TryGetValue(renderer, out var target)) + continue; - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + // If it is dyeable, and a dye exists, apply it. This has null safety, as dyeShader can be null here. + if (renderer.ShaderIsDyeable && Dyes.TryGetValue(renderer, out var dyeShader)) + dyeShader?.Apply(null, new(target, Vector2.Zero, new Rectangle(0, 0, target.Width, target.Height), Color.White)); - // If it is dyeable, and a dye exists, apply it. This has null safety, as dyeShader can be null here. - if (renderer.ShaderIsDyeable && Dyes.TryGetValue(renderer, out var dyeShader)) - dyeShader?.Apply(null, new(target, Vector2.Zero, new Rectangle(0, 0, target.Width, target.Height), Color.White)); - - // Draw the assosiated target that has been drawn to. - spriteBatch.Draw(target, Vector2.Zero, Color.White with { A = 0 }); - } + // Draw the assosiated target that has been drawn to. + spriteBatch.Draw(target, Vector2.Zero, Color.White with { A = 0 }); + } + }); } #endregion } diff --git a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs index 239947daaa..800ad701fe 100644 --- a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers if (!npc.HasValidTarget) return; - var target = Main.player[Main.myPlayer]; + var target = Main.LocalPlayer; var holyInfernoIntensity = target.Calamity().holyInfernoFadeIntensity; var prov = Provi; if (prov == null) diff --git a/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs b/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs index 9fdab1f84a..98871deb15 100644 --- a/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs @@ -60,24 +60,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers if (!npc.active || npc.type <= NPCID.None) return false; - // Do not draw other mod's bosses. - if (npc.ModNPC != null && npc.ModNPC.Mod != CalamityMod.Instance && npc.boss) - return false; - - // Don't draw excluded NPCs, or if the npc is a bestiary dummy. - if (ExcludedNPCs.Contains(npc.type) || npc.IsABestiaryIconDummy) - return false; - - // Safety check for weird MP bug when getting global npcs. - if (!npc.TryGetGlobalNPC(out var calNPC) || !npc.TryGetGlobalNPC(out var polNPC)) - return false; - - // Do not draw if the npc does not have miracle blight, or has the polarity effect. - if (calNPC.miracleBlight <= 0 || polNPC.CurPolarity > 0f) - return false; - - // Do not draw if the current player has the trippy effect. - if (Main.LocalPlayer.Calamity().trippy) + if (!CalamityDrawParameterNPC.DrawingMiracleBlight[npc.whoAmI]) return false; return true; diff --git a/Graphics/Renderers/RendererManager.cs b/Graphics/Renderers/RendererManager.cs index 4844fd81cb..a4b0132ce1 100644 --- a/Graphics/Renderers/RendererManager.cs +++ b/Graphics/Renderers/RendererManager.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -22,7 +21,7 @@ namespace CalamityMod.Graphics.Renderers #region Loading public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Main.QueueMainThreadAction(() => @@ -39,7 +38,7 @@ namespace CalamityMod.Graphics.Renderers public override void Unload() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Clear the cached renderers, so they can be readded on mod loading when initialized. @@ -83,18 +82,26 @@ namespace CalamityMod.Graphics.Renderers { orig(); - if (Main.gameMenu) + if (Main.gameMenu || Main.dedServ) return; + // Reset drawn frame check + foreach (var player in Main.ActivePlayers) + { + player.Calamity().drawnAnyShieldThisFrame = false; + } + foreach (var renderer in Renderers) { if (!renderer.ShouldDraw) continue; - renderer.MainTarget.SwapTo(Color.Transparent); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - renderer.DrawToTarget(Main.spriteBatch); - Main.spriteBatch.End(); + var matrix = Main.GameViewMatrix.TransformationMatrix; + Main.spriteBatch.SafeBegin(SpriteSortMode.Deferred, BatchSetting.AlphaBlend, null, matrix, () => + { + renderer.MainTarget.SwapTo(Color.Transparent); + renderer.DrawToTarget(Main.spriteBatch); + }); } Main.instance.GraphicsDevice.SetRenderTarget(null); @@ -110,7 +117,7 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.NPC); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); @@ -124,7 +131,7 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Projectile); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); @@ -138,7 +145,7 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Player); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); @@ -151,13 +158,13 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.BeforeTiles); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform); orig(self); } @@ -167,12 +174,12 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.AfterEverything); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform); orig(self); } #endregion diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index ef06ec1d55..5018cee4bb 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -1,6 +1,6 @@ using System; using CalamityMod.Balancing; -using CalamityMod.Items.Accessories; +using CalamityMod.Enums; using Mono.Cecil.Cil; using MonoMod.Cil; using Terraria; @@ -16,8 +16,8 @@ namespace CalamityMod.ILEditing private static bool AdjustShimmerRequirements(On_ShimmerTransforms.orig_IsItemTransformLocked orig, int type) { - //Rod of Harmony / psc requires Draedong and SCal dead instead of Moon Lord. - if (type == ItemID.RodofDiscord || type == ModContent.ItemType()) + //Rod of Harmony requires Draedong and SCal dead instead of Moon Lord. + if (type == ItemID.RodofDiscord) { return !DownedBossSystem.downedCalamitas || !DownedBossSystem.downedExoMechs; } @@ -80,15 +80,8 @@ namespace CalamityMod.ILEditing cursor.Remove(); 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."); - return; - } - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 1.2f); // Decrease to 1.2f. + // CIT 22SEP2024: Removed the edit intended to decrease Frog Leg's jump speed boost, + // as it was not doing anything due to vanilla changing how Frog Leg's jump speed boost is applied. // Remove the jump height addition from the Werewolf buff (Moon Charm). if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(2))) @@ -99,14 +92,14 @@ namespace CalamityMod.ILEditing cursor.Next.Operand = 0; } - private const float VanillaBaseJumpHeight = 5.01f; - private static void BaseJumpHeightAdjustment(ILContext il) + private const float VanillaBaseJumpSpeed = 5.01f; + private static void BaseJumpSpeedAdjustment(ILContext il) { // Increase the base jump height of the player to make early game less of a slog. var cursor = new ILCursor(il); // The jumpSpeed variable is set to this specific value before anything else occurs. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(VanillaBaseJumpHeight))) + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(VanillaBaseJumpSpeed))) { LogFailure("Base Jump Height Buff", "Could not locate the jump height variable."); return; @@ -114,7 +107,7 @@ namespace CalamityMod.ILEditing cursor.Remove(); // Increase by 10% if the higher jump speed is enabled. - cursor.EmitDelegate>(() => CalamityConfig.Instance.HigherJumpHeight ? BalancingConstants.ConfigBoostedBaseJumpHeight : VanillaBaseJumpHeight); + cursor.EmitDelegate>(() => CalamityServerConfig.Instance.FasterJumpSpeed ? BalancingConstants.ConfigBoostedBaseJumpSpeed : VanillaBaseJumpSpeed); } #endregion @@ -305,10 +298,26 @@ namespace CalamityMod.ILEditing #endregion #region Life Regen Changes - private static void PreventWellFedFromBeingRequiredInExpertModeForFullLifeRegen(ILContext il) + private static void UpdateLifeRegenBalancingChanges(ILContext il) { - // Prevent the greatly reduced life regen while without the well fed buff in expert mode. + // This IL edit accomplishes two things related to life regen: + // 1. Prevents Nebula armor's Life Boosters from cancelling out negative life regen. + // 2. Prevents the greatly reduced life regen while without a Well Fed buff in Expert Mode. var cursor = new ILCursor(il); + + // First, move to where the game checks if the Life Booster level is greater than 0. + 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 0. + // 0 will never be greater than 0, so negative life regen will never be canceled out. + cursor.Emit(OpCodes.Pop); + cursor.Emit(OpCodes.Ldc_I4_0); + + // Now move to where the game checks if it is Expert Mode and the player does not have a Well Fed buff. if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("wellFed"))) { LogFailure("Expert Mode Well Fed Reduced Life Regen Prevention", "Could not locate the Well Fed bool."); @@ -344,11 +353,28 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldc_R4, 0.2f); // Decrease to 0.2f. } - private static void ManaRegenAdjustment(ILContext il) + private static void UpdateManaRegenBalancingChanges(ILContext il) { - // Increase the base mana regen so that mage is less annoying to play without mana regen buffs. + // This IL edit accomplishes two things: + // 1. Nerfs Nebula armor's Mana Boosters. + // 2. Increases the base mana regen so that mage is less annoying to play without mana regen buffs. var cursor = new ILCursor(il); - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.8f))) // The multiplier for the mana regen formula: (float)statMana / (float)statManaMax2 * 0.8f + 0.2f. + + // Reduce Nebula armor mana regen. + // See BalancingConstants for a more in-depth explanation as to how the Mana Booster works. + // Just know that we need to raise this value in order to nerf it. + 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; + + // Next, move to the mana regen formula. + // The multiplier for the mana regen formula: (float)statMana / (float)statManaMax2 * 0.8f + 0.2f. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.8f))) { LogFailure("Mana Regen Buff", "Could not locate the mana regen multiplier variable."); return; @@ -440,12 +466,12 @@ namespace CalamityMod.ILEditing } if (item.prefix == PrefixID.Lucky) - self.luck += 0.05f; + self.Calamity().calamityBonusLuck += 0.05f; } #endregion #region Damage Variance Dampening and Luck Removal - private static int AdjustDamageVariance(Terraria.On_Main.orig_DamageVar_float_int_float orig, float dmg, int percent, float luck) + private static int AdjustDamageVariance(On_Main.orig_DamageVar_float_int_float orig, float dmg, int percent, float luck) { // Change the default damage variance from +-15% to +-5%. // If other mods decide to change the scale, they can override this. We're solely killing the default value. @@ -471,6 +497,52 @@ namespace CalamityMod.ILEditing } #endregion + #region Vanilla Boss Resist Changes + private static void VanillaBossResistChanges(ILContext il) + { + // This IL edit accomplishes two things: + // 1. Reduces Expert+ Eater of Worlds' resist to explosives from 80% to 60%. + // 2. Effectively removes Lunatic Cultist's resistance to homing projectiles. + var cursor = new ILCursor(il); + + // First, the EoW grenade resist. Naturally, this is 800 lines into Projectile.Damage, so we must do funky things. + for (int f = 0; f < 2; f++) + { + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(1002))) + { + LogFailure("Reduce EoW Grenade Resist", "Could not move to the resist factor."); + return; + } + } + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchDiv())) + { + LogFailure("Reduce EoW Grenade Resist", "Could not move to the resist factor."); + return; + } + + // Remove the division instruction, then pop the 5 off the stack to destroy it. Replace it with loading a 0.4 and then multiplying by it. + cursor.Remove(); + cursor.EmitPop(); + cursor.EmitLdcR4(0.4f); + cursor.EmitMul(); + + // Now, move to the Cultist resist which is right below it. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdsfld(typeof(ProjectileID.Sets), "CultistIsResistantTo"))) + { + LogFailure("Lunatic Cultist Homing Resist Removal", "Could not locate the Cultist resist set."); + return; + } + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.75f))) // The resist ratio. + { + LogFailure("Lunatic Cultist Homing Resist Removal", "Could not locate the resist percentage."); + return; + } + + // Replace the value with 1, meaning -0% damage or no resist. + cursor.Next.Operand = 1f; + } + #endregion + #region Terrarian Projectile Limitation for Extra Updates private static void LimitTerrarianProjectiles(ILContext il) { @@ -488,11 +560,17 @@ namespace CalamityMod.ILEditing } #endregion - #region Sharpening Station Nerf - private static void NerfSharpeningStation(ILContext il) + #region UpdateBuffs Balancing Changes + private static void UpdateBuffsBalancingChanges(ILContext il) { - // Reduce armor penetration from the Sharpening Station from 12 (it was originally 16!) + // This IL edit accomplishes four things: + // 1. Nerf Sharpening Station's armor penetration boost from 12 to 5. + // 2. Nerf Beetle Scale Mail's set bonus Beetle Might melee speed from 10% per stack to 5%. + // 3. Nerf Nebula armor's Damage and Life Boosters (Mana Boosters are not handled in this method). + // 4. Remove the ability for Feral Bite to randomly inflict debuffs. var cursor = new ILCursor(il); + + // First, find the code which applies Sharpened's armor penetration buff. if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.Sharpened))) { LogFailure("Sharpening Station Nerf", "Could not locate the Sharpened buff ID."); @@ -507,52 +585,28 @@ namespace CalamityMod.ILEditing // Replace the value entirely. cursor.Remove(); cursor.Emit(OpCodes.Ldc_R4, BalancingConstants.SharpeningStationArmorPenetration); - } - #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); + // Next, move to Beetle Scale Mail's melee speed boost from Beetle Might buff. 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. + for (int i = 0; i < 2; i++) { - 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; + 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 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. + // Then, Nebula armor's Life and Damage Boosters. + // First is the Life Boosters. if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.NebulaUpLife1))) { LogFailure("Nebula Armor Nerf", "Could not locate the Nebula Life buff ID."); @@ -573,7 +627,7 @@ namespace CalamityMod.ILEditing cursor.Remove(); cursor.Emit(OpCodes.Ldc_I4, BalancingConstants.NebulaLifeRegenPerBooster); - // Adjust damage from Nebula Damage Boosters. + // And then the Damage Boosters. if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.NebulaUpDmg1))) { LogFailure("Nebula Armor Nerf", "Could not locate the Nebula Damage buff ID."); @@ -587,40 +641,104 @@ namespace CalamityMod.ILEditing // 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"))) + // Finally, removing Feral Bite's debuffs. + // Find the random debuff duration multiplier for the debuffs inflicted by Feral Bite. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.01f))) // The 0.01f random debuff duration multiplier. { - LogFailure("Nebula Armor DoT Ignoring Nerf", "Could not locate the Nebula Armor Life Booster variable."); + LogFailure("Remove Feral Bite Random Debuffs", "Could not locate the Feral Bite random debuff duration multiplier."); 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); + // Remove and change to 0f, this makes the random debuffs from Feral Bite have 0 duration. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 0f); } + #endregion - private static void NerfNebulaArmorManaRegen(ILContext il) + #region Vortex Booster Keeps Vortex Stealth When Dashing + private static void VortexBoosterKeepsVortexStealthWhenDashing(On_Player.orig_DashMovement orig, Player self) { - // 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))) + // Allows for Vortex Booster to automatically re-engage Vortex armor's stealth after a delay when dashing + bool vortexStealth = self.vortexStealthActive; + orig(self); + + if (self.wingsLogic == (int)VanillaWingID.WingsVortex) { - LogFailure("Nebula Armor Mana Regen Nerf", "Could not locate the Nebula Armor mana regeneration frame counter threshold."); + if (vortexStealth && !self.vortexStealthActive) + self.Calamity().vortexBoosterStealthDelay = 60; + } + } + #endregion + + #region Stardust Guardian Buffs + private static void StardustGuardianAttackBuffs(ILContext il) + { + // Increase the Stardust Guardian's attack range while wearing Stardust Wings. + var cursor = new ILCursor(il); + + // Move to the label after the instruction that sets num3 to 500f. + for (int i = 0; i < 2; i++) + { + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcR4(100f))) + { + LogFailure("Stardust Guardian Buffs", "Could not move to after the Stardust Guardian's attack range."); + return; + } + } + + // Define a label for the branch statement. + var label = il.DefineLabel(); + + // Load Player.wingsLogic, and check if it's Stardust Wings. + // If it is, increase the two attack range variables. + cursor.Emit(OpCodes.Ldloc_0); + cursor.Emit(OpCodes.Ldfld, typeof(Player).GetField("wingsLogic")); + cursor.Emit(OpCodes.Ldc_I4, (int)VanillaWingID.WingsStardust); + cursor.Emit(OpCodes.Bne_Un, label); + + cursor.Emit(OpCodes.Ldc_R4, 900f); + cursor.Emit(OpCodes.Stloc, 4); + cursor.Emit(OpCodes.Ldc_R4, 900f); + cursor.Emit(OpCodes.Stloc, 5); + + cursor.MarkLabel(label); + + // Now, increase the Stardust Guardian's move speed when attacking targets. + // This is applied regardless of having Stardust Wings. + // This jumps to the base speed value when moving towards a target. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcR4(6f))) + { + LogFailure("Stardust Guardian Buffs", "Could not locate the Stardust Guardian's attack move speed."); return; } - // Swap the threshold with Calamity's value. - cursor.Next.Operand = BalancingConstants.NebulaManaRegenFrameCounterThreshold; + // Remove and replace with a higher value. + cursor.EmitPop(); + cursor.Emit(OpCodes.Ldc_R4, 12f); + } + #endregion + + #region Solar Wings Change to Solar Flare Armor Dash + private static void SolarWingsDashChange(ILContext il) + { + // Make Solar Wings always allow using Solar Flare armor's dash. + var cursor = new ILCursor(il); + + // Genuinely how the fuck is this the only OR opcode in the entire method + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchOr())) + { + LogFailure("Solar Dash Change", "Could not locate the OR opcode."); + return; + } + + // Add an additional check for if the player is wearing Solar Wings. + cursor.Emit(OpCodes.Ldarg_0); + cursor.Emit(OpCodes.Ldfld, typeof(Player).GetField("wingsLogic")); + cursor.Emit(OpCodes.Ldc_I4, (int)VanillaWingID.WingsSolar); + cursor.EmitCeq(); + // Then OR it. + cursor.EmitOr(); } #endregion @@ -652,27 +770,6 @@ namespace CalamityMod.ILEditing } #endregion - #region Remove Lunatic Cultist Homing Resist - private static void RemoveLunaticCultistHomingResist(ILContext il) - { - // Change Lunatic Cultist's resist from 25% to 0% (effectively removing it). - var cursor = new ILCursor(il); - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdsfld(typeof(ProjectileID.Sets), "CultistIsResistantTo"))) - { - LogFailure("Lunatic Cultist Homing Resist Removal", "Could not locate the Cultist resist set."); - return; - } - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.75f))) // The resist ratio. - { - LogFailure("Lunatic Cultist Homing Resist Removal", "Could not locate the resist percentage."); - return; - } - - // Replace the value with 1, meaning -0% damage or no resist. - cursor.Next.Operand = 1f; - } - #endregion - #region Remove Frozen Infliction From Deerclops Ice Spikes private static void RemoveFrozenInflictionFromDeerclopsIceSpikes(ILContext il) { diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 57937bc0c2..8a366bd53a 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -38,21 +38,13 @@ namespace CalamityMod.ILEditing exoDoorClosed = ModContent.TileType(); // Graphics - IL_Main.DoDraw += AdditiveDrawing; - IL_Main.DoDraw += DrawFloralParadiseFog; - On_Main.DrawGore += DrawForegroundStuff; + IL_Main.DoDraw += CustomDoDrawChanges; On_Main.DrawCursor += UseCoolFireCursorEffect; On_Main.SortDrawCacheWorms += DrawFusableParticles; On_Main.DrawInfernoRings += DrawForegroundParticles; - On_TileDrawing.DrawPartialLiquid += DrawCustomLava; - On_WaterfallManager.DrawWaterfall_int_int_int_float_Vector2_Rectangle_Color_SpriteEffects += DrawCustomLavafalls; - On_Main.RenderWater += CacheLavaStyle; - IL_LiquidRenderer.DrawNormalLiquids += ChangeWaterQuadColors; - IL_Main.oldDrawWater += DrawCustomLava3; - On_TileLightScanner.GetTileLight += MakeSulphSeaWaterBetter; - On_TileDrawing.PreDrawTiles += ClearForegroundStuff; On_TileDrawing.Draw += ClearTilePings; On_CommonCode.ModifyItemDropFromNPC += ColorBlightedGel; + On_MoonlordDeathDrama.RequestLight += DisableFlashesWithPhotosensitivityConfig; // Graphics (dyeable shader stuff) On_Player.UpdateItemDye += DyeableShadersRenderer.FindDyesDetour; @@ -60,38 +52,89 @@ namespace CalamityMod.ILEditing On_Player.ApplyEquipVanity_Item += DyeableShadersRenderer.CheckVanityDetour; On_Player.UpdateArmorSets += DyeableShadersRenderer.CheckArmorSetsDetour; + // Graphics (ModPlant stuff) + IL_TileDrawing.DrawSingleTile += DisableCullingForTreeAndCactus; + IL_TileDrawing.DrawTrees += DrawTreeGlowMask; + On_TileDrawing.DrawBasicTile += DrawTreeTrunkAndCactusGlowMask; + // NPC behavior IL_Main.UpdateTime += PermitNighttimeTownNPCSpawning; On_Main.UpdateTime_SpawnTownNPCs += AlterTownNPCSpawnRate; On_NPC.ShouldEmpressBeEnraged += AllowEmpressToEnrageInBossRush; On_NPC.DoDeathEvents += PreventVanillaBossDeathsInBossRush; IL_Player.CollectTaxes += MakeTaxCollectorUseful; - IL_Projectile.Damage += RemoveLunaticCultistHomingResist; // Mechanics / features On_NPC.ApplyTileCollision += AllowTriggeredFallthrough; IL_Player.ApplyEquipFunctional += ScopesRequireVisibilityToZoom; IL_Player.Hurt_PlayerDeathReason_int_int_refHurtInfo_bool_bool_int_bool_float_float_float += DodgeMechanicAdjustments; + On_Player.PutHallowedArmorSetBonusOnCooldown += AddHolyProtectionCooldown; IL_Player.DashMovement += FixAllDashMechanics; + On_Player.DashMovement += VortexBoosterKeepsVortexStealthWhenDashing; On_Player.DoCommonDashHandle += ApplyDashKeybind; IL_Player.GiveImmuneTimeForCollisionAttack += MakeShieldSlamIFramesConsistent; IL_Player.Update_NPCCollision += NerfShieldOfCthulhuBonkSafety; On_WorldGen.OpenDoor += OpenDoor_LabDoorOverride; On_WorldGen.CloseDoor += CloseDoor_LabDoorOverride; On_Item.AffixName += IncorporateEnchantmentInAffix; - On_Projectile.NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float_float += IncorporateMinionExplodingCountdown; + On_Projectile.NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float_float += IncorporateExtraProjectileVariables; + On_Player.ApplyDamageToNPC += ApplyOldFashionedDamageToMiscHits; // TODO -- This should be unnecessary. There is now a TML hook for platform collision for ModNPCs. On_NPC.Collision_DecideFallThroughPlatforms += EnableCalamityBossPlatformCollision; IL_Wiring.HitWireSingle += AddTwinklersToStatue; On_Player.UpdateItemDye += FindCalamityItemDyeShader; On_AWorldListItem.GetDifficulty += GetDifficultyOverride; On_Item.GetShimmered += ShimmerEffectEdits; - Terraria.On_Player.Teleport += TPOverride; + On_Player.Teleport += TPOverride; On_NPC.SpawnBoss += TripletsSpawnTextOverride; + On_NPC.DoDeathEvents_BeforeLoot += PreventFoveanatorDefeatMessageIfNotKilledLast; + On_NPC.DoDeathEvents_CelebrateBossDeath += TripletsDefeatTextOverride; + On_TileDrawing.DrawSingleTile += GlowMaskTileRender; + On_Main.DoUpdate_HandleChat += SpawnPunchCard; + On_Player.PlaceThing_CannonBall += AllowCannonJellyfishUse; // Mana Burn (Chaos Stone) and Chalice of the Blood God IL_Player.ApplyLifeAndOrMana += ManaSicknessAndChaliceBufferHeal; + //LavaStyles + if (ExternalMods.biomeLava == null) + { + //Rendering/Drawing + IL_Main.DoDraw += DoDrawLavas; + IL_Main.RenderWater += RenderLavas; + IL_Main.RenderBackground += RenderLavaBackgrounds; + IL_Main.DrawCapture += DrawLavatoCapture; + IL_TileDrawing.Draw += AddTileLiquidDrawing; + + //Blocking + IL_LiquidRenderer.DrawNormalLiquids += BlockLavaDrawing; + On_TileDrawing.DrawTile_LiquidBehindTile += BlockLavaDrawingForSlopes; + On_TileDrawing.DrawPartialLiquid += BlockLavaDrawingForSlopes2; + On_WaterfallManager.DrawWaterfall_int_int_int_float_Vector2_Rectangle_Color_SpriteEffects += LavafallRemover; + IL_Main.oldDrawWater += BlockRetroLightingLava; + + //Replacing + IL_LiquidRenderer.InternalPrepareDraw += LavaBubbleReplacer; + IL_TileDrawing.EmitLiquidDrops += LavaDropletReplacer; + IL_NPC.Collision_WaterCollision += SplashEntityLava; + IL_Projectile.Update += SplashEntityLava; + IL_Item.MoveInWorld += SplashEntityLava; + IL_Player.Update += SplashEntityLava; + IL_Player.Update += PlayerDebuffEdit; + + //Other + On_WaterfallManager.Draw += LavaFallRedrawer; + On_WaterfallManager.StylizeColor += WaterfallGlowmaskEditor; + + //Waterfall light + On_WaterfallManager.AddLight += LavafallLightEditor; + } + + // Liquid Lighting and alpha (Liquid Viusuals) + IL_TileLightScanner.GetTileLight += ApplyLiquidEmit; + IL_LiquidRenderer.DrawNormalLiquids += LiquidDrawColors; //Liquid Light + IL_TileDrawing.DrawTile_LiquidBehindTile += LiquidSlopeDrawColors; + // Custom grappling On_Player.GrappleMovement += CustomGrappleMovementCheck; On_Player.UpdatePettingAnimal += CustomGrapplePreDefaultMovement; @@ -101,27 +144,24 @@ namespace CalamityMod.ILEditing // Damage and health balance On_Main.DamageVar_float_int_float += AdjustDamageVariance; IL_NPC.ScaleStats_ApplyExpertTweaks += RemoveExpertHardmodeScaling; + IL_Projectile.Damage += VanillaBossResistChanges; IL_Projectile.AI_099_2 += LimitTerrarianProjectiles; - IL_Player.UpdateBuffs += NerfSharpeningStation; - IL_Player.UpdateBuffs += NerfBeetleScaleMail; - IL_Player.UpdateBuffs += NerfNebulaArmorBaseLifeRegenAndDamage; + IL_Projectile.AI_120_StardustGuardian += StardustGuardianAttackBuffs; + IL_Player.UpdateArmorSets += SolarWingsDashChange; + IL_Player.UpdateBuffs += UpdateBuffsBalancingChanges; IL_Player.ApplyVanillaHurtEffectModifiers += RemoveBeetleAndSolarFlareMultiplicativeDR; // Movement speed balance IL_Player.UpdateJumpHeight += FixJumpHeightBoosts; - IL_Player.Update += BaseJumpHeightAdjustment; + IL_Player.Update += BaseJumpSpeedAdjustment; IL_Player.Update += RunSpeedAdjustments; IL_Player.Update += NerfOverpoweredRunAccelerationSources; // Soaring Insignia, Magiluminescence, and Shadow Armor IL_Player.WingMovement += RemoveSoaringInsigniaInfiniteWingTime; - // Life regen balance - IL_Player.UpdateLifeRegen += PreventWellFedFromBeingRequiredInExpertModeForFullLifeRegen; - IL_Player.UpdateLifeRegen += RemoveNebulaLifeBoosterDoTImmunity; - - // Mana regen balance + // Life regen and mana regen balance + IL_Player.UpdateLifeRegen += UpdateLifeRegenBalancingChanges; + IL_Player.UpdateManaRegen += UpdateManaRegenBalancingChanges; IL_Player.Update += ManaRegenDelayAdjustment; - IL_Player.UpdateManaRegen += ManaRegenAdjustment; - IL_Player.UpdateManaRegen += NerfNebulaArmorManaRegen; // Item prefix changes On_Player.GrantPrefixBenefits += PrefixChanges; @@ -137,27 +177,37 @@ namespace CalamityMod.ILEditing IL_WorldGen.Chlorophyte += AdjustChlorophyteSpawnLimits; IL_UIWorldCreation.SetDefaultOptions += ChangeDefaultWorldSize; IL_UIWorldCreation.AddWorldSizeOptions += SwapSmallDescriptionKey; + IL_UIWorldCreation.AddWorldDifficultyOptions += SwapMasterModeDescriptionKey; Terraria.IO.On_WorldFile.ClearTempTiles += ClearModdedTempTiles; On_WorldGen.MakeDungeon += LimitDungeonEntranceXPosition; IL_WorldGen.DungeonHalls += LimitDungeonHallsXPosition; IL_WorldGen.MakeDungeon += ChangeDungeonSpikeQuantities; + Terraria.GameContent.Biomes.On_JunglePass.GenerateFinishingTouches += AddStohne; // Removal of vanilla stupidity - IL_Player.UpdateBuffs += RemoveFeralBiteRandomDebuffs; + IL_Player.StatusFromNPC += RemoveExpertBrainRandomDebuffs; IL_Player.ItemCheck_EmitUseVisuals += MakeMagmaStoneFireGauntletDustToggleable; IL_Projectile.EmitEnchantmentVisualsAt += MakeMagmaStoneFireGauntletProjectileDustToggleable; IL_Sandstorm.HasSufficientWind += DecreaseSandstormWindSpeedRequirement; IL_Item.TryGetPrefixStatMultipliersForItem += RelaxPrefixRequirements; On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; On_ShimmerTransforms.IsItemTransformLocked += AdjustShimmerRequirements; + On_Projectile.AI_015_Flails += FlailsNoLongerAffectedByPlayerVelocity; IL_Projectile.CanExplodeTile += MakeMeteoriteExplodable; IL_Main.UpdateWindyDayState += MakeWindyDayMusicPlayLessOften; IL_Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife; IL_WorldGen.AttemptFossilShattering += PreventFossilShattering; On_Player.GetPickaxeDamage += RemoveHellforgePickaxeRequirement; + IL_Player.Update += PreventUFODismountInWater; On_Player.GetAnglerReward += ImproveAnglerRewards; + IL_Player.TileInteractionsUse += RemovePowerCellPlanteraLock; + On_Player.ItemCheck_CheckCanUse += RemoveUseLocks; + On_Player.ItemCheck_UseEventItems += ApplyCelestialSigilChanges; + IL_Main.DrawInfoAccs += RemoveDamageConditionFromRadar; + On_ShopHelper.ApplyNpcRelationshipEffect += AllowMultipleLikedNPCs; + // Fix vanilla bugs exposed by Calamity mechanics IL_NPC.NPCLoot += FixSplittingWormBannerDrops; On_NPC.PlayerInteraction += FixSplittingWormInteraction; diff --git a/ILEditing/ILHelperMethods.cs b/ILEditing/ILHelperMethods.cs index 01f2379f0e..fe90e30043 100644 --- a/ILEditing/ILHelperMethods.cs +++ b/ILEditing/ILHelperMethods.cs @@ -64,77 +64,8 @@ namespace CalamityMod.ILEditing SoundEngine.PlaySound(SoundID.DoorClosed, new Vector2(doorX * 16, doorY * 16)); return true; } - - private static Texture2D SelectLavaTexture(Texture2D initialTexture, LiquidTileType type) - { - // Use the initial texture if it isn't lava. - if (initialTexture != CustomLavaManagement.LavaTexture && - initialTexture != CustomLavaManagement.LavaBlockTexture && - initialTexture != CustomLavaManagement.LavaSlopeTexture) - return initialTexture; - if (cachedLavaStyle == default) - return initialTexture; - - switch (type) - { - case LiquidTileType.Block: - return cachedLavaStyle.BlockTexture; - case LiquidTileType.Waterflow: - return cachedLavaStyle.LavaTexture; - case LiquidTileType.Slope: - return cachedLavaStyle.SlopeTexture; - } - - return initialTexture; - } - - private static VertexColors SelectLavaQuadColor(Texture2D initialTexture, ref VertexColors initialColor, bool forceTrue = false) - { - // We should handle the 'forceTrue' flag at this level to prevent us from checking the same thing four times. - if (!forceTrue) - { - if (initialTexture != CustomLavaManagement.LavaTexture && - initialTexture != CustomLavaManagement.LavaBlockTexture && - initialTexture != CustomLavaManagement.LavaSlopeTexture) - return initialColor; - } - - // 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); - cachedLavaStyle.SelectLightColor(ref initialColor.BottomRightColor); - return initialColor; - } - - private static Color SelectLavaColor(Texture2D initialTexture, Color initialLightColor, bool forceTrue = false) - { - // Use the initial color if it isn't lava. - if (!forceTrue) - { - if (initialTexture != CustomLavaManagement.LavaTexture && - initialTexture != CustomLavaManagement.LavaBlockTexture && - initialTexture != CustomLavaManagement.LavaSlopeTexture) - return initialLightColor; - } - - foreach (CustomLavaStyle lavaStyle in CustomLavaManagement.CustomLavaStyles) - { - if (lavaStyle.ChooseLavaStyle()) - { - lavaStyle.SelectLightColor(ref initialLightColor); - return initialLightColor; - } - } - - return initialLightColor; - } - - private static void SelectSulphuricWaterColor(int x, int y, ref VertexColors initialColor) + public static void SelectSulphuricWaterColor(int x, int y, ref VertexColors initialColor, bool isSlope) { if (SulphuricWaterSafeZoneSystem.NearbySafeTiles.Count >= 1) { @@ -177,10 +108,20 @@ namespace CalamityMod.ILEditing } } - initialColor.TopLeftColor *= 0.4f; - initialColor.TopRightColor *= 0.4f; - initialColor.BottomLeftColor *= 0.4f; - initialColor.BottomRightColor *= 0.4f; + if (isSlope) + { + initialColor.TopLeftColor *= 1f / 3; + initialColor.TopRightColor *= 1f / 3; + initialColor.BottomLeftColor *= 1f / 3; + initialColor.BottomRightColor *= 1f / 3; + } + else + { + initialColor.TopLeftColor *= 0.4f; + initialColor.TopRightColor *= 0.4f; + initialColor.BottomLeftColor *= 0.4f; + initialColor.BottomRightColor *= 0.4f; + } } public static void DumpToLog(ILContext il) => CalamityMod.Instance.Logger.Debug(il.ToString()); diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 1565301674..8563814c11 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -4,27 +4,33 @@ using System.Reflection; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; using CalamityMod.DataStructures; using CalamityMod.Events; using CalamityMod.FluidSimulation; -using CalamityMod.ForegroundDrawing; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Items.Armor.Wulfrum; +using CalamityMod.Items.Critters; using CalamityMod.Items.Dyes; +using CalamityMod.Items.Placeables.FurniturePlagued; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.DraedonLabThings; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Ravager; using CalamityMod.Particles; using CalamityMod.Projectiles; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; -using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles; using CalamityMod.Walls; using CalamityMod.Waterfalls; -using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -32,23 +38,26 @@ using Mono.Cecil.Cil; using MonoMod.Cil; using ReLogic.Content; using Terraria; +using Terraria.Audio; +using Terraria.Chat; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Achievements; +using Terraria.GameContent.Biomes; 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.Capture; 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; +using Terraria.WorldBuilding; namespace CalamityMod.ILEditing { @@ -60,16 +69,48 @@ namespace CalamityMod.ILEditing private static int aLabDoorClosed = -1; private static int exoDoorOpen = -1; private static int exoDoorClosed = -1; - // Cached for use in ChangeWaterQuadColors. - private static CustomLavaStyle cachedLavaStyle = default; // Holds the vanilla game function which spawns town NPCs, wrapped in a delegate for reflection purposes. // This function is (optionally) invoked manually in an IL edit to enable NPCs to spawn at night. private static Action VanillaSpawnTownNPCs; - private static readonly MethodInfo textureGetValueMethod = typeof(Asset).GetMethod("get_Value", BindingFlags.Public | BindingFlags.Instance); + //private static readonly MethodInfo textureGetValueMethod = typeof(Asset).GetMethod("get_Value", BindingFlags.Public | BindingFlags.Instance); - public static event Func ExtraColorChangeConditions; + #region Punch Card Spawning Command + private static void SpawnPunchCard(Terraria.On_Main.orig_DoUpdate_HandleChat orig) + { + // Any of these conditions should result in normal behaviour + if (!Main.drawingPlayerChat || Main.CurrentInputTextTakerOverride != null || Main.editSign || PlayerInput.UsingGamepad) + { + orig(); + return; + } + + // Allow only one pick up of the card this way per player (also don't give it to dead people) + Player player = Main.LocalPlayer; + if (player.Calamity().spawnedPunchCard || player.dead || !player.active) + { + orig(); + return; + } + + // Find 2 specific sets of text from the live chat box (as the player is typing) + // Gives the item to you and abruptly shuts the chat box down if both parts are found + string text = Main.chatText.ToLower(); + string prefix = "Items.Accessories.PunchCard.SpawnText"; + if ((text.Contains(CalamityUtils.GetTextValue($"{prefix}1")) || text.Contains(CalamityUtils.GetTextValue($"{prefix}1Alt"))) && text.Contains(CalamityUtils.GetTextValue($"{prefix}2"))) + { + player.QuickSpawnItem(Player.GetSource_None(), ModContent.ItemType(), 1); + player.Calamity().spawnedPunchCard = true; + Main.chatText = ""; + Main.ClosePlayerChat(); + Main.chatRelease = false; + SoundEngine.PlaySound(SoundID.MenuClose); + return; + } + orig(); + } + #endregion #region Dash Fixes and Improvements private static void MakeShieldSlamIFramesConsistent(ILContext il) @@ -263,16 +304,14 @@ namespace CalamityMod.ILEditing dir = self.direction; dashing = true; - if (self.dashTime > 0) - self.dashTime--; - if (self.dashTime < 0) - self.dashTime++; - if ((self.dashTime <= 0 && self.direction == -1) || (self.dashTime >= 0 && self.direction == 1)) + // CIT 16OCT2024: Commented this code out, as there's no reason for custom dash hotkey to use Player.dashTime + // and was causing the return of Celestial Starboard's dash bug from early 1.4 versions + /*if ((self.dashTime <= 0 && self.direction == -1) || (self.dashTime >= 0 && self.direction == 1)) { self.dashTime = 15; return; - } + }*/ dashing = true; self.dashTime = 0; @@ -287,6 +326,7 @@ namespace CalamityMod.ILEditing { dir = 1; dashing = false; + self.dashTime = 0; } } #endregion @@ -343,7 +383,7 @@ namespace CalamityMod.ILEditing { // A cached delegate is used here instead of direct reflection for performance reasons // since UpdateTime is called every frame. - if (Main.dayTime || CalamityConfig.Instance.TownNPCsSpawnAtNight) + if (Main.dayTime || CalamityServerConfig.Instance.TownNPCsSpawnAtNight) VanillaSpawnTownNPCs(); }); @@ -359,7 +399,7 @@ namespace CalamityMod.ILEditing private static void AlterTownNPCSpawnRate(Terraria.On_Main.orig_UpdateTime_SpawnTownNPCs orig) { double oldWorldRate = Main.desiredWorldTilesUpdateRate; - Main.desiredWorldTilesUpdateRate *= CalamityConfig.Instance.TownNPCSpawnRateMultiplier; + Main.desiredWorldTilesUpdateRate *= CalamityServerConfig.Instance.TownNPCSpawnRateMultiplier; orig(); Main.desiredWorldTilesUpdateRate = oldWorldRate; } @@ -431,6 +471,13 @@ namespace CalamityMod.ILEditing // No interference with ShadowDodge (previously Titanium armor, now Hallowed armor) } + + private static void AddHolyProtectionCooldown(On_Player.orig_PutHallowedArmorSetBonusOnCooldown orig, Player self) + { + // Adds Calamity's Holy Protection cooldown when triggering Hallowed armor's dodge. + orig(self); + self.AddCooldown(HolyProtection.ID, CalamityUtils.SecondsToFrames(30)); + } #endregion #region Custom Gate Door Logic @@ -495,32 +542,83 @@ namespace CalamityMod.ILEditing } #endregion - #region Hellbound Enchantment Projectile Creation Effects - private static int IncorporateMinionExplodingCountdown(Terraria.On_Projectile.orig_NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float_float orig, IEntitySource spawnSource, float x, float y, float xSpeed, float ySpeed, int type, int damage, float knockback, int owner, float ai0, float ai1, float ai2) + #region Apply Projectile Variables Upon Creation + private static int IncorporateExtraProjectileVariables(Terraria.On_Projectile.orig_NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float_float orig, IEntitySource spawnSource, float x, float y, float xSpeed, float ySpeed, int type, int damage, float knockback, int owner, float ai0, float ai1, float ai2) { // This is unfortunately not something that can be done via SetDefaults since owner is set // after that method is called. Doing it directly when the projectile is spawned appears to be the only reasonable way. int proj = orig(spawnSource, x, y, xSpeed, ySpeed, type, damage, knockback, owner, ai0, ai1, ai2); Projectile projectile = Main.projectile[proj]; - if (projectile.minion) + + Player player = Main.player[projectile.owner]; + if (Main.gameMenu || !player.active) + return proj; + + if (!projectile.TryGetGlobalProjectile(out var calProj)) + return proj; + + // Old Fashioned + if (spawnSource is EntitySource_Parent parentSource) { - Player player = Main.player[projectile.owner]; - if (Main.gameMenu || !player.active) - return proj; + // Parent-spawned projectiles involve 5 relevant sources: Buff, Item, NPC, Player, Projectile + // 1. Buffs: Old Fashioned inherently does not affect them, they have no effect - // Do not apply Hellbound effects to minions not spawned by the item itself, if it came out of an item - // This prevent minions like Luxor's Gift getting it, but minions spawned out of minions such as Temporal Umbrella will work fine - if (spawnSource is EntitySource_ItemUse && player.ActiveItem().shoot != projectile.type) - return proj; + /* 2. Item: If detected to be from weapons, are assumedly debuffed + *The criteria includes: A. has damage, B. has use animation, and C. came out of an item + *This rules out items such as Bombs or Shield of Cthulhu (hypothetically were it to spawn projectiles) + *This source is *not* from item use, but is still used for a multitude of purposes in weapons */ + if (parentSource.Entity is Item item && item.damage > 0 && item.useAnimation > 0) + calProj.buffedByOldFashioned = false; + // 3. NPCs: Not considered at all; no effect + + // 4. Players: Only considered if the source owner matches the projectile's, otherwise no effect + else if (parentSource.Entity is Player parentPlayer && parentPlayer.whoAmI == projectile.owner) + { + // 4A. The primary player-based source is item use, which follows the same logic as items (see above) + // Edge case: Wulfrum Fusion Cannon is coded like a weapon. There may be a better way to approach this but an exclusion works for now + if (spawnSource is EntitySource_ItemUse itemSource && itemSource.Item is Item usedItem + && usedItem.damage > 0 && usedItem.useAnimation > 0 && usedItem.type != ModContent.ItemType()) + calProj.buffedByOldFashioned = false; + // 4B. Every non item-use source is assumed safe to buff + else + calProj.buffedByOldFashioned = true; + } + + // 5. Projectiles: Directly inherited by its parent projectile + else if (parentSource.Entity is Projectile parentProj) + calProj.buffedByOldFashioned = parentProj.Calamity().buffedByOldFashioned; + } + + // Hellbound Enchantment + // This only applies to minions spawned by weapon uses, preventing other minions such as Luxor's Gift from exploding + if (projectile.minion && spawnSource is EntitySource_ItemUse useSource && useSource.Item is Item weapon && weapon.useAnimation > 0) + { CalamityPlayer.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); if (player.Calamity().explosiveMinionsEnchant) - projectile.Calamity().ExplosiveEnchantCountdown = CalamityGlobalProjectile.ExplosiveEnchantTime; + calProj.ExplosiveEnchantCountdown = CalamityGlobalProjectile.ExplosiveEnchantTime; + } + // Minion shots inherit the "explode countdown" from the parent minion + // This is only to inherit the damage scaling of the minion and does NOT mean the shot will explode too + else if (ProjectileID.Sets.MinionShot[projectile.type]) + { + // Going down the chain + if (spawnSource is EntitySource_Parent trueSource && trueSource.Entity is Projectile parent) + calProj.ExplosiveEnchantCountdown = parent.Calamity().ExplosiveEnchantCountdown; } return proj; } #endregion + #region Apply Old Fashioned Damage to Miscellanous Hits + private static void ApplyOldFashionedDamageToMiscHits(Terraria.On_Player.orig_ApplyDamageToNPC orig, Player self, NPC npc, int damage, float knockback, int direction, bool crit = false, DamageClass? damageType = null, bool damageVariation = false) + { + if (self.Calamity().oldFashioned) + damage = (int)(damage * OldFashioned.DamageBoostMultiplier); + orig(self, npc, damage, knockback, direction, crit, damageType, damageVariation); + } + #endregion + #region Chaos Stone and Chalice of the Blood God private static void ManaSicknessAndChaliceBufferHeal(ILContext il) { @@ -561,7 +659,7 @@ namespace CalamityMod.ILEditing modPlayer.chaliceBleedoutBuffer -= amountOfBleedToClear; // Display text indicating that healing was applied to the bleedout buffer. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { string text = $"(+{amountOfBleedToClear})"; Rectangle location = new Rectangle((int)player.position.X + 4, (int)player.position.Y - 3, player.width - 4, player.height - 4); @@ -742,17 +840,48 @@ namespace CalamityMod.ILEditing } #endregion - #region Fog Effect in Floral Paradise - private static void DrawFloralParadiseFog(ILContext il) + #region Custom DoDraw Changes + private static void CustomDoDrawChanges(ILContext il) { + // This IL edit accomplishes two things: + // 1. Calls a helper function for drawing the fog in the Floral Paradise. + // 2. Allows for drawing additive blend projectiles using IAdditiveDrawer. ILCursor cursor = new ILCursor(il); - cursor.GotoNext(MoveType.Before, i => i.MatchCallOrCallvirt
("DrawInfernoRings")); + // First, Floral Paradise fog. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCallOrCallvirt
("DrawInfernoRings"))) + return; + cursor.EmitDelegate(() => { - if (Main.netMode != NetmodeID.Server && BiomeTileCounterSystem.FloralParadiseTiles > 0) + if (!Main.dedServ && BiomeTileCounterSystem.FloralParadiseTiles > 0) DrawFog(Utils.GetLerpValue(0f, 250f, BiomeTileCounterSystem.FloralParadiseTiles, true)); }); + + // Then, additive drawing. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("Draw"))) + return; + + cursor.EmitDelegate(() => + { + Main.spriteBatch.SetBlendState(BlendState.Additive); + + // Draw Projectiles. + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.ModProjectile is IAdditiveDrawer d) + d.AdditiveDraw(Main.spriteBatch); + } + + // Draw NPCs. + foreach (NPC n in Main.ActiveNPCs) + { + if (n.ModNPC is IAdditiveDrawer d) + d.AdditiveDraw(Main.spriteBatch); + } + + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + }); } private static void DrawFog(float intensity) @@ -776,36 +905,6 @@ namespace CalamityMod.ILEditing Main.spriteBatch.End(); Main.spriteBatch.Begin(); } - #endregion Fog Effect in Floral Paradise - - #region Custom Draw Layers - private static void AdditiveDrawing(ILContext il) - { - ILCursor cursor = new(il); - if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("DrawWhite"))) - return; - - cursor.EmitDelegate(() => - { - Main.spriteBatch.SetBlendState(BlendState.Additive); - - // Draw Projectiles. - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.ModProjectile is IAdditiveDrawer d) - d.AdditiveDraw(Main.spriteBatch); - } - - // Draw NPCs. - foreach (NPC n in Main.ActiveNPCs) - { - if (n.ModNPC is IAdditiveDrawer d) - d.AdditiveDraw(Main.spriteBatch); - } - - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); - }); - } #endregion #region General Particle Rendering @@ -826,365 +925,557 @@ namespace CalamityMod.ILEditing } #endregion - #region Custom Lava Visuals - - private static void CacheLavaStyle(Terraria.On_Main.orig_RenderWater orig, Main self) + #region Disable Moon Lord Style Flashes With Photosensitivity Config + private static void DisableFlashesWithPhotosensitivityConfig(On_MoonlordDeathDrama.orig_RequestLight orig, float light, Vector2 spot) { - // Immediately cache the lava drawing style. - // This will pay off in SPADES when we go to draw the tiles. - foreach (CustomLavaStyle style in CustomLavaManagement.CustomLavaStyles) - { - if (style.ChooseLavaStyle()) - { - cachedLavaStyle = style; - orig(self); - return; - } - } - - 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) - { - orig(self, behindBlocks, tileCache, ref position, ref liquidSize, liquidType, ref colors); + // Disable this function from running if the Photosensitivity config is enabled. + if (CalamityClientConfig.Instance.Photosensitivity) return; - } - int slope = (int)tileCache.Slope; - colors = SelectLavaQuadColor(TextureAssets.LiquidSlope[liquidType].Value, ref colors, true); - if (!TileID.Sets.BlocksWaterDrawingBehindSelf[tileCache.TileType] || behindBlocks || slope == 0) - { - Texture2D liquidTexture = SelectLavaTexture(liquidType == 1 ? CustomLavaManagement.LavaBlockTexture : TextureAssets.Liquid[liquidType].Value, LiquidTileType.Block); - Main.tileBatch.Draw(liquidTexture, position, liquidSize, colors, default(Vector2), 1f, SpriteEffects.None); - return; - } - - Texture2D slopeTexture = SelectLavaTexture(liquidType == 1 ? CustomLavaManagement.LavaSlopeTexture : TextureAssets.LiquidSlope[liquidType].Value, LiquidTileType.Slope); - liquidSize.X += 18 * (slope - 1); - switch (slope) - { - case 1: - Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None); - break; - case 2: - Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None); - break; - case 3: - Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None); - break; - case 4: - Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None); - break; - } - } - - private static void ChangeWaterQuadColors(ILContext il) - { - ILCursor cursor = new ILCursor(il); - - if (!cursor.TryGotoNext(c => c.MatchLdfld("_liquidTextures"))) - { - LogFailure("Custom Lava Drawing", "Could not locate the liquid texture array load."); - return; - } - - // Move to the end of the get_Value() call and then use the resulting texture to check if a new one should replace it. - // Adding to the index directly would seem like a simple, direct way of achieving this since the operation is incredibly light, but - // it also unsafe due to the potential for NOP operations to appear. - if (!cursor.TryGotoNext(MoveType.After, c => c.MatchCallvirt(textureGetValueMethod))) - { - LogFailure("Custom Lava Drawing", "Could not locate the liquid texture Value call."); - return; - } - cursor.EmitDelegate>(initialTexture => SelectLavaTexture(initialTexture, LiquidTileType.Waterflow)); - - if (!cursor.TryGotoNext(MoveType.After, c => c.MatchLdloc(9))) - { - LogFailure("Custom Lava Drawing", "Could not locate the liquid light color."); - return; - } - - // Pass the texture in so that the method can ensure it is not messing around with non-lava textures. - cursor.Emit(OpCodes.Ldarg_0); - cursor.Emit(OpCodes.Ldfld, typeof(LiquidRenderer).GetField("_liquidTextures")); - cursor.Emit(OpCodes.Ldloc, 8); - cursor.Emit(OpCodes.Ldelem_Ref); - 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 basaltWater = ModContent.GetInstance(); - ModWaterStyle burrowsWater = ModContent.GetInstance(); - ModWaterStyle polypWater = ModContent.GetInstance(); - ModWaterStyle reefsWater = ModContent.GetInstance(); - ModWaterStyle shoresWater = ModContent.GetInstance(); - ModWaterStyle sulphuricWater = ModContent.GetInstance(); - ModWaterStyle sulphuricDepthsWater = ModContent.GetInstance(); - ModWaterStyle upperAbyssWater = ModContent.GetInstance(); - 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. - if (cachedLavaStyle != default) - { - initialColor = SelectLavaQuadColor(initialTexture, ref initialColor, liquidType == 1); - } - if (liquidType == burrowsWater.Slot || - liquidType == basaltWater.Slot || - liquidType == polypWater.Slot || - liquidType == shoresWater.Slot || - liquidType == reefsWater.Slot || - liquidType == sulphuricWater.Slot || - liquidType == sulphuricDepthsWater.Slot || - liquidType == upperAbyssWater.Slot || - liquidType == middleAbyssWater.Slot || - liquidType == voidWater.Slot) - { - SelectSulphuricWaterColor(x, y, ref initialColor); - } - - // Apply any extra color conditions. - initialColor = ExtraColorChangeConditions?.Invoke(initialColor, liquidType, new(x, y)) ?? initialColor; - - return initialColor; - }); - } - - private static void DrawCustomLava3(ILContext il) - { - ILCursor cursor = new ILCursor(il); - - // Locate the local index for the liquid color and tile coordinates. - int xCoordLocalIndex = 0; - int yCoordLocalIndex = 0; - int liquidColorLocalIndex = 0; - MethodInfo lightingGetColorMethod = typeof(Lighting).GetMethod("GetColor", new Type[] { typeof(int), typeof(int) }); - if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchCallOrCallvirt(lightingGetColorMethod))) - { - LogFailure("Custom Lava Drawing", "Could not lighting GetColor call."); - return; - } - if (!cursor.TryGotoPrev(c => c.MatchLdloc(out xCoordLocalIndex))) - { - LogFailure("Custom Lava Drawing", "Could not X coordinate local variable index."); - return; - } - if (!cursor.TryGotoPrev(c => c.MatchLdloc(out yCoordLocalIndex))) - { - LogFailure("Custom Lava Drawing", "Could not Y coordinate local variable index."); - return; - } - if (!cursor.TryGotoNext(c => c.MatchStloc(out liquidColorLocalIndex))) - { - LogFailure("Custom Lava Drawing", "Could not lighting GetColor local variable index."); - return; - } - - // Shortly after the liquid color local is the liquid type integer. Locate it. - int liquidTypeLocalIndex = 0; - if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchLdcI4(0))) - { - LogFailure("Custom Lava Drawing", "Could not default value for the liquid type."); - return; - } - if (!cursor.TryGotoNext(c => c.MatchStloc(out liquidTypeLocalIndex))) - { - LogFailure("Custom Lava Drawing", "Could not liquid type local variable index."); - return; - } - - // Select the lava color. - if (!cursor.TryGotoNext(MoveType.After, c => c.MatchCallOrCallvirt("get_NotRetro"))) - { - LogFailure("Custom Lava Drawing", "Could not locate the retro style check."); - return; - } - - // Pass the texture in so that the method can ensure it is not messing around with non-lava textures. - cursor.Emit(OpCodes.Ldloc, liquidColorLocalIndex); - cursor.Emit(OpCodes.Ldsfld, typeof(TextureAssets).GetField("Liquid")); - cursor.Emit(OpCodes.Ldloc, liquidTypeLocalIndex); - cursor.Emit(OpCodes.Ldelem_Ref); - cursor.Emit(OpCodes.Call, textureGetValueMethod); - cursor.Emit(OpCodes.Ldloc, xCoordLocalIndex); - cursor.Emit(OpCodes.Ldloc, yCoordLocalIndex); - cursor.EmitDelegate>((initialColor, initialTexture, x, y) => - { - Color c = SelectLavaColor(initialTexture, initialColor); - - if (ExtraColorChangeConditions is not null) - c = ExtraColorChangeConditions(new(c), Main.waterStyle, new(x, y)).TopLeftColor; - - return c; - }); - cursor.Emit(OpCodes.Stloc, liquidColorLocalIndex); - - // Go back to the start and change textures as necessary. - cursor.Index = 0; - - while (cursor.TryGotoNext(c => c.MatchLdsfld(typeof(TextureAssets).GetField("Liquid")))) - { - // Move to the end of the get_Value() call and then use the resulting texture to check if a new one should replace it. - // Adding to the index directly would seem like a simple, direct way of achieving this since the operation is incredibly light, but - // it is unsafe due to the potential for NOP operations to appear. - if (!cursor.TryGotoNext(MoveType.After, c => c.MatchCallvirt(textureGetValueMethod))) - { - LogFailure("Custom Lava Drawing", "Could not locate the liquid texture Value call."); - return; - } - - cursor.EmitDelegate>(initialTexture => SelectLavaTexture(initialTexture, LiquidTileType.Block)); - } - } - - private static void DrawCustomLavafalls(Terraria.On_WaterfallManager.orig_DrawWaterfall_int_int_int_float_Vector2_Rectangle_Color_SpriteEffects orig, WaterfallManager self, int waterfallType, int x, int y, float opacity, Vector2 position, Rectangle sourceRect, Color color, SpriteEffects effects) - { - waterfallType = CustomLavaManagement.SelectLavafallStyle(waterfallType); - color = CustomLavaManagement.SelectLavafallColor(waterfallType, color); - - orig(self, waterfallType, x, y, opacity, position, sourceRect, color, effects); + orig(light, spot); } #endregion - #region Water Visuals - private static void MakeSulphSeaWaterBetter(Terraria.Graphics.Light.On_TileLightScanner.orig_GetTileLight orig, TileLightScanner self, int x, int y, out Vector3 outputColor) + #region Lava Style Edits + //Nine Layers of Hell brought to you by LIONEIGHTCAKE!! + //All new liquid rendering for lava can be found in Systems/LavaRendering.cs + + //To save on time, a LOT of the edits are from the BiomeLava mod (owned by myself, lion8cake). Obv every edit has been changed to reflect + //Calamity's style of IL edits and to remove any unnessesary edits not relivant to calamity. In the loading of the detours and edits + //BiomeLava is a check for whether they load or not. If BiomeLava is active all ModLavaStyles will be turned into ModCalls for BiomeLava. + + #region Lava Rendering + private static void DoDrawLavas(ILContext il) { - orig(self, x, y, out outputColor); - if (outputColor == Vector3.One || outputColor == new Vector3(0.25f, 0.25f, 0.25f) || outputColor == new Vector3(0.5f, 0.5f, 0.5f)) + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdsfld
("drawToScreen"), i => i.MatchBrfalse(out _), i => i.MatchLdarg0(), i => i.MatchLdcI4(1), i => i.MatchCall
("DrawWaters"))) + { + LogFailure("DoDraw Lava", "Could not locate the drawing of Background Waters"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.Instance.DrawLavas(isBackground: true); + }); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdsfld
("drawToScreen"), i => i.MatchBrfalse(out _), i => i.MatchLdarg0(), i => i.MatchLdcI4(0), i => i.MatchCall
("DrawWaters"))) + { + LogFailure("DoDraw Lava", "Could not locate the drawing of Waters"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.Instance.DrawLavas(); + }); + } + + private static void RenderLavas(ILContext il) + { + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdarg0(), i => i.MatchLdcI4(0), i => i.MatchCall
("DrawWaters"))) + { + LogFailure("Render Lava", "Could not locate the drawing of Waters"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.Instance.DrawLavas(); + }); + } + + private static void RenderLavaBackgrounds(ILContext il) + { + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdarg0(), i => i.MatchLdcI4(1), i => i.MatchCall
("DrawWaters"))) + { + LogFailure("Render Lava Backgroumds", "Could not locate the drawing of Background Waters"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.Instance.DrawLavas(isBackground: true); + }); + } + + private static void DrawLavatoCapture(ILContext il) + { + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdsfld
("liquidAlpha"), i => i.MatchCall(out _), i => i.MatchStloc2())) + { + LogFailure("Draw lavas to captures", "Could not locate the saving of water alphas"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.LavaAlpha.CopyTo(LavaRenderingSystem.AlphaSave, 0); + }); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(0), i => i.MatchStloc(34), i => i.MatchBr(out _), i => i.MatchLdloc(34), i => i.MatchLdcI4(1), i => i.MatchBeq(out _))) + { + LogFailure("Draw lavas to captures", "Could not locate the resetting of water alphas"); + return; + } + cursor.EmitLdloc(8); + cursor.EmitDelegate((CaptureBiome biome) => { + for (int i = 0; i < 1; i++) + { + LavaRenderingSystem.LavaAlpha[i] = ((i == LavaRenderingSystem.LavaStyle) ? 1f : 0f); + } + }); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdarg0(), i => i.MatchLdcI4(1), i => i.MatchLdsfld
("waterStyle"), i => i.MatchLdcR4(1), i => i.MatchLdcI4(1), i => i.MatchCall
("DrawLiquid"))) + { + LogFailure("Draw lavas to captures", "Could not locate the background of liquid capture drawing"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.Instance.DrawLiquid(bg: true, LavaRenderingSystem.LavaStyle); + }); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdarg0(), i => i.MatchLdcI4(1), i => i.MatchLdsfld
("bloodMoon"), i => i.MatchBrtrue(out _), i => i.MatchLdloc(8), i => i.MatchLdfld("WaterStyle"), i => i.MatchBr(out _), i => i.MatchLdcI4(9), i => i.MatchLdcR4(1), i => i.MatchLdcI4(1), i => i.MatchCall
("DrawLiquid"))) + { + LogFailure("Draw lavas to captures", "Could not locate the second background of liquid capture drawing"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.Instance.DrawLiquid(bg: true, LavaRenderingSystem.LavaStyle); + }); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdarg0(), i => i.MatchLdcI4(0), i => i.MatchLdsfld
("waterStyle"), i => i.MatchLdcR4(1), i => i.MatchLdcI4(1), i => i.MatchCall
("DrawLiquid"))) + { + LogFailure("Draw lavas to captures", "Could not locate the liquid capture drawing"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.Instance.DrawLiquid(bg: false, LavaRenderingSystem.LavaStyle); + }); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdarg0(), i => i.MatchLdcI4(0), i => i.MatchLdloc(8), i => i.MatchLdfld("WaterStyle"), i => i.MatchLdcR4(1), i => i.MatchLdcI4(1), i => i.MatchCall
("DrawLiquid"))) + { + LogFailure("Draw lavas to captures", "Could not locate the second liquid capture drawing"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.Instance.DrawLiquid(bg: false, LavaRenderingSystem.LavaStyle); + }); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdloc2(), i => i.MatchStsfld
("liquidAlpha"))) + { + LogFailure("Draw lavas to captures", "Could not locate water style value returner"); + return; + } + cursor.EmitDelegate(() => { + LavaRenderingSystem.AlphaSave.CopyTo(LavaRenderingSystem.LavaAlpha, 0); + }); + } + + private void AddTileLiquidDrawing(ILContext il) + { + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdarg0(), i => i.MatchLdarg1(), i => i.MatchLdcI4(0), i => i.MatchLdarg(out _), i => i.MatchLdloc1(), i => i.MatchLdloc2(), i => i.MatchLdloc(12), i => i.MatchLdloc(13), i => i.MatchLdloc(14), i => i.MatchCall("DrawTile_LiquidBehindTile"))) + { + LogFailure("Tile Lava Drawing", "Could not locate the drawing of Liquid Behind Tile drawing"); + return; + } + cursor.EmitLdloc1(); + cursor.EmitLdloc2(); + cursor.EmitLdloc(12); + cursor.EmitLdloc(13); + cursor.EmitLdloc(14); + cursor.EmitDelegate((Vector2 unscaledPosition, Vector2 vector, int j, int i, Tile tile) => { + LavaRenderingSystem.Instance.DrawTile_LiquidBehindTile(solidLayer: false, inFrontOfPlayers: false, -1, unscaledPosition, vector, j, i, tile); + }); + } + #endregion + + #region Lava Blocking + private void BlockLavaDrawing(ILContext il) + { + //This edit to DrawNormalLiquids makes lavas in normal and white lighting draw with an alpha and with new textures + //If the parameter for the waterstyle is more than the max waterstyles then its subtracted by the max water style count and thats the lava style ID + ILCursor cursor = new ILCursor(il); + + //Continue if statement, basically + //if the liquid being drawn is lava and the water style is greater than the max water styles or if the liquid is water and less than the max water styles then the draw code is ran + //otherwise the loop/s are continued for the next liquid + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStloc(4), i => i.MatchBr(out _), i => i.MatchLdloc(2), i => i.MatchLdfld(typeof(LiquidRenderer).GetNestedType("LiquidDrawCache", BindingFlags.NonPublic), "IsVisible"))) + { + LogFailure("Liquid Renderer Drawing", "Could not locate the IsVisible boolean check"); + return; + } + cursor.EmitLdarg3(); + cursor.EmitLdloc2(); //Initiated Liquid Draw Cache (needed for the Type parameter) + cursor.EmitLdfld(typeof(LiquidRenderer).GetNestedType("LiquidDrawCache", BindingFlags.NonPublic).GetRuntimeField("Type")); + cursor.EmitDelegate>((IsVisible, style, type) => IsVisible && ((type == 1 && style >= LavaRenderingSystem.Instance.WaterStyleMaxCount + 1) || (type != 1 && style <= LavaRenderingSystem.Instance.WaterStyleMaxCount))); + + //Lava alpha color, if the liquid drawn is lava, multiply num by the water alpha + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdloc(2), i => i.MatchLdfld(typeof(LiquidRenderer).GetNestedType("LiquidDrawCache", BindingFlags.NonPublic).GetRuntimeField("Type")), i => i.MatchStloc(8))) + { + LogFailure("Liquid Renderer Drawing", "Could not locate creation of the local variable num2 (the liquid type holder variable)"); + return; + } + cursor.EmitLdloc(8); + cursor.EmitLdloca(7); + cursor.EmitLdarg(4); + cursor.EmitDelegate((int num2, ref float num, float globalAlpha) => + { + if (num2 == LiquidID.Lava) + { + num *= globalAlpha; + } + }); + + //Conditionally replace the liquid texture whether the liquid is lava or water + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCallvirt(typeof(Asset).GetMethod("get_Value", BindingFlags.Public | BindingFlags.Instance)))) + { + LogFailure("Liquid Renderer Drawing", "Could not locate the Texture2D array of liquids"); + return; + } + cursor.EmitLdarg3(); + cursor.EmitLdloc2(); //Initiated Liquid Draw Cache (needed for the Type parameter) + cursor.EmitLdfld(typeof(LiquidRenderer).GetNestedType("LiquidDrawCache", BindingFlags.NonPublic).GetRuntimeField("Type")); + cursor.EmitDelegate>((initialTexture, style, type) => + (style >= LavaRenderingSystem.Instance.WaterStyleMaxCount + 1 && type == LiquidID.Lava) + ? LavaRenderingSystem.Textures.liquid[style - LavaRenderingSystem.Instance.WaterStyleMaxCount - 1].Value + : initialTexture + ); + } + + private void BlockLavaDrawingForSlopes(On_TileDrawing.orig_DrawTile_LiquidBehindTile orig, TileDrawing self, bool solidLayer, bool inFrontOfPlayers, int waterStyleOverride, Vector2 screenPosition, Vector2 screenOffset, int tileX, int tileY, Tile tileCache) + { + if (tileCache.LiquidType == LiquidID.Lava) return; - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.LiquidAmount <= 0 || tile.HasTile || tile.Get().LiquidType != LiquidID.Water || (Main.waterStyle != SulphuricWater.Type && - Main.waterStyle != SulphuricDepthsWater.Type && Main.waterStyle != SunkenSeaBurrowsWater.Type && Main.waterStyle != SunkenSeaPolypWater.Type && - Main.waterStyle != SunkenSeaReefsWater.Type && Main.waterStyle != SunkenSeaShoresWater.Type && Main.waterStyle != BasaltGullyWater.Type)) + Tile tile = Main.tile[tileX + 1, tileY]; + if (tile.LiquidType == LiquidID.Lava) return; - Tile above = CalamityUtils.ParanoidTileRetrieval(x, y - 1); - if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9) && Main.waterStyle == SulphuricWater.Type) + Tile tile2 = Main.tile[tileX - 1, tileY]; + if (tile2.LiquidType == LiquidID.Lava) + return; + + Tile tile3 = Main.tile[tileX, tileY - 1]; + if (tile3.LiquidType == LiquidID.Lava) + return; + + Tile tile4 = Main.tile[tileX, tileY + 1]; + if (tile4.LiquidType == LiquidID.Lava) + return; + + orig.Invoke(self, solidLayer, inFrontOfPlayers, waterStyleOverride, screenPosition, screenOffset, tileX, tileY, tileCache); + } + + private void BlockLavaDrawingForSlopes2(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) { - MediumMistParticle acidFoam = new(new(x * 16f + Main.rand.NextFloat(16f), y * 16f + 8f), -Vector2.UnitY.RotatedByRandom(0.67f) * Main.rand.NextFloat(1f, 2.4f), Color.LightSeaGreen, Color.White, 0.16f, 128f, 0.02f); - GeneralParticleHandler.SpawnParticle(acidFoam); + return; + } + orig.Invoke(self, behindBlocks, tileCache, ref position, ref liquidSize, liquidType, ref colors); + } + + private void LavafallRemover(On_WaterfallManager.orig_DrawWaterfall_int_int_int_float_Vector2_Rectangle_Color_SpriteEffects orig, WaterfallManager self, int waterfallType, int x, int y, float opacity, Vector2 position, Rectangle sourceRect, Color color, SpriteEffects effects) + { + if (waterfallType == 1) + { + return; + } + orig.Invoke(self, waterfallType, x, y, opacity, position, sourceRect, color, effects); + } + + private void BlockRetroLightingLava(ILContext il) + { + ILCursor cursor = new ILCursor(il); + ILLabel target = cursor.DefineLabel(); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCgt(), i => i.MatchLdarg1(), i => i.MatchOr(), i => i.MatchBrfalse(out target))) + { + LogFailure("old Drawing Waters", "Could not locate the if statement that contains the check for liquid types, amounts and wether the liquid has a bg (arg1) or not"); + return; + } + if (target == null) + { + LogFailure("old Drawing Waters", "The BrFalse returned null, the boolean check getting was unsuccessful"); + return; + } + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdindU1(), i => i.MatchSub(), i => i.MatchConvR4(), i => i.MatchStloc(14))) + { + LogFailure("old Drawing Waters", "Could not locate the num3 local variable creation to put the if check after"); + return; + } + cursor.EmitLdloc(12); + cursor.EmitLdloc(11); + cursor.EmitDelegate((int i, int j) => { + return Main.tile[i, j].LiquidType == LiquidID.Lava; + }); + cursor.EmitBrtrue(target); + } + #endregion + + #region Lava Replacing + private void LavaBubbleReplacer(ILContext il) + { + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(16), i => i.MatchLdcI4(16), i => i.MatchLdcI4(35))) + { + LogFailure("Ambient lava bubble replacer", "Could not locate the bubble newdust parameters"); + return; + } + cursor.EmitDelegate>(type => LavaRenderingSystem.dustLava()); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(16), i => i.MatchLdcI4(8), i => i.MatchLdcI4(35))) + { + LogFailure("Ambient lava bubble replacer", "Could not locate the surface bubble newdust parameters"); + return; + } + cursor.EmitDelegate>(type2 => LavaRenderingSystem.dustLava()); + } + + private void LavaDropletReplacer(ILContext il) + { + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdarg(out _), i => i.MatchLdcI4(374), i => i.MatchBneUn(out _), i => i.MatchLdcI4(716))) + { + LogFailure("Ambient lava droplet replacer", "Could not locate the lava droplet newgore parameters"); + return; + } + cursor.EmitDelegate>(type => LavaRenderingSystem.goreLava()); + } + + private void SplashEntityLava(ILContext il) + { + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("width"), i => i.MatchLdcI4(12), i => i.MatchAdd(), i => i.MatchLdcI4(24), i => i.MatchLdcI4(35))) + { + LogFailure("Entity Lava Splashing (Item, Projectile, NPC, Player)", "Could not locate the first lava bubble splashing"); + return; + } + cursor.EmitDelegate>(type => LavaRenderingSystem.dustLava()); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("width"), i => i.MatchLdcI4(12), i => i.MatchAdd(), i => i.MatchLdcI4(24), i => i.MatchLdcI4(35))) + { + LogFailure("Entity Lava Splashing (Item, Projectile, NPC, Player)", "Could not locate the second lava bubble splashing"); + return; + } + cursor.EmitDelegate>(type2 => LavaRenderingSystem.dustLava()); + } + + private void PlayerDebuffEdit(ILContext il) + { + //Injects code directly at the position where the OnFire debuff is handled + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdarg0(), i => i.MatchLdcI4(24), i => i.MatchLdloc(161), i => i.MatchLdcI4(1), i => i.MatchLdcI4(0), i => i.MatchCall("AddBuff"))) + { + LogFailure("Player Update Lava Debuff", "Could not locate the infliction of the On Fire! debuff inside the Player Update code"); + return; + } + cursor.EmitLdarg0(); + cursor.EmitLdloc(161); + cursor.EmitDelegate((Player player, int onFiretime) => + { + LavaStylesLoader.InflictDebuff(player, LavaRenderingSystem.LavaStyle, onFiretime); + }); + } + #endregion + + #region Other + private Color WaterfallGlowmaskEditor(On_WaterfallManager.orig_StylizeColor orig, float alpha, int maxSteps, int waterfallType, int y, int s, Tile tileCache, Color aColor) + { + if (LavaRenderingSystem.LavaStyle != 0 && !LavaStylesLoader.Get(LavaRenderingSystem.LavaStyle).LavafallGlowmask()) + { + return aColor; + } + else + { + return orig.Invoke(alpha, maxSteps, waterfallType, y, s, tileCache, aColor); + } + } + + private void LavaFallRedrawer(On_WaterfallManager.orig_Draw orig, WaterfallManager self, SpriteBatch spriteBatch) + { + orig.Invoke(self, spriteBatch); + LavaRenderingSystem.Instance.InitialDrawLavafall(self); + } + #endregion + + #endregion + + #region Liquid Visuals + //Contains all liquid light and liquid alpha (seethrough-ability) + private static void ApplyLiquidEmit(ILContext il) + { + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchRet())) + { + LogFailure("Liquid Light Emit", "ret instruction is missing????? how is this even possible?????"); + return; } - if (tile.TileType != (ushort)ModContent.TileType()) + cursor.EmitLdloc0(); // This should be tile + cursor.EmitLdarg1(); // x + cursor.EmitLdarg2(); // y + cursor.EmitLdarg3(); // ref OutputColor + cursor.EmitDelegate((Tile tile, int x, int y, ref Vector3 lightColor) => { - if (Main.waterStyle == SulphuricWater.Type && Main.dayTime && !Main.raining) + if (tile.HasTile || tile.LiquidAmount <= 0) + return; + + if (tile.LiquidType == LiquidID.Water) { - float brightness = MathHelper.Clamp(0.2f - (y / 680), 0f, 0.2f); - if (y > 580) - brightness *= 1f - (y - 580) / 100f; + float R = 0f; + float G = 0f; + float B = 0f; + CalamityWaterLoader.ModifyLightSetup(in tile, x, y, Main.waterStyle, ref R, ref G, ref B); - float waveScale1 = Main.GameUpdateCount * 0.014f; - float waveScale2 = Main.GameUpdateCount * 0.1f; - int scalar = x + (-y / 2); - float wave1 = waveScale1 * -50 + scalar * 15; - float wave2 = waveScale2 * -10 + scalar * 14; - float wave3 = waveScale1 * -100 + scalar * 13; - float wave4 = waveScale2 * 10 + scalar * 25; - float wave5 = waveScale1 * -70 + scalar * 5; - float wave1angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave1)); - float wave2angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave2)); - float wave3angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave3)); - float wave4angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave4)); - float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); - outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle); - outputColor *= brightness; + lightColor.X = Math.Max(lightColor.X, R); + lightColor.Y = Math.Max(lightColor.Y, G); + lightColor.Z = Math.Max(lightColor.Z, B); } - - if (Main.waterStyle == SulphuricWater.Type && !Main.dayTime && !Main.raining) + else if (tile.LiquidType == LiquidID.Lava && ExternalMods.biomeLava == null) { - float brightness = MathHelper.Clamp(0.17f - (y / 680), 0f, 0.17f); - if (y > 580) - brightness *= 1f - (y - 580) / 100f; + Vector3 lavaLight = new Vector3(0.55f, 0.33f, 0.11f); - float waveScale1 = Main.GameUpdateCount * 0.014f; - float waveScale2 = Main.GameUpdateCount * 0.1f; - int scalar = x + (-y / 2); - float wave1 = waveScale1 * -50 + scalar * 15; - float wave2 = waveScale2 * -10 + scalar * 14; - float wave3 = waveScale1 * -100 + scalar * 13; - float wave4 = waveScale2 * 10 + scalar * 25; - float wave5 = waveScale1 * -70 + scalar * 5; - float wave1angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave1)); - float wave2angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave2)); - float wave3angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave3)); - float wave4angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave4)); - float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); - outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle); - outputColor *= brightness; + float R = LavaRenderingSystem.LavaStyle == 0 ? lavaLight.X : 0f; + float G = LavaRenderingSystem.LavaStyle == 0 ? lavaLight.Y : 0f; + float B = LavaRenderingSystem.LavaStyle == 0 ? lavaLight.Z : 0f; + LavaStylesLoader.ModifyLightSetup(x, y, LavaRenderingSystem.LavaStyle, ref R, ref G, ref B); + + for (int styleIndex = 0; styleIndex < LavaStylesLoader.TotalCount; styleIndex++) + { + if (LavaRenderingSystem.LavaAlpha[styleIndex] > 0f && styleIndex != LavaRenderingSystem.LavaStyle) + { + float r = styleIndex == 0 ? lavaLight.X : 0f; + float g = styleIndex == 0 ? lavaLight.Y : 0f; + float b = styleIndex == 0 ? lavaLight.Z : 0f; + LavaStylesLoader.ModifyLightSetup(x, y, styleIndex, ref r, ref g, ref b); + + float r2 = LavaRenderingSystem.LavaStyle == 0 ? lavaLight.X : 0f; + float g2 = LavaRenderingSystem.LavaStyle == 0 ? lavaLight.Y : 0f; + float b2 = LavaRenderingSystem.LavaStyle == 0 ? lavaLight.Z : 0f; + LavaStylesLoader.ModifyLightSetup(x, y, LavaRenderingSystem.LavaStyle, ref r2, ref g2, ref b2); + + R = float.Lerp(r, r2, LavaRenderingSystem.LavaAlpha[LavaRenderingSystem.LavaStyle]); + G = float.Lerp(g, g2, LavaRenderingSystem.LavaAlpha[LavaRenderingSystem.LavaStyle]); + B = float.Lerp(b, b2, LavaRenderingSystem.LavaAlpha[LavaRenderingSystem.LavaStyle]); + } + } + + if (R != 0.0f || G != 0.0f || B != 0.0f) + { + float colorManipulator = (float)(270 - Main.mouseTextColor) / 900f; + R += colorManipulator; + G += colorManipulator; + B += colorManipulator; + } + + lightColor.X = Math.Max(lightColor.X, R); + lightColor.Y = Math.Max(lightColor.Y, G); + lightColor.Z = Math.Max(lightColor.Z, B); } + }); + } - if (Main.waterStyle == SulphuricWater.Type && Main.raining) + private static void LavafallLightEditor(On_WaterfallManager.orig_AddLight orig, int waterfallType, int x, int y) + { + if (waterfallType == 1) + { + float r = 0.55f; + float g = 0.33f; + float b = 0.11f; + LavaStylesLoader.ModifyLightSetup(x, y, LavaRenderingSystem.LavaStyle, ref r, ref g, ref b); + if (!(r == 0 && g == 0 && b == 0)) { - float brightness = MathHelper.Clamp(1f - (y / 680), 0f, 1f); - if (y > 580) - brightness *= 1f - (y - 580) / 100f; - - outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f); - outputColor *= brightness; - } - - if (Main.waterStyle == SulphuricDepthsWater.Type) - outputColor = Vector3.Lerp(outputColor, Color.MediumSeaGreen.ToVector3(), 0.18f); - - if (Main.waterStyle == SunkenSeaBurrowsWater.Type || Main.waterStyle == SunkenSeaPolypWater.Type || Main.waterStyle == SunkenSeaReefsWater.Type || - Main.waterStyle == SunkenSeaShoresWater.Type || Main.waterStyle == BasaltGullyWater.Type) - { - //default to white - Color waterGlowColor = Color.White; - - //set the glow colors for each sunken sea biome water style - if (Main.waterStyle == SunkenSeaShoresWater.Type) - { - waterGlowColor = new Color(233, 170, 184); - } - if (Main.waterStyle == SunkenSeaPolypWater.Type) - { - waterGlowColor = new Color(213, 185, 178); - } - if (Main.waterStyle == SunkenSeaReefsWater.Type) - { - waterGlowColor = new Color(140, 222, 239); - } - if (Main.waterStyle == SunkenSeaBurrowsWater.Type) - { - waterGlowColor = new Color(76, 211, 231); - } - if (Main.waterStyle == BasaltGullyWater.Type) - { - waterGlowColor = new Color(144, 174, 200); - } - - float brightness = MathHelper.Clamp(0.07f, 0f, 0.07f); - float waveScale1 = Main.GameUpdateCount * 0.028f; - float waveScale2 = Main.GameUpdateCount * 0.1f; - int yScale = -y / 2; - int xScale = x / 15; - float wave1 = Main.GameUpdateCount * 0.024f * -50 + ((-x / 30) + (y / 30)) * 25; - float wave2 = waveScale2 * -10 + ((-xScale) + yScale) * 45; - float wave3 = waveScale1 * -100 + ((x / 7) + (y / 50)) * 25; - float wave4 = Main.GameUpdateCount * 0.15f * 10 + ((x / 3) + yScale) * 45; - float wave5 = waveScale1 * -70 + ((-x / 25) + (-y / 25)) * 20; - float wave6 = waveScale2 * -10 + (xScale + yScale) * 45; - float bigwave = Main.GameUpdateCount * 0.01f * -70 + ((-x / 2) + (-y / 40)) * 5; - float wave1angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave1)); - float wave2angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave2)); - float wave3angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave3)); - float wave4angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave4)); - float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); - float wave6angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave6)); - float bigwaveangle = 0.55f + 0.80f * (float)Math.Sin(MathHelper.ToRadians(bigwave)); - outputColor = Vector3.Lerp(outputColor, Color.DarkSlateGray.ToVector3(), 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle); - outputColor *= brightness; + float r8; + float num3 = (r8 = (r + (float)(270 - Main.mouseTextColor) / 900f) * 0.4f); + float g8 = num3 * g; + float b8 = num3 * b; + Lighting.AddLight(x, y, r8, g8, b8); } + return; } + orig.Invoke(waterfallType, x, y); + } + + private static void LiquidDrawColors(ILContext il) + { + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchLdarg2(), c => c.MatchLdloc3(), c => c.MatchLdloc(4), c => c.MatchCall
("DrawTileInWater"))) + { + LogFailure("Liquid Draw Colors", "Could not locate the liquid vertex colors for drawing"); + return; + } + + cursor.Emit(OpCodes.Ldloc_3); + cursor.Emit(OpCodes.Ldloc, 4); + cursor.Emit(OpCodes.Ldloc_2); + cursor.Emit(OpCodes.Ldfld, typeof(LiquidRenderer).GetNestedType("LiquidDrawCache", BindingFlags.NonPublic).GetRuntimeField("Type")); + cursor.Emit(OpCodes.Ldloca, 9); + + cursor.EmitDelegate((int x, int y, int liquidType, ref VertexColors initialColor) => + { + if (liquidType == LiquidID.Water) + { + CalamityWaterLoader.DrawColorSetup(x, y, Main.waterStyle, ref initialColor); + } + else if (liquidType == LiquidID.Lava && ExternalMods.biomeLava == null) + { + LavaStylesLoader.DrawColorSetup(x, y, LavaRenderingSystem.LavaStyle, ref initialColor); + } + }); + } + + private static void LiquidSlopeDrawColors(ILContext il) + { + ILCursor cursor = new ILCursor(il); + + var loaderGetMethod = typeof(LoaderManager) + .GetMethod(nameof(LoaderManager.Get)) + .MakeGenericMethod([typeof(WaterStylesLoader)]); + if (loaderGetMethod is null) + { + LogFailure("Liquid Slope Draw Colors", "Cannot find \"LoaderManager.Get\" Method"); + return; + } + + var getTotalCountGetter = typeof(Loader) + .GetProperty("TotalCount", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) + .GetMethod; + if (getTotalCountGetter is null) + { + LogFailure("Liquid Slope Draw Colors", "Cannot find \"Loader.TotalCount (internal)\" Method"); + return; + } + + if (!cursor.TryGotoNext(MoveType.After, + c => c.MatchCall(loaderGetMethod), + c => c.MatchCallOrCallvirt(getTotalCountGetter))) + { + LogFailure("Liquid Slope Draw Colors", "Could not locate the liquid slope vertex colors for drawing"); + return; + } + + // callvirt Loader.TotalCount + // [We are here] + // stloc.s totalCount + + // Starts from callvirt (ret: int) + // Stack now have TotalCount and about to pop by local variable, so: + cursor.EmitLdarg(8); // Push tileCache + cursor.EmitLdarg(6); // Push tileX + cursor.EmitLdarg(7); // Push tileY + cursor.EmitLdloca(14); // Push Color* + cursor.EmitDelegate((Tile tileCache, int x, int y, ref VertexColors initialColor) => + { + // TODO: Properly handle Transition between styles + // That will require extra il injection to achieve + if (tileCache.LiquidType == LiquidID.Water) + CalamityWaterLoader.DrawColorSetup(x, y, Main.waterStyle, ref initialColor, true); + + // Known Issue: Sloped Lava Rendering actually does not work on here! (It's been a case even before edited in 2024/08/30) + // Reason: Flag6 is "IsWater" flag, and since we don't modified that behaviour "yet" it will never be triggered here + // Fix this when there will be new lava style with dynamic color changes + else if (tileCache.LiquidType == LiquidID.Lava) + LavaStylesLoader.DrawColorSetup(x, y, LavaRenderingSystem.LavaStyle, ref initialColor); + }); + + // And now remaining TotalCount is now could pass to local variable + + #region Intended Result for Reference + // callvirt Loader.TotalCount push 1 + // + // ldarg 8 (tileCache) push 1 + // ldarg 6 (tileX) push 1 + // ldarg 7 (tileY) push 1 + // ldloca 14 (vertices) push 1 + // call ModdedDelegate pop 4 + // + // stloc.s totalCount pop 1 + #endregion } #endregion @@ -1296,25 +1587,8 @@ namespace CalamityMod.ILEditing } #endregion - #region Foreground tiles drawing - private static void DrawForegroundStuff(Terraria.On_Main.orig_DrawGore orig, Main self) - { - orig(self); - if (Main.PlayerLoaded && !Main.gameMenu) - ForegroundManager.DrawTiles(); - } - - private static void ClearForegroundStuff(Terraria.GameContent.Drawing.On_TileDrawing.orig_PreDrawTiles orig, Terraria.GameContent.Drawing.TileDrawing self, bool solidLayer, bool forRenderTargets, bool intoRenderTargets) - { - orig(self, solidLayer, forRenderTargets, intoRenderTargets); - - if (!solidLayer && (intoRenderTargets || Lighting.UpdateEveryFrame)) - ForegroundManager.ClearTiles(); - } - #endregion - #region Tile ping overlay - private static void ClearTilePings(Terraria.GameContent.Drawing.On_TileDrawing.orig_Draw orig, Terraria.GameContent.Drawing.TileDrawing self, bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride) + private static void ClearTilePings(On_TileDrawing.orig_Draw orig, TileDrawing self, bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride) { //Retro & Trippy light modes are fine. Just reset the cache before every time stuff gets drawn. if (Lighting.UpdateEveryFrame) @@ -1463,7 +1737,7 @@ namespace CalamityMod.ILEditing { 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--) { @@ -1487,8 +1761,8 @@ namespace CalamityMod.ILEditing #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()) + // Don't keep the original stack amount when shimmering Cirrus' Vodka into Crystal Heart Vodka + if (self.type == ModContent.ItemType()) { self.SetDefaults(ModContent.ItemType()); self.shimmered = true; @@ -1506,6 +1780,38 @@ namespace CalamityMod.ILEditing } AchievementsHelper.NotifyProgressionEvent(27); } + // Make Plagued Containment Bricks turn into Plagued Nanodroids if shimmered before defeating Golem + else if (self.type == ModContent.ItemType()) + { + if (NPC.downedGolemBoss) + orig(self); + else + { + for (int i = 0; i < 3; i++) + { + int nanodroidType = Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(); + NPC droids = NPC.NewNPCDirect(self.GetSource_FromThis(), (int)self.Center.X, (int)self.Center.Y, nanodroidType); + droids.velocity = -self.velocity.RotatedByRandom(MathHelper.Pi / 20f) * 2f; + droids.netUpdate = true; + droids.shimmerTransparency = 1f; + NetMessage.SendData(146, -1, -1, null, 2, droids.whoAmI); + } + + self.TurnToAir(); + self.shimmerWet = true; + self.wet = true; + self.velocity *= 0.1f; + if (Main.netMode == NetmodeID.SinglePlayer) + { + 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); + } + } + } else { orig(self); @@ -1549,14 +1855,20 @@ namespace CalamityMod.ILEditing else { orig(self, newPos, Style, extraInfo); + // Potion of Return triggers Jared if used in the Abyss + if (Style == 8) + { + if (t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType()) + self.AddBuff(BuffID.ChaosState, 2); + } } } #endregion - #region Change the Twins' announcement name in Revengeance Master Mode + #region Revengeance Master Mode Twins Shenanigans public static void TripletsSpawnTextOverride(Terraria.On_NPC.orig_SpawnBoss orig, int x, int y, int type, int targetPlayerIndex) { - if (Main.masterMode && CalamityWorld.revenge && type == NPCID.Retinazer) + if (CalamityWorld.death && type == NPCID.Retinazer) { int retinazerIndex = NPC.NewNPC(NPC.GetBossSpawnSource(targetPlayerIndex), x, y, type, 1); if (retinazerIndex == 200) @@ -1566,7 +1878,7 @@ namespace CalamityMod.ILEditing Main.npc[retinazerIndex].target = targetPlayerIndex; Main.npc[retinazerIndex].timeLeft *= 20; - if (Main.netMode == NetmodeID.Server && retinazerIndex < 200) + if (Main.dedServ && retinazerIndex < 200) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazerIndex); } @@ -1581,6 +1893,597 @@ namespace CalamityMod.ILEditing orig(x, y, type, targetPlayerIndex); } } + + public static void PreventFoveanatorDefeatMessageIfNotKilledLast(On_NPC.orig_DoDeathEvents_BeforeLoot orig, NPC self, Player closestPlayer) + { + if (CalamityWorld.death && self.type == ModContent.NPCType() && (NPC.AnyNPCs(NPCID.Spazmatism) || NPC.AnyNPCs(NPCID.Retinazer))) + { + self.value = 0f; + self.boss = false; + return; + } + else + { + orig(self, closestPlayer); + } + } + + public static void TripletsDefeatTextOverride(On_NPC.orig_DoDeathEvents_CelebrateBossDeath orig, NPC self, string typeName) + { + bool correctNPCType = self.type == NPCID.Retinazer || self.type == NPCID.Spazmatism || self.type == ModContent.NPCType(); + if (CalamityWorld.death && correctNPCType) + { + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Plural", CalamityUtils.GetTextValue("Status.Boss.TripletsDefeatName")), 175, 75, 255); + else if (Main.dedServ) + ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Plural", NetworkText.FromKey("Mods.CalamityMod.Status.Boss.TripletsDefeatName")), new Color(175, 75, 255)); + return; + } + else + { + orig(self, typeName); + } + } + #endregion + + #region Optimized GlowMask Rendering on Tile + private static void GlowMaskTileRender(On_TileDrawing.orig_DrawSingleTile orig, TileDrawing self, TileDrawInfo drawData, bool solidLayer, int waterStyleOverride, Vector2 screenPosition, Vector2 screenOffset, int tileX, int tileY) + { + orig(self, drawData, solidLayer, waterStyleOverride, screenPosition, screenOffset, tileX, tileY); + + var type = drawData.typeCache; + if (type < 0 || type >= GlowMaskTile.LookupLength) + return; + + var glowMaskTile = GlowMaskTile.InstanceLookup[type]; + if (glowMaskTile is null || !TileDrawing.IsVisible(drawData.tileCache)) + return; + + var glowMask = glowMaskTile.GlowMask; + var xPos = drawData.tileFrameX + drawData.addFrX; + var yPos = drawData.tileFrameY + drawData.addFrY; + if (glowMask.HasContentInFramePos(xPos, yPos)) + { + ref Tile tileCache = ref drawData.tileCache; + int colType = tileCache.TileColor; + + Color drawColor = glowMaskTile.GetGlowMaskColor(tileX, tileY, drawData); + + if (glowMaskTile.GlowMaskAffectedByLight) + { + Color tileLight = drawData.tileLight; + + if (tileLight.R > drawColor.R) drawColor.R = tileLight.R; + if (tileLight.G > drawColor.G) drawColor.G = tileLight.G; + if (tileLight.B > drawColor.B) drawColor.B = tileLight.B; + } + + drawColor = glowMaskTile.GlowMaskPaintInteraction switch + { + GlowMaskTile.PaintColorTint.OnlyByDeepPaint => CalamityUtils.ApplyPaint(colType, drawColor, deepPaintOnly: true), + GlowMaskTile.PaintColorTint.ByEveryPaint => CalamityUtils.ApplyPaint(colType, drawColor, deepPaintOnly: false), + _ => drawColor + }; + + if (glowMaskTile.GlowMaskCanBeCulled) + { + // Cull no lit and too dark colors + if (drawColor.R <= 1 && drawColor.G <= 1 && drawColor.B <= 1) + return; + } + + drawColor.A = 255; + + if (Main.tileSolid[type]) + { + var drawRect = new Rectangle(xPos, yPos, 16, 16); + TileFramingSystem.SlopedGlowmask(in tileCache, tileX, tileY, glowMask.Texture, drawRect, drawColor, default); + } + else + { + Vector2 drawPos = new Vector2(tileX * 16, tileY * 16) - screenPosition + screenOffset; + Rectangle drawRect = new Rectangle(xPos, yPos, 16, 16); + Main.spriteBatch.Draw(glowMask.Texture, drawPos, drawRect, drawColor, 0.0f, default, 1.0f, drawData.tileSpriteEffect, 0.0f); + } + } + } + #endregion + + #region Allow Cannons to use jellyfish + public static void AllowCannonJellyfishUse(Terraria.On_Player.orig_PlaceThing_CannonBall orig, Player self) + { + // Check if the player is holding a jelly + if (self.HeldItem.type == ModContent.ItemType()) + { + // I have no comments here. + bool veryLongRangeCheck = self.position.X / 16f - (float)Player.tileRangeX - (float)self.HeldItem.tileBoost - (float)self.blockRange <= (float)Player.tileTargetX + && (self.position.X + (float)self.width) / 16f + (float)Player.tileRangeX + (float)self.HeldItem.tileBoost - 1f + (float)self.blockRange >= (float)Player.tileTargetX + && self.position.Y / 16f - (float)Player.tileRangeY - (float)self.HeldItem.tileBoost - (float)self.blockRange <= (float)Player.tileTargetY + && (self.position.Y + (float)self.height) / 16f + (float)Player.tileRangeY + (float)self.HeldItem.tileBoost - 2f + (float)self.blockRange >= (float)Player.tileTargetY; + + int targX = Player.tileTargetX; + int targY = Player.tileTargetY; + + Tile t = CalamityUtils.ParanoidTileRetrieval(targX, targY); + + // All vanilla cannon types (such as the Bunny Cannon) are a single tile ID, this lets us determine that this tile is the normal Cannon + int cannonType = t.TileFrameX / 72; + + // If the player's target tile is within range, is a normal Cannon, they are using an item, and their item time is zero, shoot the baby + if (t.TileType == TileID.Cannon && cannonType == 0 && self.ItemTimeIsZero && self.controlUseItem && veryLongRangeCheck) + { + self.cursorItemIconEnabled = true; + self.cursorItemIconID = ModContent.ItemType(); + self.HeldItem.makeNPC = -1; // Prevent it from spawning critters when used + + // Determines where all the action should happen and what the angle of the cannon is + int tileX = t.TileFrameX / 18; + int angle = 0; + while (tileX >= 4) + { + tileX -= 4; + } + tileX = targX - tileX; + int tileY; + for (tileY = t.TileFrameY / 18; tileY >= 3; tileY -= 3) + { + angle++; + } + tileY = targY - tileY; + + self.ApplyItemTime(self.HeldItem); + + float speedX = 0f; + float speedY = 0f; + + // Vanilla code for determining the velocity of shot cannonballs kept intact for consistency + if (angle == 0) + { + speedX = 10f; + speedY = 0f; + } + if (angle == 1) + { + speedX = 7.5f; + speedY = -2.5f; + } + if (angle == 2) + { + speedX = 5f; + speedY = -5f; + } + if (angle == 3) + { + speedX = 2.75f; + speedY = -6f; + } + if (angle == 4) + { + speedX = 0f; + speedY = -10f; + } + if (angle == 5) + { + speedX = -2.75f; + speedY = -6f; + } + if (angle == 6) + { + speedX = -5f; + speedY = -5f; + } + if (angle == 7) + { + speedX = -7.5f; + speedY = -2.5f; + } + if (angle == 8) + { + speedX = -10f; + speedY = 0f; + } + Vector2 spawnPosition = new Vector2((tileX + 2) * 16, (tileY + 2) * 16); + // Finally shoot the projectile + int jellyfishb = Projectile.NewProjectile(new EntitySource_TileInteraction(self, tileX, tileY), spawnPosition.X, spawnPosition.Y, speedX, speedY, ModContent.ProjectileType(), self.HeldItem.damage, 8f, self.whoAmI); + Main.projectile[jellyfishb].originatedFromActivableTile = true; + // Shlorb + SoundEngine.PlaySound(SoundID.Item95, spawnPosition); + } + else + { + // Reset the item to be able to spawn critters again if any of the conditions aren't met + self.HeldItem.makeNPC = ModContent.NPCType(); + } + } + else + orig(self); + } + #endregion + + #region Add Stohne to the Jungle + public static void AddStohne(Terraria.GameContent.Biomes.On_JunglePass.orig_GenerateFinishingTouches orig, JunglePass self, GenerationProgress progress, int oldX, int oldY) + { + int anchorX = oldX; + int anchorY = oldY; + double worldScale = (double)Main.maxTilesX / 4200.0 * 1.5; + // Generate mud + for (int i = 0; (double)i <= 20.0 * worldScale; i++) + { + progress.Set((60.0 + (double)i / worldScale) * 0.01); + anchorX += WorldGen.genRand.Next((int)(-5.0 * worldScale), (int)(6.0 * worldScale)); + anchorY += WorldGen.genRand.Next((int)(-5.0 * worldScale), (int)(6.0 * worldScale)); + WorldGen.TileRunner(anchorX, anchorY, WorldGen.genRand.Next(40, 100), WorldGen.genRand.Next(300, 500), TileID.Mud); + } + for (int j = 0; (double)j <= 10.0 * worldScale; j++) + { + progress.Set((80.0 + (double)j / worldScale * 2.0) * 0.01); + anchorX = oldX + WorldGen.genRand.Next((int)(-600.0 * worldScale), (int)(600.0 * worldScale)); + anchorY = oldY + WorldGen.genRand.Next((int)(-200.0 * worldScale), (int)(200.0 * worldScale)); + while (anchorX < 1 || anchorX >= Main.maxTilesX - 1 || anchorY < 1 || anchorY >= Main.maxTilesY - 1 || Main.tile[anchorX, anchorY].TileType != TileID.Mud) + { + anchorX = oldX + WorldGen.genRand.Next((int)(-600.0 * worldScale), (int)(600.0 * worldScale)); + anchorY = oldY + WorldGen.genRand.Next((int)(-200.0 * worldScale), (int)(200.0 * worldScale)); + } + for (int k = 0; (double)k < 8.0 * worldScale; k++) + { + anchorX += WorldGen.genRand.Next(-30, 31); + anchorY += WorldGen.genRand.Next(-30, 31); + int type = -1; + if (WorldGen.genRand.NextBool(7)) + { + type = -2; + } + WorldGen.TileRunner(anchorX, anchorY, WorldGen.genRand.Next(10, 20), WorldGen.genRand.Next(30, 70), type); + } + } + int stoneType = ModContent.TileType(); + for (int l = 0; (double)l <= 300.0 * worldScale; l++) + { + anchorX = oldX + WorldGen.genRand.Next((int)(-600.0 * worldScale), (int)(600.0 * worldScale)); + anchorY = oldY + WorldGen.genRand.Next((int)(-200.0 * worldScale), (int)(200.0 * worldScale)); + while (anchorX < 1 || anchorX >= Main.maxTilesX - 1 || anchorY < 1 || anchorY >= Main.maxTilesY - 1 || Main.tile[anchorX, anchorY].TileType != 59) + { + anchorX = oldX + WorldGen.genRand.Next((int)(-600.0 * worldScale), (int)(600.0 * worldScale)); + anchorY = oldY + WorldGen.genRand.Next((int)(-200.0 * worldScale), (int)(200.0 * worldScale)); + } + WorldGen.TileRunner(anchorX, anchorY, WorldGen.genRand.Next(4, 10), WorldGen.genRand.Next(5, 30), stoneType); + // Generate Gems + if (WorldGen.genRand.NextBool(4)) + { + int gem = WorldGen.genRand.Next(63, 69); + WorldGen.TileRunner(anchorX + WorldGen.genRand.Next(-1, 2), anchorY + WorldGen.genRand.Next(-1, 2), WorldGen.genRand.Next(3, 7), WorldGen.genRand.Next(4, 8), gem); + } + } + } + #endregion + + #region Hellscape for GlowMask ModPlants + + #region Tree Trunk / Cactus GlowMask + private static void DrawTreeTrunkAndCactusGlowMask(On_TileDrawing.orig_DrawBasicTile orig, TileDrawing self, Vector2 screenPosition, Vector2 screenOffset, int tileX, int tileY, TileDrawInfo drawData, Rectangle normalTileRect, Vector2 normalTilePosition) + { + orig(self, screenPosition, screenOffset, tileX, tileY, drawData, normalTileRect, normalTilePosition); + + var type = drawData.typeCache; + + #region GlowMask Cactus + if (type == TileID.Cactus) + { + var frameX = drawData.tileFrameX; + var frameY = drawData.tileFrameY; + var xPos = drawData.tileFrameX + drawData.addFrX; + var yPos = drawData.tileFrameY + drawData.addFrY; + + WorldGen.GetCactusType(tileX, tileY, frameX, frameY, out var sandType); + if (PlantLoader.Get(TileID.Cactus, sandType) is GlowMaskCactus glowCacti) + { + Vector2 drawPos = new Vector2(tileX * 16, tileY * 16) - screenPosition + screenOffset; + Rectangle drawRect = new Rectangle(xPos, yPos, 16, 16); + + // Fruit Check + var isFruit = drawData.tileFrameX == 204 || drawData.tileFrameY == 202; + var textureToDraw = isFruit ? glowCacti.GetFruitGlowTexture() : glowCacti.GetGlowTexture(); + var texture = textureToDraw?.Value; + if (texture is not null) + Main.spriteBatch.Draw(texture, drawPos, drawRect, glowCacti.GetGlowColor(tileX, tileY), 0.0f, default, 1.0f, drawData.tileSpriteEffect, 0.0f); + } + return; + } + #endregion + + #region GlowMask Tree Trunk + else if (type == TileID.Trees) + { + var xPos = drawData.tileFrameX + drawData.addFrX; + var yPos = drawData.tileFrameY + drawData.addFrY; + + WorldGen.GetTreeBottom(tileX, tileY, out var groundX, out var groundY); + Tile tile = Main.tile[groundX, groundY]; + if (PlantLoader.Get(TileID.Trees, tile.TileType) is GlowMaskTree glowTree) + { + Vector2 drawPos = new Vector2(tileX * 16, tileY * 16) - screenPosition + screenOffset; + Rectangle drawRect = new Rectangle(xPos, yPos, 16, 16); + + var texture = glowTree.GetGlowTexture()?.Value; + if (texture is not null) + Main.spriteBatch.Draw(texture, drawPos, drawRect, glowTree.GetGlowColor(tileX, tileY), 0.0f, default, 1.0f, drawData.tileSpriteEffect, 0.0f); + } + return; + } + #endregion + + #region GlowMask Palm Tree Trunk + else if (type == TileID.PalmTree) + { + var xPos = drawData.tileFrameX + drawData.addFrX; + var yPos = drawData.tileFrameY + drawData.addFrY; + + WorldGen.GetTreeBottom(tileX, tileY, out var groundX, out var groundY); + Tile tile = Main.tile[groundX, groundY]; + if (PlantLoader.Get(TileID.PalmTree, tile.TileType) is GlowMaskPalmTree glowTree) + { + Rectangle drawRect = new Rectangle(xPos, yPos, 16, 16); + + var texture = glowTree.GetGlowTexture()?.Value; + if (texture is not null) + Main.spriteBatch.Draw(texture, normalTilePosition, drawRect, glowTree.GetGlowColor(tileX, tileY), 0.0f, default, 1.0f, drawData.tileSpriteEffect, 0.0f); + } + return; + } + #endregion + } + #endregion + + #region Disable Tree/Cactus Culling + private static void DisableCullingForTreeAndCactus(ILContext il) + { + // Justification: + // Culling for Tree/Cactus should be disabled to simplify the GlowMask rendering on Plants + // Without this We would need to setup more ilchanges to properly gather draw position + // Furthermore we might need to clone the whole vanilla code for tree rendering + // + // And disable culling for pitch black tree/cactus would not affect the performance that much as it's really niche case + + var cursor = new ILCursor(il); + + int visibleFlagIndex = 0; + if (!cursor.TryGotoNext(MoveType.Before, + [ + x => x.MatchLdloc(out visibleFlagIndex), + x => x.MatchLdarg(out _), + x => x.MatchLdfld(out _), + x => x.MatchCallOrCallvirt("IsVisible") + ])) + { + LogFailure("Disable Tree And Cactus Culling", "Unable to Locate IsVisible Call"); + return; + } + + if (!cursor.TryGotoPrev(MoveType.Before, x => x.MatchBrfalse(out _))) + { + LogFailure("Disable Tree And Cactus Culling", "Unable to Locate Brfalse.s"); + return; + } + + cursor.EmitLdarg1(); // TileDrawInfo drawInfo + cursor.EmitDelegate((TileDrawInfo drawInfo) => + { + var type = drawInfo.typeCache; + return type == TileID.Cactus || type == TileID.Trees || type == TileID.PalmTree; + }); + cursor.EmitLdloc(visibleFlagIndex); + cursor.EmitOr(); // visible || isTree || isCactus || isPalmTree + cursor.EmitStloc(visibleFlagIndex); + } + #endregion + + #region Tree Parts GlowMask + private static void DrawTreeGlowMask(ILContext il) + { + var cursor = new ILCursor(il); + + if (!cursor.TryGotoNext(MoveType.After, x => x.MatchLdfld("X"))) + { + LogFailure("GlowMask Tree Rendering", "Unable to Locate Ldfld for Point::X"); + return; + } + + if (!cursor.Next.MatchStloc(out var xLocaIdx)) + { + LogFailure("GlowMask Tree Rendering", "Unable to Locate Stloc Index for Point::X"); + return; + } + + if (!cursor.TryGotoNext(MoveType.After, x => x.MatchLdfld("Y"))) + { + LogFailure("GlowMask Tree Rendering", "Unable to Locate Ldfld for Point::Y"); + return; + } + + if (!cursor.Next.MatchStloc(out var yLocaIdx)) + { + LogFailure("GlowMask Tree Rendering", "Unable to Locate Stloc Index for Point::Y"); + return; + } + + ApplyTreeGlowMaskSubParts(cursor, "GlowMaskTree-Top", "GetTreeTopTexture", xLocaIdx, yLocaIdx, + (glowMaskTree, tileX, tileY) => + { + return new GlowMaskPlantDrawInfo() + { + Texture = glowMaskTree.GetTopGlowTextures().Value, + Color = glowMaskTree.GetGlowColor(tileX, tileY) + }; + }); + + ApplyTreeGlowMaskSubParts(cursor, "GlowMaskTree-R", "GetTreeBranchTexture", xLocaIdx, yLocaIdx, + (glowMaskTree, tileX, tileY) => + { + return new GlowMaskPlantDrawInfo() + { + Texture = glowMaskTree.GetBranchGlowTextures().Value, + Color = glowMaskTree.GetGlowColor(tileX, tileY) + }; + }); + + ApplyTreeGlowMaskSubParts(cursor, "GlowMaskTree-L", "GetTreeBranchTexture", xLocaIdx, yLocaIdx, + (glowMaskTree, tileX, tileY) => + { + return new GlowMaskPlantDrawInfo() + { + Texture = glowMaskTree.GetBranchGlowTextures().Value, + Color = glowMaskTree.GetGlowColor(tileX, tileY) + }; + }); + + ApplyPalmTreeGlowMaskSubParts(cursor, "GlowMaskPalmTree-Top", "GetTreeTopTexture", xLocaIdx, yLocaIdx, + (glowMaskPalmTree, tileX, tileY) => + { + return new GlowMaskPlantDrawInfo() + { + Texture = WorldGen.IsPalmOasisTree(tileX) ? + glowMaskPalmTree.GetOasisTopGlowTextures().Value : + glowMaskPalmTree.GetTopGlowTextures().Value, + + Color = glowMaskPalmTree.GetGlowColor(tileX, tileY) + }; + }); + } + #endregion + + #region GlowMask Patch Tree Sub Parts + private static void ApplyTreeGlowMaskSubParts( + ILCursor cursor, + string debugSubpartName, + string getTextureMethodName, + int xLocaIdx, + int yLocaIdx, + Func onPlantDrawn) where PlantType : IPlant + { + if (!cursor.TryGotoNext(MoveType.Before, x => x.MatchCallOrCallvirt(getTextureMethodName))) + { + LogFailure("GlowMask Tree Rendering", $"Could not locate First {getTextureMethodName} call ({debugSubpartName})"); + return; + } + + if (!cursor.TryGotoPrev([x => x.MatchLdcI4(out var styleEq) && styleEq == 14, x => x.MatchBneUn(out _)])) + { + LogFailure("GlowMask Tree Rendering", $"Could not locate Bne.Un for TreeStyleIndex ({debugSubpartName})"); + return; + } + + if (!cursor.Prev.MatchLdloc(out var treeStyleLocaIdx)) + { + LogFailure("GlowMask Tree Rendering", $"Prev Instruction is not a LdLoc. Cannot locate TreeStyleIndex ({debugSubpartName})"); + return; + } + + if (!cursor.TryGotoNext(MoveType.Before, x => x.MatchCallOrCallvirt("Draw"))) + { + LogFailure("GlowMask Tree Rendering", $"Could not locate DrawCall ({debugSubpartName})"); + return; + } + + cursor.EmitLdloc(treeStyleLocaIdx); // TreeStyle + cursor.EmitLdloc(xLocaIdx); + cursor.EmitLdloc(yLocaIdx); + cursor.EmitDelegate(( + SpriteBatch spriteBatch, + Texture2D texture, + Vector2 position, + Rectangle? sourceRectangle, + Color color, + float rotation, + Vector2 origin, + float scale, + SpriteEffects effects, + float layerDepth, + + int style, + int tileX, + int tileY) => + { + spriteBatch.Draw(texture, position, sourceRectangle, color, rotation, origin, scale, effects, layerDepth); + + // Spooky Hardcoded Index: style above 100 is modded tile + if (style < 100) + return; + + int lookup = style - 100; + if (PlantLoader.Get(TileID.Trees, lookup) is not PlantType plant) + return; + + GlowMaskPlantDrawInfo? drawInfo = onPlantDrawn?.Invoke(plant, tileX, tileY) ?? default; + if (drawInfo.HasValue) + { + var info = drawInfo.Value; + spriteBatch.Draw(info.Texture, position, sourceRectangle, info.Color, rotation, origin, scale, effects, layerDepth); + } + }); + cursor.Next.OpCode = OpCodes.Nop; // remove next drawcall + } + #endregion + + #region GlowMask Patch Palm Tree Sub Parts + private static void ApplyPalmTreeGlowMaskSubParts( + ILCursor cursor, + string debugSubpartName, + string getTextureMethodName, + int xLocaIdx, + int yLocaIdx, + Func onPlantDrawn) + { + if (!cursor.TryGotoNext(MoveType.Before, x => x.MatchCallOrCallvirt(getTextureMethodName))) + { + LogFailure("GlowMask Tree Rendering", $"Could not locate First {getTextureMethodName} call ({debugSubpartName})"); + return; + } + + if (!cursor.TryGotoNext(MoveType.Before, x => x.MatchCallOrCallvirt("Draw"))) + { + LogFailure("GlowMask Tree Rendering", $"Could not locate DrawCall ({debugSubpartName})"); + return; + } + + cursor.EmitLdloc(xLocaIdx); + cursor.EmitLdloc(yLocaIdx); + cursor.EmitDelegate(( + SpriteBatch spriteBatch, + Texture2D texture, + Vector2 position, + Rectangle? sourceRectangle, + Color color, + float rotation, + Vector2 origin, + float scale, + SpriteEffects effects, + float layerDepth, + + int tileX, + int tileY) => + { + spriteBatch.Draw(texture, position, sourceRectangle, color, rotation, origin, scale, effects, layerDepth); + + // TODO: This can be replace to read style and biome index from ilcode + // ... When we can figure out how to extract info from them + // Check TileDrawing.DrawTrees for context + WorldGen.GetTreeBottom(tileX, tileY, out var sandX, out var sandY); + var sandType = Main.tile[sandX, sandY].TileType; + + if (PlantLoader.Get(TileID.PalmTree, sandType) is not PlantType plant) + return; + + GlowMaskPlantDrawInfo? drawInfo = onPlantDrawn?.Invoke(plant, tileX, tileY) ?? default; + if (drawInfo.HasValue) + { + var info = drawInfo.Value; + spriteBatch.Draw(info.Texture, position, sourceRectangle, info.Color, rotation, origin, scale, effects, layerDepth); + } + }); + cursor.Next.OpCode = OpCodes.Nop; // remove next drawcall + } + #endregion + #endregion } } diff --git a/ILEditing/NetProtectionILChanges.cs b/ILEditing/NetProtectionILChanges.cs new file mode 100644 index 0000000000..6ba19e43a5 --- /dev/null +++ b/ILEditing/NetProtectionILChanges.cs @@ -0,0 +1,122 @@ +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.ILEditing +{ + // These IL edits are contained in their own ModSystem instead of the main ILChanges system for the following reasons: + // - Easily filter out only the NetProtectionILChanges from the call stack, and not other IL edits + // - No interference with the existing ILChanges system, which contains gameplay changes and is already packed + // + // Original comment by Flowaria: + // + // We want to set this as Separate ILChages type for reasons: + // - To easily filter ILChanges callstack from StackTrace + // - To make no impact on ILChanges type which is already clustered + public sealed class NetProtectionILChanges : ModSystem + { + private static string[] _ModNames; + + public override void OnModLoad() + { + _ModNames = ModLoader.Mods.Select(mod => mod.Name).ToArray(); + + On_NPC.NewNPC += NewNPCRule; + On_NetMessage.SendData += SendDataRule; + } + + public override void OnModUnload() + { + _ModNames = null; + } + + private int NewNPCRule(On_NPC.orig_NewNPC orig, IEntitySource source, int X, int Y, int Type, int Start, float ai0, float ai1, float ai2, float ai3, int Target) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + CalamityMod.Instance.Logger.Error($"NETCODE SAFETY VIOLATION DETECTED: {nameof(NPC.NewNPC)} was called from a Multiplayer Client"); + CalamityMod.Instance.Logger.Error(GetSimplifiedStackTrace()); + return Main.maxNPCs; + } + + return orig(source, X, Y, Type, Start, ai0, ai1, ai2, ai3, Target); + } + + private static void SendDataRule(On_NetMessage.orig_SendData orig, int msgType, int remoteClient, int ignoreClient, NetworkText text, int number, float number2, float number3, float number4, int number5, int number6, int number7) + { + // Sending SyncNPC as Client will cause Server to not read their bytes + // So we simply stop that from happening + if (msgType == MessageID.SyncNPC && Main.netMode == NetmodeID.MultiplayerClient) + { + CalamityMod.Instance.Logger.Error($"NETCODE SAFETY VIOLATION DETECTED: {nameof(NetMessage.SendData)} ({nameof(MessageID.SyncNPC)}) was called from a Multiplayer Client"); + CalamityMod.Instance.Logger.Error(GetSimplifiedStackTrace()); + return; + } + + orig(msgType, remoteClient, ignoreClient, text, number, number2, number3, number4, number5, number6, number7); + } + + #region Simplified StackTrace Util Method + + private static bool ContainsAnyModName(string str) + { + return _ModNames?.Any(str.Contains) ?? false; + } + + [MethodImpl(MethodImplOptions.NoInlining)] // Force No Inlining to easily filter current stack (skipFrames: 1) + private static string GetSimplifiedStackTrace() + { + var stringBuilder = new StringBuilder(); + try + { + stringBuilder.AppendLine("STACKTRACE:"); + + var stacktrace = new StackTrace(skipFrames: 1); + var frames = stacktrace.GetFrames(); + var didPrintSomethingUselessLastTime = false; + var didEverPrintSomethingUseful = false; + foreach (var frame in frames) + { + var method = frame.GetMethod(); + var methodName = method?.ToString() ?? "UNKNOWN_METHOD"; + var typeName = method?.DeclaringType?.FullName ?? "UNKNOWN_TYPE"; + + // Logging Rule: + // - It should contains ANY ModName in their FullName + // - It should NOT contains NetProtectionILChanges in their FullName (Calamity Codebase Exclusive) + if (ContainsAnyModName(typeName) && !typeName.Contains(nameof(NetProtectionILChanges))) + { + didPrintSomethingUselessLastTime = false; + didEverPrintSomethingUseful = true; + stringBuilder.AppendFormat(" at {0}::{1}", typeName, methodName); + stringBuilder.AppendLine(); + } + else if (!didPrintSomethingUselessLastTime && didEverPrintSomethingUseful) + { + stringBuilder.AppendLine(" ..."); + didPrintSomethingUselessLastTime = true; + } + } + + stringBuilder.AppendLine("END OF STACKTRACE"); + return stringBuilder.ToString(); + } + catch + { + return ""; + } + finally + { + stringBuilder?.Clear(); + } + } + + #endregion + } +} diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index 284d9c44f0..d75d3e67bd 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -1,18 +1,23 @@ using System; using System.Collections.Generic; using System.Reflection; +using CalamityMod.Events; using CalamityMod.Items.Fishing; using CalamityMod.Items.Materials; using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.TownNPCs; using CalamityMod.Walls; using Microsoft.Xna.Framework; using Mono.Cecil.Cil; using MonoMod.Cil; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameContent.Drawing; +using Terraria.GameContent.Personalities; using Terraria.ID; using Terraria.ModLoader; @@ -121,26 +126,28 @@ namespace CalamityMod.ILEditing #region Prevention of Slime Rain Spawns When Near Bosses private static void PreventBossSlimeRainSpawns(Terraria.On_NPC.orig_SlimeRainSpawns orig, int plr) { - if (!Main.player[plr].Calamity().isNearbyBoss && CalamityConfig.Instance.BossZen) + if (!Main.player[plr].Calamity().isNearbyBoss && CalamityServerConfig.Instance.BossZen) orig(plr); } #endregion Prevention of Slime Rain Spawns When Near Bosses - #region Remove Feral Bite Random Debuffs - private static void RemoveFeralBiteRandomDebuffs(ILContext il) + #region Remove Expert Brain of Cthulhu Random Debuffs + private static void RemoveExpertBrainRandomDebuffs(ILContext il) { + // Remove Expert+ Brain of Cthulhu and Creeper random debuffs on hit. var cursor = new ILCursor(il); - // Find the random debuff duration multiplier for the debuffs inflicted by Feral Bite. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.01f))) // The 0.01f random debuff duration multiplier. + // Go to the check for Expert Mode. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall
("get_expertMode"))) { - LogFailure("Remove Feral Bite Random Debuffs", "Could not locate the Feral Bite random debuff duration multiplier."); + LogFailure("Remove Expert Brain Random Debuffs", "Could not locate the Expert Mode check."); return; } - // Remove and change to 0f, this makes the random debuffs from Feral Bite have 0 duration. - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 0f); + // Remove the Expert Mode check, and in its place put a check for the Zenith seed (Get fixed boi). + // Note from CIT: I originally removed these entirely; restoring it in GFB was Fabsol's idea. + cursor.Emit(OpCodes.Pop); + cursor.Emit(OpCodes.Ldsfld, typeof(Main).GetField("zenithWorld")); } #endregion @@ -250,10 +257,50 @@ namespace CalamityMod.ILEditing } #endregion + #region Remove Flail Throw Velocity Being Affected By Player Velocity + private static void FlailsNoLongerAffectedByPlayerVelocity(On_Projectile.orig_AI_015_Flails orig, Projectile self) + { + orig(self); + if (self.ai[0] == 1f && self.ai[1] == 0f) + self.velocity -= Main.player[self.owner].velocity; + } + #endregion + #region Fix Chlorophyte Crystal Attacking Where it Shouldn't // TODO -- Finish this #endregion Fix Chlorophyte Crystal Attacking Where it Shouldn't + #region Prevent UFO Mount from Dismounting in Water + private static void PreventUFODismountInWater(ILContext il) + { + // Prevent the Cosmic Car Key's UFO mount from dismounting when the player is in water. + var cursor = new ILCursor(il); + + // Unfortunately, the code responsible for this is 4000 lines into Player.Update, meaning that reaching it is far from simple. + // The following method was the easiest way I could find to reach it: + // Move to the third call of Mount.Dismount. + for (int i = 0; i < 3; i++) + { + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCallvirt("Dismount"))) + { + LogFailure("Prevent UFO Dismounting in Water", "Could not reach the Dismount instruction."); + return; + } + } + // Move the cursor backwards to place it right after the instruction which loads Main.myPlayer onto the stack. + if (!cursor.TryGotoPrev(MoveType.After, i => i.MatchLdsfld
("myPlayer"))) + { + LogFailure("Prevent UFO Dismounting in Water", "Could not locate the myPlayer check."); + return; + } + + // Remove the instruction and replace it with the integer limit. The next instruction checks if this value is equal to Player.whoAmI. + // Player.whoAmI will never be the integer limit, so the check will always fail and the UFO will not dismount. + cursor.EmitPop(); + cursor.Emit(OpCodes.Ldc_I4, int.MaxValue); + } + #endregion Prevent UFO Mount from Dismounting in Water + #region Color Blighted Gel private static void ColorBlightedGel(Terraria.GameContent.ItemDropRules.On_CommonCode.orig_ModifyItemDropFromNPC orig, NPC npc, int itemIndex) { @@ -576,7 +623,7 @@ namespace CalamityMod.ILEditing case 17: item = new Item(); - item.SetDefaults(ItemID.HoneyAbsorbantSponge); + item.SetDefaults(ItemID.LavaFishingHook); rewardItems.Add(item); break; @@ -600,7 +647,7 @@ namespace CalamityMod.ILEditing case 21: item = new Item(); - item.SetDefaults(ItemID.LavaFishingHook); + item.SetDefaults(ItemID.HoneyAbsorbantSponge); rewardItems.Add(item); break; @@ -784,7 +831,7 @@ namespace CalamityMod.ILEditing } // Honey Absorbant Sponge - if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 17) + if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 21) { item = new Item(); item.SetDefaults(ItemID.SuperAbsorbantSponge); @@ -840,7 +887,7 @@ namespace CalamityMod.ILEditing } // Lavaproof Fishing Hook - if (Main.rand.NextBool((int)(80f * rarityReduction)) && questsDone > 21) + if (Main.rand.NextBool((int)(80f * rarityReduction)) && questsDone > 17) { item = new Item(); item.SetDefaults(ItemID.LavaFishingHook); @@ -1002,8 +1049,116 @@ namespace CalamityMod.ILEditing #endregion Make Magma Stone & Fire Gauntlet Dust Toggleable + #region Vanilla Non-Linearity Fixes + private static void RemovePowerCellPlanteraLock(ILContext il) + { + // Remove the check requiring Plantera to be defeated to use Lihzahrd Power Cells at the Altar. + var cursor = new ILCursor(il); + + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdsfld("downedPlantBoss"))) + { + LogFailure("Remove Power Cell Plantera Lock", "Could not locate the downed Plantera bool."); + return; + } + + // Remove the instruction and replace with 1 (true). This effectively removes the requirement for defeating Plantera. + // The only requirements for summoning Golems with Power Cells are now: 1) Golem is not alive, and 2) The world is in Hardmode. + cursor.EmitPop(); + cursor.Emit(OpCodes.Ldc_I4_1); + } + + private static bool RemoveUseLocks(On_Player.orig_ItemCheck_CheckCanUse orig, Player self, Item sItem) + { + if (sItem.type == ItemID.CelestialSigil) + return !NPC.AnyNPCs(NPCID.MoonLordCore) && !BossRushEvent.BossRushActive; + if (sItem.type == ItemID.SolarTablet) + return Main.dayTime && !Main.eclipse && (Main.hardMode || NPC.downedMechBossAny || NPC.downedPlantBoss); + + return orig(self, sItem); + } + + private static void ApplyCelestialSigilChanges(On_Player.orig_ItemCheck_UseEventItems orig, Player self, Item sItem) + { + if (self.ItemTimeIsZero && self.itemAnimation > 0 && sItem.type == ItemID.CelestialSigil) + { + if (NPC.AnyNPCs(NPCID.MoonLordCore) || BossRushEvent.BossRushActive) + return; + + SoundEngine.PlaySound(SoundID.Roar, self.Center); + self.ApplyItemTime(sItem); + + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(self.whoAmI, NPCID.MoonLordCore); + else + NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, self.whoAmI, NPCID.MoonLordCore); + } + else + orig(self, sItem); + } + #endregion + + #region Remove NPC.damage Condition from Radar + private static void RemoveDamageConditionFromRadar(ILContext il) + { + var cursor = new ILCursor(il); + + Func[] searchFor = + [ + (x => x.MatchLdfld(nameof(NPC.damage))), + (x => x.MatchLdcI4(out var comp) && comp == 0), + (x => x.MatchBle(out _)) //ble.s + ]; + + if (!cursor.TryGotoNext(MoveType.After, searchFor)) + { + LogFailure("Radar Condition", "Unable to locate condition for NPC.damage > 0"); + return; + } + + // branch is used for exit condition. So setting ble.s opcode to nop will remove the condition + cursor.Prev.OpCode = OpCodes.Nop; + + // After that we pop NPC.damage and 0 from stack + cursor.EmitPop(); + cursor.EmitPop(); + } + #endregion + + #region Multiple NPC Happiness support for Cirrus + private static void AllowMultipleLikedNPCs(On_ShopHelper.orig_ApplyNpcRelationshipEffect orig, ShopHelper self, int npcType, AffectionLevel affectionLevel) + { + FieldInfo npcTalkField = typeof(ShopHelper).GetField("_currentNPCBeingTalkedTo", BindingFlags.Instance | BindingFlags.NonPublic); + NPC talkedNPC = (NPC)npcTalkField.GetValue(self); + + // Allow Cirrus to have things to say about multiple NPCs with the same happiness level + if (talkedNPC.type == ModContent.NPCType()) + { + MethodInfo addReportField = typeof(ShopHelper).GetMethod("AddHappinessReportText", BindingFlags.Instance | BindingFlags.NonPublic); + + FieldInfo happinessField = typeof(ShopHelper).GetField("_currentPriceAdjustment", BindingFlags.Instance | BindingFlags.NonPublic); + float currentPriceAdjustment = (float)happinessField.GetValue(self); + + if (affectionLevel != 0 && Enum.IsDefined(affectionLevel)) + { + // Add a suffix to the localization key which specifies the NPC's name + addReportField.Invoke(self, [ $"{affectionLevel}NPC_" + NPCID.Search.GetName(npcType), new + { + NPCName = NPC.GetFullnameByID(npcType) + }, 0]); + currentPriceAdjustment *= NPCHappiness.AffectionLevelToPriceMultiplier[affectionLevel]; + happinessField.SetValue(self, currentPriceAdjustment); + } + } + else + { + orig(self, npcType, affectionLevel); + } + } + #endregion + // 02JUN2024: Ozzatron: The below code is being kept in its initial state for historic value. #region Store The Stupid Fucking Private Wind Map In Public Property + [/*TotallyNot*/Obsolete("This function serves no purpose and is included in the Calamity source code for historic value.", error: true)] private static void StoreWindGrid(On_TileDrawing.orig_Update orig, TileDrawing self) { orig(self); diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index 345bb65fac..b6ca1da325 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -68,7 +68,7 @@ namespace CalamityMod.ILEditing #region Removal of Hardmode Ore Generation from Evil Altars private static void PreventSmashAltarCode(Terraria.On_WorldGen.orig_SmashAltar orig, int i, int j) { - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) return; orig(i, j); @@ -161,7 +161,7 @@ namespace CalamityMod.ILEditing } #endregion - #region Change Small World Description + #region Change World Generation Descriptions /// /// Changes the description of Small worlds to serve as a warning. /// @@ -181,6 +181,28 @@ namespace CalamityMod.ILEditing // Emit our new string "Mods.CalamityMod.UI.SmallWorldWarning". c.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.SmallWorldWarning"); + + + } + + /// + /// Changes the description of Master Mode to mention boss changes. + /// + private static void SwapMasterModeDescriptionKey(ILContext il) + { + // Swap vanilla's Master Mode description string (UI.WorldDescriptionMaster) with Calamity's edited version (Mods.CalamityMod.UI.WorldMaster). + var cursor = new ILCursor(il); + + // Move to after the string. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdstr("UI.WorldDescriptionMaster"))) + { + LogFailure("Change Master Mode Description", "Could not match string \"UI.WorldDescriptionMaster\"."); + return; + } + + // Pop this value off, then replace it with Calamity's new string. + cursor.EmitPop(); + cursor.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.WorldMaster"); } #endregion diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index 6c0fe97557..a0d0fe0025 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Items.Accessories public class Abaddon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int AbaddonExploDamage = 90; public override void SetDefaults() { Item.width = 26; diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index 440cfaa92c..b2129bd402 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index fd672d8313..51803181a3 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -10,10 +10,14 @@ namespace CalamityMod.Items.Accessories public class AbyssalDivingSuit : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static double PlatesAllDamageReduction = 0.15D; + public static double PlatesHitDecay = 0.03D; + public override void Load() { // All code below runs only if we're not loading on a server - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Add equip textures EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Head}", EquipType.Head, this); @@ -30,7 +34,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index 273064f9ef..40e9b7a0eb 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Accessories public class AbyssalMirror : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; + public bool HasFlavorTooltip => true; public override void SetDefaults() { Item.width = 30; diff --git a/Items/Accessories/AlluringBait.cs b/Items/Accessories/AlluringBait.cs index 1a5383e4b1..786435906e 100644 --- a/Items/Accessories/AlluringBait.cs +++ b/Items/Accessories/AlluringBait.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().alluringBait = true; - player.fishingSkill += 30; + player.fishingSkill += 10; } } } diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index e1c1a5f31e..a823f93126 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -8,7 +8,6 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - // TODO -- this item includes a dodge accessory, Brain of Cthulhu public class AmalgamatedBrain : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; @@ -24,29 +23,10 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.aBrain = true; player.brainOfConfusionItem = Item; - if (player.immune) - { - var source = player.GetSource_Accessory(Item); - if (player.miscCounter % 6 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int damage = (int)player.GetBestClassDamage().ApplyTo(60); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - - Projectile rain = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 2f, player.whoAmI); - if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) - { - rain.DamageType = DamageClass.Generic; - rain.tileCollide = false; - rain.penetrate = 1; - } - } - } - } - player.GetDamage() += 0.1f; + player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Items/Accessories/AmalgamatedBrain.png b/Items/Accessories/AmalgamatedBrain.png index 0c6b178810..3eda4512cc 100644 Binary files a/Items/Accessories/AmalgamatedBrain.png and b/Items/Accessories/AmalgamatedBrain.png differ diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 6d42653934..90779b1ac3 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(3). + AddIngredient(ItemID.FragmentSolar, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/AmidiasPendant.cs b/Items/Accessories/AmidiasPendant.cs deleted file mode 100644 index 12e0ce87ad..0000000000 --- a/Items/Accessories/AmidiasPendant.cs +++ /dev/null @@ -1,82 +0,0 @@ -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories -{ - public class AmidiasPendant : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public const int ShardProjectiles = 2; - public const float ShardAngleSpread = 120; - public int ShardCountdown = 0; - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 46; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (ShardCountdown <= 0) - { - ShardCountdown = 140; - } - if (ShardCountdown > 0) - { - ShardCountdown -= Main.rand.Next(1, 4); - if (ShardCountdown <= 0) - { - if (player.whoAmI == Main.myPlayer) - { - var source = player.GetSource_Accessory(Item); - int speed2 = 25; - float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed2; - int spawnOffset = ShardProjectiles * 15; - float spread = -ShardAngleSpread / 2f; - for (int i = 0; i < ShardProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - spawnOffset; - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(spread + (ShardAngleSpread * i / (float)ShardProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int type = 0; - int damage = 0; - switch (Main.rand.Next(3)) - { - case 0: - type = ModContent.ProjectileType(); - damage = 15; - break; - case 1: - type = ModContent.ProjectileType(); - damage = 15; - break; - case 2: - type = ModContent.ProjectileType(); - damage = 30; - break; - } - - int finalDamage = (int)player.GetBestClassDamage().ApplyTo(damage); - finalDamage = player.ApplyArmorAccDamageBonusesTo(finalDamage); - Projectile.NewProjectile(source, spawn.X, spawn.Y, velocity.X / 3, velocity.Y / 2, type, finalDamage, 5f, Main.myPlayer); - } - } - } - } - } - } -} diff --git a/Items/Accessories/AmidiasPendant.png b/Items/Accessories/AmidiasPendant.png deleted file mode 100644 index ff71e1fc5f..0000000000 Binary files a/Items/Accessories/AmidiasPendant.png and /dev/null differ diff --git a/Items/Accessories/AquaticHeart.cs b/Items/Accessories/AquaticHeart.cs index c4bc403163..5c5f1de826 100644 --- a/Items/Accessories/AquaticHeart.cs +++ b/Items/Accessories/AquaticHeart.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +11,14 @@ namespace CalamityMod.Items.Accessories public class AquaticHeart : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float WaterSpeedBoost = 0.15f; + public static double IceShieldAllDamageReduction = 0.2D; + public override void Load() { // All code below runs only if we're not loading on a server - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Add equip textures EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/AquaticTrans_Head", EquipType.Head, this); @@ -23,7 +29,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -57,5 +63,11 @@ namespace CalamityMod.Items.Accessories player.Calamity().aquaticHeartHide = false; player.Calamity().aquaticHeartForce = true; } + + public override void ModifyTooltips(List tooltips) + { + string statusTooltip = this.GetLocalizedValue(NPC.downedBoss3 ? "FullTooltip" : "LockedTooltip"); + tooltips.FindAndReplace("[STATUS]", statusTooltip); + } } } diff --git a/Items/Accessories/ArcFlashRing.cs b/Items/Accessories/ArcFlashRing.cs new file mode 100644 index 0000000000..ab5618118d --- /dev/null +++ b/Items/Accessories/ArcFlashRing.cs @@ -0,0 +1,49 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class ArcFlashRing : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 56; + Item.height = 64; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.arcFlashRing = true; + if (!hideVisual) + modPlayer.arcFlashRingVisual = true; + else + modPlayer.arcFlashRingVisual = false; + } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.7f, + drawOffset: new(1f, 0f) + ); + return false; + } + } +} diff --git a/Items/Accessories/ArcFlashRing.png b/Items/Accessories/ArcFlashRing.png new file mode 100644 index 0000000000..19487413b3 Binary files /dev/null and b/Items/Accessories/ArcFlashRing.png differ diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index e75019f9d7..05610d1dc1 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Crags; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,8 +32,8 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(3). + AddIngredient(15). AddIngredient(ItemID.Bone, 15). AddTile(TileID.Anvils). Register(); diff --git a/Items/Accessories/AscendantInsignia.cs b/Items/Accessories/AscendantInsignia.cs index 11023258b1..307cc2620b 100644 --- a/Items/Accessories/AscendantInsignia.cs +++ b/Items/Accessories/AscendantInsignia.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.ascendantInsignia = true; player.empressBrooch = true; + player.moveSpeed += 0.05f; + player.jumpSpeedBoost += 0.25f; } public override void AddRecipes() @@ -37,8 +39,8 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.EmpressFlightBooster). AddIngredient(5). + AddIngredient(5). AddIngredient(ItemID.SoulofFlight, 10). - AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index bc60e6071f..064400cf16 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public Color? TooltipExtensionColor => new(195, 223, 255); - public const int ShieldSlamDamage = 1000; + public const int ShieldSlamDamage = 900; public const float ShieldSlamKnockback = 15f; public const int ShieldSlamIFrames = 12; - public const int RamExplosionDamage = 1000; + public const int RamExplosionDamage = 450; public const float RamExplosionKnockback = 20f; public override void SetDefaults() @@ -63,6 +63,8 @@ namespace CalamityMod.Items.Accessories player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Broken Armor player.buffImmune[ModContent.BuffType()] = true; // Counterpart to Burning Blood player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Bleeding + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[BuffID.Venom] = true; // "Stronger" Poisoned player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Poisoned player.buffImmune[BuffID.Webbed] = true; // "Stronger" Slow @@ -80,9 +82,10 @@ namespace CalamityMod.Items.Accessories // Additional debuff immunities (Everything from Elysian Aegis + thematic counterparts) player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.ShadowFlame] = true; - player.buffImmune[BuffID.Daybreak] = true; + player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; // Immune to God Slayer Inferno itself player.buffImmune[ModContent.BuffType()] = true; diff --git a/Items/Accessories/AsgardsValor_Shield.png b/Items/Accessories/AsgardsValor_Shield.png index 4815ca1dcf..ea83064192 100644 Binary files a/Items/Accessories/AsgardsValor_Shield.png and b/Items/Accessories/AsgardsValor_Shield.png differ diff --git a/Items/Accessories/AuricSoulArtifact.cs b/Items/Accessories/AuricSoulArtifact.cs index 2a2702982b..f20364b034 100644 --- a/Items/Accessories/AuricSoulArtifact.cs +++ b/Items/Accessories/AuricSoulArtifact.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(25). - AddIngredient(25). AddIngredient(5). + AddIngredient(25). + AddIngredient(25). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Accessories/BlackGlassBand.cs b/Items/Accessories/BlackGlassBand.cs new file mode 100644 index 0000000000..e5bd9dc238 --- /dev/null +++ b/Items/Accessories/BlackGlassBand.cs @@ -0,0 +1,37 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class BlackGlassBand : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public static int cooldown = 420; + public static int damage = 40; + public override void SetDefaults() + { + Item.width = 30; + Item.height = 23; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; + } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.bGlassBand = true; + modPlayer.bGlassBandVisual = !hideVisual; + } + public override void AddRecipes() + { + CreateRecipe(). + AddRecipeGroup("AnyGoldBar", 5). + AddIngredient(ItemID.Diamond, 2). + AddIngredient(ItemID.Obsidian, 25). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Accessories/BlackGlassBand.png b/Items/Accessories/BlackGlassBand.png new file mode 100644 index 0000000000..cb4057374e Binary files /dev/null and b/Items/Accessories/BlackGlassBand.png differ diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index 95911b09b7..c7e084615f 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -79,7 +79,6 @@ namespace CalamityMod.Items.Accessories { spinningPoint *= 1.5f; dmgAmt = (int)player.GetBestClassDamage().ApplyTo(dmgAmt); - dmgAmt = player.ApplyArmorAccDamageBonusesTo(dmgAmt); Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); } } diff --git a/Items/Accessories/BloodPact.cs b/Items/Accessories/BloodPact.cs index 7c5896228e..deb11f3734 100644 --- a/Items/Accessories/BloodPact.cs +++ b/Items/Accessories/BloodPact.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,6 +23,10 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodPact = true; // This applies the +25% health boost. modPlayer.healingPotionMultiplier += 0.25f; + //Grants immunity to most Bleeding debuffs + player.buffImmune[BuffID.Bleeding] = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; } } } diff --git a/Items/Accessories/BloodyWormScarf.png b/Items/Accessories/BloodyWormScarf.png index 1821a0087c..8d15037447 100644 Binary files a/Items/Accessories/BloodyWormScarf.png and b/Items/Accessories/BloodyWormScarf.png differ diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index e8e0be61e7..3499c1c552 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories // This is ONLY the direct DPS of having the cursor over the enemy, not the damage from the flames debuff. // The debuff is VulnerabilityHex, check that file for its DPS. public const int BaseDamage = 320; - public const int HitsPerSecond = 12; + public const int FramesPerHit = 5; public override void SetStaticDefaults() { @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Accessories if (Main.zenithWorld) { Texture2D texture = ModContent.Request("CalamityMod/Items/Accessories/Calamity_GFB").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, Main.itemAnimations[Item.type].GetFrame(texture), lightColor, 0f, Vector2.Zero, 1f, 0, 0); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Main.itemAnimations[Type].GetFrame(texture), lightColor, 0f, Vector2.Zero, 1f, 0, 0); return false; } else diff --git a/Items/Accessories/ChaliceOfTheBloodGod.cs b/Items/Accessories/ChaliceOfTheBloodGod.cs index edc3fe6b1c..622a89f0a2 100644 --- a/Items/Accessories/ChaliceOfTheBloodGod.cs +++ b/Items/Accessories/ChaliceOfTheBloodGod.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Rarities; @@ -51,6 +52,12 @@ namespace CalamityMod.Items.Accessories player.pStone = true; player.lifeRegen += 4; + //All of Blood Pact's immunities + Laceration + player.buffImmune[BuffID.Bleeding] = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; + // 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. diff --git a/Items/Accessories/CleansingJelly.cs b/Items/Accessories/CleansingJelly.cs index 4e8df9627e..298278de0b 100644 --- a/Items/Accessories/CleansingJelly.cs +++ b/Items/Accessories/CleansingJelly.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Accessories public class CleansingJelly : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int AuraLifetime = 1800; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AuraLifetime.FramesToSeconds()); + public override void SetDefaults() { Item.width = 18; diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs index 6f99322f4d..f9bc1fde4a 100644 --- a/Items/Accessories/CorrosiveSpine.cs +++ b/Items/Accessories/CorrosiveSpine.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -21,29 +22,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.corrosiveSpine = true; player.moveSpeed += 0.05f; - player.Calamity().corrosiveSpine = true; - if (player.immune) - { - if (Main.rand.NextBool(15)) - { - var source = player.GetSource_Accessory(Item); - int cloudCount = Main.rand.Next(2, 5); - for (int i = 0; i < cloudCount; i++) - { - int type = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); - float speed = Main.rand.NextFloat(3f, 11f); - int damage = (int)player.GetTotalDamage().ApplyTo(80); - Projectile.NewProjectile(source, player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, - type, damage, 0f, player.whoAmI); - } - } - } } } } diff --git a/Items/Accessories/CrownJewel.png b/Items/Accessories/CrownJewel.png index 326c657ab4..76ebab0180 100644 Binary files a/Items/Accessories/CrownJewel.png and b/Items/Accessories/CrownJewel.png differ diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index c2fe0da51a..e5a655113b 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -1,5 +1,7 @@ -using CalamityMod.Buffs.Pets; +using System; +using CalamityMod.Buffs.Pets; using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -18,16 +20,36 @@ namespace CalamityMod.Items.Accessories // "Despite the seemingly insane numbers here, I think this item might actually be underpowered" // hindsight: the item was not underpowered. Ozzatron 05NOV2021 - // - // 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 ForcedCritBullseyeCritRatio = 2.4f; // If your projectile is forced to crit, you get less of a reward. + // Memes 03SEP2024: Old comments kept for record. - 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; - private const float MaxSlowBonusUseTime = 72f; - private const float MaxSlowWeaponBonus = 0.33f; // Up to +33% more damage to crits for slower weapons. + #region Balancing Variables + + /// + /// The bullseye's total lifespan while it is not hit. + /// + public const int BullseyeIdleLifetime = 600; + + /// + /// The bullseye's lifespan when hit. + /// + public const int BullseyeHitLifetime = 90; + + /// + /// The amount of critical strike chance bonus where crit starts decaying faster.
+ /// When the crit bonus reaches this value, the decay rate increases by one tier. + ///
+ public static readonly int CritDecayThreshold = 60; + + /// + /// When the critical strike chance bonus has exceeded , it continues to decay faster for every more. + /// + public static readonly int CritDecayEchelon = 10; + + /// + /// By default, critical strike chance is lost at 15% per second (1% every 4 frames). This is the first value to which decay echelons are applied.
+ /// Once this value reaches 1, the player instead starts losing multiple % of crit every frame. + ///
+ public static readonly int CritDecayBaseRate = 4; // These were very carefully calculated, please don't change them. internal const float RegularEnemyBullseyeRadius = 8f; @@ -36,25 +58,7 @@ namespace CalamityMod.Items.Accessories // Special search radius for coin ricoshots that only applies to DSO targets. public static readonly float RicoshotSearchDistance = 2800f; - internal static float GetDamageMultiplier(Player p, CalamityPlayer mp, bool hitBullseye, bool wasForcedCrit) - { - float baseCritMult = 2f; // In vanilla Terraria, crits do +100% damage. - - // If a bullseye was struck, replace a "regular crit" with a "bullseye crit". - if (hitBullseye) - { - // Bullseye crits are weaker if the projectile was already a forced crit. - // 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. - float convertedCritBonus = StoredCritConversionRatio * mp.spiritOriginConvertedCrit; - - float useTimeInterpolant = Utils.GetLerpValue(MinUseTimeForSlowBonus, MaxSlowBonusUseTime, p.ActiveItem().useTime, true); - float slowWeaponBonus = MathHelper.Lerp(0f, MaxSlowWeaponBonus, useTimeInterpolant); - return baseCritMult * (1f + convertedCritBonus + slowWeaponBonus); - } + #endregion public override void SetDefaults() { @@ -69,7 +73,8 @@ namespace CalamityMod.Items.Accessories // The pet is purely visual and does not affect the functionality of the item. public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().spiritOrigin = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.spiritOrigin = true; // If visibility is disabled, despawn the pet. if (hideVisual) @@ -77,12 +82,49 @@ namespace CalamityMod.Items.Accessories if (player.FindBuffIndex(ModContent.BuffType()) != -1) player.ClearBuff(ModContent.BuffType()); } + // If visibility is enabled, spawn the pet. else if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) player.AddBuff(ModContent.BuffType(), 18000, true); } + + // Update the current crit boost. + int currentCritBoost = modPlayer.spiritOriginCritBoost; + + // Calculate how many tiers / echelons of decay are currently affecting the crit boost. + int decayRateEchelons = 0; + if (currentCritBoost >= CritDecayThreshold) + decayRateEchelons = 1 + ((currentCritBoost - CritDecayThreshold) / CritDecayEchelon); + + // This is the current decay rate. Crit is lost once every this many frames. + int decayRate = Math.Max(1, CritDecayBaseRate - decayRateEchelons); + int percentToDecay = 1; + + // If enough echelons have been reached that crit is already draining once per frame, + // then start removing multiple percent crit per frame as well. + if (decayRateEchelons >= CritDecayBaseRate) + percentToDecay += decayRateEchelons - CritDecayBaseRate; + + // Actually decay the crit chance boost. + if (player.miscCounter % decayRate == 0 && currentCritBoost > 0) + currentCritBoost -= percentToDecay; + + // Write out the new value to the tracked stat on the player. + modPlayer.spiritOriginCritBoost = currentCritBoost; + + // Actually give the crit boost as a direct increase to ranged critical strike chance. + player.GetCritChance() += modPlayer.spiritOriginCritBoost; + + // Display the current crit boost on a cooldown. + if (modPlayer.cooldowns.TryGetValue(DaawnlightSpiritOriginExtraCrit.ID, out var cooldown)) + { + int displayedCritOnCooldown = Math.Max(0, CritDecayThreshold - currentCritBoost); + cooldown.timeLeft = displayedCritOnCooldown; + } + else + player.AddCooldown(DaawnlightSpiritOriginExtraCrit.ID, CritDecayThreshold); } public override void UpdateVanity(Player player) diff --git a/Items/Accessories/DeadshotBrooch.cs b/Items/Accessories/DeadshotBrooch.cs index 1e1ec3c3ad..d017624cdf 100644 --- a/Items/Accessories/DeadshotBrooch.cs +++ b/Items/Accessories/DeadshotBrooch.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,10 +23,12 @@ namespace CalamityMod.Items.Accessories { player.Calamity().deadshotBrooch = true; player.Calamity().rangedAmmoCost *= 0.8f; - player.GetDamage() += 0.1f; - player.GetCritChance() += 5; + player.GetDamage() += 0.12f; + player.GetCritChance() += 7; } + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/DeepDiver.cs b/Items/Accessories/DeepDiver.cs index 33537b3241..7405576e8e 100644 --- a/Items/Accessories/DeepDiver.cs +++ b/Items/Accessories/DeepDiver.cs @@ -4,7 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 22d188bd58..b79a6ea9c4 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index f874e3229a..e449c12a33 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(25). - AddIngredient(25). AddIngredient(5). + AddIngredient(25). + AddIngredient(25). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 75479538ad..abbe1e35a3 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories // Duration of Nanomachines in frames. internal static readonly int NanomachinesDuration = 120; - // Health gained per frame while using Nanomachines. + // Health gained every other frame while using Nanomachines. internal static readonly int NanomachinesHealPerFrame = 3; // Duration of time where Nanomachines won't accumulate after taking damage, in frames. @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs( (ContactDamageReduction * 100).ToString("N0"), - NanomachinesHealPerFrame * NanomachinesDuration, + NanomachinesHealPerFrame * (NanomachinesDuration / 2), NanomachinesDuration / 60); public override void SetStaticDefaults() diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index b661c98217..dfd9f7fe01 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public const int MiniSwamerCooldown = 180; + public static int MiniSwamerDamage = 1000; public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); @@ -32,7 +33,6 @@ 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; } diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index 91df6f15a8..5bb6405a7c 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -32,9 +32,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(25). - AddIngredient(25). AddIngredient(5). + AddIngredient(25). + AddIngredient(25). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 8fe0fd29f0..d28518d7fb 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -38,8 +38,6 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.FireGauntlet). - AddIngredient(ItemID.LunarBar, 8). - AddIngredient(4). AddIngredient(4). AddTile(). Register(); diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 549733c0b9..192f3565f2 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public bool HasFlavorTooltip => true; public Color? TooltipExtensionColor => new(195, 223, 255); - public const int ShieldSlamDamage = 500; + public const int ShieldSlamDamage = 400; public const float ShieldSlamKnockback = 12f; public const int ShieldSlamIFrames = 12; - public const int RamExplosionDamage = 500; + public const int RamExplosionDamage = 200; public const float RamExplosionKnockback = 15f; public override void SetDefaults() @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.ShadowFlame] = true; player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Daybreak] = true; + player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; } } diff --git a/Items/Accessories/EnchantedPearl.cs b/Items/Accessories/EnchantedPearl.cs index 9025eb04c2..d797425333 100644 --- a/Items/Accessories/EnchantedPearl.cs +++ b/Items/Accessories/EnchantedPearl.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index 7e53c9baa6..84cb1fa4bb 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -40,8 +40,6 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddRecipeGroup("AnyManaFlower"). //Any mana flower accessory - AddIngredient(ItemID.LunarBar, 8). - AddIngredient(4). AddIngredient(4). AddTile(). Register(); diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index d0db6cd67c..d787a45479 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -44,13 +44,10 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { var source = player.GetSource_Accessory(Item); - - // 08DEC2023: Ozzatron: Cloud Elementals spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(45); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(45); var p = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 2f, Main.myPlayer, 0f, 0f); - p.originalDamage = baseDamage; + p.originalDamage = 45; } } } diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index fc1e5de671..c422418d78 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 733218f7e3..4637cba6cc 100644 --- a/Items/Accessories/FlameLickedShell.cs +++ b/Items/Accessories/FlameLickedShell.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Accessories var empowered = calPlayer.flameLickedShellEmpoweredParry; NPC target = player.Center.ClosestNPCAt(1300f, true, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 targetPosition = target?.Center ?? Main.MouseWorld; float projectileSpeed = 8f; @@ -56,7 +57,6 @@ namespace CalamityMod.Items.Accessories float offsetAngle = (float)Math.PI * radialOffset; int type = ModContent.ProjectileType(); int damage = (int)player.GetBestClassDamage().ApplyTo(200); - damage = player.ApplyArmorAccDamageBonusesTo(damage); if (player.whoAmI == Main.myPlayer) { @@ -73,7 +73,6 @@ namespace CalamityMod.Items.Accessories float radians2 = MathHelper.TwoPi / totalProjectiles; type = ModContent.ProjectileType(); damage = (int)player.GetBestClassDamage().ApplyTo(70); - damage = player.ApplyArmorAccDamageBonusesTo(damage); double angleA = radians2 * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index e65ca7c7b0..b7a5cb048e 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -35,14 +35,11 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { var source = player.GetSource_Accessory(Item); - - // 08DEC2023: Ozzatron: Fungal Clumps spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(FungalClumpDamage); - int damage = (int)player.GetBestClassDamage().ApplyTo(baseDamage); + int damage = (int)player.GetBestClassDamage().ApplyTo(FungalClumpDamage); int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 1f, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = FungalClumpDamage; } } } @@ -62,12 +59,11 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); // 08DEC2023: Ozzatron: Fungal Clumps spawned with... Hold on a second. Why the fuck are we doing damage calculations when the accessory is in vanity?! - int baseDamage = player.ApplyArmorAccDamageBonusesTo(FungalClumpDamage); - int damage = (int)player.GetBestClassDamage().ApplyTo(baseDamage); + int damage = (int)player.GetBestClassDamage().ApplyTo(FungalClumpDamage); int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 1f, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = FungalClumpDamage; } } } diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index e1e9e339a4..86de98ed56 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -1,13 +1,18 @@ using CalamityMod.CalPlayer; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [LegacyName("AmidiasPendant")] public class GiantPearl : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public const float AuraRadius = 120f; public override void SetDefaults() { Item.width = 42; @@ -22,6 +27,39 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.giantPearl = true; Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.45f, 0.8f, 0.8f); + + // Draw the aura visual + if (Main.myPlayer == player.whoAmI) + { + float npcDistCompare = 1000f; + foreach (NPC n in Main.ActiveNPCs) + { + if (n.friendly || n.dontTakeDamage) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, player.Center); + if (currentNPCDist < npcDistCompare) + npcDistCompare = currentNPCDist; + } + float opacity = Utils.Remap(npcDistCompare, AuraRadius, AuraRadius * 5f, 1f, 0f); + + if (opacity >= 1f) + { + for (int d = 0; d < 2; d++) + { + WaterGlobParticle water = new(player.Center, Main.rand.NextVector2CircularEdge(13.5f, 13.5f), 0.32f, 0f, 35); + GeneralParticleHandler.SpawnParticle(water); + } + } + + SemiCircularSmearFade smearBorder = new(player.Center, player.velocity, new Color(75, 164, 191) * opacity, player.miscCounter * (MathHelper.Pi / 30f), AuraRadius * 0.01125f, Vector2.One, 2, true); + GeneralParticleHandler.SpawnParticle(smearBorder); + smearBorder = new(player.Center, player.velocity, new Color(75, 164, 191) * opacity, player.miscCounter * (MathHelper.Pi / 30f) + MathHelper.Pi, AuraRadius * 0.01125f, Vector2.One, 2, true); + GeneralParticleHandler.SpawnParticle(smearBorder); + + CustomPulse auraVisual = new(player.Center, player.velocity, new Color(75, 164, 191), "CalamityMod/Particles/BloomRing", Vector2.One, 0f, AuraRadius * 0.0105f, AuraRadius * 0.0105f, 2, true, opacity, false); + GeneralParticleHandler.SpawnParticle(auraVisual); + } } } } diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 8b56b94464..c7b583cea5 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -17,25 +18,15 @@ namespace CalamityMod.Items.Accessories Item.height = 36; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.defense = 5; Item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) - { - if (player.Calamity().gladiatorSword) - return false; - - return true; - } - public override void UpdateAccessory(Player player, bool hideVisual) { - float damageIncrease = 0.2f; - float moveSpeedIncrease = 0.2f; + float statPower = (float)Math.Round(0.2f * Utils.GetLerpValue(1, 0.5f, ((float)player.statLife / (float)player.statLifeMax2), true), 2); player.Calamity().gladiatorSword = true; - player.GetDamage() += damageIncrease - (damageIncrease * player.statLife / player.statLifeMax2); - player.moveSpeed += moveSpeedIncrease - (moveSpeedIncrease * player.statLife / player.statLifeMax2); + player.GetDamage() += statPower; + player.moveSpeed += statPower; } } } diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index 48540432a4..1bf8309fd9 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,6 +10,13 @@ namespace CalamityMod.Items.Accessories public class GrandGelatin : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float MoveSpeedBoost = 0.12f; + public static float JumpSpeedBoost = 0.6f; // Both 12% so we only need just one in the tooltip + public static int AuraLifetime = 1800; + public static int AuraRegenBoost = 6; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), AuraLifetime.FramesToSeconds(), AuraRegenBoost.ToRegenPerSecond()); + public override void SetDefaults() { Item.width = 34; @@ -22,8 +30,8 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.GrandGelatin = true; - player.moveSpeed += 0.12f; - player.jumpSpeedBoost += 0.6f; + player.moveSpeed += MoveSpeedBoost; + player.jumpSpeedBoost += JumpSpeedBoost; } public override void AddRecipes() diff --git a/Items/Accessories/HallowedRune.cs b/Items/Accessories/HallowedRune.cs index f6bf010380..360aa5df98 100644 --- a/Items/Accessories/HallowedRune.cs +++ b/Items/Accessories/HallowedRune.cs @@ -7,6 +7,12 @@ namespace CalamityMod.Items.Accessories public class HallowedRune : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; + + public static int RegenBoost = 3; + public static int DefenseBoost = 8; + public static float DamageReductionBoost = 0.04f; + public static float SummonDamageBoost = 0.1f; + public override void SetDefaults() { Item.width = 26; diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 536236e269..8ea3582908 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Accessories public class HeartoftheElements : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public static int ElementalDamage = 50; + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 8)); @@ -59,9 +61,7 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); Vector2 velocity = new Vector2(0f, -1f); - // 08DEC2023: Ozzatron: Elementals spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(50); - int elementalDmg = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int elementalDmg = (int)player.GetTotalDamage().ApplyTo(ElementalDamage); float kBack = 2f + player.GetKnockback().Additive; @@ -81,31 +81,31 @@ namespace CalamityMod.Items.Accessories { int p = Projectile.NewProjectile(source, player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } if (player.ownedProjectileCounts[siren] < 1) { int p = Projectile.NewProjectile(source, player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } if (player.ownedProjectileCounts[healer] < 1) { int p = Projectile.NewProjectile(source, player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } if (player.ownedProjectileCounts[sandy] < 1) { int p = Projectile.NewProjectile(source, player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } if (player.ownedProjectileCounts[cloudy] < 1) { int p = Projectile.NewProjectile(source, player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } } } @@ -126,8 +126,7 @@ namespace CalamityMod.Items.Accessories Vector2 velocity = new Vector2(0f, -1f); // 08DEC2023: Ozzatron: Elementals spawned with... Hold on a second. Why the fuck are we doing damage calculations when the accessory is in vanity?! - int baseDamage = player.ApplyArmorAccDamageBonusesTo(50); - int elementalDmg = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int elementalDmg = (int)player.GetTotalDamage().ApplyTo(ElementalDamage); float kBack = 2f + player.GetKnockback().Additive; @@ -147,31 +146,31 @@ namespace CalamityMod.Items.Accessories { int p = Projectile.NewProjectile(source, player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } if (player.ownedProjectileCounts[siren] < 1) { int p = Projectile.NewProjectile(source, player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } if (player.ownedProjectileCounts[healer] < 1) { int p = Projectile.NewProjectile(source, player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } if (player.ownedProjectileCounts[sandy] < 1) { int p = Projectile.NewProjectile(source, player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } if (player.ownedProjectileCounts[cloudy] < 1) { int p = Projectile.NewProjectile(source, player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } } } diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index b59cc97768..45526da47c 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -21,13 +21,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - player.buffImmune[ModContent.BuffType()] = true; modPlayer.hideOfDeus = true; if (modPlayer.hideOfDeusMeleeBoostTimer > 0) player.GetDamage() += 0.3f; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Frostburn] = true; player.thorns += 0.75f; } } diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index f0bd6da006..5411c27755 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.BottledHoney, 10). AddIngredient(ItemID.BeeWax, 3). - AddIngredient(3). + AddIngredient(ItemID.JungleSpores, 6). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/HoneyDew.png b/Items/Accessories/HoneyDew.png index ae540d0562..c029fa38e4 100644 Binary files a/Items/Accessories/HoneyDew.png and b/Items/Accessories/HoneyDew.png differ diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs index 9397e5a300..8fdf7cac32 100644 --- a/Items/Accessories/HowlsHeart.cs +++ b/Items/Accessories/HowlsHeart.cs @@ -34,8 +34,6 @@ namespace CalamityMod.Items.Accessories Item.Calamity().donorItem = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().howlsHeart; - public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -49,12 +47,10 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Howls spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(HowlDamage); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(HowlDamage); Projectile howl = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ProjectileType(), damage, 1f, player.whoAmI, 0f, 1f); - howl.originalDamage = damage; + howl.originalDamage = HowlDamage; } if (player.ownedProjectileCounts[ProjectileType()] < 1) { @@ -79,8 +75,7 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ProjectileType()] < 1) { // 08DEC2023: Ozzatron: Howls spawned with... Hold on a second. Why the fuck are we doing damage calculations when the accessory is in vanity?! - int baseDamage = player.ApplyArmorAccDamageBonusesTo(HowlDamage); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(HowlDamage); int p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ProjectileType(), damage, 1f, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/IlmerisSpark.cs similarity index 83% rename from Items/Accessories/AmidiasSpark.cs rename to Items/Accessories/IlmerisSpark.cs index e15f15b358..718e312aeb 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/IlmerisSpark.cs @@ -5,7 +5,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class AmidiasSpark : ModItem, ILocalizedModType + [LegacyName("AmidiasSpark")] + public class IlmerisSpark : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() @@ -16,11 +17,10 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Blue; Item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aSpark = true; + modPlayer.ilSpark = true; } } } diff --git a/Items/Accessories/AmidiasSpark.png b/Items/Accessories/IlmerisSpark.png similarity index 100% rename from Items/Accessories/AmidiasSpark.png rename to Items/Accessories/IlmerisSpark.png diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index 3b3ef45fa7..a50bfc0663 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Accessories public class LeviathanAmbergris : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public static int ambergrisDashDamage = 90; public override void SetDefaults() { Item.width = 20; diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs index 5b953ac31a..00020facef 100644 --- a/Items/Accessories/LifeJelly.cs +++ b/Items/Accessories/LifeJelly.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,6 +10,11 @@ namespace CalamityMod.Items.Accessories public class LifeJelly : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int AuraLifetime = 1800; + public static int AuraRegenBoost = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AuraLifetime.FramesToSeconds(), AuraRegenBoost.ToRegenPerSecond()); + public override void SetDefaults() { Item.width = 18; diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index 741b41a753..bc76e4a498 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(3). AddIngredient(6). // TODO -- Replace with Water Essence AddIngredient(5). diff --git a/Items/Accessories/LumenousAmulet.cs b/Items/Accessories/LumenousAmulet.cs index 99f96bc469..7b07d0c8f0 100644 --- a/Items/Accessories/LumenousAmulet.cs +++ b/Items/Accessories/LumenousAmulet.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index bd3acd5dff..aeeda7a03d 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -1,17 +1,43 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using CalamityMod.NPCs; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Accessories { public class LuxorsGift : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public const int meleeAttackSpeed = 100; + public const int rangedAttackSpeed = 25; + public const int magicAttackSpeed = 75; + public const int summonerAttackSpeed = 140; + public const int rogueAttackSpeed = 36; // Rogue has a 12 frame delay between it's two shots, so it's actaully a bit slower than you'd think + public const int classlessAttackSpeed = 50; + + public const int meleeDamage = 10; + public const int rangedDamage = 5; + public const int magicDamage = 13; + public const int summonerDamage = 22; + public const int rogueDamage = 8; + public const int classlessDamage = 9; + + public const int luxArmorPen = 35; // Remember kids, If a Shark Tooth Necklace approaches you, run away and contact your nearest trusted adult public override void SetDefaults() { - Item.width = 58; - Item.height = 48; + Item.width = 66; + Item.height = 46; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; @@ -21,6 +47,22 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.luxorsGift = true; + + if (player.ownedProjectileCounts[ProjectileType()] < 1 && !player.dead) + { + Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + } + } + + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.luxorsGiftVanity = true; + + if (player.ownedProjectileCounts[ProjectileType()] < 1 && !player.dead) + { + Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + } } } } diff --git a/Items/Accessories/LuxorsGift.png b/Items/Accessories/LuxorsGift.png index f47ea32f11..df068e334c 100644 Binary files a/Items/Accessories/LuxorsGift.png and b/Items/Accessories/LuxorsGift.png differ diff --git a/Items/Accessories/MarniteRepulsionShield.cs b/Items/Accessories/MarniteRepulsionShield.cs index 722a59065d..8f20c5926b 100644 --- a/Items/Accessories/MarniteRepulsionShield.cs +++ b/Items/Accessories/MarniteRepulsionShield.cs @@ -15,7 +15,7 @@ using static CalamityMod.CalamityUtils; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Back)] - //Its not like its a renamed version of the bayonet, but i put this here more as a way to "refund" the item, so it doesnt end up rotting as an unloaded item. + //It's not like it's a renamed version of the bayonet, but I put this here more as a way to "refund" the item, so it doesnt end up rotting as an unloaded item. [LegacyName("MarniteBayonet")] public class MarniteRepulsionShield : ModItem, ILocalizedModType { @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Blue; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.accessory = true; - Item.defense = 2; + Item.defense = 4; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -37,12 +37,11 @@ namespace CalamityMod.Items.Accessories if (player.whoAmI == Main.myPlayer) { - int baseDamage = player.ApplyArmorAccDamageBonusesTo(5); var source = player.GetSource_Accessory(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - var hitbox = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), baseDamage, 10f, Main.myPlayer); - hitbox.originalDamage = baseDamage; + var hitbox = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 5, 12f, Main.myPlayer); + hitbox.originalDamage = 5; } } } @@ -91,6 +90,7 @@ namespace CalamityMod.Items.Accessories Projectile.penetrate = -1; Projectile.timeLeft = 700; Projectile.tileCollide = false; + Projectile.ArmorPenetration = 20; Projectile.netImportant = true; } diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 67ce61386b..56872a2ae0 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 882bf3a32a..7d73cda868 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -39,8 +39,6 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(ItemID.LunarBar, 8). - AddIngredient(4). AddIngredient(4). AddTile(). Register(); diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index a9ead56f4f..fe23201469 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -31,13 +31,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.nCore = true; + modPlayer.nebulousCore = true; player.GetDamage() += 0.1f; - int damage = (int)player.GetBestClassDamage().ApplyTo(250); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - float knockBack = 3f; + + // Spawn nebula stars if (Main.rand.NextBool(15)) { + // Count the number of current active nebula stars; if this is at least 10, no more can spawn int numProj = 0; foreach (Projectile p in Main.ActiveProjectiles) { @@ -46,56 +46,31 @@ namespace CalamityMod.Items.Accessories numProj++; } } - var source = player.GetSource_Accessory(Item); if (Main.rand.Next(15) >= numProj && numProj < 10) { int spawnRadius = 24; - int backupSpawnRadius = 90; - for (int j = 0; j < 50; j++) + for (int j = 0; j < 50; j++) // Attempt to spawn the star randomly around the player { - int randomProjOffset = Main.rand.Next(200 - j * 2, 400 + j * 2); + float randomProjOffset = Main.rand.NextFloat(200 - j * 2, 400 + j * 2); Vector2 center = player.Center; - center.X += (float)Main.rand.Next(-randomProjOffset, randomProjOffset + 1); - center.Y += (float)Main.rand.Next(-randomProjOffset, randomProjOffset + 1); + center.X += Main.rand.NextFloat(-randomProjOffset, randomProjOffset + 1); + center.Y += Main.rand.NextFloat(-randomProjOffset, randomProjOffset + 1); + // Ensure we are not trying to spawn the star on top of a solid tile or liquid if (!Collision.SolidCollision(center, spawnRadius, spawnRadius) && !Collision.WetCollision(center, spawnRadius, spawnRadius)) { center.X += (float)(spawnRadius / 2); center.Y += (float)(spawnRadius / 2); - if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) + // Ensure the star's spawn point has line-of-sight with the player + if (Collision.CanHit(player.Center, 1, 1, center, 1, 1) || Collision.CanHit(player.Center - new Vector2(0f, 50f), 1, 1, center, 1, 1)) { - int projTileX = (int)center.X / 16; - int projTileY = (int)center.Y / 16; - bool canSpawnProj = false; - if (Main.rand.NextBool(3) && Main.tile[projTileX, projTileY] != null && Main.tile[projTileX, projTileY].WallType > 0) + if (Main.rand.NextBool(3) && Main.myPlayer == player.whoAmI) { - canSpawnProj = true; - } - else - { - center.X -= (float)(backupSpawnRadius / 2); - center.Y -= (float)(backupSpawnRadius / 2); - if (Collision.SolidCollision(center, backupSpawnRadius, backupSpawnRadius)) - { - center.X += (float)(backupSpawnRadius / 2); - center.Y += (float)(backupSpawnRadius / 2); - canSpawnProj = true; - } - } - if (canSpawnProj) - { - for (int k = 0; k < Main.maxProjectiles; k++) - { - if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) - { - canSpawnProj = false; - break; - } - } - if (canSpawnProj && Main.myPlayer == player.whoAmI) - { - Projectile.NewProjectile(source, center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - return; - } + var source = player.GetSource_Accessory(Item); + int damage = (int)player.GetBestClassDamage().ApplyTo(250); + float knockBack = 3f; + + Projectile.NewProjectile(source, center, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + return; } } } diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index 385be00e8d..229c3e33fe 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -48,8 +48,6 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(ItemID.LunarBar, 8). - AddIngredient(4). AddIngredient(4). AddTile(). Register(); diff --git a/Items/Accessories/OccultSkullCrown.cs b/Items/Accessories/OccultSkullCrown.cs index 74efa4c071..96480eb4f3 100644 --- a/Items/Accessories/OccultSkullCrown.cs +++ b/Items/Accessories/OccultSkullCrown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs index 24d1c36c04..96197e4a51 100644 --- a/Items/Accessories/OldDie.cs +++ b/Items/Accessories/OldDie.cs @@ -16,6 +16,6 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) => player.luck += 0.2f; + public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().calamityBonusLuck += 0.2f; } } diff --git a/Items/Accessories/PearlofEnthrallment.cs b/Items/Accessories/PearlofEnthrallment.cs index a6069a3b59..53a38c6c5a 100644 --- a/Items/Accessories/PearlofEnthrallment.cs +++ b/Items/Accessories/PearlofEnthrallment.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Accessories public class PearlofEnthrallment : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public static int ElementalDamage = 65; + public override void SetDefaults() { Item.width = 56; @@ -45,13 +47,11 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Anahitas spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(65); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(ElementalDamage); int anahita = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 2f, Main.myPlayer); if (Main.projectile.IndexInRange(anahita)) - Main.projectile[anahita].originalDamage = baseDamage; + Main.projectile[anahita].originalDamage = ElementalDamage; } } } @@ -70,12 +70,11 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { // 08DEC2023: Ozzatron: Anahitas spawned with... Hold on a second. Why the fuck are we doing damage calculations when the accessory is in vanity?! - int baseDamage = player.ApplyArmorAccDamageBonusesTo(65); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(ElementalDamage); int anahita = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 2f, Main.myPlayer); if (Main.projectile.IndexInRange(anahita)) - Main.projectile[anahita].originalDamage = baseDamage; + Main.projectile[anahita].originalDamage = ElementalDamage; } } } diff --git a/Items/Accessories/PermafrostsConcoction.cs b/Items/Accessories/PermafrostsConcoction.cs index e52819bd0c..7b849b028e 100644 --- a/Items/Accessories/PermafrostsConcoction.cs +++ b/Items/Accessories/PermafrostsConcoction.cs @@ -8,7 +8,10 @@ namespace CalamityMod.Items.Accessories { // Boosted by Cross Necklace. internal static readonly int EncasedIFrames = 90; - + + public static int EncasedDefenseBoost = 30; + public static double EncasedAllDamageReduction = 0.3D; + public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index 54bd1c8d57..15ea7c2134 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -15,6 +15,12 @@ namespace CalamityMod.Items.Accessories public class PhantomicArtifact : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; + + public static int RegenBoost = 2; + public static int DefenseBoost = 10; + public static float DamageReductionBoost = 0.05f; + public static float SummonDamageBoost = 0.1f; + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 7)); @@ -36,9 +42,9 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(20). - AddIngredient(25). AddIngredient(5). + AddIngredient(25). + AddIngredient(20). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/PlanebreakersPouch.cs b/Items/Accessories/PlanebreakersPouch.cs index d53fed6512..20902eceda 100644 --- a/Items/Accessories/PlanebreakersPouch.cs +++ b/Items/Accessories/PlanebreakersPouch.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -31,13 +32,13 @@ namespace CalamityMod.Items.Accessories modPlayer.rangedAmmoCost *= 0.8f; } + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); + public override void AddRecipes() { CreateRecipe(). AddRecipeGroup("AnyQuiver"). AddIngredient(). - AddIngredient(ItemID.LunarBar, 8). - AddIngredient(4). AddIngredient(4). AddTile(). Register(); diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index 21905aa701..01232cb368 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -31,28 +31,31 @@ namespace CalamityMod.Items.Accessories public static int ShieldDurabilityMax = 25; // Interface stuff. + public int OwnerPlayer { get; set; } public float RenderDepth => IDyeableShaderRenderer.ProfanedSoulShieldDepth; public bool ShouldDrawDyeableShader { get { - bool result = false; - foreach (Player player in Main.ActivePlayers) - { - if (player.outOfRange || player.dead) - continue; + if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f) + return false; - CalamityPlayer modPlayer = player.Calamity(); + if (OwnerPlayer < 0 || OwnerPlayer >= Main.maxPlayers) + return false; - // Do not render the shield if its visibility is off (or it does not exist) - bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact; - bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion: - bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0; - bool shouldntDraw = !modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists; - result |= !shouldntDraw; - } - return result; + var player = Main.player[OwnerPlayer]; + if (player is null) + return false; + + if (player.outOfRange || player.dead) + return false; + + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.drawingParameters.ProfanedShieldCharge <= 0.0f) + return false; + + return true; } } @@ -62,7 +65,7 @@ namespace CalamityMod.Items.Accessories ItemID.Sets.AnimatesAsSoul[Type] = true; } - public void DrawDyeableShader(SpriteBatch spriteBatch) => DrawProfanedSoulShields(); + public void DrawDyeableShader(SpriteBatch spriteBatch) => DrawProfanedSoulShields(OwnerPlayer); public override void SetDefaults() { @@ -100,130 +103,94 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(25). - AddIngredient(25). AddIngredient(5). + AddIngredient(25). + AddIngredient(25). AddTile(TileID.DemonAltar). Register(); } // Complex drawcode which draws Profaned Soul shields on ALL players who have it available. Supposedly. // This is applied as IL (On hook) which draws right before Inferno Ring. - internal static void DrawProfanedSoulShields() + internal static void DrawProfanedSoulShields(int whoAmI) { - // TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive). - // Profaned Soul shields will be drawn for each player with the Profaned Soul artifact/crystal, yes. - // But there is no guarantee that the shields will be in the right condition for each player. - // Visibility is not net synced, for example. - bool alreadyDrawnShieldForPlayer = false; + if (whoAmI < 0 || whoAmI >= Main.maxPlayers) + return; - foreach (Player player in Main.ActivePlayers) + var player = Main.player[whoAmI]; + if (player is null) + return; + + if (player.outOfRange || player.dead) + return; + + CalamityPlayer modPlayer = player.Calamity(); + + if (modPlayer.drawnAnyShieldThisFrame) + return; + + if (modPlayer.drawingParameters.ProfanedShieldCharge <= 0.0f) + return; + + // Scale the shield is drawn at. + // The "i" parameter is to make different player's shields not be perfectly synced. + int i = player.whoAmI; + float scale = 0.15f + 0.03f * (0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f)); + float visualShieldStrength = modPlayer.drawingParameters.ProfanedShieldCharge; + Color shieldColor = modPlayer.drawingParameters.ProfanedShieldColor; + + // 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. + float noiseScale = MathHelper.Lerp(0.4f, 0.8f, MathF.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); + + // Define shader parameters + Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; + shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay + shieldEffect.Parameters["blowUpPower"].SetValue(2.8f); + shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); + shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); + + // Shield opacity multiplier slightly changes, this is independent of current shield strength + float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f); + float minShieldStrengthOpacityMultiplier = 0.5f; + float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength); + finalShieldOpacity *= CalamityClientConfig.Instance.EnergyShieldOpacity; + + shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); + shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); + + Color primaryEdgeColor = new Color(230, 199, 102) * 0.8f; + Color secondaryEdgeColor = new Color(249, 231, 217) * 0.8f; + Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor); + + // Define shader parameters for shield color + shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); + shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + + Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, Matrix.Identity, () => { - if (player.outOfRange || player.dead) - continue; + // Fetch shield heat overlay texture (this is the neutrons fed to the shader) + HeatTex ??= ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2"); + Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition; + Texture2D tex = HeatTex.Value; + Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); - CalamityPlayer modPlayer = player.Calamity(); - - // Do not render the shield if its visibility is off (or it does not exist) - bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact; - bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion: - bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0; - if (!modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists) - continue; - - // Scale the shield is drawn at. - // The "i" parameter is to make different player's shields not be perfectly synced. - int i = player.whoAmI; - float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f)); - - if (!alreadyDrawnShieldForPlayer) - { - CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity(); - DetermineTransformationEligibility(localModPlayer.Player); - var psState = (int)GetPscStateFor(localModPlayer.Player, localModPlayer.profanedCrystalAnim >= 0); - var psc = localModPlayer.profanedCrystalBuffs || (localModPlayer.profanedCrystalAnim >= 0 && psState >= (int)ProfanedSoulCrystalState.Buffs); - - scale += ((ProfanedSoulCrystalState)psState) == ProfanedSoulCrystalState.Empowered ? 0.05f : psc ? 0.025f : 0f; - if (localModPlayer.profanedCrystalAnim >= 0) - scale = MathHelper.Lerp(0f, scale, ((float)maxPscAnimTime - (float)localModPlayer.profanedCrystalAnim) / (float)maxPscAnimTime); //i don't like casting this many times, i'm not a fucking wizard - - float visualShieldStrength = 1f; - if (!isVanityOnly) - { - float max = psc ? ProfanedSoulCrystal.ShieldDurabilityMax : ShieldDurabilityMax; - float shieldDurabilityRatio = localModPlayer.pSoulShieldDurability / max; - visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); - } - - // 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. - float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); - - // Define shader parameters - Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; - shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay - shieldEffect.Parameters["blowUpPower"].SetValue(2.8f); - shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); - shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); - - // Shield opacity multiplier slightly changes, this is independent of current shield strength - float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f); - float minShieldStrengthOpacityMultiplier = 0.5f; - float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength); - shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); - shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - - // Profaned Soul shields are not team specific - Color shieldColor = GetColorForPsc(psState, Main.dayTime); - if (psState >= (int)(ProfanedSoulCrystalState.Buffs)) - { - bool tester = contributorNames.Any(name => name.Equals(localModPlayer.Player.name)); - shieldColor = tester ? CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25) * 0.8f, 6f) : - GetLerpedColorForPsc(modPlayer); - } - - Color primaryEdgeColor = new Color(230, 199, 102) * 0.8f; - Color secondaryEdgeColor = new Color(249, 231, 217) * 0.8f; - Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor); - - // Define shader parameters for shield color - shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); - shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); - - // GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS - // yes I copy pasted that comment, I hate end begin that much - // I also copy pasted that comment, this time for consistency :hdfailure: - 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) - HeatTex ??= ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2"); - Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition; - Texture2D tex = HeatTex.Value; - Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); - - //The border circle MUST be drawn after otherwise it becomes visually fucked. - float shieldScale = scale * 1.75f; - Texture2D shieldTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleOpenCircle").Value; - Rectangle shieldFrame = shieldTexture.Frame(); - Vector2 origin = shieldFrame.Size() * 0.5f; - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f); - } - - alreadyDrawnShieldForPlayer = true; - modPlayer.drawnAnyShieldThisFrame = true; - } - - if (alreadyDrawnShieldForPlayer) - { + //The border circle MUST be drawn after otherwise it becomes visually fucked. + float shieldScale = scale * 1.75f; + Texture2D shieldTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleOpenCircle").Value; + Rectangle shieldFrame = shieldTexture.Frame(); + Vector2 origin = shieldFrame.Size() * 0.5f; Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); - } + + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + }); + modPlayer.drawnAnyShieldThisFrame = true; } } } diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 41d1cf5ecc..546e685553 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -33,30 +33,32 @@ namespace CalamityMod.Items.Accessories public const int maxPscAnimTime = 120; // Interface stuff. + public int OwnerPlayer { get; set; } public float RenderDepth => IDyeableShaderRenderer.ProfanedSoulShieldDepth; - public bool ShaderIsDyeable => false; public bool ShouldDrawDyeableShader { get { - bool result = false; - foreach (Player player in Main.ActivePlayers) - { - if (player.outOfRange || player.dead) - continue; + if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f) + return false; - CalamityPlayer modPlayer = player.Calamity(); + if (OwnerPlayer < 0 || OwnerPlayer >= Main.maxPlayers) + return false; - // Do not render the shield if its visibility is off (or it does not exist) - bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact; - bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion: - bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0; - bool shouldntDraw = !modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists; - result |= !shouldntDraw; - } - return result; + var player = Main.player[OwnerPlayer]; + if (player is null) + return false; + + if (player.outOfRange || player.dead) + return false; + + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.drawingParameters.ProfanedShieldCharge <= 0.0f) + return false; + + return true; } } @@ -68,7 +70,7 @@ namespace CalamityMod.Items.Accessories Empowered //psc but no other minions, healer guardian functionality, inherits all other functionality (except vanity) and goes even further beyond, any remaining attack changes are here } - public void DrawDyeableShader(SpriteBatch spriteBatch) => ProfanedSoulArtifact.DrawProfanedSoulShields(); + public void DrawDyeableShader(SpriteBatch spriteBatch) => ProfanedSoulArtifact.DrawProfanedSoulShields(OwnerPlayer); internal static ProfanedSoulCrystalState GetPscStateFor(Player player, bool ignoreNoBuffs = false) { @@ -155,7 +157,7 @@ namespace CalamityMod.Items.Accessories */ public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransHead", EquipType.Head, this); @@ -172,7 +174,7 @@ namespace CalamityMod.Items.Accessories Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -227,7 +229,7 @@ namespace CalamityMod.Items.Accessories } else { - string manaCost = (100 * Main.player[Main.myPlayer].manaCost).ToString("N0"); + string manaCost = (100 * Main.LocalPlayer.manaCost).ToString("N0"); string full = this.GetLocalization("FullTooltip").Format(maxMinionRequirement, manaCost); tooltips.FindAndReplace("[STATUS]", full); } @@ -245,7 +247,8 @@ namespace CalamityMod.Items.Accessories modPlayer.profanedCrystalAnim = maxPscAnimTime; Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } - + if (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs) + player.Calamity().profanedSoulRelicBuff = true; modPlayer.profanedCrystalHide = hideVisual || modPlayer.profanedCrystalAnim > 0; modPlayer.pSoulShieldVisible = !hideVisual; @@ -289,6 +292,8 @@ namespace CalamityMod.Items.Accessories player.Calamity().profanedSoulWeaponType = weaponType; player.Calamity().profanedSoulWeaponUsage = 0; } + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 correctedVelocity = Main.MouseWorld - player.Center; correctedVelocity.Normalize(); bool empowered = player.Calamity().pscState == (int)ProfanedSoulCrystalState.Empowered; @@ -309,7 +314,6 @@ namespace CalamityMod.Items.Accessories int separation = (i * 4) - 8; int spearBaseDamage = 350; int spearDamage = (int)player.GetTotalDamage().ApplyTo(spearBaseDamage); - spearDamage = player.ApplyArmorAccDamageBonusesTo(spearDamage); int proj = Projectile.NewProjectile(source, player.Center.X, player.Center.Y - separation, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), spearDamage, 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); if (proj.WithinBounds(Main.maxProjectiles)) @@ -326,7 +330,6 @@ namespace CalamityMod.Items.Accessories { int spearBaseDamage = 250; int spearDamage = (int)player.GetTotalDamage().ApplyTo(spearBaseDamage); - spearDamage = player.ApplyArmorAccDamageBonusesTo(spearDamage); int proj = Projectile.NewProjectile(source, player.Center, correctedVelocity * 14f, ModContent.ProjectileType(), spearDamage, 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); if (proj.WithinBounds(Main.maxProjectiles)) @@ -352,7 +355,6 @@ namespace CalamityMod.Items.Accessories int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3; int boomBaseDamage = 200; int boomDamage = (int)player.GetTotalDamage().ApplyTo(boomBaseDamage); - boomDamage = player.ApplyArmorAccDamageBonusesTo(boomDamage); switch (projType) { @@ -407,7 +409,6 @@ namespace CalamityMod.Items.Accessories int sickPenalty = (int)(mageFireDamage * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); mageFireDamage -= sickPenalty; } - mageFireDamage = player.ApplyArmorAccDamageBonusesTo(mageFireDamage); int proj = Projectile.NewProjectile(source, player.position, correctedVelocity, ModContent.ProjectileType(), mageFireDamage, 1f, player.whoAmI, empowered ? 1f : 0f); if (proj.WithinBounds(Main.maxProjectiles)) @@ -435,7 +436,6 @@ namespace CalamityMod.Items.Accessories float angle = MathHelper.TwoPi / crystalCount * i; int shardBaseDamage = 176; int shardDamage = (int)player.GetTotalDamage().ApplyTo(shardBaseDamage); - shardDamage = player.ApplyArmorAccDamageBonusesTo(shardDamage); int proj = Projectile.NewProjectile(source, player.Center, angle.ToRotationVector2() * 12f, ModContent.ProjectileType(), shardDamage, 1f, player.whoAmI, 0f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) @@ -453,7 +453,6 @@ namespace CalamityMod.Items.Accessories int totalShardProjectiles = empowered ? 360 / 5 : 360 / 10; int shardBaseDamage = empowered ? 125 : 220; int shardDamage = (int)player.GetTotalDamage().ApplyTo(shardBaseDamage); - shardDamage = player.ApplyArmorAccDamageBonusesTo(shardDamage); float interval = totalShardProjectiles / chains * (empowered ? 5f : 10f); double patternInterval = Math.Floor(player.Calamity().profanedSoulWeaponUsage / interval); @@ -493,7 +492,6 @@ namespace CalamityMod.Items.Accessories { int whipBaseDamage = 250; int whipDamage = (int)player.GetTotalDamage().ApplyTo(whipBaseDamage); - whipDamage = player.ApplyArmorAccDamageBonusesTo(whipDamage); var buffed = player.HasBuff(); correctedVelocity *= buffed ? 10f : 8f; @@ -516,10 +514,11 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). + AddIngredient(5). AddIngredient(50). AddIngredient(100). - AddIngredient(5). AddTile(). + AddDecraftCondition(CalamityConditions.DownedSupremeCalamitas, CalamityConditions.DownedExoMechs). Register(); } } diff --git a/Items/Accessories/QuiverofNihility.cs b/Items/Accessories/QuiverofNihility.cs index cc419a93c1..11717b66cd 100644 --- a/Items/Accessories/QuiverofNihility.cs +++ b/Items/Accessories/QuiverofNihility.cs @@ -25,14 +25,6 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) - { - if (player.Calamity().voidField) - return false; - - return true; - } - public override void UpdateAccessory(Player player, bool hideVisual) { player.GetCritChance() += 5; @@ -40,32 +32,31 @@ namespace CalamityMod.Items.Accessories modPlayer.voidField = true; if (player.whoAmI == Main.myPlayer) { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 4) + return; + var source = player.GetSource_Accessory(Item); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 4) + int count = player.ownedProjectileCounts[ModContent.ProjectileType()]; + do { - for (int v = 0; v < 4; v++) - { - Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, v); - } + Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, count); + count++; } + while (count < 4); } } public override void AddRecipes() { CreateRecipe(). AddRecipeGroup("AnyQuiver"). - AddIngredient(3). AddIngredient(5). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - // This item doesn't follow many of the guidelines - // for this method. - // But I (nalyddd) saw the sprite in-game and felt extremely - // sad about how EXTREMELY squished it was. CalamityUtils.DrawInventoryCustomScale( spriteBatch, texture: TextureAssets.Item[Type].Value, diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 9181a9e2ea..7ded8661aa 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Accessories public class RaidersTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const float RaiderBonus = 12f; - public const int RaiderCooldown = 5; + public const float RaiderBonus = 10f; + public const int RaiderCooldown = 10; public static readonly SoundStyle StealthHitSound = new("CalamityMod/Sounds/Custom/RaidersTalismanStealthHit"); public override void SetDefaults() diff --git a/Items/Accessories/ReaperToothNecklace.cs b/Items/Accessories/ReaperToothNecklace.cs index 7fc403aa83..5c94e7fa60 100644 --- a/Items/Accessories/ReaperToothNecklace.cs +++ b/Items/Accessories/ReaperToothNecklace.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetDamage() += 0.15f; + player.GetDamage() += 0.2f; player.GetArmorPenetration() += 15; } diff --git a/Items/Accessories/Regenator.cs b/Items/Accessories/Regenator.cs index f13b41822a..f8bdcbf180 100644 --- a/Items/Accessories/Regenator.cs +++ b/Items/Accessories/Regenator.cs @@ -2,6 +2,10 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Terraria.Localization; +using System.Collections.Generic; +using System; namespace CalamityMod.Items.Accessories { @@ -14,7 +18,6 @@ namespace CalamityMod.Items.Accessories Item.height = 56; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 4; // This should have less defense due to the regen it provides Item.accessory = true; } @@ -22,18 +25,13 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.regenator = true; + player.longInvince = true; // Gives better iframes because god help you if you end up getting hit twice + } - //Hard-lock the player's health to 50%. - //No lifesteal, no regen, no healing pots - if (player.statLife >= (int)(player.statLifeMax2 * 0.5f)) - { - player.statLife = (int)(player.statLifeMax2 * 0.5f); - player.moonLeech = true; - modPlayer.healingPotionMultiplier = 0; - - if (player.lifeRegenCount > 0) - player.lifeRegenCount = 0; - } + public override void ModifyTooltips(List list) + { + if (Main.LocalPlayer != null) + list.FindAndReplace("[DAMAGE]", (Main.LocalPlayer.Calamity().regenatorDamage).ToPercent()); } } } diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index d2f21afb82..e92c7f11de 100644 --- a/Items/Accessories/RoseStone.cs +++ b/Items/Accessories/RoseStone.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Items.Accessories public class RoseStone : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public static int ElementalDamage = 60; + public override void SetDefaults() { Item.width = 20; @@ -44,12 +46,11 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { // 08DEC2023: Ozzatron: Brimstone Elementals spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(60); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(ElementalDamage); int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 2f, Main.myPlayer, 0f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } } } @@ -68,12 +69,11 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { // 08DEC2023: Ozzatron: Brimstone Elementals spawned with... Hold on a second. Why the fuck are we doing damage calculations when the accessory is in vanity?! - int baseDamage = player.ApplyArmorAccDamageBonusesTo(60); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(ElementalDamage); int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 2f, Main.myPlayer, 0f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ElementalDamage; } } } diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index 783cdf7762..8f2dd3ad50 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -20,28 +20,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.immune) - { - var source = player.GetSource_Accessory(Item); - if (player.miscCounter % 6 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int damage = (int)player.GetBestClassDamage().ApplyTo(18); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - - Projectile rain = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 2f, player.whoAmI); - if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) - { - rain.DamageType = DamageClass.Generic; - rain.tileCollide = false; - rain.penetrate = 1; - } - } - } - } CalamityPlayer modPlayer = player.Calamity(); modPlayer.rBrain = true; + player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index f2669eef54..387cfa5b86 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -31,32 +31,36 @@ namespace CalamityMod.Items.Accessories public static int ShieldDefenseBoost = 10; // Interface stuff. + public int OwnerPlayer { get; set; } public float RenderDepth => IDyeableShaderRenderer.RoverDriveDepth; public bool ShouldDrawDyeableShader { get { - bool result = false; - foreach (Player player in Main.ActivePlayers) - { - if (player.outOfRange || player.dead) - continue; + if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f) + return false; - CalamityPlayer modPlayer = player.Calamity(); + if (OwnerPlayer < 0 || OwnerPlayer >= Main.maxPlayers) + return false; - // Do not render the shield if its visibility is off (or it does not exist) - bool isVanityOnly = modPlayer.roverDriveShieldVisible && !modPlayer.roverDrive; - bool shieldExists = isVanityOnly || modPlayer.RoverDriveShieldDurability > 0; - bool shouldntDraw = (!modPlayer.roverDriveShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists); - result |= !shouldntDraw; - } - return result; + var player = Main.player[OwnerPlayer]; + if (player is null) + return false; + + if (player.outOfRange || player.dead) + return false; + + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.drawingParameters.RoverShieldCharge <= 0.0f) + return false; + + return true; } } // Allows item to be extractinated and specifies custom behavior instead of copying an existing item - public override void SetStaticDefaults() => ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; + public override void SetStaticDefaults() => ItemID.Sets.ExtractinatorMode[Type] = Item.type; public override void SetDefaults() { @@ -105,88 +109,68 @@ namespace CalamityMod.Items.Accessories // This is applied as IL (On hook) which draws right before Inferno Ring. public void DrawDyeableShader(SpriteBatch spriteBatch) { - // TODO -- Control flow analysis indicates that this hook is not stable. - // Rover Drive shields will be drawn for each player with Rover Drive, yes. - // But there is no guarantee that the shields will be in the right condition for each player. - // Visibility is not net synced, for example. - bool alreadyDrawnShieldForPlayer = false; + if (OwnerPlayer < 0 || OwnerPlayer >= Main.maxPlayers) + return; - foreach (Player player in Main.ActivePlayers) + var player = Main.player[OwnerPlayer]; + if (player is null) + return; + + if (player.outOfRange || player.dead) + return; + + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.drawnAnyShieldThisFrame) + return; + + if (modPlayer.drawingParameters.RoverShieldCharge <= 0.0f) + return; + + // The shield very gently grows and shrinks + float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + player.whoAmI * 0.2f)); + // If in vanity, the shield is always projected as if it's at full strength. + float shieldStrength = modPlayer.drawingParameters.RoverShieldCharge; + + // Noise scale also grows and shrinks, although out of sync with the shield + float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); + + // Define shader parameters + Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; + shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f); + shieldEffect.Parameters["blowUpPower"].SetValue(2.5f); + shieldEffect.Parameters["blowUpSize"].SetValue(0.5f); + shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); + + // Shield opacity multiplier slightly changes, this is independent of current shield strength + float baseShieldOpacity = 0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f); + float finalShieldOpacity = baseShieldOpacity * (0.5f + 0.5f * shieldStrength); + finalShieldOpacity *= CalamityClientConfig.Instance.EnergyShieldOpacity; + + shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); + shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); + + // Get the shield color. + Color blueTint = new Color(51, 102, 255); + Color cyanTint = new Color(71, 202, 255); + 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()); + shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + + Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, Matrix.Identity, () => { - if (player.outOfRange || player.dead) - continue; - - CalamityPlayer modPlayer = player.Calamity(); - - // Do not render the shield if its visibility is off (or it does not exist) - bool isVanityOnly = modPlayer.roverDriveShieldVisible && !modPlayer.roverDrive; - bool shieldExists = isVanityOnly || modPlayer.RoverDriveShieldDurability > 0; - if (!modPlayer.roverDriveShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists) - continue; - - // The shield very gently grows and shrinks - float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + player.whoAmI * 0.2f)); - - if (!alreadyDrawnShieldForPlayer) - { - // If in vanity, the shield is always projected as if it's at full strength. - float shieldStrength = 1f; - if (!isVanityOnly) - { - // Again, I believe there is no way this looks correct when two players have Rover Drive equipped. - CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity(); - float shieldDurabilityRatio = localModPlayer.RoverDriveShieldDurability / (float)ShieldDurabilityMax; - shieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); - } - - // Noise scale also grows and shrinks, although out of sync with the shield - float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); - - // Define shader parameters - Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; - shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f); - shieldEffect.Parameters["blowUpPower"].SetValue(2.5f); - shieldEffect.Parameters["blowUpSize"].SetValue(0.5f); - shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); - - // Shield opacity multiplier slightly changes, this is independent of current shield strength - float baseShieldOpacity = 0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f); - shieldEffect.Parameters["shieldOpacity"].SetValue(baseShieldOpacity * (0.5f + 0.5f * shieldStrength)); - shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - - // Get the shield color. - Color blueTint = new Color(51, 102, 255); - Color cyanTint = new Color(71, 202, 255); - 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()); - shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); - - // GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); - - } - - alreadyDrawnShieldForPlayer = true; - modPlayer.drawnAnyShieldThisFrame = true; - // Fetch shield noise overlay texture (this is the techy overlay fed to the shader) NoiseTex ??= ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/TechyNoise"); Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition; Texture2D tex = NoiseTex.Value; spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); - } + }); - if (alreadyDrawnShieldForPlayer) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); - } + modPlayer.drawnAnyShieldThisFrame = true; } } } diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 4f7c014cc6..b7d0e8f3a1 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,14 +29,5 @@ namespace CalamityMod.Items.Accessories modPlayer.RustyMedallionDroplets = true; player.buffImmune[ModContent.BuffType()] = true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(20). - AddRecipeGroup("AnySilverBar", 10). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index 9097563d19..d4188317bb 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -7,8 +7,6 @@ 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() { @@ -17,14 +15,10 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; - Item.defense = 2; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SandCloakHotkey); - public override void UpdateAccessory(Player player, bool hideVisual) { - player.moveSpeed += 0.05f; player.Calamity().sandCloak = true; } } diff --git a/Items/Accessories/ScuttlersJewel.cs b/Items/Accessories/ScuttlersJewel.cs index 5a24199168..e42197a607 100644 --- a/Items/Accessories/ScuttlersJewel.cs +++ b/Items/Accessories/ScuttlersJewel.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() { - ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; + ItemID.Sets.ExtractinatorMode[Type] = Item.type; } public override void SetDefaults() diff --git a/Items/Accessories/AbyssalAmulet.cs b/Items/Accessories/SeaSpiritAmulet.cs similarity index 78% rename from Items/Accessories/AbyssalAmulet.cs rename to Items/Accessories/SeaSpiritAmulet.cs index e060bee4ed..74f6b94a0c 100644 --- a/Items/Accessories/AbyssalAmulet.cs +++ b/Items/Accessories/SeaSpiritAmulet.cs @@ -6,8 +6,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [LegacyName("AbyssalAmulet")] [AutoloadEquip(EquipType.Neck)] - public class AbyssalAmulet : ModItem, ILocalizedModType + public class SeaSpiritAmulet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() @@ -22,8 +23,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.abyssalAmulet = true; - player.buffImmune[ModContent.BuffType()] = true; + modPlayer.sSpiritAmulet = true; + modPlayer.sSpiritAmuletVisual = !hideVisual; } } } diff --git a/Items/Accessories/AbyssalAmulet.png b/Items/Accessories/SeaSpiritAmulet.png similarity index 100% rename from Items/Accessories/AbyssalAmulet.png rename to Items/Accessories/SeaSpiritAmulet.png diff --git a/Items/Accessories/AbyssalAmulet_Neck.png b/Items/Accessories/SeaSpiritAmulet_Neck.png similarity index 100% rename from Items/Accessories/AbyssalAmulet_Neck.png rename to Items/Accessories/SeaSpiritAmulet_Neck.png diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 9db1a74924..cacb484ead 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -1,6 +1,10 @@ -using CalamityMod.Items.Armor.Victide; -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -9,40 +13,115 @@ namespace CalamityMod.Items.Accessories public class ShieldoftheOcean : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public static readonly SoundStyle TriggerSound = new("CalamityMod/Sounds/Custom/MossMine"); + public static readonly SoundStyle ParrySound = new("CalamityMod/Sounds/Custom/BubbleCracklePop"); + public static readonly SoundStyle ParrySoundGFB = new("CalamityMod/Sounds/Custom/GFB/OceanShieldParryGFB"); + public const int ParryTime = 30; + // These damage values scale in Expert and Master. + public const int ShoveFallBaseDamage = 80; + public const int ImmuneToShoveBaseDamage = 200; + public override void SetDefaults() { Item.width = 24; Item.height = 28; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 2; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey); public override void UpdateAccessory(Player player, bool hideVisual) { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + player.Calamity().shieldOfTheOcean = true; + } + + public static void HandleParryCountdown(Player player) + { + player.Calamity().shieldOfTheOceanParry--; + + if (player.Calamity().shieldOfTheOceanParry > 0) { - player.statDefense += 5; - } - // Accessory update comes before set bonus for some reason, so this has to be done - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - player.moveSpeed += 0.1f; - player.lifeRegen += 2; + player.controlJump = false; + player.controlDown = false; + player.controlLeft = false; + player.controlRight = false; + player.controlUp = false; + player.controlUseItem = false; + player.controlUseTile = false; + player.controlThrow = false; + player.gravDir = 1f; + player.velocity = Vector2.Zero; + player.velocity.Y = -0.1f; // Ensure Y velocity is not 0, otherwise the flight meter gets reset. + player.RemoveAllGrapplingHooks(); } } - public override void AddRecipes() + // GFB changes: + // Different sound when parrying. + // Larger radius for pushing away enemies. + // Enemies are pushed much faster. + // Damage is multiplied by 10. + public static void ActivateParry(Player player) { - CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.Starfish, 5). - AddTile(TileID.Anvils). - Register(); + bool empowered = player.Calamity().shieldOfTheOceanEmpoweredParry; + + // Search for every NPC within a certain radius of the player. + foreach (NPC npc in Main.ActiveNPCs) + { + if (Vector2.Distance(player.Center, npc.Center) > (Main.zenithWorld ? 720f : 240f)) + continue; + + // Inflict Riptide on empowered parries. + if (empowered) + npc.AddBuff(ModContent.BuffType(), 300); + + // If the NPC can be moved, violently shove them away. Make them susceptible to fall damage on empowered parries. + // Otherwise, simply deal a large amount of damage to them if empowered. + if (npc.CanBeMoved(true)) + { + // The NPC has to actually have its velocity changed, because TileCollisionHarmNPC only changes its position. Not confusing at all! + Vector2 shoveVelocity = Utils.DirectionTo(player.Center, npc.Center) * (Main.zenithWorld ? 35f : 12.5f) - Vector2.UnitY * 6f; + npc.MoveNPC(Vector2.Normalize(shoveVelocity), shoveVelocity.Length(), true); + + int scaledFallDamage = ShoveFallBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1); + if (empowered) + npc.FlungNPC().ApplyCollisionDamage(npc, player, scaledFallDamage, shoveVelocity * 0.5f, 5f, true); + else + npc.FlungNPC().ApplyForcedVelocity(npc, player, shoveVelocity * 0.5f, true); + + for (int i = -1; i <= 1; i++) + { + Vector2 particleVel = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.Pi / 6f * i) * 7.5f; + WaterFlavoredParticle pushHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue); + GeneralParticleHandler.SpawnParticle(pushHit); + } + } + else + { + if (empowered) + { + int scaledImmuneDamage = ImmuneToShoveBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1); + Projectile.NewProjectile(player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), scaledImmuneDamage, 0f, player.whoAmI, npc.whoAmI); + } + + float randOffset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 6; i++) + { + Vector2 particleVel = Vector2.UnitX.RotatedBy(MathHelper.Pi / 3f * i + randOffset) * 7.5f; + WaterFlavoredParticle bigHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue); + GeneralParticleHandler.SpawnParticle(bigHit); + } + } + } + player.Calamity().shieldOfTheOceanEmpoweredParry = false; + + for (int b = 0; b < 20; b++) + { + Vector2 waterVel = Vector2.UnitX.RotatedBy(MathHelper.TwoPi / 15f * b) * Main.rand.NextFloat(12f, 24f); + WaterFoamParticle sorryToBurstYourBubble = new(player.Center, waterVel, 15, 0.6f, Color.Blue); + GeneralParticleHandler.SpawnParticle(sorryToBurstYourBubble); + } } } } diff --git a/Items/Accessories/SlagsplitterPauldron.cs b/Items/Accessories/SlagsplitterPauldron.cs index 5180da893b..57f9ef5984 100644 --- a/Items/Accessories/SlagsplitterPauldron.cs +++ b/Items/Accessories/SlagsplitterPauldron.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Crags; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories public class SlagsplitterPauldron : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - + public static int PauldronSlamDamage = 170; public override void SetDefaults() { Item.width = 54; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(12). - AddIngredient(3). + AddIngredient(4). AddIngredient(8). AddTile(TileID.Anvils). Register(); diff --git a/Items/Accessories/SpiritGlyph.cs b/Items/Accessories/SpiritGlyph.cs index 2f7f12d2cb..2d1d84ad2f 100644 --- a/Items/Accessories/SpiritGlyph.cs +++ b/Items/Accessories/SpiritGlyph.cs @@ -9,6 +9,12 @@ namespace CalamityMod.Items.Accessories public class SpiritGlyph : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; + + public static int RegenBoost = 2; + public static int DefenseBoost = 6; + public static float DamageReductionBoost = 0.03f; + public static float SummonDamageBoost = 0.1f; + public override void SetDefaults() { Item.width = 24; diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index eb6eb0c6b2..804eaeac5d 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; CalamityPlayer modPlayer = player.Calamity(); @@ -179,10 +179,6 @@ namespace CalamityMod.Items.Accessories TwoPlaces(60f * player.GetStandingStealthRegen()), TwoPlaces(60f * player.GetMovingStealthRegen()), Sign(rogueVelocity) + TwoPlaces(100f * rogueVelocity)); - - // Rogue consumable chance only if item is consumable - if (heldItem.consumable) - stats2 += this.GetLocalization("RogueConsumption").Format(100f * modPlayer.rogueAmmoCost); } // If tool, add tool range diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index a08ba8d9a7..153d639c83 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.PygmyNecklace). AddIngredient(ItemID.SummonerEmblem). AddIngredient(ItemID.HolyWater, 30). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 6039acb7ca..3b5dca0d99 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer.Dashes; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -28,12 +30,18 @@ namespace CalamityMod.Items.Accessories { player.autoJump = true; player.jumpSpeedBoost += 1.6f; - player.extraFall += 35; + player.noFallDmg = true; player.blackBelt = true; - player.dashType = 1; - player.Calamity().DashID = string.Empty; + player.dashType = 0; + player.Calamity().DashID = StatisNinjaBeltDash.ID; player.spikedBoots = 2; player.accFlipper = true; + player.hasMagiluminescence = true; + + player.MountedCenter.ToTileCoordinates(); + DelegateMethods.v3_1 = new Vector3(0.8f, 0.5f, 1f); + Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 20f, DelegateMethods.CastLightOpen); + Utils.PlotTileLine(player.Left, player.Right, 20f, DelegateMethods.CastLightOpen); } public override void AddRecipes() @@ -43,6 +51,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.MasterNinjaGear). AddIngredient(ItemID.FrogFlipper). + AddIngredient(ItemID.Magiluminescence). AddIngredient(50). AddIngredient(5). AddTile(TileID.LunarCraftingStation). @@ -52,6 +61,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.Tabi). AddIngredient(ItemID.BlackBelt). AddIngredient(ItemID.FrogGear). + AddIngredient(ItemID.Magiluminescence). AddIngredient(50). AddIngredient(5). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index 8760d9bb52..f68a1bc362 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -42,6 +42,13 @@ namespace CalamityMod.Items.Accessories modPlayer.DashID = StatisVoidSashDash.ID; player.dashType = 0; player.spikedBoots = 2; + player.accFlipper = true; + player.hasMagiluminescence = true; + + player.MountedCenter.ToTileCoordinates(); + DelegateMethods.v3_1 = new Vector3(0.8f, 0.5f, 1f); + Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 20f, DelegateMethods.CastLightOpen); + Utils.PlotTileLine(player.Left, player.Right, 20f, DelegateMethods.CastLightOpen); } public override void AddRecipes() diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index bf385bc526..5c1034b6db 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.fishingSkill += 80; + player.fishingSkill += 50; player.accFishingLine = true; player.accTackleBox = true; player.accLavaFishing = true; diff --git a/Items/Accessories/TeslasAmulet.cs b/Items/Accessories/TeslasAmulet.cs new file mode 100644 index 0000000000..49bc23ce47 --- /dev/null +++ b/Items/Accessories/TeslasAmulet.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class TeslasAmulet : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 12)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 34; + Item.height = 32; + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().tesla = true; + player.Calamity().teslaVisuals = !hideVisual; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddIngredient(8). + AddIngredient(4). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Accessories/TeslasAmulet.png b/Items/Accessories/TeslasAmulet.png new file mode 100644 index 0000000000..5c31e04661 Binary files /dev/null and b/Items/Accessories/TeslasAmulet.png differ diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 7a4ee85420..2b2e35e978 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,6 +10,18 @@ namespace CalamityMod.Items.Accessories public class TheAbsorber : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float MoveSpeedBoost = 0.12f; + public static float JumpSpeedBoost = 0.6f; // Both 12% so we only need just one in the tooltip + public static float ThornsBoost = 3.5f; + public static int AuraLifetime = 1800; + public static int AuraRegenBoost = 6; + public static float AuraDamageBoost = 0.08f; + public static float AuraDamageReductionBoost = 0.05f; + public static float DamageTakenHealedPercent = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), AuraLifetime.FramesToSeconds(), + AuraRegenBoost.ToRegenPerSecond(), AuraDamageBoost.ToPercent(), AuraDamageReductionBoost.ToPercent(), DamageTakenHealedPercent.ToPercent()); + public override void SetDefaults() { Item.width = 20; diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 066b87b52e..a799be70a3 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -12,7 +12,6 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Accessories { - // TODO -- this item includes a dodge accessory, Brain of Cthulhu public class TheAmalgam : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; @@ -34,40 +33,22 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.amalgam = true; player.brainOfConfusionItem = Item; player.GetDamage() += 0.15f; - - if (player.immune) - { - var source = player.GetSource_Accessory(Item); - if (player.miscCounter % 6 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int damage = (int)player.GetBestClassDamage().ApplyTo(300); - Projectile rain = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileType(), damage, 2f, player.whoAmI); - if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) - { - rain.DamageType = DamageClass.Generic; - rain.tileCollide = false; - rain.penetrate = 1; - } - } - } - } } public override void AddRecipes() { CreateRecipe(). AddIngredient(). + AddIngredient(5). + AddIngredient(4). AddIngredient(5). AddIngredient(10). AddIngredient(15). AddIngredient(15). - AddIngredient(5). - AddIngredient(4). AddTile(). Register(); } diff --git a/Items/Accessories/TheBee.cs b/Items/Accessories/TheBee.cs index 71dd921abe..ae4a4bc5c4 100644 --- a/Items/Accessories/TheBee.cs +++ b/Items/Accessories/TheBee.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Items.Accessories { public class TheBee : ModItem, ILocalizedModType { - public static int CooldownLength = 600; + public static int CooldownLength = 360; public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index 1d77244faf..b6f793c7e2 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Accessories if (npc.IsAnEnemy() && !npc.dontTakeDamage && Vector2.Distance(player.Center, npc.Center) <= range) { int campingFireDamage = (int)player.GetBestClassDamage().ApplyTo(Main.rand.Next(20, 41)); - Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), campingFireDamage, 0f, player.whoAmI, npc.whoAmI); + Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), campingFireDamage, 0f, player.whoAmI, npc.whoAmI); } } } diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index a58d372c0b..e6e56b2c1d 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -40,27 +40,31 @@ namespace CalamityMod.Items.Accessories public static int ShieldActiveDefense = 30; public static float ShieldActiveDamageReduction = 0.1f; + public int OwnerPlayer { get; set; } public float RenderDepth => IDyeableShaderRenderer.SpongeShieldDepth; public bool ShouldDrawDyeableShader { get { - bool result = false; - foreach (Player player in Main.ActivePlayers) - { - if (player.outOfRange || player.dead) - continue; + if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f) + return false; - CalamityPlayer modPlayer = player.Calamity(); + if (OwnerPlayer < 0 || OwnerPlayer >= Main.maxPlayers) + return false; - // Do not render the shield if its visibility is off (or it does not exist) - bool isVanityOnly = modPlayer.spongeShieldVisible && !modPlayer.sponge; - bool shieldExists = isVanityOnly || modPlayer.SpongeShieldDurability > 0; - bool shouldntDraw = !modPlayer.spongeShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists; - result |= !shouldntDraw; - } - return result; + var player = Main.player[OwnerPlayer]; + if (player is null) + return false; + + if (player.outOfRange || player.dead) + return false; + + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.drawingParameters.SpongeShieldCharge <= 0.0f) + return false; + + return true; } } @@ -108,7 +112,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[Type].GetFrame(tex), Color.Cyan * 0.5f, 0f, new Vector2(tex.Width / 2f, (tex.Height / 30f) * 0.8f), 1f, SpriteEffects.None, 0); } } @@ -144,7 +148,7 @@ namespace CalamityMod.Items.Accessories spriteBatch, texture: tex, position, - Main.itemAnimations[Item.type].GetFrame(tex), + Main.itemAnimations[Type].GetFrame(tex), Color.Cyan * 0.4f, itemColor, origin, @@ -171,97 +175,75 @@ namespace CalamityMod.Items.Accessories // This is applied as IL (On hook) which draws right before Inferno Ring. public void DrawDyeableShader(SpriteBatch spriteBatch) { - // TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive). - // Sponge shields will be drawn for each player with the Sponge equipped, yes. - // But there is no guarantee that the shields will be in the right condition for each player. - // Visibility is not net synced, for example. - bool alreadyDrawnShieldForPlayer = false; + if (OwnerPlayer < 0 || OwnerPlayer >= Main.maxPlayers) + return; - foreach (Player player in Main.ActivePlayers) + var player = Main.player[OwnerPlayer]; + if (player is null) + return; + + if (player.outOfRange || player.dead) + return; + + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.drawnAnyShieldThisFrame) + return; + + if (modPlayer.drawingParameters.SpongeShieldCharge <= 0.0f) + return; + + // Scale the shield is drawn at. The Sponge shield gently grows and shrinks; it should be largely imperceptible. + // The "i" parameter is to make different player's shields not be perfectly synced. + int i = player.whoAmI; + float baseScale = 0.155f; + float maxExtraScale = 0.025f; + float extraScalePulseInterpolant = MathF.Pow(4f, MathF.Sin(Main.GlobalTimeWrappedHourly * 0.791f + i) - 1); + float scale = baseScale + maxExtraScale * extraScalePulseInterpolant; + float visualShieldStrength = modPlayer.drawingParameters.SpongeShieldCharge; + + // The scale used for the noise overlay 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.15f or higher than 0.75f. The higher it is, the denser / more zoomed out the noise overlay is. + // Changing this too quickly and/or too much makes the noise grow and shrink visibly, so be careful with that. + float noiseScale = MathHelper.Lerp(0.28f, 0.38f, 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.347f + i)); + + // Define shader parameters + Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; + shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.0813f); // Scrolling speed of polygonal overlay + shieldEffect.Parameters["blowUpPower"].SetValue(3f); + shieldEffect.Parameters["blowUpSize"].SetValue(0.56f); + shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); + + // Shield opacity multiplier slightly changes, this is independent of current shield strength + float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f); + float minShieldStrengthOpacityMultiplier = 0.25f; + float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength); + finalShieldOpacity *= CalamityClientConfig.Instance.EnergyShieldOpacity; + + shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); + shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); + + Color shieldColor = new Color(24, 156, 204); // #189CCC + Color primaryEdgeColor = shieldColor; + Color secondaryEdgeColor = new Color(34, 224, 227); // #22E0E3 + + // Final shield edge color, which lerps about + Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor); + + // Define shader parameters for shield color + shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); + shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + + Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, Matrix.Identity, () => { - if (player.outOfRange || player.dead) - continue; - - CalamityPlayer modPlayer = player.Calamity(); - - // Do not render the shield if its visibility is off (or it does not exist) - bool isVanityOnly = modPlayer.spongeShieldVisible && !modPlayer.sponge; - bool shieldExists = isVanityOnly || modPlayer.SpongeShieldDurability > 0; - if (!modPlayer.spongeShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists) - continue; - - // Scale the shield is drawn at. The Sponge shield gently grows and shrinks; it should be largely imperceptible. - // The "i" parameter is to make different player's shields not be perfectly synced. - int i = player.whoAmI; - float baseScale = 0.155f; - float maxExtraScale = 0.025f; - float extraScalePulseInterpolant = MathF.Pow(4f, MathF.Sin(Main.GlobalTimeWrappedHourly * 0.791f + i) - 1); - float scale = baseScale + maxExtraScale * extraScalePulseInterpolant; - - if (!alreadyDrawnShieldForPlayer) - { - // If in vanity, the shield is always projected as if it's at full strength. - float visualShieldStrength = 1f; - if (!isVanityOnly) - { - // Again, I believe there is no way this looks correct when two players have The Sponge equipped. - CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity(); - float shieldDurabilityRatio = localModPlayer.SpongeShieldDurability / (float)ShieldDurabilityMax; - visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); - } - - // The scale used for the noise overlay 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.15f or higher than 0.75f. The higher it is, the denser / more zoomed out the noise overlay is. - // Changing this too quickly and/or too much makes the noise grow and shrink visibly, so be careful with that. - float noiseScale = MathHelper.Lerp(0.28f, 0.38f, 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.347f + i)); - - // Define shader parameters - Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; - shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.0813f); // Scrolling speed of polygonal overlay - shieldEffect.Parameters["blowUpPower"].SetValue(3f); - shieldEffect.Parameters["blowUpSize"].SetValue(0.56f); - shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); - - // Shield opacity multiplier slightly changes, this is independent of current shield strength - float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f); - float minShieldStrengthOpacityMultiplier = 0.25f; - float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength); - shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); - shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - - Color shieldColor = new Color(24, 156, 204); // #189CCC - Color primaryEdgeColor = shieldColor; - Color secondaryEdgeColor = new Color(34, 224, 227); // #22E0E3 - - // Final shield edge color, which lerps about - Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor); - - // Define shader parameters for shield color - shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); - shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); - - // GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS - // yes I copy pasted that comment, I hate end begin that much - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); - } - - alreadyDrawnShieldForPlayer = true; - modPlayer.drawnAnyShieldThisFrame = true; - // Fetch shield noise overlay texture (this is the polygons fed to the shader) NoiseTex ??= ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons"); Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition; Texture2D tex = NoiseTex.Value; Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); - } + }); - if (alreadyDrawnShieldForPlayer) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); - } + modPlayer.drawnAnyShieldThisFrame = true; } } } diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index 6504109afd..eb41891dc2 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -1,4 +1,9 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -6,24 +11,31 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Accessories { public class TheTransformer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void ModifyTooltips(List list) + { + list.IntegrateHotkey(CalamityKeybinds.TransformerHotKey); + list.FindAndReplace("[GFB]", Lang.SupportGlyphs(this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"))); + } public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 16)); ItemID.Sets.AnimatesAsSoul[Type] = true; } - + public static int blobCap = 30; + public static int blobDamage = 50; public override void SetDefaults() { Item.width = 42; Item.height = 56; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; Item.accessory = true; } @@ -31,10 +43,27 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.transformer = true; - modPlayer.aSpark = true; - player.Calamity().eleResist = true; - } + modPlayer.transformerVisual = !hideVisual; + if (player.ownedProjectileCounts[ProjectileType()] < 1 && !hideVisual && !player.dead && player.Calamity().transformerCooldown == 0) + { + Projectile light = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + } + + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddRecipeGroup("AnyMythrilBar", 5). + AddIngredient(2). + AddIngredient(2). + AddIngredient(2). + AddIngredient(ItemID.SoulofNight, 3). + AddIngredient(ItemID.SoulofLight, 3). + AddTile(TileID.MythrilAnvil). + Register(); + } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { CalamityUtils.DrawInventoryCustomScale( diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index ca3e9c0e5a..97daa1e8cb 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.toxicHeart = true; + modPlayer.toxicHeartVisuals = !hideVisual; } } } diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs index 5e8b8ae18d..32ca98b5e7 100644 --- a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs +++ b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet", EquipType.Head, name: "WulfrumOldSetHead"); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Body", EquipType.Body, this); @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.cs b/Items/Accessories/Vanity/CrystalHeartVodka.cs index 880b01da73..ada7c260f7 100644 --- a/Items/Accessories/Vanity/CrystalHeartVodka.cs +++ b/Items/Accessories/Vanity/CrystalHeartVodka.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Body", EquipType.Body, this); @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); @@ -41,8 +41,8 @@ namespace CalamityMod.Items.Accessories.Vanity 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); + // Same as Cirrus' Vodka, due to the obtainment method being shimmering Cirrus' Vodka. + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; Item.vanity = true; diff --git a/Items/Accessories/Vanity/Dandy_Body.png b/Items/Accessories/Vanity/Dandy_Body.png index d6778db86e..fda1266492 100644 Binary files a/Items/Accessories/Vanity/Dandy_Body.png and b/Items/Accessories/Vanity/Dandy_Body.png differ diff --git a/Items/Accessories/Vanity/Dandy_Head.png b/Items/Accessories/Vanity/Dandy_Head.png index b107474d18..d4c6b152c1 100644 Binary files a/Items/Accessories/Vanity/Dandy_Head.png and b/Items/Accessories/Vanity/Dandy_Head.png differ diff --git a/Items/Accessories/Vanity/Dandy_Legs.png b/Items/Accessories/Vanity/Dandy_Legs.png index 364147d83b..920dbde177 100644 Binary files a/Items/Accessories/Vanity/Dandy_Legs.png and b/Items/Accessories/Vanity/Dandy_Legs.png differ diff --git a/Items/Accessories/Vanity/GhostBracelet.cs b/Items/Accessories/Vanity/GhostBracelet.cs index f2a118bcc6..18bb48b9c6 100644 --- a/Items/Accessories/Vanity/GhostBracelet.cs +++ b/Items/Accessories/Vanity/GhostBracelet.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Body", EquipType.Body, this); @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Silk, 5). + AddIngredient(ItemID.Silk, 20). AddTile(TileID.Loom). Register(); } diff --git a/Items/Accessories/Vanity/GoldenBomb.cs b/Items/Accessories/Vanity/GoldenBomb.cs new file mode 100644 index 0000000000..cef27a6ceb --- /dev/null +++ b/Items/Accessories/Vanity/GoldenBomb.cs @@ -0,0 +1,80 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class GoldenBomb : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public override void Load() + { + if (!Main.dedServ) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mihaii_Head", EquipType.Head, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mihaii_Body", EquipType.Body, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mihaii_Legs", EquipType.Legs, this); + } + } + + public override void SetStaticDefaults() + { + if (Main.dedServ) + 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 = 42; + Item.height = 38; + Item.accessory = true; + Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + 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 GoldenBombPlayer : ModPlayer + { + public bool vanityEquipped = false; + + public override void ResetEffects() + { + vanityEquipped = false; + } + + public override void FrameEffects() + { + if (vanityEquipped) + { + Player.legs = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Legs); + Player.body = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Body); + Player.head = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Head); + } + } + } +} diff --git a/Items/Accessories/Vanity/GoldenBomb.png b/Items/Accessories/Vanity/GoldenBomb.png new file mode 100644 index 0000000000..32f5ee42a6 Binary files /dev/null and b/Items/Accessories/Vanity/GoldenBomb.png differ diff --git a/Items/Accessories/Vanity/HapuFruit.cs b/Items/Accessories/Vanity/HapuFruit.cs index 30f2a7fefa..65b1948303 100644 --- a/Items/Accessories/Vanity/HapuFruit.cs +++ b/Items/Accessories/Vanity/HapuFruit.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Body", EquipType.Body, this); @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); diff --git a/Items/Accessories/Vanity/Heart_Back.png b/Items/Accessories/Vanity/Heart_Back.png index 8b34672719..35cbd573a0 100644 Binary files a/Items/Accessories/Vanity/Heart_Back.png and b/Items/Accessories/Vanity/Heart_Back.png differ diff --git a/Items/Accessories/Vanity/Heart_Body.png b/Items/Accessories/Vanity/Heart_Body.png index fdb8b237ea..ecb76a5571 100644 Binary files a/Items/Accessories/Vanity/Heart_Body.png and b/Items/Accessories/Vanity/Heart_Body.png differ diff --git a/Items/Accessories/Vanity/Heart_Head.png b/Items/Accessories/Vanity/Heart_Head.png index f3f4aef15f..5d156957f6 100644 Binary files a/Items/Accessories/Vanity/Heart_Head.png and b/Items/Accessories/Vanity/Heart_Head.png differ diff --git a/Items/Accessories/Vanity/Heart_Legs.png b/Items/Accessories/Vanity/Heart_Legs.png index b1d0e1de5f..baa2e97cf6 100644 Binary files a/Items/Accessories/Vanity/Heart_Legs.png and b/Items/Accessories/Vanity/Heart_Legs.png differ diff --git a/Items/Accessories/Vanity/Mihaii_Body.png b/Items/Accessories/Vanity/Mihaii_Body.png new file mode 100644 index 0000000000..7685fe5642 Binary files /dev/null and b/Items/Accessories/Vanity/Mihaii_Body.png differ diff --git a/Items/Accessories/Vanity/Mihaii_Head.png b/Items/Accessories/Vanity/Mihaii_Head.png new file mode 100644 index 0000000000..2178e192f4 Binary files /dev/null and b/Items/Accessories/Vanity/Mihaii_Head.png differ diff --git a/Items/Accessories/Vanity/Mihaii_Legs.png b/Items/Accessories/Vanity/Mihaii_Legs.png new file mode 100644 index 0000000000..7ba85da711 Binary files /dev/null and b/Items/Accessories/Vanity/Mihaii_Legs.png differ diff --git a/Items/Accessories/Vanity/OracleHeadphones.cs b/Items/Accessories/Vanity/OracleHeadphones.cs index b6997d3609..47645f8084 100644 --- a/Items/Accessories/Vanity/OracleHeadphones.cs +++ b/Items/Accessories/Vanity/OracleHeadphones.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Body", EquipType.Body, this); @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); diff --git a/Items/Accessories/Vanity/Popo.cs b/Items/Accessories/Vanity/Popo.cs index f78f57563a..66fe6d0f3c 100644 --- a/Items/Accessories/Vanity/Popo.cs +++ b/Items/Accessories/Vanity/Popo.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Popo_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/PopoNoseless_Head", EquipType.Head, name: "PopoNoseless"); @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Accessories/Vanity/PunchCard.cs b/Items/Accessories/Vanity/PunchCard.cs new file mode 100644 index 0000000000..40ac2b7d48 --- /dev/null +++ b/Items/Accessories/Vanity/PunchCard.cs @@ -0,0 +1,70 @@ +using CalamityMod.UI; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class PunchCard : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public override void Load() + { + if (!Main.dedServ) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Head", EquipType.Head, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Body", EquipType.Body, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Legs", EquipType.Legs, this); + } + } + + public override void SetStaticDefaults() + { + if (Main.dedServ) + 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 = 42; + Item.height = 38; + Item.accessory = true; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.vanity = true; + Item.Calamity().devItem = true; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + } + + public override bool? UseItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + PopupGUIManager.FlipActivityOfGUIWithType(typeof(PunchCardGUI)); + return true; + } + + public override void UpdateVanity(Player player) + { + player.Calamity().punchCard = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (!hideVisual) + { + player.Calamity().punchCard = true; + } + } + } +} diff --git a/Items/Accessories/Vanity/PunchCard.png b/Items/Accessories/Vanity/PunchCard.png new file mode 100644 index 0000000000..51e56a5319 Binary files /dev/null and b/Items/Accessories/Vanity/PunchCard.png differ diff --git a/Items/Accessories/Vanity/Shark_Body.png b/Items/Accessories/Vanity/Shark_Body.png new file mode 100644 index 0000000000..432dcbe76d Binary files /dev/null and b/Items/Accessories/Vanity/Shark_Body.png differ diff --git a/Items/Accessories/Vanity/Shark_Head.png b/Items/Accessories/Vanity/Shark_Head.png new file mode 100644 index 0000000000..da97adaba8 Binary files /dev/null and b/Items/Accessories/Vanity/Shark_Head.png differ diff --git a/Items/Accessories/Vanity/Shark_Legs.png b/Items/Accessories/Vanity/Shark_Legs.png new file mode 100644 index 0000000000..dadb0ee1fc Binary files /dev/null and b/Items/Accessories/Vanity/Shark_Legs.png differ diff --git a/Items/Accessories/Vanity/SharkyPlush.cs b/Items/Accessories/Vanity/SharkyPlush.cs new file mode 100644 index 0000000000..77efd68e44 --- /dev/null +++ b/Items/Accessories/Vanity/SharkyPlush.cs @@ -0,0 +1,82 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class SharkyPlush : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override void Load() + { + if (!Main.dedServ) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shark_Head", EquipType.Head, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shark_Body", EquipType.Body, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shark_Legs", EquipType.Legs, this); + } + } + + public override void SetStaticDefaults() + { + if (Main.dedServ) + 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 = 38; + Item.height = 24; + Item.accessory = true; + Item.vanity = true; + Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + 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 SharkyPlushPlayer : ModPlayer + { + public bool vanityEquipped = false; + + public override void ResetEffects() + { + vanityEquipped = false; + } + + public override void FrameEffects() + { + if (vanityEquipped) + { + Player.legs = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Legs); + Player.body = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Body); + Player.head = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Head); + } + } + } +} diff --git a/Items/Accessories/Vanity/SharkyPlush.png b/Items/Accessories/Vanity/SharkyPlush.png new file mode 100644 index 0000000000..4d55057e92 Binary files /dev/null and b/Items/Accessories/Vanity/SharkyPlush.png differ diff --git a/Items/Accessories/Vanity/Shayy_Body.png b/Items/Accessories/Vanity/Shayy_Body.png new file mode 100644 index 0000000000..56fbab6258 Binary files /dev/null and b/Items/Accessories/Vanity/Shayy_Body.png differ diff --git a/Items/Accessories/Vanity/Shayy_Head.png b/Items/Accessories/Vanity/Shayy_Head.png new file mode 100644 index 0000000000..25b28f865a Binary files /dev/null and b/Items/Accessories/Vanity/Shayy_Head.png differ diff --git a/Items/Accessories/Vanity/Shayy_Legs.png b/Items/Accessories/Vanity/Shayy_Legs.png new file mode 100644 index 0000000000..270b56183d Binary files /dev/null and b/Items/Accessories/Vanity/Shayy_Legs.png differ diff --git a/Items/Accessories/Vanity/TheComb.cs b/Items/Accessories/Vanity/TheComb.cs new file mode 100644 index 0000000000..a0b6f21acf --- /dev/null +++ b/Items/Accessories/Vanity/TheComb.cs @@ -0,0 +1,29 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class TheComb : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override void SetDefaults() + { + Item.width = 40; + Item.height = 42; + Item.accessory = true; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; + } + + public override void UpdateVanity(Player player) => player.Calamity().combHair = true; + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (!hideVisual) + player.Calamity().combHair = true; + } + } +} diff --git a/Items/Accessories/Vanity/TheComb.png b/Items/Accessories/Vanity/TheComb.png new file mode 100644 index 0000000000..95d69e8fbd Binary files /dev/null and b/Items/Accessories/Vanity/TheComb.png differ diff --git a/Items/Accessories/Vanity/Xyk_Arms.png b/Items/Accessories/Vanity/Xyk_Arms.png new file mode 100644 index 0000000000..f7bb6a0d07 Binary files /dev/null and b/Items/Accessories/Vanity/Xyk_Arms.png differ diff --git a/Items/Accessories/Vanity/Xyk_Body.png b/Items/Accessories/Vanity/Xyk_Body.png new file mode 100644 index 0000000000..7825fbcf8c Binary files /dev/null and b/Items/Accessories/Vanity/Xyk_Body.png differ diff --git a/Items/Accessories/Vanity/Xyk_Body2.png b/Items/Accessories/Vanity/Xyk_Body2.png new file mode 100644 index 0000000000..d7d1a85e80 Binary files /dev/null and b/Items/Accessories/Vanity/Xyk_Body2.png differ diff --git a/Items/Accessories/Vanity/Xyk_Head.png b/Items/Accessories/Vanity/Xyk_Head.png new file mode 100644 index 0000000000..c564e9d6e3 Binary files /dev/null and b/Items/Accessories/Vanity/Xyk_Head.png differ diff --git a/Items/Accessories/Vanity/Xyk_Head2.png b/Items/Accessories/Vanity/Xyk_Head2.png new file mode 100644 index 0000000000..1407fd150c Binary files /dev/null and b/Items/Accessories/Vanity/Xyk_Head2.png differ diff --git a/Items/Accessories/Vanity/Xyk_Legs.png b/Items/Accessories/Vanity/Xyk_Legs.png new file mode 100644 index 0000000000..095ec71090 Binary files /dev/null and b/Items/Accessories/Vanity/Xyk_Legs.png differ diff --git a/Items/Accessories/Vanity/Xyk_Legs2.png b/Items/Accessories/Vanity/Xyk_Legs2.png new file mode 100644 index 0000000000..1c1f88fbe7 Binary files /dev/null and b/Items/Accessories/Vanity/Xyk_Legs2.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs new file mode 100644 index 0000000000..520a9f3202 --- /dev/null +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -0,0 +1,93 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class XyksBlessingBlue : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override void Load() + { + if (!Main.dedServ) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head", EquipType.Head, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body", EquipType.Body, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs", EquipType.Legs, this); + } + } + + public override void SetStaticDefaults() + { + if (Main.dedServ) + 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] = false; + 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 = 36; + Item.height = 34; + Item.accessory = true; + Item.consumable = true; + Item.vanity = true; + Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.Calamity().devItem = true; + } + public override bool CanRightClick() => true; + + public override void ModifyItemLoot(ItemLoot itemLoot) + { + itemLoot.Add(ModContent.ItemType()); + } + public override void UpdateVanity(Player player) + { + player.GetModPlayer().vanityEquipped = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.XykVisualsBlue = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (!hideVisual) + { + player.GetModPlayer().vanityEquipped = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.XykVisualsBlue = true; + } + } + } + + public class XyksBlessingBluePlayer : ModPlayer + { + public bool vanityEquipped = false; + + public override void ResetEffects() + { + vanityEquipped = false; + } + + public override void FrameEffects() + { + if (vanityEquipped) + { + Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Legs); + Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Body); + Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head); + } + } + } +} diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.png b/Items/Accessories/Vanity/XyksBlessingBlue.png new file mode 100644 index 0000000000..de950cbaa1 Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingBlue.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs new file mode 100644 index 0000000000..b2908d3a7b --- /dev/null +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -0,0 +1,93 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class XyksBlessingOrange : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override void Load() + { + if (!Main.dedServ) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head2", EquipType.Head, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body2", EquipType.Body, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs2", EquipType.Legs, this); + } + } + + public override void SetStaticDefaults() + { + if (Main.dedServ) + return; + + int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); + ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = true; + + int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); + ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = false; + 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 = 36; + Item.height = 34; + Item.accessory = true; + Item.consumable = true; + Item.vanity = true; + Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.Calamity().devItem = true; + } + public override bool CanRightClick() => true; + + public override void ModifyItemLoot(ItemLoot itemLoot) + { + itemLoot.Add(ModContent.ItemType()); + } + public override void UpdateVanity(Player player) + { + player.GetModPlayer().vanityEquipped = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.XykVisualsOrange = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (!hideVisual) + { + player.GetModPlayer().vanityEquipped = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.XykVisualsOrange = true; + } + } + } + + public class XyksBlessingOrangePlayer : ModPlayer + { + public bool vanityEquipped = false; + + public override void ResetEffects() + { + vanityEquipped = false; + } + + public override void FrameEffects() + { + if (vanityEquipped) + { + Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Legs); + Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Body); + Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head); + } + } + } +} diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.png b/Items/Accessories/Vanity/XyksBlessingOrange.png new file mode 100644 index 0000000000..34e567b436 Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingOrange.png differ diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index 612d021444..6be445c5ee 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.width = 34; - Item.height = 36; + Item.width = 50; + Item.height = 58; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; diff --git a/Items/Accessories/VeneratedLocket.png b/Items/Accessories/VeneratedLocket.png index 74ca2eff7b..2b8c3297a8 100644 Binary files a/Items/Accessories/VeneratedLocket.png and b/Items/Accessories/VeneratedLocket.png differ diff --git a/Items/Accessories/VoidofCalamity.cs b/Items/Accessories/VoidofCalamity.cs index b9e35b78cb..adbefc4037 100644 --- a/Items/Accessories/VoidofCalamity.cs +++ b/Items/Accessories/VoidofCalamity.cs @@ -33,7 +33,6 @@ namespace CalamityMod.Items.Accessories if (player.miscCounter % 10 == 0) { int damage = (int)player.GetBestClassDamage().ApplyTo(30); - damage = player.ApplyArmorAccDamageBonusesTo(damage); CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 5f, player.whoAmI); } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index b892b0268b..a0bf58d13f 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Accessories public const int FireProjectiles = 2; public const float FireAngleSpread = 120; public int FireCountdown = 0; + public static int VoidExploDamage = 150; public override void SetDefaults() { @@ -29,8 +30,8 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(3). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs new file mode 100644 index 0000000000..cfc15ce1ec --- /dev/null +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using CalamityMod.NPCs; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Balloon)] + [LegacyName("SamuraiBadge")] + [LegacyName("WarbanneroftheSun")] + public class WarbanneroftheRighteous : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + internal const float MaxBonus = 0.8f; + internal const float MaxDistance = 350f; + + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 78; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.WarbanneroftheRighteous = true; + + modPlayer.warbannerGlow = !hideVisual; + + if (player.ownedProjectileCounts[ProjectileType()] < 1 && !hideVisual && !player.dead) + { + Projectile light = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + } + + int maxValue = (int)(MaxBonus * 100); + float bonus = CalculateBonus(player) - 0.6f; + float displayBonus = (int)((bonus + 0.6f) * 100); // Should range from 0 to the maxValue + + if (player.Calamity().cooldowns.TryGetValue(WarbanneroftheRighteousBuff.ID, out var cooldown)) + { + cooldown.timeLeft = maxValue - (int)displayBonus; + } + else + { + player.AddCooldown(WarbanneroftheRighteousBuff.ID, maxValue); + } + + if (bonus > 0) + player.GetDamage() += bonus; + else + player.GetDamage() += bonus; + + int targetCount = 0; + foreach (NPC npc in Main.ActiveNPCs) // More targets gradually reduces the burn damage for ALL targets + { + if (npc.Calamity().warbannerBurnMarked) + targetCount++; + } + for (int index = 0; index < Main.npc.Length; index++) + { + NPC nPC = Main.npc[index]; + float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f) + (100 + 80 * Utils.GetLerpValue(0, 200, Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f))); // Adds some room so max bonus isnt when you're ON the hitbox + float intensity = Utils.Remap(Utils.Distance(player.Center, nPC.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 1, 3, true); // We have to have this seperate from bonus, otherwise all effected enemies take damage based on the closest enemy + + if (Utils.Distance(nPC.Center, player.Center) < MaxDistance + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType()) && nPC.CanBeChasedBy()) + { + float minDamageMult = 0.35f; + int maxTargets = 25; + float damageMult = Utils.Remap(targetCount, maxTargets, 1, minDamageMult, 1); + + // Handles giving the Warbanner Burn effect + CalamityGlobalNPC modNPC = nPC.Calamity(); + if (!modNPC.warbannerBurnMarked) + { + modNPC.warbannerBurnDirection = Utils.DirectionTo(player.Center, nPC.Center); + modNPC.warbannerBurnMarked = true; + modNPC.warbannerBurnTimer = 2; + } + if (modNPC.warbannerBurnMarked) + { + modNPC.warbannerBurnIntensity = intensity; + modNPC.warbannerBurnDirection = Utils.DirectionTo(player.Center, nPC.Center); + int burnDamage = (int)player.GetBestClassDamage().ApplyTo(47 * damageMult); // There is up to a 3x multiplier on this damage depending on distance from the enemy + modNPC.warbannerBurnDamage = burnDamage; + modNPC.warbannerBurnStacks++; + modNPC.warbannerBurnTimer++; + modNPC.warbannerBurnHideEffects = hideVisual; + } + } + } + } + + private static float CalculateBonus(Player player) + { + float bonus = 0f; + + NPC closestTarget = player.Center.ClosestNPCAt(MaxDistance * 7); // extra range is to account for bonus range from massive targets + if (closestTarget != null) + { + float generousHitboxWidth = Math.Max(closestTarget.Hitbox.Width / 2f, closestTarget.Hitbox.Height / 2f) + (100 + 80 * Utils.GetLerpValue(0, 200, Math.Max(closestTarget.Hitbox.Width / 2f, closestTarget.Hitbox.Height / 2f))); // Adds some room so max bonus isnt when you're ON the hitbox + bonus = Utils.Remap(Utils.Distance(player.Center, closestTarget.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 0, MaxBonus, true); + } + else + bonus = 0; + + return bonus; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.6f, + drawOffset: new(0f, -2f) + ); + return false; + } + } +} diff --git a/Items/Accessories/WarbanneroftheSun.png b/Items/Accessories/WarbanneroftheRighteous.png similarity index 100% rename from Items/Accessories/WarbanneroftheSun.png rename to Items/Accessories/WarbanneroftheRighteous.png diff --git a/Items/Accessories/WarbanneroftheSun_Balloon.png b/Items/Accessories/WarbanneroftheRighteous_Balloon.png similarity index 100% rename from Items/Accessories/WarbanneroftheSun_Balloon.png rename to Items/Accessories/WarbanneroftheRighteous_Balloon.png diff --git a/Items/Accessories/WarbanneroftheSun.cs b/Items/Accessories/WarbanneroftheSun.cs deleted file mode 100644 index ff2003d17f..0000000000 --- a/Items/Accessories/WarbanneroftheSun.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -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 -{ - [AutoloadEquip(EquipType.Balloon)] - [LegacyName("SamuraiBadge")] - public class WarbanneroftheSun : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - internal const float MaxBonus = 0.2f; - internal const float MaxDistance = 480f; - - public override void SetStaticDefaults() - { - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); - ItemID.Sets.AnimatesAsSoul[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 32; - Item.height = 78; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.warbannerOfTheSun = true; - - float bonus = CalculateBonus(player); - player.GetAttackSpeed() += bonus; - player.GetDamage() += bonus; - player.GetDamage() += bonus; - } - - private static float CalculateBonus(Player player) - { - float bonus = 0f; - - int closestNPC = -1; - foreach (NPC nPC in Main.ActiveNPCs) - { - if (nPC.IsAnEnemy() && !nPC.dontTakeDamage) - { - closestNPC = nPC.whoAmI; - break; - } - } - float distance = -1f; - foreach (NPC nPC in Main.ActiveNPCs) - { - if (nPC.IsAnEnemy() && !nPC.dontTakeDamage) - { - float distance2 = Math.Abs(nPC.position.X + (float)(nPC.width / 2) - (player.position.X + (float)(player.width / 2))) + Math.Abs(nPC.position.Y + (float)(nPC.height / 2) - (player.position.Y + (float)(player.height / 2))); - if (distance == -1f || distance2 < distance) - { - distance = distance2; - closestNPC = nPC.whoAmI; - } - } - } - - if (closestNPC != -1) - { - NPC actualClosestNPC = Main.npc[closestNPC]; - - float generousHitboxWidth = Math.Max(actualClosestNPC.Hitbox.Width / 2f, actualClosestNPC.Hitbox.Height / 2f); - float hitboxEdgeDist = actualClosestNPC.Distance(player.Center) - generousHitboxWidth; - - if (hitboxEdgeDist < 0) - hitboxEdgeDist = 0; - - if (hitboxEdgeDist < MaxDistance) - { - bonus = MathHelper.Lerp(0f, MaxBonus, 1f - (hitboxEdgeDist / MaxDistance)); - - if (bonus > MaxBonus) - bonus = MaxBonus; - } - } - - return bonus; - } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - CalamityUtils.DrawInventoryCustomScale( - spriteBatch, - texture: TextureAssets.Item[Type].Value, - position, - frame, - drawColor, - itemColor, - origin, - scale, - wantedScale: 0.6f, - drawOffset: new(0f, -2f) - ); - return false; - } - } -} diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index 7954944e71..9a6e0d1919 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/WifeinaBottle.cs @@ -49,12 +49,10 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Sand Elementals spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(ElementalDamage); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(ElementalDamage); var p = Projectile.NewProjectileDirect(player.GetSource_Accessory(Item), player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 2f, Main.myPlayer); - p.originalDamage = baseDamage; + p.originalDamage = ElementalDamage; } } } diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index 40bf02662e..9c07ecc7ef 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -12,6 +12,10 @@ namespace CalamityMod.Items.Accessories public class WifeinaBottlewithBoobs : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + // Hold on... isn't this the HEALER elemental?? + public static int ElementalDamage = 45; + public override void SetDefaults() { Item.width = 20; @@ -44,13 +48,10 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { var source = player.GetSource_Accessory(Item); - - // 08DEC2023: Ozzatron: Rare Sand Elementals spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(45); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(ElementalDamage); Projectile sandy = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 2f, Main.myPlayer, 0f, 0f); - sandy.originalDamage = baseDamage; + sandy.originalDamage = ElementalDamage; } } } @@ -70,11 +71,10 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); // 08DEC2023: Ozzatron: Rare Sand Elementals spawned with... Hold on a second. Why the fuck are we doing damage calculations when the accessory is in vanity?! - int baseDamage = player.ApplyArmorAccDamageBonusesTo(45); - int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(ElementalDamage); Projectile sandy = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 2f, Main.myPlayer, 0f, 0f); - sandy.originalDamage = baseDamage; + sandy.originalDamage = ElementalDamage; } } } diff --git a/Items/Accessories/Wings/AureateBooster.cs b/Items/Accessories/Wings/AureateBooster.cs index 1207c6432b..d9ac581d6b 100644 --- a/Items/Accessories/Wings/AureateBooster.cs +++ b/Items/Accessories/Wings/AureateBooster.cs @@ -11,21 +11,23 @@ namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] [LegacyName("AureateWings")] - public class AureateBooster : ModItem, ILocalizedModType + public class AureateBooster : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(120, 8f, 1.5f); - } + public override float BonusAscentWhileFalling => 0.75f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1f; + public override float MaxAscentSpeed => 2.5f; + public override float BaseAscent => 0.125f; + + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(120, 8f, 1.5f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 54; Item.height = 26; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -82,15 +84,6 @@ namespace CalamityMod.Items.Accessories.Wings player.noFallDmg = true; } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.75f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 2.5f; - constantAscend = 0.125f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/BaseWings.cs b/Items/Accessories/Wings/BaseWings.cs new file mode 100644 index 0000000000..0526175386 --- /dev/null +++ b/Items/Accessories/Wings/BaseWings.cs @@ -0,0 +1,95 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text; +using CalamityMod.Balancing; +using Microsoft.Xna.Framework.Input; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Wings +{ + public abstract class BaseWings : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories.Wings"; + + /// + /// Bonus vertical acceleration per frame while player velocity is below 0.
+ /// Defaults to 0.5f. + ///
+ public virtual float BonusAscentWhileFalling => 0.5f; + + /// + /// Bonus vertical acceleration per frame while player velocity is below a velocity threshold determined by RisingSpeedThreshold.
+ /// Defaults to 0.1f. + ///
+ public virtual float BonusAscentWhileRising => 0.1f; + + /// + /// Vertical velocity threshold for activating bonus acceleration from BonusAscentWhileRising when multiplied by the player's jump speed.
+ /// Defaults to 0.5f. + ///
+ public virtual float RisingSpeedThreshold => 0.5f; + + /// + /// Max vertical velocity threshold when multiplied by the player's jump speed.
+ /// Defaults to 1.5f. + ///
+ public virtual float MaxAscentSpeed => 1.5f; + + /// + /// Base vertical acceleration per frame.
+ /// Defaults to 0.1f. + ///
+ public virtual float BaseAscent => 0.1f; + + public override void SetDefaults() + { + Item.accessory = true; + } + + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = BonusAscentWhileFalling; + ascentWhenRising = BonusAscentWhileRising; + maxCanAscendMultiplier = RisingSpeedThreshold; + maxAscentMultiplier = MaxAscentSpeed; + constantAscend = BaseAscent; + } + + public override void ModifyTooltips(List list) + { + WingStats stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot]; + int time = stats.FlyTime; + float run = stats.AccRunSpeedOverride; + float rAcc = stats.AccRunAccelerationMult * 0.08f; + bool hover = stats.HasDownHoverStats; + float hSpeed = stats.DownHoverSpeedOverride; + float hAcc = stats.DownHoverAccelerationMult * 0.08f; + float baseJumpSpeed = (CalamityServerConfig.Instance.FasterJumpSpeed ? BalancingConstants.ConfigBoostedBaseJumpSpeed : 5.01f) + 1f; + StringBuilder sb = new StringBuilder(512); + sb.Append('\n'); + sb.Append(CalamityUtils.GetText($"Common.WingStats").Format(time.FramesToSeconds(), run.ToMph(), (MaxAscentSpeed * baseJumpSpeed).ToMph())); + sb.Append('\n'); + if (Main.keyState.IsKeyDown(Keys.LeftShift)) + { + sb.Append(CalamityUtils.GetText($"Common.WingStatsAcceleration").Format(rAcc.ToMphps(), BaseAscent.ToMphps(), + (BaseAscent + BonusAscentWhileRising).ToMphps(), (RisingSpeedThreshold * baseJumpSpeed).ToMph(), + (BaseAscent + BonusAscentWhileRising + BonusAscentWhileFalling).ToMphps())); + if (hover) + { + sb.Append('\n'); + sb.Append(CalamityUtils.GetText($"Common.WingStatsHover").Format(hSpeed.ToMph(), hAcc.ToMphps())); + } + } + else + sb.Append($"[c/B8B8B8:{CalamityUtils.GetTextValue("UI.HoldShiftTooltipExtensionIndicator")}]"); + + // Add stats below the common "Allows flight" line + var wingTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); + if (wingTooltip != null) + wingTooltip.Text += sb.ToString(); + } + } +} diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index 30ec3ec6d8..f9ab4abe57 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -9,22 +9,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class DrewsWings : ModItem, ILocalizedModType + public class DrewsWings : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; + public override float BonusAscentWhileFalling => 1f; + public override float BonusAscentWhileRising => 0.17f; + public override float RisingSpeedThreshold => 1.2f; + public override float MaxAscentSpeed => 3.25f; + public override float BaseAscent => 0.15f; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(361, 11.5f, 2.9f); - } + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(361, 11.5f, 2.9f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -47,14 +48,5 @@ namespace CalamityMod.Items.Accessories.Wings } player.noFallDmg = true; } - - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 1f; - ascentWhenRising = 0.17f; - maxCanAscendMultiplier = 1.2f; - maxAscentMultiplier = 3.25f; - constantAscend = 0.15f; - } } } diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index 11f81e5059..fde3249493 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -1,5 +1,9 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Particles; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -8,40 +12,85 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class ElysianWings : ModItem, ILocalizedModType + public class ElysianWings : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; + public override float BonusAscentWhileFalling => 0.85f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1f; + public override float MaxAscentSpeed => 3f; + public override float BaseAscent => 0.135f; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(240, 9.5f, 2.7f); - } + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(240, 9.5f, 2.7f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 48; Item.height = 50; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.accessory = true; } + public override void UpdateVanity(Player player) => DrawWingEffects(player); + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); player.moveSpeed += 0.1f; player.lavaImmune = true; player.noFallDmg = true; - modPlayer.elysianWingsDust = !hideVisual; - } + modPlayer.elysianWingsDust = false; - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + if (!hideVisual) + DrawWingEffects(player); + } + private void DrawWingEffects(Player player) { - ascentWhenFalling = 0.85f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 3f; - constantAscend = 0.135f; + float rate = Main.GlobalTimeWrappedHourly * 2; + List eColors = new List() + { + Color.Gold, + Color.Khaki + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + + Vector2 spawnPos = player.Center + new Vector2(-25 * player.direction, 0); + Lighting.AddLight(spawnPos, usedColor.ToVector3() * 1.2f); + + if (player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f) + { + spawnPos = player.Center + new Vector2(-25 * player.direction, 0) + Main.rand.NextVector2Circular(20, 20); + Vector2 spawnPos2 = player.Center + new Vector2(15 * player.direction, 0) + Main.rand.NextVector2Circular(20, 20); + + float partScale = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 partVel = new Vector2(0, 5).RotatedBy(0.5f * player.direction).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.5f, 0.8f); + + Particle smoke = new CustomSpark(spawnPos, partVel, "CalamityMod/Particles/SmallBloom", false, 13, partScale * 0.25f, usedColor * 0.4f, Vector2.One, true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(smoke); + + if (Main.rand.NextBool((player.controlJump ? 2 : 4))) + { + Particle spark3 = new CustomSpark(spawnPos, partVel, "CalamityMod/Particles/ProvidenceMarkParticle", false, 19, partScale, Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark3); + } + + if (Main.rand.NextBool()) + { + Particle smoke2 = new CustomSpark(spawnPos2, partVel, "CalamityMod/Particles/SmallBloom", false, 13, partScale * 0.15f, usedColor * 0.4f, Vector2.One, true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(smoke2); + if (Main.rand.NextBool((player.controlJump ? 2 : 4))) + { + Particle spark3 = new CustomSpark(spawnPos2, partVel, "CalamityMod/Particles/ProvidenceMarkParticle", false, 19, partScale * 0.7f, Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + + } } } } diff --git a/Items/Accessories/Wings/ElysianWingsGlow.png b/Items/Accessories/Wings/ElysianWingsGlow.png new file mode 100644 index 0000000000..61f5a48d4c Binary files /dev/null and b/Items/Accessories/Wings/ElysianWingsGlow.png differ diff --git a/Items/Accessories/Wings/ElysianWings_WingsGlow.png b/Items/Accessories/Wings/ElysianWings_WingsGlow.png new file mode 100644 index 0000000000..5333a8518a Binary files /dev/null and b/Items/Accessories/Wings/ElysianWings_WingsGlow.png differ diff --git a/Items/Accessories/Wings/ExodusWings.cs b/Items/Accessories/Wings/ExodusWings.cs index bb3548b316..0401431942 100644 --- a/Items/Accessories/Wings/ExodusWings.cs +++ b/Items/Accessories/Wings/ExodusWings.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Armor.Empyrean; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Armor.Empyrean; using CalamityMod.Items.Materials; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -11,30 +13,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class ExodusWings : ModItem, ILocalizedModType + public class ExodusWings : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; + public override float BonusAscentWhileFalling => 0.85f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1f; + public override float MaxAscentSpeed => 3f; + public override float BaseAscent => 0.135f; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(180, 9f, 2.5f); - } + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(180, 9f, 2.5f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Red; - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { if (player.armor[0].type == ModContent.ItemType() && player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; + player.AddBuff(ModContent.BuffType(), 2); } if (player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) @@ -50,8 +52,10 @@ namespace CalamityMod.Items.Accessories.Wings if (Main.rand.NextBool((player.controlJump ? 2 : 4))) { - Particle spark3 = new GlowOrbParticle(spawnPos, partVel, false, 19, partScale, Color.LightGreen, true, false, false); - GeneralParticleHandler.SpawnParticle(spark3); + Dust dust = Dust.NewDustPerfect(spawnPos, ModContent.DustType(), partVel, 0, default, partScale * 2f); + dust.noGravity = true; + dust.color = Color.LightGreen; + } if (Main.rand.NextBool()) { @@ -60,8 +64,9 @@ namespace CalamityMod.Items.Accessories.Wings if (Main.rand.NextBool((player.controlJump ? 2 : 4))) { - Particle spark3 = new GlowOrbParticle(spawnPos2, partVel, false, 19, partScale * 0.7f, Color.LightGreen, true, false, false); - GeneralParticleHandler.SpawnParticle(spark3); + Dust dust = Dust.NewDustPerfect(spawnPos2, ModContent.DustType(), partVel, 0, default, partScale * 1.7f); + dust.noGravity = true; + dust.color = Color.LightGreen; } } @@ -70,15 +75,6 @@ namespace CalamityMod.Items.Accessories.Wings player.noFallDmg = true; } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.85f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 3f; - constantAscend = 0.135f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/HadalMantle.cs b/Items/Accessories/Wings/HadalMantle.cs index 9bcf25930c..a9d0f3958a 100644 --- a/Items/Accessories/Wings/HadalMantle.cs +++ b/Items/Accessories/Wings/HadalMantle.cs @@ -11,33 +11,27 @@ namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] [LegacyName("DiscordianWings")] - public class HadalMantle : ModItem, ILocalizedModType + public class HadalMantle : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(180, 7.75f, 1.5f); - } + public override float BonusAscentWhileFalling => 0.6f; + public override float BonusAscentWhileRising => 0.12f; + public override float RisingSpeedThreshold => 0.7f; + public override float MaxAscentSpeed => 1.75f; + public override float BaseAscent => 0.11f; + + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(180, 7.75f, 1.5f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - player.GetDamage() += 0.05f; - } - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { int dustXOffset = 4; @@ -57,15 +51,6 @@ namespace CalamityMod.Items.Accessories.Wings player.noFallDmg = true; } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.6f; - ascentWhenRising = 0.12f; - maxCanAscendMultiplier = 0.7f; - maxAscentMultiplier = 1.75f; - constantAscend = 0.11f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 8d3ff62629..e75b85cba5 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -11,21 +11,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class HadarianWings : ModItem, ILocalizedModType + public class HadarianWings : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(90, 9f, 1.75f); - } + public override float BonusAscentWhileFalling => 0.8f; + public override float BonusAscentWhileRising => 0.155f; + public override float RisingSpeedThreshold => 1.05f; + public override float MaxAscentSpeed => 2.55f; + public override float BaseAscent => 0.13f; + + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(90, 9f, 1.75f, true, 11.6f, 11.6f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 24; Item.height = 36; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -66,14 +68,5 @@ namespace CalamityMod.Items.Accessories.Wings } player.noFallDmg = true; } - - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.8f; - ascentWhenRising = 0.155f; - maxCanAscendMultiplier = 1.05f; - maxAscentMultiplier = 2.55f; - constantAscend = 0.13f; - } } } diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 694ddaab3b..904c7565bc 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -9,21 +9,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class MOAB : ModItem, ILocalizedModType + public class MOAB : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f); - } + public override float BonusAscentWhileFalling => 0.75f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1f; + public override float MaxAscentSpeed => 2.5f; + public override float BaseAscent => 0.125f; + + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 28; Item.height = 32; Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -90,16 +92,9 @@ namespace CalamityMod.Items.Accessories.Wings player.autoJump = true; player.noFallDmg = true; player.jumpSpeedBoost += 1.6f; - player.luck += 0.05f; - } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.75f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 2.5f; - constantAscend = 0.125f; + // Mirrors the +5% luck from Lucky Horseshoe (vanilla behavior). + player.Calamity().calamityBonusLuck += 0.05f; } public override void AddRecipes() diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index b00db4d361..0a7fefdd0f 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -13,31 +13,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class SilvaWings : ModItem, ILocalizedModType + public class SilvaWings : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; + public override float BonusAscentWhileFalling => 0.95f; + public override float BonusAscentWhileRising => 0.16f; + public override float RisingSpeedThreshold => 1.1f; + public override float MaxAscentSpeed => 3.2f; + public override float BaseAscent => 0.145f; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(270, 10.5f, 2.8f); - } + public const int LifeRegenTimerMax = 900; + + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(270, 10.5f, 2.8f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - player.Calamity().silvaWings = true; - } + player.Calamity().silvaWings = true; if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { @@ -58,15 +57,6 @@ namespace CalamityMod.Items.Accessories.Wings player.noFallDmg = true; } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.95f; - ascentWhenRising = 0.16f; - maxCanAscendMultiplier = 1.1f; - maxAscentMultiplier = 3.2f; - constantAscend = 0.145f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index 58ab67d809..0c29d76343 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -7,21 +7,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class SkylineWings : ModItem, ILocalizedModType + public class SkylineWings : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(80, 6.5f, 1f); - } + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(80, 6.25f, 1f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -29,20 +25,6 @@ namespace CalamityMod.Items.Accessories.Wings player.noFallDmg = true; } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.5f; - ascentWhenRising = 0.1f; - maxCanAscendMultiplier = 0.5f; - maxAscentMultiplier = 1.5f; - constantAscend = 0.1f; - } - - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 6.25f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index cfc3f82932..9d4219fac8 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -12,24 +12,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class SoulofCryogen : ModItem, ILocalizedModType + public class SoulofCryogen : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 3)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(120, 6.25f, 1f); } public override void SetDefaults() { + base.SetDefaults(); Item.width = 26; Item.height = 26; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.accessory = true; } public override void Update(ref float gravity, ref float maxFallSpeed) @@ -39,28 +38,17 @@ namespace CalamityMod.Items.Accessories.Wings Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0f * lightOffset, 0.3f * lightOffset, 0.3f * lightOffset); } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.5f; - ascentWhenRising = 0.1f; - maxCanAscendMultiplier = 0.5f; - maxAscentMultiplier = 1.5f; - constantAscend = 0.1f; - } - public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.cryogenSoul = true; - player.GetDamage() += 0.07f; player.noFallDmg = true; - if (modPlayer.icicleCooldown <= 0) + if (modPlayer.wingProjectileCooldown <= 0) { 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(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); if (p.WithinBounds(Main.maxProjectiles)) @@ -68,7 +56,7 @@ namespace CalamityMod.Items.Accessories.Wings Main.projectile[p].DamageType = DamageClass.Generic; Main.projectile[p].frame = Main.rand.Next(5); } - modPlayer.icicleCooldown = 7; + modPlayer.wingProjectileCooldown = 7; } } } diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index f80f8c7a98..472dab84a3 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -10,34 +10,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class StarlightWings : ModItem, ILocalizedModType + public class StarlightWings : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(150, 7.5f, 1f); - } + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 7.5f, 1.5f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - } - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { int dustXOffset = 4; @@ -57,15 +44,6 @@ namespace CalamityMod.Items.Accessories.Wings player.noFallDmg = true; } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.5f; - ascentWhenRising = 0.1f; - maxCanAscendMultiplier = 0.5f; - maxAscentMultiplier = 1.5f; - constantAscend = 0.1f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index e30e73c6bd..7692df6166 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -12,34 +12,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class TarragonWings : ModItem, ILocalizedModType + public class TarragonWings : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; + public override float BonusAscentWhileFalling => 0.85f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1f; + public override float MaxAscentSpeed => 3f; + public override float BaseAscent => 0.135f; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 9.5f, 2.5f); - } + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 9.5f, 2.5f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - player.statDefense += 15; - player.lifeRegen += 2; - } + player.statDefense += 15; + player.lifeRegen += 2; if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { @@ -60,15 +55,6 @@ namespace CalamityMod.Items.Accessories.Wings player.noFallDmg = true; } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.85f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 3f; - constantAscend = 0.135f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/TracersCelestial.cs b/Items/Accessories/Wings/TracersCelestial.cs index 5ff8fee788..2c6198dd03 100644 --- a/Items/Accessories/Wings/TracersCelestial.cs +++ b/Items/Accessories/Wings/TracersCelestial.cs @@ -12,22 +12,23 @@ namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings, EquipType.Shoes)] [LegacyName("InfinityBoots", "SeraphTracers")] - public class TracersCelestial : ModItem, ILocalizedModType + public class TracersCelestial : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; + public override float BonusAscentWhileFalling => 0.75f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1f; + public override float MaxAscentSpeed => 2.5f; + public override float BaseAscent => 0.125f; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(140, 9f, 2.6f); - } + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 9f, 2.6f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 36; Item.height = 32; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; - Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -61,15 +62,6 @@ namespace CalamityMod.Items.Accessories.Wings modPlayer.tracersCelestial = true; } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.75f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 2.5f; - constantAscend = 0.125f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/TracersElysian.cs b/Items/Accessories/Wings/TracersElysian.cs index 41740f0d71..403641dcdf 100644 --- a/Items/Accessories/Wings/TracersElysian.cs +++ b/Items/Accessories/Wings/TracersElysian.cs @@ -15,21 +15,22 @@ namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] [LegacyName("ElysianTracers")] - public class TracersElysian : ModItem, ILocalizedModType + public class TracersElysian : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; + public override float BonusAscentWhileFalling => 0.85f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1.1f; + public override float MaxAscentSpeed => 2.7f; + public override float BaseAscent => 0.135f; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(180, 10f, 2.7f); - } + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(220, 10f, 2.7f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 36; Item.height = 32; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.accessory = true; Item.rare = ModContent.RarityType(); } @@ -65,15 +66,6 @@ namespace CalamityMod.Items.Accessories.Wings modPlayer.tracersElysian = true; } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.85f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1.1f; - maxAscentMultiplier = 2.7f; - constantAscend = 0.135f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/TracersSeraph.cs b/Items/Accessories/Wings/TracersSeraph.cs index 21303ea750..b157d040ac 100644 --- a/Items/Accessories/Wings/TracersSeraph.cs +++ b/Items/Accessories/Wings/TracersSeraph.cs @@ -15,21 +15,22 @@ namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] [LegacyName("CelestialTracers")] - public class TracersSeraph : ModItem, ILocalizedModType + public class TracersSeraph : BaseWings { - public new string LocalizationCategory => "Items.Accessories.Wings"; + public override float BonusAscentWhileFalling => 0.95f; + public override float BonusAscentWhileRising => 0.16f; + public override float RisingSpeedThreshold => 1.2f; + public override float MaxAscentSpeed => 2.9f; + public override float BaseAscent => 0.145f; - public override void SetStaticDefaults() - { - ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f); - } + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f); public override void SetDefaults() { + base.SetDefaults(); Item.width = 36; Item.height = 32; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.accessory = true; Item.rare = ModContent.RarityType(); } @@ -65,15 +66,6 @@ namespace CalamityMod.Items.Accessories.Wings 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) - { - ascentWhenFalling = 0.95f; - ascentWhenRising = 0.16f; - maxCanAscendMultiplier = 1.2f; - maxAscentMultiplier = 2.9f; - constantAscend = 0.145f; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index 78fc5d2339..9bd60529f1 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -425,6 +425,7 @@ namespace CalamityMod.Items.Accessories SoundEngine.PlaySound(WulfrumAcrobaticsPack.ShootSound, Player.Center); if (Player.whoAmI == Main.myPlayer) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 velocity = (Main.MouseWorld - Player.Center).SafeNormalize(Vector2.One) * GrappleVelocity; Projectile.NewProjectile(Player.GetSource_ItemUse(PackItem), Player.Center, velocity, ProjectileType(), 0, 0, Player.whoAmI); diff --git a/Items/Accessories/WulfrumBattery.cs b/Items/Accessories/WulfrumBattery.cs index ea1aaca730..efa3e9f2ac 100644 --- a/Items/Accessories/WulfrumBattery.cs +++ b/Items/Accessories/WulfrumBattery.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; + ItemID.Sets.ExtractinatorMode[Type] = Item.type; } public override void SetDefaults() diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index 0a59362b0f..83d180aa84 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Accessories if (player.whoAmI == Main.myPlayer) { int damage = (int)player.GetBestClassDamage().ApplyTo(175); - damage = player.ApplyArmorAccDamageBonusesTo(damage); int projectile1 = Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 5f, player.whoAmI, 0f, 0f); Main.projectile[projectile1].timeLeft = 60; @@ -56,7 +55,6 @@ namespace CalamityMod.Items.Accessories if (player.whoAmI == Main.myPlayer) { int damage = (int)player.GetBestClassDamage().ApplyTo(375); - damage = player.ApplyArmorAccDamageBonusesTo(damage); CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 9f, player.whoAmI); } diff --git a/Items/AlicornonaStick.cs b/Items/AlicornonaStick.cs index 4f30a42f0b..1a0dda3f93 100644 --- a/Items/AlicornonaStick.cs +++ b/Items/AlicornonaStick.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items { int damage = npc.SimpleStrikeNPC((int)(npc.lifeMax / 200), player.direction, true); SoundEngine.PlaySound(Projectiles.Summon.CnidarianJellyfishOnTheString.SlapSound with { Volume = 2, MaxInstances = 200 }, npc.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { BloodShed(itemRect, npc, damage, player); } diff --git a/Items/Ammo/AstralSolution.cs b/Items/Ammo/AstralSolution.cs index d45fe7c8d1..4026fbb514 100644 --- a/Items/Ammo/AstralSolution.cs +++ b/Items/Ammo/AstralSolution.cs @@ -11,21 +11,10 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - ItemID.Sets.SortingPriorityTerraforming[Type] = 95; // Red Solution + ItemID.Sets.SortingPriorityTerraforming[Type] = 94; // Red Solution } - public override void SetDefaults() - { - 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; - Item.consumable = true; - return; - } + public override void SetDefaults() => Item.DefaultToSolution(ModContent.ProjectileType()); public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { diff --git a/Items/Ammo/BloodRune.cs b/Items/Ammo/BloodRune.cs index d6e658a5d1..e12165c861 100644 --- a/Items/Ammo/BloodRune.cs +++ b/Items/Ammo/BloodRune.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Ammo Item.width = 22; Item.height = 24; Item.damage = 1; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 10f; - Item.value = Item.buyPrice(gold: 1); + Item.value = Item.buyPrice(gold: 1); // Sold by Archmage Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Ammo/BloodfireArrow.cs b/Items/Ammo/BloodfireArrow.cs index c91cf6a8a8..6c44ff4334 100644 --- a/Items/Ammo/BloodfireArrow.cs +++ b/Items/Ammo/BloodfireArrow.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Ammo Item.height = 36; Item.damage = 30; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 3.5f; Item.value = Item.sellPrice(copper: 24); diff --git a/Items/Ammo/BloodfireBullet.cs b/Items/Ammo/BloodfireBullet.cs index 0bc134e56f..490e39bf4b 100644 --- a/Items/Ammo/BloodfireBullet.cs +++ b/Items/Ammo/BloodfireBullet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Ammo Item.height = 30; Item.damage = 27; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 4.5f; Item.value = Item.sellPrice(copper: 24); diff --git a/Items/Ammo/BubonicRound.cs b/Items/Ammo/BubonicRound.cs index d9953922fc..4a0079f15f 100644 --- a/Items/Ammo/BubonicRound.cs +++ b/Items/Ammo/BubonicRound.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Ammo Item.height = 8; Item.damage = 16; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 1.5f; Item.value = Item.sellPrice(copper: 16); diff --git a/Items/Ammo/BubonicRound.png b/Items/Ammo/BubonicRound.png index 230853d588..0e2796dffc 100644 Binary files a/Items/Ammo/BubonicRound.png and b/Items/Ammo/BubonicRound.png differ diff --git a/Items/Ammo/CinderArrow.cs b/Items/Ammo/CinderArrow.cs index ffe4a68740..e9ced9fd6d 100644 --- a/Items/Ammo/CinderArrow.cs +++ b/Items/Ammo/CinderArrow.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Ammo Item.height = 36; Item.damage = 12; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 1.5f; Item.value = Item.sellPrice(copper: 12); diff --git a/Items/Ammo/DryadsTear.cs b/Items/Ammo/DryadsTear.cs index 24866b5488..c71578ffd1 100644 --- a/Items/Ammo/DryadsTear.cs +++ b/Items/Ammo/DryadsTear.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Ammo Item.height = 8; Item.damage = 10; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 1.25f; Item.value = Item.sellPrice(copper: 16); diff --git a/Items/Ammo/ElysianArrow.cs b/Items/Ammo/ElysianArrow.cs index bb2d94cce2..72545034d4 100644 --- a/Items/Ammo/ElysianArrow.cs +++ b/Items/Ammo/ElysianArrow.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Ammo Item.height = 36; Item.damage = 17; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 3f; Item.value = Item.sellPrice(copper: 24); diff --git a/Items/Ammo/FlashRound.cs b/Items/Ammo/FlashRound.cs index 7dded9c0da..fbd7778605 100644 --- a/Items/Ammo/FlashRound.cs +++ b/Items/Ammo/FlashRound.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Ammo Item.height = 18; Item.damage = 5; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 1.15f; Item.value = Item.sellPrice(copper: 2); diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index dbf30390f4..da4a0261d5 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Ammo Item.height = 22; Item.damage = 28; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 3f; Item.value = Item.sellPrice(copper: 28); diff --git a/Items/Ammo/GodSlayerSlug.png b/Items/Ammo/GodSlayerSlug.png index 33d7e8e641..f3306948f8 100644 Binary files a/Items/Ammo/GodSlayerSlug.png and b/Items/Ammo/GodSlayerSlug.png differ diff --git a/Items/Ammo/HailstormBullet.cs b/Items/Ammo/HailstormBullet.cs index 0c36e71d85..8571c98ecf 100644 --- a/Items/Ammo/HailstormBullet.cs +++ b/Items/Ammo/HailstormBullet.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Ammo Item.DamageType = DamageClass.Ranged; Item.consumable = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 0, 0, 80); + Item.value = Item.buyPrice(copper: 80); // Sold by Archmage Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0.3f; Item.ammo = AmmoID.Bullet; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; } } } diff --git a/Items/Ammo/HallowPointRound.cs b/Items/Ammo/HallowPointRound.cs index 56d140b143..c3316d90fa 100644 --- a/Items/Ammo/HallowPointRound.cs +++ b/Items/Ammo/HallowPointRound.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using System.Collections.Generic; +using CalamityMod.Projectiles.Ranged; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Ammo Item.height = 18; Item.damage = BaseDamage; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 3f; Item.value = Item.sellPrice(copper: 12); @@ -33,6 +34,13 @@ namespace CalamityMod.Items.Ammo Item.ammo = AmmoID.Bullet; } + public override void ModifyTooltips(List list) + { + // Add the proper damage value + int nonConvertDamage = (int)Main.LocalPlayer.GetTotalDamage().ApplyTo(BaseDamage + BonusDamageOnHit); + list.FindAndReplace("[DAMAGE]", nonConvertDamage.ToString()); + } + public override void AddRecipes() { CreateRecipe(100). diff --git a/Items/Ammo/HolyFireBullet.cs b/Items/Ammo/HolyFireBullet.cs index 9c54ed0152..068b149d82 100644 --- a/Items/Ammo/HolyFireBullet.cs +++ b/Items/Ammo/HolyFireBullet.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Ammo Item.height = 22; Item.damage = 20; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 2f; Item.value = Item.sellPrice(copper: 24); diff --git a/Items/Ammo/HyperiusBullet.cs b/Items/Ammo/HyperiusBullet.cs index 6812c127eb..135be89269 100644 --- a/Items/Ammo/HyperiusBullet.cs +++ b/Items/Ammo/HyperiusBullet.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Ammo Item.height = 30; Item.damage = 13; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 1.5f; Item.value = Item.sellPrice(copper: 16); diff --git a/Items/Ammo/IcicleArrow.cs b/Items/Ammo/IcicleArrow.cs index 17f271b6b4..4efafcd10a 100644 --- a/Items/Ammo/IcicleArrow.cs +++ b/Items/Ammo/IcicleArrow.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Ammo Item.DamageType = DamageClass.Ranged; Item.consumable = true; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(0, 0, 0, 80); + Item.value = Item.buyPrice(copper: 80); // Sold by Archmage Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0.2f; Item.ammo = AmmoID.Arrow; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; } } } diff --git a/Items/Ammo/MarksmanRound.cs b/Items/Ammo/MarksmanRound.cs index 40ddb78f95..ecd4d70532 100644 --- a/Items/Ammo/MarksmanRound.cs +++ b/Items/Ammo/MarksmanRound.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Ammo Item.height = 26; Item.damage = 12; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 2.25f; Item.value = Item.sellPrice(copper: 10); diff --git a/Items/Ammo/MortarRound.cs b/Items/Ammo/MortarRound.cs index e9892bf3af..51aff1f16b 100644 --- a/Items/Ammo/MortarRound.cs +++ b/Items/Ammo/MortarRound.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Ammo Item.height = 14; Item.damage = 20; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 7f; Item.value = Item.sellPrice(copper: 20); diff --git a/Items/Ammo/RubberMortarRound.cs b/Items/Ammo/RubberMortarRound.cs index 117ba2780f..1b751ed01c 100644 --- a/Items/Ammo/RubberMortarRound.cs +++ b/Items/Ammo/RubberMortarRound.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Ammo Item.height = 14; Item.damage = 20; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 7f; Item.value = Item.sellPrice(copper: 20); diff --git a/Items/Ammo/SproutingArrow.cs b/Items/Ammo/SproutingArrow.cs index aa48c93a5d..d8006c98eb 100644 --- a/Items/Ammo/SproutingArrow.cs +++ b/Items/Ammo/SproutingArrow.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Ammo Item.height = 36; Item.damage = 15; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 1.5f; Item.value = Item.sellPrice(copper: 20); diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index 3b55ab5e88..efc4a9ff33 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Ammo Item.height = 46; Item.damage = 30; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 3.5f; Item.value = Item.sellPrice(copper: 28); diff --git a/Items/Ammo/VeriumBolt.cs b/Items/Ammo/VeriumBolt.cs index bbc4756fe6..ae59a0bc45 100644 --- a/Items/Ammo/VeriumBolt.cs +++ b/Items/Ammo/VeriumBolt.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Ammo Item.height = 8; Item.damage = 11; Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 1.25f; Item.value = Item.sellPrice(copper: 12); diff --git a/Items/AntiCystOintment.cs b/Items/AntiCystOintment.cs index c109169272..c3c9cd3b4d 100644 --- a/Items/AntiCystOintment.cs +++ b/Items/AntiCystOintment.cs @@ -33,13 +33,9 @@ namespace CalamityMod.Items 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; + Item.RestoreConsumedItemByRightClick(); } /* diff --git a/Items/AntiTumorOintment.cs b/Items/AntiTumorOintment.cs index 1ee5b62e48..63f9807f27 100644 --- a/Items/AntiTumorOintment.cs +++ b/Items/AntiTumorOintment.cs @@ -33,13 +33,9 @@ namespace CalamityMod.Items 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; + Item.RestoreConsumedItemByRightClick(); } /* public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Armor/Aerospec/AerospecHat.cs b/Items/Armor/Aerospec/AerospecHat.cs index 5fb0715309..b423f48d9b 100644 --- a/Items/Armor/Aerospec/AerospecHat.cs +++ b/Items/Armor/Aerospec/AerospecHat.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadgear.cs index ed6ec52e82..2caf137da0 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadgear.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Items.Armor.Aerospec public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetStaticDefaults() { - - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; } @@ -61,6 +60,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). + SortAfterFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHelm.cs b/Items/Armor/Aerospec/AerospecHelm.cs index bf10c1b5b2..d8303c5fee 100644 --- a/Items/Armor/Aerospec/AerospecHelm.cs +++ b/Items/Armor/Aerospec/AerospecHelm.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHelmet.cs b/Items/Armor/Aerospec/AerospecHelmet.cs index 688945d746..4147feed8f 100644 --- a/Items/Armor/Aerospec/AerospecHelmet.cs +++ b/Items/Armor/Aerospec/AerospecHelmet.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Armor.Aerospec public class AerospecHelmet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + public static int ValkyrieDamage = 20; + public override void SetDefaults() { Item.width = 18; @@ -48,13 +50,11 @@ namespace CalamityMod.Items.Armor.Aerospec } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Aerospec Valkyries spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(20); - var damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + var damage = (int)player.GetTotalDamage().ApplyTo(ValkyrieDamage); var p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = ValkyrieDamage; } } player.GetDamage() += 0.11f; @@ -74,6 +74,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHood.cs b/Items/Armor/Aerospec/AerospecHood.cs index 1d18851f55..e452f6a125 100644 --- a/Items/Armor/Aerospec/AerospecHood.cs +++ b/Items/Armor/Aerospec/AerospecHood.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). + SortAfterFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Astral/AstralBreastplate.cs b/Items/Armor/Astral/AstralBreastplate.cs index 4b71e1d7bf..0efb6e01dc 100644 --- a/Items/Armor/Astral/AstralBreastplate.cs +++ b/Items/Armor/Astral/AstralBreastplate.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Astral { player.statLifeMax2 += 20; player.statManaMax2 += 80; - player.detectCreature = true; + player.GetDamage() += 0.07f; } public override void AddRecipes() diff --git a/Items/Armor/Astral/AstralHelm.cs b/Items/Armor/Astral/AstralHelm.cs index 7df783d9e1..35c40f89a9 100644 --- a/Items/Armor/Astral/AstralHelm.cs +++ b/Items/Armor/Astral/AstralHelm.cs @@ -34,16 +34,17 @@ namespace CalamityMod.Items.Armor.Astral player.setBonus = this.GetLocalizedValue("SetBonus"); var modPlayer = player.Calamity(); modPlayer.astralStarRain = true; - player.moveSpeed += 0.05f; - player.GetDamage() += 0.35f; + modPlayer.omniscience = true; + player.GetDamage() += 0.1f; player.maxMinions += 3; - player.GetCritChance() += 25; + player.GetCritChance() += 10; player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.dangerSense = true; + player.GetDamage() += 0.05f; + player.GetCritChance() += 10; } public override void AddRecipes() @@ -52,6 +53,7 @@ namespace CalamityMod.Items.Armor.Astral AddIngredient(8). AddIngredient(ItemID.MeteoriteBar, 6). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Astral/AstralLeggings.cs b/Items/Armor/Astral/AstralLeggings.cs index ff3e4af4a0..3a717b7f0c 100644 --- a/Items/Armor/Astral/AstralLeggings.cs +++ b/Items/Armor/Astral/AstralLeggings.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Armor.Astral public override void UpdateEquip(Player player) { - player.moveSpeed += 0.1f; - player.findTreasure = true; + player.moveSpeed += 0.15f; + player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Items/Armor/Auric/AuricTeslaBodyArmor.cs b/Items/Armor/Auric/AuricTeslaBodyArmor.cs index 91ccc4cd61..caa5cbe2cc 100644 --- a/Items/Armor/Auric/AuricTeslaBodyArmor.cs +++ b/Items/Armor/Auric/AuricTeslaBodyArmor.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Auric public override void Load() { // All code below runs only if we're not loading on a server - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Add equip textures EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Auric/AuricTeslaBodyArmor_Back", EquipType.Back, this); diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs index e78c7cebc2..db0aaa3a4e 100644 --- a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs @@ -70,6 +70,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs index 8c5b0367f3..69eaa3d741 100644 --- a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs @@ -72,6 +72,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs index cc0549db06..078a350ff0 100644 --- a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs +++ b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.godSlayer = true; modPlayer.godSlayerDamage = true; modPlayer.auricSet = true; + modPlayer.auricSetMelee = true; player.thorns += 3f; player.ignoreWater = true; player.crimsonRegen = true; @@ -73,6 +74,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs index b04b7bb6e6..fdc49f0a7a 100644 --- a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs @@ -70,6 +70,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs index a2e4802bd0..18993c56ec 100644 --- a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs @@ -68,6 +68,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs index 92f840986d..f3da4ef71c 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs @@ -54,6 +54,7 @@ namespace CalamityMod.Items.Armor.Bloodflare AddIngredient(11). AddIngredient(2). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs index 52523c67d6..542373cdbc 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs @@ -54,6 +54,7 @@ namespace CalamityMod.Items.Armor.Bloodflare AddIngredient(11). AddIngredient(2). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs index df4841eaa7..a1bef0cca6 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Armor.Bloodflare AddIngredient(11). AddIngredient(2). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs index a9460e2066..75e086447a 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Items.Armor.Bloodflare AddIngredient(11). AddIngredient(2). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs index 1cb061cd35..0aa577c5bb 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Armor.Bloodflare AddIngredient(11). AddIngredient(2). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Brimflame/BrimflameRobes.cs b/Items/Armor/Brimflame/BrimflameRobes.cs index 489a3a5222..8e2ba2b87b 100644 --- a/Items/Armor/Brimflame/BrimflameRobes.cs +++ b/Items/Armor/Brimflame/BrimflameRobes.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Brimflame public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Armor.Brimflame AddIngredient(8). AddIngredient(4). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Brimflame/BrimflameScowl.cs b/Items/Armor/Brimflame/BrimflameScowl.cs index 3f6d5cae92..24be230104 100644 --- a/Items/Armor/Brimflame/BrimflameScowl.cs +++ b/Items/Armor/Brimflame/BrimflameScowl.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.Brimflame { player.GetDamage() += 0.05f; player.GetCritChance() += 5; - player.statManaMax2 += 70; + player.statManaMax2 += 80; player.manaCost *= 0.9f; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[BuffID.OnFire] = true; @@ -87,6 +87,7 @@ namespace CalamityMod.Items.Armor.Brimflame AddIngredient(4). AddIngredient(2). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/CirrusDress.cs b/Items/Armor/CirrusDress.cs index 4da0b51cd9..4436d3cea4 100644 --- a/Items/Armor/CirrusDress.cs +++ b/Items/Armor/CirrusDress.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/CirrusDress_Legs", EquipType.Legs, this); } @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesHands[equipSlot] = true; diff --git a/Items/Armor/Daedalus/DaedalusBreastplate.cs b/Items/Armor/Daedalus/DaedalusBreastplate.cs index 99653f3213..9b81c403db 100644 --- a/Items/Armor/Daedalus/DaedalusBreastplate.cs +++ b/Items/Armor/Daedalus/DaedalusBreastplate.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Daedalus public new string LocalizationCategory => "Items.Armor.Hardmode"; public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Daedalus/DaedalusBreastplate_Waist", EquipType.Waist, this); diff --git a/Items/Armor/Daedalus/DaedalusHeadMagic.cs b/Items/Armor/Daedalus/DaedalusHeadMagic.cs index 175ea3b048..1601c041ce 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMagic.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMagic.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Armor.Daedalus AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Daedalus/DaedalusHeadMelee.cs b/Items/Armor/Daedalus/DaedalusHeadMelee.cs index f7fc612265..1b63761a78 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMelee.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMelee.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.Armor.Daedalus AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Daedalus/DaedalusHeadRanged.cs b/Items/Armor/Daedalus/DaedalusHeadRanged.cs index 1209a9ebc0..bf2f380bd3 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRanged.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRanged.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.Armor.Daedalus AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Daedalus/DaedalusHeadRogue.cs b/Items/Armor/Daedalus/DaedalusHeadRogue.cs index 67bcabda36..b6324b20b7 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRogue.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRogue.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Items.Armor.Daedalus AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Daedalus/DaedalusHeadSummon.cs b/Items/Armor/Daedalus/DaedalusHeadSummon.cs index 5f85a4c3ef..a772d58d53 100644 --- a/Items/Armor/Daedalus/DaedalusHeadSummon.cs +++ b/Items/Armor/Daedalus/DaedalusHeadSummon.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Armor.Daedalus public class DaedalusHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + public static int CrystalDamage = 95; + public override void SetDefaults() { Item.width = 18; @@ -49,12 +51,10 @@ namespace CalamityMod.Items.Armor.Daedalus } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Daedalus Crystals spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(95); - var damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + var damage = (int)player.GetTotalDamage().ApplyTo(CrystalDamage); var p = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 50f, 0f); - p.originalDamage = baseDamage; + p.originalDamage = CrystalDamage; } } player.GetDamage() += 0.2f; @@ -72,6 +72,7 @@ namespace CalamityMod.Items.Armor.Daedalus AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Demonshade/DemonshadeHelm.cs b/Items/Armor/Demonshade/DemonshadeHelm.cs index 1abc0de932..2e854e84d2 100644 --- a/Items/Armor/Demonshade/DemonshadeHelm.cs +++ b/Items/Armor/Demonshade/DemonshadeHelm.cs @@ -20,6 +20,10 @@ namespace CalamityMod.Items.Armor.Demonshade public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/DemonshadeEnrage"); internal static string ShadowScytheEntitySourceContext => "SetBonus_Calamity_Demonshade"; + public static int DevilDamage = 1000; + public static float MultDamageBoost = 0.5f; + public static double MultDamageTakenBoost = 0.25D; + public override void SetDefaults() { Item.width = 18; @@ -44,7 +48,7 @@ namespace CalamityMod.Items.Armor.Demonshade public override void UpdateArmorSet(Player player) { var hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey); + player.setBonus = this.GetLocalization("SetBonus").Format(hotkey, (1f + MultDamageBoost).Round(), (1D + MultDamageTakenBoost).Round()); var modPlayer = player.Calamity(); modPlayer.dsSetBonus = true; modPlayer.wearingRogueArmor = true; @@ -59,12 +63,10 @@ namespace CalamityMod.Items.Armor.Demonshade } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Demonshade Red Devils spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - var baseDamage = player.ApplyArmorAccDamageBonusesTo(10000); - var damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int damage = (int)player.GetTotalDamage().ApplyTo(DevilDamage); - var devil = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - devil.originalDamage = baseDamage; + var devil = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 2f, 0f); + devil.originalDamage = DevilDamage; } } player.GetDamage() += 1f; @@ -82,6 +84,7 @@ namespace CalamityMod.Items.Armor.Demonshade CreateRecipe(). AddIngredient(12). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/DesertProwler/DesertProwlerSet.cs b/Items/Armor/DesertProwler/DesertProwlerSet.cs index d2afe3d3aa..7d7bcd3c06 100644 --- a/Items/Armor/DesertProwler/DesertProwlerSet.cs +++ b/Items/Armor/DesertProwler/DesertProwlerSet.cs @@ -205,7 +205,7 @@ namespace CalamityMod.Items.Armor.DesertProwler public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -236,6 +236,7 @@ namespace CalamityMod.Items.Armor.DesertProwler AddIngredient(3). AddIngredient(ItemID.Silk, 10). AddTile(TileID.Loom). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Empyrean/EmpyreanCloak.cs b/Items/Armor/Empyrean/EmpyreanCloak.cs index 1cb1f1d103..bf80cf38b8 100644 --- a/Items/Armor/Empyrean/EmpyreanCloak.cs +++ b/Items/Armor/Empyrean/EmpyreanCloak.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Empyrean public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Empyrean/EmpyreanCloak_Neck", EquipType.Neck, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Empyrean/EmpyreanCloak_Back", EquipType.Back, this); @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index 2dcd7472d1..87b20de371 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Empyrean public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Empyrean/MeldTransformation_Head", EquipType.Head, name: "MeldTransformation"); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Empyrean/MeldTransformation_Body", EquipType.Body, name: "MeldTransformation"); @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; var equipSlotHead = EquipLoader.GetEquipSlot(Mod, "MeldTransformation", EquipType.Head); @@ -68,10 +68,7 @@ namespace CalamityMod.Items.Armor.Empyrean modPlayer.rogueStealthMax += 1.15f; player.setBonus = this.GetLocalizedValue("SetBonus"); if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - { player.AddBuff(ModContent.BuffType(), 2); - player.AddBuff(ModContent.BuffType(), 2); - } player.GetDamage() += 0.09f; modPlayer.rogueVelocity += 0.09f; modPlayer.wearingRogueArmor = true; @@ -90,6 +87,7 @@ namespace CalamityMod.Items.Armor.Empyrean AddIngredient(10). AddIngredient(ItemID.LunarBar, 8). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs index cf89c37fa3..33257e3b8b 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs index f606b5f05e..be0e044c58 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -46,6 +46,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer AddIngredient(10). AddIngredient(5). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs index 0b1ccd16b7..5902d4e52b 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -70,6 +70,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer AddIngredient(6). AddIngredient(3). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index 4454c1f4c7..180a8fbbbd 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -58,11 +58,12 @@ namespace CalamityMod.Items.Armor.Fearmonger BuffID.Frostburn, BuffID.CursedInferno, BuffID.ShadowFlame, //doesn't do anything - BuffID.Daybreak, //doesn't do anything + ModContent.BuffType(), BuffID.Burning, ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType(), + ModContent.BuffType(), ModContent.BuffType(), BuffID.Chilled, BuffID.Frozen, @@ -80,8 +81,8 @@ namespace CalamityMod.Items.Armor.Fearmonger CreateRecipe(). AddIngredient(ItemID.SpookyHelmet). AddIngredient(8). - AddIngredient(ItemID.SoulofFright, 8). AddIngredient(2). + AddIngredient(ItemID.SoulofFright, 8). AddTile(). Register(); } diff --git a/Items/Armor/Fearmonger/FearmongerGreaves.cs b/Items/Armor/Fearmonger/FearmongerGreaves.cs index ae1a160f5a..027cf9af45 100644 --- a/Items/Armor/Fearmonger/FearmongerGreaves.cs +++ b/Items/Armor/Fearmonger/FearmongerGreaves.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Armor.Fearmonger CreateRecipe(). AddIngredient(ItemID.SpookyLeggings). AddIngredient(10). - AddIngredient(ItemID.SoulofFright, 10). AddIngredient(2). + AddIngredient(ItemID.SoulofFright, 10). AddTile(). Register(); } diff --git a/Items/Armor/Fearmonger/FearmongerPlateMail.cs b/Items/Armor/Fearmonger/FearmongerPlateMail.cs index 2429a23224..5226b1d0d7 100644 --- a/Items/Armor/Fearmonger/FearmongerPlateMail.cs +++ b/Items/Armor/Fearmonger/FearmongerPlateMail.cs @@ -33,9 +33,10 @@ namespace CalamityMod.Items.Armor.Fearmonger CreateRecipe(). AddIngredient(ItemID.SpookyBreastplate). AddIngredient(12). - AddIngredient(ItemID.SoulofFright, 12). AddIngredient(3). + AddIngredient(ItemID.SoulofFright, 12). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index b2969b7498..f5566fca6f 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -13,13 +13,19 @@ namespace CalamityMod.Items.Armor public const int tornadoBaseDmg = 80; public const float tornadoBaseKB = 1f; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; + } + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.defense = 1; // This item has the same rarity and sell price as Forbidden Mask - Item.value = Item.buyPrice(gold: 25); + Item.value = Item.sellPrice(gold: 5); Item.rare = ItemRarityID.Pink; Item.Calamity().donorItem = true; } diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index 006989a52d..b35d684234 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -61,13 +61,13 @@ namespace CalamityMod.Items.Armor.GemTech Item.height = 32; Item.defense = 14; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; } public override bool IsArmorSet(Item head, Item body, Item legs) { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + return 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(); @@ -162,6 +162,7 @@ namespace CalamityMod.Items.Armor.GemTech AddIngredient(3). AddIngredient(2). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs index 251f1f7b3a..f03824f29d 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs @@ -62,6 +62,7 @@ namespace CalamityMod.Items.Armor.GodSlayer AddIngredient(7). AddIngredient(2). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs index f5fcdee6ef..0807eb0f7a 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs @@ -59,6 +59,7 @@ namespace CalamityMod.Items.Armor.GodSlayer AddIngredient(7). AddIngredient(2). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs index 5aa027e58f..a83dde4503 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs @@ -62,6 +62,7 @@ namespace CalamityMod.Items.Armor.GodSlayer AddIngredient(7). AddIngredient(2). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Hydrothermic/HydrothermicArmor.cs b/Items/Armor/Hydrothermic/HydrothermicArmor.cs index 9dcc979f64..b1801d6c38 100644 --- a/Items/Armor/Hydrothermic/HydrothermicArmor.cs +++ b/Items/Armor/Hydrothermic/HydrothermicArmor.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(15). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs index 75ac9ea103..6bf014726a 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs @@ -54,8 +54,9 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs index 33fbbab286..c72ee844af 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs @@ -56,8 +56,9 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index e62bf09a14..2a34472a13 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -53,8 +53,9 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index 5abfac1be7..67b16fb6b9 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateEquip(Player player) { - player.Calamity().rogueAmmoCost *= 0.5f; player.GetDamage() += 0.12f; player.GetCritChance() += 10; player.moveSpeed += 0.05f; @@ -56,8 +55,9 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs index b246aae0eb..8b736ec857 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Armor.Hydrothermic public class HydrothermicHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + public static int VentDamage = 190; + public override void SetDefaults() { Item.width = 18; @@ -49,13 +51,11 @@ namespace CalamityMod.Items.Armor.Hydrothermic } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Hydrothermic Vents spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(190); - var damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + var damage = (int)player.GetTotalDamage().ApplyTo(VentDamage); var p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 38f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = VentDamage; } } player.GetDamage() += 0.4f; @@ -74,8 +74,9 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs index 95b528c3c7..7fc86d2269 100644 --- a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs +++ b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(10). - AddIngredient(2). + AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/LunicCorps/LunicCorpsBoots.cs b/Items/Armor/LunicCorps/LunicCorpsBoots.cs index aee18ca025..6844341d52 100644 --- a/Items/Armor/LunicCorps/LunicCorpsBoots.cs +++ b/Items/Armor/LunicCorps/LunicCorpsBoots.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.LunicCorps { player.Calamity().lunicCorpsLegs = true; player.moveSpeed += 0.15f; - player.GetCritChance() += 4; + player.GetCritChance() += 5; } public override void AddRecipes() diff --git a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs index 9333121be6..8f3b9717c3 100644 --- a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs +++ b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs @@ -33,27 +33,32 @@ namespace CalamityMod.Items.Armor.LunicCorps public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(2); // Interface stuff. + public int OwnerPlayer { get; set; } public float RenderDepth => IDyeableShaderRenderer.HaloShieldDepth; - public bool ShaderIsDyeable => false; public bool ShouldDrawDyeableShader { get { - bool result = false; - foreach (Player player in Main.ActivePlayers) - { - if (player.outOfRange || player.dead) - continue; + if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f) + return false; - CalamityPlayer modPlayer = player.Calamity(); + if (OwnerPlayer < 0 || OwnerPlayer >= Main.maxPlayers) + return false; - // Do not render shield if it does not exist - bool shouldntDraw = modPlayer.LunicCorpsShieldDurability <= 0 || modPlayer.drawnAnyShieldThisFrame; - result |= !shouldntDraw; - } - return result; + var player = Main.player[OwnerPlayer]; + if (player is null) + return false; + + if (player.outOfRange || player.dead) + return false; + + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.drawingParameters.LunicShieldCharge <= 0.0f) + return false; + + return true; } } @@ -81,15 +86,15 @@ namespace CalamityMod.Items.Armor.LunicCorps string adrenTooltip = CalamityWorld.revenge ? "\n" + this.GetLocalizedValue("ShieldAdren") : ""; player.setBonus = this.GetLocalization("SetBonus").Format(adrenTooltip); - player.bulletDamage += 0.1f; - player.specialistDamage += 0.1f; + player.bulletDamage += 0.15f; + player.specialistDamage += 0.15f; player.jumpSpeedBoost += 1f; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.12f; + player.GetDamage() += 0.15f; player.nightVision = true; player.detectCreature = true; } @@ -102,6 +107,7 @@ namespace CalamityMod.Items.Armor.LunicCorps AddIngredient(ItemID.ChlorophyteBar, 6). AddIngredient(ItemID.Glass, 20). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } @@ -109,88 +115,70 @@ namespace CalamityMod.Items.Armor.LunicCorps // This is applied as IL (On hook) which draws right before Inferno Ring. public void DrawDyeableShader(SpriteBatch spriteBatch) { - // TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive). - // Lunic Corps shields will be drawn for each player with the Lunic Corps armor, yes. - // But there is no guarantee that the shields will be in the right condition for each player. - // Visibility is not net synced, for example. - bool alreadyDrawnShieldForPlayer = false; + if (OwnerPlayer < 0 || OwnerPlayer >= Main.maxPlayers) + return; - foreach (Player player in Main.ActivePlayers) + var player = Main.player[OwnerPlayer]; + if (player.outOfRange || player.dead) + return; + + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.drawnAnyShieldThisFrame) + return; + + if (modPlayer.drawingParameters.LunicShieldCharge <= 0.0f) + return; + + // Scale the shield is drawn at. The Lunic Corps shield sticks very close to the body to mimic Halo and occasionally pulses. + // The "i" parameter is to make different player's shields not be perfectly synced. + int i = player.whoAmI; + float baseScale = 0.11f; + float maxExtraScale = 0.013f; + float extraScalePulseInterpolant = MathF.Pow(12f, MathF.Sin(Main.GlobalTimeWrappedHourly * 1.6f + i) - 1); + float scale = baseScale + maxExtraScale * extraScalePulseInterpolant; + float visualShieldStrength = modPlayer.drawingParameters.LunicShieldCharge; + + // 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. + float noiseScale = MathHelper.Lerp(0.65f, 0.75f, 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.87f + i)); + + // Define shader parameters + Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; + shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay + shieldEffect.Parameters["blowUpPower"].SetValue(2.8f); + shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); + shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); + + // Shield opacity multiplier slightly changes, this is independent of current shield strength + float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f); + float minShieldStrengthOpacityMultiplier = 0.5f; + float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength); + finalShieldOpacity *= CalamityClientConfig.Instance.EnergyShieldOpacity; + + shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); + shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); + + // Lunic Corps shields are not team specific + Color shieldColor = new Color(201, 180, 129); + Color primaryEdgeColor = new Color(232, 212, 175); + Color secondaryEdgeColor = new Color(237, 205, 145); + Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor); + + // Define shader parameters for shield color + shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); + shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + + Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, Matrix.Identity, () => { - if (player.outOfRange || player.dead) - continue; - - CalamityPlayer modPlayer = player.Calamity(); - - // Do not render shield if it does not exist - if (modPlayer.LunicCorpsShieldDurability <= 0 || modPlayer.drawnAnyShieldThisFrame) - continue; - - // Scale the shield is drawn at. The Lunic Corps shield sticks very close to the body to mimic Halo and occasionally pulses. - // The "i" parameter is to make different player's shields not be perfectly synced. - int i = player.whoAmI; - float baseScale = 0.11f; - float maxExtraScale = 0.013f; - float extraScalePulseInterpolant = MathF.Pow(12f, MathF.Sin(Main.GlobalTimeWrappedHourly * 1.6f + i) - 1); - float scale = baseScale + maxExtraScale * extraScalePulseInterpolant; - - if (!alreadyDrawnShieldForPlayer) - { - // Again, I believe there is no way this looks correct when two players have Lunic Corps armor equipped. - CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity(); - float shieldDurabilityRatio = localModPlayer.LunicCorpsShieldDurability / (float)ShieldDurabilityMax; - float visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); - - // 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. - float noiseScale = MathHelper.Lerp(0.65f, 0.75f, 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.87f + i)); - - // Define shader parameters - Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; - shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay - shieldEffect.Parameters["blowUpPower"].SetValue(2.8f); - shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); - shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); - - // Shield opacity multiplier slightly changes, this is independent of current shield strength - float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f); - float minShieldStrengthOpacityMultiplier = 0.5f; - float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength); - shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); - shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - - // Lunic Corps shields are not team specific - Color shieldColor = new Color(201, 180, 129); - Color primaryEdgeColor = new Color(232, 212, 175); - Color secondaryEdgeColor = new Color(237, 205, 145); - Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor); - - // Define shader parameters for shield color - shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); - shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); - - // GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS - // yes I copy pasted that comment, I hate end begin that much - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); - } - - alreadyDrawnShieldForPlayer = true; - modPlayer.drawnAnyShieldThisFrame = true; - // Fetch shield noise overlay texture (this is the polygons fed to the shader) NoiseTex ??= ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/VoronoiShapes2"); Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition; Texture2D tex = NoiseTex.Value; spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); - } + }); - if (alreadyDrawnShieldForPlayer) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); - } + modPlayer.drawnAnyShieldThisFrame = true; } } } diff --git a/Items/Armor/LunicCorps/LunicCorpsVest.cs b/Items/Armor/LunicCorps/LunicCorpsVest.cs index 104d829934..0eabd12224 100644 --- a/Items/Armor/LunicCorps/LunicCorpsVest.cs +++ b/Items/Armor/LunicCorps/LunicCorpsVest.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Items.Armor.LunicCorps Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityCyanBuyPrice; - Item.defense = 20; + Item.defense = 24; Item.rare = ItemRarityID.Cyan; Item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.03f; - player.GetCritChance() += 11; + player.GetDamage() += 0.05f; + player.GetCritChance() += 15; } public override void AddRecipes() @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Armor.LunicCorps AddIngredient(11). AddIngredient(ItemID.ChlorophyteBar, 11). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs index e2fae35316..bc1b1eaadc 100644 --- a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs +++ b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect orig(self); } - public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType(); + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType(); public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType(); public bool IsPartOfSet(Item item) => item.type == ItemType() || item.type == ItemType(); @@ -138,14 +138,14 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/MarniteArchitect/MarniteArchitectToga_Legs", EquipType.Legs, this); } public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; } @@ -205,7 +205,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public override void PostUpdateMiscEffects() { - if (!setEquipped && Player.mount.Type == ModContent.MountType() && Player.mount.Active) + if (!setEquipped && Player.mount.Type == MountType() && Player.mount.Active) Player.mount.Dismount(Player); if (mounted) @@ -366,9 +366,9 @@ namespace CalamityMod.Items.Armor.MarniteArchitect MountData.playerHeadOffset = 4; //Sprites - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - MountData.frontTextureGlow = ModContent.Request("CalamityMod/Items/Armor/MarniteArchitect/MarniteLiftFire"); + MountData.frontTextureGlow = Request("CalamityMod/Items/Armor/MarniteArchitect/MarniteLiftFire"); } } diff --git a/Items/Armor/Mollusk/MolluskShelleggings.cs b/Items/Armor/Mollusk/MolluskShelleggings.cs index ed92e3077d..607fdb87d5 100644 --- a/Items/Armor/Mollusk/MolluskShelleggings.cs +++ b/Items/Armor/Mollusk/MolluskShelleggings.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Armor.Mollusk Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 15; + Item.defense = 12; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.12f; + player.GetDamage() += 0.06f; player.GetCritChance() += 4; - player.moveSpeed -= 0.07f; + player.Calamity().molluskLegs = true; } public override void AddRecipes() diff --git a/Items/Armor/Mollusk/MolluskShellmet.cs b/Items/Armor/Mollusk/MolluskShellmet.cs index ac81a9a397..180be5c2c6 100644 --- a/Items/Armor/Mollusk/MolluskShellmet.cs +++ b/Items/Armor/Mollusk/MolluskShellmet.cs @@ -1,7 +1,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -15,13 +15,15 @@ namespace CalamityMod.Items.Armor.Mollusk public class MolluskShellmet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + public static int ShellfishDamage = 140; + public override void SetDefaults() { Item.width = 22; Item.height = 22; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 18; + Item.defense = 15; } public override void UpdateEquip(Player player) @@ -29,6 +31,7 @@ namespace CalamityMod.Items.Armor.Mollusk player.ignoreWater = true; player.GetDamage() += 0.05f; player.GetCritChance() += 4; + player.Calamity().molluskHelmet = true; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -39,10 +42,8 @@ namespace CalamityMod.Items.Armor.Mollusk public override void UpdateArmorSet(Player player) { player.setBonus = this.GetLocalizedValue("SetBonus"); - var modPlayer = player.Calamity(); - player.GetDamage() += 0.1f; - modPlayer.molluskSet = true; - player.maxMinions += 4; + player.endurance += 0.1f; + player.maxMinions += 4; // These are allocated for the Shellfish minions; there is no net change in minion slots. if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_ItemUse(Item); @@ -52,12 +53,8 @@ namespace CalamityMod.Items.Armor.Mollusk } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) { - // 08DEC2023: Ozzatron: Clams spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(140); - // wait why does this not scale with summon damage - - Projectile clam = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), baseDamage, 0f, player.whoAmI); - clam.originalDamage = baseDamage; + Projectile clam = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), ShellfishDamage, 0f, player.whoAmI); + clam.originalDamage = ShellfishDamage; } } player.Calamity().wearingRogueArmor = true; @@ -69,6 +66,7 @@ namespace CalamityMod.Items.Armor.Mollusk AddIngredient(6). AddIngredient(15). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Mollusk/MolluskShellplate.cs b/Items/Armor/Mollusk/MolluskShellplate.cs index f8813d3250..881bed8097 100644 --- a/Items/Armor/Mollusk/MolluskShellplate.cs +++ b/Items/Armor/Mollusk/MolluskShellplate.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Armor.Mollusk Item.height = 22; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 22; + Item.defense = 18; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 6; - player.moveSpeed -= 0.15f; + player.GetDamage() += 0.06f; + player.GetCritChance() += 5; + player.Calamity().molluskChest = true; } public override void AddRecipes() @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Armor.Mollusk AddIngredient(15). AddIngredient(25). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index cd1bde96a9..86e43aab19 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index c346df4cee..f431d2621b 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/OmegaBlue/OmegaBlueHelmet_HeadMadness", EquipType.Head, name: "OmegaBlueTransformation"); } @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; var equipSlotHead = EquipLoader.GetEquipSlot(Mod, "OmegaBlueTransformation", EquipType.Head); ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; @@ -94,6 +94,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue AddIngredient(12). AddIngredient(). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index 444b81aa4e..54f1cbbf0a 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); diff --git a/Items/Armor/PlagueReaper/PlagueReaperMask.cs b/Items/Armor/PlagueReaper/PlagueReaperMask.cs index 743937c551..c483c15e15 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperMask.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper Item.height = 18; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.defense = 9; //35 + Item.defense = 11; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -61,7 +61,6 @@ namespace CalamityMod.Items.Armor.PlagueReaper if (player.miscCounter % 10 == 0) { var damage = (int)player.GetTotalDamage().ApplyTo(40); - damage = player.ApplyArmorAccDamageBonusesTo(damage); var cinder = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 4f, player.whoAmI); if (cinder.whoAmI.WithinBounds(Main.maxProjectiles)) diff --git a/Items/Armor/PlagueReaper/PlagueReaperStriders.cs b/Items/Armor/PlagueReaper/PlagueReaperStriders.cs index 4b2492d575..72f7fb5256 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperStriders.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperStriders.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper Item.height = 18; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.defense = 11; + Item.defense = 14; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/PlagueReaper/PlagueReaperVest.cs b/Items/Armor/PlagueReaper/PlagueReaperVest.cs index 02b6c3132a..1016e203d4 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperVest.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper Item.height = 18; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.defense = 14; + Item.defense = 19; } public override void UpdateEquip(Player player) @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper AddIngredient(29). AddIngredient(ItemID.Nanites, 19). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs index b2aa04d2b7..dc7245ce1a 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Plaguebringer public new string LocalizationCategory => "Items.Armor.Hardmode"; public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -44,8 +44,8 @@ namespace CalamityMod.Items.Armor.Plaguebringer CreateRecipe(). AddIngredient(ItemID.BeeBreastplate). AddIngredient(2). - AddIngredient(7). AddIngredient(7). + AddIngredient(7). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Plaguebringer/PlaguebringerPistons.cs b/Items/Armor/Plaguebringer/PlaguebringerPistons.cs index 005095a0fa..488bf88d8c 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerPistons.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerPistons.cs @@ -133,8 +133,8 @@ namespace CalamityMod.Items.Armor.Plaguebringer CreateRecipe(). AddIngredient(ItemID.BeeGreaves). AddIngredient(ItemID.FlowerBoots). - AddIngredient(5). AddIngredient(5). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Plaguebringer/PlaguebringerVisor.cs b/Items/Armor/Plaguebringer/PlaguebringerVisor.cs index b176b70614..92ed645a33 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerVisor.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerVisor.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Armor.Plaguebringer { public new string LocalizationCategory => "Items.Armor.Hardmode"; public const int PlagueDashIFrames = 12; + public static int BeeMinionDamage = 25; public override void SetDefaults() { @@ -58,13 +59,11 @@ namespace CalamityMod.Items.Armor.Plaguebringer } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Plaguebringer armor dudes spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(25); - var damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + var damage = (int)player.GetTotalDamage().ApplyTo(BeeMinionDamage); var p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = BeeMinionDamage; } } @@ -76,9 +75,10 @@ namespace CalamityMod.Items.Armor.Plaguebringer { CreateRecipe(). AddIngredient(ItemID.BeeHeadgear). - AddIngredient(4). AddIngredient(4). + AddIngredient(4). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Prismatic/PrismaticHelmet.cs b/Items/Armor/Prismatic/PrismaticHelmet.cs index cb71e7273a..fa39d36891 100644 --- a/Items/Armor/Prismatic/PrismaticHelmet.cs +++ b/Items/Armor/Prismatic/PrismaticHelmet.cs @@ -61,6 +61,7 @@ namespace CalamityMod.Items.Armor.Prismatic AddIngredient(4). AddIngredient(ItemID.Nanites, 300). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Prismatic/PrismaticRegalia.cs b/Items/Armor/Prismatic/PrismaticRegalia.cs index cf33906e55..fbb6023108 100644 --- a/Items/Armor/Prismatic/PrismaticRegalia.cs +++ b/Items/Armor/Prismatic/PrismaticRegalia.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Prismatic public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Armor.Prismatic AddIngredient(8). AddIngredient(ItemID.Nanites, 300). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index 4fb96d018e..116c8e422e 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -78,6 +78,7 @@ namespace CalamityMod.Items.Armor.Reaver AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Reaver/ReaverHeadMobility.cs b/Items/Armor/Reaver/ReaverHeadMobility.cs index 5ae977cc60..f6f861a712 100644 --- a/Items/Armor/Reaver/ReaverHeadMobility.cs +++ b/Items/Armor/Reaver/ReaverHeadMobility.cs @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Armor.Reaver AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index 77d56d0339..0aff26f2c8 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -13,6 +13,9 @@ namespace CalamityMod.Items.Armor.Reaver public new string LocalizationCategory => "Items.Armor.Hardmode"; internal static string HealOrbEntitySourceContext => "SetBonus_Calamity_ReaverTank"; + public static int ReaverRageDefenseBoost = 5; + public static float ReaverRageDamageBoost = 0.1f; + //Defense and DR Helm public override void SetDefaults() { @@ -45,7 +48,6 @@ namespace CalamityMod.Items.Armor.Reaver modPlayer.reaverDefense = true; modPlayer.wearingRogueArmor = true; player.setBonus = this.GetLocalizedValue("SetBonus"); - // Reaver Rage provides 10% damage, 5 def, and 5% melee speed. } public override void UpdateEquip(Player player) @@ -62,6 +64,7 @@ namespace CalamityMod.Items.Armor.Reaver AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Reaver/ReaverScaleMail.cs b/Items/Armor/Reaver/ReaverScaleMail.cs index ef24dc9ec5..4b4f5a5f6d 100644 --- a/Items/Armor/Reaver/ReaverScaleMail.cs +++ b/Items/Armor/Reaver/ReaverScaleMail.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Reaver public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -43,6 +43,7 @@ namespace CalamityMod.Items.Armor.Reaver AddIngredient(15). AddIngredient(3). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Silva/SilvaArmor.cs b/Items/Armor/Silva/SilvaArmor.cs index c9f6fa1c0a..0aa94e0c19 100644 --- a/Items/Armor/Silva/SilvaArmor.cs +++ b/Items/Armor/Silva/SilvaArmor.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; diff --git a/Items/Armor/Silva/SilvaHeadMagic.cs b/Items/Armor/Silva/SilvaHeadMagic.cs index f74ca35b2b..468d54a814 100644 --- a/Items/Armor/Silva/SilvaHeadMagic.cs +++ b/Items/Armor/Silva/SilvaHeadMagic.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Armor.Silva AddIngredient(5). AddIngredient(2). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Silva/SilvaHeadSummon.cs b/Items/Armor/Silva/SilvaHeadSummon.cs index 5901af6fac..d6d3c29800 100644 --- a/Items/Armor/Silva/SilvaHeadSummon.cs +++ b/Items/Armor/Silva/SilvaHeadSummon.cs @@ -1,7 +1,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -61,6 +61,7 @@ namespace CalamityMod.Items.Armor.Silva AddIngredient(5). AddIngredient(2). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Silva/SilvaLeggings.cs b/Items/Armor/Silva/SilvaLeggings.cs index 887ee8d864..9a7be46dde 100644 --- a/Items/Armor/Silva/SilvaLeggings.cs +++ b/Items/Armor/Silva/SilvaLeggings.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; diff --git a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs index cc726ffdc5..c9cc263a73 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/SnowRuffian/SnowRuffianChestplate_Back", EquipType.Back, this); @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/SnowRuffian/SnowRuffianMask.cs b/Items/Armor/SnowRuffian/SnowRuffianMask.cs index f995a21e32..c05014c4cb 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianMask.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianMask.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/SnowRuffian/SnowRuffianWings", EquipType.Wings, this, equipTexture: new SnowRuffianWings()); } @@ -71,6 +71,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian AddRecipeGroup("AnySnowBlock", 20). AddIngredient(ItemID.FlinxFur). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Statigel/StatigelArmor.cs b/Items/Armor/Statigel/StatigelArmor.cs index 61dd19de8f..0ff1c28e1f 100644 --- a/Items/Armor/Statigel/StatigelArmor.cs +++ b/Items/Armor/Statigel/StatigelArmor.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Statigel public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/Statigel/StatigelHeadMagic.cs b/Items/Armor/Statigel/StatigelHeadMagic.cs index c5539d4e86..e4c60df6fc 100644 --- a/Items/Armor/Statigel/StatigelHeadMagic.cs +++ b/Items/Armor/Statigel/StatigelHeadMagic.cs @@ -50,6 +50,7 @@ namespace CalamityMod.Items.Armor.Statigel AddIngredient(5). AddIngredient(5). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Statigel/StatigelHeadMelee.cs b/Items/Armor/Statigel/StatigelHeadMelee.cs index e969579b15..078d4805df 100644 --- a/Items/Armor/Statigel/StatigelHeadMelee.cs +++ b/Items/Armor/Statigel/StatigelHeadMelee.cs @@ -50,6 +50,7 @@ namespace CalamityMod.Items.Armor.Statigel AddIngredient(5). AddIngredient(5). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Statigel/StatigelHeadRanged.cs b/Items/Armor/Statigel/StatigelHeadRanged.cs index fa19f1e0e4..25820004c8 100644 --- a/Items/Armor/Statigel/StatigelHeadRanged.cs +++ b/Items/Armor/Statigel/StatigelHeadRanged.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Items.Armor.Statigel AddIngredient(5). AddIngredient(5). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Statigel/StatigelHeadRogue.cs b/Items/Armor/Statigel/StatigelHeadRogue.cs index eb6e0d4bbf..fab0c20533 100644 --- a/Items/Armor/Statigel/StatigelHeadRogue.cs +++ b/Items/Armor/Statigel/StatigelHeadRogue.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Items.Armor.Statigel public override void UpdateEquip(Player player) { - player.Calamity().rogueAmmoCost *= 0.66f; player.GetDamage() += 0.1f; player.GetCritChance() += 7; player.moveSpeed += 0.05f; @@ -52,6 +51,7 @@ namespace CalamityMod.Items.Armor.Statigel AddIngredient(5). AddIngredient(5). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Statigel/StatigelHeadSummon.cs b/Items/Armor/Statigel/StatigelHeadSummon.cs index e6cbde0e68..44b9d4b2f4 100644 --- a/Items/Armor/Statigel/StatigelHeadSummon.cs +++ b/Items/Armor/Statigel/StatigelHeadSummon.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Armor.Statigel public class StatigelHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + public static int SlimeDamage = 18; + public override void SetDefaults() { Item.width = 18; @@ -49,11 +51,8 @@ namespace CalamityMod.Items.Armor.Statigel player.AddBuff(ModContent.BuffType(), 3600, true); } - 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(18); - var minionDamage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int minionID = -1; + int minionDamage = (int)player.GetTotalDamage().ApplyTo(SlimeDamage); if (WorldGen.crimson && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) minionID = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), minionDamage, 0f, Main.myPlayer); @@ -61,7 +60,7 @@ namespace CalamityMod.Items.Armor.Statigel minionID = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), minionDamage, 0f, Main.myPlayer); if (Main.projectile.IndexInRange(minionID)) - Main.projectile[minionID].originalDamage = baseDamage; + Main.projectile[minionID].originalDamage = SlimeDamage; } } @@ -76,6 +75,7 @@ namespace CalamityMod.Items.Armor.Statigel AddIngredient(5). AddIngredient(5). AddTile(). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Sulphurous/SulphurousBreastplate.cs b/Items/Armor/Sulphurous/SulphurousBreastplate.cs index 6848c2825b..bf6118be31 100644 --- a/Items/Armor/Sulphurous/SulphurousBreastplate.cs +++ b/Items/Armor/Sulphurous/SulphurousBreastplate.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Armor/Sulphurous/SulphurousHelmet.cs b/Items/Armor/Sulphurous/SulphurousHelmet.cs index f7375d88c0..2f3b5b0f9f 100644 --- a/Items/Armor/Sulphurous/SulphurousHelmet.cs +++ b/Items/Armor/Sulphurous/SulphurousHelmet.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.ExtraJumps; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,6 +52,7 @@ namespace CalamityMod.Items.Armor.Sulphurous AddIngredient(10). AddIngredient(10). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Sulphurous/SulphurousLeggings.cs b/Items/Armor/Sulphurous/SulphurousLeggings.cs index 5968958d92..ada7ef2a1b 100644 --- a/Items/Armor/Sulphurous/SulphurousLeggings.cs +++ b/Items/Armor/Sulphurous/SulphurousLeggings.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Armor/Tarragon/TarragonHeadMagic.cs b/Items/Armor/Tarragon/TarragonHeadMagic.cs index b46d33d1a1..d51fa12857 100644 --- a/Items/Armor/Tarragon/TarragonHeadMagic.cs +++ b/Items/Armor/Tarragon/TarragonHeadMagic.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Items.Armor.Tarragon AddIngredient(7). AddIngredient(6). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Tarragon/TarragonHeadMelee.cs b/Items/Armor/Tarragon/TarragonHeadMelee.cs index a4318fd9fa..94f2ae5883 100644 --- a/Items/Armor/Tarragon/TarragonHeadMelee.cs +++ b/Items/Armor/Tarragon/TarragonHeadMelee.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void UpdateEquip(Player player) { player.GetDamage() += 0.12f; - player.GetCritChance() += 10; + player.GetCritChance() += 7; player.endurance += 0.1f; } @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Armor.Tarragon AddIngredient(7). AddIngredient(6). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Tarragon/TarragonHeadRanged.cs b/Items/Armor/Tarragon/TarragonHeadRanged.cs index 792ea770cb..7d29dbab8a 100644 --- a/Items/Armor/Tarragon/TarragonHeadRanged.cs +++ b/Items/Armor/Tarragon/TarragonHeadRanged.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Armor.Tarragon AddIngredient(7). AddIngredient(6). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Tarragon/TarragonHeadRogue.cs b/Items/Armor/Tarragon/TarragonHeadRogue.cs index f23bb9b49f..91f8785758 100644 --- a/Items/Armor/Tarragon/TarragonHeadRogue.cs +++ b/Items/Armor/Tarragon/TarragonHeadRogue.cs @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Armor.Tarragon AddIngredient(7). AddIngredient(6). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Tarragon/TarragonHeadSummon.cs b/Items/Armor/Tarragon/TarragonHeadSummon.cs index c7cccc2570..ebaadb2a02 100644 --- a/Items/Armor/Tarragon/TarragonHeadSummon.cs +++ b/Items/Armor/Tarragon/TarragonHeadSummon.cs @@ -57,6 +57,7 @@ namespace CalamityMod.Items.Armor.Tarragon AddIngredient(7). AddIngredient(6). AddTile(TileID.LunarCraftingStation). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/TitanHeart/TitanHeartBoots.cs b/Items/Armor/TitanHeart/TitanHeartBoots.cs index a63ac888c6..ae7ef7e9f4 100644 --- a/Items/Armor/TitanHeart/TitanHeartBoots.cs +++ b/Items/Armor/TitanHeart/TitanHeartBoots.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Armor/TitanHeart/TitanHeartMantle.cs b/Items/Armor/TitanHeart/TitanHeartMantle.cs index cc8ca16d7c..fbd3c17cd5 100644 --- a/Items/Armor/TitanHeart/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeart/TitanHeartMantle.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.TitanHeart public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -34,9 +34,7 @@ namespace CalamityMod.Items.Armor.TitanHeart public override void UpdateEquip(Player player) { player.Calamity().titanHeartMantle = true; - player.Calamity().rogueAmmoCost *= 0.55f; - // 15% attack speed penalty - player.GetAttackSpeed() -= 0.15f; + player.GetDamage() += 0.05f; } public override void AddRecipes() @@ -45,6 +43,7 @@ namespace CalamityMod.Items.Armor.TitanHeart AddIngredient(20). AddIngredient(). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/TitanHeart/TitanHeartMask.cs b/Items/Armor/TitanHeart/TitanHeartMask.cs index 850e1feb01..03b99c9fa4 100644 --- a/Items/Armor/TitanHeart/TitanHeartMask.cs +++ b/Items/Armor/TitanHeart/TitanHeartMask.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Armor.TitanHeart player.setBonus = this.GetLocalizedValue("SetBonus"); var modPlayer = player.Calamity(); modPlayer.titanHeartSet = true; - player.GetDamage() += 0.15f; + player.GetDamage() += 0.10f; modPlayer.rogueStealthMax += 1f; modPlayer.wearingRogueArmor = true; player.noKnockback = true; @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Armor.TitanHeart AddIngredient(10). AddIngredient(). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Umbraphile/UmbraphileBoots.cs b/Items/Armor/Umbraphile/UmbraphileBoots.cs index ee8a1dcc3b..e48dd4b34e 100644 --- a/Items/Armor/Umbraphile/UmbraphileBoots.cs +++ b/Items/Armor/Umbraphile/UmbraphileBoots.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Umbraphile Item.height = 18; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 12; + Item.defense = 14; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Umbraphile/UmbraphileHood.cs b/Items/Armor/Umbraphile/UmbraphileHood.cs index d9722652e7..0c5da98a99 100644 --- a/Items/Armor/Umbraphile/UmbraphileHood.cs +++ b/Items/Armor/Umbraphile/UmbraphileHood.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Umbraphile Item.height = 20; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 8; //36 + Item.defense = 10; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -50,6 +50,7 @@ namespace CalamityMod.Items.Armor.Umbraphile AddIngredient(12). AddIngredient(ItemID.HallowedBar, 8). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Umbraphile/UmbraphileRegalia.cs b/Items/Armor/Umbraphile/UmbraphileRegalia.cs index cffbf86c76..f281752294 100644 --- a/Items/Armor/Umbraphile/UmbraphileRegalia.cs +++ b/Items/Armor/Umbraphile/UmbraphileRegalia.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Umbraphile Item.height = 24; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 16; + Item.defense = 18; } public override void UpdateEquip(Player player) @@ -30,6 +30,7 @@ namespace CalamityMod.Items.Armor.Umbraphile AddIngredient(18). AddIngredient(ItemID.HallowedBar, 15). AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Vanity/AnahitaMask.cs b/Items/Armor/Vanity/AnahitaMask.cs index 4db1f50099..d0e4ddd1be 100644 --- a/Items/Armor/Vanity/AnahitaMask.cs +++ b/Items/Armor/Vanity/AnahitaMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs index 11e44aab09..448662c671 100644 --- a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs +++ b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 28; Item.height = 20; - Item.rare = ModContent.RarityType(); Item.vanity = true; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = Item.sellPrice(gold: 12); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm.cs b/Items/Armor/Vanity/AncientGodSlayerHelm.cs index 2a605d9dc4..04f3f01831 100644 --- a/Items/Armor/Vanity/AncientGodSlayerHelm.cs +++ b/Items/Armor/Vanity/AncientGodSlayerHelm.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 28; Item.height = 20; - Item.rare = ModContent.RarityType(); - Item.value = Item.buyPrice(0, 75, 0, 0); Item.vanity = true; + Item.value = Item.sellPrice(gold: 15); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs index 5075c6bf6d..58956bdeed 100644 --- a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs +++ b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 28; Item.height = 20; - Item.rare = ModContent.RarityType(); - Item.value = Item.buyPrice(0, 45, 0, 0); Item.vanity = true; + Item.value = Item.sellPrice(gold: 9); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Armor/Vanity/ApolloMask.cs b/Items/Armor/Vanity/ApolloMask.cs index 4fa5fab09d..afc0ea202e 100644 --- a/Items/Armor/Vanity/ApolloMask.cs +++ b/Items/Armor/Vanity/ApolloMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public new string LocalizationCategory => "Items.Armor.Vanity"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } diff --git a/Items/Armor/Vanity/AquaticScourgeMask.cs b/Items/Armor/Vanity/AquaticScourgeMask.cs index be678d7788..e9b9122e74 100644 --- a/Items/Armor/Vanity/AquaticScourgeMask.cs +++ b/Items/Armor/Vanity/AquaticScourgeMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/AresMask.cs b/Items/Armor/Vanity/AresMask.cs index aa5580989e..55990036be 100644 --- a/Items/Armor/Vanity/AresMask.cs +++ b/Items/Armor/Vanity/AresMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/ArtemisMask.cs b/Items/Armor/Vanity/ArtemisMask.cs index b7566aee1f..bd26d7cf43 100644 --- a/Items/Armor/Vanity/ArtemisMask.cs +++ b/Items/Armor/Vanity/ArtemisMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public new string LocalizationCategory => "Items.Armor.Vanity"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } diff --git a/Items/Armor/Vanity/AshenHorns.cs b/Items/Armor/Vanity/AshenHorns.cs index 7837db098a..3810a096c6 100644 --- a/Items/Armor/Vanity/AshenHorns.cs +++ b/Items/Armor/Vanity/AshenHorns.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; } diff --git a/Items/Armor/Vanity/AstrumAureusMask.cs b/Items/Armor/Vanity/AstrumAureusMask.cs index e1fef0a232..f6d7c70af8 100644 --- a/Items/Armor/Vanity/AstrumAureusMask.cs +++ b/Items/Armor/Vanity/AstrumAureusMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -21,6 +21,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 30; Item.height = 28; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/AstrumDeusMask.cs b/Items/Armor/Vanity/AstrumDeusMask.cs index 02f8e896a6..defb99a107 100644 --- a/Items/Armor/Vanity/AstrumDeusMask.cs +++ b/Items/Armor/Vanity/AstrumDeusMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/BrimstoneWaifuMask.cs b/Items/Armor/Vanity/BrimstoneWaifuMask.cs index 0b924dfe7e..f71c4a3de6 100644 --- a/Items/Armor/Vanity/BrimstoneWaifuMask.cs +++ b/Items/Armor/Vanity/BrimstoneWaifuMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 30; Item.height = 28; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/BumblefuckMask.cs b/Items/Armor/Vanity/BumblefuckMask.cs index daa49fa6a4..481ff50a11 100644 --- a/Items/Armor/Vanity/BumblefuckMask.cs +++ b/Items/Armor/Vanity/BumblefuckMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/CalamitasCloneMask.cs b/Items/Armor/Vanity/CalamitasCloneMask.cs index 70e99716a0..1f75c613ff 100644 --- a/Items/Armor/Vanity/CalamitasCloneMask.cs +++ b/Items/Armor/Vanity/CalamitasCloneMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -21,6 +21,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/CeaselessVoidMask.cs b/Items/Armor/Vanity/CeaselessVoidMask.cs index b904b2dc40..d4899c0b68 100644 --- a/Items/Armor/Vanity/CeaselessVoidMask.cs +++ b/Items/Armor/Vanity/CeaselessVoidMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/CrabulonMask.cs b/Items/Armor/Vanity/CrabulonMask.cs index 9762528cb5..a8c620fc2d 100644 --- a/Items/Armor/Vanity/CrabulonMask.cs +++ b/Items/Armor/Vanity/CrabulonMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/CryogenMask.cs b/Items/Armor/Vanity/CryogenMask.cs index f040947bf1..12741e7ead 100644 --- a/Items/Armor/Vanity/CryogenMask.cs +++ b/Items/Armor/Vanity/CryogenMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/DesertScourgeMask.cs b/Items/Armor/Vanity/DesertScourgeMask.cs index 2f02591f1b..b37f3cb573 100644 --- a/Items/Armor/Vanity/DesertScourgeMask.cs +++ b/Items/Armor/Vanity/DesertScourgeMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/DevourerofGodsMask.cs b/Items/Armor/Vanity/DevourerofGodsMask.cs index 66d8800593..b6bbfcc6f4 100644 --- a/Items/Armor/Vanity/DevourerofGodsMask.cs +++ b/Items/Armor/Vanity/DevourerofGodsMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/DraedonMask.cs b/Items/Armor/Vanity/DraedonMask.cs index cdc742b38c..7bb08b12a8 100644 --- a/Items/Armor/Vanity/DraedonMask.cs +++ b/Items/Armor/Vanity/DraedonMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/GodSlayerHornedHelm.cs b/Items/Armor/Vanity/GodSlayerHornedHelm.cs index eb8a44b99d..0a003faafb 100644 --- a/Items/Armor/Vanity/GodSlayerHornedHelm.cs +++ b/Items/Armor/Vanity/GodSlayerHornedHelm.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; + Item.value = Item.buyPrice(gold: 8); // Sold by Clothier Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Vanity/GodSlayerVisage.cs b/Items/Armor/Vanity/GodSlayerVisage.cs index 40ba0f37dd..1c42f8c041 100644 --- a/Items/Armor/Vanity/GodSlayerVisage.cs +++ b/Items/Armor/Vanity/GodSlayerVisage.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; + Item.value = Item.buyPrice(gold: 8); // Sold by Clothier Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Vanity/HiveMindMask.cs b/Items/Armor/Vanity/HiveMindMask.cs index 31ff5b076d..1baf6973ee 100644 --- a/Items/Armor/Vanity/HiveMindMask.cs +++ b/Items/Armor/Vanity/HiveMindMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/HoodOfCalamity.cs b/Items/Armor/Vanity/HoodOfCalamity.cs index 8b98f05fdb..1a89bb31a8 100644 --- a/Items/Armor/Vanity/HoodOfCalamity.cs +++ b/Items/Armor/Vanity/HoodOfCalamity.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/LeviathanMask.cs b/Items/Armor/Vanity/LeviathanMask.cs index 8b3f4008f9..1b6b038443 100644 --- a/Items/Armor/Vanity/LeviathanMask.cs +++ b/Items/Armor/Vanity/LeviathanMask.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/OldDukeMask.cs b/Items/Armor/Vanity/OldDukeMask.cs index 03c00611bb..4472de8a11 100644 --- a/Items/Armor/Vanity/OldDukeMask.cs +++ b/Items/Armor/Vanity/OldDukeMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/OldHunterSet.cs b/Items/Armor/Vanity/OldHunterSet.cs index 03471b531d..475720b465 100644 --- a/Items/Armor/Vanity/OldHunterSet.cs +++ b/Items/Armor/Vanity/OldHunterSet.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/OldHunterShirt_Back", EquipType.Back, this); @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/Vanity/PerforatorMask.cs b/Items/Armor/Vanity/PerforatorMask.cs index 03148413bf..dc96749f0a 100644 --- a/Items/Armor/Vanity/PerforatorMask.cs +++ b/Items/Armor/Vanity/PerforatorMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs index 148f99be3e..0b9a9eea9e 100644 --- a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs +++ b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/PolterghastMask.cs b/Items/Armor/Vanity/PolterghastMask.cs index e0b4a533ff..f5dd75fad8 100644 --- a/Items/Armor/Vanity/PolterghastMask.cs +++ b/Items/Armor/Vanity/PolterghastMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/ProfanedGuardianMask.cs b/Items/Armor/Vanity/ProfanedGuardianMask.cs index 02e6f1d34c..ea757ab72b 100644 --- a/Items/Armor/Vanity/ProfanedGuardianMask.cs +++ b/Items/Armor/Vanity/ProfanedGuardianMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/ProvidenceMask.cs b/Items/Armor/Vanity/ProvidenceMask.cs index 289def74b9..91bfcdfc53 100644 --- a/Items/Armor/Vanity/ProvidenceMask.cs +++ b/Items/Armor/Vanity/ProvidenceMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/RavagerMask.cs b/Items/Armor/Vanity/RavagerMask.cs index 6e7c7352a2..bf83218b34 100644 --- a/Items/Armor/Vanity/RavagerMask.cs +++ b/Items/Armor/Vanity/RavagerMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/RobesOfCalamity.cs b/Items/Armor/Vanity/RobesOfCalamity.cs index dad5b38905..cf7c73c7c3 100644 --- a/Items/Armor/Vanity/RobesOfCalamity.cs +++ b/Items/Armor/Vanity/RobesOfCalamity.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public new string LocalizationCategory => "Items.Armor.Vanity"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/RobesOfCalamity_Legs", EquipType.Legs, this); } diff --git a/Items/Armor/Vanity/SCalMask.cs b/Items/Armor/Vanity/SCalMask.cs index a83226b508..543959bb77 100644 --- a/Items/Armor/Vanity/SCalMask.cs +++ b/Items/Armor/Vanity/SCalMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/SCalRobes.cs b/Items/Armor/Vanity/SCalRobes.cs index fb1ccb4200..957153739f 100644 --- a/Items/Armor/Vanity/SCalRobes.cs +++ b/Items/Armor/Vanity/SCalRobes.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; diff --git a/Items/Armor/Vanity/SignusMask.cs b/Items/Armor/Vanity/SignusMask.cs index 6936aac06e..1cf13e9b43 100644 --- a/Items/Armor/Vanity/SignusMask.cs +++ b/Items/Armor/Vanity/SignusMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/SilvaHelm.cs b/Items/Armor/Vanity/SilvaHelm.cs index c5434dbec7..b5875fd67e 100644 --- a/Items/Armor/Vanity/SilvaHelm.cs +++ b/Items/Armor/Vanity/SilvaHelm.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 24; Item.height = 20; - Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; + Item.value = Item.buyPrice(gold: 8); // Sold by Clothier Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Vanity/SilvaHornedHelm.cs b/Items/Armor/Vanity/SilvaHornedHelm.cs index ce40b0b7e5..7440f939ce 100644 --- a/Items/Armor/Vanity/SilvaHornedHelm.cs +++ b/Items/Armor/Vanity/SilvaHornedHelm.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 26; Item.height = 24; - Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; + Item.value = Item.buyPrice(gold: 8); // Sold by Clothier Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Vanity/SilvaMask.cs b/Items/Armor/Vanity/SilvaMask.cs index ff8f523d77..ad4ec9902f 100644 --- a/Items/Armor/Vanity/SilvaMask.cs +++ b/Items/Armor/Vanity/SilvaMask.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 24; Item.height = 26; - Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; + Item.value = Item.buyPrice(gold: 8); // Sold by Clothier Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Vanity/SlimeGodMask.cs b/Items/Armor/Vanity/SlimeGodMask.cs index 163b2e0864..b4c7746934 100644 --- a/Items/Armor/Vanity/SlimeGodMask.cs +++ b/Items/Armor/Vanity/SlimeGodMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/SlimeGodMask2.cs b/Items/Armor/Vanity/SlimeGodMask2.cs index 1c773f2cb4..8a140ead83 100644 --- a/Items/Armor/Vanity/SlimeGodMask2.cs +++ b/Items/Armor/Vanity/SlimeGodMask2.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/StormWeaverMask.cs b/Items/Armor/Vanity/StormWeaverMask.cs index c588118a60..6f073edefa 100644 --- a/Items/Armor/Vanity/StormWeaverMask.cs +++ b/Items/Armor/Vanity/StormWeaverMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/ThanatosMask.cs b/Items/Armor/Vanity/ThanatosMask.cs index eced97d9d5..30c4fc2c26 100644 --- a/Items/Armor/Vanity/ThanatosMask.cs +++ b/Items/Armor/Vanity/ThanatosMask.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Vanity/TheCommandersCap.cs b/Items/Armor/Vanity/TheCommandersCap.cs new file mode 100644 index 0000000000..5340bc723e --- /dev/null +++ b/Items/Armor/Vanity/TheCommandersCap.cs @@ -0,0 +1,62 @@ +using CalamityMod.NPCs.TownNPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class TheCommandersCap : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + public override void SetStaticDefaults() + { + + if (!Main.dedServ) + ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = false; + } + + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateVanitySet(Player player) + { + if (!player.CCed && !(Main.gamePaused && !Main.gameMenu) && player.velocity.X != 0f && player.velocity.Y == 0f) + { + for (int k = 0; k < 2; k++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)((player.gravDir == 1f) ? (player.height - 2) : (-4))), player.width, 6, DustID.Cloud, 0f, 0f, 100, default, 0.1f); + Main.dust[dust].fadeIn = 1f; + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + } + } + } + + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Silk, 5). + AddRecipeGroup("AnyGoldBar", 1). + AddIngredient(ItemID.BlueDye, 1). + AddTile(TileID.Loom). + Register(); + } + } +} diff --git a/Items/Armor/Vanity/TheCommandersCap.png b/Items/Armor/Vanity/TheCommandersCap.png new file mode 100644 index 0000000000..6ee7aa6cd2 Binary files /dev/null and b/Items/Armor/Vanity/TheCommandersCap.png differ diff --git a/Items/Armor/Vanity/TheCommandersCap_Head.png b/Items/Armor/Vanity/TheCommandersCap_Head.png new file mode 100644 index 0000000000..08c903b44a Binary files /dev/null and b/Items/Armor/Vanity/TheCommandersCap_Head.png differ diff --git a/Items/Armor/Vanity/TheFormalFootwear.cs b/Items/Armor/Vanity/TheFormalFootwear.cs new file mode 100644 index 0000000000..33fa080b6c --- /dev/null +++ b/Items/Armor/Vanity/TheFormalFootwear.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Legs)] + public class TheFormalFootwear : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.vanity = true; + Item.rare = ItemRarityID.Blue; + Item.Calamity().donorItem = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Silk, 5). + AddIngredient(ItemID.Leather, 2). + AddRecipeGroup("AnyGoldBar", 1). + AddIngredient(ItemID.BlueDye, 1). + AddTile(TileID.Loom). + Register(); + } + } +} diff --git a/Items/Armor/Vanity/TheFormalFootwear.png b/Items/Armor/Vanity/TheFormalFootwear.png new file mode 100644 index 0000000000..530ab340c0 Binary files /dev/null and b/Items/Armor/Vanity/TheFormalFootwear.png differ diff --git a/Items/Armor/Vanity/TheFormalFootwear_Legs.png b/Items/Armor/Vanity/TheFormalFootwear_Legs.png new file mode 100644 index 0000000000..503273f00b Binary files /dev/null and b/Items/Armor/Vanity/TheFormalFootwear_Legs.png differ diff --git a/Items/Armor/Vanity/TheGrandGarment.cs b/Items/Armor/Vanity/TheGrandGarment.cs new file mode 100644 index 0000000000..1f8758e0fc --- /dev/null +++ b/Items/Armor/Vanity/TheGrandGarment.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Body)] + public class TheGrandGarment : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + public override void Load() + { + if (!Main.dedServ) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/TheGrandGarment_Waist", EquipType.Waist, this); + } + } + + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + + public override void EquipFrameEffects(Player player, EquipType type) + { + player.waist = (sbyte)EquipLoader.GetEquipSlot(Mod, Name, EquipType.Waist); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Silk, 5). + AddIngredient(ItemID.Leather, 2). + AddIngredient(ItemID.BlueDye, 1). + AddTile(TileID.Loom). + Register(); + } + } +} diff --git a/Items/Armor/Vanity/TheGrandGarment.png b/Items/Armor/Vanity/TheGrandGarment.png new file mode 100644 index 0000000000..2f3a1044e0 Binary files /dev/null and b/Items/Armor/Vanity/TheGrandGarment.png differ diff --git a/Items/Armor/Vanity/TheGrandGarment_Body.png b/Items/Armor/Vanity/TheGrandGarment_Body.png new file mode 100644 index 0000000000..6b7e6cd81c Binary files /dev/null and b/Items/Armor/Vanity/TheGrandGarment_Body.png differ diff --git a/Items/Armor/Vanity/TheGrandGarment_Waist.png b/Items/Armor/Vanity/TheGrandGarment_Waist.png new file mode 100644 index 0000000000..760f824c5b Binary files /dev/null and b/Items/Armor/Vanity/TheGrandGarment_Waist.png differ diff --git a/Items/Armor/Vanity/YharonMask.cs b/Items/Armor/Vanity/YharonMask.cs index 2a68372be7..2cf26c7715 100644 --- a/Items/Armor/Vanity/YharonMask.cs +++ b/Items/Armor/Vanity/YharonMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 28; Item.height = 20; Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 75); Item.vanity = true; } } diff --git a/Items/Armor/Victide/VictideBreastplate.cs b/Items/Armor/Victide/VictideBreastplate.cs index f8e6c751c8..43e1c6649b 100644 --- a/Items/Armor/Victide/VictideBreastplate.cs +++ b/Items/Armor/Victide/VictideBreastplate.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Victide public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { //register the faulds texture. This appears either when the leggings or the chestplate is equipped (both works) EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Victide/VictideFaulds_Waist", EquipType.Waist, name: "VictideFaulds"); @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Victide public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; diff --git a/Items/Armor/Victide/VictideGreaves.cs b/Items/Armor/Victide/VictideGreaves.cs index a9a702b35b..6e96d6af32 100644 --- a/Items/Armor/Victide/VictideGreaves.cs +++ b/Items/Armor/Victide/VictideGreaves.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Victide public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlot] = true; diff --git a/Items/Armor/Victide/VictideHeadMagic.cs b/Items/Armor/Victide/VictideHeadMagic.cs index c7401a7cac..87d322f52f 100644 --- a/Items/Armor/Victide/VictideHeadMagic.cs +++ b/Items/Armor/Victide/VictideHeadMagic.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Items.Armor.Victide CreateRecipe(). AddIngredient(3). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Victide/VictideHeadMelee.cs b/Items/Armor/Victide/VictideHeadMelee.cs index 213c0a8720..9c97518add 100644 --- a/Items/Armor/Victide/VictideHeadMelee.cs +++ b/Items/Armor/Victide/VictideHeadMelee.cs @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Armor.Victide CreateRecipe(). AddIngredient(3). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Victide/VictideHeadRanged.cs b/Items/Armor/Victide/VictideHeadRanged.cs index c320003da6..068abd2914 100644 --- a/Items/Armor/Victide/VictideHeadRanged.cs +++ b/Items/Armor/Victide/VictideHeadRanged.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Items.Armor.Victide CreateRecipe(). AddIngredient(3). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Victide/VictideHeadRogue.cs b/Items/Armor/Victide/VictideHeadRogue.cs index b08263d4e0..1ebfa59ea6 100644 --- a/Items/Armor/Victide/VictideHeadRogue.cs +++ b/Items/Armor/Victide/VictideHeadRogue.cs @@ -50,6 +50,7 @@ namespace CalamityMod.Items.Armor.Victide CreateRecipe(). AddIngredient(3). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Victide/VictideHeadSummon.cs b/Items/Armor/Victide/VictideHeadSummon.cs index 48ca1c5af8..3d2d7683ce 100644 --- a/Items/Armor/Victide/VictideHeadSummon.cs +++ b/Items/Armor/Victide/VictideHeadSummon.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Armor.Victide public class VictideHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + public static int SnailDamage = 7; public override void SetDefaults() { @@ -46,13 +47,11 @@ namespace CalamityMod.Items.Armor.Victide var source = player.GetSource_ItemUse(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - // 08DEC2023: Ozzatron: Victide Sea Snails spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - var baseDamage = player.ApplyArmorAccDamageBonusesTo(7); - var minionDamage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + int minionDamage = (int)player.GetTotalDamage().ApplyTo(SnailDamage); var p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), minionDamage, 0f, Main.myPlayer, 0f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = SnailDamage; } } player.ignoreWater = true; @@ -73,6 +72,7 @@ namespace CalamityMod.Items.Armor.Victide CreateRecipe(). AddIngredient(3). AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Wulfrum/WulfrumFusionCannon.cs b/Items/Armor/Wulfrum/WulfrumFusionCannon.cs index 1f362e3ed1..ef33cd5453 100644 --- a/Items/Armor/Wulfrum/WulfrumFusionCannon.cs +++ b/Items/Armor/Wulfrum/WulfrumFusionCannon.cs @@ -10,6 +10,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; @@ -22,6 +23,9 @@ namespace CalamityMod.Items.Armor.Wulfrum public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisShoot") { PitchVariance = 0.1f, Volume = 0.4f }; public override string Texture => "CalamityMod/Items/Armor/Wulfrum/WulfrumFusionCannon"; + public static int ArmorPenetration = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); + public bool noAnimation = false; public override void SetDefaults() @@ -29,7 +33,7 @@ namespace CalamityMod.Items.Armor.Wulfrum Item.width = 34; Item.height = 42; Item.damage = 6; - Item.ArmorPenetration = 10; + Item.ArmorPenetration = ArmorPenetration; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -80,9 +84,6 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { velocity = velocity.RotatedByRandom(MathHelper.PiOver4 * 0.1f); - - // This weapon is acquired through usage of an armor set bonus and thus counts as armor. This function must be used. - damage = player.ApplyArmorAccDamageBonusesTo(damage); } public override bool CanUseItem(Player player) diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index 6d5858ea5e..69987f14d2 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Wulfrum/WulfrumHat_FemaleHead", EquipType.Head, name: "WulfrumHatFemale"); } @@ -82,9 +82,9 @@ namespace CalamityMod.Items.Armor.Wulfrum } } - else if (player.HasItem(ModContent.ItemType())) + else if (player.HasItem(ItemType())) { - player.ConsumeItem(ModContent.ItemType()); + player.ConsumeItem(ItemType()); //I Thiiiinnnk there's no need to add mp syncing packets since cooldowns get auto synced right. player.AddCooldown(WulfrumBastion.ID, BastionCooldown + BastionTime); //Though do i need to sync that or is the player inventory auto synced? @@ -234,7 +234,7 @@ namespace CalamityMod.Items.Armor.Wulfrum setBonus1.OverrideColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); tooltips.Insert(setBonusIndex + 1, setBonus1); - int AmmoItem = ModContent.ItemType(); + int AmmoItem = ItemType(); string AmmoDisplay = $"[i:{AmmoItem}] {CalamityUtils.GetItemName(AmmoItem)}"; TooltipLine setBonus2 = new TooltipLine(item.Mod, "CalamityMod:SetBonus2", CalamityUtils.GetTextFromModItem("AbilityDescription").Format(AmmoDisplay)); setBonus2.OverrideColor = new Color(110, 192, 93); @@ -274,7 +274,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; @@ -318,7 +318,7 @@ namespace CalamityMod.Items.Armor.Wulfrum Item.rare = ItemRarityID.Blue; Item.defense = 1; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlot] = true; @@ -361,7 +361,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) { - if (WulfrumHat.PowerModeEngaged(Player, out var cd) && Main.netMode != NetmodeID.Server) + if (WulfrumHat.PowerModeEngaged(Player, out var cd) && !Main.dedServ) { SetBonusEndEffect(true); if (!Player.GetModPlayer().vanityEquipped) @@ -385,7 +385,7 @@ namespace CalamityMod.Items.Armor.Wulfrum if (cd.timeLeft < WulfrumHat.BastionCooldown) { cd.timeLeft = WulfrumHat.BastionCooldown - 1; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) SetBonusEndEffect(true); } } diff --git a/Items/BleachBall.cs b/Items/BleachBall.cs index 72c06d37a5..3efe36e8fd 100644 --- a/Items/BleachBall.cs +++ b/Items/BleachBall.cs @@ -34,13 +34,9 @@ namespace CalamityMod.Items 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; + Item.RestoreConsumedItemByRightClick(); } /* diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs index c4fe0204bc..ffb03203aa 100644 --- a/Items/BrokenWaterFilter.cs +++ b/Items/BrokenWaterFilter.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; @@ -34,13 +33,9 @@ namespace CalamityMod.Items 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; + Item.RestoreConsumedItemByRightClick(); } /* @@ -91,14 +86,5 @@ namespace CalamityMod.Items text = GetTextValue("Items.Misc.SpawnBlockersOff"); tooltips.FindAndReplace("[STATE]", text); } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(20). - AddRecipeGroup("IronBar", 10). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 4f890b38d3..603f41df6c 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -7,11 +7,14 @@ using CalamityMod.CalPlayer; using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Packets; using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; @@ -20,6 +23,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; @@ -42,15 +46,25 @@ namespace CalamityMod.Items public override bool InstancePerEntity => true; // TODO -- split out a separate GlobalItem for rogue behavior? + /// Tracks the stealth strike damage modifier for this item, derived from its prefix. internal float StealthStrikePrefixBonus; #region Chargeable Item Variables + /// + /// If set to true, this item will consume on use.
+ /// Be sure to also set and . + ///
public bool UsesCharge = false; + /// The current charge value of this item. public float Charge = 0f; + /// The maximum charge value of this item. Should only be set if is set to true. public float MaxCharge = 1f; + /// The charge consumed on each use of this item. Should only be set if is set to true. public float ChargePerUse = 0f; - // If left at the default value of -1, ChargePerUse is automatically used for alt fire. - // If you want a different amount of charge used for alt fire, then set a different value here. + /// + /// By default, the right-click use of an item will use to determine how much charge to consume.
+ /// Set to a value other than -1 to make the right-click use a different amount of charge. + ///
public float ChargePerAltUse = -1f; public float ChargeRatio { @@ -63,8 +77,14 @@ namespace CalamityMod.Items #endregion #region Enchantment Variables + /// If set to true, this item cannot receive enchantments from the Brimstone Witch. public bool CannotBeEnchanted = false; + /// Stores the current enchantment placed on this item. If set to null, this item has no enchantment. public Enchantment? AppliedEnchantment = null; + /// + /// Stores the "exhaustion" value of this item for the Ephemeral enchantment.
+ /// The ratio of this value to the maximum value is used as a lerp value for the damage multiplier. + ///
public float DischargeEnchantExhaustion = 0; public float DischargeExhaustionRatio { @@ -74,16 +94,39 @@ namespace CalamityMod.Items return float.IsNaN(ratio) || float.IsInfinity(ratio) ? 0f : MathHelper.Clamp(ratio, 0f, 1f); } } + /// Constant value storing the maximum value for the Ephemeral enchantment's "exhaustion" value. public const float DischargeEnchantExhaustionCap = 1600f; + /// The minimum damage multiplier for weapons with the Ephemeral enchantment. public const float DischargeEnchantMinDamageFactor = 0.77f; + /// The maximum damage multiplier for weapons with the Ephemeral enchantment. public const float DischargeEnchantMaxDamageFactor = 1.26f; #endregion // Miscellaneous stuff + /// + /// Set to true if this item can only be obtained in Revengeance Mode.
+ /// Adds "Revengeance" to the bottom of the item's tooltip. + ///
public bool revengeanceItem = false; + /// + /// Set to true if this item is dedicated to a Patreon donator.
+ /// Adds "- Donor Item -" to the bottom of the item's tooltip. + ///
public bool donorItem = false; + /// + /// Set to true if this item is dedicated to a Calamity developer.
+ /// Adds "- Dev Item -" to the bottom of the item's tooltip. + ///
public bool devItem = false; + /// + /// If true, this item can fire projectiles with point-blank damage.
+ /// Also adds a tooltip line to the bottom of the item's tooltip. + ///
public bool canFirePointBlankShots = false; + /// + /// If set to a value greater than 1, applies a multiplier to the item's grab range.
+ /// Used by coin items spawned from hitting ricoshot coins. + ///
public float grabRangeMultiplier = 1f; public static readonly Color ExhumedTooltipColor = new Color(198, 27, 64); @@ -136,21 +179,31 @@ namespace CalamityMod.Items #region Vanilla Wing Tweaks // 170 -> 240 flight time - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BoneWings] = new WingStats(240, 7.5f, 1f); + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BoneWings].FlyTime = 240; + // 170 -> 200 flight time + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.MothronWings].FlyTime = 200; - // (Empress Wings) 150 -> 100 flight time - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.RainbowWings] = new WingStats(100, 8f, 2f); + // (Empress Wings) 150 -> 120 flight time + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.RainbowWings].FlyTime = 120; // 12 -> 10.8 hover stats - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BejeweledValkyrieWing] = new WingStats(150, 6f, 1f, true, 10.8f, 10.8f); // (Lazure) - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.Yoraiz0rWings] = new WingStats(150, 6f, 1f, true, 10.8f, 10.8f); - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.SkiphsWings] = new WingStats(150, 6f, 1f, true, 10.8f, 10.8f); - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BetsyWings] = new WingStats(150, 7f, 2.5f, true, 10.8f, 10.8f); - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsVortex] = new WingStats(180, 6.5f, 1.5f, true, 10.8f, 10.8f); - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsNebula] = new WingStats(180, 6.5f, 1.5f, true, 10.8f, 10.8f); + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BejeweledValkyrieWing].DownHoverSpeedOverride = 10.8f; // (Lazure) + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BejeweledValkyrieWing].DownHoverAccelerationMult = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.Yoraiz0rWings].DownHoverSpeedOverride = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.Yoraiz0rWings].DownHoverAccelerationMult = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.SkiphsWings].DownHoverSpeedOverride = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.SkiphsWings].DownHoverAccelerationMult = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BetsyWings].DownHoverSpeedOverride = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BetsyWings].DownHoverAccelerationMult = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsVortex].DownHoverSpeedOverride = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsVortex].DownHoverAccelerationMult = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsNebula].DownHoverSpeedOverride = 10.8f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsNebula].DownHoverAccelerationMult = 10.8f; // (Celestial Starboard) 4.5 -> 2.75 acceleration multiplier, 16 -> 11.6 hover stats - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.LongRainbowTrailWings] = new WingStats(180, 8f, 2.75f, true, 11.6f, 11.6f); + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.LongRainbowTrailWings].AccRunAccelerationMult = 2.75f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverSpeedOverride = 11.6f; + ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverAccelerationMult = 11.6f; #endregion } @@ -176,6 +229,10 @@ namespace CalamityMod.Items if (item.type == ItemID.EmpressFlightBooster) item.rare = ItemRarityID.Yellow; + // Zenith rarity + if (item.type == ItemID.Zenith) + item.rare = ModContent.RarityType(); + // Make most expert items no longer expert because they drop in all modes now. switch (item.type) { @@ -204,6 +261,17 @@ namespace CalamityMod.Items break; } + // Allow Souls to be used as ammo for SHPC. + if (item.type == ItemID.SoulofLight || item.type == ItemID.SoulofNight || item.type == ItemID.SoulofFlight || item.type == ItemID.SoulofMight || item.type == ItemID.SoulofSight || item.type == ItemID.SoulofFright) + { + item.ammo = ItemID.SoulofLight; + item.notAmmo = true; // Prevents them from showing an "Ammo" tooltip or going to ammo slots. + } + + // Increase how much health Mushrooms heal. + if (item.type == ItemID.Mushroom && item.healLife == 15) + item.healLife = 25; + // Allow Beam Sword to change direction when it fires, because vanilla disables it for some reason. if (item.type == ItemID.BeamSword) item.ChangePlayerDirectionOnShoot = true; @@ -241,12 +309,15 @@ namespace CalamityMod.Items public override bool Shoot(Item item, Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) { CalamityPlayer modPlayer = player.Calamity(); + var playerSource = player.GetSource_FromThis(); + Vector2 mouse = player.ClampedMouseWorld(); + if (Main.myPlayer == player.whoAmI && player.Calamity().cursedSummonsEnchant) { if (NPC.CountNPCS(ModContent.NPCType()) < 2) { - CalamityNetcode.NewNPC_ClientSide(Main.MouseWorld, ModContent.NPCType(), player); - SoundEngine.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld); + CalamityNetcode.NewNPC_ClientSide(mouse, ModContent.NPCType(), player); + SoundEngine.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, mouse); } } @@ -261,97 +332,17 @@ namespace CalamityMod.Items { // Calculate how much damage to deal based on how much mana was consumed int remainingMana = player.statMana; - int damagePerManaConsumed = 80; // TODO -- may not be balanced, but eating 150 mana to do 12,000 base damage seems okay + int damagePerManaConsumed = 80; int monsterDamage = (int)player.GetTotalDamage().ApplyTo(remainingMana * damagePerManaConsumed); // Spawn the Mana Monster - Vector2 shootVelocity = player.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY).RotatedByRandom(0.07f) * Main.rand.NextFloat(4f, 5f); + Vector2 shootVelocity = player.SafeDirectionTo(mouse, -Vector2.UnitY).RotatedByRandom(0.07f) * Main.rand.NextFloat(4f, 5f); Projectile.NewProjectile(source, player.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), monsterDamage, 0f, player.whoAmI); // Set the player's mana to zero. player.statMana = 0; } - if (modPlayer.luxorsGift && !item.channel) - { - // useTime 9 = 0.9 useTime 2 = 0.2 - float damageMult = 1f; - if (item.useTime < 10) - damageMult -= (10 - item.useTime) / 10f; - - float newDamage = damage * damageMult; - - if (player.whoAmI == Main.myPlayer) - { - if (item.CountsAsClass()) - { - int meleeDamage = player.ApplyArmorAccDamageBonusesTo(newDamage * 0.25f); - - if (meleeDamage >= 1) - { - int projectile = Projectile.NewProjectile(source, position, velocity * 0.5f, ModContent.ProjectileType(), (int)meleeDamage, 0f, player.whoAmI); - if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Generic; - } - } - else if (item.CountsAsClass()) - { - int throwingDamage = player.ApplyArmorAccDamageBonusesTo(newDamage * 0.2f); - - if (throwingDamage >= 1) - { - int projectile = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)throwingDamage, 0f, player.whoAmI); - if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Generic; - } - } - else if (item.CountsAsClass()) - { - // This projectile is channeled and has no cooldown unless the gun fires - // The damage of the projectile is also always the max damage of the weapon, and the shot damage is calculated based off of that - // You can see how this may cause issues - // The projectile is fired inside of the scope's code instead - if (type != ModContent.ProjectileType()) - { - int rangedDamage = player.ApplyArmorAccDamageBonusesTo(newDamage * 0.15f); - - if (rangedDamage >= 1) - { - int projectile = Projectile.NewProjectile(source, position, velocity * 1.5f, ModContent.ProjectileType(), (int)rangedDamage, 0f, player.whoAmI); - if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Generic; - } - } - } - else if (item.CountsAsClass()) - { - int magicDamage = player.ApplyArmorAccDamageBonusesTo(newDamage * 0.3f); - - if (magicDamage >= 1) - { - int projectile = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)magicDamage, 0f, player.whoAmI); - if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Generic; - } - } - else if (item.CountsAsClass() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - if (damage >= 1) - { - // 08DEC2023: Ozzatron: Luxor Summons spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(item.damage); - int summonDamage = baseDamage; - - int projectile = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), summonDamage, 0f, player.whoAmI); - if (projectile.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[projectile].DamageType = DamageClass.Generic; - Main.projectile[projectile].originalDamage = baseDamage; - } - } - } - } - } if (modPlayer.bloodflareMage && modPlayer.canFireBloodflareMageProjectile) { if (item.CountsAsClass() && !item.channel) @@ -361,9 +352,8 @@ namespace CalamityMod.Items { // Bloodflare Mage Bolt: 130%, soft cap starts at 2000 base damage int bloodflareBoltDamage = CalamityUtils.DamageSoftCap(damage * 1.3, 2600); - bloodflareBoltDamage = player.ApplyArmorAccDamageBonusesTo(bloodflareBoltDamage); - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), bloodflareBoltDamage, 1f, player.whoAmI); + Projectile.NewProjectile(playerSource, position, velocity, ModContent.ProjectileType(), bloodflareBoltDamage, 1f, player.whoAmI); } } } @@ -377,9 +367,8 @@ namespace CalamityMod.Items // Bloodflare Ranged Bloodsplosion: 80%, soft cap starts at 150 base damage // This is intentionally extremely low because this effect can be grossly overpowered with sniper rifles and the like. int bloodsplosionDamage = CalamityUtils.DamageSoftCap(damage * 0.8, 120); - bloodsplosionDamage = player.ApplyArmorAccDamageBonusesTo(bloodsplosionDamage); - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), bloodsplosionDamage, 2f, player.whoAmI); + Projectile.NewProjectile(playerSource, position, velocity, ModContent.ProjectileType(), bloodsplosionDamage, 2f, player.whoAmI); } } } @@ -390,7 +379,7 @@ namespace CalamityMod.Items modPlayer.tarraCrits = 0; // Tarragon Mage Leaves: (8-10) x 20%, soft cap starts at 200 base damage int leafAmt = 8 + Main.rand.Next(3); // 8, 9, or 10 - int leafDamage = player.ApplyArmorAccDamageBonusesTo(damage * 0.2f); + int leafDamage = (int)(damage * 0.2f); for (int l = 0; l < leafAmt; l++) { @@ -401,7 +390,7 @@ namespace CalamityMod.Items speed = item.shootSpeed / speed; xDiff *= speed; yDiff *= speed; - int projectile = Projectile.NewProjectile(source, position, new Vector2(xDiff, yDiff), ProjectileID.Leaf, leafDamage, knockBack, player.whoAmI); + int projectile = Projectile.NewProjectile(playerSource, position, new Vector2(xDiff, yDiff), ProjectileID.Leaf, leafDamage, knockBack, player.whoAmI); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].DamageType = DamageClass.Generic; } @@ -414,8 +403,8 @@ namespace CalamityMod.Items modPlayer.canFireAtaxiaRangedProjectile = false; if (player.whoAmI == Main.myPlayer) { - int ataxiaFlareDamage = player.ApplyArmorAccDamageBonusesTo(damage * 0.25f); - Projectile.NewProjectile(source, position, velocity * 1.25f, ModContent.ProjectileType(), ataxiaFlareDamage, 2f, player.whoAmI); + int ataxiaFlareDamage = (int)(damage * 0.25f); + Projectile.NewProjectile(playerSource, position, velocity * 1.25f, ModContent.ProjectileType(), ataxiaFlareDamage, 2f, player.whoAmI); } } } @@ -428,9 +417,8 @@ namespace CalamityMod.Items { // God Slayer Ranged Shrapnel: 100%, soft cap starts at 800 base damage int shrapnelRoundDamage = CalamityUtils.DamageSoftCap(damage, 800); - shrapnelRoundDamage = player.ApplyArmorAccDamageBonusesTo(shrapnelRoundDamage); - Projectile.NewProjectile(source, position, velocity * 1.25f, ModContent.ProjectileType(), shrapnelRoundDamage, 2f, player.whoAmI); + Projectile.NewProjectile(playerSource, position, velocity * 1.25f, ModContent.ProjectileType(), shrapnelRoundDamage, 2f, player.whoAmI); } } } @@ -443,20 +431,14 @@ namespace CalamityMod.Items // Hydrothermic Rogue Flares: 6 x (50 + 15%), soft cap starts at 90 base damage int flareDamage = CalamityUtils.DamageSoftCap(50 + damage * 0.15, 90); - flareDamage = player.ApplyArmorAccDamageBonusesTo(flareDamage); if (player.whoAmI == Main.myPlayer) { SoundEngine.PlaySound(SoundID.Item20, player.Center); - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; 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); + Vector2 circleVel = (MathHelper.TwoPi * i / 6f + velocity.ToRotation()).ToRotationVector2() * 5f; + Projectile.NewProjectile(playerSource, player.Center, circleVel, flareID, flareDamage, 1f, player.whoAmI); } } } @@ -471,9 +453,8 @@ namespace CalamityMod.Items { // Victide All-class Seashells: 200%, soft cap starts at 46 base damage int seashellDamage = CalamityUtils.DamageSoftCap(damage * 2, 46); - seashellDamage = player.ApplyArmorAccDamageBonusesTo(seashellDamage); - Projectile.NewProjectile(source, position, velocity * 1.25f, ModContent.ProjectileType(), seashellDamage, 1f, player.whoAmI); + Projectile.NewProjectile(playerSource, position, velocity * 1.25f, ModContent.ProjectileType(), seashellDamage, 1f, player.whoAmI); } } } @@ -488,7 +469,7 @@ 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, 0, 12f); + int rocket = Projectile.NewProjectile(playerSource, 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; @@ -497,39 +478,6 @@ namespace CalamityMod.Items } } } - 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.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)) - { - Main.projectile[feather].usesLocalNPCImmunity = true; - Main.projectile[feather].localNPCHitCooldown = 10; - Main.projectile[feather].DamageType = DamageClass.Generic; - } - } - } - } - if (item.type == ItemID.PearlwoodBow) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if ((p.type == ModContent.ProjectileType() || p.type == ModContent.ProjectileType()) && p.owner == player.whoAmI) - { - p.Kill(); - } - } - for (int i = -8; i <= 8; i += 8) - { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, 0f, player.whoAmI); - } - } return true; } #endregion @@ -602,9 +550,7 @@ namespace CalamityMod.Items bool boostedHeart = player.Calamity().photosynthesis; if (boostedHeart) { - player.statLife += 5; - if (Main.myPlayer == player.whoAmI) - player.HealEffect(5, true); + player.HealPlayer(PhotosynthesisPotion.IncreasedHeartHeal); } } return true; @@ -612,6 +558,16 @@ namespace CalamityMod.Items #endregion #region Use Item Changes + public override void HoldItem(Item item, Player player) + { + // Clear Evil Smasher buffs if not holding Evil Smasher + if (player.Calamity().evilSmasherBoost > 0) + { + if (item.type != ModContent.ItemType()) + player.Calamity().evilSmasherBoost = 0; + } + } + public override bool? UseItem(Item item, Player player) { if (Main.zenithWorld && item.type == ItemID.RodOfHarmony) @@ -622,32 +578,11 @@ namespace CalamityMod.Items player.AddBuff(ModContent.BuffType(), 3600 * 60); } } - if (player.Calamity().evilSmasherBoost > 0) - { - if (item.type != ModContent.ItemType()) - player.Calamity().evilSmasherBoost = 0; - } - - if (player.HasBuff(BuffID.ParryDamageBuff)) - { - if (item.type != ItemID.DD2SquireDemonSword && item.type != ItemID.BouncingShield) - { - player.parryDamageBuff = false; - player.ClearBuff(BuffID.ParryDamageBuff); - } - } // Give 1 minute of Mushy buff when consuming Mushrooms with Fungal Symbiote equipped. if (item.type == ItemID.Mushroom && player.Calamity().fungalSymbiote) player.AddBuff(ModContent.BuffType(), 3600); - // Moon Lord instantly spawns when Celestial Sigil is used. - if (item.type == ItemID.CelestialSigil) - { - NPC.MoonLordCountdown = 1; - 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) { @@ -702,6 +637,7 @@ namespace CalamityMod.Items if (p.type == ModContent.ProjectileType() && p.owner == player.whoAmI && p.localAI[1] == 0f) { p.rotation = MathHelper.PiOver2 + MathHelper.PiOver4; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction p.velocity = p.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 22f; p.rotation += p.velocity.ToRotation(); p.ai[0] = 180f; @@ -750,7 +686,8 @@ namespace CalamityMod.Items } if (canContinue && count > 0) { - NPC unluckyTarget = CalamityUtils.MinionHoming(Main.MouseWorld, 1000f, player); + Vector2 mouse = player.ClampedMouseWorld(); + NPC unluckyTarget = CalamityUtils.MinionHoming(mouse, 1000f, player); if (unluckyTarget != null) { int pointyThingyAmount = count; @@ -763,7 +700,7 @@ namespace CalamityMod.Items if (Main.projectile.Length == Main.maxProjectiles) break; int GlacialEmbraceDamage = (int)player.GetTotalDamage().ApplyTo(80); - int projj = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), GlacialEmbraceDamage, 1f, player.whoAmI, angle, 2f); + int projj = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), GlacialEmbraceDamage, 1f, player.whoAmI, angle, 2f); Main.projectile[projj].originalDamage = 80; angle += angleVariance; @@ -796,6 +733,11 @@ namespace CalamityMod.Items return false; // Don't use weapons if you're charging with a spear } + // If the player if using the Drill Containment Unit, ignore all this. + // It will start to check for everything below EVERY FRAME, including attacking with PSC or using Charge + if (player.mount.Type == MountID.Drill) + return base.CanUseItem(item, player); + // Conversion for Andromeda if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { @@ -853,7 +795,7 @@ namespace CalamityMod.Items // Handle general use-item effects for the Gem Tech Armor. player.Calamity().GemTechState.OnItemUseEffects(item); - if (item.type == ItemID.MonkStaffT1 || CalamityLists.spearAutoreuseList.Contains(item.type)) + if (item.type == ItemID.MonkStaffT1 || AutoreusableSpearsList.Includes(item.type)) { return player.ownedProjectileCounts[item.shoot] <= 0; } @@ -946,6 +888,15 @@ namespace CalamityMod.Items } #endregion + #region ModifyHitNPC + public override void ModifyHitNPC(Item item, Player player, NPC target, ref NPC.HitModifiers modifiers) + { + // This assume all items with a damage hit is a weapon. There appears to be no edge cases for this thus far + if (player.Calamity().oldFashioned) + modifiers.SourceDamage *= OldFashioned.DamageReductionMultiplier; + } + #endregion + #region Armor Set Changes public override string IsArmorSet(Item head, Item body, Item legs) { @@ -965,8 +916,6 @@ namespace CalamityMod.Items return "HuntressTier2"; if (head.type == ItemID.ApprenticeHat && body.type == ItemID.ApprenticeRobe && legs.type == ItemID.ApprenticeTrousers) return "ApprenticeTier2"; - if (head.type == ItemID.MonkAltHead && body.type == ItemID.MonkAltShirt && legs.type == ItemID.MonkAltPants) - return "MonkTier3"; if (head.type == ItemID.SquireAltHead && body.type == ItemID.SquireAltShirt && legs.type == ItemID.SquireAltPants) return "SquireTier3"; if (head.type == ItemID.HuntressAltHead && body.type == ItemID.HuntressAltShirt && legs.type == ItemID.HuntressAltPants) @@ -999,6 +948,8 @@ namespace CalamityMod.Items { player.setBonus = CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.CrystalAssassin"); modPlayer.DashID = string.Empty; + modPlayer.rogueStealthMax += 0.9f; + modPlayer.wearingRogueArmor = true; } else if (set == "SquireTier2") { @@ -1015,23 +966,15 @@ namespace CalamityMod.Items } else if (set == "ApprenticeTier2") { - player.GetDamage() += 0.05f; - player.GetCritChance() += 15; + player.GetDamage() += 0.1f; + player.GetCritChance() += 10; player.setBonus += $"\n{CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.ApprenticeTier2")}"; } - else if (set == "MonkTier3") - { - player.GetDamage() += 0.3f; - player.GetAttackSpeed() += 0.1f; - player.GetDamage() += 0.1f; - player.GetCritChance() += 10; - player.setBonus += $"\n{CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.MonkTier3")}"; - } else if (set == "SquireTier3") { player.lifeRegen += 6; player.GetDamage() += 0.1f; - player.GetCritChance() += 10; + player.GetCritChance() += 15; player.setBonus += $"\n{CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.SquireTier3")}"; } else if (set == "HuntressTier3") @@ -1042,7 +985,7 @@ namespace CalamityMod.Items } else if (set == "ApprenticeTier3") { - player.GetDamage() += 0.1f; + player.GetDamage() += 0.15f; player.GetCritChance() += 15; player.setBonus += $"\n{CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.ApprenticeTier3")}"; } @@ -1113,8 +1056,7 @@ namespace CalamityMod.Items player.lifeRegen -= 3; break; case ItemID.SquirePlating: - player.GetDamage() -= 0.05f; - player.GetDamage() -= 0.05f; + player.GetDamage() -= 0.1f; break; case ItemID.SquireGreaves: player.GetDamage() -= 0.1f; @@ -1123,43 +1065,56 @@ namespace CalamityMod.Items case ItemID.HuntressJerkin: player.GetDamage() -= 0.1f; - player.GetDamage() -= 0.1f; + player.GetDamage() -= 0.15f; + player.GetCritChance() += 5; + break; + case ItemID.HuntressPants: + player.GetDamage() -= 0.05f; break; + case ItemID.ApprenticeHat: + player.GetDamage() -= 0.05f; + break; + case ItemID.ApprenticeRobe: + player.GetDamage() -= 0.1f; + break; case ItemID.ApprenticeTrousers: player.GetDamage() -= 0.05f; player.GetCritChance() -= 15; break; + case ItemID.SquireAltHead: + player.GetDamage() += 0.05f; + player.GetDamage() += 0.05f; + break; case ItemID.SquireAltShirt: player.lifeRegen -= 6; + player.GetDamage() -= 0.15f; break; case ItemID.SquireAltPants: player.GetDamage() -= 0.1f; - player.GetCritChance() -= 10; - break; - - case ItemID.MonkAltHead: - player.GetDamage() -= 0.1f; - player.GetDamage() -= 0.1f; - break; - case ItemID.MonkAltShirt: - player.GetDamage() -= 0.1f; - player.GetAttackSpeed() -= 0.1f; - break; - case ItemID.MonkAltPants: - player.GetDamage() -= 0.1f; - player.GetCritChance() -= 10; + player.GetCritChance() -= 20; break; case ItemID.HuntressAltShirt: - player.GetDamage() -= 0.1f; - player.GetDamage() -= 0.1f; + player.GetDamage() -= 0.15f; + player.GetDamage() -= 0.15f; + break; + case ItemID.HuntressAltPants: + player.GetDamage() -= 0.05f; + player.GetCritChance() -= 5; break; + case ItemID.ApprenticeAltHead: + player.GetDamage() -= 0.05f; + player.GetDamage() -= 0.05f; + break; + case ItemID.ApprenticeAltShirt: + player.GetDamage() -= 0.1f; + break; case ItemID.ApprenticeAltPants: player.GetDamage() -= 0.1f; - player.GetCritChance() -= 15; + player.GetCritChance() -= 25; break; case ItemID.SolarFlareHelmet: @@ -1316,52 +1271,18 @@ namespace CalamityMod.Items if (item.type == ItemID.MoonStone) { - if (!Main.dayTime) + if (!Main.dayTime || Main.eclipse) player.GetAttackSpeed() -= 0.1f; } - if (item.type == ItemID.CelestialStone) + if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell) { player.GetAttackSpeed() -= 0.1f; } - if (item.type == ItemID.CelestialShell) - { - player.GetAttackSpeed() -= 0.1f; - if (!Main.dayTime) - player.GetAttackSpeed() -= 0.051f; - } - - //Moon Charm and Moon Shell melee speed removal - - if (item.type == ItemID.MoonCharm) - { - if (!Main.dayTime) - player.GetAttackSpeed() -= 0.051f; - } - - if (item.type == ItemID.MoonShell) - { - if (!Main.dayTime) - player.GetAttackSpeed() -= 0.051f; - } - if (item.type == ItemID.TerrasparkBoots) player.buffImmune[BuffID.OnFire] = true; - if (item.type == ItemID.AngelWings) // Boost to max life, defense, and life regen - { - player.statLifeMax2 += 20; - player.statDefense += 10; - player.lifeRegen += 2; - player.noFallDmg = true; - } - else if (item.type == ItemID.DemonWings) // Boost to all damage and crit - { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - player.noFallDmg = true; - } else if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water { if (player.IsUnderwater()) @@ -1379,124 +1300,41 @@ namespace CalamityMod.Items player.AddBuff(BuffID.Honey, 2); player.noFallDmg = true; } - else if (item.type == ItemID.ButterflyWings) // Boost to magic stats + else if (item.type == ItemID.ButterflyWings) // Boost to mana regen { - player.statManaMax2 += 20; - player.GetDamage() += 0.05f; - player.manaCost *= 0.95f; - player.GetCritChance() += 5; + player.manaRegen = (int)(player.manaRegen * 1.25f); player.noFallDmg = true; } - else if (item.type == ItemID.FairyWings) // Boost to max life - { - player.statLifeMax2 += 60; - player.noFallDmg = true; - } - else if (item.type == ItemID.BatWings) // Stronger at night + else if (item.type == ItemID.BatWings) // Greatly increases vision { player.noFallDmg = true; - if (!Main.dayTime || Main.eclipse) - { - player.GetDamage() += 0.07f; - player.GetCritChance() += 3; - } + player.nightVision = false; // Does not stack with Night Owl; actual effect is handled in LightingEffectsSystem } else if (item.type == ItemID.HarpyWings) { - modPlayer.harpyWingBoost = true; - player.moveSpeed += 0.2f; + player.moveSpeed += 0.1f; player.noFallDmg = true; } - else if (item.type == ItemID.MothronWings) // Spawn baby mothrons over time to attack enemies, max of 3 + else if (item.type == ItemID.FrozenWings) // Increases cold debuff damage { - player.statDefense += 5; - player.GetDamage() += 0.05f; player.noFallDmg = true; + player.Calamity().frozenWingsCold = true; } - else if (item.type == ItemID.FrozenWings) // Bonus to melee and ranged stats while wearing frost armor + else if (item.type == ItemID.FlameWings) // Increases heat debuff damage { player.noFallDmg = true; - if (player.head == ArmorIDs.Head.FrostHelmet && player.body == ArmorIDs.Body.FrostBreastplate && player.legs == ArmorIDs.Legs.FrostLeggings) - { - player.GetDamage() += 0.04f; - player.GetDamage() += 0.04f; - player.Calamity().frozenWingsCold = true; - } + player.Calamity().flameWingsHeat = true; } - else if (item.type == ItemID.FlameWings) // Bonus to melee stats - { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - player.noFallDmg = true; - } - else if (item.type == ItemID.GhostWings) // Bonus to mage stats while wearing spectre armor + else if (item.type == ItemID.LeafWings) // Bonus to defensive stats { player.noFallDmg = true; - if (player.body == ArmorIDs.Body.SpectreRobe && player.legs == ArmorIDs.Legs.SpectrePants) - { - if (player.head == ArmorIDs.Head.SpectreHood) - { - player.statDefense += 10; - player.endurance += 0.05f; - } - else if (player.head == ArmorIDs.Head.SpectreMask) - { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - } - } - } - else if (item.type == ItemID.BeetleWings) // Boosted defense and melee stats while wearing beetle armor - { - player.noFallDmg = true; - if (player.head == ArmorIDs.Head.BeetleHelmet && player.legs == ArmorIDs.Legs.BeetleLeggings) - { - if (player.body == ArmorIDs.Body.BeetleShell) - { - player.statDefense += 10; - player.endurance += 0.05f; - } - else if (player.body == ArmorIDs.Body.BeetleScaleMail) - { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - } - } - } - else if (item.type == ItemID.Hoverboard) // Boosted ranged stats while wearing shroomite armor - { - player.noFallDmg = true; - if (player.body == ArmorIDs.Body.ShroomiteBreastplate && player.legs == ArmorIDs.Legs.ShroomiteLeggings) - { - if (player.head == ArmorIDs.Head.ShroomiteHeadgear) //arrows - { - player.arrowDamage += 0.05f; - } - else if (player.head == ArmorIDs.Head.ShroomiteMask) //bullets - { - player.bulletDamage += 0.05f; - } - else if (player.head == ArmorIDs.Head.ShroomiteHelmet) //specialists (non-arrow/bullet) - { - player.specialistDamage += 0.05f; - } - } - } - else if (item.type == ItemID.LeafWings) // Bonus to defensive stats while wearing tiki armor - { - player.noFallDmg = true; - if (player.head == ArmorIDs.Head.TikiMask && player.body == ArmorIDs.Body.TikiShirt && player.legs == ArmorIDs.Legs.TikiPants) - { - player.statDefense += 5; - player.endurance += 0.05f; - player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing - } + player.statDefense += 10; + player.AddBuff(BuffID.DryadsWard, 2); // Dryad's Blessing } else if (item.type == ItemID.FestiveWings) // Drop homing christmas tree bulbs while in flight { player.noFallDmg = true; - player.statLifeMax2 += 40; - if (modPlayer.icicleCooldown <= 0) + if (modPlayer.wingProjectileCooldown <= 0) { var source = player.GetSource_Accessory(item); if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) @@ -1507,69 +1345,28 @@ namespace CalamityMod.Items { Main.projectile[p].DamageType = DamageClass.Generic; Main.projectile[p].Calamity().lineColor = 1; - modPlayer.icicleCooldown = 15; + modPlayer.wingProjectileCooldown = 15; } } } } - else if (item.type == ItemID.SpookyWings) // Bonus to summon stats while wearing spooky armor + else if (item.type == ItemID.TatteredFairyWings) // Leave a trail of damaging fairy dust while in flight { player.noFallDmg = true; - if (player.head == ArmorIDs.Head.SpookyHelmet && player.body == ArmorIDs.Body.SpookyBreastplate && player.legs == ArmorIDs.Legs.SpookyLeggings) + if (modPlayer.wingProjectileCooldown <= 0) { - player.GetKnockback(DamageClass.Summon) += 2f; - player.GetDamage() += 0.05f; + var source = player.GetSource_Accessory(item); + if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) + { + int fairyDustDamage = (int)player.GetBestClassDamage().ApplyTo(35); + Vector2 fairyDustVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.08f, 0.2f); + + int p = Projectile.NewProjectile(source, player.Center, fairyDustVel, ModContent.ProjectileType(), fairyDustDamage, 0f, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + modPlayer.wingProjectileCooldown = 10; + } } } - else if (item.type == ItemID.TatteredFairyWings) - { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - player.noFallDmg = true; - } - else if (item.type == ItemID.SteampunkWings) - { - player.statDefense += 8; - player.GetDamage() += 0.04f; - player.GetCritChance() += 2; - player.moveSpeed += 0.1f; - player.noFallDmg = true; - } - else if (item.type == ItemID.WingsSolar) // Bonus to melee stats while wearing solar flare armor - { - player.noFallDmg = true; - if (player.head == ArmorIDs.Head.SolarFlareHelmet && player.body == ArmorIDs.Body.SolarFlareBreastplate && player.legs == ArmorIDs.Legs.SolarFlareLeggings) - { - player.GetDamage() += 0.07f; - player.GetCritChance() += 3; - } - } - else if (item.type == ItemID.WingsVortex) // Bonus to ranged stats while wearing vortex armor - { - player.noFallDmg = true; - if (player.head == ArmorIDs.Head.VortexHelmet && player.body == ArmorIDs.Body.VortexBreastplate && player.legs == ArmorIDs.Legs.VortexLeggings) - { - player.GetDamage() += 0.03f; - player.GetCritChance() += 7; - } - } - else if (item.type == ItemID.WingsNebula) // Bonus to magic stats while wearing nebula armor - { - player.noFallDmg = true; - if (player.head == ArmorIDs.Head.NebulaHelmet && player.body == ArmorIDs.Body.NebulaBreastplate && player.legs == ArmorIDs.Legs.NebulaLeggings) - { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - player.statManaMax2 += 20; - player.manaCost *= 0.95f; - } - } - else if (item.type == ItemID.WingsStardust) // Bonus to summon stats while wearing stardust armor - { - player.noFallDmg = true; - if (player.head == ArmorIDs.Head.StardustHelmet && player.body == ArmorIDs.Body.StardustPlate && player.legs == ArmorIDs.Legs.StardustLeggings) - player.GetDamage() += 0.1f; - } else if (item.type == ItemID.FishronWings || item.type == ItemID.BetsyWings || item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || item.type == ItemID.BejeweledValkyrieWing || @@ -1608,7 +1405,7 @@ namespace CalamityMod.Items float moveSpeedBoost = modPlayer.moveSpeedBonus * 0.1f; float flightSpeedMult = 1f + - (modPlayer.soaring ? 0.1f : 0f) + + (modPlayer.soaring ? SoaringPotion.FlightBoost : 0f) + (modPlayer.reaverSpeed ? 0.1f : 0f) + moveSpeedBoost; @@ -1633,6 +1430,10 @@ namespace CalamityMod.Items // For reference, Treasure Magnet adds 150 (2.625 + 9.375 = 12 tiles) if (player.Calamity().reaverExplore) grabRange += 246; + + // Nebula boosters have greater pickup range while using Nebula Mantle. + if (player.wingsLogic == (int)VanillaWingID.WingsNebula && ItemID.Sets.NebulaPickup[item.type]) + grabRange *= 2; } #endregion @@ -1728,7 +1529,7 @@ namespace CalamityMod.Items #region PostUpdate public override void PostUpdate(Item item) { - if (CalamityLists.forceItemList?.Contains(item.type) ?? false) + if (ItemsForcedInsideWorldList.Includes(item.type)) CalamityUtils.ForceItemIntoWorld(item); } #endregion @@ -1752,7 +1553,7 @@ namespace CalamityMod.Items // Draw all particles. float currentPower = 0f; - int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType()); + int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType()); if (calamitasNPCIndex != -1) currentPower = Utils.GetLerpValue(11750f, 1000f, Main.LocalPlayer.Distance(Main.npc[calamitasNPCIndex].Center), true); @@ -1805,7 +1606,7 @@ namespace CalamityMod.Items return keepPrefix ? prefix : 0; } - if (!CalamityConfig.Instance.RemoveReforgeRNG || Main.gameMenu || storedPrefix == -1) + if (!CalamityServerConfig.Instance.RemoveReforgeRNG || Main.gameMenu || storedPrefix == -1) return -1; // Pick a prefix using the new system. @@ -1816,7 +1617,7 @@ namespace CalamityMod.Items { storedPrefix = -1; // Bandit steals 20% of the total price of the reforge if she's around. - if (NPC.AnyNPCs(ModContent.NPCType())) + if (NPC.AnyNPCs(ModContent.NPCType())) { // Calculate the item's reforge cost. int value = item.value; @@ -1824,11 +1625,17 @@ namespace CalamityMod.Items ItemLoader.ReforgePrice(item, ref value, ref p.discountAvailable); // Steal 20% of that money. - CalamityWorld.MoneyStolenByBandit += value / 5; + int stolen = value / 5; + CalamityWorld.MoneyStolenByBandit += stolen; // Increment the reforge counter to allow the Bandit to refund // Also triggers Tinkerer dialogue that hints to the player that money is being stolen CalamityWorld.Reforges++; + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + BanditStolenMoneySyncPacket.Send(stolen); + } } } #endregion diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 12b004b8cd..ae6727df34 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.PermanentBoosters; @@ -25,17 +26,14 @@ namespace CalamityMod.Items public override void ModifyItemLoot(Item item, ItemLoot loot) { Fraction fifteenPercent = new Fraction(15, 100); - static bool CryonicAvailable() - { - if (!DownedBossSystem.downedCryogen) - return false; - return (NPC.downedMechBoss1.ToInt() + NPC.downedMechBoss2.ToInt() + NPC.downedMechBoss3.ToInt()) >= 2; - } switch (item.type) { #region Boss Treasure Bags case ItemID.KingSlimeBossBag: + loot.DefineConditionalDropSet(DropHelper.NotRemix).Add(ItemID.Katana, 3); // 33% Katana + loot.DefineConditionalDropSet(DropHelper.Remix).Add(ItemID.Keybrand, 3); // 33% Keybrand in Remix + loot.Add(new CommonDrop(ModContent.ItemType(), 10)); // 10% Crown Jewel loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -53,8 +51,8 @@ namespace CalamityMod.Items // We don't care. case ItemID.EaterOfWorldsBossBag: var eowRevLCR = loot.DefineConditionalDropSet(DropHelper.If(() => CalamityWorld.revenge)); - eowRevLCR.Add(ItemID.DemoniteOre, 1, 120, 240); // 100% 120-240 Demonite Ore - eowRevLCR.Add(ItemID.ShadowScale, 1, 60, 120); // 100% 60-120 Shadow Scale + eowRevLCR.Add(ItemID.DemoniteOre, 1, 90, 135); // 100% 90-135 Demonite Ore + eowRevLCR.Add(ItemID.ShadowScale, 1, 35, 55); // 100% 35-55 Shadow Scale loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; @@ -64,9 +62,11 @@ namespace CalamityMod.Items // This can theoretically be exploited by killing the boss on Expert, then turning on Rev to open the bags. // We don't care. case ItemID.BrainOfCthulhuBossBag: + // BoC drops less partial loot than EoW + // However, sell price is overall higher despite the lower yield var bocRevLCR = loot.DefineConditionalDropSet(DropHelper.If(() => CalamityWorld.revenge)); - bocRevLCR.Add(ItemID.CrimtaneOre, 1, 100, 180); // 100% 100-180 Crimtane Ore - bocRevLCR.Add(ItemID.TissueSample, 1, 60, 120); // 100% 60-120 Tissue Sample + bocRevLCR.Add(ItemID.CrimtaneOre, 1, 80, 120); // 100% 80-120 Crimtane Ore + bocRevLCR.Add(ItemID.TissueSample, 1, 25, 40); // 100% 25-40 Tissue Sample loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; @@ -91,12 +91,12 @@ namespace CalamityMod.Items { ItemID.BeeKeeper, ItemID.BeesKnees, - ItemID.BeeGun + ItemID.BeeGun, + ModContent.ItemType(), }; loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, queenBeeWeapons)); loot.Add(ModContent.ItemType(), 10); // 10% The Bee loot.Add(ItemID.Stinger, 1, 8, 12); // 100% 8-12 Stinger - loot.Add(ModContent.ItemType(), 1, 50, 75); // 100% 50-75 Hardened Honeycomb loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; @@ -264,97 +264,55 @@ namespace CalamityMod.Items loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - // 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()); + // The Celestial Onion only drops if the player hasn't used one (or has not used Demon Heart in Master Mode as it alternatively functions as that there) + loot.AddIf((info) => (!info.player.Calamity().extraAccessoryML && !Main.masterMode) || (!info.player.extraAccessory && Main.masterMode), ModContent.ItemType()); break; #endregion #region Fishing Crates - // TODO -- What is all this shit? + // Kylie @ 1% (yes this is the consistent rate, dw it's not hard to get one of these) case ItemID.WoodenCrate: case ItemID.WoodenCrateHard: - loot.Add(ModContent.ItemType(), 4, 3, 5); // 25% 3-5 Wulfrum Scrap + loot.Add(ModContent.ItemType(), 100); + // We do not need to pop Hardmode ores out of Pearlwood Crates. They do not drop higher tier ores. break; - case ItemID.IronCrate: case ItemID.IronCrateHard: - loot.Add(ModContent.ItemType(), 4, 5, 8); // 25% 5-8 Wulfrum Scrap - loot.Add(ModContent.ItemType(), 4, 5, 8); // 25% 5-8 Ancient Bone Dust + RemoveHardmodeOresFromStandardCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Mythril); break; - // these drops are not available in hardmode because this crate will stop dropping + // Non-crafted underground Gold Chest loot @ 20%; Individually 5% case ItemID.GoldenCrate: - loot.Add(ItemID.FlareGun, 10); // 10% Flare Gun - loot.Add(ItemID.ShoeSpikes, 10); // 10% Shoe Spikes (BUT NOT CLIMBING CLAWS?) - loot.Add(ItemID.BandofRegeneration, 10); // 10% Band of Regeneration + loot.Add(new OneFromOptionsNotScaledWithLuckDropRule(5, 1, + ItemID.FlareGun, + ItemID.Mace, + ItemID.BandofRegeneration, + ItemID.ShoeSpikes)); // Climbing Claws is in Wooden/Pearlwood (vanilla) in case you're curious break; case ItemID.GoldenCrateHard: - // Post-Yharon: 15% 30-40 Auric Ore - loot.AddIf(() => DownedBossSystem.downedYharon, ModContent.ItemType(), fifteenPercent, 30, 40); + RemoveHardmodeOresFromStandardCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Titanium); + loot.Add(new OneFromOptionsNotScaledWithLuckDropRule(5, 1, + ItemID.FlareGun, + ItemID.Mace, + ItemID.BandofRegeneration, + ItemID.ShoeSpikes)); break; - case ItemID.CorruptFishingCrate: - case ItemID.CrimsonFishingCrate: case ItemID.CorruptFishingCrateHard: case ItemID.CrimsonFishingCrateHard: - loot.Add(ModContent.ItemType(), fifteenPercent, 5, 8); // 15% 5-8 Blighted Gel - break; - - case ItemID.HallowedFishingCrate: // WHY case ItemID.HallowedFishingCrateHard: - var postProv = loot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); - postProv.Add(ModContent.ItemType(), fifteenPercent, 5, 10); // 15% 5-10 Unholy Essence - break; - - 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 Necroplasm - break; - - case ItemID.JungleFishingCrate: case ItemID.JungleFishingCrateHard: - loot.Add(ModContent.ItemType(), new Fraction(1, 5), 1, 3); // 20% 1-3 Murky Paste - var postPlant = loot.DefineConditionalDropSet(() => NPC.downedPlantBoss); - postPlant.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Perennial Ore - postPlant.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Perennial Bar - loot.AddIf(() => NPC.downedGolemBoss, ModContent.ItemType(), 5, 3, 6); // 20% 3-6 Plague Cell Canister - var uelibloom = loot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); - uelibloom.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Uelibloom Ore - uelibloom.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Uelibloom Bar - break; - - case ItemID.FloatingIslandFishingCrate: case ItemID.FloatingIslandFishingCrateHard: - var evilBossTwo = loot.DefineConditionalDropSet(() => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator); - evilBossTwo.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Aerialite Ore - evilBossTwo.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Aerialite Bar - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Sunlight - loot.AddIf(() => NPC.downedMoonlord, ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Exodium Clusters - break; - - case ItemID.FrozenCrate: case ItemID.FrozenCrateHard: - var cryonic = loot.DefineConditionalDropSet(CryonicAvailable); - cryonic.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Cryonic Ore - cryonic.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Cryonic Bar - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Eleum - break; - - case ItemID.LavaCrate: case ItemID.LavaCrateHard: - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Havoc - break; - - // Calamity does not touch Oasis Crates yet - case ItemID.OasisCrate: case ItemID.OasisCrateHard: - break; - - // Calamity does not touch Ocean Crates yet - case ItemID.OceanCrate: case ItemID.OceanCrateHard: + RemoveHardmodeOresFromBiomeCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Biome); break; #endregion @@ -525,6 +483,66 @@ namespace CalamityMod.Items } #endregion + #region Fishing Crate Loot Rule Manipulation + private static void RemoveHardmodeOresFromStandardCrates(ItemLoot loot) + { + List rules = loot.Get(false); + + // This is the primary rule which contains every drop + AlwaysAtleastOneSuccessDropRule mainRule = null; + foreach (IItemDropRule rule in rules) + if (rule is AlwaysAtleastOneSuccessDropRule a) + mainRule = a; + if (mainRule is null) + return; + + // Find ones that are supposed to be for the ore and not the other loot + foreach (IItemDropRule rule in mainRule.rules) + { + // Hardmode ores/bars are both nested within *another* nested rule + if (rule is SequentialRulesNotScalingWithLuckRule oreRule) + { + // Confirm that this is for the ore/bar then pop the numerator for the big rule + foreach (IItemDropRule nestedRule in oreRule.rules) + { + if (nestedRule is SequentialRulesNotScalingWithLuckRule s) + { + oreRule.chanceNumerator = 0; + return; + } + } + } + } + } + + private static void RemoveHardmodeOresFromBiomeCrates(ItemLoot loot) + { + List rules = loot.Get(false); + + // This is the primary rule which contains every drop + AlwaysAtleastOneSuccessDropRule mainRule = null; + foreach (IItemDropRule rule in rules) + if (rule is AlwaysAtleastOneSuccessDropRule a) + mainRule = a; + if (mainRule is null) + return; + + foreach (IItemDropRule rule in mainRule.rules) + { + // 2 rules, one for ore and another for bar, nested within *another* nested rule + if (rule is SequentialRulesNotScalingWithLuckRule oreRule) + { + // Confirm that this is for the ore/bar then pop the numerator for the big rule + foreach (IItemDropRule nestedRule in oreRule.rules) + { + if (nestedRule is OneFromRulesRule o) + oreRule.chanceNumerator = 0; + } + } + } + } + #endregion + #region Goodie Bag Bat Hook private static void RemoveBatHookFromGoodieBag(ItemLoot loot) { diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 0c4058647f..298f055625 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -20,6 +20,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -154,10 +155,14 @@ namespace CalamityMod.Items EnchantmentTooltips(item, tooltips); // In GFB, replace all instances of "rogue" with "rouge". - if (Main.zenithWorld) + string[] rogueKey = new string[] { CalamityUtils.GetTextValue($"Misc.GFBRogueUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRogueLowercase") }; + string[] rougeKey = new string[] { CalamityUtils.GetTextValue($"Misc.GFBRougeUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRougeLowercase") }; + for (int n = 0; n < rogueKey.Length; n++) { - tooltips.FindAndReplace("Rogue", "Rouge"); - tooltips.FindAndReplace("rogue", "rouge"); + if (Main.zenithWorld && rogueKey[n]!="") + { + tooltips.FindAndReplace(rogueKey[n], rougeKey[n]); + } } // Everything below this line can only apply to modded items. If the item is vanilla, stop here for efficiency. @@ -170,7 +175,7 @@ namespace CalamityMod.Items { // Convert current charge ratio into a percentage. float displayedPercent = ChargeRatio * 100f; - TooltipLine line = new TooltipLine(Mod, "CalamityCharge", $"Current Charge: {displayedPercent:N1}%"); + TooltipLine line = new TooltipLine(Mod, "CalamityMod:Charge", CalamityUtils.GetText("Misc.Charge").Format(displayedPercent.ToString("N1"))); tooltips.Insert(++lastTooltipIndex, line); } @@ -319,7 +324,7 @@ namespace CalamityMod.Items nameLine.OverrideColor = new Color(220, 20, 60); if (item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(207, 17, 117); - if (item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(227, 226, 180); if (item.type == ModContent.ItemType()) nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f); @@ -407,10 +412,6 @@ namespace CalamityMod.Items #endregion #region Vanilla Item Tooltip Modification - - // Turns a number into a string of increased mining speed. - public static string MiningSpeedString(int percent) => $"\n{percent}% increased mining speed"; - private static void ModifyVanillaTooltips(Item item, IList tooltips) { #region Modular Tooltip Editing Code @@ -432,9 +433,11 @@ namespace CalamityMod.Items // These functions are shorthand to invoke ApplyTooltipEdits using the above predicates. void EditTooltipByNum(int lineNum, Action action) => ApplyTooltipEdits(tooltips, LineNum(lineNum), action); void EditTooltipByName(string lineName, Action action) => ApplyTooltipEdits(tooltips, LineName(lineName), action); + string EditedTooltip(string key) => CalamityUtils.GetTextValue($"Vanilla.EditedTooltip.{key}"); + LocalizedText GetEditedTooltip(string key) => CalamityUtils.GetText($"Vanilla.EditedTooltip.{key}"); // For items such as a Copper Helmet which literally have no tooltips at all, add a custom "Tooltip0" which mimics the vanilla Tooltip0. - void AddTooltip(string text) + void AddTooltip(string key) { // Don't add the tooltip if the item is in a social slot if (item.social) @@ -447,8 +450,44 @@ namespace CalamityMod.Items defenseIndex = i; break; } - tooltips.Insert(defenseIndex + 1, new TooltipLine(CalamityMod.Instance, "Tooltip0", text)); + tooltips.Insert(defenseIndex + 1, new TooltipLine(CalamityMod.Instance, "Tooltip0", CalamityUtils.GetTextValue($"Vanilla.AddedTooltip.{key}"))); } + string AddedTooltip(string key) => "\n" + CalamityUtils.GetTextValue($"Vanilla.AddedTooltip.{key}"); + LocalizedText GetAddedTooltip(string key) => CalamityUtils.GetText($"Vanilla.AddedTooltip.{key}"); + #endregion + + // Exact life regen descriptions + #region Life Regen Clarity Tooltips + bool isCampfire = item.type == ItemID.Campfire || item.type == ItemID.CursedCampfire || item.type == ItemID.DemonCampfire || item.type == ItemID.FrozenCampfire || item.type == ItemID.IchorCampfire || item.type == ItemID.RainbowCampfire || item.type == ItemID.UltraBrightCampfire || item.type == ItemID.BoneCampfire || item.type == ItemID.DesertCampfire || item.type == ItemID.CoralCampfire || item.type == ItemID.CorruptCampfire || item.type == ItemID.CrimsonCampfire || item.type == ItemID.HallowedCampfire || item.type == ItemID.JungleCampfire || item.type == ItemID.MushroomCampfire || item.type == ItemID.ShimmerCampfire; + if (isCampfire) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("Campfires")); + + if (item.type == ItemID.HeartLantern) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("HeartLantern")); + + if (item.type == ItemID.BottledHoney) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("BottledHoney")); + + if (item.type == ItemID.ShinyStone) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ShinyStone")); + + if (item.type == ItemID.BandofRegeneration) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("BandofRegeneration")); + + if (item.type == ItemID.CharmofMyths) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("CharmofMyths")); + + if (item.type == ItemID.RegenerationPotion) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("RegenerationPotion")); + + if (item.type == ItemID.SoulDrain) + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("SoulDrain")); + + if (item.type == ItemID.HamBat) + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("HamBat")); + + if (item.type == ItemID.AegisCrystal) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("AegisCrystal")); #endregion // Numerous random tooltip edits which don't fit into another category @@ -456,7 +495,7 @@ namespace CalamityMod.Items // Lilies of Finality 512 edit if (item.type == ModContent.ItemType()) - EditTooltipByName("Damage", (line) => line.Text = LiliesOfFinality.TheNumber + " summon damage"); + EditTooltipByName("Damage", (line) => line.Text = LiliesOfFinality.TheNumber + Language.GetTextValue("LegacyTooltip.53")); // Apparently 612 is a homestuck reference if (item.type == ModContent.ItemType()) @@ -465,111 +504,63 @@ namespace CalamityMod.Items // 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)) - EditTooltipByName("Master", (line) => line.Text += " or Revengeance"); + EditTooltipByName("Master", (line) => line.Text = EditedTooltip("MasterExclusive")); // Add a tooltip about Slimed's effects if (item.type == ItemID.SlimeGun) - EditTooltipByNum(0, (line) => line.Text += "\nSlimed enemies take more damage from fire-based debuffs"); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("SlimeGun")); // Replace the meme tooltip with a useful one. if (item.type == ItemID.GelBalloon) - EditTooltipByNum(0, (line) => line.Text = "Throws a mixture of slime and sparkling crystals" - + "\nSlimed enemies take more damage from fire-based debuffs"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("GelBalloon")); // Flesh Knuckles giving extra max life. if (item.type == ItemID.FleshKnuckles || item.type == ItemID.HeroShield || item.type == ItemID.BerserkerGlove) - EditTooltipByNum(0, (line) => line.Text += "\nMax life increased by 45"); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("FleshKnucklesLine")); // Rod of Discord cannot be used multiple times to hurt yourself if (item.type == ItemID.RodofDiscord) - EditTooltipByNum(1, (line) => line.Text += "\nTeleportation is disabled while Chaos State is active"); + EditTooltipByNum(1, (line) => line.Text += AddedTooltip("RodofDiscord")); // Indicate that the Ankh Shield provides sandstorm wind push immunity if (item.type == ItemID.AnkhShield) - EditTooltipByNum(1, (line) => line.Text += ", including Mighty Wind"); + { + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("AnkhShield1")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("AnkhShield2")); + } // 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"); - - // Exact life regen descriptions - bool isCampfire = item.type == ItemID.Campfire || item.type == ItemID.CursedCampfire || item.type == ItemID.DemonCampfire || item.type == ItemID.FrozenCampfire || item.type == ItemID.IchorCampfire || item.type == ItemID.RainbowCampfire || item.type == ItemID.UltraBrightCampfire || item.type == ItemID.BoneCampfire || item.type == ItemID.DesertCampfire || item.type == ItemID.CoralCampfire || item.type == ItemID.CorruptCampfire || item.type == ItemID.CrimsonCampfire || item.type == ItemID.HallowedCampfire || item.type == ItemID.JungleCampfire || item.type == ItemID.MushroomCampfire || item.type == ItemID.ShimmerCampfire; - if (isCampfire) - EditTooltipByNum(0, (line) => line.Text = "Life regen is increased by 0.5 HP/s when near a campfire"); - - if (item.type == ItemID.HeartLantern) - EditTooltipByNum(0, (line) => line.Text = "Grants +1 HP/s life regeneration when placed nearby"); - - if (item.type == ItemID.BottledHoney) - EditTooltipByNum(0, (line) => line.Text = "Grants +1 HP/s life regen for a short time" + - "\nGrants an additional +1 HP/s life regen while inflicted with a damaging debuff"); - - if (item.type == ItemID.ShinyStone) - EditTooltipByNum(0, (line) => line.Text = "Grants +2 HP/s life regen and accelerates natural life regen when not moving"); - - if (item.type == ItemID.BandofRegeneration) - EditTooltipByNum(0, (line) => line.Text = "Grants +1 HP/s life regeneration"); - - if (item.type == ItemID.CharmofMyths) - EditTooltipByNum(0, (line) => line.Text = "Grants +1 HP/s life regeneration and reduces the cooldown of healing potions by 25%"); - - if (item.type == ItemID.RegenerationPotion) - EditTooltipByNum(0, (line) => line.Text = "Provides +2 HP/s life regeneration"); - - if (item.type == ItemID.SoulDrain) - EditTooltipByNum(0, (line) => line.Text += "\nThis grants +1.5 HP/s life regen and accelerates natural life regen" + - "\nLife drain stacks based on the number of enemies being hit"); - - if (item.type == ItemID.HamBat) - EditTooltipByNum(1, (line) => line.Text = "Defeating enemies temporarily grants +3 HP/s life regen"); - - if (item.type == ItemID.AegisCrystal) - EditTooltipByNum(0, (line) => line.Text = "Permanently boosts natural life regeneration"); + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("Pwnhammer")); // Warmth Potion reduces debuff durations if (item.type == ItemID.WarmthPotion) - { - string immunityLine = "\nGreatly reduces the duration of Chilled, Frozen, and Glacial State"; - EditTooltipByNum(0, (line) => line.Text += immunityLine); - } + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("WarmthPotion")); // Nerfed Archery Potion tooltip if (item.type == ItemID.ArcheryPotion) - EditTooltipByNum(0, (line) => line.Text = "20% increased arrow speed and 5% increased arrow damage"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ArcheryPotion")); // Buffed Ironskin Potion tooltip if (item.type == ItemID.IronskinPotion) - EditTooltipByNum(0, (line) => line.Text = "Increase defense by " + CalamityUtils.GetScalingDefense(-1)); + EditTooltipByNum(0, (line) => line.Text = GetEditedTooltip("IronskinPotion").Format(CalamityUtils.GetScalingDefense(-1))); // Nerfed Swiftness Potion tooltip if (item.type == ItemID.SwiftnessPotion) - EditTooltipByNum(0, (line) => line.Text = "15% increased movement speed"); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25%", "15%")); // Hand Warmer has a side bonus with Snow armor if (item.type == ItemID.HandWarmer) - { - string extraLine = "\nProvides a regeneration boost while wearing the Snow armor"; - EditTooltipByNum(0, (line) => line.Text += extraLine); - } + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("HandWarmer")); // Golden Fishing Rod inherently contains High Test Fishing Line if (item.type == ItemID.GoldenFishingRod) - EditTooltipByName("NeedsBait", (line) => line.Text += "\nIts fishing line will never break"); + EditTooltipByName("NeedsBait", (line) => line.Text += AddedTooltip("GoldenFishingRod")); // Information about graveyards // There are no item sets for tombstones wtf if (item.type == ItemID.Tombstone || item.type == ItemID.GraveMarker || item.type == ItemID.CrossGraveMarker || item.type == ItemID.Headstone || item.type == ItemID.Gravestone || item.type == ItemID.Obelisk || item.type == ItemID.RichGravestone1 || item.type == ItemID.RichGravestone2 || item.type == ItemID.RichGravestone3 || item.type == ItemID.RichGravestone4 || item.type == ItemID.RichGravestone5) - EditTooltipByName("Material", (line) => line.Text += "\n13 of any tombstone turns the surrounding area into a graveyard" - + "\nGraveyards have various new item sales and recipes"); - - // Eternity Crystal notifies the player that they can accelerate the invasion - if (item.type == ItemID.DD2ElderCrystal) - EditTooltipByNum(0, (line) => line.Text += "\nOnce placed you can right click the crystal to skip waves or increase the spawn rate of the invaders"); - - // Aerial Bane is no longer the real bane of aerial enemies (50% dmg bonus removed) - if (item.type == ItemID.DD2BetsyBow) - EditTooltipByNum(0, (line) => line.Text = "Shoots splitting arrows"); + EditTooltipByName("Material", (line) => line.Text += AddedTooltip("Tombstones")); // Modify item speed tooltips to use a new scale designed to more accurately reflect practical distributions of item speeds. // Due to the higher complexity of the action, the actual logic is delegated to its own method. @@ -577,222 +568,133 @@ namespace CalamityMod.Items EditTooltipByName("Speed", (line) => RedistributeSpeedTooltips(item, line)); if (item.healLife > 0 && Main.LocalPlayer.Calamity().healingPotionMultiplier != 1f) - { - int healAmt = (int)(item.healLife * Main.LocalPlayer.Calamity().healingPotionMultiplier); - EditTooltipByName("HealLife", (line) => line.Text = $"Restores {healAmt} life"); - } + EditTooltipByName("HealLife", (line) => line.Text = Language.GetOrRegister("CommonItemTooltip.RestoresLife").Format((int)(item.healLife * Main.LocalPlayer.Calamity().healingPotionMultiplier))); #endregion // For boss summon item clarity - #region Boss Summon Tooltip Edits - + #region Boss Summon Clarity Tooltips if (item.type == ItemID.Abeemination) - { - EditTooltipByNum(0, (line) => line.Text += " when used in the Jungle\n"); - EditTooltipByNum(0, (line) => line.Text += "Enrages outside the Underground Jungle"); - } + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("Abeemination")); if (item.type == ItemID.BloodySpine) - { - EditTooltipByNum(0, (line) => line.Text += " when used in the Crimson\n"); - EditTooltipByNum(0, (line) => line.Text += "Enrages outside the Underground Crimson"); - } + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("BloodySpine")); if (item.type == ItemID.ClothierVoodooDoll) - { - EditTooltipByNum(0, (line) => line.Text += "\nWhile equipped, summons Skeletron when the Clothier is killed during nighttime\n"); - EditTooltipByNum(0, (line) => line.Text += "Enrages during the day"); - } + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ClothierVoodooDoll")); if (item.type == ItemID.DeerThing) - EditTooltipByNum(0, (line) => line.Text += " when used in the Snow or Ice biome"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("DeerThing")); if (item.type == ItemID.GuideVoodooDoll) - EditTooltipByNum(0, (line) => line.Text += "\nSummons the Wall of Flesh if thrown into lava in the underworld while the Guide is alive"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("GuideVoodooDoll")); if (item.type == ItemID.LihzahrdPowerCell) - { - EditTooltipByNum(0, (line) => line.Text += " to summon the Golem\n"); - EditTooltipByNum(0, (line) => line.Text += "Enrages outside the Jungle Temple"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("LihzahrdPowerCell")); - } + if (item.type == ItemID.MechanicalEye) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MechanicalEye")); - if (item.type == ItemID.MechanicalEye || item.type == ItemID.MechanicalSkull || item.type == ItemID.MechanicalWorm || item.type == ItemID.SuspiciousLookingEye) - { - EditTooltipByNum(0, (line) => line.Text += " when used during nighttime\n"); - EditTooltipByNum(0, (line) => line.Text += "Enrages during the day"); - } + if (item.type == ItemID.MechanicalSkull) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MechanicalSkull")); + + if (item.type == ItemID.MechanicalWorm) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MechanicalWorm")); if (item.type == ItemID.QueenSlimeCrystal) - EditTooltipByNum(0, (line) => line.Text += " when used in the Hallow"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("QueenSlimeCrystal")); + + if (item.type == ItemID.SuspiciousLookingEye) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("SuspiciousLookingEye")); if (item.type == ItemID.TruffleWorm) - { - EditTooltipByName("Consumable", (line) => line.Text += "\nSummons Duke Fishron if used as bait in the Ocean\n"); - EditTooltipByName("Consumable", (line) => line.Text += "Enrages outside the Ocean"); - } + EditTooltipByName("Consumable", (line) => line.Text += AddedTooltip("TruffleWorm")); if (item.type == ItemID.WormFood) - { - EditTooltipByNum(0, (line) => line.Text += " when used in the Corruption\n"); - EditTooltipByNum(0, (line) => line.Text += "Enrages outside the Underground Corruption"); - } + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("WormFood")); #endregion // 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" + - "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); + EditTooltipByNum(0, (line) => line.Text = CalamityUtils.GetText("Vanilla.DodgeInfo").Format(BalancingConstants.BeltDodgeCooldownMin / 60, BalancingConstants.BeltDodgeCooldownMax / 60)); if (item.type == ItemID.MasterNinjaGear) - EditTooltipByNum(1, (line) => line.Text = beltDodgeLine); + EditTooltipByNum(1, (line) => line.Text = CalamityUtils.GetText("Vanilla.DodgeInfo").Format(BalancingConstants.BeltDodgeCooldownMin / 60, BalancingConstants.BeltDodgeCooldownMax / 60)); - string brainDodgeLine = "Grants the ability to dodge attacks\n" + - "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); + EditTooltipByNum(0, (line) => line.Text = CalamityUtils.GetText("Vanilla.DodgeInfo").Format(BalancingConstants.BrainDodgeCooldownMin / 60, BalancingConstants.BrainDodgeCooldownMax / 60)); #endregion - // Early Hardmode ore melee weapons have new on-hit effects. - #region Early Hardmode Melee Tooltips - - // Cobalt - if (item.type == ItemID.CobaltSword || item.type == ItemID.CobaltNaginata) - EditTooltipByName("Knockback", (line) => line.Text += "\nDecreases enemy defense by 25% on hit\nThis effect lasts for 10 seconds"); - - // Palladium - if (item.type == ItemID.PalladiumSword || item.type == ItemID.PalladiumPike) - EditTooltipByName("Knockback", (line) => line.Text += "\nIncreases natural life regen on hit"); - - // Mythril - if (item.type == ItemID.MythrilSword || item.type == ItemID.MythrilHalberd) - EditTooltipByName("Knockback", (line) => line.Text += "\nDecreases enemy contact damage by 10% on hit\nThis effect lasts for 10 seconds"); - - // 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) - 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) - 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("Material", (line) => line.Text += "\nDeals double damage to enemies above 75% life"); - #endregion - - // Other melee weapon tooltips - #region Other Melee Tooltips - - 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 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"); - - // 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"); + // Weapon changes + #region Weapon changes + // Aerial Bane is no longer the real bane of aerial enemies (50% dmg bonus removed) + if (item.type == ItemID.DD2BetsyBow) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("DD2BetsyBow")); // Death Sickle inflict Whispering Death if (item.type == ItemID.DeathSickle) - EditTooltipByNum(0, (line) => line.Text += "\nInflicts Whispering Death on hit"); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("DeathSickle")); #endregion // Light pets, accessories, and other items which boost the player's Abyss light stat #region Abyss Light Tooltips - // +1 to Abyss light level - string abyssSmallLightLine = "\nProvides a small amount of light in the abyss"; - if (item.type == ItemID.CrimsonHeart || item.type == ItemID.ShadowOrb || item.type == ItemID.MagicLantern || item.type == ItemID.JellyfishNecklace || item.type == ItemID.MiningHelmet || item.type == ItemID.UltrabrightHelmet) - EditTooltipByNum(0, (line) => line.Text += abyssSmallLightLine); + EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel1")); if (item.type == ItemID.JellyfishDivingGear || item.type == ItemID.Magiluminescence) - EditTooltipByNum(1, (line) => line.Text += abyssSmallLightLine); + EditTooltipByNum(1, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel1")); // +2 to Abyss light level - string abyssMediumLightLine = "\nProvides a moderate amount of light in the abyss"; - if (item.type == ItemID.ShinePotion) - EditTooltipByName("BuffTime", (line) => line.Text += abyssMediumLightLine); - + EditTooltipByName("BuffTime", (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel2")); if (item.type == ItemID.FairyBell || item.type == ItemID.DD2PetGhost) - EditTooltipByNum(0, (line) => line.Text += abyssMediumLightLine); + EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel2")); // +3 to Abyss light level - string abyssLargeLightLine = "\nProvides a large amount of light in the abyss"; - if (item.type == ItemID.WispinaBottle || item.type == ItemID.PumpkingPetItem || item.type == ItemID.GolemPetItem || item.type == ItemID.FairyQueenPetItem) - EditTooltipByNum(0, (line) => line.Text += abyssLargeLightLine); + EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel3")); if (item.type == ItemID.SuspiciousLookingTentacle) - EditTooltipByNum(1, (line) => line.Text += abyssLargeLightLine); + EditTooltipByNum(1, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel3")); #endregion // Accessories and other items which boost the player's ability to breathe in the Abyss #region Abyss Breath Tooltips // Moderate breath boost - string abyssModerateBreathLine = "\nModerately reduces breath loss in the abyss"; - if (item.type == ItemID.DivingHelmet) - EditTooltipByNum(0, (line) => line.Text += abyssModerateBreathLine); + EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssBreathLevel2")); if (item.type == ItemID.ArcticDivingGear) - EditTooltipByNum(1, (line) => line.Text += abyssSmallLightLine + abyssModerateBreathLine); + EditTooltipByNum(1, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel1") + "\n" + CalamityUtils.GetTextValue("Common.AbyssBreathLevel2")); // Great breath boost - string abyssGreatBreathLine = "\nGreatly reduces breath loss in the abyss"; - if (item.type == ItemID.GillsPotion) - EditTooltipByName("BuffTime", (line) => line.Text += abyssGreatBreathLine); + EditTooltipByName("BuffTime", (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssBreathLevel3")); if (item.type == ItemID.NeptunesShell || item.type == ItemID.MoonShell) - EditTooltipByNum(1, (line) => line.Text += abyssGreatBreathLine); + EditTooltipByNum(1, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssBreathLevel3")); if (item.type == ItemID.CelestialShell) - EditTooltipByNum(4, (line) => line.Text += abyssModerateBreathLine); + EditTooltipByNum(4, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssBreathLevel3")); #endregion // Flasks apply to Rogue weapons #region Rogue Flask Tooltips if (item.type == ItemID.FlaskofCursedFlames) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" and Whip", ", Whip, and Rogue")); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlaskofCursedFlames")); if (item.type == ItemID.FlaskofFire) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" and Whip", ", Whip, and Rogue")); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlaskofFire")); if (item.type == ItemID.FlaskofGold) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" and Whip", ", Whip, and Rogue")); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlaskofGold")); if (item.type == ItemID.FlaskofIchor) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" and Whip", ", Whip, and Rogue")); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlaskofIchor")); if (item.type == ItemID.FlaskofNanites) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" and Whip", ", Whip, and Rogue")); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlaskofNanites")); // party flask is unique because it affects ALL projectiles in Calamity, not just "also rogue ones" if (item.type == ItemID.FlaskofParty) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("Melee and Whip", "All")); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlaskofParty")); if (item.type == ItemID.FlaskofPoison) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" and Whip", ", Whip, and Rogue")); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlaskofPoison")); if (item.type == ItemID.FlaskofVenom) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" and Whip", ", Whip, and Rogue")); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlaskofVenom")); #endregion // Rebalances to vanilla item stats @@ -800,134 +702,132 @@ namespace CalamityMod.Items // Various mining speed nerfs if (item.type == ItemID.MiningPotion) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25", "15")); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25%", "15%")); if (item.type == ItemID.AncientChisel) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25", "15")); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25%", "15%")); if (item.type == ItemID.HandOfCreation) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25", "15")); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25%", "15%")); // Frozen Turtle Shell rebalance. if (item.type == ItemID.FrozenTurtleShell) - EditTooltipByNum(0, (line) => line.Text = "Puts a shell around the owner when below 50% life that reduces damage by 15%"); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25%", "15%")); 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%"); + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("25%", "15%")); // 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%\n" + - "Counts as an alcohol for Alcohol Poisoning\n" + - "Drinking more than 3 different alcohols might not end well with your liver"); - } + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("AleSake")); //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'"); - } + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlameWakerBoots")); // 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(2, (line) => line.Text += "\nMultiplies all fire-based debuff damage by 1.5, does not stack with downgrades\n" + - "All attacks inflict Hellfire"); - } + EditTooltipByNum(2, (line) => line.Text += AddedTooltip("HellfireTreads")); // Fairy Boots buff. if (item.type == ItemID.FairyBoots) - EditTooltipByNum(2, (line) => line.Text += "\nFairies can spawn at any time on the surface and spawn far more frequently\n" + - "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"); + EditTooltipByNum(2, (line) => line.Text += AddedTooltip("FairyBoots")); // Reduced Nightwither and Daybroken damage, and melee speed removal. if (item.type == ItemID.MoonStone) { - EditTooltipByNum(2, (line) => line.Text += "\nReduces the damage of the Nightwither debuff"); - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("melee speed, ", "")); + EditTooltipByNum(2, (line) => line.Text += AddedTooltip("MoonStone")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("SunMoonStones")); } if (item.type == ItemID.SunStone) { - EditTooltipByNum(2, (line) => line.Text += "\nReduces the damage of the Daybroken debuff"); - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("melee speed, ", "")); + EditTooltipByNum(2, (line) => line.Text += AddedTooltip("SunStone")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("SunMoonStones")); } if (item.type == ItemID.CelestialStone) { - EditTooltipByNum(2, (line) => line.Text += "\nReduces the damage of the Nightwither and Daybroken debuffs"); - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" melee speed,", "")); + EditTooltipByNum(2, (line) => line.Text += AddedTooltip("CelestialStone")); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("CelestialStoneShell")); } if (item.type == ItemID.CelestialShell) { - EditTooltipByNum(4, (line) => line.Text += "\nReduces the damage of the Nightwither and Daybroken debuffs"); - EditTooltipByNum(2, (line) => line.Text = line.Text.Replace(" melee speed,", "")); + EditTooltipByNum(4, (line) => line.Text += AddedTooltip("CelestialStone")); + EditTooltipByNum(2, (line) => line.Text = EditedTooltip("CelestialStoneShell")); } // Mana Flower tinker buffs. if (item.type == ItemID.MagnetFlower) - EditTooltipByNum(0, (line) => line.Text = "10% reduced mana cost"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MagnetFlower")); if (item.type == ItemID.ArcaneFlower || item.type == ItemID.ManaCloak) - EditTooltipByNum(0, (line) => line.Text = "12% reduced mana cost"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ArcaneFlowerManaCloak")); if (item.type == ItemID.ArcaneFlower) - EditTooltipByNum(2, (line) => line.Text += "\n5% increased magic damage"); + EditTooltipByNum(2, (line) => line.Text += AddedTooltip("ArcaneFlower")); // Magiluminescence nerf and clear explanation of what it actually does. if (item.type == ItemID.Magiluminescence) - EditTooltipByNum(0, (line) => line.Text = "Increases movement acceleration and deceleration by 1.75x\n" + - "Increases movement speed by 1.15x. This bonus applies to running boot accessories"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("Magiluminescence")); + + // Frog Leg and all upgrades get clear explanations of what they actually do. + if (item.type == ItemID.FrogLeg) + EditTooltipByNum(0, (line) => line.Text = GetEditedTooltip("FrogLeg").Format(BalancingConstants.VanillaFrogLegJumpSpeedBoost.ToJumpSpeedPercent())); + + if (item.type == ItemID.FrogFlipper || item.type == ItemID.FrogWebbing) + EditTooltipByNum(1, (line) => line.Text = GetEditedTooltip("FrogLeg").Format(BalancingConstants.VanillaFrogLegJumpSpeedBoost.ToJumpSpeedPercent())); + + if (item.type == ItemID.FrogGear) + EditTooltipByNum(2, (line) => line.Text = GetEditedTooltip("FrogLeg").Format(BalancingConstants.VanillaFrogLegJumpSpeedBoost.ToJumpSpeedPercent())); + + if (item.type == ItemID.AmphibianBoots) + EditTooltipByNum(1, (line) => line.Text = GetEditedTooltip("FrogLeg").Format(BalancingConstants.AmphibianBootsJumpSpeedBoost.ToJumpSpeedPercent())); // Soaring Insignia nerf and clear explanation of what it actually does. if (item.type == ItemID.EmpressFlightBooster) { - EditTooltipByNum(0, (line) => line.Text = "Increases wing flight time by 25%"); - EditTooltipByNum(1, (line) => line.Text = "Increases movement and jump speed by 10% and acceleration by 1.1x"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("EmpressFlightBooster1")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("EmpressFlightBooster2")); } // 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"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("RifleScope1")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("RifleScope2")); } // 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"); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("SniperScope")); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("RifleScope")); } // Recon Scope visibility change if (item.type == ItemID.ReconScope) - EditTooltipByNum(0, (line) => line.Text += "\nThe scope effect can be toggled with visibility"); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("RifleScope")); // Magic Quiver if (item.type == ItemID.MagicQuiver) - EditTooltipByNum(0, (line) => line.Text = "Increases arrow damage by 5% and greatly increases arrow speed"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MagicQuiver")); // Molten Quiver if (item.type == ItemID.MoltenQuiver) { - EditTooltipByNum(0, (line) => line.Text = "Increases arrow damage by 7% and greatly increases arrow speed"); - EditTooltipByNum(2, (line) => line.Text += " and all arrows inflict Hellfire"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MoltenQuiver1")); + EditTooltipByNum(2, (line) => line.Text = EditedTooltip("MoltenQuiver2")); } // Magic Power Potion nerf if (item.type == ItemID.MagicPowerPotion) - EditTooltipByNum(0, (line) => line.Text = "10% increased magic damage"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MagicPowerPotion")); // Featherfall Potion being stupid broken with Aero Stone if (item.type == ItemID.FeatherfallPotion) - EditTooltipByNum(0, (line) => line.Text = "Slows falling speed\n" + "Disables all airborne flight recovery"); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("FeatherfallPotion")); // Magic Hat nerf if (item.type == ItemID.MagicHat) - EditTooltipByNum(0, (line) => line.Text = "6% increased magic critical strike chance"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MagicHat")); // Gem Robe nerfs if (item.type == ItemID.AmethystRobe) @@ -961,116 +861,107 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("12%", "10%")); if (item.type == ItemID.TitanGlove) - EditTooltipByNum(0, (line) => line.Text += "\n10% increased true melee damage"); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("TitanGloveLine")); if (item.type == ItemID.PowerGlove) { - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("12% increased melee speed", "10% increased melee speed, does not stack with downgrades")); - EditTooltipByNum(0, (line) => line.Text += "\n10% increased true melee damage"); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("PowerGlove")); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("TitanGloveLine")); } if (item.type == ItemID.BerserkerGlove) - { - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("12% increased melee speed", "10% increased true melee damage")); - } + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("BerserkerGlove")); if (item.type == ItemID.MechanicalGlove) - { - 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); - } + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("MechanicalGlove") + AddedTooltip("TitanGloveLine")); if (item.type == ItemID.FireGauntlet) { - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("fire damage", "Hellfire")); - string extraLine = "\n10% increased true melee damage"; - string extraLine2 = "\n14% increased melee speed, does not stack with downgrades" + extraLine; - EditTooltipByNum(1, (line) => line.Text = "14% increased melee damage" + extraLine2); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FireGauntlet1")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("FireGauntlet2") + AddedTooltip("TitanGloveLine")); } // On Fire! debuff immunities - if (item.type == ItemID.ObsidianSkull || item.type == ItemID.AnkhShield || item.type == ItemID.ObsidianSkullRose || item.type == ItemID.MoltenCharm) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("fire blocks", "the Burning and On Fire! debuffs")); + if (item.type == ItemID.ObsidianSkull || item.type == ItemID.ObsidianSkullRose || item.type == ItemID.MoltenCharm) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ObsidianSkullLine")); - if (item.type == ItemID.ObsidianHorseshoe || item.type == ItemID.ObsidianShield || item.type == ItemID.ObsidianWaterWalkingBoots || item.type == ItemID.LavaWaders || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose) - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("fire blocks", "the Burning and On Fire! debuffs")); + if (item.type == ItemID.ObsidianHorseshoe || item.type == ItemID.ObsidianShield || item.type == ItemID.ObsidianWaterWalkingBoots || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose) + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("ObsidianSkullLine")); + + if (item.type == ItemID.LavaWaders) + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("LavaWaders")); if (item.type == ItemID.TerrasparkBoots) - EditTooltipByNum(3, (line) => line.Text += "\nImmunity to the On Fire! debuff"); + EditTooltipByNum(3, (line) => line.Text = EditedTooltip("LavaWaders")); // 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"); - - // Falcon Blade +20% move speed while holding - if (item.type == ItemID.FalconBlade) - EditTooltipByName("Knockback", (line) => line.Text += "\nHolding this item grants +20% increased movement speed"); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("YoyoGlove")); //Gi 10% melee speed into 10% jump speed replacement if (item.type == ItemID.Gi) - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("melee", "jump")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("Gi")); #endregion // Pre-Hardmode ore armor tooltip edits #region Pre-Hardmode Ore Armor // Copper if (item.type == ItemID.CopperHelmet) - AddTooltip("5% increased damage"); + AddTooltip("CopperHelmet"); if (item.type == ItemID.CopperChainmail) - AddTooltip("3% increased critical strike chance"); + AddTooltip("CopperChainmail"); if (item.type == ItemID.CopperGreaves) - AddTooltip("5% increased movement speed"); + AddTooltip("CopperGreaves"); // Tin if (item.type == ItemID.TinHelmet) - AddTooltip("3% increased critical strike chance"); + AddTooltip("TinHelmet"); if (item.type == ItemID.TinChainmail) - AddTooltip("+0.5 HP/s life regen"); + AddTooltip("TinChainmail"); if (item.type == ItemID.TinGreaves) - AddTooltip("5% increased movement speed"); + AddTooltip("TinGreaves"); // Iron if (item.type == ItemID.IronHelmet || item.type == ItemID.AncientIronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) - AddTooltip("Increases damage reduction by 3%"); + AddTooltip("IronPieces"); // Lead if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) - AddTooltip("Increases damage reduction by 3%"); + AddTooltip("LeadPieces"); // Silver if (item.type == ItemID.SilverHelmet) - AddTooltip("5% increased critical strike chance"); + AddTooltip("SilverHelmet"); if (item.type == ItemID.SilverChainmail) - AddTooltip("+1 HP/s life regen"); + AddTooltip("SilverChainmail"); if (item.type == ItemID.SilverGreaves) - AddTooltip("8% increased movement speed"); + AddTooltip("SilverGreaves"); // Tungsten if (item.type == ItemID.TungstenHelmet) - AddTooltip("7% increased damage"); + AddTooltip("TungstenHelmet"); if (item.type == ItemID.TungstenChainmail) - AddTooltip("+0.5 HP/s life regen"); + AddTooltip("TungstenChainmail"); if (item.type == ItemID.TungstenGreaves) - AddTooltip("8% increased movement speed"); + AddTooltip("TungstenGreaves"); // Gold if (item.type == ItemID.GoldHelmet || item.type == ItemID.AncientGoldHelmet) - AddTooltip("6% increased damage"); + AddTooltip("GoldHelmet"); if (item.type == ItemID.GoldChainmail) - AddTooltip("Increases damage reduction by 5%"); + AddTooltip("GoldChainmail"); if (item.type == ItemID.GoldGreaves) - AddTooltip("10% increased movement speed"); + AddTooltip("GoldGreaves"); // Platinum if (item.type == ItemID.PlatinumHelmet) - AddTooltip("6% increased damage"); + AddTooltip("PlatinumHelmet"); if (item.type == ItemID.PlatinumChainmail) - AddTooltip("3% increased critical strike chance"); + AddTooltip("PlatinumChainmail"); if (item.type == ItemID.PlatinumGreaves) - AddTooltip("10% increased movement speed"); + AddTooltip("PlatinumGreaves"); // Jungle if (item.type == ItemID.JungleHat || item.type == ItemID.AncientCobaltHelmet) @@ -1088,7 +979,7 @@ namespace CalamityMod.Items { string newTooltip = line.Text.Replace("3%", "6%"); // Chest piece has 2 regen instead of 1 - newTooltip += item.type == ItemID.CrimsonScalemail ? "\n+1 HP/s life regen" : "\n+0.5 HP/s life regen"; + newTooltip += item.type == ItemID.CrimsonScalemail ? AddedTooltip("CrimsonBreastplate") : AddedTooltip("CrimsonOtherPieces"); line.Text = newTooltip; }); } @@ -1102,35 +993,35 @@ namespace CalamityMod.Items #region Hardmode Ore Armor // Cobalt if (item.type == ItemID.CobaltHat) - EditTooltipByNum(0, (line) => line.Text = $"Increases maximum mana by {CobaltArmorSetChange.MaxManaBoost + 40}"); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("40", $"{CobaltArmorSetChange.MaxManaBoost + 40}")); // Palladium if (item.type == ItemID.PalladiumBreastplate) - EditTooltipByNum(0, (line) => line.Text = $"{PalladiumArmorSetChange.ChestplateDamagePercentageBoost + 3}% increased damage"); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("3%", $"{PalladiumArmorSetChange.ChestplateDamagePercentageBoost + 3}%")); if (item.type == ItemID.PalladiumLeggings) - EditTooltipByNum(0, (line) => line.Text = $"{PalladiumArmorSetChange.LeggingsDamagePercentageBoost + 2}% increased damage"); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("2%", $"{PalladiumArmorSetChange.LeggingsDamagePercentageBoost + 2}%")); // Mythril if (item.type == ItemID.MythrilHood) - EditTooltipByNum(0, (line) => line.Text = $"Increases maximum mana by {MythrilArmorSetChange.MaxManaBoost + 60}"); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("60", $"{MythrilArmorSetChange.MaxManaBoost + 60}")); // Orichalcum if (item.type == ItemID.OrichalcumBreastplate) - EditTooltipByNum(0, (line) => line.Text = $"{OrichalcumArmorSetChange.ChestplateCritChanceBoost + 6}% increased critical strike chance"); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("6%", $"{OrichalcumArmorSetChange.ChestplateCritChanceBoost + 6}%")); // Adamantite if (item.type == ItemID.AdamantiteHeadgear) - EditTooltipByNum(0, (line) => line.Text = $"Increases maximum mana by {AdamantiteArmorSetChange.MaxManaBoost + 80}"); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("80", $"{AdamantiteArmorSetChange.MaxManaBoost + 80}")); // Titanium if (item.type == ItemID.TitaniumMask) - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("9", "14")); + 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%")); if (item.type == ItemID.SolarFlareHelmet || item.type == ItemID.SolarFlareBreastplate || item.type == ItemID.SolarFlareLeggings) - EditTooltipByNum(1, (line) => line.Text = "Grants +1 HP/s life regeneration"); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("SolarFlarePieces")); // Vortex if (item.type == ItemID.VortexHelmet) @@ -1145,56 +1036,69 @@ namespace CalamityMod.Items // Reduce DD2 armor piece bonuses because they're overpowered, and clarify life regen boosts // Squire armor if (item.type == ItemID.SquireGreatHelm) - EditTooltipByNum(0, (line) => line.Text = "Increases your max number of sentries by 1 and grants +2 HP/s life regen"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("SquireGreatHelm")); if (item.type == ItemID.SquirePlating) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion and melee damage"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("SquirePlating")); if (item.type == ItemID.SquireGreaves) - EditTooltipByNum(0, (line) => line.Text = "5% increased minion damage and melee critical strike chance\n" + - "15% increased movement speed"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("SquireGreaves")); // Monk armor if (item.type == ItemID.MonkBrows) - EditTooltipByNum(0, (line) => line.Text = "Increases your max number of sentries by 1 and increases melee attack speed by 10%"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MonkBrows")); if (item.type == ItemID.MonkShirt) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion and melee damage"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MonkShirt")); if (item.type == ItemID.MonkPants) { - EditTooltipByNum(0, (line) => line.Text = "5% increased minion damage and melee critical strike chance"); - EditTooltipByNum(1, (line) => line.Text = "20% increased movement speed"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MonkPants1")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("MonkPants2")); } // Huntress armor if (item.type == ItemID.HuntressJerkin) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion and ranged damage\n" + - "10% chance to not consume ammo"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("HuntressJerkin")); + if (item.type == ItemID.HuntressPants) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("HuntressPants")); // Apprentice armor + if (item.type == ItemID.ApprenticeHat) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ApprenticeHat")); + if (item.type == ItemID.ApprenticeRobe) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ApprenticeRobe")); if (item.type == ItemID.ApprenticeTrousers) - EditTooltipByNum(0, (line) => line.Text = "5% increased minion damage and magic critical strike chance\n" + - "20% increased movement speed"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ApprenticeTrousers")); // Valhalla Knight armor + if (item.type == ItemID.SquireAltHead) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("SquireAltHead")); if (item.type == ItemID.SquireAltShirt) - EditTooltipByNum(0, (line) => line.Text = "30% increased minion damage and grants +4 HP/s life regen"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("SquireAltShirt")); if (item.type == ItemID.SquireAltPants) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and melee critical strike chance"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("SquireAltPants")); // Shinobi Infiltrator armor if (item.type == ItemID.MonkAltHead) - EditTooltipByNum(0, (line) => line.Text = "Increases your max number of sentries by 2\n" + - "10% increased melee and minion damage"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MonkAltHead")); if (item.type == ItemID.MonkAltShirt) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and melee speed"); + { + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MonkAltShirt0")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("MonkAltShirt1")); + } if (item.type == ItemID.MonkAltPants) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and melee critical strike chance"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MonkAltPants")); // Red Riding armor if (item.type == ItemID.HuntressAltShirt) - EditTooltipByNum(0, (line) => line.Text = "15% increased minion and ranged damage and 20% chance to not consume ammo"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("HuntressAltShirt")); + if (item.type == ItemID.HuntressAltPants) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("HuntressAltPants")); // Dark Artist armor + if (item.type == ItemID.ApprenticeAltHead) + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("ApprenticeAltHead")); + if (item.type == ItemID.ApprenticeAltShirt) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ApprenticeAltShirt")); if (item.type == ItemID.ApprenticeAltPants) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and magic critical strike chance"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ApprenticeAltPants")); #endregion // Non-consumable boss summon items @@ -1203,23 +1107,22 @@ namespace CalamityMod.Items item.type == ItemID.WormFood || item.type == ItemID.BloodySpine || item.type == ItemID.Abeemination || item.type == ItemID.DeerThing || item.type == ItemID.QueenSlimeCrystal || item.type == ItemID.PirateMap || item.type == ItemID.SnowGlobe || item.type == ItemID.MechanicalEye || item.type == ItemID.MechanicalWorm || item.type == ItemID.MechanicalSkull || item.type == ItemID.NaughtyPresent || item.type == ItemID.PumpkinMoonMedallion || item.type == ItemID.SolarTablet || item.type == ItemID.SolarTablet || item.type == ItemID.CelestialSigil) - - EditTooltipByNum(0, (line) => line.Text += "\nNot consumable"); + EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.NotConsumable")); #endregion // Add mentions of what Calamity ores vanilla pickaxes can mine #region Pickaxe New Ore Tooltips if (item.type == ItemID.GoldPickaxe || item.type == ItemID.PlatinumPickaxe) - EditTooltipByNum(0, (line) => line.Text = "Can mine Demonite, Crimtane, Meteorite, Sea Prisms and Sea Prism Crystals"); + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("GoldPickaxe")); if (item.type == ItemID.Picksaw) - EditTooltipByNum(0, (line) => line.Text += "\nCan mine Scoria Ore located in the Abyss"); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("Picksaw")); 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"); + EditTooltipByName("Material", (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.CanMineUelibloom")); 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"); + EditTooltipByName("TileBoost", (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.CanMineUelibloom")); #endregion // Rebalances and information about vanilla set bonuses @@ -1229,105 +1132,164 @@ namespace CalamityMod.Items // Gladiator if (item.type == ItemID.GladiatorHelmet) - EditTooltipByName("Defense", (line) => line.Text += $"\n{GladiatorArmorSetChange.HelmetRogueDamageBoostPercent}% increased rogue damage"); + EditTooltipByName("Defense", (line) => line.Text += "\n" +CalamityUtils.GetText("Common.RogueDamage").Format(GladiatorArmorSetChange.HelmetRogueDamageBoostPercent)); if (item.type == ItemID.GladiatorBreastplate) - EditTooltipByName("Defense", (line) => line.Text += $"\n{GladiatorArmorSetChange.ChestplateRogueCritBoostPercent}% increased rogue critical strike chance"); + EditTooltipByName("Defense", (line) => line.Text += "\n" +CalamityUtils.GetText("Common.RogueCrit").Format(GladiatorArmorSetChange.ChestplateRogueCritBoostPercent)); if (item.type == ItemID.GladiatorLeggings) - EditTooltipByName("Defense", (line) => line.Text += $"\n{GladiatorArmorSetChange.LeggingRogueVelocityBoostPercent}% increased rogue velocity"); + EditTooltipByName("Defense", (line) => line.Text += "\n" +CalamityUtils.GetText("Common.RogueVelocity").Format(GladiatorArmorSetChange.LeggingRogueVelocityBoostPercent)); // Forbidden (UNLESS you are wearing the Circlet, which is Summon/Rogue and does not get this line) if ((item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) && !Main.LocalPlayer.Calamity().forbiddenCirclet) - EditTooltipByName("SetBonus", (line) => line.Text += "\nMinions no longer deal less damage while wielding magic weapons"); + EditTooltipByName("SetBonus", (line) => line.Text = CalamityUtils.GetText($"Vanilla.Armor.SetBonus.Forbidden").Format(Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"))); + #endregion + + // Provide the full stats of every vanilla yoyo + #region Yoyo Stat Tooltips + // This function is shorthand for appending a stat sheet to a yoyo. + void AddYoyoStats(float d, float r, float s) + { + EditTooltipByName("Knockback", (line) => line.Text += "\n" + (d == -1f ? CalamityUtils.GetText("Common.YoyoStatsInfinite").Format(r.ToTiles(), s.ToString()) + : CalamityUtils.GetText("Common.YoyoStats").Format(r.ToTiles(), s.ToString(), d.ToString()))); + } + + if (item.type == ItemID.Amarok) + AddYoyoStats(-1f, 432f, 28f); + if (item.type == ItemID.Cascade) + AddYoyoStats(30f, 384f, 28f); + if (item.type == ItemID.Chik) + AddYoyoStats(-1f, 400f, 32f); + if (item.type == ItemID.Code1) + AddYoyoStats(21f, 320f, 25f); + if (item.type == ItemID.Code2) + AddYoyoStats(-1f, 432f, 42f); + if (item.type == ItemID.CorruptYoyo) + AddYoyoStats(18f, 288f, 22f); + if (item.type == ItemID.CrimsonYoyo) + AddYoyoStats(18f, 288f, 22f); + if (item.type == ItemID.FormatC) + AddYoyoStats(-1f, 384f, 36f); + if (item.type == ItemID.Gradient) + AddYoyoStats(-1f, 384f, 36f); + if (item.type == ItemID.HelFire) + AddYoyoStats(-1f, 368f, 42f); + if (item.type == ItemID.HiveFive) + AddYoyoStats(24f, 320f, 20f); + if (item.type == ItemID.JungleYoyo) + AddYoyoStats(20f, 288f, 17f); + if (item.type == ItemID.Kraken) + AddYoyoStats(-1f, 480f, 54f); + if (item.type == ItemID.Rally) + AddYoyoStats(16f, 272f, 20f); + if (item.type == ItemID.RedsYoyo) + AddYoyoStats(-1f, 480f, 42f); + if (item.type == ItemID.Terrarian) + AddYoyoStats(-1f, 512f, 54f); + if (item.type == ItemID.TheEyeOfCthulhu) + AddYoyoStats(-1f, 480f, 36f); + if (item.type == ItemID.ValkyrieYoyo) + AddYoyoStats(-1f, 480f, 42f); + if (item.type == ItemID.Valor) + AddYoyoStats(30f, 400f, 36f); + if (item.type == ItemID.WoodYoyo) + AddYoyoStats(15f, 240f, 14f); + if (item.type == ItemID.Yelets) + AddYoyoStats(-1f, 400f, 36f); #endregion // Provide the full stats of every vanilla set of wings #region Wing Stat Tooltips // This function produces a "stat sheet" for a pair of wings from the raw stats. - // For "vertical speed", 0 = Bad, 1 = Average, 2 = Good, 3 = Great, 4 = Excellent. - string[] vertSpeedStrings = new string[] { "Bad vertical speed", "Average vertical speed", "Good vertical speed", "Great vertical speed", "Excellent vertical speed" }; - string WingStatsTooltip(float hSpeed, float accelMult, int vertSpeed, int flightTime, string extraTooltip = null) + string WingStatsTooltip(WingStats stats, float fall, float rise, float rMax, float tMax, float asc, string extraKey = null) { + int time = stats.FlyTime; + float run = stats.AccRunSpeedOverride; + float rAcc = stats.AccRunAccelerationMult * 0.08f; + bool hover = stats.HasDownHoverStats; + float hSpeed = stats.DownHoverSpeedOverride; + float hAcc = stats.DownHoverAccelerationMult * 0.08f; + float baseJumpSpeed = (CalamityServerConfig.Instance.FasterJumpSpeed ? BalancingConstants.ConfigBoostedBaseJumpSpeed : 5.01f) + 1f; StringBuilder sb = new StringBuilder(512); sb.Append('\n'); - sb.Append($"Horizontal speed: {hSpeed:N2}\n"); - sb.Append($"Acceleration multiplier: {accelMult:N1}\n"); - sb.Append(vertSpeedStrings[vertSpeed]); + sb.Append(CalamityUtils.GetText($"Common.WingStats").Format(time.FramesToSeconds(), run.ToMph(), (tMax * baseJumpSpeed).ToMph())); sb.Append('\n'); - sb.Append($"Flight time: {flightTime}"); - if (extraTooltip != null) + if (Main.keyState.IsKeyDown(Keys.LeftShift)) + { + sb.Append(CalamityUtils.GetText($"Common.WingStatsAcceleration").Format(rAcc.ToMphps(), asc.ToMphps(), (asc + rise).ToMphps(), (rMax * baseJumpSpeed).ToMph(), (asc + rise + fall).ToMphps())); + if (hover) + { + sb.Append('\n'); + sb.Append(CalamityUtils.GetText($"Common.WingStatsHover").Format(hSpeed.ToMph(), hAcc.ToMphps())); + } + } + else + sb.Append($"[c/B8B8B8:{CalamityUtils.GetTextValue("UI.HoldShiftTooltipExtensionIndicator")}]"); + + if (extraKey != null) { sb.Append('\n'); - sb.Append(extraTooltip); + sb.Append(CalamityUtils.GetTextValue($"Vanilla.Wings.{extraKey}")); } return sb.ToString(); } // This function is shorthand for appending a stat sheet to a pair of wings. - void AddWingStats(float h, float a, int v, int f, string s = null) => EditTooltipByNum(0, (line) => line.Text += WingStatsTooltip(h, a, v, f, s)); - void AddWingStats2(float h, float a, int v, int f, string s = null, string lineName = null) => EditTooltipByName(lineName, (line) => line.Text += WingStatsTooltip(h, a, v, f, s)); + void AddWingStats(int slot, float fall, float rise, float rMax, float tMax, float asc, string extraKey = null) => EditTooltipByNum(0, (line) => line.Text += WingStatsTooltip(ArmorIDs.Wing.Sets.Stats[slot], fall, rise, rMax, tMax, asc, extraKey)); if (item.type == ItemID.CreativeWings) - AddWingStats(3f, 1f, 0, 25); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.AngelWings) - AddWingStats(6.25f, 1f, 1, 100, "+20 max life, +10 defense and +1 HP/s life regen"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.DemonWings) - AddWingStats(6.25f, 1f, 1, 100, "5% increased damage and critical strike chance"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.Jetpack) - AddWingStats(6.5f, 1f, 1, 150); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.ButterflyWings) - AddWingStats(7.5f, 1f, 1, 160, "+20 max mana, 5% decreased mana usage,\n" + - "5% increased magic damage and magic critical strike chance"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.FairyWings) - AddWingStats(6.75f, 1f, 1, 130, "+60 max life"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.BeeWings) - AddWingStats(7.5f, 1f, 1, 160, "Permanently gives the Honey buff"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "BeeWings"); if (item.type == ItemID.HarpyWings) - AddWingStats(6.75f, 1f, 1, 130, "20% increased movement speed\n" + - "With Harpy Ring or Angel Treads equipped, most attacks sometimes launch feathers"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "HarpyWings"); if (item.type == ItemID.BoneWings) - AddWingStats(7.5f, 1f, 1, 240, "Halves flight time when taking a hit"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.66f, 0.1f, "BoneWings"); if (item.type == ItemID.FlameWings) - AddWingStats(7.5f, 1f, 1, 160, "5% increased melee damage and critical strike chance"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "FlameWings"); if (item.type == ItemID.FrozenWings) - AddWingStats(6.75f, 1f, 1, 130, "4% increased melee and ranged damage\n" + - "and multiplies all cold debuff damage by 1.25x while wearing Frost armor"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "FrozenWings"); if (item.type == ItemID.GhostWings) - AddWingStats(7.5f, 1f, 1, 170, "+10 defense and 5% increased damage reduction while wearing the Spectre Hood set\n" + - "5% increased magic damage and critical strike chance while wearing the Spectre Mask set"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.66f, 0.1f); if (item.type == ItemID.BeetleWings) - AddWingStats(7.5f, 1f, 1, 170, "+10 defense and 5% increased damage reduction while wearing the Beetle Shell set\n" + - "5% increased melee damage and critical strike chance while wearing the Beetle Scale Mail set"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.66f, 0.1f); if (item.type == ItemID.FinWings) - AddWingStats(6.75f, 1f, 1, 130, "Gills effect and you can move freely through liquids\n" + - "You fall faster while submerged in liquid"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "FinWings"); if (item.type == ItemID.FishronWings) - AddWingStats(8f, 2f, 2, 180); + AddWingStats(item.wingSlot, 0.75f, 0.15f, 1f, 2.5f, 0.125f); if (item.type == ItemID.SteampunkWings) - AddWingStats(7.5f, 1f, 1, 180, "+8 defense, 10% increased movement speed,\n" + "4% increased damage, and 2% increased critical strike chance"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.805f, 0.1f); if (item.type == ItemID.LeafWings) - AddWingStats(7.5f, 1f, 1, 160, "+5 defense, 5% increased damage reduction,\n" + "and permanent Dryad's Blessing while wearing the Tiki Armor"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "LeafWings"); if (item.type == ItemID.BatWings) - AddWingStats(7.5f, 1f, 1, 160, "At night or during an eclipse, you will gain the following boosts:\n" + - "7% increased damage and 3% increased critical strike chance"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "BatWings"); // All developer wings have identical stats and no special effects if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || @@ -1337,68 +1299,55 @@ namespace CalamityMod.Items item.type == ItemID.FoodBarbarianWings || item.type == ItemID.GroxTheGreatWings || item.type == ItemID.GhostarsWings || item.type == ItemID.SafemanWings) { - AddWingStats(7f, 1f, 1, 150); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); } + // Except these ones that hover + if (item.type == ItemID.SkiphsWings || item.type == ItemID.BejeweledValkyrieWing) + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); + if (item.type == ItemID.TatteredFairyWings) - AddWingStats(7.5f, 1f, 1, 180, "5% increased damage and critical strike chance"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.805f, 0.1f, "TatteredFairyWings"); if (item.type == ItemID.SpookyWings) - AddWingStats(7.5f, 1f, 1, 180, "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.805f, 0.1f); if (item.type == ItemID.Hoverboard) - AddWingStats(6.5f, 1f, 1, 170, "5% increased weapon-type damage while wearing the Shroomite Armor\n" + - "The weapon type boosted matches which Shroomite helmet is worn"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.66f, 0.1f); if (item.type == ItemID.FestiveWings) - AddWingStats(7.5f, 1f, 1, 180, "+40 max life\nOrnaments rain down as you fly"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.805f, 0.1f, "FestiveWings"); if (item.type == ItemID.MothronWings) - AddWingStats(7.5f, 1f, 1, 170, "+5 defense and 5% increased damage"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.66f, 0.1f); if (item.type == ItemID.WingsSolar) - AddWingStats(9f, 2.5f, 3, 180, "7% increased melee damage and 3% increased melee critical strike chance\n" + - "while wearing the Solar Flare Armor"); + AddWingStats(item.wingSlot, 0.85f, 0.15f, 1f, 3f, 0.135f, "WingsSolar"); if (item.type == ItemID.WingsStardust) - AddWingStats(9f, 2.5f, 3, 180, "10% increased minion damage while wearing the Stardust Armor"); + AddWingStats(item.wingSlot, 0.85f, 0.15f, 1f, 3f, 0.135f, "WingsStardust"); if (item.type == ItemID.WingsVortex) - AddWingStats(6.5f, 1.5f, 2, 180, "3% increased ranged damage and 7% increased ranged critical strike chance\n" + - "while wearing the Vortex Armor"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 1f, 2.45f, 0.15f, "WingsVortex"); if (item.type == ItemID.WingsNebula) - AddWingStats(6.5f, 1.5f, 2, 180, "+20 max mana, 5% increased magic damage and critical strike chance,\n" + - "and 5% decreased mana usage while wearing the Nebula Armor"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 1f, 2.45f, 0.15f, "WingsNebula"); - // Betsy's Wings (and dev wings) are the only wings without "Allows flight and free fall" if (item.type == ItemID.BetsyWings) - AddWingStats2(6f, 2.5f, 2, 150, null, "Equipable"); + AddWingStats(item.wingSlot, 0.75f, 0.15f, 1f, 2.5f, 0.125f); if (item.type == ItemID.RainbowWings) - AddWingStats(7f, 2.5f, 2, 100); + AddWingStats(item.wingSlot, 0.85f, 0.15f, 1f, 2.5f, 0.125f); if (item.type == ItemID.LongRainbowTrailWings) - AddWingStats(8f, 2.75f, 4, 180); + AddWingStats(item.wingSlot, 0.95f, 0.15f, 1f, 4.5f, 0.1f); #endregion // Provide the full stats of every vanilla grappling hook #region Grappling Hook Stat Tooltips - // This function produces a "stat sheet" for a grappling hook from the raw stats. - string HookStatsTooltip(float reach, float launch, float reel, float pull) - { - StringBuilder sb = new StringBuilder(128); - sb.Append('\n'); - sb.Append($"Reach: {reach:N3} tiles\n"); - sb.Append($"Launch Velocity: {launch:N2}\n"); - sb.Append($"Reelback Velocity: {reel:N2}\n"); - sb.Append($"Pull Velocity: {pull:N2}"); - return sb.ToString(); - } - // This function is shorthand for appending a stat sheet to a grappling hook. - void AddGrappleStats(float r, float l, float e, float p) => EditTooltipByName("Equipable", (line) => line.Text += HookStatsTooltip(r, l, e, p)); + void AddGrappleStats(float r, float l, float e, float p) => EditTooltipByName("Equipable", (line) => line.Text += "\n" + CalamityUtils.GetText("Common.GrappleStats").Format(r.ToString(), l.ToString(), e.ToString(), p.ToString())); if (item.type == ItemID.GrapplingHook) AddGrappleStats(18.75f, 11.5f, 11f, 11f); @@ -1455,7 +1404,7 @@ namespace CalamityMod.Items #region Herbs and Seeds Tooltips - void AddHerbTooltips(string text) + void AddHerbTooltips(string key) { int materialIndex = 0; for (int i = 0; i < tooltips.Count; ++i) @@ -1464,25 +1413,25 @@ namespace CalamityMod.Items materialIndex = i; break; } - tooltips.Insert(materialIndex + 1, new TooltipLine(CalamityMod.Instance, "Tooltip0", text)); + tooltips.Insert(materialIndex + 1, new TooltipLine(CalamityMod.Instance, "Tooltip0", CalamityUtils.GetTextValue($"Vanilla.HerbTooltips.{key}"))); } if (item.type == ItemID.Daybloom) - AddHerbTooltips(CalamityUtils.GetTextValue("Vanilla.HerbTooltips.Daybloom")); + AddHerbTooltips("Daybloom"); if (item.type == ItemID.Moonglow) - AddHerbTooltips(CalamityUtils.GetTextValue("Vanilla.HerbTooltips.Moonglow")); + AddHerbTooltips("Moonglow"); if (item.type == ItemID.Waterleaf) - AddHerbTooltips(CalamityUtils.GetTextValue("Vanilla.HerbTooltips.Waterleaf")); + AddHerbTooltips("Waterleaf"); if (item.type == ItemID.Blinkroot) - AddHerbTooltips(CalamityUtils.GetTextValue("Vanilla.HerbTooltips.Blinkroot")); + AddHerbTooltips("Blinkroot"); if (item.type == ItemID.Shiverthorn) - AddHerbTooltips(CalamityUtils.GetTextValue("Vanilla.HerbTooltips.Shiverthorn")); + AddHerbTooltips("Shiverthorn"); if (item.type == ItemID.Deathweed) - AddHerbTooltips(CalamityUtils.GetTextValue("Vanilla.HerbTooltips.Deathweed")); + AddHerbTooltips("Deathweed"); if (item.type == ItemID.Fireblossom) - AddHerbTooltips(CalamityUtils.GetTextValue("Vanilla.HerbTooltips.Fireblossom")); + AddHerbTooltips("Fireblossom"); - void AddSeedTooltips(string text) + void AddSeedTooltips(string key) { int materialIndex = 0; for (int i = 0; i < tooltips.Count; ++i) @@ -1491,23 +1440,23 @@ namespace CalamityMod.Items materialIndex = i; break; } - tooltips.Insert(materialIndex + 1, new TooltipLine(CalamityMod.Instance, "Tooltip0", text)); + tooltips.Insert(materialIndex + 1, new TooltipLine(CalamityMod.Instance, "Tooltip0", CalamityUtils.GetTextValue($"Vanilla.SeedTooltips.{key}"))); } if (item.type == ItemID.DaybloomSeeds) - AddSeedTooltips(CalamityUtils.GetTextValue("Vanilla.SeedTooltips.Daybloom")); + AddSeedTooltips("Daybloom"); if (item.type == ItemID.MoonglowSeeds) - AddSeedTooltips(CalamityUtils.GetTextValue("Vanilla.SeedTooltips.Moonglow")); + AddSeedTooltips("Moonglow"); if (item.type == ItemID.WaterleafSeeds) - AddSeedTooltips(CalamityUtils.GetTextValue("Vanilla.SeedTooltips.Waterleaf")); + AddSeedTooltips("Waterleaf"); if (item.type == ItemID.BlinkrootSeeds) - AddSeedTooltips(CalamityUtils.GetTextValue("Vanilla.SeedTooltips.Blinkroot")); + AddSeedTooltips("Blinkroot"); if (item.type == ItemID.ShiverthornSeeds) - AddSeedTooltips(CalamityUtils.GetTextValue("Vanilla.SeedTooltips.Shiverthorn")); + AddSeedTooltips("Shiverthorn"); if (item.type == ItemID.DeathweedSeeds) - AddSeedTooltips(CalamityUtils.GetTextValue("Vanilla.SeedTooltips.Deathweed")); + AddSeedTooltips("Deathweed"); if (item.type == ItemID.FireblossomSeeds) - AddSeedTooltips(CalamityUtils.GetTextValue("Vanilla.SeedTooltips.Fireblossom")); + AddSeedTooltips("Fireblossom"); #endregion @@ -1519,7 +1468,7 @@ namespace CalamityMod.Items #region Accessory Prefix Rebalance Tooltips // Turns a number into a string of increased DR. - string DRString(float percent) => $"\n+{percent:N2}% damage reduction"; + string DRString(float percent) => "\n" + GetAddedTooltip("DefensePrefix").Format(percent.ToString()); switch (item.prefix) { @@ -1540,7 +1489,7 @@ namespace CalamityMod.Items (line) => line.Text = line.Text.Replace("4", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(1f)); return; case PrefixID.Lucky: - EditTooltipByName("PrefixAccCritChance", (line) => line.Text += "\n+0.05 luck"); + EditTooltipByName("PrefixAccCritChance", (line) => line.Text += AddedTooltip("LuckyPrefix")); return; } #endregion @@ -1634,24 +1583,24 @@ namespace CalamityMod.Items #region Schematic Knowledge Tooltip Utility public static void InsertKnowledgeTooltip(List tooltips, int tier, bool allowOldWorlds = false) { - TooltipLine line = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge1", "You don't have sufficient knowledge to create this yet"); - TooltipLine line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", "A specific schematic must be deciphered first"); + TooltipLine line = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge1", CalamityUtils.GetTextValue("Misc.SchematicKnowledgeTooltip")); + TooltipLine line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", CalamityUtils.GetTextValue("Misc.SchematicKnowledgeTooltip2")); switch (tier) { case 1: - line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", "The Sunken Sea schematic must be deciphered first"); + line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", CalamityUtils.GetTextValue("Misc.Tier1KnowledgeTooltip")); break; case 2: - line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", "The Planetoid schematic must be deciphered first"); + line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", CalamityUtils.GetTextValue("Misc.Tier2KnowledgeTooltip")); break; case 3: - line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", "The Jungle schematic must be deciphered first"); + line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", CalamityUtils.GetTextValue("Misc.Tier3KnowledgeTooltip")); break; case 4: - line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", "The Underworld schematic must be deciphered first"); + line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", CalamityUtils.GetTextValue("Misc.Tier4KnowledgeTooltip")); break; case 5: - line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", "The Ice biome schematic must be deciphered first"); + line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", CalamityUtils.GetTextValue("Misc.Tier5KnowledgeTooltip")); break; } line.OverrideColor = line2.OverrideColor = Color.Cyan; diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 07c6955b62..9a134872a1 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -1,8 +1,12 @@ using System.Collections.Generic; using CalamityMod.Balancing; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -15,7 +19,7 @@ namespace CalamityMod.Items public partial class CalamityGlobalItem : GlobalItem { // 02AUG2023: Ozzatron: Having Overhaul enabled turns off all scaling changes, per direct request from Mirsario on 8/2/23. - private static bool DisableScalingForOverhaul => CalamityMod.Instance.overhaul is not null; + private static bool DisableScalingForOverhaul => ExternalMods.overhaul is not null; #region Database and Initialization internal static SortedDictionary currentTweaks = null; @@ -36,16 +40,17 @@ namespace CalamityMod.Items currentTweaks = new SortedDictionary { #region CATEGORY 1: Weapon Balancing - { ItemID.AdamantiteGlaive, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(65), ShootSpeedRatio(1.25f)) }, + { ItemID.AdamantiteGlaive, Do(AutoReuse, TrueMelee, DamageExact(69), UseExact(7), ShootSpeedExact(18f)) }, { ItemID.AdamantiteRepeater, Do(PointBlank, UseExact(14)) }, - { ItemID.AdamantiteSword, Do(UseTurn, DamageExact(77)) }, + { ItemID.AdamantiteSword, Do(UseTurn, DamageExact(75), UseExact(7)) }, { 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.AntlionClaw, Do(UseExact(10)) }, // Mandible Blade + { ItemID.AquaScepter, Do(DamageRatio(0.9f)) }, // Uses ratios due to remix seed { ItemID.Bananarang, Do(DamageExact(76), UseExact(14)) }, { ItemID.BatScepter, Do(DamageExact(50)) }, - { ItemID.BeamSword, Do(UseMeleeSpeed, DamageExact(142), UseAnimationExact(45), ShootSpeedExact(23f), KnockbackExact(8)) }, + { ItemID.BeamSword, Do(UseMeleeSpeed, DamageExact(131), UseAnimationExact(40), KnockbackExact(8)) }, { ItemID.BeeGun, Do(DamageExact(11), ManaExact(4)) }, { ItemID.BeeKeeper, Do(UseTurn, DamageExact(32)) }, { ItemID.Beenade, Do(DamageExact(11), UseTimeExact(22), ShootSpeedExact(10f)) }, @@ -54,30 +59,31 @@ namespace CalamityMod.Items { ItemID.BlizzardStaff, Do(DamageExact(41), ManaExact(7)) }, { ItemID.BloodyMachete, Do(AutoReuse, DamageExact(24)) }, { ItemID.Blowgun, Do(PointBlank, DamageExact(40), ShootSpeedExact(15f)) }, - { ItemID.BluePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.BluePhasesaber, Do(DamageExact(60)) }, - { ItemID.BookofSkulls, Do(ManaExact(12), ShootSpeedExact(5.5f)) }, + { ItemID.BluePhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, + { ItemID.BluePhasesaber, Do(DamageExact(132)) }, + { ItemID.BoneSword, Do(AutoReuse, UseTurn, DamageExact(25)) }, + { ItemID.BookofSkulls, Do(DamageExact(27), ManaExact(13), ShootSpeedExact(5.5f)) }, { ItemID.BookStaff, Do(ManaExact(14)) }, // Tome of Infinite Wisdom { ItemID.Boomstick, Do(PointBlank, DamageExact(11)) }, - { ItemID.BreakerBlade, Do(AutoReuse, UseTurn, DamageExact(97)) }, + { ItemID.BreakerBlade, Do(AutoReuse, UseTurn, DamageExact(140)) }, { ItemID.CandyCornRifle, Do(PointBlank, DamageExact(66)) }, { ItemID.Cascade, Do(AutoReuse, DamageExact(31)) }, { ItemID.ChainGuillotines, Do(DamageExact(100)) }, { ItemID.ChainGun, Do(PointBlank, DamageExact(35)) }, { ItemID.ChainKnife, Do(AutoReuse, DamageRatio(1.34f)) }, // Uses ratios due to remix seed - { 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.ChlorophyteClaymore, Do(UseMeleeSpeed, DamageExact(180), UseExact(45), ShootSpeedExact(22f)) }, + { ItemID.ChlorophytePartisan, Do(AutoReuse, UseMeleeSpeed, DamageExact(98)) }, + { ItemID.ChlorophyteSaber, Do(UseMeleeSpeed, DamageExact(92), UseExact(10)) }, { ItemID.ChristmasTreeSword, Do(AutoReuse, UseTurn, UseMeleeSpeed, DamageExact(80), UseExact(30)) }, { ItemID.ClingerStaff, Do(DamageExact(63)) }, { ItemID.ClockworkAssaultRifle, Do(PointBlank, DamageExact(21)) }, - { ItemID.CobaltNaginata, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(90)) }, + { ItemID.CobaltNaginata, Do(AutoReuse, TrueMelee, DamageExact(55), UseExact(9), ShootSpeedExact(12f)) }, { ItemID.CobaltRepeater, Do(PointBlank, UseExact(18)) }, - { ItemID.CobaltSword, Do(UseTurn, DamageExact(80)) }, + { ItemID.CobaltSword, Do(UseTurn, DamageExact(60), UseExact(9)) }, { 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.CrystalBullet, Do(DamageExact(6)) }, { ItemID.CrystalDart, Do(DamageExact(20)) }, { ItemID.CrystalSerpent, Do(DamageExact(45)) }, { ItemID.CrystalStorm, Do(DamageExact(40)) }, @@ -85,8 +91,8 @@ namespace CalamityMod.Items { ItemID.CursedDart, Do(DamageExact(25)) }, { ItemID.Cutlass, Do(UseRatio(0.9f), DamageExact(90)) }, { ItemID.DaedalusStormbow, Do(DamageExact(30)) }, - { ItemID.DaoofPow, Do(DamageExact(85), ShootSpeedExact(10)) }, - { ItemID.DarkLance, Do(AutoReuse, TrueMelee, DamageExact(45)) }, + { ItemID.DaoofPow, Do(DamageExact(85)) }, + { ItemID.DarkLance, Do(AutoReuse, TrueMelee, DamageExact(40)) }, { ItemID.DartRifle, Do(PointBlank, DamageExact(58)) }, { ItemID.DayBreak, Do(DamageExact(125), UseExact(20)) }, { ItemID.DD2BetsyBow, Do(DamageExact(42)) }, // Aerial Bane's ridiculous multiplier is removed, so this compensates for that @@ -102,31 +108,31 @@ namespace CalamityMod.Items { 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, UseRatio(0.8f), DamageExact(125), UseAnimationExact(45)) }, + { ItemID.EndlessMusketPouch, Do(DamageExact(8)) }, + { ItemID.Excalibur, Do(TrueMelee, DamageExact(220), UseExact(24)) }, { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, // Nightglow - { ItemID.FalconBlade, Do(UseTurn, UseExact(15)) }, - // For now, I think I will balance Celebration like a serious weapon. -CIT + { ItemID.FalconBlade, Do(UseTurn, UseExact(13)) }, { ItemID.FireworksLauncher, Do(DamageExact(50), UseExact(25)) }, // Celebration { ItemID.Flairon, Do(DamageExact(65)) }, { 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.FlowerofFire, Do(AutoReuse, ManaExact(7), UseRatio(0.88f), DamageRatio(0.7f)) }, // Uses ratios due to remix seed { ItemID.FlowerofFrost, Do(AutoReuse, ManaExact(7), UseExact(22), DamageExact(70), ShootSpeedExact(14)) }, { ItemID.FlyingKnife, Do(DamageExact(53)) }, { 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(39)) }, + { ItemID.GoldCoin, Do(DamageExact(75)) }, // For Coin Gun { 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(DamageExact(60)) }, + { ItemID.GreenPhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, + { ItemID.GreenPhasesaber, Do(DamageExact(132)) }, { ItemID.GrenadeLauncher, Do(DamageExact(112)) }, - { ItemID.Gungnir, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(92), ShootSpeedRatio(1.25f)) }, + { ItemID.Gungnir, Do(AutoReuse, TrueMelee, DamageExact(144), ShootSpeedExact(7f)) }, { ItemID.HallowedRepeater, Do(PointBlank, UseExact(12)) }, - { ItemID.Handgun, Do(PointBlank, UseExact(22), DamageExact(36)) }, + { ItemID.Handgun, Do(PointBlank, UseExact(20)) }, { ItemID.HellwingBow, Do(PointBlank, DamageExact(16)) }, { ItemID.HighVelocityBullet, Do(DamageExact(13)) }, { ItemID.HiveFive, Do(AutoReuse, DamageExact(27)) }, @@ -148,7 +154,7 @@ namespace CalamityMod.Items { 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.LightDisc, Do(DamageExact(98), ShootSpeedExact(18)) }, { 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 @@ -166,60 +172,62 @@ namespace CalamityMod.Items { ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageExact(90)) }, // Ghastly Glaive { ItemID.MonkStaffT3, Do(DamageExact(225)) }, // Sky Dragon's Fury { ItemID.MoonlordBullet, Do(DamageExact(19)) }, // Luminite Bullet - { ItemID.MoonlordTurretStaff, Do(DamageExact(50), UseExact(15)) }, //Lunar Portal Staff - { ItemID.Muramasa, Do(CritDelta(+20)) }, + { ItemID.MoonlordTurretStaff, Do(DamageExact(50), UseExact(15)) }, // Lunar Portal Staff + { ItemID.Muramasa, Do(CritDelta(+10)) }, { 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.MythrilHalberd, Do(AutoReuse, TrueMelee, DamageExact(65), UseExact(8), ShootSpeedExact(15f)) }, { ItemID.MythrilRepeater, Do(PointBlank, UseExact(16)) }, - { ItemID.MythrilSword, Do(UseTurn, DamageExact(100)) }, + { ItemID.MythrilSword, Do(UseTurn, DamageExact(70), UseExact(8)) }, { 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(DamageExact(60)) }, - { ItemID.OrichalcumHalberd, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(98), ShootSpeedRatio(1.25f)) }, + { ItemID.OrangePhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, + { ItemID.OrangePhasesaber, Do(DamageExact(132)) }, + { ItemID.OrichalcumHalberd, Do(AutoReuse, TrueMelee, DamageExact(128), ShootSpeedExact(6f)) }, { ItemID.OrichalcumRepeater, Do(PointBlank, DamageExact(48)) }, - { ItemID.OrichalcumSword, Do(UseTurn, DamageExact(82)) }, + { ItemID.OrichalcumSword, Do(UseTurn, DamageExact(175)) }, { ItemID.PainterPaintballGun, Do(PointBlank, DamageExact(8)) }, { ItemID.PaladinsHammer, Do(DamageExact(100), ShootSpeedExact(23)) }, - { ItemID.PalladiumPike, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(96)) }, + { ItemID.PalladiumPike, Do(AutoReuse, TrueMelee, DamageExact(120), ShootSpeedExact(5.4f)) }, { ItemID.PalladiumRepeater, Do(PointBlank, DamageExact(45)) }, - { ItemID.PalladiumSword, Do(UseTurn, DamageExact(100)) }, - { ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageExact(20), UseDelta(+8), ShootSpeedDelta(+3.4f), KnockbackDelta(+1f)) }, + { ItemID.PalladiumSword, Do(UseTurn, DamageExact(150)) }, + { ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageExact(32)) }, { ItemID.PearlwoodSword, Do(UseTurn, DamageExact(45)) }, { ItemID.PewMaticHorn, Do(DamageExact(25), ShootSpeedExact(15)) }, { ItemID.Phantasm, Do(PointBlank, DamageExact(48)) }, - { ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, UseExact(18)) }, + { ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, UseExact(20)) }, { ItemID.PiranhaGun, Do(DamageExact(48)) }, { ItemID.PlatinumBow, Do(PointBlank, DamageExact(12)) }, + { ItemID.PlatinumCoin, Do(DamageExact(150)) }, // For Coin Gun { ItemID.PlatinumShortsword, Do(AutoReuse, TrueMelee, DamageExact(18)) }, { ItemID.PoisonStaff, Do(DamageExact(57)) }, { ItemID.PossessedHatchet, Do(DamageExact(135)) }, - { ItemID.PsychoKnife, Do(UseTurn, UseExact(11), DamageExact(255)) }, + { ItemID.PrincessWeapon, Do(DamageExact(90)) }, // Resonance Scepter + { ItemID.PsychoKnife, Do(UseTurn, UseExact(11), DamageExact(200)) }, { ItemID.PurpleClubberfish, Do(UseTurn, KnockbackExact(10f)) }, - { ItemID.PurplePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.PurplePhasesaber, Do(DamageExact(60)) }, + { ItemID.PurplePhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, + { ItemID.PurplePhasesaber, Do(DamageExact(132)) }, { 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)) }, + { ItemID.RainbowRod, Do(DamageExact(40), ManaExact(13)) }, + { ItemID.Rally, Do(AutoReuse, DamageExact(18)) }, { ItemID.RavenStaff, Do(AutoReuse, UseExact(20), DamageExact(36)) }, { ItemID.RazorbladeTyphoon, Do(DamageExact(103)) }, { ItemID.Razorpine, Do(DamageExact(40)) }, - { ItemID.RedPhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.RedPhasesaber, Do(DamageExact(60)) }, + { ItemID.RedPhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, + { ItemID.RedPhasesaber, Do(DamageExact(132)) }, { ItemID.RedRyder, Do(PointBlank, DamageExact(24)) }, { 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.Seedler, Do(UseMeleeSpeed, DamageExact(74), ShootSpeedDelta(+4f)) }, + { ItemID.Seedler, Do(UseMeleeSpeed, DamageExact(75), ShootSpeedDelta(+4f)) }, { ItemID.ShadowbeamStaff, Do(DamageExact(100)) }, { ItemID.ShadowFlameBow, Do(PointBlank, DamageExact(55)) }, { ItemID.ShadowFlameHexDoll, Do(DamageExact(40), ShootSpeedExact(30)) }, - { ItemID.ShadowFlameKnife, Do(DamageExact(70)) }, + { ItemID.ShadowFlameKnife, Do(DamageExact(50)) }, { ItemID.SharpTears, Do(DamageExact(49)) }, // Blood Thorn { ItemID.Shotgun, Do(PointBlank, DamageExact(36), AutoReuse) }, { ItemID.Shroomerang, Do(ShootSpeedExact(11)) }, @@ -229,7 +237,7 @@ namespace CalamityMod.Items { ItemID.SlapHand, Do(UseTurn, DamageExact(120)) }, { ItemID.Smolstar, Do(DamageExact(9), AutoReuse, UseExact(25)) }, // Blade Staff { ItemID.SniperRifle, Do(PointBlank, DamageExact(215)) }, - { ItemID.SolarEruption, Do(DamageExact(157)) }, + { ItemID.SolarEruption, Do(DamageExact(122)) }, { ItemID.SoulDrain, Do(DamageExact(38)) }, // Life Drain { ItemID.SpaceGun, Do(DamageExact(25)) }, { ItemID.Spear, Do(AutoReuse, TrueMelee, DamageExact(14)) }, @@ -239,31 +247,33 @@ namespace CalamityMod.Items { 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.StylistKilLaKillScissorsIWish, Do(AutoReuse, UseTurn, DamageExact(21)) }, // Stylish Scissors { ItemID.Stynger, Do(DamageExact(75)) }, { ItemID.Swordfish, Do(AutoReuse, TrueMelee, DamageExact(24)) }, { ItemID.TacticalShotgun, Do(PointBlank, DamageExact(41)) }, { ItemID.TaxCollectorsStickOfDoom, Do(AutoReuse, UseTurn, UseRatio(0.8f), DamageExact(70)) }, // Classy Cane { ItemID.TendonBow, Do(PointBlank, DamageExact(17), AutoReuse) }, - { ItemID.TerraBlade, Do(DamageExact(122)) }, + { ItemID.TerraBlade, Do(DamageExact(92)) }, + { ItemID.Terragrim, Do(TrueMeleeNoSpeed, DamageExact(13)) }, // Vanilla damage 190. After fixing iframes so yoyo and shots can hit simultaneously, // Terrarian is extremely overpowered and requires a heavy nerf. - { ItemID.Terrarian, Do(AutoReuse, DamageExact(86)) }, + { ItemID.Terrarian, Do(AutoReuse, DamageExact(90)) }, { ItemID.TheEyeOfCthulhu, Do(AutoReuse, DamageExact(90)) }, + { ItemID.TheMeatball, Do(DamageExact(24)) }, { 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, DamageExact(77)) }, - { ItemID.TitaniumTrident, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(72), ShootSpeedRatio(1.25f)) }, + { ItemID.TitaniumSword, Do(UseTurn, DamageExact(192)) }, + { ItemID.TitaniumTrident, Do(AutoReuse, TrueMelee, DamageExact(144), ShootSpeedExact(6.5f)) }, { ItemID.TopazStaff, Do(ManaExact(2)) }, { ItemID.Toxikarp, Do(UseExact(9)) }, { ItemID.Trident, Do(AutoReuse, TrueMelee, DamageExact(20)) }, { ItemID.Trimarang, Do(DamageExact(24)) }, - { ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(107)) }, + { ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(112)) }, { ItemID.TrueNightsEdge, Do(DamageExact(105)) }, - { ItemID.Tsunami, Do(PointBlank, DamageExact(49)) }, + { ItemID.Tsunami, Do(PointBlank, DamageExact(45)) }, { ItemID.TungstenBullet, Do(DamageExact(8)) }, { ItemID.TungstenShortsword, Do(AutoReuse, TrueMelee, DamageExact(15)) }, { ItemID.UnholyArrow, Do(DamageExact(11)) }, @@ -274,12 +284,12 @@ namespace CalamityMod.Items { ItemID.VenusMagnum, Do(PointBlank, DamageExact(65)) }, { ItemID.WaspGun, Do(UseExact(11), DamageExact(58)) }, { ItemID.WaterBolt, Do(DamageExact(23)) }, - { ItemID.WhitePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.WhitePhasesaber, Do(DamageExact(60)) }, + { ItemID.WhitePhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, + { ItemID.WhitePhasesaber, Do(DamageExact(132)) }, { 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(DamageExact(60)) }, + { ItemID.YellowPhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, + { ItemID.YellowPhasesaber, Do(DamageExact(132)) }, { ItemID.Zenith, Do(DamageExact(210)) }, { ItemID.ZombieArm, Do(AutoReuse, UseTurn, KnockbackExact(12f)) }, #endregion @@ -296,6 +306,7 @@ namespace CalamityMod.Items { ItemID.HallowedPlateMail, Do(DefenseDelta(+3)) }, { ItemID.HeroShield, Do(DefenseDelta(+5)) }, // 15 total (plus increased max life) { ItemID.LavaSkull, Do(DefenseExact(4)) }, // Magma Skull + { ItemID.MoltenCharm, Do(DefenseExact(4)) }, //Magma Charm { ItemID.MoltenSkullRose, Do(DefenseExact(8)) }, { ItemID.ObsidianShield, Do(DefenseDelta(+4)) }, // 6 total { ItemID.ObsidianSkull, Do(DefenseDelta(+1)) }, // 2 total @@ -312,6 +323,12 @@ namespace CalamityMod.Items { ItemID.PalladiumMask, Do(DefenseDelta(+1)) }, { ItemID.PalladiumLeggings, Do(DefenseDelta(+3)) }, { ItemID.Shackle, Do(DefenseDelta(+2)) }, // 3 total + { ItemID.SquireAltHead, Do(DefenseDelta(-2)) }, + { ItemID.SquireAltPants, Do(DefenseDelta(-3)) }, + { ItemID.SquireAltShirt, Do(DefenseDelta(-3)) }, + { ItemID.SquireGreatHelm, Do(DefenseDelta(-1)) }, + { ItemID.SquireGreaves, Do(DefenseDelta(-2)) }, + { ItemID.SquirePlating, Do(DefenseDelta(-4)) }, #endregion #region CATEGORY 3: Tool Balancing @@ -323,7 +340,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(177)) }, + { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0)) }, { 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)) }, @@ -385,7 +402,7 @@ namespace CalamityMod.Items { ItemID.PlatinumHammer, Do(HammerPower(60), UseTimeExact(9), TileBoostExact(+0)) }, { ItemID.PlatinumPickaxe, Do(PickPower(55), UseTimeExact(9)) }, { ItemID.Pwnhammer, Do(HammerPower(80), UseTimeExact(11), TileBoostExact(+1)) }, - { ItemID.ReaverShark, Do(PickPower(100), UseTimeExact(16)) }, + { ItemID.ReaverShark, Do(PickPower(65), UseTimeExact(16)) }, { ItemID.RichMahoganyHammer, Do(HammerPower(25), UseTimeExact(10), TileBoostExact(+0)) }, { ItemID.Rockfish, Do(HammerPower(50), UseTimeExact(10), TileBoostExact(+0)) }, { ItemID.SawtoothShark, Do(TrueMeleeNoSpeed, AxePower(45), UseTimeExact(4), TileBoostExact(-1)) }, @@ -431,7 +448,6 @@ namespace CalamityMod.Items { ItemID.ShadowJoustingLance, trueMelee }, { ItemID.SolarFlareChainsaw, trueMeleeNoSpeed }, { ItemID.StardustChainsaw, trueMeleeNoSpeed }, - { ItemID.Terragrim, trueMeleeNoSpeed }, { ItemID.TheHorsemansBlade, trueMelee }, { ItemID.TinShortsword, Do(AutoReuse, TrueMelee) }, { ItemID.VortexChainsaw, trueMeleeNoSpeed }, @@ -516,7 +532,6 @@ namespace CalamityMod.Items { ItemID.BatBat, autoReuse }, { ItemID.BladeofGrass, Do(AutoReuse, UseTurn) }, { ItemID.BloodButcherer, Do(AutoReuse, UseTurn) }, - { ItemID.BoneSword, Do(AutoReuse, UseTurn) }, { ItemID.BorealWoodSword, Do(AutoReuse, UseTurn) }, { ItemID.CactusSword, Do(AutoReuse, UseTurn) }, { ItemID.CandyCaneSword, Do(AutoReuse, UseTurn) }, @@ -1396,7 +1411,8 @@ namespace CalamityMod.Items shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); shimmerTransmute[ModContent.ItemType()] = shimmerTransmute[ItemID.LunarOre]; - shimmerTransmute[ModContent.ItemType()] = shimmerTransmute[ItemID.ChlorophyteOre]; + shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = shimmerTransmute[ItemID.ChlorophyteOre]; shimmerTransmute[ModContent.ItemType()] = shimmerTransmute[ItemID.CobaltOre]; //shimmerTransmute[ItemID.LunarOre] = ModContent.ItemType(); @@ -1413,6 +1429,16 @@ namespace CalamityMod.Items shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + //Astral Fishing Swap + shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + + //Profaned Guardian Drop Swap + shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + //Calamity Permanent Upgrades shimmerTransmute[ItemID.FrogLeg] = ModContent.ItemType(); } diff --git a/Items/Critters/AlphaSeaMinnowGoldItem.cs b/Items/Critters/AlphaSeaMinnowGoldItem.cs new file mode 100644 index 0000000000..abe6bf332b --- /dev/null +++ b/Items/Critters/AlphaSeaMinnowGoldItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class AlphaSeaMinnowGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 50; + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/AlphaSeaMinnowGoldItem.png b/Items/Critters/AlphaSeaMinnowGoldItem.png new file mode 100644 index 0000000000..4fde55be43 Binary files /dev/null and b/Items/Critters/AlphaSeaMinnowGoldItem.png differ diff --git a/Items/Critters/AlphaSeaMinnowItem.cs b/Items/Critters/AlphaSeaMinnowItem.cs new file mode 100644 index 0000000000..c8336e00d5 --- /dev/null +++ b/Items/Critters/AlphaSeaMinnowItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class AlphaSeaMinnowItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 30; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/AlphaSeaMinnowItem.png b/Items/Critters/AlphaSeaMinnowItem.png new file mode 100644 index 0000000000..6971e57df1 Binary files /dev/null and b/Items/Critters/AlphaSeaMinnowItem.png differ diff --git a/Items/Critters/AndroombaItem.cs b/Items/Critters/AndroombaItem.cs index f425e0e5aa..9b93f5ba7d 100644 --- a/Items/Critters/AndroombaItem.cs +++ b/Items/Critters/AndroombaItem.cs @@ -17,18 +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; - Item.useAnimation = 25; - Item.useTime = 25; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30, 0); - Item.makeNPC = (short)ModContent.NPCType(); + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); Item.rare = ModContent.RarityType(); } } diff --git a/Items/Critters/BabyCannonballJellyfishItem.cs b/Items/Critters/BabyCannonballJellyfishItem.cs index 0bd52d01a3..d36cc2a4b9 100644 --- a/Items/Critters/BabyCannonballJellyfishItem.cs +++ b/Items/Critters/BabyCannonballJellyfishItem.cs @@ -15,19 +15,10 @@ 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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30, 0); - Item.makeNPC = (short)ModContent.NPCType(); + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; + Item.damage = 400; } } } diff --git a/Items/Critters/BabyCannonballJellyfishItem.png b/Items/Critters/BabyCannonballJellyfishItem.png index 7fc4c1bfe6..49a2bf6f0f 100644 Binary files a/Items/Critters/BabyCannonballJellyfishItem.png and b/Items/Critters/BabyCannonballJellyfishItem.png differ diff --git a/Items/Critters/BabyFlakCrabItem.cs b/Items/Critters/BabyFlakCrabItem.cs index f5ba7ddaac..61d480672a 100644 --- a/Items/Critters/BabyFlakCrabItem.cs +++ b/Items/Critters/BabyFlakCrabItem.cs @@ -15,19 +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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30, 0); - //item.CloneDefaults(2004); //Lightning Bug item - Item.makeNPC = (short)ModContent.NPCType(); + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.LightPurple; } } diff --git a/Items/Critters/BabyGhostBellGoldItem.cs b/Items/Critters/BabyGhostBellGoldItem.cs new file mode 100644 index 0000000000..5d9f76989f --- /dev/null +++ b/Items/Critters/BabyGhostBellGoldItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class BabyGhostBellGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 50; + Item.value = Item.sellPrice(gold: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/BabyGhostBellGoldItem.png b/Items/Critters/BabyGhostBellGoldItem.png new file mode 100644 index 0000000000..a62694c074 Binary files /dev/null and b/Items/Critters/BabyGhostBellGoldItem.png differ diff --git a/Items/Critters/BabyGhostBellGreenItem.cs b/Items/Critters/BabyGhostBellGreenItem.cs new file mode 100644 index 0000000000..a007a1e88a --- /dev/null +++ b/Items/Critters/BabyGhostBellGreenItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class BabyGhostBellGreenItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 20; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/BabyGhostBellGreenItem.png b/Items/Critters/BabyGhostBellGreenItem.png new file mode 100644 index 0000000000..b4309e1033 Binary files /dev/null and b/Items/Critters/BabyGhostBellGreenItem.png differ diff --git a/Items/Critters/BabyGhostBellItem.cs b/Items/Critters/BabyGhostBellItem.cs index 0c24b987a1..620dc56777 100644 --- a/Items/Critters/BabyGhostBellItem.cs +++ b/Items/Critters/BabyGhostBellItem.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Packets; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,25 +11,65 @@ namespace CalamityMod.Items.Critters public new string LocalizationCategory => "Items.Misc"; public override void SetStaticDefaults() { + On_Player.ItemCheck_ReleaseCritter += ReleaseColoredGhostBell; Item.ResearchUnlockCount = 5; } public override void SetDefaults() { - Item.width = 26; - Item.height = 24; - Item.useStyle = ItemUseStyleID.Swing; - Item.autoReuse = true; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30, 0); + Item.DefaultToCapturedCritter(ModContent.NPCType()); Item.bait = 20; - Item.makeNPC = (short)ModContent.NPCType(); + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; } + + // Since all Baby Ghost Bell variants are a single NPC type, this needs to be done in order for each item to spawn the correct color + public static void ReleaseColoredGhostBell(On_Player.orig_ItemCheck_ReleaseCritter orig, Player player, Item item) + { + if (item.makeNPC == ModContent.NPCType()) + { + int mouseX = Main.mouseX + (int)Main.screenPosition.X; + int mouseY = Main.mouseY + (int)Main.screenPosition.Y; + int tileX = mouseX / 16; + int tileY = mouseY / 16; + if (!WorldGen.SolidTile(tileX, tileY)) + { + int colorType = (int)BabyGhostBell.JellyColor.Blue; + if (item.type == ModContent.ItemType()) + { + colorType = (int)BabyGhostBell.JellyColor.Green; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)BabyGhostBell.JellyColor.Red; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)BabyGhostBell.JellyColor.Radiant; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)BabyGhostBell.JellyColor.Gold; + } + player.ApplyItemTime(item); + + if (Main.netMode == NetmodeID.SinglePlayer) + { + int n = NPC.NewNPC(player.GetSource_ReleaseEntity(), mouseX, mouseY, item.makeNPC); + Main.npc[n].ai[1] = colorType; + Main.npc[n].catchItem = item.type; + Main.npc[n].releaseOwner = (short)player.whoAmI; + } + else + { + PlaceAltCritterPacket.Send(player, mouseX, mouseY, item, colorType); + } + } + } + else + { + orig(player, item); + } + } } } diff --git a/Items/Critters/BabyGhostBellItem.png b/Items/Critters/BabyGhostBellItem.png index 7e7e84c4f1..df7b9dc7ef 100644 Binary files a/Items/Critters/BabyGhostBellItem.png and b/Items/Critters/BabyGhostBellItem.png differ diff --git a/Items/Critters/BabyGhostBellRadiantItem.cs b/Items/Critters/BabyGhostBellRadiantItem.cs new file mode 100644 index 0000000000..acec17ce8a --- /dev/null +++ b/Items/Critters/BabyGhostBellRadiantItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class BabyGhostBellRadiantItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 20; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/BabyGhostBellRadiantItem.png b/Items/Critters/BabyGhostBellRadiantItem.png new file mode 100644 index 0000000000..1f6c79cebc Binary files /dev/null and b/Items/Critters/BabyGhostBellRadiantItem.png differ diff --git a/Items/Critters/BabyGhostBellRedItem.cs b/Items/Critters/BabyGhostBellRedItem.cs new file mode 100644 index 0000000000..5614894572 --- /dev/null +++ b/Items/Critters/BabyGhostBellRedItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class BabyGhostBellRedItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 20; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/BabyGhostBellRedItem.png b/Items/Critters/BabyGhostBellRedItem.png new file mode 100644 index 0000000000..9b414d1ab7 Binary files /dev/null and b/Items/Critters/BabyGhostBellRedItem.png differ diff --git a/Items/Critters/NanodroidDysfunctionalItem.cs b/Items/Critters/NanodroidDysfunctionalItem.cs index 40ea800eed..aa6e247799 100644 --- a/Items/Critters/NanodroidDysfunctionalItem.cs +++ b/Items/Critters/NanodroidDysfunctionalItem.cs @@ -16,18 +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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30); - Item.makeNPC = (short)ModContent.NPCType(); + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); Item.rare = ModContent.RarityType(); } } diff --git a/Items/Critters/NanodroidItem.cs b/Items/Critters/NanodroidItem.cs index f6cb353171..61f4721b10 100644 --- a/Items/Critters/NanodroidItem.cs +++ b/Items/Critters/NanodroidItem.cs @@ -16,18 +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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30); - Item.makeNPC = (short)ModContent.NPCType(); + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); Item.rare = ModContent.RarityType(); } } diff --git a/Items/Critters/NanodroidPlagueGreenItem.cs b/Items/Critters/NanodroidPlagueGreenItem.cs index 7b9c9b8dcb..a53d200185 100644 --- a/Items/Critters/NanodroidPlagueGreenItem.cs +++ b/Items/Critters/NanodroidPlagueGreenItem.cs @@ -16,18 +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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30); - Item.makeNPC = (short)ModContent.NPCType(); + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); Item.rare = ModContent.RarityType(); } } diff --git a/Items/Critters/NanodroidPlagueRedItem.cs b/Items/Critters/NanodroidPlagueRedItem.cs index 7e402536ff..5932247cb6 100644 --- a/Items/Critters/NanodroidPlagueRedItem.cs +++ b/Items/Critters/NanodroidPlagueRedItem.cs @@ -16,18 +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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30); - Item.makeNPC = (short)ModContent.NPCType(); + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); Item.rare = ModContent.RarityType(); } } diff --git a/Items/Critters/PearlpodBlackItem.cs b/Items/Critters/PearlpodBlackItem.cs new file mode 100644 index 0000000000..30818b7f72 --- /dev/null +++ b/Items/Critters/PearlpodBlackItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class PearlpodBlackItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 20; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PearlpodBlackItem.png b/Items/Critters/PearlpodBlackItem.png new file mode 100644 index 0000000000..e12ceb5a8a Binary files /dev/null and b/Items/Critters/PearlpodBlackItem.png differ diff --git a/Items/Critters/PearlpodGoldItem.cs b/Items/Critters/PearlpodGoldItem.cs new file mode 100644 index 0000000000..fb84d69a99 --- /dev/null +++ b/Items/Critters/PearlpodGoldItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class PearlpodGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 50; + Item.value = Item.sellPrice(gold: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PearlpodGoldItem.png b/Items/Critters/PearlpodGoldItem.png new file mode 100644 index 0000000000..b4813c7bd3 Binary files /dev/null and b/Items/Critters/PearlpodGoldItem.png differ diff --git a/Items/Critters/PearlpodItem.cs b/Items/Critters/PearlpodItem.cs new file mode 100644 index 0000000000..dcdfbcc323 --- /dev/null +++ b/Items/Critters/PearlpodItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class PearlpodItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 20; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PearlpodItem.png b/Items/Critters/PearlpodItem.png new file mode 100644 index 0000000000..abddeb22ff Binary files /dev/null and b/Items/Critters/PearlpodItem.png differ diff --git a/Items/Critters/PearlpodPinkItem.cs b/Items/Critters/PearlpodPinkItem.cs new file mode 100644 index 0000000000..e91ad00b95 --- /dev/null +++ b/Items/Critters/PearlpodPinkItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class PearlpodPinkItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 20; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PearlpodPinkItem.png b/Items/Critters/PearlpodPinkItem.png new file mode 100644 index 0000000000..20bf35cddd Binary files /dev/null and b/Items/Critters/PearlpodPinkItem.png differ diff --git a/Items/Critters/PiggyItem.cs b/Items/Critters/PiggyItem.cs index 10c728c170..3388b74cff 100644 --- a/Items/Critters/PiggyItem.cs +++ b/Items/Critters/PiggyItem.cs @@ -15,18 +15,7 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - Item.width = 26; - Item.height = 24; - Item.useStyle = ItemUseStyleID.Swing; - Item.autoReuse = true; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.makeNPC = (short)ModContent.NPCType(); - + Item.DefaultToCapturedCritter(ModContent.NPCType()); Item.value = Item.sellPrice(gold: 10); Item.rare = ItemRarityID.Blue; Item.Calamity().donorItem = true; diff --git a/Items/Critters/PolypPanaseaGoldItem.cs b/Items/Critters/PolypPanaseaGoldItem.cs new file mode 100644 index 0000000000..b36e59810c --- /dev/null +++ b/Items/Critters/PolypPanaseaGoldItem.cs @@ -0,0 +1,23 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(gold: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaGoldItem.png b/Items/Critters/PolypPanaseaGoldItem.png new file mode 100644 index 0000000000..b419186c46 Binary files /dev/null and b/Items/Critters/PolypPanaseaGoldItem.png differ diff --git a/Items/Critters/PolypPanaseaGreenItem.cs b/Items/Critters/PolypPanaseaGreenItem.cs new file mode 100644 index 0000000000..f1b5fded2b --- /dev/null +++ b/Items/Critters/PolypPanaseaGreenItem.cs @@ -0,0 +1,23 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaGreenItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaGreenItem.png b/Items/Critters/PolypPanaseaGreenItem.png new file mode 100644 index 0000000000..5348095c25 Binary files /dev/null and b/Items/Critters/PolypPanaseaGreenItem.png differ diff --git a/Items/Critters/PolypPanaseaItem.cs b/Items/Critters/PolypPanaseaItem.cs new file mode 100644 index 0000000000..24baf8def9 --- /dev/null +++ b/Items/Critters/PolypPanaseaItem.cs @@ -0,0 +1,78 @@ +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Packets; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + On_Player.ItemCheck_ReleaseCritter += ReleaseColoredPanasea; + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + + // Since all Polyp Panasea variants are a single NPC type, this needs to be done in order for each item to spawn the correct color + public static void ReleaseColoredPanasea(On_Player.orig_ItemCheck_ReleaseCritter orig, Player player, Item item) + { + if (item.makeNPC == ModContent.NPCType()) + { + int mouseX = Main.mouseX + (int)Main.screenPosition.X; + int mouseY = Main.mouseY + (int)Main.screenPosition.Y; + int tileX = mouseX / 16; + int tileY = mouseY / 16; + if (!WorldGen.SolidTile(tileX, tileY)) + { + int colorType = (int)PolypPanasea.FishColor.Red; + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Green; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Turquoise; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Purple; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Radiant; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Gold; + } + player.ApplyItemTime(item); + + if (Main.netMode == NetmodeID.SinglePlayer) + { + int n = NPC.NewNPC(player.GetSource_ReleaseEntity(), mouseX, mouseY, item.makeNPC); + Main.npc[n].ai[1] = colorType; + Main.npc[n].catchItem = item.type; + Main.npc[n].releaseOwner = (short)player.whoAmI; + } + else + { + PlaceAltCritterPacket.Send(player, mouseX, mouseY, item, colorType); + } + } + } + else + { + orig(player, item); + } + } + } +} diff --git a/Items/Critters/PolypPanaseaItem.png b/Items/Critters/PolypPanaseaItem.png new file mode 100644 index 0000000000..4b961ac2e2 Binary files /dev/null and b/Items/Critters/PolypPanaseaItem.png differ diff --git a/Items/Critters/PolypPanaseaPurpleItem.cs b/Items/Critters/PolypPanaseaPurpleItem.cs new file mode 100644 index 0000000000..d348d0f10d --- /dev/null +++ b/Items/Critters/PolypPanaseaPurpleItem.cs @@ -0,0 +1,23 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaPurpleItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaPurpleItem.png b/Items/Critters/PolypPanaseaPurpleItem.png new file mode 100644 index 0000000000..9125ccacd5 Binary files /dev/null and b/Items/Critters/PolypPanaseaPurpleItem.png differ diff --git a/Items/Critters/PolypPanaseaRadiantItem.cs b/Items/Critters/PolypPanaseaRadiantItem.cs new file mode 100644 index 0000000000..452bc6696d --- /dev/null +++ b/Items/Critters/PolypPanaseaRadiantItem.cs @@ -0,0 +1,23 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaRadiantItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); // Reminder to change this :) + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaRadiantItem.png b/Items/Critters/PolypPanaseaRadiantItem.png new file mode 100644 index 0000000000..112eed64a6 Binary files /dev/null and b/Items/Critters/PolypPanaseaRadiantItem.png differ diff --git a/Items/Critters/PolypPanaseaTurquoiseItem.cs b/Items/Critters/PolypPanaseaTurquoiseItem.cs new file mode 100644 index 0000000000..4b19fb865b --- /dev/null +++ b/Items/Critters/PolypPanaseaTurquoiseItem.cs @@ -0,0 +1,23 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaTurquoiseItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaTurquoiseItem.png b/Items/Critters/PolypPanaseaTurquoiseItem.png new file mode 100644 index 0000000000..7aba44f54a Binary files /dev/null and b/Items/Critters/PolypPanaseaTurquoiseItem.png differ diff --git a/Items/Critters/RepairUnitItem.cs b/Items/Critters/RepairUnitItem.cs index 637035c1b2..ec9980cff3 100644 --- a/Items/Critters/RepairUnitItem.cs +++ b/Items/Critters/RepairUnitItem.cs @@ -16,18 +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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30, 0); - Item.makeNPC = (short)ModContent.NPCType(); + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 10); Item.rare = ModContent.RarityType(); } } diff --git a/Items/Critters/SeaMinnowGoldItem.cs b/Items/Critters/SeaMinnowGoldItem.cs new file mode 100644 index 0000000000..d0ee9d3bf7 --- /dev/null +++ b/Items/Critters/SeaMinnowGoldItem.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class SeaMinnowGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.bait = 50; + Item.value = Item.sellPrice(gold: 10); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/SeaMinnowGoldItem.png b/Items/Critters/SeaMinnowGoldItem.png new file mode 100644 index 0000000000..95f0da795b Binary files /dev/null and b/Items/Critters/SeaMinnowGoldItem.png differ diff --git a/Items/Critters/SeaMinnowItem.cs b/Items/Critters/SeaMinnowItem.cs index 03cd070d1f..0402e3cce8 100644 --- a/Items/Critters/SeaMinnowItem.cs +++ b/Items/Critters/SeaMinnowItem.cs @@ -15,19 +15,9 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - Item.width = 26; - Item.height = 24; - Item.useStyle = ItemUseStyleID.Swing; - Item.autoReuse = true; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 30, 0); + Item.DefaultToCapturedCritter(ModContent.NPCType()); Item.bait = 20; - Item.makeNPC = (short)ModContent.NPCType(); + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; } } diff --git a/Items/Critters/SeaMinnowItem.png b/Items/Critters/SeaMinnowItem.png index b016fc2245..29da187797 100644 Binary files a/Items/Critters/SeaMinnowItem.png and b/Items/Critters/SeaMinnowItem.png differ diff --git a/Items/Critters/ShroombleItem.cs b/Items/Critters/ShroombleItem.cs new file mode 100644 index 0000000000..f3489575cf --- /dev/null +++ b/Items/Critters/ShroombleItem.cs @@ -0,0 +1,22 @@ +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class ShroombleItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Critters/ShroombleItem.png b/Items/Critters/ShroombleItem.png new file mode 100644 index 0000000000..e34c2f2d46 Binary files /dev/null and b/Items/Critters/ShroombleItem.png differ diff --git a/Items/Critters/TwinklerItem.cs b/Items/Critters/TwinklerItem.cs index 67aaf2fc4c..c815407270 100644 --- a/Items/Critters/TwinklerItem.cs +++ b/Items/Critters/TwinklerItem.cs @@ -15,20 +15,9 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - Item.width = 26; - Item.height = 24; - Item.useStyle = ItemUseStyleID.Swing; - Item.autoReuse = true; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.maxStack = 9999; - Item.consumable = true; - Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 0, 40, 0); - //item.CloneDefaults(2004); //Lightning Bug item + Item.DefaultToCapturedCritter(ModContent.NPCType()); Item.bait = 40; - Item.makeNPC = (short)ModContent.NPCType(); + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; } } diff --git a/Items/DraedonMisc/AdvancedDisplay.cs b/Items/DraedonMisc/AdvancedDisplay.cs index b0b9e79122..f462de1fbb 100644 --- a/Items/DraedonMisc/AdvancedDisplay.cs +++ b/Items/DraedonMisc/AdvancedDisplay.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 52; Item.height = 52; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.rare = ItemRarityID.Yellow; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; } public override bool? UseItem(Player player) => true; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsAdvancedDisplay) diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index 65bd24df8e..fd51d616ec 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -23,10 +23,10 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 26; Item.height = 44; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.rare = ModContent.RarityType(); } @@ -48,7 +48,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsCoolingCell || codebreakerTileEntity.DecryptionCountdown > 0) @@ -69,7 +69,7 @@ namespace CalamityMod.Items.DraedonMisc AddIngredient(8). AddIngredient(8). AddIngredient(40). - AddIngredient(6). + AddIngredient(6). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(5, out Func condition), condition). AddTile(). Register(); diff --git a/Items/DraedonMisc/CodebreakerBase.cs b/Items/DraedonMisc/CodebreakerBase.cs index ed098bacda..a77fecfcd3 100644 --- a/Items/DraedonMisc/CodebreakerBase.cs +++ b/Items/DraedonMisc/CodebreakerBase.cs @@ -11,17 +11,8 @@ 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.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.rare = ItemRarityID.Green; - Item.createTile = ModContent.TileType(); } public override void AddRecipes() diff --git a/Items/DraedonMisc/DecryptionComputer.cs b/Items/DraedonMisc/DecryptionComputer.cs index 4fe0a20244..cb07ce40a7 100644 --- a/Items/DraedonMisc/DecryptionComputer.cs +++ b/Items/DraedonMisc/DecryptionComputer.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 42; Item.height = 40; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.rare = ItemRarityID.Orange; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; } public override bool? UseItem(Player player) => true; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsDecryptionComputer) diff --git a/Items/DraedonMisc/DraedonPowerCell.cs b/Items/DraedonMisc/DraedonPowerCell.cs index 5b684d3ef5..9ea84f7020 100644 --- a/Items/DraedonMisc/DraedonPowerCell.cs +++ b/Items/DraedonMisc/DraedonPowerCell.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.DraedonMisc public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; + ItemID.Sets.ExtractinatorMode[Type] = Item.type; } public override void SetDefaults() @@ -24,11 +24,11 @@ namespace CalamityMod.Items.DraedonMisc Item.width = 26; Item.height = 14; Item.rare = ModContent.RarityType(); - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.MakeUsableWithChlorophyteExtractinator(); Item.useTime = 2; - Item.value = Item.sellPrice(0, 0, 0, 20); + Item.value = Item.sellPrice(copper: 10); } public override void ExtractinatorUse(int extractinatorBlockType, ref int resultType, ref int resultStack) @@ -38,16 +38,16 @@ namespace CalamityMod.Items.DraedonMisc // 2.5% chance for Mysterious Circuitry // 2.5% chance for Dubious Plating - // 85% chance for 65-99 Copper Coins - // 10% chance for 1 Silver Coin + // 90% chance for 25-99 Copper Coins + // 5% chance for 1 Silver Coin if (dropRand < 0.025f) resultType = ModContent.ItemType(); else if (dropRand < 0.05f) resultType = ModContent.ItemType(); - else if (dropRand < 0.9f) + else if (dropRand < 0.95f) { resultType = ItemID.CopperCoin; - resultStack = Main.rand.Next(65, 100); + resultStack = Main.rand.Next(25, 100); } else resultType = ItemID.SilverCoin; diff --git a/Items/DraedonMisc/EncryptedSchematicJungle.cs b/Items/DraedonMisc/EncryptedSchematicJungle.cs index f7d3b4bb8b..a4eec184c9 100644 --- a/Items/DraedonMisc/EncryptedSchematicJungle.cs +++ b/Items/DraedonMisc/EncryptedSchematicJungle.cs @@ -5,6 +5,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.PlaceableTurrets; +using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Rarities; using CalamityMod.UI; @@ -48,6 +49,11 @@ namespace CalamityMod.Items.DraedonMisc int insertIndex = list.FindIndex(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); if (insertIndex != -1) { + int plaguebringerItem = ModContent.ItemType(); + TooltipLine aureusDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{plaguebringerItem}] {CalamityUtils.GetItemName(plaguebringerItem)}"); + aureusDisplay.OverrideColor = new Color(149, 169, 182); + list.Insert(insertIndex + 1, aureusDisplay); + int meleeItem = ModContent.ItemType(); TooltipLine meleeDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{meleeItem}] {CalamityUtils.GetItemName(meleeItem)}"); meleeDisplay.OverrideColor = new Color(149, 243, 43); diff --git a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs index eb3cc04462..d0389e89e5 100644 --- a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs +++ b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs @@ -5,6 +5,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.PlaceableTurrets; +using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Rarities; using CalamityMod.UI; @@ -48,6 +49,11 @@ namespace CalamityMod.Items.DraedonMisc int insertIndex = list.FindIndex(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); if (insertIndex != -1) { + int aureusItem = ModContent.ItemType(); + TooltipLine aureusDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{aureusItem}] {CalamityUtils.GetItemName(aureusItem)}"); + aureusDisplay.OverrideColor = new Color(149, 169, 182); + list.Insert(insertIndex + 1, aureusDisplay); + int meleeItem = ModContent.ItemType(); TooltipLine meleeDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{meleeItem}] {CalamityUtils.GetItemName(meleeItem)}"); meleeDisplay.OverrideColor = new Color(31, 242, 245); diff --git a/Items/DraedonMisc/LongRangedSensorArray.cs b/Items/DraedonMisc/LongRangedSensorArray.cs index 3f0475db85..fe32a73c5c 100644 --- a/Items/DraedonMisc/LongRangedSensorArray.cs +++ b/Items/DraedonMisc/LongRangedSensorArray.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 52; Item.height = 52; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.rare = ItemRarityID.Pink; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; } public override bool? UseItem(Player player) => true; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsSensorArray) diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs index 54508adb22..149fc0e488 100644 --- a/Items/DraedonMisc/VoltageRegulationSystem.cs +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 52; Item.height = 52; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.rare = ModContent.RarityType(); - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; } public override bool? UseItem(Player player) => true; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsVoltageRegulationSystem) diff --git a/Items/DummyTooltipItem/DummyTooltipItem.cs b/Items/DummyTooltipItem/DummyTooltipItem.cs new file mode 100644 index 0000000000..52811da4d3 --- /dev/null +++ b/Items/DummyTooltipItem/DummyTooltipItem.cs @@ -0,0 +1,23 @@ +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + /* EXPLANATION: + These items are made to facilitate tooltip reading and serve no other functions + As such these items do not have ANY features beyond their texture + */ + public abstract class DummyTooltipItem : ModItem, ILocalizedModType + { + public override LocalizedText DisplayName => LocalizedText.Empty; + public override LocalizedText Tooltip => LocalizedText.Empty; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 0; + ItemID.Sets.ItemsThatShouldNotBeInInventory[Type] = true; + } + } +} diff --git a/Items/DummyTooltipItem/GemTechArmorGems.cs b/Items/DummyTooltipItem/GemTechArmorGems.cs new file mode 100644 index 0000000000..bfde665ff8 --- /dev/null +++ b/Items/DummyTooltipItem/GemTechArmorGems.cs @@ -0,0 +1,32 @@ +namespace CalamityMod.Items +{ + public class GemTechBlueGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechBlueGem"; + } + + public class GemTechGreenGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechGreenGem"; + } + + public class GemTechPinkGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechPinkGem"; + } + + public class GemTechPurpleGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechPurpleGem"; + } + + public class GemTechRedGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechRedGem"; + } + + public class GemTechYellowGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechYellowGem"; + } +} diff --git a/Items/Dyes/AcidRainDye.cs b/Items/Dyes/AcidRainDye.cs new file mode 100644 index 0000000000..33055f6e63 --- /dev/null +++ b/Items/Dyes/AcidRainDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class AcidRainDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/AcidRainDyeShader"), "DyePass"). + UseColor(new Color(20, 117, 70)).UseSecondaryColor(new Color(208, 254, 39)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/Bark")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(silver: 20); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). + AddIngredient(). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/AcidRainDye.png b/Items/Dyes/AcidRainDye.png new file mode 100644 index 0000000000..637ecae0c4 Binary files /dev/null and b/Items/Dyes/AcidRainDye.png differ diff --git a/Items/Dyes/AerialiteDye.cs b/Items/Dyes/AerialiteDye.cs index c79e33ffbf..4f5e74492d 100644 --- a/Items/Dyes/AerialiteDye.cs +++ b/Items/Dyes/AerialiteDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Orange; - Item.value = Item.sellPrice(0, 0, 50, 0); + Item.value = Item.sellPrice(silver: 20); } public override void AddRecipes() diff --git a/Items/Dyes/AerialiteDye.png b/Items/Dyes/AerialiteDye.png index 3df26afe68..5aa915b906 100644 Binary files a/Items/Dyes/AerialiteDye.png and b/Items/Dyes/AerialiteDye.png differ diff --git a/Items/Dyes/AstralBlueDye.cs b/Items/Dyes/AstralBlueDye.cs index bbd2493650..6a96176db9 100644 --- a/Items/Dyes/AstralBlueDye.cs +++ b/Items/Dyes/AstralBlueDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Cyan; - Item.value = Item.sellPrice(0, 2, 0, 0); + Item.value = Item.sellPrice(silver: 75); } public override void AddRecipes() diff --git a/Items/Dyes/AstralDye.cs b/Items/Dyes/AstralDye.cs index d3ef186e68..05e9285039 100644 --- a/Items/Dyes/AstralDye.cs +++ b/Items/Dyes/AstralDye.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.LightRed; - Item.value = Item.sellPrice(0, 0, 65, 0); + Item.value = Item.sellPrice(silver: 20); } public override void AddRecipes() diff --git a/Items/Dyes/AstralOrangeDye.cs b/Items/Dyes/AstralOrangeDye.cs index 31a185e49c..ae734bbaf9 100644 --- a/Items/Dyes/AstralOrangeDye.cs +++ b/Items/Dyes/AstralOrangeDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Cyan; - Item.value = Item.sellPrice(0, 2, 0, 0); + Item.value = Item.sellPrice(silver: 75); } public override void AddRecipes() diff --git a/Items/Dyes/AstralSwirlDye.cs b/Items/Dyes/AstralSwirlDye.cs index a72c796fa1..4276257b75 100644 --- a/Items/Dyes/AstralSwirlDye.cs +++ b/Items/Dyes/AstralSwirlDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Cyan; - Item.value = Item.sellPrice(0, 3, 0, 0); + Item.value = Item.sellPrice(silver: 75); } public override void AddRecipes() diff --git a/Items/Dyes/AuricDye.cs b/Items/Dyes/AuricDye.cs index 0de8e802d1..f328847496 100644 --- a/Items/Dyes/AuricDye.cs +++ b/Items/Dyes/AuricDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 9, 0, 0); + Item.value = Item.sellPrice(gold: 2, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/AuricDye.png b/Items/Dyes/AuricDye.png index d729903eb7..56096cdc1b 100644 Binary files a/Items/Dyes/AuricDye.png and b/Items/Dyes/AuricDye.png differ diff --git a/Items/Dyes/BloodflareDye.cs b/Items/Dyes/BloodflareDye.cs index 3fd574d142..9e3c4e3f13 100644 --- a/Items/Dyes/BloodflareDye.cs +++ b/Items/Dyes/BloodflareDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 4, 0, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/BloodflareDye.png b/Items/Dyes/BloodflareDye.png index 53a041fc0e..1941594a4e 100644 Binary files a/Items/Dyes/BloodflareDye.png and b/Items/Dyes/BloodflareDye.png differ diff --git a/Items/Dyes/BlueCosmicFlameDye.cs b/Items/Dyes/BlueCosmicFlameDye.cs index 8dc622dd73..a322c53232 100644 --- a/Items/Dyes/BlueCosmicFlameDye.cs +++ b/Items/Dyes/BlueCosmicFlameDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/BlueCosmicFlameDye.png b/Items/Dyes/BlueCosmicFlameDye.png index c6ea46e85d..6538ca7e93 100644 Binary files a/Items/Dyes/BlueCosmicFlameDye.png and b/Items/Dyes/BlueCosmicFlameDye.png differ diff --git a/Items/Dyes/BlueStatigelDye.cs b/Items/Dyes/BlueStatigelDye.cs index 41980c70b0..7fb215af92 100644 --- a/Items/Dyes/BlueStatigelDye.cs +++ b/Items/Dyes/BlueStatigelDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.LightRed; - Item.value = Item.sellPrice(0, 0, 60, 0); + Item.value = Item.sellPrice(silver: 20); } public override void AddRecipes() diff --git a/Items/Dyes/BlueStatigelDye.png b/Items/Dyes/BlueStatigelDye.png index 289a0c3d9f..c15f7cbac7 100644 Binary files a/Items/Dyes/BlueStatigelDye.png and b/Items/Dyes/BlueStatigelDye.png differ diff --git a/Items/Dyes/BrimflameDye.cs b/Items/Dyes/BrimflameDye.cs index a73183ac1f..72e2f22529 100644 --- a/Items/Dyes/BrimflameDye.cs +++ b/Items/Dyes/BrimflameDye.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Crags; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Pink; - Item.value = Item.sellPrice(0, 0, 75, 0); + Item.value = Item.sellPrice(silver: 20); } public override void AddRecipes() diff --git a/Items/Dyes/BrimflameDye.png b/Items/Dyes/BrimflameDye.png index 43ce79a520..138ac54d46 100644 Binary files a/Items/Dyes/BrimflameDye.png and b/Items/Dyes/BrimflameDye.png differ diff --git a/Items/Dyes/CalamitousDye.cs b/Items/Dyes/CalamitousDye.cs index 7c6bdeef74..01312c1b6d 100644 --- a/Items/Dyes/CalamitousDye.cs +++ b/Items/Dyes/CalamitousDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/CalamitousDye.png b/Items/Dyes/CalamitousDye.png index 1961cf1d2b..7ef3b4597b 100644 Binary files a/Items/Dyes/CalamitousDye.png and b/Items/Dyes/CalamitousDye.png differ diff --git a/Items/Dyes/CeaselessDye.cs b/Items/Dyes/CeaselessDye.cs index 42544392b3..f8b547bf63 100644 --- a/Items/Dyes/CeaselessDye.cs +++ b/Items/Dyes/CeaselessDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 4, 0, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/CosmiliteDye.cs b/Items/Dyes/CosmiliteDye.cs index ea020175c2..c881cde6b3 100644 --- a/Items/Dyes/CosmiliteDye.cs +++ b/Items/Dyes/CosmiliteDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/CosmiliteDye.png b/Items/Dyes/CosmiliteDye.png index 6673320710..d6f168dee9 100644 Binary files a/Items/Dyes/CosmiliteDye.png and b/Items/Dyes/CosmiliteDye.png differ diff --git a/Items/Dyes/CryonicDye.cs b/Items/Dyes/CryonicDye.cs index b30a59f52d..564245000e 100644 --- a/Items/Dyes/CryonicDye.cs +++ b/Items/Dyes/CryonicDye.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Dyes { + // Despite what it may seem with its name, this dye is intended to be based on Cryogen, not the Cryonic set public class CryonicDye : BaseDye { public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/CryonicDyeShader"), "DyePass"). @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Pink; - Item.value = Item.sellPrice(0, 0, 75, 0); + Item.value = Item.sellPrice(silver: 75); } public override void AddRecipes() diff --git a/Items/Dyes/CryonicDye.png b/Items/Dyes/CryonicDye.png index 647a14f394..4be4717138 100644 Binary files a/Items/Dyes/CryonicDye.png and b/Items/Dyes/CryonicDye.png differ diff --git a/Items/Dyes/DaedalusDye.cs b/Items/Dyes/DaedalusDye.cs new file mode 100644 index 0000000000..0fa359e4b8 --- /dev/null +++ b/Items/Dyes/DaedalusDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class DaedalusDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/DaedalusDyeShader"), "DyePass"). + UseColor(new Color(59, 183, 255)).UseSecondaryColor(new Color(181, 45, 196)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/VoronoiShapes3")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Pink; + Item.value = Item.sellPrice(silver: 75); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). + AddIngredient(4). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/DaedalusDye.png b/Items/Dyes/DaedalusDye.png new file mode 100644 index 0000000000..985e016868 Binary files /dev/null and b/Items/Dyes/DaedalusDye.png differ diff --git a/Items/Dyes/DefiledFlameDye.cs b/Items/Dyes/DefiledFlameDye.cs index 1e8fe79c46..5fbdb3315d 100644 --- a/Items/Dyes/DefiledFlameDye.cs +++ b/Items/Dyes/DefiledFlameDye.cs @@ -19,8 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.LightRed; - //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; + Item.value = Item.buyPrice(gold: 7, silver: 50); // Sold by Dye Trader } } } diff --git a/Items/Dyes/DefiledFlameDye.png b/Items/Dyes/DefiledFlameDye.png index 63e9a81c0f..5dbaead872 100644 Binary files a/Items/Dyes/DefiledFlameDye.png and b/Items/Dyes/DefiledFlameDye.png differ diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index 70db1abca8..036526c584 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 8, 0, 0); + Item.value = Item.sellPrice(gold: 2, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/DragonSoulDye.png b/Items/Dyes/DragonSoulDye.png index 77ebea10cc..e361ff1284 100644 Binary files a/Items/Dyes/DragonSoulDye.png and b/Items/Dyes/DragonSoulDye.png differ diff --git a/Items/Dyes/ElementalDye.cs b/Items/Dyes/ElementalDye.cs index 6bd1a311a2..6940ca7fb3 100644 --- a/Items/Dyes/ElementalDye.cs +++ b/Items/Dyes/ElementalDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Purple; - Item.value = Item.sellPrice(0, 2, 50, 0); + Item.value = Item.sellPrice(gold: 2, silver: 50); } public override void AddRecipes() @@ -27,9 +27,9 @@ namespace CalamityMod.Items.Dyes CreateRecipe(5). AddIngredient(ItemID.SolarDye). AddIngredient(ItemID.VortexDye). - AddIngredient(ItemID.StardustDye). AddIngredient(ItemID.NebulaDye). - AddIngredient(). + AddIngredient(ItemID.StardustDye). + AddIngredient(). AddTile(TileID.DyeVat). Register(); } diff --git a/Items/Dyes/ElementalDye.png b/Items/Dyes/ElementalDye.png index d61388d486..a4e31aaff1 100644 Binary files a/Items/Dyes/ElementalDye.png and b/Items/Dyes/ElementalDye.png differ diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index 2209ece7a6..169a151228 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/EndothermicDye.png b/Items/Dyes/EndothermicDye.png index 61fba15d64..ae07821900 100644 Binary files a/Items/Dyes/EndothermicDye.png and b/Items/Dyes/EndothermicDye.png differ diff --git a/Items/Dyes/ExoDye.cs b/Items/Dyes/ExoDye.cs index 6c6c61cbce..ec2b61ece3 100644 --- a/Items/Dyes/ExoDye.cs +++ b/Items/Dyes/ExoDye.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/HairDye/AdrenalineHairDye.cs b/Items/Dyes/HairDye/AdrenalineHairDye.cs index 1d397f75dc..3e4b4da9c3 100644 --- a/Items/Dyes/HairDye/AdrenalineHairDye.cs +++ b/Items/Dyes/HairDye/AdrenalineHairDye.cs @@ -1,4 +1,7 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Dyes; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -7,19 +10,35 @@ namespace CalamityMod.Items.Dyes.HairDye public class AdrenalineHairDye : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Dyes"; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GameShaders.Hair.BindShader(Type, new LegacyHairShaderData().UseLegacyMethod(UpdateHairDye)); + } + } + + private static Color UpdateHairDye(Player player, Color newColor, ref bool lighting) + { + var calPlayer = player.Calamity(); + var adrenalineP = calPlayer.adrenaline / calPlayer.adrenalineMax; + return Color.Lerp(player.hairColor, new Color(0, 255, 171), adrenalineP); + } + public override void SetDefaults() { Item.width = 20; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.buyPrice(gold: 7, silver: 50); - Item.rare = ItemRarityID.Green; + Item.useAnimation = Item.useTime = 17; Item.UseSound = SoundID.Item3; Item.useStyle = ItemUseStyleID.DrinkLiquid; Item.useTurn = true; - Item.useAnimation = 17; - Item.useTime = 17; Item.consumable = true; + Item.maxStack = Item.CommonMaxStack; + + Item.value = Item.buyPrice(gold: 7, silver: 50); // Sold by Stylist + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Dyes/HairDye/AdrenalineHairDye.png b/Items/Dyes/HairDye/AdrenalineHairDye.png index e87f8d06d8..2bf7418283 100644 Binary files a/Items/Dyes/HairDye/AdrenalineHairDye.png and b/Items/Dyes/HairDye/AdrenalineHairDye.png differ diff --git a/Items/Dyes/HairDye/RageHairDye.cs b/Items/Dyes/HairDye/RageHairDye.cs index c3a7b838ec..54df4cc38b 100644 --- a/Items/Dyes/HairDye/RageHairDye.cs +++ b/Items/Dyes/HairDye/RageHairDye.cs @@ -1,4 +1,7 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Dyes; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -7,19 +10,35 @@ namespace CalamityMod.Items.Dyes.HairDye public class RageHairDye : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Dyes"; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GameShaders.Hair.BindShader(Type, new LegacyHairShaderData().UseLegacyMethod(UpdateHairDye)); + } + } + + private static Color UpdateHairDye(Player player, Color newColor, ref bool lighting) + { + var calPlayer = player.Calamity(); + var rageP = calPlayer.rage / calPlayer.rageMax; + return Color.Lerp(player.hairColor, new Color(255, 83, 48), rageP); + } + public override void SetDefaults() { Item.width = 20; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.buyPrice(gold: 7, silver: 50); - Item.rare = ItemRarityID.Green; + Item.useAnimation = Item.useTime = 17; Item.UseSound = SoundID.Item3; Item.useStyle = ItemUseStyleID.DrinkLiquid; Item.useTurn = true; - Item.useAnimation = 17; - Item.useTime = 17; Item.consumable = true; + Item.maxStack = Item.CommonMaxStack; + + Item.value = Item.buyPrice(gold: 7, silver: 50); // Sold by Stylist + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Dyes/HairDye/RageHairDye.png b/Items/Dyes/HairDye/RageHairDye.png index 2fcb2c74ed..5a86df9d27 100644 Binary files a/Items/Dyes/HairDye/RageHairDye.png and b/Items/Dyes/HairDye/RageHairDye.png differ diff --git a/Items/Dyes/HairDye/StealthHairDye.cs b/Items/Dyes/HairDye/StealthHairDye.cs index ca4cf6f913..713228be00 100644 --- a/Items/Dyes/HairDye/StealthHairDye.cs +++ b/Items/Dyes/HairDye/StealthHairDye.cs @@ -1,4 +1,7 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Dyes; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -7,19 +10,38 @@ namespace CalamityMod.Items.Dyes.HairDye public class StealthHairDye : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Dyes"; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GameShaders.Hair.BindShader(Type, new LegacyHairShaderData().UseLegacyMethod(UpdateHairDye)); + } + } + + private static Color UpdateHairDye(Player player, Color newColor, ref bool lighting) + { + float stealthP = player.Calamity().rogueStealth / player.Calamity().rogueStealthMax; + + if (float.IsInfinity(stealthP) || float.IsNaN(stealthP)) + stealthP = 0f; + + return Color.Lerp(player.hairColor, new Color(186, 85, 211), stealthP); + } + public override void SetDefaults() { Item.width = 20; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.buyPrice(gold: 5); - Item.rare = ItemRarityID.Green; + Item.useAnimation = Item.useTime = 17; Item.UseSound = SoundID.Item3; Item.useStyle = ItemUseStyleID.DrinkLiquid; Item.useTurn = true; - Item.useAnimation = 17; - Item.useTime = 17; Item.consumable = true; + Item.maxStack = Item.CommonMaxStack; + + Item.value = Item.buyPrice(gold: 5); // Sold by Stylist + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Dyes/HairDye/StealthHairDye.png b/Items/Dyes/HairDye/StealthHairDye.png index 1b30eaa8c3..52e2ce07a5 100644 Binary files a/Items/Dyes/HairDye/StealthHairDye.png and b/Items/Dyes/HairDye/StealthHairDye.png differ diff --git a/Items/Dyes/HairDye/WingTimeHairDye.cs b/Items/Dyes/HairDye/WingTimeHairDye.cs index fad7a3dc10..272b2b41f0 100644 --- a/Items/Dyes/HairDye/WingTimeHairDye.cs +++ b/Items/Dyes/HairDye/WingTimeHairDye.cs @@ -1,4 +1,7 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Dyes; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -7,19 +10,38 @@ namespace CalamityMod.Items.Dyes.HairDye public class WingTimeHairDye : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Dyes"; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GameShaders.Hair.BindShader(Type, new LegacyHairShaderData().UseLegacyMethod(UpdateHairDye)); + } + } + + private static Color UpdateHairDye(Player player, Color newColor, ref bool lighting) + { + float wingP = player.wingTime / player.wingTimeMax; + + if (player.mount.Active) wingP = 1f; + else if (float.IsInfinity(wingP) || float.IsNaN(wingP)) wingP = 0f; + + return Color.Lerp(player.hairColor, new Color(139, 205, 255), wingP); + } + public override void SetDefaults() { Item.width = 20; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.buyPrice(gold: 7, silver: 50); - Item.rare = ItemRarityID.Green; + Item.useAnimation = Item.useTime = 17; Item.UseSound = SoundID.Item3; Item.useStyle = ItemUseStyleID.DrinkLiquid; Item.useTurn = true; - Item.useAnimation = 17; - Item.useTime = 17; Item.consumable = true; + Item.maxStack = Item.CommonMaxStack; + + Item.value = Item.buyPrice(gold: 7, silver: 50); // Sold by Stylist + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Dyes/HairDye/WingTimeHairDye.png b/Items/Dyes/HairDye/WingTimeHairDye.png index 9e5c94f4fa..ebbe6194b9 100644 Binary files a/Items/Dyes/HairDye/WingTimeHairDye.png and b/Items/Dyes/HairDye/WingTimeHairDye.png differ diff --git a/Items/Dyes/LivingShardDye.cs b/Items/Dyes/LivingShardDye.cs new file mode 100644 index 0000000000..45ec13a2be --- /dev/null +++ b/Items/Dyes/LivingShardDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class LivingShardDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/LivingShardDyeShader"), "DyePass"). + UseColor(new Color(118, 230, 29)).UseSecondaryColor(new Color(102, 209, 255)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/OrnatePattern")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Lime; + Item.value = Item.sellPrice(silver: 75); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). + AddIngredient(). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/LivingShardDye.png b/Items/Dyes/LivingShardDye.png new file mode 100644 index 0000000000..7ab0b09d33 Binary files /dev/null and b/Items/Dyes/LivingShardDye.png differ diff --git a/Items/Dyes/MeldDye.cs b/Items/Dyes/MeldDye.cs new file mode 100644 index 0000000000..20c714dcef --- /dev/null +++ b/Items/Dyes/MeldDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class MeldDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/MeldDyeShader"), "DyePass"). + UseColor(new Color(28, 135, 84)).UseSecondaryColor(new Color(52, 235, 149)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/Veins")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Cyan; + Item.value = Item.sellPrice(gold: 2, silver: 50); + } + + public override void AddRecipes() + { + // Vanilla frag dye amount + CreateRecipe(1). + AddIngredient(ItemID.BottledWater, 1). + AddIngredient(10). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/MeldDye.png b/Items/Dyes/MeldDye.png new file mode 100644 index 0000000000..0c5e646489 Binary files /dev/null and b/Items/Dyes/MeldDye.png differ diff --git a/Items/Dyes/NecromanticDye.cs b/Items/Dyes/NecromanticDye.cs new file mode 100644 index 0000000000..0d9dcd5c13 --- /dev/null +++ b/Items/Dyes/NecromanticDye.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.TreasureBags.MiscGrabBags; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class NecromanticDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/NecromanticDyeShader"), "DyePass"). + UseColor(new Color(71, 23, 26)).UseSecondaryColor(new Color(10, 198, 255)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/SharpNoise")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Yellow; + Item.value = Item.sellPrice(gold: 1, silver: 50); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). + AddIngredient(). + AddTile(TileID.DyeVat). + Register(); + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). + AddIngredient(). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/NecromanticDye.png b/Items/Dyes/NecromanticDye.png new file mode 100644 index 0000000000..25982f05cd Binary files /dev/null and b/Items/Dyes/NecromanticDye.png differ diff --git a/Items/Dyes/NecroplasmicDye.cs b/Items/Dyes/NecroplasmicDye.cs index 8c9c1dd00d..a96be1ce35 100644 --- a/Items/Dyes/NecroplasmicDye.cs +++ b/Items/Dyes/NecroplasmicDye.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Purple; - Item.value = Item.sellPrice(0, 2, 50, 0); + Item.value = Item.sellPrice(silver: 75); } public override void AddRecipes() diff --git a/Items/Dyes/NecroplasmicDye.png b/Items/Dyes/NecroplasmicDye.png index 36fa74f0bc..e2efdf713a 100644 Binary files a/Items/Dyes/NecroplasmicDye.png and b/Items/Dyes/NecroplasmicDye.png differ diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index 0363f95a00..7687519061 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/NightmareDye.png b/Items/Dyes/NightmareDye.png index d88a94f652..52b36dbe75 100644 Binary files a/Items/Dyes/NightmareDye.png and b/Items/Dyes/NightmareDye.png differ diff --git a/Items/Dyes/PinkCosmicFlameDye.cs b/Items/Dyes/PinkCosmicFlameDye.cs index 91fefe5734..0c89581f22 100644 --- a/Items/Dyes/PinkCosmicFlameDye.cs +++ b/Items/Dyes/PinkCosmicFlameDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/PinkCosmicFlameDye.png b/Items/Dyes/PinkCosmicFlameDye.png index e4445940ba..d015bb91cf 100644 Binary files a/Items/Dyes/PinkCosmicFlameDye.png and b/Items/Dyes/PinkCosmicFlameDye.png differ diff --git a/Items/Dyes/PinkStatigelDye.cs b/Items/Dyes/PinkStatigelDye.cs index 85581e23fc..c7e54b0dc1 100644 --- a/Items/Dyes/PinkStatigelDye.cs +++ b/Items/Dyes/PinkStatigelDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.LightRed; - Item.value = Item.sellPrice(0, 0, 60, 0); + Item.value = Item.sellPrice(silver: 20); } public override void AddRecipes() diff --git a/Items/Dyes/PinkStatigelDye.png b/Items/Dyes/PinkStatigelDye.png index 8c4aabc2c4..7466fcf275 100644 Binary files a/Items/Dyes/PinkStatigelDye.png and b/Items/Dyes/PinkStatigelDye.png differ diff --git a/Items/Dyes/PlagueGooDye.cs b/Items/Dyes/PlagueGooDye.cs new file mode 100644 index 0000000000..b7faf81f87 --- /dev/null +++ b/Items/Dyes/PlagueGooDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.TreasureBags.MiscGrabBags; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class PlagueGooDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/PlagueGooDyeShader"), "DyePass"). + UseColor(new Color(26, 288, 0)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Yellow; + Item.value = Item.sellPrice(silver: 75); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). + AddIngredient(). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/PlagueGooDye.png b/Items/Dyes/PlagueGooDye.png new file mode 100644 index 0000000000..375bc25518 Binary files /dev/null and b/Items/Dyes/PlagueGooDye.png differ diff --git a/Items/Dyes/PlaguePlateDye.cs b/Items/Dyes/PlaguePlateDye.cs new file mode 100644 index 0000000000..c1737cb01a --- /dev/null +++ b/Items/Dyes/PlaguePlateDye.cs @@ -0,0 +1,35 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class PlaguePlateDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/PlaguePlateDyeShader"), "DyePass"). + UseColor(new Color(0, 54, 25)).UseSecondaryColor(new Color(0, 38, 18)); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Cyan; + Item.value = Item.sellPrice(silver: 75); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). + AddIngredient(). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/PlaguePlateDye.png b/Items/Dyes/PlaguePlateDye.png new file mode 100644 index 0000000000..9802bdcb8a Binary files /dev/null and b/Items/Dyes/PlaguePlateDye.png differ diff --git a/Items/Dyes/ProfanedCrystalDye.cs b/Items/Dyes/ProfanedCrystalDye.cs new file mode 100644 index 0000000000..2febd2a736 --- /dev/null +++ b/Items/Dyes/ProfanedCrystalDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureProfaned; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class ProfanedCrystalDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/ProfanedCrystalDyeShader"), "DyePass"). + UseColor(new Color(255, 0, 89)); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(gold: 1, silver: 50); + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). + AddIngredient(15). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/ProfanedCrystalDye.png b/Items/Dyes/ProfanedCrystalDye.png new file mode 100644 index 0000000000..30c5bd9599 Binary files /dev/null and b/Items/Dyes/ProfanedCrystalDye.png differ diff --git a/Items/Dyes/ProfanedFlameDye.cs b/Items/Dyes/ProfanedFlameDye.cs index cbb8be5523..21e4860381 100644 --- a/Items/Dyes/ProfanedFlameDye.cs +++ b/Items/Dyes/ProfanedFlameDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Purple; - Item.value = Item.sellPrice(0, 2, 50, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/ProfanedFlameDye.png b/Items/Dyes/ProfanedFlameDye.png index 38072bf705..8c214069ed 100644 Binary files a/Items/Dyes/ProfanedFlameDye.png and b/Items/Dyes/ProfanedFlameDye.png differ diff --git a/Items/Dyes/ProfanedMoonlightDye.cs b/Items/Dyes/ProfanedMoonlightDye.cs index 3292d085fa..b8c22da571 100644 --- a/Items/Dyes/ProfanedMoonlightDye.cs +++ b/Items/Dyes/ProfanedMoonlightDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } } } diff --git a/Items/Dyes/ProfanedMoonlightDye.png b/Items/Dyes/ProfanedMoonlightDye.png index 3171dd37c0..2dabd23123 100644 Binary files a/Items/Dyes/ProfanedMoonlightDye.png and b/Items/Dyes/ProfanedMoonlightDye.png differ diff --git a/Items/Dyes/ProfanedRockDye.cs b/Items/Dyes/ProfanedRockDye.cs new file mode 100644 index 0000000000..d64f6ccb4e --- /dev/null +++ b/Items/Dyes/ProfanedRockDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.FurnitureProfaned; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class ProfanedRockDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/ProfanedRockDyeShader"), "DyePass"). + UseColor(new Color(79, 16, 16)).UseSecondaryColor(new Color(173, 116, 0)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/Veins")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(gold: 1, silver: 50); + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). + AddIngredient(15). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/ProfanedRockDye.png b/Items/Dyes/ProfanedRockDye.png new file mode 100644 index 0000000000..92c47985d0 Binary files /dev/null and b/Items/Dyes/ProfanedRockDye.png differ diff --git a/Items/Dyes/ReaverDye.cs b/Items/Dyes/ReaverDye.cs index 1c6cebc090..79c887818b 100644 --- a/Items/Dyes/ReaverDye.cs +++ b/Items/Dyes/ReaverDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.Lime; - Item.value = Item.sellPrice(0, 1, 0, 0); + Item.value = Item.sellPrice(silver: 75); } public override void AddRecipes() diff --git a/Items/Dyes/ReaverDye.png b/Items/Dyes/ReaverDye.png index e609ce29a7..809cb19e40 100644 Binary files a/Items/Dyes/ReaverDye.png and b/Items/Dyes/ReaverDye.png differ diff --git a/Items/Dyes/ScoriaDye.cs b/Items/Dyes/ScoriaDye.cs new file mode 100644 index 0000000000..4059c25a39 --- /dev/null +++ b/Items/Dyes/ScoriaDye.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.TreasureBags.MiscGrabBags; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class ScoriaDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/ScoriaDyeShader"), "DyePass"). + UseColor(new Color(76, 77, 86)).UseSecondaryColor(new Color(224, 108, 29)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/Veins")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Yellow; + Item.value = Item.sellPrice(silver: 75); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). + AddIngredient(4). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/ScoriaDye.png b/Items/Dyes/ScoriaDye.png new file mode 100644 index 0000000000..c88fd05ced Binary files /dev/null and b/Items/Dyes/ScoriaDye.png differ diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs index f0986a270d..9b91514cae 100644 --- a/Items/Dyes/ShadowspecDye.cs +++ b/Items/Dyes/ShadowspecDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/ShadowspecDye.png b/Items/Dyes/ShadowspecDye.png index 02114213e6..e2665b83f9 100644 Binary files a/Items/Dyes/ShadowspecDye.png and b/Items/Dyes/ShadowspecDye.png differ diff --git a/Items/Dyes/SilvaDye.cs b/Items/Dyes/SilvaDye.cs new file mode 100644 index 0000000000..acf21b7865 --- /dev/null +++ b/Items/Dyes/SilvaDye.cs @@ -0,0 +1,35 @@ +using CalamityMod.Items.Placeables.FurnitureSilva; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class SilvaDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/SilvaDyeShader"), "DyePass"). + UseColor(new Color(103, 206, 103)).UseSecondaryColor(new Color(255, 255, 158)); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(gold: 1, silver: 50); + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). + AddIngredient(15). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/SilvaDye.png b/Items/Dyes/SilvaDye.png new file mode 100644 index 0000000000..25d1050efd Binary files /dev/null and b/Items/Dyes/SilvaDye.png differ diff --git a/Items/Dyes/SlimeGodDye.cs b/Items/Dyes/SlimeGodDye.cs index 787ee03fa9..572c7d40f5 100644 --- a/Items/Dyes/SlimeGodDye.cs +++ b/Items/Dyes/SlimeGodDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.LightRed; - Item.value = Item.sellPrice(0, 0, 65, 0); + Item.value = Item.sellPrice(silver: 20); } public override void AddRecipes() diff --git a/Items/Dyes/SlimeGodDye.png b/Items/Dyes/SlimeGodDye.png index 6f01d99104..523a1c7991 100644 Binary files a/Items/Dyes/SlimeGodDye.png and b/Items/Dyes/SlimeGodDye.png differ diff --git a/Items/Dyes/StratusDye.cs b/Items/Dyes/StratusDye.cs index e1eb845d40..788bcdcf42 100644 --- a/Items/Dyes/StratusDye.cs +++ b/Items/Dyes/StratusDye.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 4, 50, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/SwirlingCosmicFlameDye.cs b/Items/Dyes/SwirlingCosmicFlameDye.cs index 73493fadce..1fcab18fea 100644 --- a/Items/Dyes/SwirlingCosmicFlameDye.cs +++ b/Items/Dyes/SwirlingCosmicFlameDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(0, 7, 50, 0); + Item.value = Item.sellPrice(gold: 1, silver: 50); } public override void AddRecipes() diff --git a/Items/Dyes/SwirlingCosmicFlameDye.png b/Items/Dyes/SwirlingCosmicFlameDye.png index 43ab1b6f2b..1e056a89c1 100644 Binary files a/Items/Dyes/SwirlingCosmicFlameDye.png and b/Items/Dyes/SwirlingCosmicFlameDye.png differ diff --git a/Items/Dyes/TarragonDye.cs b/Items/Dyes/TarragonDye.cs new file mode 100644 index 0000000000..a5384efa72 --- /dev/null +++ b/Items/Dyes/TarragonDye.cs @@ -0,0 +1,35 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.TreasureBags.MiscGrabBags; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class TarragonDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/TarragonDyeShader"), "DyePass"). + UseColor(new Color(20, 117, 70)).UseSecondaryColor(new Color(28, 255, 55)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/Bark")); + + public override void SafeSetDefaults() + { + Item.rare = RarityType(); + Item.value = Item.sellPrice(gold: 1, silver: 50); + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). + AddIngredient(4). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/TarragonDye.png b/Items/Dyes/TarragonDye.png new file mode 100644 index 0000000000..68fc2a4baa Binary files /dev/null and b/Items/Dyes/TarragonDye.png differ diff --git a/Items/Dyes/WulfrumDye.cs b/Items/Dyes/WulfrumDye.cs new file mode 100644 index 0000000000..e5c0125349 --- /dev/null +++ b/Items/Dyes/WulfrumDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Dyes +{ + public class WulfrumDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/WulfrumDyeShader"), "DyePass"). + UseColor(new Color(89, 247, 166)).UseSecondaryColor(new Color(102, 242, 255)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/TechyNoise")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 20); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). + AddIngredient(). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Dyes/WulfrumDye.png b/Items/Dyes/WulfrumDye.png new file mode 100644 index 0000000000..27b3330dc2 Binary files /dev/null and b/Items/Dyes/WulfrumDye.png differ diff --git a/Items/ExhumedItem.cs b/Items/ExhumedItem.cs new file mode 100644 index 0000000000..219f77519d --- /dev/null +++ b/Items/ExhumedItem.cs @@ -0,0 +1,20 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + // Note the lack of ILocalizedModType. + // Unfortunately, since all exhumed items do not use the same localization category, ILocalizedModType must be placed on each individual item file. + public abstract class ExhumedItem : ModItem, IHoldShiftTooltipItem + { + // All exhumed items use the same extension indicator tooltip. + // This is given a null color, as it is colored manually. + public string ExtensionIndicatorKey => "Items.Misc.ExhumeShortTooltip"; + public Color? ExtensionIndicatorColor => null; + + // All full flavor tooltips use the same localization key. + // All full tooltips also use the same color: #C61B40. This is the standard tooltip color for Calamitas text. + public string TooltipExtensionKey => "Calamitas"; + public Color? TooltipExtensionColor => new(198, 27, 64); + } +} diff --git a/Items/Fishing/AstralCatches/AldebaranAlewife.cs b/Items/Fishing/AstralCatches/AldebaranAlewife.cs index 2573a20c7f..b5a6c1ced0 100644 --- a/Items/Fishing/AstralCatches/AldebaranAlewife.cs +++ b/Items/Fishing/AstralCatches/AldebaranAlewife.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 38; Item.height = 36; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 8); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 15); Item.rare = ItemRarityID.Blue; } diff --git a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs index 6149190827..c5cc212ccd 100644 --- a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs +++ b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.AstralCatches @@ -7,17 +8,21 @@ namespace CalamityMod.Items.Fishing.AstralCatches public class ArcturusAstroidean : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; + + public static float FishingPowerBiomeMult = 1.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FishingPowerBiomeMult.ToString()); + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 20; Item.height = 20; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Orange; Item.bait = 40; diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index 690c4c8e8b..75ca58ba4b 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -1,16 +1,6 @@ -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Items.Potions; -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.Materials; using CalamityMod.Tiles.Astral; using Terraria; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -29,18 +19,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; 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; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -51,48 +33,14 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var postAstrumAureus = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumAureus); - var postAstrumDeus = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumDeus); + // 4-10 Starblight Soot @ 50% + // This is our equivalent to Crystal Shards/Ichor + itemLoot.Add(ModContent.ItemType(), 2, 4, 10); - // Materials - 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); + // Astrophage @ 5% + itemLoot.Add(ModContent.ItemType(), 20); - postAstrumAureus.Add(ModContent.ItemType(), 5, 2, 5); - postAstrumDeus.Add(ModContent.ItemType(), 5, 10, 20); - postAstrumDeus.Add(ModContent.ItemType(), 10, 1, 3); - postAstrumDeus.Add(ModContent.ItemType(), 4, 5, 10); - - // Weapons (and Starburster Core) - postAstrumAureus.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - - // 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 - postAstrumAureus.Add(ModContent.ItemType(), 10, 1, 3); - postAstrumAureus.Add(ModContent.ItemType(), 10, 1, 3); - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/AstralCatches/AstrophageItem.cs b/Items/Fishing/AstralCatches/AstrophageItem.cs index 1a7324cb64..b82bd0d229 100644 --- a/Items/Fishing/AstralCatches/AstrophageItem.cs +++ b/Items/Fishing/AstralCatches/AstrophageItem.cs @@ -12,9 +12,8 @@ namespace CalamityMod.Items.Fishing.AstralCatches public new string LocalizationCategory => "Items.Fishing"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.ZephyrFish); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 3); // Equal to Zephyr Fish Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Fishing/AstralCatches/MonolithCrate.cs b/Items/Fishing/AstralCatches/MonolithCrate.cs index 060d03675b..736bd5ba2e 100644 --- a/Items/Fishing/AstralCatches/MonolithCrate.cs +++ b/Items/Fishing/AstralCatches/MonolithCrate.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.Astral; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,18 +16,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; 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; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -39,27 +30,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches 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); + // Astrophage @ 5% + itemLoot.Add(ModContent.ItemType(), 20); - // 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); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs index c560f5dba4..fa077f7b52 100644 --- a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs +++ b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 30; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 5); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 15); Item.rare = ItemRarityID.Blue; } diff --git a/Items/Fishing/AstralCatches/TwinklingPollox.cs b/Items/Fishing/AstralCatches/TwinklingPollox.cs index 5f77a94a91..4296052d0b 100644 --- a/Items/Fishing/AstralCatches/TwinklingPollox.cs +++ b/Items/Fishing/AstralCatches/TwinklingPollox.cs @@ -10,14 +10,14 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 32; Item.height = 28; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Blue; } diff --git a/Items/Fishing/AstralCatches/UrsaSergeant.cs b/Items/Fishing/AstralCatches/UrsaSergeant.cs index 592ca72692..343875047f 100644 --- a/Items/Fishing/AstralCatches/UrsaSergeant.cs +++ b/Items/Fishing/AstralCatches/UrsaSergeant.cs @@ -9,6 +9,11 @@ namespace CalamityMod.Items.Fishing.AstralCatches public class UrsaSergeant : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; + + public static int CooldownReducedPerKill = 180; + public static int MaxCooldown = 300; + public static int BaseSwipeDamage = 200; + public override void SetDefaults() { Item.width = 36; diff --git a/Items/Fishing/BaseQuestFish.cs b/Items/Fishing/BaseQuestFish.cs index 7e92e4d06e..c2131da27a 100644 --- a/Items/Fishing/BaseQuestFish.cs +++ b/Items/Fishing/BaseQuestFish.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { Item.ResearchUnlockCount = 2; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() diff --git a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs index b57a6a2576..9f73c7efe0 100644 --- a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs +++ b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches @@ -9,35 +10,37 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public class Bloodfin : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; + + public static int RegenBoost = 5; + public static int RegenTimeBoost = 10; + + public static int DebuffedRegenBoost = 10; // Does not stack with above + public static int DebuffedRegenTimeFloor = 1800; + + public static double ExtraRegenHealthThreshold = 0.75D; + public static int FramesForExtraRegen = 30; + public static int BuffType = ModContent.BuffType(); - public static int BuffDuration = 600; + public static int BuffDuration = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), DebuffedRegenBoost.ToRegenPerSecond(), FramesForExtraRegen.FramesToSeconds(), ExtraRegenHealthThreshold.ToPercent(), BuffDuration); public override void SetStaticDefaults() { Item.ResearchUnlockCount = 30; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { - Item.width = 44; - Item.height = 36; - Item.maxStack = 9999; - Item.useTurn = true; + Item.DefaultToHealingPotion(38, 36, 240); + Item.useStyle = ItemUseStyleID.EatFood; Item.value = Item.sellPrice(gold: 5); Item.rare = ModContent.RarityType(); - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.EatFood; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.healLife = 240; - Item.potion = true; } public override void OnConsumeItem(Player player) { - player.AddBuff(BuffType, BuffDuration); + player.AddBuff(BuffType, CalamityUtils.SecondsToFrames(BuffDuration)); } } } diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 6a0413d264..3542661795 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Potions; -using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Crags; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +20,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { Item.width = 32; Item.height = 32; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Green; Item.value = Item.sellPrice(gold: 1); @@ -42,28 +40,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches 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); - itemLoot.AddIf(() => DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType(), 10, 1, 3); - itemLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType(), 2, 1, 3); - - // 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(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs index db8bc64626..054e145481 100644 --- a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs +++ b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs @@ -10,14 +10,14 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 44; Item.height = 36; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 10); Item.rare = ItemRarityID.Orange; } diff --git a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs index 8d29188f52..48e090ae7c 100644 --- a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 30; Item.height = 28; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 8); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 15); Item.rare = ItemRarityID.Blue; } diff --git a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs index ee7ec5f6cf..72a0fe899f 100644 --- a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs +++ b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 32; Item.height = 36; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 5); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 7, copper: 50); Item.rare = ItemRarityID.Blue; } diff --git a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs index 892b507f4e..654bed6a46 100644 --- a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs +++ b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs @@ -19,8 +19,8 @@ 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 + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + Item.staff[Type] = true; //so it doesn't look weird af when holding it } public override void SetDefaults() @@ -40,62 +40,50 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; - Item.useAmmo = AmmoID.Gel; // for GFB } public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override bool CanUseItem(Player player) { - if (!Main.zenithWorld) - { - return true; - } if (player.altFunctionUse == 2) { - if (Main.zenithWorld) - { - CalamityGlobalItem.HasEnoughAmmo(player, Item, 5); - return true; - } - else + if (!Main.zenithWorld || player.Calamity().dragoonDrizzlefishGelBoost >= 6) return false; + + Item gelFodder = new Item(); + gelFodder.useAmmo = AmmoID.Gel; + return player.HasAmmo(gelFodder); } - else - return true; + return true; } public override Vector2? HoldoutOrigin() => new Vector2(7, 7); public override bool AltFunctionUse(Player player) => Main.zenithWorld ? true : false; - public override bool CanConsumeAmmo(Item ammo, Player player) - { - if (Main.zenithWorld && player.altFunctionUse == 2 && player.Calamity().dragoonDrizzlefishGelBoost < 6) - return true; - else - return false; - } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (Main.zenithWorld && player.altFunctionUse == 2) + if (player.altFunctionUse == 2) { //GFB stuff - if (player.Calamity().dragoonDrizzlefishGelBoost < 6) - { - player.Calamity().dragoonDrizzlefishGelBoost++; - SoundStyle roar = Sunskater.DeathSound; - SoundEngine.PlaySound(roar with { Pitch = 0.3f }, player.Center); - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 0.3f }, player.Center); - CombatText.NewText(player.Hitbox, Color.OrangeRed, ":)"); - for (int i = 0; i <= 11; i++) - { - Vector2 hVelocity = Main.rand.NextVector2Unit(); - hVelocity.X *= 0.66f; - hVelocity *= Main.rand.NextFloat(1f, 2f); + Item gelFodder = new Item(); + gelFodder.useAmmo = AmmoID.Gel; + player.PickAmmo(gelFodder, out _, out _, out _, out _, out _); - int heart = Gore.NewGore(player.GetSource_FromThis(), player.Center + Main.rand.NextVector2Circular(14, 14), 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.7f; - } + player.Calamity().dragoonDrizzlefishGelBoost++; + SoundEngine.PlaySound(Sunskater.DeathSound with { Pitch = 0.3f }, player.Center); + SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 0.3f }, player.Center); + CombatText.NewText(player.Hitbox, Color.OrangeRed, ":)"); + for (int i = 0; i <= 11; i++) + { + Vector2 hVelocity = Main.rand.NextVector2Unit(); + hVelocity.X *= 0.66f; + hVelocity *= Main.rand.NextFloat(1f, 2f); + + int heart = Gore.NewGore(player.GetSource_FromThis(), player.Center + Main.rand.NextVector2Circular(14, 14), 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.7f; } } else diff --git a/Items/Fishing/BrimstoneCragCatches/Havocfish.cs b/Items/Fishing/BrimstoneCragCatches/Havocfish.cs index 59f5b99abf..fd0a4060a8 100644 --- a/Items/Fishing/BrimstoneCragCatches/Havocfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Havocfish.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 30; Item.height = 28; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; diff --git a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs index 29fc9f4a47..2b4324a103 100644 --- a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 28; Item.height = 28; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 8); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 15); Item.rare = ItemRarityID.Blue; } diff --git a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs index 55ff0e63e7..ea62747e86 100644 --- a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Crags; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,18 +16,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; 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; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -39,26 +30,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches 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); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs b/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs index 1f8414e6a1..ebaf14081a 100644 --- a/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs @@ -8,5 +8,12 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { public override bool QuestCondition => NPC.downedBoss3; public override LocalizedText Location => CalamityUtils.GetText("Items.Fishing.CaughtInBrimstoneCrag"); + + // Must override this since the dialogue uses the player's name + public override void AnglerQuestChat(ref string description, ref string catchLocation) + { + description = this.GetLocalization("QuestDescription").Format(Main.LocalPlayer.name); + catchLocation = Location.ToString().Replace("'", string.Empty); + } } } diff --git a/Items/Fishing/EnchantedStarfish.cs b/Items/Fishing/EnchantedStarfish.cs index 1509210a2b..f34ae22667 100644 --- a/Items/Fishing/EnchantedStarfish.cs +++ b/Items/Fishing/EnchantedStarfish.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) ItemID.Sets.SortingPriorityBossSpawns[Type] = 21; // Mana Crystal ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ArcaneCrystal; @@ -21,15 +21,16 @@ namespace CalamityMod.Items.Fishing { Item.width = 30; Item.height = 26; - Item.rare = ItemRarityID.Green; Item.useAnimation = 30; Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.Item29; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 50); + Item.maxStack = Item.CommonMaxStack; Item.autoReuse = true; Item.consumable = true; + + Item.value = Item.sellPrice(silver: 25); + Item.rare = ItemRarityID.Green; } public override bool? UseItem(Player player) diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index 2c536a12f5..fa92d6cf33 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -27,6 +27,11 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.rare = ModContent.RarityType(); } + public override void HoldItem(Player player) + { + player.accFishingLine = 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 < 6; i++) diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index be764e8289..d7be7cc7ba 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.FishingRods @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Fishing.FishingRods public class HeronRod : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; + + public static float FishingPowerBiomeMult = 1.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FishingPowerBiomeMult.ToString()); + public override void SetDefaults() { Item.width = 24; diff --git a/Items/Fishing/FishingRods/NavyFishingRod.cs b/Items/Fishing/FishingRods/NavyFishingRod.cs index 6b6eb6d7f4..686b065a72 100644 --- a/Items/Fishing/FishingRods/NavyFishingRod.cs +++ b/Items/Fishing/FishingRods/NavyFishingRod.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Fishing/FishingRods/RiftReeler.cs b/Items/Fishing/FishingRods/RiftReeler.cs index 6bbe1e7441..4de6da68e1 100644 --- a/Items/Fishing/FishingRods/RiftReeler.cs +++ b/Items/Fishing/FishingRods/RiftReeler.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public new string LocalizationCategory => "Items.Fishing"; public override void SetStaticDefaults() { - ItemID.Sets.CanFishInLava[Item.type] = true; + ItemID.Sets.CanFishInLava[Type] = true; } public override void SetDefaults() diff --git a/Items/Fishing/FishingRods/SlurperPole.cs b/Items/Fishing/FishingRods/SlurperPole.cs index b8462e6e00..cac04d7307 100644 --- a/Items/Fishing/FishingRods/SlurperPole.cs +++ b/Items/Fishing/FishingRods/SlurperPole.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public new string LocalizationCategory => "Items.Fishing"; public override void SetStaticDefaults() { - ItemID.Sets.CanFishInLava[Item.type] = true; + ItemID.Sets.CanFishInLava[Type] = true; } public override void SetDefaults() diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index 6a4f028556..c05b8bb2ec 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public new string LocalizationCategory => "Items.Fishing"; public override void SetStaticDefaults() { - ItemID.Sets.CanFishInLava[Item.type] = true; + ItemID.Sets.CanFishInLava[Type] = true; } public override void SetDefaults() @@ -33,6 +33,11 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.rare = ModContent.RarityType(); } + public override void HoldItem(Player player) + { + player.accFishingLine = 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 < 10; i++) diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index e89239b189..74ef5cc142 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.FishingRods @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Fishing.FishingRods public class VerstaltiteFishingRod : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; + + public static float FishingPowerBiomeMult = 1.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FishingPowerBiomeMult.ToString()); + public override void SetDefaults() { Item.width = 24; diff --git a/Items/Fishing/FishofEleum.cs b/Items/Fishing/FishofEleum.cs index 47d60bf462..604c6816c2 100644 --- a/Items/Fishing/FishofEleum.cs +++ b/Items/Fishing/FishofEleum.cs @@ -11,14 +11,14 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 30; Item.height = 28; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; diff --git a/Items/Fishing/FishofFlight.cs b/Items/Fishing/FishofFlight.cs index 747c8543bb..06116dce96 100644 --- a/Items/Fishing/FishofFlight.cs +++ b/Items/Fishing/FishofFlight.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Orange; - Item.value = Item.sellPrice(gold: 1); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Fishing/FishofLight.cs b/Items/Fishing/FishofLight.cs index 1d9f09c1fd..23a1d31680 100644 --- a/Items/Fishing/FishofLight.cs +++ b/Items/Fishing/FishofLight.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 34; Item.height = 34; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Orange; - Item.value = Item.sellPrice(gold: 1); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Fishing/FishofNight.cs b/Items/Fishing/FishofNight.cs index de282cc972..2ebc006bec 100644 --- a/Items/Fishing/FishofNight.cs +++ b/Items/Fishing/FishofNight.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 34; Item.height = 34; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Orange; - Item.value = Item.sellPrice(gold: 1); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Fishing/GlimmeringGemfish.cs b/Items/Fishing/GlimmeringGemfish.cs index fd508e54bf..b9921dc101 100644 --- a/Items/Fishing/GlimmeringGemfish.cs +++ b/Items/Fishing/GlimmeringGemfish.cs @@ -1,4 +1,5 @@ -using Terraria; +using System.Collections.Generic; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,20 +8,31 @@ namespace CalamityMod.Items.Fishing public class GlimmeringGemfish : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; + public static List LootDisplay = new List + { + ItemID.Amethyst, + ItemID.Topaz, + ItemID.Sapphire, + ItemID.Emerald, + ItemID.Ruby, + ItemID.Diamond, + ItemID.Amber + }; + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 34; Item.height = 30; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; - Item.value = Item.sellPrice(silver: 50); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -42,7 +54,7 @@ namespace CalamityMod.Items.Fishing itemLoot.Add(ItemID.Amber, 8, gemMin, gemMax); // Add Thorium gems if Thorium is loaded. - Mod thorium = CalamityMod.Instance.thorium; + Mod thorium = ExternalMods.thorium; if (thorium is null) return; @@ -58,5 +70,11 @@ namespace CalamityMod.Items.Fishing else CalamityMod.Instance.Logger.Warn("Could not find Thorium Opal gem. This item will not be added to Glimmering Gemfish."); } + + public override void ModifyTooltips(List list) + { + int currentItem = (int)(Main.GlobalTimeWrappedHourly * 1.5f) % LootDisplay.Count; + list.FindAndReplace("[ITEMS]", $"[i:{LootDisplay[currentItem]}]"); + } } } diff --git a/Items/Fishing/Gorecodile.cs b/Items/Fishing/Gorecodile.cs index dec49381cc..8f97de6b50 100644 --- a/Items/Fishing/Gorecodile.cs +++ b/Items/Fishing/Gorecodile.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 30; Item.height = 28; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; diff --git a/Items/Fishing/GrandMarquisBait.cs b/Items/Fishing/GrandMarquisBait.cs index be370af1e8..21b68505b6 100644 --- a/Items/Fishing/GrandMarquisBait.cs +++ b/Items/Fishing/GrandMarquisBait.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Fishing Item.maxStack = Item.CommonMaxStack; Item.rare = ItemRarityID.LightRed; Item.value = Item.sellPrice(silver: 30); - Item.bait = 65; + Item.bait = 75; Item.consumable = true; } diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index bcfa647ef7..1c179ef7e2 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -1,4 +1,7 @@ -using Terraria; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.Crags; +using System.Collections.Generic; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,20 +10,47 @@ namespace CalamityMod.Items.Fishing public class StuffedFish : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; + public static List HerbDisplay = new List + { + ItemID.Daybloom, + ItemID.Blinkroot, + ItemID.Waterleaf, + ItemID.Shiverthorn, + ItemID.Moonglow, + ItemID.Deathweed, + ItemID.Fireblossom + }; + public static List SeedDisplay = new List + { + ItemID.DaybloomSeeds, + ItemID.BlinkrootSeeds, + ItemID.WaterleafSeeds, + ItemID.ShiverthornSeeds, + ItemID.MoonglowSeeds, + ItemID.DeathweedSeeds, + ItemID.FireblossomSeeds, + ItemID.GrassSeeds, + ItemID.JungleGrassSeeds, + ItemID.MushroomGrassSeeds, + ItemID.AshGrassSeeds, + ModContent.ItemType(), + ItemID.PumpkinSeed + }; + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 34; Item.height = 30; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; - Item.value = Item.sellPrice(silver: 50); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -58,15 +88,18 @@ namespace CalamityMod.Items.Fishing itemLoot.Add(ItemID.GrassSeeds, 10, seedMin, seedMax); itemLoot.Add(ItemID.JungleGrassSeeds, 10, seedMin, seedMax); itemLoot.Add(ItemID.MushroomGrassSeeds, 10, seedMin, seedMax); + itemLoot.Add(ItemID.AshGrassSeeds, 20, seedMin, seedMax); + itemLoot.Add(ModContent.ItemType(), 20, seedMin, seedMax); 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(() => Main.hardMode, ModContent.ItemType(), 20, seedMin, seedMax); // Add Thorium Marine Kelp if Thorium is loaded. - Mod thorium = CalamityMod.Instance.thorium; + Mod thorium = ExternalMods.thorium; if (thorium is null) return; @@ -105,5 +138,14 @@ namespace CalamityMod.Items.Fishing } */ } + + public override void ModifyTooltips(List list) + { + int currentHerb = (int)(Main.GlobalTimeWrappedHourly * 1.5f) % HerbDisplay.Count; + list.FindAndReplace("[HERBS]", $"[i:{HerbDisplay[currentHerb]}]"); + + int currentSeed = (int)(Main.GlobalTimeWrappedHourly * 1.5f) % SeedDisplay.Count; + list.FindAndReplace("[SEEDS]", $"[i:{SeedDisplay[currentSeed]}]"); + } } } diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs index 52dad8a28b..8aa67f0bd6 100644 --- a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs +++ b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs @@ -1,9 +1,6 @@ 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.Placeables.Furniture; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -31,18 +28,10 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; 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; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -53,51 +42,29 @@ namespace CalamityMod.Items.Fishing.SulphurCatches 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); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // 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); + // Rusty Chest Loot @ 100%; Individually 25% + itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(1, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); - 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, + // Ancient Treasure Chest Loot @ 100%; Individually 10% + itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(1, 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(), @@ -105,18 +72,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches 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); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/SulphurCatches/SulphurousCrate.cs b/Items/Fishing/SulphurCatches/SulphurousCrate.cs index 98d8b825e3..692e01abdb 100644 --- a/Items/Fishing/SulphurCatches/SulphurousCrate.cs +++ b/Items/Fishing/SulphurCatches/SulphurousCrate.cs @@ -1,19 +1,11 @@ using CalamityMod.Items.Accessories; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Pets; -using CalamityMod.Items.Placeables; -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.Placeables.Furniture; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Tiles.Abyss; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using CrateTile = CalamityMod.Tiles.Abyss.SulphurousCrateTile; namespace CalamityMod.Items.Fishing.SulphurCatches { @@ -29,18 +21,10 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; 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; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -51,47 +35,23 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); - var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // 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); - - // Pre-HM Abyss Weapons - tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + // Rusty Chest Loot @ 100%; Individually 25% + itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(1, 1, + 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(false); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/SunbeamFish.cs b/Items/Fishing/SunbeamFish.cs index dff792e6eb..31bfb3b70b 100644 --- a/Items/Fishing/SunbeamFish.cs +++ b/Items/Fishing/SunbeamFish.cs @@ -11,14 +11,14 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 30; Item.height = 28; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs index 7242d6591c..308fe9e4d2 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs @@ -1,10 +1,4 @@ -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 CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -24,18 +18,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; 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; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -46,27 +32,15 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var postDesertScourge = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 30, 60); - postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); - postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); - - // 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); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs index e245ff9a2d..b5a5bd815c 100644 --- a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs +++ b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs @@ -10,14 +10,14 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 40; Item.height = 38; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 10); Item.rare = ItemRarityID.Orange; } diff --git a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs index 1c5eeedd9f..57b33bb787 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs @@ -1,11 +1,4 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Fishing.BrimstoneCragCatches; -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 CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -26,18 +19,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; 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; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -48,37 +33,15 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var postDesertScourge = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); - var postHardmodeClam = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCLAMHardMode); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 30, 60); - postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); - postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); - postHardmodeClam.Add(ModContent.ItemType(), new Fraction(12, 100), 2, 5); - - // Weapons - postHardmodeClam.Add(new OneFromOptionsNotScaledWithLuckDropRule(7, 100, - 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(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs index 66ca1687ad..a3710b6d73 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs @@ -10,14 +10,14 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 30; Item.height = 28; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Green; } diff --git a/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs b/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs index fedf9b6cb9..7973bdba13 100644 --- a/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs +++ b/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs @@ -12,10 +12,8 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public new string LocalizationCategory => "Items.Fishing"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.WispinaBottle); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - Item.value = Item.sellPrice(gold: 5); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 3); // Equal to Zephyr Fish Item.rare = ItemRarityID.Orange; } diff --git a/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs b/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs index 51ce7fc457..1b25431204 100644 --- a/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs +++ b/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Typeless; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -8,13 +9,20 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public class SerpentsBite : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; + + public static float Reach = 28.125f; + public static float LaunchSpeed = 18f; + public static float ReelbackSpeed = 14f; + public static float PullSpeed = 12f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToString(), LaunchSpeed.ToString(), ReelbackSpeed.ToString(), PullSpeed.ToString()); + public override void SetDefaults() { // Instead of copying these values, we can clone and modify the ones we want to copy Item.CloneDefaults(ItemID.AmethystHook); Item.width = 30; Item.height = 32; - Item.shootSpeed = SerpentsBiteHook.LaunchSpeed; // how quickly the hook is shot. + Item.shootSpeed = 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 1688295a81..10d3c10150 100644 --- a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs +++ b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles.Magic; +using System.Collections.Generic; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,33 +11,35 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public class SparklingEmpress : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; - public static int BaseDamage = 10; - - public override void SetStaticDefaults() - { - 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.damage = 11; Item.DamageType = DamageClass.Magic; - Item.channel = true; //Channel so that you can hold the weapon [Important] - Item.rare = ItemRarityID.Green; - Item.mana = 5; - Item.useTime = 20; - Item.useAnimation = 20; - Item.UseSound = SoundID.Item13; + Item.mana = 3; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + Item.useStyle = ItemUseStyleID.Shoot; - Item.shootSpeed = 14f; - Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + + Item.rare = ItemRarityID.Green; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; } - - //Looks scuffed with the laser when there is offset - //public override Vector2? HoldoutOrigin() => new Vector2(10, 10); + 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] == 0; + 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 holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, Item.shoot, damage, knockback, player.whoAmI); + holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); + return false; + } } } diff --git a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs index c77c2ee007..287ffab9a9 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 58; Item.height = 52; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 7); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 15); Item.rare = ItemRarityID.Green; } diff --git a/Items/LabFinders/CyanSeekingMechanism.cs b/Items/LabFinders/CyanSeekingMechanism.cs index d5103b32ab..de8804036d 100644 --- a/Items/LabFinders/CyanSeekingMechanism.cs +++ b/Items/LabFinders/CyanSeekingMechanism.cs @@ -17,11 +17,12 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); } diff --git a/Items/LabFinders/GreenSeekingMechanism.cs b/Items/LabFinders/GreenSeekingMechanism.cs index 97aac930c6..ed752e35fc 100644 --- a/Items/LabFinders/GreenSeekingMechanism.cs +++ b/Items/LabFinders/GreenSeekingMechanism.cs @@ -17,11 +17,12 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); } diff --git a/Items/LabFinders/LabSeekingMechanism.cs b/Items/LabFinders/LabSeekingMechanism.cs index e4cb557cf7..47de614a07 100644 --- a/Items/LabFinders/LabSeekingMechanism.cs +++ b/Items/LabFinders/LabSeekingMechanism.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.LabFinders { Item.width = 24; Item.height = 26; + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); } diff --git a/Items/LabFinders/OnyxSeekingMechanism.cs b/Items/LabFinders/OnyxSeekingMechanism.cs index f07c064ebc..11c05af543 100644 --- a/Items/LabFinders/OnyxSeekingMechanism.cs +++ b/Items/LabFinders/OnyxSeekingMechanism.cs @@ -17,11 +17,12 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); } diff --git a/Items/LabFinders/RedSeekingMechanism.cs b/Items/LabFinders/RedSeekingMechanism.cs index 0634c3d81c..aaf1451bed 100644 --- a/Items/LabFinders/RedSeekingMechanism.cs +++ b/Items/LabFinders/RedSeekingMechanism.cs @@ -17,11 +17,12 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); } diff --git a/Items/LabFinders/WhiteSeekingMechanism.cs b/Items/LabFinders/WhiteSeekingMechanism.cs index 10b2d4f39f..e415208707 100644 --- a/Items/LabFinders/WhiteSeekingMechanism.cs +++ b/Items/LabFinders/WhiteSeekingMechanism.cs @@ -17,11 +17,12 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); } diff --git a/Items/LabFinders/YellowSeekingMechanism.cs b/Items/LabFinders/YellowSeekingMechanism.cs index 42e6582111..dc8d464cad 100644 --- a/Items/LabFinders/YellowSeekingMechanism.cs +++ b/Items/LabFinders/YellowSeekingMechanism.cs @@ -18,11 +18,12 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); } diff --git a/Items/LegendaryItem.cs b/Items/LegendaryItem.cs new file mode 100644 index 0000000000..30d4a04c79 --- /dev/null +++ b/Items/LegendaryItem.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + // Since all legendary items do not use the same localization category, ILocalizedModType must be placed on each individual item file. + public abstract class LegendaryItem : ModItem, IHoldShiftTooltipItem + { + // All legendary items use the same extension indicator tooltip. + // This is given a null color, as it is colored manually. + public string ExtensionIndicatorKey => "Items.Misc.LegendaryShortTooltip"; + public Color? ExtensionIndicatorColor => null; + + // All full flavor tooltips use the same localization key. + // Flavor tooltip color defaults to none, but can be overriden as desired for each item. + public string TooltipExtensionKey => "LegendaryText"; + public virtual Color? TooltipExtensionColor => null; + } +} diff --git a/Items/LoreItems/LoreItem.cs b/Items/LoreItems/LoreItem.cs index 193dde3a8f..2860d62fd6 100644 --- a/Items/LoreItems/LoreItem.cs +++ b/Items/LoreItems/LoreItem.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.LoreItems public override void SetStaticDefaults() { - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; } public override bool CanUseItem(Player player) => false; diff --git a/Items/LoreItems/LoreSlimeGod.png b/Items/LoreItems/LoreSlimeGod.png index a8536f1d61..b092509112 100644 Binary files a/Items/LoreItems/LoreSlimeGod.png and b/Items/LoreItems/LoreSlimeGod.png differ diff --git a/Items/Materials/AerialiteBar.cs b/Items/Materials/AerialiteBar.cs index b434352eae..cb0828ae7b 100644 --- a/Items/Materials/AerialiteBar.cs +++ b/Items/Materials/AerialiteBar.cs @@ -17,18 +17,9 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.width = 30; - Item.height = 24; - Item.createTile = ModContent.TileType(); - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.Orange; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; } public override void AddRecipes() { diff --git a/Items/Materials/AncientBoneDust.cs b/Items/Materials/AncientBoneDust.cs index c4ece734a8..e27bee21ad 100644 --- a/Items/Materials/AncientBoneDust.cs +++ b/Items/Materials/AncientBoneDust.cs @@ -4,6 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { + [LegacyName("DemonicBoneAsh")] public class AncientBoneDust : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Materials"; @@ -16,8 +17,8 @@ namespace CalamityMod.Items.Materials { Item.width = 20; Item.height = 20; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 1); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(copper: 10); Item.rare = ItemRarityID.Blue; } } diff --git a/Items/Materials/ArmoredShell.cs b/Items/Materials/ArmoredShell.cs index c19623da99..6953c56619 100644 --- a/Items/Materials/ArmoredShell.cs +++ b/Items/Materials/ArmoredShell.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Materials { Item.width = 46; Item.height = 34; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 7, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 1, silver: 40); Item.rare = ModContent.RarityType(); } } diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index 1182826311..731d9c31c9 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 118; } @@ -27,13 +27,13 @@ namespace CalamityMod.Items.Materials { Item.width = 32; Item.height = 54; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 6); Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(gold: 40); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = TextureAssets.Item[Item.type].Value; + Texture2D texture = TextureAssets.Item[Type].Value; spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } diff --git a/Items/Materials/AshesofAnnihilation.cs b/Items/Materials/AshesofAnnihilation.cs index 2497d12064..5b3565422d 100644 --- a/Items/Materials/AshesofAnnihilation.cs +++ b/Items/Materials/AshesofAnnihilation.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Materials { Item.width = 54; Item.height = 56; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 66, silver: 66, copper: 66); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 6, silver: 66, copper: 66); Item.rare = ModContent.RarityType(); } public void DrawPulsingAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Materials for (int i = 0; i < 4; i++) { Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * outwardness - drawPositionOffset; - spriteBatch.Draw(TextureAssets.Item[Item.type].Value, drawPosition, frame, drawColor, velocity, origin, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(TextureAssets.Item[Type].Value, drawPosition, frame, drawColor, velocity, origin, scale, SpriteEffects.None, 0f); } } @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Materials public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Rectangle frame = Main.itemAnimations[Item.type].GetFrame(TextureAssets.Item[Item.type].Value); + Rectangle frame = Main.itemAnimations[Type].GetFrame(TextureAssets.Item[Type].Value); DrawPulsingAfterimage(spriteBatch, Item.position - Main.screenPosition + frame.Size() * 0.5f, frame, scale); return true; } diff --git a/Items/Materials/AshesofCalamity.cs b/Items/Materials/AshesofCalamity.cs index 91816a8ea7..f6d63016a9 100644 --- a/Items/Materials/AshesofCalamity.cs +++ b/Items/Materials/AshesofCalamity.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Materials { Item.width = 26; Item.height = 20; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 4, 50, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 50); Item.rare = ItemRarityID.Lime; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index 689186cc7a..c16a1a60e2 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; ItemID.Sets.SortingPriorityMaterials[Type] = 120; ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 12)); } @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 60); + Item.value = Item.sellPrice(gold: 7); Item.rare = ModContent.RarityType(); } @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(5). - AddIngredient(60). + AddIngredient(50). AddIngredient(). AddTile(). Register(); diff --git a/Items/Materials/BlightedGel.cs b/Items/Materials/BlightedGel.cs index 6585cfd403..b1290ae703 100644 --- a/Items/Materials/BlightedGel.cs +++ b/Items/Materials/BlightedGel.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Materials { Item.width = 16; Item.height = 18; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 6); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(copper: 10); Item.rare = ItemRarityID.Blue; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index ee1993eccb..35716b0f34 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Materials { Item.width = 16; Item.height = 28; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 1, copper: 20); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(copper: 40); Item.rare = ItemRarityID.Blue; } diff --git a/Items/Materials/BloodSample.cs b/Items/Materials/BloodSample.cs index 81ab3ccdc8..5576926d81 100644 --- a/Items/Materials/BloodSample.cs +++ b/Items/Materials/BloodSample.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,15 +12,18 @@ namespace CalamityMod.Items.Materials { Item.ResearchUnlockCount = 25; ItemID.Sets.SortingPriorityMaterials[Type] = 68; // Sturdy Fossil + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ModContent.ItemType(), 1); } public override void SetDefaults() { Item.width = 26; Item.height = 34; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 50, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Orange; + + Item.MakeUsableWithChlorophyteExtractinator(); } } } diff --git a/Items/Materials/Bloodstone.cs b/Items/Materials/Bloodstone.cs index 33ccdc5e36..2f1ab7ea6b 100644 --- a/Items/Materials/Bloodstone.cs +++ b/Items/Materials/Bloodstone.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Materials { Item.width = 13; Item.height = 10; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 60); Item.rare = ModContent.RarityType(); } diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index 4dd5376703..d15ca6a99a 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Materials { Item.width = 15; Item.height = 12; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 4); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 2); Item.rare = ModContent.RarityType(); } diff --git a/Items/Materials/CoreofCalamity.cs b/Items/Materials/CoreofCalamity.cs index 70a33fca60..b2b4a1572f 100644 --- a/Items/Materials/CoreofCalamity.cs +++ b/Items/Materials/CoreofCalamity.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Materials { Item.width = 36; Item.height = 36; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 4); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Yellow; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) @@ -33,10 +33,11 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(3). - AddIngredient(3). - AddIngredient(3). + AddIngredient(). + AddIngredient(). + AddIngredient(). AddIngredient(). + AddIngredient(ItemID.Ectoplasm, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Materials/CoreofEleum.cs b/Items/Materials/CoreofEleum.cs deleted file mode 100644 index 9c7ca3df82..0000000000 --- a/Items/Materials/CoreofEleum.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class CoreofEleum : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - ItemID.Sets.ItemNoGravity[Item.type] = true; - - ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar - } - - public override void SetDefaults() - { - Item.width = 34; - Item.height = 34; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 40); - Item.rare = ItemRarityID.Yellow; - } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Materials/CoreofEleumGlow").Value); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(Item.Center, 0.15f * brightness, 0.05f * brightness, 0.5f * brightness); - } - - public override void AddRecipes() - { - CreateRecipe(3). - AddIngredient(). - AddIngredient(ItemID.Ectoplasm). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Materials/CoreofEleum.png b/Items/Materials/CoreofEleum.png deleted file mode 100644 index 06c4d1e419..0000000000 Binary files a/Items/Materials/CoreofEleum.png and /dev/null differ diff --git a/Items/Materials/CoreofEleumGlow.png b/Items/Materials/CoreofEleumGlow.png deleted file mode 100644 index 16db58cbfc..0000000000 Binary files a/Items/Materials/CoreofEleumGlow.png and /dev/null differ diff --git a/Items/Materials/CoreofHavoc.cs b/Items/Materials/CoreofHavoc.cs deleted file mode 100644 index 4adf30e98d..0000000000 --- a/Items/Materials/CoreofHavoc.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - [LegacyName("CoreofChaos")] - public class CoreofHavoc : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - ItemID.Sets.ItemNoGravity[Item.type] = true; - - ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar - } - - public override void SetDefaults() - { - Item.width = 36; - Item.height = 36; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 40); - Item.rare = ItemRarityID.Yellow; - } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Materials/CoreofHavocGlow").Value); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(Item.Center, 0.5f * brightness, 0.3f * brightness, 0.05f * brightness); - } - - public override void AddRecipes() - { - CreateRecipe(3). - AddIngredient(). - AddIngredient(ItemID.Ectoplasm). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Materials/CoreofHavoc.png b/Items/Materials/CoreofHavoc.png deleted file mode 100644 index 2ff460a354..0000000000 Binary files a/Items/Materials/CoreofHavoc.png and /dev/null differ diff --git a/Items/Materials/CoreofHavocGlow.png b/Items/Materials/CoreofHavocGlow.png deleted file mode 100644 index 14cfc6e016..0000000000 Binary files a/Items/Materials/CoreofHavocGlow.png and /dev/null differ diff --git a/Items/Materials/CoreofSunlight.cs b/Items/Materials/CoreofSunlight.cs deleted file mode 100644 index 2c8330cebc..0000000000 --- a/Items/Materials/CoreofSunlight.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - [LegacyName("CoreofCinder")] - public class CoreofSunlight : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - ItemID.Sets.ItemNoGravity[Item.type] = true; - - ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar - } - - public override void SetDefaults() - { - Item.width = 34; - Item.height = 34; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 40); - Item.rare = ItemRarityID.Yellow; - } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Materials/CoreofSunlightGlow").Value); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(Item.Center, 0.3f * brightness, 0.3f * brightness, 0.05f * brightness); - } - - public override void AddRecipes() - { - CreateRecipe(3). - AddIngredient(). - AddIngredient(ItemID.Ectoplasm). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Materials/CoreofSunlight.png b/Items/Materials/CoreofSunlight.png deleted file mode 100644 index ed7542ef9c..0000000000 Binary files a/Items/Materials/CoreofSunlight.png and /dev/null differ diff --git a/Items/Materials/CoreofSunlightGlow.png b/Items/Materials/CoreofSunlightGlow.png deleted file mode 100644 index ae82d6ac92..0000000000 Binary files a/Items/Materials/CoreofSunlightGlow.png and /dev/null differ diff --git a/Items/Materials/CorrodedFossil.cs b/Items/Materials/CorrodedFossil.cs index b8e33f9dd6..9330bc3886 100644 --- a/Items/Materials/CorrodedFossil.cs +++ b/Items/Materials/CorrodedFossil.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials { Item.width = 30; Item.height = 28; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 3, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 8); Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Materials/CosmiliteBar.cs b/Items/Materials/CosmiliteBar.cs index 1982eb858b..d402b78f8e 100644 --- a/Items/Materials/CosmiliteBar.cs +++ b/Items/Materials/CosmiliteBar.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 20); + Item.value = Item.sellPrice(gold: 3); Item.rare = ModContent.RarityType(); } diff --git a/Items/Materials/CryonicBar.cs b/Items/Materials/CryonicBar.cs index 0a13d1fb45..51bad2381a 100644 --- a/Items/Materials/CryonicBar.cs +++ b/Items/Materials/CryonicBar.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(silver: 60); + Item.value = Item.sellPrice(silver: 72); Item.rare = ItemRarityID.Pink; } diff --git a/Items/Materials/DarkPlasma.cs b/Items/Materials/DarkPlasma.cs index 2ee15aeb17..0c601f8257 100644 --- a/Items/Materials/DarkPlasma.cs +++ b/Items/Materials/DarkPlasma.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 5; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 108; } @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Materials { Item.width = 15; Item.height = 12; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 7, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 1, silver: 40); Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index 5fc79ea76a..902ceb0fa1 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 100; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 8)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 117; } @@ -27,14 +27,14 @@ namespace CalamityMod.Items.Materials { Item.width = 28; Item.height = 32; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 12); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 60); Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = TextureAssets.Item[Item.type].Value; + Texture2D texture = TextureAssets.Item[Type].Value; spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } diff --git a/Items/Materials/DemonicBoneAsh.cs b/Items/Materials/DemonicBoneAsh.cs deleted file mode 100644 index b0fa0cfcb9..0000000000 --- a/Items/Materials/DemonicBoneAsh.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class DemonicBoneAsh : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 6); - Item.rare = ItemRarityID.Orange; - } - } -} diff --git a/Items/Materials/DemonicBoneAsh.png b/Items/Materials/DemonicBoneAsh.png deleted file mode 100644 index 82628c60a7..0000000000 Binary files a/Items/Materials/DemonicBoneAsh.png and /dev/null differ diff --git a/Items/Materials/DepthCells.cs b/Items/Materials/DepthCells.cs index ef981b8c83..d7cfc2e441 100644 --- a/Items/Materials/DepthCells.cs +++ b/Items/Materials/DepthCells.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials { Item.width = 26; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 80); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 12); Item.rare = ItemRarityID.Lime; } } diff --git a/Items/Materials/DivineGeode.cs b/Items/Materials/DivineGeode.cs index 10ef67e8ff..3b075e4ff5 100644 --- a/Items/Materials/DivineGeode.cs +++ b/Items/Materials/DivineGeode.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Materials { Item.width = 15; Item.height = 12; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 6, 50, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 1, silver: 30); Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/DubiousPlating.cs b/Items/Materials/DubiousPlating.cs index 40f9827755..9566a41fdf 100644 --- a/Items/Materials/DubiousPlating.cs +++ b/Items/Materials/DubiousPlating.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Materials { Item.width = 30; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 3); Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(silver: 6); } } } diff --git a/Items/Materials/EffulgentFeather.cs b/Items/Materials/EffulgentFeather.cs index 82228a5e76..c0e9602d0f 100644 --- a/Items/Materials/EffulgentFeather.cs +++ b/Items/Materials/EffulgentFeather.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Materials { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 6, 50, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 1, silver: 30); Item.rare = ItemRarityID.Purple; } } diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index 68f6661d81..27a69c8c20 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 100; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 116; } @@ -27,14 +27,14 @@ namespace CalamityMod.Items.Materials { Item.width = 36; Item.height = 38; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 2); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 40); Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = TextureAssets.Item[Item.type].Value; + Texture2D texture = TextureAssets.Item[Type].Value; spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } diff --git a/Items/Materials/EnergyCore.cs b/Items/Materials/EnergyCore.cs index 70a5a726dc..74d593538b 100644 --- a/Items/Materials/EnergyCore.cs +++ b/Items/Materials/EnergyCore.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { Item.width = Item.height = 22; - Item.maxStack = 9999; - Item.value = Item.sellPrice(copper: 80); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(copper: 40); Item.rare = ItemRarityID.Blue; } } diff --git a/Items/Materials/EssenceofEleum.cs b/Items/Materials/EssenceofEleum.cs index 2e2594eafd..51451fdd86 100644 --- a/Items/Materials/EssenceofEleum.cs +++ b/Items/Materials/EssenceofEleum.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } @@ -22,13 +22,13 @@ namespace CalamityMod.Items.Materials { Item.width = 28; Item.height = 24; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 40); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 4); Item.rare = ItemRarityID.LightRed; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, TextureAssets.Item[Item.type].Value); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, TextureAssets.Item[Type].Value); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/EssenceofHavoc.cs b/Items/Materials/EssenceofHavoc.cs index 6966670aec..e9c5154003 100644 --- a/Items/Materials/EssenceofHavoc.cs +++ b/Items/Materials/EssenceofHavoc.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } @@ -23,13 +23,13 @@ namespace CalamityMod.Items.Materials { Item.width = 36; Item.height = 22; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 40); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 4); Item.rare = ItemRarityID.LightRed; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, TextureAssets.Item[Item.type].Value); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, TextureAssets.Item[Type].Value); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/EssenceofSunlight.cs b/Items/Materials/EssenceofSunlight.cs index 72c482ee4b..3da42eddf5 100644 --- a/Items/Materials/EssenceofSunlight.cs +++ b/Items/Materials/EssenceofSunlight.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } @@ -23,13 +23,13 @@ namespace CalamityMod.Items.Materials { Item.width = 32; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 40); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 4); Item.rare = ItemRarityID.LightRed; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, TextureAssets.Item[Item.type].Value); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, TextureAssets.Item[Type].Value); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/ExoPrism.cs b/Items/Materials/ExoPrism.cs index 217a71ef3a..732cae5900 100644 --- a/Items/Materials/ExoPrism.cs +++ b/Items/Materials/ExoPrism.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Materials { Item.width = 32; Item.height = 52; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 60); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 7); Item.rare = ModContent.RarityType(); } public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) @@ -37,13 +37,13 @@ namespace CalamityMod.Items.Materials for (int i = 0; i < 4; i++) { Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 4f; - spriteBatch.Draw(TextureAssets.Item[Item.type].Value, drawPosition, frame, drawColor, velocity, origin, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(TextureAssets.Item[Type].Value, drawPosition, frame, drawColor, velocity, origin, scale, SpriteEffects.None, 0f); } } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Rectangle frame = TextureAssets.Item[Item.type].Value.Frame(); + Rectangle frame = TextureAssets.Item[Type].Value.Frame(); DrawBackAfterimage(spriteBatch, Item.position - Main.screenPosition + frame.Size() * 0.5f, frame, scale); return true; } diff --git a/Items/Materials/GalacticaSingularity.cs b/Items/Materials/GalacticaSingularity.cs index b006b43111..f1bdcb44f6 100644 --- a/Items/Materials/GalacticaSingularity.cs +++ b/Items/Materials/GalacticaSingularity.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 24)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite } @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Materials { Item.width = 28; Item.height = 28; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 96); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Red; } public override void AddRecipes() @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Materials CreateRecipe(). AddIngredient(ItemID.FragmentSolar). AddIngredient(ItemID.FragmentVortex). - AddIngredient(ItemID.FragmentStardust). AddIngredient(ItemID.FragmentNebula). + AddIngredient(ItemID.FragmentStardust). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Materials/GrandScale.cs b/Items/Materials/GrandScale.cs index ac0c71598e..698ed552e8 100644 --- a/Items/Materials/GrandScale.cs +++ b/Items/Materials/GrandScale.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials { Item.width = 28; Item.height = 32; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 4, 50, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Lime; } } diff --git a/Items/Materials/InfectedArmorPlating.cs b/Items/Materials/InfectedArmorPlating.cs index c5d9ce788f..13522eb1b1 100644 --- a/Items/Materials/InfectedArmorPlating.cs +++ b/Items/Materials/InfectedArmorPlating.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials { Item.width = 20; Item.height = 20; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Yellow; } } diff --git a/Items/Materials/InfectedArmorPlating.png b/Items/Materials/InfectedArmorPlating.png index c68c72f36d..edaf2ea071 100644 Binary files a/Items/Materials/InfectedArmorPlating.png and b/Items/Materials/InfectedArmorPlating.png differ diff --git a/Items/Materials/LifeAlloy.cs b/Items/Materials/LifeAlloy.cs index 4021c22faa..9afafbe46e 100644 --- a/Items/Materials/LifeAlloy.cs +++ b/Items/Materials/LifeAlloy.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Materials { Item.width = 30; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 3); Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Materials/LivingShard.cs b/Items/Materials/LivingShard.cs index 91b85e7819..44be34960f 100644 --- a/Items/Materials/LivingShard.cs +++ b/Items/Materials/LivingShard.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials { Item.width = 14; Item.height = 14; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 80); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 50); Item.rare = ItemRarityID.Lime; } } diff --git a/Items/Materials/Lumenyl.cs b/Items/Materials/Lumenyl.cs index 307abbd6b5..0a54de3fb7 100644 --- a/Items/Materials/Lumenyl.cs +++ b/Items/Materials/Lumenyl.cs @@ -16,17 +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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 80); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 12); Item.rare = ItemRarityID.Lime; } } diff --git a/Items/Materials/MeldBlob.cs b/Items/Materials/MeldBlob.cs index 63d2a1da1e..c7bb47de1b 100644 --- a/Items/Materials/MeldBlob.cs +++ b/Items/Materials/MeldBlob.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Materials { Item.width = 16; Item.height = 14; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 20); Item.rare = ItemRarityID.Red; } diff --git a/Items/Materials/MeldConstruct.cs b/Items/Materials/MeldConstruct.cs index feded67f84..3fe527e5cc 100644 --- a/Items/Materials/MeldConstruct.cs +++ b/Items/Materials/MeldConstruct.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Materials { Item.width = 15; Item.height = 12; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 1, silver: 20); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 42); Item.rare = ItemRarityID.Red; } public override void AddRecipes() diff --git a/Items/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs index 1efa768b41..18963320e2 100644 --- a/Items/Materials/MiracleMatter.cs +++ b/Items/Materials/MiracleMatter.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Materials { Item.width = 70; Item.height = 80; - Item.maxStack = 9999; - Item.value = Item.sellPrice(platinum: 6, gold: 50); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(platinum: 1); Item.rare = ModContent.RarityType(); } @@ -47,14 +47,14 @@ namespace CalamityMod.Items.Materials for (int i = 0; i < 8; i++) { Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 8f).ToRotationVector2() * drawPositionOffset; - spriteBatch.Draw(TextureAssets.Item[Item.type].Value, drawPosition, frame, drawColor, 0f, origin, baseScale, SpriteEffects.None, 0f); + spriteBatch.Draw(TextureAssets.Item[Type].Value, drawPosition, frame, drawColor, 0f, origin, baseScale, SpriteEffects.None, 0f); } } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Rectangle frame = TextureAssets.Item[Item.type].Value.Frame(); + Rectangle frame = TextureAssets.Item[Type].Value.Frame(); DrawBackAfterimage(spriteBatch, Item.position - Main.screenPosition, frame, Vector2.Zero, scale); return true; } @@ -84,12 +84,12 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). AddIngredient(5). + AddIngredient(5). AddIngredient(). - AddIngredient(). AddIngredient(). AddIngredient(3). + AddIngredient(). AddTile(). Register(); } diff --git a/Items/Materials/MolluskHusk.cs b/Items/Materials/MolluskHusk.cs index e7a45fb325..4aebfaab62 100644 --- a/Items/Materials/MolluskHusk.cs +++ b/Items/Materials/MolluskHusk.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials { Item.width = 30; Item.height = 28; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 3, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 8); Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Materials/MurkyPaste.cs b/Items/Materials/MurkyPaste.cs deleted file mode 100644 index 060bd0cb08..0000000000 --- a/Items/Materials/MurkyPaste.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class MurkyPaste : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.width = 24; - Item.height = 32; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 2); - Item.rare = ItemRarityID.Blue; - } - } -} diff --git a/Items/Materials/MurkyPaste.png b/Items/Materials/MurkyPaste.png deleted file mode 100644 index 7e472bd753..0000000000 Binary files a/Items/Materials/MurkyPaste.png and /dev/null differ diff --git a/Items/Materials/MysteriousCircuitry.cs b/Items/Materials/MysteriousCircuitry.cs index aa904fc5f5..3b715e6510 100644 --- a/Items/Materials/MysteriousCircuitry.cs +++ b/Items/Materials/MysteriousCircuitry.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Materials { Item.width = 30; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 3); Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(silver: 6); } } } diff --git a/Items/Materials/Necroplasm.cs b/Items/Materials/Necroplasm.cs index 4a64871a61..6796178608 100644 --- a/Items/Materials/Necroplasm.cs +++ b/Items/Materials/Necroplasm.cs @@ -17,14 +17,15 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 110; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ectoplasm; } public override void SetDefaults() { Item.width = 24; Item.height = 52; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 1); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Purple; } diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index 441d58d716..01c020e757 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 100; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 115; } @@ -27,14 +27,14 @@ namespace CalamityMod.Items.Materials { Item.width = 38; Item.height = 36; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 2); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 40); Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = TextureAssets.Item[Item.type].Value; + Texture2D texture = TextureAssets.Item[Type].Value; spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } diff --git a/Items/Materials/PearlShard.cs b/Items/Materials/PearlShard.cs index 15fdd26495..07a56d8f2a 100644 --- a/Items/Materials/PearlShard.cs +++ b/Items/Materials/PearlShard.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Materials { Item.width = 20; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 3); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 1); Item.rare = ItemRarityID.Green; } } diff --git a/Items/Materials/PerennialBar.cs b/Items/Materials/PerennialBar.cs index b6da5b5fab..50553376a8 100644 --- a/Items/Materials/PerennialBar.cs +++ b/Items/Materials/PerennialBar.cs @@ -18,16 +18,7 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.width = 30; - Item.height = 24; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Lime; } diff --git a/Items/Materials/PlagueCellCanister.cs b/Items/Materials/PlagueCellCanister.cs index 4dc0f81339..60e9ba78e1 100644 --- a/Items/Materials/PlagueCellCanister.cs +++ b/Items/Materials/PlagueCellCanister.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Materials { Item.width = 20; Item.height = 20; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 15); Item.rare = ItemRarityID.Yellow; } } diff --git a/Items/Materials/PlagueCellCanister.png b/Items/Materials/PlagueCellCanister.png index 2f63b08e28..eec218c7b2 100644 Binary files a/Items/Materials/PlagueCellCanister.png and b/Items/Materials/PlagueCellCanister.png differ diff --git a/Items/Materials/PlasmaDriveCore.cs b/Items/Materials/PlasmaDriveCore.cs index c58829e8a4..8614b23bca 100644 --- a/Items/Materials/PlasmaDriveCore.cs +++ b/Items/Materials/PlasmaDriveCore.cs @@ -17,14 +17,14 @@ namespace CalamityMod.Items.Materials { Item.width = 30; Item.height = 30; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = 0; Item.rare = ModContent.RarityType(); } 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; + Texture2D tex = TextureAssets.Item[Type].Value; //Give it an outline. Make it look really important and shiny. The player must not confuse this for a random material spriteBatch.End(); diff --git a/Items/Materials/PurifiedGel.cs b/Items/Materials/PurifiedGel.cs index e1b068b15b..191827ea9d 100644 --- a/Items/Materials/PurifiedGel.cs +++ b/Items/Materials/PurifiedGel.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Materials { Item.width = 20; Item.height = 36; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 2, 50, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.LightRed; } } diff --git a/Items/Materials/ReaperTooth.cs b/Items/Materials/ReaperTooth.cs index c6134703ea..18da80744a 100644 --- a/Items/Materials/ReaperTooth.cs +++ b/Items/Materials/ReaperTooth.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Materials { Item.width = 26; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 7, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 1, silver: 50); Item.rare = ModContent.RarityType(); } } diff --git a/Items/Materials/RottenMatter.cs b/Items/Materials/RottenMatter.cs index e47baf25b3..bd79bb3508 100644 --- a/Items/Materials/RottenMatter.cs +++ b/Items/Materials/RottenMatter.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +13,18 @@ namespace CalamityMod.Items.Materials { Item.ResearchUnlockCount = 25; ItemID.Sets.SortingPriorityMaterials[Type] = 65; // Crimtane Ore + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ModContent.ItemType(), 1); } public override void SetDefaults() { Item.width = 28; Item.height = 32; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 50, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Orange; + + Item.MakeUsableWithChlorophyteExtractinator(); } } } diff --git a/Items/Materials/RuinousSoul.cs b/Items/Materials/RuinousSoul.cs index b02274801b..bb58851f2e 100644 --- a/Items/Materials/RuinousSoul.cs +++ b/Items/Materials/RuinousSoul.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Materials { Item.width = 26; Item.height = 42; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 7, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 1, silver: 50); Item.rare = ModContent.RarityType(); } } diff --git a/Items/Materials/ScoriaBar.cs b/Items/Materials/ScoriaBar.cs index eb22b26d91..bd91955f69 100644 --- a/Items/Materials/ScoriaBar.cs +++ b/Items/Materials/ScoriaBar.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 1, silver: 20); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Materials/SeaRemains.cs b/Items/Materials/SeaRemains.cs index 8c050cca09..ff70b1ad9f 100644 --- a/Items/Materials/SeaRemains.cs +++ b/Items/Materials/SeaRemains.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Materials { Item.width = 30; Item.height = 24; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 6); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 36); Item.rare = ItemRarityID.Green; } public override void AddRecipes() diff --git a/Items/Materials/ShadowspecBar.cs b/Items/Materials/ShadowspecBar.cs index 8b7492a277..dc7038a859 100644 --- a/Items/Materials/ShadowspecBar.cs +++ b/Items/Materials/ShadowspecBar.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(platinum: 1, gold: 92); + Item.value = Item.sellPrice(gold: 21); Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Materials/SolarVeil.cs b/Items/Materials/SolarVeil.cs index 6cf4c98a11..e20c4d60c4 100644 --- a/Items/Materials/SolarVeil.cs +++ b/Items/Materials/SolarVeil.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials { Item.width = 46; Item.height = 32; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 80); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 15); Item.rare = ItemRarityID.Lime; } } diff --git a/Items/Materials/StarblightSoot.cs b/Items/Materials/StarblightSoot.cs index a22b09e580..0da6bcb3e1 100644 --- a/Items/Materials/StarblightSoot.cs +++ b/Items/Materials/StarblightSoot.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Materials { Item.width = 30; Item.height = 26; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 3); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } } diff --git a/Items/Materials/StormlionMandible.cs b/Items/Materials/StormlionMandible.cs index 597fc42f75..452b2cc5bb 100644 --- a/Items/Materials/StormlionMandible.cs +++ b/Items/Materials/StormlionMandible.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Materials { Item.width = 36; Item.height = 38; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 1, copper: 40); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(copper: 40); Item.rare = ItemRarityID.Blue; } } diff --git a/Items/Materials/SulphuricScale.cs b/Items/Materials/SulphuricScale.cs index 5ced553ffa..442824da1a 100644 --- a/Items/Materials/SulphuricScale.cs +++ b/Items/Materials/SulphuricScale.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Materials { Item.width = 20; Item.height = 20; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 3); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(copper: 60); Item.rare = ItemRarityID.Green; } } diff --git a/Items/Materials/SuspiciousScrap.cs b/Items/Materials/SuspiciousScrap.cs index 5abbf4b4c5..ad7cf40862 100644 --- a/Items/Materials/SuspiciousScrap.cs +++ b/Items/Materials/SuspiciousScrap.cs @@ -21,13 +21,13 @@ namespace CalamityMod.Items.Materials { Item.width = 30; Item.height = 30; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 0, 20); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(copper: 4); Item.rare = ModContent.RarityType(); } 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; + Texture2D tex = TextureAssets.Item[Type].Value; 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); @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Materials public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D tex = TextureAssets.Item[Item.type].Value; + Texture2D tex = TextureAssets.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; diff --git a/Items/Materials/TitanHeart.cs b/Items/Materials/TitanHeart.cs index 2e928d8b45..4776d0d0d6 100644 --- a/Items/Materials/TitanHeart.cs +++ b/Items/Materials/TitanHeart.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials { Item.width = 10; Item.height = 10; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 1); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } } diff --git a/Items/Materials/TrapperBulb.cs b/Items/Materials/TrapperBulb.cs deleted file mode 100644 index b787880bc2..0000000000 --- a/Items/Materials/TrapperBulb.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class TrapperBulb : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 16); - Item.rare = ItemRarityID.LightRed; - } - } -} diff --git a/Items/Materials/TrapperBulb.png b/Items/Materials/TrapperBulb.png deleted file mode 100644 index 0fb83e71f6..0000000000 Binary files a/Items/Materials/TrapperBulb.png and /dev/null differ diff --git a/Items/Materials/TwistingNether.cs b/Items/Materials/TwistingNether.cs index 64dd4ce51a..81249087a9 100644 --- a/Items/Materials/TwistingNether.cs +++ b/Items/Materials/TwistingNether.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 109; } @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Materials { Item.width = 15; Item.height = 12; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 7, 0, 0); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 1, silver: 40); Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/UelibloomBar.cs b/Items/Materials/UelibloomBar.cs index 64c2c1f34e..43dcea8267 100644 --- a/Items/Materials/UelibloomBar.cs +++ b/Items/Materials/UelibloomBar.cs @@ -19,18 +19,9 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.width = 15; - Item.height = 12; - Item.createTile = ModContent.TileType(); - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 5); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 1, silver: 40); Item.rare = ModContent.RarityType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; } public override void AddRecipes() { diff --git a/Items/Materials/UnholyCore.cs b/Items/Materials/UnholyCore.cs index 8939d792ce..101ac3199a 100644 --- a/Items/Materials/UnholyCore.cs +++ b/Items/Materials/UnholyCore.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Materials { Item.width = 26; Item.height = 46; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Pink; } diff --git a/Items/Materials/UnholyEssence.cs b/Items/Materials/UnholyEssence.cs index 1f79451f27..ca3742080f 100644 --- a/Items/Materials/UnholyEssence.cs +++ b/Items/Materials/UnholyEssence.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 7)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; ItemID.Sets.SortingPriorityMaterials[Type] = 103; } @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Materials { Item.width = 28; Item.height = 36; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.Purple; - Item.value = Item.buyPrice(0, 6, 50, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Materials/WulfrumMetalScrap.cs b/Items/Materials/WulfrumMetalScrap.cs index 7df22c2da1..b2140ca6ec 100644 --- a/Items/Materials/WulfrumMetalScrap.cs +++ b/Items/Materials/WulfrumMetalScrap.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Materials { Item.width = 13; Item.height = 10; - Item.maxStack = 9999; - Item.value = Item.sellPrice(copper: 80); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(copper: 10); Item.rare = ItemRarityID.Blue; Item.ammo = Item.type; } diff --git a/Items/Materials/YharonSoulFragment.cs b/Items/Materials/YharonSoulFragment.cs index f2b986749b..542fe37019 100644 --- a/Items/Materials/YharonSoulFragment.cs +++ b/Items/Materials/YharonSoulFragment.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.ItemNoGravity[Type] = true; } @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Materials { Item.width = 10; Item.height = 14; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 45); + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(gold: 5); Item.rare = ModContent.RarityType(); } } diff --git a/Items/MomentumCapacitor.cs b/Items/MomentumCapacitor.cs index 5f95ff78f8..b5bf27973e 100644 --- a/Items/MomentumCapacitor.cs +++ b/Items/MomentumCapacitor.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -21,7 +22,7 @@ namespace CalamityMod.Items Item.rare = ItemRarityID.Pink; Item.useStyle = ItemUseStyleID.HoldUp; - Item.useTime = Item.useAnimation = 2; + Item.useAnimation = Item.useTime = 2; Item.noMelee = true; Item.channel = true; Item.autoReuse = true; @@ -40,10 +41,18 @@ namespace CalamityMod.Items CalamityPlayer modPlayer = player.Calamity(); modPlayer.momentumCapacitorTime = TotalFadeTime; modPlayer.momentumCapacitorBoost += Main.rand.NextFloat(0.5f, 3.5f) * MomentumChargePerFrame; - if (modPlayer.momentumCapacitorBoost >= MaxMomentumCharge) + if (modPlayer.momentumCapacitorBoost >= MaxMomentumCharge && !Main.zenithWorld) modPlayer.momentumCapacitorBoost = MaxMomentumCharge; } return null; } + + public override void UpdateInventory(Player player) + { + if (Main.zenithWorld) + Item.SetNameOverride(this.GetLocalizedValue("GFBName")); + } + + public override void ModifyTooltips(List tooltips) => tooltips.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); } } diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index d1f8acca61..195d4ab52a 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -17,51 +17,53 @@ namespace CalamityMod.Items.Mounts MountData.spawnDust = 234; MountData.spawnDustNoGravity = true; MountData.buff = ModContent.BuffType(); - MountData.heightBoost = 35; - MountData.fallDamage = 0f; + + // Horizontal movement MountData.runSpeed = 5.6f; MountData.dashSpeed = 17.6f; - MountData.flightTimeMax = 9999; - MountData.fatigueMax = 0; - MountData.jumpHeight = 12; - MountData.acceleration = 0.4f; - MountData.jumpSpeed = 9.21f; MountData.swimSpeed = 4f; - MountData.blockExtraJumps = false; + MountData.acceleration = 0.4f; + + // Vertical movement + MountData.fallDamage = 0f; + MountData.fatigueMax = int.MaxValue; + MountData.flightTimeMax = int.MaxValue; + MountData.jumpSpeed = 9.21f; + + // Frames and offsets MountData.totalFrames = 15; - MountData.constantJump = false; - int baseYOffset = 26; + MountData.heightBoost = 34; + int baseYOffset = 30; int[] array = new int[MountData.totalFrames]; for (int l = 0; l < array.Length; l++) - { array[l] = baseYOffset; - } + array[1] = array[3] = array[5] = array[7] = array[12] = baseYOffset - 2; MountData.playerYOffsets = array; - MountData.xOffset = -4; + MountData.playerHeadOffset = 36; MountData.bodyFrame = 3; - MountData.yOffset = 5; //-8 - MountData.playerHeadOffset = 36; //30 + MountData.xOffset = -4; + MountData.yOffset = 6; MountData.standingFrameCount = 1; MountData.standingFrameDelay = 12; MountData.standingFrameStart = 0; - MountData.runningFrameCount = 8; //7 - MountData.runningFrameDelay = 42; //36 - MountData.runningFrameStart = 1; //9 - MountData.flyingFrameCount = 6; //0 - MountData.flyingFrameDelay = 4; //0 - MountData.flyingFrameStart = 9; //0 - MountData.inAirFrameCount = 1; //1 - MountData.inAirFrameDelay = 12; //12 - MountData.inAirFrameStart = 10; //10 - MountData.idleFrameCount = 1; //4 - MountData.idleFrameDelay = 12; //12 + MountData.runningFrameCount = 8; + MountData.runningFrameDelay = 42; + MountData.runningFrameStart = 1; + MountData.flyingFrameCount = 6; + MountData.flyingFrameDelay = 4; + MountData.flyingFrameStart = 9; + MountData.inAirFrameCount = 1; + MountData.inAirFrameDelay = 12; + MountData.inAirFrameStart = 10; + MountData.idleFrameCount = 1; + MountData.idleFrameDelay = 12; MountData.idleFrameStart = 5; MountData.idleFrameLoop = true; MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.inAirFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/AlicornMountExtra"); MountData.textureWidth = MountData.backTexture.Width(); @@ -73,7 +75,7 @@ namespace CalamityMod.Items.Mounts { foreach (NPC npc in Main.ActiveNPCs) { - if (npc.type == ModContent.NPCType()) + if (npc.type == ModContent.NPCType()) { npc.active = false; npc.netUpdate = true; @@ -98,10 +100,10 @@ namespace CalamityMod.Items.Mounts // Spawn Cirrus if no other players are on the Alicorn mount. if (!anyPlayerOnFabMount) { - if (!NPC.AnyNPCs(ModContent.NPCType())) + if (!NPC.AnyNPCs(ModContent.NPCType())) { if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_TownSpawn(), (int)player.Center.X, (int)player.Center.Y, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_TownSpawn(), (int)player.Center.X, (int)player.Center.Y, ModContent.NPCType()); } } } @@ -109,7 +111,7 @@ namespace CalamityMod.Items.Mounts public override void UpdateEffects(Player player) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.fabsolVodka) + if (modPlayer.cirrusVodka) player.GetDamage() += 0.1f; if (player.velocity.Length() > 9f) diff --git a/Items/Mounts/BUMBLEDOGE.cs b/Items/Mounts/BUMBLEDOGE.cs index 8c16461fe9..1cbc9c4b3d 100644 --- a/Items/Mounts/BUMBLEDOGE.cs +++ b/Items/Mounts/BUMBLEDOGE.cs @@ -16,34 +16,31 @@ namespace CalamityMod.Items.Mounts MountData.spawnDustNoGravity = true; MountData.buff = ModContent.BuffType(); - // previous stats commented for balance. - // for run and dash speed, each 1 unit is 5.08mph in-game. - MountData.runSpeed = 10f; // 12f - MountData.dashSpeed = 14.15f; // 18.5f - MountData.acceleration = 0.13f; // 0.2f + // Attack + MountData.abilityCooldown = 12; - MountData.fatigueMax = 0; - MountData.flightTimeMax = 600; + // Horizontal movement + MountData.runSpeed = 10f; + MountData.dashSpeed = 14.15f; + MountData.acceleration = 0.2f; + + // Vertical movement MountData.fallDamage = 0f; - - MountData.jumpHeight = 10; + MountData.flightTimeMax = 600; MountData.jumpSpeed = 4f; - MountData.blockExtraJumps = false; - MountData.constantJump = false; + // Frames and offsets MountData.totalFrames = 12; - MountData.heightBoost = 44; + MountData.heightBoost = 32; int[] array = new int[MountData.totalFrames]; for (int i = 0; i < array.Length; i++) - { - array[i] = 30; - } + array[i] = 28; + MountData.playerYOffsets = array; MountData.playerHeadOffset = MountData.heightBoost; - MountData.xOffset = 1; MountData.bodyFrame = 3; - MountData.yOffset = 0; - MountData.standingFrameCount = 1; + MountData.xOffset = 0; + MountData.yOffset = -6; MountData.standingFrameDelay = 12; MountData.standingFrameStart = 0; MountData.runningFrameCount = 5; @@ -65,7 +62,7 @@ namespace CalamityMod.Items.Mounts MountData.dashingFrameCount = MountData.flyingFrameCount; MountData.dashingFrameDelay = 5; MountData.dashingFrameStart = MountData.flyingFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.textureWidth = MountData.backTexture.Width(); MountData.textureHeight = MountData.backTexture.Height(); @@ -73,15 +70,24 @@ namespace CalamityMod.Items.Mounts } public override void UpdateEffects(Player player) { - if (Main.myPlayer == player.whoAmI && Main.rand.NextBool(260)) + if (Main.myPlayer == player.whoAmI) { - Vector2 pos = player.Center + Main.rand.NextVector2Circular(45f, 45f); - Vector2 vel = Main.rand.NextVector2Circular(15f, 15f); - int damage = (int)player.GetBestClassDamage().ApplyTo(180); - float kb = 1f; - Projectile birb = Projectile.NewProjectileDirect(new EntitySource_Parent(player), pos, vel, ModContent.ProjectileType(), damage, kb, player.whoAmI); - if (birb.whoAmI.WithinBounds(Main.maxProjectiles)) - birb.DamageType = DamageClass.Generic; + // Fires faster if there's target in range + NPC Target = player.Center.MinionHoming(800f, player, false); + if (player.mount._abilityCooldown == 0 && (Main.rand.NextBool(150) || Target != null)) + { + player.mount._abilityCooldown = MountData.abilityCooldown; + Vector2 pos = player.Center + Main.rand.NextVector2Circular(20f, 4f) + Vector2.UnitX * 18f * player.direction; + Vector2 vel = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(24f)) * Main.rand.NextFloat(-8f, -6f); + int damage = (int)player.GetBestClassDamage().ApplyTo(180); + float kb = 1f; + Projectile birb = Projectile.NewProjectileDirect(new EntitySource_Mount(player, Type), pos, vel, ModContent.ProjectileType(), damage, kb, player.whoAmI); + if (birb.whoAmI.WithinBounds(Main.maxProjectiles)) + { + birb.DamageType = DamageClass.Generic; + birb.ai[2] = 1f; + } + } } } } diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index e43938133b..f23f2c5298 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,15 +12,14 @@ namespace CalamityMod.Items.Mounts { Item.width = 64; Item.height = 64; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item3; Item.noMelee = true; Item.mountType = ModContent.MountType(); - Item.value = Item.buyPrice(platinum: 1, gold: 50); - Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Yellow; Item.Calamity().devItem = true; } diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs index 874cf573de..0397aba337 100644 --- a/Items/Mounts/Crysthamyr.cs +++ b/Items/Mounts/Crysthamyr.cs @@ -16,24 +16,26 @@ namespace CalamityMod.Items.Mounts MountData.spawnDust = 173; MountData.spawnDustNoGravity = true; MountData.buff = ModContent.BuffType(); - MountData.heightBoost = 36; - MountData.fallDamage = 0f; + + // Horizontal movement MountData.runSpeed = 5f; MountData.dashSpeed = 10f; - MountData.flightTimeMax = 750; - MountData.fatigueMax = 0; - MountData.jumpHeight = 12; - MountData.acceleration = 0.6f; - MountData.jumpSpeed = 9f; MountData.swimSpeed = 6f; + MountData.acceleration = 1f; + + // Vertical movement + MountData.fallDamage = 0f; + MountData.flightTimeMax = 750; + MountData.jumpSpeed = 12f; MountData.blockExtraJumps = true; + + // Frames and offsets MountData.totalFrames = 16; - MountData.constantJump = false; + MountData.heightBoost = 32; int[] array = new int[MountData.totalFrames]; for (int l = 0; l < array.Length; l++) - { array[l] = 30; - } + array[1] = 28; array[5] = 40; array[6] = 40; @@ -44,10 +46,10 @@ namespace CalamityMod.Items.Mounts array[12] = 28; array[14] = 28; MountData.playerYOffsets = array; - MountData.xOffset = -56; - MountData.bodyFrame = 3; - MountData.yOffset = -20; MountData.playerHeadOffset = 38; + MountData.bodyFrame = 3; + MountData.xOffset = -56; + MountData.yOffset = -22; MountData.standingFrameCount = 5; MountData.standingFrameDelay = 12; MountData.standingFrameStart = 0; @@ -67,7 +69,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.runningFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/CrysthamyrExtra"); MountData.textureWidth = MountData.backTexture.Width(); diff --git a/Items/Mounts/DraedonGamerChairMount.cs b/Items/Mounts/DraedonGamerChairMount.cs index ce820837b9..adc03e7738 100644 --- a/Items/Mounts/DraedonGamerChairMount.cs +++ b/Items/Mounts/DraedonGamerChairMount.cs @@ -17,29 +17,33 @@ namespace CalamityMod.Items.Mounts MountData.spawnDust = 182; MountData.spawnDustNoGravity = true; MountData.buff = ModContent.BuffType(); - MountData.heightBoost = 0; - MountData.flightTimeMax = int.MaxValue; - MountData.fatigueMax = int.MaxValue; - MountData.fallDamage = 0f; - MountData.usesHover = true; + + // Horizontal movement MountData.runSpeed = MovementSpeed; MountData.dashSpeed = MovementSpeed; - MountData.acceleration = MovementSpeed; MountData.swimSpeed = MovementSpeed; - MountData.jumpHeight = 8; + MountData.acceleration = MovementSpeed; + + // Vertical movement + MountData.fallDamage = 0f; + MountData.fatigueMax = int.MaxValue; + MountData.flightTimeMax = int.MaxValue; MountData.jumpSpeed = 8f; MountData.blockExtraJumps = true; - MountData.totalFrames = 5; + MountData.usesHover = true; + // Frames and offsets + MountData.totalFrames = 5; + MountData.heightBoost = 0; int[] verticalOffsets = new int[MountData.totalFrames]; for (int l = 0; l < verticalOffsets.Length; l++) verticalOffsets[l] = 0; MountData.playerYOffsets = verticalOffsets; - MountData.xOffset = 2; - MountData.bodyFrame = 3; - MountData.yOffset = 28; MountData.playerHeadOffset = 3; + MountData.bodyFrame = 3; + MountData.xOffset = 2; + MountData.yOffset = 28; MountData.standingFrameCount = 5; MountData.standingFrameDelay = 5; MountData.standingFrameStart = 0; @@ -59,7 +63,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = 5; MountData.swimFrameDelay = 5; MountData.swimFrameStart = 0; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.frontTextureGlow = ModContent.Request("CalamityMod/Items/Mounts/DraedonGamerChairMount_Glowmask"); MountData.textureWidth = MountData.frontTexture.Width(); diff --git a/Items/Mounts/ExoArmamentsKit.cs b/Items/Mounts/ExoArmamentsKit.cs new file mode 100644 index 0000000000..fb5967b861 --- /dev/null +++ b/Items/Mounts/ExoArmamentsKit.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts +{ + public class ExoArmamentsKit : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Mounts"; + public override void SetDefaults() + { + Item.width = 50; + Item.height = 44; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item94; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); + + Item.value = Item.sellPrice(gold: 5); + Item.master = true; + } + } +} diff --git a/Items/Mounts/ExoArmamentsKit.png b/Items/Mounts/ExoArmamentsKit.png new file mode 100644 index 0000000000..1e8a75fcb1 Binary files /dev/null and b/Items/Mounts/ExoArmamentsKit.png differ diff --git a/Items/Mounts/ExoTank.cs b/Items/Mounts/ExoTank.cs new file mode 100644 index 0000000000..94d45b6660 --- /dev/null +++ b/Items/Mounts/ExoTank.cs @@ -0,0 +1,356 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Mounts; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts +{ + public class ExoTank : ModMount + { + public static int DashDamage = 6000; + + public static int MaxHoverTime = 600; + + public static int MissileDamage = 1000; + public static int MissileAttackRate = 4; + public static int MissileLauncherFrameCount = 8; + public static int MissileReuseDelay = 28; // Total use time = AttackRate * FrameCount + ReuseDelay (AttackRate being the "use animation" for the clockwork weapon) + public static readonly SoundStyle MissileLaunchSound = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisApolloDash") { Volume = 0.5f }; + + public static int MinigunDamage = 400; + public static int MinigunAttackRate = 4; + public static int MinigunFrameCount = 4; + + public class ExoTankData + { + internal bool Hovering; + internal int HoverTime; + internal int MinigunFrame; + internal int MinigunFrameCounter; + internal float MinigunRotation; + + public ExoTankData() + { + Hovering = false; + HoverTime = MaxHoverTime; + MinigunFrame = 0; + MinigunFrameCounter = 0; + MinigunRotation = 0f; + } + } + + public override void SetStaticDefaults() + { + MountData.spawnDust = DustID.Platinum; + MountData.spawnDustNoGravity = true; + MountData.buff = ModContent.BuffType(); + + // Horizontal movement + MountData.runSpeed = 10f; + MountData.dashSpeed = 22.5f; + MountData.swimSpeed = 10f; + MountData.acceleration = 0.5f; + + // Vertical movement + MountData.fallDamage = 0f; + MountData.jumpHeight = 10; + MountData.jumpSpeed = 12f; + + // Frames and offsets + MountData.totalFrames = 3; + MountData.heightBoost = 80; + int[] array = new int[MountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + array[l] = 76; + + MountData.playerYOffsets = array; + MountData.playerHeadOffset = 80; + MountData.bodyFrame = 3; + MountData.xOffset = 0; + MountData.yOffset = -16; + MountData.standingFrameCount = 1; + MountData.standingFrameDelay = 12; + MountData.standingFrameStart = 0; + MountData.runningFrameCount = 3; + MountData.runningFrameDelay = 24; + MountData.runningFrameStart = 0; + MountData.flyingFrameCount = 0; + MountData.flyingFrameDelay = 0; + MountData.flyingFrameStart = 0; + MountData.inAirFrameCount = 1; + MountData.inAirFrameDelay = MountData.standingFrameDelay; + MountData.inAirFrameStart = 0; + MountData.idleFrameCount = 1; + MountData.idleFrameDelay = MountData.standingFrameDelay; + MountData.idleFrameStart = 0; + MountData.idleFrameLoop = true; + MountData.swimFrameCount = MountData.inAirFrameCount; + MountData.swimFrameDelay = MountData.inAirFrameDelay; + MountData.swimFrameStart = MountData.inAirFrameStart; + if (!Main.dedServ) + { + // back (back layer) -> backExtra (gun) -> front (launcher) -> frontExtra (front layer) + MountData.backTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_BackGun"); + MountData.backTextureExtraGlow = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_BackGunGlow"); + MountData.frontTextureGlow = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_FrontGlow"); + MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_FrontLayer"); + MountData.frontTextureExtraGlow = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_FrontLayerGlow"); + MountData.textureWidth = MountData.backTexture.Width(); + MountData.textureHeight = MountData.backTexture.Height(); + } + } + + public override void SetMount(Player player, ref bool skipDust) => player.mount._mountSpecificData = new ExoTankData(); + + public override void Dismount(Player player, ref bool skipDust) + { + foreach (Projectile proj in Main.ActiveProjectiles) + { + if (proj.owner == player.whoAmI && proj.type == ModContent.ProjectileType()) + { + proj.Kill(); + break; + } + } + } + + public override void UpdateEffects(Player player) + { + if (Main.myPlayer == player.whoAmI) + { + Mount tank = player.mount; + var data = (ExoTankData)player.mount._mountSpecificData; + ref float minigunRotation = ref data.MinigunRotation; + + // Find the closest NPC targetable by the tank + float range = 960f; // 60 tiles + int targetNPC = -1; + bool canFireLasers = true; + Vector2 gunPosition = player.Center + Vector2.UnitX * 52f * player.direction - Vector2.UnitY * 10f; + foreach (NPC target in Main.ActiveNPCs) + { + if (!target.CanBeChasedBy(tank)) + continue; + + Vector2 targetDif = target.Center - gunPosition; + float angle = MathF.Abs(targetDif.ToRotation()); + + // The tank has a base sight line of 120 degrees, equal to Toy Tank + // However, the laser cannon can only pivot up to 36 degrees and any further will not fire out lasers + if (player.direction == 1) + { + if (angle > MathHelper.ToRadians(60f)) + continue; + + if (canFireLasers && angle > MathHelper.ToRadians(18f)) + continue; + } + else + { + if (angle < MathHelper.ToRadians(120f)) + continue; + + if (canFireLasers && angle < MathHelper.ToRadians(162f)) + continue; + } + + float distance = targetDif.Length(); + if (distance < range && Collision.CanHitLine(gunPosition, 0, 0, target.position, target.width, target.height)) + { + range = distance; + targetNPC = target.whoAmI; + canFireLasers = (player.direction == 1 ? angle <= MathHelper.ToRadians(18f) : angle >= MathHelper.ToRadians(162f)); + } + } + + var source = new EntitySource_Mount(player, Type); + + // Release 3 missiles matching the animation frames + if ((int)tank._frameExtraCounter % MissileAttackRate == 0) + { + if (tank._frameExtra > 0 && tank._frameExtra < 4) + { + if (tank._frameExtra == 1) + SoundEngine.PlaySound(MissileLaunchSound, player.Center); + + for (int i = 0; i < 3; i++) + { + Vector2 rocketPos = player.Center - Vector2.UnitX * (60f - 4f * i - 6f * tank._frameExtra) * player.direction - Vector2.UnitY * (72f - 8f * i); + Vector2 rocketVel = (Vector2.UnitX * player.direction).RotatedBy(-MathHelper.PiOver4 * player.direction) * 10f; + int rocketDamage = (int)player.GetBestClassDamage().ApplyTo(MissileDamage); + float rocketKB = 1f; + Projectile.NewProjectile(source, rocketPos, rocketVel, ModContent.ProjectileType(), rocketDamage, rocketKB, player.whoAmI); + } + } + } + + if (targetNPC != -1) + { + tank._aiming = true; + if (!canFireLasers) + { + minigunRotation = 0f; + return; + } + + float idealRotation = (Main.npc[targetNPC].Center - gunPosition).SafeNormalize(Vector2.UnitX * player.direction).ToRotation(); + /* + // Cap the rotation + // EDIT: This looks jarring if you can't fire lasers and the lasers are pointless if they are shot anyway. Re-add if we wanted it to shoot something again + if (!canFireLasers) + idealRotation = (player.direction == 1 ? MathHelper.ToRadians(18f) : MathHelper.ToRadians(162f)) * MathF.Sign(idealRotation); + */ + + minigunRotation = idealRotation + (player.direction == 1 ? 0f : MathHelper.Pi); + + // Fires a bullet on every frame switch + if (data.MinigunFrameCounter % MinigunAttackRate == 0) + { + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.32f }, player.Center); + + Vector2 bulletPos = player.Center + Vector2.UnitX * 28f * player.direction - Vector2.UnitY * 10f + (idealRotation * (player.direction == 1 ? 1.33f : 1f)).ToRotationVector2() * 38f; + Vector2 bulletVel = (Main.npc[targetNPC].Center - bulletPos).SafeNormalize(Vector2.UnitX * player.direction) * Main.rand.NextFloat(15f, 16f); + int bulletDamage = (int)player.GetBestClassDamage().ApplyTo(MinigunDamage); + float bulletKB = 1f; + Projectile.NewProjectile(source, bulletPos, bulletVel, ModContent.ProjectileType(), bulletDamage, bulletKB, player.whoAmI); + + Vector2 flashPos = bulletPos + bulletVel.SafeNormalize(Vector2.Zero) * 36f * (player.direction == 1 ? 1f : 1.33f); + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(flashPos, DustID.FireworksRGB); + dust.noGravity = true; + dust.noLight = true; + dust.velocity = bulletVel.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.5f, 1f); + dust.color = Color.Lerp(Color.OrangeRed, Color.Red, Main.rand.NextFloat(0f, 0.8f)); + dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + } + // Muzzle flash + // This would be attached to the gun but the frame rate is too fast for only one to exist at a time + Projectile.NewProjectile(source, flashPos, bulletVel, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } + } + else + { + tank._aiming = false; + minigunRotation = 0f; + } + } + } + + public override bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity) + { + Mount tank = mountedPlayer.mount; + var data = (ExoTankData)tank._mountSpecificData; + + // Hover effect + // If grounded, your hover time is reset to max + ref int hoverTime = ref data.HoverTime; + ref bool hovering = ref data.Hovering; + if (state <= 1) + { + hoverTime = MaxHoverTime; + hovering = false; + } + else + { + if (mountedPlayer.controlJump && mountedPlayer.TryingToHoverDown && hoverTime > 0) + { + var source = new EntitySource_Mount(mountedPlayer, Type); + if (mountedPlayer.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + Projectile.NewProjectile(source, mountedPlayer.Bottom, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, mountedPlayer.whoAmI); + + hoverTime--; + hovering = true; + mountedPlayer.velocity.Y -= 0.4f * mountedPlayer.gravDir; + mountedPlayer.velocity.Y *= 0.9f; + if (MathF.Abs(mountedPlayer.velocity.Y) < 0.05f) + mountedPlayer.velocity.Y = 0.00001f; + } + else + hovering = false; + } + + // Ground dust as you travel (State 1 indicates running on the ground) + if (state == 1 && Math.Abs(velocity.X) > mountedPlayer.mount.RunSpeed) + { + for (int i = 0; i < 2; i++) + { + Dust ground = Dust.NewDustDirect(mountedPlayer.BottomLeft - Vector2.UnitX * 40f, mountedPlayer.width + 80, 6, DustID.Platinum); + ground.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat(-2f, 0f)); + ground.noLight = true; + ground.scale = Main.rand.NextFloat(0.2f, 0.8f); + ground.fadeIn = Main.rand.NextFloat(1f, 1.5f); + ground.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); + } + if (mountedPlayer.cMount == 0) + { + float direction = Math.Sign(velocity.X); + mountedPlayer.position += new Vector2(direction * 24f, 0f); + mountedPlayer.FloorVisuals(true); + mountedPlayer.position -= new Vector2(direction * 24f, 0f); + } + } + + // Animation frames locked to 2 states: moving and not moving + if (state != 0) + state = 1; + + // Advances weapon frames while attacking OR while not attacking but mid-animation + if (tank._aiming || (tank._frameExtraCounter >= MissileAttackRate)) + tank._frameExtraCounter++; + else if (tank._frameExtraCounter > 0f) + tank._frameExtraCounter = 0f; + + int totalUseTime = MissileReuseDelay + MissileAttackRate * MissileLauncherFrameCount; + if (tank._frameExtraCounter >= totalUseTime) + { + tank._frameExtraCounter = 0f; + tank._frameExtra = 0; + } + tank._frameExtra = (int)Utils.Remap(tank._frameExtraCounter, MissileReuseDelay, totalUseTime, 0f, MissileLauncherFrameCount, true); + + // Minigun has a separate custom frame counter + ref int minigunFrame = ref data.MinigunFrame; + ref int minigunFrameCounter = ref data.MinigunFrameCounter; + if (tank._aiming || minigunFrameCounter > 0) + minigunFrameCounter++; + + if (minigunFrameCounter >= MinigunAttackRate * MinigunFrameCount) + { + minigunFrameCounter = 0; + minigunFrame = 0; + } + minigunFrame = minigunFrameCounter / MinigunAttackRate; + return true; + } + + 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) + { + // Modify everything for backTextureExtra (minigun) and its glow + if (drawType == 1) + { + var data = (ExoTankData)drawPlayer.mount._mountSpecificData; + frame = texture.Frame(1, MinigunFrameCount, 0, data.MinigunFrame); + drawPosition += new Vector2(drawPlayer.direction == 1 ? 15f : -15f, 7f); + spriteEffects = drawPlayer.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + rotation = data.MinigunRotation; + drawOrigin = new Vector2(drawPlayer.direction == 1 ? 0f : 80f, 12f); + } + + // Frames for frontTexture (missile launcher) and its glow + if (drawType == 2) + frame = texture.Frame(1, MissileLauncherFrameCount, 0, drawPlayer.mount._frameExtra); + + return true; + } + } +} diff --git a/Items/Mounts/ExoTank_Back.png b/Items/Mounts/ExoTank_Back.png new file mode 100644 index 0000000000..d1c13b1c19 Binary files /dev/null and b/Items/Mounts/ExoTank_Back.png differ diff --git a/Items/Mounts/ExoTank_BackGun.png b/Items/Mounts/ExoTank_BackGun.png new file mode 100644 index 0000000000..c6cc2b5c8d Binary files /dev/null and b/Items/Mounts/ExoTank_BackGun.png differ diff --git a/Items/Mounts/ExoTank_BackGunGlow.png b/Items/Mounts/ExoTank_BackGunGlow.png new file mode 100644 index 0000000000..c87fa2614b Binary files /dev/null and b/Items/Mounts/ExoTank_BackGunGlow.png differ diff --git a/Items/Mounts/ExoTank_Front.png b/Items/Mounts/ExoTank_Front.png new file mode 100644 index 0000000000..55c28906a8 Binary files /dev/null and b/Items/Mounts/ExoTank_Front.png differ diff --git a/Items/Mounts/ExoTank_FrontGlow.png b/Items/Mounts/ExoTank_FrontGlow.png new file mode 100644 index 0000000000..6dab98a9ca Binary files /dev/null and b/Items/Mounts/ExoTank_FrontGlow.png differ diff --git a/Items/Mounts/ExoTank_FrontLayer.png b/Items/Mounts/ExoTank_FrontLayer.png new file mode 100644 index 0000000000..1af22c803f Binary files /dev/null and b/Items/Mounts/ExoTank_FrontLayer.png differ diff --git a/Items/Mounts/ExoTank_FrontLayerGlow.png b/Items/Mounts/ExoTank_FrontLayerGlow.png new file mode 100644 index 0000000000..b1ddb46c1b Binary files /dev/null and b/Items/Mounts/ExoTank_FrontLayerGlow.png differ diff --git a/Items/Mounts/ExoThrone.cs b/Items/Mounts/ExoThrone.cs index e88ceae633..cb2b052148 100644 --- a/Items/Mounts/ExoThrone.cs +++ b/Items/Mounts/ExoThrone.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,14 +12,14 @@ namespace CalamityMod.Items.Mounts { Item.width = 32; Item.height = 34; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item94; Item.noMelee = true; Item.mountType = ModContent.MountType(); - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Yellow; } public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.ExoChairSlowdownHotkey); diff --git a/Items/Mounts/FollyFeed.cs b/Items/Mounts/FollyFeed.cs index 903be3597d..305c3e0a48 100644 --- a/Items/Mounts/FollyFeed.cs +++ b/Items/Mounts/FollyFeed.cs @@ -12,17 +12,15 @@ namespace CalamityMod.Items.Mounts { Item.width = 34; Item.height = 36; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; - - Item.value = Item.sellPrice(gold: 20); - Item.rare = ItemRarityID.Purple; - Item.Calamity().donorItem = true; - Item.UseSound = SoundID.NPCHit51; Item.noMelee = true; Item.mountType = ModContent.MountType(); + + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; } } } diff --git a/Items/Mounts/GazeOfCrysthamyr.cs b/Items/Mounts/GazeOfCrysthamyr.cs index e456334b0e..6df431d866 100644 --- a/Items/Mounts/GazeOfCrysthamyr.cs +++ b/Items/Mounts/GazeOfCrysthamyr.cs @@ -1,7 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,26 +10,20 @@ namespace CalamityMod.Items.Mounts public class GazeOfCrysthamyr : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Mounts"; - public override void SetStaticDefaults() - { - - } public override void SetDefaults() { Item.width = 16; Item.height = 16; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.HoldUp; - - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); - Item.Calamity().donorItem = true; - Item.UseSound = SoundID.NPCHit56; Item.noMelee = true; Item.mountType = ModContent.MountType(); + + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; } public override void AddRecipes() diff --git a/Items/Mounts/Minecarts/DoGCartMount.cs b/Items/Mounts/Minecarts/DoGCartMount.cs index 175584992d..3132669334 100644 --- a/Items/Mounts/Minecarts/DoGCartMount.cs +++ b/Items/Mounts/Minecarts/DoGCartMount.cs @@ -16,52 +16,24 @@ namespace CalamityMod.Items.Mounts.Minecarts public const int SegmentCount = 18; public override void SetStaticDefaults() { - MountData.Minecart = true; - MountData.delegations = new(); + MountID.Sets.Cart[Type] = true; + Mount.SetAsMinecart(MountData, ModContent.BuffType(), MountData.frontTexture); + + // Tweaks to the base minecart data MountData.delegations.MinecartDust = CreateSparkDust; - MountID.Sets.Cart[ModContent.MountType()] = true; - MountData.spawnDust = 173; - MountData.buff = ModContent.BuffType(); - - // Movement fields. - MountData.flightTimeMax = 0; - MountData.fallDamage = 1f; - - // Mechanical Cart in vanilla uses 20f and 0.1f respectively for these fields. - MountData.runSpeed = 22f; - MountData.acceleration = 0.16f; - - MountData.jumpHeight = 16; - MountData.jumpSpeed = 5.2f; - MountData.blockExtraJumps = true; - MountData.heightBoost = 12; - - // Drawing fields. - MountData.playerYOffsets = new int[] { 6, 6, 6 }; MountData.xOffset = 2; MountData.yOffset = 12; - MountData.bodyFrame = 3; - - // Animation fields. - MountData.totalFrames = 3; - MountData.standingFrameCount = 1; - MountData.standingFrameDelay = 12; - MountData.standingFrameStart = 0; - MountData.runningFrameCount = 3; - MountData.runningFrameDelay = 12; - MountData.runningFrameStart = 0; - MountData.flyingFrameCount = 0; - MountData.flyingFrameDelay = 0; - MountData.flyingFrameStart = 0; - MountData.inAirFrameCount = 0; - MountData.inAirFrameDelay = 0; - MountData.inAirFrameStart = 0; MountData.idleFrameCount = 1; MountData.idleFrameDelay = 10; MountData.idleFrameStart = 0; - MountData.idleFrameLoop = false; - if (Main.netMode != NetmodeID.Server) + + // These are more powerful than the Cart Upgrade Kit (20f and 0.1f respectively) and using it will reduce the cart speed to that + // We can IL edit this now but we can also wait for TML to add support for the kit (copefully soon) + MountData.runSpeed = 22f; + MountData.acceleration = 0.16f; + + if (!Main.dedServ) { MountData.textureWidth = 74; MountData.textureHeight = 114; diff --git a/Items/Mounts/Minecarts/TheCartofGods.cs b/Items/Mounts/Minecarts/TheCartofGods.cs index c33e8d169c..ae22235184 100644 --- a/Items/Mounts/Minecarts/TheCartofGods.cs +++ b/Items/Mounts/Minecarts/TheCartofGods.cs @@ -15,17 +15,15 @@ namespace CalamityMod.Items.Mounts.Minecarts { Item.width = 34; Item.height = 36; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item68; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); Item.value = Item.sellPrice(gold: 30); Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - - Item.UseSound = SoundID.Item68; - Item.noMelee = true; - Item.mountType = ModContent.MountType(); } public override void AddRecipes() diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index 52aa5d8846..402c49a00d 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -19,27 +19,31 @@ namespace CalamityMod.Items.Mounts MountData.spawnDust = 109; MountData.spawnDustNoGravity = true; MountData.buff = ModContent.BuffType(); - MountData.heightBoost = 10; - MountData.fallDamage = 0f; - MountData.runSpeed = 8f; - MountData.flightTimeMax = 0; - MountData.jumpHeight = 5; - MountData.acceleration = 0.2f; - MountData.jumpSpeed = 3f; + + // Horizontal movement + MountData.runSpeed = 5.5f; MountData.swimSpeed = 0.5f; + MountData.acceleration = 0.2f; + + // Vertical movement + MountData.fallDamage = 0f; + MountData.jumpHeight = 5; + MountData.jumpSpeed = 3f; + + // Frames and offsets MountData.totalFrames = 6; + MountData.heightBoost = 10; int[] array = new int[MountData.totalFrames]; for (int l = 0; l < array.Length; l++) - { array[l] = 6; - } + array[1] = 4; array[5] = 4; MountData.playerYOffsets = array; - MountData.xOffset = 10; - MountData.bodyFrame = 3; - MountData.yOffset = -1; //done MountData.playerHeadOffset = 10; + MountData.bodyFrame = 3; + MountData.xOffset = 10; + MountData.yOffset = -1; //done MountData.standingFrameCount = 1; MountData.standingFrameDelay = 12; MountData.standingFrameStart = 0; @@ -56,7 +60,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.inAirFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.backTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/OnyxExcavatorExtra"); MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/OnyxExcavatorExtra2"); diff --git a/Items/Mounts/OnyxExcavatorKey.cs b/Items/Mounts/OnyxExcavatorKey.cs index f23e248a5e..144863c5fb 100644 --- a/Items/Mounts/OnyxExcavatorKey.cs +++ b/Items/Mounts/OnyxExcavatorKey.cs @@ -11,14 +11,14 @@ namespace CalamityMod.Items.Mounts { Item.width = 16; Item.height = 16; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.HoldUp; - Item.rare = ItemRarityID.Orange; - Item.value = Item.buyPrice(0, 9, 0, 0); Item.UseSound = SoundID.Item23; Item.noMelee = true; Item.mountType = ModContent.MountType(); + + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Mounts/PhuppersChair.cs b/Items/Mounts/PhuppersChair.cs index 91f0c9d0f1..ba514b1f01 100644 --- a/Items/Mounts/PhuppersChair.cs +++ b/Items/Mounts/PhuppersChair.cs @@ -13,28 +13,32 @@ namespace CalamityMod.Items.Mounts MountData.spawnDust = (int)CalamityDusts.Brimstone; MountData.spawnDustNoGravity = true; MountData.buff = ModContent.BuffType(); - MountData.heightBoost = 12; - MountData.flightTimeMax = int.MaxValue - 1; - MountData.fatigueMax = int.MaxValue - 1; - MountData.fallDamage = 0f; - MountData.usesHover = true; + + // Horizontal movement MountData.runSpeed = 12f; MountData.dashSpeed = 12f; MountData.acceleration = 0.2f; - MountData.jumpHeight = 10; + + // Vertical movement + MountData.fallDamage = 0f; + MountData.fatigueMax = int.MaxValue; + MountData.flightTimeMax = int.MaxValue; MountData.jumpSpeed = 4f; MountData.blockExtraJumps = true; + MountData.usesHover = true; + + // Frames and offsets MountData.totalFrames = 4; + MountData.heightBoost = 0; int[] array = new int[MountData.totalFrames]; for (int l = 0; l < array.Length; l++) - { - array[l] = 12; - } + array[l] = 0; + MountData.playerYOffsets = array; - MountData.xOffset = 1; - MountData.bodyFrame = 3; - MountData.yOffset = 0; MountData.playerHeadOffset = 18; + MountData.bodyFrame = 3; + MountData.xOffset = 0; + MountData.yOffset = 6; MountData.standingFrameCount = 4; MountData.standingFrameDelay = 4; MountData.standingFrameStart = 0; @@ -54,7 +58,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = 4; MountData.swimFrameDelay = 4; MountData.swimFrameStart = 0; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.textureWidth = MountData.backTexture.Width(); MountData.textureHeight = MountData.backTexture.Height(); diff --git a/Items/Mounts/Fabsol.cs b/Items/Mounts/PrincessSpiritinaBottle.cs similarity index 65% rename from Items/Mounts/Fabsol.cs rename to Items/Mounts/PrincessSpiritinaBottle.cs index 781964dd61..26dec65edd 100644 --- a/Items/Mounts/Fabsol.cs +++ b/Items/Mounts/PrincessSpiritinaBottle.cs @@ -1,26 +1,25 @@ -using CalamityMod.Rarities; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { - public class Fabsol : ModItem, ILocalizedModType + [LegacyName("Fabsol")] + public class PrincessSpiritinaBottle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Mounts"; public override void SetDefaults() { Item.width = 16; Item.height = 16; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item3; Item.noMelee = true; Item.mountType = ModContent.MountType(); - Item.value = Item.buyPrice(platinum: 3); - Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Yellow; Item.Calamity().devItem = true; } } diff --git a/Items/Mounts/Fabsol.png b/Items/Mounts/PrincessSpiritinaBottle.png similarity index 100% rename from Items/Mounts/Fabsol.png rename to Items/Mounts/PrincessSpiritinaBottle.png diff --git a/Items/Mounts/RimehoundMount.cs b/Items/Mounts/RimehoundMount.cs index e2d0d2da2f..91459cf03f 100644 --- a/Items/Mounts/RimehoundMount.cs +++ b/Items/Mounts/RimehoundMount.cs @@ -15,46 +15,50 @@ namespace CalamityMod.Items.Mounts MountData.spawnDust = 192; MountData.spawnDustNoGravity = true; MountData.buff = ModContent.BuffType(); - MountData.heightBoost = 36; //8 - MountData.fallDamage = 0.3f; - MountData.runSpeed = 6.5f; - MountData.flightTimeMax = 0; - MountData.jumpHeight = 16; - MountData.acceleration = 0.21f; - MountData.jumpSpeed = 7f; + + // Horizontal movement + MountData.runSpeed = 7.5f; MountData.swimSpeed = 3f; + MountData.acceleration = 0.24f; + + // Vertical movement + MountData.fallDamage = 0f; + MountData.jumpHeight = 16; + MountData.jumpSpeed = 7f; + + // Frames and offsets MountData.totalFrames = 13; + MountData.heightBoost = 32; int[] array = new int[MountData.totalFrames]; for (int l = 0; l < array.Length; l++) - { - array[l] = 28; - } - array[1] = 26; - array[4] = 26; - array[7] = 26; - array[10] = 26; + array[l] = 30; + + array[1] = 28; + array[4] = 28; + array[7] = 28; + array[10] = 28; MountData.playerYOffsets = array; - MountData.xOffset = -6; - MountData.bodyFrame = 3; - MountData.yOffset = 15; //done MountData.playerHeadOffset = 38; + MountData.bodyFrame = 3; + MountData.xOffset = -6; + MountData.yOffset = 13; //done MountData.standingFrameCount = 6; MountData.standingFrameDelay = 12; MountData.standingFrameStart = 0; MountData.runningFrameCount = MountData.standingFrameCount; - MountData.runningFrameDelay = 36; //36 + MountData.runningFrameDelay = 36; MountData.runningFrameStart = MountData.standingFrameCount; MountData.inAirFrameCount = 1; MountData.inAirFrameDelay = MountData.standingFrameDelay; MountData.inAirFrameStart = MountData.standingFrameDelay; - MountData.idleFrameCount = MountData.standingFrameCount; //done - MountData.idleFrameDelay = MountData.standingFrameDelay; //done + MountData.idleFrameCount = MountData.standingFrameCount; + MountData.idleFrameDelay = MountData.standingFrameDelay; MountData.idleFrameStart = MountData.standingFrameStart; MountData.idleFrameLoop = true; MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.inAirFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.textureWidth = MountData.backTexture.Width(); MountData.textureHeight = MountData.backTexture.Height(); diff --git a/Items/Mounts/SquishyBean.cs b/Items/Mounts/SquishyBean.cs index 9ce6f441b3..f7b1b676ee 100644 --- a/Items/Mounts/SquishyBean.cs +++ b/Items/Mounts/SquishyBean.cs @@ -10,39 +10,45 @@ namespace CalamityMod.Items.Mounts public override void SetStaticDefaults() { MountData.buff = ModContent.BuffType(); - MountData.heightBoost = 58; - MountData.fallDamage = -1; + + // Horizontal movement MountData.runSpeed = 5f; MountData.dashSpeed = 8f; - MountData.jumpHeight = 20; MountData.acceleration = 0.1f; + + // Vertical movement + MountData.fallDamage = 0f; + MountData.jumpHeight = 20; MountData.jumpSpeed = 15f; + MountData.constantJump = true; + + // Frames and offsets MountData.totalFrames = 4; - MountData.blockExtraJumps = true; + MountData.heightBoost = 42; int[] array = new int[MountData.totalFrames]; for (int l = 0; l < array.Length; l++) { switch (l) { case 0: - array[l] = 44; - break; - case 1: array[l] = 46; break; - case 2: + case 1: array[l] = 48; break; + case 2: + array[l] = 50; + break; case 3: - array[l] = 48; + array[l] = 50; break; } } MountData.playerYOffsets = array; - MountData.xOffset = 0; - MountData.bodyFrame = 3; - MountData.yOffset = 19; MountData.playerHeadOffset = 30; + MountData.bodyFrame = 3; + MountData.xOffset = 0; + MountData.yOffset = 11; MountData.standingFrameCount = 1; MountData.standingFrameDelay = 12; MountData.standingFrameStart = 0; @@ -65,7 +71,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.inAirFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.textureWidth = MountData.backTexture.Width(); MountData.textureHeight = MountData.backTexture.Height(); @@ -77,7 +83,7 @@ namespace CalamityMod.Items.Mounts if (player.velocity.Y > 0f || player.controlDown) { player.gravity = 1f; - player.maxFallSpeed = 15f; + player.maxFallSpeed = 20f; } player.noFallDmg = true; } diff --git a/Items/Mounts/SuspiciousLookingJellyBean.cs b/Items/Mounts/SuspiciousLookingJellyBean.cs index 55f9597ad6..5a06120159 100644 --- a/Items/Mounts/SuspiciousLookingJellyBean.cs +++ b/Items/Mounts/SuspiciousLookingJellyBean.cs @@ -12,15 +12,14 @@ namespace CalamityMod.Items.Mounts { Item.width = 20; Item.height = 20; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item3; Item.noMelee = true; Item.mountType = ModContent.MountType(); - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Yellow; Item.Calamity().devItem = true; } } diff --git a/Items/Mounts/TundraLeash.cs b/Items/Mounts/TundraLeash.cs index 77b8206312..ec48dd65c4 100644 --- a/Items/Mounts/TundraLeash.cs +++ b/Items/Mounts/TundraLeash.cs @@ -11,14 +11,14 @@ namespace CalamityMod.Items.Mounts { Item.width = 16; Item.height = 16; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.HoldUp; - Item.rare = ItemRarityID.Orange; - Item.value = Item.buyPrice(0, 9, 0, 0); Item.UseSound = SoundID.NPCHit56; Item.noMelee = true; Item.mountType = ModContent.MountType(); + + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/NormalityRelocator.cs b/Items/NormalityRelocator.cs index 09f7d279c7..12efc351c0 100644 --- a/Items/NormalityRelocator.cs +++ b/Items/NormalityRelocator.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Items { CreateRecipe(). AddIngredient(ItemID.RodofDiscord). + AddIngredient(ItemID.FragmentStardust, 30). AddIngredient(5). AddIngredient(10). - AddIngredient(ItemID.FragmentStardust, 30). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/PermanentBoosters/CelestialOnion.cs b/Items/PermanentBoosters/CelestialOnion.cs index 4db480cb29..255737a155 100644 --- a/Items/PermanentBoosters/CelestialOnion.cs +++ b/Items/PermanentBoosters/CelestialOnion.cs @@ -14,25 +14,31 @@ namespace CalamityMod.Items.PermanentBoosters { Item.width = 28; Item.height = 28; - Item.rare = ItemRarityID.Red; - Item.maxStack = 9999; - Item.useAnimation = 30; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item4; Item.consumable = true; + Item.maxStack = Item.CommonMaxStack; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = SoundID.Item4; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Red; } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - return !Main.masterMode && !modPlayer.extraAccessoryML; - } + public override bool CanUseItem(Player player) => !(Main.masterMode && player.extraAccessory) && !player.Calamity().extraAccessoryML; public override bool? UseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); - if (player.itemAnimation > 0 && !modPlayer.extraAccessoryML && player.itemTime == 0) + // In Master Mode, will enable Demon Heart's accessory slot if for whatever reason you don't have that yet + if (Main.masterMode) + { + if (player.itemAnimation > 0 && !player.extraAccessory && player.itemTime == 0) + { + player.itemTime = Item.useTime; + player.extraAccessory = true; + } + } + + else if (player.itemAnimation > 0 && !modPlayer.extraAccessoryML && player.itemTime == 0) { player.itemTime = Item.useTime; modPlayer.extraAccessoryML = true; diff --git a/Items/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index e5e5b5ea39..c0f69da352 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.PermanentBoosters { Item.width = 24; Item.height = 46; - Item.useAnimation = 30; - Item.rare = ItemRarityID.LightRed; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 6); + Item.rare = ItemRarityID.LightRed; } public override bool CanUseItem(Player player) => player.ConsumedManaCrystals == Player.ManaCrystalMax; diff --git a/Items/PermanentBoosters/Ectoheart.cs b/Items/PermanentBoosters/Ectoheart.cs index a681f143c6..805e79a9d5 100644 --- a/Items/PermanentBoosters/Ectoheart.cs +++ b/Items/PermanentBoosters/Ectoheart.cs @@ -1,9 +1,11 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters @@ -11,17 +13,19 @@ namespace CalamityMod.Items.PermanentBoosters public class Ectoheart : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + public override LocalizedText Tooltip => CalamityUtils.GetText($"{LocalizationCategory}.AdrenalineBoosterTooltip").WithFormatArgs(BalancingConstants.AdrenalineDamagePerBooster.ToPercent(), BalancingConstants.AdrenalineDRPerBooster.ToPercent()); + public int frameCounter = 0; public int frame = 0; public override void SetDefaults() { Item.width = 42; Item.height = 44; - Item.useAnimation = 30; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item122; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = SoundID.Item122; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 2); Item.rare = ModContent.RarityType(); Item.SetRevExclusive(); } diff --git a/Items/PermanentBoosters/ElectrolyteGelPack.cs b/Items/PermanentBoosters/ElectrolyteGelPack.cs index 7b776c5289..6cb0062b24 100644 --- a/Items/PermanentBoosters/ElectrolyteGelPack.cs +++ b/Items/PermanentBoosters/ElectrolyteGelPack.cs @@ -1,6 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters @@ -8,28 +10,22 @@ namespace CalamityMod.Items.PermanentBoosters public class ElectrolyteGelPack : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + public override LocalizedText Tooltip => CalamityUtils.GetText($"{LocalizationCategory}.AdrenalineBoosterTooltip").WithFormatArgs(BalancingConstants.AdrenalineDamagePerBooster.ToPercent(), BalancingConstants.AdrenalineDRPerBooster.ToPercent()); + public override void SetDefaults() { Item.width = 20; Item.height = 20; - Item.useAnimation = 30; - Item.rare = ItemRarityID.LightRed; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item122; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = SoundID.Item122; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.LightRed; Item.SetRevExclusive(); } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.adrenalineBoostOne) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => !player.Calamity().adrenalineBoostOne; public override bool? UseItem(Player player) { diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index 8ca9f5c3e3..42da23b4b1 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.PermanentBoosters { Item.width = 42; Item.height = 44; - Item.useAnimation = 30; - Item.rare = ItemRarityID.Red; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 18); + Item.rare = ItemRarityID.Red; } public override bool CanUseItem(Player player) => player.ConsumedManaCrystals == Player.ManaCrystalMax; @@ -69,7 +69,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { CreateRecipe(). - AddIngredient(25). + AddIngredient(10). AddIngredient(ItemID.FragmentNebula, 20). AddIngredient(ItemID.FallenStar, 20). AddTile(TileID.LunarCraftingStation). diff --git a/Items/PermanentBoosters/InfernalBlood.cs b/Items/PermanentBoosters/InfernalBlood.cs index 0b73bb66cf..0cc4bad22c 100644 --- a/Items/PermanentBoosters/InfernalBlood.cs +++ b/Items/PermanentBoosters/InfernalBlood.cs @@ -1,6 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters @@ -8,16 +10,18 @@ namespace CalamityMod.Items.PermanentBoosters public class InfernalBlood : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + public override LocalizedText Tooltip => CalamityUtils.GetText($"{LocalizationCategory}.RageBoosterTooltip").WithFormatArgs(BalancingConstants.RageDurationPerBooster.FramesToSeconds()); + public override void SetDefaults() { Item.width = 20; Item.height = 20; - Item.useAnimation = 30; - Item.rare = ItemRarityID.Yellow; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item122; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = SoundID.Item122; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Yellow; Item.SetRevExclusive(); } diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index 9c16fc46b7..974b0cbc05 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -29,12 +29,12 @@ namespace CalamityMod.Items.PermanentBoosters { Item.width = 32; Item.height = 36; - Item.useAnimation = 30; - Item.rare = ItemRarityID.Yellow; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = UseSound; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = UseSound; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 30); + Item.rare = ItemRarityID.Yellow; } public override bool CanUseItem(Player player) => player.ConsumedLifeFruit == Player.LifeFruitMax; @@ -71,7 +71,6 @@ namespace CalamityMod.Items.PermanentBoosters { CreateRecipe(). AddIngredient(ItemID.LifeFruit, 5). - AddIngredient(5). AddIngredient(5). AddIngredient(12). AddTile(TileID.MythrilAnvil). diff --git a/Items/PermanentBoosters/MushroomPlasmaRoot.cs b/Items/PermanentBoosters/MushroomPlasmaRoot.cs index ee2e863ba0..543543f06e 100644 --- a/Items/PermanentBoosters/MushroomPlasmaRoot.cs +++ b/Items/PermanentBoosters/MushroomPlasmaRoot.cs @@ -1,6 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters @@ -8,16 +10,18 @@ namespace CalamityMod.Items.PermanentBoosters public class MushroomPlasmaRoot : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + public override LocalizedText Tooltip => CalamityUtils.GetText($"{LocalizationCategory}.RageBoosterTooltip").WithFormatArgs(BalancingConstants.RageDurationPerBooster.FramesToSeconds()); + public override void SetDefaults() { Item.width = 20; Item.height = 20; - Item.useAnimation = 30; - Item.rare = ItemRarityID.Green; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item122; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = SoundID.Item122; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Green; Item.SetRevExclusive(); } diff --git a/Items/PermanentBoosters/NimbleBounder.cs b/Items/PermanentBoosters/NimbleBounder.cs index 6de4d79405..e4919d1dfb 100644 --- a/Items/PermanentBoosters/NimbleBounder.cs +++ b/Items/PermanentBoosters/NimbleBounder.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters @@ -9,28 +10,28 @@ namespace CalamityMod.Items.PermanentBoosters public class NimbleBounder : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + + public static float MoveSpeedBoost = 0.05f; + public static float JumpSpeedBoost = 0.25f; // This also amounts to 5% so the tooltip is shared with movement speed + public static float AccelerationBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), AccelerationBoost.ToPercent()); + public override void SetDefaults() { Item.width = 20; Item.height = 20; - Item.useAnimation = 30; - Item.rare = ModContent.RarityType(); - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Zombie13; // frog sfx Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = SoundID.Zombie13; // frog sfx + Item.useStyle = ItemUseStyleID.HoldUp; + // Same price as Frog Leg, which is used to shimmer into it + Item.value = Item.sellPrice(gold: 1); + Item.rare = ModContent.RarityType(); + Item.stack = Item.CommonMaxStack; Item.Calamity().devItem = true; } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.nimbleBounderBoost) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => !player.Calamity().nimbleBounderBoost; public override bool? UseItem(Player player) { diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index 27ff4f93b4..2ec582f5fd 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -29,10 +29,10 @@ namespace CalamityMod.Items.PermanentBoosters { Item.width = 28; Item.height = 46; - Item.useAnimation = 30; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 24); Item.rare = ModContent.RarityType(); } diff --git a/Items/PermanentBoosters/RedLightningContainer.cs b/Items/PermanentBoosters/RedLightningContainer.cs index a8e7af6f2f..4690fe9d63 100644 --- a/Items/PermanentBoosters/RedLightningContainer.cs +++ b/Items/PermanentBoosters/RedLightningContainer.cs @@ -1,8 +1,10 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters @@ -10,17 +12,19 @@ namespace CalamityMod.Items.PermanentBoosters public class RedLightningContainer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + public override LocalizedText Tooltip => CalamityUtils.GetText($"{LocalizationCategory}.RageBoosterTooltip").WithFormatArgs(BalancingConstants.RageDurationPerBooster.FramesToSeconds()); + public int frameCounter = 0; public int frame = 0; public override void SetDefaults() { Item.width = 30; Item.height = 40; - Item.useAnimation = 30; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item122; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = SoundID.Item122; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Purple; Item.SetRevExclusive(); } diff --git a/Items/PermanentBoosters/SacredStrawberry.cs b/Items/PermanentBoosters/SacredStrawberry.cs index 6febeb79b7..d6e040021e 100644 --- a/Items/PermanentBoosters/SacredStrawberry.cs +++ b/Items/PermanentBoosters/SacredStrawberry.cs @@ -32,11 +32,11 @@ namespace CalamityMod.Items.PermanentBoosters { Item.width = 32; Item.height = 32; - Item.useAnimation = 30; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = UseSound; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = UseSound; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 48); Item.rare = ModContent.RarityType(); } @@ -74,7 +74,6 @@ namespace CalamityMod.Items.PermanentBoosters { CreateRecipe(). AddIngredient(ItemID.LifeFruit, 5). - AddIngredient(ItemID.FragmentSolar, 15). AddIngredient(5). AddIngredient(). AddTile(). diff --git a/Items/PermanentBoosters/SanguineTangerine.cs b/Items/PermanentBoosters/SanguineTangerine.cs index 9dd8f4583d..1348fda9fe 100644 --- a/Items/PermanentBoosters/SanguineTangerine.cs +++ b/Items/PermanentBoosters/SanguineTangerine.cs @@ -30,12 +30,12 @@ namespace CalamityMod.Items.PermanentBoosters { Item.width = 38; Item.height = 40; - Item.useAnimation = 30; - Item.rare = ItemRarityID.LightPurple; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = UseSound; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = UseSound; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 24); + Item.rare = ItemRarityID.LightPurple; } public override bool CanUseItem(Player player) => player.ConsumedLifeFruit == Player.LifeFruitMax; diff --git a/Items/PermanentBoosters/StarlightFuelCell.cs b/Items/PermanentBoosters/StarlightFuelCell.cs index d762aaafc5..7b84032f63 100644 --- a/Items/PermanentBoosters/StarlightFuelCell.cs +++ b/Items/PermanentBoosters/StarlightFuelCell.cs @@ -1,6 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters @@ -8,28 +10,22 @@ namespace CalamityMod.Items.PermanentBoosters public class StarlightFuelCell : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + public override LocalizedText Tooltip => CalamityUtils.GetText($"{LocalizationCategory}.AdrenalineBoosterTooltip").WithFormatArgs(BalancingConstants.AdrenalineDamagePerBooster.ToPercent(), BalancingConstants.AdrenalineDRPerBooster.ToPercent()); + public override void SetDefaults() { Item.width = 20; Item.height = 20; - Item.useAnimation = 30; - Item.rare = ItemRarityID.Lime; - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item122; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = SoundID.Item122; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Lime; Item.SetRevExclusive(); } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.adrenalineBoostTwo) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => !player.Calamity().adrenalineBoostTwo; public override bool? UseItem(Player player) { diff --git a/Items/PermanentBoosters/TaintedCloudberry.cs b/Items/PermanentBoosters/TaintedCloudberry.cs index 05eae959ae..67207446de 100644 --- a/Items/PermanentBoosters/TaintedCloudberry.cs +++ b/Items/PermanentBoosters/TaintedCloudberry.cs @@ -31,12 +31,12 @@ namespace CalamityMod.Items.PermanentBoosters { Item.width = 38; Item.height = 34; - Item.useAnimation = 30; - Item.rare = ModContent.RarityType(); - Item.useTime = 30; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = UseSound; Item.consumable = true; + Item.useAnimation = Item.useTime = 30; + Item.UseSound = UseSound; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.sellPrice(gold: 36); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ConsumedLifeFruit == Player.LifeFruitMax; @@ -74,8 +74,7 @@ namespace CalamityMod.Items.PermanentBoosters CreateRecipe(). AddIngredient(ItemID.LifeFruit, 5). AddIngredient(10). - AddIngredient(10). - AddIngredient(20). + AddIngredient(8). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Pets/AbyssShellFossil.cs b/Items/Pets/AbyssShellFossil.cs index 617e861792..d53bc07968 100644 --- a/Items/Pets/AbyssShellFossil.cs +++ b/Items/Pets/AbyssShellFossil.cs @@ -13,19 +13,10 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.width = 42; - Item.height = 30; - Item.damage = 0; - Item.useAnimation = 20; - Item.useTime = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(platinum: 1); Item.rare = ItemRarityID.Cyan; Item.Calamity().devItem = true; - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - Item.UseSound = SoundID.Item2; } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Pets/BearsEye.cs b/Items/Pets/BearsEye.cs index 866b98d124..40354beb89 100644 --- a/Items/Pets/BearsEye.cs +++ b/Items/Pets/BearsEye.cs @@ -11,26 +11,14 @@ namespace CalamityMod.Items.Pets public class BearsEye : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Pets"; - public override void SetStaticDefaults() - { - } + 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.value = Item.sellPrice(platinum: 1); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.UseSound = SoundID.Meowmere; + Item.value = Item.buyPrice(platinum: 5); // Sold by Bandit Item.rare = ItemRarityID.Pink; Item.Calamity().devItem = true; - - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - Item.UseSound = SoundID.Meowmere; } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Pets/BloodyVein.cs b/Items/Pets/BloodyVein.cs index 5fbbf788f6..54c1fa0643 100644 --- a/Items/Pets/BloodyVein.cs +++ b/Items/Pets/BloodyVein.cs @@ -12,18 +12,9 @@ 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.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.NPCHit9; - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.buyPrice(gold: 4); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; } diff --git a/Items/Pets/BrimstoneJewel.cs b/Items/Pets/BrimstoneJewel.cs index 626badc779..0156aab59e 100644 --- a/Items/Pets/BrimstoneJewel.cs +++ b/Items/Pets/BrimstoneJewel.cs @@ -13,11 +13,8 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.ZephyrFish); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.sellPrice(gold: 40); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 20); Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/CharredRelic.cs b/Items/Pets/CharredRelic.cs index cd0cab660c..09c9cc2738 100644 --- a/Items/Pets/CharredRelic.cs +++ b/Items/Pets/CharredRelic.cs @@ -12,15 +12,11 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.ZephyrFish); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.sellPrice(gold: 4); - Item.rare = ItemRarityID.Red; - Item.Calamity().devItem = true; - + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.NPCHit51; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Pink; + Item.Calamity().devItem = true; } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Pets/ChromaticOrb.cs b/Items/Pets/ChromaticOrb.cs index facd96bac2..8afc7f6cb3 100644 --- a/Items/Pets/ChromaticOrb.cs +++ b/Items/Pets/ChromaticOrb.cs @@ -12,11 +12,8 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.WispinaBottle); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.sellPrice(gold: 3); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 10); Item.rare = ItemRarityID.Cyan; Item.Calamity().donorItem = true; } diff --git a/Items/Pets/CosmicPlushie.cs b/Items/Pets/CosmicPlushie.cs index cb08a601c2..8de7642381 100644 --- a/Items/Pets/CosmicPlushie.cs +++ b/Items/Pets/CosmicPlushie.cs @@ -13,18 +13,9 @@ 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.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.Meowmere; - - Item.value = Item.sellPrice(gold: 7); + Item.value = Item.sellPrice(gold: 7); // Terry reference Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/EnchantedButterfly.cs b/Items/Pets/EnchantedButterfly.cs index 2d12c7f2aa..1fb32b541d 100644 --- a/Items/Pets/EnchantedButterfly.cs +++ b/Items/Pets/EnchantedButterfly.cs @@ -13,12 +13,9 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.WispinaBottle); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.sellPrice(gold: 1); - Item.rare = ItemRarityID.Pink; + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; } diff --git a/Items/Pets/ForgottenDragonEgg.cs b/Items/Pets/ForgottenDragonEgg.cs index 9d17706a8c..ef80bee193 100644 --- a/Items/Pets/ForgottenDragonEgg.cs +++ b/Items/Pets/ForgottenDragonEgg.cs @@ -13,11 +13,8 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.ZephyrFish); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.sellPrice(gold: 30); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 20); Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/FoxDrive.cs b/Items/Pets/FoxDrive.cs index ad8971c6d8..bdd6efc790 100644 --- a/Items/Pets/FoxDrive.cs +++ b/Items/Pets/FoxDrive.cs @@ -13,12 +13,9 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.ZephyrFish); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.expert = true; - - Item.value = Item.sellPrice(gold: 30); + Item.value = Item.sellPrice(gold: 20); Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/GeyserShell.cs b/Items/Pets/GeyserShell.cs index cb7b110649..10d9d9b507 100644 --- a/Items/Pets/GeyserShell.cs +++ b/Items/Pets/GeyserShell.cs @@ -10,23 +10,12 @@ namespace CalamityMod.Items.Pets public class GeyserShell : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Pets"; - public override void SetStaticDefaults() - { - } + 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.value = Item.sellPrice(0, 1, 50, 0); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - Item.rare = ItemRarityID.LightPurple; - Item.UseSound = SoundID.Item2; + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Pink; } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Pets/HermitsBoxofOneHundredMedicines.cs b/Items/Pets/HermitsBoxofOneHundredMedicines.cs index 1c0be6bd28..c6888f7d9b 100644 --- a/Items/Pets/HermitsBoxofOneHundredMedicines.cs +++ b/Items/Pets/HermitsBoxofOneHundredMedicines.cs @@ -15,18 +15,9 @@ 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.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.Item3; - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.buyPrice(gold: 5); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.LightRed; Item.Calamity().devItem = true; } diff --git a/Items/Pets/JoyfulHeart.cs b/Items/Pets/JoyfulHeart.cs index f11ddda78b..ed6617fa09 100644 --- a/Items/Pets/JoyfulHeart.cs +++ b/Items/Pets/JoyfulHeart.cs @@ -10,26 +10,13 @@ namespace CalamityMod.Items.Pets public class JoyfulHeart : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Pets"; - public override void SetStaticDefaults() - { - } + 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.value = Item.sellPrice(gold: 1); - Item.rare = ItemRarityID.Pink; + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 1); // "Common drop" pet price (Monster Meat) + Item.rare = ItemRarityID.Orange; Item.Calamity().devItem = true; - - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - Item.UseSound = SoundID.Item2; } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Pets/Levi.cs b/Items/Pets/Levi.cs index d9d79ee34a..567418d2f4 100644 --- a/Items/Pets/Levi.cs +++ b/Items/Pets/Levi.cs @@ -13,11 +13,8 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.ZephyrFish); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.sellPrice(gold: 40); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 20); Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/LittleLight.cs b/Items/Pets/LittleLight.cs index 8d7c755567..88849ed7ff 100644 --- a/Items/Pets/LittleLight.cs +++ b/Items/Pets/LittleLight.cs @@ -13,13 +13,10 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.WispinaBottle); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.Item83; - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.sellPrice(gold: 15); - Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(gold: 12); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/McNuggets.cs b/Items/Pets/McNuggets.cs index f46b3313eb..9ec90e2e81 100644 --- a/Items/Pets/McNuggets.cs +++ b/Items/Pets/McNuggets.cs @@ -13,11 +13,8 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.ZephyrFish); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.sellPrice(gold: 30); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 20); Item.rare = ModContent.RarityType(); } diff --git a/Items/Pets/PineapplePet.cs b/Items/Pets/PineapplePet.cs index 5340c86a40..c6593dd011 100644 --- a/Items/Pets/PineapplePet.cs +++ b/Items/Pets/PineapplePet.cs @@ -12,18 +12,8 @@ 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.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.UseSound = SoundID.Item2; - - Item.value = Item.buyPrice(gold: 4); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; } diff --git a/Items/Pets/PlagueCaller.cs b/Items/Pets/PlagueCaller.cs index eff8b02d2b..75d5c1f78e 100644 --- a/Items/Pets/PlagueCaller.cs +++ b/Items/Pets/PlagueCaller.cs @@ -12,10 +12,9 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.ZephyrFish); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - Item.rare = ItemRarityID.Lime; + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Yellow; } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Pets/PrimroseKeepsake.cs b/Items/Pets/PrimroseKeepsake.cs index 07925e77be..eb57f0e23f 100644 --- a/Items/Pets/PrimroseKeepsake.cs +++ b/Items/Pets/PrimroseKeepsake.cs @@ -14,17 +14,8 @@ 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.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.Item44; - Item.value = Item.sellPrice(platinum: 1); Item.rare = ItemRarityID.Purple; Item.Calamity().devItem = true; diff --git a/Items/Pets/RadiatingCrystal.cs b/Items/Pets/RadiatingCrystal.cs index d95ffca116..c796b75613 100644 --- a/Items/Pets/RadiatingCrystal.cs +++ b/Items/Pets/RadiatingCrystal.cs @@ -12,10 +12,8 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.WispinaBottle); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - Item.value = Item.sellPrice(silver: 20); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Orange; } diff --git a/Items/Pets/RomajedaOrchid.cs b/Items/Pets/RomajedaOrchid.cs index dfe1676b91..445a94c025 100644 --- a/Items/Pets/RomajedaOrchid.cs +++ b/Items/Pets/RomajedaOrchid.cs @@ -12,18 +12,9 @@ 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.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.Item44; - - Item.value = Item.buyPrice(gold: 40); + Item.value = Item.buyPrice(gold: 40); // Sold by Dryad Item.rare = ItemRarityID.Pink; Item.Calamity().devItem = true; } diff --git a/Items/Pets/RottingEyeball.cs b/Items/Pets/RottingEyeball.cs index 2764494b8a..62bc7ae7f8 100644 --- a/Items/Pets/RottingEyeball.cs +++ b/Items/Pets/RottingEyeball.cs @@ -12,19 +12,10 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - /*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 = ItemUseStyleID.Swing; - Item.noMelee = true; + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.NPCHit2; + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Orange; - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Pets/StrangeOrb.cs b/Items/Pets/StrangeOrb.cs index d0b550ecbb..d23fa98ee1 100644 --- a/Items/Pets/StrangeOrb.cs +++ b/Items/Pets/StrangeOrb.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.WispinaBottle); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Orange; } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Pets/SuspiciousLookingNOU.cs b/Items/Pets/SuspiciousLookingNOU.cs index 3c437206db..35f4e96c67 100644 --- a/Items/Pets/SuspiciousLookingNOU.cs +++ b/Items/Pets/SuspiciousLookingNOU.cs @@ -12,9 +12,8 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.WispinaBottle); - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 5); // Master Mode pet price (not Master but close enough) Item.rare = ItemRarityID.Master; } diff --git a/Items/Pets/TheEtomer.cs b/Items/Pets/TheEtomer.cs index 355db1054d..113860ec4f 100644 --- a/Items/Pets/TheEtomer.cs +++ b/Items/Pets/TheEtomer.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.Pets; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,18 +16,9 @@ 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.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.Item113; - - Item.value = Item.buyPrice(gold: 4); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Orange; Item.Calamity().devItem = true; } @@ -48,9 +39,9 @@ namespace CalamityMod.Items.Pets public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). AddRecipeGroup("AnyGoldBar", 8). - AddIngredient(). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Pets/ThiefsDime.cs b/Items/Pets/ThiefsDime.cs index cd11c961fa..23df38caf0 100644 --- a/Items/Pets/ThiefsDime.cs +++ b/Items/Pets/ThiefsDime.cs @@ -12,12 +12,9 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.CloneDefaults(ItemID.WispinaBottle); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.CoinPickup; - Item.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); - - Item.value = Item.sellPrice(gold: 20); //Buy price of 1 Platinum + Item.value = Item.buyPrice(platinum: 1); // Sold by Bandit Item.rare = ItemRarityID.Pink; } diff --git a/Items/Pets/TrashmanTrashcan.cs b/Items/Pets/TrashmanTrashcan.cs index 8daf1ec4dd..41b7aaffcf 100644 --- a/Items/Pets/TrashmanTrashcan.cs +++ b/Items/Pets/TrashmanTrashcan.cs @@ -10,23 +10,13 @@ namespace CalamityMod.Items.Pets public class TrashmanTrashcan : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Pets"; - public override void SetStaticDefaults() - { - } + 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.shoot = ModContent.ProjectileType(); - Item.buffType = ModContent.BuffType(); + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.NPCDeath13; - Item.value = Item.sellPrice(gold: 1); - Item.rare = ItemRarityID.Pink; + Item.value = Item.sellPrice(gold: 1); // "Common drop" pet price (Monster Meat) + Item.rare = ItemRarityID.Orange; Item.Calamity().devItem = true; } diff --git a/Items/Placeables/AbyssGravel.cs b/Items/Placeables/Abyss/AbyssGravel.cs similarity index 53% rename from Items/Placeables/AbyssGravel.cs rename to Items/Placeables/Abyss/AbyssGravel.cs index c86b2612c8..ffd0cb589c 100644 --- a/Items/Placeables/AbyssGravel.cs +++ b/Items/Placeables/Abyss/AbyssGravel.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Abyss { public class AbyssGravel : ModItem, ILocalizedModType { @@ -12,25 +12,14 @@ namespace CalamityMod.Items.Placeables Item.ResearchUnlockCount = 100; } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/AbyssGravel.png b/Items/Placeables/Abyss/AbyssGravel.png similarity index 100% rename from Items/Placeables/AbyssGravel.png rename to Items/Placeables/Abyss/AbyssGravel.png diff --git a/Items/Placeables/Acidwood.cs b/Items/Placeables/Abyss/Acidwood.cs similarity index 67% rename from Items/Placeables/Acidwood.cs rename to Items/Placeables/Abyss/Acidwood.cs index e507a7fec4..629a1cdfe9 100644 --- a/Items/Placeables/Acidwood.cs +++ b/Items/Placeables/Abyss/Acidwood.cs @@ -4,7 +4,7 @@ using CalamityMod.Tiles.Abyss; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Abyss { public class Acidwood : ModItem, ILocalizedModType { @@ -15,19 +15,7 @@ namespace CalamityMod.Items.Placeables ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Wood; } - public override void SetDefaults() - { - Item.width = 26; - Item.height = 22; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { @@ -38,10 +26,12 @@ namespace CalamityMod.Items.Placeables { CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/Acidwood.png b/Items/Placeables/Abyss/Acidwood.png similarity index 100% rename from Items/Placeables/Acidwood.png rename to Items/Placeables/Abyss/Acidwood.png diff --git a/Items/Placeables/HardenedSulphurousSandstone.cs b/Items/Placeables/Abyss/HardenedSulphurousSandstone.cs similarity index 56% rename from Items/Placeables/HardenedSulphurousSandstone.cs rename to Items/Placeables/Abyss/HardenedSulphurousSandstone.cs index 2262dd8e49..b8b33e09f4 100644 --- a/Items/Placeables/HardenedSulphurousSandstone.cs +++ b/Items/Placeables/Abyss/HardenedSulphurousSandstone.cs @@ -1,6 +1,6 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Abyss { public class HardenedSulphurousSandstone : ModItem, ILocalizedModType { @@ -11,25 +11,14 @@ namespace CalamityMod.Items.Placeables ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/HardenedSulphurousSandstone.png b/Items/Placeables/Abyss/HardenedSulphurousSandstone.png similarity index 100% rename from Items/Placeables/HardenedSulphurousSandstone.png rename to Items/Placeables/Abyss/HardenedSulphurousSandstone.png diff --git a/Items/Placeables/Abyss/PlantyMush.cs b/Items/Placeables/Abyss/PlantyMush.cs new file mode 100644 index 0000000000..e747501a43 --- /dev/null +++ b/Items/Placeables/Abyss/PlantyMush.cs @@ -0,0 +1,26 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Abyss +{ + public class PlantyMush : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 20); + } + + public override void CaughtFishStack(ref int stack) + { + stack = Main.rand.Next(5, 16); + } + } +} diff --git a/Items/Placeables/PlantyMush.png b/Items/Placeables/Abyss/PlantyMush.png similarity index 100% rename from Items/Placeables/PlantyMush.png rename to Items/Placeables/Abyss/PlantyMush.png diff --git a/Items/Placeables/Abyss/PyreMantle.cs b/Items/Placeables/Abyss/PyreMantle.cs new file mode 100644 index 0000000000..d32064a979 --- /dev/null +++ b/Items/Placeables/Abyss/PyreMantle.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Abyss +{ + public class PyreMantle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); + } + } +} diff --git a/Items/Placeables/PyreMantle.png b/Items/Placeables/Abyss/PyreMantle.png similarity index 100% rename from Items/Placeables/PyreMantle.png rename to Items/Placeables/Abyss/PyreMantle.png diff --git a/Items/Placeables/Abyss/PyreMantleMolten.cs b/Items/Placeables/Abyss/PyreMantleMolten.cs new file mode 100644 index 0000000000..c33d644406 --- /dev/null +++ b/Items/Placeables/Abyss/PyreMantleMolten.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Abyss +{ + public class PyreMantleMolten : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddIngredient(ItemID.LavaBucket). + AddIngredient(25). + AddTile(TileID.Furnaces). + Register(); + } + } +} diff --git a/Items/Placeables/PyreMantleMolten.png b/Items/Placeables/Abyss/PyreMantleMolten.png similarity index 100% rename from Items/Placeables/PyreMantleMolten.png rename to Items/Placeables/Abyss/PyreMantleMolten.png diff --git a/Items/Placeables/SulphurousSand.cs b/Items/Placeables/Abyss/SulphurousSand.cs similarity index 93% rename from Items/Placeables/SulphurousSand.cs rename to Items/Placeables/Abyss/SulphurousSand.cs index 0dbe2a305f..e2b44467ba 100644 --- a/Items/Placeables/SulphurousSand.cs +++ b/Items/Placeables/Abyss/SulphurousSand.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Abyss { public class SulphurousSand : ModItem, ILocalizedModType { @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/SulphurousSand.png b/Items/Placeables/Abyss/SulphurousSand.png similarity index 100% rename from Items/Placeables/SulphurousSand.png rename to Items/Placeables/Abyss/SulphurousSand.png diff --git a/Items/Placeables/SulphurousSandstone.cs b/Items/Placeables/Abyss/SulphurousSandstone.cs similarity index 55% rename from Items/Placeables/SulphurousSandstone.cs rename to Items/Placeables/Abyss/SulphurousSandstone.cs index bcf4d5e091..2651ab1e08 100644 --- a/Items/Placeables/SulphurousSandstone.cs +++ b/Items/Placeables/Abyss/SulphurousSandstone.cs @@ -1,6 +1,6 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Abyss { public class SulphurousSandstone : ModItem, ILocalizedModType { @@ -11,25 +11,14 @@ namespace CalamityMod.Items.Placeables ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/SulphurousSandstone.png b/Items/Placeables/Abyss/SulphurousSandstone.png similarity index 100% rename from Items/Placeables/SulphurousSandstone.png rename to Items/Placeables/Abyss/SulphurousSandstone.png diff --git a/Items/Placeables/SulphurousShale.cs b/Items/Placeables/Abyss/SulphurousShale.cs similarity index 55% rename from Items/Placeables/SulphurousShale.cs rename to Items/Placeables/Abyss/SulphurousShale.cs index 50a0f85292..02282a2688 100644 --- a/Items/Placeables/SulphurousShale.cs +++ b/Items/Placeables/Abyss/SulphurousShale.cs @@ -1,6 +1,6 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Abyss { public class SulphurousShale : ModItem, ILocalizedModType { @@ -11,25 +11,14 @@ namespace CalamityMod.Items.Placeables ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/SulphurousShale.png b/Items/Placeables/Abyss/SulphurousShale.png similarity index 100% rename from Items/Placeables/SulphurousShale.png rename to Items/Placeables/Abyss/SulphurousShale.png diff --git a/Items/Placeables/Abyss/Voidstone.cs b/Items/Placeables/Abyss/Voidstone.cs new file mode 100644 index 0000000000..270cc239d0 --- /dev/null +++ b/Items/Placeables/Abyss/Voidstone.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Abyss +{ + public class Voidstone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); + } + } +} diff --git a/Items/Placeables/Voidstone.png b/Items/Placeables/Abyss/Voidstone.png similarity index 100% rename from Items/Placeables/Voidstone.png rename to Items/Placeables/Abyss/Voidstone.png diff --git a/Items/Placeables/AerialiteBrick.cs b/Items/Placeables/AerialiteBrick.cs index 4f701db9f9..b56c18c643 100644 --- a/Items/Placeables/AerialiteBrick.cs +++ b/Items/Placeables/AerialiteBrick.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -37,6 +25,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/AlgalSlateItem.cs b/Items/Placeables/AlgalSlateItem.cs deleted file mode 100644 index b6d48487fb..0000000000 --- a/Items/Placeables/AlgalSlateItem.cs +++ /dev/null @@ -1,30 +0,0 @@ -using CalamityMod.Tiles.FloralParadise; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AlgalSlateItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 999; - } - } -} diff --git a/Items/Placeables/AstralBrick.cs b/Items/Placeables/Astral/AstralBrick.cs similarity index 52% rename from Items/Placeables/AstralBrick.cs rename to Items/Placeables/Astral/AstralBrick.cs index bee343fbe7..2e24bd3977 100644 --- a/Items/Placeables/AstralBrick.cs +++ b/Items/Placeables/Astral/AstralBrick.cs @@ -1,9 +1,9 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Placeables.Walls; using Terraria.ID; -using Terraria.ModLoader; // If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" +using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class AstralBrick : ModItem, ILocalizedModType { @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -38,6 +26,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/AstralBrick.png b/Items/Placeables/Astral/AstralBrick.png similarity index 100% rename from Items/Placeables/AstralBrick.png rename to Items/Placeables/Astral/AstralBrick.png diff --git a/Items/Placeables/Astral/AstralClay.cs b/Items/Placeables/Astral/AstralClay.cs new file mode 100644 index 0000000000..d8c8e79a72 --- /dev/null +++ b/Items/Placeables/Astral/AstralClay.cs @@ -0,0 +1,18 @@ +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Astral +{ + public class AstralClay : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.ClayBlock, 1); + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/AstralClay.png b/Items/Placeables/Astral/AstralClay.png similarity index 100% rename from Items/Placeables/AstralClay.png rename to Items/Placeables/Astral/AstralClay.png diff --git a/Items/Placeables/AstralDirt.cs b/Items/Placeables/Astral/AstralDirt.cs similarity index 53% rename from Items/Placeables/AstralDirt.cs rename to Items/Placeables/Astral/AstralDirt.cs index e182fd3bbf..9aa2ba9e2e 100644 --- a/Items/Placeables/AstralDirt.cs +++ b/Items/Placeables/Astral/AstralDirt.cs @@ -1,8 +1,9 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class AstralDirt : ModItem, ILocalizedModType { @@ -10,27 +11,17 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.DirtBlock, 1); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/AstralDirt.png b/Items/Placeables/Astral/AstralDirt.png similarity index 100% rename from Items/Placeables/AstralDirt.png rename to Items/Placeables/Astral/AstralDirt.png diff --git a/Items/Placeables/AstralGrassSeeds.cs b/Items/Placeables/Astral/AstralGrassSeeds.cs similarity index 82% rename from Items/Placeables/AstralGrassSeeds.cs rename to Items/Placeables/Astral/AstralGrassSeeds.cs index a4a7907b77..526e3af882 100644 --- a/Items/Placeables/AstralGrassSeeds.cs +++ b/Items/Placeables/Astral/AstralGrassSeeds.cs @@ -4,7 +4,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class AstralGrassSeeds : ModItem, ILocalizedModType { @@ -24,12 +24,14 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; + + Item.value = Item.buyPrice(silver: 20); // Sold by Dryad; equal to Hallowed Seeds } public override bool? UseItem(Player player) { - Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); + var tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); if (tile.HasTile && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) { diff --git a/Items/Placeables/AstralGrassSeeds.png b/Items/Placeables/Astral/AstralGrassSeeds.png similarity index 100% rename from Items/Placeables/AstralGrassSeeds.png rename to Items/Placeables/Astral/AstralGrassSeeds.png diff --git a/Items/Placeables/AstralIce.cs b/Items/Placeables/Astral/AstralIce.cs similarity index 56% rename from Items/Placeables/AstralIce.cs rename to Items/Placeables/Astral/AstralIce.cs index 608a38ae5d..6d5af9419a 100644 --- a/Items/Placeables/AstralIce.cs +++ b/Items/Placeables/Astral/AstralIce.cs @@ -1,8 +1,9 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class AstralIce : ModItem, ILocalizedModType { @@ -10,28 +11,18 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.IceBlock, 1); ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/AstralIce.png b/Items/Placeables/Astral/AstralIce.png similarity index 100% rename from Items/Placeables/AstralIce.png rename to Items/Placeables/Astral/AstralIce.png diff --git a/Items/Placeables/AstralMonolith.cs b/Items/Placeables/Astral/AstralMonolith.cs similarity index 68% rename from Items/Placeables/AstralMonolith.cs rename to Items/Placeables/Astral/AstralMonolith.cs index dad285ae29..df2a693ba4 100644 --- a/Items/Placeables/AstralMonolith.cs +++ b/Items/Placeables/Astral/AstralMonolith.cs @@ -3,7 +3,7 @@ using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class AstralMonolith : ModItem, ILocalizedModType { @@ -14,19 +14,7 @@ namespace CalamityMod.Items.Placeables ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Wood; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { @@ -39,10 +27,12 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/AstralMonolith.png b/Items/Placeables/Astral/AstralMonolith.png similarity index 100% rename from Items/Placeables/AstralMonolith.png rename to Items/Placeables/Astral/AstralMonolith.png diff --git a/Items/Placeables/AstralSand.cs b/Items/Placeables/Astral/AstralSand.cs similarity index 81% rename from Items/Placeables/AstralSand.cs rename to Items/Placeables/Astral/AstralSand.cs index 2a2e4f9987..1ddc465fb5 100644 --- a/Items/Placeables/AstralSand.cs +++ b/Items/Placeables/Astral/AstralSand.cs @@ -1,8 +1,9 @@ using CalamityMod.Projectiles.Typeless; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class AstralSand : ModItem, ILocalizedModType { @@ -10,6 +11,7 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.SandBlock, 1); // +5 flat damage, equal to other sand variants ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); diff --git a/Items/Placeables/AstralSand.png b/Items/Placeables/Astral/AstralSand.png similarity index 100% rename from Items/Placeables/AstralSand.png rename to Items/Placeables/Astral/AstralSand.png diff --git a/Items/Placeables/AstralSandstone.cs b/Items/Placeables/Astral/AstralSandstone.cs similarity index 56% rename from Items/Placeables/AstralSandstone.cs rename to Items/Placeables/Astral/AstralSandstone.cs index 2537e7510e..c881b3071e 100644 --- a/Items/Placeables/AstralSandstone.cs +++ b/Items/Placeables/Astral/AstralSandstone.cs @@ -1,8 +1,9 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class AstralSandstone : ModItem, ILocalizedModType { @@ -10,28 +11,18 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.Sandstone, 1); ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/AstralSandstone.png b/Items/Placeables/Astral/AstralSandstone.png similarity index 100% rename from Items/Placeables/AstralSandstone.png rename to Items/Placeables/Astral/AstralSandstone.png diff --git a/Items/Placeables/AstralSnow.cs b/Items/Placeables/Astral/AstralSnow.cs similarity index 53% rename from Items/Placeables/AstralSnow.cs rename to Items/Placeables/Astral/AstralSnow.cs index 1da3544eb5..8b791c569c 100644 --- a/Items/Placeables/AstralSnow.cs +++ b/Items/Placeables/Astral/AstralSnow.cs @@ -1,8 +1,9 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class AstralSnow : ModItem, ILocalizedModType { @@ -10,27 +11,17 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.SnowBlock, 1); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/AstralSnow.png b/Items/Placeables/Astral/AstralSnow.png similarity index 100% rename from Items/Placeables/AstralSnow.png rename to Items/Placeables/Astral/AstralSnow.png diff --git a/Items/Placeables/AstralStone.cs b/Items/Placeables/Astral/AstralStone.cs similarity index 53% rename from Items/Placeables/AstralStone.cs rename to Items/Placeables/Astral/AstralStone.cs index 81e70c31ad..32e793a428 100644 --- a/Items/Placeables/AstralStone.cs +++ b/Items/Placeables/Astral/AstralStone.cs @@ -1,8 +1,9 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class AstralStone : ModItem, ILocalizedModType { @@ -10,27 +11,17 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.StoneBlock, 1); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/AstralStone.png b/Items/Placeables/Astral/AstralStone.png similarity index 100% rename from Items/Placeables/AstralStone.png rename to Items/Placeables/Astral/AstralStone.png diff --git a/Items/Placeables/CelestialRemains.cs b/Items/Placeables/Astral/CelestialRemains.cs similarity index 72% rename from Items/Placeables/CelestialRemains.cs rename to Items/Placeables/Astral/CelestialRemains.cs index c597021aad..5c5a398db9 100644 --- a/Items/Placeables/CelestialRemains.cs +++ b/Items/Placeables/Astral/CelestialRemains.cs @@ -4,7 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { [LegacyName("AstralFossil")] public class CelestialRemains : ModItem, ILocalizedModType @@ -13,23 +13,11 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 200; + ItemID.Sets.ExtractinatorMode[Type] = Type; 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; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void ExtractinatorUse(int extractinatorBlockType, ref int resultType, ref int resultStack) { @@ -38,13 +26,13 @@ namespace CalamityMod.Items.Placeables When Astrum Deus has been defeated, it will give Astral Ore */ - bool twoMechsDowned = - (NPC.downedMechBoss1 && NPC.downedMechBoss2 && !NPC.downedMechBoss3) || - (NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedMechBoss1) || - (NPC.downedMechBoss3 && NPC.downedMechBoss1 && !NPC.downedMechBoss2) || - (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3); + var twoMechsDowned = + NPC.downedMechBoss1 && NPC.downedMechBoss2 && !NPC.downedMechBoss3 || + NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedMechBoss1 || + NPC.downedMechBoss3 && NPC.downedMechBoss1 && !NPC.downedMechBoss2 || + NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3; - float val = Main.rand.NextFloat(100); + var val = Main.rand.NextFloat(100); if (val < 20f) { resultType = ItemID.CopperCoin; @@ -132,22 +120,22 @@ namespace CalamityMod.Items.Placeables } else if (val < 85.03f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre : ItemID.MythrilOre; resultStack = Main.rand.Next(1, 17); } else if (val < 87.03f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre : ItemID.OrichalcumOre; resultStack = Main.rand.Next(1, 17); } else if (val < 88.78f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre : ItemID.AdamantiteOre; resultStack = Main.rand.Next(1, 17); } else if (val < 89.53f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } else if (DownedBossSystem.downedAstrumDeus) @@ -162,6 +150,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/CelestialRemains.png b/Items/Placeables/Astral/CelestialRemains.png similarity index 100% rename from Items/Placeables/CelestialRemains.png rename to Items/Placeables/Astral/CelestialRemains.png diff --git a/Items/Placeables/HardenedAstralSand.cs b/Items/Placeables/Astral/HardenedAstralSand.cs similarity index 56% rename from Items/Placeables/HardenedAstralSand.cs rename to Items/Placeables/Astral/HardenedAstralSand.cs index ba66ae62c3..eac6e9ff3c 100644 --- a/Items/Placeables/HardenedAstralSand.cs +++ b/Items/Placeables/Astral/HardenedAstralSand.cs @@ -1,7 +1,8 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { public class HardenedAstralSand : ModItem, ILocalizedModType { @@ -9,28 +10,18 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.HardenedSand, 1); ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/HardenedAstralSand.png b/Items/Placeables/Astral/HardenedAstralSand.png similarity index 100% rename from Items/Placeables/HardenedAstralSand.png rename to Items/Placeables/Astral/HardenedAstralSand.png diff --git a/Items/Placeables/NovaeSlag.cs b/Items/Placeables/Astral/NovaeSlag.cs similarity index 68% rename from Items/Placeables/NovaeSlag.cs rename to Items/Placeables/Astral/NovaeSlag.cs index 78983dd0f0..b78942be81 100644 --- a/Items/Placeables/NovaeSlag.cs +++ b/Items/Placeables/Astral/NovaeSlag.cs @@ -3,7 +3,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Astral { [LegacyName("AstralSilt")] public class NovaeSlag : ModItem, ILocalizedModType @@ -12,23 +12,12 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 200; + ItemID.Sets.ExtractinatorMode[Type] = Type; 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; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void ExtractinatorUse(int extractinatorBlockType, ref int resultType, ref int resultStack) { /* @@ -36,13 +25,13 @@ namespace CalamityMod.Items.Placeables When Astrum Deus has been defeated, it will give Astral Ore */ - bool twoMechsDowned = - (NPC.downedMechBoss1 && NPC.downedMechBoss2 && !NPC.downedMechBoss3) || - (NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedMechBoss1) || - (NPC.downedMechBoss3 && NPC.downedMechBoss1 && !NPC.downedMechBoss2) || - (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3); + var twoMechsDowned = + NPC.downedMechBoss1 && NPC.downedMechBoss2 && !NPC.downedMechBoss3 || + NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedMechBoss1 || + NPC.downedMechBoss3 && NPC.downedMechBoss1 && !NPC.downedMechBoss2 || + NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3; - float val = Main.rand.NextFloat(100); + var val = Main.rand.NextFloat(100); if (val < 30f) { resultType = ItemID.CopperCoin; @@ -120,22 +109,22 @@ namespace CalamityMod.Items.Placeables } else if (val < 83.03f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre : ItemID.MythrilOre; resultStack = Main.rand.Next(1, 17); } else if (val < 85.03f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre : ItemID.OrichalcumOre; resultStack = Main.rand.Next(1, 17); } else if (val < 86.78f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre : ItemID.AdamantiteOre; resultStack = Main.rand.Next(1, 17); } else if (val < 88.53f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } else if (DownedBossSystem.downedAstrumDeus) diff --git a/Items/Placeables/NovaeSlag.png b/Items/Placeables/Astral/NovaeSlag.png similarity index 100% rename from Items/Placeables/NovaeSlag.png rename to Items/Placeables/Astral/NovaeSlag.png diff --git a/Items/Placeables/AstralClay.cs b/Items/Placeables/AstralClay.cs deleted file mode 100644 index 3cb89b4062..0000000000 --- a/Items/Placeables/AstralClay.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AstralClay : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } - } -} diff --git a/Items/Placeables/Banners/AuroraSpiritBanner.cs b/Items/Placeables/Banners/AuroraSpiritBanner.cs new file mode 100644 index 0000000000..6c47f032ef --- /dev/null +++ b/Items/Placeables/Banners/AuroraSpiritBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class AuroraSpiritBanner : BaseBanner + { + public override int BannerTileStyle => 10; + } +} diff --git a/Items/Placeables/Banners/AuroraSpiritBanner.png b/Items/Placeables/Banners/AuroraSpiritBanner.png new file mode 100644 index 0000000000..d0a3e46120 Binary files /dev/null and b/Items/Placeables/Banners/AuroraSpiritBanner.png differ diff --git a/Items/Placeables/Banners/BabyCannonballJellyfishBanner.png b/Items/Placeables/Banners/BabyCannonballJellyfishBanner.png index 6f46d7ec01..99636485b8 100644 Binary files a/Items/Placeables/Banners/BabyCannonballJellyfishBanner.png and b/Items/Placeables/Banners/BabyCannonballJellyfishBanner.png differ diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.cs b/Items/Placeables/Banners/BlindedAnglerBanner.cs deleted file mode 100644 index a8cd03e747..0000000000 --- a/Items/Placeables/Banners/BlindedAnglerBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class BlindedAnglerBanner : BaseBanner - { - public override int BannerTileStyle => 104; - } -} diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.png b/Items/Placeables/Banners/BlindedAnglerBanner.png deleted file mode 100644 index 6f56ac9128..0000000000 Binary files a/Items/Placeables/Banners/BlindedAnglerBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/CannonballJellyfishBanner.png b/Items/Placeables/Banners/CannonballJellyfishBanner.png index 29f93d3ada..88771811b0 100644 Binary files a/Items/Placeables/Banners/CannonballJellyfishBanner.png and b/Items/Placeables/Banners/CannonballJellyfishBanner.png differ diff --git a/Items/Placeables/Banners/CladCrabBanner.cs b/Items/Placeables/Banners/CladCrabBanner.cs new file mode 100644 index 0000000000..337bd4dbe9 --- /dev/null +++ b/Items/Placeables/Banners/CladCrabBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class CladCrabBanner : BaseBanner + { + public override int BannerTileStyle => 54; + } +} diff --git a/Items/Placeables/Banners/CladCrabBanner.png b/Items/Placeables/Banners/CladCrabBanner.png new file mode 100644 index 0000000000..5f33251b97 Binary files /dev/null and b/Items/Placeables/Banners/CladCrabBanner.png differ diff --git a/Items/Placeables/Banners/DraconicSwarmerBanner.cs b/Items/Placeables/Banners/DraconicSwarmerBanner.cs new file mode 100644 index 0000000000..95e5fd22b5 --- /dev/null +++ b/Items/Placeables/Banners/DraconicSwarmerBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class DraconicSwarmerBanner : BaseBanner + { + public override int BannerTileStyle => 11; + } +} diff --git a/Items/Placeables/Banners/DraconicSwarmerBanner.png b/Items/Placeables/Banners/DraconicSwarmerBanner.png new file mode 100644 index 0000000000..ca1dba613c Binary files /dev/null and b/Items/Placeables/Banners/DraconicSwarmerBanner.png differ diff --git a/Items/Placeables/Banners/ProbesnoutBanner.cs b/Items/Placeables/Banners/ProbesnoutBanner.cs new file mode 100644 index 0000000000..7ba93318b5 --- /dev/null +++ b/Items/Placeables/Banners/ProbesnoutBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class ProbesnoutBanner : BaseBanner + { + public override int BannerTileStyle => 130; + } +} diff --git a/Items/Placeables/Banners/ProbesnoutBanner.png b/Items/Placeables/Banners/ProbesnoutBanner.png new file mode 100644 index 0000000000..40c40de9f3 Binary files /dev/null and b/Items/Placeables/Banners/ProbesnoutBanner.png differ diff --git a/Items/Placeables/Banners/SeaUrchinBanner.cs b/Items/Placeables/Banners/SeaUrchinBanner.cs deleted file mode 100644 index ea66b3e083..0000000000 --- a/Items/Placeables/Banners/SeaUrchinBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class SeaUrchinBanner : BaseBanner - { - public override int BannerTileStyle => 12; - } -} diff --git a/Items/Placeables/Banners/SeaUrchinBanner.png b/Items/Placeables/Banners/SeaUrchinBanner.png deleted file mode 100644 index d5c2a2f749..0000000000 Binary files a/Items/Placeables/Banners/SeaUrchinBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/SharkoonBanner.cs b/Items/Placeables/Banners/SharkoonBanner.cs new file mode 100644 index 0000000000..a8bfa5301c --- /dev/null +++ b/Items/Placeables/Banners/SharkoonBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class SharkoonBanner : BaseBanner + { + public override int BannerTileStyle => 129; + } +} diff --git a/Items/Placeables/Banners/SharkoonBanner.png b/Items/Placeables/Banners/SharkoonBanner.png new file mode 100644 index 0000000000..6dcf32bad3 Binary files /dev/null and b/Items/Placeables/Banners/SharkoonBanner.png differ diff --git a/Items/Placeables/Banners/ShroombleBanner.cs b/Items/Placeables/Banners/ShroombleBanner.cs new file mode 100644 index 0000000000..5cd84c158d --- /dev/null +++ b/Items/Placeables/Banners/ShroombleBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class ShroombleBanner : BaseBanner + { + public override int BannerTileStyle => 51; + } +} diff --git a/Items/Placeables/Banners/ShroombleBanner.png b/Items/Placeables/Banners/ShroombleBanner.png new file mode 100644 index 0000000000..dff34d0223 Binary files /dev/null and b/Items/Placeables/Banners/ShroombleBanner.png differ diff --git a/Items/Placeables/Basalt.cs b/Items/Placeables/Basalt.cs deleted file mode 100644 index 487fd1f7ac..0000000000 --- a/Items/Placeables/Basalt.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class Basalt : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - } -} diff --git a/Items/Placeables/BaseTiles/BaseBanner.cs b/Items/Placeables/BaseTiles/BaseBanner.cs index ad75a29691..a4d23a93aa 100644 --- a/Items/Placeables/BaseTiles/BaseBanner.cs +++ b/Items/Placeables/BaseTiles/BaseBanner.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables public new string LocalizationCategory => "Items.Placeables"; // Override these if there are no NPCs attached to the banner. public virtual LocalizedText NPCName => NPCLoader.GetNPC(BonusNPCID).DisplayName; - public override LocalizedText DisplayName => CalamityUtils.GetText($"{LocalizationCategory}.FormattedBannerName").WithFormatArgs(NPCName.ToString()); + public override LocalizedText DisplayName => base.DisplayName.WithFormatArgs(NPCName.ToString()); public override LocalizedText Tooltip => CalamityUtils.GetText($"{LocalizationCategory}.FormattedBannerTooltip").WithFormatArgs(NPCName.ToString()); public override void SetStaticDefaults() => ItemID.Sets.KillsToBanner[Type] = BannerKillRequirement; @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Placeables // Banners usually have these values. Item.width = 10; Item.height = 24; - Item.rare = ItemRarityID.Blue; Item.value = Item.sellPrice(silver: 2); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Placeables/BrimstoneSlab.cs b/Items/Placeables/Crags/BrimstoneSlab.cs similarity index 56% rename from Items/Placeables/BrimstoneSlab.cs rename to Items/Placeables/Crags/BrimstoneSlab.cs index 1dfc29e505..9448559df3 100644 --- a/Items/Placeables/BrimstoneSlab.cs +++ b/Items/Placeables/Crags/BrimstoneSlab.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Crags { public class BrimstoneSlab : ModItem, ILocalizedModType { @@ -12,29 +12,18 @@ namespace CalamityMod.Items.Placeables 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { - CreateRecipe(25). + CreateRecipe(). AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/BrimstoneSlab.png b/Items/Placeables/Crags/BrimstoneSlab.png similarity index 100% rename from Items/Placeables/BrimstoneSlab.png rename to Items/Placeables/Crags/BrimstoneSlab.png diff --git a/Items/Placeables/BrimstoneSlag.cs b/Items/Placeables/Crags/BrimstoneSlag.cs similarity index 51% rename from Items/Placeables/BrimstoneSlag.cs rename to Items/Placeables/Crags/BrimstoneSlag.cs index 9f5e1ab97a..c21b648d0c 100644 --- a/Items/Placeables/BrimstoneSlag.cs +++ b/Items/Placeables/Crags/BrimstoneSlag.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Crags { public class BrimstoneSlag : ModItem, ILocalizedModType { @@ -12,26 +12,14 @@ namespace CalamityMod.Items.Placeables Item.ResearchUnlockCount = 100; } - public override void SetDefaults() - { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = 1000; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/BrimstoneSlag.png b/Items/Placeables/Crags/BrimstoneSlag.png similarity index 100% rename from Items/Placeables/BrimstoneSlag.png rename to Items/Placeables/Crags/BrimstoneSlag.png diff --git a/Items/Placeables/CinderBlossomSeeds.cs b/Items/Placeables/Crags/CinderBlossomSeeds.cs similarity index 78% rename from Items/Placeables/CinderBlossomSeeds.cs rename to Items/Placeables/Crags/CinderBlossomSeeds.cs index 769af80d4f..0d0506283a 100644 --- a/Items/Placeables/CinderBlossomSeeds.cs +++ b/Items/Placeables/Crags/CinderBlossomSeeds.cs @@ -4,7 +4,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Crags { public class CinderBlossomSeeds : ModItem, ILocalizedModType { @@ -24,13 +24,15 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; + + Item.value = Item.buyPrice(silver: 1, copper: 50); // Sold by Dryad; equal to Ash Grass Seeds } public override bool? UseItem(Player player) { - Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); - Tile tileAbove = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY - 1); + var tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); + var 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)) { diff --git a/Items/Placeables/CinderBlossomSeeds.png b/Items/Placeables/Crags/CinderBlossomSeeds.png similarity index 100% rename from Items/Placeables/CinderBlossomSeeds.png rename to Items/Placeables/Crags/CinderBlossomSeeds.png diff --git a/Items/Placeables/ScorchedBone.cs b/Items/Placeables/Crags/ScorchedBone.cs similarity index 56% rename from Items/Placeables/ScorchedBone.cs rename to Items/Placeables/Crags/ScorchedBone.cs index 6f141f5973..fe3a24f2be 100644 --- a/Items/Placeables/ScorchedBone.cs +++ b/Items/Placeables/Crags/ScorchedBone.cs @@ -1,10 +1,9 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.Walls; using CalamityMod.Tiles.Crags; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Crags { public class ScorchedBone : ModItem, ILocalizedModType { @@ -14,19 +13,7 @@ namespace CalamityMod.Items.Placeables Item.ResearchUnlockCount = 100; } - public override void SetDefaults() - { - Item.width = 26; - Item.height = 22; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { @@ -38,6 +25,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/ScorchedBone.png b/Items/Placeables/Crags/ScorchedBone.png similarity index 100% rename from Items/Placeables/ScorchedBone.png rename to Items/Placeables/Crags/ScorchedBone.png diff --git a/Items/Placeables/Crags/ScorchedRemains.cs b/Items/Placeables/Crags/ScorchedRemains.cs new file mode 100644 index 0000000000..71d1dcee55 --- /dev/null +++ b/Items/Placeables/Crags/ScorchedRemains.cs @@ -0,0 +1,17 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Crags +{ + public class ScorchedRemains : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/ScorchedRemains.png b/Items/Placeables/Crags/ScorchedRemains.png similarity index 100% rename from Items/Placeables/ScorchedRemains.png rename to Items/Placeables/Crags/ScorchedRemains.png diff --git a/Items/Placeables/Crags/SpineSapling.cs b/Items/Placeables/Crags/SpineSapling.cs new file mode 100644 index 0000000000..f267ec6cc3 --- /dev/null +++ b/Items/Placeables/Crags/SpineSapling.cs @@ -0,0 +1,21 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Crags +{ + public class SpineSapling : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 50); + } + } +} diff --git a/Items/Placeables/SpineSapling.png b/Items/Placeables/Crags/SpineSapling.png similarity index 100% rename from Items/Placeables/SpineSapling.png rename to Items/Placeables/Crags/SpineSapling.png diff --git a/Items/Placeables/CryonicBrick.cs b/Items/Placeables/CryonicBrick.cs index d1db1ca840..9b872e7b53 100644 --- a/Items/Placeables/CryonicBrick.cs +++ b/Items/Placeables/CryonicBrick.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,6 +24,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/CyanCoral.cs b/Items/Placeables/CyanCoral.cs deleted file mode 100644 index b5d7d106bd..0000000000 --- a/Items/Placeables/CyanCoral.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CyanCoral : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.rare = ItemRarityID.Blue; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - - //public override void AddRecipes() - //{ - // CreateRecipe(4). - // AddIngredient(ItemID.PinkPearl). - // AddTile(TileID.HeavyWorkBench). - // Register(); - //} - } -} diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs index 0604c1ddbf..eb8ac2a272 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs index aee6927c2b..3cb75d20c4 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs index c190137e4d..1b72d06bca 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs index 6b6e9fccf6..1695104f5d 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; -using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -10,17 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - Item.height = 28; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.rare = ModContent.RarityType(); - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); // Non-standard Draedon's furniture: uses Door prices } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs index c9461905c3..8ac697a82b 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs index 974ec83b61..ae67faa15c 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs index 00c63cb85f..68e75267d4 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs index 630222369e..0664d6499a 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs b/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs index 3d0c857aca..ee7d778490 100644 --- a/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs +++ b/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/AgedSecurityChest.cs b/Items/Placeables/DraedonStructures/AgedSecurityChest.cs index 0164754745..b6aeef20a6 100644 --- a/Items/Placeables/DraedonStructures/AgedSecurityChest.cs +++ b/Items/Placeables/DraedonStructures/AgedSecurityChest.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; -using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,18 +11,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 26; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 14; - Item.rare = ModContent.RarityType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 500; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); // Non-standard Draedon's furniture: uses Chest prices } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedBiolightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/AgedBiolightItem.cs new file mode 100644 index 0000000000..e3ad0a0963 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/AgedBiolightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class AgedBiolightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedBiolightItem.png b/Items/Placeables/DraedonStructures/CagedLights/AgedBiolightItem.png new file mode 100644 index 0000000000..112725a391 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/AgedBiolightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedBlacklightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/AgedBlacklightItem.cs new file mode 100644 index 0000000000..01fe0c1414 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/AgedBlacklightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class AgedBlacklightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedBlacklightItem.png b/Items/Placeables/DraedonStructures/CagedLights/AgedBlacklightItem.png new file mode 100644 index 0000000000..9888b67359 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/AgedBlacklightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedCinderlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/AgedCinderlightItem.cs new file mode 100644 index 0000000000..6ba967638c --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/AgedCinderlightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class AgedCinderlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedCinderlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/AgedCinderlightItem.png new file mode 100644 index 0000000000..6e80a46118 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/AgedCinderlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedFlamelightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/AgedFlamelightItem.cs new file mode 100644 index 0000000000..e8115a6183 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/AgedFlamelightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class AgedFlamelightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedFlamelightItem.png b/Items/Placeables/DraedonStructures/CagedLights/AgedFlamelightItem.png new file mode 100644 index 0000000000..b31e326f99 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/AgedFlamelightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedFloodlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/AgedFloodlightItem.cs new file mode 100644 index 0000000000..14e217ff4d --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/AgedFloodlightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class AgedFloodlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedFloodlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/AgedFloodlightItem.png new file mode 100644 index 0000000000..b4772c0901 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/AgedFloodlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedFrostlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/AgedFrostlightItem.cs new file mode 100644 index 0000000000..b2dafd8ec7 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/AgedFrostlightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class AgedFrostlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedFrostlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/AgedFrostlightItem.png new file mode 100644 index 0000000000..3a5acca817 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/AgedFrostlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedLablightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/AgedLablightItem.cs new file mode 100644 index 0000000000..fe90044853 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/AgedLablightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class AgedLablightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/AgedLablightItem.png b/Items/Placeables/DraedonStructures/CagedLights/AgedLablightItem.png new file mode 100644 index 0000000000..1b6a2ba61e Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/AgedLablightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedBiolightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/CagedBiolightItem.cs new file mode 100644 index 0000000000..5c5b4d1c24 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/CagedBiolightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class CagedBiolightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(2). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedBiolightItem.png b/Items/Placeables/DraedonStructures/CagedLights/CagedBiolightItem.png new file mode 100644 index 0000000000..06a50f85c6 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/CagedBiolightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedBlacklightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/CagedBlacklightItem.cs new file mode 100644 index 0000000000..200edbe195 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/CagedBlacklightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class CagedBlacklightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(2). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedBlacklightItem.png b/Items/Placeables/DraedonStructures/CagedLights/CagedBlacklightItem.png new file mode 100644 index 0000000000..f3d2a4c1fd Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/CagedBlacklightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedCinderlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/CagedCinderlightItem.cs new file mode 100644 index 0000000000..9ba814cd9d --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/CagedCinderlightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class CagedCinderlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(2). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedCinderlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/CagedCinderlightItem.png new file mode 100644 index 0000000000..838dcd7805 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/CagedCinderlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedFlamelightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/CagedFlamelightItem.cs new file mode 100644 index 0000000000..d152d30995 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/CagedFlamelightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class CagedFlamelightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(2). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedFlamelightItem.png b/Items/Placeables/DraedonStructures/CagedLights/CagedFlamelightItem.png new file mode 100644 index 0000000000..bd0718dde3 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/CagedFlamelightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedFloodlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/CagedFloodlightItem.cs new file mode 100644 index 0000000000..6cc84ad544 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/CagedFloodlightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class CagedFloodlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(2). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedFloodlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/CagedFloodlightItem.png new file mode 100644 index 0000000000..739d78c791 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/CagedFloodlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedFrostlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/CagedFrostlightItem.cs new file mode 100644 index 0000000000..d5a579cba8 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/CagedFrostlightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class CagedFrostlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(2). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedFrostlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/CagedFrostlightItem.png new file mode 100644 index 0000000000..3be7887e8e Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/CagedFrostlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedLablightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/CagedLablightItem.cs new file mode 100644 index 0000000000..ac37e89196 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/CagedLablightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class CagedLablightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(2). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/CagedLablightItem.png b/Items/Placeables/DraedonStructures/CagedLights/CagedLablightItem.png new file mode 100644 index 0000000000..87766468d4 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/CagedLablightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBiolightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBiolightItem.cs new file mode 100644 index 0000000000..796752ee72 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBiolightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniAgedBiolightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBiolightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBiolightItem.png new file mode 100644 index 0000000000..1ee50556d9 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBiolightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBlacklightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBlacklightItem.cs new file mode 100644 index 0000000000..276fc58bf5 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBlacklightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniAgedBlacklightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBlacklightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBlacklightItem.png new file mode 100644 index 0000000000..07aabaef7c Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedBlacklightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedCinderlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedCinderlightItem.cs new file mode 100644 index 0000000000..f8062177b3 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedCinderlightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniAgedCinderlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedCinderlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedCinderlightItem.png new file mode 100644 index 0000000000..51f266ba9b Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedCinderlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFlamelightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFlamelightItem.cs new file mode 100644 index 0000000000..a32273a837 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFlamelightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniAgedFlamelightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFlamelightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFlamelightItem.png new file mode 100644 index 0000000000..27f2a67075 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFlamelightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFloodlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFloodlightItem.cs new file mode 100644 index 0000000000..733fcb20af --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFloodlightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniAgedFloodlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFloodlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFloodlightItem.png new file mode 100644 index 0000000000..bac129b21f Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFloodlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFrostlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFrostlightItem.cs new file mode 100644 index 0000000000..c3bec4b0d2 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFrostlightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniAgedFrostlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFrostlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFrostlightItem.png new file mode 100644 index 0000000000..090a38d6b8 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedFrostlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedLablightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedLablightItem.cs new file mode 100644 index 0000000000..fe72387478 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedLablightItem.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniAgedLablightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniAgedLablightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedLablightItem.png new file mode 100644 index 0000000000..4a1856ad85 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniAgedLablightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBiolightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBiolightItem.cs new file mode 100644 index 0000000000..598f78e7ce --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBiolightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniCagedBiolightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(). + AddIngredient(2). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBiolightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBiolightItem.png new file mode 100644 index 0000000000..859e93df34 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBiolightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBlacklightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBlacklightItem.cs new file mode 100644 index 0000000000..3be35ae9c9 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBlacklightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniCagedBlacklightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(). + AddIngredient(2). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBlacklightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBlacklightItem.png new file mode 100644 index 0000000000..b4d9ad9fa7 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedBlacklightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedCinderlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedCinderlightItem.cs new file mode 100644 index 0000000000..c4500df24d --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedCinderlightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniCagedCinderlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(). + AddIngredient(2). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedCinderlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedCinderlightItem.png new file mode 100644 index 0000000000..e800ef891a Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedCinderlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFlamelightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFlamelightItem.cs new file mode 100644 index 0000000000..3855d7833a --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFlamelightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniCagedFlamelightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(). + AddIngredient(2). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFlamelightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFlamelightItem.png new file mode 100644 index 0000000000..9cc3fa5ecf Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFlamelightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFloodlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFloodlightItem.cs new file mode 100644 index 0000000000..7b61923a07 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFloodlightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniCagedFloodlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(). + AddIngredient(2). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFloodlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFloodlightItem.png new file mode 100644 index 0000000000..26b80fd992 Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFloodlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFrostlightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFrostlightItem.cs new file mode 100644 index 0000000000..3541de0379 --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFrostlightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniCagedFrostlightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(). + AddIngredient(2). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFrostlightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFrostlightItem.png new file mode 100644 index 0000000000..fe08156b1f Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedFrostlightItem.png differ diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedLablightItem.cs b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedLablightItem.cs new file mode 100644 index 0000000000..01ec2238dd --- /dev/null +++ b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedLablightItem.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures.CagedLights +{ + public class MiniCagedLablightItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(). + AddIngredient(2). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/CagedLights/MiniCagedLablightItem.png b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedLablightItem.png new file mode 100644 index 0000000000..8d5ff1db4a Binary files /dev/null and b/Items/Placeables/DraedonStructures/CagedLights/MiniCagedLablightItem.png differ diff --git a/Items/Placeables/DraedonStructures/ChargingStationItem.cs b/Items/Placeables/DraedonStructures/ChargingStationItem.cs index c78d2704b4..8e2c01a78b 100644 --- a/Items/Placeables/DraedonStructures/ChargingStationItem.cs +++ b/Items/Placeables/DraedonStructures/ChargingStationItem.cs @@ -11,18 +11,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = Item.useTime = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); - Item.value = Item.buyPrice(gold: 50); } } } diff --git a/Items/Placeables/DraedonStructures/HazardChevronPanels.cs b/Items/Placeables/DraedonStructures/HazardChevronPanels.cs index 23380e7cc7..8f2c50de38 100644 --- a/Items/Placeables/DraedonStructures/HazardChevronPanels.cs +++ b/Items/Placeables/DraedonStructures/HazardChevronPanels.cs @@ -13,16 +13,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() @@ -36,6 +27,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs index 60339f5bf4..21c4895ca2 100644 --- a/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs +++ b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs @@ -13,18 +13,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 22; - Item.height = 32; - 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(gold: 5); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 5); Item.rare = ModContent.RarityType(); - Item.createTile = ModContent.TileType(); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs b/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs index 7cfb4c4ec8..00659a9144 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs b/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs index de0bec606d..b2b00e0f21 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs b/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs index 1a6be8f2f7..5f43354fae 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs index 5df83b46ac..57ab558052 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; -using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -10,17 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - Item.height = 28; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.rare = ModContent.RarityType(); - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); // Non-standard Draedon's furniture: uses Door prices } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs b/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs index 7e82d4105b..159d8963d2 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryPanels.cs b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs index 0329ee0bfb..ecaed07ebb 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPanels.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs @@ -13,16 +13,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() @@ -36,6 +27,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs index 3241e0f293..3f7f03ffdc 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs @@ -12,16 +12,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryPlating.cs b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs index db56ac9581..dfa54bd1c7 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPlating.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs @@ -13,16 +13,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() @@ -45,6 +36,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). diff --git a/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs b/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs index 350647a132..609390c0e7 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs b/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs index 6568a5f044..0e17e4cd72 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryShelf.cs b/Items/Placeables/DraedonStructures/LaboratoryShelf.cs index efaebcb070..f520782130 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryShelf.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryShelf.cs @@ -12,16 +12,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs b/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs index b54be8aed6..314c27815e 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs index 835fccf8ad..6b6f27ba49 100644 --- a/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs +++ b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs @@ -2,6 +2,7 @@ using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,20 +10,15 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public class PowerCellFactoryItem : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + + // Animation time parameters are more fitting to be in the tile + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((PowerCellFactory.TotalFrames * PowerCellFactory.AnimationFramerate + PowerCellFactory.BetweenCellDowntime).FramesToSeconds()); + public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = Item.useTime = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); - Item.value = Item.buyPrice(gold: 50); } } } diff --git a/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs b/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs index ae4b228a37..17ab09e2c6 100644 --- a/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs +++ b/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/RustedPipes.cs b/Items/Placeables/DraedonStructures/RustedPipes.cs index ecaedf832d..438e127b5b 100644 --- a/Items/Placeables/DraedonStructures/RustedPipes.cs +++ b/Items/Placeables/DraedonStructures/RustedPipes.cs @@ -12,16 +12,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/RustedPlating.cs b/Items/Placeables/DraedonStructures/RustedPlating.cs index 18751fb414..82e364e0dd 100644 --- a/Items/Placeables/DraedonStructures/RustedPlating.cs +++ b/Items/Placeables/DraedonStructures/RustedPlating.cs @@ -13,16 +13,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() @@ -45,6 +36,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). diff --git a/Items/Placeables/DraedonStructures/RustedShelf.cs b/Items/Placeables/DraedonStructures/RustedShelf.cs index b9343eacfd..7ae47aec6c 100644 --- a/Items/Placeables/DraedonStructures/RustedShelf.cs +++ b/Items/Placeables/DraedonStructures/RustedShelf.cs @@ -12,16 +12,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() diff --git a/Items/Placeables/DraedonStructures/SecurityChest.cs b/Items/Placeables/DraedonStructures/SecurityChest.cs index 188c8816b4..6c8cf6e194 100644 --- a/Items/Placeables/DraedonStructures/SecurityChest.cs +++ b/Items/Placeables/DraedonStructures/SecurityChest.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; -using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,18 +11,8 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 28; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 14; - Item.rare = ModContent.RarityType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 500; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); // Non-standard Draedon's furniture: uses Chest prices } public override void AddRecipes() diff --git a/Items/Placeables/EutrophicGlass.cs b/Items/Placeables/EutrophicGlass.cs deleted file mode 100644 index 126ed8ebde..0000000000 --- a/Items/Placeables/EutrophicGlass.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class EutrophicGlass : 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.createTile = ModContent.TileType(); - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - } - - public override void AddRecipes() - { - CreateRecipe(25). - AddIngredient(2). - AddTile(TileID.Furnaces). - Register(); - } - } -} diff --git a/Items/Placeables/FloralParadise/AlgalSlateItem.cs b/Items/Placeables/FloralParadise/AlgalSlateItem.cs new file mode 100644 index 0000000000..e0673c2ca8 --- /dev/null +++ b/Items/Placeables/FloralParadise/AlgalSlateItem.cs @@ -0,0 +1,18 @@ +using CalamityMod.Tiles.FloralParadise; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FloralParadise +{ + public class AlgalSlateItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/AlgalSlateItem.png b/Items/Placeables/FloralParadise/AlgalSlateItem.png similarity index 100% rename from Items/Placeables/AlgalSlateItem.png rename to Items/Placeables/FloralParadise/AlgalSlateItem.png diff --git a/Items/Placeables/FloralParadise/PeatItem.cs b/Items/Placeables/FloralParadise/PeatItem.cs new file mode 100644 index 0000000000..ea762c6b88 --- /dev/null +++ b/Items/Placeables/FloralParadise/PeatItem.cs @@ -0,0 +1,18 @@ +using CalamityMod.Tiles.FloralParadise; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FloralParadise +{ + public class PeatItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/PeatItem.png b/Items/Placeables/FloralParadise/PeatItem.png similarity index 100% rename from Items/Placeables/PeatItem.png rename to Items/Placeables/FloralParadise/PeatItem.png diff --git a/Items/Placeables/FloralParadise/PeatMossItem.cs b/Items/Placeables/FloralParadise/PeatMossItem.cs new file mode 100644 index 0000000000..40acf1915c --- /dev/null +++ b/Items/Placeables/FloralParadise/PeatMossItem.cs @@ -0,0 +1,18 @@ +using CalamityMod.Tiles.FloralParadise; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FloralParadise +{ + public class PeatMossItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/PeatMossItem.png b/Items/Placeables/FloralParadise/PeatMossItem.png similarity index 100% rename from Items/Placeables/PeatMossItem.png rename to Items/Placeables/FloralParadise/PeatMossItem.png diff --git a/Items/Placeables/FloralParadise/ScintillatingBloom.cs b/Items/Placeables/FloralParadise/ScintillatingBloom.cs new file mode 100644 index 0000000000..51516aaee2 --- /dev/null +++ b/Items/Placeables/FloralParadise/ScintillatingBloom.cs @@ -0,0 +1,19 @@ +using CalamityMod.Tiles.FloralParadise; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FloralParadise +{ + public class ScintillatingBloom : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 10; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/ScintillatingBloom.png b/Items/Placeables/FloralParadise/ScintillatingBloom.png similarity index 100% rename from Items/Placeables/ScintillatingBloom.png rename to Items/Placeables/FloralParadise/ScintillatingBloom.png diff --git a/Items/Placeables/Furniture/AbyssTreasureChest.cs b/Items/Placeables/Furniture/AbyssTreasureChest.cs index d6b6a6191a..05068c4abf 100644 --- a/Items/Placeables/Furniture/AbyssTreasureChest.cs +++ b/Items/Placeables/Furniture/AbyssTreasureChest.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Abyss; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 26; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 500; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 10); // Special: generated chest price } } } diff --git a/Items/Placeables/Furniture/AlgalPrismTorch.cs b/Items/Placeables/Furniture/AlgalPrismTorch.cs index 7780704a03..84fd680531 100644 --- a/Items/Placeables/Furniture/AlgalPrismTorch.cs +++ b/Items/Placeables/Furniture/AlgalPrismTorch.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,28 +12,15 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.WaterTorches[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } public override void SetDefaults() { - Item.width = 14; - Item.height = 16; - Item.maxStack = 9999; - Item.holdStyle = 1; - Item.noWet = false; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.value = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, true); } public override void HoldItem(Player player) diff --git a/Items/Placeables/Furniture/AstralBeaconItem.cs b/Items/Placeables/Furniture/AstralBeaconItem.cs index 0abe100357..97e7a66d44 100644 --- a/Items/Placeables/Furniture/AstralBeaconItem.cs +++ b/Items/Placeables/Furniture/AstralBeaconItem.cs @@ -1,6 +1,8 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Astral; using CalamityMod.Items.Potions; using CalamityMod.Tiles.Astral; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture @@ -8,29 +10,20 @@ namespace CalamityMod.Items.Placeables.Furniture public class AstralBeaconItem : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - } + public override void SetDefaults() { - Item.width = 32; - Item.height = 26; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 14; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Cyan; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); } + public override void AddRecipes() { CreateRecipe(). AddIngredient(5). AddIngredient(20). - AddIngredient(30). + AddIngredient(30). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Placeables/Furniture/AstralChest.cs b/Items/Placeables/Furniture/AstralChest.cs index a57eec1816..7355cbe01e 100644 --- a/Items/Placeables/Furniture/AstralChest.cs +++ b/Items/Placeables/Furniture/AstralChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Astral; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 500; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 5); // Special: biome chest price } } } diff --git a/Items/Placeables/Furniture/AstralTorch.cs b/Items/Placeables/Furniture/AstralTorch.cs index 4a537b11e8..cbe81b0ada 100644 --- a/Items/Placeables/Furniture/AstralTorch.cs +++ b/Items/Placeables/Furniture/AstralTorch.cs @@ -13,27 +13,14 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } public override void SetDefaults() { - Item.width = 14; - Item.height = 16; - Item.maxStack = 9999; - Item.holdStyle = 1; - Item.noWet = true; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.value = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, false); } public override void HoldItem(Player player) diff --git a/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.cs b/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.cs index 3a0a0c8851..46a5dab173 100644 --- a/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.cs +++ b/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.cs @@ -10,16 +10,7 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 34; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.png b/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.png index 0d0376c841..280a36f556 100644 Binary files a/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.png and b/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.png differ diff --git a/Items/Placeables/Furniture/BabyFlakCrabCage.cs b/Items/Placeables/Furniture/BabyFlakCrabCage.cs index 4968edfbc9..5b33827ab7 100644 --- a/Items/Placeables/Furniture/BabyFlakCrabCage.cs +++ b/Items/Placeables/Furniture/BabyFlakCrabCage.cs @@ -10,16 +10,7 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 34; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/BabyGhostBellJar.cs b/Items/Placeables/Furniture/BabyGhostBellJar.cs index 9f734f992e..d6adb352cc 100644 --- a/Items/Placeables/Furniture/BabyGhostBellJar.cs +++ b/Items/Placeables/Furniture/BabyGhostBellJar.cs @@ -10,16 +10,7 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 34; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs b/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs index 88f007c386..5aff1dafbd 100644 --- a/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/AstrumAureusRelic.cs b/Items/Placeables/Furniture/BossRelics/AstrumAureusRelic.cs index e428f6325b..1713751d1d 100644 --- a/Items/Placeables/Furniture/BossRelics/AstrumAureusRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/AstrumAureusRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs b/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs index f10cc394e5..790a9fb796 100644 --- a/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs b/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs index ebc31f9375..172f4cbb05 100644 --- a/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs b/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs index 1e6f5d4ff2..fcd12c6fce 100644 --- a/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/CalamitasRelic.cs b/Items/Placeables/Furniture/BossRelics/CalamitasRelic.cs index 942f26888e..4ddbc35073 100644 --- a/Items/Placeables/Furniture/BossRelics/CalamitasRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CalamitasRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs b/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs index 97bf66f10b..99b4569064 100644 --- a/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/CrabulonRelic.cs b/Items/Placeables/Furniture/BossRelics/CrabulonRelic.cs index e23af28dde..7db0d5ae9f 100644 --- a/Items/Placeables/Furniture/BossRelics/CrabulonRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CrabulonRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/CragmawMireRelic.cs b/Items/Placeables/Furniture/BossRelics/CragmawMireRelic.cs index 7e480b4b73..2be182766a 100644 --- a/Items/Placeables/Furniture/BossRelics/CragmawMireRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CragmawMireRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs b/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs index 0d794beaab..7a2f551f50 100644 --- a/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs index 794cda7d04..e521610a7a 100644 --- a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs b/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs index 43c919c1c8..59afecd89e 100644 --- a/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/DraedonRelic.cs b/Items/Placeables/Furniture/BossRelics/DraedonRelic.cs index efe67a3956..087036ac92 100644 --- a/Items/Placeables/Furniture/BossRelics/DraedonRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DraedonRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs b/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs index f71ef88673..5fb83816be 100644 --- a/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/GiantClamRelic.cs b/Items/Placeables/Furniture/BossRelics/GiantClamRelic.cs index 86edfee1f4..ab1fb1eb4a 100644 --- a/Items/Placeables/Furniture/BossRelics/GiantClamRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/GiantClamRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/GreatSandSharkRelic.cs b/Items/Placeables/Furniture/BossRelics/GreatSandSharkRelic.cs index d286aa1ab6..6bf8c99336 100644 --- a/Items/Placeables/Furniture/BossRelics/GreatSandSharkRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/GreatSandSharkRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs b/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs index 41f915c366..44ca513861 100644 --- a/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/LeviathanAnahitaRelic.cs b/Items/Placeables/Furniture/BossRelics/LeviathanAnahitaRelic.cs index 4f6b6bea5e..cddca4d4bc 100644 --- a/Items/Placeables/Furniture/BossRelics/LeviathanAnahitaRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/LeviathanAnahitaRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/MaulerRelic.cs b/Items/Placeables/Furniture/BossRelics/MaulerRelic.cs index 07b387e13c..822252d1fd 100644 --- a/Items/Placeables/Furniture/BossRelics/MaulerRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/MaulerRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/NuclearTerrorRelic.cs b/Items/Placeables/Furniture/BossRelics/NuclearTerrorRelic.cs index 0787647271..166c0693a0 100644 --- a/Items/Placeables/Furniture/BossRelics/NuclearTerrorRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/NuclearTerrorRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/OldDukeRelic.cs b/Items/Placeables/Furniture/BossRelics/OldDukeRelic.cs index 205f6be8da..b356b5d557 100644 --- a/Items/Placeables/Furniture/BossRelics/OldDukeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/OldDukeRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs index 6867125e90..c1b562624b 100644 --- a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs b/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs index 1711f71f19..7b2d3bb0b0 100644 --- a/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs b/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs index 166b62835d..3b81eeb531 100644 --- a/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs @@ -14,10 +14,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs b/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs index 8c4e3a69e0..1e9ac51fce 100644 --- a/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/ProvidenceRelic.cs b/Items/Placeables/Furniture/BossRelics/ProvidenceRelic.cs index bea8a1144a..5885ff9a77 100644 --- a/Items/Placeables/Furniture/BossRelics/ProvidenceRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/ProvidenceRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs b/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs index 528d0e53e1..395f574799 100644 --- a/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs @@ -16,10 +16,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/SignusRelic.cs b/Items/Placeables/Furniture/BossRelics/SignusRelic.cs index de0e31627c..4c92eb99f1 100644 --- a/Items/Placeables/Furniture/BossRelics/SignusRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/SignusRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.cs b/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.cs index da24cb9a5a..b458b01173 100644 --- a/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.png b/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.png index fa4f78154d..caf942e9cb 100644 Binary files a/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.png and b/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.png differ diff --git a/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs b/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs index 5a30c826f0..c77a955852 100644 --- a/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/BossRelics/YharonRelic.cs b/Items/Placeables/Furniture/BossRelics/YharonRelic.cs index cf19d69d6f..c636497845 100644 --- a/Items/Placeables/Furniture/BossRelics/YharonRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/YharonRelic.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics 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.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/Furniture/CalamityCanvas.png b/Items/Placeables/Furniture/CalamityCanvas.png new file mode 100644 index 0000000000..9c2fd66190 Binary files /dev/null and b/Items/Placeables/Furniture/CalamityCanvas.png differ diff --git a/Items/Placeables/Furniture/CalamityCanvas2023.cs b/Items/Placeables/Furniture/CalamityCanvas2023.cs new file mode 100644 index 0000000000..5c9b994545 --- /dev/null +++ b/Items/Placeables/Furniture/CalamityCanvas2023.cs @@ -0,0 +1,20 @@ +using CalamityMod.Tiles.Furniture; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class CalamityCanvas2023 : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override string Texture => "CalamityMod/Items/Placeables/Furniture/CalamityCanvas"; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = 96; + Item.height = 64; + Item.value = Item.sellPrice(silver: 40); + } + } +} diff --git a/Items/Placeables/Furniture/CalamityCanvas2024.cs b/Items/Placeables/Furniture/CalamityCanvas2024.cs new file mode 100644 index 0000000000..8174002573 --- /dev/null +++ b/Items/Placeables/Furniture/CalamityCanvas2024.cs @@ -0,0 +1,21 @@ +using CalamityMod.Tiles.Furniture; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class CalamityCanvas2024 : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override string Texture => "CalamityMod/Items/Placeables/Furniture/CalamityCanvas"; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = 96; + Item.height = 64; + Item.value = Item.sellPrice(silver: 40); + } + } +} diff --git a/Items/Placeables/Furniture/ChaosCandle.cs b/Items/Placeables/Furniture/ChaosCandle.cs index 85d79c400b..8cb883395d 100644 --- a/Items/Placeables/Furniture/ChaosCandle.cs +++ b/Items/Placeables/Furniture/ChaosCandle.cs @@ -13,25 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 16; - 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 = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, false); + Item.value = Item.sellPrice(silver: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.holdStyle = 1; } public override void HoldItem(Player player) { player.Calamity().chaosCandle = true; + + // Do not make light if wet + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) || Item.wet) + return; + 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); @@ -43,16 +37,16 @@ namespace CalamityMod.Items.Placeables.Furniture public override void PostUpdate() { - Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.85f, 0.25f, 0.25f); + if (!Item.wet) + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.85f, 0.25f, 0.25f); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.WaterCandle, 3). - AddIngredient(ItemID.SoulofNight, 3). - AddIngredient(2). + AddIngredient(ItemID.WaterCandle). AddIngredient(). + AddIngredient(2). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Placeables/Furniture/CirrusCouch.cs b/Items/Placeables/Furniture/CirrusCouch.cs index a7c10b5b24..c2b66c79ed 100644 --- a/Items/Placeables/Furniture/CirrusCouch.cs +++ b/Items/Placeables/Furniture/CirrusCouch.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,9 @@ namespace CalamityMod.Items.Placeables.Furniture 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 2, silver: 50); } } } diff --git a/Items/Placeables/Furniture/CorruptionEffigy.cs b/Items/Placeables/Furniture/CorruptionEffigy.cs index 952ae9d7ad..a658682879 100644 --- a/Items/Placeables/Furniture/CorruptionEffigy.cs +++ b/Items/Placeables/Furniture/CorruptionEffigy.cs @@ -1,5 +1,7 @@ using Terraria; +using Terraria.GameContent; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture @@ -7,20 +9,17 @@ namespace CalamityMod.Items.Placeables.Furniture public class CorruptionEffigy : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + + public static float MoveSpeedBoost = 0.1f; + public static int CritBoost = 10; // Both 10% so we only need just one in the tooltip + public static float DamageReductionLoss = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost, DamageReductionLoss.ToPercent()); + public override void SetDefaults() { - Item.width = 28; - Item.height = 32; - 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, 9, 0, 0); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Orange; - Item.createTile = ModContent.TileType(); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs index 0e1096c6be..2c39b76899 100644 --- a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs @@ -1,6 +1,8 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Crags; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +14,8 @@ 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.maxStack = 9999; - Item.useStyle = ItemUseStyleID.Swing; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 40); Item.rare = ModContent.RarityType(); } diff --git a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs index 17d8c052d6..5af066ec73 100644 --- a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.Ores; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -9,18 +11,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 28; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.rare = ItemRarityID.Orange; - Item.consumable = true; - Item.value = 0; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -32,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { CreateRecipe(). AddIngredient(10). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs index e6653a5b63..f59ea00466 100644 --- a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.FurnitureAshen; using Terraria; using Terraria.ID; @@ -10,18 +11,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 28; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.rare = ItemRarityID.Orange; - Item.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -33,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { CreateRecipe(). AddIngredient(10). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs index f1b2837430..63ab5d8089 100644 --- a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { @@ -7,17 +8,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs index 8ab452233e..585d31e782 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -13,19 +13,9 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 62; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 60); Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(platinum: 2, gold: 50); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index 229205fecf..8f6217f917 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -11,19 +11,9 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 58; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(platinum: 4); Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(platinum: 27, gold: 50); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs b/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs index d630fca520..da3038d601 100644 --- a/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs +++ b/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.FurnitureSilva; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs index 5d46aaacce..b403fe488c 100644 --- a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs +++ b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs @@ -1,4 +1,6 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +12,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 50); // This is too easy to craft to sell for 2 gold } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs b/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs index 7102134f8d..1f3116f9b6 100644 --- a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs +++ b/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs @@ -1,4 +1,6 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs index ce9464351d..016e210fb8 100644 --- a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs index 765a4bcb90..67c0ddf555 100644 --- a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs +++ b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.FurnitureProfaned; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs index 48d3cee665..105adef50b 100644 --- a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs +++ b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs index 26a24ddb01..1eac249d91 100644 --- a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs +++ b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.FurnitureVoid; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs b/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs index 8685c7336b..5f1ebc1011 100644 --- a/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); // This is REALLY too easy to craft to sell for 2 gold } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CrimsonEffigy.cs b/Items/Placeables/Furniture/CrimsonEffigy.cs index bcd700ffa9..4d1633714f 100644 --- a/Items/Placeables/Furniture/CrimsonEffigy.cs +++ b/Items/Placeables/Furniture/CrimsonEffigy.cs @@ -1,5 +1,7 @@ using Terraria; +using Terraria.GameContent; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture @@ -7,20 +9,17 @@ namespace CalamityMod.Items.Placeables.Furniture public class CrimsonEffigy : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + + public static float DamageBoost = 0.15f; + public static int DefenseBoost = 10; + public static float MaxHealthLossPercent = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), DefenseBoost, MaxHealthLossPercent.ToPercent()); + public override void SetDefaults() { - Item.width = 22; - Item.height = 32; - 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, 9, 0, 0); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Orange; - Item.createTile = ModContent.TileType(); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index 17d54c85f6..0969ede8cc 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -15,18 +15,10 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings public override void SetDefaults() { + Item.DefaultToPlaceableTile(ModContent.TileType()); 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.value = Item.sellPrice(silver: 40); Item.Calamity().donorItem = true; } @@ -71,10 +63,13 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Cooper", "CosmaticMango", "CrabBar", + "Dandy", "Dia", + "dozezoze", "enamoured", "ENNWAY", - "Fluffi", + "Flowaria", + "Fluffy", "HaguriHat", "Heart Plus Up!", "Hugekraken", @@ -89,6 +84,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Piky", "PokerFace", "Poroboros", + "Raesh", "Shade", "SharZz", "Shayy", @@ -120,7 +116,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "DarkTiny", "Demik", "DM Dokuro", - "Dominic Karma", "Done", "Doog", "drh", @@ -152,10 +147,10 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Leon", "Leviathan", "Lompl Allimath", + "Lucille Karma", "MarieArk", "Minecat", "Mrrp", - "Mr.Small", "Nao", "Neverglide", "Nincity", diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index 662a70a79b..500771f63b 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -1,4 +1,3 @@ -using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture; using Terraria; using Terraria.ID; @@ -11,26 +10,9 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 22; - Item.height = 32; - 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, 9, 0, 0); - Item.rare = ItemRarityID.Orange; - Item.createTile = ModContent.TileType(); - } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(20). - AddIngredient(10). - AddTile(TileID.Anvils). - Register(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Placeables/Furniture/ForgottenNobleStatue.cs b/Items/Placeables/Furniture/ForgottenNobleStatue.cs new file mode 100644 index 0000000000..7146286838 --- /dev/null +++ b/Items/Placeables/Furniture/ForgottenNobleStatue.cs @@ -0,0 +1,16 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class ForgottenNobleStatue : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = 60; + Item.height = 108; + } + } +} diff --git a/Items/Placeables/Furniture/ForgottenNobleStatue.png b/Items/Placeables/Furniture/ForgottenNobleStatue.png new file mode 100644 index 0000000000..f4f6ac7aa1 Binary files /dev/null and b/Items/Placeables/Furniture/ForgottenNobleStatue.png differ diff --git a/Items/Placeables/Furniture/ForgottenScholarStatue.cs b/Items/Placeables/Furniture/ForgottenScholarStatue.cs new file mode 100644 index 0000000000..d3acfb2e55 --- /dev/null +++ b/Items/Placeables/Furniture/ForgottenScholarStatue.cs @@ -0,0 +1,16 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class ForgottenScholarStatue : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = 56; + Item.height = 96; + } + } +} diff --git a/Items/Placeables/Furniture/ForgottenScholarStatue.png b/Items/Placeables/Furniture/ForgottenScholarStatue.png new file mode 100644 index 0000000000..7e27c89408 Binary files /dev/null and b/Items/Placeables/Furniture/ForgottenScholarStatue.png differ diff --git a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs index 3521c048f1..8241a48059 100644 --- a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs @@ -10,18 +10,9 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.buyPrice(gold: 4); // Sold by Witch Doctor 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 1ea7b38bb6..5db8433c56 100644 --- a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs @@ -10,18 +10,9 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.buyPrice(gold: 4); // Sold by Witch Doctor Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.cs b/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.cs index 7f2295a155..714a0f9ca6 100644 --- a/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.cs @@ -10,18 +10,9 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.buyPrice(gold: 4); // Sold by Witch Doctor Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs index 082c262a4c..1c25e24dae 100644 --- a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs @@ -10,18 +10,9 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.buyPrice(gold: 4); // Sold by Witch Doctor 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 b3c1b023f1..5ab88644b9 100644 --- a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs +++ b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs @@ -10,18 +10,9 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.buyPrice(gold: 4); // Sold by Witch Doctor Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/GloomTorch.cs b/Items/Placeables/Furniture/GloomTorch.cs index ea1615efa1..04c3af2328 100644 --- a/Items/Placeables/Furniture/GloomTorch.cs +++ b/Items/Placeables/Furniture/GloomTorch.cs @@ -11,27 +11,14 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } public override void SetDefaults() { - Item.width = 14; - Item.height = 18; - Item.maxStack = 9999; - Item.holdStyle = 1; - Item.noWet = true; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.value = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, false); } public override void HoldItem(Player player) @@ -53,7 +40,7 @@ namespace CalamityMod.Items.Placeables.Furniture { CreateRecipe(3). AddIngredient(ItemID.Torch, 3). - AddIngredient(). + AddIngredient(). Register(); } } diff --git a/Items/Placeables/Furniture/LanternCenter.cs b/Items/Placeables/Furniture/LanternCenter.cs index 874a3ddbba..bb0c244c76 100644 --- a/Items/Placeables/Furniture/LanternCenter.cs +++ b/Items/Placeables/Furniture/LanternCenter.cs @@ -10,18 +10,9 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - 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, 20, 0, 0); //Same price as Party Center + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.buyPrice(gold: 20); //Same price as Party Center; Sold by Princess Item.rare = ItemRarityID.Orange; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Monoliths/AstralProjector.cs b/Items/Placeables/Furniture/Monoliths/AstralProjector.cs index f9df9d7b02..7029bff471 100644 --- a/Items/Placeables/Furniture/Monoliths/AstralProjector.cs +++ b/Items/Placeables/Furniture/Monoliths/AstralProjector.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Furniture.Monoliths; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.Monoliths; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); Item.rare = ItemRarityID.LightRed; Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs index aeffacdc72..62d4f385a0 100644 --- a/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs +++ b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs @@ -12,16 +12,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 45); Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/Furniture/Monoliths/BossRushMonolith.cs b/Items/Placeables/Furniture/Monoliths/BossRushMonolith.cs index 1a60e8a7ec..daabf04afb 100644 --- a/Items/Placeables/Furniture/Monoliths/BossRushMonolith.cs +++ b/Items/Placeables/Furniture/Monoliths/BossRushMonolith.cs @@ -10,16 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(platinum: 1); // No longer a mere rock Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.cs b/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.cs index 13dce481a5..e99691ee70 100644 --- a/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.cs +++ b/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.cs @@ -1,5 +1,4 @@ -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.Monoliths; +using CalamityMod.Tiles.Furniture.Monoliths; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +9,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 8); Item.rare = ItemRarityID.Lime; Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs index ab3b483412..ece5bf1f44 100644 --- a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs +++ b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs @@ -12,16 +12,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 75); Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs b/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs index 3c7352e50f..f06a7b6e33 100644 --- a/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs +++ b/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs @@ -12,16 +12,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 1); Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/Furniture/Monoliths/FrigidMonolith.cs b/Items/Placeables/Furniture/Monoliths/FrigidMonolith.cs index a9f7bff28b..8478838231 100644 --- a/Items/Placeables/Furniture/Monoliths/FrigidMonolith.cs +++ b/Items/Placeables/Furniture/Monoliths/FrigidMonolith.cs @@ -9,16 +9,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.buyPrice(gold: 25); // Sold by Archmage Item.rare = ItemRarityID.Pink; Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.cs b/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.cs index fa4da117ad..2fc5f5d879 100644 --- a/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.cs +++ b/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.cs @@ -12,16 +12,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 12); Item.rare = ItemRarityID.Yellow; Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs index a665e83478..c5b5d93424 100644 --- a/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs +++ b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs @@ -12,16 +12,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 45); Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/Furniture/NavyPrismTorch.cs b/Items/Placeables/Furniture/NavyPrismTorch.cs index d6aced4657..2a1684fe1d 100644 --- a/Items/Placeables/Furniture/NavyPrismTorch.cs +++ b/Items/Placeables/Furniture/NavyPrismTorch.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,28 +12,15 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.WaterTorches[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } public override void SetDefaults() { - Item.width = 14; - Item.height = 16; - Item.maxStack = 9999; - Item.holdStyle = 1; - Item.noWet = false; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.value = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, true); } public override void HoldItem(Player player) diff --git a/Items/Placeables/Furniture/OtonilouStatue.cs b/Items/Placeables/Furniture/OtonilouStatue.cs new file mode 100644 index 0000000000..b9945b3676 --- /dev/null +++ b/Items/Placeables/Furniture/OtonilouStatue.cs @@ -0,0 +1,16 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class OtonilouStatue : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = 214; + Item.height = 414; + } + } +} diff --git a/Items/Placeables/Furniture/OtonilouStatue.png b/Items/Placeables/Furniture/OtonilouStatue.png new file mode 100644 index 0000000000..0142502af3 Binary files /dev/null and b/Items/Placeables/Furniture/OtonilouStatue.png differ diff --git a/Items/Placeables/Furniture/PiggyCage.cs b/Items/Placeables/Furniture/PiggyCage.cs index 68e62aed06..57752989ca 100644 --- a/Items/Placeables/Furniture/PiggyCage.cs +++ b/Items/Placeables/Furniture/PiggyCage.cs @@ -10,17 +10,7 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 34; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); Item.Calamity().donorItem = true; } diff --git a/Items/Placeables/Furniture/RefractivePrismTorch.cs b/Items/Placeables/Furniture/RefractivePrismTorch.cs index cd13a9a012..d4ec9f02c9 100644 --- a/Items/Placeables/Furniture/RefractivePrismTorch.cs +++ b/Items/Placeables/Furniture/RefractivePrismTorch.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,28 +12,15 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.WaterTorches[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } public override void SetDefaults() { - Item.width = 14; - Item.height = 16; - Item.maxStack = 9999; - Item.holdStyle = 1; - Item.noWet = false; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.value = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, true); } public override void HoldItem(Player player) diff --git a/Items/Placeables/Furniture/RepairUnitCage.cs b/Items/Placeables/Furniture/RepairUnitCage.cs new file mode 100644 index 0000000000..5a1ae146c8 --- /dev/null +++ b/Items/Placeables/Furniture/RepairUnitCage.cs @@ -0,0 +1,24 @@ +using CalamityMod.Items.Critters; +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class RepairUnitCage : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Terrarium). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/RepairUnitCage.png b/Items/Placeables/Furniture/RepairUnitCage.png new file mode 100644 index 0000000000..fc78feb204 Binary files /dev/null and b/Items/Placeables/Furniture/RepairUnitCage.png differ diff --git a/Items/Placeables/Furniture/ResilientCandle.cs b/Items/Placeables/Furniture/ResilientCandle.cs index 68052c8dfe..49ee32a22d 100644 --- a/Items/Placeables/Furniture/ResilientCandle.cs +++ b/Items/Placeables/Furniture/ResilientCandle.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture @@ -8,21 +9,16 @@ namespace CalamityMod.Items.Placeables.Furniture public class ResilientCandle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + + public static float DefenseRatioBonus = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DefenseRatioBonus.ToPercent(), (0.5f + DefenseRatioBonus).ToPercent(), (0.75f + DefenseRatioBonus).ToPercent(), (1f + DefenseRatioBonus).ToPercent()); + public override void SetDefaults() { - Item.width = 26; - Item.height = 34; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; + Item.DefaultToPlaceableTile(ModContent.TileType()); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 20); Item.rare = ItemRarityID.Pink; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/RustyChest.cs b/Items/Placeables/Furniture/RustyChest.cs index 87a5621a8c..7607d96e02 100644 --- a/Items/Placeables/Furniture/RustyChest.cs +++ b/Items/Placeables/Furniture/RustyChest.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Tiles.Abyss; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture @@ -9,22 +11,13 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 500; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 10); // Special: generated chest price } public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(8). AddRecipeGroup("IronBar", 2). AddTile(TileID.Anvils). Register(); diff --git a/Items/Placeables/Furniture/SeaMinnowJar.cs b/Items/Placeables/Furniture/SeaMinnowJar.cs index 64aab3ff0c..2e6c7ad191 100644 --- a/Items/Placeables/Furniture/SeaMinnowJar.cs +++ b/Items/Placeables/Furniture/SeaMinnowJar.cs @@ -10,16 +10,7 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 34; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/SpitefulCandle.cs b/Items/Placeables/Furniture/SpitefulCandle.cs index c4b222be8d..8f8eee2c9a 100644 --- a/Items/Placeables/Furniture/SpitefulCandle.cs +++ b/Items/Placeables/Furniture/SpitefulCandle.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture @@ -8,21 +9,16 @@ namespace CalamityMod.Items.Placeables.Furniture public class SpitefulCandle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + + public static float ExtraChipDamageRatio = 0.07f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((1f + ExtraChipDamageRatio).ToString(), ExtraChipDamageRatio.ToString()); + public override void SetDefaults() { - Item.width = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 20); Item.rare = ItemRarityID.Pink; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/SulphurousTorch.cs b/Items/Placeables/Furniture/SulphurousTorch.cs index 677a60f597..5f72d21b84 100644 --- a/Items/Placeables/Furniture/SulphurousTorch.cs +++ b/Items/Placeables/Furniture/SulphurousTorch.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables.Abyss; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,28 +12,15 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.WaterTorches[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } public override void SetDefaults() { - Item.width = 14; - Item.height = 18; - Item.maxStack = 9999; - Item.holdStyle = 1; - Item.noWet = false; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.value = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, true); } public override void HoldItem(Player player) diff --git a/Items/Placeables/Furniture/SunkenIdol.cs b/Items/Placeables/Furniture/SunkenIdol.cs new file mode 100644 index 0000000000..0fe4362991 --- /dev/null +++ b/Items/Placeables/Furniture/SunkenIdol.cs @@ -0,0 +1,16 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class SunkenIdol : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.Calamity().donorItem = true; + } + } +} diff --git a/Items/Placeables/Furniture/SunkenIdol.png b/Items/Placeables/Furniture/SunkenIdol.png new file mode 100644 index 0000000000..319fc574b4 Binary files /dev/null and b/Items/Placeables/Furniture/SunkenIdol.png differ diff --git a/Items/Placeables/Furniture/ThaumaticChair.cs b/Items/Placeables/Furniture/ThaumaticChair.cs index 91e5a91fac..c5934ebc44 100644 --- a/Items/Placeables/Furniture/ThaumaticChair.cs +++ b/Items/Placeables/Furniture/ThaumaticChair.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.FurnitureBotanic; using CalamityMod.Items.Placeables.FurnitureCosmilite; using CalamityMod.Items.Placeables.FurnitureEutrophic; using CalamityMod.Items.Placeables.FurnitureExo; +using CalamityMod.Items.Placeables.FurnitureMarnite; using CalamityMod.Items.Placeables.FurnitureMonolith; using CalamityMod.Items.Placeables.FurnitureOtherworldly; using CalamityMod.Items.Placeables.FurniturePlagued; @@ -20,6 +21,7 @@ using CalamityMod.Items.Placeables.FurnitureWulfrum; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,16 +32,8 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 16; - Item.height = 34; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 10); Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -55,6 +49,7 @@ namespace CalamityMod.Items.Placeables.Furniture AddIngredient(). AddIngredient(). AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Placeables/Furniture/TranquilityCandle.cs b/Items/Placeables/Furniture/TranquilityCandle.cs index 49fc11b71d..9ea3feb14a 100644 --- a/Items/Placeables/Furniture/TranquilityCandle.cs +++ b/Items/Placeables/Furniture/TranquilityCandle.cs @@ -12,25 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 16; - 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 = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, false); + Item.value = Item.sellPrice(silver: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.holdStyle = 1; } public override void HoldItem(Player player) { player.Calamity().tranquilityCandle = true; + + // Do not make light if wet + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) || Item.wet) + return; + 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, DustID.PurpleTorch); @@ -42,16 +36,16 @@ namespace CalamityMod.Items.Placeables.Furniture public override void PostUpdate() { - Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 0.55f, 1f); + if (!Item.wet) + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 0.55f, 1f); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.PeaceCandle, 3). - AddIngredient(ItemID.SoulofLight, 3). - AddIngredient(2). + AddIngredient(ItemID.PeaceCandle). AddIngredient(). + AddIngredient(2). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs index ea986b065d..7ff036e181 100644 --- a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs index 32897dc144..9af333b5f5 100644 --- a/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = Item.height = 32; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs index 7a6f8aa3ec..50e7e9ad81 100644 --- a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/AresTrophy.cs b/Items/Placeables/Furniture/Trophies/AresTrophy.cs index 5c0ca6d07c..4f9ded2b36 100644 --- a/Items/Placeables/Furniture/Trophies/AresTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AresTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = Item.height = 32; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs index 19e3fddb96..06c95437c3 100644 --- a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = Item.height = 32; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs b/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs index 4ba7c71a61..75f08b891a 100644 --- a/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,18 +11,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs b/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs index c30eab2b41..b2caafb718 100644 --- a/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs b/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs index bac2b71071..1d3cf8b012 100644 --- a/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs b/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs index f2aa8eb0e5..88d5cde3f8 100644 --- a/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,18 +11,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs b/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs index 58f754a68c..43625f85e4 100644 --- a/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs b/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs index a860b29176..843a337262 100644 --- a/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs b/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs index 1df4f94c55..1e1ecf1ec9 100644 --- a/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs b/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs index 29a51785be..b3e98744be 100644 --- a/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs b/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs index 8f32f162b3..c6917e1b11 100644 --- a/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs b/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs index c72e8b662e..1f1d328aa2 100644 --- a/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs index 613904b580..ed27c6fc81 100644 --- a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs b/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs index 2892308c30..b8bee70606 100644 --- a/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs b/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs index c17c2333e5..acae30314e 100644 --- a/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,18 +11,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs b/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs index 0947634a28..e163508c15 100644 --- a/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs b/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs index 0bda52bc05..84a52cb134 100644 --- a/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs b/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs index df5b15c9da..5c9b5beb0c 100644 --- a/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs index 6cbacf118c..4fc0d6645b 100644 --- a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs b/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs index 704f2aea3e..5c14445f49 100644 --- a/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -9,18 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs b/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs index fde2378249..8e43ae2035 100644 --- a/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs b/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs index dcf1c8874e..d055c6c457 100644 --- a/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs b/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs index e679dbd68e..5af0fe03e5 100644 --- a/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs b/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs index 0dda84c088..433210fb9c 100644 --- a/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs b/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs index d0080ba749..a44c52ccc8 100644 --- a/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs b/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs index f338d7481b..ff51b60478 100644 --- a/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs b/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs index a524153732..799a8ebe8c 100644 --- a/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs b/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs index 9b96ae3db7..e4c08160ff 100644 --- a/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SignusTrophy.cs b/Items/Placeables/Furniture/Trophies/SignusTrophy.cs index b17c44822d..a5d7264220 100644 --- a/Items/Placeables/Furniture/Trophies/SignusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SignusTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs b/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs index f2e0a31790..bd8b036d84 100644 --- a/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs index c32e9200bd..1a01bc88ec 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs index 089f2d4221..38b9fdb17d 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs index 42ea79b24a..81d0c002e6 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs index 948b972f35..66de8558f5 100644 --- a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = Item.height = 32; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs index 91c86f733e..2a137b87a5 100644 --- a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/YharonTrophy.cs b/Items/Placeables/Furniture/Trophies/YharonTrophy.cs index 5c83acf015..f27a38f920 100644 --- a/Items/Placeables/Furniture/Trophies/YharonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/YharonTrophy.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,18 +9,10 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 30; - Item.height = 30; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = 50000; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 30; + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/TwinklerInABottle.cs b/Items/Placeables/Furniture/TwinklerInABottle.cs index afa0da06e3..42666f1d69 100644 --- a/Items/Placeables/Furniture/TwinklerInABottle.cs +++ b/Items/Placeables/Furniture/TwinklerInABottle.cs @@ -10,16 +10,7 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 34; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/VigorousCandle.cs b/Items/Placeables/Furniture/VigorousCandle.cs index 7e82334566..8d8408d64d 100644 --- a/Items/Placeables/Furniture/VigorousCandle.cs +++ b/Items/Placeables/Furniture/VigorousCandle.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture @@ -8,21 +9,16 @@ namespace CalamityMod.Items.Placeables.Furniture public class VigorousCandle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + + public static double PercentHealthPerSecond = 0.004D; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(PercentHealthPerSecond.ToPercent()); + public override void SetDefaults() { - Item.width = 26; - Item.height = 38; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; + Item.DefaultToPlaceableTile(ModContent.TileType()); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 20); Item.rare = ItemRarityID.Pink; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/WeightlessCandle.cs b/Items/Placeables/Furniture/WeightlessCandle.cs index 904a2d2654..7edb2ebd30 100644 --- a/Items/Placeables/Furniture/WeightlessCandle.cs +++ b/Items/Placeables/Furniture/WeightlessCandle.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture @@ -8,21 +9,18 @@ namespace CalamityMod.Items.Placeables.Furniture public class WeightlessCandle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + + public static float MoveSpeedBoost = 0.1f; + public static double WingTimeBoost = 0.1D; + public static float AccelerationBoost = 0.1f; // All 10% so we only need just one in the tooltip + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { - Item.width = 26; - Item.height = 36; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; + Item.DefaultToPlaceableTile(ModContent.TileType()); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 20); Item.rare = ItemRarityID.Pink; - Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/WulfrumLureItem.cs b/Items/Placeables/Furniture/WulfrumLureItem.cs index 75205140eb..4d0318c02b 100644 --- a/Items/Placeables/Furniture/WulfrumLureItem.cs +++ b/Items/Placeables/Furniture/WulfrumLureItem.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture; +using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture @@ -12,20 +14,13 @@ namespace CalamityMod.Items.Placeables.Furniture public static int SignalTime = 30 * 60; public static int SpawnIntervals = 4 * 60; public static int MaxEnemiesPerWave = 3; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(SignalTime.FramesToSeconds()); public override void SetDefaults() { - Item.width = 22; - Item.height = 22; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 14; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); Item.rare = ItemRarityID.Blue; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/ZenithThrone.cs b/Items/Placeables/Furniture/ZenithThrone.cs new file mode 100644 index 0000000000..4f09cfeb9d --- /dev/null +++ b/Items/Placeables/Furniture/ZenithThrone.cs @@ -0,0 +1,27 @@ +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture +{ + public class ZenithThrone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 10); + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Zenith). + AddRecipeGroup(RecipeGroupID.IronBar, 10). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/ZenithThrone.png b/Items/Placeables/Furniture/ZenithThrone.png new file mode 100644 index 0000000000..a348766a82 Binary files /dev/null and b/Items/Placeables/Furniture/ZenithThrone.png differ diff --git a/Items/Placeables/FurnitureAbyss/AbyssBathtub.cs b/Items/Placeables/FurnitureAbyss/AbyssBathtub.cs index 7c54e2cd45..746d0e297e 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBathtub.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssBed.cs b/Items/Placeables/FurnitureAbyss/AbyssBed.cs index c808d797f2..2bfbf75f44 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBed.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs index e69876ccf6..af07e14063 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs index 1404b8bd30..32992ed59f 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs index 31dbe6c5cb..5eff284a79 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssChair.cs b/Items/Placeables/FurnitureAbyss/AbyssChair.cs index 7796c00e0c..041a8b3ff4 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChair.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChair.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 12; - Item.height = 30; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs index 97f7b6636e..139bec5900 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssChest.cs b/Items/Placeables/FurnitureAbyss/AbyssChest.cs index 357cd1d05d..1450ae8b25 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChest.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssClock.cs b/Items/Placeables/FurnitureAbyss/AbyssClock.cs index 956989d6b4..cd007d9bc2 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssClock.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssClock.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs index db631d892d..45da43cc3c 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAbyss; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - 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.value = 0; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs index 605b0a20da..87b4e8646d 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs index 72e8b90406..afe59280f3 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs index c1719fc5cb..2ba2cd1ee2 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssSink.cs b/Items/Placeables/FurnitureAbyss/AbyssSink.cs index c9a9ece1d3..e92eb3adbf 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSink.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs index 04bfeebc27..1ad013da83 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssSynth.cs b/Items/Placeables/FurnitureAbyss/AbyssSynth.cs index ff1bbd1d2c..d26df2fc54 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSynth.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSynth.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssTable.cs b/Items/Placeables/FurnitureAbyss/AbyssTable.cs index d5600142f5..ad44758ca9 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTable.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs index 2d9c8903d3..b30c3a0747 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,28 +13,15 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.WaterTorches[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } public override void SetDefaults() { - Item.width = 10; - Item.height = 12; - Item.maxStack = 9999; - Item.holdStyle = 1; - Item.noWet = false; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.value = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, true); } public override void HoldItem(Player player) diff --git a/Items/Placeables/FurnitureAbyss/AbyssWorkBench.cs b/Items/Placeables/FurnitureAbyss/AbyssWorkBench.cs index d94bccc8e1..6c9d3f0cc4 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssWorkBench.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssWorkBench.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 14; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs index 75cbeae30b..b9fc8b2339 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss @@ -11,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -34,9 +23,11 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index d8c7cb36d2..68783747b7 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss Item.ResearchUnlockCount = 200; } - public override void SetDefaults() - { - Item.width = 24; - Item.height = 14; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs index 933bf3b10e..f15a5227ee 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs index d51e2e3bc7..e61ccfb84f 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs index 99b5988ae4..919aea0947 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs index 067886fdf8..f2a1521ac5 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs index d90bed601d..fe4ed8718e 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs index 896be25ba8..300407d9b5 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs index b190fa244e..11fadfcaf1 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs index c4f2074f05..de95cd8330 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs index 34aa08d220..241a06a06d 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodClock.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodClock.cs index c285b99f95..02cc1bd896 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodClock.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodClock.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs index 11191f6251..a9720a578f 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs index 961c718a8e..37c243a570 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs index 1b72b87fbd..66fee6755c 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs index 167c805c5a..faab32ce88 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs index a57ce93fb4..abee7f866a 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodPlatform.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodPlatform.cs index 0009ca06ba..82847c538d 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodPlatform.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodPlatform.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs index 4802b4a917..b064681ded 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs index d430c838c9..5caef65bd6 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodWorkBench.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodWorkBench.cs index e41721bcc9..cf82ea1060 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodWorkBench.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodWorkBench.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Tiles.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientBasin.cs b/Items/Placeables/FurnitureAncient/AncientBasin.cs index d4f8027a1f..13ce692fbb 100644 --- a/Items/Placeables/FurnitureAncient/AncientBasin.cs +++ b/Items/Placeables/FurnitureAncient/AncientBasin.cs @@ -1,7 +1,9 @@  using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,24 +14,15 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() { CreateRecipe(). AddIngredient(10). - AddIngredient(5). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Placeables/FurnitureAncient/AncientBathtub.cs b/Items/Placeables/FurnitureAncient/AncientBathtub.cs index 1793094e60..6e4f0a4bf1 100644 --- a/Items/Placeables/FurnitureAncient/AncientBathtub.cs +++ b/Items/Placeables/FurnitureAncient/AncientBathtub.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientBed.cs b/Items/Placeables/FurnitureAncient/AncientBed.cs index 60d9354327..09a2cc6c59 100644 --- a/Items/Placeables/FurnitureAncient/AncientBed.cs +++ b/Items/Placeables/FurnitureAncient/AncientBed.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient @@ -8,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientBookcase.cs b/Items/Placeables/FurnitureAncient/AncientBookcase.cs index 43d34274f3..ff4c9d256c 100644 --- a/Items/Placeables/FurnitureAncient/AncientBookcase.cs +++ b/Items/Placeables/FurnitureAncient/AncientBookcase.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient @@ -8,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientChair.cs b/Items/Placeables/FurnitureAncient/AncientChair.cs index b6d68865ec..2d72d10df0 100644 --- a/Items/Placeables/FurnitureAncient/AncientChair.cs +++ b/Items/Placeables/FurnitureAncient/AncientChair.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 12; - Item.height = 30; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientChandelier.cs b/Items/Placeables/FurnitureAncient/AncientChandelier.cs index 36f9673a3e..8868fe6ff2 100644 --- a/Items/Placeables/FurnitureAncient/AncientChandelier.cs +++ b/Items/Placeables/FurnitureAncient/AncientChandelier.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient @@ -8,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientDoor.cs b/Items/Placeables/FurnitureAncient/AncientDoor.cs index 0b54afa0af..6182a586f9 100644 --- a/Items/Placeables/FurnitureAncient/AncientDoor.cs +++ b/Items/Placeables/FurnitureAncient/AncientDoor.cs @@ -1,5 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAncient; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +12,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - 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.value = 0; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientDresser.cs b/Items/Placeables/FurnitureAncient/AncientDresser.cs index a634980cea..7724410586 100644 --- a/Items/Placeables/FurnitureAncient/AncientDresser.cs +++ b/Items/Placeables/FurnitureAncient/AncientDresser.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientLamp.cs b/Items/Placeables/FurnitureAncient/AncientLamp.cs index a51564d5e8..ae71b05abc 100644 --- a/Items/Placeables/FurnitureAncient/AncientLamp.cs +++ b/Items/Placeables/FurnitureAncient/AncientLamp.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientLantern.cs b/Items/Placeables/FurnitureAncient/AncientLantern.cs index d0a56bb96d..6dc360c7b1 100644 --- a/Items/Placeables/FurnitureAncient/AncientLantern.cs +++ b/Items/Placeables/FurnitureAncient/AncientLantern.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient @@ -8,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientMonolith.cs b/Items/Placeables/FurnitureAncient/AncientMonolith.cs index 25f32136c7..afa334c193 100644 --- a/Items/Placeables/FurnitureAncient/AncientMonolith.cs +++ b/Items/Placeables/FurnitureAncient/AncientMonolith.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientPipeOrgan.cs b/Items/Placeables/FurnitureAncient/AncientPipeOrgan.cs index 00cf4b0858..8b31f31ee6 100644 --- a/Items/Placeables/FurnitureAncient/AncientPipeOrgan.cs +++ b/Items/Placeables/FurnitureAncient/AncientPipeOrgan.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient @@ -9,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientSink.cs b/Items/Placeables/FurnitureAncient/AncientSink.cs index 0c66ebc8d8..5c80b977c8 100644 --- a/Items/Placeables/FurnitureAncient/AncientSink.cs +++ b/Items/Placeables/FurnitureAncient/AncientSink.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient @@ -8,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientSofa.cs b/Items/Placeables/FurnitureAncient/AncientSofa.cs index bf2224b9d0..3b3465f326 100644 --- a/Items/Placeables/FurnitureAncient/AncientSofa.cs +++ b/Items/Placeables/FurnitureAncient/AncientSofa.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient @@ -8,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientTable.cs b/Items/Placeables/FurnitureAncient/AncientTable.cs index 9cdc9de4be..84a5e49443 100644 --- a/Items/Placeables/FurnitureAncient/AncientTable.cs +++ b/Items/Placeables/FurnitureAncient/AncientTable.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientWorkBench.cs b/Items/Placeables/FurnitureAncient/AncientWorkBench.cs index 1f781cbdb8..feec1ee3dd 100644 --- a/Items/Placeables/FurnitureAncient/AncientWorkBench.cs +++ b/Items/Placeables/FurnitureAncient/AncientWorkBench.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +12,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 14; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs b/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs index a9c86a31f7..e397346234 100644 --- a/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs +++ b/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs @@ -16,19 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureAshen/AshenBasin.cs b/Items/Placeables/FurnitureAshen/AshenBasin.cs index b1d1931248..a2cb5e7ae9 100644 --- a/Items/Placeables/FurnitureAshen/AshenBasin.cs +++ b/Items/Placeables/FurnitureAshen/AshenBasin.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Crags; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -11,24 +12,15 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() { CreateRecipe(). AddIngredient(10). - AddIngredient(5). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Placeables/FurnitureAshen/AshenBathtub.cs b/Items/Placeables/FurnitureAshen/AshenBathtub.cs index eaaaef4f46..684e92aa0f 100644 --- a/Items/Placeables/FurnitureAshen/AshenBathtub.cs +++ b/Items/Placeables/FurnitureAshen/AshenBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenBed.cs b/Items/Placeables/FurnitureAshen/AshenBed.cs index 8bb7335a41..ae6230d50b 100644 --- a/Items/Placeables/FurnitureAshen/AshenBed.cs +++ b/Items/Placeables/FurnitureAshen/AshenBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenBookcase.cs b/Items/Placeables/FurnitureAshen/AshenBookcase.cs index 612747bf6f..8921f9f493 100644 --- a/Items/Placeables/FurnitureAshen/AshenBookcase.cs +++ b/Items/Placeables/FurnitureAshen/AshenBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs index 8139eab35c..1c0b0cec4f 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenCandle.cs b/Items/Placeables/FurnitureAshen/AshenCandle.cs index 071a940e80..1cdb264c8b 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandle.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 16; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenChair.cs b/Items/Placeables/FurnitureAshen/AshenChair.cs index 8453fefe9e..c076c3f706 100644 --- a/Items/Placeables/FurnitureAshen/AshenChair.cs +++ b/Items/Placeables/FurnitureAshen/AshenChair.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 12; - Item.height = 30; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenChandelier.cs b/Items/Placeables/FurnitureAshen/AshenChandelier.cs index 4cf40a483b..e6652abc7c 100644 --- a/Items/Placeables/FurnitureAshen/AshenChandelier.cs +++ b/Items/Placeables/FurnitureAshen/AshenChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenChest.cs b/Items/Placeables/FurnitureAshen/AshenChest.cs index e5c475bca9..b57f465f33 100644 --- a/Items/Placeables/FurnitureAshen/AshenChest.cs +++ b/Items/Placeables/FurnitureAshen/AshenChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenDoor.cs b/Items/Placeables/FurnitureAshen/AshenDoor.cs index ef6f100b18..2cbebe0ec9 100644 --- a/Items/Placeables/FurnitureAshen/AshenDoor.cs +++ b/Items/Placeables/FurnitureAshen/AshenDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAshen; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - 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.value = 0; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenDresser.cs b/Items/Placeables/FurnitureAshen/AshenDresser.cs index 705894203a..1de01a7d18 100644 --- a/Items/Placeables/FurnitureAshen/AshenDresser.cs +++ b/Items/Placeables/FurnitureAshen/AshenDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenLamp.cs b/Items/Placeables/FurnitureAshen/AshenLamp.cs index 71cec7023f..2c3faef19f 100644 --- a/Items/Placeables/FurnitureAshen/AshenLamp.cs +++ b/Items/Placeables/FurnitureAshen/AshenLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenLantern.cs b/Items/Placeables/FurnitureAshen/AshenLantern.cs index e8e9792e7d..2448563679 100644 --- a/Items/Placeables/FurnitureAshen/AshenLantern.cs +++ b/Items/Placeables/FurnitureAshen/AshenLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenMonolith.cs b/Items/Placeables/FurnitureAshen/AshenMonolith.cs index b6e754807f..36f4fd6bb7 100644 --- a/Items/Placeables/FurnitureAshen/AshenMonolith.cs +++ b/Items/Placeables/FurnitureAshen/AshenMonolith.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenPipeOrgan.cs b/Items/Placeables/FurnitureAshen/AshenPipeOrgan.cs index 392b69dcd7..871f3f8330 100644 --- a/Items/Placeables/FurnitureAshen/AshenPipeOrgan.cs +++ b/Items/Placeables/FurnitureAshen/AshenPipeOrgan.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenPlatform.cs b/Items/Placeables/FurnitureAshen/AshenPlatform.cs index 0efaa6cfe6..c326b2c714 100644 --- a/Items/Placeables/FurnitureAshen/AshenPlatform.cs +++ b/Items/Placeables/FurnitureAshen/AshenPlatform.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureAshen/AshenSink.cs b/Items/Placeables/FurnitureAshen/AshenSink.cs index 3ca42ba058..debd6bd7ae 100644 --- a/Items/Placeables/FurnitureAshen/AshenSink.cs +++ b/Items/Placeables/FurnitureAshen/AshenSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenSlab.cs b/Items/Placeables/FurnitureAshen/AshenSlab.cs index 7bddb7efd8..b5a18e5c4c 100644 --- a/Items/Placeables/FurnitureAshen/AshenSlab.cs +++ b/Items/Placeables/FurnitureAshen/AshenSlab.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Walls; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen @@ -13,19 +14,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,6 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureAshen/AshenSofa.cs b/Items/Placeables/FurnitureAshen/AshenSofa.cs index e6a8db51b8..6a8af2aaf9 100644 --- a/Items/Placeables/FurnitureAshen/AshenSofa.cs +++ b/Items/Placeables/FurnitureAshen/AshenSofa.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenTable.cs b/Items/Placeables/FurnitureAshen/AshenTable.cs index 32d69d841b..ffb10ca242 100644 --- a/Items/Placeables/FurnitureAshen/AshenTable.cs +++ b/Items/Placeables/FurnitureAshen/AshenTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenWorkBench.cs b/Items/Placeables/FurnitureAshen/AshenWorkBench.cs index 5fd0df5f9e..36de02ed3c 100644 --- a/Items/Placeables/FurnitureAshen/AshenWorkBench.cs +++ b/Items/Placeables/FurnitureAshen/AshenWorkBench.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 14; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs index 8b35bec78f..8e5965c1f0 100644 --- a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Items.Placeables.Walls; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen @@ -12,19 +14,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -35,9 +25,11 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs b/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs index b989ac4973..46a0beec3e 100644 --- a/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs +++ b/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric { 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,6 +24,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric /*CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register();*/ } } diff --git a/Items/Placeables/FurnitureAuric/AuricAbsorber.cs b/Items/Placeables/FurnitureAuric/AuricAbsorber.cs index c6747122ed..00b972f984 100644 --- a/Items/Placeables/FurnitureAuric/AuricAbsorber.cs +++ b/Items/Placeables/FurnitureAuric/AuricAbsorber.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric { 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureAuric/AuricConsole.cs b/Items/Placeables/FurnitureAuric/AuricConsole.cs index 4e33dbd08a..7f55077b37 100644 --- a/Items/Placeables/FurnitureAuric/AuricConsole.cs +++ b/Items/Placeables/FurnitureAuric/AuricConsole.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAuric; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAuric @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAuric/AuricDisplay.cs b/Items/Placeables/FurnitureAuric/AuricDisplay.cs index dd3a605fb8..6a5f43a2b8 100644 --- a/Items/Placeables/FurnitureAuric/AuricDisplay.cs +++ b/Items/Placeables/FurnitureAuric/AuricDisplay.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAuric; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAuric @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAuric/AuricLandMine.cs b/Items/Placeables/FurnitureAuric/AuricLandMine.cs index 7df7dc410b..2b512a453e 100644 --- a/Items/Placeables/FurnitureAuric/AuricLandMine.cs +++ b/Items/Placeables/FurnitureAuric/AuricLandMine.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAuric; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAuric @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAuric/AuricPanel.cs b/Items/Placeables/FurnitureAuric/AuricPanel.cs index eb62611375..14261d6144 100644 --- a/Items/Placeables/FurnitureAuric/AuricPanel.cs +++ b/Items/Placeables/FurnitureAuric/AuricPanel.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric { 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -35,10 +23,12 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); /*CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register();*/ } } diff --git a/Items/Placeables/FurnitureAuric/AuricPlatform.cs b/Items/Placeables/FurnitureAuric/AuricPlatform.cs index 4a56e280e4..234940a20e 100644 --- a/Items/Placeables/FurnitureAuric/AuricPlatform.cs +++ b/Items/Placeables/FurnitureAuric/AuricPlatform.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.cs b/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.cs index accc587b17..7834d9ea8c 100644 --- a/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.cs +++ b/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAuric; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,16 +12,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs b/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs index 5c702a42a9..fac7b6bb34 100644 --- a/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs +++ b/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric { 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureAuric/AuricScreen.cs b/Items/Placeables/FurnitureAuric/AuricScreen.cs index 0d0f814eac..dda6a8624f 100644 --- a/Items/Placeables/FurnitureAuric/AuricScreen.cs +++ b/Items/Placeables/FurnitureAuric/AuricScreen.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAuric; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAuric @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAuric/AuricServer.cs b/Items/Placeables/FurnitureAuric/AuricServer.cs index 5f02f1bae5..e2e370b72a 100644 --- a/Items/Placeables/FurnitureAuric/AuricServer.cs +++ b/Items/Placeables/FurnitureAuric/AuricServer.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAuric; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAuric @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAuric/AuricTerminal.cs b/Items/Placeables/FurnitureAuric/AuricTerminal.cs index fc673ab4cc..e5b11805f2 100644 --- a/Items/Placeables/FurnitureAuric/AuricTerminal.cs +++ b/Items/Placeables/FurnitureAuric/AuricTerminal.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAuric; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAuric @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAuric/AuricToilet.cs b/Items/Placeables/FurnitureAuric/AuricToilet.cs index 94ad188083..9e2c3ef59f 100644 --- a/Items/Placeables/FurnitureAuric/AuricToilet.cs +++ b/Items/Placeables/FurnitureAuric/AuricToilet.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.FurnitureSilva; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAuric; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAuric @@ -14,17 +15,9 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 12; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 40); + Item.rare = ModContent.RarityType(); // Most special shitter gets most preferential treatment } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs b/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs index 3def8fb771..29435f297e 100644 --- a/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs +++ b/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric { 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,6 +24,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric /*CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register();*/ } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs index 0b4520c92a..60c180e58a 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicBed.cs b/Items/Placeables/FurnitureBotanic/BotanicBed.cs index d01928d0f6..1acb0c3b02 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBed.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicBench.cs b/Items/Placeables/FurnitureBotanic/BotanicBench.cs index 6cfd546945..466cedef84 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBench.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs index dee9a5bbd7..b648886bd6 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs index 24daac1110..0e6140697e 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs index 40e28ea501..00abbcf2e1 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicChair.cs b/Items/Placeables/FurnitureBotanic/BotanicChair.cs index 06a47d3e42..b09dc4e440 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChair.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChair.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs index 235d77ede1..136936f5d5 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicChest.cs b/Items/Placeables/FurnitureBotanic/BotanicChest.cs index 66d095d794..ea8c94157f 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChest.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicClock.cs b/Items/Placeables/FurnitureBotanic/BotanicClock.cs index 6e3ff21ab7..8687c3d0d0 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicClock.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicClock.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs index b05be6adda..2994122832 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureBotanic; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs index 3ecb84cc58..bae1342b7f 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs index 0d7d62a0a6..e1721c14f0 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs index 40d9807105..016f715296 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs index 5bd58b515b..bcb626d113 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs index 0dd631978f..2f56f85648 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureBotanic/BotanicSink.cs b/Items/Placeables/FurnitureBotanic/BotanicSink.cs index d63113971f..7b2d93382e 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicSink.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicTable.cs b/Items/Placeables/FurnitureBotanic/BotanicTable.cs index 5be85cd7f0..72801307f6 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicTable.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs index 5a28af3d5b..677b7876fc 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs index eedbd4fe1d..2f6776e8bd 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureCosmilite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBathtub.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBathtub.cs index d364255cfb..15f7759b6d 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBathtub.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs index 032852aa40..e252216cfc 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs index 09ddddcfb5..05ded2228c 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs index a2011d09c6..48cada6a8e 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -37,9 +25,11 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs index d231c10e28..acd83c9add 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs index c01979a0bf..eb3c632373 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs index 31854d565d..6b97568af9 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs @@ -1,5 +1,6 @@  using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 12; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs index d7b6ad33e4..c0195717ae 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs index d3d6a2c25a..e2deef1caa 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs index 7ff8b8222a..de1bb95802 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs index 2e323e9fc7..81010699b8 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureCosmilite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs index 9d8b785b93..54d5eea0b2 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs index 6c3f082b66..0a1a3325d0 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs index 2e6c148fb9..98f75ca456 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs index b75b27aaff..a5b58ad57f 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs index 8fa61f61e4..b828855938 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs index 969d840ebf..f6f7e7e262 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs index b5784c100b..dcdce5aa6c 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs index fb60b2dedd..74a63db530 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs index cc87084155..334a90f945 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkBench.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkBench.cs index 36af66f363..8e83081205 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkBench.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkBench.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 14; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.cs b/Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.cs new file mode 100644 index 0000000000..5fe203a28e --- /dev/null +++ b/Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureEutrophic +{ + public class AncientSmoothNavystone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + /*public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); + }*/ + } +} diff --git a/Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.png b/Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.png new file mode 100644 index 0000000000..27551b932a Binary files /dev/null and b/Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs index 2eb5d38886..657e022d09 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs index 04a43a7782..dd9074f28f 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs index 79a68d1b4b..20f4da4428 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs index c96665cf13..6ad2fb84a5 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs index 04b3a6c54c..8351687fae 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs index 57f0a0eff3..e159fc7cfc 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs index 2f5f06c83f..6d0b102069 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs index acd06f8d87..ab029ab282 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs index e8d07bb38d..eb9f034571 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs index 55afad4925..30bc7622c0 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs index 7873f04fee..12b9a49e24 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs @@ -1,5 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureEutrophic; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +12,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs index 2843e2c5f1..cc508f17c8 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs index 05dd7cd461..7b366fb21a 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs index ec361642e2..04a0ff5d2c 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs index ac38f76e80..40ef588135 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs index 16a4dada26..f1ccad62a8 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs index 929895fd72..9eab014730 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs index 0eae7507ee..e615b230a4 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs index 43f2f392fb..74c10dc6db 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs b/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs index 3134869cad..19a4f66101 100644 --- a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs +++ b/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; -using Terraria.ModLoader; // If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { @@ -10,21 +11,10 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -35,6 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.png b/Items/Placeables/FurnitureEutrophic/SmoothNavystone.png index 27551b932a..c1cfbd43f0 100644 Binary files a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.png and b/Items/Placeables/FurnitureEutrophic/SmoothNavystone.png differ diff --git a/Items/Placeables/FurnitureExo/ExoBathtub.cs b/Items/Placeables/FurnitureExo/ExoBathtub.cs index da15f4d711..b254e0bbe1 100644 --- a/Items/Placeables/FurnitureExo/ExoBathtub.cs +++ b/Items/Placeables/FurnitureExo/ExoBathtub.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoBed.cs b/Items/Placeables/FurnitureExo/ExoBed.cs index c1ba4fe9f3..968d55d1bc 100644 --- a/Items/Placeables/FurnitureExo/ExoBed.cs +++ b/Items/Placeables/FurnitureExo/ExoBed.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoBookcase.cs b/Items/Placeables/FurnitureExo/ExoBookcase.cs index b6653931c5..7007d1993d 100644 --- a/Items/Placeables/FurnitureExo/ExoBookcase.cs +++ b/Items/Placeables/FurnitureExo/ExoBookcase.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoCandelabra.cs b/Items/Placeables/FurnitureExo/ExoCandelabra.cs index 31277e70a0..20937bb909 100644 --- a/Items/Placeables/FurnitureExo/ExoCandelabra.cs +++ b/Items/Placeables/FurnitureExo/ExoCandelabra.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoCandle.cs b/Items/Placeables/FurnitureExo/ExoCandle.cs index 841254adad..f251a442e7 100644 --- a/Items/Placeables/FurnitureExo/ExoCandle.cs +++ b/Items/Placeables/FurnitureExo/ExoCandle.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoChair.cs b/Items/Placeables/FurnitureExo/ExoChair.cs index a6290afc50..9da13bf756 100644 --- a/Items/Placeables/FurnitureExo/ExoChair.cs +++ b/Items/Placeables/FurnitureExo/ExoChair.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoChandelier.cs b/Items/Placeables/FurnitureExo/ExoChandelier.cs index 0a4e258f29..eeecfec18e 100644 --- a/Items/Placeables/FurnitureExo/ExoChandelier.cs +++ b/Items/Placeables/FurnitureExo/ExoChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoChest.cs b/Items/Placeables/FurnitureExo/ExoChest.cs index 1fbb1cc2e2..5fab9f1e52 100644 --- a/Items/Placeables/FurnitureExo/ExoChest.cs +++ b/Items/Placeables/FurnitureExo/ExoChest.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoClock.cs b/Items/Placeables/FurnitureExo/ExoClock.cs index c5087cd944..9bd31eefd2 100644 --- a/Items/Placeables/FurnitureExo/ExoClock.cs +++ b/Items/Placeables/FurnitureExo/ExoClock.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoConsole.cs b/Items/Placeables/FurnitureExo/ExoConsole.cs index 4083dae865..df9a00c943 100644 --- a/Items/Placeables/FurnitureExo/ExoConsole.cs +++ b/Items/Placeables/FurnitureExo/ExoConsole.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoDisplay.cs b/Items/Placeables/FurnitureExo/ExoDisplay.cs index 9e74f970db..72bc9dba6e 100644 --- a/Items/Placeables/FurnitureExo/ExoDisplay.cs +++ b/Items/Placeables/FurnitureExo/ExoDisplay.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoDoor.cs b/Items/Placeables/FurnitureExo/ExoDoor.cs index 69934baca9..b5e2cb3af4 100644 --- a/Items/Placeables/FurnitureExo/ExoDoor.cs +++ b/Items/Placeables/FurnitureExo/ExoDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoDresser.cs b/Items/Placeables/FurnitureExo/ExoDresser.cs index c8e495d245..64a84d9df3 100644 --- a/Items/Placeables/FurnitureExo/ExoDresser.cs +++ b/Items/Placeables/FurnitureExo/ExoDresser.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoKeyboard.cs b/Items/Placeables/FurnitureExo/ExoKeyboard.cs index 3c1bb42936..1ee71a0fc8 100644 --- a/Items/Placeables/FurnitureExo/ExoKeyboard.cs +++ b/Items/Placeables/FurnitureExo/ExoKeyboard.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoLamp.cs b/Items/Placeables/FurnitureExo/ExoLamp.cs index 56eecb5c75..f530b2c3e6 100644 --- a/Items/Placeables/FurnitureExo/ExoLamp.cs +++ b/Items/Placeables/FurnitureExo/ExoLamp.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoLantern.cs b/Items/Placeables/FurnitureExo/ExoLantern.cs index 185ef69c61..9dc9a3d7c9 100644 --- a/Items/Placeables/FurnitureExo/ExoLantern.cs +++ b/Items/Placeables/FurnitureExo/ExoLantern.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoPlatform.cs b/Items/Placeables/FurnitureExo/ExoPlatform.cs index 7424e0cb0a..af83c714bc 100644 --- a/Items/Placeables/FurnitureExo/ExoPlatform.cs +++ b/Items/Placeables/FurnitureExo/ExoPlatform.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureExo/ExoPlating.cs b/Items/Placeables/FurnitureExo/ExoPlating.cs index a0a28d30e3..0d3b3d26ff 100644 --- a/Items/Placeables/FurnitureExo/ExoPlating.cs +++ b/Items/Placeables/FurnitureExo/ExoPlating.cs @@ -15,19 +15,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo { 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { @@ -43,10 +31,12 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs index 17927052b8..7ac5eb0053 100644 --- a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs +++ b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs @@ -16,19 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { @@ -44,10 +32,12 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs b/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs index 97158aa092..ce5d169e79 100644 --- a/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs +++ b/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs @@ -14,19 +14,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { diff --git a/Items/Placeables/FurnitureExo/ExoScreen.cs b/Items/Placeables/FurnitureExo/ExoScreen.cs index 6eb2cd9cd1..5c7414f37f 100644 --- a/Items/Placeables/FurnitureExo/ExoScreen.cs +++ b/Items/Placeables/FurnitureExo/ExoScreen.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoServer.cs b/Items/Placeables/FurnitureExo/ExoServer.cs index 619e66f1a0..ced965dfd3 100644 --- a/Items/Placeables/FurnitureExo/ExoServer.cs +++ b/Items/Placeables/FurnitureExo/ExoServer.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoSink.cs b/Items/Placeables/FurnitureExo/ExoSink.cs index 636ae6eb52..3b07a70d19 100644 --- a/Items/Placeables/FurnitureExo/ExoSink.cs +++ b/Items/Placeables/FurnitureExo/ExoSink.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoSofa.cs b/Items/Placeables/FurnitureExo/ExoSofa.cs index 34c3a9421b..f52a1b9d20 100644 --- a/Items/Placeables/FurnitureExo/ExoSofa.cs +++ b/Items/Placeables/FurnitureExo/ExoSofa.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoTable.cs b/Items/Placeables/FurnitureExo/ExoTable.cs index ff46f03d01..cccf60e6dc 100644 --- a/Items/Placeables/FurnitureExo/ExoTable.cs +++ b/Items/Placeables/FurnitureExo/ExoTable.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoTerminal.cs b/Items/Placeables/FurnitureExo/ExoTerminal.cs index a295237ca3..40e05a1984 100644 --- a/Items/Placeables/FurnitureExo/ExoTerminal.cs +++ b/Items/Placeables/FurnitureExo/ExoTerminal.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoToilet.cs b/Items/Placeables/FurnitureExo/ExoToilet.cs index 4cd440f42e..7732f0e68e 100644 --- a/Items/Placeables/FurnitureExo/ExoToilet.cs +++ b/Items/Placeables/FurnitureExo/ExoToilet.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoWorkBench.cs b/Items/Placeables/FurnitureExo/ExoWorkBench.cs index d097d81061..8d9d1c745a 100644 --- a/Items/Placeables/FurnitureExo/ExoWorkBench.cs +++ b/Items/Placeables/FurnitureExo/ExoWorkBench.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureExo 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteBathtub.cs b/Items/Placeables/FurnitureMarnite/MarniteBathtub.cs index ae805e6296..c74ae9cd78 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteBathtub.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteBathtub.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite 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.value = 0; - Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteBed.cs b/Items/Placeables/FurnitureMarnite/MarniteBed.cs index a70f60bd06..75e39a9129 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteBed.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMarnite @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteBookcase.cs b/Items/Placeables/FurnitureMarnite/MarniteBookcase.cs index 2d0ecf6fca..d86b858582 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteBookcase.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMarnite @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteCandelabra.cs b/Items/Placeables/FurnitureMarnite/MarniteCandelabra.cs index 83c4f70861..0fd009c5c7 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteCandelabra.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteCandelabra.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteCandle.cs b/Items/Placeables/FurnitureMarnite/MarniteCandle.cs index 344fa60ab6..9e0d07a83d 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteCandle.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteCandle.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteChair.cs b/Items/Placeables/FurnitureMarnite/MarniteChair.cs index d87c91a219..ddadfe66f3 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteChair.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteChair.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 12; - Item.height = 30; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteChandelier.cs b/Items/Placeables/FurnitureMarnite/MarniteChandelier.cs index 227c8658fa..a7d2ebea32 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteChandelier.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMarnite @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteChest.cs b/Items/Placeables/FurnitureMarnite/MarniteChest.cs index 819588ab8d..d20a98e9fc 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteChest.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteChest.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMarnite @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteClock.cs b/Items/Placeables/FurnitureMarnite/MarniteClock.cs index 4d67b22e3a..2a65849521 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteClock.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteClock.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMarnite @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteDoor.cs b/Items/Placeables/FurnitureMarnite/MarniteDoor.cs index fa666d3247..11eedc0a2a 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteDoor.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - 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.value = 0; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteDresser.cs b/Items/Placeables/FurnitureMarnite/MarniteDresser.cs index b3ff0b985e..7eee4ef299 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteDresser.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteDresser.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteLamp.cs b/Items/Placeables/FurnitureMarnite/MarniteLamp.cs index 88f3b341a2..bd6f6612b2 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteLamp.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteLamp.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteLantern.cs b/Items/Placeables/FurnitureMarnite/MarniteLantern.cs index 4368af3b7c..3379507792 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteLantern.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteLantern.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteLight.cs b/Items/Placeables/FurnitureMarnite/MarniteLight.cs index 6d66bac2f7..4785695df4 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteLight.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteLight.cs @@ -13,28 +13,15 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } public override void SetDefaults() { - Item.width = 10; - Item.height = 12; - Item.maxStack = 9999; - Item.holdStyle = 1; - Item.noWet = false; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - Item.flame = true; - Item.value = 500; + Item.DefaultToTorch(ModContent.TileType(), 0, false); + Item.value = Item.sellPrice(copper: 20); } public override void HoldItem(Player player) @@ -56,7 +43,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite { CreateRecipe(3). AddIngredient(ItemID.Torch, 3). - AddIngredient(1). + AddIngredient(). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteOrgan.cs b/Items/Placeables/FurnitureMarnite/MarniteOrgan.cs index ad62e328ad..d4e8f381f4 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteOrgan.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteOrgan.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMarnite @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteSink.cs b/Items/Placeables/FurnitureMarnite/MarniteSink.cs index e1ab06b404..e6bcad01ca 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteSink.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteSink.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMarnite @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteSofa.cs b/Items/Placeables/FurnitureMarnite/MarniteSofa.cs index 3255f15c96..f754aaf8a8 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteSofa.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteSofa.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMarnite @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteTable.cs b/Items/Placeables/FurnitureMarnite/MarniteTable.cs index 6ef3fe2a7a..3ac2b86eeb 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteTable.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteTable.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMarnite @@ -8,17 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteToilet.cs b/Items/Placeables/FurnitureMarnite/MarniteToilet.cs index cab00cbab0..9d91fac578 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteToilet.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteToilet.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,17 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 16; - 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.value = 0; - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/MarniteWorkBench.cs b/Items/Placeables/FurnitureMarnite/MarniteWorkBench.cs index 805581c632..631e7ede23 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteWorkBench.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteWorkBench.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureMarnite; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 14; - 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMarnite/PolishedMarniteBlock.cs b/Items/Placeables/FurnitureMarnite/PolishedMarniteBlock.cs index b750a0cdee..156984f82d 100644 --- a/Items/Placeables/FurnitureMarnite/PolishedMarniteBlock.cs +++ b/Items/Placeables/FurnitureMarnite/PolishedMarniteBlock.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -38,9 +26,11 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/PolishedMarnitePlatform.cs b/Items/Placeables/FurnitureMarnite/PolishedMarnitePlatform.cs index 2481bd9e63..ae848f862f 100644 --- a/Items/Placeables/FurnitureMarnite/PolishedMarnitePlatform.cs +++ b/Items/Placeables/FurnitureMarnite/PolishedMarnitePlatform.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite Item.ResearchUnlockCount = 200; } - public override void SetDefaults() - { - Item.width = 24; - Item.height = 14; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureMonolith/MonolithBathtub.cs b/Items/Placeables/FurnitureMonolith/MonolithBathtub.cs index 1328db1e9e..180e480867 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBathtub.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBathtub.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithBed.cs b/Items/Placeables/FurnitureMonolith/MonolithBed.cs index e1cd427153..1d333de777 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBed.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBed.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithBench.cs b/Items/Placeables/FurnitureMonolith/MonolithBench.cs index a63601361f..8498b4de74 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBench.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBench.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs b/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs index c044244871..c2c7c915d8 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs b/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs index cc7a0cbbb3..70090c243b 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithCandle.cs b/Items/Placeables/FurnitureMonolith/MonolithCandle.cs index e156e3e6f0..f76318e634 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithCandle.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithCandle.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithChair.cs b/Items/Placeables/FurnitureMonolith/MonolithChair.cs index 280144c3cb..25bd448184 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithChair.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithChair.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs b/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs index 285b444f2e..e3a72a15c7 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithChest.cs b/Items/Placeables/FurnitureMonolith/MonolithChest.cs index 5e17e450d7..6192e86422 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithChest.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithChest.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithClock.cs b/Items/Placeables/FurnitureMonolith/MonolithClock.cs index 3087ea7e5d..8878384da9 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithClock.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithClock.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithDoor.cs b/Items/Placeables/FurnitureMonolith/MonolithDoor.cs index 8840647e44..0f01131333 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithDoor.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithDoor.cs @@ -1,4 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureMonolith; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithDresser.cs b/Items/Placeables/FurnitureMonolith/MonolithDresser.cs index fb4ace6423..1c1d788560 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithDresser.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithDresser.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithLamp.cs b/Items/Placeables/FurnitureMonolith/MonolithLamp.cs index 34ee39420a..2b9635cdad 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithLamp.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithLamp.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithLantern.cs b/Items/Placeables/FurnitureMonolith/MonolithLantern.cs index 819f420c7c..63692653c1 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithLantern.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithLantern.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithPiano.cs b/Items/Placeables/FurnitureMonolith/MonolithPiano.cs index 4d672cc03d..2c6238a177 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithPiano.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithPiano.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithPlatform.cs b/Items/Placeables/FurnitureMonolith/MonolithPlatform.cs index fb994a0cc1..8eca34c5db 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithPlatform.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithPlatform.cs @@ -1,4 +1,4 @@ - +using CalamityMod.Items.Placeables.Astral; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureMonolith/MonolithSink.cs b/Items/Placeables/FurnitureMonolith/MonolithSink.cs index d131fdac33..65f6164663 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithSink.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithSink.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithTable.cs b/Items/Placeables/FurnitureMonolith/MonolithTable.cs index 1e184ccbdd..af80d2f04d 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithTable.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithTable.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs b/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs index faa7778f48..7aab4573e8 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith @@ -8,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs index 6602e6f558..36312630cf 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.cs index a97b580a24..f3140813d1 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBookcase.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBookcase.cs index c139a0c95d..d3df9dcdc5 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBookcase.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBookcase.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs index 89b392f08e..11c794c0f6 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs index f76f0452f1..ba12961307 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs index 838f963157..d2d7338feb 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs index 3ab62880da..3de2820561 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs index 03b6fc9d0d..88192ef233 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyClock.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyClock.cs index b496d35c4b..f0ff836923 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyClock.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyClock.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs index ef0c4af9b4..2a3a1e7b02 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.FurnitureOtherworldly; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs index fede834ec4..61a8967584 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs index 596bec1851..65d2590d83 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs index 7b2e6eb73c..41dcfc2525 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPiano.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPiano.cs index 6504495198..d84715b21d 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPiano.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPiano.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.cs index 3d4cb4ca0a..fc3ffa045e 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.cs index eb34b598d3..75ced4a50f 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlySofa.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlySofa.cs index d159e369c2..3e992a78d7 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlySofa.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlySofa.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs index 1d284a2a24..718a840b8c 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs @@ -14,19 +14,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -41,9 +29,11 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyTable.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyTable.cs index 63e4469884..d390b64ae9 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyTable.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyTable.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyWorkBench.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyWorkBench.cs index 6dcf67467d..2cf9018b78 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyWorkBench.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyWorkBench.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/BrokenPlaguedBed.cs b/Items/Placeables/FurniturePlagued/BrokenPlaguedBed.cs index ed629a2926..e530cfc363 100644 --- a/Items/Placeables/FurniturePlagued/BrokenPlaguedBed.cs +++ b/Items/Placeables/FurniturePlagued/BrokenPlaguedBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -14,16 +15,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedContainmentBrick.cs b/Items/Placeables/FurniturePlagued/PlaguedContainmentBrick.cs index fa112b67e7..bb539251e8 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedContainmentBrick.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedContainmentBrick.cs @@ -15,34 +15,25 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { + // Plagued Containment Brick does not have a direct decraft condition + // Instead, it turns into Nanodroids when shimmered before defeating Golem CreateRecipe(50). AddRecipeGroup("AnyStoneBlock", 50). AddIngredient(). AddTile(). - AddDecraftCondition(Condition.DownedGolem). Register(); CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateBathtub.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateBathtub.cs index 4ea41efc82..dc67b0f1e2 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateBathtub.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateBed.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateBed.cs index 51ad53db99..b2bf367710 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateBed.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -13,16 +14,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateBookcase.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateBookcase.cs index 76c7dce4fc..4d78213f82 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateBookcase.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateCandelabra.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateCandelabra.cs index 8940952ade..c753d8d607 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateCandelabra.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateCandle.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateCandle.cs index 6b756628ad..5298e08908 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateCandle.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateChair.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateChair.cs index 3149937bde..f20bfd836e 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateChair.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateChair.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateChandelier.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateChandelier.cs index 790bdc6492..3150ed37ad 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateChandelier.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateChest.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateChest.cs index 8ed3a5f7c9..6bd91adc4f 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateChest.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateClock.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateClock.cs index 68e4d4e5a2..9b5291e6b2 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateClock.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateClock.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateDoor.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateDoor.cs index 8281e94cb8..21b167c47f 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateDoor.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurniturePlaguedPlate; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateDresser.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateDresser.cs index 769c43d917..e993268b04 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateDresser.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateLamp.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateLamp.cs index fd59e2249d..1f1825738e 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateLamp.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateLantern.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateLantern.cs index 6214c98f48..6e8184cde1 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateLantern.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlatePiano.cs b/Items/Placeables/FurniturePlagued/PlaguedPlatePiano.cs index aaa5c856d4..35c57cac6f 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlatePiano.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlatePiano.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlatePlatform.cs b/Items/Placeables/FurniturePlagued/PlaguedPlatePlatform.cs index 1ca85b3f48..a8839a64f8 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlatePlatform.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlatePlatform.cs @@ -10,19 +10,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateSink.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateSink.cs index c697683897..65427e60b3 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateSink.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateSofa.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateSofa.cs index fff1f76d97..0e4501ebf1 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateSofa.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateSofa.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateTable.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateTable.cs index 09b5a697e4..52c11a4d27 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateTable.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurniturePlagued/PlaguedWorkBench.cs b/Items/Placeables/FurniturePlagued/PlaguedWorkBench.cs index a4362b62eb..6e5008a177 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedWorkBench.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedWorkBench.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurniturePlaguedPlate; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public new string LocalizationCategory => "Items.Placeables"; 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(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBathtub.cs b/Items/Placeables/FurnitureProfaned/ProfanedBathtub.cs index 1bd0783926..7401ff9a32 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBathtub.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs index f744787415..cf56d07996 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs index ce311f27e1..bc3d988a6a 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs index d2e34418e7..45bf09c3e4 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs index eeca2f1673..54baa4f546 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs index 6edc8a0fa4..92277fbc47 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs index 302cebc5e0..1d102fb16d 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 12; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs index a613d5ac04..a52e813877 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChest.cs b/Items/Placeables/FurnitureProfaned/ProfanedChest.cs index 1cfc58815b..fc4f6afaf0 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChest.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedClock.cs b/Items/Placeables/FurnitureProfaned/ProfanedClock.cs index 26aa00c163..427bba87b4 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedClock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedClock.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs index 105b6ab075..2100d817a9 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,6 +24,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs index b17ca58420..cc3cc0edfc 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureProfaned; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs index 79ac9bd95e..ef44ffbe53 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs index 66e30ebc9b..d4acd3d443 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs index 052bd7c174..8e3eead0e7 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs index 201a5d5d6e..9d55ca2416 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs b/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs index c67564587d..9594b0fea9 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs @@ -10,19 +10,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs index 9c63f0a11b..7a5b532e7c 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs @@ -11,19 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned { 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -35,9 +24,11 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs index adc5f19e24..1ba803657d 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs b/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs index 295b9ac13c..c3d7fc12d3 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -34,6 +22,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs index 960a5fc619..5f2d142261 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedWorkBench.cs b/Items/Placeables/FurnitureProfaned/ProfanedWorkBench.cs index fd133459f0..4be7af9875 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedWorkBench.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedWorkBench.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureProfaned; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 14; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs b/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs index b87e43a288..b975aced10 100644 --- a/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Placeables.Walls; using Terraria.ID; -using Terraria.ModLoader; // If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,6 +24,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs b/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs index 5a618e9b93..1964437eed 100644 --- a/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs +++ b/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs @@ -11,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 36; - 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, 0, 10, 0); - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 2); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs b/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs index c9825c65e1..74b24a6d4a 100644 --- a/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs +++ b/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs @@ -10,21 +10,13 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() { - Item.width = 24; - Item.height = 50; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override bool AltFunctionUse(Player player) => true; diff --git a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs index 89edc10885..5e31836e98 100644 --- a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs +++ b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs @@ -11,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 1); Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; diff --git a/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs index 943a36ae69..f122fb3f98 100644 --- a/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs +++ b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs @@ -14,19 +14,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious Item.ResearchUnlockCount = 100; } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -37,10 +25,12 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs b/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs index d578d21cda..ec2d53a3ee 100644 --- a/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs +++ b/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs @@ -11,17 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 36; - 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, 0, 10, 0); - Item.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 2); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.cs b/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.cs index a2d7b42aad..c59182ad6c 100644 --- a/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.cs +++ b/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious Item.ResearchUnlockCount = 200; } - public override void SetDefaults() - { - Item.width = 22; - Item.height = 18; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs b/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs index 170fb8a81a..5ce24bbe71 100644 --- a/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs +++ b/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs @@ -10,21 +10,13 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() { - Item.width = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override bool AltFunctionUse(Player player) => true; diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs index b83e03515b..9055b46e21 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 38; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs index d6b34a3164..b6cc1e1f4a 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 38; - Item.height = 18; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs index 0a91b8e4fb..376060634c 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 42; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs index 8f93f672a5..82cdad4b58 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 36; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs index 20e1097ea4..44fe49884d 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs index bc4dea6dcb..97d8b95a2a 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 16; - Item.height = 16; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs index 24c6f47afd..ff313d9ef1 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 16; - 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs index e1825750fc..350cda2419 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 40; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.cs index 54ddce21fb..78345310da 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.cs index 98d0e3b579..2617b61294 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 20; - Item.height = 34; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs index 39658d8f4d..e4c05e2136 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 22; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs index 73b5238afe..2299f9070d 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 24; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs index a628258836..52361ec7b6 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 16; - Item.height = 38; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs index 0aeeffab53..d66b27406d 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 16; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs index 695256bc92..68e9a04595 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 24; - Item.height = 34; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs index 3c7661c61c..4f8cb9c850 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs index 376f985014..0c9fe5f09f 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 38; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs index e2d4b4bf37..fe6b642038 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 16; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs index e99ba3e55f..1334cde423 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaBed.cs b/Items/Placeables/FurnitureSilva/SilvaBed.cs index 8eb7dec1ff..3d0c73f109 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBed.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaBench.cs b/Items/Placeables/FurnitureSilva/SilvaBench.cs index e7461c2f02..333fed0272 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBench.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs index 383a307553..f036b18c6e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs index 702798d59d..92ae20f92e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaCandle.cs b/Items/Placeables/FurnitureSilva/SilvaCandle.cs index 1fd440b8c6..b5bedb72c0 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandle.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaChair.cs b/Items/Placeables/FurnitureSilva/SilvaChair.cs index 2961c44336..276ece5d5b 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChair.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChair.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs index 54988c8f24..a10990fdd0 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaChest.cs b/Items/Placeables/FurnitureSilva/SilvaChest.cs index c4c4e3e9b4..dc123f5db8 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChest.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaClock.cs b/Items/Placeables/FurnitureSilva/SilvaClock.cs index fcaf052fee..f4afb5cf0e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaClock.cs +++ b/Items/Placeables/FurnitureSilva/SilvaClock.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs index 976f927c8d..1addf1b43f 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Walls; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; @@ -13,19 +14,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -38,9 +27,11 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaDoor.cs b/Items/Placeables/FurnitureSilva/SilvaDoor.cs index 5be1f1694b..703348131f 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDoor.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSilva; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaDresser.cs b/Items/Placeables/FurnitureSilva/SilvaDresser.cs index d35ee4cee6..7f149b01f1 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDresser.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaLamp.cs b/Items/Placeables/FurnitureSilva/SilvaLamp.cs index a284f1be07..336d5e4d8e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLamp.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaLantern.cs b/Items/Placeables/FurnitureSilva/SilvaLantern.cs index 92b6f3d5dc..bcd188b58c 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLantern.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaPiano.cs b/Items/Placeables/FurnitureSilva/SilvaPiano.cs index e720ec85e3..619ac5cdc8 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPiano.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPiano.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaPlatform.cs b/Items/Placeables/FurnitureSilva/SilvaPlatform.cs index 2e634038b3..b83a3a955e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPlatform.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPlatform.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva Item.ResearchUnlockCount = 200; } - 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.createTile = ModContent.TileType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureSilva/SilvaSink.cs b/Items/Placeables/FurnitureSilva/SilvaSink.cs index 19ad3be982..56e6f60507 100644 --- a/Items/Placeables/FurnitureSilva/SilvaSink.cs +++ b/Items/Placeables/FurnitureSilva/SilvaSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaTable.cs b/Items/Placeables/FurnitureSilva/SilvaTable.cs index 15b3849e45..8b0175b74c 100644 --- a/Items/Placeables/FurnitureSilva/SilvaTable.cs +++ b/Items/Placeables/FurnitureSilva/SilvaTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs index 50af2b0149..4311048e5d 100644 --- a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelBathtub.cs b/Items/Placeables/FurnitureStatigel/StatigelBathtub.cs index 51ca9b7dce..3f7fc58b21 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBathtub.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelBed.cs b/Items/Placeables/FurnitureStatigel/StatigelBed.cs index d5e840f874..cafa39bbcf 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBed.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs index 45254e6bed..d28fcccc64 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs @@ -14,19 +14,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,10 +24,12 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs index 012af8b83b..148c98fbc4 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs index 4bf3d3fe60..4cab592c8a 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs index c90dd5894c..2b615e086a 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelChair.cs b/Items/Placeables/FurnitureStatigel/StatigelChair.cs index 02d1ece838..5a67a9131a 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChair.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChair.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 12; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs index 5e3f2daaae..08014dcb98 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelChest.cs b/Items/Placeables/FurnitureStatigel/StatigelChest.cs index 69720b0094..751521bc2a 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChest.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelClock.cs b/Items/Placeables/FurnitureStatigel/StatigelClock.cs index 4564d14f04..a3ad4e7f12 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelClock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelClock.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 18; - Item.height = 46; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs index f79fa59001..583efa5451 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureStatigel; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs index 733bf50dac..59b759b84c 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs index 6568d635fc..01f6b7453c 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs index 0e6231e388..8eea59ba86 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs index c74d15a57d..05b1cd26fd 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs b/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs index 5d52b60e2d..51b059ea36 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureStatigel/StatigelSink.cs b/Items/Placeables/FurnitureStatigel/StatigelSink.cs index 357e41b7a2..4f62ce1aca 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSink.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs index 77a4e14ae8..15e53c4ebc 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelTable.cs b/Items/Placeables/FurnitureStatigel/StatigelTable.cs index 5c97c5f8b0..db940dd1d7 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelTable.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelWorkBench.cs b/Items/Placeables/FurnitureStatigel/StatigelWorkBench.cs index 5ec185eea9..e284ee43ed 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelWorkBench.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelWorkBench.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureStatigel; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 14; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusBathtub.cs b/Items/Placeables/FurnitureStratus/StratusBathtub.cs index 44efc2eb82..3f5e3b6b76 100644 --- a/Items/Placeables/FurnitureStratus/StratusBathtub.cs +++ b/Items/Placeables/FurnitureStratus/StratusBathtub.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusBed.cs b/Items/Placeables/FurnitureStratus/StratusBed.cs index bce3b8fb72..6ce98dccab 100644 --- a/Items/Placeables/FurnitureStratus/StratusBed.cs +++ b/Items/Placeables/FurnitureStratus/StratusBed.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusBookcase.cs b/Items/Placeables/FurnitureStratus/StratusBookcase.cs index b3981d0083..558a78bfec 100644 --- a/Items/Placeables/FurnitureStratus/StratusBookcase.cs +++ b/Items/Placeables/FurnitureStratus/StratusBookcase.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusBricks.cs b/Items/Placeables/FurnitureStratus/StratusBricks.cs index 65587db24c..c8e4ecead9 100644 --- a/Items/Placeables/FurnitureStratus/StratusBricks.cs +++ b/Items/Placeables/FurnitureStratus/StratusBricks.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -39,12 +27,15 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs index 61368f0f86..3f4a616950 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusCandle.cs b/Items/Placeables/FurnitureStratus/StratusCandle.cs index 1422f98bc1..1e0c3bc8ea 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandle.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandle.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusChair.cs b/Items/Placeables/FurnitureStratus/StratusChair.cs index 4663302a99..20dd9f148d 100644 --- a/Items/Placeables/FurnitureStratus/StratusChair.cs +++ b/Items/Placeables/FurnitureStratus/StratusChair.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusChandelier.cs b/Items/Placeables/FurnitureStratus/StratusChandelier.cs index ab431764e8..84b7f7fe5d 100644 --- a/Items/Placeables/FurnitureStratus/StratusChandelier.cs +++ b/Items/Placeables/FurnitureStratus/StratusChandelier.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusChest.cs b/Items/Placeables/FurnitureStratus/StratusChest.cs index aa6ade59cc..9137ca711c 100644 --- a/Items/Placeables/FurnitureStratus/StratusChest.cs +++ b/Items/Placeables/FurnitureStratus/StratusChest.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusClock.cs b/Items/Placeables/FurnitureStratus/StratusClock.cs index 9ecf78d673..35591f9dac 100644 --- a/Items/Placeables/FurnitureStratus/StratusClock.cs +++ b/Items/Placeables/FurnitureStratus/StratusClock.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusDoor.cs b/Items/Placeables/FurnitureStratus/StratusDoor.cs index 441fe59049..c0086b86cc 100644 --- a/Items/Placeables/FurnitureStratus/StratusDoor.cs +++ b/Items/Placeables/FurnitureStratus/StratusDoor.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.FurnitureStratus; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusDresser.cs b/Items/Placeables/FurnitureStratus/StratusDresser.cs index 4b64df1890..3371fd2794 100644 --- a/Items/Placeables/FurnitureStratus/StratusDresser.cs +++ b/Items/Placeables/FurnitureStratus/StratusDresser.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusLamp.cs b/Items/Placeables/FurnitureStratus/StratusLamp.cs index 45bd49e7dd..10dd94a614 100644 --- a/Items/Placeables/FurnitureStratus/StratusLamp.cs +++ b/Items/Placeables/FurnitureStratus/StratusLamp.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusLantern.cs b/Items/Placeables/FurnitureStratus/StratusLantern.cs index 5578768d87..96d8746e51 100644 --- a/Items/Placeables/FurnitureStratus/StratusLantern.cs +++ b/Items/Placeables/FurnitureStratus/StratusLantern.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusPiano.cs b/Items/Placeables/FurnitureStratus/StratusPiano.cs index 10f63c625a..daf3753343 100644 --- a/Items/Placeables/FurnitureStratus/StratusPiano.cs +++ b/Items/Placeables/FurnitureStratus/StratusPiano.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusPlatform.cs b/Items/Placeables/FurnitureStratus/StratusPlatform.cs index 47dace2d84..1bc9e4a576 100644 --- a/Items/Placeables/FurnitureStratus/StratusPlatform.cs +++ b/Items/Placeables/FurnitureStratus/StratusPlatform.cs @@ -10,19 +10,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus Item.ResearchUnlockCount = 200; } - public override void SetDefaults() - { - Item.width = 26; - Item.height = 26; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureStratus/StratusSink.cs b/Items/Placeables/FurnitureStratus/StratusSink.cs index c0449bcf20..adbc891824 100644 --- a/Items/Placeables/FurnitureStratus/StratusSink.cs +++ b/Items/Placeables/FurnitureStratus/StratusSink.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusSofa.cs b/Items/Placeables/FurnitureStratus/StratusSofa.cs index 9bcfe3b552..53c00d843d 100644 --- a/Items/Placeables/FurnitureStratus/StratusSofa.cs +++ b/Items/Placeables/FurnitureStratus/StratusSofa.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs b/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs index 1f2696ac34..bfbfc866ac 100644 --- a/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs +++ b/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus Item.ResearchUnlockCount = 200; } - public override void SetDefaults() - { - Item.width = 26; - Item.height = 26; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureStratus/StratusTable.cs b/Items/Placeables/FurnitureStratus/StratusTable.cs index 1a21d4f7d4..dd7749ac4f 100644 --- a/Items/Placeables/FurnitureStratus/StratusTable.cs +++ b/Items/Placeables/FurnitureStratus/StratusTable.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { @@ -7,16 +8,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusWorkBench.cs b/Items/Placeables/FurnitureStratus/StratusWorkBench.cs index fb23f66139..12f8d5edcd 100644 --- a/Items/Placeables/FurnitureStratus/StratusWorkBench.cs +++ b/Items/Placeables/FurnitureStratus/StratusWorkBench.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.FurnitureStratus; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs b/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs index 7693b3fc45..c5c4dbd2bc 100644 --- a/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs +++ b/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -11,19 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -34,9 +23,11 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs index 6a28f02877..36e1377ed5 100644 --- a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureVoid/VoidBathtub.cs b/Items/Placeables/FurnitureVoid/VoidBathtub.cs index efb5812c8b..44e4bc34a0 100644 --- a/Items/Placeables/FurnitureVoid/VoidBathtub.cs +++ b/Items/Placeables/FurnitureVoid/VoidBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidBed.cs b/Items/Placeables/FurnitureVoid/VoidBed.cs index b2c9eb2f99..a204ce22b3 100644 --- a/Items/Placeables/FurnitureVoid/VoidBed.cs +++ b/Items/Placeables/FurnitureVoid/VoidBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidBookcase.cs b/Items/Placeables/FurnitureVoid/VoidBookcase.cs index 1be0081d6b..2e0d2190d5 100644 --- a/Items/Placeables/FurnitureVoid/VoidBookcase.cs +++ b/Items/Placeables/FurnitureVoid/VoidBookcase.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs index 0cce6250db..8a97293d87 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidCandle.cs b/Items/Placeables/FurnitureVoid/VoidCandle.cs index 0795cca240..a41f12eb08 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandle.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidChair.cs b/Items/Placeables/FurnitureVoid/VoidChair.cs index 6af4c4a6a0..8ba7af4c53 100644 --- a/Items/Placeables/FurnitureVoid/VoidChair.cs +++ b/Items/Placeables/FurnitureVoid/VoidChair.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 12; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidChandelier.cs b/Items/Placeables/FurnitureVoid/VoidChandelier.cs index 38e4f37bea..857424a88c 100644 --- a/Items/Placeables/FurnitureVoid/VoidChandelier.cs +++ b/Items/Placeables/FurnitureVoid/VoidChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidChest.cs b/Items/Placeables/FurnitureVoid/VoidChest.cs index 35fb017c36..3eba2cb5cf 100644 --- a/Items/Placeables/FurnitureVoid/VoidChest.cs +++ b/Items/Placeables/FurnitureVoid/VoidChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidDoor.cs b/Items/Placeables/FurnitureVoid/VoidDoor.cs index a0aa337f78..16addc9a82 100644 --- a/Items/Placeables/FurnitureVoid/VoidDoor.cs +++ b/Items/Placeables/FurnitureVoid/VoidDoor.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureVoid; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidDresser.cs b/Items/Placeables/FurnitureVoid/VoidDresser.cs index 0ec9368424..e56e219ec8 100644 --- a/Items/Placeables/FurnitureVoid/VoidDresser.cs +++ b/Items/Placeables/FurnitureVoid/VoidDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidLamp.cs b/Items/Placeables/FurnitureVoid/VoidLamp.cs index 8511c2c5db..7b50a5fd2f 100644 --- a/Items/Placeables/FurnitureVoid/VoidLamp.cs +++ b/Items/Placeables/FurnitureVoid/VoidLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidLantern.cs b/Items/Placeables/FurnitureVoid/VoidLantern.cs index c06848e2a0..767bb3ecad 100644 --- a/Items/Placeables/FurnitureVoid/VoidLantern.cs +++ b/Items/Placeables/FurnitureVoid/VoidLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidObelisk.cs b/Items/Placeables/FurnitureVoid/VoidObelisk.cs index a2af015953..2800fb30ad 100644 --- a/Items/Placeables/FurnitureVoid/VoidObelisk.cs +++ b/Items/Placeables/FurnitureVoid/VoidObelisk.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidPiano.cs b/Items/Placeables/FurnitureVoid/VoidPiano.cs index 36eb360204..10cbb768f0 100644 --- a/Items/Placeables/FurnitureVoid/VoidPiano.cs +++ b/Items/Placeables/FurnitureVoid/VoidPiano.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidSink.cs b/Items/Placeables/FurnitureVoid/VoidSink.cs index 74967ccb8f..b72322a430 100644 --- a/Items/Placeables/FurnitureVoid/VoidSink.cs +++ b/Items/Placeables/FurnitureVoid/VoidSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidSofa.cs b/Items/Placeables/FurnitureVoid/VoidSofa.cs index 4f07e6d093..4d9d364d39 100644 --- a/Items/Placeables/FurnitureVoid/VoidSofa.cs +++ b/Items/Placeables/FurnitureVoid/VoidSofa.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidTable.cs b/Items/Placeables/FurnitureVoid/VoidTable.cs index 6756872f39..3e1ad4e28a 100644 --- a/Items/Placeables/FurnitureVoid/VoidTable.cs +++ b/Items/Placeables/FurnitureVoid/VoidTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidWorkBench.cs b/Items/Placeables/FurnitureVoid/VoidWorkBench.cs index fd46a0236f..db41e4f1e0 100644 --- a/Items/Placeables/FurnitureVoid/VoidWorkBench.cs +++ b/Items/Placeables/FurnitureVoid/VoidWorkBench.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureVoid; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 14; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs b/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs index bf1eb2b981..3a109e0b8f 100644 --- a/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs +++ b/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,6 +24,7 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs b/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs index b6706d2289..45519cd146 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 36; - Item.height = 24; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs b/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs index 9aef8b1892..dba6f46033 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 34; - 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs b/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs index ef51458322..183ac5df10 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -9,16 +10,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs b/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs index 55b405f085..6f0a7e44f5 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs b/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs index 4bc409133d..be884f8399 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - 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.createTile = ModContent.TileType(); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs index aadf91cc44..87ee331186 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 24; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs index 6b24beb21b..d023bcca90 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 46; - Item.height = 32; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs index b9005512aa..16228bfe97 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs @@ -1,6 +1,7 @@ -// There is no Wulfrum Chest placed sprite... +// There is no Wulfrum Chest placed sprite... THERES STILL NONE /* using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -15,16 +16,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public override void SetDefaults() { - Item.width = 32; - Item.height = 24; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs b/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs index 5eb76c356e..fd29ef50dc 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 18; - Item.height = 40; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs b/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs index cb386c281b..e18969357f 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 38; - Item.height = 24; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs b/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs index 432e433e30..b271efdb91 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 14; - Item.height = 34; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs b/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs index be97e26f4f..72ebb8ebc3 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 18; - Item.height = 34; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs index bc85d3b62e..1000898784 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 38; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs index b907b16622..f77b24e65e 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -37,6 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs index f0d730303f..5cff22aca0 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs index 3885a5b1bc..bc87369619 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 38; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs b/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs index 1e4992d358..9f4ca75337 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 38; - Item.height = 26; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs b/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs index f4b97ce68a..bb8189d1d8 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -8,16 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 30; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumWorkBench.cs b/Items/Placeables/FurnitureWulfrum/WulfrumWorkBench.cs index 213f67d077..a4b4e96e4a 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumWorkBench.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumWorkBench.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureWulfrum; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureWulfrum @@ -10,16 +11,8 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 32; - Item.height = 18; - 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.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() diff --git a/Items/Placeables/Limestone.cs b/Items/Placeables/Limestone.cs deleted file mode 100644 index d238c192a1..0000000000 --- a/Items/Placeables/Limestone.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class Limestone : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - } -} diff --git a/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs b/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs index 46fa5d8754..bbc82b92d6 100644 --- a/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs +++ b/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.LivingFire; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.LivingFire; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,19 +14,7 @@ namespace CalamityMod.Items.Placeables.LivingFire Item.ResearchUnlockCount = 100; } - public override void SetDefaults() - { - Item.width = 10; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void PostUpdate() { @@ -37,6 +26,7 @@ namespace CalamityMod.Items.Placeables.LivingFire CreateRecipe(20). AddIngredient(ItemID.LivingFireBlock, 20). AddIngredient(). + AddTile(TileID.CrystalBall). Register(); } } diff --git a/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs b/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs index afab6f7513..f1e470235b 100644 --- a/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs +++ b/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs @@ -14,19 +14,7 @@ namespace CalamityMod.Items.Placeables.LivingFire Item.ResearchUnlockCount = 100; } - public override void SetDefaults() - { - Item.width = 10; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void PostUpdate() { @@ -38,6 +26,7 @@ namespace CalamityMod.Items.Placeables.LivingFire CreateRecipe(20). AddIngredient(ItemID.LivingFireBlock, 20). AddIngredient(). + AddTile(TileID.CrystalBall). Register(); } } diff --git a/Items/Placeables/LivingFire/LivingHolyFireBlock.cs b/Items/Placeables/LivingFire/LivingHolyFireBlock.cs index edc5fc89e4..0088f008a5 100644 --- a/Items/Placeables/LivingFire/LivingHolyFireBlock.cs +++ b/Items/Placeables/LivingFire/LivingHolyFireBlock.cs @@ -14,19 +14,7 @@ namespace CalamityMod.Items.Placeables.LivingFire Item.ResearchUnlockCount = 100; } - public override void SetDefaults() - { - Item.width = 10; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void PostUpdate() { @@ -38,6 +26,7 @@ namespace CalamityMod.Items.Placeables.LivingFire CreateRecipe(20). AddIngredient(ItemID.LivingFireBlock, 20). AddIngredient(). + AddTile(TileID.CrystalBall). Register(); } } diff --git a/Items/Placeables/LivingFire/LivingPlagueFireBlock.cs b/Items/Placeables/LivingFire/LivingPlagueFireBlock.cs new file mode 100644 index 0000000000..ad05630f0f --- /dev/null +++ b/Items/Placeables/LivingFire/LivingPlagueFireBlock.cs @@ -0,0 +1,33 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.LivingFire; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.LivingFire +{ + public class LivingPlagueFireBlock : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0f, 1f, 0.2f); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(ItemID.LivingFireBlock, 20). + AddIngredient(). + AddTile(TileID.CrystalBall). + Register(); + } + } +} diff --git a/Items/Placeables/LivingFire/LivingPlagueFireBlock.png b/Items/Placeables/LivingFire/LivingPlagueFireBlock.png new file mode 100644 index 0000000000..8b7b3dd14b Binary files /dev/null and b/Items/Placeables/LivingFire/LivingPlagueFireBlock.png differ diff --git a/Items/Placeables/MagentaCoral.cs b/Items/Placeables/MagentaCoral.cs deleted file mode 100644 index a78ffb95c0..0000000000 --- a/Items/Placeables/MagentaCoral.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class MagentaCoral : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.rare = ItemRarityID.Blue; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - - //public override void AddRecipes() - //{ - // CreateRecipe(4). - // AddIngredient(ItemID.PinkPearl). - // AddTile(TileID.HeavyWorkBench). - // Register(); - //} - } -} diff --git a/Items/Placeables/OrangeCoral.cs b/Items/Placeables/OrangeCoral.cs deleted file mode 100644 index d0dc22fe52..0000000000 --- a/Items/Placeables/OrangeCoral.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class OrangeCoral : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.rare = ItemRarityID.Blue; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - - //public override void AddRecipes() - //{ - // CreateRecipe(4). - // AddIngredient(ItemID.PinkPearl). - // AddTile(TileID.HeavyWorkBench). - // Register(); - //} - } -} diff --git a/Items/Placeables/Ores/AerialiteOre.cs b/Items/Placeables/Ores/AerialiteOre.cs index 85218b62c2..e9beb239f2 100644 --- a/Items/Placeables/Ores/AerialiteOre.cs +++ b/Items/Placeables/Ores/AerialiteOre.cs @@ -15,16 +15,7 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); 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 15a98f66f4..8b9b2ee7e2 100644 --- a/Items/Placeables/Ores/AerialiteOreDisenchanted.cs +++ b/Items/Placeables/Ores/AerialiteOreDisenchanted.cs @@ -15,16 +15,7 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); 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 6e3acc6cca..d9114c0a60 100644 --- a/Items/Placeables/Ores/AstralOre.cs +++ b/Items/Placeables/Ores/AstralOre.cs @@ -15,16 +15,7 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 22; - Item.height = 22; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); 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 b1e3ec05c6..e4d55a7f3f 100644 --- a/Items/Placeables/Ores/AuricOre.cs +++ b/Items/Placeables/Ores/AuricOre.cs @@ -1,4 +1,5 @@ -using CalamityMod.Rarities; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,18 +17,17 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 10; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 4); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 50); Item.rare = ModContent.RarityType(); } + + public override void AddRecipes() + { + CreateRecipe(30). + AddIngredient(). + AddCondition(Condition.NearShimmer). + Register(); + } } } diff --git a/Items/Placeables/Ores/CryonicOre.cs b/Items/Placeables/Ores/CryonicOre.cs index 808d5b4062..3f884f353e 100644 --- a/Items/Placeables/Ores/CryonicOre.cs +++ b/Items/Placeables/Ores/CryonicOre.cs @@ -15,17 +15,8 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 12); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 18); Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Placeables/Ores/ExodiumCluster.cs b/Items/Placeables/Ores/ExodiumCluster.cs index 5a56926b8b..f58e99f3a7 100644 --- a/Items/Placeables/Ores/ExodiumCluster.cs +++ b/Items/Placeables/Ores/ExodiumCluster.cs @@ -17,17 +17,8 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(gold: 1, silver: 60); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.Red; } } diff --git a/Items/Placeables/Ores/HallowedOre.cs b/Items/Placeables/Ores/HallowedOre.cs index 34abf9649b..9a436f95cc 100644 --- a/Items/Placeables/Ores/HallowedOre.cs +++ b/Items/Placeables/Ores/HallowedOre.cs @@ -15,16 +15,7 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); 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 f382f01c38..61abbbaeff 100644 --- a/Items/Placeables/Ores/InfernalSuevite.cs +++ b/Items/Placeables/Ores/InfernalSuevite.cs @@ -16,17 +16,8 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 12); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 16); Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Placeables/Ores/PerennialOre.cs b/Items/Placeables/Ores/PerennialOre.cs index a97770a14c..3a1ed29a5a 100644 --- a/Items/Placeables/Ores/PerennialOre.cs +++ b/Items/Placeables/Ores/PerennialOre.cs @@ -15,17 +15,8 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 12; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 18); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 25); Item.rare = ItemRarityID.Lime; } } diff --git a/Items/Placeables/Ores/ScoriaOre.cs b/Items/Placeables/Ores/ScoriaOre.cs index 889fbacf99..d2755dc865 100644 --- a/Items/Placeables/Ores/ScoriaOre.cs +++ b/Items/Placeables/Ores/ScoriaOre.cs @@ -16,17 +16,8 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 10; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 24); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 25); Item.rare = ItemRarityID.Yellow; } } diff --git a/Items/Placeables/Ores/UelibloomOre.cs b/Items/Placeables/Ores/UelibloomOre.cs index 1cbe71b9a4..e41ef45795 100644 --- a/Items/Placeables/Ores/UelibloomOre.cs +++ b/Items/Placeables/Ores/UelibloomOre.cs @@ -16,18 +16,9 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.width = 10; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 35); Item.rare = ModContent.RarityType(); - Item.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/PeatItem.cs b/Items/Placeables/PeatItem.cs deleted file mode 100644 index 3a66f54c81..0000000000 --- a/Items/Placeables/PeatItem.cs +++ /dev/null @@ -1,30 +0,0 @@ -using CalamityMod.Tiles.FloralParadise; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PeatItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 999; - } - } -} diff --git a/Items/Placeables/PeatMossItem.cs b/Items/Placeables/PeatMossItem.cs deleted file mode 100644 index 716931ef05..0000000000 --- a/Items/Placeables/PeatMossItem.cs +++ /dev/null @@ -1,30 +0,0 @@ -using CalamityMod.Tiles.FloralParadise; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PeatMossItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 999; - } - } -} diff --git a/Items/Placeables/PerennialBrick.cs b/Items/Placeables/PerennialBrick.cs index e3a817a227..90554133a1 100644 --- a/Items/Placeables/PerennialBrick.cs +++ b/Items/Placeables/PerennialBrick.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,10 +24,12 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/PlaceableTurrets/FireTurret.cs b/Items/Placeables/PlaceableTurrets/FireTurret.cs index 8127d848a9..f2494e86fd 100644 --- a/Items/Placeables/PlaceableTurrets/FireTurret.cs +++ b/Items/Placeables/PlaceableTurrets/FireTurret.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Pink; } diff --git a/Items/Placeables/PlaceableTurrets/HostileFireTurret.cs b/Items/Placeables/PlaceableTurrets/HostileFireTurret.cs index 7e58eddef6..81788cba31 100644 --- a/Items/Placeables/PlaceableTurrets/HostileFireTurret.cs +++ b/Items/Placeables/PlaceableTurrets/HostileFireTurret.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Placeables/PlaceableTurrets/HostileIceTurret.cs b/Items/Placeables/PlaceableTurrets/HostileIceTurret.cs index 7e20a68089..703b0d5d1e 100644 --- a/Items/Placeables/PlaceableTurrets/HostileIceTurret.cs +++ b/Items/Placeables/PlaceableTurrets/HostileIceTurret.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Placeables/PlaceableTurrets/HostileLabTurret.cs b/Items/Placeables/PlaceableTurrets/HostileLabTurret.cs index a3b8697082..1025683d72 100644 --- a/Items/Placeables/PlaceableTurrets/HostileLabTurret.cs +++ b/Items/Placeables/PlaceableTurrets/HostileLabTurret.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Orange; } } diff --git a/Items/Placeables/PlaceableTurrets/HostileLaserTurret.cs b/Items/Placeables/PlaceableTurrets/HostileLaserTurret.cs index c8e8ad5cd3..259a7deefa 100644 --- a/Items/Placeables/PlaceableTurrets/HostileLaserTurret.cs +++ b/Items/Placeables/PlaceableTurrets/HostileLaserTurret.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Placeables/PlaceableTurrets/HostileOnyxTurret.cs b/Items/Placeables/PlaceableTurrets/HostileOnyxTurret.cs index e4597d2ef6..e8325902a8 100644 --- a/Items/Placeables/PlaceableTurrets/HostileOnyxTurret.cs +++ b/Items/Placeables/PlaceableTurrets/HostileOnyxTurret.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Orange; } } diff --git a/Items/Placeables/PlaceableTurrets/HostilePlagueTurret.cs b/Items/Placeables/PlaceableTurrets/HostilePlagueTurret.cs index 492f01fc41..c98f5193fd 100644 --- a/Items/Placeables/PlaceableTurrets/HostilePlagueTurret.cs +++ b/Items/Placeables/PlaceableTurrets/HostilePlagueTurret.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 20, 0, 0); + Item.value = Item.sellPrice(gold: 4); Item.rare = ItemRarityID.Yellow; } } diff --git a/Items/Placeables/PlaceableTurrets/HostileWaterTurret.cs b/Items/Placeables/PlaceableTurrets/HostileWaterTurret.cs index 8edc6bc17f..bd7c54752c 100644 --- a/Items/Placeables/PlaceableTurrets/HostileWaterTurret.cs +++ b/Items/Placeables/PlaceableTurrets/HostileWaterTurret.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Orange; } } diff --git a/Items/Placeables/PlaceableTurrets/IceTurret.cs b/Items/Placeables/PlaceableTurrets/IceTurret.cs index 74996095c7..5882121585 100644 --- a/Items/Placeables/PlaceableTurrets/IceTurret.cs +++ b/Items/Placeables/PlaceableTurrets/IceTurret.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Pink; } diff --git a/Items/Placeables/PlaceableTurrets/LabTurret.cs b/Items/Placeables/PlaceableTurrets/LabTurret.cs index 309ea046d5..ffd9663bcc 100644 --- a/Items/Placeables/PlaceableTurrets/LabTurret.cs +++ b/Items/Placeables/PlaceableTurrets/LabTurret.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Orange; } @@ -26,7 +26,6 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets CreateRecipe(). AddIngredient(14). AddIngredient(20). - AddIngredient(). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Func condition), condition). AddTile(TileID.Anvils). Register(); diff --git a/Items/Placeables/PlaceableTurrets/LaserTurret .cs b/Items/Placeables/PlaceableTurrets/LaserTurret .cs index bbfa32629c..c3bd0ffb62 100644 --- a/Items/Placeables/PlaceableTurrets/LaserTurret .cs +++ b/Items/Placeables/PlaceableTurrets/LaserTurret .cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Pink; } diff --git a/Items/Placeables/PlaceableTurrets/OnyxTurret.cs b/Items/Placeables/PlaceableTurrets/OnyxTurret.cs index 94ee1a3708..68349ef1ef 100644 --- a/Items/Placeables/PlaceableTurrets/OnyxTurret.cs +++ b/Items/Placeables/PlaceableTurrets/OnyxTurret.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Orange; } diff --git a/Items/Placeables/PlaceableTurrets/PlagueTurret.cs b/Items/Placeables/PlaceableTurrets/PlagueTurret.cs index 7fb7eb6eaf..76ae55713d 100644 --- a/Items/Placeables/PlaceableTurrets/PlagueTurret.cs +++ b/Items/Placeables/PlaceableTurrets/PlagueTurret.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 20, 0, 0); + Item.value = Item.sellPrice(gold: 4); Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Placeables/PlaceableTurrets/WaterTurret.cs b/Items/Placeables/PlaceableTurrets/WaterTurret.cs index 6eb12d47f0..b2fa1aa6bf 100644 --- a/Items/Placeables/PlaceableTurrets/WaterTurret.cs +++ b/Items/Placeables/PlaceableTurrets/WaterTurret.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.PlaceableTurrets { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Orange; } diff --git a/Items/Placeables/PlantyMush.cs b/Items/Placeables/PlantyMush.cs deleted file mode 100644 index e1477cf719..0000000000 --- a/Items/Placeables/PlantyMush.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PlantyMush : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 6); - Item.rare = ItemRarityID.Orange; - } - - public override void CaughtFishStack(ref int stack) - { - stack = Main.rand.Next(5, 16); - } - } -} diff --git a/Items/Placeables/Plates/Cinderplate.cs b/Items/Placeables/Plates/Cinderplate.cs index 7d4b3976ca..197a893bb1 100644 --- a/Items/Placeables/Plates/Cinderplate.cs +++ b/Items/Placeables/Plates/Cinderplate.cs @@ -17,16 +17,7 @@ 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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; } @@ -41,6 +32,7 @@ namespace CalamityMod.Items.Placeables.Plates CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/Plates/Elumplate.cs b/Items/Placeables/Plates/Elumplate.cs index f01666932c..156b399188 100644 --- a/Items/Placeables/Plates/Elumplate.cs +++ b/Items/Placeables/Plates/Elumplate.cs @@ -17,16 +17,7 @@ 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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; } @@ -41,6 +32,7 @@ namespace CalamityMod.Items.Placeables.Plates CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/Plates/Havocplate.cs b/Items/Placeables/Plates/Havocplate.cs index 7493866f59..51185cd79c 100644 --- a/Items/Placeables/Plates/Havocplate.cs +++ b/Items/Placeables/Plates/Havocplate.cs @@ -18,16 +18,7 @@ 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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; } @@ -42,6 +33,7 @@ namespace CalamityMod.Items.Placeables.Plates CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/Plates/Navyplate.cs b/Items/Placeables/Plates/Navyplate.cs index 0471f5826e..6c512b142c 100644 --- a/Items/Placeables/Plates/Navyplate.cs +++ b/Items/Placeables/Plates/Navyplate.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.Walls; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,16 +17,7 @@ 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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; } @@ -40,6 +32,7 @@ namespace CalamityMod.Items.Placeables.Plates CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/Plates/Onyxplate.cs b/Items/Placeables/Plates/Onyxplate.cs index 287167982e..4b77b92416 100644 --- a/Items/Placeables/Plates/Onyxplate.cs +++ b/Items/Placeables/Plates/Onyxplate.cs @@ -17,16 +17,7 @@ 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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; } @@ -40,6 +31,7 @@ namespace CalamityMod.Items.Placeables.Plates CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/Plates/Plagueplate.cs b/Items/Placeables/Plates/Plagueplate.cs index 513a8efbed..d9b40426e9 100644 --- a/Items/Placeables/Plates/Plagueplate.cs +++ b/Items/Placeables/Plates/Plagueplate.cs @@ -18,16 +18,7 @@ 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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; } @@ -42,6 +33,7 @@ namespace CalamityMod.Items.Placeables.Plates CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/PolypSand.cs b/Items/Placeables/PolypSand.cs deleted file mode 100644 index 89c5bb8aa1..0000000000 --- a/Items/Placeables/PolypSand.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PolypSand : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - } -} diff --git a/Items/Placeables/PrismShard.cs b/Items/Placeables/PrismShard.cs deleted file mode 100644 index ba6cf09ed3..0000000000 --- a/Items/Placeables/PrismShard.cs +++ /dev/null @@ -1,31 +0,0 @@ -using CalamityMod.Tiles.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables -{ - public class PrismShard : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 26; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 3); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Placeables/Pylons/AstralPylon.cs b/Items/Placeables/Pylons/AstralPylon.cs index 4d7b4fe3c2..a235dbf6a8 100644 --- a/Items/Placeables/Pylons/AstralPylon.cs +++ b/Items/Placeables/Pylons/AstralPylon.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Pylons { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Blue; } } diff --git a/Items/Placeables/Pylons/CragsPylon.cs b/Items/Placeables/Pylons/CragsPylon.cs index edc0814c5f..3b63072df8 100644 --- a/Items/Placeables/Pylons/CragsPylon.cs +++ b/Items/Placeables/Pylons/CragsPylon.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Pylons { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Blue; } } diff --git a/Items/Placeables/Pylons/SulphurPylon.cs b/Items/Placeables/Pylons/SulphurPylon.cs index 5d9f6bf998..5210731b6e 100644 --- a/Items/Placeables/Pylons/SulphurPylon.cs +++ b/Items/Placeables/Pylons/SulphurPylon.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Pylons { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Blue; } } diff --git a/Items/Placeables/Pylons/SunkenPylon.cs b/Items/Placeables/Pylons/SunkenPylon.cs index 13408a5f66..e0e1d30843 100644 --- a/Items/Placeables/Pylons/SunkenPylon.cs +++ b/Items/Placeables/Pylons/SunkenPylon.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Pylons { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(0, 10, 0, 0); + Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Blue; } } diff --git a/Items/Placeables/PyreMantle.cs b/Items/Placeables/PyreMantle.cs deleted file mode 100644 index f24554f03f..0000000000 --- a/Items/Placeables/PyreMantle.cs +++ /dev/null @@ -1,29 +0,0 @@ -using CalamityMod.Items.Placeables.Walls; -using Terraria.ID; -using Terraria.ModLoader; // If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" - -namespace CalamityMod.Items.Placeables -{ - public class PyreMantle : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - } -} diff --git a/Items/Placeables/PyreMantleMolten.cs b/Items/Placeables/PyreMantleMolten.cs deleted file mode 100644 index bef3851c68..0000000000 --- a/Items/Placeables/PyreMantleMolten.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Placeables.Walls; -using Terraria.ID; -using Terraria.ModLoader; // If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" - -namespace CalamityMod.Items.Placeables -{ - public class PyreMantleMolten : 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(25). - AddIngredient(ItemID.LavaBucket). - AddIngredient(25). - AddTile(TileID.Furnaces). - Register(); - } - } -} diff --git a/Items/Placeables/RuneSand.cs b/Items/Placeables/RuneSand.cs deleted file mode 100644 index 1dc5aebddb..0000000000 --- a/Items/Placeables/RuneSand.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class RuneSand : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - } -} diff --git a/Items/Placeables/Runestone.cs b/Items/Placeables/Runestone.cs deleted file mode 100644 index 29e003cc66..0000000000 --- a/Items/Placeables/Runestone.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Walls; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class Runestone : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 200; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.rare = ItemRarityID.Blue; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - } -} diff --git a/Items/Placeables/ScintillatingBloom.cs b/Items/Placeables/ScintillatingBloom.cs deleted file mode 100644 index cb8daca949..0000000000 --- a/Items/Placeables/ScintillatingBloom.cs +++ /dev/null @@ -1,31 +0,0 @@ -using CalamityMod.Tiles.FloralParadise; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ScintillatingBloom : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 10; - } - - public override void SetDefaults() - { - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 24; - Item.height = 24; - Item.maxStack = 999; - } - } -} diff --git a/Items/Placeables/ScorchedRemains.cs b/Items/Placeables/ScorchedRemains.cs deleted file mode 100644 index 864a890ab9..0000000000 --- a/Items/Placeables/ScorchedRemains.cs +++ /dev/null @@ -1,31 +0,0 @@ -using CalamityMod.Items.Placeables.Walls; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ScorchedRemains : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = 1000; - Item.rare = ItemRarityID.Orange; - } - } -} diff --git a/Items/Placeables/ScoriaBrick.cs b/Items/Placeables/ScoriaBrick.cs index f0b96cfd2f..36f6446fe3 100644 --- a/Items/Placeables/ScoriaBrick.cs +++ b/Items/Placeables/ScoriaBrick.cs @@ -10,21 +10,7 @@ namespace CalamityMod.Items.Placeables public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() => Item.ResearchUnlockCount = 100; - public override void SetDefaults() - { - Item.width = 24; - Item.height = 25; - Item.maxStack = 9999; - Item.value = 0; - Item.rare = ItemRarityID.Blue; - 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -36,6 +22,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/Shellstone.cs b/Items/Placeables/Shellstone.cs deleted file mode 100644 index f0e23fd388..0000000000 --- a/Items/Placeables/Shellstone.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class Shellstone : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - } -} diff --git a/Items/Placeables/SpineSapling.cs b/Items/Placeables/SpineSapling.cs deleted file mode 100644 index 2fc99a8ed9..0000000000 --- a/Items/Placeables/SpineSapling.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SpineSapling : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } - } -} diff --git a/Items/Placeables/Stohne.cs b/Items/Placeables/Stohne.cs new file mode 100644 index 0000000000..1e17d1f9ee --- /dev/null +++ b/Items/Placeables/Stohne.cs @@ -0,0 +1,16 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class Stohne : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/Stohne.png b/Items/Placeables/Stohne.png new file mode 100644 index 0000000000..60d4e9c891 Binary files /dev/null and b/Items/Placeables/Stohne.png differ diff --git a/Items/Placeables/SunkenSea/Basalt.cs b/Items/Placeables/SunkenSea/Basalt.cs new file mode 100644 index 0000000000..b6445da5bb --- /dev/null +++ b/Items/Placeables/SunkenSea/Basalt.cs @@ -0,0 +1,16 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class Basalt : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/Basalt.png b/Items/Placeables/SunkenSea/Basalt.png similarity index 100% rename from Items/Placeables/Basalt.png rename to Items/Placeables/SunkenSea/Basalt.png diff --git a/Items/Placeables/BlackPearlPile.cs b/Items/Placeables/SunkenSea/BlackPearlPile.cs similarity index 59% rename from Items/Placeables/BlackPearlPile.cs rename to Items/Placeables/SunkenSea/BlackPearlPile.cs index 2f44d3cd68..e7c6b445ab 100644 --- a/Items/Placeables/BlackPearlPile.cs +++ b/Items/Placeables/SunkenSea/BlackPearlPile.cs @@ -1,7 +1,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class BlackPearlPile : ModItem, ILocalizedModType { @@ -13,17 +13,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - Item.width = 12; - Item.height = 12; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.rare = ItemRarityID.Blue; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); } public override void AddRecipes() diff --git a/Items/Placeables/BlackPearlPile.png b/Items/Placeables/SunkenSea/BlackPearlPile.png similarity index 100% rename from Items/Placeables/BlackPearlPile.png rename to Items/Placeables/SunkenSea/BlackPearlPile.png diff --git a/Items/Placeables/SunkenSea/CyanCoral.cs b/Items/Placeables/SunkenSea/CyanCoral.cs new file mode 100644 index 0000000000..4cb4280873 --- /dev/null +++ b/Items/Placeables/SunkenSea/CyanCoral.cs @@ -0,0 +1,21 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class CyanCoral : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Placeables/CyanCoral.png b/Items/Placeables/SunkenSea/CyanCoral.png similarity index 100% rename from Items/Placeables/CyanCoral.png rename to Items/Placeables/SunkenSea/CyanCoral.png diff --git a/Items/Placeables/Driftwood.cs b/Items/Placeables/SunkenSea/Driftwood.cs similarity index 56% rename from Items/Placeables/Driftwood.cs rename to Items/Placeables/SunkenSea/Driftwood.cs index 72db8e2f9f..d870b66fb5 100644 --- a/Items/Placeables/Driftwood.cs +++ b/Items/Placeables/SunkenSea/Driftwood.cs @@ -1,7 +1,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class Driftwood : ModItem, ILocalizedModType { @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Wood; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { @@ -34,8 +22,9 @@ namespace CalamityMod.Items.Placeables public override void AddRecipes() { CreateRecipe(4). - AddIngredient(4). + AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/Driftwood.png b/Items/Placeables/SunkenSea/Driftwood.png similarity index 100% rename from Items/Placeables/Driftwood.png rename to Items/Placeables/SunkenSea/Driftwood.png diff --git a/Items/Placeables/SunkenSea/EutrophicGlass.cs b/Items/Placeables/SunkenSea/EutrophicGlass.cs new file mode 100644 index 0000000000..d278bac6a7 --- /dev/null +++ b/Items/Placeables/SunkenSea/EutrophicGlass.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class EutrophicGlass : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(2). + AddTile(TileID.Furnaces). + Register(); + } + } +} diff --git a/Items/Placeables/EutrophicGlass.png b/Items/Placeables/SunkenSea/EutrophicGlass.png similarity index 100% rename from Items/Placeables/EutrophicGlass.png rename to Items/Placeables/SunkenSea/EutrophicGlass.png diff --git a/Items/Placeables/EutrophicSand.cs b/Items/Placeables/SunkenSea/EutrophicSand.cs similarity index 93% rename from Items/Placeables/EutrophicSand.cs rename to Items/Placeables/SunkenSea/EutrophicSand.cs index 202584c1e0..903c1b2618 100644 --- a/Items/Placeables/EutrophicSand.cs +++ b/Items/Placeables/SunkenSea/EutrophicSand.cs @@ -4,7 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class EutrophicSand : ModItem, ILocalizedModType { @@ -30,6 +30,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/EutrophicSand.png b/Items/Placeables/SunkenSea/EutrophicSand.png similarity index 100% rename from Items/Placeables/EutrophicSand.png rename to Items/Placeables/SunkenSea/EutrophicSand.png diff --git a/Items/Placeables/HardenedEutrophicSand.cs b/Items/Placeables/SunkenSea/HardenedEutrophicSand.cs similarity index 58% rename from Items/Placeables/HardenedEutrophicSand.cs rename to Items/Placeables/SunkenSea/HardenedEutrophicSand.cs index d12f6498e8..c950d573fc 100644 --- a/Items/Placeables/HardenedEutrophicSand.cs +++ b/Items/Placeables/SunkenSea/HardenedEutrophicSand.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class HardenedEutrophicSand : ModItem, ILocalizedModType { @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/HardenedEutrophicSand.png b/Items/Placeables/SunkenSea/HardenedEutrophicSand.png similarity index 100% rename from Items/Placeables/HardenedEutrophicSand.png rename to Items/Placeables/SunkenSea/HardenedEutrophicSand.png diff --git a/Items/Placeables/LimeCoral.cs b/Items/Placeables/SunkenSea/LimeCoral.cs similarity index 59% rename from Items/Placeables/LimeCoral.cs rename to Items/Placeables/SunkenSea/LimeCoral.cs index 67ed0a5725..eb2122adb7 100644 --- a/Items/Placeables/LimeCoral.cs +++ b/Items/Placeables/SunkenSea/LimeCoral.cs @@ -1,7 +1,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class LimeCoral : ModItem, ILocalizedModType { @@ -9,21 +9,13 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { - Item.width = 12; - Item.height = 12; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.rare = ItemRarityID.Blue; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); } //public override void AddRecipes() diff --git a/Items/Placeables/LimeCoral.png b/Items/Placeables/SunkenSea/LimeCoral.png similarity index 100% rename from Items/Placeables/LimeCoral.png rename to Items/Placeables/SunkenSea/LimeCoral.png diff --git a/Items/Placeables/SunkenSea/Limestone.cs b/Items/Placeables/SunkenSea/Limestone.cs new file mode 100644 index 0000000000..faa2a7a1d5 --- /dev/null +++ b/Items/Placeables/SunkenSea/Limestone.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class Limestone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + + } +} diff --git a/Items/Placeables/Limestone.png b/Items/Placeables/SunkenSea/Limestone.png similarity index 100% rename from Items/Placeables/Limestone.png rename to Items/Placeables/SunkenSea/Limestone.png diff --git a/Items/Placeables/SunkenSea/MagentaCoral.cs b/Items/Placeables/SunkenSea/MagentaCoral.cs new file mode 100644 index 0000000000..02553282f3 --- /dev/null +++ b/Items/Placeables/SunkenSea/MagentaCoral.cs @@ -0,0 +1,21 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class MagentaCoral : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Placeables/MagentaCoral.png b/Items/Placeables/SunkenSea/MagentaCoral.png similarity index 100% rename from Items/Placeables/MagentaCoral.png rename to Items/Placeables/SunkenSea/MagentaCoral.png diff --git a/Items/Placeables/Navystone.cs b/Items/Placeables/SunkenSea/Navystone.cs similarity index 63% rename from Items/Placeables/Navystone.cs rename to Items/Placeables/SunkenSea/Navystone.cs index bb4af23fa1..247e14cc42 100644 --- a/Items/Placeables/Navystone.cs +++ b/Items/Placeables/SunkenSea/Navystone.cs @@ -3,7 +3,7 @@ using CalamityMod.Items.Placeables.Walls; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class Navystone : ModItem, ILocalizedModType { @@ -14,29 +14,19 @@ namespace CalamityMod.Items.Placeables ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 13; - Item.height = 10; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/Navystone.png b/Items/Placeables/SunkenSea/Navystone.png similarity index 100% rename from Items/Placeables/Navystone.png rename to Items/Placeables/SunkenSea/Navystone.png diff --git a/Items/Placeables/SunkenSea/OrangeCoral.cs b/Items/Placeables/SunkenSea/OrangeCoral.cs new file mode 100644 index 0000000000..02ddc9fdfa --- /dev/null +++ b/Items/Placeables/SunkenSea/OrangeCoral.cs @@ -0,0 +1,20 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class OrangeCoral : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Placeables/OrangeCoral.png b/Items/Placeables/SunkenSea/OrangeCoral.png similarity index 100% rename from Items/Placeables/OrangeCoral.png rename to Items/Placeables/SunkenSea/OrangeCoral.png diff --git a/Items/Placeables/PinkPearlPile.cs b/Items/Placeables/SunkenSea/PinkPearlPile.cs similarity index 59% rename from Items/Placeables/PinkPearlPile.cs rename to Items/Placeables/SunkenSea/PinkPearlPile.cs index 2307018521..2c29d35fd3 100644 --- a/Items/Placeables/PinkPearlPile.cs +++ b/Items/Placeables/SunkenSea/PinkPearlPile.cs @@ -1,7 +1,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class PinkPearlPile : ModItem, ILocalizedModType { @@ -13,17 +13,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - Item.width = 12; - Item.height = 12; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.rare = ItemRarityID.Blue; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); } public override void AddRecipes() diff --git a/Items/Placeables/PinkPearlPile.png b/Items/Placeables/SunkenSea/PinkPearlPile.png similarity index 100% rename from Items/Placeables/PinkPearlPile.png rename to Items/Placeables/SunkenSea/PinkPearlPile.png diff --git a/Items/Placeables/PolishedNavystoneBrick.cs b/Items/Placeables/SunkenSea/PolishedNavystoneBrick.cs similarity index 50% rename from Items/Placeables/PolishedNavystoneBrick.cs rename to Items/Placeables/SunkenSea/PolishedNavystoneBrick.cs index d8866493c8..e0aa52e928 100644 --- a/Items/Placeables/PolishedNavystoneBrick.cs +++ b/Items/Placeables/SunkenSea/PolishedNavystoneBrick.cs @@ -1,7 +1,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class PolishedNavystoneBrick : ModItem, ILocalizedModType { @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/PolishedNavystoneBrick.png b/Items/Placeables/SunkenSea/PolishedNavystoneBrick.png similarity index 100% rename from Items/Placeables/PolishedNavystoneBrick.png rename to Items/Placeables/SunkenSea/PolishedNavystoneBrick.png diff --git a/Items/Placeables/SunkenSea/PolypSand.cs b/Items/Placeables/SunkenSea/PolypSand.cs new file mode 100644 index 0000000000..50c699626f --- /dev/null +++ b/Items/Placeables/SunkenSea/PolypSand.cs @@ -0,0 +1,16 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class PolypSand : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/PolypSand.png b/Items/Placeables/SunkenSea/PolypSand.png similarity index 100% rename from Items/Placeables/PolypSand.png rename to Items/Placeables/SunkenSea/PolypSand.png diff --git a/Items/Placeables/SunkenSea/PrismShard.cs b/Items/Placeables/SunkenSea/PrismShard.cs new file mode 100644 index 0000000000..9a4907a8a1 --- /dev/null +++ b/Items/Placeables/SunkenSea/PrismShard.cs @@ -0,0 +1,22 @@ +using CalamityMod.Tiles.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class PrismShard : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Placeables/PrismShard.png b/Items/Placeables/SunkenSea/PrismShard.png similarity index 100% rename from Items/Placeables/PrismShard.png rename to Items/Placeables/SunkenSea/PrismShard.png diff --git a/Items/Placeables/SunkenSea/RuneSand.cs b/Items/Placeables/SunkenSea/RuneSand.cs new file mode 100644 index 0000000000..b5c6ead314 --- /dev/null +++ b/Items/Placeables/SunkenSea/RuneSand.cs @@ -0,0 +1,17 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class RuneSand : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/RuneSand.png b/Items/Placeables/SunkenSea/RuneSand.png similarity index 100% rename from Items/Placeables/RuneSand.png rename to Items/Placeables/SunkenSea/RuneSand.png diff --git a/Items/Placeables/SunkenSea/Runestone.cs b/Items/Placeables/SunkenSea/Runestone.cs new file mode 100644 index 0000000000..cca228044b --- /dev/null +++ b/Items/Placeables/SunkenSea/Runestone.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class Runestone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 200; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); + } + + } +} diff --git a/Items/Placeables/Runestone.png b/Items/Placeables/SunkenSea/Runestone.png similarity index 100% rename from Items/Placeables/Runestone.png rename to Items/Placeables/SunkenSea/Runestone.png diff --git a/Items/Placeables/SeaPrism.cs b/Items/Placeables/SunkenSea/SeaPrism.cs similarity index 56% rename from Items/Placeables/SeaPrism.cs rename to Items/Placeables/SunkenSea/SeaPrism.cs index a2d6bda82f..855ff7fa4a 100644 --- a/Items/Placeables/SeaPrism.cs +++ b/Items/Placeables/SunkenSea/SeaPrism.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class SeaPrism : ModItem, ILocalizedModType { @@ -14,17 +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; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(silver: 10); + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Green; } diff --git a/Items/Placeables/SeaPrism.png b/Items/Placeables/SunkenSea/SeaPrism.png similarity index 100% rename from Items/Placeables/SeaPrism.png rename to Items/Placeables/SunkenSea/SeaPrism.png diff --git a/Items/Placeables/SeaPrismBrick.cs b/Items/Placeables/SunkenSea/SeaPrismBrick.cs similarity index 54% rename from Items/Placeables/SeaPrismBrick.cs rename to Items/Placeables/SunkenSea/SeaPrismBrick.cs index f87e0cd49c..d247dbfee9 100644 --- a/Items/Placeables/SeaPrismBrick.cs +++ b/Items/Placeables/SunkenSea/SeaPrismBrick.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class SeaPrismBrick : ModItem, ILocalizedModType { @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables Item.ResearchUnlockCount = 100; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.createTile = ModContent.TileType(); - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/SeaPrismBrick.png b/Items/Placeables/SunkenSea/SeaPrismBrick.png similarity index 100% rename from Items/Placeables/SeaPrismBrick.png rename to Items/Placeables/SunkenSea/SeaPrismBrick.png diff --git a/Items/Placeables/SunkenSea/Shellstone.cs b/Items/Placeables/SunkenSea/Shellstone.cs new file mode 100644 index 0000000000..321018307f --- /dev/null +++ b/Items/Placeables/SunkenSea/Shellstone.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class Shellstone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); + } + + } +} diff --git a/Items/Placeables/Shellstone.png b/Items/Placeables/SunkenSea/Shellstone.png similarity index 100% rename from Items/Placeables/Shellstone.png rename to Items/Placeables/SunkenSea/Shellstone.png diff --git a/Items/Placeables/ShellstoneSlab.cs b/Items/Placeables/SunkenSea/ShellstoneSlab.cs similarity index 58% rename from Items/Placeables/ShellstoneSlab.cs rename to Items/Placeables/SunkenSea/ShellstoneSlab.cs index 4ddac14904..2e3be721f4 100644 --- a/Items/Placeables/ShellstoneSlab.cs +++ b/Items/Placeables/SunkenSea/ShellstoneSlab.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class ShellstoneSlab : ModItem, ILocalizedModType { @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -35,6 +23,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/ShellstoneSlab.png b/Items/Placeables/SunkenSea/ShellstoneSlab.png similarity index 100% rename from Items/Placeables/ShellstoneSlab.png rename to Items/Placeables/SunkenSea/ShellstoneSlab.png diff --git a/Items/Placeables/SunkenSea/VolcanicSand.cs b/Items/Placeables/SunkenSea/VolcanicSand.cs new file mode 100644 index 0000000000..277f746966 --- /dev/null +++ b/Items/Placeables/SunkenSea/VolcanicSand.cs @@ -0,0 +1,16 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class VolcanicSand : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/VolcanicSand.png b/Items/Placeables/SunkenSea/VolcanicSand.png similarity index 100% rename from Items/Placeables/VolcanicSand.png rename to Items/Placeables/SunkenSea/VolcanicSand.png diff --git a/Items/Placeables/WhitePearlPile.cs b/Items/Placeables/SunkenSea/WhitePearlPile.cs similarity index 59% rename from Items/Placeables/WhitePearlPile.cs rename to Items/Placeables/SunkenSea/WhitePearlPile.cs index 2c771bf04d..4f33aeaa35 100644 --- a/Items/Placeables/WhitePearlPile.cs +++ b/Items/Placeables/SunkenSea/WhitePearlPile.cs @@ -1,7 +1,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.SunkenSea { public class WhitePearlPile : ModItem, ILocalizedModType { @@ -13,17 +13,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - Item.width = 12; - Item.height = 12; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.rare = ItemRarityID.Blue; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); } public override void AddRecipes() diff --git a/Items/Placeables/WhitePearlPile.png b/Items/Placeables/SunkenSea/WhitePearlPile.png similarity index 100% rename from Items/Placeables/WhitePearlPile.png rename to Items/Placeables/SunkenSea/WhitePearlPile.png diff --git a/Items/Placeables/SunkenSea/YellowCoral.cs b/Items/Placeables/SunkenSea/YellowCoral.cs new file mode 100644 index 0000000000..ea25a171e5 --- /dev/null +++ b/Items/Placeables/SunkenSea/YellowCoral.cs @@ -0,0 +1,21 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class YellowCoral : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Placeables/YellowCoral.png b/Items/Placeables/SunkenSea/YellowCoral.png similarity index 100% rename from Items/Placeables/YellowCoral.png rename to Items/Placeables/SunkenSea/YellowCoral.png diff --git a/Items/Placeables/UelibloomBrick.cs b/Items/Placeables/UelibloomBrick.cs index bc47762db3..b90fd18f95 100644 --- a/Items/Placeables/UelibloomBrick.cs +++ b/Items/Placeables/UelibloomBrick.cs @@ -14,19 +14,7 @@ namespace CalamityMod.Items.Placeables 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 SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { @@ -38,9 +26,11 @@ namespace CalamityMod.Items.Placeables CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). + DisableDecraft(). Register(); CreateRecipe(). AddIngredient(2). + DisableDecraft(). Register(); } } diff --git a/Items/Placeables/VernalSoil.cs b/Items/Placeables/VernalSoil.cs index 04e7d27cc4..0339f3c9e9 100644 --- a/Items/Placeables/VernalSoil.cs +++ b/Items/Placeables/VernalSoil.cs @@ -11,18 +11,6 @@ namespace CalamityMod.Items.Placeables Item.ResearchUnlockCount = 10; } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); } } diff --git a/Items/Placeables/Voidstone.cs b/Items/Placeables/Voidstone.cs deleted file mode 100644 index d8101cd36d..0000000000 --- a/Items/Placeables/Voidstone.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Placeables.Walls; -using Terraria.ID; -using Terraria.ModLoader; // If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" - -namespace CalamityMod.Items.Placeables -{ - public class Voidstone : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(4). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Placeables/VolcanicSand.cs b/Items/Placeables/VolcanicSand.cs deleted file mode 100644 index 7f79888f53..0000000000 --- a/Items/Placeables/VolcanicSand.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VolcanicSand : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - } -} diff --git a/Items/Placeables/Walls/AbyssGravelWallItem.cs b/Items/Placeables/Walls/AbyssGravelWallItem.cs index 4733ef5b8b..943045e744 100644 --- a/Items/Placeables/Walls/AbyssGravelWallItem.cs +++ b/Items/Placeables/Walls/AbyssGravelWallItem.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Abyss; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 24; - Item.height = 24; - 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 SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AcidwoodWallItem.cs b/Items/Placeables/Walls/AcidwoodWallItem.cs index a755a6c675..51968f9e81 100644 --- a/Items/Placeables/Walls/AcidwoodWallItem.cs +++ b/Items/Placeables/Walls/AcidwoodWallItem.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Abyss; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - 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 SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AerialiteBrickWall.cs b/Items/Placeables/Walls/AerialiteBrickWall.cs index a49136e248..a62cea94ee 100644 --- a/Items/Placeables/Walls/AerialiteBrickWall.cs +++ b/Items/Placeables/Walls/AerialiteBrickWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AshenSlabWall.cs b/Items/Placeables/Walls/AshenSlabWall.cs index 6aff536c43..348e4e7b9c 100644 --- a/Items/Placeables/Walls/AshenSlabWall.cs +++ b/Items/Placeables/Walls/AshenSlabWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralBrickWall.cs b/Items/Placeables/Walls/AstralBrickWall.cs index e3c7958e7d..a340aa269f 100644 --- a/Items/Placeables/Walls/AstralBrickWall.cs +++ b/Items/Placeables/Walls/AstralBrickWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralDirtWall.cs b/Items/Placeables/Walls/AstralDirtWall.cs index b9d55f4747..92f04ca230 100644 --- a/Items/Placeables/Walls/AstralDirtWall.cs +++ b/Items/Placeables/Walls/AstralDirtWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralGrassWall.cs b/Items/Placeables/Walls/AstralGrassWall.cs index 0351a93277..4b733618b7 100644 --- a/Items/Placeables/Walls/AstralGrassWall.cs +++ b/Items/Placeables/Walls/AstralGrassWall.cs @@ -12,18 +12,6 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); } } diff --git a/Items/Placeables/Walls/AstralIceWall.cs b/Items/Placeables/Walls/AstralIceWall.cs index c579ec979d..c97435081c 100644 --- a/Items/Placeables/Walls/AstralIceWall.cs +++ b/Items/Placeables/Walls/AstralIceWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralMonolithWall.cs b/Items/Placeables/Walls/AstralMonolithWall.cs index 756cf24167..0066082c69 100644 --- a/Items/Placeables/Walls/AstralMonolithWall.cs +++ b/Items/Placeables/Walls/AstralMonolithWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralSandstoneWall.cs b/Items/Placeables/Walls/AstralSandstoneWall.cs index 3ac6117746..aba828d058 100644 --- a/Items/Placeables/Walls/AstralSandstoneWall.cs +++ b/Items/Placeables/Walls/AstralSandstoneWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralSnowWall.cs b/Items/Placeables/Walls/AstralSnowWall.cs index d8c56c6d97..ad137271ff 100644 --- a/Items/Placeables/Walls/AstralSnowWall.cs +++ b/Items/Placeables/Walls/AstralSnowWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralStoneWall.cs b/Items/Placeables/Walls/AstralStoneWall.cs index 7391417a80..25f2ec002e 100644 --- a/Items/Placeables/Walls/AstralStoneWall.cs +++ b/Items/Placeables/Walls/AstralStoneWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/BrimstoneSlabWall.cs b/Items/Placeables/Walls/BrimstoneSlabWall.cs index 7ca2bcc0bf..5b29cdcb07 100644 --- a/Items/Placeables/Walls/BrimstoneSlabWall.cs +++ b/Items/Placeables/Walls/BrimstoneSlabWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Crags; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/BrimstoneSlagWall.cs b/Items/Placeables/Walls/BrimstoneSlagWall.cs index 5694ffc362..a2febbce97 100644 --- a/Items/Placeables/Walls/BrimstoneSlagWall.cs +++ b/Items/Placeables/Walls/BrimstoneSlagWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Crags; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -11,19 +12,8 @@ namespace CalamityMod.Items.Placeables.Walls { Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/CelestialRemainsWall.cs b/Items/Placeables/Walls/CelestialRemainsWall.cs index 2c41dcb379..b3b8f5dfc0 100644 --- a/Items/Placeables/Walls/CelestialRemainsWall.cs +++ b/Items/Placeables/Walls/CelestialRemainsWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -13,19 +14,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/CinderplateWall.cs b/Items/Placeables/Walls/CinderplateWall.cs index 6b23fe0f91..15dde19795 100644 --- a/Items/Placeables/Walls/CinderplateWall.cs +++ b/Items/Placeables/Walls/CinderplateWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/CosmiliteBrickWall.cs b/Items/Placeables/Walls/CosmiliteBrickWall.cs index b18e61237b..eaa38bb641 100644 --- a/Items/Placeables/Walls/CosmiliteBrickWall.cs +++ b/Items/Placeables/Walls/CosmiliteBrickWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls 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 SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/CryonicBrickWall.cs b/Items/Placeables/Walls/CryonicBrickWall.cs index 8d1275ffee..c5099e6035 100644 --- a/Items/Placeables/Walls/CryonicBrickWall.cs +++ b/Items/Placeables/Walls/CryonicBrickWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs index 0cb7c2efd2..b4d0a32192 100644 --- a/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs index 2a7771a90b..bdeed11d99 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs index bf55238513..e5ad36d018 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs index fd1abf025c..3e91ed90ff 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs index 327f8dd6fc..587e7dea29 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs index 0e9159a2d8..2f626acdad 100644 --- a/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs index 76fb957605..97adbda804 100644 --- a/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs index ed0c494ae5..40d801901f 100644 --- a/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DriftwoodWall.cs b/Items/Placeables/Walls/DriftwoodWall.cs index 61d8eaada7..6f4217b604 100644 --- a/Items/Placeables/Walls/DriftwoodWall.cs +++ b/Items/Placeables/Walls/DriftwoodWall.cs @@ -1,6 +1,7 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; using Terraria.ID; +using CalamityMod.Items.Placeables.SunkenSea; namespace CalamityMod.Items.Placeables.Walls { @@ -12,23 +13,11 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { - CreateRecipe(4). + CreateRecipe(). AddIngredient(). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Placeables/Walls/ElumplateWall.cs b/Items/Placeables/Walls/ElumplateWall.cs index a378abf53b..f5e745aece 100644 --- a/Items/Placeables/Walls/ElumplateWall.cs +++ b/Items/Placeables/Walls/ElumplateWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/EutrophicSandWall.cs b/Items/Placeables/Walls/EutrophicSandWall.cs index eca6ed6d28..f7e9ef7d62 100644 --- a/Items/Placeables/Walls/EutrophicSandWall.cs +++ b/Items/Placeables/Walls/EutrophicSandWall.cs @@ -14,18 +14,6 @@ namespace CalamityMod.Items.Placeables.Walls ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); } } diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.cs b/Items/Placeables/Walls/EutrophicSandWallSafe.cs index 93a70fd1ba..d1558ba3c6 100644 --- a/Items/Placeables/Walls/EutrophicSandWallSafe.cs +++ b/Items/Placeables/Walls/EutrophicSandWallSafe.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -13,19 +14,7 @@ namespace CalamityMod.Items.Placeables.Walls ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/ExoPlatingWallItem.cs b/Items/Placeables/Walls/ExoPlatingWallItem.cs index 61feff30d1..61327dc7ae 100644 --- a/Items/Placeables/Walls/ExoPlatingWallItem.cs +++ b/Items/Placeables/Walls/ExoPlatingWallItem.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/ExoPrismPanelWallItem.cs b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs index 1b1677aee9..4509c5b921 100644 --- a/Items/Placeables/Walls/ExoPrismPanelWallItem.cs +++ b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/FloralWall.cs b/Items/Placeables/Walls/FloralWall.cs index 7bc8af7813..e31db5b601 100644 --- a/Items/Placeables/Walls/FloralWall.cs +++ b/Items/Placeables/Walls/FloralWall.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/HardenedAstralSandWall.cs b/Items/Placeables/Walls/HardenedAstralSandWall.cs index 73f9e12ac8..23e5cebc10 100644 --- a/Items/Placeables/Walls/HardenedAstralSandWall.cs +++ b/Items/Placeables/Walls/HardenedAstralSandWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Astral; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls @@ -11,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs index 3c737c6577..402bbd66c5 100644 --- a/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs +++ b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Abyss; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls @@ -11,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/HavocplateWall.cs b/Items/Placeables/Walls/HavocplateWall.cs index ac15819ea7..e5ff6667c2 100644 --- a/Items/Placeables/Walls/HavocplateWall.cs +++ b/Items/Placeables/Walls/HavocplateWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/LimestoneWall.cs b/Items/Placeables/Walls/LimestoneWall.cs new file mode 100644 index 0000000000..c9165d8b12 --- /dev/null +++ b/Items/Placeables/Walls/LimestoneWall.cs @@ -0,0 +1,27 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; +using CalamityMod.Items.Placeables.SunkenSea; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class LimestoneWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + + } +} diff --git a/Items/Placeables/Walls/LimestoneWall.png b/Items/Placeables/Walls/LimestoneWall.png new file mode 100644 index 0000000000..0bceedae91 Binary files /dev/null and b/Items/Placeables/Walls/LimestoneWall.png differ diff --git a/Items/Placeables/Walls/NavyplateWall.cs b/Items/Placeables/Walls/NavyplateWall.cs index b0957f7a18..5cbbe4cf16 100644 --- a/Items/Placeables/Walls/NavyplateWall.cs +++ b/Items/Placeables/Walls/NavyplateWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/NavystoneWall.cs b/Items/Placeables/Walls/NavystoneWall.cs index fa9fd011a1..86d37219d1 100644 --- a/Items/Placeables/Walls/NavystoneWall.cs +++ b/Items/Placeables/Walls/NavystoneWall.cs @@ -13,18 +13,6 @@ namespace CalamityMod.Items.Placeables.Walls ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); } } diff --git a/Items/Placeables/Walls/NavystoneWallSafe.cs b/Items/Placeables/Walls/NavystoneWallSafe.cs index b215b7f0a5..7dd6ce6ca0 100644 --- a/Items/Placeables/Walls/NavystoneWallSafe.cs +++ b/Items/Placeables/Walls/NavystoneWallSafe.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/OccultBrickWallItem.cs b/Items/Placeables/Walls/OccultBrickWallItem.cs index 252394c3f8..32f1c7b2f4 100644 --- a/Items/Placeables/Walls/OccultBrickWallItem.cs +++ b/Items/Placeables/Walls/OccultBrickWallItem.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - 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 SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/OnyxplateWall.cs b/Items/Placeables/Walls/OnyxplateWall.cs index 9e73cc43b2..c1699bb954 100644 --- a/Items/Placeables/Walls/OnyxplateWall.cs +++ b/Items/Placeables/Walls/OnyxplateWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/OtherworldlyStoneWall.cs b/Items/Placeables/Walls/OtherworldlyStoneWall.cs index 6515eb8168..8ded9adb60 100644 --- a/Items/Placeables/Walls/OtherworldlyStoneWall.cs +++ b/Items/Placeables/Walls/OtherworldlyStoneWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/PerennialBrickWall.cs b/Items/Placeables/Walls/PerennialBrickWall.cs index 60a6a4ccc9..4159081e88 100644 --- a/Items/Placeables/Walls/PerennialBrickWall.cs +++ b/Items/Placeables/Walls/PerennialBrickWall.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/PlagueContainmentCellsWall.cs b/Items/Placeables/Walls/PlagueContainmentCellsWall.cs index fadb115b5b..9a95e57200 100644 --- a/Items/Placeables/Walls/PlagueContainmentCellsWall.cs +++ b/Items/Placeables/Walls/PlagueContainmentCellsWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/PlaguedPlateWall.cs b/Items/Placeables/Walls/PlaguedPlateWall.cs index c74807221d..14f6975fd0 100644 --- a/Items/Placeables/Walls/PlaguedPlateWall.cs +++ b/Items/Placeables/Walls/PlaguedPlateWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/PolishedMarniteWall.cs b/Items/Placeables/Walls/PolishedMarniteWall.cs index 22994a9baa..330cf077b1 100644 --- a/Items/Placeables/Walls/PolishedMarniteWall.cs +++ b/Items/Placeables/Walls/PolishedMarniteWall.cs @@ -10,22 +10,10 @@ namespace CalamityMod.Items.Placeables.Walls public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 100; + Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/ProfanedCrystalWall.cs b/Items/Placeables/Walls/ProfanedCrystalWall.cs index 48faf899a6..a3a025c837 100644 --- a/Items/Placeables/Walls/ProfanedCrystalWall.cs +++ b/Items/Placeables/Walls/ProfanedCrystalWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/ProfanedRockWall.cs b/Items/Placeables/Walls/ProfanedRockWall.cs index b918c82db7..8250681db4 100644 --- a/Items/Placeables/Walls/ProfanedRockWall.cs +++ b/Items/Placeables/Walls/ProfanedRockWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/ProfanedSlabWall.cs b/Items/Placeables/Walls/ProfanedSlabWall.cs index 16a4611a3b..f5b484b79b 100644 --- a/Items/Placeables/Walls/ProfanedSlabWall.cs +++ b/Items/Placeables/Walls/ProfanedSlabWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/PyreMantleWall.cs b/Items/Placeables/Walls/PyreMantleWall.cs new file mode 100644 index 0000000000..b160551007 --- /dev/null +++ b/Items/Placeables/Walls/PyreMantleWall.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.Abyss; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +namespace CalamityMod.Items.Placeables.Walls +{ + public class PyreMantleWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/PyreMantleWall.png b/Items/Placeables/Walls/PyreMantleWall.png new file mode 100644 index 0000000000..67e2c4cf59 Binary files /dev/null and b/Items/Placeables/Walls/PyreMantleWall.png differ diff --git a/Items/Placeables/Walls/RunestoneWall.cs b/Items/Placeables/Walls/RunestoneWall.cs new file mode 100644 index 0000000000..d7776f3a70 --- /dev/null +++ b/Items/Placeables/Walls/RunestoneWall.cs @@ -0,0 +1,27 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; +using CalamityMod.Items.Placeables.SunkenSea; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class RunestoneWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + + } +} diff --git a/Items/Placeables/Walls/RunestoneWall.png b/Items/Placeables/Walls/RunestoneWall.png new file mode 100644 index 0000000000..3a516ae7b9 Binary files /dev/null and b/Items/Placeables/Walls/RunestoneWall.png differ diff --git a/Items/Placeables/Walls/RunicProfanedBrickWall.cs b/Items/Placeables/Walls/RunicProfanedBrickWall.cs index 01770e1243..04f39f8a17 100644 --- a/Items/Placeables/Walls/RunicProfanedBrickWall.cs +++ b/Items/Placeables/Walls/RunicProfanedBrickWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/ScorchedBoneWall.cs b/Items/Placeables/Walls/ScorchedBoneWall.cs index 1406d975bd..ee369a5202 100644 --- a/Items/Placeables/Walls/ScorchedBoneWall.cs +++ b/Items/Placeables/Walls/ScorchedBoneWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Crags; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - 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 SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/ScoriaBrickWall.cs b/Items/Placeables/Walls/ScoriaBrickWall.cs index 96108f5683..6cc1bb91e6 100644 --- a/Items/Placeables/Walls/ScoriaBrickWall.cs +++ b/Items/Placeables/Walls/ScoriaBrickWall.cs @@ -12,19 +12,8 @@ namespace CalamityMod.Items.Placeables.Walls { Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/ShellstoneSlabWall.cs b/Items/Placeables/Walls/ShellstoneSlabWall.cs index 2cfe2a0d1c..71a1f34779 100644 --- a/Items/Placeables/Walls/ShellstoneSlabWall.cs +++ b/Items/Placeables/Walls/ShellstoneSlabWall.cs @@ -1,6 +1,7 @@ using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; using Terraria.ID; +using CalamityMod.Items.Placeables.SunkenSea; namespace CalamityMod.Items.Placeables.Walls { @@ -12,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/ShellstoneWall.cs b/Items/Placeables/Walls/ShellstoneWall.cs index aa28237ecd..8f8e7fe1f5 100644 --- a/Items/Placeables/Walls/ShellstoneWall.cs +++ b/Items/Placeables/Walls/ShellstoneWall.cs @@ -1,6 +1,7 @@ using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; using Terraria.ID; +using CalamityMod.Items.Placeables.SunkenSea; namespace CalamityMod.Items.Placeables.Walls { @@ -12,18 +13,15 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); } + } } diff --git a/Items/Placeables/Walls/SilvaWall.cs b/Items/Placeables/Walls/SilvaWall.cs index 564c8df5f8..08b2b92e23 100644 --- a/Items/Placeables/Walls/SilvaWall.cs +++ b/Items/Placeables/Walls/SilvaWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SmoothAbyssGravelWall.cs b/Items/Placeables/Walls/SmoothAbyssGravelWall.cs index e2fe9021f1..ace537f3f8 100644 --- a/Items/Placeables/Walls/SmoothAbyssGravelWall.cs +++ b/Items/Placeables/Walls/SmoothAbyssGravelWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs b/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs index e9f5255376..ccb5adbb71 100644 --- a/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs +++ b/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs @@ -12,20 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.rare = ItemRarityID.Orange; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SmoothNavystoneWall.cs b/Items/Placeables/Walls/SmoothNavystoneWall.cs index 48313056c3..a2104c8b5c 100644 --- a/Items/Placeables/Walls/SmoothNavystoneWall.cs +++ b/Items/Placeables/Walls/SmoothNavystoneWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SmoothVoidstoneWall.cs b/Items/Placeables/Walls/SmoothVoidstoneWall.cs index 2595547146..e5e48f82da 100644 --- a/Items/Placeables/Walls/SmoothVoidstoneWall.cs +++ b/Items/Placeables/Walls/SmoothVoidstoneWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/StatigelWall.cs b/Items/Placeables/Walls/StatigelWall.cs index 845cdcea41..43f60409a1 100644 --- a/Items/Placeables/Walls/StatigelWall.cs +++ b/Items/Placeables/Walls/StatigelWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/StratusWall.cs b/Items/Placeables/Walls/StratusWall.cs index 55379b9b27..45a66c9276 100644 --- a/Items/Placeables/Walls/StratusWall.cs +++ b/Items/Placeables/Walls/StratusWall.cs @@ -12,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SulphurousSandWall.cs b/Items/Placeables/Walls/SulphurousSandWall.cs index 291ca0af8b..a975584667 100644 --- a/Items/Placeables/Walls/SulphurousSandWall.cs +++ b/Items/Placeables/Walls/SulphurousSandWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Abyss; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls @@ -11,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SulphurousSandstoneWall.cs b/Items/Placeables/Walls/SulphurousSandstoneWall.cs index fe332c889d..994455af66 100644 --- a/Items/Placeables/Walls/SulphurousSandstoneWall.cs +++ b/Items/Placeables/Walls/SulphurousSandstoneWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Abyss; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls @@ -11,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SulphurousShaleWall.cs b/Items/Placeables/Walls/SulphurousShaleWall.cs index de29f09716..2801be9e26 100644 --- a/Items/Placeables/Walls/SulphurousShaleWall.cs +++ b/Items/Placeables/Walls/SulphurousShaleWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Abyss; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls @@ -11,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.createWall = ModContent.WallType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/UelibloomBrickWall.cs b/Items/Placeables/Walls/UelibloomBrickWall.cs index e7248b1da9..5710869e6b 100644 --- a/Items/Placeables/Walls/UelibloomBrickWall.cs +++ b/Items/Placeables/Walls/UelibloomBrickWall.cs @@ -11,19 +11,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/VoidstoneSlabWall.cs b/Items/Placeables/Walls/VoidstoneSlabWall.cs index fdf6408814..a4c8df54d3 100644 --- a/Items/Placeables/Walls/VoidstoneSlabWall.cs +++ b/Items/Placeables/Walls/VoidstoneSlabWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/VoidstoneWall.cs b/Items/Placeables/Walls/VoidstoneWall.cs index 71d30faa61..fcfb0dfb0b 100644 --- a/Items/Placeables/Walls/VoidstoneWall.cs +++ b/Items/Placeables/Walls/VoidstoneWall.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.Abyss; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls @@ -11,19 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = ModContent.WallType(); - } + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/WulfrumPlatingWall.cs b/Items/Placeables/Walls/WulfrumPlatingWall.cs index 5345aca21f..95ab191159 100644 --- a/Items/Placeables/Walls/WulfrumPlatingWall.cs +++ b/Items/Placeables/Walls/WulfrumPlatingWall.cs @@ -13,19 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls 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 SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/YellowCoral.cs b/Items/Placeables/YellowCoral.cs deleted file mode 100644 index 410cc62fe5..0000000000 --- a/Items/Placeables/YellowCoral.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class YellowCoral : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() - { - Item.width = 12; - Item.height = 12; - Item.rare = ItemRarityID.Blue; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = ModContent.TileType(); - } - - //public override void AddRecipes() - //{ - // CreateRecipe(4). - // AddIngredient(ItemID.PinkPearl). - // AddTile(TileID.HeavyWorkBench). - // Register(); - //} - } -} diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index 964b55b6ed..b9a40e4147 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,29 @@ namespace CalamityMod.Items.Potions.Alcohol public class BloodyMary : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float DamageBoost = 0.1f; + public static float MoveSpeedBoost = 0.1f; // Both 10% so we only need just one in the tooltip + public static int RegenLoss = 4; + public static float DefenseLossPercent = 0.04f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(204, 90, 73), + new Color(168, 37, 37), + new Color(120, 28, 28) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 80); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index fb3b0a0705..2d0df11fd0 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,29 @@ namespace CalamityMod.Items.Potions.Alcohol public class CaribbeanRum : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static int RegenBoost = 2; + public static float MoveSpeedBoost = 0.1f; + public static float DefenseLossPercent = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), MoveSpeedBoost.ToPercent(), DefenseLossPercent.ToPercent()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + // Based on the drink itself + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(105, 29, 14), + new Color(128, 39, 22), + new Color(138, 28, 7) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(14, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 60); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index 1910bad0c8..ada553d5dc 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,30 @@ namespace CalamityMod.Items.Potions.Alcohol public class CinnamonRoll : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + // Mana has a stupid formula so it won't go into the tooltip + public static float ManaRegenDelayBonus = 1f; + public static int ManaRegenBonus = 10; + public static float HeatDebuffBoost = 0.5f; + public static float DefenseLossPercent = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((1f + HeatDebuffBoost).ToString(), DefenseLossPercent.ToPercent()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(245, 223, 181), + new Color(222, 186, 147), + new Color(176, 129, 106) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Yellow; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Potions/Alcohol/FabsolsVodka.cs b/Items/Potions/Alcohol/CirrusVodka.cs similarity index 61% rename from Items/Potions/Alcohol/FabsolsVodka.cs rename to Items/Potions/Alcohol/CirrusVodka.cs index 0ba3d02d36..4b59118bae 100644 --- a/Items/Potions/Alcohol/FabsolsVodka.cs +++ b/Items/Potions/Alcohol/CirrusVodka.cs @@ -1,38 +1,40 @@ using CalamityMod.Buffs.Alcohol; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class FabsolsVodka : ModItem, ILocalizedModType + [LegacyName("FabsolsVodka")] + public class CirrusVodka : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + public static float DamageBoost = 0.08f; + public static float DefenseLossPercent = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), DefenseLossPercent.ToPercent()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(239, 123, 202), + new Color(187, 56, 158), + new Color(165, 47, 255) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightRed; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(900f); + Item.DefaultToFood(30, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 30); + Item.rare = ItemRarityID.LightRed; } public override void AddRecipes() @@ -47,7 +49,7 @@ namespace CalamityMod.Items.Potions.Alcohol CreateRecipe(). AddIngredient(ItemID.Ale). - AddIngredient(40). + AddIngredient(15). AddIngredient(ItemID.CrystalShard). AddTile(TileID.AlchemyTable). Register() diff --git a/Items/Potions/Alcohol/FabsolsVodka.png b/Items/Potions/Alcohol/CirrusVodka.png similarity index 100% rename from Items/Potions/Alcohol/FabsolsVodka.png rename to Items/Potions/Alcohol/CirrusVodka.png diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index 33e4888e93..1a79a28375 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,28 @@ namespace CalamityMod.Items.Potions.Alcohol public class Everclear : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float DamageBoost = 0.25f; + public static int RegenLoss = 10; + public static float DefenseLossPercent = 0.30f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + // Everclear is clear so uhm... yeah? + ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { + new Color(153, 168, 162, 180), + new Color(198, 205, 207, 180) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(60f); + Item.DefaultToFood(14, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(1), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 80); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index 0453782cd2..e3ac50f3ee 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,28 @@ namespace CalamityMod.Items.Potions.Alcohol public class EvergreenGin : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float SicknessWaterDebuffBoost = 0.25f; + public static int RegenLoss = 1; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((1f + SicknessWaterDebuffBoost).ToString(), RegenLoss.ToRegenPerSecond()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + // Pale green-blue + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(201, 248, 248), + new Color(201, 248, 221), + new Color(177, 240, 184) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 60); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index a177520b66..c5c3326bdb 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,27 @@ namespace CalamityMod.Items.Potions.Alcohol public class Fireball : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float HeatDebuffBoost = 0.25f; + public static int RegenLoss = 1; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((1f + HeatDebuffBoost).ToString(), RegenLoss.ToRegenPerSecond()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(245, 171, 22), + new Color(227, 128, 41), + new Color(237, 82, 31) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightRed; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(16, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 30); + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index c1462f6d78..5a6ecfe28c 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,33 +10,32 @@ namespace CalamityMod.Items.Potions.Alcohol public class GrapeBeer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float DefenseLossPercent = 0.03f; + public static int SecondDuration = 15; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DefenseLossPercent.ToPercent(), SecondDuration); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 30; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(36, 2, 41), + new Color(56, 0, 64), + new Color(82, 10, 92) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightRed; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.healLife = 100; - Item.healMana = 100; - Item.consumable = true; - Item.potion = true; + Item.DefaultToHealingPotion(12, 28, 100); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.LightRed; } public override void OnConsumeItem(Player player) { - player.AddBuff(ModContent.BuffType(), 900); + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(SecondDuration)); } } } diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 04ebc3f9af..fef39cfa86 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,36 +10,34 @@ namespace CalamityMod.Items.Potions.Alcohol public class Margarita : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + public static int BuffType = ModContent.BuffType(); - public static int BuffDuration = 10800; + public static float DefenseLossPercent = 0.06f; + public static int RegenLoss = 1; + public static int MinuteDuration = 3; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DefenseLossPercent.ToPercent(), RegenLoss.ToRegenPerSecond(), MinuteDuration); public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 30; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(219, 227, 191), + new Color(186, 189, 147), + new Color(142, 161, 125) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 40; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.potion = true; - Item.healLife = 200; - Item.healMana = 200; + Item.DefaultToHealingPotion(28, 40, 200); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 60); + Item.rare = ItemRarityID.Lime; } public override void OnConsumeItem(Player player) { - player.AddBuff(BuffType, BuffDuration); + player.AddBuff(BuffType, CalamityUtils.MinutesToFrames(MinuteDuration)); } } } diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index 165545297f..bbe98be132 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,29 @@ namespace CalamityMod.Items.Potions.Alcohol public class Moonshine : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static int DefenseBoost = 10; + public static float DamageReductionBoost = 0.03f; + public static int RegenLoss = 1; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DefenseBoost, DamageReductionBoost.ToPercent(), RegenLoss.ToRegenPerSecond()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + // Another clear drink + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(237, 237, 218, 128), + new Color(227, 219, 191, 128), + new Color(209, 204, 194, 128) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Yellow; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(24, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index 10433f63b9..e3de1158d0 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,29 +10,30 @@ namespace CalamityMod.Items.Potions.Alcohol public class MoscowMule : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; - internal static readonly int CritBoost = 3; + + public static float DamageBoost = 0.09f; + public static float KnockbackBoost = 0.5f; + public static int CritBoost = 3; + public static int RegenLoss = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), KnockbackBoost.ToPercent(), CritBoost, RegenLoss.ToRegenPerSecond()); public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + // Pale green with a hint of red + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(194, 252, 192), + new Color(226, 252, 192), + new Color(250, 225, 222) + }; } public override void SetDefaults() { - Item.width = 32; - Item.height = 34; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Yellow; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(32, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Potions/Alcohol/OddMushroom.cs b/Items/Potions/Alcohol/OddMushroom.cs index f3e1efa5f3..39c9dc8190 100644 --- a/Items/Potions/Alcohol/OddMushroom.cs +++ b/Items/Potions/Alcohol/OddMushroom.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,27 +9,25 @@ namespace CalamityMod.Items.Potions.Alcohol public class OddMushroom : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float DamageBoost = 0.5f; + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(232, 100, 90), + new Color(230, 215, 117), + new Color(143, 83, 64) + }; } public override void SetDefaults() { - Item.width = 38; - Item.height = 50; - Item.useTurn = true; - Item.maxStack = 9999; - Item.useAnimation = 17; - Item.useTime = 17; - Item.rare = ItemRarityID.LightRed; - Item.useStyle = ItemUseStyleID.EatFood; - Item.UseSound = SoundID.Item2; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(3600f); + Item.DefaultToFood(38, 50, ModContent.BuffType(), CalamityUtils.MinutesToFrames(60)); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 10); + Item.rare = ItemRarityID.LightRed; } public override void OnConsumeItem(Player player) diff --git a/Items/Potions/Alcohol/OldFashioned.cs b/Items/Potions/Alcohol/OldFashioned.cs index a440396e3d..8240710765 100644 --- a/Items/Potions/Alcohol/OldFashioned.cs +++ b/Items/Potions/Alcohol/OldFashioned.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -9,30 +11,26 @@ namespace CalamityMod.Items.Potions.Alcohol { public new string LocalizationCategory => "Items.Potions"; - public static readonly float AccessoryAndSetBonusDamageMultiplier = 1.5f; - public static readonly float DamageStatReduction = 0.25f; + public static readonly float DamageBoostMultiplier = 1.25f; + public static readonly float DamageReductionMultiplier = 0.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DamageBoostMultiplier).ToString("N2"), (DamageReductionMultiplier).ToString("N2")); public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(255, 118, 3), + new Color(255, 200, 82), + new Color(255, 228, 122) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 40; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(360f); + Item.DefaultToFood(30, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 60); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index 06a09a61b2..15c37e5d1a 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,37 +10,38 @@ namespace CalamityMod.Items.Potions.Alcohol public class RedWine : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static int HealValue = 200; + public static int RegenLoss = 1; + public static int SecondDuration = 15; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenLoss.ToRegenPerSecond(), SecondDuration); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 30; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(54, 5, 21), + new Color(82, 9, 36), + new Color(105, 4, 29) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightRed; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.healLife = 200; - Item.consumable = true; - Item.potion = true; + Item.DefaultToHealingPotion(14, 48, HealValue); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 30); + Item.rare = ItemRarityID.LightRed; } public override void GetHealLife(Player player, bool quickHeal, ref int healValue) { - healValue = player.Calamity().baguette ? 250 : 200; + healValue = player.Calamity().baguette ? Baguette.RedWineBuffedHealValue : HealValue; } public override void OnConsumeItem(Player player) { - player.AddBuff(ModContent.BuffType(), 900); + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(SecondDuration)); } } } diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index a6ac51a739..ec9ac8cb46 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,28 @@ namespace CalamityMod.Items.Potions.Alcohol public class Rum : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static int RegenBoost = 2; + public static float MoveSpeedBoost = 0.1f; + public static float DefenseLossPercent = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), MoveSpeedBoost.ToPercent(), DefenseLossPercent.ToPercent()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(237, 165, 9), + new Color(247, 219, 54), + new Color(255, 195, 31) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightRed; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(24, 26, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 30); + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index 299d0ff7fb..7324ec7709 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,27 @@ namespace CalamityMod.Items.Potions.Alcohol public class Screwdriver : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float PiercingDamageBuff = 0.05f; + public static int RegenLoss = 1; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((1f + PiercingDamageBuff).ToString(), RegenLoss.ToRegenPerSecond()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(225, 84, 33), + new Color(244, 176, 77), + new Color(255, 218, 102) + }; } public override void SetDefaults() { - Item.width = 16; - Item.height = 26; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightPurple; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(14, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 40); + Item.rare = ItemRarityID.LightPurple; } } } diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index f279ce4f8d..a2db1c7ac3 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,27 +10,31 @@ namespace CalamityMod.Items.Potions.Alcohol public class StarBeamRye : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static int MaxManaBoost = 50; + public static float MagicDamageBoost = 0.08f; + public static float ManaCostReduction = 0.1f; + public static float DefenseLossPercent = 0.06f; + public static int RegenLoss = 2; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, MagicDamageBoost.ToPercent(), ManaCostReduction.ToPercent(), DefenseLossPercent.ToPercent(), RegenLoss.ToRegenPerSecond()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + // Dark red-orange + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(89, 18, 10), + new Color(102, 39, 14), + new Color(128, 31, 9) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(20, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 80); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index 3a87ad876d..c423400e0a 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,29 +10,29 @@ namespace CalamityMod.Items.Potions.Alcohol public class Tequila : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; - internal static readonly int CritBoost = 4; + + public static float KnockbackBoost = 0.1f; + public static int CritBoost = 4; + public static int DefenseBoost = 5; + public static int RegenLoss = 1; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(KnockbackBoost.ToPercent(), CritBoost, DefenseBoost, RegenLoss.ToRegenPerSecond()); public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(163, 110, 10), + new Color(176, 135, 0), + new Color(194, 132, 25) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightRed; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(16, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 30); + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index c6c181562c..3a65d32387 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,28 +10,29 @@ namespace CalamityMod.Items.Potions.Alcohol public class TequilaSunrise : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; - internal static readonly int CritBoost = 8; + + public static float KnockbackBoost = 0.2f; + public static int CritBoost = 8; + public static int DefenseBoost = 10; + public static int RegenLoss = 2; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(KnockbackBoost.ToPercent(), CritBoost, DefenseBoost, RegenLoss.ToRegenPerSecond()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(220, 75, 59), + new Color(229, 147, 47), + new Color(255, 190, 76) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Yellow; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(22, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index 56a28b6ecf..b1b0ef79ca 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,29 +10,29 @@ namespace CalamityMod.Items.Potions.Alcohol public class Vodka : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; - internal static readonly int CritBoost = 2; + + public static float DamageBoost = 0.06f; + public static int CritBoost = 2; + public static int RegenLoss = 1; + public static float DefenseLossPercent = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost, RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + // Another clear drink + ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { + new Color(219, 219, 208, 180), + new Color(181, 181, 176, 180) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightPurple; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(14, 36, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 40); + Item.rare = ItemRarityID.LightPurple; } } } diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 1b79dd7714..eed0d9f389 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -8,29 +10,29 @@ namespace CalamityMod.Items.Potions.Alcohol public class Whiskey : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; - internal static readonly int CritBoost = 2; + + public static float DamageBoost = 0.04f; + public static float KnockbackBoost = 0.2f; + public static int CritBoost = 2; + public static float DefenseLossPercent = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), KnockbackBoost.ToPercent(), CritBoost, DefenseLossPercent.ToPercent()); public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(227, 148, 11), + new Color(235, 177, 5), + new Color(250, 190, 12) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightRed; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 30); + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index a75ba175dc..7e5249978d 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.Alcohol; +using Microsoft.Xna.Framework; using Terraria; using Terraria.GameInput; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol @@ -9,31 +11,33 @@ namespace CalamityMod.Items.Potions.Alcohol public class WhiteWine : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float MagicDamageBoost = 0.08f; + public static float DefenseLossPercent = 0.06f; + public static int RegenLoss = 2; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDamageBoost.ToPercent(), DefenseLossPercent.ToPercent(), RegenLoss.ToRegenPerSecond()); + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 30; + // Clear, yellow-green + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(242, 252, 177, 180), + new Color(250, 252, 215, 180), + new Color(228, 245, 181, 180) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.LightPurple; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; + Item.DefaultToFood(14, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(5), true); Item.healMana = 300; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(300f); // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 40); + Item.rare = ItemRarityID.LightPurple; } - public override bool? UseItem(Player player) + public override void OnConsumeItem(Player player) { if (PlayerInput.Triggers.JustPressed.QuickBuff) { @@ -49,7 +53,6 @@ namespace CalamityMod.Items.Potions.Alcohol } } player.AddBuff(Item.buffType, Item.buffTime); - return true; } } } diff --git a/Items/Potions/AnechoicCoating.cs b/Items/Potions/AnechoicCoating.cs index 10959c40c1..cb8c122a7e 100644 --- a/Items/Potions/AnechoicCoating.cs +++ b/Items/Potions/AnechoicCoating.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,23 +13,19 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { + new Color(118, 182, 199), + new Color(150, 227, 230) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 2, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.EatFood; + // How do you even use this? + Item.DefaultToFood(22, 26, ModContent.BuffType(), CalamityUtils.MinutesToFrames(4)); Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(240f); + Item.value = Item.sellPrice(silver: 2); + Item.rare = ItemRarityID.Blue; } public override void AddRecipes() diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index 682a341ce2..e2bbfbc188 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -1,8 +1,10 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions @@ -10,35 +12,34 @@ namespace CalamityMod.Items.Potions public class AstralInjection : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static int ManaPerFrame = 2; + public static int SelfDamage = 5; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaPerFrame * 60, SelfDamage); + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 30; + ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { + new Color(255, 164, 94), + new Color(109, 242, 196) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; + Item.DefaultToFood(14, 34, ModContent.BuffType(), CalamityUtils.SecondsToFrames(5), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(5f); - Item.value = Item.buyPrice(0, 2, 0, 0); } public override void OnConsumeItem(Player player) { player.AddBuff(BuffID.ManaSickness, Player.manaSickTime / 2, true); - player.statLife -= 5; + player.statLife -= SelfDamage; if (Main.myPlayer == player.whoAmI) { - player.HealEffect(-5, true); + player.HealEffect(-SelfDamage, true); } if (player.statLife <= 0) { diff --git a/Items/Potions/AureusCell.cs b/Items/Potions/AureusCell.cs index 2393b8088c..5878710f40 100644 --- a/Items/Potions/AureusCell.cs +++ b/Items/Potions/AureusCell.cs @@ -1,4 +1,5 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.GameInput; using Terraria.ID; using Terraria.ModLoader; @@ -12,27 +13,24 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(187, 220, 237), + new Color(237, 93, 83), + new Color(123, 99, 130) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.useAnimation = 17; - Item.useTime = 17; - Item.rare = ItemRarityID.Lime; - Item.useStyle = ItemUseStyleID.EatFood; + // Eating animation but gulp sound? Sure + Item.DefaultToFood(22, 38, BuffID.MagicPower, CalamityUtils.MinutesToFrames(8)); Item.healMana = 200; Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.value = Item.buyPrice(0, 4, 50, 0); - Item.buffType = BuffID.MagicPower; - Item.buffTime = CalamityUtils.SecondsToFrames(360f); + Item.value = Item.sellPrice(silver: 50); // Based on material cost rather than potion cost + Item.rare = ItemRarityID.Lime; } - public override bool? UseItem(Player player) + public override void OnConsumeItem(Player player) { if (PlayerInput.Triggers.JustPressed.QuickBuff) { @@ -49,7 +47,6 @@ namespace CalamityMod.Items.Potions } player.AddBuff(BuffID.MagicPower, Item.buffTime); player.AddBuff(BuffID.ManaRegeneration, Item.buffTime); - return true; } } } diff --git a/Items/Potions/Baguette.cs b/Items/Potions/Baguette.cs index 406e1e1d26..0009eb0f1c 100644 --- a/Items/Potions/Baguette.cs +++ b/Items/Potions/Baguette.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Potions; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions @@ -8,29 +10,27 @@ namespace CalamityMod.Items.Potions public class Baguette : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static int RedWineBuffedHealValue = 250; + public static int RedWineBuffedRegenLoss = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RedWineBuffedHealValue, RedWineBuffedRegenLoss.ToRegenPerSecond()); + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(231, 137, 159), + new Color(179, 104, 56), + new Color(108, 47, 16) + }; } public override void SetDefaults() { - Item.width = 52; - Item.height = 38; - Item.useTurn = true; - Item.maxStack = 9999; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.EatFood; - Item.UseSound = SoundID.Item2; - Item.consumable = true; - + Item.DefaultToFood(52, 38, BuffID.WellFed, CalamityUtils.MinutesToFrames(5)); Item.value = Item.sellPrice(silver: 1); Item.rare = ItemRarityID.Blue; Item.Calamity().donorItem = true; - - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(300f); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -40,9 +40,9 @@ namespace CalamityMod.Items.Potions public override void OnConsumeItem(Player player) { - //5 minutes for both - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(300f)); - player.AddBuff(BuffID.WellFed, CalamityUtils.SecondsToFrames(300f)); + // 5 minutes for both + player.AddBuff(BuffID.WellFed, Item.buffTime); + player.AddBuff(ModContent.BuffType(), Item.buffTime); } public override void AddRecipes() diff --git a/Items/Potions/BlasphemousDonut.cs b/Items/Potions/BlasphemousDonut.cs index 7d006225b8..994ceb77fa 100644 --- a/Items/Potions/BlasphemousDonut.cs +++ b/Items/Potions/BlasphemousDonut.cs @@ -1,4 +1,5 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,22 +11,17 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(122, 66, 59), + new Color(206, 116, 59), + new Color(198, 153, 113) + }; } public override void SetDefaults() { - Item.width = 40; - Item.height = 26; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.DefaultToFood(40, 26, BuffID.WellFed2, CalamityUtils.MinutesToFrames(60)); + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Purple; - Item.maxStack = 9999; - Item.consumable = true; - Item.useAnimation = 17; - Item.useTime = 17; - Item.UseSound = SoundID.Item2; - Item.useStyle = ItemUseStyleID.EatFood; - Item.useTurn = true; - Item.buffType = BuffID.WellFed2; - Item.buffTime = CalamityUtils.SecondsToFrames(3600f); } } } diff --git a/Items/Potions/BoundingPotion.cs b/Items/Potions/BoundingPotion.cs index f17f74b675..a5906281fa 100644 --- a/Items/Potions/BoundingPotion.cs +++ b/Items/Potions/BoundingPotion.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions @@ -9,40 +11,39 @@ namespace CalamityMod.Items.Potions public class BoundingPotion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float JumpSpeedBoost = 0.25f; + public static float JumpHeightPercentBoost = 0.2f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(JumpSpeedBoost.ToJumpSpeedPercent(), JumpHeightPercentBoost.ToPercent()); + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { + new Color(213, 255, 226), + new Color(141, 220, 166) + }; } public override void SetDefaults() { - Item.width = 26; - Item.height = 38; - Item.useTurn = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.DefaultToFood(26, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(300f); } public override void AddRecipes() { CreateRecipe(3). - AddIngredient(ItemID.BottledWater). + AddIngredient(ItemID.BottledWater, 3). AddIngredient(ItemID.Frog). - AddIngredient(ItemID.Vine). + AddIngredient(ItemID.Moonglow). AddTile(TileID.Bottles). Register(); CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(20). + AddIngredient(10). AddTile(TileID.AlchemyTable). Register() .DisableDecraft(); diff --git a/Items/Potions/CalciumPotion.cs b/Items/Potions/CalciumPotion.cs index 4e2cbc5f84..407672f6bc 100644 --- a/Items/Potions/CalciumPotion.cs +++ b/Items/Potions/CalciumPotion.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions @@ -9,32 +11,30 @@ namespace CalamityMod.Items.Potions public class CalciumPotion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float KnockbackResistance = 0.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(KnockbackResistance.ToPercent()); + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { + new Color(194, 202, 134), + new Color(149, 144, 86) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 20, 0); + Item.DefaultToFood(18, 30, ModContent.BuffType(), CalamityUtils.MinutesToFrames(20), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(1200f); } public override void AddRecipes() { - CreateRecipe(4). - AddIngredient(ItemID.BottledWater, 4). + CreateRecipe(). + AddIngredient(ItemID.BottledWater). AddIngredient(). AddTile(TileID.Bottles). Register() @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Potions CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(10). + AddIngredient(5). AddTile(TileID.AlchemyTable). Register() .DisableDecraft(); diff --git a/Items/Potions/CeaselessHungerPotion.cs b/Items/Potions/CeaselessHungerPotion.cs index 82b60bf13e..625751c603 100644 --- a/Items/Potions/CeaselessHungerPotion.cs +++ b/Items/Potions/CeaselessHungerPotion.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,23 +14,18 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(12, 18, 28), + new Color(110, 197, 212), + new Color(158, 81, 153) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; + Item.DefaultToFood(22, 32, ModContent.BuffType(), CalamityUtils.SecondsToFrames(20), true); + Item.value = Item.sellPrice(silver: 10); Item.rare = ModContent.RarityType(); - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(10f); - Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() @@ -37,14 +33,13 @@ namespace CalamityMod.Items.Potions CreateRecipe(4). AddIngredient(ItemID.BottledWater, 4). AddIngredient(). - AddIngredient(). AddTile(TileID.AlchemyTable). AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); - CreateRecipe(4). - AddIngredient(ItemID.BottledWater, 4). - AddIngredient(20). + CreateRecipe(8). + AddIngredient(ItemID.BottledWater, 8). + AddIngredient(10). AddIngredient(). AddTile(TileID.AlchemyTable). Register() diff --git a/Items/Potions/DeliciousMeat.cs b/Items/Potions/DeliciousMeat.cs index fd48c262c0..779c5e8f18 100644 --- a/Items/Potions/DeliciousMeat.cs +++ b/Items/Potions/DeliciousMeat.cs @@ -1,4 +1,5 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,22 +11,16 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; + ItemID.Sets.FoodParticleColors[Type] = new Color[2] { + new Color(147, 197, 206), + new Color(94, 131, 168), + }; } public override void SetDefaults() { - Item.width = 32; - Item.height = 30; - Item.value = Item.buyPrice(0, 0, 50, 0); + Item.DefaultToFood(32, 30, BuffID.WellFed2, CalamityUtils.MinutesToFrames(30)); + Item.value = Item.buyPrice(silver: 50); // Sold by Archmage Item.rare = ItemRarityID.Pink; - Item.maxStack = 9999; - Item.consumable = true; - Item.useAnimation = 17; - Item.useTime = 17; - Item.UseSound = SoundID.Item2; - Item.useStyle = ItemUseStyleID.EatFood; - Item.useTurn = true; - Item.buffType = BuffID.WellFed2; - Item.buffTime = CalamityUtils.SecondsToFrames(1800f); } } } diff --git a/Items/Potions/Fabsoup.cs b/Items/Potions/Fabsoup.cs index e532b991b1..91e98d12c6 100644 --- a/Items/Potions/Fabsoup.cs +++ b/Items/Potions/Fabsoup.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Potions public override void UseItemFrame(Player player) { - int time = CalamityUtils.SecondsToFrames(1980f); // 33 minutes + int time = CalamityUtils.MinutesToFrames(33); if (player.itemAnimation == 180) { player.AddBuff(BuffID.WellFed3, time); diff --git a/Items/Potions/FlaskOfBrimstone.cs b/Items/Potions/FlaskOfBrimstone.cs index e2c74857ef..885fed71c6 100644 --- a/Items/Potions/FlaskOfBrimstone.cs +++ b/Items/Potions/FlaskOfBrimstone.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,23 +14,18 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(240, 95, 64), + new Color(227, 52, 68), + new Color(189, 112, 123) + }; } public override void SetDefaults() { - Item.width = 30; - Item.height = 34; - Item.useTurn = true; - Item.maxStack = 9999; + Item.DefaultToFood(30, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(20), true); + Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.LightRed; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(1200f); - Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() diff --git a/Items/Potions/FlaskOfCrumbling.cs b/Items/Potions/FlaskOfCrumbling.cs index e3caa29130..6f358b0230 100644 --- a/Items/Potions/FlaskOfCrumbling.cs +++ b/Items/Potions/FlaskOfCrumbling.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,23 +14,18 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(243, 205, 45), + new Color(192, 97, 38), + new Color(225, 162, 58) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.DefaultToFood(32, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(20), true); + Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.LightRed; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(1200f); } public override void AddRecipes() diff --git a/Items/Potions/FlaskOfHolyFlames.cs b/Items/Potions/FlaskOfHolyFlames.cs index 1ff05f954f..bb4f4c46e8 100644 --- a/Items/Potions/FlaskOfHolyFlames.cs +++ b/Items/Potions/FlaskOfHolyFlames.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,23 +14,18 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(252, 23, 23), + new Color(199, 14, 51), + new Color(143, 36, 72) + }; } public override void SetDefaults() { - Item.width = 44; - Item.height = 36; - Item.useTurn = true; - Item.maxStack = 9999; + Item.DefaultToFood(44, 36, ModContent.BuffType(), CalamityUtils.MinutesToFrames(20), true); + Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Purple; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(1200f); - Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() diff --git a/Items/Potions/Food/Barberry.cs b/Items/Potions/Food/Barberry.cs new file mode 100644 index 0000000000..f81b940201 --- /dev/null +++ b/Items/Potions/Food/Barberry.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Barberry : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(112, 1, 25), + new Color(136, 69, 137), + new Color(160, 32, 95) + }; + ItemID.Sets.IsFood[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ambrosia; + } + + public override void SetDefaults() + { + Item.DefaultToFood(26, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Potions/Food/Barberry.png b/Items/Potions/Food/Barberry.png new file mode 100644 index 0000000000..d66c541f27 Binary files /dev/null and b/Items/Potions/Food/Barberry.png differ diff --git a/Items/Potions/Food/Cometfruit.cs b/Items/Potions/Food/Cometfruit.cs new file mode 100644 index 0000000000..8b80cdc0d6 --- /dev/null +++ b/Items/Potions/Food/Cometfruit.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Cometfruit : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(153, 100, 184), + new Color(181, 141, 166), + new Color(147, 200, 221) + }; + ItemID.Sets.IsFood[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ambrosia; + } + + public override void SetDefaults() + { + Item.DefaultToFood(32, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Potions/Food/Cometfruit.png b/Items/Potions/Food/Cometfruit.png new file mode 100644 index 0000000000..2d3fe3895b Binary files /dev/null and b/Items/Potions/Food/Cometfruit.png differ diff --git a/Items/Potions/Food/Jackfruit.cs b/Items/Potions/Food/Jackfruit.cs new file mode 100644 index 0000000000..97477e2b7e --- /dev/null +++ b/Items/Potions/Food/Jackfruit.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Jackfruit : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(250, 216, 80), + new Color(201, 207, 79), + new Color(147, 176, 54) + }; + ItemID.Sets.IsFood[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ambrosia; + } + + public override void SetDefaults() + { + Item.DefaultToFood(26, 36, BuffID.WellFed, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Potions/Food/Jackfruit.png b/Items/Potions/Food/Jackfruit.png new file mode 100644 index 0000000000..17f48aab6d Binary files /dev/null and b/Items/Potions/Food/Jackfruit.png differ diff --git a/Items/Potions/Food/Lotus.cs b/Items/Potions/Food/Lotus.cs new file mode 100644 index 0000000000..ecabc71b53 --- /dev/null +++ b/Items/Potions/Food/Lotus.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Lotus : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(198, 83, 236), + new Color(207, 81, 108), + new Color(233, 184, 87) + }; + ItemID.Sets.IsFood[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ambrosia; + } + + public override void SetDefaults() + { + Item.DefaultToFood(26, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Potions/Food/Lotus.png b/Items/Potions/Food/Lotus.png new file mode 100644 index 0000000000..9ddfcaaa7d Binary files /dev/null and b/Items/Potions/Food/Lotus.png differ diff --git a/Items/Potions/Food/Mangosteen.cs b/Items/Potions/Food/Mangosteen.cs new file mode 100644 index 0000000000..4c77a549b0 --- /dev/null +++ b/Items/Potions/Food/Mangosteen.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Mangosteen : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(218, 238, 253), + new Color(178, 199, 214), + new Color(123, 99, 130) + }; + ItemID.Sets.IsFood[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ambrosia; + } + + public override void SetDefaults() + { + Item.DefaultToFood(30, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Potions/Food/Mangosteen.png b/Items/Potions/Food/Mangosteen.png new file mode 100644 index 0000000000..8d3852e144 Binary files /dev/null and b/Items/Potions/Food/Mangosteen.png differ diff --git a/Items/Potions/Food/Salak.cs b/Items/Potions/Food/Salak.cs new file mode 100644 index 0000000000..8b99e2e4f3 --- /dev/null +++ b/Items/Potions/Food/Salak.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Salak : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(203, 134, 81), + new Color(162, 109, 68), + new Color(253, 242, 233) + }; + ItemID.Sets.IsFood[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ambrosia; + } + + public override void SetDefaults() + { + Item.DefaultToFood(28, 26, BuffID.WellFed, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Potions/Food/Salak.png b/Items/Potions/Food/Salak.png new file mode 100644 index 0000000000..6a52d1fe4d Binary files /dev/null and b/Items/Potions/Food/Salak.png differ diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs index 1c45d08e64..e95b3e3898 100644 --- a/Items/Potions/GravityNormalizerPotion.cs +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,23 +14,18 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(255, 164, 94), + new Color(109, 242, 196), + new Color(255, 255, 191) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; + Item.DefaultToFood(24, 36, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() diff --git a/Items/Potions/HadalStew.cs b/Items/Potions/HadalStew.cs index a901b1bcab..a724a51365 100644 --- a/Items/Potions/HadalStew.cs +++ b/Items/Potions/HadalStew.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Items.Fishing.BrimstoneCragCatches; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -14,31 +15,28 @@ namespace CalamityMod.Items.Potions { public new string LocalizationCategory => "Items.Potions"; public static int BuffType = BuffID.WellFed2; - public static int BuffDuration = 60 * 3600; - public static int SicknessDuration = 50 * 60; + public static int BuffDuration = CalamityUtils.MinutesToFrames(60); + public static int SicknessDuration = CalamityUtils.SecondsToFrames(50); public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(BuffDuration / 3600); public override void SetStaticDefaults() { Item.ResearchUnlockCount = 30; + // Even though this uses the drinking animation, it does not use DrinkParticleColors + // This is so that dusts fly out (like Bowl of Soup) instead of drip down (like Apple Juice) + ItemID.Sets.FoodParticleColors[Type] = new Color[4] { + new Color(185, 117, 70), + new Color(214, 98, 44), + new Color(235, 156, 117), + new Color(89, 54, 46) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.useAnimation = 17; - Item.useTime = 17; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.DefaultToHealingPotion(28, 18, 120); + Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.Green; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.potion = true; - Item.healLife = 120; - Item.healMana = 150; } public override void ModifyTooltips(List list) @@ -52,12 +50,11 @@ namespace CalamityMod.Items.Potions return player.potionDelay <= 0 && player.Calamity().potionTimer <= 0; } - public override bool? UseItem(Player player) + public override void OnConsumeItem(Player player) { player.AddBuff(BuffType, BuffDuration); // fixes hardcoded potion sickness duration from quick heal (see CalamityPlayerMiscEffects.cs) player.Calamity().potionTimer = 2; - return true; } public override void AddRecipes() diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index 1c12d5f0c8..a4e28baa46 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,22 +13,17 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 30; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(255, 31, 25), + new Color(162, 28, 25), + new Color(159, 10, 111) + }; } public override void SetDefaults() { - Item.width = 24; - Item.height = 32; - Item.useTurn = true; - Item.maxStack = 9999; - Item.healLife = 300; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.potion = true; - Item.value = Item.buyPrice(0, 7, 0, 0); + Item.DefaultToHealingPotion(24, 32, 300); + Item.value = Item.sellPrice(gold: 1); Item.rare = ModContent.RarityType(); } diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs index 4b52ece07f..f1dbcd15c1 100644 --- a/Items/Potions/PhotosynthesisPotion.cs +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions @@ -9,33 +11,32 @@ namespace CalamityMod.Items.Potions public class PhotosynthesisPotion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static int IncreasedHeartHeal = 5; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(IncreasedHeartHeal); + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(246, 235, 143), + new Color(230, 204, 121), + new Color(214, 173, 78) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.DefaultToFood(30, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(). + AddIngredient(ItemID.Daybloom, 3). AddIngredient(). AddTile(TileID.AlchemyTable). AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). @@ -44,7 +45,7 @@ namespace CalamityMod.Items.Potions CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(40). + AddIngredient(5). AddIngredient(). AddTile(TileID.AlchemyTable). Register() diff --git a/Items/Potions/PotionofOmniscience.cs b/Items/Potions/PotionofOmniscience.cs index 8f53cf2b53..bc71eddfa1 100644 --- a/Items/Potions/PotionofOmniscience.cs +++ b/Items/Potions/PotionofOmniscience.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,23 +13,18 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(159, 67, 199), + new Color(176, 147, 243), + new Color(84, 50, 185) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 30; - Item.useTurn = true; - Item.maxStack = 9999; + Item.DefaultToFood(28, 30, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(900f); - Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() diff --git a/Items/Potions/ShadowPotion.cs b/Items/Potions/ShadowPotion.cs index b569c8188c..611ac1c8e6 100644 --- a/Items/Potions/ShadowPotion.cs +++ b/Items/Potions/ShadowPotion.cs @@ -1,8 +1,10 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions @@ -10,26 +12,25 @@ namespace CalamityMod.Items.Potions public class ShadowPotion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float StealthRegenBoost = 0.08f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(StealthRegenBoost.ToPercent()); + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(45, 45, 45), + new Color(0, 0, 0), + new Color(95, 0, 36) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; + Item.DefaultToFood(20, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index 59ca3fb070..c89f575924 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -1,8 +1,10 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions @@ -10,27 +12,25 @@ namespace CalamityMod.Items.Potions public class SoaringPotion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + + public static float FlightBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightBoost.ToPercent()); + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(85, 181, 217), + new Color(190, 237, 232), + new Color(81, 114, 173) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.DefaultToFood(30, 30, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(360f); } public override void AddRecipes() @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Potions CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(30). + AddIngredient(15). AddIngredient(ItemID.SoulofFlight). AddTile(TileID.AlchemyTable). Register() diff --git a/Items/Potions/SulphurskinPotion.cs b/Items/Potions/SulphurskinPotion.cs index 1498cae00f..82301ec02a 100644 --- a/Items/Potions/SulphurskinPotion.cs +++ b/Items/Potions/SulphurskinPotion.cs @@ -1,7 +1,7 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Placeables.Abyss; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,36 +14,32 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(133, 180, 49), + new Color(80, 139, 81), + new Color(117, 95, 133) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.DefaultToFood(22, 26, ModContent.BuffType(), CalamityUtils.MinutesToFrames(4), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Green; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(150f); } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(15). + AddIngredient(). + AddIngredient(ItemID.Waterleaf). AddTile(TileID.Bottles). Register(); CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(10). + AddIngredient(5). AddTile(TileID.AlchemyTable). Register() .DisableDecraft(); diff --git a/Items/Potions/SupremeHealingPotion.cs b/Items/Potions/SupremeHealingPotion.cs index 5569c65837..8d2d5d7d74 100644 --- a/Items/Potions/SupremeHealingPotion.cs +++ b/Items/Potions/SupremeHealingPotion.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,23 +12,18 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 30; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(255, 31, 25), + new Color(217, 19, 15), + new Color(255, 0, 221) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.healLife = 250; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.potion = true; + Item.DefaultToHealingPotion(26, 38, 250); + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Purple; - Item.value = Item.buyPrice(0, 6, 50, 0); } public override void AddRecipes() diff --git a/Items/Potions/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs index 859ab69b80..d01a3e3283 100644 --- a/Items/Potions/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,22 +12,19 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 30; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(0, 255, 250), + new Color(26, 117, 177), + new Color(160, 82, 144) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; + Item.DefaultToFood(34, 38, 0, 0, true); Item.healMana = 400; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; + Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Purple; - Item.value = Item.buyPrice(0, 6, 50, 0); } public override void AddRecipes() diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs deleted file mode 100644 index 1fa1a540b3..0000000000 --- a/Items/Potions/TeslaPotion.cs +++ /dev/null @@ -1,60 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Placeables.Ores; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - public class TeslaPotion : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Potions"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 20; - Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 14)); - ItemID.Sets.AnimatesAsSoul[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 32; - Item.height = 32; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - CreateRecipe(5). - AddIngredient(ItemID.BottledWater). - AddIngredient(2). - AddIngredient(5). - AddIngredient(). - AddIngredient(). - AddTile(TileID.Bottles). - AddDecraftCondition(CalamityConditions.DownedHiveMindOrPerforator). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(10). - AddIngredient(). - AddTile(TileID.AlchemyTable). - Register() - .DisableDecraft(); - } - } -} diff --git a/Items/Potions/TeslaPotion.png b/Items/Potions/TeslaPotion.png deleted file mode 100644 index 1903d9e02c..0000000000 Binary files a/Items/Potions/TeslaPotion.png and /dev/null differ diff --git a/Items/Potions/ZenPotion.cs b/Items/Potions/ZenPotion.cs index c76f6c4d10..905b6f831d 100644 --- a/Items/Potions/ZenPotion.cs +++ b/Items/Potions/ZenPotion.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,24 +13,18 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(216, 230, 236), + new Color(137, 149, 173), + new Color(102, 85, 128) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.DefaultToFood(24, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(900f); } public override void AddRecipes() @@ -44,7 +39,7 @@ namespace CalamityMod.Items.Potions CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(20). + AddIngredient(5). AddIngredient(2). AddTile(TileID.AlchemyTable). Register() diff --git a/Items/Potions/ZergPotion.cs b/Items/Potions/ZergPotion.cs index 144bbc6ce2..0d118409f3 100644 --- a/Items/Potions/ZergPotion.cs +++ b/Items/Potions/ZergPotion.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,24 +13,18 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(223, 135, 244), + new Color(94, 74, 213), + new Color(156, 217, 246) + }; } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.DefaultToFood(24, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(900f); } public override void AddRecipes() @@ -37,14 +32,14 @@ namespace CalamityMod.Items.Potions CreateRecipe(). AddIngredient(ItemID.BottledWater). AddIngredient(2). - AddIngredient(). + AddIngredient(ItemID.Fireblossom, 2). AddTile(TileID.AlchemyTable). AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(20). + AddIngredient(5). AddIngredient(2). AddTile(TileID.AlchemyTable). Register() diff --git a/Items/RelicOfConvergence.cs b/Items/RelicOfConvergence.cs index 4ed4266d9f..d441f610cc 100644 --- a/Items/RelicOfConvergence.cs +++ b/Items/RelicOfConvergence.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items @@ -8,18 +9,21 @@ namespace CalamityMod.Items public class RelicOfConvergence : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + + public static int HealValue = 60; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(HealValue); + public override void SetStaticDefaults() { - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 32; Item.height = 46; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = SoundID.DD2_DarkMageCastHeal; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; @@ -28,6 +32,11 @@ namespace CalamityMod.Items Item.shoot = ModContent.ProjectileType(); } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; diff --git a/Items/RelicOfResilience.cs b/Items/RelicOfResilience.cs new file mode 100644 index 0000000000..cf610774c1 --- /dev/null +++ b/Items/RelicOfResilience.cs @@ -0,0 +1,32 @@ +using System.Linq; +using CalamityMod.Projectiles.Damageable; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class RelicOfResilience : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetDefaults() + { + Item.width = 40; + Item.height = 34; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; + } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + } +} diff --git a/Items/Weapons/Typeless/RelicOfResilience.png b/Items/RelicOfResilience.png similarity index 100% rename from Items/Weapons/Typeless/RelicOfResilience.png rename to Items/RelicOfResilience.png diff --git a/Items/Rock.cs b/Items/Rock.cs index b74679d9e6..30bf1937ab 100644 --- a/Items/Rock.cs +++ b/Items/Rock.cs @@ -17,16 +17,8 @@ namespace CalamityMod.Items public override void SetDefaults() { - Item.width = 20; - Item.height = 20; - Item.value = Item.buyPrice(0, 0, 0, 1); - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; // This item cannot be researched/duped. + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 1); } } } diff --git a/Items/SirenproofEarMuffs.cs b/Items/SirenproofEarMuffs.cs index b05a825f31..884f337b5b 100644 --- a/Items/SirenproofEarMuffs.cs +++ b/Items/SirenproofEarMuffs.cs @@ -34,13 +34,9 @@ namespace CalamityMod.Items 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; + Item.RestoreConsumedItemByRightClick(); } /* diff --git a/Items/SummonItems/Abombination.cs b/Items/SummonItems/Abombination.cs index 8c3ec4b38b..5897c5788b 100644 --- a/Items/SummonItems/Abombination.cs +++ b/Items/SummonItems/Abombination.cs @@ -1,10 +1,13 @@ -using CalamityMod.Events; +using CalamityMod.CustomRecipes; +using System; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.PlaguebringerGoliath; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using System.Collections.Generic; namespace CalamityMod.Items.SummonItems { @@ -39,14 +42,11 @@ namespace CalamityMod.Items.SummonItems return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + public override bool? UseItem(Player player) { - SoundEngine.PlaySound(UseSound, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, UseSound); return true; } @@ -55,7 +55,8 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(20). AddRecipeGroup("IronBar", 8). - AddIngredient(ItemID.Obsidian, 3). + AddIngredient(8). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/SummonItems/AstralChunk.cs b/Items/SummonItems/AstralChunk.cs index 4a0116a906..539b1854a8 100644 --- a/Items/SummonItems/AstralChunk.cs +++ b/Items/SummonItems/AstralChunk.cs @@ -1,17 +1,20 @@ -using CalamityMod.Events; +using CalamityMod.CustomRecipes; +using System; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.AstrumAureus; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using System.Collections.Generic; namespace CalamityMod.Items.SummonItems { public class AstralChunk : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AstrumAureusSpawn"); public override void SetStaticDefaults() { ItemID.Sets.SortingPriorityBossSpawns[Type] = 12; // Truffle Worm @@ -33,6 +36,8 @@ namespace CalamityMod.Items.SummonItems itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override bool CanUseItem(Player player) { return player.Calamity().ZoneAstral && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; @@ -40,16 +45,10 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - 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); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); - } - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + int posX = (int)(player.position.X + Main.rand.Next(-250, 251)); + int posY = (int)(player.position.Y - 500f); + int bossToSpawn = ModContent.NPCType(); + CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, UseSound); return true; } @@ -58,7 +57,9 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(30). AddIngredient(ItemID.FallenStar, 20). - AddTile(TileID.Anvils). + AddIngredient(8). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Func condition), condition). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/SummonItems/BloodwormItem.cs b/Items/SummonItems/BloodwormItem.cs index 854fb89d77..be23362d9c 100644 --- a/Items/SummonItems/BloodwormItem.cs +++ b/Items/SummonItems/BloodwormItem.cs @@ -1,5 +1,6 @@ using CalamityMod.NPCs.AcidRain; using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { + Item.ResearchUnlockCount = 3; ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil } @@ -17,8 +19,7 @@ namespace CalamityMod.Items.SummonItems { Item.width = 28; Item.height = 28; - Item.maxStack = 9999; - Item.rare = ModContent.RarityType(); + Item.maxStack = Item.CommonMaxStack; Item.bait = 4444; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; @@ -28,7 +29,9 @@ namespace CalamityMod.Items.SummonItems Item.consumable = true; Item.noUseGraphic = true; Item.makeNPC = (short)ModContent.NPCType(); - Item.ResearchUnlockCount = 3; + + Item.value = Item.sellPrice(gold: 20); // 2x the sell price of Truffle Worms; also sold by Sea King for a custom (2x) price + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/SummonItems/BloodyWormFood.cs b/Items/SummonItems/BloodyWormFood.cs index c5847c9316..590d5c5b4b 100644 --- a/Items/SummonItems/BloodyWormFood.cs +++ b/Items/SummonItems/BloodyWormFood.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.Perforator; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -39,12 +38,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } diff --git a/Items/SummonItems/CharredIdol.cs b/Items/SummonItems/CharredIdol.cs index 152bac38b9..48063cc2bc 100644 --- a/Items/SummonItems/CharredIdol.cs +++ b/Items/SummonItems/CharredIdol.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.SummonItems public class CharredIdol : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Custom/BrimstoneElemental/BrimstoneSpawn"); public override void SetStaticDefaults() { ItemID.Sets.SortingPriorityBossSpawns[Type] = 10; // Mechanical Skull @@ -41,12 +42,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, UseSound); return true; } diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index e5e38178b3..fb810a7c9e 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -4,7 +4,6 @@ using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -45,12 +44,7 @@ namespace CalamityMod.Items.SummonItems Color messageColor = Color.Cyan; CalamityUtils.DisplayLocalizedText(key, messageColor); - SoundEngine.PlaySound(DevourerofGodsHead.SpawnSound, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, DevourerofGodsHead.SpawnSound); return true; } diff --git a/Items/SummonItems/CryoKey.cs b/Items/SummonItems/CryoKey.cs index a128adc1a4..d8f4048ae0 100644 --- a/Items/SummonItems/CryoKey.cs +++ b/Items/SummonItems/CryoKey.cs @@ -3,11 +3,9 @@ using System.Linq; using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Cryogen; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -43,12 +41,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } diff --git a/Items/SummonItems/DeathWhistle.cs b/Items/SummonItems/DeathWhistle.cs index 409ffefc3a..017f3eddee 100644 --- a/Items/SummonItems/DeathWhistle.cs +++ b/Items/SummonItems/DeathWhistle.cs @@ -35,21 +35,15 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(ModContent.NPCType()) && player.ZoneOverworldHeight && !BossRushEvent.BossRushActive; + return !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.ScaryScream, 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); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); - } - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + int posX = (int)(player.position.X + Main.rand.Next(-250, 251)); + int posY = (int)(player.position.Y - 500f); + int bossToSpawn = ModContent.NPCType(); + CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, SoundID.ScaryScream); return true; } diff --git a/Items/SummonItems/DecapoditaSprout.cs b/Items/SummonItems/DecapoditaSprout.cs index 336ce1a51b..23ada1d63c 100644 --- a/Items/SummonItems/DecapoditaSprout.cs +++ b/Items/SummonItems/DecapoditaSprout.cs @@ -1,8 +1,6 @@ using CalamityMod.Events; using CalamityMod.NPCs.Crabulon; using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -39,16 +37,9 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - 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(-160, 161)), (int)(player.position.Y - 320f), ModContent.NPCType(), 1); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); - } - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + int posX = (int)(player.position.X + Main.rand.Next(-160, 161)); + int posY = (int)(player.position.Y - 320f); + CalamityUtils.SpawnBossOnPosUsingItem(player, posX, posY, SoundID.Roar); return true; } diff --git a/Items/SummonItems/DesertMedallion.cs b/Items/SummonItems/DesertMedallion.cs index f1a0d59321..5be0d32527 100644 --- a/Items/SummonItems/DesertMedallion.cs +++ b/Items/SummonItems/DesertMedallion.cs @@ -1,7 +1,6 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.DesertScourge; -using CalamityMod.World; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -43,12 +42,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SummonSound, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, SummonSound); return true; } diff --git a/Items/SummonItems/EidolonTablet.cs b/Items/SummonItems/EidolonTablet.cs index bb9fe3513f..efbc3cdfc3 100644 --- a/Items/SummonItems/EidolonTablet.cs +++ b/Items/SummonItems/EidolonTablet.cs @@ -1,7 +1,6 @@ using System; using CalamityMod.Events; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -34,21 +33,45 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(NPCID.CultistBoss) && !NPC.LunarApocalypseIsUp && !NPC.AnyNPCs(NPCID.CultistTablet) && !BossRushEvent.BossRushActive; + // This is quite ugly, but MP does not sync NPC.LunarApocalypseIsUp + // So we should check it ourselves + if (BossRushEvent.BossRushActive) + return false; + + if (NPC.MoonLordCountdown > 0) + return false; + + foreach (var npc in Main.ActiveNPCs) + { + switch (npc.type) + { + case NPCID.CultistTablet: + case NPCID.CultistBoss: + case NPCID.LunarTowerSolar: + case NPCID.LunarTowerVortex: + case NPCID.LunarTowerNebula: + case NPCID.LunarTowerStardust: + case NPCID.MoonLordCore: + return false; + } + } + + return true; } public override bool? UseItem(Player player) { - if (Main.netMode != NetmodeID.MultiplayerClient) + int posX = (int)player.Center.X + 30; + int posY = (int)player.Center.Y - 90; + NPC npc = CalamityUtils.SpawnBossOnPosUsingItem(player, NPCID.CultistBoss, posX, posY); + if (npc != null) { - int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)player.Center.X + 30, (int)player.Center.Y - 90, NPCID.CultistBoss, 1); - Main.npc[npc].direction = Main.npc[npc].spriteDirection = Math.Sign(player.Center.X - player.Center.X - 30f); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); - } - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, NPCID.CultistBoss); + WorldGen.GetRidOfCultists(); + int newDir = Math.Sign(player.Center.X - player.Center.X - 30f); + npc.direction = newDir; + npc.spriteDirection = newDir; + } return true; } } diff --git a/Items/SummonItems/EidolonTablet.png b/Items/SummonItems/EidolonTablet.png index 4383b9ec72..dd558ecf48 100644 Binary files a/Items/SummonItems/EidolonTablet.png and b/Items/SummonItems/EidolonTablet.png differ diff --git a/Items/SummonItems/ExoticPheromones.cs b/Items/SummonItems/ExoticPheromones.cs index 6e648cad2f..995118804c 100644 --- a/Items/SummonItems/ExoticPheromones.cs +++ b/Items/SummonItems/ExoticPheromones.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.Bumblebirb; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -40,12 +39,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } diff --git a/Items/SummonItems/EyeofDesolation.cs b/Items/SummonItems/EyeofDesolation.cs index ae80ddf3c8..8168d6aae7 100644 --- a/Items/SummonItems/EyeofDesolation.cs +++ b/Items/SummonItems/EyeofDesolation.cs @@ -2,10 +2,8 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.CalClone; -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -52,11 +50,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) { @@ -85,7 +79,7 @@ namespace CalamityMod.Items.SummonItems Main.tile[i + xoffset, j + yoffset].TileType = (ushort)ModContent.TileType(); Main.tile[i + xoffset, j + yoffset].Get().HasTile = true; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i + xoffset, j + yoffset, 1, TileChangeType.None); } diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index 2de57c9d47..75deb7d52b 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -38,8 +38,13 @@ namespace CalamityMod.Items.SummonItems.Invasion public override bool? UseItem(Player player) { - CalamityNetcode.SyncWorld(); - AcidRainEvent.TryStartEvent(true); + // Only Single Player client and Server should call this! + if (Main.netMode != NetmodeID.MultiplayerClient) + { + AcidRainEvent.TryStartEvent(forceRain: true); + // TryStartEvent already syncs the world data + } + return true; } diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.cs b/Items/SummonItems/Invasion/MartianDistressRemote.cs index 965b1b0ff3..880a169570 100644 --- a/Items/SummonItems/Invasion/MartianDistressRemote.cs +++ b/Items/SummonItems/Invasion/MartianDistressRemote.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System.Linq; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -35,11 +36,38 @@ namespace CalamityMod.Items.SummonItems.Invasion itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; } - public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; + public override bool CanUseItem(Player player) + { + // Do not start new invasion when it's already on going + if (Main.invasionType != InvasionID.None) + return false; + + // This is the requirement for StartInvasion for some reason + // If this part is missing MartianRemote will show DD2 invasion GUI without any enemy spawn on MP + if (!Main.player.Any(p => p.active && p.ConsumedLifeCrystals >= 5)) + return false; + + return true; + } public override bool? UseItem(Player player) { - Main.StartInvasion(InvasionID.MartianMadness); + // Single Player case + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.invasionDelay = 0; + Main.StartInvasion(InvasionID.MartianMadness); + return true; + } + + // MP case: only owner should send Spawn Message to Master + if (player.whoAmI == Main.myPlayer) + { + //-7.0 is hardcoded id for MartianMadness Event + NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, number: player.whoAmI, number2: -7.0f); + return true; + } + return true; } diff --git a/Items/SummonItems/MarkofProvidence.cs b/Items/SummonItems/MarkofProvidence.cs index 36ea4261ed..d41c16641b 100644 --- a/Items/SummonItems/MarkofProvidence.cs +++ b/Items/SummonItems/MarkofProvidence.cs @@ -51,27 +51,15 @@ namespace CalamityMod.Items.SummonItems { if (player.ZoneDungeon) { - SoundEngine.PlaySound(CVSound, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); + CalamityUtils.SpawnBossUsingItem(player, CVSound); } else if (player.ZoneUnderworldHeight) { - SoundEngine.PlaySound(SignutSound, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); + CalamityUtils.SpawnBossUsingItem(player, SignutSound); } else if (player.ZoneSkyHeight) { - SoundEngine.PlaySound(StormSound, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); + CalamityUtils.SpawnBossUsingItem(player, StormSound); } return true; diff --git a/Items/SummonItems/NO.cs b/Items/SummonItems/NO.cs index b3d12b72d4..6578012f85 100644 --- a/Items/SummonItems/NO.cs +++ b/Items/SummonItems/NO.cs @@ -1,9 +1,7 @@ using CalamityMod.Events; using CalamityMod.NPCs.Other; using CalamityMod.Rarities; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -39,11 +37,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } } diff --git a/Items/SummonItems/NaiadsWarhorn.cs b/Items/SummonItems/NaiadsWarhorn.cs new file mode 100644 index 0000000000..ff3e494d4f --- /dev/null +++ b/Items/SummonItems/NaiadsWarhorn.cs @@ -0,0 +1,76 @@ +using CalamityMod.Events; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Steamworks; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SummonItems +{ + public class NaiadsWarhorn : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.SummonItems"; + public static readonly SoundStyle HornSound = new("CalamityMod/Sounds/Item/LeviathanHornSound") { Volume = 0.55f }; + public override void SetStaticDefaults() + { + ItemID.Sets.SortingPriorityBossSpawns[Type] = 12; // Truffle Worm + } + + public override void SetDefaults() + { + Item.width = 108; + Item.height = 68; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.consumable = false; + } + + public override Vector2? HoldoutOffset() => new Vector2(5, 8); + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneBeach && !player.Calamity().ZoneSulphur && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; + } + + public override bool? UseItem(Player player) + { + int posX = (int)player.position.X; + int posY = (int)(player.position.Y - 700f); + int bossToSpawn = ModContent.NPCType(); + CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, HornSound); + return true; + } + + // Makes it draw lower in the world so that it doesn't look weird with the cloth at the bottom + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Item.Center - Main.screenPosition + Vector2.UnitY * 20f, null, lightColor, rotation, tex.Size() / 2f, scale, 0, 0); + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddIngredient(15). + AddIngredient(10). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/SummonItems/NaiadsWarhorn.png b/Items/SummonItems/NaiadsWarhorn.png new file mode 100644 index 0000000000..9eb845833b Binary files /dev/null and b/Items/SummonItems/NaiadsWarhorn.png differ diff --git a/Items/SummonItems/NecroplasmicBeacon.cs b/Items/SummonItems/NecroplasmicBeacon.cs index 6cb20ea800..ff4eabadb1 100644 --- a/Items/SummonItems/NecroplasmicBeacon.cs +++ b/Items/SummonItems/NecroplasmicBeacon.cs @@ -5,7 +5,6 @@ using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -48,12 +47,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(Polterghast.SpawnSound, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, Polterghast.SpawnSound); return true; } diff --git a/Items/SummonItems/OldPowerCell.cs b/Items/SummonItems/OldPowerCell.cs deleted file mode 100644 index 02c26ef26e..0000000000 --- a/Items/SummonItems/OldPowerCell.cs +++ /dev/null @@ -1,71 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.SummonItems -{ - public class OldPowerCell : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.SummonItems"; - public override string Texture => $"Terraria/Images/Item_{ItemID.LihzahrdPowerCell}"; - - public override void SetStaticDefaults() - { - NPCID.Sets.MPAllowedEnemies[NPCID.Golem] = true; - ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Lihzahrd Power Cell - } - - public override void SetDefaults() - { - Item.width = 28; - Item.height = 18; - Item.rare = ItemRarityID.Lime; - Item.useAnimation = 10; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.consumable = false; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } - - public override bool CanUseItem(Player player) - { - bool canSummon = false; - if (player.Center.Y > Main.worldSurface * 16.0) - { - int playerTileX = (int)player.Center.X / 16; - int playerTileY = (int)player.Center.Y / 16; - Tile tile = Framing.GetTileSafely(playerTileX, playerTileY); - if (tile.WallType == 87) - canSummon = true; - } - return canSummon && !NPC.AnyNPCs(NPCID.Golem) && !BossRushEvent.BossRushActive; - } - - public override bool? UseItem(Player player) - { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Golem); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, NPCID.Golem); - - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.LunarTabletFragment, 20). - AddIngredient(10). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/SummonItems/OverloadedSludge.cs b/Items/SummonItems/OverloadedSludge.cs index e13c873308..6aae80b8a0 100644 --- a/Items/SummonItems/OverloadedSludge.cs +++ b/Items/SummonItems/OverloadedSludge.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.SlimeGod; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -39,12 +38,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } diff --git a/Items/SummonItems/Portabulb.cs b/Items/SummonItems/Portabulb.cs index 2f239988b5..6dd1c5b01e 100644 --- a/Items/SummonItems/Portabulb.cs +++ b/Items/SummonItems/Portabulb.cs @@ -1,7 +1,7 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -40,21 +40,16 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, NPCID.Plantera); - + CalamityUtils.SpawnBossUsingItem(player, NPCID.Plantera, SoundID.Roar); return true; } public override void AddRecipes() { CreateRecipe(). + AddIngredient(20). AddIngredient(ItemID.JungleSpores, 15). - AddIngredient(3). - AddIngredient(). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs index ae2034fd96..c61306273d 100644 --- a/Items/SummonItems/ProfanedCore.cs +++ b/Items/SummonItems/ProfanedCore.cs @@ -1,8 +1,9 @@ using CalamityMod.Events; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -35,21 +36,27 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(ModContent.NPCType()) && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; + var Prov = CalamityGlobalNPC.holyBoss; + bool canPissOffProvi = Prov != -1 && Main.npc[Prov].life >= (Main.npc[Prov].lifeMax * 0.95f) && Main.npc[Prov].Calamity().newAI[3] >= 180f && !Main.npc[Prov].Calamity().CurrentlyEnraged; + return (!NPC.AnyNPCs(ModContent.NPCType()) || canPissOffProvi) && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) { - SoundEngine.PlaySound(Providence.SpawnSound, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) + var Prov = CalamityGlobalNPC.holyBoss; + bool usingToMakeProviPissedOff = Prov != -1 && Main.npc[Prov].life >= (Main.npc[Prov].lifeMax * 0.95f) && Main.npc[Prov].Calamity().newAI[3] >= 180f && !Main.npc[Prov].Calamity().CurrentlyEnraged; + if (usingToMakeProviPissedOff) { - int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType(), 1); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); + (Main.npc[Prov].ModNPC as Providence).hasBeenGivenFullPower = true; + Projectile.NewProjectile(Item.GetSource_FromThis(), player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0); } else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + { + int posX = (int)player.position.X; + int posY = (int)(player.position.Y - 100f); + int bossToSpawn = ModContent.NPCType(); + CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, Providence.SpawnSound); + } return true; } } diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index e65cceda1b..11a1a9a4df 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -2,7 +2,6 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.World; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -13,6 +12,7 @@ namespace CalamityMod.Items.SummonItems public class ProfanedShard : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianSpawn"); public override void SetStaticDefaults() { ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil @@ -41,15 +41,9 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, UseSound); return true; } - public override void ModifyTooltips(List list) => list.FindAndReplace("[SPAWN]", this.GetLocalizedValue(Main.remixWorld ? "SpawnRemix" : "SpawnNormal")); public override void AddRecipes() { diff --git a/Items/SummonItems/SandstormsCore.cs b/Items/SummonItems/SandstormsCore.cs index 32dba4f830..0df7ac8a2a 100644 --- a/Items/SummonItems/SandstormsCore.cs +++ b/Items/SummonItems/SandstormsCore.cs @@ -1,9 +1,7 @@ using System.Collections.Generic; using CalamityMod.Items.Materials; using CalamityMod.NPCs.GreatSandShark; -using CalamityMod.World; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -41,22 +39,17 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } - public override void ModifyTooltips(List list) => list.FindAndReplace("[BIOME]", Main.zenithWorld ? CalamityUtils.GetTextValue("Biomes.AstralDesert") : Language.GetTextValue("Bestiary_Biomes.Desert")); + public override void ModifyTooltips(List list) => list.FindAndReplace("[BIOME]", Main.zenithWorld ? CalamityUtils.GetTextValue("Biomes.AstralDesert.TownNPCDialogueName") : Language.GetTextValue("Bestiary_Biomes.Desert")); public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.AncientBattleArmorMaterial, 3). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/SummonItems/Seafood.cs b/Items/SummonItems/Seafood.cs index 4d780eb9e0..fd8d5e04b5 100644 --- a/Items/SummonItems/Seafood.cs +++ b/Items/SummonItems/Seafood.cs @@ -1,9 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Events; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.NPCs.AquaticScourge; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -41,12 +40,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } diff --git a/Items/SummonItems/Teratoma.cs b/Items/SummonItems/Teratoma.cs index 7f3fee2cbf..fabb86b0a4 100644 --- a/Items/SummonItems/Teratoma.cs +++ b/Items/SummonItems/Teratoma.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.HiveMind; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -39,12 +38,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } diff --git a/Items/SummonItems/YharonEgg.cs b/Items/SummonItems/YharonEgg.cs index fdb5d724ba..ccd197a89e 100644 --- a/Items/SummonItems/YharonEgg.cs +++ b/Items/SummonItems/YharonEgg.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.Yharon; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -20,8 +21,8 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - Item.width = 28; - Item.height = 18; + Item.width = 58; + Item.height = 60; Item.useAnimation = 10; Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; @@ -41,20 +42,20 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(Yharon.FireSound, player.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - + CalamityUtils.SpawnBossUsingItem(player, Yharon.FireSound); return true; } + public override void UseItemFrame(Player player) + { + player.itemLocation = (Vector2)player.HandPosition + new Vector2(10 * -player.direction, 20); + } + public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). AddIngredient(10). + AddIngredient(15). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/SummonItems/YharonEgg.png b/Items/SummonItems/YharonEgg.png index ab48454ce9..e3b95a7a3e 100644 Binary files a/Items/SummonItems/YharonEgg.png and b/Items/SummonItems/YharonEgg.png differ diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index 2791c4a11f..415c44514a 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Packets; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,20 +14,15 @@ namespace CalamityMod.Items { Item.width = 20; Item.height = 30; - Item.damage = 0; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.value = 0; - Item.rare = ItemRarityID.Blue; Item.autoReuse = true; + Item.useTurn = true; + Item.value = Item.sellPrice(silver: 1); // Same as Target Dummy + Item.rare = ItemRarityID.Blue; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public static void DeleteDummies() { @@ -37,7 +33,7 @@ namespace CalamityMod.Items npc.life = 0; npc.active = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } } @@ -59,9 +55,7 @@ namespace CalamityMod.Items // dummies are gone, and cause them to reappear, making the deletion moot. else { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DeleteAllSuperDummies); - netMessage.Send(); + DeleteAllSuperDummiesPacket.Send(); } } } @@ -77,16 +71,29 @@ namespace CalamityMod.Items // Otherwise, send a message to the server indicating that a Super Dummy should be spawned at this position. else { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SpawnSuperDummy); - netMessage.Write(x); - netMessage.Write(y); - netMessage.Send(); + SpawnSuperDummyPacket.Send(x, y); } } return true; } + public override bool CanRightClick() => true; + + // RightClick only called by client, no worry about potential packetstorm + public override void RightClick(Player player) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + DeleteDummies(); + } + else + { + DeleteAllSuperDummiesPacket.Send(); + } + + Item.RestoreConsumedItemByRightClick(); + } + public override void AddRecipes() { Recipe r = CreateRecipe(); diff --git a/Items/Tools/AbyssalWarhammer.png b/Items/Tools/AbyssalWarhammer.png index b20edc3726..ec6356d7cf 100644 Binary files a/Items/Tools/AbyssalWarhammer.png and b/Items/Tools/AbyssalWarhammer.png differ diff --git a/Items/Tools/AcidwoodAxe.cs b/Items/Tools/AcidwoodAxe.cs index 301e67b604..681916df76 100644 --- a/Items/Tools/AcidwoodAxe.cs +++ b/Items/Tools/AcidwoodAxe.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Tools/AcidwoodHammer.cs b/Items/Tools/AcidwoodHammer.cs index 52d10ab949..78f5eeb610 100644 --- a/Items/Tools/AcidwoodHammer.cs +++ b/Items/Tools/AcidwoodHammer.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Tools/AcidwoodPickaxe.cs b/Items/Tools/AcidwoodPickaxe.cs index cbe69cf6e6..95630050c4 100644 --- a/Items/Tools/AcidwoodPickaxe.cs +++ b/Items/Tools/AcidwoodPickaxe.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Tools/AxeofPurity.cs b/Items/Tools/AxeofPurity.cs index abdf5aa8d7..61320c4c85 100644 --- a/Items/Tools/AxeofPurity.cs +++ b/Items/Tools/AxeofPurity.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Tools public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() diff --git a/Items/Tools/BobbitHook.cs b/Items/Tools/BobbitHook.cs index f67d9f7fe3..d4e9e27084 100644 --- a/Items/Tools/BobbitHook.cs +++ b/Items/Tools/BobbitHook.cs @@ -1,9 +1,8 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; -using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; - using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Tools @@ -11,16 +10,23 @@ namespace CalamityMod.Items.Tools public class BobbitHook : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Tools"; + + public static float Reach = 40f; + public static float LaunchSpeed = 25f; + public static float ReelbackSpeed = 28f; + public static float PullSpeed = 24f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToString(), LaunchSpeed.ToString(), ReelbackSpeed.ToString(), PullSpeed.ToString()); + public override void SetDefaults() { // Instead of copying these values, we can clone and modify the ones we want to copy Item.CloneDefaults(ItemID.AmethystHook); Item.width = 30; Item.height = 32; - Item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. + Item.shootSpeed = LaunchSpeed; // How quickly the hook is shot. Item.shoot = ProjectileType(); Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); } } } diff --git a/Items/Tools/BobbitHook.png b/Items/Tools/BobbitHook.png index 8f26d018c5..4944a37071 100644 Binary files a/Items/Tools/BobbitHook.png and b/Items/Tools/BobbitHook.png differ diff --git a/Items/Tools/ClimateChange/AridArtifact.cs b/Items/Tools/ClimateChange/AridArtifact.cs index 759f43754d..9949af0295 100644 --- a/Items/Tools/ClimateChange/AridArtifact.cs +++ b/Items/Tools/ClimateChange/AridArtifact.cs @@ -1,8 +1,14 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; + +using SandstormEvent = Terraria.GameContent.Events.Sandstorm; + namespace CalamityMod.Items.Tools.ClimateChange { + + public class AridArtifact : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Tools"; @@ -27,13 +33,17 @@ namespace CalamityMod.Items.Tools.ClimateChange return DownedBossSystem.downedDesertScourge || Main.hardMode; } - // this is extremely ugly and has to be fully qualified because we add an item called Sandstorm public override bool? UseItem(Player player) { - if (Terraria.GameContent.Events.Sandstorm.Happening) - CalamityUtils.StopSandstorm(); + // Only SinglePlayer and Server need to sync those parameters + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + + if (SandstormEvent.Happening) + CalamityWorld.StopSandstorm(); else - CalamityUtils.StartSandstorm(); + CalamityWorld.StartSandstorm(); + return true; } diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index 70705a1e1a..b380c4f384 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -32,10 +32,13 @@ namespace CalamityMod.Items.Tools.ClimateChange itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; } - public override bool CanUseItem(Player player) + public override bool CanUseItem(Player player) => !CalamityPlayer.areThereAnyDamnBosses; + + public override bool? UseItem(Player player) { - if (CalamityPlayer.areThereAnyDamnBosses) - return false; + //Only SinglePlayer or DedServ should change time to prevent unwanted race condition + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; // Early Morning -> Noon if (Main.dayTime && Main.time < NoonCutoff) diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index fca095ca74..ff849c21b1 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,16 +32,19 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool? UseItem(Player player) { + // Only SinglePlayer and Server need to sync those parameters + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + if (!Main.raining) { - CalamityUtils.StartRain(true); + CalamityWorld.StartRain(adjustSeverity: true, worldSync: true); } else { - Main.raining = false; + CalamityWorld.StopRain(clearWeather: false, worldSync: true); } - CalamityNetcode.SyncWorld(); return true; } diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index 43b4d0a156..a4ad4abbf5 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Tools public override void SetStaticDefaults() { - Item.staff[Item.type] = true; - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + Item.staff[Type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() diff --git a/Items/Tools/DriftwoodAxe.cs b/Items/Tools/DriftwoodAxe.cs index fb4ddd9b78..2d06c0f68f 100644 --- a/Items/Tools/DriftwoodAxe.cs +++ b/Items/Tools/DriftwoodAxe.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Tools/DriftwoodHammer.cs b/Items/Tools/DriftwoodHammer.cs index 54c8abee9f..2a1917c2e2 100644 --- a/Items/Tools/DriftwoodHammer.cs +++ b/Items/Tools/DriftwoodHammer.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Tools/DriftwoodPickaxe.cs b/Items/Tools/DriftwoodPickaxe.cs index 60be118203..dbec552f83 100644 --- a/Items/Tools/DriftwoodPickaxe.cs +++ b/Items/Tools/DriftwoodPickaxe.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index 8f6cffdec9..4d95f705b3 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools { CreateRecipe(). AddRecipeGroup("AnySilverBar", 18). - AddIngredient(ItemID.Wood, 18). + AddRecipeGroup("Wood", 18). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/GenesisPickaxe.cs b/Items/Tools/GenesisPickaxe.cs index 907c036040..c74692833c 100644 --- a/Items/Tools/GenesisPickaxe.cs +++ b/Items/Tools/GenesisPickaxe.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -65,30 +66,6 @@ namespace CalamityMod.Items.Tools swingRotation = Utils.Remap(time, 0, player.itemAnimationMax, 0, 2.88f * swordDirection); - if (Main.rand.NextBool(4)) - { - Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; - Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); - dust.scale = Main.rand.NextFloat(0.5f, 0.75f); - dust.velocity = dustVel * 0.1f; - dust.color = Color.LightGreen; - dust.noGravity = true; - } - if (Main.rand.NextBool(4)) - { - Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; - - float partScale = Main.rand.NextFloat(0.6f, 1.2f); - Vector2 partVel = dustVel * Main.rand.NextFloat(0.1f, 0.3f); - Particle spark3 = new GlowOrbParticle(player.Center + dustVel * 7, partVel, false, 18, partScale, Color.Black, false, false, false); - GeneralParticleHandler.SpawnParticle(spark3); - for (int i = 0; i < 2; i++) - { - Particle spark2 = new GlowOrbParticle(player.Center + dustVel * 7, partVel, false, 18, partScale * 0.5f, Color.LightGreen, true, false, false); - GeneralParticleHandler.SpawnParticle(spark2); - } - } - Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); float partScale2 = Main.rand.NextFloat(0.5f, 0.8f); @@ -96,6 +73,12 @@ namespace CalamityMod.Items.Tools Particle smoke = new HeavySmokeParticle(player.Center + dustVel2 * 12 + Main.rand.NextVector2Circular(8, 8), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, Color.Black, 13, partScale2, 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false); GeneralParticleHandler.SpawnParticle(smoke); + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(player.Center + dustVel2 * 12 + Main.rand.NextVector2Circular(8, 8), ModContent.DustType(), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection), 0, default, Main.rand.NextFloat(0.9f, 1.25f)); + dust.noGravity = true; + dust.color = Color.LightGreen; + } time++; } diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index 05a6a1d354..dfa90262bf 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -13,9 +13,13 @@ namespace CalamityMod.Items.Tools private const int HammerPower = 110; private const int AxePower = 180 / 5; + public static float DamageBoost = 0.15f; + public static int DefenseBoost = 30; + public static float DamageReductionBoost = 0.1f; + public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() diff --git a/Items/Tools/MarniteDeconstructor.cs b/Items/Tools/MarniteDeconstructor.cs index 6938d7deb3..5e1fd756fd 100644 --- a/Items/Tools/MarniteDeconstructor.cs +++ b/Items/Tools/MarniteDeconstructor.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Tools @@ -11,36 +12,37 @@ namespace CalamityMod.Items.Tools public class MarniteDeconstructor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Tools"; + + public static int ArmorPenetration = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); + public override void SetDefaults() { Item.width = 36; Item.height = 18; Item.damage = 6; - Item.ArmorPenetration = 10; - Item.knockBack = 0f; - Item.useTime = 4; - Item.useAnimation = 25; - Item.hammer = 59; - Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Item.channel = true; - Item.noUseGraphic = true; - Item.noMelee = true; - Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item23; - Item.autoReuse = true; + Item.ArmorPenetration = ArmorPenetration; + Item.hammer = 59; + Item.tileBoost = 7; + Item.useAnimation = 25; + Item.useTime = 4; + Item.knockBack = 0.5f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 40f; - Item.tileBoost = 7; - } - public override void HoldItem(Player player) - { - player.Calamity().mouseWorldListener = true; + Item.UseSound = SoundID.Item23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; } + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override void AddRecipes() { diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 9b7e9e0541..636fbc944a 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Tools @@ -11,36 +12,36 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/MarniteObliteratorUse") { PitchVariance = 0.3f }; + public static int ArmorPenetration = 5; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); + public override void SetDefaults() { Item.width = 36; Item.height = 18; Item.damage = 7; - Item.ArmorPenetration = 5; - Item.knockBack = 0f; - Item.useTime = 3; - Item.useAnimation = 25; - Item.pick = 59; - Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Item.channel = true; - Item.noUseGraphic = true; - Item.noMelee = true; - Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item23; - Item.autoReuse = true; + Item.ArmorPenetration = ArmorPenetration; + Item.pick = 59; + Item.tileBoost = 7; + Item.useAnimation = 25; + Item.useTime = 3; + Item.knockBack = 0.5f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 40f; - Item.tileBoost = 7; - } - public override void HoldItem(Player player) - { - player.Calamity().mouseWorldListener = true; + Item.UseSound = SoundID.Item23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; } + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override void AddRecipes() { diff --git a/Items/Tools/MonolithAxe.cs b/Items/Tools/MonolithAxe.cs index 4764f38ed5..a34af5e678 100644 --- a/Items/Tools/MonolithAxe.cs +++ b/Items/Tools/MonolithAxe.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Tools/MonolithHammer.cs b/Items/Tools/MonolithHammer.cs index 3b3c1d5443..4c30aa8ccb 100644 --- a/Items/Tools/MonolithHammer.cs +++ b/Items/Tools/MonolithHammer.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Tools/MonolithPickaxe.cs b/Items/Tools/MonolithPickaxe.cs index 46a436d3ea..5281c45aae 100644 --- a/Items/Tools/MonolithPickaxe.cs +++ b/Items/Tools/MonolithPickaxe.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Tools/SeismicHampick.cs b/Items/Tools/SeismicHampick.cs index 1146ade1fc..626b208649 100644 --- a/Items/Tools/SeismicHampick.cs +++ b/Items/Tools/SeismicHampick.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Tools public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Tools { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool(3) ? 16 : 127); } - if (Main.rand.NextBool(5) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(5) && !Main.dedServ) { int smoke = Gore.NewGore(player.GetSource_ItemUse(Item), new Vector2(hitbox.X, hitbox.Y), default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; diff --git a/Items/Tools/TectonicTruncator.cs b/Items/Tools/TectonicTruncator.cs index 3f022a6ab5..8e56a87c84 100644 --- a/Items/Tools/TectonicTruncator.cs +++ b/Items/Tools/TectonicTruncator.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Tools { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool(3) ? 16 : 127); } - if (Main.rand.NextBool(5) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(5) && !Main.dedServ) { int smoke = Gore.NewGore(player.GetSource_ItemUse(Item), new Vector2(hitbox.X, hitbox.Y), default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; diff --git a/Items/Tools/WulfrumDiggingTurtle.cs b/Items/Tools/WulfrumDiggingTurtle.cs index f398ed1c3a..76181d9eeb 100644 --- a/Items/Tools/WulfrumDiggingTurtle.cs +++ b/Items/Tools/WulfrumDiggingTurtle.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Tools { Item.width = 30; Item.height = 38; - Item.useTime = Item.useAnimation = 8; - Item.maxStack = 9999; + Item.useAnimation = Item.useTime = 8; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 0, 10, 0); + Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } @@ -60,8 +60,7 @@ namespace CalamityMod.Items.Tools p.ai[1] = 1f; p.timeLeft = 1; - p.netUpdate = true; - p.netSpam = 0; + p.ForceNetUpdate(); explodedAny = true; } diff --git a/Items/Tools/WulfrumDrill.cs b/Items/Tools/WulfrumDrill.cs index 1a5508fe6d..0d829fad72 100644 --- a/Items/Tools/WulfrumDrill.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -15,29 +15,26 @@ namespace CalamityMod.Items.Tools Item.width = 46; Item.height = 38; Item.damage = 5; - Item.knockBack = 0f; - Item.useTime = 5; - Item.useAnimation = 16; + Item.DamageType = DamageClass.Melee; Item.pick = 35; Item.tileBoost += 1; - - Item.DamageType = DamageClass.Melee; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item23; - Item.autoReuse = true; + Item.useAnimation = 16; + Item.useTime = 5; + Item.knockBack = 0.5f; Item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; Item.channel = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.useStyle = ItemUseStyleID.Shoot; + + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; } - public override void HoldItem(Player player) - { - player.Calamity().mouseWorldListener = true; - } + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override void AddRecipes() { diff --git a/Items/Tools/WulfrumScaffoldKit.cs b/Items/Tools/WulfrumScaffoldKit.cs index 5214589d07..c32bd9c1df 100644 --- a/Items/Tools/WulfrumScaffoldKit.cs +++ b/Items/Tools/WulfrumScaffoldKit.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; @@ -20,12 +21,13 @@ namespace CalamityMod.Items.Tools public static int TileTime = 6 * 60; public static int TileReach = 40; public static int PlacedTileType => ModContent.TileType(); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(TilesPerScrap); public override void SetDefaults() { Item.width = 52; Item.height = 42; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.autoReuse = false; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.HiddenAnimation; @@ -33,7 +35,7 @@ namespace CalamityMod.Items.Tools Item.noMelee = true; Item.channel = true; Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(silver: 50); + Item.value = Item.sellPrice(silver: 10); storedScrap = 0; Item.shoot = ModContent.ProjectileType(); TileTime = 6 * 60; diff --git a/Items/Tools/WulfrumTreasurePinger.cs b/Items/Tools/WulfrumTreasurePinger.cs index 8ccbada62e..165d179cd3 100644 --- a/Items/Tools/WulfrumTreasurePinger.cs +++ b/Items/Tools/WulfrumTreasurePinger.cs @@ -29,14 +29,14 @@ namespace CalamityMod.Items.Tools { Item.width = 52; Item.height = 42; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.autoReuse = false; Item.holdStyle = 16; //Custom hold style Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = null; Item.noMelee = true; Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(silver: 50); + Item.value = Item.sellPrice(silver: 10); usesLeft = maxUses; timeBeforeBlast = breakTime; } @@ -102,7 +102,7 @@ namespace CalamityMod.Items.Tools GeneralParticleHandler.SpawnParticle(smoke); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < shrapnelCount; i++) { diff --git a/Items/TreasureBags/AquaticScourgeBag.cs b/Items/TreasureBags/AquaticScourgeBag.cs index 052a8aaabd..84daab017c 100644 --- a/Items/TreasureBags/AquaticScourgeBag.cs +++ b/Items/TreasureBags/AquaticScourgeBag.cs @@ -23,14 +23,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/AstrumAureusBag.cs b/Items/TreasureBags/AstrumAureusBag.cs index 0b3d7925d6..ebb93f3858 100644 --- a/Items/TreasureBags/AstrumAureusBag.cs +++ b/Items/TreasureBags/AstrumAureusBag.cs @@ -28,14 +28,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index 0edb610266..46858f2661 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -24,14 +24,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; diff --git a/Items/TreasureBags/BrimstoneWaifuBag.cs b/Items/TreasureBags/BrimstoneWaifuBag.cs index 124589d49e..4b68c1a252 100644 --- a/Items/TreasureBags/BrimstoneWaifuBag.cs +++ b/Items/TreasureBags/BrimstoneWaifuBag.cs @@ -25,14 +25,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; @@ -67,9 +67,9 @@ namespace CalamityMod.Items.TreasureBags { ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() })); - itemLoot.Add(ModContent.ItemType(), 10); // Equipment itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/TreasureBags/CalamitasCloneBag.cs b/Items/TreasureBags/CalamitasCloneBag.cs index 45454a0eab..08b9c7558d 100644 --- a/Items/TreasureBags/CalamitasCloneBag.cs +++ b/Items/TreasureBags/CalamitasCloneBag.cs @@ -23,14 +23,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/CalamitasCoffer.cs b/Items/TreasureBags/CalamitasCoffer.cs index 15d59ed0f2..42fa940a87 100644 --- a/Items/TreasureBags/CalamitasCoffer.cs +++ b/Items/TreasureBags/CalamitasCoffer.cs @@ -25,14 +25,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Purple; Item.expert = true; diff --git a/Items/TreasureBags/CeaselessVoidBag.cs b/Items/TreasureBags/CeaselessVoidBag.cs index 4b7b168392..3e82674595 100644 --- a/Items/TreasureBags/CeaselessVoidBag.cs +++ b/Items/TreasureBags/CeaselessVoidBag.cs @@ -20,14 +20,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/CrabulonBag.cs b/Items/TreasureBags/CrabulonBag.cs index 7d913160e9..7dde476399 100644 --- a/Items/TreasureBags/CrabulonBag.cs +++ b/Items/TreasureBags/CrabulonBag.cs @@ -24,15 +24,15 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; - ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/CryogenBag.cs b/Items/TreasureBags/CryogenBag.cs index ac76a5f8c3..224aee88b5 100644 --- a/Items/TreasureBags/CryogenBag.cs +++ b/Items/TreasureBags/CryogenBag.cs @@ -24,14 +24,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/DesertScourgeBag.cs b/Items/TreasureBags/DesertScourgeBag.cs index 4f734a549f..42d1b0abc6 100644 --- a/Items/TreasureBags/DesertScourgeBag.cs +++ b/Items/TreasureBags/DesertScourgeBag.cs @@ -24,15 +24,15 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; - ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index c4f6fc619f..e5bd7e7854 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -26,14 +26,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 36; Item.height = 34; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/DraedonBag.cs b/Items/TreasureBags/DraedonBag.cs index b8d2456874..99969e8636 100644 --- a/Items/TreasureBags/DraedonBag.cs +++ b/Items/TreasureBags/DraedonBag.cs @@ -24,14 +24,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/DragonfollyBag.cs b/Items/TreasureBags/DragonfollyBag.cs index 0cccdf84d8..bdbc785757 100644 --- a/Items/TreasureBags/DragonfollyBag.cs +++ b/Items/TreasureBags/DragonfollyBag.cs @@ -25,14 +25,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; diff --git a/Items/TreasureBags/HiveMindBag.cs b/Items/TreasureBags/HiveMindBag.cs index 9a8f86fb84..22c3df8060 100644 --- a/Items/TreasureBags/HiveMindBag.cs +++ b/Items/TreasureBags/HiveMindBag.cs @@ -24,15 +24,15 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; - ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; @@ -73,7 +73,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 50, 75), + ModContent.ItemType(), })); // Equipment diff --git a/Items/TreasureBags/LeviathanBag.cs b/Items/TreasureBags/LeviathanBag.cs index a772eed178..1f54228f35 100644 --- a/Items/TreasureBags/LeviathanBag.cs +++ b/Items/TreasureBags/LeviathanBag.cs @@ -23,14 +23,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; @@ -69,7 +69,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), })); diff --git a/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs index f18d53077b..bbbe86179b 100644 --- a/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs +++ b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs @@ -12,21 +12,18 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public new string LocalizationCategory => "Items.TreasureBags"; internal static readonly int[] AbyssalTreasurePotions = new int[] { - ItemID.SpelunkerPotion, - ItemID.MagicPowerPotion, - ItemID.ShinePotion, - ItemID.WaterWalkingPotion, - ItemID.ObsidianSkinPotion, - ItemID.WaterWalkingPotion, - ItemID.GravitationPotion, - ItemID.RegenerationPotion, + // Exploration potions ModContent.ItemType(), - ItemID.GillsPotion, - ItemID.EndurancePotion, - ItemID.HeartreachPotion, ItemID.FlipperPotion, + ItemID.GillsPotion, + ItemID.ShinePotion, + ItemID.PotionOfReturn, + // Other higher tier potions + ItemID.EndurancePotion, + ItemID.GravitationPotion, + ItemID.HeartreachPotion, ItemID.LifeforcePotion, - ItemID.InfernoPotion + ItemID.SpelunkerPotion }; public override void SetStaticDefaults() @@ -39,7 +36,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Blue; //Blue for thematics } @@ -51,38 +48,41 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public override bool CanRightClick() => true; - // TML 1.4 August Stable Grab Bag hook public override void ModifyItemLoot(ItemLoot itemLoot) { - // 10% chance for potions - var tenPercentPotions = itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(10, 1, AbyssalTreasurePotions)); + LeadingConditionRule LCRsinglePlayer = new LeadingConditionRule(DropHelper.If(() => Main.netMode != NetmodeID.MultiplayerClient)); + LeadingConditionRule LCRexpert = new LeadingConditionRule(DropHelper.If(() => Main.expertMode)); - // 1/30 chance for a Wormhole Potion in multiplayer only - IItemDropRule wormholePotion = ItemDropRule.ByCondition(DropHelper.If(() => Main.netMode == NetmodeID.MultiplayerClient), ItemID.WormholePotion, 30); - LeadingConditionRule singlePlayer = new LeadingConditionRule(DropHelper.If(() => Main.netMode != NetmodeID.MultiplayerClient)); + // Buff Potions @ 10% + var buffPotions = itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(10, 1, AbyssalTreasurePotions)); - // IF YOU DONT GET POTIONS - // 10% chance for 4-8 Abyss Torches - // 10% chance 10-20 Hellfire Arrows - // 10% chance for 1 Hadal Stew - // 10% chance for 1 Sticky Dynamite - // 60% chance for 40-60 Silver Coins + // Wormhole Potions @ 3% (Multiplayer only) + var wormholePotion = ItemDropRule.ByCondition(DropHelper.If(() => Main.netMode == NetmodeID.MultiplayerClient), ItemID.WormholePotion, 30); - // 4-8 Abyss Torches - CommonDrop torches = new CommonDrop(ModContent.ItemType(), 1, 4, 8); - // 10-20 Hellfire Arrows - CommonDrop hellfireArrows = new CommonDrop(ItemID.HellfireArrow, 1, 10, 20); - // 1 Hadal Stew - CommonDrop hadalStew = new CommonDrop(ModContent.ItemType(), 1); - // 1 Sticky Dynamite - CommonDrop stickyDynamite = new CommonDrop(ItemID.StickyDynamite, 1); - // 40-60 Silver Coin - CommonDrop silver = new CommonDrop(ItemID.SilverCoin, 1, 40, 60); + // Pots can normally contain hearts here... but we turned it into a grab bag (so... coins!) + // 4-12/5-18 Biome Torches @ 12.43% (87/700) + var torches = DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 4, 12, 5, 18); - OneFromRulesRule otherDrops = new OneFromRulesRule(1, new IItemDropRule[] { torches, hellfireArrows, hadalStew, stickyDynamite, silver, silver, silver, silver, silver, silver }); + // 10-20 Hellfire Arrows @ 12.43% + var ammo = ItemDropRule.NotScalingWithLuck(ItemID.HellfireArrow, 1, 10, 20); - tenPercentPotions.OnFailedRoll(wormholePotion).OnFailedRoll(otherDrops); - tenPercentPotions.OnFailedRoll(singlePlayer).OnSuccess(otherDrops); + // 1 Healing Potion (33.33% in Expert for +1) @ 12.43% + var healPot = ItemDropRule.NotScalingWithLuck(ItemID.HealingPotion, 1); + var healPotExtra = ItemDropRule.NotScalingWithLuck(ItemID.HealingPotion, 3); + + // 1-4/1-7 Dynamites @ 12.43% + var bombs = DropHelper.NormalVsExpertQuantity(ItemID.Dynamite, 1, 1, 4, 1, 7); + + // Ropes substituted by coins (assuming you don't need it) + // 4-18/12-54 Silver Coins (500% coin modifier) @ 37.29% + // Expert multiplier is a simple 3x because vanilla coin modifiers are awful + var coins = DropHelper.NormalVsExpertQuantity(ItemID.SilverCoin, 1, 4, 18, 12, 54); + + OneFromRulesRule otherDrops = new OneFromRulesRule(1, new IItemDropRule[] { coins, torches, ammo, healPot, bombs, coins, coins }); + + buffPotions.OnFailedRoll(wormholePotion).OnFailedRoll(otherDrops); + buffPotions.OnFailedRoll(LCRsinglePlayer).OnSuccess(otherDrops); + healPot.OnSuccess(LCRexpert).OnSuccess(healPotExtra); } } } diff --git a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs index a19f07bdda..e371b23910 100644 --- a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs +++ b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Pink; } diff --git a/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs index 786b8c9f05..983ac2f023 100644 --- a/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs +++ b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Yellow; } @@ -35,22 +35,28 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { // Different drop rates on Normal and Expert, so define normal first, then expert // 1-3 bars on Normal, 2-3 bars on Expert - // 1-2 cores on Normal, 1-3 cores on Expert + // 1-2 essences on Normal, 1-3 essences on Expert + // 33% chance of life alloy on Normal, 50% on Expert + // 25% chance of core of calamity on Normal, 33% on Expert var normalOnly = itemLoot.DefineNormalOnlyDropSet(); normalOnly.Add(ModContent.ItemType(), 1, 1, 3); normalOnly.Add(ModContent.ItemType(), 1, 1, 3); normalOnly.Add(ModContent.ItemType(), 1, 1, 3); - normalOnly.Add(ModContent.ItemType(), 1, 1, 2); - normalOnly.Add(ModContent.ItemType(), 1, 1, 2); - normalOnly.Add(ModContent.ItemType(), 1, 1, 2); + normalOnly.Add(ModContent.ItemType(), 1, 1, 2); + normalOnly.Add(ModContent.ItemType(), 1, 1, 2); + normalOnly.Add(ModContent.ItemType(), 1, 1, 2); + normalOnly.Add(ModContent.ItemType(), 3); + normalOnly.Add(ModContent.ItemType(), 4); var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); expertPlus.Add(ModContent.ItemType(), 1, 2, 3); expertPlus.Add(ModContent.ItemType(), 1, 2, 3); expertPlus.Add(ModContent.ItemType(), 1, 2, 3); - expertPlus.Add(ModContent.ItemType(), 1, 1, 3); - expertPlus.Add(ModContent.ItemType(), 1, 1, 3); - expertPlus.Add(ModContent.ItemType(), 1, 1, 3); + expertPlus.Add(ModContent.ItemType(), 1, 1, 3); + expertPlus.Add(ModContent.ItemType(), 1, 1, 3); + expertPlus.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 2); + normalOnly.Add(ModContent.ItemType(), 3); } } } diff --git a/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs b/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs index c1fd5b146b..e6d46d3194 100644 --- a/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs +++ b/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ModContent.RarityType(); } @@ -37,7 +37,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { // Different drop rates on Normal and Expert, so define normal first, then expert // 5-10 bars on Normal, 7-12 bars on Expert - // 1-3 cores on Normal, 2-4 cores on Expert + // 1-3 essences on Normal, 2-4 essences on Expert // 50% chance of life alloy on Normal, 100% on Expert // 33% chance of core of calamity on Normal, 50% on Expert // 100-120 bloodstone on Normal, 120-140 bloodstone on Expert @@ -45,9 +45,9 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags normalOnly.Add(ModContent.ItemType(), 1, 5, 10); normalOnly.Add(ModContent.ItemType(), 1, 5, 10); normalOnly.Add(ModContent.ItemType(), 1, 5, 10); - normalOnly.Add(ModContent.ItemType(), 1, 1, 3); - normalOnly.Add(ModContent.ItemType(), 1, 1, 3); - normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); normalOnly.Add(ModContent.ItemType(), 2); normalOnly.Add(ModContent.ItemType(), 3); normalOnly.Add(ModContent.ItemType(), 1, 100, 120); @@ -56,9 +56,9 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags expertPlus.Add(ModContent.ItemType(), 1, 7, 12); expertPlus.Add(ModContent.ItemType(), 1, 7, 12); expertPlus.Add(ModContent.ItemType(), 1, 7, 12); - expertPlus.Add(ModContent.ItemType(), 1, 2, 4); - expertPlus.Add(ModContent.ItemType(), 1, 2, 4); - expertPlus.Add(ModContent.ItemType(), 1, 2, 4); + expertPlus.Add(ModContent.ItemType(), 1, 2, 4); + expertPlus.Add(ModContent.ItemType(), 1, 2, 4); + expertPlus.Add(ModContent.ItemType(), 1, 2, 4); expertPlus.Add(ModContent.ItemType()); expertPlus.Add(ModContent.ItemType(), 2); expertPlus.Add(ModContent.ItemType(), 1, 120, 140); diff --git a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs index 25dfb959cf..c2b5e5076f 100644 --- a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs +++ b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Blue; } diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index 03aabed864..0398fbda0c 100644 --- a/Items/TreasureBags/MiscGrabBags/StarterBag.cs +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -53,19 +53,18 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags itemLoot.Add(ItemID.Rope, 1, 50, 50); // Potions - itemLoot.Add(ItemID.MiningPotion); - itemLoot.Add(ItemID.SpelunkerPotion, 1, 2, 2); - itemLoot.Add(ItemID.SwiftnessPotion, 1, 3, 3); - itemLoot.Add(ItemID.GillsPotion, 1, 2, 2); - itemLoot.Add(ItemID.ShinePotion); + LeadingConditionRule multiplayer = itemLoot.DefineConditionalDropSet(() => Main.netMode == NetmodeID.MultiplayerClient); + itemLoot.Add(ItemID.MiningPotion, 1, 3, 3); + itemLoot.Add(ItemID.SpelunkerPotion, 1, 3, 3); itemLoot.Add(ItemID.RecallPotion, 1, 3, 3); + multiplayer.Add(ItemID.WormholePotion, 1, 3, 3); // Tiles itemLoot.Add(ItemID.Torch, 1, 25, 25); itemLoot.Add(ItemID.Chest, 1, 3, 3); // Calamity title theme music box (if music mod is enabled) - Mod musicMod = CalamityMod.Instance.musicMod; + Mod musicMod = ExternalMods.musicMod; if (musicMod is not null) itemLoot.Add(musicMod.Find("CalamityMusicbox").Type); @@ -81,6 +80,15 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags }; itemLoot.AddIf(getsLadPet, ModContent.ItemType()); + // Mihaii dev item + // Name specific: "Mihaii" + static bool getsGoldenBomb(DropAttemptInfo info) + { + string playerName = info.player.name; + return playerName == "Mihaii"; + }; + itemLoot.AddIf(getsGoldenBomb, ModContent.ItemType()); + // HPU dev item // Name specific: "Heart Plus Up" static bool getsHapuFruit(DropAttemptInfo info) @@ -90,6 +98,15 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags }; itemLoot.AddIf(getsHapuFruit, ModContent.ItemType()); + // CIT vanity item + // Name specific: "CongratsIsTrash" or "CIT" + static bool getsSharkyPlush(DropAttemptInfo info) + { + string playerName = info.player.name; + return playerName == "CongratsIsTrash" || playerName == "CIT"; + } + itemLoot.AddIf(getsSharkyPlush, ModContent.ItemType()); + // Dandy dev item // Name specific: "Dandy" static bool getsGhostBracelet(DropAttemptInfo info) @@ -100,6 +117,26 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags itemLoot.AddIf(getsGhostBracelet, ModContent.ItemType()); + // Shayy dev item + // Name specific: "Shayy" + static bool getsPunchCard(DropAttemptInfo info) + { + string playerName = info.player.name; + return playerName == "Shayy"; + } + + itemLoot.AddIf(getsPunchCard, ModContent.ItemType()); + + // Xyk dev item + // Name specific: "Xyk" + static bool getsXyksBlessing(DropAttemptInfo info) + { + string playerName = info.player.name; + return playerName.Contains("Xyk"); // Any name containing "Xyk" will work + } + + itemLoot.AddIf(getsXyksBlessing, ModContent.ItemType()); + // Mishiro dev vanity // Name specific: "Amber" or "Mishiro" static bool getsOracleHeadphones(DropAttemptInfo info) diff --git a/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs b/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs index 5bf5ae2529..ed50d98c56 100644 --- a/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs +++ b/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Potions; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Potions; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -11,21 +12,18 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public new string LocalizationCategory => "Items.TreasureBags"; internal static readonly int[] SulphuricTreasurePotions = new int[] { - ItemID.SpelunkerPotion, - ItemID.MagicPowerPotion, - ItemID.ShinePotion, - ItemID.WaterWalkingPotion, - ItemID.ObsidianSkinPotion, - ItemID.WaterWalkingPotion, - ItemID.GravitationPotion, - ItemID.RegenerationPotion, - ModContent.ItemType(), - ItemID.GillsPotion, - ItemID.EndurancePotion, - ItemID.HeartreachPotion, + // Exploration potions + ModContent.ItemType(), ItemID.FlipperPotion, + ItemID.GillsPotion, + ItemID.ShinePotion, + ItemID.PotionOfReturn, + // Other higher tier potions + ItemID.EndurancePotion, + ItemID.GravitationPotion, + ItemID.HeartreachPotion, ItemID.LifeforcePotion, - ItemID.InfernoPotion + ItemID.SpelunkerPotion }; public override void SetStaticDefaults() @@ -37,7 +35,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Green; //Green for thematics } @@ -51,36 +49,40 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // 1/15 chance for potions - var oneInFifteenPotions = itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(15, 1, SulphuricTreasurePotions)); + LeadingConditionRule LCRsinglePlayer = new LeadingConditionRule(DropHelper.If(() => Main.netMode != NetmodeID.MultiplayerClient)); + LeadingConditionRule LCRexpert = new LeadingConditionRule(DropHelper.If(() => Main.expertMode)); - // 1/30 chance for a Wormhole Potion in multiplayer only - IItemDropRule wormholePotion = ItemDropRule.ByCondition(DropHelper.If(() => Main.netMode == NetmodeID.MultiplayerClient), ItemID.WormholePotion, 30); - LeadingConditionRule singlePlayer = new LeadingConditionRule(DropHelper.If(() => Main.netMode != NetmodeID.MultiplayerClient)); + // Buff Potions @ 10% + var buffPotions = itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(10, 1, SulphuricTreasurePotions)); - // IF YOU DONT GET POTIONS - // 10% chance for 4-8 Sticky Glowsticks - // 10% chance for 10-20 Jester Arrows - // 10% chance for 1 Hadal Stew - // 10% chance for 5-7 BOMBS?! - // 0% chance for Lamp Oil (no item in game) - // 60% chance for 40-60 Silver Coins + // Wormhole Potions @ 3% (Multiplayer only) + var wormholePotion = ItemDropRule.ByCondition(DropHelper.If(() => Main.netMode == NetmodeID.MultiplayerClient), ItemID.WormholePotion, 30); - // 4-8 Glowsticks - CommonDrop stickyGlowsticks = new CommonDrop(ItemID.StickyGlowstick, 1, 4, 8); - // 10-20 Jester Arrows - CommonDrop jesterArrows = new CommonDrop(ItemID.JestersArrow, 1, 10, 20); - // 1 Hadal Stew - CommonDrop hadalStew = new CommonDrop(ModContent.ItemType(), 1); - // 5-7 Sticky Bombs - CommonDrop stickyBombs = new CommonDrop(ItemID.StickyBomb, 1, 5, 7); - // 40-60 Silver Coin - CommonDrop silver = new CommonDrop(ItemID.SilverCoin, 1, 40, 60); + // Pots can normally contain hearts here... but we turned it into a grab bag (so... coins!) + // 4-12/5-18 Biome Torches @ 12.43% (87/700) + var torches = DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 4, 12, 5, 18); - OneFromRulesRule otherDrops = new OneFromRulesRule(1, new IItemDropRule[] { stickyGlowsticks, jesterArrows, hadalStew, stickyBombs, silver, silver, silver, silver, silver, silver }); + // 10-20 Wooden Arrows @ 12.43% + var ammo = ItemDropRule.NotScalingWithLuck(ItemID.WoodenArrow, 1, 10, 20); - oneInFifteenPotions.OnFailedRoll(wormholePotion).OnFailedRoll(otherDrops); - oneInFifteenPotions.OnFailedRoll(singlePlayer).OnSuccess(otherDrops); + // 1 Healing Potion @ 12.43% (33.33% in Expert for +1) + var healPot = ItemDropRule.NotScalingWithLuck(ItemID.HealingPotion, 1); + var healPotExtra = ItemDropRule.NotScalingWithLuck(ItemID.HealingPotion, 3); + + // 1-4/1-7 Bombs @ 12.43% + var bombs = DropHelper.NormalVsExpertQuantity(ItemID.Bomb, 1, 1, 4, 1, 7); + + // Ropes substituted by coins (assuming you don't need it) + // 2-9/6-27 Silver Coins (250% coin modifier) @ 37.29% + // Expert multiplier is a simple 3x because vanilla coin modifiers are awful + var coins = DropHelper.NormalVsExpertQuantity(ItemID.SilverCoin, 1, 2, 9, 6, 27); + + OneFromRulesRule otherDrops = new OneFromRulesRule(1, new IItemDropRule[] { coins, torches, ammo, healPot, bombs, coins, coins }); + + // Buff Potions > Wormhole Potion > Other drops + buffPotions.OnFailedRoll(wormholePotion).OnFailedRoll(otherDrops); + buffPotions.OnFailedRoll(LCRsinglePlayer).OnSuccess(otherDrops); + healPot.OnSuccess(LCRexpert).OnSuccess(healPotExtra); } } } diff --git a/Items/TreasureBags/OldDukeBag.cs b/Items/TreasureBags/OldDukeBag.cs index 14c7d1e91d..051ba8705b 100644 --- a/Items/TreasureBags/OldDukeBag.cs +++ b/Items/TreasureBags/OldDukeBag.cs @@ -22,14 +22,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Red; diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index 230ebe44c3..cec78d95d9 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -24,15 +24,15 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; - ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; @@ -75,7 +75,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 50, 75), + ModContent.ItemType(), })); // Equipment diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index bcbca32ab3..90f1610de5 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -24,14 +24,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; @@ -66,7 +66,6 @@ namespace CalamityMod.Items.TreasureBags // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] { - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/TreasureBags/PolterghastBag.cs b/Items/TreasureBags/PolterghastBag.cs index f1516c5f3c..6b10c1e1a0 100644 --- a/Items/TreasureBags/PolterghastBag.cs +++ b/Items/TreasureBags/PolterghastBag.cs @@ -25,14 +25,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 32; Item.height = 34; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index 4feb1ba07a..d192e2f733 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -23,14 +23,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/RavagerBag.cs b/Items/TreasureBags/RavagerBag.cs index 909b7ac934..e6159c6cb7 100644 --- a/Items/TreasureBags/RavagerBag.cs +++ b/Items/TreasureBags/RavagerBag.cs @@ -25,14 +25,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; diff --git a/Items/TreasureBags/SignusBag.cs b/Items/TreasureBags/SignusBag.cs index 32d248e425..fff0ce985d 100644 --- a/Items/TreasureBags/SignusBag.cs +++ b/Items/TreasureBags/SignusBag.cs @@ -20,14 +20,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/SlimeGodBag.cs b/Items/TreasureBags/SlimeGodBag.cs index d14f85068d..2172292425 100644 --- a/Items/TreasureBags/SlimeGodBag.cs +++ b/Items/TreasureBags/SlimeGodBag.cs @@ -23,15 +23,15 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; - ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/StormWeaverBag.cs b/Items/TreasureBags/StormWeaverBag.cs index aa7d570dcb..48c7eb7a9d 100644 --- a/Items/TreasureBags/StormWeaverBag.cs +++ b/Items/TreasureBags/StormWeaverBag.cs @@ -1,8 +1,10 @@ -using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.StormWeaver; using Microsoft.Xna.Framework; @@ -20,14 +22,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; @@ -60,14 +62,14 @@ namespace CalamityMod.Items.TreasureBags // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] { - ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() })); - itemLoot.Add(ModContent.ItemType(), 10); // Equipment + itemLoot.Add(ModContent.ItemType()); itemLoot.AddRevBagAccessories(); - // Stay tuned for Definitely Not Charged Perforator Runald's Band As A Single Item // Vanity itemLoot.Add(ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index e56cc657c5..82a29bcd1c 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -26,14 +26,14 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Type] = true; } public override void SetDefaults() { Item.width = 24; Item.height = 24; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; diff --git a/Items/TreasureBags/YharonBag.png b/Items/TreasureBags/YharonBag.png index c6bce143eb..6ea7b0e409 100644 Binary files a/Items/TreasureBags/YharonBag.png and b/Items/TreasureBags/YharonBag.png differ diff --git a/Items/VanillaArmorChanges/FrostArmorSetChange.cs b/Items/VanillaArmorChanges/FrostArmorSetChange.cs index 3466dba90e..f84f8b0fa0 100644 --- a/Items/VanillaArmorChanges/FrostArmorSetChange.cs +++ b/Items/VanillaArmorChanges/FrostArmorSetChange.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Frost"; - public const float ProximityBoost = 0.15f; + public const float ProximityBoost = 0.2f; public const float MinDistance = 160f; public const float MaxDistance = 800f; diff --git a/Items/VanillaArmorChanges/GoldArmorSetChange.cs b/Items/VanillaArmorChanges/GoldArmorSetChange.cs index 1cd9c38894..fbb7771b69 100644 --- a/Items/VanillaArmorChanges/GoldArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GoldArmorSetChange.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Gold"; - public const float HeadDamage = 0.06f; + public const float HeadDamage = 0.05f; public const float ChestDR = 0.05f; public const float LegsMoveSpeed = 0.1f; public const float GoldDropChanceFromEnemies = 0.02f; public const int GoldFromBosses = 3; public const float SetBonusCritPerGoldCoin = 0.1f; // 10 gold coins = +1% crit chance - public const float MaximumCritBonus = 9f; + public const float MaximumCritBonus = 7f; public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; diff --git a/Items/VanillaArmorChanges/MonkT2ArmorSetChange.cs b/Items/VanillaArmorChanges/MonkT2ArmorSetChange.cs index 1da19b5973..a0cf88de55 100644 --- a/Items/VanillaArmorChanges/MonkT2ArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MonkT2ArmorSetChange.cs @@ -21,27 +21,31 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyHeadPieceEffect(Player player) { - player.GetAttackSpeed() -= 0.1f; + player.GetAttackSpeed() -= 0.2f; + player.Calamity().rogueVelocity += 0.1f; // Replace melee speed with rogue velocity. } - public override void ApplyBodyPieceEffect(Player player) + public override void ApplyBodyPieceEffect(Player player) { - player.GetDamage() -= 0.1f; - player.GetDamage() -= 0.1f; + player.GetDamage() -= 0.15f; // Decrease both damage boosts to 5%. + player.GetDamage() -= 0.2f; + player.GetDamage() += 0.05f; // Replace melee damage with rogue damage. } public override void ApplyLegPieceEffect(Player player) { - player.GetDamage() -= 0.05f; - player.GetCritChance() -= 10; + player.GetDamage() -= 0.05f; // Decrease summon damage boost to 5%. + player.GetCritChance() -= 15; // Replace melee crit chance with rogue and decrease to 5%. + player.GetCritChance() += 5; } public override void ApplyArmorSetBonus(Player player) { - player.GetDamage() += 0.15f; - player.GetDamage() += 0.1f; - player.GetAttackSpeed() += 0.1f; - player.GetCritChance() += 10; + player.GetDamage() += 0.15f; // Re-add 15% of the 20% lost summon damage, 10% of the 20% rogue damage, and the rest of the rogue crit. + player.GetDamage() += 0.1f; + player.GetCritChance() += 10; + player.Calamity().rogueStealthMax += 0.9f; // Give rogue stealth. + player.Calamity().wearingRogueArmor = true; } } } diff --git a/Items/VanillaArmorChanges/MonkT3ArmorSetChange.cs b/Items/VanillaArmorChanges/MonkT3ArmorSetChange.cs new file mode 100644 index 0000000000..b56de9692e --- /dev/null +++ b/Items/VanillaArmorChanges/MonkT3ArmorSetChange.cs @@ -0,0 +1,53 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.VanillaArmorChanges +{ + public class MonkT3ArmorSetChange : VanillaArmorChange + { + public override int? HeadPieceID => ItemID.MonkAltHead; + + public override int? BodyPieceID => ItemID.MonkAltShirt; + + public override int? LegPieceID => ItemID.MonkAltPants; + + public override string ArmorSetName => "MonkTier3"; + + public override void UpdateSetBonusText(ref string setBonusText) + { + setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + } + + public override void ApplyHeadPieceEffect(Player player) + { + player.GetDamage() -= 0.1f; // Decrease both damage boosts to 10%. + player.GetDamage() -= 0.2f; + player.GetDamage() += 0.1f; // Replace melee damage with rogue damage. + } + + public override void ApplyBodyPieceEffect(Player player) + { + player.GetDamage() -= 0.1f; // Decrease summon damage boost to 10%. + player.GetAttackSpeed() -= 0.2f; // Replace melee speed with rogue velocity, and decrease to 15%. + player.Calamity().rogueVelocity += 0.15f; + player.GetCritChance() -= 5; // Replace melee crit with rogue crit. + player.GetCritChance() += 5; + } + + public override void ApplyLegPieceEffect(Player player) + { + player.GetDamage() -= 0.1f; // Decrease summon damage boost to 10%. + player.GetCritChance() -= 20; // Replace melee crit chance with rogue, and decrease to 10%. + player.GetCritChance() += 10; + } + + public override void ApplyArmorSetBonus(Player player) + { + player.GetDamage() += 0.2f; // Re-add 20% of the 30% lost summon damage, and the rest of the rogue damage. + player.GetDamage() += 0.1f; + player.Calamity().rogueStealthMax += 1f; // Give rogue stealth. + player.Calamity().wearingRogueArmor = true; + } + } +} diff --git a/Items/VanillaArmorChanges/MythrilArmorSetChange.cs b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs index 772fad8a35..0d162d6663 100644 --- a/Items/VanillaArmorChanges/MythrilArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs @@ -52,7 +52,6 @@ namespace CalamityMod.Items.VanillaArmorChanges owner.Calamity().MythrilFlareSpawnCountdown = FlareFrameSpawnDelay; int flareDamage = CalamityUtils.DamageSoftCap(originalDamage * 0.3, FlareDamageSoftcap); - flareDamage = owner.ApplyArmorAccDamageBonusesTo(flareDamage); Vector2 flareSpawnPosition = victim.Center + Main.rand.NextVector2Circular(10f, 10f); Projectile.NewProjectile(owner.GetSource_ItemUse(owner.ActiveItem()), flareSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), flareDamage, 0f, owner.whoAmI); diff --git a/Items/VanillaArmorChanges/NecroArmorSetChange.cs b/Items/VanillaArmorChanges/NecroArmorSetChange.cs index dc0b171ace..f4768a2092 100644 --- a/Items/VanillaArmorChanges/NecroArmorSetChange.cs +++ b/Items/VanillaArmorChanges/NecroArmorSetChange.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Necro"; - public const int PostMortemDuration = 7; + public const int PostMortemDuration = 10; public static readonly SoundStyle TimerSound = new("CalamityMod/Sounds/Custom/TickingTimer"); public override void UpdateSetBonusText(ref string setBonusText) diff --git a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs index d709df88d2..18fee450a0 100644 --- a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs +++ b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs @@ -1,4 +1,4 @@ -using System.Text; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,9 +18,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float HeadDamage = 0.06f; public const float ChestCrit = 3f; public const float LegsMoveSpeed = 0.1f; - 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; + public const float SetBonusDamagePerDefense = 0.1f; // 10 defense = +1% damage, this gets divided by 100 + public const int SetBonusDefenseCap = 50; public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; @@ -36,14 +35,14 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyArmorSetBonus(Player player) { // 07MAY2024: Ozzatron: Platinum armor doesn't count its own defense for its set bonus - int defenseBesidesThisArmor = player.statDefense - (4 + 6 + 4 + 4); + // CIT 1MAR2025: Platinum armor should not count its set bonus defense here, because it hasn't been applied yet + int defenseBesidesThisArmor = player.statDefense - (5 + 6 + 5); if (defenseBesidesThisArmor <= 0) return; if (defenseBesidesThisArmor > SetBonusDefenseCap) defenseBesidesThisArmor = SetBonusDefenseCap; - player.GetDamage() += defenseBesidesThisArmor * SetBonusDamagePerDefense; - player.GetCritChance() += defenseBesidesThisArmor * SetBonusCritPerDefense; + player.GetDamage() += (float)Math.Floor(defenseBesidesThisArmor * SetBonusDamagePerDefense) * 0.01f; } } } diff --git a/Items/VanillaArmorChanges/RainArmorSetChange.cs b/Items/VanillaArmorChanges/RainArmorSetChange.cs new file mode 100644 index 0000000000..c3845a3259 --- /dev/null +++ b/Items/VanillaArmorChanges/RainArmorSetChange.cs @@ -0,0 +1,28 @@ +using CalamityMod.Buffs.StatDebuffs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.VanillaArmorChanges +{ + public class RainArmorSetChange : VanillaArmorChange + { + public override int? HeadPieceID => ItemID.RainHat; + public override int? BodyPieceID => ItemID.RainCoat; + public override int? LegPieceID => null; + + public override string ArmorSetName => "Rain"; + + public override void UpdateSetBonusText(ref string setBonusText) + { + setBonusText = $"{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + } + + public override void ApplyArmorSetBonus(Player player) + { + player.Calamity().rainSet = true; + player.autoJump = true; + player.jumpSpeedBoost += 1.2f; // 24% + } + } +} diff --git a/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs b/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs index fd242a29e5..591bb65d2d 100644 --- a/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs +++ b/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs @@ -4,29 +4,28 @@ using System.Linq; using System.Runtime.Serialization; using Terraria; using Terraria.ID; +using Terraria.ModLoader; using Terraria.ModLoader.Core; namespace CalamityMod.Items.VanillaArmorChanges { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class VanillaArmorChangeManager + public class VanillaArmorChangeManager : ModSystem { internal static List ArmorChanges; - internal static void Load() + public override void OnModLoad() { - ArmorChanges = new List(); - Type[] types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); - foreach (Type type in types) + ArmorChanges = []; + ReflectionHelper.IterateCalamityTypes(action: type => { - if (!type.IsSubclassOf(typeof(VanillaArmorChange)) || type.IsAbstract) - continue; - - ArmorChanges.Add((VanillaArmorChange)FormatterServices.GetUninitializedObject(type)); - } + ArmorChanges.Add((VanillaArmorChange)Activator.CreateInstance(type)); + }); } - internal static void Unload() => ArmorChanges = null; + public override void Unload() + { + ArmorChanges = null; + } public static void ApplySetBonusTooltipChanges(Item checkItem, ref string setBonusText) { diff --git a/Items/VoodooDemonVoodooDoll.cs b/Items/VoodooDemonVoodooDoll.cs index c098d72199..5885c4c135 100644 --- a/Items/VoodooDemonVoodooDoll.cs +++ b/Items/VoodooDemonVoodooDoll.cs @@ -35,12 +35,9 @@ namespace CalamityMod.Items 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; + + Item.RestoreConsumedItemByRightClick(); } /* diff --git a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs index ded5c99d03..7361d5bda7 100644 --- a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs +++ b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; public override void SetStaticDefaults() { - ItemID.Sets.Spears[Item.type] = true; + ItemID.Sets.Spears[Type] = true; } public override void SetDefaults() @@ -63,8 +63,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(12). AddIngredient(18). - AddIngredient(10). AddIngredient(5). + AddIngredient(10). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index c914d5e12b..17fb58acf7 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -6,7 +6,6 @@ using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -58,12 +57,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); - 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(), damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - public override Vector2? HoldoutOffset() => new Vector2(-20, 0); public override void AddRecipes() @@ -71,8 +64,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(15). AddIngredient(15). - AddIngredient(10). AddIngredient(5). + AddIngredient(10). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs index 98c8eac524..e8e51a0954 100644 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs index 144e1db7c4..445df79e74 100644 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.mana = 6; Item.damage = 150; Item.knockBack = 11f; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index 7be5cf7369..ea4fe97f92 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.DamageType = DamageClass.Ranged; Item.damage = 150; Item.knockBack = 30f; - Item.useTime = Item.useAnimation = 32; + Item.useAnimation = Item.useTime = 32; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; @@ -58,8 +58,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(18). AddIngredient(12). - AddIngredient(10). AddIngredient(5). + AddIngredient(10). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs index 6bcc75a4ce..8fce78b1c8 100644 --- a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public const float HoldoutChargeUse = 0.002f; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/DraedonsArsenal/MatterModulator.cs b/Items/Weapons/DraedonsArsenal/MatterModulator.cs index 67952028d0..004fcf0338 100644 --- a/Items/Weapons/DraedonsArsenal/MatterModulator.cs +++ b/Items/Weapons/DraedonsArsenal/MatterModulator.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.DamageType = DamageClass.Ranged; Item.damage = 100; Item.knockBack = 11f; - Item.useTime = Item.useAnimation = 33; + Item.useAnimation = Item.useTime = 33; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index 526fc38224..f6a07d25f4 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.damage = 24; Item.knockBack = 2f; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index 653ce53ecf..d177e4d0b0 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.useTurn = false; Item.knockBack = 7f; + Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; @@ -60,6 +61,7 @@ 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) { Projectile blade = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction blade.rotation = blade.AngleTo(Main.MouseWorld); blade.netUpdate = true; return false; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index 04a8bd9965..544c5818aa 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 857a3d038e..5c2902b993 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shootSpeed = 10f; Item.damage = 310; Item.mana = 12; - Item.useTime = Item.useAnimation = 9; + Item.useAnimation = Item.useTime = 9; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 8f; @@ -47,8 +47,9 @@ 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) { - Projectile north = Projectile.NewProjectileDirect(source, Main.MouseWorld + Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); - Projectile south = Projectile.NewProjectileDirect(source, Main.MouseWorld - Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Vector2 mouse = player.ClampedMouseWorld(); + Projectile north = Projectile.NewProjectileDirect(source, mouse + Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile south = Projectile.NewProjectileDirect(source, mouse - Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); north.originalDamage = Item.damage; south.originalDamage = Item.damage; north.ai[1] = 1f; diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 1f048ea46d..53f707848b 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -2,11 +2,10 @@ using System.Collections.Generic; using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -21,34 +20,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 62; Item.height = 22; - Item.DamageType = DamageClass.Magic; Item.damage = 22; - Item.knockBack = 0f; - Item.useTime = Item.useAnimation = 23; - Item.autoReuse = true; + Item.DamageType = DamageClass.Magic; Item.mana = 6; + Item.useAnimation = Item.useTime = 23; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5.2f; // This may seem low but the shot has 10 extra updates. - Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = PulseRifle.FireSound; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5.2f; // This may seem low but the shot has 10 extra updates. - modItem.UsesCharge = true; modItem.MaxCharge = 50f; modItem.ChargePerUse = 0.05f; } - 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(), damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - public override Vector2? HoldoutOffset() => new Vector2(10f, 0f); public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 9a68a38931..3d58c31b72 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -9,7 +9,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,32 +30,24 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 32; Item.DamageType = DamageClass.Ranged; Item.damage = BaseDamage; - Item.knockBack = 0f; - Item.useTime = 55; - Item.useAnimation = 55; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 55; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; - Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = FireSound; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - modItem.UsesCharge = true; modItem.MaxCharge = 250f; modItem.ChargePerUse = 0.24f; } - 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(), 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); diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index 15ca250bb3..3ddaa8b693 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -20,24 +20,23 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 28; Item.height = 26; + Item.damage = 150; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.damage = 150; - Item.knockBack = 0f; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 24; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; - Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.Item15; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.autoReuse = true; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 1f; - modItem.UsesCharge = true; modItem.MaxCharge = 135f; modItem.ChargePerUse = 1f; @@ -65,8 +64,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(12). AddIngredient(18). - AddIngredient(10). AddIngredient(5). + AddIngredient(10). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 7e1b3d2566..1b041e028e 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 24; Item.damage = 200; Item.mana = 12; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 3f; @@ -50,7 +50,7 @@ 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) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index 6ae3f691fd..15fda0cf58 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shootSpeed = 10f; Item.damage = 24; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2.25f; @@ -44,10 +44,11 @@ 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) { - Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); + Vector2 mouse = player.ClampedMouseWorld(); + Point mouseTileCoords = mouse.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).HasTile) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, mouse, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/DraedonsArsenal/SystemBane.cs b/Items/Weapons/DraedonsArsenal/SystemBane.cs index fce888af9a..aaa42e66ec 100644 --- a/Items/Weapons/DraedonsArsenal/SystemBane.cs +++ b/Items/Weapons/DraedonsArsenal/SystemBane.cs @@ -61,8 +61,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(20). AddIngredient(10). - AddIngredient(10). AddIngredient(5). + AddIngredient(10). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs index 70f91a0b1e..af84e0175b 100644 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ b/Items/Weapons/DraedonsArsenal/Taser.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Sounds; using Terraria; @@ -20,22 +20,21 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 50; Item.height = 26; - Item.DamageType = DamageClass.Ranged; Item.damage = 16; - Item.knockBack = 0f; - Item.useTime = Item.useAnimation = 28; - Item.autoReuse = true; + Item.DamageType = DamageClass.Ranged; + Item.useAnimation = Item.useTime = 28; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; - Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = CommonCalamitySounds.PlasmaBoltSound; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 25f; - modItem.UsesCharge = true; modItem.MaxCharge = 50f; modItem.ChargePerUse = 0.05f; diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 53b5e7d0ee..1388f7623a 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -8,7 +8,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -49,19 +48,13 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.ChargePerUse = 0.75f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { if (velocity.Length() > 5f) { velocity.Normalize(); velocity *= 5f; } - - float SpeedX = velocity.X + (float)Main.rand.Next(-1, 2) * 0.02f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-1, 2) * 0.02f; - - Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; } public override Vector2? HoldoutOffset() => new Vector2(-20, 0); diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs index 99fe8347cd..475c24e69e 100644 --- a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs +++ b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs @@ -31,12 +31,13 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 44; Item.damage = 1675; Item.knockBack = 4.5f; - Item.useTime = Item.useAnimation = AnomalysNanogunHoldout.PlasmaFireTimer; + Item.useAnimation = Item.useTime = AnomalysNanogunHoldout.PlasmaFireTimer; Item.shootSpeed = 5f; Item.DamageType = DamageClass.Ranged; Item.useStyle = ItemUseStyleID.Shoot; Item.shoot = ModContent.ProjectileType(); Item.UseSound = null; + Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index f69d253b41..8853f072ea 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index 96a3b2e987..cd2d2ec4c1 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -20,25 +20,23 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 75; - 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.damage = 75; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 56; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + + Item.UseSound = SoundID.Item1; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 0f; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item1; - - Item.shootSpeed = 16f; - Item.shoot = ModContent.ProjectileType(); modItem.UsesCharge = true; modItem.MaxCharge = 190f; diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index 399ba5cb99..5fca24ab40 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -16,30 +16,24 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = 86; Item.height = 32; Item.damage = 27; - Item.noMelee = true; Item.DamageType = DamageClass.Magic; - Item.channel = true; - Item.useTime = 19; - Item.useAnimation = 19; + Item.mana = 10; + Item.useAnimation = Item.useTime = 19; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.UseSound = SoundID.Item13; Item.useStyle = ItemUseStyleID.Shoot; - Item.mana = 10; + Item.autoReuse = true; + Item.noMelee = true; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; - - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; } - 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 * 4.5f, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => position += velocity.SafeNormalize(Vector2.UnitX) * 56f; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 712bb487fe..1332539641 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 28; Item.DamageType = DamageClass.Magic; Item.mana = 9; - Item.useTime = Item.useAnimation = 45; + Item.useAnimation = Item.useTime = 45; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; diff --git a/Items/Weapons/Magic/AetherfluxCannon.cs b/Items/Weapons/Magic/AetherfluxCannon.cs index 782fffeba9..77be95907f 100644 --- a/Items/Weapons/Magic/AetherfluxCannon.cs +++ b/Items/Weapons/Magic/AetherfluxCannon.cs @@ -15,15 +15,17 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; public const int UseTime = 36; + public static Color mainColor = Color.Goldenrod; + public static Color accentColor = Color.LightGreen; public override void SetDefaults() { Item.width = 94; Item.height = 54; - Item.damage = 285; + Item.damage = 355; Item.DamageType = DamageClass.Magic; Item.mana = 7; - Item.useTime = Item.useAnimation = UseTime; + Item.useAnimation = Item.useTime = UseTime; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; @@ -44,7 +46,8 @@ 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) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); - Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } @@ -52,7 +55,6 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(5). AddIngredient(12). AddIngredient(8). diff --git a/Items/Weapons/Magic/AethersWhisper.cs b/Items/Weapons/Magic/AethersWhisper.cs index 84c70e6b73..f240be95f0 100644 --- a/Items/Weapons/Magic/AethersWhisper.cs +++ b/Items/Weapons/Magic/AethersWhisper.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 44; Item.damage = 504; Item.knockBack = 5.5f; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.mana = 30; diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index 8cb2b562d2..7211108bdf 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/AnahitasArpeggio.cs b/Items/Weapons/Magic/AnahitasArpeggio.cs index 23a16ea650..49ef7576af 100644 --- a/Items/Weapons/Magic/AnahitasArpeggio.cs +++ b/Items/Weapons/Magic/AnahitasArpeggio.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; +using System.Linq; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; public float RotationOffset; - public static int MusicNoteAmt = 0; public static readonly SoundStyle CapSound = new("CalamityMod/Sounds/Item/HarpLV6"); public static readonly SoundStyle EndSound = new("CalamityMod/Sounds/Item/HarpEnd"); @@ -48,7 +47,16 @@ namespace CalamityMod.Items.Weapons.Magic { // Max music note check is in Shoot instead of CanUseItem so that the weapon can still be visually played while at the cap int musicNoteCap = Main.zenithWorld ? 7 : 6; - if (MusicNoteAmt >= musicNoteCap) + + int nonReleasedMusicNotes = 0; + foreach (var proj in Main.ActiveProjectiles) + { + if (proj.type != Item.shoot || proj.owner != player.whoAmI || proj.ai[1] == 2f) + continue; + nonReleasedMusicNotes++; + } + + if (nonReleasedMusicNotes >= musicNoteCap) { Main.musicPitch = -0.5f; SoundEngine.PlaySound(CapSound with { Volume = 0.8f }, player.Center); @@ -56,12 +64,11 @@ namespace CalamityMod.Items.Weapons.Magic } else { - if (MusicNoteAmt <= 0) + if (nonReleasedMusicNotes <= 0) RotationOffset = Main.rand.NextFloat(0f, MathHelper.TwoPi); - int note = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f, RotationOffset); - Main.projectile[note].localAI[1] = MusicNoteAmt; - MusicNoteAmt++; + Projectile note = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, ai2: nonReleasedMusicNotes); + note.ModProjectile()._randomReleaseRotationOffset = RotationOffset; return false; } } @@ -77,7 +84,8 @@ namespace CalamityMod.Items.Weapons.Magic // Consume much less mana while the maximum number of notes are present public override void ModifyManaCost(Player player, ref float reduce, ref float mult) { - if (MusicNoteAmt >= 6) + int nonReleasedMusicNotes = Main.projectile.Count(proj => proj.type == Item.shoot && Main.myPlayer == proj.owner && proj.active && proj.ai[1] != 2f); + if (nonReleasedMusicNotes >= 6) mult *= 0.25f; } diff --git a/Items/Weapons/Magic/Apathanull.cs b/Items/Weapons/Magic/Apathanull.cs index 15fd4f2860..da4a586ebb 100644 --- a/Items/Weapons/Magic/Apathanull.cs +++ b/Items/Weapons/Magic/Apathanull.cs @@ -13,11 +13,12 @@ namespace CalamityMod.Items.Weapons.Magic public class Apathanull : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetDefaults() { Item.width = 28; Item.height = 30; - Item.damage = 51; + Item.damage = 54; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.useTime = 8; @@ -34,12 +35,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 12f; } + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 12; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile proj = Projectile.NewProjectileDirect(source, position, velocity.RotatedByRandom(0.7f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectileDirect(source, position, velocity.RotatedByRandom(0.7f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index c376b5e698..b641a22307 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.width = 98; - Item.height = 34; + Item.width = 130; + Item.height = 58; Item.damage = 99; Item.DamageType = DamageClass.Magic; Item.mana = 12; diff --git a/Items/Weapons/Magic/ApoctosisArray.png b/Items/Weapons/Magic/ApoctosisArray.png index 9d31bbf2f3..1b09d9d45f 100644 Binary files a/Items/Weapons/Magic/ApoctosisArray.png and b/Items/Weapons/Magic/ApoctosisArray.png differ diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index 183b7f53cb..997c64fb18 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 30; Item.height = 34; - Item.damage = 230; + Item.damage = 222; Item.DamageType = DamageClass.Magic; Item.mana = 42; - Item.useTime = Item.useAnimation = 167; + Item.useAnimation = Item.useTime = 167; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; Item.noMelee = true; @@ -49,9 +49,9 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(2). AddIngredient(2). - AddIngredient(11). - AddIngredient(33). AddIngredient(5). + AddIngredient(33). + AddIngredient(11). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index 1359f1b9fd..a5eab40668 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -14,13 +14,13 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { - Item.width = 38; - Item.height = 38; + Item.width = 82; + Item.height = 84; Item.damage = 17; Item.DamageType = DamageClass.Magic; Item.mana = 3; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item43; + Item.UseSound = SoundID.DD2_SkyDragonsFuryShot; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -39,13 +39,12 @@ 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) { - for (int index = 0; index < 2; ++index) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-30, 31) * 0.05f; - int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 180; - } + int parent = Projectile.NewProjectile(source, position + velocity*2, velocity, type, damage, knockback, player.whoAmI); + int child = Projectile.NewProjectile(source, position + velocity*2, velocity, type, damage, knockback, player.whoAmI, 1, 0, parent); + Main.projectile[child].penetrate = -1; + Main.projectile[child].tileCollide = false; + Main.projectile[child].scale = 0.75f; + return false; } diff --git a/Items/Weapons/Magic/AquamarineStaff.png b/Items/Weapons/Magic/AquamarineStaff.png index e21c19d43e..02c75595f5 100644 Binary files a/Items/Weapons/Magic/AquamarineStaff.png and b/Items/Weapons/Magic/AquamarineStaff.png differ diff --git a/Items/Weapons/Magic/ArchAmaryllis.cs b/Items/Weapons/Magic/ArchAmaryllis.cs index bbb0031196..33419882b8 100644 --- a/Items/Weapons/Magic/ArchAmaryllis.cs +++ b/Items/Weapons/Magic/ArchAmaryllis.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/ArtAttack.cs b/Items/Weapons/Magic/ArtAttack.cs index 45d5c5bd1f..b16f045350 100644 --- a/Items/Weapons/Magic/ArtAttack.cs +++ b/Items/Weapons/Magic/ArtAttack.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 80; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Magic/AsteroidStaff.cs b/Items/Weapons/Magic/AsteroidStaff.cs index f15b6fc41f..78a029f901 100644 --- a/Items/Weapons/Magic/AsteroidStaff.cs +++ b/Items/Weapons/Magic/AsteroidStaff.cs @@ -1,8 +1,12 @@ using System; +using System.Collections.Generic; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,16 +15,97 @@ namespace CalamityMod.Items.Weapons.Magic public class AsteroidStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + #region GFB Projectile Array + public static int[] CorekeeperChaos = + { + ProjectileID.BallofFire, + ProjectileID.BallofFrost, + ProjectileID.MagicMissile, + ProjectileID.WaterStream, + ProjectileID.Flamelash, + ProjectileID.RainbowRodBullet, + ProjectileID.UnholyTridentFriendly, + ProjectileID.AmethystBolt, + ProjectileID.AmberBolt, + ProjectileID.TopazBolt, + ProjectileID.DiamondBolt, + ProjectileID.SapphireBolt, + ProjectileID.RubyBolt, + ProjectileID.EmeraldBolt, + ProjectileID.RainCloudMoving, + ProjectileID.BloodCloudMoving, + ProjectileID.ShadowBeamFriendly, + ProjectileID.InfernoFriendlyBlast, + ProjectileID.LostSoulFriendly, + ProjectileID.Bat, + + 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(), + 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(), + }; + #endregion public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { Item.width = 50; Item.height = 50; - Item.damage = 145; + Item.damage = 146; Item.DamageType = DamageClass.Magic; Item.mana = 18; Item.useTime = 10; @@ -39,53 +124,71 @@ 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 meteorSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float meteorSpawnXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float meteorSpawnYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) + if (Main.zenithWorld) { - meteorSpawnYPos = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float meteorSpawnDist = (float)Math.Sqrt((double)(meteorSpawnXPos * meteorSpawnXPos + meteorSpawnYPos * meteorSpawnYPos)); - if ((float.IsNaN(meteorSpawnXPos) && float.IsNaN(meteorSpawnYPos)) || (meteorSpawnXPos == 0f && meteorSpawnYPos == 0f)) - { - meteorSpawnXPos = (float)player.direction; - meteorSpawnYPos = 0f; - meteorSpawnDist = meteorSpeed; + for (int i = 0; i < 4; i++) + { + int projType; + projType = CorekeeperChaos[Main.rand.Next(CorekeeperChaos.Length)]; + 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, projType, damage, knockback, player.whoAmI); + + } } else { - meteorSpawnDist = meteorSpeed / meteorSpawnDist; - } + float meteorSpeed = Item.shootSpeed; + Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float meteorSpawnXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; + float meteorSpawnYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; + if (player.gravDir == -1f) + { + meteorSpawnYPos = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; + } + float meteorSpawnDist = (float)Math.Sqrt((double)(meteorSpawnXPos * meteorSpawnXPos + meteorSpawnYPos * meteorSpawnYPos)); + if ((float.IsNaN(meteorSpawnXPos) && float.IsNaN(meteorSpawnYPos)) || (meteorSpawnXPos == 0f && meteorSpawnYPos == 0f)) + for (int i = 0; i < 4; i++) + { + meteorSpawnXPos = (float)player.direction; + meteorSpawnYPos = 0f; + meteorSpawnDist = meteorSpeed; + } + else + { + meteorSpawnDist = meteorSpeed / meteorSpawnDist; + } - int asteroidAmt = 3; - for (int i = 0; i < asteroidAmt; i++) - { - 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 * i); - meteorSpawnXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X + (float)Main.rand.Next(-40, 41) * 0.03f; - meteorSpawnYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (meteorSpawnYPos < 0f) + int asteroidAmt = 3; + for (int i = 0; i < asteroidAmt; i++) { - meteorSpawnYPos *= -1f; + 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 * i); + meteorSpawnXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X + (float)Main.rand.Next(-40, 41) * 0.03f; + meteorSpawnYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; + if (meteorSpawnYPos < 0f) + { + meteorSpawnYPos *= -1f; + } + if (meteorSpawnYPos < 20f) + { + meteorSpawnYPos = 20f; + } + meteorSpawnDist = (float)Math.Sqrt((double)(meteorSpawnXPos * meteorSpawnXPos + meteorSpawnYPos * meteorSpawnYPos)); + meteorSpawnDist = meteorSpeed / meteorSpawnDist; + meteorSpawnXPos *= meteorSpawnDist; + meteorSpawnYPos *= meteorSpawnDist; + float meteorSpawnXOffset = meteorSpawnXPos; + float meteorSpawnYOffset = meteorSpawnYPos + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, meteorSpawnXOffset * 0.75f, meteorSpawnYOffset * 0.75f, type, damage, knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); } - if (meteorSpawnYPos < 20f) - { - meteorSpawnYPos = 20f; - } - meteorSpawnDist = (float)Math.Sqrt((double)(meteorSpawnXPos * meteorSpawnXPos + meteorSpawnYPos * meteorSpawnYPos)); - meteorSpawnDist = meteorSpeed / meteorSpawnDist; - meteorSpawnXPos *= meteorSpawnDist; - meteorSpawnYPos *= meteorSpawnDist; - float meteorSpawnXOffset = meteorSpawnXPos; - float meteorSpawnYOffset = meteorSpawnYPos + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, meteorSpawnXOffset * 0.75f, meteorSpawnYOffset * 0.75f, type, damage, knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); } return false; } + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/AstralStaff.cs b/Items/Weapons/Magic/AstralStaff.cs index 6c2ca3d064..03a48809e3 100644 --- a/Items/Weapons/Magic/AstralStaff.cs +++ b/Items/Weapons/Magic/AstralStaff.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -42,6 +42,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) { Vector2 spawnPos = new Vector2(player.MountedCenter.X + Main.rand.Next(-200, 201), player.MountedCenter.Y - 600f); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 targetPos = Main.MouseWorld + new Vector2(Main.rand.Next(-30, 31), Main.rand.Next(-30, 31)); Vector2 velocityReal = targetPos - spawnPos; velocityReal.Normalize(); diff --git a/Items/Weapons/Magic/AstralachneaStaff.cs b/Items/Weapons/Magic/AstralachneaStaff.cs index 7317265a11..8ffa9448aa 100644 --- a/Items/Weapons/Magic/AstralachneaStaff.cs +++ b/Items/Weapons/Magic/AstralachneaStaff.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index 8a0f0fd26a..ffa9afe85a 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -2,6 +2,8 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using CalamityMod.Particles; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -30,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.UseSound = SoundID.Item34; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/VividClarityBeamAppear") with { Volume = 0.5f, Pitch = 0.2f }; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 40f; @@ -46,6 +48,32 @@ namespace CalamityMod.Items.Weapons.Magic } } public override float UseSpeedMultiplier(Player player) => (DownedBossSystem.downedDoG && Main.zenithWorld) ? 2.5f : 1f; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + int points = 6; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(velocity); + for (int k = 0; k < points; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Particle spark = new GlowSparkParticle((position + velocity2 * 7.5f) + velocity * 2.5f, velocity2 * 0.5f, false, 11, 0.01f, Color.LightBlue * 0.9f, new Vector2(3.5f, 1), true, false); + GeneralParticleHandler.SpawnParticle(spark); + for (int b = 0; b < 3; b++) + { + Dust dust = Dust.NewDustPerfect(position + velocity * 2.5f, 278, (velocity2 * 10).RotatedByRandom(0.5) * Main.rand.NextFloat(0.5f, 0.9f)); + dust.scale = Main.rand.NextFloat(0.3f, 0.5f); + dust.color = Main.rand.NextBool() ? Color.Cyan : Color.LightBlue; + dust.noGravity = true; + } + } + Particle blastRing = new CustomPulse(position + velocity * 2.5f, Vector2.Zero, Color.CornflowerBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.25f, 0f, 11, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(position + velocity * 2.5f, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.6f, 0.1f, 14, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + + Projectile.NewProjectile(source, position + velocity * 2, velocity, type, damage, knockback, player.whoAmI, 0f, 0f, 5f); + return false; + } public override void ModifyTooltips(List list) { diff --git a/Items/Weapons/Magic/AuguroftheVoid.cs b/Items/Weapons/Magic/AuguroftheVoid.cs index d8d00fdbc0..d2ef2738fe 100644 --- a/Items/Weapons/Magic/AuguroftheVoid.cs +++ b/Items/Weapons/Magic/AuguroftheVoid.cs @@ -36,27 +36,15 @@ 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) { - 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; - Vector2 tentacleVelocity = new Vector2(mouseXDist, mouseYDist); - tentacleVelocity.Normalize(); - Vector2 tentacleRandVelocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - tentacleRandVelocity.Normalize(); - tentacleVelocity = tentacleVelocity * 6f + tentacleRandVelocity; - tentacleVelocity.Normalize(); - tentacleVelocity *= Item.shootSpeed; - float tentacleYDirection = (float)Main.rand.Next(10, 50) * 0.001f; + Vector2 spreadVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(18f)) * Main.rand.NextFloat(0.8f, 1.2f); + float tentacleYDirection = Main.rand.NextFloat(0.01f, 0.05f); if (Main.rand.NextBool()) - { tentacleYDirection *= -1f; - } - float tentacleXDirection = (float)Main.rand.Next(10, 50) * 0.001f; + float tentacleXDirection = Main.rand.NextFloat(0.01f, 0.05f); if (Main.rand.NextBool()) - { tentacleXDirection *= -1f; - } - Projectile.NewProjectile(source, realPlayerPos, tentacleVelocity, type, damage, knockback, player.whoAmI, tentacleXDirection, tentacleYDirection); + + Projectile.NewProjectile(source, position, spreadVelocity, type, damage, knockback, Main.myPlayer, tentacleXDirection, tentacleYDirection); return false; } @@ -67,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentNebula, 5). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index dd72089081..5bdcb4e06f 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index 1982fc6d2e..3baf578096 100644 --- a/Items/Weapons/Magic/BrimroseStaff.cs +++ b/Items/Weapons/Magic/BrimroseStaff.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index d08ab647d1..91257ae1d1 100644 --- a/Items/Weapons/Magic/BurningSea.cs +++ b/Items/Weapons/Magic/BurningSea.cs @@ -9,26 +9,37 @@ namespace CalamityMod.Items.Weapons.Magic public class BurningSea : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public const float ChargeTime = 240f; + public const float BurnOutTime = 560f; + public const int BurnOutReuseDelay = 150; + public const float FizzleOutTime = 40f; + public override void SetDefaults() { Item.width = 28; Item.height = 30; - Item.damage = 68; + Item.damage = 69; Item.DamageType = DamageClass.Magic; - Item.mana = 15; + Item.mana = 8; Item.useTime = 20; Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; - Item.knockBack = 6.5f; + Item.channel = true; + Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item20; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; } + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.Calamity().burningSeaBurnOut <= 0; + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/ChronomancersScythe.cs b/Items/Weapons/Magic/ChronomancersScythe.cs index a872675c83..2902fe0d98 100644 --- a/Items/Weapons/Magic/ChronomancersScythe.cs +++ b/Items/Weapons/Magic/ChronomancersScythe.cs @@ -13,7 +13,7 @@ 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[Type] = true; } public override void SetDefaults() @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.IceSickle). AddIngredient(ItemID.FastClock). AddIngredient(ItemID.LunarBar, 10). - AddIngredient(6). + AddIngredient(6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/ClamorNoctus.cs b/Items/Weapons/Magic/ClamorNoctus.cs index 73f5b92166..a54e500163 100644 --- a/Items/Weapons/Magic/ClamorNoctus.cs +++ b/Items/Weapons/Magic/ClamorNoctus.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index 7c9c432dc1..dab7555774 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -1,6 +1,7 @@ -using System; -using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,88 +16,34 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 26; Item.height = 64; - Item.damage = 105; + Item.damage = 117; Item.DamageType = DamageClass.Magic; - Item.mana = 30; - Item.useTime = 35; - Item.useAnimation = 35; + Item.mana = 10; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; + + Item.UseSound = SoundID.Item67 with { Volume = 0.7f }; Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; Item.noMelee = true; - Item.knockBack = 0f; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; - Item.UseSound = SoundID.Item67; - Item.autoReuse = true; - Item.shoot = ProjectileID.RainbowFront; - Item.shootSpeed = 18f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - float tenthPi = 0.314159274f; - int directRainbowAmt = 3; - Vector2 directRainbowVel = velocity; - directRainbowVel.Normalize(); - directRainbowVel *= 60f; - bool rainbowHitsTiles = Collision.CanHit(vector, 0, 0, vector + directRainbowVel, 0, 0); - for (int i = 0; i < directRainbowAmt; i++) - { - float rainbowOffset = (float)i - ((float)directRainbowAmt - 1f) / 2f; - Vector2 offsetSpawnPos = directRainbowVel.RotatedBy((double)(tenthPi * rainbowOffset), default); - if (!rainbowHitsTiles) - { - offsetSpawnPos -= directRainbowVel; - } - int rainbow = Projectile.NewProjectile(source, vector.X + offsetSpawnPos.X, vector.Y + offsetSpawnPos.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); - Main.projectile[rainbow].usesLocalNPCImmunity = true; - Main.projectile[rainbow].localNPCHitCooldown = 10; - } - float skyRainbowSpeed = 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 = skyRainbowSpeed; - } - else - { - mouseDistance = skyRainbowSpeed / mouseDistance; - } + Vector2 rainbowPos = player.Center + (Vector2.Normalize(velocity) * Main.rand.NextFloat(-36f, 36f)).RotatedBy(MathHelper.PiOver2); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 rainbowVel = Vector2.Normalize(Main.MouseWorld - rainbowPos) * Item.shootSpeed; + Projectile.NewProjectile(source, rainbowPos, rainbowVel, type, damage, knockback, Main.myPlayer); - for (int j = 0; j < 2; j++) - { - 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) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = skyRainbowSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist + (float)Main.rand.Next(-15, 16) * 0.01f; - float speedY5 = mouseYDist + (float)Main.rand.Next(-15, 16) * 0.01f; - int rainbow2 = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); - Main.projectile[rainbow2].usesLocalNPCImmunity = true; - Main.projectile[rainbow2].localNPCHitCooldown = 10; - } + double rotationOffset = Math.Sin((Main.GameUpdateCount / 60f) * (MathHelper.Pi / 1.5f)) * 0.4f; + Projectile star = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(rotationOffset), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, Main.rand.Next(12), 1f); + star.DamageType = DamageClass.Magic; + star.scale = 0.7f; return false; } @@ -104,8 +51,9 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.RainbowGun). - AddIngredient(ItemID.PearlwoodBow). - AddIngredient(5). + AddIngredient(ItemID.LunarBar, 5). + AddIngredient(ItemID.CrystalShard, 10). + AddIngredient(ItemID.SoulofLight, 10). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index f9013dad83..bfb28a081d 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; -using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -25,29 +24,23 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.useTime = 10; - Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item13; + Item.channel = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.channel = true; - Item.knockBack = 0f; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 30f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0.0f, 0.0f); - return false; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index 3092602c28..f78e124280 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -42,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SpellTome). - AddIngredient(ItemID.AncientCloth, 2). AddIngredient(ItemID.FossilOre, 25). + AddIngredient(ItemID.AncientCloth, 2). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index cbe31237bb..36dd27dd3b 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs index a345625500..91f0211d95 100644 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ b/Items/Weapons/Magic/DivineRetribution.cs @@ -1,5 +1,4 @@ -using System; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -15,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -37,54 +36,21 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item73; Item.autoReuse = true; - Item.shootSpeed = 19f; + Item.shootSpeed = 25f; 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; - 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) + // 5 projectiles total + Vector2 mouse = player.ClampedMouseWorld(); + for (int i = -2; i < 3; i++) { - 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 = spearSpeed / mouseDistance; - } - int numProjectiles = 5; - for (int i = 0; i < numProjectiles; i++) - { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); //200 - 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 = spearSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX6 = mouseXDist + (float)Main.rand.Next(-60, 61) * 0.02f; - float speedY7 = mouseYDist + (float)Main.rand.Next(-60, 61) * 0.02f; - float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX6, -speedY7, type, damage, knockback, player.whoAmI, 0.0f, ai1); + Vector2 newPos = new Vector2(mouse.X + Main.rand.NextFloat(8f, 64f) * i, player.MountedCenter.Y + Main.rand.NextFloat(640f, 800f)); + Vector2 newVel = (mouse + Main.rand.NextVector2CircularEdge(4f, 4f) - newPos).SafeNormalize(Vector2.Zero) * velocity.Length() * Main.rand.NextFloat(1f, 1.25f); + float velScale = 1f + Main.rand.NextFloat(0.02f, 0.08f) * i; + Projectile.NewProjectile(source, newPos, newVel, type, damage, knockback, player.whoAmI, velScale); } return false; } @@ -94,7 +60,6 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(). AddIngredient(8). - AddIngredient(6). AddIngredient(10). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Magic/Downpour.cs b/Items/Weapons/Magic/Downpour.cs index 5e340743dc..0bede5d021 100644 --- a/Items/Weapons/Magic/Downpour.cs +++ b/Items/Weapons/Magic/Downpour.cs @@ -1,7 +1,5 @@ using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -34,12 +32,5 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; } - - - 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, 0.0f, 0.0f); - return false; - } } } diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 190e2321a1..971a031c93 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = velocity.X + Main.rand.Next(-25, 26) * 0.05f; float SpeedY = velocity.Y + Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.BubbleGun). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(15). + AddIngredient(ItemID.ShimmerBlock, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index 11291e2f1f..411bae5c95 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 60; Item.height = 60; - Item.damage = 1248; + Item.damage = 943; Item.DamageType = DamageClass.Magic; Item.mana = 30; - Item.useTime = 12; - Item.useAnimation = 36; - Item.reuseDelay = 30; + Item.useTime = 10; + Item.useAnimation = 30; + Item.reuseDelay = 40; Item.useLimitPerAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.UseSound = CommonCalamitySounds.WyrmScreamSound; Item.autoReuse = true; - Item.shootSpeed = 14.5f; + Item.shootSpeed = 14f; Item.shoot = ModContent.ProjectileType(); Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/EidolonStaff.cs b/Items/Weapons/Magic/EidolonStaff.cs index 45fa1b6e53..f3c14ab5b0 100644 --- a/Items/Weapons/Magic/EidolonStaff.cs +++ b/Items/Weapons/Magic/EidolonStaff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/EldritchTome.cs b/Items/Weapons/Magic/EldritchTome.cs index 912d223f4b..3021f53ee0 100644 --- a/Items/Weapons/Magic/EldritchTome.cs +++ b/Items/Weapons/Magic/EldritchTome.cs @@ -35,31 +35,15 @@ 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 i = Main.myPlayer; - float playerKnockback = 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; - Vector2 tentacleVelocity = new Vector2(mouseXDist, mouseYDist); - tentacleVelocity.Normalize(); - Vector2 tentacleRandVelocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - tentacleRandVelocity.Normalize(); - tentacleVelocity = tentacleVelocity * 4f + tentacleRandVelocity; - tentacleVelocity.Normalize(); - tentacleVelocity *= Item.shootSpeed; - float tentacleYDirection = (float)Main.rand.Next(10, 80) * 0.001f; + Vector2 spreadVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(18f)) * Main.rand.NextFloat(0.8f, 1.2f); + float tentacleYDirection = Main.rand.NextFloat(0.01f, 0.05f); if (Main.rand.NextBool()) - { tentacleYDirection *= -1f; - } - float tentacleXDirection = (float)Main.rand.Next(10, 80) * 0.001f; + float tentacleXDirection = Main.rand.NextFloat(0.01f, 0.05f); if (Main.rand.NextBool()) - { tentacleXDirection *= -1f; - } - Projectile.NewProjectile(source, realPlayerPos, tentacleVelocity, ModContent.ProjectileType(), damage, playerKnockback, i, tentacleXDirection, tentacleYDirection); + + Projectile.NewProjectile(source, position, spreadVelocity, type, damage, knockback, Main.myPlayer, tentacleXDirection, tentacleYDirection); return false; } } diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 0c119bc4cd..39d89390ce 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -28,20 +28,20 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = BaseDamage; Item.DamageType = DamageClass.Magic; Item.mana = 30; - Item.useTime = Item.useAnimation = 120; + Item.useAnimation = Item.useTime = 120; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.channel = true; Item.noMelee = true; - Item.knockBack = 0f; + Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; - - Item.autoReuse = true; - Item.noUseGraphic = true; - Item.shoot = ModContent.ProjectileType(); - Item.channel = true; - Item.shootSpeed = 0f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void ModifyTooltips(List list) @@ -54,9 +54,9 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(). + AddIngredient(5). AddIngredient(20). AddIngredient(ItemID.UnicornHorn, 5). - AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index bb80dcc498..70401af4c4 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -16,18 +16,18 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 40; Item.height = 46; - Item.damage = 200; + Item.damage = 70; Item.knockBack = 3.5f; Item.noMelee = true; Item.DamageType = DamageClass.Magic; Item.mana = 12; - Item.useTime = Item.useAnimation = 32; + Item.useAnimation = Item.useTime = 32; Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item84; Item.shoot = ModContent.ProjectileType(); @@ -50,8 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(8). - AddIngredient(8). + AddIngredient(3). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index 72117d510f..0875c6bebd 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -14,18 +14,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { Item.width = 84; Item.height = 84; - Item.damage = 125; + Item.damage = 135; Item.DamageType = DamageClass.Magic; - Item.mana = 50; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 40; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -45,8 +44,8 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.RainbowRod). - AddIngredient(10). AddIngredient(5). + AddIngredient(10). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 951693e686..1148903310 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } else diff --git a/Items/Weapons/Magic/FatesReveal.cs b/Items/Weapons/Magic/FatesReveal.cs index bb490b7a17..26f28c4056 100644 --- a/Items/Weapons/Magic/FatesReveal.cs +++ b/Items/Weapons/Magic/FatesReveal.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 481eb7aab1..3168b9b7ef 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,28 +14,53 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 34; Item.height = 38; - Item.damage = 36; + Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.useTime = 30; - Item.useAnimation = 30; + Item.mana = 22; + Item.useTime = 80; + Item.useAnimation = 80; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 5.5f; + Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 7.5f; + Item.shootSpeed = 6.5f; } + 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() * 4f; + Vector2 itemSize = new Vector2(34, 38); + 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; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.HellstoneBar, 6). AddIngredient(ItemID.Obsidian, 9). AddIngredient(ItemID.Fireblossom, 2). + AddIngredient(ItemID.Ruby). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index e1df32d506..5320497da6 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -1,6 +1,11 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; 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.ModLoader; @@ -10,35 +15,88 @@ namespace CalamityMod.Items.Weapons.Magic { public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/FrigidflashUse"); public static readonly SoundStyle ProjDeathSound = new("CalamityMod/Sounds/Item/FrigidflashDeath"); + public static readonly SoundStyle ChargeSound = new("CalamityMod/Sounds/Item/FrigidflashCharge"); public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } public override void SetDefaults() { Item.width = 38; Item.height = 42; - Item.damage = 80; + Item.damage = 72; Item.DamageType = DamageClass.Magic; Item.mana = 13; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 5.5f; + Item.knockBack = 6f; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.UseSound = UseSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } + public override bool AltFunctionUse(Player player) => true; + public override float UseSpeedMultiplier(Player player) + { + if (player.altFunctionUse == 2) + return 0.25f; + + return 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) // Right Click + { + Projectile bigMagic = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 5); + bigMagic.extraUpdates = 4; + bigMagic.timeLeft = 370; + bigMagic.penetrate = -1; + } + else // Left Click + { + Projectile smallMagic = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback / 2, player.whoAmI); + } + 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() * 4f; + Vector2 itemSize = new Vector2(38, 42); + 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; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void AddRecipes() { CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(2). - AddIngredient(2). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index 489a233792..4b90f09c01 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -1,4 +1,7 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,28 +15,53 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 34; Item.height = 38; - Item.damage = 14; + Item.damage = 25; Item.DamageType = DamageClass.Magic; - Item.mana = 6; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 8; + Item.useTime = 30; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item8; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; + Item.shootSpeed = 8f; } + 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() * 4f; + Vector2 itemSize = new Vector2(34, 38); + 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; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void AddRecipes() { CreateRecipe(). AddRecipeGroup("AnyIceBlock", 20). AddRecipeGroup("AnySnowBlock", 10). AddIngredient(ItemID.Shiverthorn, 2). + AddIngredient(ItemID.Sapphire). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/Genesis.cs b/Items/Weapons/Magic/Genesis.cs index 44c82b67ff..20af5325b0 100644 --- a/Items/Weapons/Magic/Genesis.cs +++ b/Items/Weapons/Magic/Genesis.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.useTime = 4; - Item.useAnimation = 4; + + Item.useAnimation = Item.useTime = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -45,7 +45,8 @@ 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) { - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } diff --git a/Items/Weapons/Magic/GleamingMagnolia.cs b/Items/Weapons/Magic/GleamingMagnolia.cs index 6ca12ba596..8cc2defd86 100644 --- a/Items/Weapons/Magic/GleamingMagnolia.cs +++ b/Items/Weapons/Magic/GleamingMagnolia.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index 59db80cd1d..61de44955a 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 58; Item.damage = 120; Item.knockBack = 10f; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.mana = 20; Item.DamageType = DamageClass.Magic; Item.channel = true; diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index 684c53dd65..e4a64b95a0 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class GruesomeEminence : ModItem, ILocalizedModType + public class GruesomeEminence : ExhumedItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() diff --git a/Items/Weapons/Magic/HadalUrn.cs b/Items/Weapons/Magic/HadalUrn.cs index 99191e7e68..1a30b38322 100644 --- a/Items/Weapons/Magic/HadalUrn.cs +++ b/Items/Weapons/Magic/HadalUrn.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.FurnitureVoid; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -42,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) { SoundEngine.PlaySound(SoundID.Item103 with { Volume = SoundID.Item103.Volume }, player.Center); - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 12); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 12); return false; } public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(20). - AddIngredient(5). + AddIngredient(20). AddIngredient(15). AddIngredient(ItemID.Bone, 10). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index bd5307fc53..4344a34749 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -1,10 +1,10 @@ -using System; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; 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; @@ -14,96 +14,58 @@ namespace CalamityMod.Items.Weapons.Magic public class HeliumFlash : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - internal const float ExplosionDamageMultiplier = 0.125f; + internal const float ExplosionDamageMultiplier = 1.4f; + public static readonly SoundStyle Charge = new("CalamityMod/Sounds/Item/HeliumFlashCharge"); + public static readonly SoundStyle ChargeLoop = new("CalamityMod/Sounds/Item/HeliumFlashFullChargeLoop"); + internal static readonly int ChargeLoopSoundFrames = 120; + public static readonly SoundStyle ChargeFire = new("CalamityMod/Sounds/Item/HeliumFlashFire") { Volume = 1f }; - public override void SetStaticDefaults() - { - Item.staff[Item.type] = true; - } + public static int AftershotCooldownFrames = 17; + public static int FullChargeFrames = 88; public override void SetDefaults() { Item.width = 112; Item.height = 112; Item.DamageType = DamageClass.Magic; - Item.damage = 1800; + Item.damage = 5000; Item.knockBack = 9.5f; - Item.mana = 40; - Item.useAnimation = 40; - Item.useTime = 40; + Item.mana = 80; + Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.autoReuse = true; Item.noMelee = true; - + Item.channel = true; + Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = SoundID.Item73; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; } - // Creates dust at the tip of the staff when used. + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + 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) { - Vector2 dir = velocity; - double angle = Math.Atan2(velocity.Y, velocity.X) + MathHelper.PiOver4; - dir = dir.SafeNormalize(Vector2.Zero); - dir *= 80f * (float)Math.Sqrt(2); // distance to gleaming point on staff - Vector2 dustPos = position + dir; - - int dustType = 162; - int dustCount = 72; - float minSpeed = 4f; - float maxSpeed = 11f; - float minScale = 0.8f; - float maxScale = 1.4f; - Vector2 leftVec = new Vector2(-1f, 0f).RotatedBy(angle); - Vector2 rightVec = new Vector2(1f, 0f).RotatedBy(angle); - Vector2 upVec = new Vector2(0f, -1f).RotatedBy(angle); - Vector2 downVec = new Vector2(0f, 1f).RotatedBy(angle); - for (int i = 0; i < dustCount; i += 4) - { - int left = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f); - Main.dust[left].position = dustPos; - Main.dust[left].velocity = leftVec * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale); - Main.dust[left].noGravity = true; - - int right = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f); - Main.dust[right].position = dustPos; - Main.dust[right].velocity = rightVec * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale); - Main.dust[right].noGravity = true; - - int up = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f); - Main.dust[up].position = dustPos; - Main.dust[up].velocity = upVec * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale); - Main.dust[up].noGravity = true; - - int down = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f); - Main.dust[down].position = dustPos; - Main.dust[down].velocity = downVec * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale); - Main.dust[down].noGravity = true; - } - return true; + Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + return false; } - - public override void AddRecipes() { - Recipe r = CreateRecipe(); - r.AddIngredient(); - r.AddIngredient(); - r.AddIngredient(); - r.AddIngredient(ItemID.FragmentSolar, 20); - r.AddIngredient(ItemID.FragmentNebula, 5); - r.AddIngredient(5); - r.AddTile(); - r.Register(); + CreateRecipe(). + AddIngredient(). + AddIngredient(). + AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 10). + AddIngredient(ItemID.FragmentNebula, 5). + AddTile(). + Register(); } } } diff --git a/Items/Weapons/Magic/HeliumFlash.png b/Items/Weapons/Magic/HeliumFlash.png index 721abc05ae..211a007067 100644 Binary files a/Items/Weapons/Magic/HeliumFlash.png and b/Items/Weapons/Magic/HeliumFlash.png differ diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 14d8c95b40..4e98d6301c 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Magic mouseYDist *= mouseDistance; float speedX4 = mouseXDist + (float)Main.rand.Next(-40, 41) * 0.02f; float speedY5 = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index 18c289a27f..5ccbd20082 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -38,10 +38,10 @@ 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) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); for (int x = 0; x < 10; x++) { - Projectile.NewProjectile(source, position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/Heresy.cs b/Items/Weapons/Magic/Heresy.cs index 77c4af47e3..2349832e9d 100644 --- a/Items/Weapons/Magic/Heresy.cs +++ b/Items/Weapons/Magic/Heresy.cs @@ -23,20 +23,20 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 960; Item.DamageType = DamageClass.Magic; Item.mana = 15; - Item.useTime = Item.useAnimation = 120; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; + Item.useAnimation = Item.useTime = 120; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0f; + Item.UseSound = SoundID.DD2_EtherianPortalDryadTouch; - Item.knockBack = 0f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); - - Item.autoReuse = true; - Item.noUseGraphic = true; - Item.shoot = ModContent.ProjectileType(); - Item.channel = true; - Item.shootSpeed = 0f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index 30bc37b713..dc7b12a637 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 1d71b194b4..90f046f193 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -30,9 +31,9 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.damage = 2250; + Item.damage = 2300; Item.knockBack = 6f; - Item.useTime = Item.useAnimation = 300; + Item.useAnimation = Item.useTime = 300; Item.reuseDelay = 60; Item.useLimitPerAnimation = 1; Item.shoot = ModContent.ProjectileType(); @@ -49,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); realPlayerPos.X = Main.mouseX + Main.screenPosition.X; realPlayerPos.Y = Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(source, realPlayerPos, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, realPlayerPos, Vector2.Zero, type, damage, knockback, player.whoAmI); CalamityGlobalItem.ConsumeAdditionalAmmo(player, Item, 2); @@ -70,8 +71,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(8). AddIngredient(40). - AddIngredient(18). - AddTile(TileID.IceMachine). + AddTile(). Register(); } } diff --git a/Items/Weapons/Magic/IcicleStaff.cs b/Items/Weapons/Magic/IcicleStaff.cs index 6e5c822dab..fd481cb380 100644 --- a/Items/Weapons/Magic/IcicleStaff.cs +++ b/Items/Weapons/Magic/IcicleStaff.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/IcicleTrident.cs b/Items/Weapons/Magic/IcicleTrident.cs index 206d0b3632..36fdb84c17 100644 --- a/Items/Weapons/Magic/IcicleTrident.cs +++ b/Items/Weapons/Magic/IcicleTrident.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index 0fcf0fc8d6..a162271cf9 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -61,12 +61,11 @@ namespace CalamityMod.Items.Weapons.Magic } f = Main.rand.NextFloat() * MathHelper.TwoPi; } - Vector2 mouseWorld = Main.MouseWorld; - Vector2 projSpawnPos = mouseWorld - projSpawnOffset; + Vector2 projSpawnPos = player.ClampedMouseWorld() - projSpawnOffset; Vector2 projVelocity = new Vector2(mouseXDist, mouseYDist).SafeNormalize(Vector2.UnitY) * projSpeed; projSpawnPos = projSpawnPos.SafeNormalize(projVelocity) * projSpeed; projSpawnPos = Vector2.Lerp(projSpawnPos, projVelocity, 0.25f); - Projectile.NewProjectile(source, projSpawnOffset, projSpawnPos, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, projSpawnOffset, projSpawnPos, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/IonBlaster.cs b/Items/Weapons/Magic/IonBlaster.cs index 24dc94d772..68f3fa069c 100644 --- a/Items/Weapons/Magic/IonBlaster.cs +++ b/Items/Weapons/Magic/IonBlaster.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.width = 44; - Item.height = 28; + Item.width = 68; + Item.height = 38; Item.damage = 29; Item.DamageType = DamageClass.Magic; Item.mana = 10; diff --git a/Items/Weapons/Magic/IonBlaster.png b/Items/Weapons/Magic/IonBlaster.png index b6b652cdb3..c7f12c03cb 100644 Binary files a/Items/Weapons/Magic/IonBlaster.png and b/Items/Weapons/Magic/IonBlaster.png differ diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index a0ef23a3cb..d43e562b13 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 111; Item.DamageType = DamageClass.Magic; Item.mana = 6; - Item.useTime = Item.useAnimation = 4; + Item.useAnimation = Item.useTime = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; @@ -49,10 +49,10 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(). AddIngredient(ItemID.HolyWater, 10). - AddIngredient(ItemID.SoulofLight, 30). - AddIngredient(5). AddIngredient(8). AddIngredient(20). + AddIngredient(5). + AddIngredient(ItemID.SoulofLight, 30). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs index 6715bf4deb..c43b45a6c8 100644 --- a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs +++ b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; flaskIDs = new int[] { ModContent.ProjectileType(), diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index 8ec34d604c..0e5266cef6 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -55,7 +55,6 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpectreStaff). AddIngredient(ItemID.MagnetSphere). AddIngredient(3). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Magic/ManaRose.cs b/Items/Weapons/Magic/ManaRose.cs index 898c4af8d1..be441ecf19 100644 --- a/Items/Weapons/Magic/ManaRose.cs +++ b/Items/Weapons/Magic/ManaRose.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 5a24f1a067..e2d1fb0d40 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 40; Item.DamageType = DamageClass.Magic; Item.mana = 16; - Item.useTime = Item.useAnimation = 27; + Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index e2fa749681..17811fcf7d 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -60,8 +60,8 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.Razorpine). AddIngredient(ItemID.LeafBlower). - AddIngredient(7). - AddIngredient(). + AddIngredient(5). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/Mistlestorm.png b/Items/Weapons/Magic/Mistlestorm.png index 9ff288dea4..90bdccaaab 100644 Binary files a/Items/Weapons/Magic/Mistlestorm.png and b/Items/Weapons/Magic/Mistlestorm.png differ diff --git a/Items/Weapons/Magic/NanoPurge.cs b/Items/Weapons/Magic/NanoPurge.cs index a0522394b9..c5cd65b095 100644 --- a/Items/Weapons/Magic/NanoPurge.cs +++ b/Items/Weapons/Magic/NanoPurge.cs @@ -4,6 +4,8 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; namespace CalamityMod.Items.Weapons.Magic { @@ -18,17 +20,17 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 62; Item.height = 34; - Item.damage = 60; + Item.damage = 135; Item.DamageType = DamageClass.Magic; Item.mana = 8; - Item.useTime = Item.useAnimation = UseTime; + Item.useAnimation = Item.useTime = UseTime; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; Item.knockBack = 3f; - Item.rare = ItemRarityID.Red; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; @@ -41,7 +43,8 @@ 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) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); - Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } @@ -49,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.LaserMachinegun). - AddIngredient(ItemID.FragmentVortex, 6). + AddIngredient(7). AddIngredient(ItemID.Nanites, 100). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Magic/NebulousCataclysm.cs b/Items/Weapons/Magic/NebulousCataclysm.cs index 7a113fceae..ad891db07e 100644 --- a/Items/Weapons/Magic/NebulousCataclysm.cs +++ b/Items/Weapons/Magic/NebulousCataclysm.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.NebulaArcanum). AddIngredient(ItemID.NebulaBlaze). AddIngredient(8). + AddIngredient(20). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index 3b767eaa97..27f2e1b514 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -44,6 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.AmberStaff). AddIngredient(10). AddTile(TileID.DemonAltar). + AddCondition(Condition.NotRemixWorld). Register(); CreateRecipe(). AddIngredient(ItemID.CrimsonRod). @@ -52,7 +53,29 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.AmberStaff). AddIngredient(10). AddTile(TileID.DemonAltar). + AddCondition(Condition.NotRemixWorld). Register(); + + // CIT 16NOV2024: Due to Wand of Sparking (and Frosting) being swapped with Magic Dagger in Remix, Night's Ray uses Magic Dagger in its recipe there. + CreateRecipe(). + AddIngredient(ItemID.Vilethorn). + AddIngredient(ItemID.MagicMissile). + AddIngredient(ItemID.MagicDagger). + AddIngredient(ItemID.AmberStaff). + AddIngredient(10). + AddTile(TileID.DemonAltar). + AddCondition(Condition.RemixWorld). + Register(); + CreateRecipe(). + AddIngredient(ItemID.CrimsonRod). + AddIngredient(ItemID.MagicMissile). + AddIngredient(ItemID.MagicDagger). + AddIngredient(ItemID.AmberStaff). + AddIngredient(10). + AddTile(TileID.DemonAltar). + AddCondition(Condition.RemixWorld). + Register(); + } } } diff --git a/Items/Weapons/Magic/Nucleosynthesis.cs b/Items/Weapons/Magic/Nucleosynthesis.cs index 90e3f5756d..f00df0ee15 100644 --- a/Items/Weapons/Magic/Nucleosynthesis.cs +++ b/Items/Weapons/Magic/Nucleosynthesis.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; @@ -14,13 +15,13 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { - Item.width = 62; - Item.height = 62; + Item.width = 116; + Item.height = 116; Item.damage = 70; Item.DamageType = DamageClass.Magic; Item.mana = 18; @@ -63,6 +64,7 @@ namespace CalamityMod.Items.Weapons.Magic else return false; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 spawnOffset = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).RotatedBy(offsetAngle) * -Main.rand.NextFloat(40f, 96f); Vector2 shootDirection = (Main.MouseWorld - (position + spawnOffset)).SafeNormalize(Vector2.UnitX * player.direction); int beam = Projectile.NewProjectile(source, position + spawnOffset, shootDirection * shootSpeed, type, damage, knockback, player.whoAmI); @@ -76,13 +78,15 @@ 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(Texture + "Glow").Value); + public override void AddRecipes() { CreateRecipe(). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentNebula, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/Nucleosynthesis.png b/Items/Weapons/Magic/Nucleosynthesis.png index 8fdeb5441e..505094f4dd 100644 Binary files a/Items/Weapons/Magic/Nucleosynthesis.png and b/Items/Weapons/Magic/Nucleosynthesis.png differ diff --git a/Items/Weapons/Magic/NucleosynthesisGlow.png b/Items/Weapons/Magic/NucleosynthesisGlow.png new file mode 100644 index 0000000000..2030d56fef Binary files /dev/null and b/Items/Weapons/Magic/NucleosynthesisGlow.png differ diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs index 2f5274a96d..5b920b4c1a 100644 --- a/Items/Weapons/Magic/Omicron.cs +++ b/Items/Weapons/Magic/Omicron.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 82; Item.DamageType = DamageClass.Magic; Item.mana = 8; - Item.useTime = Item.useAnimation = 4; + Item.useAnimation = Item.useTime = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -53,13 +53,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) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction 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); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; @@ -69,8 +70,8 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(5). AddIngredient(10). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index a79fa58088..3713f53c6e 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 12; Item.knockBack = 3f; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.autoReuse = true; Item.DamageType = DamageClass.Magic; Item.shootSpeed = 10f; @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons.Magic 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/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index f50734ad0f..a3d4564a54 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -3,6 +3,8 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,30 +15,47 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { Item.width = 62; Item.height = 60; - Item.damage = 260; + Item.damage = 188; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 60; + Item.useTime = 3; + Item.useAnimation = 45; + Item.reuseDelay = 75; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 7.5f; + Item.knockBack = 20f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.UseSound = SoundID.Item43; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/PhantasmalFuryShoot") with { Volume = 0.6f, PitchVariance = 0.15f }; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 6f; Item.rare = ModContent.RarityType(); } - + 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 * 13, velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.8f, 1.1f), ModContent.ProjectileType(), damage, 0, player.whoAmI); + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(source, position + velocity * 13, velocity.RotatedByRandom(0.4f), ModContent.ProjectileType(), damage / 2, 0, player.whoAmI); + } + for (int i = 0; i < 2; i++) + { + Dust chargefull = Dust.NewDustPerfect(position + velocity * 13, 267); + chargefull.velocity = velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(1f, 4); + chargefull.scale = Main.rand.NextFloat(0.5f, 0.9f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Color.Aqua, 0.3f); + } + return false; + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/PhantasmalFury.png b/Items/Weapons/Magic/PhantasmalFury.png index 771690f2d2..3e5883272a 100644 Binary files a/Items/Weapons/Magic/PhantasmalFury.png and b/Items/Weapons/Magic/PhantasmalFury.png differ diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index 5f47966448..1921f78eeb 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Photosynthesis.cs b/Items/Weapons/Magic/Photosynthesis.cs index d3bb5f9161..dc4e32d222 100644 --- a/Items/Weapons/Magic/Photosynthesis.cs +++ b/Items/Weapons/Magic/Photosynthesis.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/PlagueStaff.cs b/Items/Weapons/Magic/PlagueStaff.cs index 61462b4e87..c9cd97def5 100644 --- a/Items/Weapons/Magic/PlagueStaff.cs +++ b/Items/Weapons/Magic/PlagueStaff.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index 24bb921c54..4cf11901f2 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; -using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -20,26 +19,28 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() { Item.width = 72; Item.height = 20; - Item.damage = 150; - Item.mana = 40; + Item.damage = 160; Item.DamageType = DamageClass.Magic; - Item.useTime = Item.useAnimation = 8; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; + Item.mana = 40; + Item.useAnimation = Item.useTime = 40; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = CommonCalamitySounds.PlasmaBlastSound; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + + Item.UseSound = HeavyShotSound; + Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + + Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -48,14 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool CanUseItem(Player player) { - if (player.altFunctionUse == 2) - { - Item.UseSound = FastShotSound; - } - else - { - Item.UseSound = HeavyShotSound; - } + Item.UseSound = player.altFunctionUse == 2 ? FastShotSound : HeavyShotSound; return base.CanUseItem(player); } @@ -65,20 +59,18 @@ namespace CalamityMod.Items.Weapons.Magic mult *= 0.25f; } - public override float UseSpeedMultiplier(Player player) - { - if (player.altFunctionUse == 2) - return 1f; - return 0.2f; - } + public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 5f : 1f; + + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => position += velocity.SafeNormalize(Vector2.UnitX) * 56f; 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(), damage * 2, knockback, player.whoAmI); - else - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - return false; + { + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 1f); + return false; + } + return true; } public override void AddRecipes() @@ -86,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.ToxicFlask). AddIngredient(ItemID.LaserRifle). - AddIngredient(7). + AddIngredient(ItemID.FragmentVortex, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/PlasmaRod.cs b/Items/Weapons/Magic/PlasmaRod.cs index 11b443fc00..904896c5ae 100644 --- a/Items/Weapons/Magic/PlasmaRod.cs +++ b/Items/Weapons/Magic/PlasmaRod.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Poseidon.cs b/Items/Weapons/Magic/Poseidon.cs index d1de524308..305b14499d 100644 --- a/Items/Weapons/Magic/Poseidon.cs +++ b/Items/Weapons/Magic/Poseidon.cs @@ -1,7 +1,5 @@ using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -29,11 +27,5 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - int typhoon = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } } } diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index 5b0258b181..b587e34686 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -5,14 +5,21 @@ using Terraria; using Terraria.DataStructures; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using Microsoft.Xna.Framework; +using System; namespace CalamityMod.Items.Weapons.Magic { public class PrimordialAncient : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public static float BuffDamageReductionBoost = 0.08f; + public static float BuffDamageBoost = 0.18f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(BuffDamageReductionBoost.ToPercent(), BuffDamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 40; @@ -35,10 +42,11 @@ 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) { bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness); - for (int i = 0; i < 5; i++) + for (int i = -2; i <= 2; i++) { - Vector2 vel = velocity.RotatedByRandom(0.2f * i); - Projectile.NewProjectile(source, position, vel * Main.rand.NextFloat(0.8f, 1.2f), type, damage, knockback, player.whoAmI, 0f, i == 0 ? 1 : 0, MaxMana ? 1f : 0f); + Vector2 vel = velocity.RotatedBy(0.1f * i) * MathHelper.Lerp(3 - Math.Abs(i), 1, 0.7f); + Projectile dust = Projectile.NewProjectileDirect(source, position, vel, type, damage, knockback, player.whoAmI, 0f, i == 0 ? 1 : 0, MaxMana ? 1f : 0f); + dust.localAI[0] = i * 0.45f; } return false; @@ -48,6 +56,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(). AddIngredient(8). + AddIngredient(20). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index 16383ffa6f..bfda7be735 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Microsoft.Xna.Framework; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic @@ -12,6 +12,11 @@ namespace CalamityMod.Items.Weapons.Magic public class PrimordialEarth : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public static int BuffDefenseBoost = 12; + public static float BuffDamageBoost = 0.12f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(BuffDefenseBoost, BuffDamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 36; @@ -45,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(). AddIngredient(ItemID.Amber, 5). - AddIngredient(6). + AddIngredient(ItemID.Ectoplasm, 5). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index 00e44ba34b..b39487c4e9 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -16,33 +16,35 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.width = 58; - Item.height = 44; - Item.damage = 120; + Item.width = 64; + Item.height = 48; + Item.damage = 152; Item.DamageType = DamageClass.Magic; - Item.mana = 22; - Item.useTime = 24; - Item.useAnimation = 24; + Item.mana = 50; + Item.useTime = 38; + Item.useAnimation = 38; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; Item.knockBack = 4.5f; - Item.UseSound = CommonCalamitySounds.LaserCannonSound; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + 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) { - // Fire extra lasers to the left and right - Projectile.NewProjectile(source, position, velocity.RotatedBy(-Spread), type, damage, knockback, player.whoAmI); - Projectile.NewProjectile(source, position, velocity.RotatedBy(+Spread), type, damage, knockback, player.whoAmI); - - // Still also fire the center laser - return true; + Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, type, damage, knockback, player.whoAmI); + return false; } } } diff --git a/Items/Weapons/Magic/PurgeGuzzler.png b/Items/Weapons/Magic/PurgeGuzzler.png index ba116a437c..083a037b4e 100644 Binary files a/Items/Weapons/Magic/PurgeGuzzler.png and b/Items/Weapons/Magic/PurgeGuzzler.png differ diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index 6eddc1e9c8..e496dd6214 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 52; Item.height = 30; - Item.damage = 225; + Item.damage = 175; Item.DamageType = DamageClass.Magic; Item.mana = 25; Item.crit += 4; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; @@ -57,13 +57,12 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.ConfettiCannon). AddIngredient(). AddIngredient(ItemID.Celeb2). - AddIngredient(ItemID.FlaskofParty, 5). + AddIngredient(ItemID.ConfettiCannon). + AddIngredient(5). AddIngredient(ItemID.SoulofLight, 25). AddIngredient(ItemID.Confetti, 50). - AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index 67dcea1045..f69ac44ac2 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class Rancor : ModItem, ILocalizedModType + public class Rancor : ExhumedItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index f3626fdbab..4b4cf8fedc 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 38; Item.height = 54; - Item.damage = 128; + Item.damage = 60; Item.mana = 17; Item.noMelee = true; - Item.useAnimation = 18; + Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 18; + Item.useTime = 22; Item.knockBack = 8.5f; Item.UseSound = SoundID.Item8; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Magic; - Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults @@ -38,16 +38,10 @@ 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 spread = 60f * 0.0174f; - double startAngle = Math.Atan2(velocity.X, velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - int i; - for (i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), type, damage, knockback, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), type, damage, knockback, Main.myPlayer, 0f, 0f); + Vector2 circleVel = (MathHelper.TwoPi * i / 6f + velocity.ToRotation()).ToRotationVector2() * 2.2f; + Projectile.NewProjectile(source, player.Center, circleVel, type, damage, knockback, Main.myPlayer); } return false; } @@ -56,9 +50,8 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.DemonScythe). - AddIngredient(12). - AddIngredient(8). - AddIngredient(20). + AddIngredient(6). + AddIngredient(6). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 0504374faf..379715917a 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -1,35 +1,54 @@ -using System.Collections.Generic; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Sounds; 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.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Weapons.Magic { - public class SHPC : ModItem, ILocalizedModType + public class SHPC : LegendaryItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBShot"); + + public const int ShotsPerSoul = 40; + public int storedSoulpower = 0; + public int storedSoulType = ItemID.SoulofLight; // Determines bar color and soul effects for projectile + public int recoilProgress = 0; + + public const float LightExplosionSizeMult = 1.5f; + public const float NightExplosionTimeMult = 2.5f; + public const int FlightDirectHitFlightBoost = 25; // The amount of flight time restored on direct hits with Flight bombs, in frames + public const float MightKnockbackStrength = 8f; // The value to multiply the unit vector by when applying velocity to enemies launched by Might bombs + public const float SightHomingRange = 288f; // Range of homing for Sight bombs, in pixels + public const int FrightFlatDamage = 20; + + public override Color? TooltipExtensionColor => new Color(31, 251, 255); + + public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; public override void SetDefaults() { Item.width = 124; Item.height = 52; - Item.damage = 16; + Item.damage = 94; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = Item.useAnimation = 7; + Item.mana = 15; + Item.useAnimation = Item.useTime = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 3.25f; - Item.UseSound = SoundID.Item92; + Item.knockBack = 3f; + Item.UseSound = FireSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; @@ -38,21 +57,143 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ItemRarityID.Pink; } + #region Weapon-Specific Functions + public int FindSoulForAmmo(Player player) + { + int soul = -1; + bool foundItem = false; + + // First check ammo slots + for (int s = 54; s < 58; s++) + { + if (player.inventory[s].stack > 0 && player.inventory[s].ammo == ItemID.SoulofLight) + { + soul = player.inventory[s].type; + foundItem = true; + break; + } + } + + // If you didn't find anything in ammo slots, check normal inventory + if (!foundItem) + { + for (int i = 0; i < 54; i++) + { + if (player.inventory[i].stack > 0 && player.inventory[i].ammo == ItemID.SoulofLight) + { + soul = player.inventory[i].type; + break; + } + } + } + + return soul; + } + + public Color FindColorForSoul() + { + Color returnColor = new(0, 0, 0); + switch (storedSoulType) + { + case ItemID.SoulofLight: + returnColor = new(240, 29, 196); + break; + case ItemID.SoulofNight: + returnColor = new(123, 29, 220); + break; + case ItemID.SoulofFlight: + returnColor = new(106, 240, 250); + break; + case ItemID.SoulofMight: + returnColor = new(4, 51, 222); + break; + case ItemID.SoulofSight: + returnColor = new(79, 255, 124); + break; + case ItemID.SoulofFright: + returnColor = new(255, 128, 20); + break; + } + return returnColor; + } + + public int TransferColorToProj() + { + int projai = 0; + switch (storedSoulType) + { + case ItemID.SoulofLight: + projai = 0; + break; + case ItemID.SoulofNight: + projai = 1; + break; + case ItemID.SoulofFlight: + projai = 2; + break; + case ItemID.SoulofMight: + projai = 3; + break; + case ItemID.SoulofSight: + projai = 4; + break; + case ItemID.SoulofFright: + projai = 5; + break; + } + return projai; + } + #endregion + public override Vector2? HoldoutOffset() => new Vector2(-35, -10); public override bool AltFunctionUse(Player player) => true; + public override void OnCreated(ItemCreationContext context) + { + if (context is RecipeItemCreationContext) + storedSoulpower = ShotsPerSoul; + } + public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) { - Item.UseSound = CommonCalamitySounds.LaserCannonSound; + Item.useTime = 3; + Item.useAnimation = 3 * storedSoulpower; + Item.UseSound = null; } else { - Item.UseSound = SoundID.Item92; + Item.useTime = Item.useAnimation = 60; + Item.UseSound = FireSound; } - return base.CanUseItem(player); + + return storedSoulpower > 0 || (FindSoulForAmmo(player) != -1 && player.altFunctionUse != 2); + } + + public override bool? UseItem(Player player) + { + if (storedSoulpower > 0) + storedSoulpower--; + + if (storedSoulpower <= 0 && player.altFunctionUse != 2) + { + bool ammoConsumed = false; + + if (FindSoulForAmmo(player) != -1) + { + int soulType = FindSoulForAmmo(player); + player.ConsumeItem(soulType); + storedSoulType = soulType; + ammoConsumed = true; + } + + if (ammoConsumed) + storedSoulpower = ShotsPerSoul; + } + + return base.UseItem(player); } public override void ModifyManaCost(Player player, ref float reduce, ref float mult) @@ -64,35 +205,85 @@ namespace CalamityMod.Items.Weapons.Magic public override float UseSpeedMultiplier(Player player) { if (player.altFunctionUse == 2) - return 1f; + return 6f; - return 1 / 7.14f; + return 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) { - for (int shootAmt = 0; shootAmt < 3; shootAmt++) + SoundEngine.PlaySound(CommonCalamitySounds.ELRFireSound, player.Center); + if (storedSoulpower % 2 == 0) { - float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback * 0.5f, player.whoAmI, 0f, 0f); + Vector2 Speed = new Vector2(velocity.X + Main.rand.NextFloat(-1f, 1f), velocity.Y + Main.rand.NextFloat(-1f, 1f)); + Projectile.NewProjectile(source, position + new Vector2(0, -10) + velocity * 2.6f, Speed, ModContent.ProjectileType(), (int)(damage * 0.25f), knockback * 0.5f, player.whoAmI, TransferColorToProj()); } return false; } else { - for (int shootAmt = 0; shootAmt < 3; shootAmt++) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.1), knockback, player.whoAmI, 0f, 0f); - } + Projectile.NewProjectile(source, position + new Vector2(0, -10) + velocity * 3f, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, TransferColorToProj()); return false; } } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + float barScale = 2.5f; + var barBG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarFront").Value; + + Vector2 drawPos = position + new Vector2((frame.Width - barBG.Width * 0.5f) * scale, (frame.Height + 45f) * scale); + Rectangle frameCrop = new Rectangle(0, 0, (int)(storedSoulpower / (float)ShotsPerSoul * barFG.Width), barFG.Height); + Color colorBG = Color.Black; + Color colorFG = Color.Lerp(Color.DarkGray, FindColorForSoul(), storedSoulpower / (float)ShotsPerSoul); + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, origin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG * 0.8f, 0f, origin, scale * barScale, 0f, 0f); + + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, storedSoulpower.ToString(), drawPos + new Vector2(-200, -60) * scale, Color.GreenYellow, Color.Black, scale * 2.5f); + } + + #region Recoil Stuff + 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(-35, 0); + + if (player.altFunctionUse != 2) + { + recoilProgress++; + if (recoilProgress < Item.useAnimation / 3) + { + itemPosition -= (player.Calamity().mouseWorld - player.Center).SafeNormalize(Vector2.UnitX) * (Item.useAnimation / 3 - recoilProgress) * 0.75f; + } + else + { + if (recoilProgress >= Item.useAnimation - 1) + recoilProgress = 0; + } + } + + 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 rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + #endregion + public override void ModifyWeaponDamage(Player player, ref StatModifier damage) { // scaling legendary!!!! @@ -116,7 +307,7 @@ namespace CalamityMod.Items.Weapons.Magic damage *= damageMult; } } - public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", Lang.SupportGlyphs(this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"))); public override void AddRecipes() { @@ -124,8 +315,48 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(4). AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.SoulofFright, 5). + AddIngredient(ItemID.SoulofMight, 5). + AddIngredient(ItemID.SoulofSight, 5). AddTile(TileID.MythrilAnvil). Register(); } + + #region Saving Ammo Amount and Soul Type + public override ModItem Clone(Item item) + { + ModItem clone = base.Clone(item); + if (clone is SHPC a && item.ModItem is SHPC a2) + { + a.storedSoulpower = a2.storedSoulpower; + a.storedSoulType = a2.storedSoulType; + } + return clone; + } + + public override void SaveData(TagCompound tag) + { + tag["ammoStored"] = storedSoulpower; + tag["soulType"] = storedSoulType; + } + + public override void LoadData(TagCompound tag) + { + storedSoulpower = tag.GetInt("ammoStored"); + storedSoulType = tag.GetInt("soulType"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(storedSoulpower); + writer.Write(storedSoulType); + } + + public override void NetReceive(BinaryReader reader) + { + storedSoulpower = reader.ReadInt32(); + storedSoulType = reader.ReadInt32(); + } + #endregion } } diff --git a/Items/Weapons/Magic/SandstreamScepter.cs b/Items/Weapons/Magic/SandstreamScepter.cs index 942ba48deb..2478aed15c 100644 --- a/Items/Weapons/Magic/SandstreamScepter.cs +++ b/Items/Weapons/Magic/SandstreamScepter.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { - Item.width = 46; - Item.height = 40; + Item.width = 50; + Item.height = 56; Item.damage = 16; Item.DamageType = DamageClass.Magic; Item.mana = 4; @@ -36,10 +36,6 @@ 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) - { - Projectile.NewProjectile(source, position + velocity * 5, velocity, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => position += velocity.SafeNormalize(Vector2.UnitX) * 55f; } } diff --git a/Items/Weapons/Magic/SandstreamScepter.png b/Items/Weapons/Magic/SandstreamScepter.png index c85eec12d1..64e58ebf01 100644 Binary files a/Items/Weapons/Magic/SandstreamScepter.png and b/Items/Weapons/Magic/SandstreamScepter.png differ diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index 23cb3d0aea..bc7827c338 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index ccb6632d8c..63aeac78ab 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.Projectiles.Magic; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; @@ -11,37 +12,61 @@ namespace CalamityMod.Items.Weapons.Magic public class SeethingDischarge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public int DartTimer = 0; public override void SetDefaults() { Item.width = 28; Item.height = 32; - Item.damage = 52; + Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 15; - Item.useTime = 24; - Item.useAnimation = 24; + Item.mana = 20; + Item.useTime = 60; + Item.useAnimation = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.75f; - Item.UseSound = CommonCalamitySounds.FlareSound; + Item.UseSound = BrimstoneElemental.ShellFireSound; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 10f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float SpeedX = velocity.X + 10f * 0.05f; - float SpeedY = velocity.Y + 10f * 0.05f; - float SpeedX2 = velocity.X - 10f * 0.05f; - float SpeedY2 = velocity.Y - 10f * 0.05f; - float SpeedX3 = velocity.X + 0f * 0.05f; - float SpeedY3 = velocity.Y + 0f * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockback, player.whoAmI, 0f, 0f); + DartTimer++; + + // Spawn hellblasts + float diameter = 50f; + Vector2 projVelocity = velocity.SafeNormalize(Vector2.UnitY); + projVelocity *= diameter; + + int totalProjectiles = 5; + float offsetAngle = MathHelper.Pi * 0.2f; + + for (int j = 0; j < totalProjectiles; j++) + { + float radians = j - (totalProjectiles - 1f) / 2f; + Vector2 offset = projVelocity.RotatedBy(offsetAngle * radians); + Projectile.NewProjectile(source, player.Center + offset, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + } + + // Every 3rd attack, spawn a ring of homing darts + if (DartTimer == 3) + { + DartTimer = 0; + + totalProjectiles = 8; + Vector2 initialOffset = Vector2.UnitX.RotatedBy(Main.rand.NextFloat(0f, MathHelper.PiOver4)); + for (int k = 0; k < totalProjectiles; k++) + { + velocity = initialOffset.RotatedBy(MathHelper.TwoPi * (k / (float)totalProjectiles)) * Item.shootSpeed; + Projectile.NewProjectile(source, player.Center, velocity, type, damage, 0f, player.whoAmI, 0f, 1f); + } + } + return false; } } diff --git a/Items/Weapons/Magic/Serpentine.cs b/Items/Weapons/Magic/Serpentine.cs index 7753b8bbea..2a9e1ff387 100644 --- a/Items/Weapons/Magic/Serpentine.cs +++ b/Items/Weapons/Magic/Serpentine.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic @@ -11,11 +12,16 @@ namespace CalamityMod.Items.Weapons.Magic public class Serpentine : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public static int ArmorPenetration = 15; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); + public override void SetDefaults() { Item.width = 28; Item.height = 32; Item.damage = 10; + Item.ArmorPenetration = ArmorPenetration; Item.DamageType = DamageClass.Magic; Item.mana = 20; Item.useTime = 35; @@ -38,7 +44,10 @@ namespace CalamityMod.Items.Weapons.Magic player.itemTime = Item.useTime; Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 projRotation = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); + + // 14NOV2024: Ozzatron: clamped mouse position is inappropriate to apply here due to excessive use of decompiled vanilla shitcode Vector2 projSpawnPos = Main.MouseWorld - realPlayerPos; + float velX = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; float velY = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; if (player.gravDir == -1f) diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 76e976a116..cb4d8ccff9 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -29,27 +29,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { Item.width = Item.height = 42; Item.damage = 19; - Item.shootSpeed = 11f; - Item.useTime = Item.useAnimation = 34; - Item.mana = 10; - Item.knockBack = 0f; - - Item.shoot = ModContent.ProjectileType(); - Item.DamageType = DamageClass.Magic; - Item.useStyle = ItemUseStyleID.Shoot; + Item.mana = 10; + Item.useAnimation = Item.useTime = 34; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; + Item.UseSound = SoundID.Item66; - Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; Item.noMelee = true; + + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; } 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/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index 593ac52488..d438f5e097 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -13,26 +13,26 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { Item.width = 58; Item.height = 56; - Item.damage = 280; + Item.damage = 190; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 14; - Item.useAnimation = 14; + Item.mana = 10; + Item.useTime = 12; + Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 8f; + Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.UseSound = SoundID.Item72; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; + Item.shootSpeed = 5f; Item.rare = ModContent.RarityType(); } @@ -40,8 +40,8 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.ShadowbeamStaff). - AddIngredient(3). AddIngredient(2). + AddIngredient(). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index ca5991c6f6..ad97b003f3 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = Item.height = 58; Item.damage = 76; Item.knockBack = 5f; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.mana = 20; Item.DamageType = DamageClass.Magic; Item.channel = true; diff --git a/Items/Weapons/Magic/SkyGlaze.cs b/Items/Weapons/Magic/SkyGlaze.cs index 07705ba1b5..a9bc168915 100644 --- a/Items/Weapons/Magic/SkyGlaze.cs +++ b/Items/Weapons/Magic/SkyGlaze.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index a0789ea6c9..c7c48d362a 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 310; Item.DamageType = DamageClass.Magic; Item.mana = 19; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; diff --git a/Items/Weapons/Magic/StaffofBlushie.cs b/Items/Weapons/Magic/StaffofBlushie.cs index b8d8a4e951..d89bd90aa0 100644 --- a/Items/Weapons/Magic/StaffofBlushie.cs +++ b/Items/Weapons/Magic/StaffofBlushie.cs @@ -39,8 +39,8 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SapphireStaff). - AddIngredient(10). AddIngredient(5). + AddIngredient(10). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/StarShower.cs b/Items/Weapons/Magic/StarShower.cs index f1da7a9249..f699464be8 100644 --- a/Items/Weapons/Magic/StarShower.cs +++ b/Items/Weapons/Magic/StarShower.cs @@ -40,8 +40,9 @@ 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) { - Vector2 destination = Main.MouseWorld; - position = destination - Vector2.UnitY * (Main.MouseWorld.Y - Main.screenPosition.Y + 80f); + Vector2 mouse = player.ClampedMouseWorld(); + Vector2 destination = mouse; + position = destination - Vector2.UnitY * (mouse.Y - Main.screenPosition.Y + 80f); Vector2 cachedPosition = position; float maxRandomOffset = 16f; int totalProjectiles = 5; @@ -49,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic { 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); + velocity = (mouse - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); position = cachedPosition; } diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index cdfa059331..84db87a52f 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -41,16 +41,16 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() { Item.width = 86; Item.height = 104; - Item.damage = 466; + Item.damage = 460; Item.DamageType = DamageClass.Magic; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.shootSpeed = 7f; Item.mana = 22; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/TacticiansTrumpCard.cs b/Items/Weapons/Magic/TacticiansTrumpCard.cs index ecdf6fbeb6..4e26e129e7 100644 --- a/Items/Weapons/Magic/TacticiansTrumpCard.cs +++ b/Items/Weapons/Magic/TacticiansTrumpCard.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(). AddIngredient(5). - AddIngredient(). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); CreateRecipe(). @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(). AddIngredient(5). - AddIngredient(). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 142e3a62f1..6e31eef359 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -52,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(ItemID.WaterBolt). AddIngredient(15). - AddIngredient(5). + AddIngredient(ItemID.Ectoplasm, 5). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/Teslastaff.cs b/Items/Weapons/Magic/Teslastaff.cs index 2611504952..ac23efa9d6 100644 --- a/Items/Weapons/Magic/Teslastaff.cs +++ b/Items/Weapons/Magic/Teslastaff.cs @@ -23,19 +23,20 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 166; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.useTime = 10; - Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = Item.useTime = 10; + Item.reuseDelay = 60; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.UseSound = CommonCalamitySounds.LightningSound with { Pitch = 1.1f }; + Item.useStyle = ItemUseStyleID.Shoot; 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; @@ -45,8 +46,8 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.ThunderStaff). AddRecipeGroup("AnyCopperBar", 20). - AddIngredient(2). - AddIngredient(6). + AddIngredient(6). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/TheCauldron.cs b/Items/Weapons/Magic/TheCauldron.cs index c05c1dd41c..d3b57adcb1 100644 --- a/Items/Weapons/Magic/TheCauldron.cs +++ b/Items/Weapons/Magic/TheCauldron.cs @@ -61,7 +61,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) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 46); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 46); return false; } diff --git a/Items/Weapons/Magic/TheDanceofLight.cs b/Items/Weapons/Magic/TheDanceofLight.cs index 347545910d..32f4211022 100644 --- a/Items/Weapons/Magic/TheDanceofLight.cs +++ b/Items/Weapons/Magic/TheDanceofLight.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 40; Item.height = 42; - Item.damage = 415; + Item.damage = 515; Item.knockBack = 4f; Item.DamageType = DamageClass.Magic; Item.mana = 6; @@ -89,7 +89,6 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.SkyFracture). AddIngredient(ItemID.LunarFlareBook). - AddIngredient(). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index d01a32eff6..2cf5bc192a 100644 --- a/Items/Weapons/Magic/ThePrince.cs +++ b/Items/Weapons/Magic/ThePrince.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public const int FlameSplitCount = 6; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.noMelee = true; Item.mana = 12; - Item.useTime = Item.useAnimation = 21; + Item.useAnimation = Item.useTime = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; Item.UseSound = SoundID.DD2_FlameburstTowerShot; diff --git a/Items/Weapons/Magic/TheSwarmer.cs b/Items/Weapons/Magic/TheSwarmer.cs index 35d5d257f3..665c7963e1 100644 --- a/Items/Weapons/Magic/TheSwarmer.cs +++ b/Items/Weapons/Magic/TheSwarmer.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ProjectileID.Wasp; Item.shootSpeed = 12f; + Item.knockBack = 0.25f; } public override Vector2? HoldoutOffset() => new Vector2(-15, -5); diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index 38f0e17b33..cb2dcf2656 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/TheWand.png b/Items/Weapons/Magic/TheWand.png index b2efdfb95e..e1261a6212 100644 Binary files a/Items/Weapons/Magic/TheWand.png and b/Items/Weapons/Magic/TheWand.png differ diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index 0fe8425e06..005e22edf6 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Thunderstorm.cs b/Items/Weapons/Magic/Thunderstorm.cs deleted file mode 100644 index 2309058e6c..0000000000 --- a/Items/Weapons/Magic/Thunderstorm.cs +++ /dev/null @@ -1,35 +0,0 @@ -using CalamityMod.Projectiles.Magic; -using CalamityMod.Rarities; -using CalamityMod.Sounds; -using Microsoft.Xna.Framework; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class Thunderstorm : ModItem, ILocalizedModType - { - 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.useTime = 24; - Item.useAnimation = 24; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 2f; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = CommonCalamitySounds.PlasmaBlastSound; - Item.autoReuse = true; - Item.shootSpeed = 6f; - Item.shoot = ModContent.ProjectileType(); - } - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - } -} diff --git a/Items/Weapons/Magic/Thunderstorm.png b/Items/Weapons/Magic/Thunderstorm.png deleted file mode 100644 index 5f3b9e2100..0000000000 Binary files a/Items/Weapons/Magic/Thunderstorm.png and /dev/null differ diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 7e3fc41370..1095523651 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -59,11 +59,12 @@ namespace CalamityMod.Items.Weapons.Magic } f = Main.rand.NextFloat() * MathHelper.TwoPi; } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 velocityReal = Main.MouseWorld - source; Vector2 upperVelocityLimit = new Vector2(xVec, yVec).SafeNormalize(Vector2.UnitY) * speed; velocityReal = velocityReal.SafeNormalize(upperVelocityLimit) * speed; velocityReal = Vector2.Lerp(velocityReal, upperVelocityLimit, 0.25f); - Projectile.NewProjectile(projSource, source, velocityReal, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(projSource, source, velocityReal, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index 85490b1564..1ffeebf364 100644 --- a/Items/Weapons/Magic/UndinesRetribution.cs +++ b/Items/Weapons/Magic/UndinesRetribution.cs @@ -1,6 +1,6 @@ using System; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 7658454429..9c8c4765fe 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/VeeringWind.cs b/Items/Weapons/Magic/VeeringWind.cs index 7adc9d4a4d..603589b897 100644 --- a/Items/Weapons/Magic/VeeringWind.cs +++ b/Items/Weapons/Magic/VeeringWind.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 19; Item.DamageType = DamageClass.Magic; Item.mana = 14; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 10f; @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(ItemID.IceBlock, 30). AddIngredient(ItemID.Feather, 3). AddIngredient(ItemID.FallenStar, 5). AddIngredient(ItemID.Cloud, 10). diff --git a/Items/Weapons/Magic/Vehemence.cs b/Items/Weapons/Magic/Vehemence.cs index f5304189d4..00f8970db7 100644 --- a/Items/Weapons/Magic/Vehemence.cs +++ b/Items/Weapons/Magic/Vehemence.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 6666; Item.DamageType = DamageClass.Magic; Item.mana = 41; - Item.useTime = Item.useAnimation = 43; + Item.useAnimation = Item.useTime = 43; Item.noUseGraphic = true; Item.channel = true; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index 275e0f2306..407eaf612a 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() { Item.width = 70; Item.height = 68; - Item.damage = 256; + Item.damage = 2156; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 40; + Item.useTime = 65; + Item.useAnimation = 65; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9f; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item45; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 19f; + Item.shootSpeed = 13f; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index 3ed6924f0d..c5095b7d93 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + Item.staff[Type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index f7c221a071..ec75d92d53 100644 --- a/Items/Weapons/Magic/Viscera.cs +++ b/Items/Weapons/Magic/Viscera.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public const int BoomLifetime = 40; diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index 45cc02fd5a..681c2e9007 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -11,43 +11,38 @@ namespace CalamityMod.Items.Weapons.Magic public class VitriolicViper : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - Item.staff[Item.type] = true; - } public override void SetDefaults() { Item.width = 60; Item.height = 62; - Item.damage = 93; + Item.damage = 2893; Item.DamageType = DamageClass.Magic; - Item.mana = 15; - Item.useTime = Item.useAnimation = 16; + Item.mana = 45; + Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 4f; - Item.UseSound = SoundID.Item46; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 6.5f; + Item.UseSound = null; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + 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 = -4; i <= 4; i += 1) - { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X * 1.65f, perturbedSpeed.Y * 1.65f, type, (int)(damage * 0.7f), knockback * 0.7f, player.whoAmI, 0f, 0f); - } - for (int j = -2; j <= 2; j += 1) - { - Vector2 perturbedSpeed2 = velocity.RotatedBy(MathHelper.ToRadians(j)); - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed2.X, perturbedSpeed2.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - } + Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index d5f00474c2..5aabf36d9d 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public static readonly SoundStyle BeamSound = new("CalamityMod/Sounds/Item/VividClarityBeamAppear"); public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -64,6 +64,7 @@ namespace CalamityMod.Items.Weapons.Magic } f = Main.rand.NextFloat() * MathHelper.TwoPi; } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 velocityReal = Main.MouseWorld - source; Vector2 velocityVariation = new Vector2(xPos, yPos).SafeNormalize(Vector2.UnitY) * speed; velocityReal = velocityReal.SafeNormalize(velocityVariation) * speed; diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index c60e56b414..abd18f69a4 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -26,23 +26,24 @@ namespace CalamityMod.Items.Weapons.Magic 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.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item20; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 49; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; + + Item.UseSound = SoundID.Item20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.noMelee = true; + + 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) { int numOrbs = 12; - Vector2 clickPos = Main.MouseWorld; + Vector2 clickPos = player.ClampedMouseWorld(); float orbDistance = 90f; float orbSpeed = 4f; diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index a2bd468659..5cd70a1c53 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -43,7 +43,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 numOrbs = 9; - Vector2 clickPos = Main.MouseWorld; + Vector2 clickPos = player.ClampedMouseWorld(); float orbSpeed = 14f; Vector2 vel = Main.rand.NextVector2CircularEdge(orbSpeed, orbSpeed); for (int i = 0; i < numOrbs; i++) @@ -60,6 +60,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(). + AddIngredient(8). AddIngredient(8). AddTile(). Register(); diff --git a/Items/Weapons/Magic/Volterion.cs b/Items/Weapons/Magic/Volterion.cs new file mode 100644 index 0000000000..5579403159 --- /dev/null +++ b/Items/Weapons/Magic/Volterion.cs @@ -0,0 +1,56 @@ +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + [LegacyName("Thunderstorm")] + public class Volterion : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetDefaults() + { + Item.width = 220; + Item.height = 60; + Item.damage = 840; + Item.DamageType = DamageClass.Magic; + Item.mana = 50; + Item.useAnimation = Item.useTime = 80; // 42 frames of firing animation + Item.knockBack = 2f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + } + + // Cancels out the mana used to summon the holdout + public override void OnConsumeMana(Player player, int manaConsumed) + { + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.statMana += manaConsumed; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + 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) + { + Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, type, damage, knockback, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Magic/Volterion.png b/Items/Weapons/Magic/Volterion.png new file mode 100644 index 0000000000..47b3104e64 Binary files /dev/null and b/Items/Weapons/Magic/Volterion.png differ diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index add4b132bf..83ca88ed9d 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,31 +11,35 @@ namespace CalamityMod.Items.Weapons.Magic public class Waywasher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public int shotCount = 0; public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 16; + Item.damage = 38; Item.DamageType = DamageClass.Magic; - Item.mana = 4; - Item.useTime = 15; - Item.useAnimation = 15; + Item.mana = 10; + Item.useTime = 14; + Item.useAnimation = 28; + Item.reuseDelay = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 2.5f; + Item.knockBack = 12f; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item8; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 13f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity.RotatedBy(-0.3f * (shotCount % 2 == 0 ? -1 : 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, shotCount % 2 == 0 ? -1 : 1); + + SoundStyle WayWashed = new("CalamityMod/Sounds/Item/WaterSplash" + (shotCount % 2 == 0 ? "1" : "2")); + SoundEngine.PlaySound(WayWashed with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 2 }, position); + + shotCount++; return false; } diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index b4960be3d1..b083e19c88 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Items.Weapons.Magic for (int i = 0; i < 2; i++) { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); } diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs deleted file mode 100644 index e7a48dcdec..0000000000 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ /dev/null @@ -1,37 +0,0 @@ -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 WrathoftheAncients : ModItem, ILocalizedModType - { - 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.useTime = 38; - Item.useAnimation = 38; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 6f; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; - Item.rare = ItemRarityID.Yellow; - 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) - { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - } -} diff --git a/Items/Weapons/Magic/WrathoftheAncients.png b/Items/Weapons/Magic/WrathoftheAncients.png deleted file mode 100644 index 4412f19055..0000000000 Binary files a/Items/Weapons/Magic/WrathoftheAncients.png and /dev/null differ diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index 36a2897fd8..67b618de61 100644 --- a/Items/Weapons/Magic/WyvernsCall.cs +++ b/Items/Weapons/Magic/WyvernsCall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index d91a6096e9..79f6ee338e 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -21,15 +21,15 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = SoundID.Item13; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; - Item.knockBack = 0f; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 30f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index 199a341c1a..71525139dd 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Weapons/Melee/AcidwoodSword.cs b/Items/Weapons/Melee/AcidwoodSword.cs index 3d8eaf9876..e66fd94976 100644 --- a/Items/Weapons/Melee/AcidwoodSword.cs +++ b/Items/Weapons/Melee/AcidwoodSword.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index 9b76ece0bb..6607f71156 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -12,7 +12,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 1ab080f85e..f3a317b299 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -9,11 +10,17 @@ namespace CalamityMod.Items.Weapons.Melee public class AirSpinner : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 330f; + public static float Speed = 32f; + public static float Duration = 30f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed, Duration); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/AmidiasTrident.cs b/Items/Weapons/Melee/AmidiasTrident.cs index 9624cbde95..36530c0bdb 100644 --- a/Items/Weapons/Melee/AmidiasTrident.cs +++ b/Items/Weapons/Melee/AmidiasTrident.cs @@ -10,7 +10,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index be42a6d88f..deda0bf7d1 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.BreakerBlade). AddIngredient(5). - AddIngredient(3). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index 62b40b8710..6552a7ee34 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -9,11 +10,17 @@ namespace CalamityMod.Items.Weapons.Melee public class Aorta : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 330f; + public static float Speed = 25f; + public static float Duration = 24f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed, Duration); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index b2075df53f..905ec0cf9c 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -22,23 +22,24 @@ namespace CalamityMod.Items.Weapons.Melee public float Combo = 0f; public float Charge = 0f; + // Frame window for double right click to snip. + // The right click item activation takes 3 frames, so the frame window is frame 3 to frame 11. + public static int DoubleRightClickFrames = 11; + private int rmbFrames = 0; + public static float NeedleDamageMultiplier = 0.7f; //Damage on the non-homing needle projectile public static float MaxThrowReach = 760; - public static float snapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap + public static float SnapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap 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; - public static float SlashBoltsDamageMultiplier = 0.2f; public static float SnapBoltsDamageMultiplier = 0.1f; - 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 - public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder + public static float BlastDamageMultiplier = 2f; //Damage multiplier for the blast attack + public static float BlastBoltsDamageMultiplier = 0.2f; - public static float SwirlBoltAmount = 6f; //The amount of cosmic bolts produced during hte swirl attack + public static float SwirlBoltAmount = 6f; //The amount of cosmic bolts produced during the swirl attack public static float SwirlBoltDamageMultiplier = 0.7f; //This is the damage multiplier for ALL THE BOLTS: Aka, said damage multiplier is divided by the amount of bolts in a swirl and the full damage multiplier is gotten if you hit all the bolts public override void ModifyTooltips(List tooltips) @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -89,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 28f; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults @@ -101,35 +102,70 @@ namespace CalamityMod.Items.Weapons.Melee { player.Calamity().mouseWorldListener = true; + if (rmbFrames > 0) + --rmbFrames; + if (CanUseItem(player) && Combo != 4) Item.channel = false; if (Combo == 4) Item.channel = true; } + public override bool CanUseItem(Player player) { return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType()); } + // Right clicks for parries execute extremely fast (3 or less frames) and intentionally so. + public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 5f : 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) { - if (Charge > 0 && player.controlUp) + // If it has been less than N frames since the last alt function use, this is a double right click. + bool rightMouseDoubleClick = rmbFrames > 0; + + // Check if a parry holdout is already present. + Projectile parrier = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); + + bool canExecuteBlast = rightMouseDoubleClick && Charge > 0; + bool canExecuteParry = parrier is null && !canExecuteBlast; + + // The blast is checked first, so that it overrides the first right click triggering a parry. Blasts delete any active parry holdouts on use. + if (canExecuteBlast) { + // Fire the super blast, then set charge back to zero. float angle = velocity.ToRotation(); - Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI, Charge); - - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; - + Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * BlastDamageMultiplier), 0, player.whoAmI, Charge); Charge = 0; + + // If the parry holdout has existed for very few frames and hasn't parried something, just delete it. + if (parrier is not null && parrier.timeLeft > ArkoftheCosmosParryHoldout.MaxTime - DoubleRightClickFrames && parrier.ai[1] <= 0f) + { + parrier.active = false; + parrier.netUpdate = true; + } } - else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) - Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); + // If the blast cannot be executed, then the parry is executed, assuming no existing holdout is present. + else if (canExecuteParry) + { + // Checks for parries from any Ark weapon, presumably to prevent some kind of abuse. + bool anyArkParryExists = Main.projectile.Any(n => + n.active && n.owner == player.whoAmI && ( + n.type == ProjectileType() || + n.type == ProjectileType() || + n.type == ProjectileType() || + n.type == ProjectileType())); + if (!anyArkParryExists) + Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); + } + + // Regardless of what transpires from the right click, set the double right click frames appropriately. + rmbFrames = DoubleRightClickFrames; return false; } diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index df934e2e7c..39b95d5473 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -27,16 +27,12 @@ namespace CalamityMod.Items.Weapons.Melee 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) - 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 - public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder - public override void ModifyTooltips(List tooltips) { if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -52,12 +48,6 @@ namespace CalamityMod.Items.Weapons.Melee parryTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("ParryInfo")); parryTooltip.OverrideColor = Color.Orange; } - var blastTooltip = tooltips.FirstOrDefault(x => x.Text.Contains("[BLAST]") && x.Mod == "Terraria"); - if (blastTooltip != null) - { - blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfo")); - blastTooltip.OverrideColor = Color.Gold; - } } public override void SetDefaults() @@ -106,18 +96,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - if (Charge > 0 && player.controlUp) - { - float angle = velocity.ToRotation(); - Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI); - - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; - - Charge = 0; - } - - else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) + if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); return false; @@ -133,9 +112,6 @@ namespace CalamityMod.Items.Weapons.Melee if (Combo > ComboLength) Combo = 0; - - - //Shoot projectiles every upwards swing if (scissorState == 1f) { @@ -188,6 +164,9 @@ namespace CalamityMod.Items.Weapons.Melee float tweakedScale = scale * (1 + extraScale); //Make the scale bigger to avoid crunching of the item Vector2 offset = (frontTexture.Size() * extraScale / 2f) * scale; + // The base offset is not perfect, so we need to move it down a little + offset -= Vector2.UnitY * 16f * scale; + float backLayerOpacity = (Charge > 0) ? 1f : (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.9f) * 0.2f + 0.3f; spriteBatch.Draw(backTexture, position - offset, null, drawColor * backLayerOpacity, 0f, origin, tweakedScale, SpriteEffects.None, 0f); //Make the back scissor slightly transparent if the ark isnt charged @@ -231,7 +210,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/AstralPike.cs b/Items/Weapons/Melee/AstralPike.cs index d9d5da2e0a..688ef97985 100644 --- a/Items/Weapons/Melee/AstralPike.cs +++ b/Items/Weapons/Melee/AstralPike.cs @@ -11,7 +11,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index da283e3c99..912b7417a7 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -32,7 +32,7 @@ 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, velocity, type, (int)(damage * 0.6), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.6), knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index d02a6a5184..62bc330370 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee // Center projectile int centerID = ModContent.ProjectileType(); int centerDamage = (damage / 2); - Projectile.NewProjectile(source, position, velocity, centerID, centerDamage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, centerID, centerDamage, knockback, player.whoAmI); // Side projectiles (these deal 75% damage) int sideID = ModContent.ProjectileType(); @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee 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); + Projectile.NewProjectile(source, targetPos, Vector2.Zero, trueMeleeID, trueMeleeDamage, Item.knockBack, player.whoAmI); } @@ -129,7 +129,6 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(5). AddIngredient(8). AddIngredient(2). - AddIngredient(20). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/Avalanche.cs b/Items/Weapons/Melee/Avalanche.cs index d62182a121..af32ff182b 100644 --- a/Items/Weapons/Melee/Avalanche.cs +++ b/Items/Weapons/Melee/Avalanche.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 64; Item.height = 64; - Item.damage = 100; + Item.damage = 75; Item.DamageType = DamageClass.Melee; Item.useAnimation = 35; Item.useTime = 35; @@ -29,39 +29,16 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - var source = player.GetSource_ItemUse(Item); - int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int bombDamage = player.CalcIntDamage(Item.damage); - float velocity = 4f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); - for (int k = 0; k < totalProjectiles; k++) + if (CalamityUtils.CountOwnedProjectiles(type, player.whoAmI) < 16) { - Vector2 projRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, hit.Knockback * 0.5f, Main.myPlayer); - } - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - var source = player.GetSource_ItemUse(Item); - int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); - int bombDamage = player.CalcIntDamage(Item.damage); - float velocity = 4f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 projRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, 0f, Main.myPlayer); + var source = player.GetSource_ItemUse(Item); + int bombDamage = player.CalcIntDamage(Item.damage); + for (int k = 0; k < 4; k++) + { + // ai0: projectile timer. ai1: target index. ai2: rotation offset based on ice bomb number. + Projectile.NewProjectile(source, target.Center, Vector2.Zero, type, bombDamage, hit.Knockback * 0.5f, Main.myPlayer, 0f, target.whoAmI, k); + } } } diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index 3685b98f2f..2dd12c9fb4 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -4,6 +4,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -11,11 +12,16 @@ namespace CalamityMod.Items.Weapons.Melee public class Azathoth : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 880f; + public static float Speed = 60f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() @@ -48,8 +54,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.Terrarian). - AddIngredient(2). AddIngredient(5). + AddIngredient(2). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index b1b41f3c1a..57fd032a47 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Items.BaseItems; using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class BalefulHarvester : ModItem, ILocalizedModType + public class BalefulHarvester : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; @@ -14,33 +14,22 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 86; Item.height = 98; - Item.damage = 105; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 22; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 22; + Item.damage = 120; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = Item.useTime = 80; Item.useTurn = true; Item.knockBack = 8f; - Item.UseSound = SoundID.Item1; + Item.UseSound = null; Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; } - 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.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.5f, 0, type); - target.AddBuff(BuffID.OnFire3, 300); - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/BansheeHook.cs b/Items/Weapons/Melee/BansheeHook.cs index 458b6276f9..0c788bd3ff 100644 --- a/Items/Weapons/Melee/BansheeHook.cs +++ b/Items/Weapons/Melee/BansheeHook.cs @@ -15,7 +15,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index f63ec86d3d..e050f25e6f 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -1,41 +1,41 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Basher : ModItem, ILocalizedModType + public class Basher : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { Item.width = 56; Item.height = 60; - Item.damage = 50; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 40; + Item.damage = 40; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.useTurn = true; + + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; 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 bool MeleePrefix() => true; public override void AddRecipes() { CreateRecipe(). - AddIngredient(30). + AddIngredient(). AddIngredient(12). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index 84639e8046..e88d676e19 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -7,50 +7,39 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class BladecrestOathsword : ModItem, ILocalizedModType + public class BladecrestOathsword : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Melee"; + public int throwCount = 0; public override void SetDefaults() { Item.width = 56; Item.height = 56; - Item.damage = 17; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 21; - Item.useTime = 21; - Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 4f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; + + Item.damage = 50; + Item.knockBack = 3f; + Item.useTime = 53; + Item.useAnimation = 53; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + + Item.noMelee = true; Item.noUseGraphic = true; - Item.useTurn = false; - Item.channel = true; + Item.DamageType = DamageClass.Melee; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.shootSpeed = 6f; - // Set so the item isn't classified as true melee - Item.shoot = ModContent.ProjectileType(); } - - public override bool CanUseItem(Player player) + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + public override bool MeleePrefix() => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int bladeProjID = ModContent.ProjectileType(); - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type != bladeProjID || p.owner != player.whoAmI) - continue; - - return p.ModProjectile().PostSwingRepositionDelay <= 0f; - } - - return base.CanUseItem(player); + throwCount++; + Projectile.NewProjectileDirect(source, player.MountedCenter, velocity, type, damage, knockback, player.whoAmI, 0, throwCount); + return false; } - - // Return false because Shoot code is not actually relevant - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) => false; - - public override bool? CanHitNPC(Player player, NPC target) => false; - - public override bool CanHitPvp(Player player, Player target) => false; } } diff --git a/Items/Weapons/Melee/BlightedCleaver.cs b/Items/Weapons/Melee/BlightedCleaver.cs index 176febb628..ec16818ed4 100644 --- a/Items/Weapons/Melee/BlightedCleaver.cs +++ b/Items/Weapons/Melee/BlightedCleaver.cs @@ -91,8 +91,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(ItemID.BrokenHeroSword). - AddIngredient(ItemID.FlaskofVenom, 5). AddIngredient(ItemID.ChlorophyteBar, 15). + AddIngredient(ItemID.VialofVenom, 10). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Melee/BotanicPiercer.cs b/Items/Weapons/Melee/BotanicPiercer.cs index 5e75b4790b..25f5f5eb42 100644 --- a/Items/Weapons/Melee/BotanicPiercer.cs +++ b/Items/Weapons/Melee/BotanicPiercer.cs @@ -14,7 +14,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index 1666ed6820..891c17c57e 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -10,7 +10,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/BrimstoneSword.cs b/Items/Weapons/Melee/BrimstoneSword.cs index 8407cb5eb2..78ccce24fd 100644 --- a/Items/Weapons/Melee/BrimstoneSword.cs +++ b/Items/Weapons/Melee/BrimstoneSword.cs @@ -16,7 +16,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index 108c8f20de..0720ced625 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -13,7 +13,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index ebd82fb459..2da5be69b2 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -3,9 +3,11 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CalamityMod.DataStructures; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -20,7 +22,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { [LegacyName("BiomeBlade")] - public class BrokenBiomeBlade : ModItem, ILocalizedModType + public class BrokenBiomeBlade : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public Attunement mainAttunement = null; @@ -41,24 +43,12 @@ namespace CalamityMod.Items.Weapons.Melee public static int ColdAttunement_BaseDamage = 40; public static float ColdAttunement_ThirdSwingBoost = 1.15f; - 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 int HotAttunement_BaseDamage = 42; + public static int HotAttunement_ShredPlayerIFrames = 6; + public static int HotAttunement_LocalIFrames = 30; //Be warned its got one extra update so all the iframes should be divided in 2 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; - public static float TropicalAttunement_SweetSpotDamageMultiplier = 1.2f; //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 #endregion - public override void SetStaticDefaults() - { - //Theres potential for flavor text as well but im not a writer - } - public override void ModifyTooltips(List list) { if (list == null) @@ -66,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee SafeCheckAttunements(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -138,7 +128,7 @@ namespace CalamityMod.Items.Weapons.Melee var clone = base.Clone(item); if (Main.mouseItem.type == ItemType()) - item.ModItem?.HoldItem(Main.player[Main.myPlayer]); + item.ModItem?.HoldItem(Main.LocalPlayer); if (clone is BrokenBiomeBlade a && item.ModItem is BrokenBiomeBlade a2) { @@ -169,8 +159,8 @@ namespace CalamityMod.Items.Weapons.Melee int attunement1 = tag.GetInt("mainAttunement"); int attunement2 = tag.GetInt("secondaryAttunement"); - mainAttunement = Attunement.attunementArray[attunement1 != -1 ? attunement1 : Attunement.attunementArray.Length - 1]; - secondaryAttunement = Attunement.attunementArray[attunement2 != -1 ? attunement2 : Attunement.attunementArray.Length - 1]; + mainAttunement = AttunementSystem.FindOrNull(attunement1); + secondaryAttunement = AttunementSystem.FindOrNull(attunement2); if (mainAttunement == secondaryAttunement) secondaryAttunement = null; @@ -180,14 +170,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void NetSend(BinaryWriter writer) { - writer.Write(mainAttunement != null ? (byte)mainAttunement.id : Attunement.attunementArray.Length - 1); - writer.Write(secondaryAttunement != null ? (byte)secondaryAttunement.id : Attunement.attunementArray.Length - 1); + writer.Write(mainAttunement != null ? (byte)mainAttunement.id : AttunementSystem.EmptyID); + writer.Write(secondaryAttunement != null ? (byte)secondaryAttunement.id : AttunementSystem.EmptyID); } public override void NetReceive(BinaryReader reader) { - mainAttunement = Attunement.attunementArray[reader.ReadInt32()]; - secondaryAttunement = Attunement.attunementArray[reader.ReadInt32()]; + mainAttunement = AttunementSystem.FindOrNull(reader.ReadInt32()); + secondaryAttunement = AttunementSystem.FindOrNull(reader.ReadInt32()); } #endregion @@ -199,10 +189,24 @@ namespace CalamityMod.Items.Weapons.Melee public void SafeCheckAttunements() { if (mainAttunement != null) - mainAttunement = Attunement.attunementArray[(int)MathHelper.Clamp((float)mainAttunement.id, (float)AttunementID.Default, (float)AttunementID.Evil)]; + mainAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)mainAttunement.id)); if (secondaryAttunement != null) - secondaryAttunement = Attunement.attunementArray[(int)MathHelper.Clamp((float)secondaryAttunement.id, (float)AttunementID.Default, (float)AttunementID.Evil)]; + secondaryAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)secondaryAttunement.id)); + + if (mainAttunement == secondaryAttunement) + secondaryAttunement = null; + } + + private static int ClampAttunementRange(int input) + { + if (input < (int)AttunementID.Default) + return (int)AttunementID.Default; + + if (input > (int)AttunementID.Evil) + return (int)AttunementID.Evil; + + return input; } public override void HoldItem(Player player) @@ -262,7 +266,6 @@ namespace CalamityMod.Items.Weapons.Melee 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())); } @@ -287,8 +290,8 @@ namespace CalamityMod.Items.Weapons.Melee public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D itemTexture = TextureAssets.Item[Item.type].Value; - Rectangle itemFrame = (Main.itemAnimations[Item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[Item.type].GetFrame(itemTexture); + Texture2D itemTexture = TextureAssets.Item[Type].Value; + Rectangle itemFrame = (Main.itemAnimations[Type] == null) ? itemTexture.Frame() : Main.itemAnimations[Type].GetFrame(itemTexture); if (mainAttunement == null) return true; diff --git a/Items/Weapons/Melee/BurningRevelation.cs b/Items/Weapons/Melee/BurningRevelation.cs index 85c2b4d6e8..b4523d58ba 100644 --- a/Items/Weapons/Melee/BurningRevelation.cs +++ b/Items/Weapons/Melee/BurningRevelation.cs @@ -1,7 +1,12 @@ using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { @@ -9,11 +14,16 @@ namespace CalamityMod.Items.Weapons.Melee public class BurningRevelation : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 680f; + public static float Speed = 54f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() @@ -21,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 40; Item.height = 38; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 120; + Item.damage = 300; Item.knockBack = 7.5f; Item.useTime = 20; Item.useAnimation = 20; @@ -39,5 +49,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } + 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/Melee/BurningRevelation.png b/Items/Weapons/Melee/BurningRevelation.png index 96bcbf2574..43251fe869 100644 Binary files a/Items/Weapons/Melee/BurningRevelation.png and b/Items/Weapons/Melee/BurningRevelation.png differ diff --git a/Items/Weapons/Melee/BurningRevelationGlow.png b/Items/Weapons/Melee/BurningRevelationGlow.png new file mode 100644 index 0000000000..3b42554476 Binary files /dev/null and b/Items/Weapons/Melee/BurningRevelationGlow.png differ diff --git a/Items/Weapons/Melee/Carnage.cs b/Items/Weapons/Melee/Carnage.cs index f1831a2ad1..97b34b6923 100644 --- a/Items/Weapons/Melee/Carnage.cs +++ b/Items/Weapons/Melee/Carnage.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -37,6 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee // Carnage's on-hits only occur on valid enemies. Specifically won't trigger on statues. public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 120); if (target.life > 0 || !target.IsAnEnemy(false)) return; OnHitEffects(player, target, hit.Knockback); diff --git a/Items/Weapons/Melee/CatastropheClaymore.cs b/Items/Weapons/Melee/CatastropheClaymore.cs deleted file mode 100644 index 035899da48..0000000000 --- a/Items/Weapons/Melee/CatastropheClaymore.cs +++ /dev/null @@ -1,77 +0,0 @@ -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class CatastropheClaymore : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "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; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 6.25f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; - Item.rare = ItemRarityID.LightPurple; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 11f; - } - - 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, Main.myPlayer, Main.rand.Next(3)); - 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, DustID.PinkFairy); - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - if (Main.rand.NextBool(3)) - { - target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(BuffID.OnFire3, 180); - target.AddBuff(BuffID.Frostburn2, 120); - } - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - if (Main.rand.NextBool(3)) - { - target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(BuffID.OnFire3, 180); - target.AddBuff(BuffID.Frostburn2, 120); - } - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.HallowedBar, 10). - AddRecipeGroup("CursedFlameIchor", 5). - AddIngredient(ItemID.SoulofFright, 3). - AddIngredient(ItemID.SoulofMight, 3). - AddIngredient(ItemID.SoulofSight, 3). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/CatastropheClaymore.png b/Items/Weapons/Melee/CatastropheClaymore.png deleted file mode 100644 index ecb1ecad4f..0000000000 Binary files a/Items/Weapons/Melee/CatastropheClaymore.png and /dev/null differ diff --git a/Items/Weapons/Melee/CelestialClaymore.cs b/Items/Weapons/Melee/CelestialClaymore.cs index 7272201e97..be2b5e936f 100644 --- a/Items/Weapons/Melee/CelestialClaymore.cs +++ b/Items/Weapons/Melee/CelestialClaymore.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 80; Item.height = 82; - Item.damage = 59; + Item.damage = 50; Item.DamageType = DamageClass.Melee; Item.useAnimation = 24; Item.useTime = 24; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0.1f; } @@ -36,14 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee 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 + Main.screenHeight + Main.mouseY + realPlayerPos.Y; - } - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = player.direction; - mouseYDist = 0f; - } Vector2 realPositionOrig = realPlayerPos; mouseXDist *= 0.8f; @@ -52,25 +45,10 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = 0; i < 2; i++) { realPlayerPos = realPositionOrig; - realPlayerPos.X += Main.rand.Next(-100, 101); - realPlayerPos.Y += Main.rand.Next(-100, 101); + realPlayerPos.X += Main.rand.Next(-75, 76); + realPlayerPos.Y += Main.rand.Next(-75, 76); realPlayerPos += new Vector2(mouseXDist, mouseYDist); - - switch (Main.rand.Next(3)) - { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ModContent.ProjectileType(); - break; - case 2: - type = ModContent.ProjectileType(); - break; - default: - break; - } - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, 0f, 0f, type, (int)(damage * 0.8), knockback, player.whoAmI, 0f, (float)Main.rand.Next(3)); + Projectile.NewProjectile(source, realPlayerPos, Vector2.Zero, type, damage, knockback, player.whoAmI, Main.rand.Next(3)); } return false; } @@ -79,20 +57,20 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(4)) { - int dustType = Main.rand.Next(2); - if (dustType == 0) + int dustType = -1; + switch (Main.rand.Next(3)) { - dustType = 15; + case 0: + dustType = DustID.MagicMirror; + break; + case 1: + dustType = DustID.PinkFairy; + break; + case 2: + dustType = DustID.CopperCoin; + break; } - else if (dustType == 1) - { - dustType = 73; - } - else - { - dustType = 244; - } - int swingDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, dustType, (float)(player.direction * 2), 0f, 150, default, 1.3f); + int swingDust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType, player.direction * 2, 0f, 150, default, 1.3f); Main.dust[swingDust].velocity *= 0.2f; } } diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index 2715110fdf..31455c4fe4 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -1,98 +1,53 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Items.BaseItems; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class CometQuasher : ModItem, ILocalizedModType + public class CometQuasher : CustomUseProjItem, 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.damage = 134; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 22; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 22; - Item.useTurn = true; - Item.knockBack = 7.75f; - Item.UseSound = SoundID.Item1; + Item.width = 92; + Item.height = 94; + Item.damage = 35; + + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = Item.useTime = 38; + + Item.knockBack = 2.75f; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.shootSpeed = ShootSpeed; - } + Item.useTurn = true; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + } + public override bool MeleePrefix() => true; + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 destination = target.Center; - Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); - Vector2 cachedPosition = position; - - 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++) - { - 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; - } + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/CometQuasherGlow").Value); } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - Vector2 destination = target.Center; - Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); - Vector2 cachedPosition = position; - - 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++) - { - 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; - } - } - - 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, Main.rand.NextBool() ? DustID.Torch : (int)CalamityDusts.Ectoplasm, 0f, 0f, 0, default, Main.rand.NextFloat(1.5f, 2.5f)); - Main.dust[dust].noGravity = true; - } - } - public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.MeteoriteBar, 25). - AddIngredient(ItemID.Ectoplasm, 5). - AddTile(TileID.MythrilAnvil). + AddIngredient(ItemID.MeteoriteBar, 20). + AddIngredient(4). + AddIngredient(12). + AddIngredient(ItemID.FallenStar, 5). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Melee/CometQuasher.png b/Items/Weapons/Melee/CometQuasher.png index 873c0c2f6c..129b7238a4 100644 Binary files a/Items/Weapons/Melee/CometQuasher.png and b/Items/Weapons/Melee/CometQuasher.png differ diff --git a/Items/Weapons/Melee/CometQuasherGlow.png b/Items/Weapons/Melee/CometQuasherGlow.png new file mode 100644 index 0000000000..201e99559d Binary files /dev/null and b/Items/Weapons/Melee/CometQuasherGlow.png differ diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index 5e0f2ae32c..f27421e8d2 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -36,7 +36,7 @@ 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 ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3); return false; } } diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index 12654f8efb..4452ea6789 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -37,13 +37,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) { float ai3 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; //0.5 - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3); return false; } public override void AddRecipes() { CreateRecipe(). + AddIngredient(). AddIngredient(8). AddIngredient(3). AddIngredient(16). diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 9fc987e810..62b7bcfe59 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -50,6 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee else position += offset; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction 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); @@ -59,14 +60,6 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(Main.rand.NextBool() ? BuffID.Frostburn2 : BuffID.ShadowFlame, 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(Main.rand.NextBool() ? BuffID.Frostburn2 : BuffID.ShadowFlame, 240); diff --git a/Items/Weapons/Melee/DeathsAscension.cs b/Items/Weapons/Melee/DeathsAscension.cs index f22376f9da..a71bc50700 100644 --- a/Items/Weapons/Melee/DeathsAscension.cs +++ b/Items/Weapons/Melee/DeathsAscension.cs @@ -12,9 +12,21 @@ namespace CalamityMod.Items.Weapons.Melee public class DeathsAscension : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public const int RiftLifeTime = 600; + + public const float OrbitalScytheDamageMult = 0.4f; + + public const float RiftScytheDamageMult = 0.125f; + + public const int RiftOrbitalAmount = 4; + + public const int ScytheShotAmount = 4; + + public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -23,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 70; Item.damage = 1200; Item.knockBack = 9f; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.channel = true; @@ -80,27 +92,39 @@ namespace CalamityMod.Items.Weapons.Melee int spreadfactor = 9; if (player.altFunctionUse == 2f) { - for (int index = 0; index < 4; ++index) + for (int index = 0; index < ScytheShotAmount; ++index) { float SpeedX = velocity.X + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); float SpeedY = velocity.Y + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.125f), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.125f), knockback, player.whoAmI); + } + + // Tell the rift(s) to shoot + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && p.owner == player.whoAmI && p.ai[0] <= 0) + p.ai[0] = 10f; // Cooldown before scythes can be shot again because right click code is cool and shoots twice without this } } else { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } return false; } + + public override void UseItemFrame(Player player) + { + player.itemLocation = (Vector2)player.HandPosition; + } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.DeathSickle). AddIngredient(4). - AddIngredient(). AddIngredient(ItemID.SoulofNight, 15). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Devastation.cs b/Items/Weapons/Melee/Devastation.cs deleted file mode 100644 index e6179dfa09..0000000000 --- a/Items/Weapons/Melee/Devastation.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class Devastation : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetStaticDefaults() - { - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 11)); - ItemID.Sets.AnimatesAsSoul[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 72; - Item.height = 72; - Item.damage = 132; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 24; - Item.useTime = 24; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 4.25f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - switch (Main.rand.Next(6)) - { - case 1: - type = ModContent.ProjectileType(); - break; - case 2: - type = ModContent.ProjectileType(); - break; - case 3: - type = ModContent.ProjectileType(); - break; - default: - break; - } - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, Main.myPlayer); - 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; - 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; - } - - for (int i = 0; i < 4; 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; - 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; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist + (float)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), damage / 2, knockback, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), damage / 2, knockback, player.whoAmI, 0f, (float)Main.rand.Next(3)); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), damage / 2, knockback, player.whoAmI, 0f, (float)Main.rand.Next(1)); - } - 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, DustID.PinkFairy); - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(BuffID.OnFire3, 180); - target.AddBuff(BuffID.Frostburn2, 120); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(BuffID.OnFire3, 180); - target.AddBuff(BuffID.Frostburn2, 120); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.LunarBar, 5). - AddIngredient(10). - AddIngredient(ItemID.MeteoriteBar, 10). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/Devastation.png b/Items/Weapons/Melee/Devastation.png deleted file mode 100644 index 59d0697df8..0000000000 Binary files a/Items/Weapons/Melee/Devastation.png and /dev/null differ diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index f92adf52cc..8e6627d650 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -1,7 +1,11 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -13,155 +17,80 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class DevilsDevastation : ModItem, ILocalizedModType + public class DevilsDevastation : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public int throwCount = 0; public override void SetDefaults() { Item.width = 118; Item.height = 118; - Item.damage = 166; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 20; - Item.useTime = 20; + + Item.damage = 235; + Item.useAnimation = Item.useTime = 45; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.shoot = ModContent.ProjectileType(); Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 6.75f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 7.5f; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.UseSound = null; Item.autoReuse = true; + Item.channel = true; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 28f; Item.rare = ModContent.RarityType(); } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source2, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override bool MeleePrefix() => true; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 41; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && !player.Calamity().mouseRight; + public override void HoldItem(Player player) { - //Shoot 3 oathblades in a spread - int index = 8; - for (int j = -index; j <= index; j += index) + player.Calamity().mouseWorldListener = true; + if (player.Calamity().mouseRight && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) { - Vector2 perturbedSpeed = new Vector2(velocity.X, velocity.Y).RotatedBy(MathHelper.ToRadians(j)); - Projectile.NewProjectile(source2, position, perturbedSpeed, type, damage, knockback, player.whoAmI); - } + SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); + SoundEngine.PlaySound(buff with { Volume = 0.95f }, player.Center); - //Not actually sure what this middle code does - float speed = Item.shootSpeed; - Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); - float directionX = (float)Main.mouseX + Main.screenPosition.X - source.X; - float directionY = (float)Main.mouseY + Main.screenPosition.Y - source.Y; - if (player.gravDir == -1f) - { - directionY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - source.Y; - } - Vector2 direction = new Vector2(directionX, directionY); - float aimDist = direction.Length(); - if ((float.IsNaN(direction.X) && float.IsNaN(direction.Y)) || (direction.X == 0f && direction.Y == 0f)) - { - direction.X = (float)player.direction; - direction.Y = 0f; - aimDist = speed; - } - else - { - aimDist = speed / aimDist; - } + for (int i = 0; i < 10; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 6.5f; + Particle spark2 = new CustomSpark(player.Center + vel * 14, -vel * 0.1f, "CalamityMod/Particles/DemonSigilParticle", false, 22, 0.6f, (i % 2 == 0 ? Color.MediumOrchid : Color.BlueViolet) * 0.7f, new Vector2(1, 1), true, false, 0, false, false, -0.23f); + GeneralParticleHandler.SpawnParticle(spark2); - //Shoot 9 tridents from below - int projAmt = 3; //Since the method spawns 3 projectiles, it spawns 9 total - for (int projIndex = 0; projIndex < projAmt; projIndex++) - { - source = 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); - source.X = (source.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - source.Y += (float)(100 * projIndex); - direction.X = (float)Main.mouseX + Main.screenPosition.X - source.X; - direction.Y = (float)Main.mouseY + Main.screenPosition.Y - source.Y; - if (direction.Y < 0f) - { - direction.Y *= -1f; + Dust c = Dust.NewDustPerfect(player.Center, ModContent.DustType()); + c.velocity = vel; + c.scale = 1.7f; + c.noGravity = true; + c.color = (i % 2 != 0 ? Color.MediumOrchid : Color.BlueViolet); + c.noLightEmittence = true; } - if (direction.Y < 20f) - { - direction.Y = 20f; - } - aimDist = direction.Length(); - aimDist = speed / aimDist; - direction.X *= aimDist; - direction.Y *= aimDist; - direction.X += Main.rand.NextFloat(-40f, 40f) * 0.02f; - direction.Y += Main.rand.NextFloat(-40f, 40f) * 0.02f; - direction.Y *= -1; - Projectile.NewProjectile(source2, source, direction, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, Main.rand.Next(5)); - Projectile.NewProjectile(source2, source, direction, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, Main.rand.Next(3)); - Projectile.NewProjectile(source2, source, direction, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); + + player.Calamity().demonSwordKillMode = true; + + int cooldownTime = KillMode.cooldownMax + KillMode.buffMax; + player.Calamity().killModeCooldown = cooldownTime; + player.AddCooldown(KillMode.ID, cooldownTime); } + if (player.Calamity().demonSwordKillMode && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.Calamity().killModeCooldown == KillMode.cooldownMax + KillMode.buffMax) + { + Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 30, Item.knockBack, player.whoAmI, 0, throwCount); + } + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + throwCount++; + int useSpeed = (int)MathHelper.Clamp((Item.useTime / 2.8f), 1, 100); + Projectile blade = Projectile.NewProjectileDirect(source, player.MountedCenter, velocity, type, damage, knockback, player.whoAmI, 0, throwCount); + blade.localAI[2] = useSpeed; + blade.timeLeft += useSpeed; 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, DustID.ShadowbeamStaff); - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.ShadowFlame, 150); - target.AddBuff(ModContent.BuffType(), 300); - if (hit.Crit) - { - target.AddBuff(BuffID.ShadowFlame, 450); - target.AddBuff(ModContent.BuffType(), 900); - player.ApplyDamageToNPC(target, Item.damage * 4, 0f, 0, false); - float firstDustScale = 1.7f; - float secondDustScale = 0.8f; - float thirdDustScale = 2f; - Vector2 dustRotation = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); - Vector2 dustVelocity = dustRotation * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - for (int i = 0; i < 40; i++) - { - 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, 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; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - } - for (int j = 0; j < 20; j++) - { - 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; - dust.velocity.Y -= 1.5f; - dust.velocity *= 0.5f; - dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); - } - } - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 450); - target.AddBuff(ModContent.BuffType(), 900); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - } - public override void AddRecipes() { CreateRecipe(). - AddIngredient(). AddIngredient(). AddIngredient(8). AddIngredient(20). diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index c2fb16337e..0706ed19c2 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -1,9 +1,8 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Crags; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,14 +16,14 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 66; Item.height = 66; + Item.damage = 420; Item.DamageType = DamageClass.MeleeNoSpeed; + Item.useAnimation = 25; + Item.useTime = 5; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; - Item.damage = 420; Item.knockBack = 4f; - Item.useAnimation = 25; - Item.useTime = 5; Item.autoReuse = false; Item.useStyle = ItemUseStyleID.Shoot; @@ -38,20 +37,20 @@ 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 += 10; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + // You can't use the sword if you've thrown it, silly + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + public override void HoldItem(Player player) { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - return false; + player.Calamity().mouseWorldListener = true; + player.Calamity().rightClickListener = true; } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.Terragrim). - AddIngredient(10). AddIngredient(25). + AddIngredient(10). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/DiseasedPike.cs b/Items/Weapons/Melee/DiseasedPike.cs deleted file mode 100644 index 343abf21ac..0000000000 --- a/Items/Weapons/Melee/DiseasedPike.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Projectiles.Melee.Spears; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class DiseasedPike : 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 = 62; - Item.height = 58; - Item.damage = 65; - Item.DamageType = TrueMeleeDamageClass.Instance; - Item.noMelee = true; - Item.useTurn = true; - Item.noUseGraphic = true; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 20; - Item.knockBack = 8.5f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - } -} diff --git a/Items/Weapons/Melee/DiseasedPike.png b/Items/Weapons/Melee/DiseasedPike.png deleted file mode 100644 index 3d1dbc1a4a..0000000000 Binary files a/Items/Weapons/Melee/DiseasedPike.png and /dev/null differ diff --git a/Items/Weapons/Melee/DraconicDestruction.cs b/Items/Weapons/Melee/DraconicDestruction.cs index 7794866eb5..7a99bb4606 100644 --- a/Items/Weapons/Melee/DraconicDestruction.cs +++ b/Items/Weapons/Melee/DraconicDestruction.cs @@ -50,9 +50,9 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(5). - AddIngredient(3). - AddIngredient(3). AddIngredient(ItemID.FragmentSolar, 10). + AddIngredient(3). + AddIngredient(3). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index a5a7a08866..9b2ca8504b 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -53,8 +53,8 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.Flairon). AddIngredient(). AddIngredient(). - AddIngredient(4). AddIngredient(5). + AddIngredient(4). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/DriftwoodSword.cs b/Items/Weapons/Melee/DriftwoodSword.cs index 57f1ca8924..92ea5b1ac9 100644 --- a/Items/Weapons/Melee/DriftwoodSword.cs +++ b/Items/Weapons/Melee/DriftwoodSword.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee public class DriftwoodSword : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.damage = 14; @@ -24,24 +25,17 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; } + public override void MeleeEffects(Player player, Rectangle hitbox) { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); - if (GetEffects) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160); - Item.useTime = 12; - Item.useAnimation = 12; - Item.knockBack = 5.5f; - } - else - { - Item.useTime = 20; - Item.useAnimation = 20; - Item.knockBack = 4f; - } + if (IsPlayerInContactWithWater(player)) + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160); } + + public override float UseSpeedMultiplier(Player player) => IsPlayerInContactWithWater(player) ? 1.66f : 1f; + + public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback.Base += IsPlayerInContactWithWater(player) ? 1.5f : 0f; + public override void AddRecipes() { CreateRecipe(). @@ -49,5 +43,11 @@ namespace CalamityMod.Items.Weapons.Melee AddTile(TileID.WorkBenches). Register(); } + + private static bool IsPlayerInContactWithWater(Player player) + { + bool surface = player.Center.Y < Main.worldSurface * 16.0; + return (Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet); + } } } diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index c1aa6c32fb..ad209469b3 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.width = 164; - Item.height = 164; - Item.damage = 1980; + Item.width = 186; + Item.height = 186; + Item.damage = 5684; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useAnimation = 38; - Item.useTime = 38; + Item.useAnimation = 42; + Item.useTime = 42; Item.useTurn = true; Item.knockBack = 15f; Item.autoReuse = true; @@ -65,8 +65,9 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(5). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/Earth.png b/Items/Weapons/Melee/Earth.png index 290dc67176..13b2db7230 100644 Binary files a/Items/Weapons/Melee/Earth.png and b/Items/Weapons/Melee/Earth.png differ diff --git a/Items/Weapons/Melee/EarthGlow.png b/Items/Weapons/Melee/EarthGlow.png index 00c632f373..a26f95cabb 100644 Binary files a/Items/Weapons/Melee/EarthGlow.png and b/Items/Weapons/Melee/EarthGlow.png differ diff --git a/Items/Weapons/Melee/EarthenPike.cs b/Items/Weapons/Melee/EarthenPike.cs index 279a1f99a0..7db0bd93f5 100644 --- a/Items/Weapons/Melee/EarthenPike.cs +++ b/Items/Weapons/Melee/EarthenPike.cs @@ -10,14 +10,14 @@ 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[Type] = true; } public override void SetDefaults() { Item.width = 60; Item.height = 60; - Item.damage = 90; + Item.damage = 85; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index 4081665059..285c560887 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 18; Item.height = 20; - Item.damage = 230; + Item.damage = 130; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons.Melee knifeSpawnYPos *= mouseDistance; float x4 = realPlayerPos.X; float y4 = realPlayerPos.Y; - Projectile.NewProjectile(source, x4, y4, knifeSpawnXPos, knifeSpawnYPos, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, x4, y4, knifeSpawnXPos, knifeSpawnYPos, type, damage, knockback, player.whoAmI); } return false; } @@ -97,9 +97,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.VampireKnives). AddIngredient(). - AddIngredient(8). - AddIngredient(8). - AddTile(). + AddIngredient(3). + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index ea2efddce5..125028b0c0 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -1,9 +1,9 @@ -using System; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using Steamworks; +using System; +using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 130; Item.height = 130; - Item.damage = 96; + Item.damage = 110; Item.DamageType = DamageClass.Melee; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; @@ -38,21 +38,23 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 12f; } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + /*public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { - //int hitX = (int)(player.itemLocation + (swingRotation + MathHelper.ToRadians(90f)).ToRotationVector2() * 90).X; - //int hitY = (int)(player.itemLocation + (swingRotation + MathHelper.ToRadians(90f)).ToRotationVector2() * 90).Y; - //hitbox = new Rectangle(hitX, hitY, Item.width / 3, Item.height / 3); + int hitX = (int)(player.itemLocation + (swingRotation + MathHelper.ToRadians(90f)).ToRotationVector2() * 90).X; + int hitY = (int)(player.itemLocation + (swingRotation + MathHelper.ToRadians(90f)).ToRotationVector2() * 90).Y; + hitbox = new Rectangle(hitX, hitY, Item.width / 3, Item.height / 3); - //Particle spark2 = new GlowOrbParticle(new Vector2(hitX, hitY), Vector2.Zero, false, 5, 1, Color.Red); - //GeneralParticleHandler.SpawnParticle(spark2); - } + Particle spark2 = new GlowOrbParticle(new Vector2(hitX, hitY), Vector2.Zero, false, 5, 1, Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); + }*/ + + public override void ModifyTooltips(List tooltips) => tooltips.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); 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 < 6; i++) + for (int i = 0; i < 5; i++) { - Projectile.NewProjectileDirect(source, position, velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.7f, 1.1f), type, damage / 2, knockback * 0.5f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.7f, 1.1f), type, damage / 2, knockback * 0.5f, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/EutrophicScimitar.cs b/Items/Weapons/Melee/EutrophicScimitar.cs deleted file mode 100644 index 156f6b9779..0000000000 --- a/Items/Weapons/Melee/EutrophicScimitar.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class EutrophicScimitar : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetDefaults() - { - 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.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.useTurn = 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 <= 21; i++) - { - Dust dust; - 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; - } - - for (int projectiles = 0; projectiles < 2; projectiles++) - { - float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.7), knockback, player.whoAmI); - } - - return false; - } - } -} diff --git a/Items/Weapons/Melee/EutrophicScimitar.png b/Items/Weapons/Melee/EutrophicScimitar.png deleted file mode 100644 index 19e2e407c2..0000000000 Binary files a/Items/Weapons/Melee/EutrophicScimitar.png and /dev/null differ diff --git a/Items/Weapons/Melee/ExaltedOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs index be2759f775..6dd42db33a 100644 --- a/Items/Weapons/Melee/ExaltedOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -1,7 +1,11 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -12,108 +16,83 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { [LegacyName("TrueForbiddenOathblade")] - public class ExaltedOathblade : ModItem, ILocalizedModType + public class ExaltedOathblade : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Melee"; - - internal const float ShootSpeed = 3f; - + public int throwCount = 0; public override void SetDefaults() { Item.width = 88; Item.height = 88; - Item.damage = 150; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 23; - Item.useTime = 23; + Item.damage = 95; + Item.useAnimation = Item.useTime = 45; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.shoot = ModContent.ProjectileType(); Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 7.5f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 5.5f; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.UseSound = null; Item.autoReuse = true; + Item.channel = true; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = ShootSpeed; } + public override bool MeleePrefix() => true; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 31; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && !player.Calamity().mouseRight; + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + if (player.Calamity().mouseRight && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) + { + SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); + SoundEngine.PlaySound(buff with { Volume = 0.95f }, player.Center); + for (int i = 0; i < 10; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 6.5f; + Particle spark2 = new CustomSpark(player.Center + vel * 14, -vel * 0.1f, "CalamityMod/Particles/DemonSigilParticle", false, 22, 0.6f, (i % 2 == 0 ? Color.MediumOrchid : Color.BlueViolet) * 0.7f, new Vector2(1, 1), true, false, 0, false, false, -0.23f); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust c = Dust.NewDustPerfect(player.Center, ModContent.DustType()); + c.velocity = vel; + c.scale = 1.7f; + c.noGravity = true; + c.color = (i % 2 != 0 ? Color.MediumOrchid : Color.BlueViolet); + c.noLightEmittence = true; + } + + player.Calamity().demonSwordKillMode = true; + + int cooldownTime = KillMode.cooldownMax + KillMode.buffMax; + player.Calamity().killModeCooldown = cooldownTime; + player.AddCooldown(KillMode.ID, cooldownTime); + } + if (player.Calamity().demonSwordKillMode && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.Calamity().killModeCooldown == KillMode.cooldownMax + KillMode.buffMax) + { + Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 23, Item.knockBack, player.whoAmI, 0, throwCount); + } + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int index = 8; - 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); - } + throwCount++; + int useSpeed = (int)MathHelper.Clamp((Item.useTime / 2.8f), 1, 100); + Projectile blade = Projectile.NewProjectileDirect(source, player.MountedCenter, velocity, type, damage, knockback, player.whoAmI, 0, throwCount); + blade.localAI[2] = useSpeed; + blade.timeLeft += useSpeed; 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, DustID.ShadowbeamStaff); - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.ShadowFlame, 150); - target.AddBuff(ModContent.BuffType(), 300); - if (hit.Crit) - { - target.AddBuff(BuffID.ShadowFlame, 450); - target.AddBuff(ModContent.BuffType(), 900); - player.ApplyDamageToNPC(target, player.GetWeaponDamage(player.ActiveItem()) * 2, 0f, 0, false); - float firstDustScale = 1.7f; - float secondDustScale = 0.8f; - float thirdDustScale = 2f; - Vector2 dustRotation = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); - Vector2 dustVelocity = dustRotation * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - for (int i = 0; i < 40; i++) - { - 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, 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; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - } - for (int j = 0; j < 20; j++) - { - 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; - dust.velocity.Y -= 1.5f; - dust.velocity *= 0.5f; - dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); - } - } - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 450); - target.AddBuff(ModContent.BuffType(), 900); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(). AddIngredient(ItemID.BrokenHeroSword). AddIngredient(8). - AddIngredient(8). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/Excelsus.cs b/Items/Weapons/Melee/Excelsus.cs index 4aab4c5fdb..8c5022575a 100644 --- a/Items/Weapons/Melee/Excelsus.cs +++ b/Items/Weapons/Melee/Excelsus.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee type = ModContent.ProjectileType(); break; } - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index 3b47ca0784..e13b50b5e5 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -121,8 +121,7 @@ namespace CalamityMod.Items.Weapons.Melee continue; p.timeLeft = LungeCooldown; - p.netUpdate = true; - p.netSpam = 0; + p.ForceNetUpdate(); } } @@ -138,7 +137,7 @@ namespace CalamityMod.Items.Weapons.Melee 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); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request("CalamityMod/Items/Weapons/Melee/ExobladeGlow").Value); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/FallenPaladinsHammer.cs b/Items/Weapons/Melee/FallenPaladinsHammer.cs index 0c43c3267e..3eac1280c0 100644 --- a/Items/Weapons/Melee/FallenPaladinsHammer.cs +++ b/Items/Weapons/Melee/FallenPaladinsHammer.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Melee public class FallenPaladinsHammer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static float Speed = 28.8f; + public static float Speed = 27f; public override void SetDefaults() { diff --git a/Items/Weapons/Melee/FaultLine.cs b/Items/Weapons/Melee/FaultLine.cs index fb99d311a7..17876a8b2a 100644 --- a/Items/Weapons/Melee/FaultLine.cs +++ b/Items/Weapons/Melee/FaultLine.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -10,11 +11,16 @@ namespace CalamityMod.Items.Weapons.Melee public class FaultLine : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 480f; + public static float Speed = 40f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/Floodtide.cs b/Items/Weapons/Melee/Floodtide.cs index cf6602e1e3..67930b7773 100644 --- a/Items/Weapons/Melee/Floodtide.cs +++ b/Items/Weapons/Melee/Floodtide.cs @@ -42,7 +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; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 63d3236843..91545b0bfb 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -1,103 +1,99 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.BaseItems; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Mono.Cecil; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class ForbiddenOathblade : ModItem, ILocalizedModType + public class ForbiddenOathblade : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Melee"; + public int throwCount = 0; public override void SetDefaults() { Item.width = 74; Item.height = 74; - Item.damage = 110; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 55; + Item.damage = 44; + Item.useAnimation = Item.useTime = 50; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.shoot = ModContent.ProjectileType(); Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 6.5f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 4.5f; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.UseSound = null; Item.autoReuse = true; + Item.channel = true; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; } - - public override void MeleeEffects(Player player, Rectangle hitbox) + public override bool MeleePrefix() => true; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 21; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && !player.Calamity().mouseRight; + public override void HoldItem(Player player) { - if (Main.rand.NextBool(3)) - 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) - { - target.AddBuff(BuffID.ShadowFlame, 120); - target.AddBuff(ModContent.BuffType(), 240); - if (hit.Crit) + player.Calamity().mouseWorldListener = true; + if (player.Calamity().mouseRight && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) { - target.AddBuff(BuffID.ShadowFlame, 360); - target.AddBuff(ModContent.BuffType(), 720); - int onHitDamage = player.CalcIntDamage(2 * Item.damage); - player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); - float firstDustScale = 1.7f; - float secondDustScale = 0.8f; - float thirdDustScale = 2f; - Vector2 dustRotation = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 dustVelocity = dustRotation * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - int dustIncr; - for (int i = 0; i < 40; i = dustIncr + 1) + SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); + SoundEngine.PlaySound(buff with { Volume = 0.95f }, player.Center); + + for (int i = 0; i < 10; i++) { - 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, 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; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - dustIncr = i; - } - 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, 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; - dust.velocity.Y -= 1.5f; - dust.velocity *= 0.5f; - dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); - dustIncr = j; + Vector2 vel = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 6.5f; + Particle spark2 = new CustomSpark(player.Center + vel * 14, -vel * 0.1f, "CalamityMod/Particles/DemonSigilParticle", false, 22, 0.6f, (i % 2 == 0 ? Color.MediumOrchid : Color.BlueViolet) * 0.7f, new Vector2(1, 1), true, false, 0, false, false, -0.23f); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust c = Dust.NewDustPerfect(player.Center, ModContent.DustType()); + c.velocity = vel; + c.scale = 1.7f; + c.noGravity = true; + c.color = (i % 2 != 0 ? Color.MediumOrchid : Color.BlueViolet); + c.noLightEmittence = true; } + + player.Calamity().demonSwordKillMode = true; + + int cooldownTime = KillMode.cooldownMax + KillMode.buffMax; + player.Calamity().killModeCooldown = cooldownTime; + player.AddCooldown(KillMode.ID, cooldownTime); + } + if (player.Calamity().demonSwordKillMode && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.Calamity().killModeCooldown == KillMode.cooldownMax + KillMode.buffMax) + { + Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter,Vector2.Zero, ModContent.ProjectileType(), Item.damage * 12, Item.knockBack, player.whoAmI, 0, throwCount); } } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - target.AddBuff(ModContent.BuffType(), 360); - target.AddBuff(ModContent.BuffType(), 720); - SoundEngine.PlaySound(SoundID.Item14, target.Center); + throwCount++; + int useSpeed = (int)MathHelper.Clamp((Item.useTime / 2.8f), 1, 100); + Projectile blade = Projectile.NewProjectileDirect(source, player.MountedCenter, velocity, type, damage, knockback, player.whoAmI, 0, throwCount); + blade.localAI[2] = useSpeed; + blade.timeLeft += useSpeed; + return false; } - public override void AddRecipes() { CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(ItemID.SoulofFright, 5). + AddIngredient(5). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index f2a0223988..d729006844 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -6,6 +6,7 @@ using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -29,45 +30,38 @@ namespace CalamityMod.Items.Weapons.Melee public bool OnHitProc = false; #region stats - public static int BaseDamage = 800; + public static int BaseDamage = 250; - public static int PhoenixAttunement_BaseDamage = 1200; + public static int PhoenixAttunement_BaseDamage = 300; public static int PhoenixAttunement_LocalIFrames = 30; //Remember its got one extra update public static float PhoenixAttunement_BoltDamageReduction = 0.5f; public static float PhoenixAttunement_BoltThrowDamageMultiplier = 1f; public static float PhoenixAttunement_BaseDamageReduction = 0.5f; public static float PhoenixAttunement_FullChargeDamageBoost = 2.1f; public static float PhoenixAttunement_ThrowDamageBoost = 3.2f; + public static int PhoenixAttunement_FlamePillarLocalIFrames = 10; - public static int PolarisAttunement_BaseDamage = 1800; - public static int PolarisAttunement_FullChargeDamage = 3600; + public static int PolarisAttunement_BaseDamage = 400; + public static int PolarisAttunement_FullChargeDamage = 630; public static int PolarisAttunement_ShredIFrames = 10; public static int PolarisAttunement_LocalIFrames = 30; //Be warned its got one extra update so all the iframes should be divided in 2 public static int PolarisAttunement_LocalIFramesCharged = 16; public static float PolarisAttunement_SlashDamageBoost = 6f; //Keep in mind the slice always crits - public static int PolarisAttunement_SlashBoltsDamage = 1300; public static int PolarisAttunement_SlashIFrames = 20; public static float PolarisAttunement_ShotDamageBoost = 0.8f; //The shots fired if the dash connects - public static float PolarisAttunement_ShredChargeupGain = 1f; //How much charge is gainted per second. + public static float PolarisAttunement_ShredChargeupGain = 1f; //How much charge is gained per second. - public static int AndromedaAttunement_BaseDamage = 2800; + public static int AndromedaAttunement_BaseDamage = 1120; public static int AndromedaAttunement_DashHitIFrames = 20; - public static float AndromedaAttunement_FullChargeBoost = 6f; //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 AndromedaAttunement_MonolithDamageBoost = 1.2f; - public static float AndromedaAttunement_BoltsDamageReduction = 0.2f; //The shots fired as it charges + public static float AndromedaAttunement_FullChargeMult = 3.5f; //The maxmimum damage multiplier of the lunge. Note that the lunge always crits. + public static float AndromedaAttunement_StarDamageMultiplier = 1f; + public static float AndromedaAttunement_ChargeupBoltDamageMultiplier = 0.2f; //Damage of shots fired as it charges - public static int AriesAttunement_BaseDamage = 1325; + public static int AriesAttunement_BaseDamage = 375; public static int AriesAttunement_LocalIFrames = 10; public static int AriesAttunement_Reach = 650; public static float AriesAttunement_ChainDamageReduction = 0.2f; public static float AriesAttunement_OnHitBoltDamageReduction = 0.5f; - - public static int CancerPassiveDamage = 3000; - public static int CancerPassiveLifeSteal = 3; - public static float CancerPassiveLifeStealProc = 0.4f; - public static int CapricornPassiveDebuffTime = 200; - - #endregion public override string Texture => "CalamityMod/Items/Weapons/Melee/Galaxia"; //Base sprite for stuff like item browser and shit. yeah @@ -81,14 +75,12 @@ namespace CalamityMod.Items.Weapons.Melee SafeCheckAttunements(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; var effectDescTooltip = list.FirstOrDefault(x => x.Text.Contains("[FUNC]") && x.Mod == "Terraria"); - var passiveDescTooltip = list.FirstOrDefault(x => x.Text.Contains("[PASS]") && x.Mod == "Terraria"); var mainAttunementTooltip = list.FirstOrDefault(x => x.Text.Contains("[ATT]") && x.Mod == "Terraria"); - var blessingTooltip = list.FirstOrDefault(x => x.Text.Contains("[BLE]") && x.Mod == "Terraria"); //Default stuff gets skipped here. MainAttunement is set to true in SafeCheckAttunements() above @@ -105,23 +97,11 @@ namespace CalamityMod.Items.Weapons.Melee effectDescTooltip.OverrideColor = mainAttunement.tooltipColor; } - if (passiveDescTooltip != null) - { - passiveDescTooltip.Text = mainAttunement.PassiveDesc.ToString(); - passiveDescTooltip.OverrideColor = mainAttunement.tooltipPassiveColor; - } - if (mainAttunementTooltip != null) { mainAttunementTooltip.Text = mainAttunementTooltip.Text.Replace("ATT", mainAttunement.AttunementName.ToString()); mainAttunementTooltip.OverrideColor = Color.Lerp(mainAttunement.tooltipColor, mainAttunement.tooltipColor2, 0.5f + (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.5f); } - - if (blessingTooltip != null) - { - blessingTooltip.Text = blessingTooltip.Text.Replace("BLE", mainAttunement.PassiveName.ToString()); - blessingTooltip.OverrideColor = mainAttunement.tooltipPassiveColor; - } } #endregion @@ -137,10 +117,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = RarityType(); Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 24f; - Item.rare = RarityType(); Item.reuseDelay = 30; } @@ -149,7 +129,7 @@ namespace CalamityMod.Items.Weapons.Melee { var clone = base.Clone(item); if (Main.mouseItem.type == ItemType()) - item.ModItem?.HoldItem(Main.player[Main.myPlayer]); + item.ModItem?.HoldItem(Main.LocalPlayer); if (clone is FourSeasonsGalaxia a && item.ModItem is FourSeasonsGalaxia a2) a.mainAttunement = a2.mainAttunement; @@ -167,17 +147,17 @@ namespace CalamityMod.Items.Weapons.Melee { int attunement1 = tag.GetInt("mainAttunement"); - mainAttunement = Attunement.attunementArray[attunement1 != -1 ? attunement1 : Attunement.attunementArray.Length - 1]; + mainAttunement = AttunementSystem.FindOrNull(attunement1); } public override void NetSend(BinaryWriter writer) { - writer.Write(mainAttunement != null ? (byte)mainAttunement.id : Attunement.attunementArray.Length - 1); + writer.Write(mainAttunement != null ? (byte)mainAttunement.id : AttunementSystem.EmptyID); } public override void NetReceive(BinaryReader reader) { - mainAttunement = Attunement.attunementArray[reader.ReadInt32()]; + mainAttunement = AttunementSystem.FindOrNull(reader.ReadInt32()); } #endregion @@ -201,10 +181,21 @@ namespace CalamityMod.Items.Weapons.Melee public void SafeCheckAttunements() { if (mainAttunement == null) - mainAttunement = Attunement.attunementArray[(int)AttunementID.Phoenix]; + mainAttunement = AttunementSystem.FindOrNull(AttunementID.Phoenix); else - mainAttunement = Attunement.attunementArray[(int)MathHelper.Clamp((float)mainAttunement.id, (float)AttunementID.Phoenix, (float)AttunementID.Andromeda)]; + mainAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)mainAttunement.id)); + } + + private static int ClampAttunementRange(int input) + { + if (input < (int)AttunementID.Phoenix) + return (int)AttunementID.Phoenix; + + if (input > (int)AttunementID.Andromeda) + return (int)AttunementID.Andromeda; + + return input; } public override void HoldItem(Player player) @@ -222,22 +213,15 @@ namespace CalamityMod.Items.Weapons.Melee } SafeCheckAttunements(); - mainAttunement.ApplyStats(Item); - //Passive effects only jappen player side haha - if (player.whoAmI != Main.myPlayer) - return; - - var source = player.GetSource_ItemUse(Item); - mainAttunement.PassiveEffect(player, source, ref UseTimer, ref OnHitProc); - if (player.Calamity().mouseRight && CanUseItem(player) && player.whoAmI == Main.myPlayer && !Main.mapFullscreen) { //Don't shoot out a visual blade if you already have one out if (Main.projectile.Any(n => n.active && n.type == ProjectileType() && n.owner == player.whoAmI)) return; + var source = player.GetSource_ItemUse(Item); Projectile.NewProjectile(source, player.Top, Vector2.Zero, ProjectileType(), 0, 0, player.whoAmI, 0, Math.Sign(player.position.X - Main.MouseWorld.X)); } } @@ -261,7 +245,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { if (mainAttunement == null) - mainAttunement = Attunement.attunementArray[(int)AttunementID.Phoenix]; + mainAttunement = AttunementSystem.FindOrNull(AttunementID.Phoenix); Texture2D itemTexture = Request((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaDusk" : "CalamityMod/Items/Weapons/Melee/GalaxiaDawn").Value; Texture2D outlineTexture = Request((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaDuskOutline" : "CalamityMod/Items/Weapons/Melee/GalaxiaDawnOutline").Value; @@ -285,7 +269,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { if (mainAttunement == null) - mainAttunement = Attunement.attunementArray[(int)AttunementID.Phoenix]; + mainAttunement = AttunementSystem.FindOrNull(AttunementID.Phoenix); Texture2D itemTexture = Request((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaDusk" : "CalamityMod/Items/Weapons/Melee/GalaxiaDawn").Value; Texture2D outlineTexture = Request((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaDuskOutline" : "CalamityMod/Items/Weapons/Melee/GalaxiaDawnOutline").Value; @@ -310,9 +294,10 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(8). - AddIngredient(8). - AddTile(). + AddIngredient(). + AddIngredient(). + AddIngredient(). + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Weapons/Melee/FracturedArk.cs b/Items/Weapons/Melee/FracturedArk.cs index f7b6845084..bf19a29e79 100644 --- a/Items/Weapons/Melee/FracturedArk.cs +++ b/Items/Weapons/Melee/FracturedArk.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 60; - Item.damage = 35; + Item.damage = 41; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noUseGraphic = true; Item.noMelee = true; diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index c4d9e656db..4d78166bc2 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Melee //NOTE: GetWeaponDamage is in the CalamityPlayer file public override void SetDefaults() { - Item.width = 112; - Item.height = 102; + Item.width = 108; + Item.height = 100; Item.damage = BaseDamage; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 13; @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { var source = player.GetSource_ItemUse(Item); - if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) < 3 && + if (CalamityUtils.CountOwnedProjectiles(ModContent.ProjectileType(), player.whoAmI) < 3 && player.statLife <= player.statLifeMax2 * 0.5f && Main.myPlayer == player.whoAmI) { diff --git a/Items/Weapons/Melee/GaelsGreatsword.png b/Items/Weapons/Melee/GaelsGreatsword.png index 5af2cc305c..246cda9d6c 100644 Binary files a/Items/Weapons/Melee/GaelsGreatsword.png and b/Items/Weapons/Melee/GaelsGreatsword.png differ diff --git a/Items/Weapons/Melee/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index 7d90459230..eeddb62413 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -1,6 +1,9 @@ using System; +using System.Collections.Generic; +using System.Security.Cryptography.X509Certificates; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -8,6 +11,8 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { @@ -15,92 +20,115 @@ namespace CalamityMod.Items.Weapons.Melee public class GalactusBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + private int swordDirection; + public int time = 0; + private float swingRotation = 0; + public Color useColor = Color.White; + public bool spawnProj = true; public override void SetDefaults() { - Item.width = 60; - Item.height = 58; - Item.damage = 84; + Item.width = 144; + Item.height = 146; + Item.damage = 828; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 17; + Item.useAnimation = 27; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 17; + Item.useTime = 27; Item.useTurn = true; - Item.knockBack = 6f; + Item.knockBack = 17f; Item.UseSound = SoundID.Item105; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 23f; + Item.shootSpeed = 13f; + Item.scale = 0.75f; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request(Texture + "Glow").Value); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - 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; - } - - for (int i = 0; i < 5; 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; - 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 speedX4 = mouseXDist + (float)Main.rand.Next(-100, 101) * 0.02f; - float speedY5 = mouseYDist + (float)Main.rand.Next(-100, 101) * 0.02f; - int projectile = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } return false; } - + public override void UseAnimation(Player player) + { + swordDirection = (player.Center - player.Calamity().mouseWorld).X > 1 ? -1 : 1; + time = 0; + swingRotation = 0; + spawnProj = true; + } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(4)) + int swordSize = (int)(33 * Item.scale); + + float rate = Main.GlobalTimeWrappedHourly * 18; + List eColors = new List() { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? 164 : 229); + Color.Gold, + Color.HotPink, + Color.Cyan + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + useColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + player.itemRotation = swingRotation - 1.7f * swordDirection; + player.itemLocation = player.Center; + player.direction = swordDirection; + + float val = MathF.Abs(time - player.itemAnimationMax * 0.75f) / player.itemAnimationMax; + + float goalRot = Utils.Remap(time, 0, player.itemAnimationMax, -0.5f, 5.2f) * swordDirection; + float swingEasing = Utils.GetLerpValue(0, player.itemAnimationMax * 0.4f, time, true) * (0.35f - val); + if (time < player.itemAnimationMax) + { + swingRotation = MathHelper.Lerp(swingRotation, goalRot, swingEasing); } - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, swingRotation + MathHelper.ToRadians(120f * swordDirection)); - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); - } + if (val < 0.4f) + { + if (spawnProj) + { + for (int i = 0; i < 7; i++) + { + Vector2 clampedMouse = player.ClampedMouseWorld(); + Vector2 spawnSpot = new Vector2(clampedMouse.X, player.Center.Y) + new Vector2(Main.rand.NextFloat(-850, 850), Main.rand.NextFloat(-750, -1250)); + Projectile comet = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), spawnSpot, Utils.DirectionTo(spawnSpot, player.Calamity().mouseWorld + Main.rand.NextVector2Circular(50, 50)) * Item.shootSpeed, Item.shoot, Item.damage / 3, Item.knockBack, player.whoAmI); + comet.extraUpdates = Main.rand.Next(2, 3 + 1); + } + spawnProj = false; + } + for (int i = 0; i < 3; i++) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); + float partScale = Main.rand.NextFloat(0.6f, 0.9f); + Vector2 partVel = (dustVel * Main.rand.NextFloat(0.2f, 0.3f)).RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedByRandom(-0.2) * -3; + Vector2 partPos = player.Center + dustVel.RotatedByRandom(0.4f) * swordSize; + + Particle spark2 = new SparkParticle(partPos, partVel, false, 14, partScale * 0.6f, useColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); + + float partScale2 = Main.rand.NextFloat(0.3f, 0.7f); + Vector2 partVel2 = dustVel2 * Main.rand.NextFloat(0.2f, 0.3f); + for (int i = 0; i < 5; i++) + { + Particle smoke2 = new CustomSpark(player.Center + dustVel2 * Main.rand.Next(1, swordSize + 1) + Main.rand.NextVector2Circular(12, 12), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * Main.rand.NextFloat(-1, -10), "CalamityMod/Particles/SmallBloom", false, 12, partScale2 * 0.5f, useColor * 0.4f, Vector2.One, true, false, 3, false, false); + GeneralParticleHandler.SpawnParticle(smoke2); + } + Lighting.AddLight(player.Center + dustVel2, Color.White.ToVector3() * 1.2f); + time++; + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/GalactusBlade.png b/Items/Weapons/Melee/GalactusBlade.png index dfc96e92b1..3e0e245e39 100644 Binary files a/Items/Weapons/Melee/GalactusBlade.png and b/Items/Weapons/Melee/GalactusBlade.png differ diff --git a/Items/Weapons/Melee/GalactusBladeGlow.png b/Items/Weapons/Melee/GalactusBladeGlow.png new file mode 100644 index 0000000000..83d8b7a329 Binary files /dev/null and b/Items/Weapons/Melee/GalactusBladeGlow.png differ diff --git a/Items/Weapons/Melee/GalaxySmasher.cs b/Items/Weapons/Melee/GalaxySmasher.cs index 78c04aef91..4181e6db0e 100644 --- a/Items/Weapons/Melee/GalaxySmasher.cs +++ b/Items/Weapons/Melee/GalaxySmasher.cs @@ -14,18 +14,17 @@ namespace CalamityMod.Items.Weapons.Melee public class GalaxySmasher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static int BaseDamage = 1300; - public static float Speed = 30f; + public static float Speed = 35f; public override void SetDefaults() { Item.width = 86; Item.height = 72; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = BaseDamage; + Item.damage = 1300; Item.knockBack = 14f; - Item.useAnimation = 40; - Item.useTime = 40; + Item.useAnimation = 48; + Item.useTime = 48; Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index 45b27e9071..e278081d7e 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -10,7 +10,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/GoldplumeSpear.cs b/Items/Weapons/Melee/GoldplumeSpear.cs index 4c86273d79..b870ed806a 100644 --- a/Items/Weapons/Melee/GoldplumeSpear.cs +++ b/Items/Weapons/Melee/GoldplumeSpear.cs @@ -11,7 +11,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/GrandDad.cs b/Items/Weapons/Melee/GrandDad.cs index eb665c0e8f..ac5bfb214c 100644 --- a/Items/Weapons/Melee/GrandDad.cs +++ b/Items/Weapons/Melee/GrandDad.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 124; Item.height = 124; - Item.damage = 2777; + Item.damage = 2407; // Feel free to change these 7s as balance requires. The other 7s should stay - Update: no more 2777... :( Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 77; Item.useTime = 77; diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 0889718f66..5691d09fe2 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 130; Item.height = 130; - Item.damage = 204; + Item.damage = 325; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useAnimation = 28; - Item.useTime = 28; + Item.useAnimation = 35; + Item.useTime = 35; Item.useTurn = true; Item.knockBack = 9f; Item.autoReuse = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.FragmentNebula, 6). + AddIngredient(ItemID.FragmentNebula, 12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index b2ded44e87..19486833cb 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -1,31 +1,91 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { public class GreatswordofJudgement : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + private float swingRoatation = 0; + private int time = 0; + private Color mainColor; + private int swordDirection; + private int useTime = 20; + private int opacityAdjust = 0; + private float smearOpacity = 0; public override void SetDefaults() { Item.width = 78; Item.height = 78; - Item.damage = 85; + Item.damage = 155; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; + Item.useAnimation = Item.useTime = useTime; Item.useTurn = true; Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; + Item.UseSound = SoundID.Item60; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 5f; } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + float scale = 1.1f; + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } + public override void UseAnimation(Player player) + { + swordDirection = player.direction; + time = 0; + swingRoatation = 0; + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + opacityAdjust = 0; + smearOpacity = 0; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + opacityAdjust++; + if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f) + smearOpacity += 0.1f; + else if (smearOpacity > 0) + smearOpacity -= 0.2f; + time++; + swingRoatation += swordDirection == 1 ? 0.13f : -0.13f; + + float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation; + if (swordDirection != player.direction) + { + swingRoatation *= -1; + swordDirection = player.direction; + } + Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(1.95f, 2.2f), new Vector2(1, 1), 2, true, false, true, player.direction); + GeneralParticleHandler.SpawnParticle(Smear); + + if (Main.rand.NextBool(3)) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f); + Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); + dust.scale = Main.rand.NextFloat(0.4f, 0.55f); + dust.velocity = dustVel * 0.55f; + dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + dust.noGravity = 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/Melee/GreatswordofJudgementGlow").Value); + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/GreatswordofJudgementGlow.png b/Items/Weapons/Melee/GreatswordofJudgementGlow.png index fde78a59ec..346b28b3a3 100644 Binary files a/Items/Weapons/Melee/GreatswordofJudgementGlow.png and b/Items/Weapons/Melee/GreatswordofJudgementGlow.png differ diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index 836b4b600d..2c7fe3aabe 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee internal const int TotalRows = 2; - internal const int TotalTeeth = 5; + internal const int TotalTeeth = 4; public override void SetDefaults() { @@ -27,25 +28,50 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 62; Item.damage = 87; // IS THAT THE BITE OF '87 Item.DamageType = DamageClass.Melee; - Item.useTime = 31; - Item.useAnimation = 31; + Item.useTime = 27; + Item.useAnimation = 27; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; + Item.shoot = ModContent.ProjectileType(); Item.autoReuse = true; - Item.shootSpeed = ShootSpeed; + Item.shootSpeed = 10; + } + 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) + { + for (int i = 0; i < 2; ++i) + { + Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(-0.1f * (i + 1)).RotatedByRandom(0.06f) * (1 - i * 0.3f), type, (int)(damage * 0.5f), knockback / 3, player.whoAmI, 1f, 0f); + } + for (int i = 0; i < 2; ++i) + { + Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(0.1f * (i + 1)).RotatedByRandom(0.06f) * (1 - i * 0.3f), type, (int)(damage * 0.5f), knockback / 3, player.whoAmI, 1f, 0f); + } + Projectile strongTooth = Projectile.NewProjectileDirect(source, position, velocity * 1.2f, type, (int)(damage), knockback, player.whoAmI, 2f, 0f); + strongTooth.penetrate = -1; + strongTooth.timeLeft = 150; + return false; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for aiming a projectile + NPC target2 = player.Calamity().mouseWorld.ClosestNPCAt(300); + if (target2 == null) + target2 = target; + Vector2 destination = target.Center; - Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); + Vector2 position = new Vector2(target2.Center.X, target2.Center.Y - 350); Vector2 cachedPosition = position; - Vector2 secondPosition = cachedPosition + (Vector2.UnitY * (Main.screenHeight + 160f)); + Vector2 secondPosition = new Vector2(target2.Center.X, target2.Center.Y + 350); Vector2 secondCachedPosition = secondPosition; Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; @@ -53,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 secondVelocity = (destination - secondPosition).SafeNormalize(Vector2.UnitY) * ShootSpeed; Vector2 secondCachedVelocity = secondVelocity; - int teethDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + int teethDamage = player.CalcIntDamage((int)(Item.damage * 0.1f)); float teethKnockback = Item.knockBack * 0.2f; bool evenNumberOfProjectiles = TotalTeeth % 2 == 0; float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; @@ -71,19 +97,19 @@ namespace CalamityMod.Items.Weapons.Melee 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; + position.X += MathHelper.Lerp(-HalvedTeethSpread * 0.3f, HalvedTeethSpread * 0.3f, j / (float)(TotalTeeth - 1)); + velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(position, target2, 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); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity * 0.25f, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target2.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; + secondPosition.X += MathHelper.Lerp(-HalvedTeethSpread * 0.3f, HalvedTeethSpread * 0.3f, j / (float)(TotalTeeth - 1)); + secondVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(secondPosition, target2, 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); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), secondPosition, secondVelocity * 0.25f, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target2.Center.Y); secondPosition = secondCachedPosition; secondVelocity = secondCachedVelocity; } @@ -145,8 +171,9 @@ 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, Main.rand.NextBool() ? 33 : 89); + Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.9f, 1.5f); + if (Main.rand.NextBool(3)) + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 102, dustVel.X, dustVel.Y); } } } diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index bfe5859fd8..089e30c529 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee default: break; } - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * damageMult), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * damageMult), knockback, player.whoAmI); } return false; } @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool(3) ? 16 : 174); } - if (Main.rand.NextBool(5) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(5) && !Main.dedServ) { int smoke = Gore.NewGore(player.GetSource_ItemUse(Item), new Vector2(hitbox.X, hitbox.Y), default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index 0ea8d94c6d..d89110439a 100644 --- a/Items/Weapons/Melee/HellionFlowerSpear.cs +++ b/Items/Weapons/Melee/HellionFlowerSpear.cs @@ -11,7 +11,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 9a42ae4f2e..e3954b3dff 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -1,13 +1,11 @@ using System.Collections.Generic; -using System.Linq; using CalamityMod.Items.BaseItems; -using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,13 +20,14 @@ namespace CalamityMod.Items.Weapons.Melee public static readonly SoundStyle HitSoundBig = new("CalamityMod/Sounds/Item/HellkiteBigHit", 2); public static readonly SoundStyle ChargeSound = new("CalamityMod/Sounds/Item/HellkiteCharge"); public static readonly SoundStyle FullChargeSound = new("CalamityMod/Sounds/Item/HellkiteFullCharge"); + public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; public override void SetDefaults() { Item.width = 124; Item.height = 124; Item.damage = 795; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useTime = Item.useAnimation = 71; + Item.useAnimation = Item.useTime = 71; Item.useTurn = true; Item.knockBack = 13f; Item.autoReuse = true; @@ -41,7 +40,18 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.useStyle = ItemUseStyleID.Shoot; } + public override bool AltFunctionUse(Player player) => true; public override bool MeleePrefix() => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.Calamity().mouseRight) + { + Projectile.NewProjectile(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 5); + } + else + Projectile.NewProjectile(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 0); + 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/HellkiteGlow").Value); diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index cdedd6b888..8829a63b1c 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -1,75 +1,50 @@ -using Microsoft.Xna.Framework; -using System; +using CalamityMod.Items.BaseItems; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +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.Melee { - public class HolyCollider : ModItem, ILocalizedModType + public class HolyCollider : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.width = 94; - Item.height = 80; - Item.damage = 270; + Item.width = 114; + Item.height = 146; + Item.damage = 3140; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 22; + Item.useAnimation = 45; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 22; + Item.useTime = 45; Item.useTurn = true; Item.knockBack = 7.75f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.shootSpeed = 10f; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } - - public override void UseStyle(Player player, Rectangle heldItemFrame) + public override bool MeleePrefix() => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - player.itemLocation += new Vector2(5f * player.direction, 13f * player.gravDir).RotatedBy(player.itemRotation); + Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 5); + return false; } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Item.shootSpeed, Item.shootSpeed) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int holyFireDamage = player.CalcIntDamage(0.3f * Item.damage); - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), holyFireDamage, hit.Knockback, Main.myPlayer); - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), holyFireDamage, hit.Knockback, Main.myPlayer); - } - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Item.shootSpeed, Item.shootSpeed) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int holyFireDamage = player.CalcIntDamage(0.3f * Item.damage); - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), holyFireDamage, Item.knockBack, Main.myPlayer); - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), holyFireDamage, Item.knockBack, Main.myPlayer); - } + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request(Texture + "Glow").Value); } } } diff --git a/Items/Weapons/Melee/HolyColliderGlow.png b/Items/Weapons/Melee/HolyColliderGlow.png new file mode 100644 index 0000000000..67075c1c28 Binary files /dev/null and b/Items/Weapons/Melee/HolyColliderGlow.png differ diff --git a/Items/Weapons/Melee/IllustriousKnives.cs b/Items/Weapons/Melee/IllustriousKnives.cs index 2b39aa7796..4ccb3cde94 100644 --- a/Items/Weapons/Melee/IllustriousKnives.cs +++ b/Items/Weapons/Melee/IllustriousKnives.cs @@ -23,9 +23,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 10; + Item.useAnimation = 8; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 10; + Item.useTime = 8; Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; @@ -40,58 +40,16 @@ 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 knifeSpeed = 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 = knifeSpeed; - } - else - { - mouseDistance = knifeSpeed / mouseDistance; - } - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; int knifeAmt = 4; - if (Main.rand.NextBool()) - { - knifeAmt++; - } - if (Main.rand.NextBool(4)) - { - knifeAmt++; - } - if (Main.rand.NextBool(6)) - { - knifeAmt++; - } - if (Main.rand.NextBool(8)) - { - knifeAmt++; - } + if (Main.rand.NextBool()) knifeAmt++; + if (Main.rand.NextBool(4)) knifeAmt++; + if (Main.rand.NextBool(6)) knifeAmt++; + if (Main.rand.NextBool(8)) knifeAmt++; + for (int i = 0; i < knifeAmt; i++) { - float knifeSpawnXPos = mouseXDist; - float knifeSpawnYPos = mouseYDist; - float randOffsetDampener = 0.05f * (float)i; - knifeSpawnXPos += (float)Main.rand.Next(-35, 36) * randOffsetDampener; - knifeSpawnYPos += (float)Main.rand.Next(-35, 36) * randOffsetDampener; - mouseDistance = (float)Math.Sqrt((double)(knifeSpawnXPos * knifeSpawnXPos + knifeSpawnYPos * knifeSpawnYPos)); - mouseDistance = knifeSpeed / mouseDistance; - knifeSpawnXPos *= mouseDistance; - knifeSpawnYPos *= mouseDistance; - float x4 = realPlayerPos.X; - float y4 = realPlayerPos.Y; - Projectile.NewProjectile(source, x4, y4, knifeSpawnXPos, knifeSpawnYPos, type, damage, knockback, player.whoAmI, 0f, 0f); + Vector2 knifeVel = velocity.RotatedByRandom(MathHelper.Pi / 6f); + Projectile.NewProjectile(source, position, knifeVel, type, damage, knockback, player.whoAmI); } return false; } @@ -100,8 +58,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(2). AddIngredient(5). + AddIngredient(2). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 89be9745df..840223abe1 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -1,7 +1,9 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,21 +17,26 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 66; Item.height = 70; - Item.damage = 198; + Item.damage = 295; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 20; + Item.useAnimation = Item.useTime = 13; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 8f; + Item.knockBack = 12f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 15f; + Item.shootSpeed = 18f; 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) + { + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, 0); + return false; + } } } diff --git a/Items/Weapons/Melee/IridescentExcalibur.cs b/Items/Weapons/Melee/IridescentExcalibur.cs index 457c2521e4..76c749add9 100644 --- a/Items/Weapons/Melee/IridescentExcalibur.cs +++ b/Items/Weapons/Melee/IridescentExcalibur.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index 50d74118be..f0b0564e82 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -6,6 +6,7 @@ using CalamityMod.Rarities; using CalamityMod.World; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -13,11 +14,16 @@ namespace CalamityMod.Items.Weapons.Melee public class Lacerator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 640f; + public static float Speed = 48f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/LifehuntScythe.cs b/Items/Weapons/Melee/LifehuntScythe.cs index 2141d6263b..54c3aaf1e1 100644 --- a/Items/Weapons/Melee/LifehuntScythe.cs +++ b/Items/Weapons/Melee/LifehuntScythe.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Enums; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -44,10 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee int heal = 5; player.lifeSteal -= heal; - player.statLife += heal; - player.HealEffect(heal); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + player.HealPlayer(heal); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) @@ -57,10 +55,7 @@ namespace CalamityMod.Items.Weapons.Melee int heal = 5; player.lifeSteal -= heal; - player.statLife += heal; - player.HealEffect(heal); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + player.HealPlayer(heal); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index 5b06e0992b..0d1e6e1441 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -46,7 +46,7 @@ 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) { if (player.altFunctionUse == 2 && !player.HasCooldown(LionHeartShield.ID) && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index 3d4df9ee9c..e9a0937621 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 58; - Item.height = 58; + Item.width = 54; + Item.height = 54; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/Lucrecia.png b/Items/Weapons/Melee/Lucrecia.png index ed64e31beb..a6656497b1 100644 Binary files a/Items/Weapons/Melee/Lucrecia.png and b/Items/Weapons/Melee/Lucrecia.png differ diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index e87bf0aff6..f61f948bca 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 100; - Item.damage = 295; + Item.damage = 325; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 50; Item.useTime = 50; @@ -43,17 +43,17 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.GoldBroadsword). AddRecipeGroup("AnyMythrilBar", 15). - AddIngredient(3). - AddIngredient(3). AddIngredient(3). + AddIngredient(3). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); CreateRecipe(). AddIngredient(ItemID.PlatinumBroadsword). AddRecipeGroup("AnyMythrilBar", 15). - AddIngredient(3). - AddIngredient(3). AddIngredient(3). + AddIngredient(3). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index f7ff3190cb..e088461822 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -25,20 +25,19 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 20; Item.damage = 111; Item.DamageType = DamageClass.Melee; - Item.useStyle = ItemUseStyleID.HiddenAnimation; - Item.noUseGraphic = true; - Item.useAnimation = 25; - Item.noMelee = true; - Item.useTime = 25; + Item.useAnimation = Item.useTime = 25; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); + + Item.useStyle = ItemUseStyleID.HiddenAnimation; Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; } } diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 68f155fd79..beda17aa01 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,8 +1,6 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -32,12 +30,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); } - 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, 0f, 0f); - return false; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { int conDamage = target.damage + baseDamage; diff --git a/Items/Weapons/Melee/MonolithSword.cs b/Items/Weapons/Melee/MonolithSword.cs index 3af19b0da7..79100057a1 100644 --- a/Items/Weapons/Melee/MonolithSword.cs +++ b/Items/Weapons/Melee/MonolithSword.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -25,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.ArmorPenetration = 15; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { @@ -34,9 +35,12 @@ namespace CalamityMod.Items.Weapons.Melee } public override void UseAnimation(Player player) { - float Rot = (player.direction == -1 ? 5.5f : -5.5f) * Main.rand.NextFloat(0.99f, 1.1f); - Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, (Main.rand.NextBool() ? Color.DarkTurquoise : Color.Coral) * 0.7f, Rot, Main.rand.NextFloat(1.48f, 1.53f), new Vector2(1, 1), 6, true, false, true); - GeneralParticleHandler.SpawnParticle(Smear); + if (player.whoAmI == Main.myPlayer) + { + float Rot = (player.direction == -1 ? 5.5f : -5.5f) * Main.rand.NextFloat(0.99f, 1.1f); + Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, (Main.rand.NextBool() ? Color.DarkTurquoise : Color.Coral) * 0.7f, Rot, Main.rand.NextFloat(1.48f, 1.53f), new Vector2(1, 1), 6, true, false, true); + GeneralParticleHandler.SpawnParticle(Smear); + } } public override void MeleeEffects(Player player, Rectangle hitbox) { diff --git a/Items/Weapons/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index a039ce5e46..c04ecb3315 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Items.Weapons.Melee { float ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 float ai3X = (Main.rand.NextFloat() - 0.25f) * 0.7853982f; //0.5 - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3); - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3X); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3X); return false; } @@ -46,9 +46,9 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.SolarEruption). - AddIngredient(6). - AddIngredient(6). AddIngredient(6). + AddIngredient(6). + AddIngredient(6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 178e3f5df1..aec2123d1a 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -100,11 +100,5 @@ namespace CalamityMod.Items.Weapons.Melee return false; return IDUnlocked(player); } - - 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; - } } } diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index 62ed4826eb..4ba4e5d206 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { - ItemID.Sets.Spears[Item.type] = true; + ItemID.Sets.Spears[Type] = true; } public override void SetDefaults() @@ -48,10 +48,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(5). - AddIngredient(5). AddIngredient(8). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index 8e36c516f2..b6c96a6a50 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -34,7 +34,7 @@ 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 ai3 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; //0.5 - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3); return false; } } diff --git a/Items/Weapons/Melee/Oblivion.cs b/Items/Weapons/Melee/Oblivion.cs index 14b23912fb..33ee8074d6 100644 --- a/Items/Weapons/Melee/Oblivion.cs +++ b/Items/Weapons/Melee/Oblivion.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -9,11 +10,16 @@ namespace CalamityMod.Items.Weapons.Melee public class Oblivion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 512f; + public static float Speed = 36f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/OldLordClaymore.cs b/Items/Weapons/Melee/OldLordClaymore.cs index 21913884b1..8151d67e9f 100644 --- a/Items/Weapons/Melee/OldLordClaymore.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -1,39 +1,37 @@ -using Terraria; +using CalamityMod.Items.BaseItems; +using CalamityMod.Projectiles.Melee; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { [LegacyName("OldLordOathsword")] - public class OldLordClaymore : ModItem, ILocalizedModType + public class OldLordClaymore : CustomUseProjItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Melee"; - public bool RMBchannel = false; public override void SetDefaults() { Item.width = 70; Item.height = 70; - Item.damage = 60; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 34; - Item.useTime = 34; - Item.channel = true; - Item.useStyle = ItemUseStyleID.Swing; + Item.damage = 202; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = Item.useTime = 90; // Yes it's actually supposed to be this slow + + Item.useStyle = ItemUseStyleID.Shoot; + Item.shoot = ModContent.ProjectileType(); Item.useTurn = true; - Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 10f; Item.autoReuse = true; Item.noUseGraphic = true; + Item.noMelee = true; Item.channel = true; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } - - public override bool AltFunctionUse(Player player) => true; - - public override bool? CanHitNPC(Player player, NPC target) => false; - - public override bool CanHitPvp(Player player, Player target) => false; + public override bool MeleePrefix() => true; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 11; } } diff --git a/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index 213198cac8..c41913c66d 100644 --- a/Items/Weapons/Melee/OmegaBiomeBlade.cs +++ b/Items/Weapons/Melee/OmegaBiomeBlade.cs @@ -6,6 +6,7 @@ using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -33,43 +34,41 @@ namespace CalamityMod.Items.Weapons.Melee #region stats public static int BaseDamage = 200; - public static int WhirlwindAttunement_BaseDamage = 140; + public static int WhirlwindAttunement_BaseDamage = 120; public static int WhirlwindAttunement_LocalIFrames = 20; //Remember its got one extra update - public static int WhirlwindAttunement_SigilTime = 1000; - public static float WhirlwindAttunement_BeamDamageReduction = 0.5f; - public static float WhirlwindAttunement_BaseDamageReduction = 0.3f; - public static float WhirlwindAttunement_FullChargeDamageBoost = 0.9f; + public static float WhirlwindAttunement_EnergyDamageMult = 0.5f; + public static float WhirlwindAttunement_BaseSwingDamageMult = 0.4f; + public static float WhirlwindAttunement_FullSwingDamageMult = 1f; public static float WhirlwindAttunement_ThrowDamageBoost = 3.3f; + public static float WhirlwindAttunement_MonolithDamageMult = 0.5f; - public static int WhirlwindAttunement_PassiveBaseDamage = 200; + public static int WhirlwindAttunement_PassiveBaseDamage = 80; - public static int SuperPogoAttunement_BaseDamage = 200; - public static int SuperPogoAttunement_FullChargeDamage = 380; - public static int SuperPogoAttunement_ShredIFrames = 10; - public static int SuperPogoAttunement_LocalIFrames = 30; //Be warned its got one extra update so all the iframes should be divided in 2 - public static int SuperPogoAttunement_LocalIFramesCharged = 16; - public static float SuperPogoAttunement_SlashDamageBoost = 2.5f; //Keep in mind the slice always crits - public static int SuperPogoAttunementSlashLifesteal = 4; - public static int SuperPogoAttunement_SlashIFrames = 20; - public static float SuperPogoAttunement_ShotDamageBoost = 2.5f; + public static int SuperPogoAttunement_BaseDamage = 190; + public static int SuperPogoAttunement_PlayerShredIFrames = 8; + public static int SuperPogoAttunement_LocalIFrames = 24; //Be warned its got one extra update so all the iframes should be divided in 2 + public static float SuperPogoAttunement_ShotDamageMult = 2.5f; + public static float SuperPogoAttunement_SliceDamageMult = 2.5f; //Keep in mind the slice always crits + public static int SuperPogoAttunementSliceLifesteal = 4; + public static int SuperPogoAttunement_PlayerSliceIFrames = 20; public static float SuperPogoAttunement_ShredDecayRate = 0.65f;//How much charge is lost per frame. public static int SuperPogoAttunement_PassiveLifeSteal = 7; public static int ShockwaveAttunement_BaseDamage = 550; + public static float ShockwaveAttunement_BeamDamageMult = 0.25f; public static int ShockwaveAttunement_DashHitIFrames = 20; - public static float ShockwaveAttunement_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 ShockwaveAttunement_MonolithDamageBoost = 1.1f; - public static float ShockwaveAttunement_MonolithDamageFalloff = 0.15f; //Damage multiplier for all subsequent hits after the first one. - public static float ShockwaveAttunement_BlastDamageReduction = 0.8f; + public static float ShockwaveAttunement_FullChargeMult = 3.6f; + public static int ShockwaveAttunement_SigilTime = 1000; + public static float ShockwaveAttunement_MonolithDamageBoost = 0.75f; public static int ShockwaveAttunement_PassiveBaseDamage = 200; - public static int FlailBladeAttunement_BaseDamage = 400; - public static int FlailBladeAttunement_LocalIFrames = 30; + public static int FlailBladeAttunement_BaseDamage = 200; + public static int FlailBladeAttunement_LocalIFrames = 15; public static int FlailBladeAttunement_FlailTime = 10; public static int FlailBladeAttunement_Reach = 400; public static float FlailBladeAttunement_ChainDamageReduction = 0.5f; @@ -80,15 +79,16 @@ namespace CalamityMod.Items.Weapons.Melee //Proc coefficients. aka the likelihood of any given attack to trigger a on-hit passive. public static float WhirlwindAttunement_WhirlwindProc = 0.24f; public static float WhirlwindAttunement_SwordThrowProc = 1f; - public static float WhirlwindAttunement_SwordBeamProc = 0.05f; + public static float WhirlwindAttunement_MonolithProc = 0.25f; public static float SuperPogoAttunement_ShredderProc = 0.1f; public static float SuperPogoAttunement_WheelProc = 0.4f; public static float SuperPogoAttunement_DashProc = 1f; public static float ShockwaveAttunement_SwordProc = 1f; - public static float ShockwaveAttunement_MonolithProc = 1f; - public static float ShockwaveAttunement_BlastProc = 0.5f; + public static float ShockwaveAttunement_SwordBeamProc = 0.05f; + public static float ShockwaveAttunement_BlastProc = 0.33f; + public static float ShockwaveAttunement_ShockwaveProc = 0.33f; public static float FlailBladeAttunement_BladeProc = 0.1f; public static float FlailBladeAttunement_ChainProc = 0.05f; @@ -103,7 +103,7 @@ namespace CalamityMod.Items.Weapons.Melee SafeCheckAttunements(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -194,7 +194,7 @@ namespace CalamityMod.Items.Weapons.Melee { var clone = base.Clone(item); if (Main.mouseItem.type == ItemType()) - item.ModItem?.HoldItem(Main.player[Main.myPlayer]); + item.ModItem?.HoldItem(Main.LocalPlayer); if (clone is OmegaBiomeBlade a && item.ModItem is OmegaBiomeBlade a2) { a.mainAttunement = a2.mainAttunement; @@ -217,8 +217,8 @@ namespace CalamityMod.Items.Weapons.Melee int attunement1 = tag.GetInt("mainAttunement"); int attunement2 = tag.GetInt("secondaryAttunement"); - mainAttunement = Attunement.attunementArray[attunement1 != -1 ? attunement1 : Attunement.attunementArray.Length - 1]; - secondaryAttunement = Attunement.attunementArray[attunement2 != -1 ? attunement2 : Attunement.attunementArray.Length - 1]; + mainAttunement = AttunementSystem.FindOrNull(attunement1); + secondaryAttunement = AttunementSystem.FindOrNull(attunement2); if (mainAttunement == secondaryAttunement) secondaryAttunement = null; @@ -228,14 +228,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void NetSend(BinaryWriter writer) { - writer.Write(mainAttunement != null ? (byte)mainAttunement.id : Attunement.attunementArray.Length - 1); - writer.Write(secondaryAttunement != null ? (byte)secondaryAttunement.id : Attunement.attunementArray.Length - 1); + writer.Write(mainAttunement != null ? (byte)mainAttunement.id : AttunementSystem.EmptyID); + writer.Write(secondaryAttunement != null ? (byte)secondaryAttunement.id : AttunementSystem.EmptyID); } public override void NetReceive(BinaryReader reader) { - mainAttunement = Attunement.attunementArray[reader.ReadInt32()]; - secondaryAttunement = Attunement.attunementArray[reader.ReadInt32()]; + mainAttunement = AttunementSystem.FindOrNull(reader.ReadInt32()); + secondaryAttunement = AttunementSystem.FindOrNull(reader.ReadInt32()); } #endregion @@ -251,10 +251,24 @@ namespace CalamityMod.Items.Weapons.Melee public void SafeCheckAttunements() { if (mainAttunement != null) - mainAttunement = Attunement.attunementArray[(int)MathHelper.Clamp((float)mainAttunement.id, (float)AttunementID.Whirlwind, (float)AttunementID.Shockwave)]; + mainAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)mainAttunement.id)); if (secondaryAttunement != null) - secondaryAttunement = Attunement.attunementArray[(int)MathHelper.Clamp((float)secondaryAttunement.id, (float)AttunementID.Whirlwind, (float)AttunementID.Shockwave)]; + secondaryAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)secondaryAttunement.id)); + + if (mainAttunement == secondaryAttunement) + secondaryAttunement = null; + } + + private static int ClampAttunementRange(int input) + { + if (input < (int)AttunementID.Whirlwind) + return (int)AttunementID.Whirlwind; + + if (input > (int)AttunementID.Shockwave) + return (int)AttunementID.Shockwave; + + return input; } public override void HoldItem(Player player) @@ -262,7 +276,7 @@ namespace CalamityMod.Items.Weapons.Melee player.Calamity().rightClickListener = true; player.Calamity().mouseWorldListener = true; - //Reset the strong lunge thing just in case it didnt get caught beofre. + //Reset the strong lunge thing just in case it didnt get caught before. if (CanUseItem(player)) { @@ -292,7 +306,7 @@ namespace CalamityMod.Items.Weapons.Melee return; - //PAssive effetcsts only happen on the side of the owner + //Passive effects only happen on the side of the owner var source = player.GetSource_ItemUse(Item); if (secondaryAttunement != null) { @@ -329,7 +343,7 @@ namespace CalamityMod.Items.Weapons.Melee 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() || n.type == ProjectileType())); } @@ -359,7 +373,7 @@ namespace CalamityMod.Items.Weapons.Melee position.Y -= 6f * scale; Texture2D itemTexture = Request("CalamityMod/Items/Weapons/Melee/OmegaBiomeBladeExtra").Value; - Rectangle itemFrame = (Main.itemAnimations[Item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[Item.type].GetFrame(itemTexture); + Rectangle itemFrame = (Main.itemAnimations[Type] == null) ? itemTexture.Frame() : Main.itemAnimations[Type].GetFrame(itemTexture); // Draw all particles. @@ -398,9 +412,9 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(3). AddIngredient(3). + AddIngredient(). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 01acc2a755..d4192e2eda 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -2,8 +2,17 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.Audio; using Terraria.ID; +using Microsoft.Xna.Framework; using Terraria.ModLoader; +using CalamityMod.Particles; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Basic.Reference.Assemblies; +using System; +using Mono.Cecil; namespace CalamityMod.Items.Weapons.Melee { @@ -11,23 +20,104 @@ namespace CalamityMod.Items.Weapons.Melee public class Orderbringer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + private float swingRoatation = 0; + private int time = 0; + private Color mainColor; + private int swordDirection; + private int useTime = 18; + private int opacityAdjust = 0; + private float smearOpacity = 0; public override void SetDefaults() { Item.width = Item.height = 108; - Item.damage = 128; + Item.damage = 415; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 18; + Item.useAnimation = Item.useTime = useTime; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; Item.useTurn = true; - Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item60; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5.5f; + } + 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); + + for (int i = 0; i < 4; i++) + { + Vector2 vel = (velocity * 2.5f).RotatedByRandom(0.6f); + Projectile.NewProjectile(source, player.ClampedMouseWorld() - (velocity * 40) + Main.rand.NextVector2Circular(130, 130), vel * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), (int)(damage * 0.1f), knockback * 0.2f, player.whoAmI, 0, 0, 1); + } + return false; + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + float scale = 1.2f; + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } + public override void UseAnimation(Player player) + { + swordDirection = player.direction; + time = 0; + swingRoatation = 0; + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + opacityAdjust = 0; + smearOpacity = 0; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + opacityAdjust++; + if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f) + smearOpacity += 0.1f; + else if (smearOpacity > 0) + smearOpacity -= 0.2f; + + time++; + swingRoatation += swordDirection == 1 ? 0.17f : -0.17f; + + float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation; + if (swordDirection != player.direction) + { + swingRoatation *= -1; + swordDirection = player.direction; + } + Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(2.8f, 3.2f), new Vector2(1, 1), 2, true, false, true, player.direction); + GeneralParticleHandler.SpawnParticle(Smear); + + if (Main.rand.NextBool()) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; + Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); + dust.scale = Main.rand.NextFloat(0.5f, 0.75f); + dust.velocity = dustVel * 0.55f; + dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + dust.noGravity = true; + } + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + { + int beamDamage = player.CalcIntDamage(Item.damage * 0.5f); + Vector2 mouseClamped = player.ClampedMouseWorld(); + for (int i = 0; i < 2; i++) + { + Vector2 targetPos = Main.MouseWorld; + NPC target2 = Main.MouseWorld.ClosestNPCAt(650); + if (target2 != null) + targetPos = target2.Center + target2.velocity * 14; + + Vector2 spawnPos = mouseClamped + new Vector2(Main.rand.NextFloat(-300, 300), -900); + Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI); + } + } + 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/OrderbringerGlow").Value); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Pandemic.cs b/Items/Weapons/Melee/Pandemic.cs index 794fbeedd3..49c829b756 100644 --- a/Items/Weapons/Melee/Pandemic.cs +++ b/Items/Weapons/Melee/Pandemic.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -10,11 +11,16 @@ namespace CalamityMod.Items.Weapons.Melee public class Pandemic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 480f; + public static float Speed = 40f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() @@ -45,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.HiveFive). - AddIngredient(10). AddIngredient(6). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/PhotonRipper.cs b/Items/Weapons/Melee/PhotonRipper.cs index 5986c13bc3..067ee83e3b 100644 --- a/Items/Weapons/Melee/PhotonRipper.cs +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -13,7 +13,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/PlagueKeeper.cs b/Items/Weapons/Melee/PlagueKeeper.cs deleted file mode 100644 index 9ec6a35407..0000000000 --- a/Items/Weapons/Melee/PlagueKeeper.cs +++ /dev/null @@ -1,76 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class PlagueKeeper : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetDefaults() - { - Item.width = 74; - Item.height = 90; - Item.damage = 68; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; - Item.useTurn = true; - Item.knockBack = 6f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - var source = player.GetSource_ItemUse(Item); - - target.AddBuff(ModContent.BuffType(), 300); - for (int i = 0; i < 3; i++) - { - int bee = Projectile.NewProjectile(source, player.Center, Vector2.Zero, player.beeType(), - player.beeDamage(Item.damage / 3), player.beeKB(0f), player.whoAmI); - if (bee.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[bee].penetrate = 1; - Main.projectile[bee].DamageType = DamageClass.Melee; - } - } - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - var source = player.GetSource_ItemUse(Item); - - target.AddBuff(ModContent.BuffType(), 300); - for (int i = 0; i < 3; i++) - { - int bee = Projectile.NewProjectile(source, player.Center, Vector2.Zero, player.beeType(), - player.beeDamage(Item.damage / 3), player.beeKB(0f), player.whoAmI); - if (bee.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[bee].penetrate = 1; - Main.projectile[bee].DamageType = DamageClass.Melee; - } - } - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.BeeKeeper). - AddIngredient(ItemID.LunarBar, 5). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/PlagueKeeper.png b/Items/Weapons/Melee/PlagueKeeper.png deleted file mode 100644 index ba7c729383..0000000000 Binary files a/Items/Weapons/Melee/PlagueKeeper.png and /dev/null differ diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 81ad513f31..20941fbed8 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -35,103 +35,41 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() { Item.width = 50; Item.height = 50; - Item.damage = 699; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 13; - Item.useTurn = true; + Item.damage = 300; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = Item.useTime = 13; + Item.reuseDelay = 30; Item.DamageType = MeleeRangedHybridDamageClass.Instance; Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 8; - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow").Value); } - 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(), damage, knockback, player.whoAmI); - } - else - { - Projectile.NewProjectile(source, position, velocity * 0.5f, type, (int)(damage * 1.1f), knockback, player.whoAmI); - } - return false; - } - - public override bool AltFunctionUse(Player player) => true; - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.UseSound = SoundID.Item1; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.autoReuse = true; - Item.noMelee = false; - Item.channel = false; - } - else - { - Item.UseSound = CrystylCrusher.ChargeSound; - Item.useStyle = ItemUseStyleID.Shoot; - Item.useTurn = false; - Item.autoReuse = false; - Item.noMelee = true; - Item.channel = true; - } - return base.CanUseItem(player); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - 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; - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Daybreak, 300); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Daybreak, 300); - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(3). AddIngredient(8). AddIngredient(20). AddTile(). diff --git a/Items/Weapons/Melee/Pwnagehammer.cs b/Items/Weapons/Melee/Pwnagehammer.cs index 41e5b2a727..4c0510417d 100644 --- a/Items/Weapons/Melee/Pwnagehammer.cs +++ b/Items/Weapons/Melee/Pwnagehammer.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 29.4f; + Item.shootSpeed = 22f; } diff --git a/Items/Weapons/Melee/Quagmire.cs b/Items/Weapons/Melee/Quagmire.cs index 8105ff2d7e..93827b8f25 100644 --- a/Items/Weapons/Melee/Quagmire.cs +++ b/Items/Weapons/Melee/Quagmire.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -9,11 +10,16 @@ namespace CalamityMod.Items.Weapons.Melee public class Quagmire : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 480f; + public static float Speed = 36f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/RedSun.cs b/Items/Weapons/Melee/RedSun.cs index c20fd8963d..71c7e89b04 100644 --- a/Items/Weapons/Melee/RedSun.cs +++ b/Items/Weapons/Melee/RedSun.cs @@ -107,8 +107,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.AntlionClaw). AddIngredient(). - AddIngredient(5). AddIngredient(5). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/RedtideSpear.cs b/Items/Weapons/Melee/RedtideSpear.cs deleted file mode 100644 index 39a9fce2af..0000000000 --- a/Items/Weapons/Melee/RedtideSpear.cs +++ /dev/null @@ -1,69 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee.Spears; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - [LegacyName("UrchinSpear")] - public class RedtideSpear : 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 = 56; - Item.height = 56; - Item.damage = 25; - Item.DamageType = DamageClass.Melee; - Item.noMelee = true; - Item.useTurn = true; - Item.noUseGraphic = true; - Item.useAnimation = 25; - Item.useStyle = ItemUseStyleID.Shoot; - Item.channel = true; - Item.useTime = 25; - Item.knockBack = 5f; - Item.UseSound = null; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 4f; - } - - public override void HoldItem(Player player) - { - player.Calamity().mouseWorldListener = true; - } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(4). - AddTile(TileID.Anvils). - Register(); - } - } - - public class SpearChargePlayer : ModPlayer - { - public bool ChargingKnockbackResist = false; - - public override void PostUpdateMiscEffects() - { - if (ChargingKnockbackResist) - { - Player.noKnockback = true; - ChargingKnockbackResist = false; - } - } - } -} diff --git a/Items/Weapons/Melee/RedtideSpear.png b/Items/Weapons/Melee/RedtideSpear.png deleted file mode 100644 index 2f951da3ff..0000000000 Binary files a/Items/Weapons/Melee/RedtideSpear.png and /dev/null differ diff --git a/Items/Weapons/Melee/RemsRevenge.cs b/Items/Weapons/Melee/RemsRevenge.cs index 27da6eb01b..6b59d9ff1b 100644 --- a/Items/Weapons/Melee/RemsRevenge.cs +++ b/Items/Weapons/Melee/RemsRevenge.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.MaceFlails; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -8,6 +9,10 @@ namespace CalamityMod.Items.Weapons.Melee public class RemsRevenge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static int WitherDefenseReduction = 20; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(WitherDefenseReduction); + public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; public override void SetDefaults() { diff --git a/Items/Weapons/Melee/Riptide.cs b/Items/Weapons/Melee/Riptide.cs index 3676f8d2e5..1803c1123e 100644 --- a/Items/Weapons/Melee/Riptide.cs +++ b/Items/Weapons/Melee/Riptide.cs @@ -1,8 +1,9 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -11,19 +12,25 @@ namespace CalamityMod.Items.Weapons.Melee public class Riptide : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 288f; + public static float Speed = 25f; + public static float Duration = 18f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed, Duration); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() { - Item.width = 30; - Item.height = 44; + Item.width = 46; + Item.height = 48; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 12; + Item.damage = 14; Item.knockBack = 1f; Item.useTime = 25; Item.useAnimation = 25; diff --git a/Items/Weapons/Melee/Riptide.png b/Items/Weapons/Melee/Riptide.png index 99efcf6899..8eee3928bd 100644 Binary files a/Items/Weapons/Melee/Riptide.png and b/Items/Weapons/Melee/Riptide.png differ diff --git a/Items/Weapons/Melee/SaharaSlicers.cs b/Items/Weapons/Melee/SaharaSlicers.cs index 4ffc6f96f5..40549fec04 100644 --- a/Items/Weapons/Melee/SaharaSlicers.cs +++ b/Items/Weapons/Melee/SaharaSlicers.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public bool AltProjectile = true; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/SaharaSlicers.png b/Items/Weapons/Melee/SaharaSlicers.png index aecbe93345..d3667f574b 100644 Binary files a/Items/Weapons/Melee/SaharaSlicers.png and b/Items/Weapons/Melee/SaharaSlicers.png differ diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index fd0f87b89b..d43d86bd7f 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -11,7 +11,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs deleted file mode 100644 index 465fa48b07..0000000000 --- a/Items/Weapons/Melee/SeashineSword.cs +++ /dev/null @@ -1,41 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -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.width = 40; - Item.height = 40; - 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; - Item.shoot = ModContent.ProjectileType(); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddIngredient(7). - AddIngredient(10). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/SeashineSword.png b/Items/Weapons/Melee/SeashineSword.png deleted file mode 100644 index ec74860678..0000000000 Binary files a/Items/Weapons/Melee/SeashineSword.png and /dev/null differ diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index 79f0a44291..f7fb0a7c67 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -1,6 +1,8 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,22 +12,27 @@ namespace CalamityMod.Items.Weapons.Melee public class SeekingScorcher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static readonly SoundStyle ThrowSound = new("CalamityMod/Sounds/Item/SwingMid") { Volume = 0.5f, Pitch = -0.35f, PitchVariance = 0.1f }; + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact") { Volume = 0.5f, Pitch = 0.2f, PitchVariance = 0.2f }; + public static readonly SoundStyle ShatterSound = new("CalamityMod/Sounds/Item/BlazingCoreParry") { Volume = 0.4f, PitchVariance = 0.2f }; + public static readonly SoundStyle LightShatterSound = new("CalamityMod/Sounds/NPCKilled/CrownJewelShatter") { Pitch = 0.4f, PitchVariance = 0.3f }; + public override void SetDefaults() { Item.width = 86; Item.height = 64; - Item.damage = 232; + Item.damage = 718; + Item.DamageType = DamageClass.MeleeNoSpeed; + Item.useAnimation = Item.useTime = 55; + Item.knockBack = 8.5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.autoReuse = true; - Item.useAnimation = 17; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 17; - Item.knockBack = 8.5f; - Item.UseSound = SoundID.Item1; - Item.DamageType = DamageClass.MeleeNoSpeed; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Melee/Shimmerspark.cs b/Items/Weapons/Melee/Shimmerspark.cs index 45f7958674..526fd23df7 100644 --- a/Items/Weapons/Melee/Shimmerspark.cs +++ b/Items/Weapons/Melee/Shimmerspark.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -9,11 +10,16 @@ namespace CalamityMod.Items.Weapons.Melee public class Shimmerspark : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 448f; + public static float Speed = 36f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/SkytideDragoon.cs b/Items/Weapons/Melee/SkytideDragoon.cs new file mode 100644 index 0000000000..ec33a45b04 --- /dev/null +++ b/Items/Weapons/Melee/SkytideDragoon.cs @@ -0,0 +1,43 @@ +using CalamityMod.Items.BaseItems; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class SkytideDragoon : CustomUseProjItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + + public override void SetDefaults() + { + Item.width = 86; + Item.height = 94; + Item.damage = 345; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 35; + Item.useTime = 35; + Item.useTurn = true; + Item.knockBack = 12f; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + } + public override bool MeleePrefix() => true; // This spear can deal more damage with melee speed, no reason to limit it to godly + 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/SkytideDragoonGlow").Value); + } + } +} diff --git a/Items/Weapons/Melee/SkytideDragoon.png b/Items/Weapons/Melee/SkytideDragoon.png new file mode 100644 index 0000000000..98d66f472b Binary files /dev/null and b/Items/Weapons/Melee/SkytideDragoon.png differ diff --git a/Items/Weapons/Melee/SkytideDragoonGlow.png b/Items/Weapons/Melee/SkytideDragoonGlow.png new file mode 100644 index 0000000000..c23430079f Binary files /dev/null and b/Items/Weapons/Melee/SkytideDragoonGlow.png differ diff --git a/Items/Weapons/Melee/SmokingComet.cs b/Items/Weapons/Melee/SmokingComet.cs index ff8fe8633e..8fe6c66857 100644 --- a/Items/Weapons/Melee/SmokingComet.cs +++ b/Items/Weapons/Melee/SmokingComet.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -8,11 +9,17 @@ namespace CalamityMod.Items.Weapons.Melee public class SmokingComet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 320f; + public static float Speed = 20f; + public static float Duration = 21f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed, Duration); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/SoulHarvester.cs b/Items/Weapons/Melee/SoulHarvester.cs index 6ad35bb47f..5e96d09f84 100644 --- a/Items/Weapons/Melee/SoulHarvester.cs +++ b/Items/Weapons/Melee/SoulHarvester.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -46,7 +47,8 @@ namespace CalamityMod.Items.Weapons.Melee { SoundEngine.PlaySound(SoundID.Item14, target.Center); int onHitDamage = player.CalcIntDamage(Item.damage); - player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); + Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, player.whoAmI, target.whoAmI); + blast.DamageType = Item.DamageType; for (int i = 0; i < 10; i++) { int plagueDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); diff --git a/Items/Weapons/Melee/SpineOfThanatos.cs b/Items/Weapons/Melee/SpineOfThanatos.cs index 57bdf30542..6b9de5cab9 100644 --- a/Items/Weapons/Melee/SpineOfThanatos.cs +++ b/Items/Weapons/Melee/SpineOfThanatos.cs @@ -35,11 +35,10 @@ 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) { for (int i = 0; i < 2; i++) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, (i == 0f).ToDirectionInt()); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, (i == 0f).ToDirectionInt()); // Create a third, final whip that does not swing around at all and instead simply flies towards the mouse. - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; + return true; } } } diff --git a/Items/Weapons/Melee/StarburstShiv.cs b/Items/Weapons/Melee/StarburstShiv.cs index bc484097bc..5fdd6a0f4f 100644 --- a/Items/Weapons/Melee/StarburstShiv.cs +++ b/Items/Weapons/Melee/StarburstShiv.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Shortswords; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 44; - Item.height = 44; + Item.width = 74; + Item.height = 94; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; @@ -32,13 +34,15 @@ namespace CalamityMod.Items.Weapons.Melee public override bool MeleePrefix() => 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/Melee/StarburstShivGlow").Value); + public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.PiercingStarlight). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/StarburstShiv.png b/Items/Weapons/Melee/StarburstShiv.png index c7c7aa1288..6fc05ab7e6 100644 Binary files a/Items/Weapons/Melee/StarburstShiv.png and b/Items/Weapons/Melee/StarburstShiv.png differ diff --git a/Items/Weapons/Melee/StarburstShivGlow.png b/Items/Weapons/Melee/StarburstShivGlow.png new file mode 100644 index 0000000000..007dc4ba4a Binary files /dev/null and b/Items/Weapons/Melee/StarburstShivGlow.png differ diff --git a/Items/Weapons/Melee/StarnightLance.cs b/Items/Weapons/Melee/StarnightLance.cs index 8e6afe25b2..8dc323f208 100644 --- a/Items/Weapons/Melee/StarnightLance.cs +++ b/Items/Weapons/Melee/StarnightLance.cs @@ -11,7 +11,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/StellarContempt.cs b/Items/Weapons/Melee/StellarContempt.cs index 03487196f7..ca015ca064 100644 --- a/Items/Weapons/Melee/StellarContempt.cs +++ b/Items/Weapons/Melee/StellarContempt.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee public class StellarContempt : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static float Speed = 25f; + public static float Speed = 30f; public override void SetDefaults() { diff --git a/Items/Weapons/Melee/StellarContempt.png b/Items/Weapons/Melee/StellarContempt.png index 0bb32f5aa9..40c00729ad 100644 Binary files a/Items/Weapons/Melee/StellarContempt.png and b/Items/Weapons/Melee/StellarContempt.png differ diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index 49569015ed..7179fb521f 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Items.BaseItems; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -7,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class StellarStriker : ModItem, ILocalizedModType + public class StellarStriker : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; @@ -15,87 +17,24 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 118; - Item.damage = 450; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 25; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 25; + Item.damage = 56; + Item.DamageType = TrueMeleeDamageClass.Instance; + + Item.useAnimation = Item.useTime = 33; + Item.useTurn = true; Item.knockBack = 7.75f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; - Item.shootSpeed = 12f; + + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; } - - // 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) - SpawnFlaresNPC(player, Item.knockBack, GetOnHitDamage(player), target); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - if (player.whoAmI == Main.myPlayer) - SpawnFlaresPvp(player, Item.knockBack, GetOnHitDamage(player), target); - } - - 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); - - 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 = 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; - } - } - - 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, DustID.Vortex); - } - } - + public override bool MeleePrefix() => true; public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index f155315a5f..4df89ae204 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -31,9 +31,11 @@ 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, (int)(damage * 0.8), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.8), knockback, player.whoAmI); Vector2 spawnPos = new Vector2(player.MountedCenter.X + Main.rand.Next(-200, 201), player.MountedCenter.Y - 600f); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 targetPos = Main.MouseWorld + new Vector2(Main.rand.Next(-30, 31), Main.rand.Next(-30, 31)); velocity = targetPos - spawnPos; velocity.Normalize(); diff --git a/Items/Weapons/Melee/StygianShield.cs b/Items/Weapons/Melee/StygianShield.cs index 3b6b75e84f..a2c212cbd7 100644 --- a/Items/Weapons/Melee/StygianShield.cs +++ b/Items/Weapons/Melee/StygianShield.cs @@ -32,7 +32,7 @@ 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 SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; public override void SetDefaults() { diff --git a/Items/Weapons/Melee/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index 9f948cf7e9..3ec096138d 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Rapier; Item.damage = 90; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useAnimation = Item.useTime = 10; + Item.useAnimation = Item.useTime = 16; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2f; Item.knockBack = 7f; diff --git a/Items/Weapons/Melee/SulphurousGrabber.cs b/Items/Weapons/Melee/SulphurousGrabber.cs index d7179f663d..f6815107aa 100644 --- a/Items/Weapons/Melee/SulphurousGrabber.cs +++ b/Items/Weapons/Melee/SulphurousGrabber.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -8,11 +9,16 @@ namespace CalamityMod.Items.Weapons.Melee public class SulphurousGrabber : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 400f; + public static float Speed = 32f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/TaintedBlade.cs b/Items/Weapons/Melee/TaintedBlade.cs index 4bd49059d5..eb0e887f73 100644 --- a/Items/Weapons/Melee/TaintedBlade.cs +++ b/Items/Weapons/Melee/TaintedBlade.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs index 7bbd67982a..f92d002223 100644 --- a/Items/Weapons/Melee/TenebreusTides.cs +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -13,7 +13,7 @@ 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[Type] = true; } public override void SetDefaults() @@ -46,8 +46,6 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddIngredient(). AddIngredient(ItemID.InfluxWaver). - AddIngredient(20). - AddIngredient(25). AddIngredient(50). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 55e29d8ac4..519bed62e3 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -60,8 +60,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.TerraBlade). - AddIngredient(9). AddIngredient(7). + AddIngredient(9). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index abb9f7b438..a4e26ae751 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee { // Visually a sword, but with no true melee capability. The Burning Sky is held out like a staff. - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = 0; i < ProjectilesPerBarrage; ++i) { float randomSpeed = speed * Main.rand.NextFloat(0.7f, 1.4f); - CalamityUtils.ProjectileRain(source, Main.MouseWorld, 290f, 130f, 850f, 1100f, randomSpeed, type, damage, knockback, player.whoAmI); + CalamityUtils.ProjectileRain(source, player.ClampedMouseWorld(), 290f, 130f, 850f, 1100f, randomSpeed, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/TheDarkMaster.cs b/Items/Weapons/Melee/TheDarkMaster.cs index e37cb358fb..75bfd17d1c 100644 --- a/Items/Weapons/Melee/TheDarkMaster.cs +++ b/Items/Weapons/Melee/TheDarkMaster.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { - Item.staff[Item.type] = true; - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + Item.staff[Type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee 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); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * (1 + bonusDamage)), knockback, player.whoAmI); } // still play the sound if the clones are out since they always fire beams else if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index d786bdcc23..d17e980aa4 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -10,11 +11,16 @@ namespace CalamityMod.Items.Weapons.Melee public class TheGodsGambit : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 400f; + public static float Speed = 32f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index 19f4ae60b0..ebe94fe490 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(ItemID.TheHorsemansBlade). AddIngredient(ItemID.SoulofNight, 30). AddIngredient(5). AddIngredient(3). diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs index c485fbbe46..21be661ebd 100644 --- a/Items/Weapons/Melee/TheMicrowave.cs +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -12,11 +13,15 @@ namespace CalamityMod.Items.Weapons.Melee public static readonly SoundStyle BeepSound = new("CalamityMod/Sounds/Custom/MicrowaveBeep"); public static readonly SoundStyle MMMSound = new("CalamityMod/Sounds/Custom/MMMMMMMMMMMMM") { IsLooped = true }; + public static float Reach = 512f; + public static float Speed = 54f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index a02d38ce6a..61674ef152 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -10,11 +11,16 @@ namespace CalamityMod.Items.Weapons.Melee public class TheObliterator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 720f; + public static float Speed = 54f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/TheOracle.cs b/Items/Weapons/Melee/TheOracle.cs index 49a98cf8dc..7bf5027c5c 100644 --- a/Items/Weapons/Melee/TheOracle.cs +++ b/Items/Weapons/Melee/TheOracle.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -17,11 +18,15 @@ namespace CalamityMod.Items.Weapons.Melee public const int AuraBaseDamage = 68; public const int AuraMaxDamage = 150; + public static float Reach = 800f; + public static float Speed = 60f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs similarity index 75% rename from Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs rename to Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs index e6a4b2eb9f..c24a749c40 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs @@ -2,26 +2,28 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class TriactisTruePaladinianMageHammerofMightMelee : ModItem, ILocalizedModType + [LegacyName("TriactisTruePaladinianMageHammerofMightMelee")] + public class TriactisTruePaladinianMageHammerofMight : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { - Item.width = 160; - Item.height = 160; - Item.damage = 2000; + Item.width = 168; + Item.height = 168; + Item.damage = 5000; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 10; - Item.knockBack = 50f; + Item.knockBack = 14f; Item.UseSound = SoundID.Item1; Item.DamageType = DamageClass.MeleeNoSpeed; Item.shoot = ModContent.ProjectileType(); @@ -36,8 +38,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.SoulofMight, 30). AddIngredient(5). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.png b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.png new file mode 100644 index 0000000000..25daefa6fc Binary files /dev/null and b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.png differ diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png deleted file mode 100644 index 60e00a746b..0000000000 Binary files a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index 8ace1c199a..bce0c1ee8b 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -23,16 +23,12 @@ namespace CalamityMod.Items.Weapons.Melee 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 - public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder - public override void ModifyTooltips(List tooltips) { if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -79,19 +75,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - if (Charge > 0 && player.controlUp) - { - float angle = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).ToRotation(); - Vector2 laserVector = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 600; - Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, laserVector, ProjectileType(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI); - - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; - - Charge = 0; - } - - else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) + if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); return false; diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index d465084ed8..2dbd3efbd9 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -3,9 +3,11 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CalamityMod.DataStructures; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -20,7 +22,7 @@ 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 class TrueBiomeBlade : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public Attunement mainAttunement = null; @@ -33,10 +35,12 @@ namespace CalamityMod.Items.Weapons.Melee #region stats public static int BaseDamage = 115; - public static int DefaultAttunement_BaseDamage = 105; + public static int DefaultAttunement_BaseDamage = 100; public static int DefaultAttunement_SigilTime = 900; public static int DefaultAttunement_BeamTime = 90; - public static float DefaultAttunement_HomingAngle = MathHelper.PiOver4; + public static float DefaultAttunement_LungeDamageMult = 2f; + public static int DefaultAttunement_LungeIFrames = 20; + public static float DefaultAttunement_HomingAngle = MathHelper.Pi / 3f; public static int EvilAttunement_BaseDamage = 155; public static int EvilAttunement_Lifesteal = 2; @@ -44,16 +48,14 @@ namespace CalamityMod.Items.Weapons.Melee public static float EvilAttunement_SlashDamageBoost = 3f; public static int EvilAttunement_SlashIFrames = 60; - public static int ColdAttunement_BaseDamage = 175; - public static float ColdAttunement_ThirdSwingBoost = 1.75f; - public static float ColdAttunement_MistDamageReduction = 0.09f; + public static int ColdAttunement_BaseDamage = 150; + public static float ColdAttunement_ThirdSwingBoost = 1.25f; + public static float ColdAttunement_MistDamageReduction = 0.11f; - public static int HotAttunement_BaseDamage = 122; - public static int HotAttunement_FullChargeDamage = 160; - public static int HotAttunement_ShredIFrames = 8; + public static int HotAttunement_BaseDamage = 135; + public static int HotAttunement_PlayerShredIFrames = 8; public static float HotAttunement_ShotDamageBoost = 4.5f; - 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 int HotAttunement_LocalIFrames = 24; //Be warned its got one extra update so all the iframes should be divided in 2 public static float HotAttunement_ShredDecayRate = 0.65f; //How much charge is lost per frame. public static int TropicalAttunement_BaseDamage = 150; @@ -62,29 +64,14 @@ namespace CalamityMod.Items.Weapons.Melee 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; - public static float HolyAttunement_BaseDamageReduction = 0.4f; - public static float HolyAttunement_FullChargeDamageBoost = 2f; + public static int HolyAttunement_BaseDamage = 66; + public static float HolyAttunement_BaseSwingDamageMult = 0.75f; + public static float HolyAttunement_FullSwingDamageMult = 1.5f; 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 = 250; - public static int AstralAttunement_DashHitIFrames = 20; - 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. - - public static int MarineAttunement_BaseDamage = 300; - public static float MarineAttunement_InWaterDamageMultiplier = 1.5f; - + public static float HolyAttunement_MonolithDamage = 0.5f; #endregion - - public override void SetStaticDefaults() - { - //Theres potential for flavor text as well but im not a writer - } - #region tooltip editing public override void ModifyTooltips(List list) @@ -94,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Melee SafeCheckAttunements(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -168,7 +155,7 @@ namespace CalamityMod.Items.Weapons.Melee { var clone = base.Clone(item); if (Main.mouseItem.type == ItemType()) - item.ModItem?.HoldItem(Main.player[Main.myPlayer]); + item.ModItem?.HoldItem(Main.LocalPlayer); if (clone is TrueBiomeBlade a && item.ModItem is TrueBiomeBlade a2) { a.mainAttunement = a2.mainAttunement; @@ -192,8 +179,8 @@ namespace CalamityMod.Items.Weapons.Melee int attunement1 = tag.GetInt("mainAttunement"); int attunement2 = tag.GetInt("secondaryAttunement"); - mainAttunement = Attunement.attunementArray[attunement1 != -1 ? attunement1 : Attunement.attunementArray.Length - 1]; - secondaryAttunement = Attunement.attunementArray[attunement2 != -1 ? attunement2 : Attunement.attunementArray.Length - 1]; + mainAttunement = AttunementSystem.FindOrNull(attunement1); + secondaryAttunement = AttunementSystem.FindOrNull(attunement2); if (mainAttunement == secondaryAttunement) secondaryAttunement = null; @@ -203,14 +190,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void NetSend(BinaryWriter writer) { - writer.Write(mainAttunement != null ? (byte)mainAttunement.id : Attunement.attunementArray.Length - 1); - writer.Write(secondaryAttunement != null ? (byte)secondaryAttunement.id : Attunement.attunementArray.Length - 1); + writer.Write(mainAttunement != null ? (byte)mainAttunement.id : AttunementSystem.EmptyID); + writer.Write(secondaryAttunement != null ? (byte)secondaryAttunement.id : AttunementSystem.EmptyID); } public override void NetReceive(BinaryReader reader) { - mainAttunement = Attunement.attunementArray[reader.ReadInt32()]; - secondaryAttunement = Attunement.attunementArray[reader.ReadInt32()]; + mainAttunement = AttunementSystem.FindOrNull(reader.ReadInt32()); + secondaryAttunement = AttunementSystem.FindOrNull(reader.ReadInt32()); } #endregion @@ -226,10 +213,24 @@ namespace CalamityMod.Items.Weapons.Melee public void SafeCheckAttunements() { if (mainAttunement != null) - mainAttunement = Attunement.attunementArray[(int)MathHelper.Clamp((float)mainAttunement.id, (float)AttunementID.TrueDefault, (float)AttunementID.Marine)]; + mainAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)mainAttunement.id)); if (secondaryAttunement != null) - secondaryAttunement = Attunement.attunementArray[(int)MathHelper.Clamp((float)secondaryAttunement.id, (float)AttunementID.TrueDefault, (float)AttunementID.Marine)]; + secondaryAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)secondaryAttunement.id)); + + if (mainAttunement == secondaryAttunement) + secondaryAttunement = null; + } + + private static int ClampAttunementRange(int input) + { + if (input < (int)AttunementID.TrueDefault) + return (int)AttunementID.TrueDefault; + + if (input > (int)AttunementID.Holy) + return (int)AttunementID.Holy; + + return input; } public override void HoldItem(Player player) @@ -296,9 +297,7 @@ namespace CalamityMod.Items.Weapons.Melee (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || - n.type == ProjectileType() || - 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. @@ -313,27 +312,6 @@ namespace CalamityMod.Items.Weapons.Melee return mainAttunement.Shoot(player, source, ref position, ref velocity.X, ref velocity.Y, ref type, ref damage, ref knockback, ref Combo, ref StoredLunges, ref PowerLungeCounter); } - - //This is only used for the purity sigil effect of the default attunement - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - if (mainAttunement == null || mainAttunement.id != AttunementID.TrueDefault || player.whoAmI != Main.myPlayer) - return; - - foreach (Projectile proj in Main.projectile) - { - if (proj.active && proj.type == ProjectileType() && proj.owner == player.whoAmI) - { - //Reset the timeleft on the sigil & give it its new target (or the same, it doesnt matter really. - proj.ai[0] = target.whoAmI; - proj.timeLeft = DefaultAttunement_SigilTime; - return; - } - } - var source = player.GetSource_ItemUse(Item); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ProjectileType(), 0, 0, player.whoAmI, target.whoAmI); - } - 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/TrueCausticEdge.cs b/Items/Weapons/Melee/TrueCausticEdge.cs index b82385b468..ccfead5620 100644 --- a/Items/Weapons/Melee/TrueCausticEdge.cs +++ b/Items/Weapons/Melee/TrueCausticEdge.cs @@ -58,9 +58,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddRecipeGroup("AnyEvilFlask", 5). - AddIngredient(ItemID.FlaskofPoison, 5). - AddIngredient(ItemID.Deathweed, 4). + AddRecipeGroup("CursedFlameIchor", 8). + AddIngredient(ItemID.SpiderFang, 8). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index e101efa146..e2d8e61327 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index 655d248f21..f9128f195b 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -1,7 +1,9 @@ using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -26,13 +28,17 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.autoReuse = true; Item.UseSound = SoundID.Item1; + Item.shoot = ModContent.ProjectileType(); // Dummy argument to ensure it doesn't get set to true melee } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) => false; + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 360); int onHitDamage = player.CalcIntDamage(Item.damage); - player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); + Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, player.whoAmI, target.whoAmI); + blast.DamageType = Item.DamageType; float firstDustScale = 1.7f; float secondDustScale = 0.8f; float thirdDustScale = 2f; diff --git a/Items/Weapons/Melee/UrchinMace.cs b/Items/Weapons/Melee/UrchinMace.cs index 9947723237..ff90145473 100644 --- a/Items/Weapons/Melee/UrchinMace.cs +++ b/Items/Weapons/Melee/UrchinMace.cs @@ -1,6 +1,5 @@ -using System.Linq; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee.MaceFlails; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +10,8 @@ namespace CalamityMod.Items.Weapons.Melee public class UrchinMace : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; public override void SetDefaults() { Item.width = 42; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } @@ -37,11 +38,6 @@ namespace CalamityMod.Items.Weapons.Melee player.Calamity().mouseWorldListener = true; } - public override bool CanUseItem(Player player) - { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType()); - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/ElementalLance.cs b/Items/Weapons/Melee/VanishingPoint.cs similarity index 83% rename from Items/Weapons/Melee/ElementalLance.cs rename to Items/Weapons/Melee/VanishingPoint.cs index a4cf059a36..5aee60aefa 100644 --- a/Items/Weapons/Melee/ElementalLance.cs +++ b/Items/Weapons/Melee/VanishingPoint.cs @@ -6,13 +6,13 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - [LegacyName("SpatialLance")] - public class ElementalLance : ModItem, ILocalizedModType + [LegacyName("SpatialLance", "ElementalLance")] + public class VanishingPoint : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Spears[Item.type] = true; + ItemID.Sets.Spears[Type] = true; } public override void SetDefaults() @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/ElementalLance.png b/Items/Weapons/Melee/VanishingPoint.png similarity index 100% rename from Items/Weapons/Melee/ElementalLance.png rename to Items/Weapons/Melee/VanishingPoint.png diff --git a/Items/Weapons/Melee/Virulence.cs b/Items/Weapons/Melee/Virulence.cs index da76d26a24..97f4b5a5ac 100644 --- a/Items/Weapons/Melee/Virulence.cs +++ b/Items/Weapons/Melee/Virulence.cs @@ -2,7 +2,6 @@ using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,8 +13,8 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.width = 48; - Item.height = 62; + Item.width = 74; + Item.height = 90; Item.damage = 100; Item.knockBack = 5.5f; Item.useAnimation = Item.useTime = 15; @@ -31,11 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ItemRarityID.Yellow; } - 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.85), knockback, player.whoAmI, 0f, 0f); - return false; - } + 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.85); public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Items/Weapons/Melee/Virulence.png b/Items/Weapons/Melee/Virulence.png index dafb387026..ba7c729383 100644 Binary files a/Items/Weapons/Melee/Virulence.png and b/Items/Weapons/Melee/Virulence.png differ diff --git a/Items/Weapons/Melee/VulcaniteLance.cs b/Items/Weapons/Melee/VulcaniteLance.cs index 98e810e120..b61b432b67 100644 --- a/Items/Weapons/Melee/VulcaniteLance.cs +++ b/Items/Weapons/Melee/VulcaniteLance.cs @@ -12,7 +12,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs index ad663b26d5..74a3d5142f 100644 --- a/Items/Weapons/Melee/WulfrumScrewdriver.cs +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -44,12 +44,12 @@ namespace CalamityMod.Items.Weapons.Melee { return base.Clone(item); - ModItem clone = base.Clone(item); + /*ModItem clone = base.Clone(item); if (clone is WulfrumScrewdriver a && item.ModItem is WulfrumScrewdriver a2 && a2.ScrewStored) { a.ScrewStored = a2.ScrewStored; } - return clone; + return clone;*/ } public override float UseSpeedMultiplier(Player player) @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 14; Item.height = 50; Item.damage = 12; - Item.DamageType = DamageClass.Melee; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = DefaultTime + WulfrumScrewdriverProj.MaxTime; Item.useStyle = ItemUseStyleID.Shoot; Item.useTime = DefaultTime + WulfrumScrewdriverProj.MaxTime; diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index 4254bd8158..0cb321f18f 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; // Flail already does half damage. No tooltip mutliplier required. } diff --git a/Items/Weapons/Melee/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index 641d211528..31cedfa79f 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -7,17 +8,22 @@ namespace CalamityMod.Items.Weapons.Melee public class YinYo : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static float Reach = 400f; + public static float Speed = 32f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; - ItemID.Sets.GamepadExtraRange[Item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + ItemID.Sets.Yoyo[Type] = true; + ItemID.Sets.GamepadExtraRange[Type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Type] = true; } public override void SetDefaults() { - Item.width = 26; - Item.height = 24; + Item.width = 50; + Item.height = 44; Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 44; Item.knockBack = 3.5f; @@ -41,8 +47,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.Valor). AddIngredient(ItemID.DarkShard). AddIngredient(ItemID.LightShard). + AddIngredient(ItemID.SoulofNight, 7). + AddIngredient(ItemID.SoulofLight, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/YinYo.png b/Items/Weapons/Melee/YinYo.png index a00eb19a83..2248953d7d 100644 Binary files a/Items/Weapons/Melee/YinYo.png and b/Items/Weapons/Melee/YinYo.png differ diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 72672b11ce..7f7c60844b 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -5,7 +5,6 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -49,24 +48,21 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.Revolver). AddIngredient(). - AddIngredient(52). + AddIngredient(). AddIngredient(5). AddTile(). Register(); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - int card = Utils.SelectRandom(Main.rand, new int[] + type = Utils.SelectRandom(Main.rand, new int[] { ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType() }); - - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, card, damage, knockback, player.whoAmI, 0f, 0f); - return false; } } } diff --git a/Items/Weapons/Ranged/AcidwoodBow.cs b/Items/Weapons/Ranged/AcidwoodBow.cs index f57096b36e..37af5aa1ea 100644 --- a/Items/Weapons/Ranged/AcidwoodBow.cs +++ b/Items/Weapons/Ranged/AcidwoodBow.cs @@ -1,10 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Placeables; namespace CalamityMod.Items.Weapons.Ranged { @@ -32,11 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = true; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - return false; - } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs index 62bfe59a96..a7b9d1d5e3 100644 --- a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs +++ b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index a062ad960f..f90dedf730 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -89,9 +89,9 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(20). AddIngredient(8). AddIngredient(20). + AddIngredient(20). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index bd1547fa45..4057a09072 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Ranged public class AngelicShotgun : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - private static float BulletSpeed = 12f; public override void SetDefaults() { @@ -36,8 +35,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.shootSpeed = BulletSpeed; - Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } @@ -49,68 +48,33 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int NumBullets = Main.rand.Next(5, 6+1); - 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) + { + type = ModContent.ProjectileType(); damage += HallowPointRound.BaseDamage - 7; + } // Fire a shotgun spread of bullets. + int NumBullets = Main.rand.Next(5, 6 + 1); + Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * velocity.Length(); for (int i = 0; i < NumBullets; ++i) { - float dx = Main.rand.NextFloat(-1.3f, 1.3f); - float dy = Main.rand.NextFloat(-1.3f, 1.3f); - Vector2 randomVelocity = baseVelocity + new Vector2(dx, dy); - - if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position, randomVelocity, Item.shoot, damage, knockback, player.whoAmI); - else - Projectile.NewProjectile(source, position, randomVelocity, type, damage, knockback, player.whoAmI); + Vector2 randomVelocity = baseVelocity.RotatedByRandom(MathHelper.ToRadians(12.5f)) * Main.rand.NextFloat(0.88f, 1.12f); + Projectile.NewProjectile(source, position + velocity.SafeNormalize(Vector2.Zero) * 16f, randomVelocity, type, damage, knockback, player.whoAmI); } // Spawn a beam from the sky ala Deathhail Staff or Lunar Flare + // This is more powerful if Hallow-Point Rounds (either naturally used or converted) are fired + bool empowered = type == ModContent.ProjectileType(); float laserSpeed = 8f; - int laserDamage = (int)(damage * 2.5f); - float laserKB = 5f; + int laserDamage = (int)(damage * (empowered ? 3.5f : 2f)); + float laserKB = knockback * 1.6f; - Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseDX = (float)Main.mouseX - Main.screenPosition.X - rrp.X; - float mouseDY = (float)Main.mouseY - Main.screenPosition.Y - rrp.Y; - - // Correct for grav potion - if (player.gravDir == -1f) - mouseDY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - rrp.Y; - - // Unnecessary NaN checks - float mouseDist = (float)Math.Sqrt((double)(mouseDX * mouseDX + mouseDY * mouseDY)); - if ((float.IsNaN(mouseDX) && float.IsNaN(mouseDY)) || (mouseDX == 0f && mouseDY == 0f)) - { - mouseDX = (float)player.direction; - } - else - { - mouseDist = laserSpeed / mouseDist; - } - - rrp = new Vector2(player.Center.X + (Main.rand.NextFloat(200f) * -player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - rrp.X = (rrp.X + player.Center.X) / 2f + Main.rand.NextFloat(-200f, 200f); - rrp.Y -= 100f; - mouseDX = (float)Main.mouseX + Main.screenPosition.X - rrp.X; - mouseDY = (float)Main.mouseY + Main.screenPosition.Y - rrp.Y; - if (mouseDY < 0f) - { - mouseDY *= -1f; - } - if (mouseDY < 20f) - { - mouseDY = 20f; - } - mouseDist = (float)Math.Sqrt((double)(mouseDX * mouseDX + mouseDY * mouseDY)); - mouseDist = laserSpeed / mouseDist; - mouseDX *= mouseDist; - mouseDY *= mouseDist; - Projectile.NewProjectile(source, rrp, new Vector2(mouseDX, mouseDY + Main.rand.NextFloat(-0.8f, 0.8f)), ModContent.ProjectileType(), laserDamage, laserKB, player.whoAmI); + Vector2 newPos = new Vector2(player.ClampedMouseWorld().X + Main.rand.NextFloat(-160f, 160f), player.MountedCenter.Y - 1200f); + Vector2 newVel = (player.ClampedMouseWorld() + Main.rand.NextVector2CircularEdge(8f, 8f) - newPos).SafeNormalize(Vector2.Zero) * laserSpeed; + Projectile laser = Projectile.NewProjectileDirect(source, newPos, newVel, Item.shoot, laserDamage, laserKB, player.whoAmI); + laser.scale = empowered ? 1.75f : 1f; // Play the sound of the laser beam SoundEngine.PlaySound(SoundID.Item72, player.Center); @@ -122,9 +86,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.SunplateBlock, 75). - AddIngredient(10). AddIngredient(15). - AddIngredient(7). + AddIngredient(7). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index afd87d2f30..3ca149441e 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -18,18 +18,18 @@ namespace CalamityMod.Items.Weapons.Ranged 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 SniperDmgMult = 9f; 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[Type] = true; public override void SetDefaults() { Item.width = 70; Item.height = 18; - Item.damage = 45; + Item.damage = 46; Item.DamageType = DamageClass.Ranged; Item.width = 70; Item.height = 18; @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void ModifyTooltips(List list) { string tooltip = Main.zenithWorld ? this.GetLocalizedValue("TooltipGFB") : this.GetLocalizedValue("TooltipNormal"); - list.FindAndReplace("[GFB]", tooltip); + list.FindAndReplace("[GFB]", Lang.SupportGlyphs(tooltip)); //Distortion wind do whisper one truth... } @@ -177,7 +177,7 @@ namespace CalamityMod.Items.Weapons.Ranged } } //shell - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { 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); diff --git a/Items/Weapons/Ranged/AntiMaterielRifle.cs b/Items/Weapons/Ranged/AntiMaterielRifle.cs index 3a1552f5c9..f777603609 100644 --- a/Items/Weapons/Ranged/AntiMaterielRifle.cs +++ b/Items/Weapons/Ranged/AntiMaterielRifle.cs @@ -46,7 +46,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(10). + AddIngredient(8). + AddIngredient(20). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index 642af025bf..c388ec1d2e 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Weapons/Ranged/ArcNovaDiffuser.cs b/Items/Weapons/Ranged/ArcNovaDiffuser.cs index 2ce192c482..737ffe8a93 100644 --- a/Items/Weapons/Ranged/ArcNovaDiffuser.cs +++ b/Items/Weapons/Ranged/ArcNovaDiffuser.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 28; Item.damage = 172; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = AftershotCooldownFrames; + Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; @@ -56,6 +56,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 holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } diff --git a/Items/Weapons/Ranged/Arietes41.cs b/Items/Weapons/Ranged/Arietes41.cs index 17bcbe0b77..d1de224282 100644 --- a/Items/Weapons/Ranged/Arietes41.cs +++ b/Items/Weapons/Ranged/Arietes41.cs @@ -1,8 +1,6 @@ using System; -using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles; -using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -22,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.width = 56; Item.height = 30; Item.scale = 0.85f; - Item.damage = 65; + Item.damage = 95; Item.DamageType = DamageClass.Ranged; Item.useTime = 13; Item.useAnimation = 13; @@ -104,7 +102,6 @@ namespace CalamityMod.Items.Weapons.Ranged 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/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 9623518c5f..9a37c667b7 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -74,13 +74,12 @@ namespace CalamityMod.Items.Weapons.Ranged mouseDistance = arrowSpeed / mouseDistance; mouseXDist *= mouseDistance; mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist; - 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; - CalamityGlobalProjectile cgp = Main.projectile[shotArrow].Calamity(); - cgp.allProjectilesHome = true; + Vector2 arrowVel = new Vector2(mouseXDist, mouseYDist); + + Projectile shotArrow = Projectile.NewProjectileDirect(source, realPlayerPos, arrowVel, type, damage, knockback, player.whoAmI); + shotArrow.noDropItem = true; + shotArrow.tileCollide = false; + shotArrow.Calamity().conditionalHomingRange = 300f; return false; } diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index 72e9b8da2c..621e409326 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -40,9 +40,9 @@ 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) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index b65b6d0d34..1d5ca3004e 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 34; Item.damage = 695; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.knockBack = 10f; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index d58ef12011..aae8b9e920 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.width = 30; - Item.height = 44; + Item.width = 52; + Item.height = 80; Item.damage = 5; Item.DamageType = DamageClass.Ranged; Item.useTime = 24; @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(0, 4); 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.RotatedBy(-0.55f), velocity.RotatedBy(0.025f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); - Projectile.NewProjectile(source, position + velocity.RotatedBy(0.55f), velocity.RotatedBy(-0.025f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position + velocity.RotatedBy(-0.95f), velocity.RotatedBy(0.025f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position + velocity.RotatedBy(0.95f), velocity.RotatedBy(-0.025f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/Barinade.png b/Items/Weapons/Ranged/Barinade.png index 0d4a6b1bf8..5ab49d1c58 100644 Binary files a/Items/Weapons/Ranged/Barinade.png and b/Items/Weapons/Ranged/Barinade.png differ diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index d258ec492c..12d468c942 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -36,9 +36,9 @@ 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 (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 5e3de62293..87895c9b14 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/BladedgeRailbow.cs b/Items/Weapons/Ranged/BladedgeRailbow.cs index c870e43a22..323cf7ae91 100644 --- a/Items/Weapons/Ranged/BladedgeRailbow.cs +++ b/Items/Weapons/Ranged/BladedgeRailbow.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; + // TODO -- This is a List. It should be handled in the way the new Collections are handled. #region GFB Arrow Array public static int[] arrowArr = { @@ -80,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Ranged ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 150dc202ea..93f7bfbfff 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -1,10 +1,13 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; 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 { @@ -13,33 +16,44 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.width = 76; - Item.height = 30; - Item.damage = 93; + Item.width = 88; + Item.height = 48; + Item.damage = 592; Item.DamageType = DamageClass.Ranged; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useTime = 39; + Item.useAnimation = 39; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 7.5f; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 14f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item11; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = 0.4f, Pitch = -0.5f, PitchVariance = 0.1f }; Item.autoReuse = true; Item.shootSpeed = 24f; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Rocket; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - // Figure out which rocket is used - public int RocketType; - public override void OnConsumeAmmo(Item ammo, Player player) => RocketType = ammo.type; + // 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; + player.Calamity().mouseWorldListener = true; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request(Texture + "Glow").Value); 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(), damage, knockback, player.whoAmI, RocketType); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // We set the rotation to the direction to the aim direction so the first frame doesn't appear bugged out. + holdout.velocity = (new Vector2(MathHelper.Lerp(player.Calamity().mouseWorld.X, player.Center.X, 0.55f), player.Center.Y) + new Vector2(0, -500) - player.Center).SafeNormalize(Vector2.Zero); return false; } } diff --git a/Items/Weapons/Ranged/BlissfulBombardier.png b/Items/Weapons/Ranged/BlissfulBombardier.png index 4950236e7d..4ee4918b80 100644 Binary files a/Items/Weapons/Ranged/BlissfulBombardier.png and b/Items/Weapons/Ranged/BlissfulBombardier.png differ diff --git a/Items/Weapons/Ranged/BlissfulBombardierGlow.png b/Items/Weapons/Ranged/BlissfulBombardierGlow.png new file mode 100644 index 0000000000..0be8a0440d Binary files /dev/null and b/Items/Weapons/Ranged/BlissfulBombardierGlow.png differ diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 29e9f63f78..4a0f30013d 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index b17ee348e4..8fc15e31b1 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -7,12 +7,13 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class BlossomFlux : ModItem, ILocalizedModType + public class BlossomFlux : LegendaryItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override Color? TooltipExtensionColor => new Color(109, 161, 84); public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -63,11 +64,11 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(damage * 3.15f), knockback * 60f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 3.15f), knockback * 60f, player.whoAmI); } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs index a985c94a1d..4bee81bf6d 100644 --- a/Items/Weapons/Ranged/BulletFilledShotgun.cs +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -19,17 +19,18 @@ namespace CalamityMod.Items.Weapons.Ranged Item.width = 64; Item.height = 24; Item.damage = 1; - Item.knockBack = 0f; - Item.useTime = Item.useAnimation = 75; Item.DamageType = DamageClass.Ranged; - Item.noMelee = true; - Item.autoReuse = true; - Item.useAmmo = AmmoID.Bullet; - Item.shootSpeed = 9f; + Item.useAnimation = Item.useTime = 75; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useAmmo = AmmoID.Bullet; Item.UseSound = SoundID.Item38; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.noMelee = true; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Ranged/Buzzkill.cs b/Items/Weapons/Ranged/Buzzkill.cs index a8af69f6c4..b5a9e54ea7 100644 --- a/Items/Weapons/Ranged/Buzzkill.cs +++ b/Items/Weapons/Ranged/Buzzkill.cs @@ -14,14 +14,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { Item.width = 76; Item.height = 42; - Item.damage = 50; + Item.damage = 56; Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index 5d4b85312a..1382b7b071 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 126; Item.height = 42; - Item.damage = 290; + Item.damage = 277; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 33; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -27,58 +27,20 @@ namespace CalamityMod.Items.Weapons.Ranged // No use sound is intentional Item.autoReuse = true; Item.shootSpeed = 14.5f; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Rocket; Item.channel = true; - } - - public override void HoldItem(Player player) - { - Item.channel = player.altFunctionUse != 2; - Item.noUseGraphic = player.altFunctionUse != 2; + Item.noUseGraphic = true; } public override Vector2? HoldoutOffset() => new Vector2(-20, 0); - public override bool AltFunctionUse(Player player) => true; - - // Right click doesn't use ammo because it's a detonation signal. - public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse != 2; - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 || player.altFunctionUse == 2; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Play a sound and detonate all in-flight rockets, but don't shoot anything. - if (player.altFunctionUse == 2) - { - SoundEngine.PlaySound(SoundID.Item110, position); - DetonateRockets(player); - return false; - } - - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 1); - // Otherwise just play a grenade launcher sound and fire a rocket. - //Main.PlaySound(SoundID.Item61, position); - //Projectile.NewProjectile(source, position, velocity, item.shoot, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, Item.shoot, 0, 0f, player.whoAmI, 1); return false; } - - private void DetonateRockets(Player player) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.owner != player.whoAmI || p.type != Item.shoot) - continue; - - // All rockets will instantly explode on the next frame and send packets to indicate as such. - p.timeLeft = 1; - p.netUpdate = true; - p.netSpam = 0; - } - } - - // Right clicking to detonate all rockets is very fast. - public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 5f : 1f; } } diff --git a/Items/Weapons/Ranged/ChromaticEruption.cs b/Items/Weapons/Ranged/ChromaticEruption.cs index e0184292d8..dd1cab2c5d 100644 --- a/Items/Weapons/Ranged/ChromaticEruption.cs +++ b/Items/Weapons/Ranged/ChromaticEruption.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; @@ -19,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.width = 64; - Item.height = 34; + Item.width = 166; + Item.height = 60; Item.damage = 94; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 6; @@ -50,17 +51,20 @@ 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 holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); 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/ChromaticEruptionGlow").Value); + public override void AddRecipes() { CreateRecipe(). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentVortex, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/ChromaticEruption.png b/Items/Weapons/Ranged/ChromaticEruption.png index d5748c9943..aba67996a9 100644 Binary files a/Items/Weapons/Ranged/ChromaticEruption.png and b/Items/Weapons/Ranged/ChromaticEruption.png differ diff --git a/Items/Weapons/Ranged/ChromaticEruptionGlow.png b/Items/Weapons/Ranged/ChromaticEruptionGlow.png new file mode 100644 index 0000000000..41eed8a1bb Binary files /dev/null and b/Items/Weapons/Ranged/ChromaticEruptionGlow.png differ diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs index 70569df399..0e19d9b1a0 100644 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ b/Items/Weapons/Ranged/ClaretCannon.cs @@ -48,9 +48,9 @@ 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) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index 52b3cd1dfd..5e0af0c3f6 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.width = 108; - Item.height = 38; + Item.width = 104; + Item.height = 62; Item.damage = 290; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; @@ -39,7 +39,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) { - Vector2 newPos = position + velocity.SafeNormalize(Vector2.UnitX) * 36f; + Vector2 newPos = position + new Vector2(0f, 5f) + velocity.SafeNormalize(Vector2.UnitX) * 36f; for (int i = 0; i < 3; i++) { Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); diff --git a/Items/Weapons/Ranged/CleansingBlaze.png b/Items/Weapons/Ranged/CleansingBlaze.png index bdf253d486..7d983db60f 100644 Binary files a/Items/Weapons/Ranged/CleansingBlaze.png and b/Items/Weapons/Ranged/CleansingBlaze.png differ diff --git a/Items/Weapons/Ranged/CleansingBlazeGlow.png b/Items/Weapons/Ranged/CleansingBlazeGlow.png index 3a8bdd621d..9c847dea46 100644 Binary files a/Items/Weapons/Ranged/CleansingBlazeGlow.png and b/Items/Weapons/Ranged/CleansingBlazeGlow.png differ diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index 64b5d58268..d2de85e06e 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 96; Item.damage = 770; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 8adb29a61a..96d14370c5 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 42; Item.damage = 2130; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 22; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.channel = true; Item.noMelee = true; diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index f8fe958161..c878c4894e 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -42,16 +42,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(20). + AddIngredient(). AddIngredient(5). + AddIngredient(20). AddTile(). Register(); } 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); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/CoralCannon.cs b/Items/Weapons/Ranged/CoralCannon.cs deleted file mode 100644 index 6e97debf19..0000000000 --- a/Items/Weapons/Ranged/CoralCannon.cs +++ /dev/null @@ -1,53 +0,0 @@ -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 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.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.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item61; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - Item.Calamity().canFirePointBlankShots = true; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (Main.rand.NextBool(5)) - { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback * 1.5f, player.whoAmI); - return false; - } - return true; - } - } -} diff --git a/Items/Weapons/Ranged/CoralCannon.png b/Items/Weapons/Ranged/CoralCannon.png deleted file mode 100644 index 78f131b76b..0000000000 Binary files a/Items/Weapons/Ranged/CoralCannon.png and /dev/null differ diff --git a/Items/Weapons/Ranged/CorinthPrime.cs b/Items/Weapons/Ranged/CorinthPrime.cs index 0ddd616eda..2bcfaa60db 100644 --- a/Items/Weapons/Ranged/CorinthPrime.cs +++ b/Items/Weapons/Ranged/CorinthPrime.cs @@ -14,7 +14,7 @@ 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[Type] = true; } public override void SetDefaults() @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(). AddIngredient(ItemID.VortexBeater). AddIngredient(ItemID.IllegalGunParts). - AddIngredient(2). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 2413651e0e..8a79b82295 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -38,9 +38,9 @@ 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 (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 7fa53c9b10..0574340fcb 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -48,7 +48,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.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index 960908d2c8..960f51a999 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[index].noDropItem = true; } - int projectile = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.CrystalDart, damage / 2, knockback, player.whoAmI); + int projectile = Projectile.NewProjectile(source, position, velocity, ProjectileID.CrystalDart, damage / 2, knockback, player.whoAmI); Main.projectile[projectile].penetrate = 3; return false; } diff --git a/Items/Weapons/Ranged/DeadSunsWind.cs b/Items/Weapons/Ranged/DeadSunsWind.cs index 8e81c00b99..d95779c143 100644 --- a/Items/Weapons/Ranged/DeadSunsWind.cs +++ b/Items/Weapons/Ranged/DeadSunsWind.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 24; Item.damage = 100; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 22; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ItemRarityID.Red; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; + Item.shootSpeed = 8f; Item.useAmmo = AmmoID.Gel; } diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index 81cf35ba6d..5b485b9487 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/DeathwindGlow").Value); } - + 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 < 4; ++index) @@ -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(), (int)(damage * 1.75), knockback, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 2), knockback, player.whoAmI); } else { - int baseArrow = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.75), knockback, player.whoAmI); + int baseArrow = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[baseArrow].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/DeepcoreGK2.cs b/Items/Weapons/Ranged/DeepcoreGK2.cs index b1f059e43b..cd98650a7f 100644 --- a/Items/Weapons/Ranged/DeepcoreGK2.cs +++ b/Items/Weapons/Ranged/DeepcoreGK2.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.ArmorPenetration = 10; Item.DamageType = DamageClass.Ranged; Item.noMelee = true; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 7f; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; diff --git a/Items/Weapons/Ranged/Disseminator.cs b/Items/Weapons/Ranged/Disseminator.cs deleted file mode 100644 index 255bbf4bc3..0000000000 --- a/Items/Weapons/Ranged/Disseminator.cs +++ /dev/null @@ -1,152 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - [LegacyName("Interfacer")] - public class Disseminator : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 66; - Item.height = 24; - Item.damage = 61; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 32; - Item.useAnimation = 32; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.UseSound = SoundID.Item38; - Item.autoReuse = true; - Item.shootSpeed = 13f; - Item.shoot = ProjectileID.PurificationPowder; - Item.useAmmo = AmmoID.Bullet; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override bool CanConsumeAmmo(Item ammo, Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - - int bulletAmt = 4; - for (int index = 0; index < bulletAmt; ++index) - { - velocity.X += Main.rand.Next(-15, 16) * 0.05f; - velocity.Y += Main.rand.Next(-15, 16) * 0.05f; - int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - Main.projectile[proj].extraUpdates += 2; - } - - 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); - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.chaseable && npc.lifeMax > 5 && !npc.dontTakeDamage && !npc.friendly && !npc.immortal) - { - if (npc.Hitbox.Intersects(rectangle)) - { - if (targetArrayIndex < maxTargets) - { - targets[targetArrayIndex] = npc.whoAmI; - targetArrayIndex++; - } - else - break; - } - } - } - - if (targetArrayIndex == 0) - return false; - - Vector2 targetPosition; - int extraBulletDamage = (int)(damage * 0.7); - - for (int j = 0; j < targetArrayIndex; j++) - { - targetPosition = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - targetPosition.X = (targetPosition.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); - targetPosition.Y -= 100 * j; - - 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 += 14; - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft /= 2; - - targetPosition = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y + 600f); - targetPosition.X = (targetPosition.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); - targetPosition.Y += 100 * j; - - 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 += 14; - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft /= 2; - } - - if (targetArrayIndex == maxTargets) - return false; - - // Fire bullets at the same targets if 8 unique targets aren't found - for (int k = 0; k < maxTargets - targetArrayIndex; k++) - { - int randomTarget = Main.rand.Next(targetArrayIndex); - - targetPosition = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - targetPosition.X = (targetPosition.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); - targetPosition.Y -= 100 * randomTarget; - - 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 += 14; - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft /= 2; - - targetPosition = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y + 600f); - targetPosition.X = (targetPosition.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); - targetPosition.Y += 100 * randomTarget; - - 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 += 14; - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft /= 2; - } - - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.LunarBar, 5). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/Disseminator.png b/Items/Weapons/Ranged/Disseminator.png deleted file mode 100644 index 204c17b26b..0000000000 Binary files a/Items/Weapons/Ranged/Disseminator.png and /dev/null differ diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs index 6751d3d00a..f36fde133d 100644 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ b/Items/Weapons/Ranged/DodusHandcannon.cs @@ -49,8 +49,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 15). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index c3162d97ca..df0e1a9c79 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -20,114 +20,43 @@ namespace CalamityMod.Items.Weapons.Ranged 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 }; - public SlotId WeldSoundSlot; - - public static int BaseReuseDelay = 14; - public static int MinReuseDelay = 4; - public static int ShotsToMaxFirerate = 20; - public static int ShotsToFireBeams = ShotsToMaxFirerate + 20; - public static int ShotsToReset = ShotsToFireBeams + 50; - public int Counter = 0; public override void SetDefaults() { Item.width = 124; Item.height = 72; - Item.damage = 478; + Item.damage = 328; Item.DamageType = DamageClass.Ranged; - Item.useTime = 5; - Item.useAnimation = 9; - Item.reuseDelay = BaseReuseDelay; + Item.useTime = 30; + Item.useAnimation = 30; Item.autoReuse = true; + Item.channel = true; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; + Item.noUseGraphic = true; Item.knockBack = 4.5f; Item.UseSound = null; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3.5f; Item.useAmmo = AmmoID.Gel; Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } - public override bool CanConsumeAmmo(Item ammo, Player player) => Counter < ShotsToFireBeams && Main.rand.NextFloat() > 0.80f; - - public override Vector2? HoldoutOffset() => new Vector2(27, 6); - + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + 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) { - Counter++; - if (Counter < ShotsToFireBeams) - { - if (Counter % 2 == 1) - SoundEngine.PlaySound(FireballSound, player.Center); + Projectile holdout = Projectile.NewProjectileDirect(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(2.5f)); - Projectile.NewProjectile(source, position, newVel * Main.rand.NextFloat(1.2f, 0.8f), type, damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // 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); - Item.reuseDelay = (int)Utils.Remap(Counter, 0, ShotsToMaxFirerate, BaseReuseDelay, MinReuseDelay); - } - else - { - if (Counter == ShotsToFireBeams) - SoundEngine.PlaySound(WeldingStart, player.Center); - - if (SoundEngine.TryGetActiveSound(WeldSoundSlot, out var WeldSound) && WeldSound.IsPlaying) - WeldSound.Position = player.Center; - if (player.Calamity().DragonsBreathAudioCooldown2 == 0 && Counter >= ShotsToFireBeams + 5) - { - player.Calamity().DragonsBreathAudioCooldown2 = 30; - WeldSoundSlot = SoundEngine.PlaySound(WeldingShoot, player.Center); - } - - Projectile.NewProjectile(source, position, velocity * 2f, type, damage, knockback, player.whoAmI, 1); - Item.reuseDelay = 0; - - if (Counter >= ShotsToReset) - { - Counter = 0; - Item.reuseDelay = BaseReuseDelay; - SoundEngine.PlaySound(SpeedBlaster.Empty, player.Center); - Projectile.NewProjectile(source, player.Center, new Vector2(5 * -player.direction, -5), ModContent.ProjectileType(), Main.zenithWorld ? 250000 : 1, knockback, player.whoAmI); - WeldSound?.Stop(); - } - } return false; } - - public override void UpdateInventory(Player player) - { - // Reset speed back to initial once swapped to another item (including one of itself) - if (player.ActiveItem() != Item) - Counter = 0; - } - - public override void UseStyle(Player player, Rectangle heldItemFrame) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - - Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; - Vector2 itemSize = new Vector2(124, 72); - Vector2 itemOrigin = new Vector2(-17, 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 += Counter == 0 ? -0.25f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction : 0; - - player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); - } } } diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index e7d1ad1b07..36ca91f8d5 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Ranged } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } return false; @@ -103,9 +103,9 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(12). - AddIngredient(4). AddIngredient(5). + AddIngredient(4). + AddIngredient(12). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/DriftwoodBow.cs b/Items/Weapons/Ranged/DriftwoodBow.cs index f79dfada00..66322c7e39 100644 --- a/Items/Weapons/Ranged/DriftwoodBow.cs +++ b/Items/Weapons/Ranged/DriftwoodBow.cs @@ -1,7 +1,6 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +9,7 @@ namespace CalamityMod.Items.Weapons.Ranged public class DriftwoodBow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() { Item.damage = 10; @@ -31,32 +31,23 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = true; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); - if (GetEffects) + if (IsPlayerInContactWithWater(player)) { + velocity *= 1.3f; + knockback += 1f; + for (int i = 0; i <= 18; i++) { - Dust dust = Dust.NewDustPerfect(position + velocity * 3, 160, velocity.RotatedByRandom(MathHelper.ToRadians(19f)) * Main.rand.NextFloat(0.8f, 3.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + Dust dust = Dust.NewDustPerfect(position + velocity * 3f, 160, velocity.RotatedByRandom(MathHelper.ToRadians(19f)) * Main.rand.NextFloat(0.8f, 3.8f), Scale: Main.rand.NextFloat(1.2f, 1.6f)); dust.noGravity = true; } - Item.useTime = 23; - Item.useAnimation = 23; - Item.knockBack = 1f; - Item.shootSpeed = 8.6f; } - else - { - Item.useTime = 28; - Item.useAnimation = 28; - Item.knockBack = 0f; - Item.shootSpeed = 6.6f; - } - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - return false; } + + public override float UseSpeedMultiplier(Player player) => IsPlayerInContactWithWater(player) ? 1.2f : 1f; + public override void AddRecipes() { CreateRecipe(). @@ -64,5 +55,11 @@ namespace CalamityMod.Items.Weapons.Ranged AddTile(TileID.WorkBenches). Register(); } + + private static bool IsPlayerInContactWithWater(Player player) + { + bool surface = player.Center.Y < Main.worldSurface * 16.0; + return (Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet); + } } } diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index 5a17b2119f..6a6d5e6b82 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -40,9 +40,9 @@ 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) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 79febc9ceb..65e5339690 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 76; Item.height = 46; - Item.damage = 239; + Item.damage = 250; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 6; + Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -38,6 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // 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; diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index 573af9b6a4..51ecdc5739 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -11,7 +11,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index 707d82448f..868f04b376 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -37,22 +37,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 152; + Item.height = 58; Item.damage = 124; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = OriginalUseTime; + Item.useAnimation = Item.useTime = OriginalUseTime; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; - Item.width = 152; - Item.height = 58; + Item.useAmmo = AmmoID.Rocket; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.95f, PitchVariance = 0.1f }; + Item.useStyle = ItemUseStyleID.Shoot; + Item.channel = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.channel = true; - Item.useAmmo = AmmoID.Rocket; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.95f, PitchVariance = 0.1f }; } // Obviously we don't want multiple holdouts existing at the same time. @@ -68,6 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // 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); diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index 78d2f57a2b..956f36a2e7 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -30,22 +30,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 88; + Item.height = 28; Item.damage = 73; // Here you're modifying the shrapnel's damage. Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 44; + Item.useAnimation = Item.useTime = 44; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; - Item.width = 88; - Item.height = 28; + Item.useAmmo = AmmoID.Rocket; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.7f, PitchVariance = 0.1f }; + Item.useStyle = ItemUseStyleID.Shoot; + Item.channel = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.channel = true; - Item.useAmmo = AmmoID.Rocket; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - 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. @@ -61,6 +63,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // 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); diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index d2d1e03035..fb1b12d224 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -2,7 +2,6 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -42,11 +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); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => type = Item.shoot; public override void AddRecipes() { @@ -54,10 +49,22 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.SnowballCannon). AddIngredient(ItemID.IllegalGunParts). AddIngredient(10). - AddIngredient(ItemID.Bone, 50). - AddIngredient(25). - AddIngredient(ItemID.WaterBucket, 3). + AddIngredient(ItemID.Bone, 10). + AddIngredient(10). AddTile(TileID.Anvils). + AddCondition(Condition.NotRemixWorld). + Register(); + + // CIT 16NOV2024: Due to Snowball Cannon being swapped with Ice Bow in Remix, Flurrystorm Cannon uses Ice Bow in its recipe there. + // Yes, this makes no sense. I don't care; I prefer obtainability over making sense. + CreateRecipe(). + AddIngredient(ItemID.IceBow). + AddIngredient(ItemID.IllegalGunParts). + AddIngredient(10). + AddIngredient(ItemID.Bone, 10). + AddIngredient(10). + AddTile(TileID.Anvils). + AddCondition(Condition.RemixWorld). Register(); } } diff --git a/Items/Weapons/Ranged/FreedomStar.cs b/Items/Weapons/Ranged/FreedomStar.cs index b97730696b..cf45be4de1 100644 --- a/Items/Weapons/Ranged/FreedomStar.cs +++ b/Items/Weapons/Ranged/FreedomStar.cs @@ -59,10 +59,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.LunarBar, 4). - AddIngredient(8). AddIngredient(12). AddIngredient(18). + AddIngredient(8). + AddIngredient(ItemID.LunarBar, 4). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/Fungicide.cs b/Items/Weapons/Ranged/Fungicide.cs index b7142eaa2b..830466446c 100644 --- a/Items/Weapons/Ranged/Fungicide.cs +++ b/Items/Weapons/Ranged/Fungicide.cs @@ -39,9 +39,9 @@ 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) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index 9db3fecab5..175b7691be 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged { 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, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 3348115c70..4068714c06 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.RifleScope). + AddIngredient(ItemID.ElfMelter). AddIngredient(6). AddIngredient(4). AddIngredient(12). diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index f332f79ce0..45ca6ba331 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -4,7 +4,6 @@ using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -42,10 +41,10 @@ namespace CalamityMod.Items.Weapons.Ranged // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 15; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - Projectile.NewProjectile(source, position + player.DirectionTo(Main.MouseWorld) * 48f, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; + position += velocity.SafeNormalize(Vector2.UnitX) * 48f; + type = Item.shoot; } public override Vector2? HoldoutOffset() => new Vector2(-33, 0); diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 6ec064fecf..0dedc0af37 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using System.Linq; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -10,121 +14,64 @@ namespace CalamityMod.Items.Weapons.Ranged public class Hellborn : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public const float ExplosionDamageMultiplier = 3f; - + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + } public override void SetDefaults() { Item.width = 62; Item.height = 34; - Item.damage = 20; + Item.damage = 320; Item.DamageType = DamageClass.Ranged; - Item.useAnimation = Item.useTime = 20; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 2f; + Item.knockBack = 2.5f; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.UseSound = SoundID.Item11; + + Item.noMelee = true; + Item.UseSound = null; + Item.noUseGraphic = true; + Item.channel = true; Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; + + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } - - public override float UseTimeMultiplier(Player player) => 1f - 0.5f * (player.Calamity().hellbornBoost * (1f / 600f)); - - public override void ModifyWeaponDamage(Player player, ref StatModifier damage) => damage *= 1f + player.Calamity().hellbornBoost * (1f / 600f); - - public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback *= 1f + (player.Calamity().hellbornBoost * (1f / 600f)); - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - //Custom melee hitbox - public override bool? CanHitNPC(Player player, NPC target) + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) { - Rectangle targetHitbox = target.Hitbox; + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; - float collisionPoint = 0f; - float gunLength = 66f; - float gunHeight = 15; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLength), gunHeight, ref collisionPoint) ? null : false; + if (player.Calamity().cooldowns.TryGetValue(HellbornShots.ID, out var cooldown)) + { + cooldown.timeLeft = 8 - player.Calamity().hellbornShots; + } + else + { + player.AddCooldown(HellbornShots.ID, 8); + } } - 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 < 3; index++) - { - float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; + // Only one out at a time + if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI)) + return false; + float gunType = 0; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) + gunType = 5; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, gunType); - if (type == ProjectileID.Bullet) - { - int bullet = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockback, player.whoAmI); - Main.projectile[bullet].usesLocalNPCImmunity = true; - Main.projectile[bullet].localNPCHitCooldown = 10; - } - else - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // 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 ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - player.Calamity().hellbornBoost = 600; - modifiers.SourceDamage *= ExplosionDamageMultiplier; - int touchDamage = player.CalcIntDamage(Item.damage); - player.ApplyDamageToNPC(target, touchDamage, 0f, 0, false); - float firstDustScale = 3.4f; - float secondDustScale = 1.6f; - float thirdDustScale = 4f; - Vector2 dustRotation = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); - Vector2 dustVelocity = dustRotation * target.velocity.Length(); - 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, 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, 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; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - } - for (int j = 0; j < 40; j++) - { - 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; - dust.velocity.Y -= 6f; - dust.velocity *= 0.5f; - dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); - } - } - - public override void ModifyHitPvp(Player player, Player target, ref Player.HurtModifiers modifiers) - { - modifiers.SourceDamage *= 10; - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire3, 360); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(BuffID.OnFire3, 360); - } } } diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 0dbfca56dd..dfb6c5bb78 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged { 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); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Hydra.cs b/Items/Weapons/Ranged/Hydra.cs index d4a5d9ffa6..521f677b7a 100644 --- a/Items/Weapons/Ranged/Hydra.cs +++ b/Items/Weapons/Ranged/Hydra.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 31868841d0..6f702331f1 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public int SineCounter = 0; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -55,6 +55,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) { int shotType = (player.altFunctionUse == 2 ? type : ModContent.ProjectileType()); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction position = position + (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.UnitX) * 65; float sine = (float)Math.Sin(SineCounter * 0.175f / MathHelper.Pi) * 3.5f; SineCounter++; @@ -82,7 +84,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(10). + AddIngredient(8). + AddIngredient(20). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index 65b84fc6fa..cbcef379cc 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -78,9 +78,9 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.LargeRuby). AddIngredient(15). AddIngredient(25). - AddIngredient(5). AddIngredient(8). AddIngredient(20). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/Kingsbane.cs b/Items/Weapons/Ranged/Kingsbane.cs index c98cb01137..1fd0f82a85 100644 --- a/Items/Weapons/Ranged/Kingsbane.cs +++ b/Items/Weapons/Ranged/Kingsbane.cs @@ -40,7 +40,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && 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 holdout = Projectile.NewProjectileDirect(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } diff --git a/Items/Weapons/Ranged/Leviatitan.cs b/Items/Weapons/Ranged/Leviatitan.cs index 2130046725..61010b9c37 100644 --- a/Items/Weapons/Ranged/Leviatitan.cs +++ b/Items/Weapons/Ranged/Leviatitan.cs @@ -1,6 +1,11 @@ -using CalamityMod.Projectiles.Ranged; +using System; +using System.Diagnostics.Metrics; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Build.Tasks; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,48 +15,108 @@ namespace CalamityMod.Items.Weapons.Ranged public class Leviatitan : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + // Every sixth shot fires homing Aberrations, then resets the counter to 2. + // This is intentional so you don't get the Aberrations instantly when you start firing and have to play around it. + private int shotCounter = 1; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } + public override void SetDefaults() { Item.width = 82; Item.height = 28; - Item.damage = 77; + Item.damage = 121; Item.DamageType = DamageClass.Ranged; - Item.useTime = 10; - Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = Item.useAnimation = 18; //Try not to change this if you can help it. Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.UseSound = SoundID.Item92; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") { Pitch = 0.65f, Volume = 0.4f }; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 13f; + Item.useStyle = ItemUseStyleID.Shoot; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override bool AltFunctionUse(Player player) { - return new Vector2(-15, 0); + return true; } + public override bool CanUseItem(Player player) + { + Item.UseSound = player.altFunctionUse == 2 ? SoundID.NPCHit56 : new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") { Pitch = 0.65f, Volume = 0.3f }; + return base.CanUseItem(player); + } + public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? (1f / 3f) : 1f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f; + // Reposition to the gun's tip. Calculated seperately due to the two different shot styles. + Vector2 boulderPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); + Vector2 shotPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -6f : 3f)).RotatedBy(velocity.ToRotation()); - if (type == ProjectileID.Bullet) + if (player.altFunctionUse == 2) { - if (Main.rand.NextBool(3)) - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.5), knockback, player.whoAmI); - else - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + int index = Projectile.NewProjectile(source, boulderPos, velocity * 0.7f, ModContent.ProjectileType(), (int)(damage * 2f), knockback, player.whoAmI); } else - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - + { + Projectile.NewProjectile(source, shotPos, velocity, Item.shoot, damage, knockback, player.whoAmI); + } + if (shotCounter == 7) + { + SoundEngine.PlaySound(SoundID.Zombie38 with { Volume = SoundID.Zombie38.Volume * 0.5f }); + for (int i = 0; i <= 1; i++) + { + float projSpeed = Item.shootSpeed; + Projectile.NewProjectile(source, position + Main.rand.NextVector2Circular(150, 150), velocity * projSpeed, ModContent.ProjectileType(), (int)(damage * 1.3), knockback, player.whoAmI); + } + } + shotCounter++; + if (shotCounter > 7) + shotCounter = 2; return false; } + + //Thanks to Xyk's incredible recoil code, we give both left click and right click different recoils without having to use a holdout. + 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; + + float pullback = 7f; + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.1f) + pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2); + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback; + Vector2 itemSize = new Vector2(52, 28); + 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 += (player.altFunctionUse == 2 ? -0.15f : 0) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } } } + diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index 73882fcfb2..ea46bd671f 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 32; Item.height = 62; - Item.damage = 25; + Item.damage = 27; Item.DamageType = DamageClass.Ranged; Item.useTime = 22; Item.useAnimation = 22; diff --git a/Items/Weapons/Ranged/MagnaCannon.cs b/Items/Weapons/Ranged/MagnaCannon.cs index aa926fe2ab..d31343d31b 100644 --- a/Items/Weapons/Ranged/MagnaCannon.cs +++ b/Items/Weapons/Ranged/MagnaCannon.cs @@ -22,7 +22,7 @@ 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 SetStaticDefaults() => ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; public override void SetDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 34; Item.damage = 30; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = AftershotCooldownFrames; + Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; @@ -52,7 +52,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) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter); - Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter), ModContent.ProjectileType(), damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter), ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index f23f2fe0e1..c329d10c8c 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -5,7 +5,6 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -39,11 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-30, -10); } - 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); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => type = Item.shoot; public override bool CanConsumeAmmo(Item ammo, Player player) { diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index e9fe5a2b9f..0645679232 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -54,8 +54,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.BeesKnees). - AddIngredient(10). AddIngredient(5). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index 80d0526b43..5f22951eac 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -1,6 +1,6 @@ using System; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 72; Item.height = 32; - Item.damage = 37; + Item.damage = 41; Item.DamageType = DamageClass.Ranged; Item.useTime = 6; Item.useAnimation = 6; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item11; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index 2b06fe3f35..17194984f0 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.damage = 85; Item.DamageType = DamageClass.Ranged; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 60; + Item.useAnimation = Item.useTime = 60; Item.shootSpeed = 25f; Item.knockBack = 20f; @@ -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) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); - Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs deleted file mode 100644 index 76e1a08c05..0000000000 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ /dev/null @@ -1,61 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -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.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.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item33; - Item.autoReuse = true; - Item.shootSpeed = 25f; - Item.shoot = ModContent.ProjectileType(); - 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) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(2). - AddIngredient(). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/MolecularManipulator.png b/Items/Weapons/Ranged/MolecularManipulator.png deleted file mode 100644 index ea6f70892c..0000000000 Binary files a/Items/Weapons/Ranged/MolecularManipulator.png and /dev/null differ diff --git a/Items/Weapons/Ranged/MonolithBow.cs b/Items/Weapons/Ranged/MonolithBow.cs index e467e12c49..fa8b2ea872 100644 --- a/Items/Weapons/Ranged/MonolithBow.cs +++ b/Items/Weapons/Ranged/MonolithBow.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Items/Weapons/Ranged/NitroExpressRifle.cs b/Items/Weapons/Ranged/NitroExpressRifle.cs index c7111ac95b..021467e500 100644 --- a/Items/Weapons/Ranged/NitroExpressRifle.cs +++ b/Items/Weapons/Ranged/NitroExpressRifle.cs @@ -8,7 +8,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -48,30 +47,26 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.Musket). - AddIngredient(3). AddIngredient(3). + AddIngredient(3). AddIngredient(ItemID.ExplosivePowder, 5). AddTile(TileID.Anvils). Register(); CreateRecipe(). AddIngredient(ItemID.TheUndertaker). - AddIngredient(3). 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) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - Vector2 recoilVelocity = velocity; - recoilVelocity.Normalize(); - player.velocity += -recoilVelocity * 7f; + player.velocity += velocity.SafeNormalize(Vector2.UnitX) * -7f; if (type == ProjectileID.Bullet) type = ModContent.ProjectileType(); - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f); - return false; } public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index 2f7500ee26..ab4a0922b6 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { Item.width = 140; Item.height = 42; - Item.damage = 7077; + Item.damage = 7777; Item.knockBack = 15f; Item.shootSpeed = 30f; Item.useStyle = ItemUseStyleID.Shoot; @@ -59,7 +59,8 @@ namespace CalamityMod.Items.Weapons.Ranged } Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, (cheater ? 1000 : 0), loadedShots); - + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // 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); diff --git a/Items/Weapons/Ranged/NullificationPistol.cs b/Items/Weapons/Ranged/NullificationPistol.cs index cca4e3d8c1..f196a583e4 100644 --- a/Items/Weapons/Ranged/NullificationPistol.cs +++ b/Items/Weapons/Ranged/NullificationPistol.cs @@ -1,6 +1,9 @@ -using CalamityMod.Projectiles.Ranged; +using System; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,40 +14,116 @@ namespace CalamityMod.Items.Weapons.Ranged public class NullificationPistol : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public bool shotType = true; // true = positive shot, false = negative shot + public float mult = 0; public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() { Item.width = 52; Item.height = 28; - Item.damage = 170; + Item.damage = 190; Item.DamageType = DamageClass.Ranged; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useTime = 18; + Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 7f; + Item.knockBack = 0.1f; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.UseSound = SoundID.Item33; Item.autoReuse = true; - Item.shootSpeed = 25f; + Item.shootSpeed = 8f; Item.shoot = ModContent.ProjectileType(); - Item.Calamity().canFirePointBlankShots = true; } - - public override Vector2? HoldoutOffset() + public override bool AltFunctionUse(Player player) => true; + public override float UseSpeedMultiplier(Player player) { - return new Vector2(-5, 0); - } + if (player.altFunctionUse == 2) + return 1.3f; + + if (Main.zenithWorld) + return 3 * (shotType ? 0.7f : 1); + + if (!shotType) + return 1.5f - mult; + + return 1f - mult; + } 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); + if (player.altFunctionUse == 2) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = -0.5f + (shotType ? 0.5f : 0) }, position); + for (int i = 0; i < 18; i++) + { + Dust dust = Dust.NewDustPerfect(position, shotType ? ModContent.DustType() : ModContent.DustType(), (velocity).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.25f); + dust.color = shotType ? Color.White : (Main.rand.NextBool() ? Color.Orchid : Color.Turquoise); + } + shotType = !shotType; + mult = 0; + } + else if (shotType) + { + for (int i = 0; i < 3; i++) + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage / 3, 0, player.whoAmI, 0, 0, i); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage / 2, 0, player.whoAmI, 0, 0); + if (mult < 0.35f) + mult += 0.013f; + } + else + { + Projectile aBeam = Projectile.NewProjectileDirect(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 0.7f), 0, player.whoAmI, 0, 5); + aBeam.penetrate = 1; + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage / 2, 0, player.whoAmI, 0, 5); + if (mult < 0.5f) + mult += 0.013f; + } + if (player.altFunctionUse != 2) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/NullShot"); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0f, 0.2f) + (!shotType ? 0.3f : 0) }, position); + } 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; + + float pullback = 7f; + + 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) + pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2); + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback; + Vector2 itemSize = new Vector2(52, 28); + 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 += (player.altFunctionUse == 2 ? -0.15f : 0) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } } } diff --git a/Items/Weapons/Ranged/OntologicalDespoiler.cs b/Items/Weapons/Ranged/OntologicalDespoiler.cs new file mode 100644 index 0000000000..89fb5c4a7a --- /dev/null +++ b/Items/Weapons/Ranged/OntologicalDespoiler.cs @@ -0,0 +1,126 @@ +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; +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; + +namespace CalamityMod.Items.Weapons.Ranged +{ + [LegacyName("MolecularManipulator")] + public class OntologicalDespoiler : ModItem, ILocalizedModType + { + public static readonly SoundStyle ChargeLV1 = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV1"); + public static readonly SoundStyle ChargeLV2 = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV2"); + public static readonly SoundStyle ChargeStart = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeStart"); + public static readonly SoundStyle ChargeLoop = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLoop"); + internal static readonly int ChargeLoopSoundFrames = 151; + public static readonly SoundStyle SmallShot = new("CalamityMod/Sounds/Item/ArcNovaDiffuserSmallShot"); + public static readonly SoundStyle BigShot = new("CalamityMod/Sounds/Item/ArcNovaDiffuserBigShot"); + public static readonly SoundStyle BigShot2 = new("CalamityMod/Sounds/Item/OntologicalDespoilerLargeShot"); + public static readonly SoundStyle SmallImpact = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV1"); + public static readonly SoundStyle LargeImpact = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV2"); + + public bool shotType = true; // true = positive shot, false = negative shot + public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 88; + Item.height = 34; + Item.damage = 387; + Item.DamageType = DamageClass.Ranged; + Item.useAnimation = Item.useTime = 8; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 6f; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + Item.UseSound = null; + Item.autoReuse = false; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + } + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 25; + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + 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) + { + // Only one out at a time + if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI)) + return false; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) + { + Projectile holdout2 = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, Item.shoot, player.ActiveItem().damage, 0f, player.whoAmI, 0, 0, 10 + (shotType ? 5 : 0)); + holdout2.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + SoundStyle fire = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = -0.5f + (shotType ? 0.5f : 0) }, player.Center); + shotType = !shotType; + } + else + { + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, shotType ? 0 : 5); + holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); + } + return false; + } + public override void ModifyTooltips(List list) + { + Player Owner = Main.LocalPlayer; + if (Owner is null) + return; + float rate = (Main.GlobalTimeWrappedHourly * 3); + List eColors = new List() + { + Owner.shirtColor, + Color.Lerp(Owner.shirtColor, Color.Black, 0.3f), + Color.Lerp(Owner.shirtColor, Color.White, 0.2f), + Color.Lerp(Owner.shirtColor, Color.White, 0.4f) + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color eTooltipColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + if (Owner.shirtColor == Color.White) + eTooltipColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip7"); + if (line != null) + line.OverrideColor = Color.Lerp(eTooltipColor, Color.White, 0.2f); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(). + AddIngredient(2). + AddIngredient(). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/OntologicalDespoiler.png b/Items/Weapons/Ranged/OntologicalDespoiler.png new file mode 100644 index 0000000000..ae67daa865 Binary files /dev/null and b/Items/Weapons/Ranged/OntologicalDespoiler.png differ diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index 590aa09ec2..4dddf0b7fd 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -42,13 +42,13 @@ namespace CalamityMod.Items.Weapons.Ranged int shardDamage = (int)(2.5f * damage); float shardKB = 2f * knockback; Vector2 offset = new Vector2(Main.rand.Next(-25, 26) * 0.05f, Main.rand.Next(-25, 26) * 0.05f); - Projectile shard = Projectile.NewProjectileDirect(source, position, velocity + offset, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + Projectile shard = Projectile.NewProjectileDirect(source, position, velocity + offset, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI); shard.timeLeft = (int)(shard.timeLeft * 1.25f); for (int i = 0; i < 4; i++) { offset = new Vector2(Main.rand.Next(-45, 46) * 0.05f, Main.rand.Next(-45, 46) * 0.05f); - Projectile.NewProjectile(source, position, velocity + offset, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity + offset, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index dd8f167c67..175f3a44a0 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 34; Item.damage = 90; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged // The shard deals 145% damage and double knockback int shardDamage = (int)(1.45f * damage); float shardKB = 2f * knockback; - Projectile shard = Projectile.NewProjectileDirect(source, position, velocity, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + Projectile shard = Projectile.NewProjectileDirect(source, position, velocity, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI); shard.timeLeft = (int)(shard.timeLeft * 1.4f); // Fire three symmetric pairs of bullets alongside it @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Ranged float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f); Vector2 ccwVelocity = velocity.RotatedBy(-randAngle) * randVelMultiplier; Vector2 cwVelocity = velocity.RotatedBy(randAngle) * randVelMultiplier; - Projectile.NewProjectile(source, position, ccwVelocity, type, damage, knockback, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(source, position, cwVelocity, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, ccwVelocity, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, cwVelocity, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index 2367059962..e2abf396ac 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 24; Item.damage = 33; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = AftershotCooldownFrames; + Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; @@ -51,7 +51,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) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); - Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/P90.cs b/Items/Weapons/Ranged/P90.cs index 0ffc14bb2c..6a810bba8d 100644 --- a/Items/Weapons/Ranged/P90.cs +++ b/Items/Weapons/Ranged/P90.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 60; Item.height = 28; - Item.damage = 5; + Item.damage = 6; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 2; + Item.useAnimation = Item.useTime = 2; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -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) { if (fireShot) - Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.03f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.03f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); fireShot = !fireShot; return false; } diff --git a/Items/Weapons/Ranged/PestilentDefiler.cs b/Items/Weapons/Ranged/PestilentDefiler.cs index cfa96401ed..f8eebf70e4 100644 --- a/Items/Weapons/Ranged/PestilentDefiler.cs +++ b/Items/Weapons/Ranged/PestilentDefiler.cs @@ -40,9 +40,9 @@ 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) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; @@ -52,8 +52,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(12). AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index b9d4a58cf8..1b25904346 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -25,7 +25,11 @@ namespace CalamityMod.Items.Weapons.Ranged // Right-click stats public static float RightClickVelocityMult = 2.5f; - public static int RightClickCooldown = 30; + public static int RightClickCooldown = 25; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } public override void SetDefaults() { @@ -34,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.damage = 495; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = LightBombCooldown; + Item.useAnimation = Item.useTime = LightBombCooldown; Item.shootSpeed = 6f; Item.knockBack = 2f; Item.shoot = ModContent.ProjectileType(); @@ -55,33 +59,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void HoldItem(Player player) { - if (player.whoAmI != Main.myPlayer) - return; - - // Right-click channeling - player.Calamity().rightClickListener = true; - - if (player.Calamity().mouseRight && CanUseItem(player) && !Main.mapFullscreen && !Main.blockMouse) - { - // Only one out at a time - if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI)) - return; - // If you don't have any Gel don't even spawn the holdout - if (!player.HasAmmo(Item)) - return; - - var source = player.GetSource_ItemUse_WithPotentialAmmo(Item, ItemID.Gel); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, Item.shoot, 0, 0f, player.whoAmI); - } + 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) { // 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); + { + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) + Projectile.NewProjectile(source, position, Vector2.Zero, type, 0, 0f, player.whoAmI); + else + return false; + } + else + Projectile.NewProjectile(source, position, Vector2.Zero, type, 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/PlagueTaintedSMG.cs b/Items/Weapons/Ranged/PlagueTaintedSMG.cs index 1eb3e132a5..c5c81448e0 100644 --- a/Items/Weapons/Ranged/PlagueTaintedSMG.cs +++ b/Items/Weapons/Ranged/PlagueTaintedSMG.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 50; Item.damage = 78; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 12; + Item.useAnimation = Item.useTime = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; @@ -65,8 +65,8 @@ namespace CalamityMod.Items.Weapons.Ranged // Fire drones to the left and right. for (int i = 0; i < 3; i++) { - Projectile.NewProjectile(source, barrelPosition, velocity.RotatedBy(-Spread * (i + 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1f, player.Calamity().alchFlask || player.Calamity().spiritOrigin ? 1f : 0f); - Projectile.NewProjectile(source, barrelPosition, velocity.RotatedBy(Spread * (i + 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1f, player.Calamity().alchFlask || player.Calamity().spiritOrigin ? 1f : 0f); + Projectile.NewProjectile(source, barrelPosition, velocity.RotatedBy(-Spread * (i + 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1f, player.Calamity().alchFlask ? 1f : 0f); + Projectile.NewProjectile(source, barrelPosition, velocity.RotatedBy(Spread * (i + 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1f, player.Calamity().alchFlask ? 1f : 0f); } } else diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index d06d34e907..6838dd2b28 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.DaedalusStormbow). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentVortex, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/PolarisParrotfish.cs b/Items/Weapons/Ranged/PolarisParrotfish.cs index 2deeabc7b3..ee3f0273a3 100644 --- a/Items/Weapons/Ranged/PolarisParrotfish.cs +++ b/Items/Weapons/Ranged/PolarisParrotfish.cs @@ -14,28 +14,27 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public int SetUseTime = 6; - public int SetUseAnimation = 6; public int ShotNumber = 0; public bool Happy = false; + public float fireSpeed = 1; 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() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; - Item.staff[Item.type] = true; //so it doesn't look weird af when holding it + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + Item.staff[Type] = true; //so it doesn't look weird af when holding it } public override void SetDefaults() { Item.width = 38; Item.height = 34; - Item.damage = 41; + Item.damage = 35; Item.DamageType = DamageClass.Ranged; - Item.useTime = SetUseTime; - Item.useAnimation = SetUseAnimation; + Item.useTime = 9; + Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -48,7 +47,6 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { @@ -116,17 +114,6 @@ namespace CalamityMod.Items.Weapons.Ranged } 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)) @@ -141,7 +128,8 @@ namespace CalamityMod.Items.Weapons.Ranged else SoundEngine.PlaySound(Shot, player.Center); - Projectile.NewProjectile(source, position + velocity * 5f, velocity.RotatedByRandom(0.05f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, ShotNumber); + for (int i = 0; i < (Happy ? 3 : 1); i++) + Projectile.NewProjectile(source, position + velocity * 5f, velocity.RotatedByRandom(0.05f * (i != 0 ? 6 : 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, ShotNumber); if (ShotNumber >= 2) // Cycle the shot color ShotNumber = 0; @@ -150,5 +138,11 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } + public override float UseSpeedMultiplier(Player player) + { + NPC target = player.Center.ClosestNPCAt(400); + fireSpeed = (target == null ? 1 : Utils.Remap(Utils.Distance(player.Center, target.Center), 100, 400, 2, 1, true)); + return (Happy ? fireSpeed * 2 : fireSpeed); + } } } diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 056f567798..e1aa81d309 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Dusts; +using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -10,16 +11,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class PristineFury : ModItem, ILocalizedModType + public class PristineFury : LegendaryItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; public int frameCounter = 0; public int frame = 0; public bool Trail = true; + public int shotCount = 0; + + public static int boomTime = 6; + + public override Color? TooltipExtensionColor => new Color(255, 140, 0); public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -55,15 +61,19 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - for (int i = 0; i < 2; i++) - { - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); - Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - } + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); + Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + + Dust dust = Dust.NewDustPerfect(position + velocity * 3f + new Vector2(0, -3), ModContent.DustType(), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 2.5f), 0, default, Main.rand.NextFloat(0.4f, 0.8f)); + dust.noGravity = true; + dust.color = Color.Orchid; + + CritSpark spark = new CritSpark(position + velocity * 3f + new Vector2(0, -3), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.2f, 1.8f), Color.White, Color.Orchid, 0.9f, 18, 2f, 2.2f); + GeneralParticleHandler.SpawnParticle(spark); } else { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, Trail ? 1 : 0); + Projectile.NewProjectile(source, position, velocity * 0.8f, type, damage, knockback, player.whoAmI, Trail ? 1 : 0, 0, shotCount); Trail = !Trail; for (int i = 0; i <= 2; i++) { @@ -72,6 +82,7 @@ namespace CalamityMod.Items.Weapons.Ranged } CritSpark spark = new CritSpark(position + velocity * 3f + new Vector2(0, -3), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.2f, 1.8f), Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed, Color.OrangeRed, 0.9f, 18, 2f, 1.9f); GeneralParticleHandler.SpawnParticle(spark); + shotCount += 1; } return false; } diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index bf87eb6146..36aeaafe38 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/ReedBlowgun.cs b/Items/Weapons/Ranged/ReedBlowgun.cs index fa3902328f..d0939ed636 100644 --- a/Items/Weapons/Ranged/ReedBlowgun.cs +++ b/Items/Weapons/Ranged/ReedBlowgun.cs @@ -12,21 +12,19 @@ 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 override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { Item.width = 22; Item.height = 46; - Item.damage = 21; + Item.damage = 25; Item.DamageType = DamageClass.Ranged; - Item.useTime = 25; - Item.useAnimation = 25; + Item.useTime = 32; + Item.useAnimation = 32; Item.useStyle = ItemUseStyleID.Shoot; Item.holdStyle = 16; Item.noMelee = true; @@ -67,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 playerMouth = getPlayerMouth(player); Vector2 playerToCursor = (player.Calamity().mouseWorld - playerMouth).SafeNormalize(Vector2.UnitX); - float pointingDirection = (playerToCursor.ToRotation() + MathHelper.PiOver4 / 3f * player.direction * player.gravDir); + float pointingDirection = (playerToCursor.ToRotation() + MathHelper.PiOver4 / 3f * player.direction * player.gravDir) - player.fullRotation; CalamityUtils.CleanHoldStyle(player, pointingDirection, playerMouth, new Vector2(50, 18), new Vector2(-23, 6)); } diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Riftburst.cs similarity index 88% rename from Items/Weapons/Ranged/Phangasm.cs rename to Items/Weapons/Ranged/Riftburst.cs index 7a8aab8725..61f46860e6 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Riftburst.cs @@ -11,7 +11,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class Phangasm : ModItem, ILocalizedModType + [LegacyName("Phangasm")] + public class Riftburst : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.channel = true; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; Item.rare = ModContent.RarityType(); @@ -44,13 +45,13 @@ 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.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 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/Ranged/PhangasmGlow").Value); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/RiftburstGlow").Value); } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Phangasm.png b/Items/Weapons/Ranged/Riftburst.png similarity index 100% rename from Items/Weapons/Ranged/Phangasm.png rename to Items/Weapons/Ranged/Riftburst.png diff --git a/Items/Weapons/Ranged/PhangasmGlow.png b/Items/Weapons/Ranged/RiftburstGlow.png similarity index 100% rename from Items/Weapons/Ranged/PhangasmGlow.png rename to Items/Weapons/Ranged/RiftburstGlow.png diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index 01025b4751..2042afd288 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -1,9 +1,14 @@ -using CalamityMod.Items.Materials; +using System; +using System.Diagnostics.Metrics; +using System.Threading; +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; @@ -13,48 +18,105 @@ namespace CalamityMod.Items.Weapons.Ranged public class RubicoPrime : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/TankCannon") { PitchVariance = 0.5f }; + public static readonly SoundStyle ReloadSound = new("CalamityMod/Sounds/Item/RubicoReload") { Volume = 1.1f, PitchVariance = 0.1f }; + public static int BaseReuseDelay = 25; + public static int ShotsToReset = 5; + + public int ShotAmount = 0; public override void SetDefaults() { Item.width = 82; Item.height = 28; - Item.damage = 1050; + Item.damage = 450; Item.DamageType = DamageClass.Ranged; Item.knockBack = 10f; - Item.useTime = 30; - Item.useAnimation = 300; - Item.autoReuse = false; - + Item.useTime = 50; + Item.useAnimation = 50; + Item.reuseDelay = BaseReuseDelay; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.shoot = ProjectileID.PurificationPowder; + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; - - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 40; - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 38; + public override Vector2? HoldoutOffset() => new Vector2(-6, 10); 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); + ShotAmount++; + if (ShotAmount <= ShotsToReset) + { + SoundEngine.PlaySound(UseSound, player.Center); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + player.velocity += velocity.SafeNormalize(Vector2.UnitX) * -6f; + } + else + { + if (ShotAmount >= ShotsToReset) + { + ShotAmount = 0; + Item.reuseDelay = BaseReuseDelay; + Projectile.NewProjectile(source, player.Center, new Vector2(5 * -player.direction, -5), ModContent.ProjectileType(), 1, knockback, player.whoAmI); + SoundEngine.PlaySound(ReloadSound, player.Center); + } + } 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); + + 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); + } + + } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(8). - AddIngredient(20). - AddTile(). + AddIngredient(). + AddIngredient(ItemID.IllegalGunParts). + AddIngredient(8). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/SandstormGun.cs b/Items/Weapons/Ranged/Sandblaster.cs similarity index 85% rename from Items/Weapons/Ranged/SandstormGun.cs rename to Items/Weapons/Ranged/Sandblaster.cs index 0a5727550b..71bec5ad7c 100644 --- a/Items/Weapons/Ranged/SandstormGun.cs +++ b/Items/Weapons/Ranged/Sandblaster.cs @@ -8,7 +8,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class SandstormGun : ModItem, ILocalizedModType + [LegacyName("SandstormGun")] + public class Sandblaster : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item11; Item.autoReuse = true; Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Sand; Item.Calamity().canFirePointBlankShots = true; } @@ -46,7 +47,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.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/SandstormGun.png b/Items/Weapons/Ranged/Sandblaster.png similarity index 100% rename from Items/Weapons/Ranged/SandstormGun.png rename to Items/Weapons/Ranged/Sandblaster.png diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index 1a71fcc78e..57a93203f4 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -63,9 +63,9 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). + AddRecipeGroup("AnyAdamantiteBar", 15). AddIngredient(10). AddIngredient(ItemID.FragmentSolar, 50). - AddRecipeGroup("AnyAdamantiteBar", 15). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/Scorpio.cs b/Items/Weapons/Ranged/Scorpio.cs index 3f01345339..e4ea8b3ded 100644 --- a/Items/Weapons/Ranged/Scorpio.cs +++ b/Items/Weapons/Ranged/Scorpio.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.damage = 33; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = OriginalUseTime; + Item.useAnimation = Item.useTime = OriginalUseTime; Item.shoot = ProjectileType(); Item.shootSpeed = 15f; Item.knockBack = 6.5f; @@ -70,6 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, -30); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // 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); diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 7c1dc1426b..6e4b33c8a2 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -1,6 +1,6 @@ using System; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item11; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; @@ -98,8 +98,8 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(9). - AddIngredient(3). AddIngredient(10). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/SeasSearing.cs b/Items/Weapons/Ranged/SeasSearing.cs index c714e4e168..11d8e3fa93 100644 --- a/Items/Weapons/Ranged/SeasSearing.cs +++ b/Items/Weapons/Ranged/SeasSearing.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -70,11 +70,11 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(damage * 1.22f), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 1.22f), knockback, player.whoAmI); } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1f); } return false; } diff --git a/Items/Weapons/Ranged/SepticSkewer.cs b/Items/Weapons/Ranged/SepticSkewer.cs index 739a0214ff..ab572d256f 100644 --- a/Items/Weapons/Ranged/SepticSkewer.cs +++ b/Items/Weapons/Ranged/SepticSkewer.cs @@ -1,40 +1,105 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Terraria.DataStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Boss; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { public class SepticSkewer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - + public bool pulled = false; public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() { Item.width = 46; Item.height = 24; - Item.damage = 272; + Item.damage = 1303; Item.DamageType = DamageClass.Ranged; - Item.useTime = 12; - Item.useAnimation = 12; + Item.useTime = 30; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 7.5f; - Item.UseSound = SoundID.Item10; + Item.knockBack = 3.5f; + Item.UseSound = null; Item.autoReuse = true; - Item.shootSpeed = 20f; + Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); - Item.Calamity().canFirePointBlankShots = true; + } + 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) + { + pulled = false; + if (player.altFunctionUse == 2) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == type) + { + projectile.ai[2] = 5; + pulled = true; + } + } + + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotMid"); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0.7f, 0.8f) }, position); + if (pulled) + player.Calamity().GeneralScreenShakePower = 5.5f; + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotHeavy"); + SoundEngine.PlaySound(fire with { Volume = 0.45f, Pitch = Main.rand.NextFloat(0.4f, 0.65f) }, position); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, 0); + } + 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; + + float pullback = 7f; + + 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) + pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2); + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback; + Vector2 itemSize = new Vector2(46, 24); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + 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 += (player.altFunctionUse == 2 ? -0.25f : 0) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } } } diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index bca4b94f92..45d07acc99 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -37,9 +37,9 @@ 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 (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index 4996c2f66a..5137773712 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -14,7 +14,7 @@ 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[Type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index 4005da80e6..e3a71d7dfb 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -39,9 +39,9 @@ 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) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index 95ac291e2e..beed00b0e5 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 94; Item.height = 34; - Item.damage = 400; + Item.damage = 705; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 5; + Item.useAnimation = Item.useTime = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 30; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 26; public override Vector2? HoldoutOffset() => new Vector2(-25, 0); @@ -54,8 +54,12 @@ namespace CalamityMod.Items.Weapons.Ranged velocity.Y += Main.rand.NextFloat(-XYInaccuracy, XYInaccuracy); Vector2 vel = velocity; Projectile shot = Projectile.NewProjectileDirect(source, position, vel, type, damage, knockback, player.whoAmI); + + // Set all projectiles fired from Soma Prime to have 3x base crit multiplier and to have supercrits enabled. + // They also are able to apply one stack of Shred. CalamityGlobalProjectile cgp = shot.Calamity(); cgp.supercritHits = -1; + cgp.bonusCritDamage += 1f; cgp.appliesSomaShred = true; return false; } diff --git a/Items/Weapons/Ranged/SpeedBlaster.cs b/Items/Weapons/Ranged/SpeedBlaster.cs index a146ae3b32..91eb648f97 100644 --- a/Items/Weapons/Ranged/SpeedBlaster.cs +++ b/Items/Weapons/Ranged/SpeedBlaster.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 30; Item.damage = 40; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; diff --git a/Items/Weapons/Ranged/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index b121ad2ba7..f8c21806ff 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged counter++; if (counter == 10) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X * 0.8f, velocity.Y * 0.8f, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity * 0.8f, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback, player.whoAmI); } if (counter >= 12) counter = 0; diff --git a/Items/Weapons/Ranged/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index debf9c5790..d3797af0c3 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 76; Item.height = 36; - Item.damage = 63; + Item.damage = 115; Item.DamageType = DamageClass.Ranged; Item.useTime = 55; Item.useAnimation = 55; @@ -50,9 +52,9 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.SuperStarCannon). - AddIngredient(). - AddIngredient(ItemID.LunarBar, 5). - AddIngredient(ItemID.FragmentStardust, 6). + AddIngredient(6). + AddIngredient(4). + AddIngredient(12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/Starmada.cs b/Items/Weapons/Ranged/Starmada.cs index b70b3820c5..20425ca0c6 100644 --- a/Items/Weapons/Ranged/Starmada.cs +++ b/Items/Weapons/Ranged/Starmada.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 15f; Item.shootSpeed = 16f; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = Item.useAnimation = 27; + Item.useAnimation = Item.useTime = 27; Item.UseSound = SoundID.Item92; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; @@ -49,7 +49,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.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } @@ -58,9 +58,9 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(15). AddIngredient(8). AddIngredient(8). + AddIngredient(15). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/Starmageddon.cs b/Items/Weapons/Ranged/Starmageddon.cs index 0b704e77ac..a2c2cd6707 100644 --- a/Items/Weapons/Ranged/Starmageddon.cs +++ b/Items/Weapons/Ranged/Starmageddon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 4f; Item.shootSpeed = 16f; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.UseSound = null; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; @@ -61,9 +61,9 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(15). AddIngredient(8). AddIngredient(8). + AddIngredient(15). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/StellarCannon.cs b/Items/Weapons/Ranged/StellarCannon.cs index c35aae9dab..376629dbca 100644 --- a/Items/Weapons/Ranged/StellarCannon.cs +++ b/Items/Weapons/Ranged/StellarCannon.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs deleted file mode 100644 index 9e9c0301dc..0000000000 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class StormDragoon : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 74; - Item.height = 34; - Item.damage = 96; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 2; - Item.useAnimation = 20; - Item.reuseDelay = 10; - Item.useLimitPerAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item31; - Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 18f; - Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - - public override bool CanConsumeAmmo(Item ammo, Player player) - { - if (Main.rand.Next(0, 100) < 90) - return false; - return true; - } - } -} diff --git a/Items/Weapons/Ranged/StormDragoon.png b/Items/Weapons/Ranged/StormDragoon.png deleted file mode 100644 index da8a466b98..0000000000 Binary files a/Items/Weapons/Ranged/StormDragoon.png and /dev/null differ diff --git a/Items/Weapons/Ranged/StormSurge.cs b/Items/Weapons/Ranged/StormSurge.cs index a55535b3a7..a9c9ae609c 100644 --- a/Items/Weapons/Ranged/StormSurge.cs +++ b/Items/Weapons/Ranged/StormSurge.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index 36c41d54c0..0b06d218fa 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -1,8 +1,11 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Terraria.DataStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Items.Weapons.Ranged { @@ -12,27 +15,71 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { Item.width = 90; Item.height = 30; - Item.damage = 144; + Item.damage = 550; Item.DamageType = DamageClass.Ranged; - Item.useTime = 18; - Item.useAnimation = 18; + Item.useTime = 35; + Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.UseSound = SoundID.Item95; - Item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item73; + Item.useAmmo = AmmoID.Rocket; + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() => Vector2.UnitX * -15f; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + // Reposition to the gun's tip + add some inaccuracy + Vector2 newPos = position + new Vector2(78f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(10f)); + + //Find which rocket type the player will be using. + player.PickAmmo(player.HeldItem, out _, out _, out _, out _, out int rocketType); + Projectile.NewProjectile(source, newPos, newVel, Item.shoot, damage, knockback, player.whoAmI,rocketType); + 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; + + float pullback = 7f; + + 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) + pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2); + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback; + Vector2 itemSize = new Vector2(52, 28); + 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; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } } } diff --git a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs index 0431c9500d..39271ef02f 100644 --- a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs +++ b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -49,13 +49,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { Item.width = 84; Item.height = 46; - Item.damage = 76; + Item.damage = 88; Item.DamageType = DamageClass.Ranged; Item.useTime = 30; Item.useAnimation = 30; @@ -100,6 +100,8 @@ namespace CalamityMod.Items.Weapons.Ranged int damage = (int)player.GetTotalDamage().ApplyTo(Item.damage); float kb = player.GetTotalKnockback().ApplyTo(Item.knockBack); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(Item.GetSource_FromThis(), player.Center, player.SafeDirectionTo(player.Calamity().mouseWorld), Item.shoot, damage * 2, kb, player.whoAmI, ai1: 2f); } } @@ -122,7 +124,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentVortex, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index 5dc40527ab..a344d60962 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -13,7 +13,7 @@ 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[Type] = true; } public override void SetDefaults() @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 58; Item.damage = 140; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 28; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index e304c42a43..da30c36b85 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -18,13 +18,13 @@ namespace CalamityMod.Items.Weapons.Ranged public int SineCounter = 0; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() { Item.width = 60; Item.height = 26; - Item.damage = 200; + Item.damage = 222; Item.DamageType = DamageClass.Ranged; Item.useTime = 1; Item.useAnimation = 3; @@ -54,6 +54,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) { int shotType = (player.altFunctionUse == 2 ? type : ModContent.ProjectileType()); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction position = position + (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.UnitX) * 65; float sine = (float)Math.Sin(SineCounter * 0.175f / MathHelper.Pi) * 4f; float sine2 = (float)Math.Sin(SineCounter * 0.275f / MathHelper.Pi) * 2f; diff --git a/Items/Weapons/Ranged/TauCannon.cs b/Items/Weapons/Ranged/TauCannon.cs new file mode 100644 index 0000000000..189682bcad --- /dev/null +++ b/Items/Weapons/Ranged/TauCannon.cs @@ -0,0 +1,56 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class TauCannon : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetDefaults() + { + CalamityGlobalItem modItem = Item.Calamity(); + + Item.damage = 620; + Item.DamageType = DamageClass.Ranged; + Item.useTime = Item.useAnimation = 180; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.knockBack = 4f; + + Item.width = 146; + Item.height = 52; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ModContent.RarityType(); + Item.useStyle = ItemUseStyleID.Shoot; + + modItem.UsesCharge = true; + modItem.MaxCharge = 200f; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0 && Item.Calamity().Charge > 0; + + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(10). + AddIngredient(15). + AddIngredient(10). + AddIngredient(2). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/TauCannon.png b/Items/Weapons/Ranged/TauCannon.png new file mode 100644 index 0000000000..5a9b893adb Binary files /dev/null and b/Items/Weapons/Ranged/TauCannon.png differ diff --git a/Items/Weapons/Ranged/TauCannon_Glow.png b/Items/Weapons/Ranged/TauCannon_Glow.png new file mode 100644 index 0000000000..73c6d8b2c0 Binary files /dev/null and b/Items/Weapons/Ranged/TauCannon_Glow.png differ diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 95485b137b..2c5775d3a2 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -1,7 +1,10 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +13,23 @@ namespace CalamityMod.Items.Weapons.Ranged public class TelluricGlare : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public int shots = 0; + public int frame = 0; + public int frameCounter = 0; + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(3, 5)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + } public override void SetDefaults() { - Item.width = 54; - Item.height = 92; - Item.damage = 216; + Item.width = 74; + Item.height = 126; + Item.damage = 79; Item.DamageType = DamageClass.Ranged; - Item.useTime = 5; - Item.useAnimation = 20; - Item.reuseDelay = 23; - Item.useLimitPerAnimation = 4; + Item.useTime = 3; + Item.useAnimation = 25; + Item.useLimitPerAnimation = 8; Item.knockBack = 7.5f; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -27,21 +37,43 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item102; + Item.UseSound = null; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; Item.useAmmo = AmmoID.Arrow; Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() => new Vector2(-14f, 0f); + public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() < 0.25f; + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture; + //0 = 6 frames, 8 = 3 frames] + texture = ModContent.Request(Texture).Value; + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 3, 5), 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; + + texture = ModContent.Request(Texture).Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 3, 5), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/TelluricGlareGlow").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 3, 5, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - // Always fires Radiant Arrows regardless of ammo used - type = Item.shoot; - // The arrow appears from a random location "on the bow". // They are also moved backwards so that they have some time to build up past positions. This helps make them not appear out of thin air. @@ -49,5 +81,20 @@ namespace CalamityMod.Items.Weapons.Ranged position += offset * Main.rand.NextFloat(-19f, 19f); position -= 3f * velocity; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + bool isHolyArrow = CalamityUtils.CheckWoodenAmmo(type, player); + if (isHolyArrow) + type = Item.shoot; + if (shots % 2 == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(sound with { Volume = 0.25f, Pitch = Main.rand.NextFloat(-0.3f, -0.8f), MaxInstances = -1 }, player.Center); + type = Item.shoot; + } + Projectile.NewProjectile(source, (isHolyArrow || shots % 2 == 0) ? position : player.Center + velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(90)) * Main.rand.NextFloat(-15, 15), velocity, type, (isHolyArrow ? (int)(damage * 1.2f) : damage), knockback, player.whoAmI); + shots++; + return false; + } } } diff --git a/Items/Weapons/Ranged/TelluricGlare.png b/Items/Weapons/Ranged/TelluricGlare.png index a4c34f0dbd..6090c78a53 100644 Binary files a/Items/Weapons/Ranged/TelluricGlare.png and b/Items/Weapons/Ranged/TelluricGlare.png differ diff --git a/Items/Weapons/Ranged/TelluricGlareGlow.png b/Items/Weapons/Ranged/TelluricGlareGlow.png new file mode 100644 index 0000000000..06ea41c2fb Binary files /dev/null and b/Items/Weapons/Ranged/TelluricGlareGlow.png differ diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index 89e585472d..a5365bc034 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.damage = 92; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = OriginalUseTime; + Item.useAnimation = Item.useTime = OriginalUseTime; Item.shoot = ProjectileType(); Item.shootSpeed = 13f; Item.knockBack = 3.5f; @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // 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); diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index 7cb4df516e..79bdaba8f6 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 70; Item.damage = 235; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 28; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; diff --git a/Items/Weapons/Ranged/TheMaelstrom.cs b/Items/Weapons/Ranged/TheMaelstrom.cs index f00ed388bd..81342eb7a0 100644 --- a/Items/Weapons/Ranged/TheMaelstrom.cs +++ b/Items/Weapons/Ranged/TheMaelstrom.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index 97cbdb97e5..a6d0fc3f6f 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -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) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } @@ -51,9 +51,9 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(ItemID.MarbleBlock, 50). - AddIngredient(4). AddIngredient(8). AddIngredient(20). + AddIngredient(4). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/TheSevensStriker.cs b/Items/Weapons/Ranged/TheSevensStriker.cs index 8c404d042e..347ed65b3a 100644 --- a/Items/Weapons/Ranged/TheSevensStriker.cs +++ b/Items/Weapons/Ranged/TheSevensStriker.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -172,8 +172,8 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(). AddIngredient(ItemID.PlatinumCoin, 7). AddIngredient(ItemID.GoldCoin, 77). - AddIngredient(2). AddIngredient(ItemID.LunarBar, 12). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index b9fd74ee14..83e6dd9282 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -1,8 +1,8 @@ -using System; -using CalamityMod.Projectiles.Ranged; +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; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged public class TheStorm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public int shots = 0; public override void SetStaticDefaults() { @@ -22,19 +23,18 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 54; Item.height = 90; - Item.damage = 35; + Item.damage = 23; Item.DamageType = DamageClass.Ranged; - Item.useTime = 7; - Item.useAnimation = 14; + Item.useTime = 2; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item122; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 28f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; } @@ -42,65 +42,37 @@ namespace CalamityMod.Items.Weapons.Ranged { return new Vector2(-10, 0); } - + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 95) + return false; + return true; + } 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 arrowSpeed = Main.rand.Next(25, 30); - 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 = arrowSpeed; - } - else - { - mouseDistance = arrowSpeed / mouseDistance; - } + if (shots % 2 == 0) + SoundEngine.PlaySound(SoundID.Item122 with { Volume = 0.6f, PitchVariance = 0.2f }, position); - for (int j = 0; j < 3; j++) + 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 - 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) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = arrowSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist + (float)Main.rand.Next(-120, 121) * 0.01f; - float speedY5 = mouseYDist + (float)Main.rand.Next(-120, 121) * 0.01f; + float arrowVelAdjust = Main.rand.NextFloat(-40, 40); + Vector2 arrowSpawnPos = new Vector2(MathHelper.Lerp(player.Calamity().mouseWorld.X, player.Center.X, 0.5f), player.Center.Y) + new Vector2(arrowVelAdjust, Main.rand.NextFloat(-560, -660)); + Vector2 velAdjust = (player.Calamity().mouseWorld - arrowSpawnPos).SafeNormalize(velocity); + Vector2 arrowVel = (velAdjust).RotatedBy(arrowVelAdjust * -0.004f) * Item.shootSpeed; + if (CalamityUtils.CheckWoodenAmmo(type, player)) { - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, knockback, i); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, knockback, i); + Projectile.NewProjectileDirect(source, arrowSpawnPos, arrowVel, ModContent.ProjectileType(), (int)(damage * (i == 0 ? 1.5f : 1f)), knockback, -1, i == 0 ? 5 : 0); } else { - int arrow1 = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5 * 0.9f, type, damage, knockback, i); - Main.projectile[arrow1].noDropItem = true; - int arrow2 = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5 * 0.8f, type, damage, knockback, i); - Main.projectile[arrow2].noDropItem = true; + Projectile arrow1 = Projectile.NewProjectileDirect(source, arrowSpawnPos, arrowVel, i == 0 ? ModContent.ProjectileType() : type, damage, knockback); + arrow1.noDropItem = true; + arrow1.tileCollide = false; } } + + shots++; return false; } } diff --git a/Items/Weapons/Ranged/ThermoclineBlaster.cs b/Items/Weapons/Ranged/ThermoclineBlaster.cs index fd64420f39..cb2a56540f 100644 --- a/Items/Weapons/Ranged/ThermoclineBlaster.cs +++ b/Items/Weapons/Ranged/ThermoclineBlaster.cs @@ -113,8 +113,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.PhoenixBlaster). - AddIngredient(5). AddIngredient(5). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/TitaniumRailgun.cs b/Items/Weapons/Ranged/TitaniumRailgun.cs index 02fd415f1e..34ad55a974 100644 --- a/Items/Weapons/Ranged/TitaniumRailgun.cs +++ b/Items/Weapons/Ranged/TitaniumRailgun.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index a9c20c62dc..51ad67d868 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.width = 26; - Item.height = 54; + Item.width = 22; + Item.height = 60; Item.damage = 15; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 28; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). + AddIngredient(). AddIngredient(15). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Ranged/Toxibow.png b/Items/Weapons/Ranged/Toxibow.png index 099dd434e0..6b2852f5ae 100644 Binary files a/Items/Weapons/Ranged/Toxibow.png and b/Items/Weapons/Ranged/Toxibow.png differ diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 0565b2e6e6..4a2e5cf67a 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 58; Item.damage = 150; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 8; + Item.useAnimation = Item.useTime = 8; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; @@ -54,9 +54,9 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.LaserRifle). AddIngredient(). AddIngredient(). - AddIngredient(15). AddIngredient(8). AddIngredient(8). + AddIngredient(15). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index 0526d67ad4..d26c0be45e 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 60; Item.damage = 192; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 26; + Item.useAnimation = Item.useTime = 26; Item.knockBack = 6.5f; Item.useAmmo = AmmoID.Bullet; Item.shoot = ProjectileID.Bullet; @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.StarCloak, 3). AddIngredient(5). AddIngredient(4). diff --git a/Items/Weapons/Ranged/Voidragon.cs b/Items/Weapons/Ranged/Voidragon.cs index d1077a7bd5..2cd4c67f92 100644 --- a/Items/Weapons/Ranged/Voidragon.cs +++ b/Items/Weapons/Ranged/Voidragon.cs @@ -58,9 +58,9 @@ namespace CalamityMod.Items.Weapons.Ranged shotType = 1; if (shotType == 1) - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); shotType++; @@ -80,7 +80,6 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.SoulofFright, 30). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Ranged/WildfireBloom.cs b/Items/Weapons/Ranged/WildfireBloom.cs index d821089aeb..ce9ab240c8 100644 --- a/Items/Weapons/Ranged/WildfireBloom.cs +++ b/Items/Weapons/Ranged/WildfireBloom.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, position, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // 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); diff --git a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs index 69d9acf480..5b74101f5d 100644 --- a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs +++ b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs @@ -8,6 +8,7 @@ using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; using static CalamityMod.CalamityUtils; @@ -21,6 +22,9 @@ 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 int ArmorPenetration = 3; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); + public static float MinSpreadDistance = 460f; public static float MaxSpreadDistance = 60f; public static float MinSpread = 0.2f; @@ -36,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.width = 23; Item.height = 8; Item.damage = 11; - Item.ArmorPenetration = 3; + Item.ArmorPenetration = ArmorPenetration; Item.DamageType = DamageClass.Ranged; Item.useTime = 55; Item.useAnimation = 55; @@ -95,6 +99,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary due to the result being clamped float aimLength = (Main.MouseWorld - player.MountedCenter).Length(); float damageMult = MathHelper.Lerp(1f, MaxDamageFalloff, Math.Clamp(aimLength - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance)); damage = (int)(damage * damageMult); @@ -105,6 +110,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().GeneralScreenShakePower < 3f) player.Calamity().GeneralScreenShakePower = 3f; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary due to the result being clamped float aimLength = (Main.MouseWorld - player.MountedCenter).Length(); float spreadDistance = Math.Clamp(aimLength - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance); float spread = MathHelper.Lerp(MaxSpread, MinSpread, spreadDistance); @@ -117,7 +123,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 direction = nuzzleDir.RotatedByRandom(spread); Vector2 nuzzlePos = player.MountedCenter + direction * 15f; - Projectile.NewProjectile(player.GetSource_ItemUse_WithPotentialAmmo(Item, Item.useAmmo), nuzzlePos, direction * Item.shootSpeed * Main.rand.NextFloat(1.5f, 2f), type, damage, (int)Item.knockBack, player.whoAmI, 0, 0); + Projectile.NewProjectile(player.GetSource_ItemUse_WithPotentialAmmo(Item, Item.useAmmo), nuzzlePos, direction * Item.shootSpeed * Main.rand.NextFloat(1.5f, 2f), type, damage, (int)Item.knockBack, player.whoAmI); } return false; diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index bd12133a97..cd38cbe612 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -8,26 +8,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class AdamantiteThrowingAxe : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 30; Item.height = 40; - Item.damage = 67; + Item.damage = 61; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1600; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -51,8 +44,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.AdamantiteBar). + CreateRecipe(). + AddIngredient(ItemID.AdamantiteBar, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/AlphaVirus.cs b/Items/Weapons/Rogue/AlphaVirus.cs deleted file mode 100644 index 136298988c..0000000000 --- a/Items/Weapons/Rogue/AlphaVirus.cs +++ /dev/null @@ -1,60 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class AlphaVirus : RogueWeapon - { - public override void SetDefaults() - { - Item.width = 44; - Item.height = 44; - Item.damage = 248; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useAnimation = 31; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 31; - Item.knockBack = 1f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.maxStack = 1; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 4f; - Item.rare = ItemRarityID.Purple; - Item.DamageType = RogueDamageClass.Instance; - } - - public override float StealthDamageMultiplier => 0.70f; - - 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 p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, Item.shootSpeed, 0f); - if (p.WithinBounds(Main.maxProjectiles)) - Main.projectile[p].Calamity().stealthStrike = true; - return false; - } - return true; - } - - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.LunarBar, 5). - AddTile(TileID.LunarCraftingStation). - Register(); - } - - } -} diff --git a/Items/Weapons/Rogue/AlphaVirus.png b/Items/Weapons/Rogue/AlphaVirus.png deleted file mode 100644 index e3e8c3c7ea..0000000000 Binary files a/Items/Weapons/Rogue/AlphaVirus.png and /dev/null differ diff --git a/Items/Weapons/Rogue/AntlionSkewer.cs b/Items/Weapons/Rogue/AntlionSkewer.cs new file mode 100644 index 0000000000..81a55c114d --- /dev/null +++ b/Items/Weapons/Rogue/AntlionSkewer.cs @@ -0,0 +1,43 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class AntlionSkewer : RogueWeapon + { + public static float CloudDamageDebuffMult = 0.9f; + + public override void SetDefaults() + { + Item.width = 58; + Item.height = 56; + Item.damage = 19; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 28; + Item.knockBack = 2f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + + Item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + } + + 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; + return false; + } + } +} diff --git a/Items/Weapons/Rogue/AntlionSkewer.png b/Items/Weapons/Rogue/AntlionSkewer.png new file mode 100644 index 0000000000..da2d80fb4d Binary files /dev/null and b/Items/Weapons/Rogue/AntlionSkewer.png differ diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 1e646c10bb..aa889bdab6 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Rogue; using CalamityMod.Utilities; using Microsoft.Xna.Framework; @@ -17,11 +17,10 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 66; Item.height = 64; - Item.damage = 228; + Item.damage = 238; Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); - Item.useTime = 26; - Item.useAnimation = 26; + Item.useAnimation = Item.useTime = 26; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 10f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; @@ -36,7 +35,6 @@ 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.3f; public override void UseStyle(Player player, Rectangle heldItemFrame) { ExtraArmAnimations.ThrowArmAnimationFast(player, Item); @@ -47,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Rogue //Check if stealth is full if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index 50d0e9b31b..38d580285a 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 36; - Item.height = 34; + Item.height = 36; Item.damage = 37; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/AshenStalactite.png b/Items/Weapons/Rogue/AshenStalactite.png index aafd03c7af..7eda8b46b2 100644 Binary files a/Items/Weapons/Rogue/AshenStalactite.png and b/Items/Weapons/Rogue/AshenStalactite.png differ diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs index 3bc3e7e79c..04409f3752 100644 --- a/Items/Weapons/Rogue/AuroradicalThrow.cs +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, TextureAssets.Item[Item.type].Value); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, TextureAssets.Item[Type].Value); } } } diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index 8e0c21d98a..a5adb023be 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -1,6 +1,6 @@ using System; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index 871115b9eb..5f608b05d3 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -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.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/BouncingEyeball.cs b/Items/Weapons/Rogue/BouncingEyeball.cs index 8ccc7e6781..0da66baf7a 100644 --- a/Items/Weapons/Rogue/BouncingEyeball.cs +++ b/Items/Weapons/Rogue/BouncingEyeball.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Green; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.DamageType = RogueDamageClass.Instance; + Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs deleted file mode 100644 index 212f13a817..0000000000 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class BouncySpikyBall : RogueWeapon - { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.width = 14; - Item.height = 14; - Item.damage = 10; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useAnimation = 18; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; - Item.knockBack = 1f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 1, 0); - Item.rare = ItemRarityID.Blue; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8f; - Item.DamageType = RogueDamageClass.Instance; - } - - 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 = 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)); - 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); - } - return false; - } - return true; - } - - public override void AddRecipes() - { - CreateRecipe(100). - AddIngredient(ItemID.SpikyBall, 100). - AddIngredient(ItemID.PinkGel). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/BouncySpikyBall.png b/Items/Weapons/Rogue/BouncySpikyBall.png deleted file mode 100644 index d409a6b571..0000000000 Binary files a/Items/Weapons/Rogue/BouncySpikyBall.png and /dev/null differ diff --git a/Items/Weapons/Rogue/BrackishFlask.png b/Items/Weapons/Rogue/BrackishFlask.png deleted file mode 100644 index 0e5ad78a57..0000000000 Binary files a/Items/Weapons/Rogue/BrackishFlask.png and /dev/null differ diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index 592522b026..eaffccad71 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -13,37 +13,30 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 16; Item.height = 28; + Item.damage = 73; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 25; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.UseSound = SoundID.Item1; Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.autoReuse = true; - Item.noUseGraphic = true; - Item.noMelee = true; - - Item.useAnimation = 25; - Item.useTime = 25; - Item.damage = 96; - Item.shootSpeed = 8f; - Item.shoot = ModContent.ProjectileType(); - - Item.DamageType = RogueDamageClass.Instance; } - // 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 StealthVelocityMultiplier => 1.25f; 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, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) - { Main.projectile[proj].Calamity().stealthStrike = true; - Main.projectile[proj].penetrate = 5; - } return false; } } diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 5c1696590e..113f7e24a7 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Weapons/Rogue/Cinquedea.cs b/Items/Weapons/Rogue/Cinquedea.cs index ff5b5ab84a..888ab52af2 100644 --- a/Items/Weapons/Rogue/Cinquedea.cs +++ b/Items/Weapons/Rogue/Cinquedea.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 32; Item.height = 32; - Item.damage = 36; + Item.damage = 35; Item.rare = ItemRarityID.Orange; Item.knockBack = 5; Item.autoReuse = true; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useTime = 20; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.noMelee = true; Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8; + Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.DamageType = RogueDamageClass.Instance; } @@ -33,11 +33,14 @@ 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.5f; + 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) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index 3b2b74b77e..1fbc6ca7a2 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -8,26 +8,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CobaltKunai : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 14; Item.height = 38; - Item.damage = 58; + Item.damage = 56; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 900; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -56,8 +49,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.CobaltBar). + CreateRecipe(). + AddIngredient(ItemID.CobaltBar, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/ContaminatedBile.cs b/Items/Weapons/Rogue/ContaminatedBile.cs index a4fee1163e..96c82f5ca8 100644 --- a/Items/Weapons/Rogue/ContaminatedBile.cs +++ b/Items/Weapons/Rogue/ContaminatedBile.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 24; - Item.damage = 9; - Item.useAnimation = Item.useTime = 31; + Item.damage = 18; + Item.useAnimation = Item.useTime = 40; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.5f; - Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.UseSound = SoundID.Item106; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 15f; + Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } @@ -35,14 +35,5 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(10). - AddTile(TileID.Bottles). - Register(); - } } } diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 210c235930..bfad290128 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using System; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -16,9 +17,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 98; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -26,10 +26,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8.5f; + Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 2.5f; + public override float StealthKnockbackMultiplier => 2f; + // Gains 10% of missing health as base damage. public override void ModifyWeaponDamage(Player player, ref StatModifier damage) { @@ -37,22 +40,20 @@ namespace CalamityMod.Items.Weapons.Rogue damage.Base += lifeAmount * 0.1f; } - 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(); - } - - 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) { if (player.Calamity().StealthStrikeAvailable()) { - int dagger = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + int dagger = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (dagger.WithinBounds(Main.maxProjectiles)) Main.projectile[dagger].Calamity().stealthStrike = true; + + // Take 6 HP every time the stealth strike is used + player.statLife -= 6; + if (Main.myPlayer == player.whoAmI) + player.HealEffect(-6); + if (player.statLife <= 0) + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CorpusAvertor").Format(player.name)), 1000.0, 0, false); return false; } return true; diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index f85e68d5dd..5ef882b4c0 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -9,42 +9,36 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CraniumSmasher : RogueWeapon { + private bool throwExplosive = false; public override void SetDefaults() { Item.width = 50; Item.height = 50; - Item.damage = 120; + Item.damage = 140; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4f; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; - Item.knockBack = 4f; Item.UseSound = SoundID.Item1; 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 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(); } - else if (Main.rand.NextBool(5)) - { - damage = (int)(damage * 1.25f); - type = ModContent.ProjectileType(); - } else { - type = ModContent.ProjectileType(); + type = throwExplosive ? ModContent.ProjectileType() : ModContent.ProjectileType(); + throwExplosive = !throwExplosive; } } diff --git a/Items/Weapons/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index 97d3531c4b..611d050155 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 38; Item.height = 22; - Item.damage = 85; + Item.damage = 81; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 18; @@ -61,9 +62,13 @@ namespace CalamityMod.Items.Weapons.Rogue if (!HasHoveredOverNameInGFB) { HasHoveredOverNameInGFB = true; - string firstWord = this.GetLocalizedValue("GFBFirstWord" + Main.rand.Next(1, 12 + 1).ToString()); - string lastWord = this.GetLocalizedValue("GFBLastWord" + Main.rand.Next(1, 10 + 1).ToString()); - Item.SetNameOverride(firstWord + " " + lastWord); + string[] firstWords = this.GetLocalizedValue("GFBFirstWords").Split('\n', '\r').Select(str => str.Trim()).ToArray(); + string[] lastWords = this.GetLocalizedValue("GFBLastWords").Split('\n', '\r').Select(str => str.Trim()).ToArray(); + + string firstWord = firstWords[Main.rand.Next(firstWords.Length)]; + string lastWord = lastWords[Main.rand.Next(lastWords.Length)]; + string separator = this.GetLocalizedValue("GFBWordSeparator"); + Item.SetNameOverride(firstWord + separator + lastWord); } } else @@ -75,12 +80,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index 62c1ed394d..f7b115b4da 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -10,26 +10,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CrystalPiercer : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 62; Item.height = 62; Item.damage = 92; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 2500; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; @@ -55,8 +48,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(). + CreateRecipe(). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index c7de2c3c34..74260456a7 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(50). + AddIngredient(). AddIngredient(ItemID.Diamond, 3). AddIngredient(ItemID.FallenStar, 3). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 679e92b6ae..4bb20aae43 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -26,12 +26,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Lime; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; + Item.shootSpeed = 17f; Item.DamageType = RogueDamageClass.Instance; } public override float StealthVelocityMultiplier => 1.1f; - 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 aba7223a7a..d9a4719ab1 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -86,13 +86,9 @@ namespace CalamityMod.Items.Weapons.Rogue if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } + return false; } - else - { - //Does this even need to exist? Can't you just return true for this? - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - } - return false; + return true; } } } diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/DoomsdayDevice.cs similarity index 50% rename from Items/Weapons/Rogue/ShockGrenade.cs rename to Items/Weapons/Rogue/DoomsdayDevice.cs index 0afc12fa2d..8d1ebe930b 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/DoomsdayDevice.cs @@ -8,58 +8,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ShockGrenade : RogueWeapon + [LegacyName("ShockGrenade")] + public class DoomsdayDevice : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 14; Item.height = 30; - Item.damage = 108; + Item.damage = 240; Item.noMelee = true; Item.noUseGraphic = true; - Item.consumable = true; - Item.useAnimation = Item.useTime = 18; + Item.useTime = 55; + Item.useAnimation = 55; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 1f; + Item.knockBack = 12f; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12.5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; + Item.channel = true; } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override bool CanUseItem(Player player) { - if (player.Calamity().StealthStrikeAvailable()) + // If a grenade is in the throwing animation, don't throw another one. + for (int x = 0; x < Main.maxProjectiles; x++) { - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (p.WithinBounds(Main.maxProjectiles)) - Main.projectile[p].Calamity().stealthStrike = true; - return false; + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == Item.shoot && projectile.localAI[1] < 5 && projectile.owner == player.whoAmI) + { + return false; + } } return true; } + 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 fakeBomb = Projectile.NewProjectileDirect(source, position, velocity, type, damage, 0, player.whoAmI, 0, 0); + 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/ShockGrenadeGlow").Value); - } - - public override void AddRecipes() - { - CreateRecipe(150). - AddIngredient(ItemID.Grenade, 30). - AddIngredient(ItemID.MartianConduitPlating, 5). - AddIngredient(ItemID.Nanites, 5). - AddTile(TileID.WorkBenches). - Register(); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow").Value); } } } diff --git a/Items/Weapons/Rogue/ShockGrenade.png b/Items/Weapons/Rogue/DoomsdayDevice.png similarity index 100% rename from Items/Weapons/Rogue/ShockGrenade.png rename to Items/Weapons/Rogue/DoomsdayDevice.png diff --git a/Items/Weapons/Rogue/ShockGrenadeGlow.png b/Items/Weapons/Rogue/DoomsdayDeviceGlow.png similarity index 100% rename from Items/Weapons/Rogue/ShockGrenadeGlow.png rename to Items/Weapons/Rogue/DoomsdayDeviceGlow.png diff --git a/Items/Weapons/Rogue/DoomsdayDeviceGlow2.png b/Items/Weapons/Rogue/DoomsdayDeviceGlow2.png new file mode 100644 index 0000000000..9dadf33dcd Binary files /dev/null and b/Items/Weapons/Rogue/DoomsdayDeviceGlow2.png differ diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index b1dfd66b28..926ce17a5a 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); + Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index e0c8ca091d..66e11cf25d 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -33,8 +33,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 1.05f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) @@ -52,9 +50,9 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(12). AddIngredient(8). AddIngredient(8). + AddIngredient(12). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/EnchantedAxe.cs b/Items/Weapons/Rogue/EnchantedAxe.cs index d4f014dab9..187a61f645 100644 --- a/Items/Weapons/Rogue/EnchantedAxe.cs +++ b/Items/Weapons/Rogue/EnchantedAxe.cs @@ -14,12 +14,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 40; Item.height = 36; - Item.damage = 20; + Item.damage = 19; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 19; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -36,7 +35,7 @@ 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, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; @@ -47,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(100). + AddIngredient(). AddIngredient(ItemID.FallenStar, 5). AddIngredient(10). AddIngredient(ItemID.Bone, 30). @@ -55,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue Register(); CreateRecipe(). - AddIngredient(100). + AddIngredient(). AddIngredient(ItemID.FallenStar, 5). AddIngredient(10). AddIngredient(ItemID.Bone, 30). diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index d05c0a4635..3133d376dc 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -1,6 +1,9 @@ -using CalamityMod.Projectiles.Rogue; +using System.Linq; +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; @@ -9,14 +12,15 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Equanimity : RogueWeapon { + public static readonly SoundStyle StealthBoom = new("CalamityMod/Sounds/Item/MagnusImpact") { PitchVariance = 0.1f }; public override void SetDefaults() { - Item.width = 40; - Item.height = 36; - Item.damage = 40; + Item.width = 46; + Item.height = 58; + Item.damage = 84; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 36; + Item.useAnimation = Item.useTime = 46; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; @@ -25,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 30f; + Item.shootSpeed = 3f; Item.DamageType = RogueDamageClass.Instance; } @@ -33,7 +37,7 @@ 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, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; @@ -44,10 +48,11 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Flamarang). - AddIngredient(ItemID.IceBoomerang). + AddIngredient(). AddIngredient(ItemID.DarkShard). AddIngredient(ItemID.LightShard). + AddIngredient(ItemID.SoulofNight, 7). + AddIngredient(ItemID.SoulofLight, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/Equanimity.png b/Items/Weapons/Rogue/Equanimity.png index 7e0cbdd5e5..f484f83cea 100644 Binary files a/Items/Weapons/Rogue/Equanimity.png and b/Items/Weapons/Rogue/Equanimity.png differ diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index 0ae4de8476..4742e420dc 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -11,47 +11,50 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.width = 34; - Item.height = 42; - Item.damage = 64; + Item.width = 109; + Item.height = 128; + Item.damage = 285; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 20; + // Due to the amazing sound engine, having more than one of these on screen will cause audio bugs! + // Therefore this thing has to be absurdly slow (Not that I've ever complained about that before) + Item.useAnimation = Item.useTime = 115; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 1f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 12f; Item.autoReuse = true; - Item.maxStack = 1; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 6f; Item.DamageType = RogueDamageClass.Instance; } - + public override float StealthDamageMultiplier => 0.65f; + 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) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage); + int p = Projectile.NewProjectile(source, position, velocity, 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, 0.25f, damage); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0.25f, damage); } return false; } - + public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.HolyWater, 10). - AddIngredient(ItemID.HallowedBar, 12). - AddIngredient(ItemID.SoulofFright, 6). - AddIngredient(ItemID.SoulofMight, 6). - AddIngredient(ItemID.SoulofSight, 6). + AddIngredient(ItemID.HallowedBar, 20). + AddIngredient(ItemID.SoulofFright, 3). + AddIngredient(ItemID.SoulofMight, 3). + AddIngredient(ItemID.SoulofSight, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/Exorcism.png b/Items/Weapons/Rogue/Exorcism.png index 0011f65c8d..c595d31a28 100644 Binary files a/Items/Weapons/Rogue/Exorcism.png and b/Items/Weapons/Rogue/Exorcism.png differ diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index f81beacc1d..aad9aeb1d9 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -10,53 +10,55 @@ namespace CalamityMod.Items.Weapons.Rogue { public class FantasyTalisman : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 82; + Item.damage = 52; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 16; - Item.useTime = 16; + Item.useAnimation = 25; + Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 60, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16.5f; + Item.shootSpeed = 18f; Item.DamageType = RogueDamageClass.Instance; } - - public override float StealthDamageMultiplier => 0.8f; - + 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) { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (!player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; + for (int i = -1; i <= 1; i++) + { + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i * 6f)); + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); + } + } + else if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + for (int i = -1; i <= 1; i++) + { + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i * 5f)); + int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; + } } return true; } public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(3). - AddIngredient(ItemID.Silk). - AddIngredient(ItemID.Ectoplasm). + CreateRecipe(). + AddIngredient(10). + AddIngredient(ItemID.Silk, 10). + AddIngredient(ItemID.Ectoplasm, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index 3688488e55..756ef3c40a 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -10,11 +10,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public class FeatherKnife : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 18; @@ -22,21 +17,20 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; - Item.damage = 18; + Item.damage = 25; Item.useAnimation = Item.useTime = 20; Item.knockBack = 2f; Item.autoReuse = true; - Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.maxStack = 9999; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; Item.DamageType = RogueDamageClass.Instance; - Item.value = Item.sellPrice(copper: 60); + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } + 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) { @@ -59,8 +53,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(). + CreateRecipe(). + AddIngredient(6). + AddIngredient(ItemID.SunplateBlock, 4). AddTile(TileID.SkyMill). Register(); } diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index 4b41108386..43953e042c 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class FrostcrushValari : RogueWeapon { - public static float Speed = 14f; + public static float Speed = 16f; public override void SetDefaults() { Item.width = 32; Item.height = 46; Item.damage = 89; - Item.knockBack = 12; Item.DamageType = RogueDamageClass.Instance; + Item.useTime = Item.useAnimation = 17; + Item.knockBack = 12; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.useTime = 21; - Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -37,32 +37,19 @@ 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 => 0.35f; + public override float StealthDamageMultiplier => 0.9f; 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) { - CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); - //If stealth is full, shoot a spread of 3 boomerangs with reduced range and 6 to 10 icicles - if (modPlayer.StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { - int spread = 10; - for (int i = 0; i < 3; i++) + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + if (proj.WithinBounds(Main.maxProjectiles)) { - Vector2 perturbedspeed = velocity.RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI, 0f, 1f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = true; - spread -= 10; - } - int spread2 = 3; - 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)); - Projectile.NewProjectile(source, position, perturbedspeed, (Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType()), damage, 0f, player.whoAmI, 0f, 0f); - spread2 -= Main.rand.Next(1, 4); - } + Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].penetrate = 5; + } return false; } return true; @@ -74,8 +61,8 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(6). AddIngredient(40). - AddIngredient(5). - AddTile(TileID.IceMachine). + AddIngredient(ItemID.Ectoplasm, 5). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/FrostcrushValari.png b/Items/Weapons/Rogue/FrostcrushValari.png index 1dd40a54e7..a22a47651b 100644 Binary files a/Items/Weapons/Rogue/FrostcrushValari.png and b/Items/Weapons/Rogue/FrostcrushValari.png differ diff --git a/Items/Weapons/Rogue/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index 1a4e5b7b3b..1226639a46 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 22f; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index 46abfb7598..c01f1fb608 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -11,18 +11,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class GelDart : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 26; Item.height = 54; - Item.damage = 28; + Item.damage = 21; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 11; Item.useStyle = ItemUseStyleID.Swing; @@ -30,13 +24,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 2, 50); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; 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) { @@ -57,9 +51,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(2). - AddIngredient(2). + CreateRecipe(). + AddIngredient(18). + AddIngredient(18). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/GildedDagger.cs b/Items/Weapons/Rogue/GildedDagger.cs index b111c30627..a83905ca76 100644 --- a/Items/Weapons/Rogue/GildedDagger.cs +++ b/Items/Weapons/Rogue/GildedDagger.cs @@ -36,7 +36,7 @@ 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, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/GleamingDagger.cs b/Items/Weapons/Rogue/GleamingDagger.cs index 0677be07ca..6e8efee10d 100644 --- a/Items/Weapons/Rogue/GleamingDagger.cs +++ b/Items/Weapons/Rogue/GleamingDagger.cs @@ -36,7 +36,7 @@ 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, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 3e61b927d1..617ddddddc 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -18,12 +18,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 20; Item.height = 20; - Item.damage = 142; + Item.damage = 210; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 29; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; @@ -31,48 +30,28 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.shootSpeed = 5f; + Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.shoot = ProjectileID.None; - return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - } - else - { - Item.shoot = ModContent.ProjectileType(); - return player.ownedProjectileCounts[ModContent.ProjectileType()] < 10; - } - } - - public override float StealthDamageMultiplier => 0.75f; + 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) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = false; - if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike + 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].localNPCHitCooldown = 30; + } return false; } return true; } - public override bool AltFunctionUse(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = true; - return true; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Rogue/GraveGrimreaver.cs b/Items/Weapons/Rogue/GraveGrimreaver.cs index 9d1664b32b..a26773792a 100644 --- a/Items/Weapons/Rogue/GraveGrimreaver.cs +++ b/Items/Weapons/Rogue/GraveGrimreaver.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().donorItem = true; } - public override float StealthDamageMultiplier => 0.40f; + public override float StealthDamageMultiplier => 0.6f; 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 85cc054a52..2042fcee4d 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -20,15 +20,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 32; Item.damage = 19; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 300; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -51,10 +49,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.Hive). - AddIngredient(ItemID.CrispyHoneyBlock). - AddIngredient(ItemID.BeeWax). + CreateRecipe(). + AddIngredient(ItemID.Hive, 10). + AddIngredient(ItemID.BeeWax, 8). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs deleted file mode 100644 index 9d23b85f76..0000000000 --- a/Items/Weapons/Rogue/HellsSun.cs +++ /dev/null @@ -1,85 +0,0 @@ -using CalamityMod.CalPlayer; -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 -{ - public class HellsSun : RogueWeapon - { - public override void SetDefaults() - { - Item.width = 22; - Item.height = 18; - Item.damage = 200; - Item.DamageType = RogueDamageClass.Instance; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useTime = 15; - Item.useAnimation = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 5; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - - Item.shootSpeed = 5f; - Item.shoot = ModContent.ProjectileType(); - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.shoot = ProjectileID.None; - return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - } - else - { - Item.shoot = ModContent.ProjectileType(); - return player.ownedProjectileCounts[ModContent.ProjectileType()] < 10; - } - } - - 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) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = false; - if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike - { - int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].penetrate = -1; - Main.projectile[stealth].timeLeft = 2400; - } - return false; - } - return true; - } - - public override bool AltFunctionUse(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = true; - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.LunarBar, 10). - AddIngredient(20). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/HellsSun.png b/Items/Weapons/Rogue/HellsSun.png deleted file mode 100644 index 130f9037b4..0000000000 Binary files a/Items/Weapons/Rogue/HellsSun.png and /dev/null differ diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 419ededede..c219d0b749 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -78,10 +78,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.IceBlock, 100). - AddIngredient(6). AddIngredient(8). AddIngredient(20). + AddIngredient(6). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index 1f54f0333e..d7cf231cb7 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.width = Item.height = 66; Item.damage = 45; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Swing; @@ -27,7 +26,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 5, 0); Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/IchorSpear.cs b/Items/Weapons/Rogue/IchorSpear.cs index 251e1e2d00..d745b0686e 100644 --- a/Items/Weapons/Rogue/IchorSpear.cs +++ b/Items/Weapons/Rogue/IchorSpear.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 52; - Item.damage = 132; + Item.damage = 120; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 39; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 17f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.38f; + 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) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index 2efc3a1ecd..eacb33e1bc 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -9,27 +9,20 @@ namespace CalamityMod.Items.Weapons.Rogue { public class InfernalKris : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 32; Item.height = 38; - Item.damage = 24; + Item.damage = 23; Item.noMelee = true; Item.noUseGraphic = true; - Item.consumable = true; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 18; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 5, 0); + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; @@ -40,7 +33,7 @@ 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, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; @@ -50,9 +43,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.HellstoneBar). - AddIngredient(ItemID.Obsidian, 2). + CreateRecipe(). + AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(ItemID.Obsidian, 9). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index ff90a931cc..bc128f5463 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -9,38 +9,31 @@ namespace CalamityMod.Items.Weapons.Rogue { public class IronFrancisca : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 40; Item.height = 36; - Item.damage = 14; + Item.damage = 9; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; + Item.useTime = 20; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = false; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 1, 0); + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - + 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) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; @@ -53,9 +46,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.Wood). - AddIngredient(ItemID.IronBar). + CreateRecipe(). + AddIngredient(ItemID.IronBar, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/JawsOfOblivion.cs b/Items/Weapons/Rogue/JawsOfOblivion.cs index 0d32fde57a..82b1ec85be 100644 --- a/Items/Weapons/Rogue/JawsOfOblivion.cs +++ b/Items/Weapons/Rogue/JawsOfOblivion.cs @@ -32,14 +32,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - 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) { float spreadAngle = MathHelper.ToRadians(2.5f); - Vector2 direction = velocity; - Vector2 baseDirection = direction.RotatedBy(-spreadAngle * 2.5f); + Vector2 baseDirection = velocity.RotatedBy(-spreadAngle * 2.5f); for (int i = 0; i < 6; i++) { diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index 4f5b30cf01..dc3bf49211 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(). AddIngredient(10). - AddTile(TileID.IceMachine). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index 8184726764..b9004d3226 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 34; Item.height = 50; - Item.damage = 63; + Item.damage = 15; Item.knockBack = 12; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; @@ -33,22 +33,15 @@ 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 => 0.3333f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - CalamityPlayer p = Main.player[Main.myPlayer].Calamity(); - //If stealth is full, shoot a spread of 3 boomerangs with reduced range - if (p.StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { - int spread = 10; - for (int i = 0; i < 3; i++) + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) { - Vector2 perturbedspeed = velocity.RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI, 0f, 1f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = true; - spread -= 10; + Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].penetrate = 7; } return false; } diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index d0edf28472..d07c9ea8e1 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -9,38 +9,31 @@ namespace CalamityMod.Items.Weapons.Rogue { public class LeadTomahawk : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 40; Item.height = 36; - Item.damage = 14; + Item.damage = 10; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; + Item.useTime = 20; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = false; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 1, 0); + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - + 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) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; @@ -53,9 +46,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.Wood). - AddIngredient(ItemID.LeadBar). + CreateRecipe(). + AddIngredient(ItemID.LeadBar, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index 46d509b1ad..7918e2eded 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 64; Item.DamageType = RogueDamageClass.Instance; Item.knockBack = 3f; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/LeviathanTeeth.cs b/Items/Weapons/Rogue/LeviathanTeeth.cs index f013288b68..adc05255a4 100644 --- a/Items/Weapons/Rogue/LeviathanTeeth.cs +++ b/Items/Weapons/Rogue/LeviathanTeeth.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 36; Item.height = 38; - Item.damage = 64; + Item.damage = 44; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 15; + Item.useAnimation = Item.useTime = 9; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; @@ -25,43 +25,30 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 5.5f; Item.DamageType = RogueDamageClass.Instance; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { bool stealthStrike = false; - int teethCount; + if (player.Calamity().StealthStrikeAvailable()) - { - teethCount = 6; stealthStrike = true; - } - else + for (int i = 0; i < 2; i++) { - teethCount = Main.rand.Next(2, 3 + 1); - } - - for (int i = 0; i < teethCount; i++) - { - float offsetSpeedX = velocity.X + Main.rand.NextFloat(-2f, 2f); - float offsetSpeedY = velocity.Y + Main.rand.NextFloat(-2f, 2f); - if (stealthStrike) { - int tooth = Projectile.NewProjectile(source, position.X, position.Y, offsetSpeedX * 1.5f, offsetSpeedY * 1.5f, type, damage, knockback * 10f, player.whoAmI); - if (tooth.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[tooth].Calamity().stealthStrike = true; - Main.projectile[tooth].Calamity().lineColor = Main.rand.Next(3); - } + Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity * 1.5f, type, damage, knockback * 12, player.whoAmI); + tooth.Calamity().stealthStrike = true; + tooth.timeLeft = 140; + tooth.ai[1] = 4; + return false; // This makes it not fire 2 with the for loop, thanks Angel lol } else { - int tooth = Projectile.NewProjectile(source, position.X, position.Y, offsetSpeedX, offsetSpeedY, type, damage, knockback, player.whoAmI); - if (tooth.WithinBounds(Main.maxProjectiles)) - Main.projectile[tooth].Calamity().lineColor = Main.rand.Next(3); + Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedByRandom(0.05f + i * 0.15f) * Main.rand.NextFloat(0.7f, 1f), type, damage, knockback, player.whoAmI); + tooth.ai[1] = Main.rand.Next(1, 3 + 1); } } return false; diff --git a/Items/Weapons/Rogue/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 8d692e8cb1..73a34dda76 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 45; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 26; + Item.useAnimation = Item.useTime = 26; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index a39f6910b3..5c695cd2d4 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -10,18 +10,11 @@ namespace CalamityMod.Items.Weapons.Rogue { public class LunarKunai : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 38; Item.height = 38; - Item.damage = 112; - Item.maxStack = 9999; - Item.consumable = true; + Item.damage = 102; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 10; @@ -30,52 +23,21 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; - Item.value = Item.sellPrice(copper: 24); + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 22f; Item.DamageType = RogueDamageClass.Instance; } - 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) { - float kunaiSpeed = 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 = kunaiSpeed; - } - else - { - mouseDistance = kunaiSpeed / mouseDistance; - } - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - int projAmt = player.Calamity().StealthStrikeAvailable() ? 9 : 3; + int projAmt = player.Calamity().StealthStrikeAvailable() ? 10 : 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); + Vector2 spreadVel = velocity.RotatedByRandom(MathHelper.Pi / 20f); + + int stealth = Projectile.NewProjectile(source, position, spreadVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles) && player.Calamity().StealthStrikeAvailable()) Main.projectile[stealth].Calamity().stealthStrike = true; } @@ -84,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(333). + CreateRecipe(). AddIngredient(ItemID.LunarBar, 5). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index 30060d64a7..e67860842d 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -7,11 +7,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Malachite : RogueWeapon + // Have to directly implement the interface instead of extending LegendaryItem since it already extends RogueWeapon + public class Malachite : RogueWeapon, IHoldShiftTooltipItem { + public string ExtensionIndicatorKey => "Items.Misc.LegendaryShortTooltip"; + public Color? ExtensionIndicatorColor => null; + public string TooltipExtensionKey => "LegendaryText"; + public Color? TooltipExtensionColor => Color.Lime; + public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override void SetDefaults() @@ -21,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 52; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1.25f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/MetalMonstrosity.cs b/Items/Weapons/Rogue/MetalMonstrosity.cs index f0f50260f1..d8420bced9 100644 --- a/Items/Weapons/Rogue/MetalMonstrosity.cs +++ b/Items/Weapons/Rogue/MetalMonstrosity.cs @@ -21,10 +21,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Orange; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.damage = 30; - Item.useAnimation = 40; - Item.useTime = 40; - Item.knockBack = 7f; + Item.damage = 28; + Item.useAnimation = Item.useTime = 45; + Item.knockBack = 12f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 7f; @@ -35,7 +34,10 @@ namespace CalamityMod.Items.Weapons.Rogue { int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) + { Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].penetrate = 3; + } return false; } diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index d1b4b08094..3fe824bcf6 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -13,38 +13,38 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 22; Item.height = 28; - Item.damage = 15; + Item.damage = 37; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 28; + Item.knockBack = 5.75f; + Item.shootSpeed = 4f; + Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 18; - Item.knockBack = 5.75f; + Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 3.15f; + public override float StealthDamageMultiplier => 1.15f; + + 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) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 4f); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; + return false; } - else - { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 4f); - } - return false; + return true; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index 4f81f42ffc..6b61c1d864 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,7 +1,10 @@ -using CalamityMod.Projectiles.Rogue; +using System; +using CalamityMod.Dusts; +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; @@ -10,40 +13,82 @@ namespace CalamityMod.Items.Weapons.Rogue { public class MoltenAmputator : RogueWeapon { - public const float Speed = 21f; - + public float speed = 16; public override void SetDefaults() { - Item.width = 60; - Item.height = 60; - Item.damage = 166; + Item.width = 92; + Item.height = 80; + Item.damage = 200; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; - Item.knockBack = 9f; - Item.UseSound = SoundID.Item1; + Item.useTime = Item.useAnimation = 25; + Item.knockBack = 2f; // It needs to be low otherwise enemies dont stay in the slash zone Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = Speed; + Item.shootSpeed = speed; Item.DamageType = RogueDamageClass.Instance; } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + if (player.Calamity().mouseRight) + { + if (player.Calamity().StealthStrikeAvailable()) + { + player.Calamity().amputatorBuff = 30; + player.Calamity().ConsumeStealthByAttacking(); + SoundStyle buff = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRay"); + SoundEngine.PlaySound(buff with { Volume = 1f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, player.Center); - public override float StealthDamageMultiplier => 1.07f; - + for (int i = 0; i < 20; i++) + { + Dust c = Dust.NewDustPerfect(player.Center, ModContent.DustType()); + c.velocity = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 15.5f * (i % 2 == 0 ? 0.88f : 1f); + c.scale = Main.rand.NextFloat(1.3f, 1.6f) * 0.8f * (i % 2 == 0 ? 2.2f : 1.8f); + c.noGravity = true; + c.color = Color.Goldenrod; + c.noLightEmittence = true; + } + } + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[2] < 5 && projectile.timeLeft < 840) + { + projectile.ai[2] = 5; + SoundStyle pullback = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(pullback with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, player.Center); + } + } + } + } + public override float UseSpeedMultiplier(Player player) + { + return (player.Calamity().amputatorBuff > 0 ? 3f : 1); + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) + bool fastToss = player.Calamity().amputatorBuff > 0; + + SoundStyle fire = new("CalamityMod/Sounds/Item/SpearofDestiny"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = (player.Calamity().amputatorBuff > 0 ? -0.4f + (player.Calamity().amputatorBuff * 0.02f) : Main.rand.NextFloat(-0.4f, -0.65f)) }, position); + // Since the positioning of the scythe is important, its velocity is based on your mouse position + Vector2 staticSpeed = Utils.DirectionTo(position, position + velocity) * Utils.Distance(position, player.ClampedMouseWorld()) * 0.022f; + // "fast toss" is the stealth, if you need to change stealth values, change those + int fastTossDamage = (int)(damage * 0.65f); + Projectile scythe = Projectile.NewProjectileDirect(source, position, staticSpeed.RotatedByRandom((player.Calamity().amputatorBuff > 0 ? 0.7f : 0)), type, fastToss ? fastTossDamage : damage, knockback, player.whoAmI, 0, 0, 0); + if (fastToss) { - int ss = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (ss.WithinBounds(Main.maxProjectiles)) - Main.projectile[ss].Calamity().stealthStrike = true; - return false; + scythe.extraUpdates = 6; + scythe.Calamity().stealthStrike = true; + player.Calamity().amputatorBuff--; } - return true; + player.Calamity().ConsumeStealthByAttacking(); + + return false; } } } diff --git a/Items/Weapons/Rogue/MoltenAmputator.png b/Items/Weapons/Rogue/MoltenAmputator.png index 4e44d58710..675411c959 100644 Binary files a/Items/Weapons/Rogue/MoltenAmputator.png and b/Items/Weapons/Rogue/MoltenAmputator.png differ diff --git a/Items/Weapons/Rogue/MonkeyDarts.cs b/Items/Weapons/Rogue/MonkeyDarts.cs deleted file mode 100644 index bfadd571b7..0000000000 --- a/Items/Weapons/Rogue/MonkeyDarts.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class MonkeyDarts : RogueWeapon - { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - 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.useStyle = ItemUseStyleID.Swing; - Item.UseSound = SoundID.Item1; - Item.useTime = 20; - Item.useAnimation = 20; - Item.value = Item.buyPrice(0, 0, 4, 0); - Item.rare = ItemRarityID.Lime; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); - Item.autoReuse = 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 += 18; - - 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) - { - //Checks if stealth is avalaible to shoot a spread of 3 darts - if (player.Calamity().StealthStrikeAvailable()) - { - float spread = 7; - for (int i = 0; i < 3; i++) - { - Vector2 perturbedspeed = new Vector2(velocity.X * 1.25f, velocity.Y * 1.25f).RotatedBy(MathHelper.ToRadians(spread)); - int p = Projectile.NewProjectile(source, position, perturbedspeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1); - if (p.WithinBounds(Main.maxProjectiles)) - Main.projectile[p].Calamity().stealthStrike = true; - spread -= 7; - } - return false; - } - - else - { - return true; - } - } - - } -} diff --git a/Items/Weapons/Rogue/MonkeyDarts.png b/Items/Weapons/Rogue/MonkeyDarts.png deleted file mode 100644 index f5f895427b..0000000000 Binary files a/Items/Weapons/Rogue/MonkeyDarts.png and /dev/null differ diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 72bfad6516..7adee86c42 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -32,7 +32,7 @@ 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) { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20 && stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index 8d63d39313..b7be65a638 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -8,18 +8,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class MythrilKnife : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 12; Item.height = 40; Item.damage = 80; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Swing; @@ -27,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1100; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -49,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.MythrilBar). + CreateRecipe(). + AddIngredient(ItemID.MythrilBar, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/NanoblackReaper.cs b/Items/Weapons/Rogue/NanoblackReaper.cs index 7b189af415..4e74227094 100644 --- a/Items/Weapons/Rogue/NanoblackReaper.cs +++ b/Items/Weapons/Rogue/NanoblackReaper.cs @@ -46,8 +46,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = Speed; } - 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) { if (player.Calamity().StealthStrikeAvailable()) @@ -65,10 +63,10 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(). + AddIngredient(5). AddIngredient(40). AddIngredient(20). AddIngredient(ItemID.Nanites, 400). - AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/NastyCholla.cs b/Items/Weapons/Rogue/NastyCholla.cs index 3798f96f9f..4149843acd 100644 --- a/Items/Weapons/Rogue/NastyCholla.cs +++ b/Items/Weapons/Rogue/NastyCholla.cs @@ -9,28 +9,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class NastyCholla : RogueWeapon { - public static int BaseDamage = 15; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 20; Item.height = 18; - Item.damage = BaseDamage; + Item.damage = 10; Item.noMelee = true; Item.noUseGraphic = true; - Item.maxStack = 9999; - Item.consumable = true; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 20; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 0, 0, 50); + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; @@ -60,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(10). - AddIngredient(ItemID.Cactus). + CreateRecipe(). + AddIngredient(ItemID.Cactus, 8). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index 4b05fd1732..04afde8631 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -34,13 +34,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.22f; + 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 p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs deleted file mode 100644 index 7a4119a894..0000000000 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class Nychthemeron : RogueWeapon - { - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.damage = 60; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; - Item.knockBack = 1f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; - Item.rare = ItemRarityID.LightPurple; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; - Item.DamageType = RogueDamageClass.Instance; - } - - public override bool AltFunctionUse(Player player) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == Item.shoot && p.owner == player.whoAmI) - { - p.ai[0] = 1f; - } - } - return true; - } - - 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) - { - int orbDamage = (int)(damage * 0.75f); - - if (player.Calamity().StealthStrikeAvailable()) - { - for (int j = 0; j < 10 - player.ownedProjectileCounts[ModContent.ProjectileType()]; j++) - { - float spread = 2; - int pIndex = Projectile.NewProjectile(source, position.X, position.Y, velocity.X + Main.rand.NextFloat(-spread, spread), velocity.Y + Main.rand.NextFloat(-spread, spread), type, damage, knockback, player.whoAmI, 0f, 1f); - Projectile p = Main.projectile[pIndex]; - if (pIndex.WithinBounds(Main.maxProjectiles)) - p.Calamity().stealthStrike = true; - int pID = p.identity; - - CreateOrbs(source, position, (int)(orbDamage * 0.675f), knockback, pID, player, true); - } - } - else - { - int pIndex = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); - int pID = Main.projectile[pIndex].identity; - - CreateOrbs(source, position, orbDamage, knockback, pID, player, false); - } - return false; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.shoot = ProjectileID.None; - return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - } - else - { - Item.shoot = ModContent.ProjectileType(); - return player.ownedProjectileCounts[ModContent.ProjectileType()] < 10; - } - } - - private static void CreateOrbs(IEntitySource source, Vector2 position, int damage, float knockback, int projectileID, Player player, bool stealth) - { - float rotationOffset = 0f; - - // Ideally new projectiles will fill in the most recently vacated spots in the pattern - int[] activeSlots = new int[10] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - foreach (Projectile proj in Main.ActiveProjectiles) - { - if (proj.type == ModContent.ProjectileType() && proj.owner == player.whoAmI && proj.localAI[0] == 0f && activeSlots[(int)proj.localAI[1]] == -1) - { - activeSlots[(int)proj.localAI[1]] = proj.whoAmI; - } - } - - int pos = 0; - bool assignedOffset = false; - for (int i = 0; i < 10; i++) - { - if (activeSlots[i] != -1) - { - rotationOffset = Main.projectile[activeSlots[i]].rotation; - assignedOffset = true; - } - if (activeSlots[i] == -1 && assignedOffset) - { - pos = i; - break; - } - } - - float orb1Col = 0f; - float orb2Col = 1f; - - if (pos > 0 && pos < 5) - { - rotationOffset += MathHelper.ToRadians(45f); - - orb1Col = pos % 2; - orb2Col = pos % 2; - } - else if (pos >= 5) - { - rotationOffset += MathHelper.ToRadians(72f); - } - - - int orb1 = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, orb1Col, projectileID); - int orb2 = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, orb2Col, projectileID); - if (orb1.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[orb1].localAI[1] = pos; - Main.projectile[orb1].rotation = rotationOffset; - Main.projectile[orb1].Calamity().lineColor = stealth ? 1 : 0; - } - if (orb2.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[orb2].localAI[1] = pos; - Main.projectile[orb2].rotation = rotationOffset + MathHelper.ToRadians(180f); - Main.projectile[orb2].Calamity().lineColor = stealth ? 1 : 0; - } - } - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("AnyMythrilBar", 10). - AddIngredient(ItemID.DarkShard). - AddIngredient(ItemID.LightShard). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/Nychthemeron.png b/Items/Weapons/Rogue/Nychthemeron.png deleted file mode 100644 index 35694b0ef6..0000000000 Binary files a/Items/Weapons/Rogue/Nychthemeron.png and /dev/null differ diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index 2afca45b5a..54fb0625e8 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -8,26 +8,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class OrichalcumSpikedGemstone : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 14; Item.height = 34; Item.damage = 40; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 13; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1200; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -51,8 +44,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.OrichalcumBar). + CreateRecipe(). + AddIngredient(ItemID.OrichalcumBar, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index 52d8b1209a..d05f728ce9 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -8,26 +8,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class PalladiumJavelin : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 54; Item.height = 54; Item.damage = 118; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1200; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -47,8 +40,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.PalladiumBar). + CreateRecipe(). + AddIngredient(ItemID.PalladiumBar, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index 55975887bf..e933be5740 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -68,9 +68,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). AddIngredient(8). AddIngredient(20). + AddIngredient(6). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index 80f0d86737..bbab821611 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -10,11 +10,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Plaguenade : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 20; @@ -22,15 +17,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 63; Item.noMelee = true; Item.noUseGraphic = true; - Item.consumable = true; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 15; Item.knockBack = 1.5f; - Item.maxStack = 9999; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(gold: 1); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); @@ -42,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; @@ -52,9 +45,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.Beenade, 30). - AddIngredient(5). + CreateRecipe(). + AddIngredient(ItemID.Beenade, 100). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs deleted file mode 100644 index 858e9aff61..0000000000 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ /dev/null @@ -1,82 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class PoisonPack : RogueWeapon - { - private static float baseKnockback = 1.8f; - - public override void SetDefaults() - { - Item.width = 14; - Item.height = 14; - Item.damage = 20; - Item.DamageType = RogueDamageClass.Instance; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useTime = 19; - Item.useAnimation = 19; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = baseKnockback; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item1; - - Item.shootSpeed = 7f; - 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 bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.shoot = ProjectileID.None; - return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - } - else - { - Item.shoot = ModContent.ProjectileType(); - return player.ownedProjectileCounts[ModContent.ProjectileType()] < 3; - } - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = false; - if (modPlayer.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; - return false; - } - return true; - } - - public override bool AltFunctionUse(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = true; - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.JungleSpores, 10). - AddIngredient(ItemID.Stinger, 8). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/PoisonPack.png b/Items/Weapons/Rogue/PoisonPack.png deleted file mode 100644 index ba811c24d2..0000000000 Binary files a/Items/Weapons/Rogue/PoisonPack.png and /dev/null differ diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index 140007da3d..8977ed8739 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 1a0b20520d..c6d2aec7aa 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 56; Item.height = 56; - Item.damage = 322; + Item.damage = 222; Item.knockBack = 8f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; @@ -51,8 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(500). - AddIngredient(4). + AddIngredient(). AddIngredient(25). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Rogue/RealityRupture.cs b/Items/Weapons/Rogue/RealityRupture.cs index 27b1129ff6..f88d479661 100644 --- a/Items/Weapons/Rogue/RealityRupture.cs +++ b/Items/Weapons/Rogue/RealityRupture.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 86; Item.height = 102; - Item.damage = 225; + Item.damage = 420; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 37; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 10f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 3.9f; + public override float StealthDamageMultiplier => 2.25f; 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 @@ -54,19 +54,16 @@ namespace CalamityMod.Items.Weapons.Rogue { int projType = BigSpear ? ModContent.ProjectileType() : type; - if (!BigSpear) - SoundEngine.PlaySound(ThrowSound, player.Center); - else - SoundEngine.PlaySound(ThrowSound2, player.Center); + SoundEngine.PlaySound(BigSpear ? ThrowSound2 : ThrowSound, player.Center); if (BigSpear) { - Projectile.NewProjectile(source, position, velocity, projType, BigSpear ? damage * 4 : damage, knockback * 1.5f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, projType, damage * 4, knockback * 1.5f, player.whoAmI); } - int index = 4; - for (int i = -index; i <= index; i += index) + else { - if (!BigSpear) + int index = 4; + for (int i = -index; i <= index; i += index) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); int spear = Projectile.NewProjectile(source, position, perturbedSpeed, projType, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Rogue/ElementalDisk.cs b/Items/Weapons/Rogue/ReboundingRainbow.cs similarity index 90% rename from Items/Weapons/Rogue/ElementalDisk.cs rename to Items/Weapons/Rogue/ReboundingRainbow.cs index 21e758b945..a874f6347d 100644 --- a/Items/Weapons/Rogue/ElementalDisk.cs +++ b/Items/Weapons/Rogue/ReboundingRainbow.cs @@ -8,8 +8,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - [LegacyName("AccretionDisk")] - public class ElementalDisk : RogueWeapon + [LegacyName("AccretionDisk", "ElementalDisk")] + public class ReboundingRainbow : RogueWeapon { public static int stealthTimeMult = 2; public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; } @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/ElementalDisk.png b/Items/Weapons/Rogue/ReboundingRainbow.png similarity index 100% rename from Items/Weapons/Rogue/ElementalDisk.png rename to Items/Weapons/Rogue/ReboundingRainbow.png diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index 2d7451a63e..4d9491c548 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -13,9 +14,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 120; - Item.damage = 616; + Item.damage = 240; Item.knockBack = 8.5f; - Item.useAnimation = Item.useTime = 18; + Item.useAnimation = Item.useTime = 40; Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; Item.shootSpeed = 18f; @@ -29,14 +30,25 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 0.75f; + public override float StealthDamageMultiplier => 0.3f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int shuriken = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(shuriken)) - Main.projectile[shuriken].Calamity().stealthStrike = true; - return false; + CalamityPlayer p = Main.LocalPlayer.Calamity(); + //If stealth is full, shoot a spread of 3 shurikens + if (p.StealthStrikeAvailable()) + { + int spread = 20; + for (int i = -1; i <= 1; i++) + { + Vector2 perturbedspeed = velocity.RotatedBy(MathHelper.ToRadians(spread * i)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI, 0f, 1f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; + } + return false; + } + return true; } } } diff --git a/Items/Weapons/Rogue/RegulusRiot.cs b/Items/Weapons/Rogue/RegulusRiot.cs index ce2b201f5e..02c40309ce 100644 --- a/Items/Weapons/Rogue/RegulusRiot.cs +++ b/Items/Weapons/Rogue/RegulusRiot.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 28; Item.height = 34; - Item.damage = 116; + Item.damage = 100; + Item.useAnimation = Item.useTime = 24; Item.knockBack = 4.5f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityCyanBuyPrice; - Item.useTime = 26; - Item.useAnimation = 26; Item.UseSound = SoundID.Item1; Item.rare = ItemRarityID.Cyan; Item.DamageType = RogueDamageClass.Instance; @@ -31,8 +30,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); } - 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()) //setting the stealth strike diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index e1b71f353a..d3f15c1c90 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -37,7 +37,5 @@ namespace CalamityMod.Items.Weapons.Rogue 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 9d76091a63..89cf7dcd29 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -10,18 +10,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class RotBall : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 24; + Item.damage = 20; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Swing; @@ -29,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1000; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; @@ -57,10 +50,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.DemoniteBar). - AddIngredient(). - AddIngredient(ItemID.RottenChunk). + CreateRecipe(). + AddIngredient(ItemID.DemoniteBar, 4). + AddIngredient(12). + AddIngredient(ItemID.RottenChunk, 4). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Rogue/SamsaraSlicer.cs b/Items/Weapons/Rogue/SamsaraSlicer.cs index 1c35afd3bc..a6cb2e84ef 100644 --- a/Items/Weapons/Rogue/SamsaraSlicer.cs +++ b/Items/Weapons/Rogue/SamsaraSlicer.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("TerraDisk")] public class SamsaraSlicer : RogueWeapon { - public static float Speed = 12f; + public static float Speed = 20f; public override void SetDefaults() { Item.width = 60; Item.height = 64; - Item.damage = 100; + Item.damage = 80; Item.knockBack = 4f; Item.useAnimation = Item.useTime = 30; Item.autoReuse = true; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.UseSound = SoundID.Item1; + Item.UseSound = SoundID.DD2_GoblinBomberThrow; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; @@ -36,10 +36,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = Speed; } - public override float StealthVelocityMultiplier => 0.75f; + 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) { + if (player.ownedProjectileCounts[type] > 4) return false; + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { @@ -48,6 +50,12 @@ namespace CalamityMod.Items.Weapons.Rogue return false; } + public override bool CanUseItem(Player player) + { + if (player.ownedProjectileCounts[Item.shoot] > 4) return false; + return base.CanUseItem(player); + } + 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); diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index c7110b796b..f873ac1eba 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -42,8 +42,6 @@ namespace CalamityMod.Items.Weapons.Rogue } } - 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) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike diff --git a/Items/Weapons/Rogue/Sandslasher.png b/Items/Weapons/Rogue/Sandslasher.png deleted file mode 100644 index bee7527680..0000000000 Binary files a/Items/Weapons/Rogue/Sandslasher.png and /dev/null differ diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index 9d53380866..52d204654e 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -49,9 +49,9 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(). + AddIngredient(5). AddIngredient(15). AddIngredient(ItemID.SoulofNight, 15). - AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/ScourgeoftheDesert.cs b/Items/Weapons/Rogue/ScourgeoftheDesert.cs index c39e7906bd..3686253aea 100644 --- a/Items/Weapons/Rogue/ScourgeoftheDesert.cs +++ b/Items/Weapons/Rogue/ScourgeoftheDesert.cs @@ -11,13 +11,13 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.width = 82; - Item.height = 82; + Item.width = 112; + Item.height = 116; Item.damage = 12; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.knockBack = 3.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/ScourgeoftheDesert.png b/Items/Weapons/Rogue/ScourgeoftheDesert.png index 8e86310af5..625d9bb541 100644 Binary files a/Items/Weapons/Rogue/ScourgeoftheDesert.png and b/Items/Weapons/Rogue/ScourgeoftheDesert.png differ diff --git a/Items/Weapons/Rogue/SeafoamBomb.cs b/Items/Weapons/Rogue/SeafoamBomb.cs index 63f19c3669..b7666b5cd4 100644 --- a/Items/Weapons/Rogue/SeafoamBomb.cs +++ b/Items/Weapons/Rogue/SeafoamBomb.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -12,45 +12,58 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SeafoamBomb : RogueWeapon { + public int throwCount = 0; // Gives bubbles an order to be fused in public override void SetDefaults() { - Item.width = 26; - Item.height = 44; - Item.damage = 12; + Item.width = 38; + Item.height = 42; + Item.damage = 35; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 25; + Item.useTime = Item.useAnimation = 40; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 25; Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8f; + Item.shootSpeed = 7f; Item.DamageType = RogueDamageClass.Instance; } - + public override float UseSpeedMultiplier(Player player) + { + if (Main.zenithWorld) // It's S tier + return 6; + return 1f; + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) // Stealth strikes throw a cluster bomb, the throw count is increased to insure that bubble fusing works { - int stealth = Projectile.NewProjectile(source, position, new Vector2(velocity.X + velocity.X / 3, velocity.Y + velocity.Y / 3), type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, -5); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].localAI[0] = throwCount; + throwCount += 50; + return false; } - return true; + else + { + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, -5); + Main.projectile[proj].localAI[0] = throwCount; + throwCount++; + } + return false; } public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Bomb, 25). AddIngredient(10). - AddIngredient(). + AddIngredient(2). + AddIngredient(15). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/SeafoamBomb.png b/Items/Weapons/Rogue/SeafoamBomb.png index 33dfca0d19..86e3f26bcf 100644 Binary files a/Items/Weapons/Rogue/SeafoamBomb.png and b/Items/Weapons/Rogue/SeafoamBomb.png differ diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index 9eb6db81d9..0c81d9d686 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().donorItem = true; } - public override float StealthDamageMultiplier => 0.72f; + 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/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index 411e55ba23..b7cc902959 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.reuseDelay = 1; Item.useLimitPerAnimation = 1; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/Seraphim.cs b/Items/Weapons/Rogue/Seraphim.cs index 05f34b2484..70f1b3c210 100644 --- a/Items/Weapons/Rogue/Seraphim.cs +++ b/Items/Weapons/Rogue/Seraphim.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Rogue/ShardofAntumbra.cs b/Items/Weapons/Rogue/ShardofAntumbra.cs index 41e5a94627..1b49987a1c 100644 --- a/Items/Weapons/Rogue/ShardofAntumbra.cs +++ b/Items/Weapons/Rogue/ShardofAntumbra.cs @@ -11,16 +11,11 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("XerocPitchfork")] public class ShardofAntumbra : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 48; Item.height = 48; - Item.damage = 97; + Item.damage = 111; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 17; @@ -36,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.7f; + 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/ShatteredSun.cs b/Items/Weapons/Rogue/ShatteredDawn.cs similarity index 94% rename from Items/Weapons/Rogue/ShatteredSun.cs rename to Items/Weapons/Rogue/ShatteredDawn.cs index a6c682cd9d..ddd03e1541 100644 --- a/Items/Weapons/Rogue/ShatteredSun.cs +++ b/Items/Weapons/Rogue/ShatteredDawn.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ShatteredSun : RogueWeapon + public class ShatteredDawn : RogueWeapon { public override void SetDefaults() { @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/ShatteredSun.png b/Items/Weapons/Rogue/ShatteredDawn.png similarity index 100% rename from Items/Weapons/Rogue/ShatteredSun.png rename to Items/Weapons/Rogue/ShatteredDawn.png diff --git a/Items/Weapons/Rogue/SlickCane.cs b/Items/Weapons/Rogue/SlickCane.cs index 22ee59fe16..66108a171d 100644 --- a/Items/Weapons/Rogue/SlickCane.cs +++ b/Items/Weapons/Rogue/SlickCane.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 42; Item.height = 36; - Item.damage = 27; + Item.damage = 50; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index f35fe11b61..d3f9b71e46 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -11,26 +11,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SludgeSplotch : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 32; Item.height = 30; - Item.damage = 48; + Item.damage = 41; Item.noMelee = true; Item.noUseGraphic = true; - Item.consumable = true; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 18; Item.knockBack = 1f; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(0, 0, 0, 40); + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -56,9 +49,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(15). - AddRecipeGroup("Boss2Material"). + CreateRecipe(). + AddIngredient(50). + AddRecipeGroup("Boss2Material", 8). Register(); } } diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index 292c1b9aef..e99ea4e662 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -19,12 +19,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 52; Item.height = 52; - Item.damage = 50; + Item.damage = 75; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 40; + Item.useAnimation = Item.useTime = 41; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 40; Item.knockBack = 2f; Item.UseSound = ThrowSound; Item.autoReuse = true; @@ -35,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 4.2f; + 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) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike @@ -53,19 +52,16 @@ namespace CalamityMod.Items.Weapons.Rogue { int projType = BigSpear ? ModContent.ProjectileType() : type; - if (!BigSpear) - SoundEngine.PlaySound(ThrowSound, player.Center); - else - SoundEngine.PlaySound(ThrowSound2, player.Center); + SoundEngine.PlaySound(BigSpear ? ThrowSound2 : ThrowSound, player.Center); if (BigSpear) { - Projectile.NewProjectile(source, position, velocity, projType, BigSpear ? damage * 3 : damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, projType, damage * 3, knockback, player.whoAmI); } - int index = 5; - for (int i = -index; i <= index; i += index) + else { - if (!BigSpear) + int index = 5; + for (int i = -index; i <= index; i += index) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); int spear = Projectile.NewProjectile(source, position, perturbedSpeed, projType, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Rogue/Sandslasher.cs b/Items/Weapons/Rogue/SporeKnife.cs similarity index 52% rename from Items/Weapons/Rogue/Sandslasher.cs rename to Items/Weapons/Rogue/SporeKnife.cs index 84486e2e08..5c05d20d3e 100644 --- a/Items/Weapons/Rogue/Sandslasher.cs +++ b/Items/Weapons/Rogue/SporeKnife.cs @@ -1,42 +1,40 @@ -using CalamityMod.Items.Materials; -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 { - public class Sandslasher : RogueWeapon + public class SporeKnife : RogueWeapon { public override void SetDefaults() { - Item.width = 40; + Item.width = 12; Item.height = 40; - Item.damage = 115; + Item.damage = 18; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 20; - Item.knockBack = 5f; + Item.knockBack = 1.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8f; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; } - + 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) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = true; + 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 true; @@ -45,11 +43,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(6). - AddRecipeGroup("AnyGoldBar", 10). - AddIngredient(ItemID.HardenedSand, 25). - AddTile(TileID.MythrilAnvil). + AddIngredient(ItemID.JungleSpores, 12). + AddIngredient(ItemID.Stinger, 8). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Rogue/SporeKnife.png b/Items/Weapons/Rogue/SporeKnife.png new file mode 100644 index 0000000000..f795ed33cb Binary files /dev/null and b/Items/Weapons/Rogue/SporeKnife.png differ diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index 76c4f95444..31295b43ed 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 94; - Item.damage = 475; + Item.damage = 420; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 100; + Item.useAnimation = Item.useTime = 90; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 10f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index 38f8dc355d..b8f8e6eb71 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -38,8 +38,6 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[Item.shoot] < knifeLimit) { - damage = (int)(damage * 1.1f); - int knifeAmt = knifeCount; if ((player.ownedProjectileCounts[Item.shoot] + knifeCount) >= knifeLimit) knifeAmt = knifeLimit - player.ownedProjectileCounts[Item.shoot]; diff --git a/Items/Weapons/Rogue/StickySpikyBall.cs b/Items/Weapons/Rogue/StickySpikyBall.cs deleted file mode 100644 index 40d52883b8..0000000000 --- a/Items/Weapons/Rogue/StickySpikyBall.cs +++ /dev/null @@ -1,69 +0,0 @@ -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class StickySpikyBall : RogueWeapon - { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.width = 14; - Item.height = 14; - Item.damage = 10; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.maxStack = 9999; - Item.consumable = true; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; - Item.knockBack = 3f; - Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 0, 1, 0); - Item.rare = ItemRarityID.Blue; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8f; - Item.DamageType = RogueDamageClass.Instance; - } - - 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 = 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)); - int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].Calamity().stealthStrike = true; - Main.projectile[proj].timeLeft *= 4; - Main.projectile[proj].localNPCHitCooldown += 15; - } - spread -= Main.rand.Next(1, 4); - } - return false; - } - return true; - } - - public override void AddRecipes() - { - CreateRecipe(100). - AddIngredient(ItemID.SpikyBall, 100). - AddIngredient(ItemID.Gel). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/StickySpikyBall.png b/Items/Weapons/Rogue/StickySpikyBall.png deleted file mode 100644 index 6d92f61274..0000000000 Binary files a/Items/Weapons/Rogue/StickySpikyBall.png and /dev/null differ diff --git a/Items/Weapons/Rogue/StormfrontRazor.cs b/Items/Weapons/Rogue/StormfrontRazor.cs index cbfac2a18a..3d98b335f5 100644 --- a/Items/Weapons/Rogue/StormfrontRazor.cs +++ b/Items/Weapons/Rogue/StormfrontRazor.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Weapons/Rogue/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index 36cf6c2268..cc2beb46e3 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -11,18 +11,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class TarragonThrowingDart : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 34; Item.height = 34; Item.damage = 380; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 11; Item.useStyle = ItemUseStyleID.Swing; @@ -30,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(copper: 30); + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; @@ -52,8 +45,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(333). - AddIngredient(). + CreateRecipe(). + AddIngredient(12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/TerrorTalons.cs b/Items/Weapons/Rogue/TerrorTalons.cs index ae55c3601e..72246ccf3b 100644 --- a/Items/Weapons/Rogue/TerrorTalons.cs +++ b/Items/Weapons/Rogue/TerrorTalons.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 40; Item.height = 24; - Item.damage = 52; + Item.damage = 50; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; @@ -26,11 +26,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10.5f; + Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 9f; + public override float StealthDamageMultiplier => 1.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/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index 9cddd5b17f..10cbf7a310 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 128; - Item.damage = 326; + Item.damage = 296; Item.knockBack = 7f; Item.useAnimation = Item.useTime = 25; Item.DamageType = RogueDamageClass.Instance; @@ -29,8 +29,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - 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); diff --git a/Items/Weapons/Rogue/TheFinalDawn.cs b/Items/Weapons/Rogue/TheFinalDawn.cs index 45f45c9fe6..beb247c99c 100644 --- a/Items/Weapons/Rogue/TheFinalDawn.cs +++ b/Items/Weapons/Rogue/TheFinalDawn.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 2500; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; Item.autoReuse = false; diff --git a/Items/Weapons/Rogue/TheOldReaper.cs b/Items/Weapons/Rogue/TheOldReaper.cs index dffec98bbb..841f548173 100644 --- a/Items/Weapons/Rogue/TheOldReaper.cs +++ b/Items/Weapons/Rogue/TheOldReaper.cs @@ -15,31 +15,30 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 106; Item.height = 104; - Item.damage = 180; + Item.damage = 1450; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 20; - Item.useTime = 20; + Item.useAnimation = 50; + Item.useTime = 50; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = 10f; Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } - //public override float StealthDamageMultiplier => 0.45f; + 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) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 15; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 1; 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); diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index 03869d928a..a34ec66c13 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 14; Item.shootSpeed = 15f; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 0, 0, 50); + Item.value = Item.sellPrice(0, 0, 0, 4); Item.rare = ItemRarityID.White; - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.UseSound = SoundID.Item1; Item.consumable = true; Item.noMelee = true; @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue //Check if stealth is full if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 1); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 35937393a0..6d48b1f18c 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -32,11 +32,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.68f; + 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) { - int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index 9c6f50b5a9..baee97518b 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -8,33 +8,24 @@ namespace CalamityMod.Items.Weapons.Rogue { public class TitaniumShuriken : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 34; Item.height = 34; - Item.damage = 41; - Item.noMelee = true; - Item.consumable = true; - Item.noUseGraphic = true; - Item.useAnimation = 9; + Item.damage = 38; + Item.useAnimation = Item.useTime = 9; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 9; + Item.noMelee = true; + Item.noUseGraphic = true; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 2000; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.3f; public override float StealthVelocityMultiplier => 1.25f; @@ -49,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Rogue if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; Main.projectile[stealth].aiStyle = -1; Main.projectile[stealth].extraUpdates = 1; + Main.projectile[stealth].localNPCHitCooldown = -1; } return false; } @@ -60,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.TitaniumBar). + CreateRecipe(). + AddIngredient(ItemID.TitaniumBar, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 593ca377c3..2799f984b0 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -10,18 +10,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ToothBall : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 24; + Item.damage = 20; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Swing; @@ -29,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1000; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; @@ -57,10 +50,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.CrimtaneBar). - AddIngredient(). - AddIngredient(ItemID.Vertebrae). + CreateRecipe(). + AddIngredient(ItemID.CrimtaneBar, 4). + AddIngredient(12). + AddIngredient(ItemID.Vertebrae, 4). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index d5dce99ce1..8a9a9c21f4 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -14,34 +14,50 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 42; Item.height = 46; - Item.damage = 333; + Item.damage = 230; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 20; + Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 5f; + Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 18f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 1.3f; + 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) { + float rotationAngle = MathHelper.ToRadians(20f); if (player.Calamity().StealthStrikeAvailable()) { - int boomer = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (boomer.WithinBounds(Main.maxProjectiles)) - Main.projectile[boomer].Calamity().stealthStrike = true; - return false; + for (int i = 0; i < 2; i++) + { + int proj = Projectile.NewProjectile(source, position, velocity.RotatedBy(rotationAngle), type, damage, knockback, player.whoAmI, 0, 0, 0 + i); + int proj2 = Projectile.NewProjectile(source, position, velocity.RotatedBy(rotationAngle * 0.5f) * 0.9f, type, damage, knockback, player.whoAmI, 0, 0, 2 + i); + rotationAngle *= -1; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; + if (proj2.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj2].Calamity().stealthStrike = true; + } } - return true; + else + { + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(source, position, velocity.RotatedBy(rotationAngle), type, damage, knockback, player.whoAmI, 0, 0, 0 + i); + Projectile.NewProjectile(source, position, velocity.RotatedBy(rotationAngle * 0.5f) * 0.9f, type, damage, knockback, player.whoAmI, 0, 0, 2 + i); + rotationAngle *= -1; + } + } + return false; } } } diff --git a/Items/Weapons/Rogue/TwistingThunder.cs b/Items/Weapons/Rogue/TwistingThunder.cs index aa3d36d2b3..55cfb38d91 100644 --- a/Items/Weapons/Rogue/TwistingThunder.cs +++ b/Items/Weapons/Rogue/TwistingThunder.cs @@ -57,9 +57,8 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(3). AddIngredient(15). - AddIngredient(5). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/UrchinStinger.cs b/Items/Weapons/Rogue/UrchinStinger.cs index 07622f7198..606271f7d4 100644 --- a/Items/Weapons/Rogue/UrchinStinger.cs +++ b/Items/Weapons/Rogue/UrchinStinger.cs @@ -8,41 +8,45 @@ namespace CalamityMod.Items.Weapons.Rogue { public class UrchinStinger : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 10; Item.height = 26; Item.damage = 13; - Item.noMelee = true; - Item.consumable = true; - Item.noUseGraphic = true; - Item.useAnimation = 14; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 14; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 17; Item.knockBack = 1.5f; + + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 200; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.DamageType = RogueDamageClass.Instance; } - 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) { - int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - if (player.Calamity().StealthStrikeAvailable()) - Main.projectile[proj].Calamity().stealthStrike = true; - return false; + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(23f)) * 0.6f; + Vector2 newVel2 = velocity.RotatedByRandom(MathHelper.ToRadians(23f)) * 0.8f; + if (!player.Calamity().StealthStrikeAvailable()) + { + Projectile.NewProjectile(source, position, newVel, type, damage / 2, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, newVel2, type, damage / 2, knockback, player.whoAmI); + } + + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable()) + Main.projectile[proj].Calamity().stealthStrike = true; + return false; + } + return true; } } } diff --git a/Items/Weapons/Rogue/WaveSkipper.cs b/Items/Weapons/Rogue/WaveSkipper.cs index 7abed0d80a..8b13ced2b3 100644 --- a/Items/Weapons/Rogue/WaveSkipper.cs +++ b/Items/Weapons/Rogue/WaveSkipper.cs @@ -1,6 +1,6 @@ using System; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue { for (int i = -SpreadAngle; i < SpreadAngle * 2; i += SpreadAngle) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 spreadVelocity = player.SafeDirectionTo(Main.MouseWorld).RotatedBy(MathHelper.ToRadians(i)) * Item.shootSpeed; int stealth = Projectile.NewProjectile(source, position, spreadVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index b6b8276719..146b03b4f7 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -9,26 +9,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class WebBall : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 20; Item.height = 18; - Item.damage = 12; + Item.damage = 11; Item.noMelee = true; Item.noUseGraphic = true; - Item.maxStack = 9999; - Item.consumable = true; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 20; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 0, 0, 30); + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6.5f; @@ -39,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; @@ -49,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(50). - AddIngredient(ItemID.Cobweb, 10). + CreateRecipe(). + AddIngredient(ItemID.Cobweb, 30). Register(); } } diff --git a/Items/Weapons/Rogue/BrackishFlask.cs b/Items/Weapons/Rogue/Whitewater.cs similarity index 61% rename from Items/Weapons/Rogue/BrackishFlask.cs rename to Items/Weapons/Rogue/Whitewater.cs index cb85473023..fe1e7f836b 100644 --- a/Items/Weapons/Rogue/BrackishFlask.cs +++ b/Items/Weapons/Rogue/Whitewater.cs @@ -7,25 +7,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BrackishFlask : RogueWeapon + [LegacyName("BrackishFlask")] + public class Whitewater : RogueWeapon { + public bool splitDirection = false; public override void SetDefaults() { - Item.width = 28; - Item.height = 30; - Item.damage = 60; + Item.width = 36; + Item.height = 40; + Item.damage = 88; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 35; + Item.useAnimation = 42; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 35; + Item.useTime = 42; Item.knockBack = 6.5f; - Item.UseSound = SoundID.Item106; + Item.UseSound = SoundID.Item106 with { Volume = 0.7f }; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; Item.DamageType = RogueDamageClass.Instance; } @@ -37,10 +39,17 @@ 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 true; + else + { + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + Main.projectile[proj].ai[1] = splitDirection ? 1 : -1; + splitDirection = !splitDirection; + } + return false; } } } diff --git a/Items/Weapons/Rogue/Whitewater.png b/Items/Weapons/Rogue/Whitewater.png new file mode 100644 index 0000000000..665e99c8f2 Binary files /dev/null and b/Items/Weapons/Rogue/Whitewater.png differ diff --git a/Items/Weapons/Rogue/Wrathwing.cs b/Items/Weapons/Rogue/Wrathwing.cs index f8f71d8eb5..1e974a818b 100644 --- a/Items/Weapons/Rogue/Wrathwing.cs +++ b/Items/Weapons/Rogue/Wrathwing.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 13; + Item.useAnimation = Item.useTime = 13; Item.autoReuse = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; @@ -34,7 +34,7 @@ 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) { - int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + 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; diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 056ec51dd4..57a97d0e19 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -12,15 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class WulfrumKnife : RogueWeapon { - 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 override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } + public static readonly SoundStyle Throw3Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowFull") { Volume = 0.7f, PitchVariance = 0.4f }; + public static readonly SoundStyle Throw2Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowTwo") { Volume = 0.7f, PitchVariance = 0.4f }; + public static readonly SoundStyle Throw1Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowSingle") { Volume = 0.7f, PitchVariance = 0.4f }; + public static readonly SoundStyle TileHitSound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit", 2) { Volume = 0.7f, PitchVariance = 0.4f, MaxInstances = 3 }; public int shootCount = 0; public bool stealthStrikeStarted = false; @@ -29,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 22; Item.height = 38; - Item.damage = 9; + Item.damage = 11; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; //Clockwork burst @@ -43,70 +37,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = Throw3Sound; Item.autoReuse = true; - Item.maxStack = 9999; Item.value = Item.sellPrice(0, 0, 0, 5); Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 4f; Item.DamageType = RogueDamageClass.Instance; } - - //Magnetization - public override void HoldItem(Player player) - { - player.Calamity().rightClickListener = true; - - if (player.Calamity().mouseRight && Main.rand.NextBool(7)) - { - Particle streak = new ManaDrainStreak(player, Main.rand.NextFloat(0.2f, 0.5f), Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(170f, 670f), Main.rand.NextFloat(30f, 44f), Color.GreenYellow, Color.DeepSkyBlue, Main.rand.Next(15, 30)); - GeneralParticleHandler.SpawnParticle(streak); - } - } - - public override void GrabRange(Player player, ref int grabRange) - { - float rangeMult = 2f; - if (player.Distance(Item.Center) < 670 && player.HeldItem.type == ModContent.ItemType() && player.Calamity().mouseRight) - rangeMult = 20f; - - grabRange = (int)(grabRange * rangeMult); - - if (rangeMult > 2f && player.Distance(Item.Center) > 50f) - { - Item.velocity = (player.DirectionTo(Item.Center) * -20f); - - if (Main.rand.NextBool(3)) - { - Vector2 dustCenter = Item.Center + Main.rand.NextVector2Circular(4f, 4f); - - Dust chust = Dust.NewDustPerfect(dustCenter, 15, -Item.velocity * Main.rand.NextFloat(0.2f, 0.1f), Scale: Main.rand.NextFloat(1.2f, 1.8f)); - chust.noGravity = true; - } - } - } - - - //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) - { - int placeholderStock = shootCount; - shootCount = -1; - - if (ItemLoader.ConsumeItem(Item, player)) - { - Item.stack--; - - if (Item.stack <= 0) - Item.TurnToAir(); - } - - shootCount = placeholderStock; - - shootCount++; - return base.UseItem(player); - } - //Random spread public override void UseAnimation(Player player) { @@ -121,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = Throw1Sound; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 1.5f; 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) @@ -154,8 +90,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(50). - AddIngredient(). + CreateRecipe(). + AddIngredient(9). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index 5240e09f86..f29d97c52a 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 40; Item.damage = 56; Item.knockBack = 3f; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -57,10 +57,10 @@ namespace CalamityMod.Items.Weapons.Summon { CalamityUtils.KillShootProjectiles(true, type, player); float damageMult = ((float)Math.Log(slimeSlots, 8f)) + 1f; - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; - int slime = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * damageMult), knockback, player.whoAmI); + int slime = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * damageMult), knockback, player.whoAmI); Main.projectile[slime].originalDamage = (int)(Item.damage * damageMult); Main.projectile[slime].minionSlots = slimeSlots; return false; diff --git a/Items/Weapons/Summon/AmphibiansGuitar.cs b/Items/Weapons/Summon/AmphibiansGuitar.cs new file mode 100644 index 0000000000..1957f73d79 --- /dev/null +++ b/Items/Weapons/Summon/AmphibiansGuitar.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class AmphibiansGuitar : ModItem, ILocalizedModType + { + public override string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetDefaults() + { + Item.damage = 200; + Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); + + (Item.width, Item.height) = (72, 64); + Item.useAnimation = Item.useTime = 15; + Item.mana = 10; + Item.noMelee = true; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.useStyle = ItemUseStyleID.HoldUp; + } + + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.TheAxe). + AddIngredient(ItemID.Frog). + AddIngredient(3). + AddIngredient(8). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/Summon/AmphibiansGuitar.png b/Items/Weapons/Summon/AmphibiansGuitar.png new file mode 100644 index 0000000000..b0e498db15 Binary files /dev/null and b/Items/Weapons/Summon/AmphibiansGuitar.png differ diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index 9554bd8e42..00bfcf39ee 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; @@ -50,7 +50,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) { - Projectile.NewProjectileDirect(source, Main.MouseWorld, Main.rand.NextVector2Circular(1f, 1f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(1f, 1f), type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/AquasScepter.cs b/Items/Weapons/Summon/AquasScepter.cs index 40ac018f06..f97b61c3c5 100644 --- a/Items/Weapons/Summon/AquasScepter.cs +++ b/Items/Weapons/Summon/AquasScepter.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetStaticDefaults() { - ItemID.Sets.GamepadWholeScreenUseRange[Item.type] = true; - ItemID.Sets.LockOnIgnoresCollision[Item.type] = true; + ItemID.Sets.GamepadWholeScreenUseRange[Type] = true; + ItemID.Sets.LockOnIgnoresCollision[Type] = true; } public override void SetDefaults() @@ -41,7 +41,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) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); var projectile = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); projectile.originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index 25c8513ee5..5b822be2c0 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void Load() { // Add the body equip texture. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Body}", EquipType.Body, this); } @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 625; Item.useStyle = ItemUseStyleID.HoldUp; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 9; + Item.useAnimation = Item.useTime = 9; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs index 118a21ec6c..0706ca78d9 100644 --- a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs +++ b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 38; Item.damage = 200; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4.75f; @@ -82,9 +82,11 @@ namespace CalamityMod.Items.Weapons.Summon 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); + + Vector2 mouse = player.ClampedMouseWorld(); + position = mouse - Vector2.UnitY * 1020f; + velocity = (mouse - position).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(9f, 10f); + Projectile.NewProjectile(source, position, velocity, type, Item.damage, knockback, player.whoAmI, mouse.Y - 40f); player.UpdateMaxTurrets(); } return false; diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index 43e4bb72cc..44890bd7ff 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; @@ -45,7 +45,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) { - int belladonna = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int belladonna = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(belladonna)) Main.projectile[belladonna].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 9900da3a9b..330d2f3e95 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 40; Item.damage = 25; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 1f; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.whoAmI == Main.myPlayer) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index ae8716c368..d3fdc3a340 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 56; Item.damage = 35; Item.mana = 10; - Item.useTime = Item.useAnimation = 19; + Item.useAnimation = Item.useTime = 19; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -43,10 +43,10 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, Main.myPlayer); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, Main.myPlayer); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/BrittleStarStaff.cs b/Items/Weapons/Summon/BrittleStarStaff.cs index 8a2b3ed5f5..a69c43a5a0 100644 --- a/Items/Weapons/Summon/BrittleStarStaff.cs +++ b/Items/Weapons/Summon/BrittleStarStaff.cs @@ -16,10 +16,11 @@ namespace CalamityMod.Items.Weapons.Summon public float Knockback = 2f; public override void SetDefaults() { - Item.width = Item.height = 44; + Item.width = 44; + Item.height = 64; Item.damage = 10; Item.mana = 10; - Item.useTime = Item.useAnimation = 32; + Item.useAnimation = Item.useTime = 32; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = Knockback; @@ -33,18 +34,18 @@ namespace CalamityMod.Items.Weapons.Summon } public override void SetStaticDefaults() { - Item.staff[Item.type] = true; - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + Item.staff[Type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = 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) { Item.noUseGraphic = false; - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity = Vector2.Zero; int SummonNumber = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0, 0, SummonNumber); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, SummonNumber); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } @@ -64,10 +65,5 @@ namespace CalamityMod.Items.Weapons.Summon } return false; } - public override void HoldItem(Player player) - { - //player.Calamity().rightClickListener = true; - //player.Calamity().mouseWorldListener = true; - } } } diff --git a/Items/Weapons/Summon/BrittleStarStaff.png b/Items/Weapons/Summon/BrittleStarStaff.png index 782d3eb149..5bcb654ee5 100644 Binary files a/Items/Weapons/Summon/BrittleStarStaff.png and b/Items/Weapons/Summon/BrittleStarStaff.png differ diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 6ae7b901f7..e2ff231070 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index c477f89bdc..8123714305 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -41,25 +41,25 @@ namespace CalamityMod.Items.Weapons.Summon 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.noMelee = true; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; // This does nothing, it's just here so it's able to act like a staff. + Item.UseSound = SoundID.Item85; Item.useStyle = ItemUseStyleID.Shoot; - Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.autoReuse = true; + Item.noMelee = true; - // This does nothing, it's just here so it's able to act like a staff. - Item.shootSpeed = 1f; + 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) { - Projectile.NewProjectile(source, Main.MouseWorld, velocity, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index 4a4e8c1f0b..f9fc88fab2 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -15,19 +15,21 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 36; Item.height = 42; Item.damage = 8; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 35; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.sentry = true; - Item.DamageType = DamageClass.Summon; + + Item.UseSound = SoundID.Item44; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; } 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/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index dfe5605cd4..88a22bfafb 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } @@ -46,10 +46,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("AnyEvilFlask", 5). - AddIngredient(ItemID.Deathweed, 2). - AddIngredient(ItemID.SoulofNight, 10). AddRecipeGroup("AnyEvilBar", 10). + AddRecipeGroup("CursedFlameIchor", 10). + AddIngredient(ItemID.SoulofNight, 10). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index 0c5b883154..f048621794 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 2f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; @@ -33,7 +33,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, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index 44d8fc9f3c..6d7d05659f 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -8,40 +8,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class CindersOfLament : ModItem, ILocalizedModType + public class CindersOfLament : ExhumedItem, ILocalizedModType { 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.useTime = Item.useAnimation = 80; // 79 because of useStyle 1 - Item.autoReuse = true; - Item.noMelee = true; - Item.knockBack = 0f; - 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(); } + public override void SetDefaults() + { + Item.width = 86; + Item.height = 92; + Item.damage = 1666; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.useAnimation = Item.useTime = 80; // 79 because of useStyle 1 + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + + Item.UseSound = SoundID.DD2_BetsySummon; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noMelee = true; + + 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) { if (player.altFunctionUse != 2) { if (Main.rand.NextBool()) type = ModContent.ProjectileType(); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/Cnidarian.cs b/Items/Weapons/Summon/Cnidarian.cs index 836c151c26..6799b4cac7 100644 --- a/Items/Weapons/Summon/Cnidarian.cs +++ b/Items/Weapons/Summon/Cnidarian.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.channel = true; Item.noMelee = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ProjectileType(); Item.shootSpeed = 10f; Item.rare = ItemRarityID.Green; @@ -78,6 +78,7 @@ namespace CalamityMod.Items.Weapons.Summon public void SetPlayerArms(Player player) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Calculate the dirction in which the players arms should be pointing at. Vector2 playerToCursor = (player.Calamity().mouseWorld - player.Center).SafeNormalize(Vector2.UnitX); float armPointingDirection = (playerToCursor.ToRotation()); @@ -124,7 +125,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; + Texture2D properSprite = Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; spriteBatch.DrawNewInventorySprite(properSprite, new Vector2(42f, 34), position, drawColor, origin, scale); return false; @@ -132,7 +133,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; + Texture2D properSprite = Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; spriteBatch.Draw(properSprite, Item.position - Main.screenPosition, null, lightColor, rotation, properSprite.Size() / 2f, scale, 0, 0); return false; diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index 81c6b7689f..bdaf95d306 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 54; Item.damage = 24; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -33,10 +33,10 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index edb6f0390c..781e063250 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 114; Item.knockBack = 2f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index ee16f65e35..d555808fda 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -15,21 +15,26 @@ namespace CalamityMod.Items.Weapons.Summon public class CosmicImmaterializer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 10f; + public override void SetDefaults() { Item.width = 170; Item.height = 164; - Item.mana = 10; Item.damage = 560; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 10; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.UseSound = SoundID.Item60; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.DamageType = DamageClass.Summon; + + Item.UseSound = SoundID.Item60; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } @@ -38,7 +43,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, 0f, 0f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index 535ad630a2..ce0fd4f2de 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 28; Item.damage = 321; Item.mana = 10; - Item.useTime = Item.useAnimation = 9; + Item.useAnimation = Item.useTime = 9; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 6f; diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index 13dc9b4d22..e1a878b754 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -19,13 +19,15 @@ namespace CalamityMod.Items.Weapons.Summon public const float LanternSummonCost = 2f; + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + public override void SetDefaults() { Item.width = 42; Item.height = 60; Item.damage = 127; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; @@ -55,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon } int existingLamps = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) { Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 65ef4d76a8..24fa2614c3 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 52; Item.damage = 24; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -33,10 +33,10 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index 3d189ee3b0..8408855e68 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.autoReuse = true; @@ -34,7 +34,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) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), 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/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index 57461c8924..ec0b92d270 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 32; Item.damage = 70; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3f; @@ -36,10 +36,11 @@ 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) { - Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); + Vector2 mouse = player.ClampedMouseWorld(); + Point mouseTileCoords = mouse.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).IsTileSolidGround()) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, mouse, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index ad9e9a42a6..9f99226039 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 58; Item.damage = 14; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2.25f; @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 3759fa322b..477f451751 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -1,7 +1,9 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.width = 54; - Item.height = 52; + Item.width = 56; + Item.height = 60; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.DD2_DarkMageHealImpact; @@ -23,36 +25,42 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 127; Item.knockBack = 2f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } - + 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/DazzlingStabberStaffGlow").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 p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + for (int i = 0; i < 3; i++) + { + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; + } } - float angleMax = MathHelper.ToRadians(45f); - if (CalamityUtils.CountProjectiles(type) == 1) + float angleMax = MathHelper.ToRadians(360f); + if (CalamityUtils.CountOwnedProjectiles(type, player.whoAmI) == 1) angleMax = 0f; float index = 1f; - if (player.ownedProjectileCounts[Item.shoot] > 8) + if (player.ownedProjectileCounts[Item.shoot] > 30) { - angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 8) * 2.5f); + angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f); } - angleMax = angleMax > MathHelper.ToRadians(105f) ? MathHelper.ToRadians(105f) : angleMax; // More intuative than using a min function + angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuitive than using a min function foreach (Projectile p in Main.ActiveProjectiles) { if (p.type == type && p.owner == player.whoAmI) { - p.ai[1] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f; + p.ai[1] = (index / CalamityUtils.CountOwnedProjectiles(type, player.whoAmI)) * angleMax - angleMax / 2f; p.netUpdate = true; index++; } diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.png b/Items/Weapons/Summon/DazzlingStabberStaff.png index 959b2003dd..375cf51f90 100644 Binary files a/Items/Weapons/Summon/DazzlingStabberStaff.png and b/Items/Weapons/Summon/DazzlingStabberStaff.png differ diff --git a/Items/Weapons/Summon/DazzlingStabberStaffGlow.png b/Items/Weapons/Summon/DazzlingStabberStaffGlow.png new file mode 100644 index 0000000000..212656b909 Binary files /dev/null and b/Items/Weapons/Summon/DazzlingStabberStaffGlow.png differ diff --git a/Items/Weapons/Summon/DeathstareRod.cs b/Items/Weapons/Summon/DeathstareRod.cs index 2d1c16e302..8bd0029774 100644 --- a/Items/Weapons/Summon/DeathstareRod.cs +++ b/Items/Weapons/Summon/DeathstareRod.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 46; Item.damage = 20; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -30,7 +30,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, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index 86b85473b1..b68a90c690 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 44; Item.damage = 40; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity = Vector2.Zero; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 33371abda8..1dbc591245 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 32; Item.damage = 42; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; @@ -41,13 +41,13 @@ namespace CalamityMod.Items.Weapons.Summon } if (totalSlots < player.maxMinions) { - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } else if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0f) { - int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage * 2; } diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index cd4ee73ef3..2adca37808 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -12,13 +12,16 @@ namespace CalamityMod.Items.Weapons.Summon public class DragonbloodDisgorger : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 6f; + public override void SetDefaults() { Item.width = 64; Item.height = 62; Item.damage = 215; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; @@ -32,7 +35,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) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index a2aa36d7e8..e26467a1f2 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 44; Item.damage = 60; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4.5f; @@ -35,7 +35,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.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), 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/EnchantedConch.cs b/Items/Weapons/Summon/EnchantedConch.cs index 422f7c7233..768ffed01d 100644 --- a/Items/Weapons/Summon/EnchantedConch.cs +++ b/Items/Weapons/Summon/EnchantedConch.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; @@ -33,7 +33,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) { - Projectile.NewProjectileDirect(source, Main.MouseWorld, Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), 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 6e96ca55f3..3b64d117d0 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 232; Item.knockBack = 3f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index 0cface095a..97942a9175 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -16,10 +16,8 @@ namespace CalamityMod.Items.Weapons.Summon //Cooper be like cool public static int AttackMode = 0; - public override void SetStaticDefaults() - { - //Icy no problems with that - } + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 10f; public override void SetDefaults() { @@ -34,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 1300; Item.knockBack = 4f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -56,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Summon ModContent.ProjectileType() }); - SummonEndoCooper(source, AttackMode, Main.MouseWorld, damage, Item.damage, knockback, player, out _, out _); + SummonEndoCooper(source, AttackMode, player.ClampedMouseWorld(), damage, Item.damage, knockback, player, out _, out _); AttackMode++; if (AttackMode > 3) @@ -92,9 +90,9 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(). AddIngredient(). AddIngredient(ItemID.BlizzardStaff). - AddIngredient(100). - AddIngredient(15). AddIngredient(5). + AddIngredient(100). + AddIngredient(15). AddTile(). Register(); } diff --git a/Items/Weapons/Summon/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index dd0c9287de..676648fcab 100644 --- a/Items/Weapons/Summon/EntropysVigil.cs +++ b/Items/Weapons/Summon/EntropysVigil.cs @@ -12,7 +12,11 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() => Item.staff[Type] = true; + public override void SetStaticDefaults() + { + Item.staff[Type] = true; + ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + } public override void SetDefaults() { @@ -23,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; @@ -38,6 +42,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) { + Vector2 mouse = player.ClampedMouseWorld(); float randomAngleOffset = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < 3; i++) { @@ -47,13 +52,13 @@ namespace CalamityMod.Items.Weapons.Summon switch (i) { case 0: - Projectile.NewProjectileDirect(source, Main.MouseWorld, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); break; case 1: - Projectile.NewProjectileDirect(source, Main.MouseWorld, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); break; case 2: - Projectile.NewProjectileDirect(source, Main.MouseWorld, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); break; } } diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index 9abf615c95..e1103cbc49 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; @@ -38,7 +38,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) { - Projectile.NewProjectileDirect(source, Main.MouseWorld, Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), 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 009e3325a1..4dae0ecdb7 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 36; Item.damage = 24; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/FlamsteedRing.cs b/Items/Weapons/Summon/FlamsteedRing.cs index 697ee14482..9f7230b417 100644 --- a/Items/Weapons/Summon/FlamsteedRing.cs +++ b/Items/Weapons/Summon/FlamsteedRing.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/CalPlayer/DrawLayers/AndromedaWithout_Head", EquipType.Head, name: "HeadlessEquipTexture"); } @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, "HeadlessEquipTexture", EquipType.Head); ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 200; Item.damage = 1999; Item.useStyle = ItemUseStyleID.HoldUp; - Item.useTime = Item.useAnimation = 9; + Item.useAnimation = Item.useTime = 9; Item.noMelee = true; Item.knockBack = 1f; @@ -198,8 +198,8 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(). AddIngredient(). AddIngredient(ItemID.WingsVortex). - AddIngredient(40). AddIngredient(5). + AddIngredient(40). AddTile(). Register(); } diff --git a/Items/Weapons/Summon/FlarebatStaff.cs b/Items/Weapons/Summon/FlarebatStaff.cs new file mode 100644 index 0000000000..f94955710b --- /dev/null +++ b/Items/Weapons/Summon/FlarebatStaff.cs @@ -0,0 +1,38 @@ +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 FlarebatStaff : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetDefaults() + { + Item.damage = 18; + Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); + Item.knockBack = 1f; + + Item.useAnimation = Item.useTime = 15; + (Item.width, Item.height) = (50, 50); + Item.mana = 10; + Item.noMelee = true; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item20; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Summon/FlarebatStaff.png b/Items/Weapons/Summon/FlarebatStaff.png new file mode 100644 index 0000000000..22e7b112ab Binary files /dev/null and b/Items/Weapons/Summon/FlarebatStaff.png differ diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index 1373817513..a7f73e84fa 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; @@ -33,7 +33,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) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index e40bf2ed65..2778b1c5a0 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -11,6 +11,9 @@ namespace CalamityMod.Items.Weapons.Summon public class FlowersOfMortality : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + public override void SetDefaults() { Item.width = 36; @@ -18,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 72; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5f; @@ -36,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 5; i++) { - Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); blossom.ai[0] = MathHelper.TwoPi * i / 5f; blossom.rotation = blossom.ai[0]; blossom.originalDamage = Item.damage; @@ -49,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 63625ec5e3..4fb966f134 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4f; Item.mana = 10; Item.damage = 28; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); vector2.X = Main.mouseX + Main.screenPosition.X; vector2.Y = Main.mouseY + Main.screenPosition.Y; - int p = Projectile.NewProjectile(source, vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 928fbdfa4b..852b6cd188 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 24; Item.damage = 10; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -31,7 +31,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, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/FrostbatStaff.cs b/Items/Weapons/Summon/FrostbatStaff.cs new file mode 100644 index 0000000000..ade55ae2aa --- /dev/null +++ b/Items/Weapons/Summon/FrostbatStaff.cs @@ -0,0 +1,38 @@ +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 FrostbatStaff : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetDefaults() + { + Item.damage = 22; + Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); + Item.knockBack = 1f; + + Item.useAnimation = Item.useTime = 15; + (Item.width, Item.height) = (50, 50); + Item.mana = 10; + Item.noMelee = true; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item28; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Summon/FrostbatStaff.png b/Items/Weapons/Summon/FrostbatStaff.png new file mode 100644 index 0000000000..1c99a19da7 Binary files /dev/null and b/Items/Weapons/Summon/FrostbatStaff.png differ diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index 1083ecfd3b..6e0f725d93 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 25; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.noMelee = true; Item.knockBack = 7f; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index aafe020881..6ab12f05c7 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 85; Item.knockBack = 3f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index 6566d75dab..4d2796f9cd 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 70; Item.damage = 60; Item.mana = 10; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/GlacialEmbrace.cs b/Items/Weapons/Summon/GlacialEmbrace.cs index 466e2ceb5e..00fc0f2f75 100644 --- a/Items/Weapons/Summon/GlacialEmbrace.cs +++ b/Items/Weapons/Summon/GlacialEmbrace.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 48; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 4.5f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions) { player.AddBuff(ModContent.BuffType(), 120, true); - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/GuidelightofOblivion.cs b/Items/Weapons/Summon/GuidelightofOblivion.cs index 6525ba6f3e..4f3797d962 100644 --- a/Items/Weapons/Summon/GuidelightofOblivion.cs +++ b/Items/Weapons/Summon/GuidelightofOblivion.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.sentry = true; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5f; @@ -36,7 +36,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.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), 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/HarvestStaff.cs b/Items/Weapons/Summon/HarvestStaff.cs index 96da01b29c..4d26fbbfbc 100644 --- a/Items/Weapons/Summon/HarvestStaff.cs +++ b/Items/Weapons/Summon/HarvestStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 5f; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.mana = 10; Item.width = 44; Item.height = 46; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon 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); + Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index ae22914112..5ac5707364 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 48; Item.damage = 25; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 3f; @@ -39,10 +39,10 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); 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); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 30f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Wood, 10). + AddRecipeGroup("Wood", 10). AddIngredient(ItemID.SoulofLight, 5). AddIngredient(ItemID.SoulofNight, 5). AddIngredient(ItemID.FoodPlatter, 3). diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index ba118cfcf5..33f8bd5fbe 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item21; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index 849e2cdda0..8fdf65c7a8 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.sentry = true; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index b00537081a..1fb197c03a 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 34; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon } if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index 080093f247..afde753a8f 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -32,13 +32,15 @@ namespace CalamityMod.Items.Weapons.Summon public const float EnemyTargetingRange = 1300f; + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + public override void SetDefaults() { Item.width = 46; Item.height = 28; Item.damage = 50; Item.mana = 10; - Item.useTime = Item.useAnimation = 19; + Item.useAnimation = Item.useTime = 19; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 5f; @@ -58,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon { CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs index 92b2903ebf..c8e3d512af 100644 --- a/Items/Weapons/Summon/KingofConstellationsTenryu.cs +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; + public override void SetDefaults() { Item.width = 44; @@ -54,7 +56,9 @@ namespace CalamityMod.Items.Weapons.Summon public static void SpawnDragon(int head, int body, int tail, Vector2 spawnPos, Player player, EntitySource_ItemUse_WithAmmo source, int damage, float knockback) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPos, player.DirectionTo(Main.MouseWorld) * 3, head, damage, knockback, player.whoAmI); + // okay but seriously why are you multiplying zero by three Projectile.NewProjectile(source, spawnPos, Vector2.Zero * 3, tail, damage, knockback, player.whoAmI); for (var i = 0; i < 20; i++) { @@ -66,8 +70,8 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(ItemID.StardustDragonStaff). - AddIngredient(ItemID.LightShard). AddIngredient(ItemID.DarkShard). + AddIngredient(ItemID.LightShard). AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Summon/LegionofCelestia.cs b/Items/Weapons/Summon/LegionofCelestia.cs index c4664b19c5..227aa6aed1 100644 --- a/Items/Weapons/Summon/LegionofCelestia.cs +++ b/Items/Weapons/Summon/LegionofCelestia.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; @@ -14,12 +15,12 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.width = 36; - Item.height = 36; + Item.width = 100; + Item.height = 128; Item.damage = 57; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5f; @@ -31,20 +32,27 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation += new Vector2(-20f * player.direction, 34f * player.gravDir).RotatedBy(player.itemRotation); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) 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/LegionofCelestiaGlow").Value); + public override void AddRecipes() { CreateRecipe(). @@ -52,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Summon/LegionofCelestia.png b/Items/Weapons/Summon/LegionofCelestia.png index 06ae7fb2e6..db5fd93c4a 100644 Binary files a/Items/Weapons/Summon/LegionofCelestia.png and b/Items/Weapons/Summon/LegionofCelestia.png differ diff --git a/Items/Weapons/Summon/LegionofCelestiaGlow.png b/Items/Weapons/Summon/LegionofCelestiaGlow.png new file mode 100644 index 0000000000..ce16e6cd0b Binary files /dev/null and b/Items/Weapons/Summon/LegionofCelestiaGlow.png differ diff --git a/Items/Weapons/Summon/LiliesOfFinality.cs b/Items/Weapons/Summon/LiliesOfFinality.cs index 7e441ab524..6f30839132 100644 --- a/Items/Weapons/Summon/LiliesOfFinality.cs +++ b/Items/Weapons/Summon/LiliesOfFinality.cs @@ -37,6 +37,8 @@ namespace CalamityMod.Items.Weapons.Summon #endregion + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + public override void SetDefaults() { Item.damage = TheNumber; @@ -45,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 5f; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.width = 36; Item.height = 50; Item.noMelee = true; @@ -59,8 +61,9 @@ 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) { - Projectile.NewProjectileDirect(source, player.Calamity().mouseWorld, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI); - Projectile.NewProjectileDirect(source, player.Calamity().mouseWorld, new Vector2(1f, -1f) * 3f, ProjectileType(), damage, knockback, player.whoAmI); + Vector2 mouse = player.ClampedMouseWorld(); + Projectile.NewProjectile(source, mouse, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, mouse, new Vector2(1f, -1f) * 3f, ProjectileType(), damage, knockback, player.whoAmI); if (Main.dedServ) return false; @@ -71,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Summon float angle = MathHelper.TwoPi / dustAmount * i; Vector2 dustVelocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 6f); Dust spawnDust = Dust.NewDustPerfect( - Main.MouseWorld, + mouse, CommonDustID, dustVelocity, Scale: Main.rand.NextFloat(1.2f, 1.5f)); diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index 6f8e1fbdf2..ce288d7a8b 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -8,16 +8,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class Metastasis : ModItem, ILocalizedModType + public class Metastasis : ExhumedItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; + } + public override void SetDefaults() { Item.width = 66; Item.height = 78; Item.damage = 400; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1 + Item.useAnimation = Item.useTime = 10; // 9 because of useStyle 1 Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -29,16 +36,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - public override void SetStaticDefaults() - { - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 4367d0f1ac..431dfd4d0f 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 32; Item.damage = 176; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Summon/MirrorofKalandra.cs b/Items/Weapons/Summon/MirrorofKalandra.cs index be74192042..764c1af28f 100644 --- a/Items/Weapons/Summon/MirrorofKalandra.cs +++ b/Items/Weapons/Summon/MirrorofKalandra.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 58; Item.height = 50; Item.damage = 317; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.knockBack = 4f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/MutatedTruffle.cs b/Items/Weapons/Summon/MutatedTruffle.cs index 8284dd30e0..145cc7d099 100644 --- a/Items/Weapons/Summon/MutatedTruffle.cs +++ b/Items/Weapons/Summon/MutatedTruffle.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Items.Weapons.Summon #endregion + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + public override void SetDefaults() { Item.width = 24; @@ -38,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 5f; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.noMelee = true; Item.useStyle = ItemUseStyleID.HoldUp; @@ -51,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon { // Only one can be summoned. if (player.ownedProjectileCounts[type] < 1 && player.maxMinions >= 3) - Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index 0642fb536b..54321a17b5 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 34; Item.damage = 53; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2f; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.whoAmI == Main.myPlayer) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index a6129eab11..9db7a9910e 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; + public override void SetDefaults() { Item.width = Item.height = 56; @@ -21,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 4f; - Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1. + Item.useAnimation = Item.useTime = 10; // 9 because of useStyle 1. Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; @@ -36,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { if (player.ownedProjectileCounts[type] < 1) - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); } else { diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index 2fff600df2..f7ab0903ef 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -33,6 +33,8 @@ namespace CalamityMod.Items.Weapons.Summon public static float TentacleSpeed = 25f; + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + public override void SetDefaults() { Item.width = 50; @@ -43,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1f; Item.mana = 10; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; @@ -55,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) { - Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/PolypLauncher.cs b/Items/Weapons/Summon/PolypLauncher.cs index 662d30304d..dd22edc4cd 100644 --- a/Items/Weapons/Summon/PolypLauncher.cs +++ b/Items/Weapons/Summon/PolypLauncher.cs @@ -15,19 +15,21 @@ namespace CalamityMod.Items.Weapons.Summon 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.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.sentry = true; + Item.mana = 10; + Item.useAnimation = Item.useTime = 35; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + + Item.UseSound = SoundID.Item44; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; } 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/PuffShroom.cs b/Items/Weapons/Summon/PuffShroom.cs index bee58b18d1..b1e933d4d3 100644 --- a/Items/Weapons/Summon/PuffShroom.cs +++ b/Items/Weapons/Summon/PuffShroom.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 32; Item.damage = 14; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int puffGuy = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int puffGuy = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(puffGuy)) Main.projectile[puffGuy].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 67a1b45685..98ff76631a 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 46; Item.damage = 66; // clueless Item.mana = 10; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; @@ -36,37 +36,13 @@ 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) { - int i = Main.myPlayer; - 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; - 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, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); + Vector2 clampedMouse = player.ClampedMouseWorld(); + Vector2 mouseDirection = Vector2.Normalize(clampedMouse - player.Center) * Item.shootSpeed; + + int p = Projectile.NewProjectile(source, clampedMouse, mouseDirection.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); 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); + p = Projectile.NewProjectile(source, clampedMouse, mouseDirection.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; @@ -75,10 +51,10 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Silk, 40). - AddIngredient(ItemID.Ectoplasm, 20). AddIngredient(5). AddIngredient(ItemID.ButterflyDust, 2). + AddIngredient(ItemID.Silk, 40). + AddIngredient(ItemID.Ectoplasm, 20). AddTile(TileID.Loom). Register(); } diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index e17e158a74..2cc3731c36 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -23,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 20; Item.mana = 10; Item.damage = 8; - Item.useTime = Item.useAnimation = 34; + Item.useAnimation = Item.useTime = 34; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; @@ -38,20 +37,11 @@ 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) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(20). - AddRecipeGroup("AnySilverBar", 10). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/Weapons/Summon/SanctifiedSpark.cs b/Items/Weapons/Summon/SanctifiedSpark.cs index c1d0f28176..443383274b 100644 --- a/Items/Weapons/Summon/SanctifiedSpark.cs +++ b/Items/Weapons/Summon/SanctifiedSpark.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 128; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.mana = 10; - Item.useTime = Item.useAnimation = 14; + Item.mana = 100; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -37,7 +37,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.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index ff780b7dd0..5254fbb849 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item44; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int sandnado = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int sandnado = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(sandnado)) Main.projectile[sandnado].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index 8d6dbc6405..cb7411cbcc 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -13,6 +13,9 @@ namespace CalamityMod.Items.Weapons.Summon public class SarosPossession : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 8f; + public override void SetDefaults() { Item.width = Item.height = 56; @@ -21,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.DD2_BetsyFlameBreath; diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index d83cf2574e..74d18a268c 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -10,13 +10,16 @@ namespace CalamityMod.Items.Weapons.Summon public class ScabRipper : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => Item.staff[Type] = true; + public override void SetDefaults() { Item.width = 66; Item.height = 70; Item.damage = 16; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0.5f; @@ -25,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Summon 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. @@ -36,10 +38,10 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/SeashineSword.cs b/Items/Weapons/Summon/SeashineSword.cs new file mode 100644 index 0000000000..3425ef6d93 --- /dev/null +++ b/Items/Weapons/Summon/SeashineSword.cs @@ -0,0 +1,144 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class SeashineSword : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } + public override void SetDefaults() + { + Item.width = 32; + Item.height = 34; + Item.useTime = 10; + Item.useAnimation = 10; + Item.damage = 55; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.DamageType = DamageClass.Summon; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.knockBack = 5f; + Item.shootSpeed = 12f; + Item.mana = 10; + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + } + public override bool AltFunctionUse(Player player) => true; + public override float UseSpeedMultiplier(Player player) + { + // There's a long cooldown on commanding blades + // This is so you don't just hold down right click, since now it's optimal to only command blades when all are ready + if (player.altFunctionUse == 2) + return 0.1f; + else + return 1f; + } + 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) + { + // Call all active blades to attack if they are charged + // The check to see if a blade is charged is done in the blade itself + if (player.altFunctionUse == 2) + { + int blades = 0; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == Item.shoot && projectile.ai[0] < 5 && projectile.timeLeft < 90000 - 180) + { + projectile.ai[0] = 5; + blades++; + } + } + if (blades > 0) // If theres no blades, then don't do anything + { + for (int i = 0; i < 7; i++) + { + Dust dust = Dust.NewDustPerfect(player.Center, ModContent.DustType(), (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(5f, 10f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.95f, 1.7f); + dust.color = Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue; + dust.noLightEmittence = true; + + Particle fx = new CustomSpark(player.Center, (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 20f), "CalamityMod/Particles/Sparkle", false, (int)(Main.rand.Next(16, 26 + 1)), Main.rand.NextFloat(1.1f, 1.7f), Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: 0.2f); + GeneralParticleHandler.SpawnParticle(fx); + } + Particle e = new CustomSpark(player.Center, (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(7f, 20f), "CalamityMod/Particles/WaterFoam", false, 14, Main.rand.NextFloat(0.15f, 0.25f) * 3, Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(e); + SoundEngine.PlaySound(SoundID.Item101 with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.3f, 0.5f) }, player.Center); + } + } + else // Toss out the summon + { + SoundEngine.PlaySound(SoundID.Item1, player.Center); + + int pr = Projectile.NewProjectile(source, player.Center, velocity, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(pr)) + Main.projectile[pr].originalDamage = Item.damage; + + float angleMax = MathHelper.ToRadians(360f); + if (CalamityUtils.CountProjectiles(type) == 1) + angleMax = 0f; + float index = 1f; + if (player.ownedProjectileCounts[Item.shoot] > 30) + { + angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f); + } + angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuative than using a min function + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == type && p.owner == player.whoAmI) + { + p.ai[2] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f; + p.ai[1] = index; + p.netUpdate = true; + index++; + } + } + } + return false; + } + public override void UseItemFrame(Player player) // Player hand animation when you command the blades + { + if (player.altFunctionUse == 2) + { + 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.15f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddIngredient(7). + AddIngredient(10). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Summon/SeashineSword.png b/Items/Weapons/Summon/SeashineSword.png new file mode 100644 index 0000000000..7b2e0792bc Binary files /dev/null and b/Items/Weapons/Summon/SeashineSword.png differ diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index 2487b3034c..acfa24fee7 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -10,13 +10,16 @@ namespace CalamityMod.Items.Weapons.Summon public class ShellfishStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + public override void SetDefaults() { Item.width = 50; Item.height = 50; Item.damage = 70; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -33,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 3a178abe56..deee425550 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -13,11 +13,14 @@ namespace CalamityMod.Items.Weapons.Summon public class Sirius : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 6f; + public override void SetDefaults() { Item.width = Item.height = 62; Item.damage = 600; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.knockBack = 10f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index c00379c4e0..96f57f7c7c 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 34; Item.damage = 10; Item.mana = 10; - Item.useTime = Item.useAnimation = 29; + Item.useAnimation = Item.useTime = 29; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 3.6f; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, Main.myPlayer); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, Main.myPlayer); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 53691dfcaf..d9eb1fdafa 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index 2917782ac7..5ee42ced6e 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -10,48 +11,71 @@ namespace CalamityMod.Items.Weapons.Summon public class SquirrelSquireStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public static float ProjectileVelocity = 20f; + public static int TimeBeforeFalling = 30; + public static float DistanceToMortarShoot = 240f; + public static int ProjectileTimeAlive = 180; + public static float ProjectileGravity = 0.5f; + public static int ProjectileAoERadiusSize = 24; + + public override void SetStaticDefaults() => Item.staff[Type] = true; + public override void SetDefaults() { - 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.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); Item.knockBack = 0.5f; + + Item.useAnimation = Item.useTime = 15; + Item.mana = 10; + Item.width = 46; + Item.height = 52; + Item.noMelee = true; + Item.sentry = true; + Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; + Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item44; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - Item.DamageType = DamageClass.Summon; - Item.sentry = true; + + // This doesn't do anything relevant, it's just so it can be 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) - { - 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; + // Find the base farthest position + Vector2 initialSpawn = player.GetFarthestSpawnPositionOnLine(position, velocity.X, velocity.Y); - player.UpdateMaxTurrets(); - //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks + // Push the squirrel away from collision in all directions if applicable + while (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0) || + !Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitX * 20f, 0, 0) || + !Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitY * 24f, 0, 0) || + !Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitY * 24f, 0, 0)) + { + if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0)) + initialSpawn.X -= 1f; + // Be sure to not infinite loop + if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitX * 20f, 0, 0) && Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0)) + initialSpawn.X += 1f; + if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitY * 24f, 0, 0)) + initialSpawn.Y -= 1f; + // Be sure to not infinite loop + if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitY * 24f, 0, 0) && Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitY * 24f, 0, 0)) + initialSpawn.Y += 1f; } + + Projectile.NewProjectile(source, initialSpawn, Vector2.Zero, type, damage, knockback, player.whoAmI); + player.UpdateMaxTurrets(); return false; } - //in case you lose it and want another for some bizzare reason public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Wood, 10). + AddRecipeGroup("Wood", 10). AddIngredient(ItemID.Acorn). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.png b/Items/Weapons/Summon/SquirrelSquireStaff.png index fb60c84a32..b613e40fb1 100644 Binary files a/Items/Weapons/Summon/SquirrelSquireStaff.png and b/Items/Weapons/Summon/SquirrelSquireStaff.png differ diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index 5c08cfc5bc..9bd042de78 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 54; Item.damage = 31; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3.5f; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon return false; if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 5a9a3a858f..d6bee5eefe 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 68; Item.damage = 100; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1 + Item.useAnimation = Item.useTime = 10; // 9 because of useStyle 1 Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -55,19 +55,21 @@ namespace CalamityMod.Items.Weapons.Summon if (Main.myPlayer != owner.whoAmI) return; - int curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, 0f, 0f); + Vector2 mouse = owner.ClampedMouseWorld(); + + int curr = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, 0f, 0f); if (Main.projectile.IndexInRange(curr)) Main.projectile[curr].originalDamage = baseDamage; - curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); + curr = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); if (Main.projectile.IndexInRange(curr)) Main.projectile[curr].originalDamage = baseDamage; int prev = curr; - curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); + curr = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); if (Main.projectile.IndexInRange(curr)) Main.projectile[curr].originalDamage = baseDamage; Main.projectile[prev].localAI[1] = curr; prev = curr; - curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); + curr = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); if (Main.projectile.IndexInRange(curr)) Main.projectile[curr].originalDamage = baseDamage; Main.projectile[prev].localAI[1] = curr; diff --git a/Items/Weapons/Summon/StarspawnHelixStaff.cs b/Items/Weapons/Summon/StarspawnHelixStaff.cs index ac6e306dcd..333bdf5ce4 100644 --- a/Items/Weapons/Summon/StarspawnHelixStaff.cs +++ b/Items/Weapons/Summon/StarspawnHelixStaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item44; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) { Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/StellarTorusStaff.cs b/Items/Weapons/Summon/StellarTorusStaff.cs index 07741b3cad..2540e43a21 100644 --- a/Items/Weapons/Summon/StellarTorusStaff.cs +++ b/Items/Weapons/Summon/StellarTorusStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 42; Item.height = 42; Item.damage = 142; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.knockBack = 4f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); @@ -43,7 +43,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) { - int minion = Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); + int minion = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(minion)) Main.projectile[minion].originalDamage = Item.OriginalDamage; @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(ItemID.XenoStaff). - AddIngredient(3). AddIngredient(ItemID.FragmentStardust, 6). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 99f5a062b4..53c47e8b77 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 32; Item.damage = 11; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index 0c2c0315e1..fa04a52417 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 48; Item.damage = 12; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.15f; diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 0f24df1f31..f29284f1c7 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 20; Item.damage = 140; Item.mana = 10; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/TemporalUmbrella.cs b/Items/Weapons/Summon/TemporalUmbrella.cs index 165a7abad0..592dea16b1 100644 --- a/Items/Weapons/Summon/TemporalUmbrella.cs +++ b/Items/Weapons/Summon/TemporalUmbrella.cs @@ -14,6 +14,9 @@ namespace CalamityMod.Items.Weapons.Summon public class TemporalUmbrella : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; + public override void SetDefaults() { Item.width = 74; @@ -21,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 193; Item.knockBack = 1f; Item.mana = 99; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.DamageType = DamageClass.Summon; Item.shootSpeed = 0f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index 8695293f73..dcf2926b9a 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 60; Item.damage = 40; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 3; i++) { - Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); blossom.ai[1] = (int)(MathHelper.TwoPi / 3f * i * 32f); blossom.originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index 54cc6a4d9f..89b2e15d82 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.mana = 300; - Item.damage = 9600; + Item.damage = 9000; Item.knockBack = 7f; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.noUseGraphic = true; @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon if (!player.HasCooldown(Cooldowns.UniverseSplitter.ID)) { player.AddCooldown(Cooldowns.UniverseSplitter.ID, CalamityUtils.SecondsToFrames(30)); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; for (int i = 0; i < 36; i++) diff --git a/Items/Weapons/Summon/VengefulSunStaff.cs b/Items/Weapons/Summon/VengefulSunStaff.cs index 1638072b13..fc5250bf6d 100644 --- a/Items/Weapons/Summon/VengefulSunStaff.cs +++ b/Items/Weapons/Summon/VengefulSunStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 72; Item.damage = 60; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.25f; diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index 2ed2a9261d..a1bb127949 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 32; Item.damage = 115; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.maxMinions - player.slotsMinions >= 1f) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) { Main.projectile[p].ai[0] = player.ownedProjectileCounts[type]; diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index 7e02720664..e584d973f4 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 0.5f; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; @@ -37,7 +37,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) { - Projectile.NewProjectileDirect(source, Main.MouseWorld, Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index a15b2b4211..967ce92bd5 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 56; Item.damage = 30; Item.mana = 10; - Item.useTime = Item.useAnimation = 19; + Item.useAnimation = Item.useTime = 19; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 2e30e7403b..0da9bba37e 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Type] = true; } public override void SetDefaults() @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 73; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 4d0ecae6ad..332e3bc54d 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -12,6 +12,9 @@ namespace CalamityMod.Items.Weapons.Summon public class VoidConcentrationStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + public override void SetDefaults() { Item.width = 52; @@ -23,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 105; Item.knockBack = 4f; - Item.useTime = Item.useAnimation = 15; // 14 because of useStyle 1 + Item.useAnimation = Item.useTime = 15; // 14 because of useStyle 1 Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index d1b4234ac0..b346171917 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -17,13 +17,15 @@ namespace CalamityMod.Items.Weapons.Summon public const int PunchCooldownTime = 36; + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; + public override void SetDefaults() { Item.width = 50; Item.height = 50; Item.damage = 450; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -44,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { int existingFists = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) { Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs index e7a264c7cc..e4ff0d39fd 100644 --- a/Items/Weapons/Summon/WitherBlossomsStaff.cs +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -11,13 +11,16 @@ namespace CalamityMod.Items.Weapons.Summon public class WitherBlossomsStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + public override void SetDefaults() { Item.width = 52; Item.height = 60; Item.damage = 50; Item.mana = 10; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3f; @@ -36,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 4; i++) { - Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); blossom.ai[0] = MathHelper.TwoPi * i / 4f; blossom.rotation = blossom.ai[0]; blossom.originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 82f79133b8..8aae13745f 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 20; Item.damage = 16; Item.mana = 10; - Item.useTime = Item.useAnimation = 34; + Item.useAnimation = Item.useTime = 34; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int droid = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); diff --git a/Items/Weapons/Summon/YharonsKindleStaff.cs b/Items/Weapons/Summon/YharonsKindleStaff.cs index 6dbd440111..dc09c1c246 100644 --- a/Items/Weapons/Summon/YharonsKindleStaff.cs +++ b/Items/Weapons/Summon/YharonsKindleStaff.cs @@ -14,6 +14,9 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; public const float ReboundRamDamageFactor = 2f; + + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; + public override void SetDefaults() { Item.width = 80; @@ -21,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 325; Item.mana = 10; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.noMelee = true; Item.knockBack = 7f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; @@ -37,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); int dragon = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(dragon)) Main.projectile[dragon].originalDamage = Item.damage; diff --git a/Items/Weapons/Typeless/Aestheticus.cs b/Items/Weapons/Typeless/Aestheticus.cs index b03b538f9a..a7fa7ed44c 100644 --- a/Items/Weapons/Typeless/Aestheticus.cs +++ b/Items/Weapons/Typeless/Aestheticus.cs @@ -1,10 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -39,12 +37,6 @@ namespace CalamityMod.Items.Weapons.Typeless 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) - { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Items/Weapons/Typeless/EyeofMagnus.cs b/Items/Weapons/Typeless/EyeofMagnus.cs index 03c034f810..955b96b971 100644 --- a/Items/Weapons/Typeless/EyeofMagnus.cs +++ b/Items/Weapons/Typeless/EyeofMagnus.cs @@ -1,7 +1,7 @@ using CalamityMod.Projectiles.Typeless; -using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,23 +10,26 @@ namespace CalamityMod.Items.Weapons.Typeless public class EyeofMagnus : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Typeless"; + public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Item/MagnusImpact") { PitchVariance = 0.1f }; + public override void SetDefaults() { Item.width = 80; Item.height = 50; + Item.damage = 60; Item.DamageType = AverageDamageClass.Instance; - Item.damage = 32; - Item.rare = ItemRarityID.Red; - Item.useAnimation = 20; - Item.useTime = 20; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = Item.useTime = 22; Item.knockBack = 5f; - Item.UseSound = CommonCalamitySounds.LaserCannonSound; - Item.autoReuse = true; - Item.noMelee = true; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = LunicEye.UseSound; + Item.autoReuse = true; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -34,10 +37,9 @@ namespace CalamityMod.Items.Weapons.Typeless itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-15, 0); + + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => position += velocity.SafeNormalize(Vector2.Zero) * 44f; public override void AddRecipes() { diff --git a/Items/Weapons/Typeless/LunicEye.cs b/Items/Weapons/Typeless/LunicEye.cs index 83600706cf..872d2e4d6a 100644 --- a/Items/Weapons/Typeless/LunicEye.cs +++ b/Items/Weapons/Typeless/LunicEye.cs @@ -1,8 +1,8 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; -using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,23 +11,28 @@ namespace CalamityMod.Items.Weapons.Typeless public class LunicEye : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Typeless"; + + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/LunicShot", 2) { PitchVariance = 0.1f }; + public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Item/LunicImpact") { PitchVariance = 0.1f }; + public override void SetDefaults() { Item.width = 60; Item.height = 36; + Item.damage = 32; Item.DamageType = AverageDamageClass.Instance; - Item.damage = 9; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; - Item.useAnimation = 15; - Item.useTime = 15; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = Item.useTime = 22; Item.knockBack = 4.5f; - Item.UseSound = CommonCalamitySounds.LaserCannonSound; - Item.autoReuse = true; - Item.noMelee = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = UseSound; + Item.autoReuse = true; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -35,10 +40,9 @@ namespace CalamityMod.Items.Weapons.Typeless itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + 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) => position += velocity.SafeNormalize(Vector2.Zero) * 48f; public override void AddRecipes() { diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 18fa4a63c8..52a8e2e512 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -12,10 +12,11 @@ namespace CalamityMod.Items.Weapons.Typeless { Item.width = 32; Item.height = 46; - Item.damage = 1350; - Item.useTime = Item.useAnimation = 25; + Item.damage = 1700; + Item.useAnimation = Item.useTime = 35; Item.reuseDelay = 15; Item.useStyle = ItemUseStyleID.Shoot; + Item.DamageType = AverageDamageClass.Instance; Item.UseSound = SoundID.Item46; Item.noMelee = true; Item.noUseGraphic = true; @@ -26,13 +27,18 @@ namespace CalamityMod.Items.Weapons.Typeless Item.Calamity().CannotBeEnchanted = true; } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + 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; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 55; public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs deleted file mode 100644 index a2b5adafcb..0000000000 --- a/Items/Weapons/Typeless/RelicOfResilience.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Linq; -using CalamityMod.Projectiles.Damageable; -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 RelicOfResilience : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Typeless"; - public const int CooldownSeconds = 5; - public const float WeaknessDR = 0.45f; - public override void SetStaticDefaults() - { - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 40; - Item.height = 34; - Item.useAnimation = Item.useTime = 28; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item45; - Item.autoReuse = true; - Item.noMelee = true; - 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 bool CanUseItem(Player player) => !player.HasCooldown(Cooldowns.RelicOfResilience.ID); - public override bool? UseItem(Player player) => true; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - player.AddCooldown(Cooldowns.RelicOfResilience.ID, CalamityUtils.SecondsToFrames(CooldownSeconds)); - int[] shardTypes = new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - }; - if (player.ownedProjectileCounts[Item.shoot] > 0) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == Item.shoot) - { - p.Center = Main.MouseWorld; - p.netUpdate = true; - } - } - } - else if (shardTypes.All(proj => player.ownedProjectileCounts[proj] == 0)) - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - } -} diff --git a/Items/Weapons/Typeless/Skynamite.cs b/Items/Weapons/Typeless/Skynamite.cs index 351f6072f8..4b58acd186 100644 --- a/Items/Weapons/Typeless/Skynamite.cs +++ b/Items/Weapons/Typeless/Skynamite.cs @@ -16,16 +16,16 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn[Item.type] = true; - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn[Type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } public override void SetDefaults() { Item.width = 8; Item.height = 28; - Item.useTime = Item.useAnimation = 40; - Item.maxStack = 9999; + Item.useAnimation = Item.useTime = 40; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.shootSpeed = 5f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Typeless/StarStruckWater.cs b/Items/Weapons/Typeless/StarStruckWater.cs index 110edb02eb..13499cb0f5 100644 --- a/Items/Weapons/Typeless/StarStruckWater.cs +++ b/Items/Weapons/Typeless/StarStruckWater.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using CalamityMod.Projectiles.Typeless; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - ItemID.Sets.SortingPriorityTerraforming[Type] = 92; // Blood Water + ItemID.Sets.SortingPriorityTerraforming[Type] = 88; // Blood Water } public override void SetDefaults() @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Typeless Item.rare = ItemRarityID.Orange; Item.damage = 20; Item.shoot = ModContent.ProjectileType(); - Item.maxStack = 9999; + Item.maxStack = Item.CommonMaxStack; Item.consumable = true; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs index 42b934e108..9aa8579d24 100644 --- a/Items/Weapons/Typeless/YanmeisKnife.cs +++ b/Items/Weapons/Typeless/YanmeisKnife.cs @@ -3,8 +3,8 @@ using CalamityMod.Projectiles.Typeless; 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.Typeless @@ -15,6 +15,17 @@ namespace CalamityMod.Items.Weapons.Typeless public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/YanmeiKnifeHit"); public static readonly SoundStyle ExpireSound = new("CalamityMod/Sounds/Custom/YanmeiKnifeExpire"); + public static int DebuffDuration = 600; + public static int DebuffDoT = 250; + public static float DebuffDamageReductionMult = 0.8f; + public static float DebuffNPCSpeedCap = 16f; + + public static int BoostDuration = 600; + public static float RunSpeedBoost = 0.15f; + public static float RunAccelerationBoost = 0.15f; + public static float DamageBoost = 0.15f; // All 15% so we only need just one in the tooltip -- Same for the respective buff + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RunSpeedBoost.ToPercent(), BoostDuration.FramesToSeconds()); + public override void SetDefaults() { Item.width = 48; @@ -49,12 +60,7 @@ namespace CalamityMod.Items.Weapons.Typeless return base.CanUseItem(player); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - player.Calamity().KameiBladeUseDelay = 180; - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => player.Calamity().KameiBladeUseDelay = 180; public override void AddRecipes() { diff --git a/Localization/en-US/Mods.CalamityMod.Attunement.hjson b/Localization/en-US/Mods.CalamityMod.Attunement.hjson index 78bb05cad3..a694250087 100644 --- a/Localization/en-US/Mods.CalamityMod.Attunement.hjson +++ b/Localization/en-US/Mods.CalamityMod.Attunement.hjson @@ -1,40 +1,26 @@ // Broken Biome Blade DefaultAttunement: { Name: Pure Clarity - Function: Fires a weak projectile that crushes enemy defenses + Function: Fires a weak sword beam that crushes enemy defenses } HotAttunement: { Name: Arid Grandeur Function: ''' - Hold to conjure searing blades in front of you that get larger and stronger the more you hit enemies - The blades can also be used to bounce off tiles when in the air + Conjure searing blades in front of you that get larger with enemy hits + The blades will bounce you off of tiles while in the air ''' } ColdAttunement: { Name: Biting Embrace - Function: Perform a 3 strike combo with a glacial blade. The final strike freezes foes for a split second -} - -TropicalAttunement: { - Name: Grovetender's Touch - Function: - ''' - Throw out the blade using a vine whip - Striking enemies with the tip of the whip as it cracks guarantees a critical hit - The whip will also propel you towards struck tiles - ''' + Function: Perform a 3 strike combo with a glacial blade, with the final strike freezing foes for a split second } EvilAttunement: { Name: Decay's Retort - Function: - ''' - Lunge forward using a ghostly rapier projection that leeches life on enemy hits - You will bounce away from struck targets - ''' + Function: Lunge forward with a ghostly rapier projection, bouncing away from struck targets and leeching their life } // Mended Biome Blade @@ -42,8 +28,9 @@ TrueDefaultAttunement: { Name: Pure Clarity Function: ''' - Fires a weak projectile that crushes enemy defenses - Landing true melee hits places a sigil of purity over the enemy. Your projectiles home onto the marked foes + Fires a weak sword beam that crushes enemy defenses + Landing three true melee hits charges a powerful lunge, unleashed when you stop swinging the sword + Enemies struck by the lunge are marked with a sigil that sword beams will home in on ''' } @@ -51,8 +38,8 @@ TrueHotAttunement: { Name: Arid Grandeur Function: ''' - Hold to conjure searing blades in front of you that get larger and stronger the more you hit enemies - The blades can also be used to bounce off tiles when in the air + Conjure searing blades in front of you that get larger with enemy hits + The blades will bounce you off of tiles while in the air Releasing after the blades are fully charged sends them hurtling forwards to shred your foes ''' } @@ -61,8 +48,8 @@ TrueColdAttunement: { Name: Biting Embrace Function: ''' - Perform a 3 strike combo with a glacial blade. The final strike freezes foes for a split second - Lingering glacial mist is released on each swing, dealing damage to enemies wandering into it + Perform a 3 strike combo with a glacial blade, with the final strike freezing foes for a split second + Harmful lingering glacial mist is released on each swing ''' } @@ -70,10 +57,9 @@ TrueTropicalAttunement: { Name: Grovetender's Touch Function: ''' - Throw out the blade using a vine whip. + Throw out the blade using a vine whip Striking enemies with the tip of the whip as it cracks guarantees a critical hit - The whip will also propel you towards struck tiles - Spreading vines sprout from critical strikes. These vines can hit up to three targets + Spreading vines sprout from critical strikes, which can hit up to three targets ''' } @@ -81,8 +67,8 @@ TrueEvilAttunement: { Name: Decay's Retort Function: ''' - Lunge forward using a ghostly rapier projection that leeches life off any struck foes. You also get bounced away from hit targets - Landing three strikes without touching the ground changes your next attack into an empowered dash thrust + Lunge forward with a ghostly rapier projection, bouncing away from struck targets and leeching their life + Landing three strikes without touching the ground turns your next attack into an empowered dash thrust ''' } @@ -90,26 +76,9 @@ HolyAttunement: { Name: Heaven's Might Function: ''' - Hold to swing the sword around you, accelerating over time - Releasing hurls the sword towards your cursor. The sword then quickly returns to your hand - ''' -} - -AstralAttunement: { - Name: Extant Abhorrence - Function: - ''' - Hold to charge a star-piercing lunge, release to unleash the devastating blow - Striking the earth with the lunge will cause a massive impact which raises otherworldly monoliths - ''' -} - -MarineAttunement: { - Name: Gesture for the Drowned - Function: - ''' - Shoot out two water balls at your sides. On ground contact the water balls will turn into small waves that ride along the ground - Waves fired while underwater or that touch water will become much larger and faster + Swing the sword around you, accelerating and dealing more damage over time + Once swung for long enough, releasing hurls the sword towards your cursor for a short time + Striking an enemy with the hurled sword at maximum power causes an astral monolith to erupt from them ''' } @@ -118,43 +87,47 @@ WhirlwindAttunement: { Name: Swordsmith's Pride Function: ''' - Hold to swing the sword around you, accelerating over time. Sword beams are fired wildly while swinging - Releasing hurls the sword towards your cursor. Sword beams home onto enemies struck by the thrown sword + Hold to swing the sword around you, accelerating and dealing more damage over time + Homing astral energies are wildly fired around you while swinging + Once swung for long enough, releasing hurls the sword towards your cursor + The hurled sword erupts into astral monoliths on enemy hits ''' - PassiveDesc: All attacks have a chance to fire sword beams + PassiveDesc: Striking enemies occasionally spawns homing astral bombers that spread the Astral Infection } FlailBladeAttunement: { Name: Lamentations of the Chained Function: ''' - Lash out with a flurry of chained blades. Striking enemies with the tip of the blades guarantees a critical hit + Lash out with a flurry of chained blades + Striking enemies with the tip of the blades guarantees a critical strike Critical strikes send out extra phantom chains which latch onto multiple targets ''' - PassiveDesc: An enchanted chain hook floats near you. Striking enemies makes the hook whirl around you, freezing enemies + PassiveDesc: An enchanted chain hook floats near you which spins and freezes enemies while dealing damage } SuperPogoAttunement: { Name: Sanguine Fury Function: ''' - Hold to conjure molten blades in front of you that get larger and stronger the more you hit enemies - The blades can also be used to bounce off tiles when in the air + Conjure molten blades in front of you that get larger with enemy hits + The blades will bounce you off of tiles while in the air Releasing sends the charged blades hurtling forwards like a wheel - Attacking again immediately thereafter dashes to the wheel, shredding anything in the way + Attacking immediately after throwing the blade launches you toward it, slicing through enemies and healing you ''' - PassiveDesc: Striking enemies rarely steals a small amount of life + PassiveDesc: Striking enemies will rarely heal you } ShockwaveAttunement: { - Name: Mercurial Tides + Name: Earthen Tides Function: ''' - Hold to charge a heaven-shattering lunge, release to unleash the devastating blow - Shock waves are emitted as the sword charges up - Striking the earth with the lunge will cause a massive shock wave on impact which raises a flood of monoliths + Charge an earth-shattering lunge, release to unleash a devastating blow + Homing sword beams are emitted as the sword charges up + Striking an enemy with the lunge creates a shockwave and marks them with an armor crunching sigil that attracts sword beam homing + Striking the earth with the lunge will cause several blasts of dust to erupt around you ''' - PassiveDesc: Periodically emit shock waves while attacking + PassiveDesc: Periodically emit large shock waves while attacking } // Galaxia @@ -162,15 +135,10 @@ PhoenixAttunement: { Name: Phoenix's Pride Function: ''' - to swing Galaxia around you, accelerating over time + Swing the sword around you, accelerating over time The swirling nebula constantly emits homing cosmic bolts - Release to hurl Galaxia toward the cursor alongside 6 gigantic cosmic bolts - ''' - PassiveName: Capricorn's Blessing - PassiveDesc: - ''' - Periodically releases a ring of weakening stars around your cursor when attacking - The ring is repelled away from you at first, before slowing down over time + Release to hurl the sword toward the cursor alongside 6 gigantic cosmic bolts + The hurled sword erupts into a blazing flame pillar on enemy hits ''' } @@ -178,32 +146,19 @@ AriesAttunement: { Name: Aries' Wrath Function: ''' - Throw Galaxia to your cursor, holding it in place with constellations - Galaxia follows your cursor, rapidly spinning to shred enemies + Binds the sword to your cursor through a chain of constellations Striking enemies causes nebulous explosions which spawn homing cosmic bolts ''' - PassiveName: Capricorn's Blessing - PassiveDesc: - ''' - Periodically releases a ring of weakening stars around your cursor when attacking - The ring is repelled away from you at first, before slowing down over time - ''' } PolarisAttunement: { Name: Polaris' Gaze Function: ''' - Hold to channel Galaxia's power into a tight vortex of galactic energies - The vortex powers up over time and when hitting enemies - Release to fire off the charged star in straight line - Press again immediately to dash towards the star and release cosmic bolts - ''' - PassiveName: Cancer's Blessing - PassiveDesc: - ''' - Periodically releases a ring of lifestealing stars around yourself when attacking - The ring is attracted towards you at first, before slowing down over time + Channel Galaxia's power into a vortex of celestial energies + The vortex powers up over time and while hitting enemies + Release to fire a powerful star directly on your cursor that bombards nearby enemies with bolts + Attacking immediately after firing the star launches you toward it, damaging enemies ''' } @@ -211,14 +166,8 @@ AndromedaAttunement: { Name: Andromeda's Stride Function: ''' - Hold to charge a god-erasing lunge, release to unleash the devastating blow - Galaxia emits cosmic bolts while charging - Lunging into the ground will cause a shockwave which summons a storm of cosmic energies - ''' - PassiveName: Cancer's Blessing - PassiveDesc: - ''' - Periodically releases a ring of lifestealing stars around yourself when attacking - The ring is attracted towards you at first, before slowing down over time + Charge a spatial lunge, release to unleash a galactic blow + Charging the sword periodically emits homing bolts + Lunging into enemies rains large homing stars from the heavens ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson new file mode 100644 index 0000000000..269038422a --- /dev/null +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson @@ -0,0 +1,108 @@ +// Put their internal name here +NPCName: { + Guide: Once tasked with shepherding the Wall of Flesh, the Guide is a godlike figure in Demon folklore. However, the former warlock apprentice now savors a humble life, mentoring adventurers with his sharp intuition. + Dryad: Dryads practice the art of Life Magic, pioneered by Silva. She is connected with nature and can analyze its purity worldwide. She sells seeds, too! + Mechanic: The Mechanic was imprisoned for sticking her nose where she shouldn't. She sells wiring and tools for putting together anything imaginable. + EmpressButterfly: These familiars conjured by the Empress draw power from their surroundings and later bring it to their master. They remind her of a lost loved one, and should one perish in the chaos of night, she shall unleash her full fury upon the attacker. + DemonEye: "{$CommonEntries.DemonEye}" + CataractEye: "{$CommonEntries.DemonEye}" + DialatedEye: "{$CommonEntries.DemonEye}" + SleepyEye: "{$CommonEntries.DemonEye}" + GreenEye: "{$CommonEntries.DemonEye}" + PurpleEye: "{$CommonEntries.DemonEye}" + Wraith: Souls belonging to devotees of gods were once sealed inside the Wall of Flesh. Now, they roam the night in search of vengeance. + BloodNautilus: The intense red glow of the Blood Moon becomes even greater in contact with water, making aquatic creatures affected more strongly than their land counterparts. This enormous shelled water demon directly feeds off that energy, responding brutally to being pestered. + DiggerHead: Exposure to the effects of godly magicks flowing throughout the cracks of the world causes unusual rapid growths in giant worms. + UndeadMiner: After the Crusade died down, many spelunkers attempted to take advantage of the situation. The results were less than optimal. + GraniteGolem: These strong magicked constructs were utilized in mines for carrying heavy ores and machinery. They continue to inhabit the mines deep below, even after their abandonment. + GraniteFlyer: The Earth Elemental manifests through many forms by taking on the properties of different materials, such as this hardy granite. + GreekSkeleton: Marble caves were used as arenas during the Deific Era. Fighters looking for glory flocked to them, but now only their bodies populate the area. + UndeadViking: After the Crusade left the continent in shambles, many factions attempted to conquer it. These vikings were one such group, but the icy winds of the tundra made short work of them. + IcyMerman: Mermen rarely stray far from the ocean, favoring the vast waters where their revered Elemental now lives in. Those that do can become lost, wander into cold caverns, and become icy undead fish men. + IceElemental: After splitting, the fragments of an Elemental may become stranded and inaccessible. Ice Elementals were once part of Anahita, left behind during her journey to the Ocean. Their frosty shards freeze all. + DesertBeast: Minor draconic offshoots who thrive in arid climates, the Basilisk's hardened bodies make them formidable threats. + DuneSplicerHead: The largest worm native to the Desert. Even strengthened by divine magicks, they fall short of the Scourge, and run amok in a hunger-induced frenzy. + SandElemental: The most powerful manifestation of the fragmented Earth Elemental, taking many forms through the properties of different materials. With this feminine form, her tornadoes tear all asunder. + SandShark: "{$CommonEntries.SandShark}" + SandsharkCorrupt: "{$CommonEntries.SandShark}" + SandsharkCrimson: "{$CommonEntries.SandShark}" + SandsharkHallow: "{$CommonEntries.SandShark}" + MeteorHead: When meteorites strike the surface, their fragments lay scattered for the taking. Some pieces have a higher mana density, coming to life and attacking anything nearby. + AngryBones: "{$CommonEntries.AngryBones}" + AngryBonesBig: "{$CommonEntries.AngryBones}" + AngryBonesBigMuscle: "{$CommonEntries.AngryBones}" + AngryBonesBigHelmet: "{$CommonEntries.AngryBones}" + BlueArmoredBones: "{$CommonEntries.BlueArmoredBones}" + BlueArmoredBonesMace: "{$CommonEntries.BlueArmoredBones}" + BlueArmoredBonesNoPants: "{$CommonEntries.BlueArmoredBones}" + BlueArmoredBonesSword: "{$CommonEntries.BlueArmoredBones}" + HellArmoredBones: "{$CommonEntries.HellArmoredBones}" + HellArmoredBonesSpikeShield: "{$CommonEntries.HellArmoredBones}" + HellArmoredBonesMace: "{$CommonEntries.HellArmoredBones}" + HellArmoredBonesSword: "{$CommonEntries.HellArmoredBones}" + RustyArmoredBonesAxe: "{$CommonEntries.RustyArmoredBones}" + RustyArmoredBonesFlail: "{$CommonEntries.RustyArmoredBones}" + RustyArmoredBonesSword: "{$CommonEntries.RustyArmoredBones}" + RustyArmoredBonesSwordNoArmor: "{$CommonEntries.RustyArmoredBones}" + SkeletonSniper: Part of Yharim's military force in their past lives, these eagle-eyed sharpshooters let nothing escape their crosshairs, even when their place of operation were these cramped halls. + TacticalSkeleton: Part of Yharim's military force in their past lives, with thick armor and mighty boomsticks, they were the frontline against the invader that massacred the guards in these halls. + SkeletonCommando: Part of Yharim's military force in their past lives, their rocket-powered rage could wipe out entire crowds of escapees had they ever once dared to step out of their cells. + BoneLee: This Onyx Kinsman was apprehended by Yharim's troops, and after countless failed escape attempts, used as an example to other prisoners. + Paladin: Several Godseeker Knights were assigned to guard the Dungeon, yet not even they could fight against, much less see, their killer. Word of the massacre that happened in these halls never got out, the wails of the dead forever silenced. + DiabolistRed: "{$CommonEntries.Diabolist}" + DiabolistWhite: "{$CommonEntries.Diabolist}" + Necromancer: "{$CommonEntries.Necromancer}" + NecromancerArmored: "{$CommonEntries.Necromancer}" + RaggedCaster: "{$CommonEntries.RaggedCaster}" + RaggedCasterOpenCoat: "{$CommonEntries.RaggedCaster}" + DungeonGuardian: The Old Man is cursed to never leave nor enter the Dungeon, much less die. Whoever crosses paths with him and dares to descend into those halls shall not pass! + BoneSerpentHead: Mighty serpentine beasts ruled hell since before history, later led by the exiled Flame Dragon. For said alliance, their obsidian scales were turned to Ash shortly after his demise. Now their skeletal husks remain, forced to protect the demonic territory using stolen Azafurian spells. + Demon: Despite being a primitive civilization, demons populate most of the underworld. Unlike their lesser brothers, they cast shadow magic rather than hell magic. + VoodooDemon: Demons have several religious practices, specially sacrifices. They worship the Wall of Flesh ever since it started roaming the underworld, using offerings to draw it closer. + RedDevil: Conjuring potent spears of dark magic, these elite demons look after the adventurer that destroyed their perceived deity. + WyvernHead: Deeply in tune with the magic of the world, these serpentine dragons guard the skyward ruins of Chrysadia on behalf of the Storm Dragon. Now, their duty calls louder as divine essence surges through the land. + Harpy: Winged, demi-human creatures from distant southward mountains who came to inhabit Chrysadia after its tragic downfall. They defend their new territory fiercely against invaders with their razor-sharp feathers. + Scutlix: One of the few creatures left in the Martian homeworld, these creatures function similarly to horses. That is, if horses could fire lasers from their eyes. + MartianProbe: Sensing growing power on the planet, otherworldly beings send space-age technology to scan for valuable resources. + SeekerHead: Godly magicks have unleashed the dark influences that gave birth to the Eater of Worlds, producing smaller, but just as deadly worms. + DesertDjinn: Buried in these caves lie cryptic artifacts older than Ilmeris, their origins swept away by the sands of time. Corrupted by divine magicks, the once friendly djinns within them now reemerge, full of hostility. + ChaosElemental: Manifestations of the unstable Essence of the Hallow, they erratically make chase with an uncontrollable surge of luminous power. + GoblinThief: Thieves forcefully conscripted in the Goblin Army in exchange for freedom, these pesky foes specialize in nimble movement and close-quarters combat. + GoblinSummoner: Goblins that reach such a mastery over the arcane are treated like royalty, prize jewels of their society. Warlocks in particular conjure unfathomable shadowflame ghasts through a powerful hex. + GoblinSorcerer: Goblins struggle to manipulate magic, only scantily capable of conjuring the simplest of spells. Those that can have the potential for manipulating magicked shadow energy through a form of hexing. + PirateCaptain: A pirate captain's love for riches is only rivaled by his desire to explore! Word that the Crusade had seemingly ended spread fast across the world, and abundances to plunder in this continent attracted this sea dweller and his motley crew. + MartianSaucerCore: Following the destruction of their planet by otherworldly creatures, the Martians' military evolved at an unprecedented rate. They were prepared to fight back any future threats, and also pillage any other worlds they could find. + TorchGod: An unknown entity responsible for a torch's eternal flicker, however easily angered by the unsightly, ungrateful abuse of torch placement. + EyeofCthulhu: A gargantuan monster of unknown origins, responsible for plaguing the night with Demon Eyes. It was given the title of "Cthulhu", which means "Great Beast" in the language of dragons. + BrainofCthulhu: The death of a god often birthed great monsters due to the volatile nature of godly essence. The culling of such abominations used to be cause for songs and festivities, but now, they only give birth to disappointments. + SkeletronHead: A demonic construct that bursts out of the Old Man when necessary and the most dangerous part of the curse laid by the Dragon Cult. They hoped to stop all intruders with it, but one was too cunning even for them. + WallofFlesh: Originally created by Azafurian mages as a gambit to seal away godly essence, the towering wall broke free after the city's destruction. Its existence was problematic, but its demise has ushered even greater instability upon the world. + QueenSlimeBoss: After fleeing the initial battle, the Slime God attempted to rebuild its Paladins with the emerged energy of the Hallow. However, it was ensnared by its own creation, unable to control the vast and unstable power of it. + Retinazer: A pair of mechanical eyes built by Draedon for reconnaissance and assassination, Retinazer focuses its energy into firing powerful lasers. + Spazmatism: A pair of mechanical eyes built by Draedon for reconnaissance and assassination, Spazmatism chases at high speed, exhaling cursed flames. + TheDestroyer: Despite being made with repurposed mining equipment, the Destroyer was built for fighting other deities in single combat, decorated in laser-armed probes, which detach from its body when damaged. + SkeletronPrime: Built with the express purpose of inciting fear into the hearts of any god worshiper, this machine has more arms than ever before, and a variety of fierce weapons. + Plantera: A creation of the Vernal Pass meant to replace Braelor in his absence. They harnessed dead animal souls to give it life, but the span of such magic was far larger than anticipated. It didn't take long for the Plantera to grow out of control and slaughter its masters. + HallowBoss: Despite their parentage, children of gods do not inherit a shred of their power. The Empress chose to claim power for herself by siphoning it from other places and beings. She found a perfect candidate in the Hallow due to its unstable nature, and is now transformed into a mighty fae. + Golem: A remarkable display of ingenuity constructed by the Lihzahrd race. Seeking light after they hid away in their temple out of shame for driving their goddess away, they built this construct. Powered by solar energy cells, it is ready to guard the Temple. + DukeFishron: An aquatic-evolved species which lives in isolation in the depths of the ocean. Despite their shortcomings, they still share blood with the dragons of old, claiming near complete dominion over the oceans. Legends claim it only surfaces in search of a rare, savory type of worm. + CultistBoss: The fanatical leader of the Dragon Cult, hell-bent on resurrecting a dragon. He upholds their sacred duty of keeping the cosmic behemoth sealed far away on the moon, an oath he swore to long ago when he pledged himself in their service. + CultistDevote: Utterly devoted, Lunatic Devotees are so paranoid over the prospect of their ritual failing that they stay unflinching even when threatened with death. Fear only makes them work harder. + LunarTowerNebula: The second pillar, created to spawn beings from beyond that filled the Minds of all with gloom. These troops specialized in disabling the enemy's intelligence, ensuring no countermeasures could be planned against the dominator. + LunarTowerSolar: The fourth and last pillar, created as Sunlight bled and marked doom. A miniscule shard of its power was used to make it, and yet its spawns accompanied the dominator directly in his conquest against the dragons. + LunarTowerVortex: The first pillar, created as black Storm clouds on the horizon loomed. While the dominator fought the mightiest of dragons, the spawns of this pillar focused on exterminating any mundane life they could find, appearing in seemingly infinite droves. + LunarTowerStardust: The third Pillar, created as Life rose to fight, but was given no room. Its spawns found particular utility in searching and picking off stronger beings that could pose a threat to the creatures of the Vortex. + MoonLordCore: The cosmic behemoth that brought Terraria to its knees 800 years ago, freed from its lunar prison in a weakened state. It had the power to siphon and dominate souls, including those possessed by dragons, permanently wounding them. It hails from an incomprehensible fissure of broken spacetime which leeches energy from our dimension to sustain itself. +} + +CommonEntries: { + DemonEye: That suspicious feeling of being watched may very well come true in the dark of night, when the Eye of Cthulhu's minions roam the skies. + SandShark: Sand Sharks lived in the shallow waters of Ilmeris, hiding beneath the sand. They were thankfully well equipped to deal with the fallout of the Incineration. + AngryBones: Cursed with undeath, the former prisoners of the Dungeon roam endlessly through its halls, seeking a victim for their unending fury. + BlueArmoredBones: Mercenaries hired by Yharim to guard the Dungeon, the Marching Blues were disciplined and relentless, sundering any escapees that decided to rise against their jailors. + HellArmoredBones: Mercenaries hired by Yharim to guard the Dungeon hailing from Azafure, the fiery glow of the Molten Legion is unmistakable. If anyone ever tried to hide, their red-hot armaments would melt the hideout immediately. + RustyArmoredBones: Mercenaries hired by Yharim to guard the Dungeon hailing from Underground factions, the Rusted Company's weapons are jagged and rough through use and neglect. The brutality they employed on the field was enough to make many prisoners give up on freedom. + Diabolist: Mages of Azafure who bear the Diabolic Sigil, a certificate of their prowess, wielding flames as intense as any in the underworld. They were effective at blocking passageways and at making prisoners talk. + Necromancer: These sorcerers were trained in Azafure and bore the Necromantic Sign, a certificate of their prowess. Much like they terrorized prisoners with the bodies of their friends, so do they terrorize the Dungeon now. + RaggedCaster: Casters directly from the Dragon Cult, their cursed magic leaves their victims helplessly lost in utter darkness. They perished attempting to contain the onslaught that happened beneath their halls. +} diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index 065b44f876..06606aa88c 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -1,5 +1,5 @@ //Abyss Enemies -BabyCannonballJellyfish: These creatures have been hunted for centuries now. They are widely used as ammunition in ships or even as normal bombs. Despite this, they never truly vanish, as if an external power kept this species alive. +BabyCannonballJellyfish: These creatures have been hunted for centuries now. They are widely used as ammunition in ships or even as normal bombs. Ecologists have been attempting to repopulate their species in recent times due to their importance to the Sulphurous Sea's preservation. Bloatfish: More geological than biological, bloatfish have sticky glue-like skin that they use to cover their bodies in voidstone. Though it protects them from predators, their immense weight has sunk them to the deepest parts of the Abyss. BobbitWorm: Hiding away in the darkest corners of the void to strike at unsuspecting prey, bobbit worms take full advantage of the Abyss' darkness. To live here, in the most extreme environment in the world, a creature must either be truly mighty, learn to use the environment to survive, or both. BoxJellyfish: Larger than the average jellyfish, the sting of these persistent pests packs a powerful punch. Though they can be found in most large bodies of water, they are locally extinct around Ilmeris after the Brimstone Witch turned her hexes against the kingdom. @@ -70,7 +70,8 @@ ArmoredDigger: Despite being relatively primitive compared to Draedon's current AuroraSpirit: Thought to be no more than an old wives' tale, sightings of aurora spirits have become commonplace since the defeat of the wall of flesh. Upon closer inspection, it appears these "spirits" are rather wisp-like entities clad in a cryonic shell, a sure sign that these were created by Archmage Permafrost. BloomSlime: Imbued with profaned energy, this slime wishes to see the world reduced to ashes to ensure the suffering it brings is no more. However, the simplicity of their form makes it difficult for the slain goddess to fully impose her will onto them. Bohldohr: Bohldohrs were made to serve the lihzahrds, being crafted from ancient stone and brought to life with magical power in the twilight of the great Lihzahrd Dynasty. But the sun sets on every civilization, and once their deity abandoned them, they were left to fend for themselves. -Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, cnidrions survived the Incineration due to their sheer might. They continue to defend what was once the heart of the sea kingdom from intruders, maintaining a fierce loyalty to their masters even after they have passed on. +CladCrab: Strong enough to carry an entire mound, these land crustaceans were hard pressed for survival during the Crusade. With no other option, they added rock and stone to their list of protections, allowing them to continue thriving. +CloudElemental: Part of a solitary elemental that rarely appears aside from when her domain is at its strongest. Many attempts were made by what remained of Yharim's forces to hunt down the elementals after Azafure fell. Only now that the war has passed do the weaker elementals dare return. 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. @@ -90,11 +91,9 @@ ProfanedEnergyBody: Those most devout to Her travel the world, being planted int Rimehound: These hounds were bred and trained to survive in the tundra's hostile conditions by Yharim's forces, so that they may act as scouts. Most were simply abandoned by their masters out of either necessity or choice, and were resigned to roam forever without purpose. Rotdog: Fast and furious, these hounds prowl the night, hunting prey with their razor sharp teeth. They are similar in nature to the demon eyes, both being spawned from the same vile mire, yet these creatures are tailored made to end those who have proven themselves a threat to it. ScornEater: For one to be weak of will does not inherently mean they are weak of body. Within these powerful individuals does a powerful fire burn, and She is all too willing to fan the flames. All one need give in return for Her gracious blessing is their free will, and they shall be gifted Her enlightenment. -SeaUrchin: Massive urchins that roll and hop their way across the sea floor, catching both fish hiding in the sand thanks to their spikes that allow them to comb the sea floor and those far above with their incredible leaps. Their surprising size is due to this species' carnivorous diet, rather than consuming plants like most types of urchins. ShockstormShuttle: Mining devices and scouts for a civilization from a long lost world. They now seek whatever resources are left on other nearby planets, and perhaps even this world as a potential replacement for their ruined home. -Stormlion: Some survivors of Ilmeris' downfall claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity from the battle remains buried in the sands, with several antlions having learned to both channel and harness the former kingdom's power. +Shroomble: Mushrooms offer surprisingly effective regenerative agents to human bodies. This is commonly attributed to their abundance of Life, and visibly, "abundance" is often an understatement. Sunskater: To the civilization that lived far above clouds, sunskaters were seen as a good omen. These creatures inspired hope in those who saw them, that their society might live on for as long as the sun's light bathes the world. -ThiccWaifu: Part of a solitary elemental that rarely appears aside from when her domain is at its strongest. Many attempts were made by what remained of Yharim's forces to hunt down the elementals after Azafure fell. Only now that the war has passed do the weaker elementals dare return. WildBumblefuck: Though but an adolescent dragonfolly, it poses a great threat to all around it regardless of its age. Their species survived the draconic purges by reproducing rapidly and becoming highly reclusive, alongside developing a hyper-aggressive nature. WulfrumAmplifier: These amplifiers empower fellow wulfrum machines through a surprisingly advanced tesla field. While the field is harmless to any organic beings that pass through it, wulfrum machines are designed to receive energy from it which allows them to run at peak efficiency. WulfrumDrone: The purpose the wulfrum machines once fulfilled can most clearly be seen through the drones: to harass the basic troopers of Yharim's forces. They were not threatening enough to be a priority target, though their laser attacks could be quite deadly if allowed to fully power up. @@ -117,34 +116,47 @@ Sulflounder: A relative to certain hadopelagic creatures living in the depths, t Toxicatfish: Though these fish once threatened none other than their prey, the radiation from nuclear waste generated from Draedon's old experiments has rotted both their bodies and minds. Attacking anything that comes near, this once flourishing species is now on the verge of extinction. Trasher: Despite being equipped with a mouth large enough to swallow a child whole, these crocodiles simply act as scavengers, devouring scraps and bones left over from predators' meals. Needing to conserve energy due to eating relatively little, they rarely move at their full speed unless they feel threatened. //Sunken Sea Enemies -BabyGhostBell: Ghost Bells were bred in large numbers during the Ilmeran war, due to the Ilmerian army needing a staggering amount of electricity to keep Yharim and his forces at bay. Alas, their efforts were for naught, and the kingdom collapsed after the Great Incineration. -BlindedAngler: Lacking most normal senses, these predators use a form of biological sonar to 'see' their surroundings. The glowing crystals on their backs draw in prey that use the sea's shimmering prisms as their guiding light, like a moth to the flame. -Clam: Clams once lived in the upper portion of the Ilmeran Sea before the Incineration, being forced to relocate after the battle. Though it was thanks in part to their adaptability and hardiness that their species survived, luck was also certainly on their side. -EutrophicRay: Eutrophic Rays have formed a commensalistic relationship with Ghost Bells. The rays can store energy given by the Ghost Bells for electrical muscle stimulation, allowing for great bursts of speed. -GhostBell: These high-voltage jellyfish can incapacitate most with a single touch, and were a major factor in the Ilmerian army's strength. The sea kingdom used the electricity produced by Ghost Bells to drive back Yharim's forces, electrifying the waters so that none could cross their borders. -GiantClam: Clams slowly crystalise ambient magic around themselves into pearls, and as they grow larger, so too do their pearls. Upon growing to their full size, they are classified as Giant Clams, and gain the ability to use the magic stored in their pearls to some degree. -PrismBack: Due to the beautiful prisms and calm behavior, these animals have been taken in as pets by many over the course of centuries, even outside of Ilmeris. Though far too slow and bulky to hunt normally, the sea prisms on their back act as a lure for small fish. -SeaFloaty: Flatworms can be found in many seas and oceans across the world, and are exceptional at fitting through cracks or crevices due to their thin bodies. These particular flatworms only ever inhabited the lower sea, and were left entirely unthreatened by the carnage that annihilated most species' homes. -SeaMinnow: Schools of sea minnows were one of the most beautiful things one could witness during the days when Ilmeris was unshattered. Those permitted into the kingdom would gather to see these fish swimming in the open sea… yet, this is but a distant past now, even for the minnows themselves. -SeaSerpent: Despite being one of the few carnivorous creatures to have ever existed in the Ilmeran Sea, even these serpents are unusually passive towards those they do not consider prey by the standards of elsewhere. The sea has only ever known one truly aggressive predator, and it abandoned a life of calming solitude years ago. +BabyGhostBell: Despite their decidedly lower size and development, infant Ghost Bells can deliver just as many volts to unsuspecting creatures. The Ilmerian army bred thousands of Ghost Bells to maintain the lethal electric field around the sea kingdom, but all their efforts were consumed by ash in a single burning moment. +Clam: Despite having the same filter feeder appetite of the common clam, the Ilmeran species adopted defensive mechanisms against macrofauna due to their forced relocation by the Incineration. Almost all of the remaining Clams have congregated in a small den at the bottom of the sea; what makes this place unique is unknown, as few divers can withstand the ferocity of the clams in their natural abode. +Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, Cnidrions fought valiantly alongside their masters during the Incineration. Though many perished unceremoniously with the warriors that commanded them, one managed to escape a fiery demise, continuing to defend what was once the heart of the sea kingdom with a fierce loyalty. +EutrophicRay: Living life as a filter feeder, the tranquil Eutrophic Ray is quick to flee from any dangers. They are aided by their commensalistic relationship with Ghost Bells, storing the latent voltage in a sac on their underbelly for electrical muscle stimulation, allowing for great bursts of speed. +GhostBell: Commonly encountered as large walls of electric power, these high-voltage jellyfish can incapacitate most with a single touch. Even when not delivering shocks to prey, they passively release a current into the surrounding water, which the old sea kingdom exploited to drive back Yharim's crusade for decades. +GiantClam: Pearls are formed from ambient mana combining with natural limestone deposits, and are claimed to be capable of storing thoughts and memories. Although most clams die and break down before their shells can act as sufficient conduits, the largest and strongest clams can gather enough mana in their pearls for direct use in feeding and defense. +HauntedChum: During the Witch's razing of Ilmeris' seas, many of the largest fish that had never known fear in their lives were foolish enough to fight back. Even in death they remain consumed by rage, attacking those who draw near, despite being as ruined as the sea itself. +Jellyghoul: The spirits of some Ilmerians were so consumed by grief and despair that, over time, their identity and memories faded away. These souls are now confined in the blank form of phantom jellyfishes, doomed to forever haunt the Timeless Shores. +KelpieSeadragon: Kelpie Seadragons enjoy hiding in the scarlet kelp fronds of the Polyp Forest, where they can observe their surroundings without being noticed. Don’t underestimate them, as their silly-looking faces can shoot highly poisonous pellets! +LostShoal: Shoals of spectral fish swim through the damp air of the Sunken shoreline, fully ignorant of their ominous demeanor and the horrible fate that befell them. +Pearlpod: Residing in the utmost depths of the Sunken Sea, these docile crustaceans consume Lantern Kelp and organic remains to survive. When curled up, their nacreous hide makes them almost identical to pearls and impervious to attacks. +PolypPanasea: The vibrant Panaseas developed a natural coating which counters the toxins of polyps, and now frequently take shelter in their tentacles. Anything that chases the fish into their home swiftly learns about the other side of this partnership. +PrismBack: Far too slow and bulky to hunt normally, these turtles subsist on a diet of purely kelp. As a result of their slow and infrequent movement, large prisms are able to accumulate on their backs, providing natural protection against threats that would not risk swallowing a razor-sharp crystal. +Probesnout: One of just a few known seahorse species who miraculously survived the Incineration. Its efficient snout allows it to streamline nutrients from the abundant sponge in the reefs that it lives in. +SandProwler: These colorful sea serpents prowl through the sand, looking for the gleam of an unsuspecting Guppy to snack on. Due to this creature’s habit of mistakenly capturing dropped coins, Ilmerians fond of avarice began to share the namesake. +SeaFloaty: Flatworms can be found in many seas and oceans across the world, and are exceptional at fitting through cracks or crevices to find kelp due to their thin bodies. These particular flatworms are incredibly skittish, and thus fled with plenty of time to be spared from the infernal carnage. +SeaMinnow: Large schools of Sea Minnows were one of the most beautiful things one could witness during the days when Ilmeris was unsundered. Though the kingdom's grandeur has been lost like ashes in the wind, the tranquil fish continue to swim at peace, a breathtaking reminder that not all was lost. +Sharkoon: The bulbous Sharkoon wanders the reefs on the outskirts of the Sunken Sea. It retaliates against threats through the unusual method of exploding a sac on its body that stores highly reactive chemicals, fleeing in the confusion caused by its shockwave. +Stormlion: Some Ilmerian survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. //Town NPCs AndroombaFriendly: Reverse-engineered Androombas that have been retrofitted to spread the Steampunker's solutions rather than clean dust and debris off of floors. They can be used to purify the world– or ruin it further, if one so desires. -DILF: One of the world's foremost experts on magical theory, he is renowned for his skill with the arcane arts. In his days when he traveled with Yharim's entourage, he acted as the Godseeker's advisor, due to both his status and his distaste for actively participating in battle. -FAP: A princess from an unknown land. She drinks constantly in a vain attempt to escape the memories of her past, but is practically immune to alcohol. She makes a business of selling her mixtures, alcoholic and alchemic alike. -SEAHOE: The seventeenth ruler of the constitutional monarchy of Ilmeris since the tribes of the Ilmeran Sea unified, under the Electric Goddess, Otonilou, and the elusive God of the Seas. Alas, one cannot be a ruler without subjects, and while he remains respected by those who opposed Godseeker Yharim, his kingdom is no more. -THIEF: The bandit may have a bad habit of looting battlefields and taking what isn't theirs, but their actions are mostly motivated by their hatred of the obscenely rich who haven't truly earned the wealth they possess. Their methods are somewhat shady, but can always be relied upon to get a job done. -WITCH: Recruited to Yharim's forces late into the war, her magic overflows with such power that she is largely incapable of casting normal spells. Yet despite her great power, Calamitas prefers not to use it, as it takes a heavy toll on her psyche. +Archmage: One of the world's foremost experts on magical theory, he is renowned for his skill with the arcane arts. In his days when he traveled with Yharim's entourage, he acted as the Godseeker's advisor, due to both his status and his distaste for actively participating in battle. +Bandit: The bandit may have a bad habit of looting battlefields and taking what isn't theirs, but their actions are mostly motivated by their hatred of the obscenely rich who haven't truly earned the wealth they possess. Their methods are somewhat shady, but can always be relied upon to get a job done. +BrimstoneWitch: Recruited to Yharim's forces late into the war, her magic overflows with such power that she is largely incapable of casting normal spells. Yet despite her great power, Calamitas prefers not to use it, as it takes a heavy toll on her psyche. +Cirrus: A princess from an unknown land. She drinks constantly in a vain attempt to escape the memories of her past, but is practically immune to alcohol. She makes a business of selling her mixtures, alcoholic and alchemic alike. +SeaKing: The seventeenth ruler of the constitutional monarchy of Ilmeris since the tribes of the Ilmeran Sea unified, under the Electric Goddess, Otonilou, and the elusive God of the Seas. Alas, one cannot be a ruler without subjects, and while he remains respected by those who opposed Godseeker Yharim, his kingdom is no more. //Boss Minions Brimling: Extensions of the Brimstone Elemental herself, and part of her very being. Both she and her Brimlings are of a single mind, so she naturally cares for them just as she cares for herself. When heavily wounded, they withdraw into a cocoon to protect themselves from further harm. SoulSeeker: The Clone's attempt at wielding the souls of the damned as weapons, these retain slightly more autonomy than their Azafurian brethren. And yet given the striking resemblance the bear to the Clone's shell, it's arguable that they might be further from Calamitas' current soul seekers than those found in Azafure's ruins. DarkEnergy: - DesertNuisance: Though these serpents are of the Desert Scourge's species, they are notably younger and less developed. Choosing to hunt in a pack with the large scourge due to this weakness, many have seen them tear apart prey not unlike the piranhas that once populated the former sea. CosmicGuardian: Though of the same species as the nameless serpent, their minds and functions are far more basic. They possess very little will of their own and blindly follow the orders of their gluttonous master. +DankCreeper: Divine puppeteers beheld incessantly through their devotees, an organic panopticon for a wicked hive mind. Their word was truth, and evidence otherwise was burned. Even in decay, they summon subjects to creep, spy and kill. +DarkHeart: Beneath all the schemes and lies, dark desires coiled inside the pitch-black hearts of these deities. With their forms rent beyond recognition, new hearts arise from their rot to beat with misery once more +HiveBlob: The faceless are bulletproof, and so the corrupt coalescence shields itself behind dull pawns, as the Gods it was birthed from once did. HiveTumor: This tumor acts as the brain of the putrid wasteland, being all that is left of the minds of the slain gods that lay there. The creatures of the Corruption exist to protect it, and those who attempt to harm it rarely live to tell the tale. AquaticAberration: A spawn of the immense Leviathan, their lifespan can be measured in hours. All they know is how to hunt for their masters. Even non-aquatic life is well within their reach, due to their uncanny ability to fly through air just as easily as swimming through water. LeviathanStart: A lure created by the Water Elemental, Anahita. It sings so sweetly, its voice full of promise and warmth, but beware: follow the siren's call at your own peril. PerforatorCyst: This twitching and convulsing pile of gore acts as the heart of the Perforator Hive, harvesting what small amount of diluted Ichor flowing through the Crimson is left and feeding it to the Hive. Little else is known about it, for those who dare to disturb it have become indistinguishable from the landscape. CosmicLantern: These lanterns possess a magical, distorted flame that radiates no heat whatsoever. If one looks closely into their fire, they may see another world entirely. +CosmicMine: Tearing a rift into our world from the distortion takes vast amounts of energy; that is, unless you are a being of both worlds. Signus alone can create these portals with such ease, but even it cannot sustain them for long before the energy used to open them violently disperses. CorruptSlimeSpawn: Slimes are extraordinarily hardy creatures: if a large slime has chunks of living gelatin severed from it, the chunks tend to continue on, albeit as their own beings. Even as gel, a slime is still technically alive– it simply exists in a state where it cannot function in any meaningful way. CrimsonSlimeSpawn: Slimes are extraordinarily hardy creatures: if a large slime has chunks of living gelatin severed from it, the chunks tend to continue on, albeit as their own beings.They even retain the memories of the original slime, and so continue to work in the interest of their "parent". CrimsonSlimeSpawn2: Though many slimes may get objects stuck partway inside of it and learn to use them as weapons, these slimes are a unique case. The spikes of these slimes are a natural part of them, heavily sharpened so that they may impale those who dare defy their god. @@ -183,7 +195,7 @@ ProfanedGuardianCommander: In a time lost to memory, there were four soldiers wh ProfanedGuardianDefender: In a time lost to memory, there were four champions who used their loyalty to one another to slay a dragon, that one might gorge themself upon its auric soul. "I am the strongest," declared their shieldmaiden, "I should be the one." There was silence, until Providence spoke: "You lack strength of conviction, that you might try to pluck the stars from the sky." ProfanedGuardianHealer: In a time lost to memory, there were four champions who used their fathomless determination to slay a dragon, that one might gorge themself upon its auric soul. "I am the most courageous," declared their cleric, "I should be the one." There was silence, until Providence spoke: "Your courage blinds you to the truth, that your overconfidence would doom you." Providence: In a time lost to memory, there were four visionaries. With righteous fury, they slew a dragon, and their leader gorged Herself upon its auric soul of Flame. "The world is without guidance, and its people are filled with darkness." She said. There was silence, until Providence spoke once more. "Let us go forth, and light the world anew." And it was so. -Ravager: The mangled reincarnation of the God of Sacrifices, given life once more. Necromancers sworn to his faith returned his broken body to his temple, offering the only sacrifices they could to reverse his Death– their own lives. Yet, necromancy is an imperfect art, and the god has very little of his mind left, simply destroying all it comes across. +Ravager: The mangled reincarnation of the God of Sacrifices, given life once more. Necromancers sworn to his faith returned his broken body to his temple, offering their own lives as sacrifice so they could reverse his Death. Yet, necromancy is an imperfect art, and the god has very little of his mind left, simply destroying all it comes across. Signus: "'For any desire, there is a price'. A deal bound in Onyx and sealed in blood, and one can have any wish granted– a gateway, a promise, a betrayal. Curiously, there is no recorded history of Signus before the age of gods, and very little recorded to this day. Perhaps, for the right price, one might find out the truth of Signus for oneself." SlimeGodPaladin: The Slime God avoids direct combat due to its weakness, instead choosing to mold guardians to protect it. These guardians were created from countless blight slimes, their filth acting as a counterweight to the purity of their god. SlimeGodCore: Despite being a Gluttonous slime, the Slime God forbids itself from growing out of control to maintain the balance of the world. It was still pursued during the Crusade, but it managed to survive through countless strategic retreats. The duty it upholds and the methods it employs are the reason the Onyx Kinsmen worship such a puny deity. diff --git a/Localization/en-US/Mods.CalamityMod.Biomes.hjson b/Localization/en-US/Mods.CalamityMod.Biomes.hjson index aa99aff816..b3057f8810 100644 --- a/Localization/en-US/Mods.CalamityMod.Biomes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Biomes.hjson @@ -76,26 +76,6 @@ AstralUnderground: { TownNPCDialogueName: Underground Astral Infection } -SunkenSeaBurrowsBiome: { - DisplayName: Sunken Sea Burrows Biome - TownNPCDialogueName: the Sunken Sea Burrows Biome -} - -SunkenSeaPolypBiome: { - DisplayName: Sunken Sea Polyp Biome - TownNPCDialogueName: the Sunken Sea Polyp Biome -} - -SunkenSeaReefsBiome: { - DisplayName: Sunken Sea Reefs Biome - TownNPCDialogueName: the Sunken Sea Reefs Biome -} - -SunkenSeaShoresBiome: { - DisplayName: Sunken Sea Shores Biome - TownNPCDialogueName: the Sunken Sea Shores Biome -} - AstralCaveDesert: { DisplayName: Astral Cave Desert TownNPCDialogueName: the Astral Cave Desert @@ -105,3 +85,28 @@ FloralParadiseBiome: { DisplayName: Floral Paradise TownNPCDialogueName: the Floral Paradise } + +BasaltGullyBiome: { + DisplayName: Basalt Gully Biome + TownNPCDialogueName: the Basalt Gully Biome +} + +GleamingBurrowsBiome: { + DisplayName: Gleaming Burrows Biome + TownNPCDialogueName: the Gleaming Burrows Biome +} + +PolypForestBiome: { + DisplayName: Polyp Forest Biome + TownNPCDialogueName: the Polyp Forest Biome +} + +RadiantReefsBiome: { + DisplayName: Radiant Reefs Biome + TownNPCDialogueName: the Radiant Reefs Biome +} + +TimelessShoresBiome: { + DisplayName: Timeless Shores Biome + TownNPCDialogueName: the Timeless Shores Biome +} diff --git a/Localization/en-US/Mods.CalamityMod.BossChecklistIntegration.hjson b/Localization/en-US/Mods.CalamityMod.BossChecklistIntegration.hjson index c5075a5d7b..1887130660 100644 --- a/Localization/en-US/Mods.CalamityMod.BossChecklistIntegration.hjson +++ b/Localization/en-US/Mods.CalamityMod.BossChecklistIntegration.hjson @@ -116,7 +116,7 @@ HiveMind: { Leviathan: { EntryName: Anahita & The Leviathan - SpawnInfo: Defeat an elusive singer in the ocean… + SpawnInfo: Defeat an elusive singer in the ocean or use a [i:CalamityMod/NaiadsWarhorn] in the ocean. DespawnMessage: "[c/7FFFD4:The aquatic outcasts return to their lonesome company.]" } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 42c88f0356..67845293c8 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1,3 +1,4 @@ +// Alcohols (including Odd Mushroom) AlcoholPoisoning: { DisplayName: Alcohol Poisoning Description: You drank too much and you are now dying @@ -10,7 +11,7 @@ BloodyMaryBuff: { CaribbeanRumBuff: { DisplayName: Caribbean Rum - Description: Life regen, movement speed, and wing flight time increased, you are floaty and defense is reduced + Description: Life regen and movement speed increased, you are floaty and defense is reduced } CinnamonRollBuff: { @@ -18,6 +19,11 @@ CinnamonRollBuff: { Description: Mana regen rate and fire debuff damage increased, defense reduced } +CirrusVodkaBuff: { + DisplayName: Fab + Description: You feel fabulous +} + EverclearBuff: { DisplayName: Everclear Description: Damage increased, life regen and defense reduced @@ -28,11 +34,6 @@ EvergreenGinBuff: { Description: Sickness and water debuff damage increased, life regen reduced } -FabsolVodkaBuff: { - DisplayName: Fab - Description: You feel fabulous -} - FireballBuff: { DisplayName: Fireball Description: Fire debuff damage increased, life regen reduced @@ -60,7 +61,7 @@ MoscowMuleBuff: { OldFashionedBuff: { DisplayName: Old Fashioned - Description: Accessory and set bonus damage multiplied, damage reduced + Description: Non-weapon damage increased, weapon damage reduced } RedWineBuff: { @@ -95,7 +96,7 @@ TequilaSunriseBuff: { Trippy: { DisplayName: Trippy - Description: You see the world for what it truly is... and you also have a 50% increase to all damage + Description: You see the world for what it truly is... and you also have a {0}% increase to all damage } VodkaBuff: { @@ -113,16 +114,23 @@ WhiteWineBuff: { Description: Magic damage increased, life regen and defense reduced } +// Cooldowns Withered: { DisplayName: Withered Description: Holding withered weapons causes you to suffer but makes your weapons strong } +// Damage over time AstralInfectionDebuff: { DisplayName: Astral Infection Description: Your flesh is melting off } +AuricRebuke: { + DisplayName: Auric Rebuke + Description: Your cells are violently bouncing off each other +} + BanishingFire: { DisplayName: Banishing Fire Description: You shall not be forgiven for your sins @@ -143,6 +151,11 @@ BrainRot: { Description: Your neurons are popping like corn kernels } +DemonicFlames: { + DisplayName: Demonic Flames + Description: Immolating flames sear your soul +} + ElementalMix: { DisplayName: Elemental Mix Description: A beautiful elemental symphony is flaying you alive @@ -163,21 +176,16 @@ Dragonfire: { Description: Engulfed by roaring flames } -VermillionFlux: { - DisplayName: Vermillion Flux - Description: Sharp arcs of scarlet course through you -} - -StaticDischarge: { - DisplayName: Static Discharge - Description: Shocked by static electricity -} - GodSlayerInferno: { DisplayName: God Slayer Inferno Description: Your flesh is burning off } +HeavyBleeding: { + DisplayName: Heavy Bleeding + Description: That's gonna need stitches +} + HolyFlames: { DisplayName: Holy Flames Description: Dissolving from holy light @@ -238,16 +246,36 @@ SnapClamDebuff: { Description: Clapped by Snap Clams } +StaticDischarge: { + DisplayName: Static Discharge + Description: Shocked by static electricity +} + SulphuricPoisoning: { DisplayName: Sulphuric Poisoning Description: The acidic water burns away your flesh } +TrueVulnerabilityHex: { + DisplayName: True Vulnerability Hex + Description: The end has come +} + Vaporfied: { DisplayName: Vaporfied Description: Vape } +VermillionFlux: { + DisplayName: Vermillion Flux + Description: Sharp arcs of scarlet course through you +} + +Voidfrost: { + DisplayName: Voidfrost + Description: The emptiness of space devours all warmth and life +} + VulnerabilityHex: { DisplayName: Vulnerability Hex Description: Your mental fortitude is fading @@ -258,6 +286,7 @@ WeakBrimstoneFlames: { Description: Using the Supreme Witch's power causes you to suffer, but makes your weapons strong } +// Mounts AlicornBuff: { DisplayName: Alicorn Description: You beat DoG while drunk, you are truly fabulous! @@ -288,6 +317,11 @@ DraedonGamerChairBuff: { Description: Riding a physics defying gamer chair } +ExoTankBuff: { + DisplayName: Rainbow Road Roller + Description: Your foes shall fall within your calculations +} + GazeOfCrysthamyrBuff: { DisplayName: Gaze of Crysthamyr Description: You are riding a shadow dragon @@ -318,6 +352,7 @@ TheCartofGodsBuff: { Description: Riding a cosmic terror } +// Pets AkatoBuff: { DisplayName: Akato Description: Looks like you'll have to take care of it now @@ -468,6 +503,7 @@ YharonSonBuff: { Description: You better not eat his dinner } +// Placeables ChaosCandleBuff: { DisplayName: Chaos Candle Description: Spawn rates around the candle are boosted! @@ -513,16 +549,7 @@ TranquilityCandleBuff: { Description: Spawn rates around the candle are reduced! } -PopoBuff: { - DisplayName: Popo - Description: You are a snowman now! -} - -PopoNoselessBuff: { - DisplayName: Noseless Popo - Description: Your nose has been stolen! -} - +// Potions AnechoicCoatingBuff: { DisplayName: Anechoic Coating Description: Abyssal creatures' detection ranges reduced @@ -545,12 +572,12 @@ BloodfinBoost: { BoundingBuff: { DisplayName: Bounding - Description: Increased jump height, jump speed, and fall damage resistance + Description: Increased jump speed and height } CalciumBuff: { DisplayName: Calcium - Description: You are immune to fall damage + Description: You take {0}% less knockback } CeaselessHunger: { @@ -560,7 +587,7 @@ CeaselessHunger: { GravityNormalizerBuff: { DisplayName: Gravity Normalizer - Description: Gravity is now normal in space, immunity to distorted + Description: Gravity is now normal in space, immunity to {$BuffName.VortexDebuff} } Omniscience: { @@ -570,7 +597,7 @@ Omniscience: { PhotosynthesisBuff: { DisplayName: Photosynthesis - Description: Life regen boosted, more during daytime, and hearts heal more HP + Description: Hearts heal {0} more HP } ShadowBuff: { @@ -578,18 +605,13 @@ ShadowBuff: { Description: ''' You are a shadow - Rogue weapons spawn projectiles on hit - 8% boosted stealth generation + {0}% increased stealth generation ''' } Soaring: { DisplayName: Soaring - Description: - ''' - 10% increased wing flight time and speed - True melee hits restore some wing flight time - ''' + Description: "{0}% increased wing flight time and speed" } SulphurskinBuff: { @@ -597,11 +619,6 @@ SulphurskinBuff: { Description: The sulphuric waters have a lesser effect on you } -TeslaBuff: { - DisplayName: Tesla's Electricity - Description: Summons an aura of electricity -} - WeaponImbueBrimstone: { DisplayName: Weapon Imbue: Brimstone Description: Melee, Whip, and Rogue attacks ignite enemies with brimstone flames @@ -627,9 +644,14 @@ Zerg: { Description: Spawn rates are greatly boosted } -RancorBurn: { - DisplayName: Rancor Burn - Description: Burning +// Stat buffs +AbsorberRegen: { + DisplayName: Regeneraga + Description: + ''' + You are blessed by the culmimation of nature's powers + Life regen increased by {0} HP/s, damage increased by {1}%, damage reduction increased by {2}% + ''' } AbyssalDivingSuitBuff: { @@ -639,7 +661,7 @@ AbyssalDivingSuitBuff: { AbyssalDivingSuitPlates: { DisplayName: Abyssal Diving Suit Plates - Description: 15% increased damage reduction + Description: "{0}% increased damage reduction" } AbyssalMadness: { @@ -649,7 +671,16 @@ AbyssalMadness: { AdrenalineMode: { DisplayName: Adrenaline Mode - Description: Total damage multiplied by 2.5x. Can be boosted by other items up to 3.1x + Description: Total damage multiplied by {0}x +} + +AeolianEarthBuff: { + DisplayName: Aeolian Earth + Description: + ''' + You are strengthened by primordial powers + Damage reduction increased by {0}%, damage increased by {1}% + ''' } Afflicted: { @@ -674,7 +705,7 @@ AquaticHeartBuff: { AquaticHeartWaterSpeed: { DisplayName: Ocean's Blessing - Description: 15% increased max speed and acceleration + Description: "{0}% increased max speed and acceleration" } AvertorBonus: { @@ -705,7 +736,7 @@ BrimflameFrenzyBuff: { BrutalCarnage: { DisplayName: Brutal Carnage - Description: 20% increased melee damage + Description: "{0}% increased melee damage" } ChiBuff: { @@ -720,7 +751,7 @@ ChiRegenBuff: { CoralSymbiosis: { DisplayName: Coral Symbiosis - Description: Coral Spout charges up faster and deals 2 extra damage + Description: Coral Spout charges up faster and deals {0} extra damage } CosmicFreeze: { @@ -745,7 +776,7 @@ EmpyreanWrath: { Encased: { DisplayName: Encased - Description: Increased defense by 30 and damage reduction by 30%, but... + Description: Increased defense by {0} and damage reduction by {1}%, but... } GraxBoost: { @@ -753,14 +784,19 @@ GraxBoost: { Description: Your defenses and muscles are strong } +GreenJellyRegen: { + DisplayName: Green Jelly Regen + Description: The regenerative goo empowers you, life regen increased by {0} HP/s +} + HallowedRuneDefense: { DisplayName: Hallowed Defense - Description: Increased defense by 8 and damage reduction by 4% + Description: Increased defense by {0} and damage reduction by {1}% } HallowedRunePower: { DisplayName: Hallowed Power - Description: 10% increased summon damage + Description: "{0}% increased summon damage" } HallowedRuneRegeneration: { @@ -775,22 +811,22 @@ Haste: { IceShieldBuff: { DisplayName: Ice Shield - Description: Absorbs 20% damage from the next hit you take, then shatters + Description: Absorbs {0}% damage from the next hit you take, then shatters } KamiBuff: { DisplayName: Kami Injection - Description: 15% increased max movement speed, acceleration and damage + Description: "{0}% increased max movement speed, acceleration and damage" } Mushy: { DisplayName: Mushy - Description: Increased defense by 6 and life regen by 1HP/s + Description: Increased defense by {0} and life regen by {1} HP/s } PhantomicEmpowerment: { DisplayName: Phantomic Empowerment - Description: 10% increased summon damage + Description: "{0}% increased summon damage" } PhantomicRegen: { @@ -802,11 +838,16 @@ PhantomicShield: { DisplayName: Phantomic Shield Description: ''' - Defense increased by 10 and damage reduction increased by 5% + Defense increased by {0} and damage reduction increased by {1}% An ephemeral bulwark protects you ''' } +PinkJellyRegen: { + DisplayName: Pink Jelly Regen + Description: The power of goo refreshes you, life regen increased by {0} HP/s +} + ProfanedCrystalBuff: { DisplayName: Devotion Description: You are an emissary of the profaned goddess now! @@ -841,7 +882,7 @@ ProfanedCrystalWhipBuff: { RageMode: { DisplayName: Rage Mode - Description: Total damage multiplied by 1.35x + Description: Total damage multiplied by {0}x } ReaverRage: { @@ -849,23 +890,32 @@ ReaverRage: { Description: ''' Rage of the earth - Defense increased by 5 and damage increased by 10% + Defense increased by {0} and damage increased by {1}% + ''' +} + +SandsWindBuff: { + DisplayName: Sand's Wind + Description: + ''' + You are strengthened by the powers of sand + Defense increased by {0}, damage increased by {1}% ''' } SilvaRevival: { DisplayName: Silva Immunity - Description: You are unkillable and immune to most debuffs + Description: Silva's blessing makes you invulnerable and immune to most debuffs } SpiritDefense: { DisplayName: Spirit Defense - Description: Defense increased by 6 and damage reduction increased by 3% + Description: Defense increased by {0} and damage reduction increased by {1}% } SpiritPower: { DisplayName: Spirit Power - Description: 10% increased summon damage + Description: "{0}% increased summon damage" } SpiritRegen: { @@ -875,7 +925,7 @@ SpiritRegen: { TarragonCloak: { DisplayName: Tarragon Cloak - Description: 50% reduced contact damage + Description: "{0}% reduced contact damage" } TarragonImmunity: { @@ -888,6 +938,12 @@ TarraLifeRegen: { Description: Rapid healing } +// Stat debuffs +AbsorberAffliction: { + DisplayName: Absorber Affliction + Description: Damn nature, you scary! +} + AndromedaCripple: { DisplayName: Andromeda Cripple Description: You're slow @@ -912,14 +968,14 @@ DoGExtremeGravity: { DisplayName: Extreme Gravity Description: ''' - 25% decreased wing time + {0}% decreased wing time Infinite flight is disabled ''' } Enraged: { DisplayName: Enraged - Description: Total damage multiplied by 2.25x, but you take 1.25x damage + Description: Total damage multiplied by 1.5x, but you take 1.25x damage } Eutrophication: { @@ -952,11 +1008,16 @@ GlacialState: { Description: Cannot move } +HadopelagicPressure: { + DisplayName: Hadopelagic Pressure + Description: Rapidly sinking to a watery grave +} + IcarusFolly: { DisplayName: Icarus' Folly Description: ''' - 33% decreased wing time + {0}% decreased wing time Infinite flight is disabled ''' } @@ -983,7 +1044,7 @@ PearlAura: { ProfanedWeakness: { DisplayName: Profaned Weakness - Description: You do less damage + Description: You take more damage } TemporalSadness: { @@ -1016,15 +1077,21 @@ WitherDebuff: { Description: ''' Withered... - Defense decreased by 20 + Defense decreased by {0} ''' } +// Summons AbandonedSlimeBuff: { DisplayName: Astral Jelly Description: Back from the heavens just to protect you! } +AmphibiansGuitarBuff: { + DisplayName: Amphibian's Guitars + Description: Worthless human... +} + AncientMineralSharkBuff: { DisplayName: Ancient Mineral Shark Description: So ancient yet just as powerful @@ -1195,6 +1262,11 @@ FieryDraconidBuff: { Description: The fiery draconid will protect you } +FlarebatBuff: { + DisplayName: Flarebat + Description: The construct of fire will protect you +} + FleshBallBuff: { DisplayName: Flesh Ball Description: Why is it following you? @@ -1205,6 +1277,11 @@ FlowersOfMortalityBuff: { Description: Celestial blossoms surround you } +FrostbatBuff: { + DisplayName: Frostbat + Description: The construct of ice will protect you +} + FrostBlossomBuff: { DisplayName: Frost Blossom Description: A cold, prickly flower is floating uncomfortably close to you @@ -1275,6 +1352,11 @@ KingofConstellationsBuff: { Description: The celestial dragons will protect you } +LiliesOfFinalityBuff: { + DisplayName: Finality + Description: Remember our promise +} + LilPlaguebringerBuff: { DisplayName: Lil' Plaguebringer Description: The Plaguebringer will protect you @@ -1391,6 +1473,11 @@ SarosPossessionBuff: { Description: A radiant aura protects you } +SeashineSwordBuff: { + DisplayName: Seashine Sword + Description: A beautiful dance of crystalline blades... +} + SeaSnailBuff: { DisplayName: Sea Snail Description: Meow? @@ -1506,59 +1593,18 @@ WulfrumDroidBuff: { Description: The wulfrum droid will protect you } -PinkJellyRegen: { - DisplayName: Pink Jelly Regen - Description: The power of goo refreshes you, life regen increased by 2HP/s -} - -GreenJellyRegen: { - DisplayName: Green Jelly Regen - Description: The regenerative goo empowers you, life regen increased by 2.5HP/s -} - -AbsorberRegen: { - DisplayName: Regeneraga - Description: - ''' - You are blessed by the culmimation of nature's powers - Life regen increased by 3HP/s, damage increased by 8%, damage reduction increased by 5% - ''' -} - -AbsorberAffliction: { - DisplayName: Absorber Affliction - Description: Damn nature, you scary! -} - YoungDukeBuff: { DisplayName: Baby Boomer Description: The mutated fishron will intoxicate your foes } -LiliesOfFinalityBuff: { - DisplayName: Finality - Description: Remember our promise +// Misc +PopoBuff: { + DisplayName: Popo + Description: You are a snowman now! } -AuricRebuke: { - DisplayName: Auric Rebuke - Description: Your cells are violently bouncing off each other -} - -SandsWindBuff: { - DisplayName: Sand's Wind - Description: - ''' - You are strengthened by the powers of sand - Defense increased by 10, damage increased by 12% - ''' -} - -AeolianEarthBuff: { - DisplayName: Aeolian Earth - Description: - ''' - You are strengthened by primordial powers - Damage reduction increased by 8%, damage increased by 18% - ''' +PopoNoselessBuff: { + DisplayName: Noseless Popo + Description: Your nose has been stolen! } diff --git a/Localization/en-US/Mods.CalamityMod.Common.hjson b/Localization/en-US/Mods.CalamityMod.Common.hjson new file mode 100644 index 0000000000..c083073773 --- /dev/null +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -0,0 +1,63 @@ +AbyssLightLevel1: Provides a small amount of light in the abyss +AbyssLightLevel2: Provides a moderate amount of light in the abyss +AbyssLightLevel3: Provides a large amount of light in the abyss +AbyssBreathLevel1: Slightly reduces breath loss in the abyss +AbyssBreathLevel2: Moderately reduces breath loss in the abyss +AbyssBreathLevel3: Greatly reduces breath loss in the abyss +AlcoholWarning: Drinking more than 3 different alcohols might not end well with your liver +ArmorPenetration: Ignores {0} points of enemy Defense +CanMineUelibloom: Can mine Uelibloom Ore +NotConsumable: Not consumable +RogueDamage: "{0}% increased rogue damage" +RogueCrit: "{0}% increased rogue critical strike chance" +RogueVelocity: "{0}% increased rogue velocity" +DodgeInformation: + ''' + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 20 and 90 seconds depending on the dodged attack's damage + This cooldown is shared with all other dodges and reflects + ''' +ReflectInformation: + ''' + Projectiles that deal less than 5% of your max life in damage will not be reflected + The reflect has a cooldown that ranges between 20 and 90 seconds depending on the reflected projectile's damage + This cooldown is shared with all other dodges and reflects + ''' +GrappleStats: + ''' + Reach: {0} tiles + Launch Velocity: {1} + Reelback Velocity: {2} + Pull Velocity: {3} + ''' +WingStats: + ''' + Flight time: {0} seconds + Max horizontal speed: {1} mph + Max vertical speed: {2} mph + ''' +WingStatsAcceleration: + ''' + Horizontal acceleration: {0} mph/s + Vertical acceleration: + {1} mph/s + {2} mph/s if ascending slower than {3} mph + {4} mph/s if ascending while falling + ''' +WingStatsHover: + ''' + Max hover speed: {0} mph + Hover acceleration: {1} mph/s + ''' +YoyoStats: + ''' + Reach: {0} tiles + Speed: {1} + Duration: {2} seconds + ''' +YoyoStatsInfinite: + ''' + Reach: {0} tiles + Speed: {1} + Infinite throw duration + ''' diff --git a/Localization/en-US/Mods.CalamityMod.Condition.hjson b/Localization/en-US/Mods.CalamityMod.Condition.hjson index fa96db8c5d..99fdd6fa50 100644 --- a/Localization/en-US/Mods.CalamityMod.Condition.hjson +++ b/Localization/en-US/Mods.CalamityMod.Condition.hjson @@ -1,7 +1,7 @@ // Drop conditions Drops: { - CataclysmKilledLast: Drops if defeated after {$Mods.CalamityMod.NPCs.Catastrophe.DisplayName} - CatastropheKilledLast: Drops if defeated after {$Mods.CalamityMod.NPCs.Cataclysm.DisplayName} + CataclysmKilledLast: Drops if defeated after {$NPCs.Catastrophe.DisplayName} + CatastropheKilledLast: Drops if defeated after {$NPCs.Cataclysm.DisplayName} Cynosure: After defeating both Draedon and Calamitas DownedDS: After defeating the Desert Scourge DownedCrab: After defeating Crabulon @@ -41,17 +41,7 @@ Drops: { DownedT2AR: After defeating the second tier of Acid Rain FirstKill: Drops only on the first kill MechBoss: Drops on the first kill of the final Mechanical Boss - ProvidenceHallow: - ''' - Drops if Providence was summoned in the Hallow - or if Providence is only attacked during nighttime - ''' - ProvidenceUnderworld: - ''' - Drops if Providence was summoned in the Underworld - or if Providence is only attacked during nighttime - ''' - ProvidenceNight: Drops if Providence is only attacked during nighttime + ProvidenceEnraged: Drops if Providence has been enraged ProvidenceChallenge: ''' Drops if Providence was defeated only with the [i:CalamityMod/ProfanedSoulArtifact] Profaned Soul Artifact @@ -70,7 +60,7 @@ InCrag: In the Brimstone Crags InSulph: In the Sulphurous Sea InSunken: In the Sunken Sea InRev: In Revengeance Mode -IsRevOrMM: In Revengeance Mode or in Master Mode +InRevOrMM: In Revengeance Mode or in Master Mode AlcoholPoison: While inflicted with Alcohol Poisoning PostCal: After defeating Calamitas Clone PostAureus: After defeating Astrum Aureus diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index 821007ffbc..61bb06bf81 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -1,14 +1,13 @@ -CalamityConfig: { - DisplayName: Main Config +CalamityClientConfig: { + DisplayName: Client Config Headers: { - ExpertMaster: Expert and Master Mode Changes Gameplay: General Gameplay Changes Graphics: Graphics Changes - Revengeance: Revengeance Mode Changes UI: UI Changes - BaseBoosts: Base Stat Boosts - MusicEvents: Music Events + MeterPositions: Meter Positions + MusicEvents: In-Game Music Events + Multithreading: Multi-Threading } AdrenalineMeterPosX: { @@ -38,15 +37,6 @@ CalamityConfig: { ''' } - BossesStopWeather: { - Label: "[i:CalamityMod/TorrentialTear] Bosses Stop Weather" - Tooltip: - ''' - When enabled, many late game bosses will stop all rain and related weather when spawned. - Enable if you have performance issues during late game boss fights. - ''' - } - BossHealthBarExtraInfo: { Label: "[i:CalamityMod/EncryptedSchematicPlanetoid] Boss Health Bar Extra Info" Tooltip: @@ -56,35 +46,6 @@ CalamityConfig: { ''' } - BossHealthBoost: { - Label: "[i:LifeCrystal] Boss Health Boost Percentage" - Tooltip: - ''' - Globally boosts the health of all bosses by the specified percentage. - This stacks with multiplayer boss health boosts. - Does not affect bosses that are already spawned. - ''' - } - - DefaultDashEnabled: { - Label: "[i:Tabi] Default Dash" - Tooltip: - ''' - Gives the player a very weak dash by default that requires no equipment or items to use. - This dash will be replaced by any other available dash, including those from other mods. - ''' - } - - BossZen: { - Label: "[i:CalamityMod/ZenPotion] Bosses Drastically Reduce Spawn Rates" - Tooltip: - ''' - All living bosses will drastically reduce the spawn rates of regular enemies. - This also prevents Slime Rain from occurring while a boss is alive. - Calamity is balanced around this setting being enabled. - ''' - } - ChargeMeter: { Label: "[i:CalamityMod/DraedonPowerCell] Display Charge Meter" Tooltip: @@ -112,11 +73,6 @@ CalamityConfig: { ''' } - ChilledWaterRework: { - Label: "[i:ArcticDivingGear] Chilled Water Rework" - Tooltip: When enabled, water in the Snow and Ice biomes will rapidly drain the player's breath instead of inflicting Chilled. - } - CooldownDisplay: { Label: "[i:CalamityMod/NebulousCore] Cooldown Rack Display Mode" Tooltip: @@ -136,34 +92,21 @@ CalamityConfig: { Tooltip: Plays Calamity Mod OST - "Scourge of the Universe (Eulogy for the Ego)", after the Devourer of Gods has been defeated. } - EarlyHardmodeProgressionRework: { - Label: "[i:Pwnhammer] Early Hardmode Progression Rework" + EnableVanillaTextureEdits: { + Label: "[i:Paintbrush] Enable Vanilla Texture Edits" Tooltip: ''' - 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% (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. + Enables slight edits to vanilla boss textures to improve attack telegraphs. + Disable this for compatibility with texture packs. ''' } - FasterBaseSpeed: { - Label: "[i:HermesBoots] Increase Base Movement Speed" + EnergyShieldOpacity: { + Label: "[i:CalamityMod/TheSponge] Energy Shield Opacity" Tooltip: ''' - Increases the player's base movement speed substantially by always giving them +50% movement speed. - This setting does nothing if the mod Terraria Overhaul is loaded. - Calamity is balanced around this setting being enabled. - ''' - } - - FasterRopeClimbSpeed: { - Label: "[i:Rope] Increase Rope Climb Speed" - Tooltip: - ''' - Increases the player's rope climb speed substantially by increasing acceleration and deceleration while on a rope. - Calamity is balanced around this setting being enabled. + Set the opacity of energy shields rendered over the player. + Setting this to 0 disables energy shield visuals entirely. ''' } @@ -177,24 +120,6 @@ CalamityConfig: { ''' } - FasterJumpSpeed: { - Label: "[i:FrogLeg] Increase Base Jump Speed" - Tooltip: - ''' - Slightly increases the player's base jump speed. - Calamity is balanced around this setting being enabled. - ''' - } - - FasterTilePlacement: { - Label: "[i:ArchitectGizmoPack] Increase Base Building Speed" - Tooltip: - ''' - Substantially increases how rapidly the player can place tiles and walls. - This config stacks with the Brick Layer, Portable Cement Mixer and other accessories. - ''' - } - FlightBar: { Label: "[i:CalamityMod/DrewsWings] Display Flight Bar" Tooltip: @@ -223,24 +148,6 @@ CalamityConfig: { ''' } - ForceTownSafety: { - Label: "[i:Sunflower] Force Town Safety" - Tooltip: - ''' - Counteracts Expert and Master Mode allowing enemies to spawn near towns by vastly decreasing spawn rates. - This can have unintended side effects such as making critters difficult to find. - ''' - } - - HigherJumpHeight: { - Label: "[i:ShinyRedBalloon] Increase Base Jump Height" - Tooltip: - ''' - Increases the player's base jump height by 10% so that they can jump 7 tiles. - Calamity is balanced around this setting being enabled. - ''' - } - Interlude1: { Label: "[i:CalamityModMusic/Interlude1MusicBox] Interlude 1" Tooltip: Plays Calamity Mod OST - "Silence before the storms", after Calamitas Clone has been defeated. @@ -265,33 +172,6 @@ CalamityConfig: { ''' } - MusicModReminderMessage: { - Label: "[i:MusicBoxMartians] Music Mod Reminder Message" - Tooltip: - ''' - Enable or disable the status message which reminds users to install the Calamity Music Mod. - This message plays on world entry. - ''' - } - - NerfExpertDebuffs: { - Label: "[i:AnkhCharm] Remove Increased Debuff Duration" - Tooltip: - ''' - Disables Expert Mode doubling (and Master Mode tripling) the duration of debuffs on the player. - Calamity is balanced around this setting being enabled. - ''' - } - - 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: @@ -303,6 +183,16 @@ CalamityConfig: { ''' } + Photosensitivity: { + Label: "[i:DiscoBall] Photosensitivity Mode" + Tooltip: + ''' + Reduces or disables the brightness and/or flashiness of certain visual effects. + Also disables all screenshake effects. + Highly recommended if you are photosensitive. + ''' + } + RageMeterPosX: { Label: "[i:LaserRuler] Rage Meter X Position" Tooltip: @@ -321,20 +211,6 @@ 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: - ''' - Removes randomness from the Goblin Tinkerer's reforges for both weapons and accessories. - Disable this if using mods that change reforging on their own to prevent conflicts. - ''' - } - RipperMeterShake: { Label: "[i:CalamityMod/RedLightningContainer] Rage and Adrenaline Meter Shake" Tooltip: @@ -442,12 +318,172 @@ CalamityConfig: { ''' } - PotionSelling: { - Label: "[i:SpelunkerPotion] Town NPC Potion Selling" + VanillaCooldownDisplay: { + Label: "[i:HealingPotion] Display Vanilla Cooldowns" Tooltip: ''' - Allows town NPCs to sell various potions. - Certain potions are sold after specific bosses have been defeated. + Adds the vanilla effects Potion Sickness, Chaos State, and Holy Protection to the Cooldown Rack. + The debuffs will still appear in the buffs array, but this may help make them more visible. + ''' + } + + VCMMStatusMessage: { + Label: "[i:MusicBoxMartians] VCMM Status Message" + Tooltip: Enable or disable the status message promoting the Vanilla Calamity Music Mod that plays on world entry. + } + + WikiStatusMessage: { + Label: "[i:Book] Wiki Status Message" + Tooltip: Enable or disable the status message promoting the Official Calamity Wiki that plays on world entry. + } + + MultiThreadingType: { + Label: Sunken Sea Multi-Threading Option + Tooltip: + ''' + Option 0 will disable worldgen multi-threading. + Option 1 will enable ReLogic's multi-threading. + Option 2 will enable custom multi-threading. + ''' + } + + SunkenSeaMultiThreading: { + Label: Sunken Sea Multi Threading + Tooltip: "" + } +} + +CalamityServerConfig: { + DisplayName: Server Config + Denied: You have no permission to change this config + + Headers: { + ExpertMaster: Expert and Master Mode Changes + Gameplay: General Gameplay Changes + BaseBoosts: Base Stat Boosts + } + + BossesStopWeather: { + Label: "[i:CalamityMod/TorrentialTear] Bosses Stop Weather" + Tooltip: + ''' + When enabled, many late game bosses will stop all rain and related weather when spawned. + Enable if you have performance issues during late game boss fights. + ''' + } + + BossHealthBoost: { + Label: "[i:LifeCrystal] Boss Health Boost Percentage" + Tooltip: + ''' + Globally boosts the health of all bosses by the specified percentage. + This stacks with multiplayer boss health boosts. + Does not affect bosses that are already spawned. + ''' + } + + DefaultDashEnabled: { + Label: "[i:Tabi] Default Dash" + Tooltip: + ''' + Gives the player a very weak dash by default that requires no equipment or items to use. + This dash will be replaced by any other available dash, including those from other mods. + ''' + } + + BossZen: { + Label: "[i:CalamityMod/ZenPotion] Bosses Drastically Reduce Spawn Rates" + Tooltip: + ''' + All living bosses will drastically reduce the spawn rates of regular enemies. + This also prevents Slime Rain from occurring while a boss is alive. + Calamity is balanced around this setting being enabled. + ''' + } + + ChilledWaterRework: { + Label: "[i:ArcticDivingGear] Chilled Water Rework" + Tooltip: When enabled, water in the Snow and Ice biomes will rapidly drain the player's breath instead of inflicting Chilled. + } + + EarlyHardmodeProgressionRework: { + Label: "[i:Pwnhammer] Early Hardmode Progression Rework" + Tooltip: + ''' + 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% (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. + ''' + } + + FasterBaseSpeed: { + Label: "[i:HermesBoots] Increase Base Movement Speed" + Tooltip: + ''' + Increases the player's base movement speed substantially by always giving them +50% movement speed. + This setting does nothing if the mod Terraria Overhaul is loaded. + Calamity is balanced around this setting being enabled. + ''' + } + + FasterRopeClimbSpeed: { + Label: "[i:Rope] Increase Rope Climb Speed" + Tooltip: + ''' + Increases the player's rope climb speed substantially by increasing acceleration and deceleration while on a rope. + Calamity is balanced around this setting being enabled. + ''' + } + + FasterJumpSpeed: { + Label: "[i:FrogLeg] Increase Base Jump Speed" + Tooltip: + ''' + Slightly increases the player's base jump speed. + Calamity is balanced around this setting being enabled. + ''' + } + + FasterTilePlacement: { + Label: "[i:ArchitectGizmoPack] Increase Base Building Speed" + Tooltip: + ''' + Substantially increases how rapidly the player can place tiles and walls. + This config stacks with the Brick Layer, Portable Cement Mixer and other accessories. + ''' + } + + ForceTownSafety: { + Label: "[i:Sunflower] Force Town Safety" + Tooltip: + ''' + Counteracts Expert and Master Mode allowing enemies to spawn near towns by vastly decreasing spawn rates. + This can have unintended side effects such as making critters difficult to find. + ''' + } + + NerfExpertDebuffs: { + Label: "[i:AnkhCharm] Remove Increased Debuff Duration" + Tooltip: + ''' + Disables Expert Mode doubling (and Master Mode tripling) the duration of debuffs on the player. + Calamity is balanced around this setting being enabled. + ''' + } + + 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: + ''' + Removes randomness from the Goblin Tinkerer's reforges for both weapons and accessories. + Disable this if using mods that change reforging on their own to prevent conflicts. ''' } @@ -477,23 +513,4 @@ CalamityConfig: { This includes the Old Man. ''' } - - VanillaCooldownDisplay: { - Label: "[i:HealingPotion] Display Vanilla Cooldowns" - Tooltip: - ''' - Adds the vanilla debuffs Potion Sickness and Chaos State to the Cooldown Rack. - The debuffs will still appear in the buffs array, but this may help make them more visible. - ''' - } - - VCMMStatusMessage: { - Label: "[i:MusicBoxMartians] VCMM Status Message" - Tooltip: Enable or disable the status message promoting the Vanilla Calamity Music Mod that plays on world entry. - } - - WikiStatusMessage: { - Label: "[i:Book] Wiki Status Message" - Tooltip: Enable or disable the status message promoting the Official Calamity Wiki that plays on world entry. - } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 880417844b..9fbc0e3b60 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -2,10 +2,7 @@ AureateBooster: { DisplayName: Aureate Booster Tooltip: ''' - Horizontal speed: 8.00 - Acceleration multiplier: 1.5 - Good vertical speed - Flight time: 120 + {$CommonItemTooltip.FlightAndSlowfall} 'Mach speed with style!' ''' } @@ -14,10 +11,7 @@ DrewsWings: { DisplayName: Drew's Wings Tooltip: ''' - Horizontal speed: 11.50 - Acceleration multiplier: 2.9 - Excellent vertical speed - Flight time: 361 + {$CommonItemTooltip.FlightAndSlowfall} 'Absolutely Fabulous' ''' } @@ -26,11 +20,8 @@ ElysianWings: { DisplayName: Elysian Wings Tooltip: ''' - Horizontal speed: 9.50 - Acceleration multiplier: 2.7 - Great vertical speed - Flight time: 240 - Immunity to lava and 10% increased movement speed + {$CommonItemTooltip.FlightAndSlowfall} + 10% increased movement speed and grants immunity to lava Blessed by the Profaned Flame ''' } @@ -39,11 +30,8 @@ ExodusWings: { DisplayName: Exodus Wings Tooltip: ''' - Horizontal speed: 9.00 - Acceleration multiplier: 2.5 - Great vertical speed - Flight time: 180 - 5% increased rogue damage and critical strike chance while wearing the Empyrean Armor + {$CommonItemTooltip.FlightAndSlowfall} + Grants permanent Empyrean Wrath and Empyrean Rage while wearing the Empyrean armor Pulsing with an alien heartbeat ''' } @@ -52,11 +40,7 @@ HadalMantle: { DisplayName: Hadal Mantle Tooltip: ''' - Horizontal speed: 7.75 - Acceleration multiplier: 1.5 - Average vertical speed - Flight time: 180 - 5% increased damage while wearing the Hydrothermic Armor + {$CommonItemTooltip.FlightAndSlowfall} Fueled by the fury of the depths ''' } @@ -65,10 +49,7 @@ HadarianWings: { DisplayName: Hadarian Wings Tooltip: ''' - Horizontal speed: 9.00 - Acceleration multiplier: 1.75 - Good vertical speed - Flight time: 90 + {$CommonItemTooltip.FlightAndSlowfall} {$CommonItemTooltip.PressDownToHover} Powered by the Astral Infection ''' @@ -78,11 +59,7 @@ MOAB: { DisplayName: MOAB Tooltip: ''' - Counts as wings - Horizontal speed: 6.50 - Acceleration multiplier: 1.0 - Good vertical speed - Flight time: 75 + {$CommonItemTooltip.FlightAndSlowfall} 32% increased jump speed and allows auto-jump Grants the player cloud, blizzard, and sandstorm mid-air jumps 'The Mother Of All Balloons' @@ -93,36 +70,23 @@ SilvaWings: { DisplayName: Silva Wings Tooltip: ''' - Horizontal speed: 10.50 - Acceleration multiplier: 2.8 - Excellent vertical speed - Flight time: 270 - The Silva revive heals you to half health while wearing the Silva armor + {$CommonItemTooltip.FlightAndSlowfall} + Grants a scaling life regeneration boost while you remain in the air without resetting flight time + This boost caps at 8 HP/s after 15 seconds 'The purest of nature' ''' } SkylineWings: { DisplayName: Skyline Wings - Tooltip: - ''' - Horizontal speed: 6.25 - Acceleration multiplier: 1.0 - Average vertical speed - Flight time: 80 - ''' + Tooltip: "{$CommonItemTooltip.FlightAndSlowfall}" } SoulofCryogen: { DisplayName: Soul of Cryogen Tooltip: ''' - Counts as wings - Horizontal speed: 6.25 - Acceleration multiplier: 1.0 - Average vertical speed - Flight time: 120 - 7% increase to all damage + {$CommonItemTooltip.FlightAndSlowfall} Icicles rain down as you fly ''' } @@ -131,11 +95,7 @@ StarlightWings: { DisplayName: Starlight Wings Tooltip: ''' - Horizontal speed: 7.50 - Acceleration multiplier: 1.0 - Average vertical speed - Flight time: 150 - 5% increased damage and critical strike chance while wearing the Daedalus Armor + {$CommonItemTooltip.FlightAndSlowfall} Wings of the Nightingale ''' } @@ -144,11 +104,8 @@ TarragonWings: { DisplayName: Tarragon Wings Tooltip: ''' - Horizontal speed: 9.50 - Acceleration multiplier: 2.5 - Great vertical speed - Flight time: 250 - +15 defense and +1 HP/s life regen while wearing the Tarragon Armor + {$CommonItemTooltip.FlightAndSlowfall} + +15 defense and +1 HP/s life regen 'Born of the jungle' ''' } @@ -157,11 +114,7 @@ TracersCelestial: { DisplayName: Celestial Tracers Tooltip: ''' - Counts as wings - Horizontal speed: 9.00 - Acceleration multiplier: 2.6 - Good vertical speed - Flight time: 140 + {$CommonItemTooltip.FlightAndSlowfall} 24% increased running acceleration and greater mobility on ice Provides the ability to walk on water, honey, and lava Grants immunity to fire and lava @@ -173,11 +126,7 @@ TracersElysian: { DisplayName: Elysian Tracers Tooltip: ''' - Counts as wings - Horizontal speed: 10.00 - Acceleration multiplier: 2.7 - Great vertical speed - Flight time: 180 + {$CommonItemTooltip.FlightAndSlowfall} 36% increased running acceleration and greater mobility on ice Provides the ability to walk on water, honey, and lava Grants immunity to fire and lava @@ -189,11 +138,7 @@ TracersSeraph: { DisplayName: Seraph Tracers Tooltip: ''' - Counts as wings - Horizontal speed: 11.00 - Acceleration multiplier: 2.8 - Excellent vertical speed - Flight time: 250 + {$CommonItemTooltip.FlightAndSlowfall} 50% increased running acceleration and greater mobility on ice Provides the ability to walk on water, honey, and lava Grants immunity to fire, lava, and harmful block effects diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index b99dbdecca..df6bdae49d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -8,15 +8,6 @@ Abaddon: { ''' } -AbyssalAmulet: { - DisplayName: Abyssal Amulet - Tooltip: - ''' - Attacks inflict Riptide and you are immune to it - While in the abyss you gain 10% increased max life - ''' -} - AbyssalDivingGear: { DisplayName: Abyssal Diving Gear Tooltip: @@ -42,7 +33,8 @@ AbyssalDivingSuit: { Grants the ability to swim, extends underwater breathing, emits light underwater, and improves mobility on ice Provides a moderate amount of light and reduces breath loss in the abyss Abyss creatures are less likely to see you, mitigates the abyss' defense reduction, and lets you sink faster in liquids - Grants immunity to the sulphurous waters + Grants immunity to the sulphurous waters and Crush Depth's increased breath loss + Grants resistance to the increased breath loss caused by Hadopelagic Pressure ''' } @@ -53,15 +45,13 @@ AbyssalMirror: { Enemies are less likely to target you, even in the abyss Generate stealth 25% faster when standing still and 12% faster while moving Grants the ability to dodge attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies - 'Light does not reach the depths of the ocean' ''' HoldShiftTooltip: ''' - 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 + {$Common.DodgeInformation} Dodging an attack gives stealth ''' + FlavorTooltip: "'Light does not reach the depths of the ocean'" } AeroStone: { @@ -83,7 +73,7 @@ AlchemicalFlask: { DisplayName: Alchemical Flask Tooltip: ''' - All attacks inflict the Plague and lessens damage taken from the Plague + All attacks inflict the Plague and reduces damage taken from the Plague Projectiles spawn plague seekers on enemy hits Releases plague bees when damaged and douses you in honey ''' @@ -93,9 +83,8 @@ AlluringBait: { DisplayName: Alluring Bait Tooltip: ''' - Increases fishing power by 30 - Greatly increases chance of catching potion ingredient fish - Potion ingredient fish yield is increased + Increases fishing power by 10 + Increases the yield of potion ingredient fish ''' } @@ -103,17 +92,13 @@ AmalgamatedBrain: { DisplayName: Amalgamated Brain Tooltip: ''' - 10% increased damage - Shade rains down and enemies are confused when hit, - and summon damage and crit chance are boosted by 10% + 5% increased damage + Taking damage confuses nearby enemies and spawns a dank creeper + The dank creeper flies above you, exploding into several shaderain clouds Grants the ability to dodge attacks + After dodging, summon damage and crit chance are boosted by 10% ''' - HoldShiftTooltip: - ''' - 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 - ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" } AmbrosialAmpoule: { @@ -129,16 +114,6 @@ AmbrosialAmpoule: { ''' } -AmidiasPendant: { - DisplayName: Amidias' Pendant - Tooltip: Periodically rains down prism shards that briefly stun enemies -} - -AmidiasSpark: { - DisplayName: Amidias' Spark - Tooltip: Taking damage releases a blast of sparks -} - AncientFossil: { DisplayName: Ancient Fossil Tooltip: Increases mining speed by 10% @@ -176,7 +151,7 @@ AngelTreads: { 36% increased running acceleration Increased flight time and grants rocket flight Provides water walking and extra mobility on ice - Immunity to On Fire! and temporary immunity to lava + Grants immunity to On Fire! and temporary immunity to lava 'Extreme speed!' ''' } @@ -212,6 +187,17 @@ AquaticHeart: { ''' } +ArcFlashRing: { + DisplayName: Arc Flash Ring + Tooltip: + ''' + Attacks have a 6% chance to call down a lightning bolt for 4x damage + The chance is reduced for each enemy an attack hits + The bolt's damage is based on non-crit damage, but can itself crit + Bolts are transparent and silent if visibility is disabled + ''' +} + ArchaicPowder: { DisplayName: Archaic Powder Tooltip: @@ -225,8 +211,8 @@ AscendantInsignia: { DisplayName: Ascendant Insignia Tooltip: ''' - Increases wing flight time by 30%, movement and jump speed by 10%, and acceleration by 1.1x - Pressing [KEY] will give you the power of ascension, providing infinite flight time for 4 seconds + Increases wing flight time by 50%, movement and jump speed by 15%, and acceleration by 1.5x + Pressing [KEY] grants you the power of ascension, providing infinite flight time for 4 seconds Ascension has a 40 second cooldown ''' } @@ -241,11 +227,11 @@ AsgardianAegis: { ''' HoldShiftTooltip: ''' - On Fire!, Hellfire, Chilled, Frozen, Frostburn, Frostbite, Weak, Broken Armor, - Bleeding, Poisoned, Acid Venom, Sulphuric Poisoning, Slow, Confused, - Silenced, Cursed, Darkness, Webbed, Mighty Wind, Stoned, Armor Crunch, - Blackout, Brain Rot, Burning Blood, Cursed Inferno, Brimstone Flames, - Shadowflame, Daybroken, Nightwither, Holy Flames, God Slayer Inferno, Burning + On Fire!, Hellfire, Burning, Chilled, Frozen, Frostburn, Frostbite, Weak, + Broken Armor, Bleeding, Poisoned, Acid Venom, Sulphuric Poisoning, Slow, Confused, + Silenced, Cursed, Darkness, Webbed, Mighty Wind, Stoned, Armor Crunch, Blackout, + Brain Rot, Burning Blood, Heavy Bleeding, Laceration, Cursed Inferno, Brimstone Flames, + Shadowflame, Daybroken, Nightwither, Holy Flames, Voidfrost, God Slayer Inferno ''' } @@ -292,6 +278,15 @@ Baroclaw: { ''' } +BlackGlassBand: { + DisplayName: Black Glass Band + Tooltip: + ''' + Enemy hits create an obsidian blast that always critically strikes + This effect has a 7 second cooldown, but is halved if the blast kills an enemy + ''' +} + BlazingCore: { DisplayName: Blazing Core Tooltip: @@ -299,10 +294,10 @@ BlazingCore: { The searing core of the Profaned Goddess Pressing [KEY] will activate a parry, encasing you in luminous profaned crystal Being hit shortly after encasement will shatter the crystal - Upon shattering, holy stars spiral outwards and you only take 1 damage + Upon shattering, holy stars spiral outwards and damage taken is negated After shattering, this damage reduction effect goes on cooldown Damage parried whilst on cooldown summons additional healing stars, and will not be reduced - Provides a moderate amount of light in the Abyss + {$Common.AbyssLightLevel2} ''' } @@ -320,6 +315,7 @@ BloodPact: { Tooltip: ''' Increases max HP by 25% + Grants immunity to Bleeding, Burning Blood and Heavy Bleeding Healing Potions are 25% more effective ''' } @@ -359,7 +355,7 @@ BlunderBooster: { 12% increased rogue damage and 15% increased rogue projectile velocity Stealth generates 10% faster Summons a red lightning aura around the player that electrifies nearby enemies - The aura's appearance can be toggled with visibility + The aura has reduced opacity if visibility is disabled Press [KEY] to consume 25% of your maximum stealth to perform a swift upwards diagonal dash This dash leaves a trail of red lightning bolts This effect has a 1 second cooldown before it can be used again @@ -372,6 +368,9 @@ Calamity: { ''' Lights your cursor ablaze with the Witch's flames, engulfing it in a blazing aura Enemies touching the blaze take immense damage and are inflicted with Vulnerability Hex + Focusing an enemy for 2.5 seconds curses them, ascending Vulnerability Hex to its True form + Foes afflicted with True Vulnerability Hex take 1.15x damage from all sources + This effect is increased to 2.5x for the blazing cursor itself Equip in a vanity slot to change the cursor without dealing damage These changes work in conjunction with the Rainbow Cursor ''' @@ -382,10 +381,11 @@ ChaliceOfTheBloodGod: { Tooltip: ''' Increases max HP by 25% + Grants immunity to Bleeding, Burning Blood, Heavy Bleeding and Laceration +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 + Taking more than 5 damage converts the hit into a damage over time bleed effect This bleeding does not interfere with life regeneration - Drinking a healing potion cancels up to 50% of its heal value in remaining bleed damage + Drinking a healing potion removes some of the remaining bleed, up to 50% of its heal value Unequipping this accessory while bleeding inflicts the remaining damage instantly 'All that for a drop of blood...' ''' @@ -406,7 +406,7 @@ CleansingJelly: { DisplayName: Cleansing Jelly Tooltip: ''' - Using a healing potion spawns a blue aura that lasts for 30 seconds + Using a healing potion spawns a blue aura that lasts for {0} seconds Walking into the aura removes all debuffs one time ''' } @@ -425,8 +425,9 @@ CorrosiveSpine: { Tooltip: ''' 5% increased movement speed - All rogue weapons inflict poison and spawn poisoned clouds on enemy hits - You release a ton of clouds everywhere on hit + Multiplies all sickness and water-related debuff damage by 1.25x + All attacks irradiate enemies and reduces the severity of the sulphuric waters + You burst into radioactive clouds when struck ''' } @@ -434,8 +435,8 @@ CorruptFlask: { DisplayName: Corrupt Flask Tooltip: ''' - Incerases damage reduction by 4% and defense by 6 while in the corruption - Immunity to Brain Rot + Increases damage reduction by 4% and defense by 6 while in the corruption + Grants immunity to Brain Rot ''' } @@ -463,7 +464,7 @@ CrimsonFlask: { Tooltip: ''' Increases damage reduction by 4% and defense by 6 while in the crimson - Immunity to Burning Blood + Grants immunity to Burning Blood ''' } @@ -491,19 +492,20 @@ DaawnlightSpiritOrigin: { DisplayName: Daawnlight Spirit Origin Tooltip: ''' - Places bullseyes on enemies and bosses that can be hit for massive damage - Converts all ranged critical strike chance into critical strike damage + All ranged weapons can supercrit when critical strike chance is over 100% + Marks enemies and bosses with bullseyes which boost critical strike chance when hit + Extra critical strike chance quickly fades over time Summons a heroic spirit from another world if visibility is on or in vanity slots ''' HoldShiftTooltip: ''' - All nearby enemies and bosses are marked with bullseyes - All ranged attacks that hit a bullseye critically strike and deal massive damage - Struck bullseyes vanish and a new one appears elsewhere - Explosions and large projectiles cannot hit bullseyes - Shots ricocheted off of tossed coins deal less bullseye damage - Converts all ranged critical strike chance into critical strike damage - Ranged weapons that are slow to use deal more bullseye damage + All ranged weapons can supercrit when critical strike chance is over 100% + Marks nearby enemies and bosses with bullseyes which disappear shortly after being hit + Ranged attacks which strike bullseyes boost critical strike chance + Large projectiles and explosions cannot strike bullseyes + Slower weapons give a larger critical strike chance boost on hit + Extra critical strike chance quickly fades over time + The higher the boost, the more quickly it fades away Summons a heroic spirit from another world if visibility is on or in vanity slots ''' FlavorTooltip: "'A strand of a lost cosmos remains, waiting for its master'" @@ -524,7 +526,7 @@ DarkSunRing: { DisplayName: Dark Sun Ring Tooltip: ''' - 12% increase to damage + 12% increased damage +0.5 HP/s life regen and +2 max minions Increased minion knockback Grants various buffs as the day goes on @@ -542,8 +544,9 @@ DeadshotBrooch: { DisplayName: Deadshot Brooch Tooltip: ''' - 10% increased ranged damage, 5% increased ranged critical strike chance and 20% reduced ammo usage - Greatly increases all ranged projectile velocity + 12% increased ranged damage, 7% increased ranged critical strike chance and 20% reduced ammo usage + Pressing [KEY] will automatically swap the order of ammos in your ammo slots + The ammo type swapped depends on the ammo of the weapon you are holding ''' } @@ -573,6 +576,7 @@ DepthCharm: { ''' Reduces the damage caused by drowning in the abyss Removes the bleed effect caused by the upper layers of the abyss + Removes the increased breath loss of Crush Depth ''' } @@ -614,7 +618,7 @@ DragonScales: { Rogue projectiles spawn slow fireballs as they travel Stealth strikes create infernados where they hit +10% max run speed and acceleration - Immunity to Dragonfire + Grants immunity to Dragonfire 'Only a living dragon holds true treasure' ''' } @@ -642,10 +646,8 @@ EclipseMirror: { ''' HoldShiftTooltip: ''' - 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 + {$Common.DodgeInformation} Dodging an attack grants a lot of stealth - This cooldown is shared with all other dodges and reflects ''' FlavorTooltip: "'Its reflection shows naught but darkness'" } @@ -655,7 +657,7 @@ EldritchSoulArtifact: { Tooltip: ''' Boosts melee speed by 10%, ranged velocity by 25%, rogue stealth regen by 15%, max minions by 1 and reduces mana cost by 25% - Immunity to Whispering Death + Grants immunity to Whispering Death Knowledge ''' } @@ -665,7 +667,7 @@ ElectriciansGlove: { Tooltip: ''' Stealth strikes summon sparks on enemy hits and heal you for 2 HP - Stealth strikes also have +8 armor penetration, deal 8% more damage + Stealth strikes also have +8 armor penetration and deal 8% more damage ''' } @@ -700,7 +702,12 @@ ElysianAegis: { EnchantedPearl: { DisplayName: Enchanted Pearl - Tooltip: Increases fishing power by 10 and crate catch chance by 10% + Tooltip: + ''' + Increases fishing power by 10 + Increases chance to catch crates and loot-containing fish by 15% + Crate catches are 25% more likely to be higher quality, accompanied by visual pearls + ''' } EtherealExtorter: { @@ -778,7 +785,7 @@ FrostBarrier: { Tooltip: ''' You will freeze nearby enemies when you are struck - Immunity to Chilled and Frostburn + Grants immunity to Chilled and Frostburn ''' } @@ -787,7 +794,7 @@ FrostFlare: { Tooltip: ''' All attacks and projectiles inflict Frostbite - Immunity to Frostburn, Chilled and Frozen + Grants 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 @@ -808,8 +815,8 @@ FungalSymbiote: { Tooltip: ''' You grow mushrooms on the grass beneath you - Consuming mushrooms provides the Mushy buff, granting 6 defense and +1 HP/s life regen - All mushroom-based weapons deal 10% more damage and emit harmless mushrooms + Consuming mushrooms provides the Mushy buff, granting 8 defense and +1 HP/s life regen + 10% increased damage while you have the Mushy buff ''' } @@ -819,8 +826,8 @@ GiantPearl: { ''' You have a light aura around you Enemies within the aura are slowed down - Does not work while a boss is alive - Provides a small amount of light in the abyss + Enemies that remain within the aura are bombarded by homing prism shards + {$Common.AbyssLightLevel1} ''' } @@ -829,7 +836,7 @@ GiantShell: { Tooltip: ''' 10% reduced dash velocity - Taking a hit restores dash velocity and reduces defense for 5 seconds + Taking a hit restores dash velocity and reduces defense for 3 seconds ''' } @@ -839,7 +846,7 @@ GiantTortoiseShell: { ''' Grants immunity to knockback 5% increased damage reduction and 10% reduced dash velocity - Taking a hit restores dash velocity and reduces defense and damage reduction for 5 seconds + Taking a hit restores dash velocity and reduces defense and damage reduction for 3 seconds ''' } @@ -848,7 +855,7 @@ GladiatorsLocket: { Tooltip: ''' Enemies drop a healing orb on kill - Gain an increase to your damage and movement speed the lower your health is, up to 20% + Gain an increase to your damage and movement speed the lower your health is, up to 20% at 50% life or below ''' } @@ -871,9 +878,9 @@ GrandGelatin: { DisplayName: Grand Gelatin Tooltip: ''' - 12% increased movement speed and jump speed - Using a healing potion creates a cleansing aura which lasts for 30 seconds - Entering the aura removes all debuffs one time and grants +2.5 HP/s life regen + {0}% increased movement speed and jump speed + Using a healing potion creates a cleansing aura which lasts for {1} seconds + Entering the aura removes all debuffs one time and grants +{2} HP/s life regen ''' } @@ -916,10 +923,10 @@ HideofAstrumDeus: { Tooltip: ''' Taking damage or inflicting true melee strikes drops an immense amount of astral stars from the sky - Taking damage temporarily boosts true melee damage by 30% + Taking damage temporarily increases true melee damage by 30% Boost duration scales with the amount of damage you took, up to 10 seconds - Immunity to Astral Infection, Cursed Inferno, On Fire!, and Frostburn Attackers take damage and are inflicted with Astral Infection + Nullifies the Astral Infection debuff ''' } @@ -943,6 +950,16 @@ HowlsHeart: { ''' } +IlmerisSpark: { + DisplayName: Ilmeris' Spark + Tooltip: + ''' + Attacks inflict Static Discharge while underwater + Taking damage causes the enemy to be shocked + Shocked enemies constantly release sparks + ''' +} + InfectedJewel: { DisplayName: Infected Jewel Tooltip: @@ -997,11 +1014,15 @@ JellyChargedBattery: { Laudanum: { DisplayName: Laudanum - Tooltip: Converts certain debuffs into buffs and extends their durations + Tooltip: + ''' + Converts certain debuffs into buffs and extends their durations + This also removes immunities to these debuffs if you have them + ''' HoldShiftTooltip: ''' - Debuffs affected: Darkness, Blackout, Confused, Slow, Weak, - Broken Armor, Armor Crunch, Chilled, Ichor, and Obstructed + Debuffs affected: Armor Crunch, Blackout, Bleeding, Broken Armor, Chilled, Confused, + Cursed, Darkness, Distorted, Ichor, Silenced, Slow, Weak, and Whispering Death ''' } @@ -1018,8 +1039,8 @@ LifeJelly: { DisplayName: Life Jelly Tooltip: ''' - Using a healing potion spawns a pink aura that lasts for 30 seconds - The aura grants +2 HP/s life regen + Using a healing potion spawns a pink aura that lasts for {0} seconds + The aura grants +{1} HP/s life regen ''' } @@ -1038,9 +1059,9 @@ LumenousAmulet: { DisplayName: Lumenous Amulet Tooltip: ''' - Attacks inflict Crush Depth and you are immune to it and Riptide + Attacks inflict Crush Depth, and grants immunity to Crush Depth and Riptide While in the abyss you gain 25% increased max life - Provides a moderate amount of light in the abyss + {$Common.AbyssLightLevel2} ''' } @@ -1048,8 +1069,10 @@ LuxorsGift: { DisplayName: Luxor's Gift Tooltip: ''' - Weapons fire unique projectiles based on their damage type - Some weapons are unable to receive this bonus + Summons a scarab launcher that follows you closely + The scarab fires different projectiles at enemies depending on what class the held weapon belongs to + Held item class is not updated when holding a tool + When not in use, the scarab will condense itself into a small orb of light ''' } @@ -1101,8 +1124,7 @@ Nanotech: { Stealth strikes summon nanobeams and sparks on enemy hits Stealth strikes have +15 armor penetration, deal 5% more damage, and heal for 2 HP 15% increased rogue damage and 15% increased rogue velocity - Landing a stealth strike grants a 12% crit bonus to non-stealth strikes - This crit bonus slowly decays + Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds ''' } @@ -1133,7 +1155,7 @@ NuclearFuelRod: { ''' Increases your max number of minions by 1 Minions release an irradiated aura on enemy hits - Immunity to Irradiated + Grants immunity to Irradiated ''' } @@ -1142,7 +1164,7 @@ Nucleogenesis: { Tooltip: ''' Increases your max number of mininons by 4 - Immunity to Shadowflame and Irradiated + Grants immunity to Shadowflame and Irradiated 15% increased summon damage, and increased minion knockback Minions inflict a variety of debuffs Minions spawn damaging sparks on enemy hits @@ -1156,13 +1178,14 @@ OccultSkullCrown: { ''' You constantly gain rage over time, and rage does not fade when out of combat Converts certain debuffs into buffs and extends their durations + This also removes immunities to these debuffs if you have them Adrenaline charges 20% faster Increases your max movement speed and acceleration by 5% ''' HoldShiftTooltip: ''' - Debuffs affected: Darkness, Blackout, Confused, Slow, Weak, - Broken Armor, Armor Crunch, Chilled, Ichor and Obstructed + Debuffs affected: Armor Crunch, Blackout, Bleeding, Broken Armor, Chilled, Confused, + Cursed, Darkness, Distorted, Ichor, Silenced, Slow, Weak, and Whispering Death ''' FlavorTooltip: "'Only a fool would ever wear this...'" } @@ -1196,7 +1219,7 @@ OldDukeScales: { HoldShiftTooltip: ''' [c/c3dfff: Using any dash will consume 20% of your stamina] - [c/c3dfff: Stamina will gradually restore after not dashing for 1 second] + [c/c3dfff: Stamina will gradually restore after not dashing for 1.5 seconds] [c/c3dfff: Stamina recovers faster when you are stationary] [c/c3dfff: If your stamina reaches 0%, you become exhausted] [c/e3545c: While exhausted, this item's damage reduction and movement bonuses are negated] @@ -1211,7 +1234,7 @@ OrnateShield: { ''' Allows the ability to dash This dash can ram through enemies without taking damage - Immunity to Chilled, Frostburn, Frostbite, and Frozen + Grants immunity to Chilled, Frostburn, Frostbite, and Frozen ''' } @@ -1269,7 +1292,8 @@ PlanebreakersPouch: { ''' 15% increased ranged damage, 5% increased ranged critical strike chance and 20% reduced ammo usage Grants a 20% chance to not consume arrows - Greatly increases all ranged projectile velocity + Pressing [KEY] will automatically swap the ammos in your ammo slots + The ammo type swapped depends on the ammo of the weapon you are holding ''' } @@ -1304,6 +1328,7 @@ ProfanedSoulCrystal: { FullTooltip: ''' Provides passive buffs depending on the time of day + Greatly boosts the power of the Guardian's relics Grants additional effects if you have {0} minion slots Summons your own personal Guardians to fight alongside you All non-summon attacks are transformed, and are empowered if no minions are active @@ -1356,11 +1381,7 @@ RadiantOoze: { RaidersTalisman: { DisplayName: Raider's Talisman - Tooltip: - ''' - Stealth strikes grant 12% crit bonus to non-stealth strikes - This crit bonus slowly decays - ''' + Tooltip: Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds } RampartofDeities: { @@ -1381,7 +1402,7 @@ ReaperToothNecklace: { DisplayName: Reaper Tooth Necklace Tooltip: ''' - 15% increased damage + 20% increased damage Increases armor penetration by 15 'A grisly trophy from the ultimate predator' ''' @@ -1391,8 +1412,11 @@ Regenator: { DisplayName: Regenator Tooltip: ''' - +6 HP/s life regen and massively accelerated natural life regen - However, your health cannot exceed 50% of its maximum + Your health cannot exceed 50% of its maximum + Increases length of invincibility after taking damage + Provides powerful special life regen to heal you for 8.5 HP/s + All normal life regen is negated and converted into damage + Current damage boost: [DAMAGE]% ''' } @@ -1410,9 +1434,9 @@ RottenBrain: { DisplayName: Rotten Brain Tooltip: ''' - 10% increased damage when below 75% life - 5% decreased movement speed when below 50% life - Shade rains down when you are hit + 5% increased damage + Taking damage spawns a dank creeper + The dank creeper flies above you, exploding into several shaderain clouds ''' } @@ -1430,7 +1454,6 @@ RoverDrive: { If depleted, the barrier's health regenerates after not receiving damage for 10 seconds Getting hit resets the timer Can also be scrapped at an extractinator - ''' ShieldAdren: Halved Adrenaline loss if all damage is absorbed } @@ -1449,7 +1472,7 @@ RustyMedallion: { Tooltip: ''' Causes most ranged weapons to release acid droplets from the sky - Immunity to Irradiated + Grants immunity to Irradiated ''' } @@ -1457,10 +1480,10 @@ SandCloak: { DisplayName: Sand Cloak Tooltip: ''' - 5% increased movement speed - Press [KEY] to consume 10% of your maximum stealth to create a protective dust veil - While inside the veil, you gain 6 defense and +1 HP/s life regen - This effect has a 30 second cooldown before it can be used again + Dashing creates a large protective sand veil which damages enemies inside it + The sand veil lasts 15 seconds, but dissipates early if you dash again + The veil slowly follows you, and any player inside it gains 10 defense and 1.75x acceleration + After dissipating, the sand veil has a 15 second cooldown before it can be used again ''' } @@ -1482,6 +1505,18 @@ ScuttlersJewel: { ''' } +SeaSpiritAmulet: { + DisplayName: Sea Spirit Amulet + Tooltip: + ''' + Slowly accumulate up to eight spirit orbs that follow you + Spirits disperse when dashing + If below 50% life, they will heal you, otherwise they will attack nearby enemies + Multiplies all water debuff damage by 1.35x + Spirit orbs are transparent and silent if visibility is disabled + ''' +} + ShatteredCommunity: { DisplayName: Shattered Community Tooltip: @@ -1500,7 +1535,7 @@ ShatteredCommunity: { ''' RageAdd: ''' - Adds the Rage meter, which generates over time + Adds the Rage meter, which fills over time Rage generates faster when in proximity of enemies When Rage is maxed, press {0} for a temporary damage boost ''' @@ -1531,8 +1566,12 @@ ShieldoftheOcean: { DisplayName: Shield of the Ocean Tooltip: ''' - Increased defense by 5 when submerged in liquid - 10% increased movement speed and +1 HP/s life regen while wearing Victide armor + Pressing [KEY] will activate a parry, encasing you in a bubble + Being hit shortly after encasement will pop the bubble, granting 60% DR for that hit + Upon popping, nearby enemies are violently launched away from you, and will be damaged if they collide with tiles + Enemies which cannot be launched instead directly take large damage + After popping, the damage reducing effect goes on a 20 second cooldown + Damage parried whilst on cooldown will not be reduced, and will not deal collision damage to launched enemies ''' } @@ -1603,7 +1642,7 @@ StarTaintedGenerator: { ''' Increases your max number of minions by 2, and summon damage by 7% Minion attacks spawn astral explosions and inflict several debuffs - Immunity to Irradiated + Grants immunity to Irradiated Does not stack with downgrades ''' } @@ -1623,7 +1662,7 @@ StatisCurse: { ''' Increases your max number of minions by 3, and summon damage by 12% Increased minion knockback - Minion attacks inflict Shadowflame and you are immune to it + Minion attacks inflict Shadowflame, and grants immunity to Shadowflame Does not stack with downgrades ''' } @@ -1632,16 +1671,14 @@ StatisNinjaBelt: { DisplayName: Statis' Ninja Belt Tooltip: ''' - 32% increased jump speed and allows auto-jump - Increased fall damage resistance by 35 blocks + 32% increased jump speed, allows auto-jump, and negates fall damage + Increases movement acceleration and deceleration by 1.75x + Increases movement speed by 1.15x. This bonus applies to running boot accessories Grants the ability to swim, climb walls, dash, and dodge attacks + Provides light when worn + {$Common.AbyssLightLevel1} ''' - HoldShiftTooltip: - ''' - 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 - ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" } StatisVoidSash: { @@ -1649,14 +1686,14 @@ StatisVoidSash: { Tooltip: ''' 32% increased jump speed, allows auto-jump, and negates fall damage - Can climb walls, dash, and dodge attacks - ''' - HoldShiftTooltip: - ''' - 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 + Increases movement acceleration and deceleration by 1.75x + Increases movement speed by 1.15x. This bonus applies to running boot accessories + Grants the ability to swim, climb walls, dash, and dodge attacks + Dashes leave homing scythes in your wake + Provides light when worn + {$Common.AbyssLightLevel1} ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" } // Be warned translators, this thing fucking sucks @@ -1708,7 +1745,6 @@ StatMeter: { Max Stealth: {0} | Standing Regen: {1} / sec | Moving Regen: {2} / sec Rogue Velocity Boost: {3}% ''' - RogueConsumption: " | Rogue Weapon Consumption Chance: {0}%" // Utility stats ToolRange: Tool Range Bonus: ({0}, {1}) MiningSpeed: " | Mining Speed: {0}%" @@ -1746,11 +1782,19 @@ SupremeBaitTackleBoxFishingStation: { DisplayName: Supreme Bait Tackle Box Fishing Station Tooltip: ''' - Increases fishing skill by 80, and crate catch chance by 10% + Increases fishing power by 50 Fishing line will never break and decreases chance of bait consumption - Allows fishing in lava - Sonar potion effect - The ultimate fishing accessory + Allows fishing in lava and detects hooked fish + ''' +} + +TeslasAmulet: { + DisplayName: Tesla's Amulet + Tooltip: + ''' + Generates an electrifying field that slows enemies + The field has reduced opacity if visibility is disabled + Reduces the duration of the Static Discharge debuff ''' } @@ -1758,12 +1802,12 @@ TheAbsorber: { DisplayName: The Absorber Tooltip: ''' - 12% increased movement and jump speed + {0}% increased movement and jump speed Grants immunity to knockback Attackers take immense damage and are afflicted with a crippling sickness debuff - Using a healing potion will spawn a green aura that lasts for 30 seconds - Walking into the aura removes all debuffs once and grants 3 HP/s regen, 8% damage, and 5% damage reduction - 5% of the damage from enemy attacks is converted into healing + Using a healing potion will spawn a green aura that lasts for {1} seconds + Walking into the aura removes all debuffs once and grants {2} HP/s regen, {3}% damage, and {4}% damage reduction + {5}% of the damage from enemy attacks is converted into healing ''' } @@ -1772,15 +1816,13 @@ TheAmalgam: { Tooltip: ''' 15% increased damage - Shade rains down when you are hit + Most buffs last twice as long, and persist after dying + Taking damage inflicts several debuffs on nearby enemies and spawns a dank creeper + The dank creeper flies above you, exploding into several shaderain clouds Grants the ability to dodge attacks + After dodging, summon damage and crit chance are boosted by 10% ''' - HoldShiftTooltip: - ''' - 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 - ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" } TheBee: { @@ -1790,7 +1832,7 @@ TheBee: { When at full HP, your damage is increased based on your damage reduction Damage taken at full HP is halved Any energy shields must be fully charged for this effect to apply - This has a 10 second cooldown + This has a 6 second cooldown ''' } @@ -1801,7 +1843,7 @@ TheCamper: { You deal 90% less damage unless stationary Standing still grants buffs depending on held item, and creates a damaging aura around you While moving, you regenerate health as if standing still - Provides a small amount of light in the Abyss + {$Common.AbyssLightLevel1} 'In rest may we find victory' ''' } @@ -1828,12 +1870,10 @@ TheEvolution: { DisplayName: The Evolution Tooltip: ''' - Reflects projectiles that hit you, making them harmless to you but 10x more harmful to enemies - 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 - Reflecting a projectile 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% + Reflects projectiles that hit you, negating their damage and dealing 10x damage to enemies + {$Common.ReflectInformation} + Reflecting a projectile grants +6 HP/s life regen for 5 seconds and grants maximum natural life regen + Getting hit by the same enemy projectile type during cooldown will resist its damage by 20% ''' } @@ -1842,7 +1882,7 @@ TheFirstShadowflame: { Tooltip: ''' Increases your max number of minions by 1 - Minion attacks inflict Shadowflame and you are immune to it + Minion attacks inflict Shadowflame, and grants immunity to Shadowflame ''' } @@ -1861,12 +1901,22 @@ TheSponge: { TheTransformer: { DisplayName: The Transformer - Tooltip: + Tooltip: "[GFB]" + TooltipNormal: ''' - Multiplies all electric debuff damage by 1.5 - Taking damage releases a blast of sparks - Complete immunity to Electrified and all electric attacks - You take halved damage from enemy bullets and reflect them for 800% damage + Generates an aura around you that creates morphing globs when projectiles pass through it or when enemies are killed + The globs encircle you and deal low damage and knockback to enemies they collide with + The circle can contain up to 30 globs at once + Press [KEY] to transform all globs into needles and launch them at your cursor + 'How did this come out of the junk you cobbled together? You're lucky it doesn't transform you' + ''' + TooltipGFB: + ''' + Generates an aura around you that creates morphing globs when projectiles pass through it or when enemies are killed + The globs encircle you and deal low damage and knockback to enemies they collide with + The circle has no limit to the number of globs it can hold, but your PC might + Press [KEY] to transform all globs into needles and launch them at your cursor + 'It's no Beeftank Doctrine, but it sure feels breakthrough!' ''' } @@ -1877,6 +1927,7 @@ ToxicHeart: { Your heart beats with the plague, pulsing outside of your body Pulse frequency scale with regen, and pulses that kill enemies pulse again to heal you Multiplies all sickness debuff damage by 1.5x + Effects are transparent and silent if visibility is disabled ''' } @@ -1884,7 +1935,7 @@ TrinketofChi: { DisplayName: Trinket of Chi Tooltip: ''' - Provides 4% damage reduction 5 seconds after taking damage + Increases damage reduction by 4% if you avoid taking damage for 5 seconds This buff expires on hit +1 HP/s life regen for teammates ''' @@ -1928,7 +1979,7 @@ VoidofCalamity: { DisplayName: Void of Calamity Tooltip: ''' - 12% increase to all damage + 12% increased damage Brimstone fire rains down after getting hit ''' } @@ -1952,12 +2003,14 @@ VoltaicJelly: { ''' } -WarbanneroftheSun: { - DisplayName: Warbanner of the Sun +WarbanneroftheRighteous: { + DisplayName: Warbanner of the Righteous Tooltip: ''' - Increases melee damage, true melee damage and melee speed the closer you are to enemies - These stat boosts max out at 20% + Damage is increased by 20% when close to enemies, but decreased by 60% when none are nearby + Emit a blazing aura that burns and repels nearby enemies + Enemies take increasing damage the closer they are to you and the longer they are near you + Effects are transparent and silent if visibility is disabled ''' } @@ -2005,7 +2058,7 @@ YharimsGift: { Flaming meteors rain down after getting hit Volatile dragon dust trails behind you Increases damage and movement speed by 15% - The power to kill a god pulses from within this artifact + [c/FCA92B:'The power to kill a god pulses from within this artifact'] ''' } @@ -2032,6 +2085,11 @@ GhostBracelet: { Tooltip: Wow.... It looks at me with its hollow eyes full of curiosity } +GoldenBomb: { + DisplayName: Golden Bomb + Tooltip: "'I AM THE BOMB'" +} + HapuFruit: { DisplayName: Ha-pu Fruit Tooltip: "'A fruit that calms your nerves (may have unintended side effects)'" @@ -2050,3 +2108,49 @@ Popo: { 'Don't let the demons steal your nose' ''' } + +PunchCard: { + DisplayName: Punch Card + Tooltip: "[c/842593:'Please... please get world record...']" + // These are used to spawn the item via chat -- both must be all lower case for the detection to work + SpawnText1: it's late + SpawnText1Alt: its late + SpawnText2: go to bed +} + +SharkyPlush: { + DisplayName: Sharky Plush + Tooltip: "[c/696969:'Look out, for the force without form...']" +} + +TheComb: { + DisplayName: The Comb + Tooltip: + ''' + Gives the wearer's hair a lustrous finish + Sparkles are attracted to nearby chests + 'We ain't found shit!' + ''' +} + +XyksBlessingBlue: { + DisplayName: Xyk's Blessing (Blue) + Tooltip: + ''' + Applies visual effects to your dashes and deaths + to transform + 'It's simply too much to turn back now; passion and time have long since stained it. + [c/5f8ae1:Have I always been so selfish?'] + ''' +} + +XyksBlessingOrange: { + DisplayName: Xyk's Blessing (Orange) + Tooltip: + ''' + Applies visual effects to your dashes and deaths + to transform + 'Even so, the march of time waits for none. Recall that feeling of fulfillment, and show it to the world. + [c/E1B65F:Prove that it was never a waste.'] + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index 7389b01ff3..31f7ee1828 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -23,7 +23,7 @@ BloodfireBullet: { ''' 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 + This damage caps at 35 ''' } @@ -31,42 +31,34 @@ BloodRune: { DisplayName: Blood Rune Tooltip: ''' - Used with the Ice Barrage - Found in some sort of runic landscape + Used by the Ice Barrage + 'Found in some sort of runic landscape' ''' } BubonicRound: { DisplayName: Bubonic Round - Tooltip: - ''' - Spreads the plague on hit - Ignores 10% of enemy defense - ''' + Tooltip: Spreads the plague on hit and ignores 10% of enemy defense } CinderArrow: { DisplayName: Cinder Arrow - Tooltip: Explosive arrows that burst into weak flaming shards that inflict Brimstone Flames + Tooltip: Explosive arrows that burst into weak flaming Brimstone Shards } DryadsTear: { DisplayName: Dryad's Tear - Tooltip: Splits into homing nature shards on impact which ignore enemy defense + Tooltip: Splits into homing shards on impact which ignore 10 points of enemy defense } ElysianArrow: { DisplayName: Elysian Arrow - Tooltip: - ''' - Arrows carrying profaned energy - Summons purifying light from above and below on impact - ''' + Tooltip: On impact, summons purifying light from above and below at the nearest enemy } FlashRound: { DisplayName: Flash Round - Tooltip: Gives off a concussive blast that confuses enemies in a large area for a short time + Tooltip: Emits a wide-reaching concussive blast which briefly confuses enemies } GodSlayerSlug: { @@ -74,8 +66,7 @@ GodSlayerSlug: { Tooltip: ''' Heavy ammunition with unlimited piercing that tears through spacetime - After a slug lands a hit, if it strikes a wall or runs out of targets to pierce, - it warps backwards through space and supercharges, exploding on impact + Slugs that strike a target will warp back and supercharge, shattering on hit ''' } @@ -83,9 +74,8 @@ 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 and freezing normal enemies + Once shot, bullets rapidly decelerate + Critical hits cause a flash freeze, dealing additional damage and freezing non-boss enemies ''' } @@ -93,7 +83,7 @@ HallowPointRound: { DisplayName: Hallow-Point Round Tooltip: ''' - Gallant light deals 6 bonus damage on hit + Releases anointed light on hit that increases the bullet's base damage to [DAMAGE] This effect does not occur if the bullets are converted by special guns ''' } @@ -102,27 +92,22 @@ HolyFireBullet: { DisplayName: Holy Fire Bullet Tooltip: ''' - Explosive holy bullets - Explosions are larger right when the bullets are fired + Profaned bullets that explode on impact, dealing extra damage + The explosion grows weaker the further the bullet travels ''' } HyperiusBullet: { DisplayName: Hyperius Bullet - Tooltip: - ''' - Powerful multicolor bullets - Bullets split into swirling lights on impact - ''' + Tooltip: Dazzling multicolor bullets that split into swirling lights on impact } IcicleArrow: { DisplayName: Icicle Arrow Tooltip: ''' - 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 + Once shot, arrows quickly freeze into falling icicles + Hitting enemies or tiles before the arrow fully freezes causes it to bounce upwards ''' } @@ -130,8 +115,8 @@ MarksmanRound: { DisplayName: Marksman Round Tooltip: ''' - A carefully crafted round which can be ricocheted off of midair coins - This allows other guns to utilize the coins tossed by Crackshot Colt and Midas Prime + A carefully crafted round which can ricochet off of coins + This allows other guns to utilize coins tossed by Crackshot Colt and Midas Prime ''' } @@ -139,8 +124,8 @@ MortarRound: { DisplayName: Mortar Round Tooltip: ''' - Specialized high explosive rounds with a large blast radius - Will destroy tiles + Specialized high explosive rounds + Large blast radius. Will destroy tiles Used by normal guns ''' } @@ -149,8 +134,8 @@ RubberMortarRound: { DisplayName: Rubber Mortar Round Tooltip: ''' - Specialized high explosive rounds with a large blast radius - Will destroy tiles on each bounce + Specialized high explosive rounds + Large blast radius. Will destroy tiles on each bounce Used by normal guns ''' } @@ -168,8 +153,8 @@ VanquisherArrow: { DisplayName: Vanquisher Arrow Tooltip: ''' - Powerful arrows forged with cosmic steel Pierces through tiles and homes in on enemies + Tears a rift in space on enemy hits ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index eb17975d7f..91905b3659 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -2,18 +2,19 @@ AstralBreastplate: { DisplayName: Astral Breastplate Tooltip: ''' + 7% increased damage +80 max mana and +20 max life - Creature detection ''' } AstralHelm: { DisplayName: Astral Helm - Tooltip: Danger detection + Tooltip: 5% increased damage and 10% increased critical strike chance SetBonus: ''' - 5% increased movement speed and +3 max minions - 35% increased damage and 25% increased critical strike chance + +3 max minions + 10% increased damage and critical strike chance + Detects nearby creatures, enemy projectiles, danger sources, and treasure Whenever you crit an enemy, a barrage of stars will rain down This effect has a 1 second cooldown before it can trigger again ''' @@ -23,8 +24,8 @@ AstralLeggings: { DisplayName: Astral Leggings Tooltip: ''' - 10% increased movement speed - Treasure and ore detection + 5% increased damage + 15% increased movement speed ''' } @@ -47,16 +48,16 @@ BrimflameScowl: { Tooltip: ''' 5% increased magic damage and critical strike chance - Increases maximum mana by 70 and reduces mana usage by 10% + Increases maximum mana by 80 and reduces mana usage by 10% Immunity to On Fire!, Brimstone Flames and Frostburn ''' SetBonus: ''' - Grants an additional 15% increased magic damage and crit + Grants an additional 15% increased magic damage and critical strike chance Press {0} to trigger a brimflame frenzy effect While under this effect, you get an additional 40% increase to magic damage - However, this comes at the cost of rapid life loss and no mana regeneration - This can be toggled off, however, a brimflame frenzy has a 30 second cooldown + However, this inflicts rapid life loss and disables mana regeneration and mana potions + This can be toggled off, however, brimflame frenzy has a 30 second cooldown ''' } @@ -105,9 +106,7 @@ DaedalusHeadMelee: { Enemies are more likely to target you You reflect projectiles back at enemies Reflected projectiles deal 50% less damage to you - 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 + {$Common.ReflectInformation} ''' } @@ -207,6 +206,7 @@ ForbiddenCirclet: { The ancient storm costs {1} mana and benefits from both summon and rogue bonuses Rogue stealth strikes spawn homing eaters on enemy hits Rogue and summon attacks will scale off of the stat with a higher boost + Minions no longer deal less damage while wielding rogue weapons ''' } @@ -274,7 +274,7 @@ HydrothermicHeadRogue: { Tooltip: ''' 12% increased rogue damage and 10% increased rogue critical strike chance - 50% chance to not consume rogue items and 5% increased movement speed + 5% increased movement speed Grants immunity to fire and lava ''' SetBonus: @@ -313,7 +313,7 @@ LunicCorpsBoots: { Tooltip: ''' 15% increased movement speed - 4% increased ranged critical strike chance + 5% increased ranged critical strike chance 10% increased max movement speed and acceleration ''' } @@ -322,7 +322,7 @@ LunicCorpsHelmet: { DisplayName: Lunic Corps Helmet Tooltip: ''' - 12% increased ranged damage + 15% increased ranged damage Night vision and creature detect ''' SetBonus: @@ -332,8 +332,8 @@ LunicCorpsHelmet: { 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 - 10% increased bullet damage - 10% increased specialist ranged damage + 15% increased bullet damage + 15% increased specialist ranged damage These are launchers, dartguns, or anything else that doesn't shoot arrows/bullets 20% increased jump speed ''' @@ -344,8 +344,8 @@ LunicCorpsVest: { DisplayName: Lunic Corps Vest Tooltip: ''' - 3% increased ranged damage - 11% increased ranged critical strike chance + 5% increased ranged damage + 15% increased ranged critical strike chance ''' } @@ -353,8 +353,8 @@ MolluskShelleggings: { DisplayName: Mollusk Shelleggings Tooltip: ''' - 12% increased damage and 4% increased critical strike chance - 7% decreased movement speed + 6% increased damage and 4% increased critical strike chance + Your horizontal movement is slowed ''' } @@ -364,12 +364,12 @@ MolluskShellmet: { ''' 5% increased damage and 4% increased critical strike chance You can move freely through liquids + Your horizontal movement is slowed ''' SetBonus: ''' Two shellfishes aid you in combat - 10% increased damage - Your horizontal movement is slowed + 10% increased damage reduction ''' } @@ -377,8 +377,8 @@ MolluskShellplate: { DisplayName: Mollusk Shellplate Tooltip: ''' - 10% increased damage and 6% increased critical strike chance - 15% decreased movement speed + 6% increased damage and 5% increased critical strike chance + Your horizontal movement is slowed ''' } @@ -522,11 +522,7 @@ TitanHeartBoots: { TitanHeartMantle: { DisplayName: Titan Heart Mantle - Tooltip: - ''' - 45% chance to not consume rogue items - 5% boosted rogue knockback but 15% lowered rogue attack speed - ''' + Tooltip: 5% boosted rogue damage and knockback } TitanHeartMask: { @@ -538,7 +534,7 @@ TitanHeartMask: { ''' SetBonus: ''' - 15% increased rogue damage and knockback + 10% increased rogue damage and 20% increased rogue knockback +100 maximum stealth Stealth strikes deal double knockback and cause an astral explosion Grants immunity to knockback diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index 13a6ffa0e3..f94a0fd15a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -181,7 +181,7 @@ DemonshadeHelm: { Shadowbeams and demon scythes will fire down when you are hit A friendly red devil follows you around Press {0} to enrage nearby enemies with a dark magic spell for 10 seconds - This makes them take 2.25x total damage, but they will deal 1.25x damage to you + This makes them take {1}x total damage, but they will deal {2}x damage to you ''' } @@ -311,8 +311,7 @@ GodSlayerChestplate: { ''' CommonSetBonus: ''' - Allows you to dash for an immense distance in 8 directions - Press {0} while holding down the movement keys in the direction you want to dash + Pressing {0} allows you to dash towards your cursor for 2.5 seconds Enemies you dash through take massive damage During the dash you are immune to most debuffs The dash has a {1} second cooldown @@ -370,7 +369,7 @@ OmegaBlueChestplate: { Tooltip: ''' 12% increased damage and 8% increased critical strike chance - Your attacks inflict Crush Depth + Your attacks inflict Hadopelagic Pressure No positive life regen ''' } @@ -452,8 +451,8 @@ SilvaArmor: { ''' All projectiles spawn healing leaf orbs on enemy hits Max run speed and acceleration boosted by 5% - If you are reduced to 1 HP you will not die from any further damage for 8 seconds - This effect has a 5 minute cooldown. The cooldown does not decrement if any bosses or events are active. + Taking fatal damage will revive you and make you invulnerable to all damage for 5 seconds + This effect has a 5 minute cooldown, which does not decrement if any bosses or events are active ''' } @@ -520,7 +519,7 @@ TarragonHeadMelee: { DisplayName: Tarragon Helm Tooltip: ''' - 12% increased melee damage and critical strike chance + 12% increased melee damage and 7% increased melee critical strike chance 10% increased damage reduction ''' SetBonus: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson index 438e31c223..3095f99502 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson @@ -168,7 +168,7 @@ StatigelHeadRogue: { DisplayName: Statigel Mask Tooltip: ''' - 10% increased rogue damage and 34% chance to not consume rogue items + 10% increased rogue damage 7% increased rogue critical strike chance and 5% increased movement speed ''' SetBonus: +90 maximum stealth @@ -180,7 +180,7 @@ StatigelHeadSummon: { SetBonus: ''' 18% increased summon damage and +1 max minion - Summons a mini slime god to fight for you, the type depends on what world evil you have + Summons a mini paladin to fight for you, the type depends on what world evil you have ''' } @@ -211,7 +211,7 @@ SulphurousLeggings: { Tooltip: ''' Movement speed increased by 10% - Movement speed increased by 35% while submerged in liquid + Movement speed increased an additional 25% while submerged in liquid ''' } @@ -287,7 +287,7 @@ WulfrumFusionCannon: { Tooltip: ''' Fires quick bursts of medium-range pellets - Ignores 10 points of enemy Defense + {$Common.ArmorPenetration} [c/878787:'Who needs whips when you can simply become the summon yourself?'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson index eaefebe6e8..7ac8dddb6c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson @@ -238,6 +238,21 @@ ThanatosMask: { Tooltip: "" } +TheCommandersCap: { + DisplayName: The Commanders Cap + Tooltip: Part of The High-Flying Finery +} + +TheFormalFootwear: { + DisplayName: The Formal Footwear + Tooltip: Part of The High-Flying Finery +} + +TheGrandGarment: { + DisplayName: The Grand Garment + Tooltip: Part of The High-Flying Finery +} + YharonMask: { DisplayName: Yharon Mask Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson b/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson index 904a71bbe9..5ccba37d5d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson @@ -1,3 +1,8 @@ +AcidRainDye: { + DisplayName: Acid Rain Dye + Tooltip: "" +} + AerialiteDye: { DisplayName: Aerialite Dye Tooltip: "" @@ -68,6 +73,11 @@ CryonicDye: { Tooltip: "" } +DaedalusDye: { + DisplayName: Daedalus Dye + Tooltip: "" +} + DefiledFlameDye: { DisplayName: Defiled Flame Dye Tooltip: "" @@ -113,6 +123,21 @@ WingTimeHairDye: { Tooltip: "" } +LivingShardDye: { + DisplayName: Living Shard Dye + Tooltip: "" +} + +MeldDye: { + DisplayName: Meld Dye + Tooltip: "" +} + +NecromanticDye: { + DisplayName: Necromantic Dye + Tooltip: "" +} + NecroplasmicDye: { DisplayName: Necroplasmic Dye Tooltip: "" @@ -133,6 +158,21 @@ PinkStatigelDye: { Tooltip: "" } +PlagueGooDye: { + DisplayName: Plague Goo Dye + Tooltip: "" +} + +PlaguePlateDye: { + DisplayName: Plague Plate Dye + Tooltip: "" +} + +ProfanedCrystalDye: { + DisplayName: Profaned Crystal Dye + Tooltip: "" +} + ProfanedFlameDye: { DisplayName: Profaned Flame Dye Tooltip: "" @@ -143,16 +183,31 @@ ProfanedMoonlightDye: { Tooltip: "" } +ProfanedRockDye: { + DisplayName: Profaned Rock Dye + Tooltip: "" +} + ReaverDye: { DisplayName: Reaver Dye Tooltip: "" } +ScoriaDye: { + DisplayName: Scoria Dye + Tooltip: "" +} + ShadowspecDye: { DisplayName: Shadowspec Dye Tooltip: "" } +SilvaDye: { + DisplayName: Silva Dye + Tooltip: "" +} + SlimeGodDye: { DisplayName: Slime God Dye Tooltip: "" @@ -167,3 +222,13 @@ SwirlingCosmicFlameDye: { DisplayName: Swirling Cosmic Flame Dye Tooltip: "" } + +TarragonDye: { + DisplayName: Tarragon Dye + Tooltip: "" +} + +WulfrumDye: { + DisplayName: Wulfrum Dye + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 11566009ab..a79d57210b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -11,7 +11,7 @@ AldebaranAlewife: { ArcturusAstroidean: { DisplayName: Arcturus Astroidean - Tooltip: Increases fishing power if used in the Astral Infection or Sulphurous Sea + Tooltip: Increases fishing power by {0}x when in the Astral Infection or Sulphurous Sea } AstralCrate: { @@ -44,9 +44,9 @@ UrsaSergeant: { Tooltip: ''' Attacks maul enemies with astral claw swipes - Taking damage reduces the cooldown, but inflicts you with Astral Infection + Taking damage reduces the cooldown, but inflicts you with {$Buffs.AstralInfectionDebuff.DisplayName} Enemy kills also reduce the cooldown - Swipes will be opaque and produce no sound if visibility is disabled + Swipes will be translucent and silent if visibility is disabled ''' } @@ -55,16 +55,17 @@ Bloodfin: { DisplayName: Bloodfin Tooltip: ''' - Grants a buff that grants +2.5 HP/s life regen - This buff directly restores HP if below 75% health - 10 second duration + Grants a buff that massively boosts natural life regen and grants +{0} HP/s life regen + This increases to +{1} HP/s while suffering from damage over time debuffs + This buff also directly restores HP every {2} seconds if below {3}% health + {$CommonItemTooltip.SecondDuration@4} 'The wonders of angiogenesis' ''' } Brimlish: { DisplayName: Brimlish - QuestDescription: When you defeated the Brimstone Elemental, her children fell in the lava as a result of the aftermath. Rumors say they mutated a fish, and I'd love if you fetched one for my new lava-filled fish tank. + QuestDescription: Did you really defeat that big fire lady? Well, I heard that her children fled into the lava, and one of them mutated into a fish! I'm not burning my hands though, so you catch it and bring it to me for my lava-filled tank! } BrimstoneCrate: { @@ -108,7 +109,7 @@ DragoonDrizzlefish: { Havocfish: { DisplayName: Havocfish - Tooltip: Press to extract essence + Tooltip: Press to extract [i:CalamityMod/EssenceofHavoc] essence } Shadowfish: { @@ -123,7 +124,7 @@ SlagCrate: { 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. + QuestDescription: Hey {0}, wouldn't it be absolutely calamitous if I sent you to those ruins in the depths of hell? Well, I heard of a scary fish that can slurp the souls out of people! I want to keep my soul, so scram! The fish isn't going to catch itself! } // Sunken Sea Catches @@ -134,7 +135,7 @@ EutrophicCrate: { 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! + QuestDescription: You ever wondered what would happen if a lizard that lived in the desert wandered too deep into those old Ilmeran areas? Well I know, and it looks super cool! But it's way too slippery for me to get my hands on, so you go and get it so I can keep it as a pet! } GreenwaveLoach: { @@ -163,26 +164,41 @@ RustedJingleBell: { SerpentsBite: { DisplayName: Serpent's Bite - Tooltip: - ''' - Reach: 28.125 - Launch Velocity: 18 - Reelback Velocity: 14 - Pull Velocity: 12 - ''' + Tooltip: "{$Common.GrappleStats}" } Serpentuna: { DisplayName: Serpentuna - QuestDescription: Sea serpents are pretty but not as pretty as the look on someone's face when they find one in their chair. I need you to fetch me the props for my next big scare, and the deadline is tomorrow. + QuestDescription: I'm tired of always losing my allowance to those serpents in the Ilmeran water! I wanna fish up all the baby serpents, and I need YOUR help to do it! ...What? No, I'm not trying to steal money from others... } SparklingEmpress: { DisplayName: Sparkling Empress - Tooltip: + Tooltip: "[GFB]" + TooltipNormal: ''' - Fires a concentrated laser to annihilate your foes - Defeated enemies explode into prism shards + Fires a stream of erratic magic + After firing for long enough, the fish will shine + Ceasing use of the fish while it shines will restore some of your mana and life + 'An beautiful fish that seems to feed on mana' + ''' + TooltipGFB: + ''' + Fires a stream of erratic magic + After firing for long enough, the fish will shine + Ceasing use of the fish while it shines will restore some of your mana and life + 'Hello there, you seem to be an unfamiliar face around here. + Perhaps you are surprised a fish like me is able to speak? + No need for worry, I have no intention of any foul play. + I only hope to find a delectable meal of pure mana on this fine day! + You have a supply of mana, yes? + Would you perchance be so kind as to share a bit with this small fish? + If it is not to your liking do not worry, for I have a compromise to make you. + It should be simple enough, you provide me, the fish, with your mana. + But, in turn I shall provide you plentiful offensive power through my art of fish magic. + Is this an applicable compromise? + Good! + Then let us set out and see the world beyond as I enjoy a fine feast!' ''' } @@ -193,7 +209,7 @@ SunkenSailfish: { SurfClam: { DisplayName: Surf Clam - QuestDescription: Did you know that clams are a delicacy? Rumor has it that a big colony lives beneath the Desert. Just talking about them makes me hungry. I need you to fetch one for me, so I can practice my culinary skills and curb my hunger. + QuestDescription: Rumor has it that a massive swarm of clams has taken over that sea under the desert! Clams are a delicacy, so just hearing that makes me hungry! Will you help me curb my hunger? Of course you will! Just make sure my clam and you make it back in one piece! } // Other Catches @@ -208,32 +224,32 @@ EnchantedStarfish: { FishofEleum: { DisplayName: Fish of Eleum - Tooltip: Press to extract essence + Tooltip: Press to extract [i:CalamityMod/EssenceofEleum] essence } FishofFlight: { DisplayName: Fish of Flight - Tooltip: Press to extract souls + Tooltip: Press to extract [i:SoulofFlight] souls } FishofLight: { DisplayName: Fish of Light - Tooltip: Press to extract souls + Tooltip: Press to extract [i:SoulofLight] souls } FishofNight: { DisplayName: Fish of Night - Tooltip: Press to extract souls + Tooltip: Press to extract [i:SoulofNight] souls } GlimmeringGemfish: { DisplayName: Glimmering Gemfish - Tooltip: Press to extract gems + Tooltip: Press to extract [ITEMS] gems } Gorecodile: { DisplayName: Gorecodile - Tooltip: Press to extract blood orbs + Tooltip: Press to extract [i:CalamityMod/BloodOrb] blood orbs } HydrothermalCrate: { @@ -252,7 +268,7 @@ Spadefish: { StuffedFish: { DisplayName: Stuffed Fish - Tooltip: Press to extract herbs and seeds + Tooltip: Press to extract [HERBS] herbs and [SEEDS] seeds } SulphurousCrate: { @@ -262,7 +278,7 @@ SulphurousCrate: { SunbeamFish: { DisplayName: Sunbeam Fish - Tooltip: Press to extract essence + Tooltip: Press to extract [i:CalamityMod/EssenceofSunlight] essence } // Fishing Rods @@ -288,7 +304,7 @@ HeronRod: { DisplayName: Heron Rod Tooltip: ''' - Increased fishing power in space + Increases fishing power by {0}x when in space 'A silent head and beak lanced down and plucked it out by the head, and the beak swallowed the little fish while its tail waved frantically.' ''' @@ -337,7 +353,7 @@ VerstaltiteFishingRod: { DisplayName: Verstaltite Fishing Rod Tooltip: ''' - Increased fishing power when in the tundra + Increases fishing power by {0}x when in the tundra The ancient alloy's prismatic qualities are perfect for attracting fish ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson index fad6ef1784..eeb8cd9033 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson @@ -232,7 +232,7 @@ LoreCrimson: { DisplayName: The Crimson Lore: ''' - The foul air, the morbid fauna, the disgusting terrain… Here lies my first mistake of my crusade. + The foul air, the morbid fauna, the disgusting terrain… Here lies the first mistake of my crusade. The essence of a God does not simply vanish when the body dies. It must be properly disposed of or destroyed entirely. Essence of a pious God could never fester into a mire as dreadful as this. ''' @@ -320,8 +320,8 @@ LoreDukeFishron: { Outlandish as they may seem, this species is the single mightiest of the seas. They are relentless hunters and can easily spend significant time out of the water. Folklore holds that the Fishrons claim heritage from the true Dragons; countless years back. - While there are many such tales of creatures hailing from draconic descent, this case is factual. - Genetic heritage or not: the Fishrons lack Dragonblood and Auric souls. I would well know. + While there are many such tales of creatures hailing draconic descent, this case is factual. + Genetic heritage or not: the Fishrons lack Auric souls. I would know well. ''' Tooltip: "" } @@ -466,7 +466,7 @@ LorePerforators: { These creatures were unique. They wielded the slain Gods' power as purely as possible, veins flowing with spilt ichor. All that exists in the Crimson is truly the divine turned inside out; their gore now glistens with perverse treachery for all to bear witness. The mire reeks of centuries of vile manipulation and callous domination of the hapless. - Judgment has long passed and only extinction is left waiting. + Judgement has long passed and only extinction is left waiting. ''' Tooltip: "" } @@ -490,13 +490,13 @@ LorePlantera: { DisplayName: Plantera Lore: ''' - This floral aberration is another example of the volatile power of harnessed souls. - Taking their mastery of agriculture to new heights, the Jungle settlers bred a special sprout. - Through ritual blessing of the soil, it was fed legions of souls. - Elders of the village wished this to bring forth a new age of botanical prosperity. - Indeed, the plant was awe inspiring. But it was wild and untamed, with a will of its own. - Now that you have slain it, more disorderly spiritual energies are flooding the lands. - The village's ignorance was shameful in its own right, but this is worse still. + That floral beast hailed from a grove known as the Vernal Pass, home of Silva's champion Braelor. + Once I learned of his origins, I sought the Pass myself. Alas, it seemed the very grass I tread on kept me from finding it. + I gave up my pursuit, but the hubris of the Pass's citizens was ultimately their own downfall. + So intimidated were they by my search that they fashioned themselves an appalling guardian. + Shackling the souls of once free creatures could only have one result. The revolt of this floral beast was well justified. + Now that you have slain it, even greater disorderly spirits have taken root in the lands. + The village's shortsightedness was shameful in its own right, but the consequences of this may be worse still. ''' Tooltip: "" } @@ -537,11 +537,11 @@ LoreProfanedGuardians: { DisplayName: The Profaned Guardians Lore: ''' - The Guardians are rather simple constructs, extensions of the Profaned Goddess' power. - They are given partial autonomy to hunt down threats and are rarely seen outside of temples sanctified in her name. - She has been attempting to expand her domain, it is of no surprise she sees you as her largest threat to that. - After all, it was you that finished off the star-spawned horror that catalyzed the downfall of the Dragons. - Draw her out from hiding. Have no mercy, for the Profaned Goddess shows none herself. + The Guardians are foul extensions of the Profaned Goddess' power, wielders of the same wicked flame. + They were given partial autonomy to hunt down threats, rarely spotted outside of temples sanctified in her name. + She has been expanding her iniquitous domain, and she believes you to be her largest threat. + After all, it was you that finished off the voidborn horror that catalyzed the downfall of the Dragons. + Draw her out from hiding. Have no mercy; the Profaned Goddess shows none herself. ''' Tooltip: "" } @@ -589,13 +589,13 @@ LoreRavager: { DisplayName: The Ravager Lore: ''' - A sickening flesh golem built for the sole purpose of savage, relentless destruction. - The monstrosity was a desperate gambit to turn the tides against my God-seeking armies. - I could scarcely believe it myself, it was born of a ritual of great sacrifice, performed in ardent faith. - The ritual condemned and fused the bodies and souls of their fallen allies into this hideous thing. - When the warlocks pledged their very lives to it as an offering, it awoke and effortlessly massacred them. - Now caked in fresh blood, it hungered for more, setting off on an aimless rampage. - I suppose its brutality serves as a reminder to be careful what you believe. + A sickening flesh titan built for the sole purpose of savage, relentless destruction. + This monstrosity was a desperate gambit to turn the tides against my mighty paladins. + I stormed their cathedral not long after executing their deity, but despite my efforts I could not fully prevent its conception. + Their ritual entombed the bodies and souls of their fallen allies into this hideous thing. + When the warlocks pledged their very lives to it as an offering, it awoke. I cut it down then and there, reducing it to naught but paste. + I know not how it survived my blade, but it seems its flesh no longer listens to whatever mind was still there. + Its unfettered brutality should serve as a reminder to be careful what you believe. ''' Tooltip: "" } @@ -674,13 +674,15 @@ LoreStormWeaver: { DisplayName: Storm Weaver Lore: ''' - This beast while of lesser stature than the Devourer, is a great danger in its own right. - They are clearly of the same species. Even this serpent was known to devour Wyverns whole. - Very little is known about the realm or space that the Great Devourer hails from. - Even Draedon and his obsessive research has been unable to discern its true nature. - The Weaver slipped through a rift from this place opened by the Devourer, and he has monitored it since. - In his mind, the lesser serpent's similar powers could lead it to be too threatening for him to let live. - Little does he know, he has forever stood in a similar position. He thinks himself invincible after all. + This beast, while of lesser stature than the Devourer, is a great danger in its own right. + Chrysadia held it in notable infamy; it was said to devour Wyverns whole. + It arrived in our realm through a rift opened by the Devourer. He immediately set out on the hunt, but I intervened. + He claimed the lesser serpent was too great a threat to let live. This proved to be little more than another lie. + It is strange, however. To this very day, I know not why he feigned such worry. + Then again, little is known of the Serpent or his home. Even Draedon's obsessive research yields little results. + Regardless, I did not see it fit for the Devourer to take the Weaver's life on suspicion alone. + He has monitored the Weaver since then. Little does he know, he has forever stood in the same position. + He thinks himself untouchable, after all. ''' Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson index 6c23f21453..e6c83d21fe 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -73,21 +73,6 @@ CoreofCalamity: { Tooltip: "" } -CoreofEleum: { - DisplayName: Core of Eleum - Tooltip: "" -} - -CoreofHavoc: { - DisplayName: Core of Havoc - Tooltip: "" -} - -CoreofSunlight: { - DisplayName: Core of Sunlight - Tooltip: "" -} - CorrodedFossil: { DisplayName: Corroded Fossil Tooltip: It's very sturdy @@ -113,11 +98,6 @@ DarksunFragment: { Tooltip: An impacted crystal suffused with opposing celestial energies } -DemonicBoneAsh: { - DisplayName: Demonic Bone Ash - Tooltip: "" -} - DepthCells: { DisplayName: Depth Cells Tooltip: The cells of abyssal creatures @@ -222,11 +202,6 @@ MolluskHusk: { Tooltip: The remains of a mollusk } -MurkyPaste: { - DisplayName: Murky Paste - Tooltip: "" -} - MysteriousCircuitry: { DisplayName: Mysterious Circuitry Tooltip: "" @@ -327,11 +302,6 @@ TitanHeart: { Tooltip: Can be offered up at the Astral Beacon } -TrapperBulb: { - DisplayName: Trapper Bulb - Tooltip: "" -} - TwistingNether: { DisplayName: Twisting Nether Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 0c302fbb07..45aa900888 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -1,6 +1,16 @@ // Critters +AlphaSeaMinnowItem: { + DisplayName: Alpha Sea Minnow + Tooltip: "" +} + +AlphaSeaMinnowGoldItem: { + DisplayName: Gold Alpha Sea Minnow + Tooltip: "" +} + AndroombaItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.Androomba.DisplayName}" + DisplayName: "{$NPCs.Androomba.DisplayName}" Tooltip: ''' Press on the roomba with a solution to insert it @@ -9,17 +19,37 @@ AndroombaItem: { } BabyCannonballJellyfishItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.BabyCannonballJellyfish.DisplayName}" - Tooltip: "" + DisplayName: "{$NPCs.BabyCannonballJellyfish.DisplayName}" + Tooltip: Can be fired out of cannons } BabyFlakCrabItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.BabyFlakCrab.DisplayName}" + DisplayName: "{$NPCs.BabyFlakCrab.DisplayName}" Tooltip: "" } BabyGhostBellItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.BabyGhostBell.DisplayName}" + DisplayName: Blue Baby Ghost Bell + Tooltip: "" +} + +BabyGhostBellGoldItem: { + DisplayName: Gold Baby Ghost Bell + Tooltip: "" +} + +BabyGhostBellGreenItem: { + DisplayName: Green Baby Ghost Bell + Tooltip: "" +} + +BabyGhostBellRadiantItem: { + DisplayName: Radiant Baby Ghost Bell + Tooltip: "" +} + +BabyGhostBellRedItem: { + DisplayName: Red Baby Ghost Bell Tooltip: "" } @@ -29,7 +59,7 @@ NanodroidDysfunctionalItem: { } NanodroidItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.Nanodroid.DisplayName}" + DisplayName: "{$NPCs.Nanodroid.DisplayName}" Tooltip: "" } @@ -43,33 +73,96 @@ NanodroidPlagueRedItem: { Tooltip: "" } +PearlpodBlackItem: { + DisplayName: Black Pearlpod + Tooltip: "" +} + +PearlpodItem: { + DisplayName: White Pearlpod + Tooltip: "" +} + +PearlpodGoldItem: { + DisplayName: Gold Pearlpod + Tooltip: "" +} + +PearlpodPinkItem: { + DisplayName: Pink Pearlpod + Tooltip: "" +} + +PolypPanaseaGoldItem: { + DisplayName: Gold Polyp Panasea + Tooltip: "" +} + +PolypPanaseaGreenItem: { + DisplayName: Green Polyp Panasea + Tooltip: "" +} + +PolypPanaseaItem: { + DisplayName: Red Polyp Panasea + Tooltip: "" +} + +PolypPanaseaPurpleItem: { + DisplayName: Purple Polyp Panasea + Tooltip: "" +} + +PolypPanaseaRadiantItem: { + DisplayName: Radiant Polyp Panasea + Tooltip: "" +} + +PolypPanaseaTurquoiseItem: { + DisplayName: Turquoise Polyp Panasea + Tooltip: "" +} + PiggyItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.Piggy.DisplayName}" + DisplayName: "{$NPCs.Piggy.DisplayName}" Tooltip: "" } RepairUnitItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.RepairUnitCritter.DisplayName}" + DisplayName: "{$NPCs.RepairUnitCritter.DisplayName}" Tooltip: "" } SeaMinnowItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.SeaMinnow.DisplayName}" + DisplayName: "{$NPCs.SeaMinnow.DisplayName}" + Tooltip: "" +} + +SeaMinnowGoldItem: { + DisplayName: Gold Sea Minnow + Tooltip: "" +} + +ShroombleItem: { + DisplayName: "{$NPCs.Shroomble.DisplayName}" Tooltip: "" } TwinklerItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.Twinkler.DisplayName}" + DisplayName: "{$NPCs.Twinkler.DisplayName}" Tooltip: "" } // Permanent Boosters +AdrenalineBoosterTooltip: Permanently increases {$Buffs.AdrenalineMode.DisplayName} damage by {0}% and damage reduction by {1}% +RageBoosterTooltip: Permanently increases the duration of {$Buffs.RageMode.DisplayName} by {0} second + CelestialOnion: { DisplayName: Celestial Onion Tooltip: ''' Permanently increases the number of accessory slots - This item does nothing in Master Mode + Enables Demon Heart's accessory slot instead in Master Mode Alien power pulses inside its layers ''' } @@ -83,15 +176,8 @@ CometShard: { ''' } -Ectoheart: { - DisplayName: Ectoheart - Tooltip: Permanently increases Adrenaline Mode damage by 20% and damage reduction by 5% -} - -ElectrolyteGelPack: { - DisplayName: Electrolyte Gel Pack - Tooltip: Permanently increases Adrenaline Mode damage by 20% and damage reduction by 5% -} +Ectoheart.DisplayName: Ectoheart +ElectrolyteGelPack.DisplayName: Electrolyte Gel Pack EtherealCore: { DisplayName: Ethereal Core @@ -102,10 +188,7 @@ EtherealCore: { ''' } -InfernalBlood: { - DisplayName: Infernal Blood - Tooltip: Permanently increases the duration of Rage Mode by 1 second -} +InfernalBlood.DisplayName: Infernal Blood MiracleFruit: { DisplayName: Miracle Fruit @@ -117,9 +200,16 @@ MiracleFruit: { ''' } -MushroomPlasmaRoot: { - DisplayName: Mushroom Plasma Root - Tooltip: Permanently increases the duration of Rage Mode by 1 second +MushroomPlasmaRoot.DisplayName: Mushroom Plasma Root + +NimbleBounder: { + DisplayName: Nimble Bounder + Tooltip: + ''' + Permanently increases movement and jump speed by {0}% + Permanently increases acceleration by {1}% + [c/842593:'Might be useful for speedrunning'] + ''' } PhantomHeart: { @@ -131,10 +221,7 @@ PhantomHeart: { ''' } -RedLightningContainer: { - DisplayName: Red Lightning Container - Tooltip: Permanently increases the duration of Rage Mode by 1 second -} +RedLightningContainer.DisplayName: Red Lightning Container SacredStrawberry: { DisplayName: Sacred Strawberry @@ -156,10 +243,7 @@ SanguineTangerine: { ''' } -StarlightFuelCell: { - DisplayName: Starlight Fuel Cell - Tooltip: Permanently increases Adrenaline Mode damage by 20% and damage reduction by 5% -} +StarlightFuelCell.DisplayName: Starlight Fuel Cell TaintedCloudberry: { DisplayName: Tainted Cloudberry @@ -236,6 +320,17 @@ VoodooDemonVoodooDoll: { } // Uncategorized +ExhumeShortTooltip: + ''' + [c/C61B40:'Ah, are you curious what I saw within this item?'] + [c/BABABA:Press "Left Shift" to listen] + ''' +LegendaryShortTooltip: + ''' + [c/FF6F00:Tales of legends past radiate around you...] + [c/BABABA:Press "Left Shift" to listen closer] + ''' + AlicornonaStick: { DisplayName: Alicorn on a Stick Tooltip: "'Congratulations, you're winner! Here's my head on a stick.'" @@ -262,12 +357,21 @@ BrimstoneLocus: { MomentumCapacitor: { DisplayName: Momentum Capacitor - Tooltip: + GFBName: Burden Breaker + Tooltip: "[GFB]" + TooltipNormal: ''' While using the Momentum Capacitor, your top speed will continuously and uncontrollably increase This effect only works if there are no bosses alive ''' + TooltipGFB: + ''' + The good time + Go fast + WARNING: May have disastrous results + Only works if there are no bosses alive + ''' } NormalityRelocator: { @@ -275,7 +379,7 @@ NormalityRelocator: { Tooltip: ''' Press [KEY] to teleport to the position of the mouse - Fall speed is doubled for 30 frames after teleporting + Fall speed is doubled for 0.5 seconds after teleporting Teleportation is disabled while Chaos State is active Works while in the inventory 'I'll be there in the blink of an eye' @@ -286,9 +390,28 @@ RelicOfConvergence: { DisplayName: Relic of Convergence Tooltip: ''' - Creates a profaned crystal that charges power - Holding out the crystal slows the player down - At the end of its life, the crystal heals the player for 70 HP + Creates a profaned crystal at the cursor that channels a healing aura before shattering + All players within the area of effect are healed for {0} HP + Allies gain 50% extra healing + Holding out the crystal heavily reduces the damage of all summons + [c/FF8C00:Never once had I known kindness. Neither my peers or family had a shred of compassion for me.] + [c/FF8C00:I wished for someone I could confide. A presence that cleansed me of anxiety.] + [c/FF8C00:And when I saw Her radiant smile when we met, I knew I had finally found it.] + ''' +} + +RelicOfResilience: { + DisplayName: Relic of Resilience + Tooltip: + ''' + Holding this item creates orbiting rock shards around you and nearby allies + While they orbit you, your minimum defense is set to 150 and minimum damage reduction to 10% + Taking a hit or pressing will pull in the shards, then blast them outward, crippling hit enemies + This effect has a 10 second cooldown after taking a hit + Holding out the shield heavily reduces the damage of all summons while rocks are active, only for you + [c/FF8C00:I saw a massacre and did nothing to stop it. My vow broken, I was shunned.] + [c/FF8C00:My will to forge ahead vanished. My final wish was simply to not die alone.] + [c/FF8C00:But when She put faith in my shield, I would never again let it falter.] ''' } @@ -323,13 +446,3 @@ SuperDummy: { Right click to kill all super dummies ''' } - -NimbleBounder: { - DisplayName: Nimble Bounder - Tooltip: - ''' - Permanently increases movement and jump speed by 5% - Permanently increases acceleration by 10% - [c/842593:'Might be useful for speedrunning'] - ''' -} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson index 88b741e48c..609f6d8a11 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson @@ -1,38 +1,38 @@ Brimrose: { DisplayName: Brimrose - Tooltip: Summons a brimrose mount + Tooltip: Summons a rideable Brimrose mount +} + +ExoArmamentsKit: { + DisplayName: Exo Armaments Kit + Tooltip: + ''' + Summons a rideable war machine + 'A superweapon just right for your stature' + ''' } ExoThrone: { DisplayName: Exo Box Tooltip: ''' - Materializes a quite cozy and extremely nimble flying Exo throne + Materializes a quite cozy and extremely nimble flying Exo Throne mount Hold [KEY] while sitting in the throne to move slower for more precision 'A comfortable gamer is a dangerous gamer' ''' } -Fabsol: { - DisplayName: Princess Spirit in a Bottle - Tooltip: - ''' - Summons the spirit of Cirrus, the Drunk Princess, in her alicorn form - Mounting will transform Cirrus, dismounting transforms her back - ''' -} - FollyFeed: { DisplayName: Folly Feed - Tooltip: Summons a monstrosity + Tooltip: Summons a rideable monstrosity } GazeOfCrysthamyr: { DisplayName: Gaze of Crysthamyr Tooltip: ''' - Summons a shadow dragon - Hold W to ascend faster + Summons a rideable shadow dragon mount + Hold Up to ascend faster ''' } @@ -45,13 +45,23 @@ OnyxExcavatorKey: { DisplayName: Onyx Excavator Key Tooltip: ''' - Summons a drill to drill through the world so you can destroy all the neat world generation - with complete disregard for all the creatures that inhabit these lands. I am sure the EPA and PETA would like - to have a word with you afterwards. + Summons a rideable Onyx Drill mount + to mine blocks in front of you so you can destroy all the neat world generation + with complete disregard for all the creatures that inhabit these lands + I am sure the EPA and PETA would like to have a word with you afterwards The power of the destruction scales with the highest powered pickaxe in your inventory ''' } +PrincessSpiritinaBottle: { + DisplayName: Princess Spirit in a Bottle + Tooltip: + ''' + Summons the spirit of Cirrus, the Drunk Princess, in her alicorn form + Mounting will transform Cirrus, dismounting transforms her back + ''' +} + SuspiciousLookingJellyBean: { DisplayName: Suspicious Looking Jelly Bean Tooltip: JELLY BEAN @@ -59,5 +69,5 @@ SuspiciousLookingJellyBean: { TundraLeash: { DisplayName: Tundra Leash - Tooltip: Summons a Rimehound mount + Tooltip: Summons a rideable Rimehound mount } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson index ba0af93915..06dae2e293 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson @@ -36,7 +36,7 @@ ChromaticOrb: { Tooltip: ''' Summons an ancient dragon light pet that highlights nearby enemies and danger sources - Provides a small amount of light in the abyss + {$Common.AbyssLightLevel1} 'It glows warmly in your hand' ''' } @@ -56,7 +56,7 @@ EnchantedButterfly: { Tooltip: ''' Summons a mysterious dragonfly light pet - Provides a small amount of light in the abyss + {$Common.AbyssLightLevel1} 'Feed him butterflies to keep him strong!' ''' } @@ -106,7 +106,7 @@ LittleLight: { Tooltip: ''' Summons a small construct that follows you and provides a great amount of light - Provides a large amount of light in the abyss + {$Common.AbyssLightLevel3} 'It's been looking for you for a long time' ''' } @@ -136,7 +136,7 @@ RadiatingCrystal: { Tooltip: ''' Summons a radiator light pet - Provides a small amount of light in the abyss + {$Common.AbyssLightLevel1} 'The crystal contains traces of holothurin' ''' } @@ -184,7 +184,7 @@ ThiefsDime: { Tooltip: ''' Summons Goldie the rogue coin to collect nearby coins and light your way - Provides a small amount of light in the abyss + {$Common.AbyssLightLevel1} 'Once worthless treasure, now a relic of a thief's companionship' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 4a904bb8a6..74cc606294 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -1,5 +1,125 @@ FormattedBannerName: "{0} Banner" FormattedBannerTooltip: "{$CommonItemTooltip.BannerBonus}{0}" +AcidEelBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AeroSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AmberCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AmethystCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AndroombaBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AnthozoanCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AquaticUrchinBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AriesBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ArmoredDiggerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AstraglomerateBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AstralachneaBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AstralProbeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AstralSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AtlasBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +AuroraSpiritBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BabyCannonballJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BabyFlakCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BabyGhostBellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BelchingCoralBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BloatfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BloomSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BobbitWormBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BohldohrBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BoxJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CalamityEyeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CannonballJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ChaoticPufferBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CladCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ClamBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CloudElementalBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CnidrionBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ColossalSquidBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CrimulanBlightSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CryonBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CryoSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CrystalCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CuttlefishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +DespairStoneBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +DevilFishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +DiamondCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +DraconicSwarmerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +EarthElementalBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +EbonianBlightSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +EidolistBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +EidolonWyrmJuvenileBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +EmeraldCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +EutrophicRayBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +FearlessGoldfishWarriorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +FlakCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +FrogfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +FusionFeederBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +GammaSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +GhostBellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +GiantSquidBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +GnasherBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +GulperEelBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +HadarianBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +HeatSpiritBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +IceClasperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ImpiousImmolatorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +InfernalCongealmentBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +IrradiatedSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +LaserfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +LuminousCorvinaBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +MantisBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +MantisShrimpBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +MelterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +MirageJellyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +MorayEelBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +NovaBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +NuclearToadBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +OarfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +OrthoceraBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +OverloadedSoldierBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PerennialSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PestilentSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PhantomSpiritBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PiggyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PlaguebringerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PlagueChargerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PlagueshellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PrismBackBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ProfanedEnergyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +RadiatorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ReaperSharkBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +RenegadeWarlockBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +RepairUnitBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +RimehoundBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +RotdogBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +RubyCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SapphireCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ScornEaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ScryllarBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SeaFloatyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SeaMinnowBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SeaSerpentBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ShockstormShuttleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ShroombleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SightseerColliderBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SightseerSpitterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SkyfinBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SlabCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SoulSlurperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +StellarCulexBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +StormlionBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SulflounderBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SulphurousSkaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SunskaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +TopazCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ToxicatfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ToxicMinnowBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +TrasherBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +TrilobiteBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ViperfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +VirulingBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +WulfrumAmplifierBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +WulfrumDroneBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +WulfrumGyratorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +WulfrumHovercraftBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +WulfrumRoverBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" AstralPylon: { DisplayName: Astral Pylon @@ -116,6 +236,8 @@ CryonicBrick: { Tooltip: "" } +// Draedon Structures + AgedLaboratoryConsoleItem: { DisplayName: Aged Laboratory Console Tooltip: "" @@ -170,7 +292,7 @@ ChargingStationItem: { DisplayName: Charging Station Tooltip: ''' - Charges Draedon's Arsenal items using Power Cells + Charges Draedon's Arsenal items using [i:CalamityMod/DraedonPowerCell] Draedon Power Cells Place both an item and Power Cells into the Charging Station to charge the item ''' } @@ -249,8 +371,8 @@ PowerCellFactoryItem: { DisplayName: Power Cell Factory Tooltip: ''' - Produces Draedon Power Cells over time - One cell is produced every 15 seconds + Produces [i:CalamityMod/DraedonPowerCell] Draedon Power Cells over time + One cell is produced every {0} seconds ''' } @@ -279,6 +401,8 @@ SecurityChest: { Tooltip: "" } +// End of Draedon Structures + EutrophicGlass: { DisplayName: Eutrophic Glass Tooltip: "" @@ -294,6 +418,30 @@ HardenedEutrophicSand: { Tooltip: "" } +// Floral Paradise + +AlgalSlateItem: { + DisplayName: Algal Slate + Tooltip: "" +} + +PeatItem: { + DisplayName: Peat + Tooltip: "" +} + +PeatMossItem: { + DisplayName: Peat Moss + Tooltip: "" +} + +ScintillatingBloom: { + DisplayName: Scintillating Bloom + Tooltip: "" +} + +// End of Floral Paradise + AbyssTreasureChest: { DisplayName: Ancient Treasure Chest Tooltip: "" @@ -343,6 +491,32 @@ BabyGhostBellJar: { Tooltip: "" } +CalamityCanvas2023: { + DisplayName: Calamity Canvas 2023 + Tooltip: + ''' + when placed to open a UI which allows customizing the focus of the painting + to make the focus follow the cursor, again to set it + Arrow keys can also be used to manually adjust the focus point + The scroll wheel zooms the focus in and out + Hold SHIFT to hide the UI without closing it + 'Embrace chaos' + ''' +} + +CalamityCanvas2024: { + DisplayName: Calamity Canvas 2024 + Tooltip: + ''' + when placed to open a UI which allows customizing the focus of the painting + to make the focus follow the cursor, again to set it + Arrow keys can also be used to manually adjust the focus point + The scroll wheel zooms the focus in and out + Hold SHIFT to hide the UI without closing it + 'Embrace havoc' + ''' +} + CirrusCouch: { DisplayName: Cirrus Couch Tooltip: This shouldn't exist... @@ -512,8 +686,9 @@ CorruptionEffigy: { DisplayName: Corruption Effigy Tooltip: ''' - When placed down, nearby players have their movement speed and crit chance increased by 10% - Nearby players also suffer a 5% decrease to their damage reduction + when placed to gain {0}% increased movement speed and critical strike chance + However, this comes at a cost of {1}% damage reduction + This cannot be stacked with Crimson Effigy ''' } @@ -521,7 +696,7 @@ AltarOfTheAccursedItem: { DisplayName: Altar of the Accursed Tooltip: ''' - Offer Ashes of Calamity at this altar to summon the Witch + Offer [i:CalamityMod/AshesofCalamity] {$Items.Materials.AshesofCalamity.DisplayName} at this altar to summon the Witch Doing so will create a square arena of blocks, with the altar at its center The Witch enrages while you are outside of the arena {$CommonItemTooltip.SpecialCrafting} @@ -605,8 +780,9 @@ CrimsonEffigy: { DisplayName: Crimson Effigy Tooltip: ''' - When placed down nearby players have their damage increased by 15% and defense by 10 - Nearby players also suffer a 10% decrease to their maximum health + when placed to gain {0}% damage and {1} defense + However, this comes at a cost of {2}% maximum health + This cannot be stacked with Corruption Effigy ''' } @@ -626,7 +802,7 @@ EffigyOfDecay: { ''' When placed down, nearby players can breathe underwater This effect does not work in the abyss - Nearby players are also immune to the sulphuric poisoning + Nearby players are also immune to the {$Buffs.SulphuricPoisoning.DisplayName} ''' } @@ -695,11 +871,26 @@ ExoObelisk: { Tooltip: "'Energize the atmosphere with exo energy.'" } +ForgottenNobleStatue: { + DisplayName: Forgotten Noble Statue + Tooltip: "" +} + +ForgottenScholarStatue: { + DisplayName: Forgotten Scholar Statue + Tooltip: "" +} + FrigidMonolith: { DisplayName: Frigid Monolith Tooltip: "'Enchant the sky with frosty auroras.'" } +OtonilouStatue: { + DisplayName: Otonilou Memorial + Tooltip: "" +} + PlagueHumidifier: { DisplayName: Plague Humidifier Tooltip: "'Spread light amounts of the plague through the air.'" @@ -725,12 +916,17 @@ RefractivePrismTorch: { Tooltip: Can be placed in water } +RepairUnitCage: { + DisplayName: Repair Unit Cage + Tooltip: "" +} + ResilientCandle: { DisplayName: Resilient Candle Tooltip: ''' - when placed to make defense block 10% more damage - (60% in Classic, 85% in Expert, and 110% in Master) + when placed to make defense block {0}% more damage + ({1}% in Classic, {2}% in Expert, and {3}% in Master) This cannot be stacked with other Cirrus Candle buffs 'Neither rain nor wind can snuff its undying flame' ''' @@ -750,8 +946,8 @@ SpitefulCandle: { DisplayName: Spiteful Candle Tooltip: ''' - when placed to deal 1.07x damage to all enemies - The extra 0.07x damage bypasses enemy defense and damage reduction + when placed to deal {0}x damage to all enemies + The extra {1}x damage bypasses enemy defense and damage reduction This cannot be stacked with other Cirrus Candle buffs 'Its hateful glow flickers with ire' ''' @@ -762,6 +958,11 @@ SulphurousTorch: { Tooltip: Can be placed in water } +SunkenIdol: { + DisplayName: Sunken Idol + Tooltip: "" +} + ThaumaticChair: { DisplayName: Thaumatic Chair Tooltip: One of Chloe's finest creations @@ -976,7 +1177,7 @@ VigorousCandle: { DisplayName: Vigorous Candle Tooltip: ''' - when placed to regenerate 0.4% of your maximum health per second + when placed to regenerate {0}% of your maximum health per second This regeneration is at full power even while moving and bypasses Revengeance Mode caps This cannot be stacked with other Cirrus Candle buffs 'Its brilliant light suffuses those nearby with hope' @@ -987,7 +1188,7 @@ WeightlessCandle: { DisplayName: Weightless Candle Tooltip: ''' - when placed to gain 10% increased movement speed, wing time and acceleration + when placed to gain {0}% increased movement speed, wing time and acceleration This cannot be stacked with other Cirrus Candle buffs 'The floating flame seems to uplift your very spirit' ''' @@ -998,10 +1199,15 @@ WulfrumLureItem: { Tooltip: ''' Consumes [i:CalamityMod/EnergyCore] Energy Cores to emit a wulfrum signal that lures Wulfrum automatons out - The signal lasts for 30 seconds + The signal lasts for {0} seconds ''' } +ZenithThrone: { + DisplayName: Zenith Throne + Tooltip: "'There will be no games, only damage per second...'" +} + AbyssBathtub: { DisplayName: Abyss Bathtub Tooltip: "" @@ -1671,6 +1877,11 @@ CosmiliteWorkBench: { Tooltip: "" } +AncientSmoothNavystone: { + DisplayName: Ancient Smooth Navystone + Tooltip: "" +} + EutrophicBathtub: { DisplayName: Eutrophic Bathtub Tooltip: "" @@ -3095,6 +3306,13 @@ LivingHolyFireBlock: { Tooltip: "" } +LivingPlagueFireBlock: { + DisplayName: Living Plague Fire Block + Tooltip: "" +} + +// Music Boxes + DraedonExoSelectMusicBox: { DisplayName: Music Box (Exo Mech Selection) Tooltip: Plays 'Signal Received' by CDMusic @@ -3105,51 +3323,6 @@ DraedonTalkMusicBox: { Tooltip: Plays a variant of 'Signal Received' by CDMusic } -Basalt: { - DisplayName: Basalt - Tooltip: "" -} - -Driftwood: { - DisplayName: Driftwood - Tooltip: "" -} - -Navystone: { - DisplayName: Navystone - Tooltip: "" -} - -Shellstone: { - DisplayName: Shellstone - Tooltip: "" -} - -PolishedNavystoneBrick: { - DisplayName: Polished Navystone Brick - Tooltip: "" -} - -ShellstoneSlab: { - DisplayName: Shellstone Slab - Tooltip: "" -} - -BlackPearlPile: { - DisplayName: Black Pearl Pile - Tooltip: "" -} - -PinkPearlPile: { - DisplayName: Pink Pearl Pile - Tooltip: "" -} - -WhitePearlPile: { - DisplayName: White Pearl Pile - Tooltip: "" -} - NovaeSlag: { DisplayName: Novae Slag Tooltip: "" @@ -3295,6 +3468,11 @@ SpineSapling: { Tooltip: Plants Giant Spine saplings on Brimstone Slag } +Stohne: { + DisplayName: Stohne + Tooltip: "" +} + SulphurousSand: { DisplayName: Sulphurous Sand Tooltip: "" @@ -3310,6 +3488,105 @@ SulphurousShale: { Tooltip: "" } +// Sunken Sea + +Basalt: { + DisplayName: Basalt + Tooltip: "" +} + +Driftwood: { + DisplayName: Driftwood + Tooltip: "" +} + +Navystone: { + DisplayName: Navystone + Tooltip: "" +} + +Shellstone: { + DisplayName: Shellstone + Tooltip: "" +} + +PolishedNavystoneBrick: { + DisplayName: Polished Navystone Brick + Tooltip: "" +} + +ShellstoneSlab: { + DisplayName: Shellstone Slab + Tooltip: "" +} + +BlackPearlPile: { + DisplayName: Black Pearl Pile + Tooltip: "" +} + +PinkPearlPile: { + DisplayName: Pink Pearl Pile + Tooltip: "" +} + +WhitePearlPile: { + DisplayName: White Pearl Pile + Tooltip: "" +} + +CyanCoral: { + DisplayName: Cyan Coral + Tooltip: "" +} + +MagentaCoral: { + DisplayName: Magenta Coral + Tooltip: "" +} + +OrangeCoral: { + DisplayName: Orange Coral + Tooltip: "" +} + +LimeCoral: { + DisplayName: Lime Coral + Tooltip: "" +} + +YellowCoral: { + DisplayName: Yellow Coral + Tooltip: "" +} + +Runestone: { + DisplayName: Runestone + Tooltip: "" +} + +RuneSand: { + DisplayName: Runesand + Tooltip: "" +} + +Limestone: { + DisplayName: Limestone + Tooltip: "" +} + +PolypSand: { + DisplayName: Polyp Sand + Tooltip: "" +} + +VolcanicSand: { + DisplayName: Volcanic Sand + Tooltip: "" +} + +// End of Sunken Sea + UelibloomBrick: { DisplayName: Uelibloom Brick Tooltip: "" @@ -3415,6 +3692,8 @@ CryonicBrickWall: { Tooltip: "" } +// Draedon + HazardChevronWall: { DisplayName: Hazard Chevron Wall Tooltip: "" @@ -3455,6 +3734,13 @@ RustedPlatingWall: { Tooltip: "" } +// End of Draedon + +DriftwoodWall: { + DisplayName: Driftwood Wall + Tooltip: "" +} + ElumplateWall: { DisplayName: Elumplate Wall Tooltip: "" @@ -3560,6 +3846,11 @@ ProfanedSlabWall: { Tooltip: "" } +PyreMantleWall: { + DisplayName: Pyre Mantle Wall + Tooltip: "" +} + RunicProfanedBrickWall: { DisplayName: Runic Profaned Brick Wall Tooltip: "" @@ -3753,77 +4044,157 @@ WaterTurret: { ''' } -CyanCoral: { - DisplayName: Cyan Coral +// Draedon lab lights + +CagedLablightItem: { + DisplayName: Caged Lablight Tooltip: "" } -MagentaCoral: { - DisplayName: Magenta Coral +AgedLablightItem: { + DisplayName: Aged Lablight Tooltip: "" } -OrangeCoral: { - DisplayName: Orange Coral +MiniCagedLablightItem: { + DisplayName: Mini Caged Lablight Tooltip: "" } -LimeCoral: { - DisplayName: Lime Coral +MiniAgedLablightItem: { + DisplayName: Mini Aged Lablight Tooltip: "" } -YellowCoral: { - DisplayName: Yellow Coral +CagedCinderlightItem: { + DisplayName: Caged Cinderlight Tooltip: "" } -Runestone: { - DisplayName: Runestone +AgedCinderlightItem: { + DisplayName: Aged Cinderlight Tooltip: "" } -RuneSand: { - DisplayName: Runesand +MiniCagedCinderlightItem: { + DisplayName: Mini Caged Cinderlight Tooltip: "" } -Limestone: { - DisplayName: Limestone +MiniAgedCinderlightItem: { + DisplayName: Mini Aged Cinderlight Tooltip: "" } -PolypSand: { - DisplayName: Polyp Sand +CagedFlamelightItem: { + DisplayName: Caged Flamelight Tooltip: "" } -VolcanicSand: { - DisplayName: Volcanic Sand +AgedFlamelightItem: { + DisplayName: Aged Flamelight Tooltip: "" } -DriftwoodWall: { - DisplayName: Driftwood Wall +MiniCagedFlamelightItem: { + DisplayName: Mini Caged Flamelight Tooltip: "" } -AlgalSlateItem: { - DisplayName: Algal Slate +MiniAgedFlamelightItem: { + DisplayName: Mini Aged Flamelight Tooltip: "" } -PeatItem: { - DisplayName: Peat +CagedFrostlightItem: { + DisplayName: Caged Frostlight Tooltip: "" } -PeatMossItem: { - DisplayName: Peat Moss +AgedFrostlightItem: { + DisplayName: Aged Frostlight Tooltip: "" } -ScintillatingBloom: { - DisplayName: Scintillating Bloom +MiniCagedFrostlightItem: { + DisplayName: Mini Caged Frostlight + Tooltip: "" +} + +MiniAgedFrostlightItem: { + DisplayName: Mini Aged Frostlight + Tooltip: "" +} + +CagedBiolightItem: { + DisplayName: Caged Biolight + Tooltip: "" +} + +AgedBiolightItem: { + DisplayName: Aged Biolight + Tooltip: "" +} + +MiniCagedBiolightItem: { + DisplayName: Mini Caged Biolight + Tooltip: "" +} + +MiniAgedBiolightItem: { + DisplayName: Mini Aged Biolight + Tooltip: "" +} + +CagedBlacklightItem: { + DisplayName: Caged Blacklight + Tooltip: "" +} + +AgedBlacklightItem: { + DisplayName: Aged Blacklight + Tooltip: "" +} + +MiniCagedBlacklightItem: { + DisplayName: Mini Caged Blacklight + Tooltip: "" +} + +MiniAgedBlacklightItem: { + DisplayName: Mini Aged Blacklight + Tooltip: "" +} + +CagedFloodlightItem: { + DisplayName: Caged Floodlight + Tooltip: "" +} + +AgedFloodlightItem: { + DisplayName: Aged Floodlight + Tooltip: "" +} + +MiniCagedFloodlightItem: { + DisplayName: Mini Caged Floodlight + Tooltip: "" +} + +MiniAgedFloodlightItem: { + DisplayName: Mini Aged Floodlight + Tooltip: "" +} + +ProbesnoutBanner.DisplayName: Probesnout Banner +SharkoonBanner.DisplayName: Sharkoon Banner + +LimestoneWall: { + DisplayName: Limestone Wall + Tooltip: "" +} + +RunestoneWall: { + DisplayName: Runestone Wall Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 295ba11731..eda5f6d73f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -5,12 +5,16 @@ AnechoicCoating: { AstralInjection: { DisplayName: Astral Injection - Tooltip: Gives mana sickness and hurts you when used, but you regenerate mana extremely quickly even while moving or casting spells + Tooltip: + ''' + Restores {0} mana per second + Lower your health by {1} and inflicts {$BuffName.ManaSickness} when used + ''' } AureusCell: { DisplayName: Aureus Cell - Tooltip: Grants increased mana regeneration and magic power + Tooltip: Grants the {$BuffName.MagicPower} and {$BuffName.ManaRegeneration} buffs } Baguette: { @@ -18,7 +22,7 @@ Baguette: { Tooltip: ''' {$CommonItemTooltip.MinorStats} - Red Wine heals 250 HP, but reduces life regen by 2 HP/s + {$Potions.RedWine.DisplayName} heals {0} HP, but reduces life regen by {1} HP/s [c/FCE391:'je suis Monte'] ''' } @@ -34,12 +38,12 @@ BlasphemousDonut: { BoundingPotion: { DisplayName: Bounding Potion - Tooltip: 5% increased jump speed, 25 extra blocks of fall damage resistance, and increased jump height + Tooltip: "{0}% increased jump speed and {1}% increased jump height" } CalciumPotion: { DisplayName: Calcium Potion - Tooltip: Grants immunity to fall damage + Tooltip: Grants {0}% knockback resistance } CeaselessHungerPotion: { @@ -67,29 +71,29 @@ Fabsoup: { FlaskOfBrimstone: { DisplayName: Flask of Brimstone - Tooltip: Melee, Whip, and Rogue attacks inflict Brimstone Flames + Tooltip: Melee, Whip, and Rogue attacks inflict {$Buffs.BrimstoneFlames.DisplayName} } FlaskOfCrumbling: { DisplayName: Flask of Crumbling - Tooltip: Melee, Whip, and Rogue attacks inflict Crumbling on enemies + Tooltip: Melee, Whip, and Rogue attacks inflict {$Buffs.Crumbling.DisplayName} } FlaskOfHolyFlames: { DisplayName: Flask of Holy Flames - Tooltip: Melee, Whip, and Rogue attacks inflict Holy Flames + Tooltip: Melee, Whip, and Rogue attacks inflict {$Buffs.HolyFlames.DisplayName} } GravityNormalizerPotion: { DisplayName: Gravity Normalizer Potion - Tooltip: Disables the low gravity of space and grants immunity to the distorted debuff + Tooltip: Disables the low gravity of space and grants immunity to the {$BuffName.VortexDebuff} debuff } HadalStew: { DisplayName: Hadal Stew Tooltip: ''' - Only gives [S] seconds of Potion Sickness + Only gives [S] seconds of {$BuffName.PotionSickness} {$CommonItemTooltip.MediumStats} {$CommonItemTooltip.MinuteDuration} ''' @@ -102,12 +106,7 @@ OmegaHealingPotion: { PhotosynthesisPotion: { DisplayName: Photosynthesis Potion - Tooltip: - ''' - Grants +0.5 HP/s life regen and accelerates natural life regen while not moving - This natural life regen effect is five times as strong during daytime - Dropped hearts heal more HP - ''' + Tooltip: Dropped hearts heal {0} more HP } PotionofOmniscience: { @@ -123,21 +122,15 @@ ShadowPotion: { DisplayName: Shadow Potion Tooltip: ''' + {0}% increased stealth generation Turns the player into a shadow with glowing eyes - Rogue weapons spawn projectiles on hit - 8% increased stealth generation Visual effects can be disabled with the Stealth Invisibility config ''' } SoaringPotion: { DisplayName: Soaring Potion - Tooltip: - ''' - 10% increased flight time and horizontal flight speed - Restores a fraction of your wing flight time after a true melee strike - The amount of flight time restored scales with your melee stats and weapon swing speed - ''' + Tooltip: "{0}% increased flight time and horizontal flight speed" } SulphurskinPotion: { @@ -155,15 +148,6 @@ SupremeManaPotion: { Tooltip: "" } -TeslaPotion: { - DisplayName: Tesla Potion - Tooltip: - ''' - Summons an aura of electricity that electrifies and slows enemies - Aura damage is reduced on bosses - ''' -} - ZenPotion: { DisplayName: Zen Potion Tooltip: Vastly decreases enemy spawn rate @@ -179,9 +163,9 @@ BloodyMary: { DisplayName: Bloody Mary Tooltip: ''' - 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 + {0}% increased damage and movement speed during a Blood Moon + Reduces life regen by {1} HP/s and defense by {2}% + {$Common.AlcoholWarning} [c/B00BA5:'Extra spicy... and bloody!'] ''' } @@ -190,9 +174,9 @@ CaribbeanRum: { DisplayName: Caribbean Rum Tooltip: ''' - 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 + Increases life regen by {0} HP/s, movement speed by {1}% + Makes you floaty and reduces defense by {2}% + {$Common.AlcoholWarning} [c/B00BA5:'Why is the rum gone?'] ''' } @@ -201,21 +185,32 @@ CinnamonRoll: { DisplayName: Cinnamon Roll Tooltip: ''' - 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 + Multiplies all fire-based debuff damage by {0}x and increases mana regeneration + Reduces defense by {1}% + {$Common.AlcoholWarning} [c/B00BA5:'A great-tasting cinnamon whiskey with a touch of cream soda.'] ''' } +CirrusVodka: { + DisplayName: Cirrus' Vodka + Tooltip: + ''' + {0}% increased damage, but lowers defense by {1}% + Increases immune time after being struck + {$Common.AlcoholWarning} + This magical liquor is highly sought by those with a refined palate + ''' +} + Everclear: { DisplayName: Everclear Tooltip: ''' - 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 + {0}% increased damage + Reduces life regen by {1} HP/s and defense by {2}% + Counts as 2 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} + {$Common.AlcoholWarning} [c/B00BA5:'This is the most potent booze I have, be careful with it.'] ''' } @@ -224,31 +219,20 @@ EvergreenGin: { DisplayName: Evergreen Gin Tooltip: ''' - 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 + Multiplies all sickness and water-related debuff damage by {0}x + Reduces life regen by {1} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'It tastes like a Christmas tree, if you can imagine that.'] ''' } -FabsolsVodka: { - DisplayName: Fabsol's Vodka - Tooltip: - ''' - 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 - ''' -} - Fireball: { DisplayName: Fireball Tooltip: ''' - 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 + Multiplies all fire-based debuff damage by {0}x + Reduces life regen by {1} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'A great-tasting cinnamon whiskey.'] ''' } @@ -257,8 +241,8 @@ GrapeBeer: { DisplayName: Grape Beer Tooltip: ''' - Reduces defense by 3% for 15 seconds - Drinking more than 3 different alcohols might not end well with your liver + Reduces defense by {0}% for {1} seconds + {$Common.AlcoholWarning} [c/B00BA5:'This crap is abhorrent, but you might like it.'] ''' } @@ -268,10 +252,10 @@ Margarita: { Tooltip: ''' 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 + Reduces defense by {0}% and life regen by {1} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'One of the best drinks ever created, enjoy it while it lasts.'] + {$CommonItemTooltip.MinuteDuration@2} ''' } @@ -279,9 +263,9 @@ Moonshine: { DisplayName: Moonshine Tooltip: ''' - 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 + Increases defense by {0} and damage reduction by {1}% + Reduces life regen by {2} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'This stuff is pretty strong, but I'm sure you can handle it.'] ''' } @@ -290,9 +274,9 @@ MoscowMule: { DisplayName: Moscow Mule Tooltip: ''' - 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 + Increases damage by {0}%, knockback by {1}% and critical strike chance by {2}% + Reduces life regen by {3} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'I once heard the copper mug can be toxic and I told 'em, 'listen, dummy, I'm already poisoning myself!''] ''' } @@ -312,9 +296,9 @@ OldFashioned: { DisplayName: Old Fashioned Tooltip: ''' - 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 + Multiplies most non-weapon, non-debuff damage by {0}x + Multiplies all weapon damage by {1}x + {$Common.AlcoholWarning} [c/B00BA5:'An old favorite of mine.'] ''' } @@ -323,8 +307,8 @@ RedWine: { DisplayName: Red Wine 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 + Reduces life regen by {0} HP/s for {1} seconds + {$Common.AlcoholWarning} [c/B00BA5:'Too dry for my taste.'] ''' } @@ -333,9 +317,9 @@ Rum: { DisplayName: Rum Tooltip: ''' - 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 + Increases life regen by {0} HP/s and movement speed by {1}% + Reduces defense by {2}% + {$Common.AlcoholWarning} [c/B00BA5:'Sweet and potent, just how I like it.'] ''' } @@ -344,9 +328,9 @@ Screwdriver: { DisplayName: Screwdriver Tooltip: ''' - 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 + Multiplies piercing projectile damage by {0}x + Reduces life regen by {1} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'Do you have a screw loose?'] ''' } @@ -355,10 +339,10 @@ StarBeamRye: { DisplayName: Star Beam Rye Tooltip: ''' - 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 + Increases max mana by {0}, magic damage by {1}%, + and reduces mana usage by {2}% + Reduces defense by {3}% and life regen by {4} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'Made from some stuff I found near the Astral Meteor crash site. Don't worry, it's safe, trust me...'] ''' } @@ -367,9 +351,9 @@ Tequila: { DisplayName: Tequila Tooltip: ''' - 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 + Increases knockback by {0}%, crit chance by {1}% and defense by {2} during daytime + Reduces life regen by {3} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'Great for mixing up daytime drinks.'] ''' } @@ -378,9 +362,9 @@ TequilaSunrise: { DisplayName: Tequila Sunrise Tooltip: ''' - 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 + Increases knockback by {0}%, crit chance by {1}% and defense by {2} during daytime + Reduces life regen by {3} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'The greatest daytime drink I've ever had.'] ''' } @@ -389,9 +373,9 @@ Vodka: { DisplayName: Vodka Tooltip: ''' - 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 + Increases damage by {0}% and critical strike chance by {1}% + Reduces life regen by {2} HP/s and defense by {3}% + {$Common.AlcoholWarning} [c/B00BA5:'The number one alcohol for creating great mixed drinks.'] ''' } @@ -400,9 +384,9 @@ Whiskey: { DisplayName: Whiskey Tooltip: ''' - 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 + Increases damage by {0}%, knockback by {1}% and critical strike chance by {2}% + Reduces defense by {3}% + {$Common.AlcoholWarning} [c/B00BA5:'The burning sensation makes it tastier.'] ''' } @@ -411,9 +395,48 @@ WhiteWine: { DisplayName: White Wine Tooltip: ''' - 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 + Increases magic damage by {0}% + Reduces defense by {1}% and life regen by {2} HP/s + {$Common.AlcoholWarning} [c/B00BA5:'I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day.'] ''' } + +// Food +Barberry: { + DisplayName: Barberry + Tooltip: "{$CommonItemTooltip.MediumStats}" +} + +Cometfruit: { + DisplayName: Cometfruit + Tooltip: + ''' + {$CommonItemTooltip.MediumStats} + 'Tastes stellar!' + ''' +} + +Jackfruit: { + DisplayName: Jackfruit + Tooltip: "{$CommonItemTooltip.MinorStats}" +} + +Lotus: { + DisplayName: Lotus + Tooltip: "{$CommonItemTooltip.MediumStats}" +} + +Mangosteen: { + DisplayName: Mangosteen + Tooltip: + ''' + {$CommonItemTooltip.MediumStats} + 'Queen of fruits' + ''' +} + +Salak: { + DisplayName: Salak + Tooltip: "{$CommonItemTooltip.MinorStats}" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index f07dbba2cc..ad00243c80 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -4,7 +4,7 @@ Abombination: { ''' Summons the Plaguebringer Goliath when used in the Jungle Enrages outside the Jungle - Not consumable + {$Common.NotConsumable} 'Radio capable of emitting a frequency recognized by the Plague nanovirus.' ''' } @@ -15,13 +15,13 @@ AstralChunk: { ''' Summons Astrum Aureus when used in the Astral Infection Enrages during the day while outside the Astral Infection - Not consumable + {$Common.NotConsumable} 'The Infection's fortress has found another target.' ''' } BloodwormItem: { - DisplayName: Bloodworm + DisplayName: "{$NPCs.BloodwormNormal.DisplayName}" Tooltip: ''' Summons The Old Duke if used as bait in the Sulphurous Sea @@ -35,7 +35,7 @@ BloodyWormFood: { ''' Summons the Perforator Hive when used in the Crimson Enrages outside the Underground Crimson - Not consumable + {$Common.NotConsumable} 'Do not play with your food, they won't play with theirs.' ''' } @@ -45,7 +45,7 @@ CausticTear: { Tooltip: ''' Causes an acidic downpour in the Sulphurous Sea - Not consumable + {$Common.NotConsumable} ''' } @@ -54,7 +54,7 @@ CeremonialUrn: { Tooltip: ''' Use at the Altar of the Accursed to summon the Supreme Witch, Calamitas - Not consumable + {$Common.NotConsumable} 'The Witch will not allow it to happen once again.' ''' } @@ -65,7 +65,7 @@ CharredIdol: { ''' Summons the Brimstone Elemental when used in the Brimstone Crags Enrages outside the Brimstone Crags - Not consumable + {$Common.NotConsumable} 'Anything under her gaze shall be scorched beyond recognition.' ''' } @@ -75,7 +75,7 @@ CosmicWorm: { Tooltip: ''' Summons the Devourer of Gods - Not consumable + {$Common.NotConsumable} 'The Nameless Serpent has set out for you.' ''' } @@ -87,7 +87,7 @@ CryoKey: { ''' [SPAWN] Enrages outside the tundra - Not consumable + {$Common.NotConsumable} 'A key for a glacial prison.' ''' SpawnNormal: Summons Cryogen when used in the tundra @@ -99,7 +99,7 @@ DeathWhistle: { Tooltip: ''' Summons the Ravager - Not consumable + {$Common.NotConsumable} 'One of the few sounds the flesh golem still recognizes.' ''' } @@ -110,7 +110,7 @@ DecapoditaSprout: { ''' Summons Crabulon when used in the Mushroom biome Enrages outside the Underground Mushroom biome - Not consumable + {$Common.NotConsumable} 'Bristling with the spores of a unique, parasitic strain.' ''' } @@ -121,7 +121,7 @@ DesertMedallion: { ''' Summons the Desert Scourge when used in the Desert Enrages outside the Desert - Not consumable + {$Common.NotConsumable} 'The Scourge seeks for another meal.' ''' } @@ -131,7 +131,7 @@ EidolonTablet: { Tooltip: ''' Summons the Lunatic Cultist - Not consumable + {$Common.NotConsumable} 'An aged artifact venerated by the Dragon Cult.' ''' } @@ -142,7 +142,7 @@ ExoticPheromones: { ''' Summons Dragonfolly when used in the Jungle Enrages outside the Jungle - Not consumable + {$Common.NotConsumable} 'Pheromones used for hunting Draconic Offshoots.' ''' } @@ -154,12 +154,23 @@ EyeofDesolation: { ''' Summons the Calamitas Clone when used during nighttime[GFB] Enrages during the day - Not consumable + {$Common.NotConsumable} 'She is here.' ''' GFBInfo: Creates a square arena of blocks, with you at its center } +NaiadsWarhorn: { + DisplayName: Naiad's Warhorn + Tooltip: + ''' + Summons Anahita when used in the Ocean + Enrages outside the Ocean + {$Common.NotConsumable} + 'An instrument used by mermen to call upon Anahita. Its melody is oddly alluring.' + ''' +} + MarkofProvidence: { DisplayName: Mark of Providence Tooltip: @@ -167,7 +178,7 @@ MarkofProvidence: { An ornate sigil of the Profaned Flame Hatred yet burns upon its brow [SPAWN] - Not consumable + {$Common.NotConsumable} ''' SpawnInfo: Such power attracts otherworldly beings SpawnVoid: @@ -184,7 +195,7 @@ MartianDistressRemote: { Tooltip: ''' Summons the Martian Madness - Not consumable + {$Common.NotConsumable} ''' } @@ -193,7 +204,7 @@ NecroplasmicBeacon: { Tooltip: ''' Summons Polterghast when used in the Dungeon - Not consumable + {$Common.NotConsumable} 'The wails of the spirits disturbed something far more terrifying.' ''' } @@ -203,22 +214,12 @@ NO: { Tooltip: U } -OldPowerCell: { - DisplayName: Old Power Cell - Tooltip: - ''' - Summons the Golem when used in the Jungle Temple - Enrages outside the Jungle Temple - Not consumable - ''' -} - OverloadedSludge: { DisplayName: Overloaded Sludge Tooltip: ''' Summons the Slime God - Not consumable + {$Common.NotConsumable} 'Writhing and bloated with the pus of Gods long dead.' ''' } @@ -229,7 +230,7 @@ Portabulb: { ''' Summons Plantera when used in the Jungle Enrages outside the Underground Jungle - Not consumable + {$Common.NotConsumable} ''' } @@ -238,9 +239,8 @@ ProfanedCore: { Tooltip: ''' Summons Providence when used in the Hallow or Underworld - Unique drop changes depending on the biome fought in - Enrages when fought during nighttime - Not consumable + Use again while Providence is at high health to unleash Her perfect fury + {$Common.NotConsumable} 'The heart of Her Guardians, Her wicked wrath shall burn upon whoever now wields it.' ''' } @@ -249,16 +249,10 @@ ProfanedShard: { DisplayName: Profaned Shard Tooltip: ''' - [SPAWN] - Not consumable + Summons the Profaned Guardians when used in the Hallow or Underworld + {$Common.NotConsumable} 'Her Guardians seek the holder of such vast stolen power.' ''' - SpawnNormal: - ''' - Summons the Profaned Guardians when used in the Hallow or Underworld - Enrages when fought during nighttime - ''' - SpawnRemix: Summons the Profaned Guardians when used in the Hallow or Underworld } SandstormsCore: { @@ -266,7 +260,7 @@ SandstormsCore: { Tooltip: ''' Summons the Great Sand Shark when used in the [BIOME] - Not consumable + {$Common.NotConsumable} ''' } @@ -276,7 +270,7 @@ Seafood: { ''' Summons the Aquatic Scourge when used in the Sulphurous Sea Enrages outside the Sulphurous Sea - Not consumable + {$Common.NotConsumable} 'Large bait for a large catch. Beware the monsters of the seas.' ''' } @@ -297,7 +291,7 @@ Teratoma: { ''' Summons the Hive Mind when used in the Corruption Enrages outside the Underground Corruption - Not consumable + {$Common.NotConsumable} 'An exquisitely hideous tumor for those diseased in the head.' ''' } @@ -314,7 +308,7 @@ YharonEgg: { ''' Summons Yharon, Dragon of Rebirth Enrages outside the fire walls - Not consumable + {$Common.NotConsumable} 'A symbol of the Dragon watching over and waiting for you.' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index fc4392598f..7b35e3cf51 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -47,8 +47,8 @@ AxeofPurity: { DisplayName: Axe of Purity Tooltip: ''' - Left click to use as a tool - Right click to cleanse evil + to use as a tool + to cleanse evil ''' } @@ -72,10 +72,7 @@ BobbitHook: { Tooltip: ''' Retracts upon attaching to a tile with extreme speeds - Reach: 40 - Launch Velocity: 25 - Reelback Velocity: 28 - Pull Velocity: 24 + {$Common.GrappleStats} ''' } @@ -93,7 +90,7 @@ CrystylCrusher: { Tooltip: ''' Hold to channel a beam that destroys just about anything - 'Gotta dig faster, gotta go deeper' + 'A primitive weapon from a bygone era...' ''' } @@ -124,7 +121,7 @@ Gelpick: { GenesisPickaxe: { DisplayName: Genesis Pickaxe - Tooltip: Can mine Uelibloom Ore + Tooltip: "{$Common.CanMineUelibloom}" } Grax: { @@ -155,7 +152,7 @@ MarniteDeconstructor: { Tooltip: ''' Its engine generates hardlight rays capable of excavating walls from a long distance - Ignores 10 points of enemy Defense + {$Common.ArmorPenetration} ''' } @@ -164,7 +161,7 @@ MarniteObliterator: { Tooltip: ''' Uses a diamond focus to project a long-range digging beam of light - Ignores 5 points of enemy Defense + {$Common.ArmorPenetration} ''' } @@ -241,7 +238,7 @@ WulfrumScaffoldKit: { DisplayName: Wulfrum Scaffold Kit Tooltip: ''' - Places down temporary metal scaffolding. Uses up one wulfrum metal scrap for 40 tiles built + Places down temporary metal scaffolding. Uses up [i:CalamityMod/WulfrumMetalScrap] {$Items.Materials.WulfrumMetalScrap.DisplayName} for {0} tiles built Scaffold needs to be adjacent to a solid tile to be placed down 'For when you need something built fast and don't need it to last.' ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson index 07965c9f35..4dab8cfc05 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson @@ -120,7 +120,7 @@ StormWeaverBag: { } YharonBag: { - DisplayName: Treasure Bag (Yharon) + DisplayName: Treasure Cache (Yharon) Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 94ed0edea1..946e20f0c3 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -148,7 +148,8 @@ PulseTurretRemote: { DisplayName: Pulse Turret Remote Tooltip: ''' - Summons a pulse turret which eradicates nearby foes with focused energy blasts + {$CommonItemTooltip.Sentry} + Summons a turret to fire explosive pulse blasts at your enemies Only one pulse turret may exist at a time ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 8c4fbd7b25..fa5537a35f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -106,7 +106,13 @@ ArtAttack: { AsteroidStaff: { DisplayName: Asteroid Staff - Tooltip: Summons asteroids from the sky + Tooltip: "[GFB]" + TooltipNormal: Summons asteroids from the sky + TooltipGFB: + ''' + Core Keeper Chaos Staff + bottom text + ''' } AstralachneaStaff: { @@ -165,8 +171,9 @@ BurningSea: { DisplayName: Burning Sea Tooltip: ''' - Fires a bouncing brimstone fireball that splits into homing fireballs upon collision with liquid - Enemies inflicted with a water debuff also spawn homing fireballs on hit + Conjures a massive brimstone fireball that hovers near you and incinerates foes + Holding the fireball for too long causes it to burn out + This burns you with Brimstone Flames and gives a long delay before another can be cast ''' } @@ -212,7 +219,7 @@ CoralSpout: { CosmicRainbow: { DisplayName: Cosmic Rainbow - Tooltip: Launches a barrage of rainbows + Tooltip: Launches a barrage of rainbows and homing sparkles } Cryophobia: { @@ -275,7 +282,7 @@ EidolicWail: { DisplayName: Eidolic Wail Tooltip: ''' - Fires a string of bouncing sound waves that become stronger as they travel + Fires a string of bouncing sound waves that slow down on enemy hits RIP headphone users ''' } @@ -337,7 +344,11 @@ FatesReveal: { FlareBolt: { DisplayName: Flare Bolt - Tooltip: Casts a slow-moving ball of flame + Tooltip: + ''' + Casts a ball of flame + Balls of flame collapse into a swirling backdraft which pulls in enemies + ''' } ForbiddenSun: { @@ -347,12 +358,22 @@ ForbiddenSun: { FrigidflashBolt: { DisplayName: Frigidflash Bolt - Tooltip: Casts a slow-moving ball of flash-freezing magma + Tooltip: + ''' + Casts a fast ball of flash-freezing magma that bounces off tiles + When hitting a tile, a flarefrost burst is produced + Press to cast an empowered ball that creates a collapsing flarefrost vortex which explodes + ''' } FrostBolt: { DisplayName: Frost Bolt - Tooltip: Casts a slow-moving ball of frost + Tooltip: + ''' + Casts a ball of frost that bounces off tiles + When hitting a tile, a small frost burst is produced + Frost projectiles will fall to the ground after enough time has passed + ''' } Genesis: { @@ -391,11 +412,14 @@ GruesomeEminence: { DisplayName: Gruesome Eminence Tooltip: ''' - Summons a gaseous conglomeration of spirits near the cursor - At first, the spirits will fly wildly. This can hurt enemies and players - However, over time they will begin to accumulate to create a single, controllable monstrosity - [c/C61B40:'The spirits of the amalgam could never pass on to their desired afterlife,] - [c/C61B40:Tainted and melded by rage as they were.'] + Summons a gaseous conglomeration of spirits near the cursor that fly around wildly + Over time, the spirits accumulate to create a single, controllable monstrosity + ''' + Calamitas: + ''' + 'Many will tell you that Yharim fell from grace as his Crusade went on, but that's far from the truth. + Sure, he was a good man when he was killing assassins drunk on power, but even as he dethroned dictators, entire kingdoms were leveled alongside. + I wish more people could bear witness to this "Polterghast". Maybe then, they would understand the pain he caused for the world.' ''' } @@ -596,7 +620,7 @@ ParasiticSceptor: { PhantasmalFury: { DisplayName: Phantasmal Fury - Tooltip: Casts a phantasmal bolt that explodes into more bolts + Tooltip: Casts a vortex of homing souls around you that repels enemies and will fly towards your cursor after a few seconds } PhoenixFlameBarrage: { @@ -626,8 +650,8 @@ PlasmaRifle: { DisplayName: Plasma Rifle Tooltip: ''' - Fires a plasma blast that explodes - Press to rapidly fire plasma bolts + Fires an explosive plasma blast with pinpoint accuracy + Press to rapidly fire non-explosive blasts ''' } @@ -651,8 +675,8 @@ PrimordialAncient: { Tooltip: ''' Casts five primordial sand blasts that converge at your cursor after a moment and create a giant explosion - Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the Aeolian Earth Buff - The Aeolian Earth Buff increases your damage reduction by 8% and damage by 18% + Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.AeolianEarthBuff.DisplayName} buff + The {$Buffs.AeolianEarthBuff.DisplayName} buff increases your damage reduction by {0}% and damage by {1}% ''' } @@ -661,14 +685,18 @@ PrimordialEarth: { Tooltip: ''' Casts two enchanted blasts of sand that coverge with each other and explode - Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the Sand's Wind Buff - The Sand's Wind Buff increases your defense by 10 and damage by 12% + Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.SandsWindBuff.DisplayName} buff + The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0} and damage by {1}% ''' } PurgeGuzzler: { DisplayName: Purge Guzzler - Tooltip: Emits three beams of holy energy in a tight spread + Tooltip: + ''' + Fires a barrage of holy rays that converge into two massive sweeping beams + 'Baptism by holy fire' + ''' } RainbowPartyCannon: { @@ -682,9 +710,13 @@ Rancor: { Tooltip: ''' Casts a magic circle that charges energy and eventually releases a powerful laser burst of controlled maleficent magic - The laser causes arms and searing lava to appear on surfaces it touches which harm both you and enemies - [c/C61B40:'Forgiveness can only heal so much,] - [c/C61B40:If the recipient has not yet forgiven themselves.'] + The laser causes arms and searing lava to appear on surfaces it touches + ''' + Calamitas: + ''' + 'Yharim told me it was Otonilou who unleashed the Brimstone Elemental unto Azafure. + I believed him at the time, being a child looking for someone to blame for all her woes. + So I unleashed upon them all the fury and scorn I thought they deserved, and only once it was too late did I see through his lies.' ''' } @@ -723,7 +755,11 @@ SanguineFlare: { SeethingDischarge: { DisplayName: Seething Discharge - Tooltip: Fires a barrage of brimstone blasts + Tooltip: + ''' + Fires an accelerating arc of brimstone hellblasts + Every third attack spawns a brimstone dart ring which chases after foes + ''' } Serpentine: { @@ -731,7 +767,7 @@ Serpentine: { Tooltip: ''' Casts a serpent that follows the mouse cursor - Ignores 15 points of enemy Defense + {$Common.ArmorPenetration} ''' } @@ -747,7 +783,7 @@ ShaderainStaff: { ShadowboltStaff: { DisplayName: Shadowbolt Staff - Tooltip: The more tiles and enemies the beam bounces off of or travels through the more damage the beam does + Tooltip: Fires a shadow beam that creates a platform to redirect itself back at enemies for increased damage } ShiftingSands: { @@ -760,8 +796,18 @@ SHPC: { Tooltip: "[GFB]" TooltipNormal: ''' - Fires plasma orbs that linger and emit massive explosions - Press to fire powerful energy beams + Consumes Souls as ammo + Fires orbs of unstable, concentrated soulpower that linger after ejection + Orbs create a large explosion and emit seeking souls after collapse + Orbs have varying effects depending on Soul type used + Press Right Click to discharge all soulpower in the weapon as weak energy beams + ''' + LegendaryText: + ''' + 'Though soul-powered machines were a near failure, potential remained in souls as a form of fuel. + To avoid my last experiments' main flaw, the Soul-Harnessing Plasma Cannon was designed to expel souls as projectiles before they exert control over the weapon. + Each soul type appears to react differently to the base plasma. Yet, lacking volunteers, obtaining potential ammunition is currently too difficult to undergo further testing. + A shame, for a weapon that could have practically unlimited ammunition in the battlefield. Perhaps some day, its potential can be truly tested.' ''' TooltipGFB: It scales again :) } @@ -861,7 +907,7 @@ ThePrince: { DisplayName: The Prince Tooltip: ''' - Casts a holy fireball that explodes into 6 flames + Casts a holy fireball that explodes into six homing flames 'So you're telling me that the prince exploded, and then turned into a flower?' -Dain, the sailor druid ''' @@ -887,15 +933,6 @@ ThornBlossom: { ''' } -Thunderstorm: { - DisplayName: Thunderstorm - Tooltip: - ''' - Fires a stream of exploding green plasma bullets that rain down additional plasma from the sky - 'Make it rain' - ''' -} - Tradewinds: { DisplayName: Tradewinds Tooltip: Casts fast moving sunlight feathers @@ -956,7 +993,11 @@ Viscera: { VitriolicViper: { DisplayName: Vitriolic Viper - Tooltip: Releases a volley of venomous fangs and spit + Tooltip: + ''' + Charges up and fires a slithering beam of radiation + If fully charged, instead fires a huge spread of short range fangs which quickly vanish + ''' } VividClarity: { @@ -980,9 +1021,18 @@ VoltaicClimax: { Tooltip: Conjures a ring of supercharged magnet spheres around the cursor } +Volterion: { + DisplayName: Volterion + Tooltip: + ''' + Discharges a high-voltage stream which bursts into 5 balls of lightning on hit + Each ball lightning emits two additional lightning bolts before exploding + ''' +} + Waywasher: { DisplayName: Waywasher - Tooltip: Casts a deluge of inaccurate water bolts + Tooltip: Casts two large swirling waves } Wingman: { @@ -1004,11 +1054,6 @@ WintersFury: { ''' } -WrathoftheAncients: { - DisplayName: Wrath of the Ancients - Tooltip: Summons an energy pulse at the cursor to periodically summon homing spirits -} - WulfrumProsthesis: { DisplayName: Wulfrum Prosthesis Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 0bdb891193..f221281fd1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -40,8 +40,8 @@ AirSpinner: { DisplayName: Air Spinner Tooltip: ''' + {$Common.YoyoStats} Fires feathers when enemies are near - A very agile yoyo ''' } @@ -64,8 +64,8 @@ Aorta: { DisplayName: Aorta Tooltip: ''' + {$Common.YoyoStats} Fires homing blood when enemies are near - A very agile yoyo ''' } @@ -88,14 +88,10 @@ 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 15 swings of the sword - ''' - BlastInfo: - ''' - Pressing while holding UP with empowered charges will provoke a Big Rip in spacetime and use all charges - If more than 5 charges were used, you can dash across the rip by holding UP + You can also parry projectiles to make them deal 160 less damage for a short period + Parrying will empower the next 15 swings of the sword ''' + BlastInfo: Double with charges available to cause a Big Rip in spacetime and consume all charges } ArkoftheElements: { @@ -104,7 +100,6 @@ ArkoftheElements: { ''' [COMBO] [PARRY] - [BLAST] A heavenly pair of blades infused with the essence of Terraria, powerful enough to cut through the fabric of reality ''' ComboInfo: @@ -119,7 +114,6 @@ ArkoftheElements: { You can parry projectiles to make them deal 100 less damage for a short period Parrying will empower the next 10 swings of the sword, letting you use both blades at once ''' - BlastInfo: Pressing while holding UP with empowered charges will provoke a Big Rip in spacetime and use all charges } AstralBlade: { @@ -144,22 +138,30 @@ Ataraxia: { Avalanche: { DisplayName: Avalanche - Tooltip: Spawns ice bombs that explode after 3 seconds into ice shards on hit + Tooltip: + ''' + Hitting enemies spawns orbiting ice bombs + After 2 seconds, ice bombs explode into gravity-affected ice shards + ''' } Azathoth: { DisplayName: Azathoth Tooltip: ''' + {$Common.YoyoStatsInfinite} Fires cosmic orbs that blast nearby enemies with lasers - An exceptionally agile yoyo 'Destroy the universe in the blink of an eye' ''' } BalefulHarvester: { DisplayName: Baleful Harvester - Tooltip: Summons flaming pumpkins and skulls that split into homing fire orbs on enemy hits + Tooltip: + ''' + A flaming scythe which is rapidly swung around three times in succession + Enemy hits summon flaming skulls that split into homing fire orbs + ''' } BallOFugu: { @@ -179,12 +181,26 @@ BansheeHook: { Basher: { DisplayName: Basher - Tooltip: Swings a rotten club that poisons and irradiates enemies on hit + Tooltip: + ''' + Swings a rotten club that poisons and irradiates enemies on hit + Holding while swinging will increase the club's damage, but will also knock you back on hit + ''' } BladecrestOathsword: { DisplayName: Bladecrest Oathsword - Tooltip: Fires bursts of demonic blades that exponentially decelerate and explode + Tooltip: + ''' + Throw a sharp blade that impales and slows enemies + Up to three blades can impale an enemy at a time + Consecutive hits past the first three will launch out the previous impaled blades + ''' + HoldShiftTooltip: + ''' + [c/df0049:A ritual blade used by Demons for sacrifices.] + [c/df0049:The more blood taints the edge, the sharper it becomes.] + ''' } BlightedCleaver: { @@ -253,8 +269,12 @@ BurningRevelation: { DisplayName: Burning Revelation Tooltip: ''' - Emits large holy explosions on hit - An exceptionally agile yoyo + {$Common.YoyoStatsInfinite} + An ever burning yoyo that constantly charges power + Direct hits greatly increase the charge and release profaned energy that scales with charge level + At maximum charge, the yoyo unleashes a volley of homing stars that gain damage the farther they travel + Stars with maximum damage let off an additional explosion on hit + 'It burns, but you hold it close to your heart. Clarity and purpose fill your soul' ''' } @@ -268,11 +288,6 @@ Carnage: { Tooltip: Enemies explode into homing blood on death } -CatastropheClaymore: { - DisplayName: Catastrophe Claymore - Tooltip: Fires sparkles which inflict Frostbite, Hellfire, or Ichor -} - CelestialClaymore: { DisplayName: Celestial Claymore Tooltip: Spawns cosmic energy stars near the cursor that inflict several debuffs @@ -329,8 +344,11 @@ DeathsAscension: { DisplayName: Death's Ascension Tooltip: ''' + Performs powerful soul-infused swings that creates a rift orbited by scythes on enemy hits Press to launch a barrage of homing scythes - You can feel the hands of Death himself onto yours + The rift will fire scythes along with you + 'It feels just right in your grip... + [c/660066:But the hands that wield it are not yours'] ''' } @@ -353,29 +371,37 @@ DepthCrusher: { ''' } -Devastation: { - DisplayName: Devastation - Tooltip: Fires galaxy blasts that explode -} - DevilsDevastation: { DisplayName: Devil's Devastation Tooltip: ''' - Fires a spread of demonic scythes - Pitchforks rise from the underworld to skewer your foes - Critical hits cause shadowflame explosions + Throw a demonic blade that impales, immolates, and slows enemies + Up to five blades can impale an enemy at a time, with further hits launching the previous impaled blades + Press to enter a stance where you can use to perform a colossal, devastating slash + While in the stance, you gain life and flight time regeneration and your dashes have a shorter cooldown + The devastating slash must recharge after being used + Striking an impaled enemy with the devastating slash launches all blades and readies another slash + The final enemy hit with a devastating slash has a death mark applied to them + When you exit the stance, the death mark explodes for massive damage + ''' + HoldShiftTooltip: + ''' + [c/d13ca2:The perfect blade of the Underworld, wielding the power of Brimstone directly.] + [c/d13ca2:Humans understand this force as Havoc, the inevitable sundering of all order in fire.] + [c/d13ca2:Perhaps this is why the Brimstone Elemental had strength unrivaled by her sisters.] ''' } DevilsSunrise: { DisplayName: Devil's Sunrise - Tooltip: Balls? Smalls. -} - -DiseasedPike: { - DisplayName: Diseased Pike - Tooltip: Fires plague seekers on hit + Tooltip: + ''' + Unleashes a devilish flurry of swipes + Hellish energy charges in the blades over time, which is accelerated by striking foes + Press while swinging the blades with full energy to throw the spinning blades to your cursor + The spinning blades lodge into and repeatedly slice the first foe they meet, stealing their life + 'Balls? Smalls.' + ''' } DraconicDestruction: { @@ -417,7 +443,7 @@ Earth: { A beautiful prismatic blade with unrivaled close combat proficiency Heals you greatly on hit Every other swing will summon three Gaia meteors to fall upon nearby enemies - 'All its spawn shall know the beauty and wrath of their creator' + 'All Its spawn shall know the beauty and wrath of their creator' ''' } @@ -430,28 +456,27 @@ EarthenPike: { ''' } -ElementalLance: { - DisplayName: Elemental Lance - Tooltip: - ''' - Fires a lance beam that splits multiple times as it travels - 'Rend the cosmos asunder!' - ''' -} - EmpyreanKnives: { DisplayName: Empyrean Knives - Tooltip: Throws a flurry of bouncing knives that can heal the user + Tooltip: Throws a flurry of homing knives that bounce off of tiles and heal the user } EntropicClaymore: { DisplayName: Entropic Claymore - Tooltip: + Tooltip: "[GFB]" + TooltipNormal: ''' Fires a spread of living plasma that swims though the air Plasma will track your cursor or enemies near it, prioritizing which is closest The plasma pierces, but will stop tracking after hitting the first enemy ''' + TooltipGFB: + ''' + Fires a spread of dead tapeworms that swim throuh the air + Tapeworms will track your cursor or enemies near it, prioritizing which is closest + The tapeworms pierce, but will stop tracking after hitting the first enemy + [c/FF0000:'Go my tapeworms, make their balls itch'] + ''' } EssenceFlayer: { @@ -459,11 +484,6 @@ EssenceFlayer: { Tooltip: Shoots an essence scythe that generates healing spirits on enemy kills } -EutrophicScimitar: { - DisplayName: Eutrophic Scimitar - Tooltip: Fires two beams that stun enemies -} - EvilSmasher: { DisplayName: Evil Smasher Tooltip: @@ -478,7 +498,22 @@ EvilSmasher: { ExaltedOathblade: { DisplayName: Exalted Oathblade - Tooltip: Fires a spread of demonic scythes and critical hits cause shadowflame explosions + Tooltip: + ''' + Throw a twisted blade that impales, immolates, and slows enemies + Up to four blades can impale an enemy at a time, with further hits launching the previous impaled blades + Press to enter a stance where you can use to perform a devastating slash + While in the stance, you gain life and flight time regeneration and your dashes have a shorter cooldown + The devastating slash must recharge after being used + Striking an impaled enemy with the devastating slash launches all blades and readies another slash + ''' + HoldShiftTooltip: + ''' + [c/b63cd1:A sword fashioned from the legend of the Last Demon Lord.] + [c/b63cd1:Crowned through his overwhelming might, his sword bathed in the blood of Demons and the fires of hell.] + [c/b63cd1:Even long after his passing, none have dared to take the seat.] + [c/b63cd1:Demonkind has not known unity since.] + ''' } Excelsus: { @@ -506,7 +541,7 @@ FallenPaladinsHammer: { DisplayName: Fallen Paladin's Hammer Tooltip: ''' - Throws a heavy, gravity-affected hammer that will return to you after striking an enemy + Throws a heavy, gravity-affected hammer that will explode and return to you after striking an enemy After returning three times, a homing spectral hammer is summoned with devastating impact ''' } @@ -515,8 +550,8 @@ FaultLine: { DisplayName: Fault Line Tooltip: ''' + {$Common.YoyoStatsInfinite} Explodes on enemy hits - A very agile yoyo ''' } @@ -537,7 +572,20 @@ Floodtide: { ForbiddenOathblade: { DisplayName: Forbidden Oathblade - Tooltip: Fires a demonic scythe and critical hits cause shadowflame explosions + Tooltip: + ''' + Throw a sharp blade that impales, burns, and slows enemies + Up to three blades can impale an enemy at a time, with further hits launching the previous impaled blades + Press to enter a stance where you can use to perform a powerful slash + The powerful slash must recharge after being used + Striking an impaled enemy with the powerful slash launches all blades and readies another slash + ''' + HoldShiftTooltip: + ''' + [c/b63cd1:A blade forged in the likeness of that granted to the Demon Lord.] + [c/b63cd1:The title was coveted by all demonkind. Only one may exist at a time.] + [c/b63cd1:Any claimant who seeks the throne has a simple goal: the head of the former Lord.] + ''' } ForsakenSaber: { @@ -551,12 +599,10 @@ FourSeasonsGalaxia: { Tooltip: ''' [FUNC] - [PASS] Freed from earthly shackles and coursing with cosmic power Has access to all of the attunements at all times Press to cycle the sword's attunement depending on the cursor's position Active Attunement : [ATT] - Passive Blessing : [BLE] ''' } @@ -571,7 +617,6 @@ FracturedArk: { ''' to extend the Ark out in front of you Hitting an enemy with it will parry them, granting you a small window of invulnerability - You can also parry projectiles and temporarily make them deal 50 less damage Parrying empowers the next 10 swings of the sword, boosting damage and letting them throw projectiles ''' } @@ -606,7 +651,7 @@ GalaxySmasher: { Tooltip: ''' Throws a heavy, gravity-affected hammer that will return to you after striking an enemy - Consecutive hits summon more and more cosmic hammers + Consecutive hits summon more and more cosmic shards After hitting eight times, the hammer supercharges itself with galactic energies, delivering an apocalyptic strike that reverberates through space and time ''' @@ -670,19 +715,16 @@ GrandGuardian: { GreatswordofJudgement: { DisplayName: Greatsword of Judgement - Tooltip: - ''' - 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 - I shall always be at your side, my lord' - ''' + Tooltip: Fires a piercing energy wave that releases homing stars as it flies } Greentide: { DisplayName: Greentide - Tooltip: Summons teeth to chomp your foes on hit + Tooltip: + ''' + Launches a spread of four teeth with one stronger piercing tooth in the center + Hitting with the blade creates two jaws of teeth to chomp on the enemy closest to your cursor + ''' } HellfireFlamberge: { @@ -706,33 +748,44 @@ Hellkite: { ''' An ancient blade created during the Draconic Era by Azafure's finest forgemaster Swings a slow and heavy blade with powerful knockback - Holding while swinging will begin charging a strengthened swing - Releasing while fully charged will unleash a devastating slash + Holding will begin charging a strengthened swing + Releasing while fully charged will unleash a devastating slash that always critically strikes [c/E1B65F:'Feel the strength of a blade forged through passion'] ''' TooltipGFB: ''' An ancient blade created during the Draconic Era by Azafure's finest forgemaster Swings a slow and heavy blade with powerful knockback - Holding while swinging will begin charging a strengthened swing - Releasing while fully charged will unleash a devastating slash + Holding will begin charging a strengthened swing + Releasing while fully charged will unleash a devastating slash that always critically strikes [c/0C507F:'My beloved <3' -Xyk] ''' } HolyCollider: { DisplayName: Holy Collider - Tooltip: Striking enemies will cause them to explode into holy fire + Tooltip: + ''' + Swings a holy greatsword that can be charged for higher damage + Charged swings create four lingering flares that float around the point of impact + Striking a flare with an uncharged strike will push it around and extend its lifetime + Charged swings can empower flares, turning them into massive fireballs on hit and launching them to your cursor + Holding while swinging will repeatedly do uncharged slashes that create a spread of flames on hit + ''' } IllustriousKnives: { DisplayName: Illustrious Knives - Tooltip: Throws a flurry of homing knives that can heal the user + Tooltip: Throws a barrage of fast-moving homing knives that heal the user } InsidiousImpaler: { DisplayName: Insidious Impaler - Tooltip: Fires infected harpoons that stick to enemies and explode + Tooltip: + ''' + Throws self-propelling radioactive harpoons which chase foes + Harpoons ricochet at close range for additional hits + ''' } IridescentExcalibur: { @@ -749,8 +802,8 @@ Lacerator: { DisplayName: Lacerator Tooltip: ''' + {$Common.YoyoStatsInfinite} Accelerates natural life regeneration on hits with the yoyo - An exceptionally agile yoyo [GFB] ''' TooltipNormal: Someone thought this was a viable weapon against DoG at one point lol @@ -817,7 +870,7 @@ MonolithSword: { MonstrousKnives: { DisplayName: Monstrous Knives - Tooltip: Throws a spread of knives that can heal the user + Tooltip: Throws a spread of short-range knives that have a chance to heal the user } Mourningstar: { @@ -846,7 +899,6 @@ Nadir: { Tooltip: ''' Fires void essences which flay nearby enemies with tentacles - Ignores immunity frames 'The abyss has stared back at you long enough. It now speaks, and it does not speak softly' ''' } @@ -869,18 +921,18 @@ Oblivion: { DisplayName: Oblivion Tooltip: ''' + {$Common.YoyoStatsInfinite} Fires brimstone darts when enemies are near - A very agile yoyo ''' } OldLordClaymore: { DisplayName: Old Lord Claymore - Tooltip: + Tooltip: A slow but powerful blade that sets enemies ablaze and has substantial knockback + HoldShiftTooltip: ''' - Holding rapidly absorbs energy into the blade until it is charged - Press while charged to fly in the direction of the cursor - Using the lunge resets the blade's charge to zero + [c/df4420:A gift to outstanding Demons, a replica of the sword used by the greatest of all Demon Lords.] + [c/df4420:The prosperity he brought to their kind is unmatched even now that they alone rule the Undeworld.] ''' } @@ -913,11 +965,10 @@ Orderbringer: { DisplayName: Orderbringer Tooltip: ''' - 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 - I shall always be at your side, my lord' + Fires piercing energy waves and summons four homing stars near your cursor + Energy waves deal more damage with each consecutive hit + Hits with the blade summon two beams from the sky + 'No matter where you may be you are never alone' ''' } @@ -925,8 +976,8 @@ Pandemic: { DisplayName: Pandemic Tooltip: ''' + {$Common.YoyoStatsInfinite} Fires plague seekers when enemies are near - A very agile yoyo ''' } @@ -955,18 +1006,13 @@ PhotonRipper: { ''' } -PlagueKeeper: { - DisplayName: Plague Keeper - Tooltip: Fires a plague and bee cloud -} - PrismaticBreaker: { DisplayName: Prismatic Breaker Tooltip: ''' - Fire to charge for a powerful rainbow laser - Press to instead swing the sword and fire rainbow colored waves - The sword is boosted by both melee and ranged damage + Fires several bursts of magic stars as the weapon charges up + After charging up, a massive rainbow laser is unleashed to devastate your foes + This weapon is boosted by both melee and ranged damage Seems to belong to a certain magical girl. Radiates with intense cosmic energy ''' } @@ -984,8 +1030,8 @@ Quagmire: { DisplayName: Quagmire Tooltip: ''' + {$Common.YoyoStatsInfinite} Fires spore clouds - A very agile yoyo ''' } @@ -998,23 +1044,11 @@ RedSun: { ''' } -RedtideSpear: { - DisplayName: Redtide Spear - Tooltip: - ''' - Poisons enemies on hit - Aiming the spear in front of you while running holds it down with increased knockback - Releasing the attack button after the charge makes an upwards slash, sending enemies flying into the air - [c/5C95A1:'The people of the sea were adept hunters, but they abhorred unnecessary violence.] - [c/5C95A1:Unfortunately, neighboring nations were brutish, so they fashioned their tools for war.'] - ''' -} - RemsRevenge: { DisplayName: Rem's Revenge Tooltip: ''' - Summons blood explosions and lowers enemy defense on hit + Summons blood explosions and lowers enemy defense by {0} on hit 'A deadly morning star befitting its demonic owner' ''' } @@ -1031,7 +1065,11 @@ Respiteblock: { Riptide: { DisplayName: Riptide - Tooltip: Sprays a spiral of aqua streams + Tooltip: + ''' + {$Common.YoyoStats} + Occasionally pulses a riptide wave with heavy knockback + ''' } Roxcalibur: { @@ -1068,16 +1106,14 @@ ScourgeoftheCosmos: { Tooltip: Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on enemy and tile hits } -SeashineSword: { - DisplayName: Seashine Sword - Tooltip: Shoots an aqua sword beam -} - SeekingScorcher: { DisplayName: Seeking Scorcher Tooltip: ''' - Throws a holy boomerang that seeks out up to four enemies before returning to the player + Throws a massive crystalline axe which bounces to three additional targets after hitting + Crystallizes in place if all bounces have not been exhausted + Crystallized hatchets can be shattered by another axe + Doing so empowers the hatchet based on the amount shattered but prevents it from crystallizing 'May your enemies burn in hell for the sins they have committed' ''' } @@ -1086,14 +1122,28 @@ Shimmerspark: { DisplayName: Shimmerspark Tooltip: ''' + {$Common.YoyoStatsInfinite} Fires stars when enemies are near - A very agile yoyo + ''' +} + +SkytideDragoon: { + DisplayName: Skytide Dragoon + Tooltip: + ''' + Calls down a thunderbolt to strike and charge the tip of the spear + Press to discharge the electricity as a spread of bolts that narrows as you spend the energy + Hold when the spear catches the thunderbolt to redirect it to the cursor ''' } SmokingComet: { DisplayName: Smoking Comet - Tooltip: Rains stars from the sky + Tooltip: + ''' + {$Common.YoyoStats} + Rains stars from the sky + ''' } SolsticeClaymore: { @@ -1198,9 +1248,9 @@ SulphurousGrabber: { DisplayName: Sulphurous Grabber Tooltip: ''' + {$Common.YoyoStatsInfinite} Occasionally releases a ring of colored bubbles The yoyo powers up after touching a green bubble - A very agile yoyo ''' } @@ -1266,11 +1316,11 @@ TheDarkMaster: { DisplayName: The Dark Master Tooltip: ''' - Fires red echo slash projectiles at full health - Projectile damage increases for every point of HP above 400 + Fires red echo slash projectiles when above 75% health + Projectile damage increases for every 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 + Projectiles are fired regardless of your own HP, but deal less damage The clones may only exist while holding this weapon 'The blade by which the shadows levy their foes with a terrible fate' ''' @@ -1285,8 +1335,8 @@ TheGodsGambit: { DisplayName: The God's Gambit Tooltip: ''' + {$Common.YoyoStatsInfinite} Fires a stream of slime when enemies are near - A very agile yoyo ''' } @@ -1299,8 +1349,8 @@ TheMicrowave: { DisplayName: The Microwave Tooltip: ''' + {$Common.YoyoStatsInfinite} Fries nearby enemies with radiation - An exceptionally agile yoyo 'Cooking, Astral Infection style' ''' } @@ -1316,12 +1366,12 @@ TheMutilator: { TheObliterator: { DisplayName: The Obliterator - Tooltip: "[GFB]" - TooltipNormal: + Tooltip: ''' - Ruins nearby enemies with death lasers - An exceptionally agile yoyo + {$Common.YoyoStatsInfinite} + [GFB] ''' + TooltipNormal: Ruins nearby enemies with death lasers TooltipGFB: just a slight bit of dust spam on this weapon im afraid } @@ -1329,9 +1379,9 @@ TheOracle: { DisplayName: The Oracle Tooltip: ''' + {$Common.YoyoStatsInfinite} Emits an aura of 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' ''' } @@ -1345,9 +1395,15 @@ TitanArm: { ''' } -TriactisTruePaladinianMageHammerofMightMelee: { +TriactisTruePaladinianMageHammerofMight: { DisplayName: Triactis' True Paladinian Mage-Hammer of Might - Tooltip: Explodes on enemy hits + Tooltip: + ''' + Throws a heavy, gravity-affected hammer that will return to you after striking an enemy + Enemy hits release prismatic light flares which orbit around the struck foe + Instead of returning, the fourth hit transforms flares into hardlight hammers + These hammers converge and form a universe-collapsing explosion + ''' } TrueArkoftheAncients: { @@ -1362,8 +1418,7 @@ TrueArkoftheAncients: { to extend the Ark out in front of you Hitting an enemy with it will parry them, granting you brief invulnerability You can also parry projectiles to make them deal 80 less damage for a short period - Parrying empowers the next 10 swings of the sword, letting them throw stronger projectiles - Pressing while holding UP will release all empowered charges in a powerful burst of energy + Parrying will empower the next 10 swings of the sword, letting it throw stronger projectiles ''' } @@ -1418,14 +1473,18 @@ UltimusCleaver: { Tooltip: Launches damaging homing sparks and explodes on enemy hits } -UrchinFlail: { - DisplayName: Urchin Flail - Tooltip: Launch an urchin ball, which shoots a spike on contact with an enemy -} - UrchinMace: { DisplayName: Urchin Mace - Tooltip: Throws out a whirlpool when released at full charge + Tooltip: Throws out a whirlpool when released +} + +VanishingPoint: { + DisplayName: Vanishing Point + Tooltip: + ''' + Fires a lance beam that splits multiple times as it travels + 'Rend the cosmos asunder!' + ''' } VeinBurster: { @@ -1489,8 +1548,8 @@ YinYo: { DisplayName: Yin-Yo Tooltip: ''' + {$Common.YoyoStatsInfinite} Fires light or dark shards when enemies are near Shards fly back and forth - A very agile yoyo ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 1eb75ba619..e4025b826b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -4,7 +4,7 @@ AcesHigh: { ''' Fires a string of cards with varying effects based on card type Hearts grant lifesteal - Spades pierce and ignore immunity frames + Spades pierce enemies Diamonds violently explode Clubs split into three ''' @@ -34,7 +34,7 @@ AngelicShotgun: { Tooltip: ''' Each shot casts a radiant beam of holy light from the sky - Converts musket balls into hallow-point rounds + Musket balls convert into hallow-point rounds which also empower the beam 'Fighting 'til the war's won' ''' } @@ -46,12 +46,12 @@ Animosity: { TooltipNormal: ''' 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 + Press 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/ac14ba:Press to use a hexing rifle round instead] [c/454545:By Cthulhu Eye, Yharon tooth...] ''' } @@ -187,8 +187,8 @@ BlissfulBombardier: { DisplayName: Blissful Bombardier Tooltip: ''' - Fires flare rockets - Rockets will destroy tiles with tile-destroying ammo + Launches a crystalline missile high into the sky, raining holy fire on the cursor + The missile relentlessly seeks out a target before bursting into a massive explosion ''' } @@ -209,6 +209,15 @@ BlossomFlux: { Fires a stream of leaves Press to fire a spore orb that explodes into a cloud of spore gas ''' + LegendaryText: + ''' + '...I see... So frightened by the Godseeker were my children they chose to defile death for a warden in my image. + I am sorry. I could not gaze unto your hearts. The despair I inflicted upon you... I should have forseen the consequences of taking away your guardian. + But you shan't be neglected any longer. + Heed me, floral beast, on my authority. Ravage this place no longer, stand guard of the home and memories of the people who once lived here. + Channel all the might of this canopy and of the dead within you, so that no Godseeker, lowly or high, will ever trespass into this settlement. + Defend it till the last rays of the sun, so my hero shall yet have a home.' + ''' } BrimstoneFury: { @@ -239,11 +248,7 @@ Buzzkill: { ChickenCannon: { DisplayName: Chicken Cannon - Tooltip: - ''' - Fires chicken flares which create enormous incendiary explosions - Press to detonate all airborne rockets - ''' + Tooltip: Fires chicken flares which create enormous incendiary explosions } ChromaticEruption: { @@ -332,15 +337,6 @@ ContinentalGreatbow: { ''' } -CoralCannon: { - DisplayName: Coral Cannon - Tooltip: - ''' - Has a 20% chance to shoot a big coral that stuns enemies - Does not consume ammo - ''' -} - CorinthPrime: { DisplayName: Corinth Prime Tooltip: @@ -417,16 +413,6 @@ DeepcoreGK2: { ''' } -Disseminator: { - DisplayName: Disseminator - Tooltip: - ''' - Fires a tight spread of bullets that call a great number of bullets from the sky - 50% chance to save ammo - [c/768EE6:@everyone] - ''' -} - DodusHandcannon: { DisplayName: Dodu's Handcannon Tooltip: @@ -481,6 +467,8 @@ FetidEmesis: { ''' Fires an accelerating stream of bullets until the barrel overheats When the barrel overheats, a spread of fetid chunks is vomited out + Holding while firing will hold in the chunks + If held in for long enough, more chunks will be fired After firing, the gun must cool back down before it can be used again 75% chance to save ammo ''' @@ -626,11 +614,11 @@ Hellborn: { DisplayName: Hellborn Tooltip: ''' - Fires a spread of 3 bullets - Enemies that touch the gun while it's being fired trigger a massive explosion - After the explosion, this gun gains a massive boost to damage, fire rate and knockback for 10 seconds - These stat bonuses slowly decay over time - Converts musket balls into explosive bullets + An ornate firearm created during the Draconic Era by Azafure's finest forgemaster + Hold to twirl the gun in your hand, rapidly hitting nearby enemies + Hits with the gun itself add rounds to the gun, up to a max of 8 + At the cost of one round, hold to fire a giant energy sphere with potent recoil + [c/E1B65F:'Know the grace of a gun forged through beauteous inspiration'] ''' } @@ -693,7 +681,13 @@ Kingsbane: { Leviatitan: { DisplayName: Leviatitan - Tooltip: Converts musket balls into toxic and normal water blasts + Tooltip: + ''' + Fires high velocity aqua blasts + Releases homing aberrations that shred enemy defense every six shots + to vomit a meteor that explodes on hit + 'The L in LMG stands for Leviathan' + ''' } LunarianBow: { @@ -788,15 +782,6 @@ MineralMortar: { ''' } -MolecularManipulator: { - DisplayName: Molecular Manipulator - Tooltip: - ''' - Fires a fast null bullet that distorts NPC stats - 'Is it nullable or not? Let's find out!' - ''' -} - MonolithBow: { DisplayName: Monolith Bow Tooltip: "" @@ -844,8 +829,27 @@ NullificationPistol: { DisplayName: Nullification Pistol Tooltip: ''' - Fires a fast null bullet that distorts NPC stats - 'Is it nullable or not? Let's find out!' + Fires discrete bolts of polarized energy. to swap modes + Positive energy splits into three piercing beams + Negative energy shoots rapidly and homes in on enemies + All shots blow away enemies at close range + Each mode weakens with continuous use and resets to full power when swapped + 'Weaponizing alien tech? Now that's what I like to hear!' + ''' +} + +OntologicalDespoiler: { + DisplayName: Ontological Despoiler + Tooltip: + ''' + Condenses chargeable pockets of concentrated unreality. to swap modes + Unstable condensate shots trifurcate and pierce enemies + Null condensate shots fire rapidly and home in on enemies + At 50% charge or higher, rate of fire significantly increases + Fully charged unstable condensate lobs a homing disruption sphere + Fully charged null condensate emits a hitscan null-annihilation beam + Each mode charges slower when used repeatedly and resets to full speed when swapped + 'Rob them of continuity and the laws of physics they hold so dear.' ''' } @@ -913,15 +917,6 @@ PestilentDefiler: { Tooltip: Converts musket balls into plague rounds that explode and split apart on hit } -Phangasm: { - DisplayName: Phangasm - Tooltip: - ''' - Fires a spread of 5 arrows and emits phantom arrows on enemy hits - 66% chance to save ammo - ''' -} - Photoviscerator: { DisplayName: Photoviscerator Tooltip: @@ -958,14 +953,14 @@ PolarisParrotfish: { Tooltip: "[GFB]" TooltipNormal: ''' - Rapidly fires an array of colorful star shots that bounce off tiles - However, only two shots can exist at once + Rapidly fires an array of colorful star shots + Firing speed increases the closer you are to an enemy '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 + Rapidly fires an array of colorful star shots + Firing speed increases the closer you are to an enemy Right click to give the little girl some attention 'She is a happy girl' ''' @@ -989,10 +984,20 @@ PristineFury: { DisplayName: Pristine Fury Tooltip: ''' - Fires an intense helix of flames that explode into a column of smoke - Press to disperse intense clouds of profaned heat + Fires an intense helix of flames that burst into a column of smoke + to disperse flammable crystalline powder + Powder can be ignited, causuing it to explode for extra damage + Both helix flames and other nearby explosions can ignite the powder Uses gel for ammo ''' + LegendaryText: + ''' + 'I and many others lost everything in this world's darkest hour. + I saw a beast descend from the heavens. A hulking cosmic monstrosity that heralded countless angels of death. + My family was torn from me by them, and my people forsake me. Even our supposed protectors did nothing to aid us. + And thus I swore to those I lost that I would do what is right, that my blaze's light would dwarf even that of Zeratros' Sun; + That one day, this cruel world would know nothing less than My perfect fury.' + ''' } Pumpler: { @@ -1019,17 +1024,26 @@ ReedBlowgun: { ''' } +Riftburst: { + DisplayName: Riftburst + Tooltip: + ''' + Fires a spread of 5 arrows and emits phantom arrows on enemy hits + 66% chance to save ammo + ''' +} + RubicoPrime: { DisplayName: Rubico Prime Tooltip: ''' - Semi-automatic sniper that fires in 5 second bursts - Fires impact rounds that have an increased crit multiplier + A powerful sniper rifle that must reload after 5 shots + Fires impact rounds that deal increased critical damage ''' } -SandstormGun: { - DisplayName: Sandstorm +Sandblaster: { + DisplayName: Sandblaster Tooltip: ''' Fires sand bullets that explode and slow enemies on hit @@ -1091,8 +1105,12 @@ SepticSkewer: { DisplayName: Septic Skewer Tooltip: ''' - Launches a spiky harpoon infested with toxins - Releases bacteria when returning to the player + Launches a vile chained harpoon infested with toxins + Harpoons stick into enemies and inflict Sulphuric Poisoning for a long time + After being impaled for one second, harpoons rip themselves back out and spray damaging gores + Press to manually rip out all harpoons, dealing bonus damage + Enemies close to death are dragged back with returning harpoons and executed when they reach you + Executions heal you for 25 health and launch an additional harpoon automatically ''' } @@ -1139,9 +1157,10 @@ SomaPrime: { Tooltip: ''' This weapon can supercrit if its crit chance is over 100% - All bullets fired inflict Shred, a stacking bleed debuff - Shred deals 150 DPS per stack and scales with your ranged stats - Damage ticks of Shred can also critically strike or supercrit + All bullets fired have a 5% chance to inflict Shred, a stacking bleed debuff + Critical strikes deal 3x damage instead of 2x by default and have a 30% chance to inflict Shred + Shred deals 600 DPS per stack and scales with your ranged stats + Damage ticks of Shred can critically strike for 3x damage and can supercrit Replaces musket balls with enhanced High Velocity Bullets 80% chance to save ammo ''' @@ -1216,15 +1235,6 @@ StellarCannon: { Tooltip: Launches an explosive astral crystal } -StormDragoon: { - DisplayName: Storm Dragoon - Tooltip: - ''' - Fires a spray of bullets - 90% chance to save ammo - ''' -} - StormSurge: { DisplayName: Storm Surge Tooltip: @@ -1237,7 +1247,11 @@ StormSurge: { SulphuricAcidCannon: { DisplayName: Sulphuric Acid Cannon - Tooltip: Fires an acidic shot that sticks to enemies and dissolves them + Tooltip: + ''' + Fires homing Acid Rockets + Acid Rockets stick to enemies and explode into toxic mist after a short delay + ''' } SuperradiantSlaughterer: { @@ -1284,9 +1298,27 @@ Svantechnical: { ''' } +TauCannon: { + DisplayName: Tau Cannon + Tooltip: + ''' + A bulky assault rifle with three charge levels that fires astral energy + Charge level one fires a burst of bolts + Charge level two fires a beam of energy that quickly fizzles out + Charge level three fires a massive laser and creates astral portals around you + 'This weapon is very ethically questionable' + ''' +} + TelluricGlare: { DisplayName: Telluric Glare - Tooltip: Fires volleys of four colossal radiant arrows which can pass through walls + Tooltip: + ''' + Rapidly fires volleys of arrows + Every other arrow is converted into radiant greatarrows which pierce but quicky dissapear after striking + Wooden arrows are converted into more powerful greatarrows that deal increased damage + 75% chance to save ammo + ''' } TheBallista: { @@ -1346,8 +1378,9 @@ TheStorm: { DisplayName: The Storm Tooltip: ''' - Fires a spread of arrows from the sky - Converts wooden arrows into lightning bolts + Fires a spread of homing lightning bolts and arrows from the sky + Converts wooden arrows into powerful electric beams + 95% chance to save ammo ''' } @@ -1439,7 +1472,7 @@ WulfrumBlunderbuss: { ''' Consumes wulfrum scrap or silver coins to fire The shot's spread can be diminished by aiming further away, at the cost of less damage - Ignores 3 points of enemy Defense + {$Common.ArmorPenetration} [c/83B87E:'The good thing about Wulfrum is that while it breaks fast, it can be reused even faster.] [c/83B87E:In fact, it is quite common for a robot to be turned into ammo right after it stops functioning.'] ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 4254373b8c..fa60f07171 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -12,12 +12,13 @@ AdamantiteThrowingAxe: { Tooltip: Stealth strikes ignore gravity and rain down lightning on enemy hits } -AlphaVirus: { - DisplayName: Alpha Virus +AntlionSkewer: { + DisplayName: Antlion Skewer Tooltip: ''' - Throws a giant plague cell with a lethal aura that explodes into 6 homing plague seekers - Stealth strikes cause the plague cell to move slower, accumulating an aura of swirling plague seekers as it flies + Throws living, skewered Antlions that fire sand blasts + Stealth strikes spew a mess of sand balls and gust + Sand clouds temporarily lower enemy contact damage ''' } @@ -64,7 +65,7 @@ BlastBarrel: { Tooltip: ''' Throws a rolling barrel that explodes on wall collision - Stealth strikes makes the barrel bounce twice before disappearing with varied effects after each bounce + Stealth strikes make the barrel bounce twice before disappearing with varied effects after each bounce 'Some people used to jump over these' ''' } @@ -99,25 +100,6 @@ BouncingEyeball: { ''' } -BouncySpikyBall: { - DisplayName: Bouncy Spiky Ball - Tooltip: - ''' - Throws a very bouncy ball that ricochets off walls and enemies - Receives a small boost in damage and velocity after bouncing off an enemy - Stealth strikes throw four at once - ''' -} - -BrackishFlask: { - DisplayName: Brackish Flask - Tooltip: - ''' - Throws a flask that explodes into poisonous seawater blasts - Stealth strikes summon a brackish spear spike - ''' -} - Brimblade: { DisplayName: Brimblade Tooltip: @@ -131,8 +113,8 @@ BurningStrife: { DisplayName: Burning Strife Tooltip: ''' - Throws a shadowflame spiky ball that bursts into flames - Stealth strikes make the ball linger and explode more violently + Throws a shadowflame spiky ball that explodes into flames + Stealth strikes make the ball erupt into tentacles on hit 'Definitely not pocket safe' ''' } @@ -158,7 +140,7 @@ Celestus: { Cinquedea: { DisplayName: Cinquedea - Tooltip: Stealth strikes home in after hitting an enemy + Tooltip: Stealth strikes stick into enemies before launching forward, slicing everything } CobaltKunai: { @@ -181,8 +163,8 @@ ContaminatedBile: { DisplayName: Contaminated Bile Tooltip: ''' - Throws a flask of sickly green, irradiated bile which explodes on collision - Stealth strikes make the explosion much more violent and powerful + Throws a flask of irradiated bile which shatters and lingers in a cloud + Stealth strikes cause sulphuric bubbles to quickly rise from the cloud ''' } @@ -190,11 +172,10 @@ CorpusAvertor: { DisplayName: Corpus Avertor Tooltip: ''' - Attacks grant lifesteal based on damage dealt - The lower your HP the more damage this weapon does and heals the player on enemy hits - Stealth strikes throw a single rainbow outlined dagger - On enemy hits, this dagger grants 10% damage and +2 HP/s life regen to all members of your team - However, there is a small chance it will cut your health in half instead + Throws a spinning dagger that spawns a rebounding clone + Deals more damage the lower your health, and grants lifesteal + Stealth strikes throw a piercing rainbow dagger which spawns an extra slash in its wake, with a blood cost + This dagger grants players on your team 10% damage and +2 HP/s life regen on hit, and heals them for a portion of damage dealt 'Seems like it has worn down over time' ''' } @@ -212,8 +193,8 @@ CraniumSmasher: { DisplayName: Cranium Smasher Tooltip: ''' - Throws disks that roll on the ground, occasionally launches an explosive disk - Stealth strikes launch an explosive disk that can pierce several enemies + Alternates between throwing piercing, rolling disks and explosive disks + Stealth strikes embed into the hit foe, exploding multiple times ''' } @@ -224,28 +205,42 @@ CrushsawCrasher: { Throws bouncing axes Stealth strikes throw five at once ''' - GFBFirstWord1: Crushsaw - GFBFirstWord2: Crashsaw - GFBFirstWord3: Crushclaw - GFBFirstWord4: Crashclaw - GFBFirstWord5: Crushcaw - GFBFirstWord6: Crushaw - GFBFirstWord7: Crushmaw - GFBFirstWord8: Crashmaw - GFBFirstWord9: Crawshaw - GFBFirstWord10: Coleslaw - GFBFirstWord11: Cashew - GFBFirstWord12: Cawcaw - GFBLastWord1: Crasher - GFBLastWord2: Crusher - GFBLastWord3: Clasher - GFBLastWord4: Casher - GFBLastWord5: Clacker - GFBLastWord6: Catcher - GFBLastWord7: Trasher - GFBLastWord8: Rasher - GFBLastWord9: Cracker - GFBLastWord10: Cackler + GFBFirstWords: + ''' + Crushsaw + Crashsaw + Crushclaw + Crashclaw + Crushcaw + Crushaw + Crushmaw + Crashmaw + Crawshaw + Coleslaw + Cashew + Cawcaw + Crabshaw + Castle + Catshaw + Catspaw + ''' + GFBLastWords: + ''' + Crasher + Crusher + Clasher + Casher + Clacker + Catcher + Trasher + Rasher + Cracker + Cackler + Checker + Clicker + Catsher + ''' + GFBWordSeparator: " " } Crystalline: { @@ -290,7 +285,8 @@ DeepWounder: { Tooltip: ''' Throws an abyssal hatchet that inflicts Armor Crunch and Crush Depth to the enemies it hits - Stealth strikes cause the hatchet to be thrown faster and trail water, inflicting Marked for Death in addition to the other debuffs + Stealth strikes cause the hatchet to stick to struck enemies, causing Heavy Bleeding and spawning a burst of water projectiles + Water projectiles launch at the closest enemy after a brief delay ''' } @@ -313,6 +309,19 @@ DesecratedWater: { ''' } +DoomsdayDevice: { + DisplayName: Doomsday Device + Tooltip: + ''' + Direct hits from the weapon grant stealth + Non-stealth strikes do not consume stealth when fully charged + Holding a stealth strike charge beyond its limit rapidly drains stealth + Stealth strikes ricochet between multiple enemies, ending in a strong impact + 'A high-tech explosive with devastating power... If only you could figure out how to arm it' + 'At least you can throw it really hard!' + ''' +} + DukesDecapitator: { DisplayName: Duke's Decapitator Tooltip: @@ -348,16 +357,7 @@ EclipsesFall: { ''' Summons spears from the sky on hit Stealth strikes impale enemies and summon a constant barrage of spears over time - 'When the sun goes dark, you will know judgment' - ''' -} - -ElementalDisk: { - DisplayName: Elemental Disk - Tooltip: - ''' - Throws a disk that has a chance to generate several disks if enemies are near it - Stealth strikes fly slower but travel farther, pierce through enemies, and spawn extra disks more frequently + 'When the sun goes dark, you will know judgement' ''' } @@ -367,7 +367,7 @@ EnchantedAxe: { ''' Throws a high velocity axe that returns to you after travelling a short distance or hitting a wall At the furthest point from the player, a magical axe that travels through walls will be cast towards the nearest enemy - Stealth strikes make the axe fly further, throwing out many other magical axes in all directions + Stealth strikes make the axe fly further, casting additional homing magical axes ''' } @@ -385,9 +385,9 @@ Equanimity: { DisplayName: Equanimity Tooltip: ''' - Throws a boomerang born of light and darkness that confuses enemies - The boomerang will create light shards upon hitting enemies when thrown out, and will fire homing dark shards when returning - Stealth strikes cause the boomerang to create both dark and light shards whenever one type would be created + Throws a confusing boomerang that ricochets between enemies + Enemy hits alternate summoning homing light shards or piercing dark shards + Stealth strikes cause an alternating explosion of light or dark on every ricochet, empowering the opposite color of shard ''' } @@ -413,8 +413,10 @@ Exorcism: { DisplayName: Exorcism Tooltip: ''' - 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 + Throws a gigantic hallowed cross to the heavens, which will fall at your cursor a moment later + Enemies hit as it falls are impaled and repeatedly seared with holy light + Upon experation a cross shaped explosion is created + Stealth strikes twirl and throw the cross, ending in a stronger explosion at your cursor ''' } @@ -423,8 +425,9 @@ FantasyTalisman: { Tooltip: ''' Fires high velocity talismans that ignore gravity - Talismans attach to enemies, causing them to release lost souls - Stealth strikes release more souls and leave behind souls as they travel + Talismans attach to enemies, releasing vengeful souls that chase them down + Stealth strikes release more souls and erupt into lost souls on death + 'Good thing I didn't bet against you!' ''' } @@ -433,7 +436,7 @@ FeatherKnife: { Tooltip: ''' Throws a knife which summons homing feathers - Stealth strike throws a volley of knives + Stealth strikes throw a volley of knives ''' } @@ -441,7 +444,8 @@ FishboneBoomerang: { DisplayName: Fishbone Boomerang Tooltip: ''' - Stealth strikes make the boomerang ricochet between enemies + Ricochets between up to three enemies + Stealth strikes release rotting bone shards with every ricochet [c/5C95A1:Though the evaporating Sea Kingdom fought a losing battle, its proud inhabitants did not go down easily.] [c/5C95A1:As a last resort, they had to fashion weapons from the skeletons of dead animals.] ''' @@ -451,8 +455,9 @@ FrostcrushValari: { DisplayName: Frostcrush Valari Tooltip: ''' - Fires a long ranged boomerang that explodes into icicles on hit - Stealth strikes throw three shorter ranged boomerangs that freeze along with a spread of icicles + Fires a long ranged frosty boomerang that chips off homing icicles on hit + Stealth strikes throw a boomerang which follows the cursor + This boomerang creates a freezing blast and chips off homing icicles on every hit ''' } @@ -479,9 +484,8 @@ GelDart: { DisplayName: Gel Dart Tooltip: ''' - Throws bouncing gel darts - Stealth strikes ignore gravity and bounce more vigorously - They additionally leak slime and cover enemies in dark sludge + Throws bouncing gel darts that cover struck enemies in slime + Stealth strikes ignore gravity, bounce more vigorously, and constantly leak slime ''' } @@ -527,10 +531,9 @@ GodsParanoia: { DisplayName: Gods' Paranoia Tooltip: ''' - Hurls up to 10 speedy homing spiky balls - Attaches to enemies and summons a localized storm of god slayer kunai - Stealth strikes home in faster and summon kunai at a faster rate - Press to delete all existing spiky balls + Hurls homing spiky balls which attach to enemies + Attached spiky balls summon a localized storm of god slayer kunai on each hit + Stealth strikes home in faster and hit at a faster rate ''' } @@ -565,18 +568,6 @@ HeavenfallenStardisk: { ''' } -HellsSun: { - DisplayName: Hell's Sun - Tooltip: - ''' - Hurls up to 10 gravity-defying spiky balls - Once stationary, periodically emit small suns that explode on hit - Stealth strikes emit suns at a faster rate and last for a longer amount of time - Press to delete all existing spiky balls - 'The Subterranean Sun in the palm of your hand' - ''' -} - Hypothermia: { DisplayName: Hypothermia Tooltip: @@ -588,7 +579,11 @@ Hypothermia: { Icebreaker: { DisplayName: Icebreaker - Tooltip: Stealth strikes spawn a cosmic explosion and freeze nearby enemies on enemy hits + Tooltip: + ''' + Throws an icy hammer that magically returns to the player + Stealth strikes spawn a cosmic explosion and freeze nearby enemies on hit + ''' } IceStar: { @@ -660,7 +655,7 @@ Kylie: { DisplayName: Kylie Tooltip: ''' - Stealth strikes throws three shorter ranged kylies instead of a single long range one + Stealth strikes throw a kylie that weakly seeks out your cursor 'Also known as Dowak' ''' } @@ -688,9 +683,9 @@ LeviathanTeeth: { DisplayName: Leviathan Teeth Tooltip: ''' - 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 + Rapidly throws a spread of teeth that stick into enemies + After sticking to an enemy, the teeth will gouge through them and shoot out the other side + Stealth strikes throw a single piercing tooth that creates a jawline of teeth to maul your foes ''' } @@ -710,7 +705,7 @@ LunarKunai: { ''' Throws out a set of three kunai that ignore gravity and slightly home in on enemies After traveling enough distance, the kunai supercharge with lunar energy, homing in far more aggressively and exploding on impact - Stealth strikes instantly throw nine supercharged Kunai + Stealth strikes instantly throw ten supercharged Kunai ''' } @@ -722,6 +717,23 @@ Malachite: { Press to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit Stealth strikes fire three kunai that home in, stick to enemies, and explode ''' + LegendaryText: + ''' + > STATUS_ + Extensive hull damage. Repairs initiated. + Sensor arrays offline. Repairs scheduled T+2200. + + > UPDATE_DIRECTIVE_ + Error 0x00017F80. Device sector unreadable. + Initializing search for external directive. + Searching... (383526 more) + Directive found. + New directive compiled. Rebooting... + + > PLAGUE UNIT 194-QB-03d ONLINE. + Directive summary: + Continue propagation of unified frequency band and lead satellite units. + ''' } MangroveChakram: { @@ -733,8 +745,8 @@ MetalMonstrosity: { DisplayName: Metal Monstrosity Tooltip: ''' - Hurls a heavy metal ball that shatters on impact - Stealth strikes cause the ball to release spikes as it travels + Hurls a heavy metal ball that shatters into shards and spiky balls on impact + Stealth strikes cause the ball to impale hit enemies, piercing them with extra shards when it breaks 'This has to hurt' ''' } @@ -743,8 +755,8 @@ MeteorFist: { DisplayName: Meteor Fist Tooltip: ''' - Fires a rocket fist that explodes forcefully - Stealth strikes make the fist ricochet between enemies up to 4 times + Fires a wired-guided rocket fist that seeks the cursor and accelerates over time + Stealth strikes immediately start accelerating and drop a meteorite on the struck enemy ''' } @@ -752,17 +764,11 @@ MoltenAmputator: { DisplayName: Molten Amputator Tooltip: ''' - Throws a scythe that emits molten globs on enemy hits - Stealth strikes spawn molten globs periodically in flight and more on-hit - ''' -} - -MonkeyDarts: { - DisplayName: Monkey Darts - Tooltip: - ''' - Stealth strikes throw 3 bouncing darts at high speed - 'Perfect for popping' + Throw a spinning scythe that lingers at your cursor + to recall all existing scythes + Recalling a scythe while it's on an enemy rends them for massive damage + with sufficient stealth to empower yourself, greatly increasing attack speed for a short time + You cannot recall scythes thrown while empowered ''' } @@ -772,7 +778,7 @@ Mycoroot: { ''' Fires a stream of short-range fungal roots Stealth strikes spawn an explosion of fungi spores - and grant you and all other players the Mushy buff for 15 seconds + This grants you and nearby players on your team the Mushy buff for 15 seconds ''' } @@ -820,18 +826,6 @@ NightsGaze: { ''' } -Nychthemeron: { - DisplayName: Nychthemeron - Tooltip: - ''' - Throws a spiky ball that ignores gravity and summons a pair of dark and light orbs that orbit the player - Once the spiky ball disappears the orbs will home in on the nearest target - Up to 10 spiky balls can exist at a time - Stealth strikes cause all spiky balls and orbs to be thrown at once - Press to recall all existing spiky balls - ''' -} - OrichalcumSpikedGemstone: { DisplayName: Orichalcum Spiked Gemstone Tooltip: Stealth strikes last longer and summon petals on enemy hits @@ -869,16 +863,6 @@ Plaguenade: { ''' } -PoisonPack: { - DisplayName: Poison Pack - Tooltip: - ''' - Throws up to 3 poisonous spiky balls - Stealth strikes cause the balls to release spore clouds - Press to delete all existing spiky balls - ''' -} - Prismalline: { DisplayName: Prismalline Tooltip: @@ -902,7 +886,7 @@ RadiantStar: { Tooltip: ''' Throws daggers that explode and split after a while - Stealth strike splits more with a devastating explosion and sucks enemies in + Stealth strikes split more with a devastating explosion that sucks enemies in ''' } @@ -911,7 +895,16 @@ RealityRupture: { Tooltip: ''' Cycles between throwing 3 small homing spears and throwing a single piercing lance - Stealth Strikes throw a high-velocity reality shattering lance that explodes on hit + Stealth strikes throw a high-velocity reality shattering lance that explodes on hit + ''' +} + +ReboundingRainbow: { + DisplayName: Rebounding Rainbow + Tooltip: + ''' + Throws a disk that has a chance to generate several disks if enemies are near it + Stealth strikes fly slower but travel farther, pierce through enemies, and spawn extra disks more frequently ''' } @@ -919,9 +912,9 @@ RefractionRotor: { DisplayName: Refraction Rotor Tooltip: ''' - Fires a huge prismatic disk shuriken - The shuriken shatters moments after impact into homing rockets - Stealth strikes shatter into many more rockets + Throws a huge prismatic shuriken + The shuriken shatters moments after impact into homing blades + Stealth strikes throw 3 shurikens that rapidly home on enemies ''' } @@ -968,21 +961,11 @@ SandDollar: { ''' } -Sandslasher: { - DisplayName: Sandslasher - Tooltip: - ''' - Throws a huge shuriken made out of fused sand unaffected by gravity which slowly accelerates horizontally - It does more damage depending on how fast it goes horizontally and how long it has been flying for - Stealth strikes periodically release sand clouds - ''' -} - ScarletDevil: { DisplayName: Scarlet Devil Tooltip: ''' - Throws an ultra high velocity spear, which creates more projectiles that home in + Throws an ultra high velocity spear, which leaves a trail of homing bullets The spear creates a Scarlet Blast upon hitting an enemy Stealth strikes grant you lifesteal and summon a star of projectiles upon hitting an enemy 'Divine Spear "Spear the Gungnir"' @@ -1012,13 +995,17 @@ SeafoamBomb: { 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 + Hurls a lightweight bomb which bursts into a foam bubble + Foam bubbles combine in pairs to form huge bubbles + Huge bubbles pop into small homing suds after a delay + Stealth strikes are cluster bombs that release eight normal bombs ''' TooltipGFB: ''' - Throws a bomb that explodes into a bubble which deals extra damage to enemies - Stealth strikes are faster and explode into 5 bubbles + Rapidly hurls a lightweight bomb which bursts into a foam bubble + Foam bubbles combine in pairs to form huge bubbles + Huge bubbles pop into small homing suds after a delay + Stealth strikes are cluster bombs that release 38 normal bombs [c/256b93:'Right back in S tier!'] ''' } @@ -1066,8 +1053,8 @@ ShardofAntumbra: { ''' } -ShatteredSun: { - DisplayName: Shattered Sun +ShatteredDawn: { + DisplayName: Shattered Dawn Tooltip: ''' Throws daggers that split into scorching homing daggers @@ -1084,15 +1071,6 @@ ShinobiBlade: { ''' } -ShockGrenade: { - DisplayName: Shock Grenade - Tooltip: - ''' - Throws a grenade that explodes into a burst of lightning - Stealth strikes cause the grenade to leave an electrifying aura when it explodes - ''' -} - SkyfinBombers: { DisplayName: Skyfin Bombers Tooltip: @@ -1118,8 +1096,8 @@ SlickCane: { Tooltip: ''' Swipes a cane that steals money from enemies - Stealth strikes gives a 1 in 20 chance for enemies to drop 1-3 gold coins when hit - Stealth strikes' damage increases in proportion to money in the inventory (up to 2 platinum) + Stealth strikes give a 1 in 20 chance for enemies to drop 1-2 gold coins when hit + Stealth strikes boost damage in proportion to money in the inventory, up to 1 Platinum 'Economy at its finest' ''' } @@ -1143,7 +1121,7 @@ SpearofDestiny: { Tooltip: ''' Cycles between throwing 3 small homing spears and throwing a single piercing lance - Stealth Strikes throw a high-velocity holy lance that explodes on hit + Stealth strikes throw a high-velocity holy lance that explodes on hit ''' } @@ -1168,14 +1146,23 @@ SpentFuelContainer: { ''' } +SporeKnife: { + DisplayName: Spore Knife + Tooltip: + ''' + Throws an overgrown dagger that bursts into a cloud of poisonous spores + Stealth strikes erupt into hungry homing buds that stick to enemies and gnaw them + ''' +} + StarofDestruction: { DisplayName: Star of Destruction Tooltip: ''' Throws a fan of cosmic bolts that meld together into a star of destruction The explosive star will slowly follow your cursor until it expires or hits an enemy - Stealth strikes throw additional bolts that converge into faster star that can pierce, exploding on every hit Upon running out of time, the star will burst into a huge explosion that deals increased damage + Stealth strikes throw additional bolts that converge into a faster star that can pierce, exploding on every hit ''' } @@ -1189,15 +1176,6 @@ StellarKnife: { ''' } -StickySpikyBall: { - DisplayName: Sticky Spiky Ball - Tooltip: - ''' - Throws a spiky ball that sticks to everything - Stealth strikes throw four at once and last a lot longer - ''' -} - StormfrontRazor: { DisplayName: Stormfront Razor Tooltip: @@ -1232,7 +1210,7 @@ TarragonThrowingDart: { DisplayName: Tarragon Throwing Dart Tooltip: ''' - Fires a piercing dart with reduced immunity frames + Fires a piercing dart Stealth strikes erupt into thorns on enemy hits ''' } @@ -1242,7 +1220,7 @@ TerrorTalons: { Tooltip: ''' Fires small wavering claws - Stealth strikes launch a large, high speed claw which pierces + Stealth strikes launch a large, high speed claw which slashes multiple times ''' } @@ -1271,9 +1249,10 @@ TheOldReaper: { DisplayName: The Old Reaper Tooltip: ''' - Throws a homing reaper scythe that shreds enemies - Stealth strikes throw three at once - 'Slice 'n dice' + Throws an irradiated scythe that cuts through enemies + Deposits unstable isotopes on hit, which create delayed nuclear explosions when they decay + Stealth strikes are thrown into the sky and fall upon enemies a few seconds later + On hit, stealth strikes create a focused deluge of acid rain ''' } @@ -1332,9 +1311,8 @@ ToxicantTwister: { DisplayName: Toxicant Twister Tooltip: ''' - Throws a slow moving boomerang - After a few moments, the boomerang chooses a target and rapidly homes in - Stealth strikes home in faster and rapidly release sand + Throws a fan of four spinning disks that swirl around your cursor + Stealth strikes swirl in a wider range and create a vortex of toxic raindrops that home in on enemies ''' } @@ -1361,7 +1339,12 @@ TwistingThunder: { UrchinStinger: { DisplayName: Urchin Stinger - Tooltip: Stealth strikes stick to enemies while releasing sulphuric bubbles + Tooltip: + ''' + Sticks into enemies and injects an extremely potent poison + Stealth strikes stick into and poison enemies for longer + Sticking seven stingers in an enemy with a stealth strike stuck in it spawns an irradiated blast + ''' } UtensilPoker: { @@ -1401,6 +1384,18 @@ WebBall: { ''' } +Whitewater: { + DisplayName: Whitewater + Tooltip: + ''' + Throws a flask of magic white water at the cursor that glows after a short while + Flasks that hit enemies while glowing release four water spears that converge back on the flask's position + If the flask hits an enemy or gets too far, it will return to the owner + Stealth strikes create eight water spears and summon a swirling whitewater vortex that heals players and knocks back enemies + Allies that enter the vortex will heal for twice as long + ''' +} + Wrathwing: { DisplayName: Wrathwing Tooltip: @@ -1416,6 +1411,5 @@ WulfrumKnife: { ''' Fires wulfrum knives in bursts of 3 Stealth strikes make the knife fly further and hit several times at once - Hold to magnetize all nearby fallen knives back to you ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index d51e5d1554..50e9c95edd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -24,7 +24,8 @@ AquasScepter: { DisplayName: Aqua's Scepter Tooltip: ''' - Summons a giant storm cloud sentry to rain down on your foes, and strike nearby enemies with overloading tesla energy + {$CommonItemTooltip.Sentry} + Summons a giant storm cloud to rain down on your foes, and strike nearby enemies with overloading tesla energy 'Captain! I think- we've got a risk of rain!' ''' } @@ -44,6 +45,7 @@ AtlasMunitionsBeacon: { DisplayName: Atlas Munitions Beacon Tooltip: ''' + [c/F2B629:{$CommonItemTooltip.Sentry}] [c/F2B629:Brings forth an exo-powered, stationary cannon] [c/F2B629:The cannon will fire at enemies within its range] [c/F27049:If an enemy is in close proximity, it will enter Overdrive] @@ -96,7 +98,11 @@ BrittleStarStaff: { CadaverousCarrion: { DisplayName: Cadaverous Carrion - Tooltip: Summons a gross, shark-puking Old Duke head on the ground + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a gross, shark-puking Old Duke head on the ground + ''' } CalamarisLament: { @@ -115,7 +121,11 @@ CalamarisLament: { CausticCroakerStaff: { DisplayName: Caustic Croaker Staff - Tooltip: Summons a toad that explodes if enemies are nearby + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a toad that explodes if enemies are nearby + ''' } CausticStaff: { @@ -144,8 +154,13 @@ CindersOfLament: { Summons either Cataclysm or Catastrophe at the mouse position They will look at you for a moment before charging at you They can do damage to both you and enemies - [c/C61B40:'The Witch, a sinner of her own making,] - [c/C61B40:Within her mind her demon lies, ever patient, until the end of time.'] + ''' + Calamitas: + ''' + 'My brothers perished in Azafure. I found their bodies near the center of the city, after they left for an expedition. + Before my power was what it is now, they were always alongside me and didn't allow anyone to harm me. + It may have been a problem sometimes, but they were surprisingly obedient. + And even after all that's happened, and even in death, they still look out for me. Isn't that sweet of them?' ''' } @@ -214,7 +229,8 @@ CryogenicStaff: { DisplayName: Cryogenic Staff Tooltip: ''' - Summons an animated ice construct to protect you + {$CommonItemTooltip.Sentry} + Summons an ice construct to unleash the cold upon your enemies Fire rate and range increase the longer it targets an enemy ''' } @@ -235,7 +251,14 @@ DankStaff: { DazzlingStabberStaff: { DisplayName: Dazzling Stabber Staff - Tooltip: Summons a holy blade to fight for you + Tooltip: + ''' + Summons three holy daggers made of profaned materials to fight for you + Holy flame daggers gallantly turn all that oppose them to ashes + Crystalline daggers gracefully carve foes to ribbons + Profane daggers brutishtly splinter and reform eternally + 'Ever onward, towards Her future' + ''' } DeathstareRod: { @@ -277,7 +300,11 @@ DragonbloodDisgorger: { DreadmineStaff: { DisplayName: Dreadmine Staff - Tooltip: Summons a dreadmine turret to fight for you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a turret that swarms your enemies with sea mines + ''' } EnchantedConch: { @@ -415,7 +442,8 @@ GuidelightofOblivion: { DisplayName: Guidelight of Oblivion Tooltip: ''' - Summons a lantern turret to fight for you + {$CommonItemTooltip.Sentry} + Summons a lantern that swarms your enemies with flames 'Shadows dream of endless fire, flames devour and embers swoop' ''' } @@ -424,6 +452,7 @@ HarvestStaff: { DisplayName: Harvest Staff Tooltip: ''' + {$CommonItemTooltip.Sentry} 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 @@ -443,7 +472,11 @@ HerringStaff: { HivePod: { DisplayName: Hive Pod - Tooltip: Summons an astraglomerate to protect you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons an astraglomerate to spawn glomerings at your enemies + ''' } IgneousExaltation: { @@ -498,12 +531,16 @@ Metastasis: { Tooltip: ''' Summons a Sepulcher to fight for you - While the Sepulcher is active brimstone hearts will begin to appear and orbit you - It will attempt to attack you more and more frequently depending on how many hearts are present - It takes up 4 minion slots and it can only be summoned once - [c/C61B40:A contemplated possible future of the cosmic serpent,] - [c/C61B40:A gruesome warning for those blinded by the hunger for power.] - + While the Sepulcher is active, brimstone hearts will begin to appear and orbit you + When too many hearts are present, it will interrupt attacking to attack the hearts instead + This happens more frequently depending on how many hearts are present + Requires 4 minion slots to use and can only be summoned once + ''' + Calamitas: + ''' + 'When I joined Yharim's ranks, the Devourer was one of the first to greet me. He seemed kind at first, but that mask did not last long. + He was arrogant, disrespectful and shady. If you hadn't killed him, I would've. + I made my Sepulcher as a mockery of his arrogance, but it seems the insult fell flat. You can add "slime-brained" to his list of fabricated titles.' ''' } @@ -540,7 +577,11 @@ MutatedTruffle: { OrthoceraShell: { DisplayName: Orthocera Shell - Tooltip: Summons a flying orthocera sentry at the mouse position + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a flying orthocera to spit acid streams at your enemies + ''' } Perdition: { @@ -564,7 +605,11 @@ PlantationStaff: { PolypLauncher: { DisplayName: Polyp Launcher - Tooltip: Summons a polyp bunch that launches coral chunks at nearby enemies + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a polyp bunch that launches coral chunks at nearby enemies + ''' } PuffShroom: { @@ -586,14 +631,21 @@ RustyBeaconPrototype: { DisplayName: Rusty Beacon Prototype Tooltip: ''' - Summons a long-abandoned drone to support you - The drone hovers in place and releases toxic waves that irradiate hit enemies + {$CommonItemTooltip.Sentry} + Summons a long-abandoned drone that passively emits irradiated waves ''' } SanctifiedSpark: { DisplayName: Sanctified Spark - Tooltip: Summons a profaned energy turret to fight for you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a friendly immolator that will float towards you + Immolators rapidly fire homing flares at nearby enemies, before continuing to float near you again + After firing, Immolators will fire one healing bolt at you for every 4 summon slots you have + 'They might be a bit clingy, but at least they're warm' + ''' } SandSharknadoStaff: { @@ -617,6 +669,17 @@ ScabRipper: { Tooltip: Summons a baby blood crawler to protect you } +SeashineSword: { + DisplayName: Seashine Sword + Tooltip: + ''' + Summons a brilliant sea prism blade to slice your enemies + Blades will charge up while you hold this item + Pressing will order all fully charged blades to swipe at your cursor + Each sword only consumes half a minion slot + ''' +} + ShellfishStaff: { DisplayName: Shellfish Staff Tooltip: @@ -649,17 +712,26 @@ SlimePuppetStaff: { SpikecragStaff: { DisplayName: Spikecrag Staff Tooltip: "[GFB]" - TooltipNormal: Summons a spikecrag to protect you + TooltipNormal: + ''' + {$CommonItemTooltip.Sentry} + Summons a bed of stalagmites to spray spikes at your enemies + ''' TooltipGFB: ''' - Summons a spikecrag to protect you" + {$CommonItemTooltip.Sentry} + Summons a bed of stalagmites to spray spikes at your enemies Defeating the Profaned Goddess unlocks its true power ''' } SquirrelSquireStaff: { DisplayName: Squirrel Squire Staff - Tooltip: Summons a squirrel squire to fight for you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a squirrel to throw acorns at your enemies + ''' } StaffOfNecrosteocytes: { @@ -834,3 +906,31 @@ YharonsKindleStaff: { Requires 5 minion slots to use ''' } + +FlarebatStaff: { + DisplayName: Flarebat Staff + Tooltip: + ''' + Summons a bat construct of pure fire to fight for you + Swoops towards foes with great haste + ''' +} + +FrostbatStaff: { + DisplayName: Frostbat Staff + Tooltip: + ''' + Summons a bat construct of pure ice to fight for you + Swoops towards foes with slow and precise maneuvers + ''' +} + +AmphibiansGuitar: { + DisplayName: Amphibian's Guitar + Tooltip: + ''' + Summons up to 8 guitars that spin around you and shoot notes at the target, ocasianally firing spread shots + If all 8 guitars are present some notes become empowered dealing extra damage + "I'll show you suffering!" + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index b9a504451c..cad73bc9d5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -11,9 +11,9 @@ EyeofMagnus: { DisplayName: Eye of Magnus Tooltip: ''' - Fires powerful homing beams that reduce enemy protection - Heals mana and health on hit - This weapon scales with all your damage stats at once + Fires seeking cosmic masses that restore health and mana on hit + Explodes into a nebula cloud which reduces enemy protection + This weapon scales with the average of all your damage stats ''' } @@ -21,8 +21,8 @@ LunicEye: { DisplayName: Lunic Eye Tooltip: ''' - Fires homing lunic beams that reduce enemy protection - This weapon scales with all your damage stats at once + Fires seeking energy bolts that reduce enemy protection + This weapon scales with the average of all your damage stats ''' } @@ -30,26 +30,16 @@ RelicOfDeliverance: { DisplayName: Relic of Deliverance Tooltip: ''' - Press to begin charging up a lunging spear attack - Press again to release the charge and lunge towards the cursor - Pressing while lunging to redirect the lunge to the cursor - Holding any other item will cancel the charge - ''' -} - -RelicOfResilience: { - DisplayName: Relic of Resilience - Tooltip: - ''' - Summons an artifact at the mouse position - The artifact is damaged by enemies and all projectiles - When destroyed, the artifact explodes into a rotating burst of shards - If an enemy is in the area of the shards, its next attack will be 45% weaker - This effect has a cooldown - After 5 seconds, the shards come together to reform the original artifact - This reformation can happen 3 times before needing to be re-summoned - You gain a 5 second cooldown when summoning a new artifact - If an artifact already exists, using this item again will relocate it to the cursor + Using mounts you on the spear; holding revvs the spear, slowing you down + Release to launch yourself at high speeds, halved while a boss is alive + Losing too much speed while charging will bust the charge, resetting your speed + The dash allows you to ram through enemies and travel through tiles + Being inside tiles for too long will warp you back to where you entered + Press to dismount + Holding out the spear heavily reduces the damage of all summons + [c/FF8C00:Vengeance fueled me, I had no thought other than exactment.] + [c/FF8C00:The dragon took everything from me, leaving my broken pieces strewn on the ground.] + [c/FF8C00:But when I danced by Her side, I knew there was still something worth fighting for.] ''' } @@ -72,7 +62,7 @@ YanmeisKnife: { Tooltip: ''' Enemies you hit are crippled - Hits will also give you enhanced movement speed and damage for 10 seconds + Hits will also give you {0}% increased movement speed and damage for {1} seconds 'A knife from an unknown world An owner whose heart is pure and free of taint A heart of iron and valor' diff --git a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson index 6adae130f7..8f12f250f0 100644 --- a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson +++ b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson @@ -1,5 +1,6 @@ ActivateAccessoryParry.DisplayName: Activate Accessory Parry AdrenalineMode.DisplayName: Adrenaline Mode +AmmoCycle.DisplayName: Ammo Cycle Hotkey AngelicAllianceBlessing.DisplayName: Angelic Alliance Blessing ArmorSetBonus.DisplayName: Armor Set Bonus AscendantInsigniaHotKey.DisplayName: Ascendant Insignia Flight @@ -7,8 +8,8 @@ BoosterDash.DisplayName: Booster Dash DashDoubleTapOverride.DisplayName: Dash Double Tap Override ExoChairSlowDown.DisplayName: Exo Chair Slow Down GodSlayerDash.DisplayName: God Slayer Dash -GravistarSabatonHotkey.DisplayName: Gravistar Sabaton Slam +GravistarSabatonHotkey.DisplayName: Interstellar Stompers Slam NormalityRelocator.DisplayName: Normality Relocator RageMode.DisplayName: Rage Mode -SandCloakEffect.DisplayName: Sand Cloak Effect SpectralVeilTeleport.DisplayName: Spectral Veil Teleport +TransformerHotKey.DisplayName: Transformer Hot Key diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 5bee99dffd..ff133415d5 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -33,6 +33,14 @@ PlanetoidSchematicRecipeCondition: Place a schematic from the lab in the large p JungleSchematicRecipeCondition: Place a schematic from the lab deep within the jungle in your inventory at least once UnderworldSchematicRecipeCondition: Place a schematic from the lab near the edges of the underworld in your inventory at least once IceSchematicRecipeCondition: Place a schematic from the lab within the frozen caverns in your inventory at least once +// Schematic Knowledge tooltips +SchematicKnowledgeTooltip: You don't have sufficient knowledge to create this yet +SchematicKnowledgeTooltip2: A specific schematic must be deciphered first +Tier1KnowledgeTooltip: The Sunken Sea schematic must be deciphered first +Tier2KnowledgeTooltip: The Planetoid schematic must be deciphered first +Tier3KnowledgeTooltip: The Jungle schematic must be deciphered first +Tier4KnowledgeTooltip: The Underworld schematic must be deciphered first +Tier5KnowledgeTooltip: The Ice biome schematic must be deciphered first // Other CombatText uses and Item Messages ShiftToExpand: Hold SHIFT to see an expanded description LearnedSchematic: You learned how to create new things! @@ -40,7 +48,10 @@ CragmawVibeCheck: Vibe check. AutocannonHot: OUCH! HOT! NoComputer: No decryption computer installed ArkParry: Parry! +BurningSeaBurn: It burns... LightsWarning: I've gotta give you a flashing lights warning on this one +NotSafe: Y O U A R E N O T S A F E +HecBoop: boop! ClockworkTick: Tick ClockworkTock: Tock SevensJackpot: Jackpot!!! @@ -63,5 +74,16 @@ Polaris2: You give Polaris a small treat Polaris3: You tell Polaris she's a good girl Polaris4: You let Polaris cuddle your arm Polaris5: You pet Polaris +Empress1: A fine day for mana consumption. +Empress2: That's quite enough mana... +Empress3: OH GREAT HEAVENS! +Empress4: A // Point Blank PointBlank: Does extra damage to enemies shot at point-blank range +// Charge +Charge: Current Charge: {0}% +//GFB Rogue Keys +GFBRogueUppercase: Rogue +GFBRougeUppercase: Rouge +GFBRogueLowercase: rogue +GFBRougeLowercase: rouge diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 811944daa8..9083290ac3 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -150,6 +150,9 @@ AuroraSpirit.DisplayName: Aurora Spirit BloodlettingServant.DisplayName: Bloodletting Servant BloomSlime.DisplayName: Bloom Slime Bohldohr.DisplayName: Bohldohr +BucketZombie.DisplayName: "{$NPCName.Zombie}" +CladCrab.DisplayName: Clad Crab +CloudElemental.DisplayName: Cloud Elemental Cnidrion.DisplayName: Cnidrion CrawlerAmber.DisplayName: Amber Crawler CrawlerAmethyst.DisplayName: Amethyst Crawler @@ -184,13 +187,12 @@ ProfanedEnergyBody.DisplayName: Profaned Energy Rimehound.DisplayName: Rimehound Rotdog.DisplayName: Rotdog ScornEater.DisplayName: Scorn Eater -SeaUrchin.DisplayName: Sea Urchin ShockstormShuttle.DisplayName: Shockstorm Shuttle +Shroomble.DisplayName: Shroomble SkeletronPrime2.DisplayName: Skeletron Prime Stormlion.DisplayName: Stormlion Sunskater.DisplayName: Sunskater SuperDummyNPC.DisplayName: Super Dummy -ThiccWaifu.DisplayName: Cloud Elemental WildBumblefuck.DisplayName: Draconic Swarmer WulfrumAmplifier.DisplayName: Wulfrum Amplifier WulfrumDrone.DisplayName: Wulfrum Drone @@ -259,18 +261,35 @@ MicrobialCluster.DisplayName: Microbial Cluster Sulflounder.DisplayName: Sulflounder Toxicatfish.DisplayName: Toxicatfish Trasher.DisplayName: Trasher +AlphaSeaMinnow.DisplayName: Alpha Sea Minnow +AlphaSeaMinnowGold.DisplayName: Gold Alpha Sea Minnow +MinnowPrime: Minnow Prime BabyGhostBell.DisplayName: Baby Ghost Bell -BlindedAngler.DisplayName: Blinded Angler Clam.DisplayName: Clam EutrophicRay.DisplayName: Eutrophic Ray +FesteringRemains.DisplayName: Festering Remains GhostBell.DisplayName: Ghost Bell GiantClam.DisplayName: Giant Clam Clamitas: Clamitas SupremeClamitas: Supreme Clamitas +HauntedChum.DisplayName: Haunted Chum +Jellyghoul.DisplayName: Jellyghoul +KelpieSeadragon.DisplayName: Kelpie Seadragon +LostShoal.DisplayName: Lost Shoal +PearlpodBlack.DisplayName: Pearlpod +PearlpodGold.DisplayName: Gold Pearlpod +PearlpodPink.DisplayName: Pearlpod +PearlpodWhite.DisplayName: Pearlpod +PolypPanasea.DisplayName: Polyp Panasea PrismBack.DisplayName: Prism-Back +Probesnout.DisplayName: Probesnout +ProbesnoutGold.DisplayName: Probesnout Gold +SandProwler.DisplayName: Sand Prowler +SandProwlerNested.DisplayName: Sand Prowler SeaFloaty.DisplayName: Sea Floaty SeaMinnow.DisplayName: Sea Minnow -SeaSerpent1.DisplayName: Sea Serpent +SeaMinnowGold.DisplayName: Gold Sea Minnow +Sharkoon.DisplayName: Sharkoon BrimstoneHeart.DisplayName: Brimstone Heart SepulcherHead.DisplayName: Sepulcher SoulSeekerSupreme.DisplayName: Soul Seeker @@ -283,7 +302,7 @@ YharonPhase2: Yharon, Resplendent Phoenix // Town NPCs, Pets, etc AndroombaFriendly.DisplayName: Androomba Pal -DILF: { +Archmage: { DisplayName: Archmage Census.SpawnCondition: Defeat Cryogen Name.Permafrost: Permafrost @@ -322,68 +341,208 @@ DILF: { } } -FAP: { +Bandit: { + DisplayName: Bandit + Census.SpawnCondition: Have a {$ItemName.PlatinumCoin} [i:PlatinumCoin] in your inventory after defeating Skeletron + + Name: { + Laura: Laura + Mie: Mie + Bonnie: Bonnie + Sarah: Sarah + Diane: Diane + Kate: Kate + Penelope: Penelope + Marisa: Marisa + Maribel: Maribel + Valerie: Valerie + Jessica: Jessica + Rowan: Rowan + Jessie: Jessie + Jade: Jade + Hearn: Hearn + Amber: Amber + Anne: Anne + Indiana: Indiana + } + + Chat: { + BloodMoon1: Oy, watch where you're going or I might just use you for dart practice. + BloodMoon2: Bet you'd look good as a pincushion, amiright? + BloodMoon3: Zombies don't dodge very well. Maybe you'll do a bit better. + BloodMoon4: Hey, careful over there. I've rigged the place. One wrong step and you're going to get a knife in your forehead. + Normal1: Anything is a weapon if you throw it hard enough. + Normal2: That's your chucking arm? You need to work out more. + Normal3: Listen here. It's all in the wrist, the wrist! Oh, forget it. + Normal4: Eh you know how it goes; steal from the rich, give to the poor, but I do take a cut of the profit. + Normal5: Snakes! Why does it always have to be snakes! + Normal6: It's super nice you know, to just have everything you want. Some people never got that luxury. + Normal7: It's not stealing! I'm just borrowing it until I die! + Night1: Hm, the stars are too bright tonight. Makes sneaking around a little more difficult. + Night2: You think those stars that fall occasionally would make good throwing weapons? + BrimstoneWitch: Hey, hey, has {0} seriously moved in here with us? Why??? + DrunkPrincess: I learned never to steal {0}'s drinks. She doesn't appreciate me right now, so I'll go back to hiding. + Merchant: Don't tell {0}, but I took some of his stuff and replaced it with Angel Statues. + NurseArmsDealer: Don't tell {0} that I was responsible for {1}'s injuries. + NamedLaura: The nice thing about maps is I can track anything that has fallen. + NamedPenelope: Imagine how fast you could throw if you just had more hands. + NamedValerie: I also take food for currency. + NamedRowan: Usually I only think of animals as food or target practice, but dragons are an exception. + Jungle: I'd rather not be here. This place has bad vibes, y'know? It brings back some unpleasant memories. + Party: Where is my party hat? Well, I stole it of course. + Hardmode1: All sorts of new weapons to be found and looted. Get to that, and I'll share some of my collection too! + Hardmode2: There's so much scrap around this land with valuable parts to them. Makes you wonder who could afford to leave em all around. + Hardmode3: Crypts, tombs, dungeons, those're all just treasure troves to me. The dead are dead, they've got nothing to do with it. + MoonLordDefeated1: If you find anything cool, make sure to drop by and show it to me, I promise I'll keep my hands off it. + MoonLordDefeated2: So many new things to steal, I can't think of where to start! + MoonLordDefeated3: If I end up angering some deities or whatever, would you mind taking the blame for me? + HasBoneGlove: Wouldn't be the first time I used remains as weapons. + HasValediction: Oh man, did you rip that off a shark!? Now that's a weapon! + } + + RefundButton: Refund + Refund1: Want in on a little secret? Since {0} always gets so much cash from you, I've been stealing some of it as we go. I need you to keep quiet about it, so here. + Refund2: Hey, if government officials can get tax, why can't I? The heck do you mean that these two things are nothing alike? + NoRefund: Sorry, I got nothing. Perhaps you could reforge something and come back later... + + TownNPCMood: { + Content: It's been going well! + NoHome: You have a place to bunk? Sleeping on the ground makes me stiff and sore. + LoveSpace: Less people makes getting away with certain things easier. + FarFromHome: I need to get back to my secret cache! What if someone got their hands on it while I was away!? + DislikeCrowded: I don't like this, too many possible eyewitnesses. + HateCrowded: Being around this many people makes me think I'M going to be robbed. + LikeBiome: I know that a lot of wealthy traders come through the desert at times. Makes it a great spot to nick their goods. + DislikeBiome: Too stifling, too humid. I get sluggish in these conditions, no good. + HateBiome: No one lives here, and why would they?! This place is a dump! + 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: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how they do it!" + } +} + +BrimstoneWitch: { + DisplayName: Brimstone Witch + Census.SpawnCondition: Defeat Supreme Witch, Calamitas + Name.Calamitas: Calamitas + + Chat: { + EasterEgg: Mrrp is cringe. + Homeless1: I'm considering moving back to that old cave of mine. + Homeless2: I certainly can't return to Yharim's old dwellings now, have you got any places to stay? + Normal1: I can't pay rent, but if you've got any dead relative you want me to try and... what? You don't? + Normal2: One of these days, I was thinking of starting a garden with the flowers from the old capitol of hell. I love the smell of brimstone in the morning. + Normal3: I think I've settled comfortably, thank you very much. + Normal4: Many seasons have gone by since I first met with the Tyrant, and only now did I break free. I wish I'd been stronger... + Normal5: If you've got any curses you want dispelled... well I'm not your person. + BloodMoon1: Such an unnatural shade of red. Nothing like my brimstone flames. + BloodMoon2: I can't work with nights like these. The stars seem to have shrunk away in fear. + Night1: These undead are horrific, I can't stand to look at them. How could anyone be satisfied with such amateur work? + Night2: I don't think it's a stretch to say that astrology is utter nonsense... but it was a hobby of mine once. + DrunkPrincess: I wonder if {0} ever feels cold given how revealing her dress is. Perhaps she should cover up a bit more. + SeaKing: I cannot understand the Sea King. He does not seem to want me dead. That amount of compassion I just can't understand. + Party: If another person asks me if I can dance or not, I will light their hat on fire. + } + + EnchantButton: Enchant + + TownNPCMood: { + Content: I can't complain, really. + NoHome: Anywhere would be better than a cave with no bed or lighting. + LoveSpace: The quieter, the better. This is good. + FarFromHome: After being used to having people around for a bit, I miss it again. + DislikeCrowded: I really don't like how familiar some of these people are getting with me. + HateCrowded: I'm getting a headache from the pressure of having so many people around. + LikeBiome: I've never had the chance to live somewhere like this before. The trees and the songbirds… I quite like it. + DislikeBiome: Is this a sick joke? I can't bear to be here any longer, I've already tried to atone for my sins. + HateBiome: The spirits are unrestful here. It's really not a good feeling. + 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: "{NPCName} is always lonely, it's why I want to hang out with her, no one should be left alone like that!" + } +} + +Cirrus: { DisplayName: Drunk Princess - Census.SpawnCondition: Have {$Mods.CalamityMod.Items.Potions.FabsolsVodka.DisplayName} [i:CalamityMod/FabsolsVodka] in your inventory in Hardmode + Census.SpawnCondition: Have {$Items.Potions.CirrusVodka.DisplayName} [i:CalamityMod/CirrusVodka] in your inventory in Hardmode or defeat Calamitas Clone/Plantera Name.Cirrus: Cirrus Chat: { - BossAlive: Why are you talking to me right now? Shouldn't you be bumbling around and dying for my amusement? + BossAlive: Why are you talking to me right now? Shouldn't you be bumbling about and dying for my amusement? + BossAliveAlt: You must be joking! Get back out there and FINISH THE FIGHT! Homeless1: I could smell my vodka from MILES away! Homeless2: Have any spare rooms available? Preferably candle-lit with a hefty supply of booze? BloodMoon1: I'm gonna make some Bloody Marys to relax, celery included. Want one? BloodMoon2: If you're too lazy to craft potions normally, try Blood Orbs. Blood is fuel, dumbass. BloodMoon3: I'm trying to not be bitchy tonight, but it's hard when everyone else won't shut up. - BloodMoonSlap: Sorry, I have no moral compass at the moment. - Normal1: I HATE WALMART! ...Anyway, what do you want this time? - Normal2: Drink something that turns you into a magical flying unicorn so you can be just like me. - Normal3: Deals so good I'll [$$!$] myself! ...Sorry, just had a minor stroke! + BloodMoonSlap1: Sorry, I have no moral compass at the moment. + BloodMoonSlap2: I could slap you... but you've done more for me than most. What do you need? + Normal1: What do you want this time? I have an appointment to get my nails done in 5 minutes, make it quick. + Normal1Alt: Whaddya need? I have candles and alcohols galore! + Normal2: Maybe you should drink something that turns you into a magical flying unicorn, so you can be just like me. + Normal2Alt: Sometimes, I think about returning to nature for a while, to escape from all of this chaos. + Normal3: Deals so good I'll [$$!$] myself! ...Sorry, I may have just had a minor stroke! + Normal3Alt: I've been thinking more about the future lately. I can't say I'm not worried, but I'll be trying my best to make it better. Normal4: Did anyone ever tell you that large assets cause back pain? Well, they were right. + Normal4Alt: Do you have any idea how much extra money I make so {0} can afford her super-fancy hair products? Heh, the back pain is worth it. Archmage: "{0} can share a drink with me any time! ...Or maybe not, I'm not sure his old heart could take it." - BrimstoneWitch: The abuse {0} went through is something I can hardly comprehend. I'd offer her a drink, but I don't think she'd enjoy it. + BrimstoneWitch: The abuse {0} endured is something I can scarcely comprehend. I'd offer her a drink, but I don't think she'd enjoy it. Tavernkeep1: My booze will always be better than {0}'s, and nobody can convince me otherwise. Tavernkeep2: Tell {0} to stop calling me. He's not wanted. Tavernkeep3: I've had to tell baldie where my eyes are so many times that I've lost count. - Stylist1: Ever since {0} moved in I haven't been drinking as much... a strange but not unwelcome feeling. + Stylist1: Ever since {0} moved in I haven't been drinking as much... a strange, but not unwelcome, feeling. + Stylist1Alt: I've stopped drinking almost entirely, thanks to {0} and... you. Thank you, for making this world a safer place. Stylist2: You can't stop me from trying to move in with {0}. + Stylist2Alt: If you have {0} and I housed in one of those so-called 'NPC prisons'... we WILL find you, and we WILL bring the scissors... Stylist3: I love it when {0}'s hands get sticky from all that... wax. + Stylist3Alt: "{0} and I will be building wax figures tonight. And no, there's nothing weird about that." Day1: I'm literally balls drunk off my sass right now, what do you want? + Day1Alt: A nice day for a walk in the woods, don't you think? Anyway, what do you need? Day2: I'm either laughing because I'm drunk or because I've lost my mind, probably both. + Day2Alt: Some people ask me whether it's 'unicorn', 'pegacorn', 'alicorn', 'pegasus'... whatever, all of them suit me. Day3: When I'm drunk I'm way happier... at least until the talking worms start to appear. - Day4: I should reprogram the whole mod, while drunk, then send it back to the testers. - DayStylist1: "{0} helped me learn to accept my past. It's been rough, but I think I'm on the right track now." + Day3Alt: Did you know that certain worms can speak? Neither did I, until I flew to outer space. + Day4: I should go fishing... while drunk, and jump into the ocean to spare myself {0}'s annoying naivety... + Day4Alt: I may be a 'hater' and a 'gatekeeper', but I'm also Dionysus' favorite princess, and the most fabulous girl in the world. + DayStylist1: "{0} helped me accept my past. It's been tough, but I think I'm on the right path now." DayStylist2: Might go out for a jog later with {0}. Nice day for it. - DayDrunk1: I drink to forget certain... things. What things, you might ask? Well, the point is to forget them, isn't it? + DayDrunk1: I drink to forget... What am I trying to forget, you might ask? Well, the point is to FORGET, not RECALL, isn't it? DayDrunk2: What a great day! Might just drink so much that I get poisoned again. - Night1: A perfect night to light some candles, drink some wine and relax. - Night2: Here's a challenge... take a shot for every time you've had to look at the wiki. Oh wait, you'd die. - Night3: Yes, everyone knows the mechworm is buggy. Well, not anymore, but still. - Night4: You lost or something? I don't mind company, but I'd rather be left alone at night. - Night5: Are you sure you're 21? ...Alright, fine, but don't tell anyone I sold you these. - NightStylist: I should watch some movies with {0} tonight. You could come too, but only if you bring snacks for us. + Night1: A perfect night to light some candles, drink some wine, and relax. + Night2: Here's a challenge, take a shot for every time you've had to use the wiki. Oh wait, you'd die. + Night2Alt: There's more to life than challenge, y'know. Be sure to sit back and treat yourself once in a while. + Night3: You lost or something? I don't mind company, but I'd rather be left alone at night. + Night3Alt: I do love gazing at the stars. You could join me, if you like. + Night4: Are you sure you're 21? ...Alright, fine, but don't tell anyone I sold you these. + NightStylist: I should watch some movies with {0} tonight. You could come too, but only if you bring snacks. Party: You'll always find me at parties where booze is involved... well, you'll always find BOOZE where I'M involved! - AcidRain: I'm melting! Put a stop to this inclement weather this instant before it ruins my hair! - Martians: You should probably deal with those ayy lmaos before anything else, but whatever. - CryogenDefeated: God I can't wait to smash some ice again! ...For drinks, of course. + PartyAlt: Y'know... this is fun and all, but I can't wait for the festivities to be over. + AcidRain: I'm melting! Put a stop to this inclement weather before it ruins my hair! + Martians: You should probably deal with those 'ayy lmaos' before doing anything else, but whatever. + CryogenDefeated: God, I can't wait to smash some ice again! ...For drinks, of course. LeviathanDefeated: How could you murder such a beautiful creature!? ...The blue one, not the obese cucumber. - MoonLordDefeated: Ever wondered why the Moon Lord needed so many tentacles? Uh... on second thought, I won't answer that. + MoonLordDefeated: Ever wondered why the Moon Lord needed so many tentacles? Uhm... on second thought, I won't answer that. PolterghastDefeated: I saw a ghost down by the old train tracks back at my homeland once, flailing wildly at the lily pads... frightening times those were. DoGDefeated: I hear it's amazing when the famous Devourer of Gods out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61! HasChibii: The hell is that? Looks like something I'd carry around if I was 5 years old. - HasAnahitaTrans: Nice scales... is it hot in here or is it just me? - HasVodka: Do you like my vodka? I created it by mixing fairy dust, crystallized cave sweat and other magical crap. + HasChibiiAlt: I won't judge you for having that creature in tow... but keep it the hell away from me. + HasAnahitaTrans: Nice scales... Is it hot in here, or is it just me? + HasVodka: Do you like my vodka? I created it by mixing fairy dust, crystallized cave sweat, and other magical crap. HasAlicorn1: So... you found my special bottle. Hope you enjoy it, I know I will. - HasAlicorn2: Be sure to dismount me once in a while, I get tired. And besides, I can't rip you off-I mean offer you excellent deals you won't find anywhere else if you're riding me 24/7. + HasAlicorn2: Be sure to dismount me once in a while, I get tired. And besides, I can't rip you off-I mean, offer you excellent deals you won't find anywhere else, if you're riding me 24/7. HasAlicorn3: Before you ask, no, I do NOT have a heart on my butt while in human form. Don't question my transformation preferences! + NewOutfit: It's so refreshing to finally wear something else. I still love my dress, of course, but it's not exactly ideal for exercising. } // Death Count stuffs DeathCountButton: Death Count + Donors DeathCount: You have failed {0} {^0:time;times}. - Death10000: Congratulations! You are now, officially, the biggest loser in Terraria's history! Who was number two? Hell if I know. - Death5000: I'm not sure what to say this time. That you're bad and should feel bad? That much was known already. - Death2500: Bless your heart. I could dodge better than you even if I were drunk high. - Death1000: It is said the average Terrarian has a lifespan of 2 minutes or less. ...Well, not really, but I feel like you'd be part of that statistic. + Death10000: Congratulations! You are now, officially, the biggest loser in Terraria's history! + Death5000: I'm not sure what to say this time... perhaps, that you're bad and should feel bad? + Death2500: I could dodge better than you even if I was blackout drunk. + Death1000: It is said that the average Terrarian has a lifespan of 2 minutes or less... well, not really, but I feel like you'd be part of that statistic. Death500: Your inability to avoid dying to even the most basic of attacks is astonishing to me. Death250: I admire your tenacity. Keep it up, your enemies are racking up quite the kill count! Death100: Consider lowering the difficulty. If you found that statement irritating, good. @@ -391,25 +550,25 @@ FAP: { TownNPCMood: { Content: It's 5 o'clock somewhere. - NoHome: I need a place to crash! My drinks need to be properly cooled before they can be served! + NoHome: I need a place to crash! My drinks MUST be properly cooled before they can be served! LoveSpace: Finally, some peace and quiet. Large quantities of people tend to piss me off. - FarFromHome: I'm used to running away from home, but this is a little ridiculous. - DislikeCrowded: If one more person tells me 'it's happy hour somewhere' to try and get a discount, I'm going to snap! + FarFromHome: Don't get me wrong, I'm used to running away from home, but this is a little ridiculous. + DislikeCrowded: If one more person tells me 'it's happy hour somewhere', I'm going to snap! HateCrowded: No amount of alcohol can drown out the noise these people make! - LoveBiome: Other unicorns? Never thought I'd see the day! This place is incredible! - LikeBiome: A good breeze to cool some heads, that's the way to deal with customers who've had a few too many drinks! + LoveBiome: Other unicorns? I never thought I'd see the day... this place is incredible! + LikeBiome: Ah, a soothing breeze and a gorgeous view; a great way to calm some of my more 'unpleasant' patrons. DislikeBiome: This dry air and heat isn't good for my hair, or my drinks. - HateBiome: You think I can fix this mess with a magical friendship rainbow? That's not how it works, dumbass! Get me out of here already! + HateBiome: You think I can fix this place with a magical friendship rainbow? That's not how it works, so get me out of here already! LoveNPC_Stylist: "{NPCName} works wonders for my hair... among other things, hehe." LoveNPC_BestiaryGirl: "{NPCName} is so fluffy and squishy! She also says my alicorn form is 'mega rad'." - LikeNPC_Truffle: "{NPCName} makes me so hungry... I wonder how great of a trip he'd give..." + LikeNPC_DyeTrader: I tried inviting {NPCName} over for drinks a while back, but he didn't seem interested... oh well, his loss. LikeNPC_PartyGirl: "{NPCName} would make for a great bartender some day. She really knows how to liven the mood!" - DislikeNPC_DD2Bartender: "{NPCName} is so bald." + DislikeNPC_DD2Bartender: "{NPCName} is so bald. The sheen reflecting off his dome could legit blind someone, like, oh my god." DislikeNPC_TaxCollector: "{NPCName} had best keep his distance... he wouldn't want to wake up one morning with a pipe bomb in his mailbox." - 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: "{NPCName} has really interesting stories to tell, I've learned a lot from her already!" + HateNPC_GoblinTinkerer: "{NPCName} was so terrible that I had to FORCE him to stop ripping off his customers... why would you house me next to him!?" + HateNPC_Angler: "{NPCName} never stops blabbering about his inane fishing quests. Get me away from him before I punt him into the sulphurous sea!" + 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: "{NPCName} has some fascinating stories to tell, I've learned quite a lot from her already." HateNPC: I hate {NPCName}. DislikeNPC: I dislike {NPCName}. LikeNPC: I like {NPCName}. @@ -417,7 +576,7 @@ FAP: { } } -SEAHOE: { +SeaKing: { DisplayName: Sea King Census.SpawnCondition: Defeat a Giant Clam after defeating the Desert Scourge Name.Amidias: Amidias @@ -501,126 +660,3 @@ SEAHOE: { Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!" } } - -THIEF: { - DisplayName: Bandit - Census.SpawnCondition: Have a {$ItemName.PlatinumCoin} [i:PlatinumCoin] in your inventory after defeating Skeletron - - Name: { - Laura: Laura - Mie: Mie - Bonnie: Bonnie - Sarah: Sarah - Diane: Diane - Kate: Kate - Penelope: Penelope - Marisa: Marisa - Maribel: Maribel - Valerie: Valerie - Jessica: Jessica - Rowan: Rowan - Jessie: Jessie - Jade: Jade - Hearn: Hearn - Amber: Amber - Anne: Anne - Indiana: Indiana - } - - Chat: { - BloodMoon1: Oy, watch where you're going or I might just use you for dart practice. - BloodMoon2: Bet you'd look good as a pincushion, amiright? - BloodMoon3: Zombies don't dodge very well. Maybe you'll do a bit better. - BloodMoon4: Hey, careful over there. I've rigged the place. One wrong step and you're going to get a knife in your forehead. - Normal1: Anything is a weapon if you throw it hard enough. - Normal2: That's your chucking arm? You need to work out more. - Normal3: Listen here. It's all in the wrist, the wrist! Oh, forget it. - Normal4: Eh you know how it goes; steal from the rich, give to the poor, but I do take a cut of the profit. - Normal5: Snakes! Why does it always have to be snakes! - Normal6: It's super nice you know, to just have everything you want. Some people never got that luxury. - Normal7: It's not stealing! I'm just borrowing it until I die! - Night1: Hm, the stars are too bright tonight. Makes sneaking around a little more difficult. - Night2: You think those stars that fall occasionally would make good throwing weapons? - BrimstoneWitch: Hey, hey, has {0} seriously moved in here with us? Why??? - DrunkPrincess: I learned never to steal {0}'s drinks. She doesn't appreciate me right now, so I'll go back to hiding. - Merchant: Don't tell {0}, but I took some of his stuff and replaced it with Angel Statues. - NurseArmsDealer: Don't tell {0} that I was responsible for {1}'s injuries. - NamedLaura: The nice thing about maps is I can track anything that has fallen. - NamedPenelope: Imagine how fast you could throw if you just had more hands. - NamedValerie: I also take food for currency. - NamedRowan: Usually I only think of animals as food or target practice, but dragons are an exception. - Jungle: I'd rather not be here. This place has bad vibes, y'know? It brings back some unpleasant memories. - Party: Where is my party hat? Well, I stole it of course. - Hardmode1: All sorts of new weapons to be found and looted. Get to that, and I'll share some of my collection too! - Hardmode2: There's so much scrap around this land with valuable parts to them. Makes you wonder who could afford to leave em all around. - Hardmode3: Crypts, tombs, dungeons, those're all just treasure troves to me. The dead are dead, they've got nothing to do with it. - MoonLordDefeated1: If you find anything cool, make sure to drop by and show it to me, I promise I'll keep my hands off it. - MoonLordDefeated2: So many new things to steal, I can't think of where to start! - MoonLordDefeated3: If I end up angering some deities or whatever, would you mind taking the blame for me? - HasBoneGlove: Wouldn't be the first time I used remains as weapons. - HasValediction: Oh man, did you rip that off a shark!? Now that's a weapon! - } - - RefundButton: Refund - Refund1: Want in on a little secret? Since {0} always gets so much cash from you, I've been stealing some of it as we go. I need you to keep quiet about it, so here. - Refund2: Hey, if government officials can get tax, why can't I? The heck do you mean that these two things are nothing alike? - NoRefund: Sorry, I got nothing. Perhaps you could reforge something and come back later... - - TownNPCMood: { - Content: It's been going well! - NoHome: You have a place to bunk? Sleeping on the ground makes me stiff and sore. - LoveSpace: Less people makes getting away with certain things easier. - FarFromHome: I need to get back to my secret cache! What if someone got their hands on it while I was away!? - DislikeCrowded: I don't like this, too many possible eyewitnesses. - HateCrowded: Being around this many people makes me think I'M going to be robbed. - LikeBiome: I know that a lot of wealthy traders come through the desert at times. Makes it a great spot to nick their goods. - DislikeBiome: Too stifling, too humid. I get sluggish in these conditions, no good. - HateBiome: No one lives here, and why would they?! This place is a dump! - 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: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how she does it!" - } -} - -WITCH: { - DisplayName: Brimstone Witch - Census.SpawnCondition: Defeat Supreme Witch, Calamitas - Name.Calamitas: Calamitas - - Chat: { - EasterEgg: Mrrp is cringe. - Homeless1: I'm considering moving back to that old cave of mine. - Homeless2: I certainly can't return to Yharim's old dwellings now, have you got any places to stay? - Normal1: I can't pay rent, but if you've got any dead relative you want me to try and... what? You don't? - Normal2: One of these days, I was thinking of starting a garden with the flowers from the old capitol of hell. I love the smell of brimstone in the morning. - Normal3: I think I've settled comfortably, thank you very much. - Normal4: Many seasons have gone by since I first met with the Tyrant, and only now did I break free. I wish I'd been stronger... - Normal5: If you've got any curses you want dispelled... well I'm not your person. - BloodMoon1: Such an unnatural shade of red. Nothing like my brimstone flames. - BloodMoon2: I can't work with nights like these. The stars seem to have shrunk away in fear. - Night1: These undead are horrific, I can't stand to look at them. How could anyone be satisfied with such amateur work? - Night2: I don't think it's a stretch to say that astrology is utter nonsense... but it was a hobby of mine once. - DrunkPrincess: I wonder if {0} ever feels cold given how revealing her dress is. Perhaps she should cover up a bit more. - SeaKing: I cannot understand the Sea King. He does not seem to want me dead. That amount of compassion I just can't understand. - Party: If another person asks me if I can dance or not, I will light their hat on fire. - } - - EnchantButton: Enchant - - TownNPCMood: { - Content: I can't complain, really. - NoHome: Anywhere would be better than a cave with no bed or lighting. - LoveSpace: The quieter, the better. This is good. - FarFromHome: After being used to having people around for a bit, I miss it again. - DislikeCrowded: I really don't like how familiar some of these people are getting with me. - HateCrowded: I'm getting a headache from the pressure of having so many people around. - LikeBiome: I've never had the chance to live somewhere like this before. The trees and the songbirds… I quite like it. - DislikeBiome: Is this a sick joke? I can't bear to be here any longer, I've already tried to atone for my sins. - HateBiome: The spirits are unrestful here. It's really not a good feeling. - 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: "{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.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index a457e9850c..9c5863d7c5 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -1,3 +1,4 @@ +AnahitaTelegraph.DisplayName: Anahita Telegraph ApolloChargeTelegraph.DisplayName: Apollo Charge Telegraph ApolloFireball.DisplayName: Volatile Plasma Blast ApolloRocket.DisplayName: High Explosive Plasma Rocket @@ -40,6 +41,8 @@ CirrusBlaster.DisplayName: Cirrus Mushroom CirrusPhotonRipperPrismTooth.DisplayName: Cirrus Photon Ripper Tooth CirrusPhotonRipperProjectile.DisplayName: Cirrus Photon Ripper CirrusVolatileVodkaBottle.DisplayName: Volatile Vodka Bottle +CrimulanSpike.DisplayName: Crimulan Spike +CursedFire.DisplayName: Eye Fire DarkEnergyBall.DisplayName: Dark Energy DarkEnergyBall2.DisplayName: Dark Energy DarkOrb.DisplayName: Dark Orb @@ -56,6 +59,7 @@ DoGDeathBoom.DisplayName: Cosmic Explosion DoGFire.DisplayName: Death Fire DoGP1EndPortal.DisplayName: Portal DoGTeleportRift.DisplayName: Rift +DoGWingdings.DisplayName: Ramblings of Wing DoGster DraedonSummonLaser.DisplayName: Giant Fuck-off Deathray of Doom DyingSun.DisplayName: Dying Sun EssenceDust.DisplayName: Cosmic Dust @@ -64,10 +68,12 @@ FlareBomb.DisplayName: Flare Bomb FlareDust.DisplayName: Flare Dust FlareDust2.DisplayName: Flare Bomb Flarenado.DisplayName: Flarenado +FoveanatorEnergyBomb.DisplayName: Nebulous Energy Bomb +FoveanatorLaser.DisplayName: Nebulous Laser +FoveanatorFlamethrower.DisplayName: Nebulous Flames FrostMist.DisplayName: Frost Mist GooglyEye.DisplayName: Googly Eye GreatSandBlast.DisplayName: Great Sand Blast -HealOrbProv.DisplayName: Heal HellfireExplosion.DisplayName: Brimstone Hellfire Explosion HiveBombGoliath.DisplayName: Hive Bomb HolyAura.DisplayName: Holy Aura @@ -130,7 +136,7 @@ SandTooth.DisplayName: Sand Tooth SCalBrimstoneFireblast.DisplayName: Brimstone Fireblast SCalBrimstoneGigablast.DisplayName: Brimstone Gigablast SCalRitualDrama.DisplayName: Calamitous Ritual Drama -ScavengerLaser.DisplayName: Homing Dart +HomingLaserDart.DisplayName: Homing Dart ScavengerNuke.DisplayName: Homing Nuke ShadeNimbusHostile.DisplayName: Shade Nimbus ShaderainHostile.DisplayName: Shade Rain diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson index 1972f5913e..7de66aee2f 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson @@ -15,10 +15,12 @@ FlameBurstHostile.DisplayName: Burst GammaAcid.DisplayName: Acid GammaBeam.DisplayName: Gamma Ray GammaRayBurst.DisplayName: G-FUEL BEAM +HorsPoisonBlast.DisplayName: Poisonous Spit HorsWaterBlast.DisplayName: Water IceClasperEnemyProjectile.DisplayName: Ice Shard InkBombHostile.DisplayName: Ink Bomb InkPoisonCloud.DisplayName: Ink Cloud +JellyghoulBolt.DisplayName: Jellyghoul Bolt LightningCloud.DisplayName: Cloud MantisRing.DisplayName: Mantis Ring MaulerAcidBubble.DisplayName: Acid Bubble @@ -30,6 +32,7 @@ OrthoceraStream.DisplayName: Acid Stream PearlBurst.DisplayName: Pearl Burst PearlRain.DisplayName: Pearl Rain PufferExplosion.DisplayName: Explosion +SharkoonExplosion.DisplayName: Sharkoon Explosion StormMarkHostile.DisplayName: Mark SulphuricAcidBubble.DisplayName: Acid Bubble SulphuricAcidMist.DisplayName: Acid Mist diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 3227b6c5db..9e64da189d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -20,7 +20,6 @@ AstralCrystalInvisibleExplosion.DisplayName: Astral Crystal Invisible Explosion AstralStarMagic.DisplayName: Astral Star AtlantisSpear.DisplayName: Atlantis Spear AugurTentacle.DisplayName: Elemental Tentacle -AuraRain.DisplayName: Aura Rain AuroraAustralis.DisplayName: Aurora Australis BeamingBolt.DisplayName: Beaming Bolt BeamingBolt2.DisplayName: Beaming Bolt @@ -35,10 +34,7 @@ BloodRay.DisplayName: Blood Ray BlueBubble.DisplayName: Bubble BlushieStaffProj.DisplayName: Staff of Blushie BrimroseBeam.DisplayName: Brimrose Beam -BrimstoneFireball.DisplayName: Brimstone Fireball BrimstoneHellfireballFriendly.DisplayName: Hellfireball -BrimstoneHomer.DisplayName: Brimstone Homer -BrimstoneTentacle.DisplayName: Brimstone Tentacle CauldronProj.DisplayName: Smauldron CauldronProjSmall.DisplayName: Smaullerdron ChronoIcicleLarge.DisplayName: Chrono Icicle @@ -49,6 +45,8 @@ ClamorNoctusWyvern.DisplayName: Clamor Wyvern ClimaxBeam.DisplayName: Voltaic Bolt ClimaxProj.DisplayName: Voltaic Orb CoralSpike.DisplayName: Coral Spike +CosmicRainbowFront.DisplayName: Rainbow +CosmicRainbowTrail.DisplayName: Rainbow CosmicTentacle.DisplayName: Dark Tentacle CryoBlast.DisplayName: Cryo Blast DarkSparkBeam.DisplayName: Dark Spark Beam @@ -72,6 +70,7 @@ ExoVortex2.DisplayName: Subsuming Vortex FabBolt.DisplayName: Fab Bolt FabRay.DisplayName: Fab Ray FatesRevealFlame.DisplayName: Fate's Reveal +FireImplosion.DisplayName: Swirling Backdraft FlareBoltProjectile.DisplayName: Flare Bolt ForbiddenAxeBlade.DisplayName: Ruin Blade ForbiddenSunburst.DisplayName: Sunburst @@ -86,8 +85,6 @@ GhastlyExplosionShard.DisplayName: Ghastly Fragment GhastlySubBlast.DisplayName: Ghast Blast GleamingBolt.DisplayName: Gleaming Bolt GleamingBolt2.DisplayName: Gleaming Bolt -GraniteEnergy.DisplayName: Granite Energy -GranitePulse.DisplayName: Granite Pulse HadalUrnIsopod.DisplayName: Abyssal Isopod HadalUrnJellyfish.DisplayName: Mirage Jelly HadalUrnLamprey.DisplayName: Sea Lamprey @@ -99,11 +96,12 @@ HellwingBat.DisplayName: Ashen Hellwing HolyFlame.DisplayName: Holy Flame HolyLaser.DisplayName: Holy Laser IceBarrageMain.DisplayName: Ice Barrage -IceBlock.DisplayName: Ice Barrage -IceBlockIcicle.DisplayName: Ice Barrage +IceBlock.DisplayName: Ice Barrage Block +IceBlockIcicle.DisplayName: Ice Barrage Icicle IceCluster.DisplayName: Ice Cluster Icicle.DisplayName: Icicle IcicleStaffProj.DisplayName: Furious Icicle +IncineratingFireball.DisplayName: Incinerating Fireball InfernadoFriendly.DisplayName: Infernado InfernadoMarkFriendly.DisplayName: Infernado Mark InfernalBlade.DisplayName: Infernal Blade @@ -160,10 +158,10 @@ 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 PlasmaRay2.DisplayName: Plasma Ray -PlasmaShot.DisplayName: Plasma Shot +PlasmaRifleExplosion.DisplayName: Ionizing Particle Cloud +PlasmaRifleShot.DisplayName: Concentrated Plasma Blast PoseidonTyphoon.DisplayName: Poseidon Typhoon PrimordialAncientExplosion.DisplayName: Primordial Ancient PrimordialAncientProjectile.DisplayName: Primordial Ancient @@ -195,7 +193,6 @@ SerpentineBody.DisplayName: Serpentine SerpentineHead.DisplayName: Serpentine SerpentineTail.DisplayName: Serpentine ShadecrystalProjectile.DisplayName: Shadecrystal -ShadeNimbus.DisplayName: Shade Nimbus ShadeNimbusCloud.DisplayName: Shade Nimbus Shaderain.DisplayName: Shaderain Shadowbolt.DisplayName: Shadowbolt @@ -203,6 +200,7 @@ ShiftingSandsProj.DisplayName: Shifting Sands SHPB.DisplayName: SHPB SHPExplosion.DisplayName: SHPB Explosion SHPL.DisplayName: SHPL +SHPS.DisplayName: SHPS SilvaBurst.DisplayName: Silva Burst SlitheringEelProjectile.DisplayName: Slithering Eel SmallSpirit.DisplayName: Small Angry Spirit @@ -223,8 +221,6 @@ TacticiansElectricBoom.DisplayName: Electric Explosion TacticiansTrumpCardProj.DisplayName: Trump Beam TearsofHeavenProjectile.DisplayName: Tears of Heaven Teslabeam.DisplayName: Teslabeam -ThunderstormShot.DisplayName: Thunderous Shot -ThunderstormShotSplit.DisplayName: Thunderous Shot TradewindsProjectile.DisplayName: Tradewinds Feather TridentIcicle.DisplayName: Trident Icicle UberBubble.DisplayName: Bubble @@ -234,6 +230,7 @@ ValkyrieRayStaff.DisplayName: Valkyrie Ray VeeringWindAirWave.DisplayName: Veering Wind Air Wave VeeringWindFrostWave.DisplayName: Veering Wind Frost Wave Vehemence.DisplayName: Blast of Vehemence +VehemenceBolt.DisplayName: Vehemence Bolt VehemenceSkull.DisplayName: Vehement Skull VenusianBolt.DisplayName: Venusian Bolt VenusianExplosion.DisplayName: Venusian Explosion @@ -250,9 +247,11 @@ VividLaser2.DisplayName: Vivid Laser VividOrb.DisplayName: Vivid Orb VoidVortexProj.DisplayName: Void Vortex VolatileStarcore.DisplayName: Volatile Starcore +VolterionOrb.DisplayName: Unstable Ball Lightning +VolterionShot.DisplayName: Ultracharged Filament VortexElementalBeam.DisplayName: Vortex Lightning WaterLeechProj.DisplayName: Water Leech -WaywasherProj.DisplayName: Waywasher Blast +WaywasherProj.DisplayName: Waywasher Wave WingmanGrenade.DisplayName: Mana Grenade WingmanShot.DisplayName: Mana Shot WulfrumBolt.DisplayName: Wulfrum Bolt diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 435f7da56d..72ae489a01 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -10,7 +10,6 @@ AncientBeam.DisplayName: Ancient Beam AncientStar.DisplayName: Ancient Star AndromedasStride.DisplayName: Andromeda's Stride AndromedasStrideBoltSpawner.DisplayName: Andromeda Shock -AquaStream.DisplayName: Aqua Stream AridGrandeur.DisplayName: Arid Grandeur AriesWrath.DisplayName: Aries's Wrath AriesWrathConstellation.DisplayName: Constellation @@ -34,11 +33,11 @@ BansheeHookScythe.DisplayName: Banshee Scythe BiomeBladeHoldout.DisplayName: Mended Biome Blade BitingEmbrace.DisplayName: Biting Embrace BitingEmbraceMist.DisplayName: Glacial Mist +BladecrestOathswordThrownBlade.DisplayName: Bladecrest Oathsword Thrown Blade BlazingPhantomBlade.DisplayName: Blazing Phantom Blade Blood.DisplayName: Carnage Blood Blood2.DisplayName: Blood BloodBall.DisplayName: Blood Ball -BloodScythe.DisplayName: Blood Scythe BonebreakerFragment1.DisplayName: Bone Crunching Shrapnel BonebreakerProjectile.DisplayName: Bonebreaker BotanicSpear.DisplayName: Botanic Spear @@ -53,8 +52,8 @@ BrimstoneSwordProj.DisplayName: Brimstone Sword BrinySpout.DisplayName: Briny Spout BrinyTyphoonBubble.DisplayName: Bubble BrokenBiomeBladeHoldout.DisplayName: Broken Biome Blade +BurningHolyBlast.DisplayName: Profaned Blast BurningMeteor.DisplayName: Meteor -CatastropheClaymoreSparkle.DisplayName: Catastrophe Sparkle CausticEdgeProjectile.DisplayName: Caustic Edge ChainedMeatHook.DisplayName: Enchanted Meat Hook ClamCrusherFlail.DisplayName: Clam Crusher @@ -67,9 +66,7 @@ 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 +CosmicSpiritBomb.DisplayName: Cosmic Bomb CrescentMoonFlail.DisplayName: Crescent Moon CrescentMoonProj.DisplayName: Crescent Moon CrystylCrusherRay.DisplayName: Crystyl Crusher Ray @@ -82,31 +79,35 @@ DarklightGreatswordSlashCreator.DisplayName: Darklight Greatsword Slash Creator DarkMasterBeam.DisplayName: Dark Master Beam DarkMasterClone.DisplayName: Dark Terrarian DeathsAscensionProjectile.DisplayName: Ascended Scythe +DeathsAscensionRift.DisplayName: Rift 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 +DevilsDevastationThrownBlade.DisplayName: Devils Devastation Thrown Blade DevilsSunriseCyclone.DisplayName: Devil's Sunrise -DivineHatchetBoomerang.DisplayName: Scorching Seeker DNA.DisplayName: DNA DracoBeam.DisplayName: Draconic Beam DracoBeam2.DisplayName: Draconic Beam DraconicSpark.DisplayName: Draconic Spark DragonPowFlail.DisplayName: Dragon Pow DragonRageFireball.DisplayName: Dragon Rage Fireball +DragoonBigBolt.DisplayName: Dragoon Lightning +DragoonSmallBolt.DisplayName: Dragoon Bolt EarthBoom.DisplayName: Earth's Judgement EarthMeteor.DisplayName: Gaia Meteor +EarthenTides.DisplayName: Earthen Tides +EarthenTidesBeam.DisplayName: Earthen Projection +EarthenTidesBlast.DisplayName: Earthen Tides Blast +EarthenTidesBlastSpawner.DisplayName: Blast Spawner +EarthenTidesShockwave.DisplayName: Earthen Tides Shockwave ElementalGlassStar.DisplayName: Glass Star -ElementBall.DisplayName: Elemental Ball EmpyreanKnife.DisplayName: Empyrean Knife EntropicFlechette.DisplayName: Entropic Flechette EonBolt.DisplayName: Eon Bolt EssenceFlame2.DisplayName: Essence Flame EssenceScythe.DisplayName: Essence Scythe -EutrophicScimitarProj.DisplayName: Scimitar Zap +ExaltedOathbladeThrownBlade.DisplayName: Exalted Oathblade Thrown Blade ExcelsusBlue.DisplayName: Excelsus ExcelsusMain.DisplayName: Excelsus ExcelsusPink.DisplayName: Excelsus @@ -115,28 +116,24 @@ ExobeamSlash.DisplayName: Exobeam Slash ExobeamSlashCreator.DisplayName: Anime Sword Effect Exoboom.DisplayName: Exoplasma Explosion ExtantAbhorrence.DisplayName: Extant Abhorrence -ExtantAbhorrenceMonolith.DisplayName: Abhorrent Monolith FallenBlast.DisplayName: Fallen Paladin's Wrath +FallenExplosionSmall.DisplayName: Fallen Hammer Blast 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 +ForbiddenOathbladeThrownBlade.DisplayName: Forbidden Oathblade Thrown Blade GaelExplosion.DisplayName: Gael Explosion GaelSkull.DisplayName: No Longer Ark of the Cosmos' Superior Cousin GaelSkull2.DisplayName: No Longer Ark of the Cosmos' Superior Cousin GalacticaComet.DisplayName: Galactus Comet GalaxiaBolt.DisplayName: Galaxia Bolt GalaxiaHoldout.DisplayName: Galactic Formation -GalaxiaTropicRing.DisplayName: Star Ring -GalaxyBlast.DisplayName: Galaxy Blast -GalaxyBlastType2.DisplayName: Galaxy Blast -GalaxyBlastType3.DisplayName: Galaxy Blast GalaxySmasherBlast.DisplayName: Galactic Blast GalaxySmasherEcho.DisplayName: Galaxy Smasher Echo GalaxySmasherHammer.DisplayName: Galaxy Smasher -GalaxySmasherMini.DisplayName: Galaxy Smasher +GalaxySmasherMini.DisplayName: Cosmic Shard GalileosMoon.DisplayName: Crescent Moon GalileosPlanet.DisplayName: Planet GayBeam.DisplayName: Iridescent Beam @@ -153,6 +150,7 @@ GreenWater.DisplayName: Greentide Tooth GrovetendersEntanglingVines.DisplayName: Entangling Growth GrovetendersTouch.DisplayName: Grovetender's Touch HeavensMight.DisplayName: Heaven's Might +HeavensMonolith.DisplayName: Heaven's Monolith HellionSpike.DisplayName: Hellion Spike HolyColliderHolyFire.DisplayName: Holy Collider Fire IceBombFriendly.DisplayName: Ice Bomb @@ -168,9 +166,9 @@ LifeScythe.DisplayName: Lifehunt Scythe LightBeam.DisplayName: Light Beam LightningThing.DisplayName: Lightning LuxorsGiftMelee.DisplayName: Luxor's Melee -MercurialTides.DisplayName: Mercurial Tides -MercurialTidesBlast.DisplayName: Mercurial Blast -MercurialTidesMonolith.DisplayName: Mercurial Monolith +MantisClawHoldout.DisplayName: Mantis Claw +MantisClawJet.DisplayName: Mantis Claw Jet +MantisClawSlash.DisplayName: Mantis Claw Slash MicrowaveAura.DisplayName: Microwave Radiation MirrorBlast.DisplayName: Mirror Blade MonstrousKnife.DisplayName: Monstrous Knife @@ -182,14 +180,12 @@ 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 -OrderbringerAura.DisplayName: Aura OrderbringerBeam.DisplayName: Orderbringer Beam -OrderbringerRain.DisplayName: Rain -OrderbringerWhiteOrb.DisplayName: Orderbringer Orb +OrderbringerWaveProj.DisplayName: Order-bringing Wave PhoenixsPride.DisplayName: Phoenix's Pride +PhoenixsPrideFirewall.DisplayName: Phoenix's Pride Flame Pillar PhosphorescentGauntletPunches.DisplayName: Gauntlet Punch PhotonRipperProjectile.DisplayName: Extraordinarily Cost-Inefficient Chainsaw PlagueSeeker.DisplayName: Plague Seeker @@ -198,8 +194,11 @@ PolarisGazeDash.DisplayName: Polaris Piercing Lunge PolarisGazeStar.DisplayName: Northern Star PrismaticBeam.DisplayName: Prismatic Beam PrismaticWave.DisplayName: Prismatic Wave +PrismaticMagicCircle.DisplayName: Magic Circle +PrismaticRay.DisplayName: Prismatic Master Spark PrismRay.DisplayName: Prismatic Light PrismTooth.DisplayName: Photon Ripper +PureClarity.DisplayName: Pure Clarity PurityProjection.DisplayName: Purity Projection PurityProjectionSigil.DisplayName: Purity Sigil PwnagehammerEcho.DisplayName: Pwnagehammer Echo @@ -213,6 +212,7 @@ RemsRevengeExplosion.DisplayName: Blood Explosion RendingNeedle.DisplayName: Rending Needle RespiteblockBlood.DisplayName: Respiteblock Blood RespiteblockHoldout.DisplayName: Respiteblock +RiptideWave.DisplayName: Wave Rox1.DisplayName: Rock RoxcaliburProj.DisplayName: Roxcalibur RSSolarFlare.DisplayName: Flare @@ -222,9 +222,10 @@ SandFire.DisplayName: Fire SanguineFury.DisplayName: Sanguine Fury SanguineFuryDash.DisplayName: Shredding Lunge SanguineFuryWheel.DisplayName: Sanguine Bladewheel +ScorcherExplosion.DisplayName: Scorching Crystal Blast ScourgeoftheCosmosMini.DisplayName: Miniature Cosmic Scourge ScourgeoftheCosmosProj.DisplayName: Cosmic Scourge -SeashineSwordProj.DisplayName: Seashine Beam +SeekingScorcherProj.DisplayName: Scorching Seeker SolarNeedle.DisplayName: Solar Needle SolsticeBeam.DisplayName: Solstice Beam SoulScythe.DisplayName: Soul Scythe @@ -237,9 +238,11 @@ SpineOfThanatosProjectile.DisplayName: Spine of Thanatos StarburstBeam.DisplayName: Star Shiv StarburstSHIV.DisplayName: SHIV StarnightBeam.DisplayName: Starnight Beam +StarofJudgement.DisplayName: Star of Judgement StellarContemptBlast.DisplayName: Stellar Blast StellarContemptEcho.DisplayName: Echoes of Contempt StellarContemptHammer.DisplayName: Stellar Contempt +StellarStrikerMeteor.DisplayName: Stellar Striker Meteor StormBeam.DisplayName: Storm Beam StormMark.DisplayName: Storm Mark StormRulerProj.DisplayName: Storm Ruler @@ -249,7 +252,9 @@ StygianShieldThrown.DisplayName: Shield of Chaos SulphurousGrabberBubble.DisplayName: Grabber Bubble SulphurousGrabberBubble2.DisplayName: Grabber Bubble SwordsmithsPride.DisplayName: Swordsmith's Pride -SwordsmithsPrideBeam.DisplayName: Swordsmith's Projection +SwordsmithsPrideAstralBomber.DisplayName: Swordsmith's Astral Bomber +SwordsmithsPrideAstralEnergy.DisplayName: Swordsmith's Astral Energy +SwordsmithsPrideMonolith.DisplayName: Swordsmiths Pride Monolith SwordsplosionBlue.DisplayName: Blue Sword SwordsplosionGreen.DisplayName: Green Sword SwordsplosionPurple.DisplayName: Purple Sword @@ -271,6 +276,8 @@ ThornBase.DisplayName: Thorn TinyCrystal.DisplayName: Crystal TinyFlare.DisplayName: Flare Tornado.DisplayName: Tornado +TriactisHammerExplosion.DisplayName: The Great Collapse +TriactisHammerFlare.DisplayName: Prismatic Light Flare TriactisHammerProj.DisplayName: Triactis' True Paladinian Mage-Hammer of Might TrueAncientBeam.DisplayName: True Ancient Beam TrueAncientBlast.DisplayName: Ancient Energy Blast @@ -282,11 +289,11 @@ TrueBiomeBladeHoldout.DisplayName: True Biome Blade TrueBitingEmbrace.DisplayName: Biting Embrace TrueDecaysRetort.DisplayName: Decay's Retort TrueGrovetendersTouch.DisplayName: Grovetender's Touch +TruePureClarity.DisplayName: Pure Clarity TruePurityProjection.DisplayName: Purity Projection TumbleweedRolling.DisplayName: Rolling Tumbleweed TyphonsGreedBubble.DisplayName: Typhon's Greed UltimusCleaverDust.DisplayName: Ultimus Flame -UrchinMaceProjectile.DisplayName: Urchin Mace UrchinSpikeFugu.DisplayName: Urchin Spike VirulentBeeWave.DisplayName: Virulent Bee Wave VirulentWave.DisplayName: Virulent Wave @@ -295,13 +302,7 @@ VoidTentacle.DisplayName: Void Tentacle VolcanicFireball.DisplayName: Volcanic Fireball VolcanicFireballLarge.DisplayName: Volcanic Fireball Waterfall.DisplayName: Waterfall Beam -WhiteBoltAura.DisplayName: White Aura -WhiteOrb.DisplayName: White Orb -Whiterain.DisplayName: White Rain WulfrumScrew.DisplayName: Wulfrum Screw WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard -MantisClawHoldout.DisplayName: Mantis Claw -MantisClawSlash.DisplayName: Mantis Claw Slash -MantisClawJet.DisplayName: Mantis Claw Jet diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 389293cecf..403a7a04c0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -19,15 +19,13 @@ AuricBullet.DisplayName: Auric Bullet AuroraFire.DisplayName: Aurora Blaze BallistaGreatArrow.DisplayName: Ballista Great Arrow BarinadeArrow.DisplayName: Fin Arrow -BigCoral.DisplayName: Big Coral BlightFlames.DisplayName: Blight Flames -BlissfulBombardierDustProjectile.DisplayName: Holy Flare Dust +BlissfulBombardierSplitProjectile.DisplayName: Profaned Mini-Rocket BloodBoilerFire.DisplayName: Blood Fire BloodClotFriendly.DisplayName: Blood Clot BloodfireArrowProj.DisplayName: Bloodfire Arrow BloodfireBulletProj.DisplayName: Bloodfire Bullet BloodflareSoul.DisplayName: Blood Soul -Bolt.DisplayName: Storm Bolt BoltArrow.DisplayName: Bolt Arrow BouncingShotgunPellet.DisplayName: Shotgun Pellet BrimstoneBolt.DisplayName: Brimstone Bolt @@ -59,6 +57,7 @@ CorrodedShell.DisplayName: Corroded Shell CosmicFire.DisplayName: Dead Sun's Fire DaemonsFlameArrow.DisplayName: Daemon's Arrow DeadSunExplosion.DisplayName: Dead Sun's Explosion +DragonsBreathBurst.DisplayName: Draconic Burst DragonsBreathFlames.DisplayName: Draconic Flames DragonsBreathMag.DisplayName: Dragons Breath Cartridge DragonsBreathRound.DisplayName: Dragon's Breath Round @@ -138,9 +137,13 @@ NorfleetComet.DisplayName: Comet NorfleetExplosion.DisplayName: Explosion NovaChargedShot.DisplayName: Charged Nova Blast NovaShot.DisplayName: Nova Bolt -Nuke.DisplayName: Nuke +NukeOfBliss.DisplayName: Profaned Nuke +NullFlash.DisplayName: Null Flash NullShot.DisplayName: Null -NullShot2.DisplayName: Null +OntologicalDespoilerBeam.DisplayName: Null-Annihilation Beam +OntoligicalDespoilerBurst.DisplayName: Disruption Blast +OntologicalDespoilerGrenade.DisplayName: Disruption Sphere +OntologicalDespoilerShot.DisplayName: Unreality Condensate OpalChargedStrike.DisplayName: Charged Plasma Bolt OpalStrike.DisplayName: Heated Bolt PiercingBullet.DisplayName: Piercing Blow @@ -172,7 +175,7 @@ RealmRavagerBullet.DisplayName: Explosive Bullet RicoshotCoin.DisplayName: Ricoshot Coin RocketFire.DisplayName: Fire RubberMortarRoundProj.DisplayName: Rubber Mortar -SandstormBullet.DisplayName: Sandstorm +SandblasterBullet.DisplayName: Sandstorm ScorchedEarthBlast.DisplayName: Earth Scorcher ScorchedEarthClusterBomb.DisplayName: Cluster Bomb ScorchedEarthRocket.DisplayName: Rocket @@ -183,7 +186,7 @@ SeaDragonRocket.DisplayName: Seadragon RPG SeasSearingBubble.DisplayName: Searing Bubble SeasSearingSecondary.DisplayName: Hydroshower SeasSearingSpout.DisplayName: Spout -SepticSkewerBacteria.DisplayName: Bacteria +SepticSkewerBacteria.DisplayName: Septic Gore SepticSkewerHarpoon.DisplayName: Septic Skewer SevensStrikerBrick.DisplayName: Brick SevensStrikerCherry.DisplayName: Cherry @@ -218,11 +221,15 @@ SulphuricBlast.DisplayName: Sulphuric Blast SuperradiantBolt.DisplayName: Superradiant Bolt SuperradiantSaw.DisplayName: Superradiant Saw SuperradiantSawLingering.DisplayName: Ultraradiant Saw +TauCannonBeam.DisplayName: Tau Cannon Beam +TauCannonBolt.DisplayName: Tau Cannon Bolt +TauCannonPortal.DisplayName: Tau Cannon Portal TelluricGlareArrow.DisplayName: Radiant Arrow TheMaelstromExplosion.DisplayName: Reaper Explosion TheMaelstromShark.DisplayName: Reaper Shark ThePackMinissile.DisplayName: Pack Minissile ThePackMissile.DisplayName: Pack Missile +TheStormLightningShot.DisplayName: Storm Bolt TitaniumRailgunScope.DisplayName: Titanium Scope TitaniumRailgunShot.DisplayName: Titanium Decimator TorrentialArrow.DisplayName: Torrential Arrow @@ -244,3 +251,13 @@ WaterSpout.DisplayName: Spout WildfireBloomFire.DisplayName: Wildfire Fire WildfireBloomFlare.DisplayName: Wildfire Flare WulfrumScrapBullet.DisplayName: High Speed Scrap +HellbornProj.DisplayName: Hell-born Gunblast +HellbornShell.DisplayName: Hell's Shell +RubicoPrimeMag.DisplayName: Rubico Prime Mag +MegalodonShot.DisplayName: Megalodon Shot +SulphuricAcidCannonExplosion.DisplayName: Sulphuric Acid Cannon Explosion +LeviatitanAberration.DisplayName: Leviatitan Aberration +LeviatitanMeteor.DisplayName: Leviatitan Meteor +LeviatitanExplosion.DisplayName: Leviatitan Explosion +SulphuricDrop.DisplayName: Sulphuric Drop +AcidRocket.DisplayName: Acid Rocket diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 2a9058f92e..275aa51dbc 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -2,9 +2,11 @@ AbyssalMirrorProjectile.DisplayName: Lumenyl Fluid AcidBarrelDrop.DisplayName: Barrel Acid Drop AcidShrapnel.DisplayName: Acidic Shrapnel AdamantiteThrowingAxeProjectile.DisplayName: Adamantite Throwing Axe -AlphaSeeker.DisplayName: Alpha Virus Seeker -AlphaVirusProjectile.DisplayName: Alpha Virus +AntlionSkewerProj.DisplayName: Antlion on a Stick +AntlionSkewerSandBlast.DisplayName: Antlion Blast +AntlionSkewerSandCloud.DisplayName: Dense Sand Cloud AntumbraShardProjectile.DisplayName: Antumbra Shard +ApoctolithExplosion.DisplayName: Apoctolith Boom ApoctolithProj.DisplayName: Apoctolith ApoctolithShard.DisplayName: Apoctolith Shard AshenStalactiteDebris.DisplayName: Ashen Debris @@ -16,7 +18,6 @@ BallisticPoisonBombProj.DisplayName: Poison Bomb BallisticPoisonBombSpike.DisplayName: Poison Spike BallisticPoisonCloud.DisplayName: Ballistic Cloud BarrelShrapnel.DisplayName: Barrel Shrapnel -BettyExplosion.DisplayName: Betty Explosion BileExplosion.DisplayName: Bile BlastBarrelProjectile.DisplayName: Blast Barrel BlazingStarProj.DisplayName: Blazing Star @@ -25,16 +26,13 @@ BlueFlamePillar.DisplayName: Flame Pillar BlunderBoosterLightning.DisplayName: Blunder Bolt BouncingEyeballProjectile.DisplayName: Bouncy Eyeball BouncingEyeballProjectileStealthStrike.DisplayName: Bouncy Eyeball -BouncyBol.DisplayName: Bouncy Ball -BrackishFlaskProj.DisplayName: Brackish Flask -BrackishSpear.DisplayName: Not Atlantis Spear -BrackishWater.DisplayName: Brackish Water -BrackishWaterBlast.DisplayName: Brackish Water Brick.DisplayName: Brick BrickFragment.DisplayName: Brick Fragment Brimblade2.DisplayName: Brimblade BrimbladeProj.DisplayName: Brimblade +BurningStrifeExplosion.DisplayName: Shadow Flame Explosion BurningStrifeProj.DisplayName: Shadow Flame Spiky Ball +BurningTentacle.DisplayName: Strife Tentacle ButcherKnife.DisplayName: Butcher Knife CarvingFork.DisplayName: Carving Fork CelestialReaperAfterimage.DisplayName: Celestial Reaper @@ -48,7 +46,7 @@ CobaltEnergy.DisplayName: Cobalt Energy CobaltKunaiProjectile.DisplayName: Cobalt Kunai ConsecratedWaterProjectile.DisplayName: Consecrated Water ContaminatedBileFlask.DisplayName: Contaminated Bile -CorpusAvertorClone.DisplayName: Corpus Avertor +CorpusAvertorClone.DisplayName: Corpus Avertor Clone CorpusAvertorProj.DisplayName: Corpus Avertor CorpusAvertorStealth.DisplayName: Corpus Avertor Corrocloud1.DisplayName: Corrocloud @@ -94,8 +92,6 @@ EclipsesSmol.DisplayName: Eclipse's Small EclipsesStealth.DisplayName: Eclipse's Fall EclipseStealthBoom.DisplayName: Eclipse Blast EGloveSpark.DisplayName: Electrician's Spark -ElementalDiskProj.DisplayName: Elemental Disk -ElementalDiskSplit.DisplayName: Elemental Disk EnchantedAxe2.DisplayName: Enchanted Axe EnchantedAxeProj.DisplayName: Enchanted Axe EpidemicShredderProjectile.DisplayName: Epidemic Shredder @@ -107,8 +103,6 @@ ExecutionersBladeProj.DisplayName: Executioner's Blade ExecutionersBladeStealthProj.DisplayName: Executioner's Blade ExorcismProj.DisplayName: Exorcism ExorcismShockwave.DisplayName: Exorcism Shockwave -ExorcismStar.DisplayName: Exorcism Star -ExplosiveSun.DisplayName: Explosive Sun FantasyTalismanProj.DisplayName: Talisman FantasyTalismanStealth.DisplayName: Talisman FeatherKnifeProjectile.DisplayName: Feather Knife @@ -141,7 +135,6 @@ GrimreaverBat.DisplayName: Grim Bat GrimreaverSkull.DisplayName: Grim Skull HeavenfallenEnergy.DisplayName: Heavenfallen Energy HeavenfallenStardiskBoomerang.DisplayName: Heavenfallen Stardisk -HellsSunProj.DisplayName: Hell's Sun Honeycomb.DisplayName: Honeycomb HoneycombFragment.DisplayName: Honeycomb Fragment HypothermiaChunk.DisplayName: Ice Chunk @@ -155,8 +148,6 @@ InfernalKrisProjectile.DisplayName: Infernal Kris InfestedClawmerangProj.DisplayName: Shroomerang InkBombProjectile.DisplayName: Ink Bomb InkCloud.DisplayName: Ink Cloud -InkCloud2.DisplayName: Ink Cloud -InkCloud3.DisplayName: Ink Cloud IronFranciscaProj.DisplayName: Iron Francisca JawsProjectile.DisplayName: Reaper Tooth JawsShockwave.DisplayName: Reaper Tooth Shockwave @@ -183,10 +174,8 @@ MangroveChakramProjectile.DisplayName: Mangrove Chakram MetalChunk.DisplayName: Metal Chunk MetalShard.DisplayName: Metal Shard MeteorFistProj.DisplayName: Meteor Fist Gud For A Lot Of Shtuff -MeteorFistStealth.DisplayName: Meteor Fist Gud For A Lot Of Shtuff +MeteorFistMeteorite.DisplayName: Meteorite REALLY Gud For A Lot Of Shtuff MoltenAmputatorProj.DisplayName: Molten Amputator -MoltenBlobThrown.DisplayName: Molten Blob -MonkeyDart.DisplayName: Monkey Dart MoonSigil.DisplayName: Moon Sigil MycorootProj.DisplayName: Mycoroot MythrilKnifeProjectile.DisplayName: Mythril Knife @@ -199,8 +188,6 @@ NiceCock.DisplayName: Kitchen Fire NightsGazeProjectile.DisplayName: Night's Gaze NightsGazeSpark.DisplayName: Night's Gaze Spark NightsGazeStar.DisplayName: Night's Gaze Star -NychthemeronOrb.DisplayName: Nychthemeron Orb -NychthemeronProjectile.DisplayName: Nychthemeron OrichalcumSpikedGemstoneProjectile.DisplayName: Orichalcum Gemstone PalladiumJavelinProjectile.DisplayName: Palladium Javelin PanSpark.DisplayName: Pan Spark @@ -213,7 +200,6 @@ PhantasmalSoulBlue.DisplayName: Blue Spirit PlaguedFuelPackCloud.DisplayName: Plagued Cloud PlaguenadeBee.DisplayName: Plague Bee PlaguenadeProj.DisplayName: Plaguenade -PoisonBol.DisplayName: Poison Ball Prismalline2.DisplayName: Prismalline Prismalline3.DisplayName: Prismalline PrismallineProj.DisplayName: Prismalline @@ -228,6 +214,8 @@ RealityRuptureLance.DisplayName: Lance of Reality RealityRuptureMini.DisplayName: Reality Shard RealityRuptureStealth.DisplayName: Ruptured Reality ReaperProjectile.DisplayName: The Old Reaper +ReboundingRainbowProj.DisplayName: Rebounding Rainbow +ReboundingRainbowSplit.DisplayName: Rebounding Rainbow RefractionRotorProjectile.DisplayName: Prism Shuriken RegulusEnergy.DisplayName: Regulus Energy RegulusRiotProj.DisplayName: Regulus Riot @@ -237,7 +225,6 @@ SamsaraSlicerProjectile.DisplayName: Samsara Slicer SamsaraSlicerSmallDisk.DisplayName: Samsara Slicer SandDollarProj.DisplayName: Sand Dollar SandDollarStealth.DisplayName: Sand Dollar -SandslasherProj.DisplayName: Sandslasher ScarletBlast.DisplayName: Scarlet Blast ScarletDevilBullet.DisplayName: Gungnir Bullet ScarletDevilProjectile.DisplayName: Spear the Gungnir @@ -255,13 +242,13 @@ SeraphimAngelicLight2.DisplayName: Light Orb SeraphimBeamLarge.DisplayName: Holy Beam SeraphimDagger.DisplayName: Seraphim SeraphimProjectile.DisplayName: Seraphim -ShatteredExplosion.DisplayName: Shattered Sun Blast -ShatteredSunKnife.DisplayName: Shattered Sun -ShatteredSunScorchedBlade.DisplayName: Scorched Blade +ShatteredExplosion.DisplayName: Shattered Dawn Blast +ShatteredDawnKnife.DisplayName: Shattered Dawn +ShatteredDawnScorchedBlade.DisplayName: Scorched Blade ShinobiBladeProjectile.DisplayName: Shinobi Blade -ShockGrenadeBolt.DisplayName: Shock Grenade Bolt -ShockGrenadeExplosion.DisplayName: Shock Grenade Explosion -ShockGrenadeProjectile.DisplayName: Shock Grenade +ShockBolt.DisplayName: Shock Bolt +ShockExplosion.DisplayName: Shock Explosion +DoomsdayDeviceProjectile.DisplayName: Doomsday Device ShockTeslaAura.DisplayName: Electrifying Aura ShroomerangSpore.DisplayName: Infested Spore SkyBomberGas.DisplayName: Irradiated Cloud @@ -284,7 +271,6 @@ StealthNimbus.DisplayName: Nimbus StealthNimbusCloud.DisplayName: Nimbus StealthRain.DisplayName: Rain StellarKnifeProj.DisplayName: Stellar Knife -StickyBol.DisplayName: Sticky Bol StormfrontLightning.DisplayName: Stormfront Lightning StormfrontRazorProjectile.DisplayName: Stormfront Razor Stormfrontspark.DisplayName: Stormfront Spark @@ -311,12 +297,13 @@ TotalityFire.DisplayName: Totality Fire TotalityFlask.DisplayName: Totality Flask TotalityTar.DisplayName: Totality Tar TotalMeltdown.DisplayName: Explosion -ToxicantTwisterDust.DisplayName: Toxicant Dust -ToxicantTwisterTwoPointZero.DisplayName: Toxicant Twister +ToxicantTwisterDust.DisplayName: Toxicant Raindrop +ToxicantTwisterProj.DisplayName: Toxicant Twister TurbulanceProjectile.DisplayName: Turbulance TurbulanceWindSlash.DisplayName: Wind Slash TwistingThunderProj.DisplayName: Twisting Thunder UmbraphileBoom.DisplayName: Umbra Blast +UrchinIrradiation.DisplayName: Irradiation UrchinStingerProj.DisplayName: Urchin Stinger ValariBoomerang.DisplayName: Frostcrush Valari Valaricicle.DisplayName: Valaricicle @@ -325,7 +312,16 @@ ValedictionBoomerang.DisplayName: Valediction VeneratedKnife.DisplayName: Venerated Knife WaveSkipperProjectile.DisplayName: Wave Skipper WebBallBol.DisplayName: Web Ball +WhitewaterAura.DisplayName: Whitewater Aura +WhitewaterProj.DisplayName: Whitewater Flask +WhitewaterSpear.DisplayName: Whitewater Spear WrathwingCinder.DisplayName: Wrathwing Eruption WrathwingFireball.DisplayName: Wrathwing Fireball WrathwingSpear.DisplayName: Wrathwing WulfrumKnifeProj.DisplayName: Wulfrum Knife +RadiationBurst.DisplayName: Radiation Burst +RadiationRain.DisplayName: Radiation Rain +RefractionRotorSlashCreator.DisplayName: Refraction Rotor Slash Creator +RefractionSlash.DisplayName: Refraction Slash +SporeKnifeProj.DisplayName: Spore Knife +SporeKnifeBud.DisplayName: Spore Knife Bud diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index 81212f4f23..3be6965766 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -96,8 +96,8 @@ EndoCooperLimbs.DisplayName: Ascened Cooper EndoFire.DisplayName: Endo Fire EndoHydraBody.DisplayName: Hydra Body EndoHydraHead.DisplayName: Hydra Head +EndoHydraRay.DisplayName: Endo Ray EndoIceShard.DisplayName: Endo Ice Shard -EndoRay.DisplayName: Endo Ray EnergyOrb.DisplayName: Energy Orb EXPLODINGFROG.DisplayName: A not frog of the explosive variety EyeOfNightCell.DisplayName: Night Cell @@ -244,6 +244,7 @@ SandTornado.DisplayName: Tornado SarosAura.DisplayName: Saros Aura SarosMicrosun.DisplayName: Saros Microsun SarosSunfire.DisplayName: Saros Sunfire +SeashineSwordProj.DisplayName: Seashine Sword SeekerSummonProj.DisplayName: Soul Seeker SepulcherMinion.DisplayName: Sepulcher Shellfish.DisplayName: Shellfish @@ -330,3 +331,7 @@ WulfrumDroid.DisplayName: Wulfrum Droid WulfrumEnergyBurst.DisplayName: Wulfrum Bolt WulfrumFusionBolt.DisplayName: Fusion Bolt YharonMinionFireball.DisplayName: Dragon Fireball +FlarebatMinion.DisplayName: Flarebat +FrostbatMinion.DisplayName: Frostbat +AmphibiansGuitarMinion.DisplayName: Amphibian's Guitars +AmphibiansGuitarProjectile.DisplayName: Note diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 259341d807..2d7cf3ef7b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -1,13 +1,9 @@ AbaddonCrit.DisplayName: Brimstone Blast AeroExplosive.DisplayName: Aeroboom AllianceTriangle.DisplayName: Alliance Triangle +AmuletEnergy.DisplayName: Sea Spirit ArcZap.DisplayName: Arc Zap -ArtifactOfResilienceShard1.DisplayName: Artifact Shard -ArtifactOfResilienceShard2.DisplayName: Artifact Shard -ArtifactOfResilienceShard3.DisplayName: Artifact Shard -ArtifactOfResilienceShard4.DisplayName: Artifact Shard -ArtifactOfResilienceShard5.DisplayName: Artifact Shard -ArtifactOfResilienceShard6.DisplayName: Artifact Shard +ArtifactOfResilienceShards.DisplayName: Artifact Shard AscendantAura.DisplayName: Ascendant Aura AstralFallingSand.DisplayName: Astral Falling Sand AstralSandBallFalling.DisplayName: Astral Sand @@ -15,7 +11,10 @@ AstralSandBallGun.DisplayName: Astral Sand AstralSpray.DisplayName: Astral Spray AstralStar.DisplayName: Star AuricLandMineExplosion.DisplayName: Auric Land Mine Explosion +BabyCannonballProjectile.DisplayName: Baby Cannonball Projectile +BasicBurst.DisplayName: Nondescript Damaging Explosion BasicPlagueBee.DisplayName: Basic Plague Bee +BlackGlassBandProjectile.DisplayName: Obsidian Strike BlazingStarHeal.DisplayName: Blazing Star Heal BlazingStarThatDoesNotHeal.DisplayName: Blazing Star That Does Not Heal BlazingSun.DisplayName: Blazing Sun @@ -53,9 +52,14 @@ EmpyreanMarble.DisplayName: Empyrean Marble EmpyreanStellarDetritus.DisplayName: Empyrean Stellar Detritus EnergyShell.DisplayName: Energy Shell EutrophicSandBallGun.DisplayName: Eutrophic Sand +ExoTankHoverThrust.DisplayName: Exo Thrust +ExoTankLaser.DisplayName: Mini Exo Pulse Laser +ExoTankMissile.DisplayName: Miracle Missile +ExoTankMuzzleFlash.DisplayName: Mini Exo Flash FeralDoubleBobber.DisplayName: Feral Bobber FlameLickedBarrage.DisplayName: Flame Licked Barrage FlameLickedHellblast.DisplayName: Flame Licked Hellblast +FlashBolt.DisplayName: The Reminder FuckYou.DisplayName: Explosion FungalClumpMinion.DisplayName: Fungal Clump GemTechArmorGem.DisplayName: Trireme's Gem @@ -68,6 +72,7 @@ GreenLabSeeker.DisplayName: Seeking Mechanism HeronBobber.DisplayName: Heron Bobber HideOfAstrumDeusExplosion.DisplayName: Explosion HolyExplosionSupreme.DisplayName: Explosion +HolyStarDamage.DisplayName: Holy Star HydrothermalSmoke.DisplayName: Smoke HydrothermicFlare.DisplayName: Hydrothermic Flare HydrothermicFlareRogue.DisplayName: Hydrothermic Flare @@ -75,9 +80,11 @@ HydrothermicSphere.DisplayName: Hydrothermic Sphere JewelSpike.DisplayName: Spike KelvinCatalystStar.DisplayName: Kelvin Catalyst Star LeviAmberDash.DisplayName: Riptide Slam -LunicBeam.DisplayName: Beam -MageHammerBoom.DisplayName: Explosion -MagnusBeam.DisplayName: Beam +LunicBeam.DisplayName: Lunic Seeker +Luxor.DisplayName: Luxor +LuxorsGiftClassless.DisplayName: Luxor's Classless +MagnusBeam.DisplayName: Magnus Seeker +MagnusBoom.DisplayName: Nebula Blast MythrilFlare.DisplayName: Mythril Flare NanoFlare.DisplayName: Nano Flare Nanotech.DisplayName: Nanoblade @@ -89,24 +96,26 @@ OmegaBlueTentacle.DisplayName: Omega Blue Tentacle OnyxLabSeeker.DisplayName: Seeking Mechanism PauldronDash.DisplayName: Pauldron Dash PauldronExplosion.DisplayName: Pauldron Explosion -PendantProjectile1.DisplayName: Prism Shard -PendantProjectile2.DisplayName: Prism Shard -PendantProjectile3.DisplayName: Prism Shard +PearlAuraShard.DisplayName: Prism Shard PlaguePulse.DisplayName: Plague Pulse PoisonousSeawater.DisplayName: Seawater PscTransformAnimation.DisplayName: Psc Transform Animation PscTransformRocks.DisplayName: Psc Transform Rocks +PuddleSplash.DisplayName: Puddle Splash ReaverOrb.DisplayName: Reaver Orb ReaverThornBase.DisplayName: Thorn RedLabSeeker.DisplayName: Seeking Mechanism +RelicGuard.DisplayName: Relic Guard +RetaliationProjectile.DisplayName: Retaliation Shard RiftReelerBobber.DisplayName: Chaotic Bobber SandCloakVeil.DisplayName: Dust Veil SandExplosion.DisplayName: Sand Seashell.DisplayName: Seashell SepulcherSoul.DisplayName: Tormented Soul SerpentsBiteHook.DisplayName: Serpent's Bite -ShadowflameExplosion.DisplayName: Shadowflame Explosion -ShadowflameExplosionBig.DisplayName: Shadowflame Explosion +ShadeNimbus.DisplayName: Shade Nimbus +ShadeNimbusRain.DisplayName: Shade Rain +ShadeNimbusSpawner.DisplayName: Dank Creeper SkyFlareFriendly.DisplayName: Flare SlimeStream.DisplayName: Slime Stream SlurperBobber.DisplayName: Slurper Bobber @@ -120,10 +129,16 @@ SulphuricAcidBubbleFriendly.DisplayName: Acid Bubble SulphurousSandBallGun.DisplayName: Sulphurous Sand TarraEnergy.DisplayName: Tarra Energy TarragonAura.DisplayName: Tarragon Aura +TatteredFairyDust.DisplayName: Tattered Fairy Dust TeslaAura.DisplayName: Tesla's Electricity TitanHeartBoom.DisplayName: Titan Heart Boom +TransformerAura.DisplayName: Transformer Aura +TransformerBlob.DisplayName: Transformer Shard +UrsaSlash.DisplayName: Ursa Slash VerstaltiteBobber.DisplayName: Verstaltite Bobber VoidFieldGenerator.DisplayName: Void Field Generator +WarbannerDamage.DisplayName: The Unmatched Power of the Sun +WarbannerLight.DisplayName: Warbanner Light WaterConvertor.DisplayName: Water Convertor WhiteLabSeeker.DisplayName: Seeking Mechanism WulfrumBobber.DisplayName: Wulfrum Bobber @@ -132,4 +147,5 @@ WulfrumHook.DisplayName: Wulfrum Slingshot WulfrumLureSignal.DisplayName: Signal YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism -UrsaSlash.DisplayName: Ursa Slash +VoidofExtinctionCrit.DisplayName: Void of Extinction Crit +XykDeathAnim.DisplayName: Xyk Death Animation diff --git a/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson index 735a20c834..05300a04a6 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson @@ -5,6 +5,7 @@ CryogenBossText: Cryogen is derping out! PyrogenBossText: Pyrogen is derping out! // Triplets TripletsBossText: The Triplets have awoken! +TripletsDefeatName: The Triplets // Calamitas Clone CalamitasBossText: You underestimate my power... CalamitasBossText2: Rise again, my siblings. diff --git a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index 040a177b97..472bb07020 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -3,7 +3,6 @@ AbyssDrown2: Oxygen failed to reach {0} from the depths of the Abyss. AbyssDrown3: "{0} faded away, lost in the dark waters." AlcoholBig1: "{0} downed too many shots." AlcoholBig2: "{0}'s liver failed." -AlcoholSmall: "{0} succumbed to alcohol sickness." Armageddon: "{0} failed the challenge at hand." AstralInfection1: "{0}'s infection spread too far." AstralInfection2: "{0}'s skin was replaced by the astral virus." @@ -49,10 +48,13 @@ ChaliceOfTheBloodGodUnequip: "{0} violated their pact with the Blood God." ChibiiDoggo: "{0} couldn't stand the sharp objects." CirrusSlap1: "{0} was slapped too hard." CirrusSlap2: "{0} forked around and found out." -CorpusAvertor: "{0} became the blood god's sacrifice." +CorpusAvertor: "{0} became the Blood God's sacrifice." CrushDepth1: "{0} was crushed by the pressure." CrushDepth2: "{0}'s lungs collapsed." CrushDepth3: "{0}'s bones crunched under the deep pressure." +HadopelagicPressure1: "{0} was crushed in the lightless void." +HadopelagicPressure2: "{0} was reduced to a smear of waterlogged paste." +HadopelagicPressure3: "{0} suffered a critical pressurization event." Daybroken: "{0} was incinerated by solar rays." Dragonfire1: "{0}'s ashes scatter in the wind." Dragonfire2: "{0}'s embers fade away in a warm glow." @@ -65,13 +67,16 @@ GodSlayerInferno1: "{0} imploded into nothingness." GodSlayerInferno2: "{0}'s body slipped into oblivion." GodSlayerInferno3: "{0} ceased being a part of our universe." Goldfish: "{0} was once again impaled by Goldfish." +HeavyBleeding1: "{0} expired from heavy internal bleeding." +HeavyBleeding2: "{0} forgot that blood is supposed to stay inside the body." +HeavyBleeding3: "{0} bled profusely to their last breath." HolyFlames1: "{0} fell prey to their sins." HolyFlames2: "{0} burst into sinless ash." HolyFlames3: "{0} was purified by the profaned flame." HolyInferno: "{0} was incinerated by the profaned backdraft." -Laceration1: "{0} expired from heavy internal bleeding." +Laceration1: "{0} was indecently smeared all over the walls." Laceration2: "{0} was turned into a fine red mist." -Laceration3: "{0} forgot that blood is supposed to stay inside the body." +Laceration3: "{0} was pulped, ribbons and rivulets of spent life spattering freely." ManaBurn: "{0}'s life was completely converted into mana." ManaConversionEnchant: "{0}'s life was fully tapped by dark magics." MiracleBlight1: "{0} was blown away by miraculous technological advancements." @@ -85,6 +90,7 @@ Plague2: "{0} couldn't vaccinate against the plague." Plague3: "{0} was reduced to nutrient rich sludge." ProfanedSoulCrystal: "{0} was summoned too soon." ProvidenceAntiHealing: "{0} was purged of their unworthy existence." +Rebecca: "{0} was once again exploded by CIT." Riptide1: "{0} was swept away by the tides." Riptide2: "{0} was ripped apart by the current." SearingLava1: "{0}'s soul was released by the lava." diff --git a/Localization/en-US/Mods.CalamityMod.Tiles.hjson b/Localization/en-US/Mods.CalamityMod.Tiles.hjson index b0ecb2d5e2..32316202fc 100644 --- a/Localization/en-US/Mods.CalamityMod.Tiles.hjson +++ b/Localization/en-US/Mods.CalamityMod.Tiles.hjson @@ -48,13 +48,13 @@ UelibloomOre.MapEntry: Uelibloom ArenaTile.MapEntry: Arena AshenChest: { - MapEntry0: "{$Mods.CalamityMod.Items.Placeables.AshenChest.DisplayName}" - MapEntry1: Locked {$Mods.CalamityMod.Items.Placeables.AshenChest.DisplayName} + MapEntry0: "{$Items.Placeables.AshenChest.DisplayName}" + MapEntry1: Locked {$Items.Placeables.AshenChest.DisplayName} } AstralChestLocked: { - MapEntry0: "{$Mods.CalamityMod.Items.Placeables.AstralChest.DisplayName}" - MapEntry1: Locked {$Mods.CalamityMod.Items.Placeables.AstralChest.DisplayName} + MapEntry0: "{$Items.Placeables.AstralChest.DisplayName}" + MapEntry1: Locked {$Items.Placeables.AstralChest.DisplayName} } PlaguedPlateBed.MapEntry: "'Bed'" diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index b52c15e978..dc46a26af4 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -1,4 +1,6 @@ +// Vanilla UI edits SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" +WorldMaster: Game over man, game over! (Brutally hard boss changes, for the truly brave) // Main UI Elements Adrenaline: Adrenaline Nanomachines: Nanomachines @@ -34,7 +36,7 @@ Revengeance: Revengeance RevMaster: Rev+Master RevLegend: Rev+Legend RevengeanceEnabled: Revengeance Mode is enabled -RevengeanceShortInfo: "[c/F54254:The intended Calamity experience!]" +RevengeanceShortInfo: "[c/F54254:The intended Calamity experience! Can only be enabled in Expert Mode!]" RevengeanceExpandedInfo: ''' [c/B55362:Enables the] [c/85FFE9:Adrenaline] [c/B55362:mechanic. You gain Adrenaline while fighting bosses. Getting hit drops Adrenaline back to 0] @@ -51,7 +53,7 @@ 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]" +DeathShortInfo: "[c/C82DF7:A far more difficult challenge than Revengeance Mode! Can only be enabled in Master Mode!]" DeathExpandedInfo: ''' [c/B834E0:All foes will pose a much larger threat with highly aggressive AIs and increased damage] @@ -86,17 +88,20 @@ Cooldowns: { BloodflareRangedSet: Bloodflare Soul Cooldown BrimflameFrenzy: Brimflame Frenzy Cooldown ChaosState: Teleportation Cooldown - CounterScarf: Scarf Cooldown DivineBless: Divine Bless Cooldown DivingPlatesBreaking: Abyssal Diving Suit Plates Durability DivingPlatesBroken: Abyssal Diving Suit Broken Plates + DSOCritCooldown: Extra Critical Strike Chance ParryCooldown: Parry Ability Cooldown - EvasionScarf: Scarf Cooldown FleshTotem: Contact Damage Halving Cooldown GaelsRage: Gael's Greatsword Rage Cooldown GlobalDodge: Dodge Cooldown GodSlayerDash: God Slayer Dash Cooldown + HellbornShots: Hellborn Shots + HolyProtection: Holy Protection InkBomb: Ink Bomb Cooldown + KillModeActive: Kill Mode Active + KillModeCooldown: Kill Mode Cooldown LifeSteal: Life Steal Cooldown LionHeartShield: Energy Shell Cooldown MasterChefShieldDurability: MJOLNIR Shield Level @@ -111,11 +116,12 @@ Cooldowns: { PrismaticLaser: Prismatic Laser Barrage Cooldown ProfanedSoulShieldDurability: Profaned Soul Shield Durability ProfanedSoulShieldRecharge: Profaned Soul Shield Recharge - RelicOfResilience: Relic of Resilience Cooldown + RelicOfResilienceCooldown: Relic of Resilience Cooldown RogueBooster: Rogue Booster Cooldown SandCloak: Sand Cloak Cooldown SandsmokeBombActive: Sandsmoke Bomb Duration SandsmokeBombCooldown: Sandsmoke Bomb Cooldown + ScarfCooldown: Scarf Cooldown SilvaRevive: Silva Revive Cooldown SpeedBlasterBoost: Speed Blaster Boost SpongeDurability: Sponge Barrier Durability @@ -124,6 +130,7 @@ Cooldowns: { TarragonCloak: Tarragon Cloak Cooldown TarragonImmunity: Tarragon Immunity Cooldown UniverseSplitter: Universe Splitter Cooldown + WarbanneroftheRighteousBuff: Warbanner Strength WulfrumBastionActive: Power Armor Durability WulfrumBastionCooldown: Wulfrum Bastion Cooldown WulfrumRoverDriveDurability: Protective Matrix Durability @@ -616,6 +623,7 @@ DraedonFacility: Other minor research projects Abyss: Disposing of Silva's remains SulphurSea2: Irradiating one of the oceans Roxcalibur: I wanna rock +AuricLandMines: Setting god killing traps // Hold Shift tooltip default HoldShiftTooltipExtensionIndicator: Hold "Left Shift" for more HoldShiftTooltipReplacementIndicator: Hold "Left Shift" for details diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index 3e221f5442..718270c4af 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -37,10 +37,21 @@ SetBonus: { ''' Eskimo: ''' - Multiplies all cold-based debuff damage by 1.25 + Multiplies all cold-based debuff damage by 1.25x Cold enemies will deal reduced contact damage to the player Provides immunity to the Chilled, Frozen, Frostburn and Glacial State debuffs ''' + Rain: + ''' + 24% increased jump speed and allows auto-jump + Jumping creates a puddle splash that damages and knocks back enemies + This splash is stronger if it is raining + ''' + Forbidden: + ''' + {$LegacyTooltip.48} {$ArmorSetBonus.Forbidden} + Minions no longer deal less damage while wielding magic weapons + ''' Frost: ''' Melee and ranged attacks inflict Frostbite @@ -55,8 +66,8 @@ SetBonus: { ''' Gold: ''' - 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% + All enemies have a 2% chance to drop 1 gold; bosses killed drop 3 gold + You gain 1% critical strike chance for every 10 gold in your inventory, capped at 7% ''' Iron: ''' @@ -80,8 +91,14 @@ SetBonus: { ''' MonkTier2: ''' - 10% increased melee speed, crit, and damage - 15% increased minion damage + 10% increased rogue damage and critical strike chance + 15% increased summon damage + +90 maximum stealth + ''' + MonkTier3: + ''' + 10% increased rogue damage and 20% increased summon damage + +100 maximum stealth ''' Mythril: ''' @@ -101,8 +118,7 @@ SetBonus: { ''' Obsidian: ''' - Increases whip range by 50% and speed by 35% - Increases minion damage by 15% + {$ArmorSetBonus.ObsidianOutlaw} Grants immunity to fire blocks and temporary immunity to lava ''' Palladium: @@ -113,9 +129,9 @@ SetBonus: { PlatinumChainmail: 3% increased critical strike chance Platinum: ''' - Every 10 extra defense gives you 1% increased damage and 1% increased critical strike chance + Every 10 extra defense gives you 1% increased damage 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 + Bonus damage caps at 50 extra defense ''' Silver: ''' @@ -137,26 +153,22 @@ SetBonus: { ''' Allows the ability to dash 10% increased damage and critical strike chance + +90 maximum stealth ''' SquireTier2: ''' - Increases your life regeneration - 15% increased minion damage and 10% increased melee critical strike chance - ''' - HuntressTier2: 10% increased minion and ranged damage - ApprenticeTier2: 5% increased minion damage and 15% increased magic critical strike chance - MonkTier3: - ''' - 10% increased melee damage, melee critical strike chance and melee speed - 30% increased minion damage + Grants +1.5 HP/s life regen + 15% increased summon damage and 10% increased melee critical strike chance ''' + HuntressTier2: 10% increased summon and ranged damage + ApprenticeTier2: 10% increased summon damage and magic critical strike chance SquireTier3: ''' - Massively increased life regeneration - 10% increased minion damage and melee critical strike chance + Grants +3 HP/s life regen + 10% increased summon damage and 15% increased melee critical strike chance ''' - HuntressTier3: 10% increased minion and ranged damage - ApprenticeTier3: 10% increased minion damage and 15% increased magic critical strike chance + HuntressTier3: 10% increased summon and ranged damage + ApprenticeTier3: 15% increased summon damage and magic critical strike chance SpectreHealing: ''' Converts magic damage to healing force diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson index 8b13789179..9edc92b12c 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson @@ -1 +1,19 @@ - +BatWings: Improved vision +BeeWings: Permanently gives the Honey buff +BoneWings: Halves flight time when taking a hit +ButterflyWings: Increases mana regeneration rate +FestiveWings: Homing ornaments rain down as you fly +FinWings: + ''' + Gills effect and you can move freely through liquids + You fall faster while submerged in liquid + ''' +FlameWings: Multiplies all heat debuff damage by 1.25x +FrozenWings: Multiplies all cold debuff damage by 1.25x +HarpyWings: 10% increased movement speed +LeafWings: +10 defense and permanent Dryad's Blessing +TatteredFairyWings: You leave a trail of fairy dust as you fly +WingsNebula: Increases the pickup range of Nebula armor's nebula boosters +WingsSolar: Allows Solar Flare armor's dash to be used without any charges +WingsStardust: Greatly increases Stardust armor's stardust guardian damage and attack range +WingsVortex: Vortex armor's stealth ability is automatically reactivated 1 second after dashing diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 4373a9e37f..198423a825 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -1,3 +1,281 @@ +DodgeInfo: + ''' + Grants the ability to dodge attacks + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between {0} and {1} seconds depending on the dodged attack's damage + The cooldown is shared with all other dodges and reflects + ''' + +AddedTooltip: { + TruffleWorm: + ''' + Summons Duke Fishron if used as bait in the Ocean + Enrages outside the Ocean + ''' + SlimeGun: Slimed enemies take more damage from fire-based debuffs + FleshKnucklesLine: Max life increased by 45 + RodofDiscord: Teleportation is disabled while Chaos State is active + Pwnhammer: + ''' + Demon Altars now drop Souls of Night instead of generating ores when destroyed + Hardmode ores now generate after defeating Mechanical Bosses for the first time + ''' + // Life Drain + SoulDrain: + ''' + This grants +1.5 HP/s life regen and accelerates natural life regen + Life drain stacks based on the number of enemies being hit + ''' + WarmthPotion: Greatly reduces the duration of Chilled, Frozen, and Glacial State + HandWarmer: Provides a regeneration boost while wearing the Snow armor + GoldenFishingRod: Its fishing line will never break + Tombstones: + ''' + 13 of any tombstone turns the surrounding area into a graveyard + Graveyards have various new item sales and recipes + ''' + DeathSickle: Inflicts Whispering Death on hit + HellfireTreads: + ''' + Multiplies all fire-based debuff damage by 1.5x, does not stack with downgrades + All attacks inflict Hellfire + ''' + FairyBoots: + ''' + Fairies can spawn at any time on the surface and spawn far more frequently + Nearby fairies grant +2 HP/s life regen, 10 defense and 10% movement speed + Fairies are immune to damage and will no longer flee + ''' + MoonStone: Reduces the damage of the Nightwither debuff + SunStone: Reduces the damage of the Daybroken debuff + CelestialStone: Reduces the damage of the Nightwither and Daybroken debuffs + ArcaneFlower: 5% increased magic damage + RifleScope: The scope effect can be toggled with visibility + FeatherfallPotion: Disables all airborne flight recovery + TitanGloveLine: 10% increased true melee damage + YoyoGlove: Secondary yoyos will do 50% less damage + DefensePrefix: +{0}% damage reduction + LuckyPrefix: +0.05 luck + /* + Armor + */ + CopperHelmet: 5% increased damage + CopperChainmail: 3% increased critical strike chance + CopperGreaves: 5% increased movement speed + TinHelmet: 3% increased critical strike chance + TinChainmail: +0.5 HP/s life regen + TinGreaves: 5% increased movement speed + IronPieces: Increases damage reduction by 3% + LeadPieces: Increases damage reduction by 2% + SilverHelmet: 5% increased critical strike chance + SilverChainmail: +1 HP/s life regen + SilverGreaves: 8% increased movement speed + TungstenHelmet: 7% increased damage + TungstenChainmail: +0.5 HP/s life regen + TungstenGreaves: 8% increased movement speed + GoldHelmet: 5% increased damage + GoldChainmail: Increases damage reduction by 5% + GoldGreaves: 10% increased movement speed + PlatinumHelmet: 6% increased damage + PlatinumChainmail: 3% increased critical strike chance + PlatinumGreaves: 10% increased movement speed + CrimsonBreastplate: +1 HP/s life regen + CrimsonOtherPieces: +0.5 HP/s life regen + Picksaw: Can mine Scoria Ore located in the Abyss +} + +EditedTooltip: { + /* + Boss Summons + */ + Abeemination: + ''' + Summons the Queen Bee when used in the Jungle + Enrages outside the Underground Jungle + ''' + BloodySpine: + ''' + Summons the Brain of Cthulhu when used in the Crimson + Enrages outside the Underground Crimson + ''' + ClothierVoodooDoll: + ''' + While equipped, summons Skeletron when the Clothier is killed during nighttime + Enrages during the day + 'You are a terrible person' + ''' + DeerThing: Summons Deerclops when used in the Snow or Ice biome + GuideVoodooDoll: + ''' + Summons the Wall of Flesh if thrown into lava in the underworld while the Guide is alive + 'You are a terrible person' + ''' + LihzahrdPowerCell: + ''' + Summons the Golem when used at the Lihzahrd Altar + Enrages outside the Jungle Temple + ''' + MechanicalEye: + ''' + Summons The Twins when used during nighttime + Enrages during the day + ''' + MechanicalSkull: + ''' + Summons Skeletron Prime when used during nighttime + Enrages during the day + ''' + MechanicalWorm: + ''' + Summons The Destroyer when used during nighttime + Enrages during the day + ''' + QueenSlimeCrystal: Summons Queen Slime when used in the Hallow + SuspiciousLookingEye: + ''' + Summons the Eye of Cthulhu when used during nighttime + Enrages during the day + ''' + WormFood: + ''' + Summons the Eater of Worlds when used in the Corruption + Enrages outside the Underground Corruption + ''' + MasterExclusive: Master or Revengeance + // Sparkle Slime Balloon + GelBalloon: + ''' + Throws a mixture of slime and sparkling crystals + Slimed enemies take more damage from fire-based debuffs + ''' + AnkhShield1: Grants immunity to knockback + AnkhShield2: Grants immunity to most debuffs, including Mighty Wind + Campfires: Life regen is increased by 0.5 HP/s when near a campfire + HeartLantern: Grants +1 HP/s life regeneration when placed nearby + BottledHoney: + ''' + Grants +1 HP/s life regen for a short time + Grants an additional +1 HP/s life regen while inflicted with a damaging debuff + ''' + ShinyStone: Grants +2 HP/s life regen and accelerates natural life regen when not moving + BandofRegeneration: Grants +1 HP/s life regeneration + CharmofMyths: Grants +1 HP/s life regeneration and reduces the cooldown of healing potions by 25% + RegenerationPotion: Provides +2 HP/s life regeneration + HamBat: Defeating enemies temporarily grants +3 HP/s life regen + // Arcane Crystal + AegisCrystal: Permanently boosts natural life regeneration + ArcheryPotion: 20% increased arrow speed and 5% increased arrow damage + IronskinPotion: Increase defense by {0} + // Aerial Bane + DD2BetsyBow: Shoots a tight spread of 6 splitting arrows + AleSake: + ''' + Increases melee damage by 10% and reduces defense by 5% + Counts as an alcohol for Alcohol Poisoning + {$Common.AlcoholWarning} + ''' + FlameWakerBoots: + ''' + Multiplies all fire-based debuff damage by 1.25x + All attacks light enemies on fire + 'Never get cold feet again' + ''' + SunMoonStones: critical strike chance, life regeneration, + CelestialStoneShell: Minor increase to damage, + MagnetFlower: 10% reduced mana cost + ArcaneFlowerManaCloak: 12% reduced mana cost + Magiluminescence: + ''' + Increases movement acceleration and deceleration by 1.75x + Increases movement speed by 1.15x. This bonus applies to running boot accessories + ''' + FrogLeg: Increases jump speed by {0}% and allows auto-jump + // Soaring Insignia + EmpressFlightBooster1: Increases wing flight time by 33% + EmpressFlightBooster2: Increases movement and jump speed by 10% and acceleration by 1.25x + RifleScope1: Increase view range for guns (Right click to zoom out) + RifleScope2: The scope effect can be toggled with visibility + SniperScope: 7% increased ranged damage and critical strike chance + MagicQuiver: Increases arrow damage by 5% and greatly increases arrow speed + MoltenQuiver1: Increases arrow damage by 7% and greatly increases arrow speed + MoltenQuiver2: Lights wooden arrows ablaze and all arrows inflict Hellfire + MagicPowerPotion: 10% increased magic damage + MagicHat: 6% increased magic critical strike chance + PowerGlove: 10% increased melee speed, does not stack with downgrades + BerserkerGlove: 10% increased true melee damage + MechanicalGlove: + ''' + 12% increased melee damage + 12% increased melee speed, does not stack with downgrades + ''' + FireGauntlet1: Increases melee knockback and melee attacks inflict Hellfire + FireGauntlet2: + ''' + 14% increased melee damage + 14% increased melee speed, does not stack with downgrades + ''' + ObsidianSkullLine: Grants immunity to the Burning and On Fire! debuffs + LavaWaders: Grants immunity to the Burning and On Fire! debuffs, and 7 seconds of immunity to lava + Gi: 10% increased movement and jump speed + GoldPickaxe: Can mine Demonite, Crimtane, Meteorite, Sea Prisms, and Sea Prism Crystals + FlaskofCursedFlames: Melee, Whip, and Rogue attacks inflict enemies with cursed flames + FlaskofFire: Melee, Whip, and Rogue attacks set enemies on fire + FlaskofGold: Melee, Whip, and Rogue attacks make enemies drop more gold + FlaskofIchor: Melee, Whip, and Rogue attacks decrease enemies defense + FlaskofNanites: Melee, Whip, and Rogue attacks confuse enemies + FlaskofParty: All attacks cause confetti to appear + FlaskofPoison: Melee, Whip, and Rogue attacks poison enemies + FlaskofVenom: Melee, Whip, and Rogue attacks inflict Acid Venom on enemies + SolarFlarePieces: Grants +1 HP/s life regeneration + /* + OOA sets + */ + SquireGreatHelm: Increases your max number of sentries by 1 and grants +0.5 HP/s life regen + SquirePlating: 5% increased summon damage and 15% increased melee damage + SquireGreaves: + ''' + 5% increased summon damage and melee critical strike chance + 15% increased movement speed + ''' + MonkBrows: Increases your max number of sentries by 1 and increases rogue velocity by 10% + MonkShirt: 5% increased summon and rogue damage + MonkPants1: 5% increased summon damage and rogue critical strike chance + MonkPants2: 20% increased movement speed + // Valhalla Knight + SquireAltHead: Increases your max number of sentries by 2 and increases summon and melee damage by 15% + SquireAltShirt: 15% increased summon damage and grants +1 HP/s life regen + SquireAltPants: 10% increased summon damage + HuntressJerkin: + ''' + 10% increased summon damage and 5% increased ranged damage and critical strike chance + 10% chance to not consume ammo + ''' + HuntressPants: 5% increased summon damage and 20% increased movement speed + ApprenticeHat: Increases your max number of sentries by 1, 5% increased magic damage and 10% reduced mana cost + ApprenticeRobe: 10% increased summon and magic damage + ApprenticeTrousers: + ''' + 5% increased summon damage and magic critical strike chance + 20% increased movement speed + ''' + // Shinobi Infiltrator + MonkAltHead: + ''' + Increases your max number of sentries by 2 + 10% increased summon and rogue damage + ''' + MonkAltShirt0: 10% increased summon damage and 15% increased rogue velocity + MonkAltShirt1: 5% increased rogue critical strike chance + MonkAltPants: 10% increased summon damage and rogue critical strike chance + // Red Riding + HuntressAltShirt: 10% increased summon and ranged damage and 20% chance to not consume ammo + HuntressAltPants: 20% increased summon damage and 5% increased ranged critical strike chance + // Dark Artist + ApprenticeAltHead: 10% increased summon & magic damage + ApprenticeAltShirt: 15% increased summon damage and 10% increased magic damage + ApprenticeAltPants: 10% increased summon damage +} + // Buff Descriptions BuffDescription: { Banner: You have increased damage and defense against the following: @@ -40,7 +318,10 @@ CyborgChat: { Rain: All these moments will be lost in time. Like tears... in the rain. } -DemolitionistChat.DoGDefeated: God Slayer Dynamite? Boy do I like the sound of that! +DemolitionistChat: { + MentionSkynamite: Tired of blowing your legs off with dynamite? Not my problem, but if you aren't fond of it you could try throwing them into a Sky Mill to see if they fly. + DoGDefeated: God Slayer Dynamite? Boy do I like the sound of that! +} DryadChat: { DarksunEclipse: There's a dark solar energy emanating from the moths that appear during this time. What's up with moths getting stronger as you do too? @@ -79,6 +360,7 @@ HerbTooltips: { } MechanicChat: { + HasPortalGun: Just what is that contraption? It makes my Teleporters look like child's play! MoonLordDefeated: What do you mean your traps aren't making the cut? Don't look at me! Eclipse: Um... should my nightlight be on? AcidRain: Maybe I should've waterproofed my gadgets... They're starting to corrode. @@ -140,7 +422,6 @@ SeedTooltips: { SkeletonMerchantChat.Normal: What'dya buyin'? SteampunkerChat: { - HasPortalGun: Just what is that contraption? It makes my Teleporters look like child's play! MoonLordDefeated: Yep! I'm also considering being a space pirate now. Astral: Some of my machines are starting to go haywire thanks to this Astral Infection. I probably shouldn't have built them here. Hallow: I'm sorry I really don't have any Unicorn proof tech here, you're on your own. @@ -148,8 +429,9 @@ SteampunkerChat: { StylistChat: { Hardmode: Please don't catch space lice. Or {0} lice. Or just lice in general. - DrunkPrincess1: "{0} is always trying to brighten my mood... even if, deep down, I know she's sad..." + DrunkPrincess1: "{0} is always trying to brighten my mood... even though, deep down, I know she's sad..." DrunkPrincess2: Sometimes I catch {0} sneaking up from behind me. + DrunkPrincess3: "{0} has been smiling more often lately, even without alcohol. I think I can thank you for that, at least somewhat." ProfanedSoulCrystal1: They look so cute and yet, I can feel their immense power just by being near them. What are you? ProfanedSoulCrystal2: I hate to break it to you, but you don't have hair to cut or style, hun. ProfanedDonuts: Aww, they're so cute, do they have names? diff --git a/MainMenu/CalamityMainMenu.cs b/MainMenu/CalamityMainMenu.cs index 5e83ed1a39..3d92738200 100644 --- a/MainMenu/CalamityMainMenu.cs +++ b/MainMenu/CalamityMainMenu.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.MainMenu { + // Intentionally masquerades over the previous main menu, which is now the Classic main menu. public class CalamityMainMenu : ModMenu { public class Cinder @@ -39,6 +40,7 @@ namespace CalamityMod.MainMenu internal set; } = new(); + public float remixLogoRotation = 0f; public override string DisplayName => "Calamity Style"; public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/Logo"); @@ -52,7 +54,7 @@ namespace CalamityMod.MainMenu // Before drawing the logo, draw the entire Calamity background. This way, the typical parallax background is skipped entirely. public override bool PreDrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) { - Texture2D texture = ModContent.Request("CalamityMod/MainMenu/MenuBackground").Value; + Texture2D texture = ModContent.Request("CalamityMod/MainMenu/ModernMenuBackground").Value; // Calculate the draw position offset and scale in the event that someone is using a non-16:9 monitor Vector2 drawOffset = Vector2.Zero; @@ -75,14 +77,13 @@ namespace CalamityMod.MainMenu drawOffset.Y -= (texture.Height * scale - Main.screenHeight) * 0.5f; } + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); spriteBatch.Draw(texture, drawOffset, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); static Color selectCinderColor() { - if (Main.rand.NextBool(3)) - return Color.Lerp(Color.DarkGray, Color.LightGray, Main.rand.NextFloat()); - - return Color.Lerp(Color.Red, Color.Yellow, Main.rand.NextFloat(0.9f)); + return Color.Lerp(Color.Lerp(Color.Crimson, Color.PaleVioletRed, 0.3f), Color.Lerp(Color.PaleGoldenrod, Color.LightSalmon, Main.rand.NextFloat()), Main.rand.NextFloat()); } // Randomly add cinders. @@ -135,11 +136,24 @@ namespace CalamityMod.MainMenu Main.time = 27000; Main.dayTime = true; + // Adjust rotation based on secret seeds; only Drunk world and Remix touch this, with GFB leeching off those two + // Standard rotation is none; Drunk world makes it spin out, so it can use the vanilla rotation due to disappearing + // Remix makes it flip upside down, and in GFB it will spin forever + if (WorldGen.remixWorldGen) + { + remixLogoRotation += MathHelper.Pi / 50f; + if (remixLogoRotation >= MathHelper.Pi && !WorldGen.everythingWorldGen) + remixLogoRotation = MathHelper.Pi; + } + else + remixLogoRotation = 0f; + float rotationSecretSeedAdjusted = WorldGen.remixWorldGen ? remixLogoRotation : WorldGen.drunkWorldGen ? logoRotation : 0f; + // Draw the logo using a different spritebatch blending setting so it doesn't have a horrible yellow glow Vector2 drawPos = new Vector2(Main.screenWidth / 2f, 100f); spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); - spriteBatch.Draw(Logo.Value, drawPos, null, drawColor, logoRotation, Logo.Value.Size() * 0.5f, logoScale, SpriteEffects.None, 0f); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Draw(Logo.Value, drawPos, null, drawColor, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); return false; diff --git a/MainMenu/CalamityMainMenu_Classic.cs b/MainMenu/CalamityMainMenu_Classic.cs new file mode 100644 index 0000000000..c887934987 --- /dev/null +++ b/MainMenu/CalamityMainMenu_Classic.cs @@ -0,0 +1,162 @@ +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.ModLoader; + +namespace CalamityMod.MainMenu +{ + public class CalamityMainMenu_Classic : ModMenu + { + public class Cinder + { + public int Time; + public int Lifetime; + public int IdentityIndex; + public float Scale; + public float Depth; + public Color DrawColor; + public Vector2 Velocity; + public Vector2 Center; + + public Cinder(int lifetime, int identity, float depth, Color color, Vector2 startingPosition, Vector2 startingVelocity) + { + Lifetime = lifetime; + IdentityIndex = identity; + Depth = depth; + DrawColor = color; + Center = startingPosition; + Velocity = startingVelocity; + } + } + + public static List Cinders + { + get; + internal set; + } = new(); + + public float remixLogoRotation = 0f; + public override string DisplayName => "Calamity Style - Classic"; + + public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/Logo"); + public override Asset SunTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); + public override Asset MoonTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); + + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("CalamityTitle") ?? MusicID.Title; + + public override ModSurfaceBackgroundStyle MenuBackgroundStyle => ModContent.GetInstance(); + + // Before drawing the logo, draw the entire Calamity background. This way, the typical parallax background is skipped entirely. + public override bool PreDrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) + { + Texture2D texture = ModContent.Request("CalamityMod/MainMenu/ClassicMenuBackground").Value; + + // Calculate the draw position offset and scale in the event that someone is using a non-16:9 monitor + Vector2 drawOffset = Vector2.Zero; + float xScale = (float)Main.screenWidth / texture.Width; + float yScale = (float)Main.screenHeight / texture.Height; + float scale = xScale; + + // if someone's monitor isn't in wacky dimensions, no calculations need to be performed at all + if (xScale != yScale) + { + // If someone's monitor is tall, it needs to be shifted to the left so that it's still centered on screen + // Additionally the Y scale is used so that it still covers the entire screen + if (yScale > xScale) + { + scale = yScale; + drawOffset.X -= (texture.Width * scale - Main.screenWidth) * 0.5f; + } + else + // The opposite is true if someone's monitor is widescreen + drawOffset.Y -= (texture.Height * scale - Main.screenHeight) * 0.5f; + } + + spriteBatch.Draw(texture, drawOffset, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + + static Color selectCinderColor() + { + if (Main.rand.NextBool(3)) + return Color.Lerp(Color.DarkGray, Color.LightGray, Main.rand.NextFloat()); + + return Color.Lerp(Color.Red, Color.Yellow, Main.rand.NextFloat(0.9f)); + } + + // Randomly add cinders. + for (int i = 0; i < 5; i++) + { + if (Main.rand.NextBool(4)) + { + int lifetime = Main.rand.Next(200, 300); + float depth = Main.rand.NextFloat(1.8f, 5f); + Vector2 startingPosition = new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * 1.05f); + Vector2 startingVelocity = -Vector2.UnitY.RotatedBy(Main.rand.NextFloat(-0.9f, 0.9f)) * 4f; + Color cinderColor = selectCinderColor(); + Cinders.Add(new Cinder(lifetime, Cinders.Count, depth, cinderColor, 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 *= MathHelper.Lerp(0.6f, 0.9f, Cinders[i].IdentityIndex % 6f / 6f); + if (Cinders[i].IdentityIndex % 13 == 12) + Cinders[i].Scale *= 2f; + + float flySpeed = MathHelper.Lerp(3.2f, 14f, Cinders[i].IdentityIndex % 21f / 21f); + Vector2 idealVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.44f, 0.44f, (float)Math.Sin(Cinders[i].Time / 16f + Cinders[i].IdentityIndex) * 0.5f + 0.5f)); + idealVelocity = (idealVelocity + Vector2.UnitX).SafeNormalize(Vector2.UnitY) * flySpeed; + + float movementInterpolant = MathHelper.Lerp(0.01f, 0.08f, Utils.GetLerpValue(45f, 145f, Cinders[i].Time, true)); + Cinders[i].Velocity = Vector2.Lerp(Cinders[i].Velocity, idealVelocity, movementInterpolant); + + Cinders[i].Time++; + Cinders[i].Center += Cinders[i].Velocity; + } + + // Clear away all dead cinders. + Cinders.RemoveAll(c => c.Time >= c.Lifetime); + + // Draw cinders. + Texture2D cinderTexture = ModContent.Request("CalamityMod/Skies/CalamitasCinder").Value; + for (int i = 0; i < Cinders.Count; i++) + { + Vector2 drawPosition = Cinders[i].Center; + spriteBatch.Draw(cinderTexture, drawPosition, null, Cinders[i].DrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale, 0, 0f); + } + + // Set the logo draw color to be white and the time to be noon + // This is because there is not a day/night cycle in this menu, and changing colors would look bad + drawColor = Color.White; + Main.time = 27000; + Main.dayTime = true; + + // Adjust rotation based on secret seeds; only Drunk world and Remix touch this, with GFB leeching off those two + // Standard rotation is none; Drunk world makes it spin out, so it can use the vanilla rotation due to disappearing + // Remix makes it flip upside down, and in GFB it will spin forever + if (WorldGen.remixWorldGen) + { + remixLogoRotation += MathHelper.Pi / 50f; + if (remixLogoRotation >= MathHelper.Pi && !WorldGen.everythingWorldGen) + remixLogoRotation = MathHelper.Pi; + } + else + remixLogoRotation = 0f; + float rotationSecretSeedAdjusted = WorldGen.remixWorldGen ? remixLogoRotation : WorldGen.drunkWorldGen ? logoRotation : 0f; + + // Draw the logo using a different spritebatch blending setting so it doesn't have a horrible yellow glow + Vector2 drawPos = new Vector2(Main.screenWidth / 2f, 100f); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Draw(Logo.Value, drawPos, null, drawColor, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + return false; + } + } +} diff --git a/MainMenu/MenuBackground.png b/MainMenu/ClassicMenuBackground.png similarity index 100% rename from MainMenu/MenuBackground.png rename to MainMenu/ClassicMenuBackground.png diff --git a/MainMenu/Logo.png b/MainMenu/Logo.png index 8cf6fe8c08..a4a84ac6ed 100644 Binary files a/MainMenu/Logo.png and b/MainMenu/Logo.png differ diff --git a/MainMenu/ModernMenuBackground.png b/MainMenu/ModernMenuBackground.png new file mode 100644 index 0000000000..08f90deb64 Binary files /dev/null and b/MainMenu/ModernMenuBackground.png differ diff --git a/ModSupport/ExternalMods.cs b/ModSupport/ExternalMods.cs new file mode 100644 index 0000000000..7518e201c1 --- /dev/null +++ b/ModSupport/ExternalMods.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public sealed class ExternalMods : ModSystem + { + // This is Calamity's official music mod, CalamityModMusic. It is now a hard dependency. + internal static Mod musicMod = null; + internal static bool MusicAvailable => musicMod is not null; + + // This is Vanilla Calamity Mod Music, internally named UnCalamityModMusic. + // VCMM is an official music add-on. Unlike the main music mod, it is not a dependency. + internal static Mod vcmm = null; + internal static bool VCMMAvailable => vcmm is not null; + + // Please keep this in alphabetical order so it's easy to read + internal static Mod ancientsAwakened = null; + internal static Mod biomeLava = null; + internal static Mod bossChecklist = null; + internal static Mod coloredDamageTypes = null; + internal static Mod crouchMod = null; + internal static Mod dialogueTweak = null; + internal static Mod fargos = null; + internal static Mod luminance = null; + internal static Mod magicStorage = null; + internal static Mod overhaul = null; + internal static Mod redemption = null; + internal static Mod soa = null; + internal static Mod subworldLibrary = null; + internal static Mod summonersAssociation = null; + internal static Mod thorium = null; + internal static Mod varia = null; + internal static Mod wikithis = null; + + public override void Load() + { + musicMod = null; + ModLoader.TryGetMod("CalamityModMusic", out musicMod); + vcmm = null; + ModLoader.TryGetMod("UnCalamityModMusic", out vcmm); + + ancientsAwakened = null; + ModLoader.TryGetMod("AAMod", out ancientsAwakened); + biomeLava = null; + ModLoader.TryGetMod("BiomeLava", out biomeLava); + 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; + ModLoader.TryGetMod("TerrariaOverhaul", out overhaul); + redemption = null; + ModLoader.TryGetMod("Redemption", out redemption); + soa = null; + ModLoader.TryGetMod("SacredTools", out soa); + subworldLibrary = null; + ModLoader.TryGetMod("SubworldLibrary", out subworldLibrary); + summonersAssociation = null; + ModLoader.TryGetMod("SummonersAssociation", out summonersAssociation); + thorium = null; + ModLoader.TryGetMod("ThoriumMod", out thorium); + varia = null; + ModLoader.TryGetMod("Varia", out varia); + wikithis = null; + ModLoader.TryGetMod("Wikithis", out wikithis); + } + + public override void Unload() + { + musicMod = null; + vcmm = null; + + ancientsAwakened = null; + biomeLava = null; + bossChecklist = null; + coloredDamageTypes = null; + crouchMod = null; + dialogueTweak = null; + fargos = null; + luminance = null; + magicStorage = null; + overhaul = null; + redemption = null; + soa = null; + subworldLibrary = null; + summonersAssociation = null; + thorium = null; + varia = null; + wikithis = null; + } + } +} diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index a5a69d421a..bce9cbdf27 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -7,6 +7,7 @@ using CalamityMod.Items; using CalamityMod.NPCs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.UI.DraedonSummoning; @@ -670,6 +671,24 @@ namespace CalamityMod p.Calamity().externalAbyssLight += add; } + public static void AddBreathLossMult(Player p, float add) + { + if (p != null) + p.Calamity().externalBreathLossMultBoost += add; + } + + public static void AddBreathTick(Player p, float add) + { + if (p != null) + p.Calamity().externalBreathTickBoost += add; + } + + public static void AddFlightTimeMult(Player p, float add) + { + if (p != null) + p.Calamity().externalFlightTimeMultBoost += add; + } + public static void ToggleInfiniteFlight(Player p, bool enabled) { if (p != null) @@ -692,17 +711,18 @@ namespace CalamityMod p.Calamity().WearingPostMLSummonerSet = enabled; } - public static bool MakeColdImmune(Player p) => p is null ? false : (p.Calamity().externalColdImmunity = true); - public static bool MakeHeatImmune(Player p) => p is null ? false : (p.Calamity().externalHeatImmunity = true); + public static bool SetPlayerColdImmune(Player p, bool cold) => p is not null && (p.Calamity().externalColdImmunity = cold); + public static bool SetPlayerHeatImmune(Player p, bool heat) => p is not null && (p.Calamity().externalHeatImmunity = heat); + public static bool SetPlayerDefenseDamageImmune(Player p, bool dd) => p is not null && (p.Calamity().externalDefenseDamageImmunity = dd); #endregion #region NPC Damage Reduction // Sets the damage reduction for an NPC type public static float SetDamageReduction(int npcID, float dr) { - CalamityMod.DRValues.TryGetValue(npcID, out float oldDR); - CalamityMod.DRValues.Remove(npcID); - CalamityMod.DRValues.Add(npcID, dr); + CalamityGlobalNPC.DRValues.TryGetValue(npcID, out float oldDR); + CalamityGlobalNPC.DRValues.Remove(npcID); + CalamityGlobalNPC.DRValues.Add(npcID, dr); return oldDR; } // Sets a specific NPC's damage reduction @@ -895,43 +915,43 @@ namespace CalamityMod #region Amalgam Potion Buff List public static bool SetAmalgamBuffList(int type, bool shouldBeListed) { - if (shouldBeListed && !CalamityLists.amalgamBuffList.Contains(type)) + if (shouldBeListed && !AmalgamBuffList.Includes(type)) { - CalamityLists.amalgamBuffList.Add(type); + AmalgamBuffList.List.Add(type); return true; } else if (!shouldBeListed) { - return CalamityLists.amalgamBuffList.Remove(type); + return AmalgamBuffList.List.Remove(type); } return false; } public static bool SetPersistentBuffList(int type, bool isPersistent) { - if (isPersistent && !CalamityLists.persistentBuffList.Contains(type)) + if (isPersistent && !PersistentBuffList.Includes(type)) { - CalamityLists.persistentBuffList.Add(type); + PersistentBuffList.List.Add(type); return true; } else if (!isPersistent) { - return CalamityLists.persistentBuffList.Remove(type); + return PersistentBuffList.List.Remove(type); } return false; } - public static bool IsOnAmalgamBuffList(int type) => CalamityLists.amalgamBuffList.Contains(type); - public static bool IsOnPersistentBuffList(int type) => CalamityLists.persistentBuffList.Contains(type); + public static bool IsOnAmalgamBuffList(int type) => AmalgamBuffList.Includes(type); + public static bool IsOnPersistentBuffList(int type) => PersistentBuffList.Includes(type); #endregion #region Venerated Locket Bans public static bool AddToVeneratedLocketBanlist(int type) { - if (!CalamityLists.VeneratedLocketBanlist.Contains(type)) + if (!VeneratedLocketBanList.Includes(type)) { - CalamityLists.VeneratedLocketBanlist.Add(type); + VeneratedLocketBanList.List.Add(type); return true; } return false; @@ -941,35 +961,35 @@ namespace CalamityMod #region Summoner Cross Class Nerf Disabling public static bool SetSummonerNerfDisabledByMinion(int type, bool disableNerf) { - if (disableNerf && !CalamityLists.DisabledSummonerNerfMinions.Contains(type)) + if (disableNerf && !DisabledSummonerNerfMinionList.Includes(type)) { - CalamityLists.DisabledSummonerNerfMinions.Add(type); + DisabledSummonerNerfMinionList.List.Add(type); return true; } else if (!disableNerf) { - return CalamityLists.DisabledSummonerNerfMinions.Remove(type); + return DisabledSummonerNerfMinionList.List.Remove(type); } return false; } public static bool SetSummonerNerfDisabledByItem(int type, bool disableNerf) { - if (disableNerf && !CalamityLists.DisabledSummonerNerfItems.Contains(type)) + if (disableNerf && !DisabledSummonerNerfItemList.Includes(type)) { - CalamityLists.DisabledSummonerNerfItems.Add(type); + DisabledSummonerNerfItemList.List.Add(type); return true; } else if (!disableNerf) { - return CalamityLists.DisabledSummonerNerfItems.Remove(type); + return DisabledSummonerNerfItemList.List.Remove(type); } return false; } - public static bool GetSummonerNerfDisabledByMinion(int type) => CalamityLists.DisabledSummonerNerfMinions.Contains(type); - public static bool GetSummonerNerfDisabledByItem(int type) => CalamityLists.DisabledSummonerNerfItems.Contains(type); + public static bool GetSummonerNerfDisabledByMinion(int type) => DisabledSummonerNerfMinionList.Includes(type); + public static bool GetSummonerNerfDisabledByItem(int type) => DisabledSummonerNerfItemList.Includes(type); #endregion #region Debuff Display support @@ -1057,9 +1077,9 @@ namespace CalamityMod //This is to add minions to the hp scaling config public static bool AddToHPScaling(int type) { - if (!CalamityLists.bossHPScaleList.Contains(type)) + if (!BossHPScalingList.List.Contains(type)) { - CalamityLists.bossHPScaleList.Add(type); + BossHPScalingList.List.Add(type); return true; } return false; @@ -1222,7 +1242,6 @@ namespace CalamityMod return null; } - case "GetLight": case "GetLightLevel": case "GetLightStrength": @@ -1252,6 +1271,51 @@ namespace CalamityMod AddAbyssLightStrength(castPlayer(args[1]), light); return null; + case "BreathMult": + case "BreathLossMult": + case "AddBreathMult": + case "AddBreathLossMult": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and breath loss mult change as a float."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify breath loss mult change as a float."); + if (!(args[2] is float breathLossMult)) + return new ArgumentException("ERROR: The second argument to \"AddBreathLossMult\" must be a float."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"AddBreathLossMult\" must be a Player or an int."); + AddBreathLossMult(castPlayer(args[1]), breathLossMult); + return null; + + case "BreathTick": + case "AbyssBreathTick": + case "AddBreathTick": + case "AddAbyssBreathTick": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and Abyss breath tick change as a float."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify Abyss breath tick change as a float."); + if (!(args[2] is float breathTick)) + return new ArgumentException("ERROR: The second argument to \"AddBreathTick\" must be a float."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"AddBreathTick\" must be a Player or an int."); + AddBreathTick(castPlayer(args[1]), breathTick); + return null; + + case "FlightMult": + case "FlightTimeMult": + case "AddFlightMult": + case "AddFlightTimeMult": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and flight mult change as a float."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify flight mult change as a float."); + if (!(args[2] is float flightMult)) + return new ArgumentException("ERROR: The second argument to \"AddFlightMult\" must be a float."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"AddFlightMult\" must be a Player or an int."); + AddFlightTimeMult(castPlayer(args[1]), flightMult); + return null; + case "InfiniteFlight": case "AddInfiniteFlight": case "EnableInfiniteFlight": @@ -1864,6 +1928,18 @@ namespace CalamityMod return new ArgumentException("ERROR: The first argument to \"SetFirePointBlank\" must be an Item or an int."); return SetFirePointBlank(castItem(args[1]), firePointBlank); + + case "GetPointBlankDuration": + case "GetProjectilePointBlank": + case "GetProjectilePointBlankDuration": + { + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Projectile."); + if (!isValidProjectileArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"GetPointBlankDuration\" must be a Projectile."); + return GetPointBlankDuration(castProjectile(args[1])); + } + case "SetPointBlankDuration": case "SetProjectilePointBlank": case "SetProjectilePointBlankDuration": @@ -1881,17 +1957,6 @@ namespace CalamityMod return null; } - case "GetPointBlankDuration": - case "GetProjectilePointBlank": - case "GetProjectilePointBlankDuration": - { - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Projectile."); - if (!isValidProjectileArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"GetPointBlankDuration\" must be a Projectile."); - return GetPointBlankDuration(castProjectile(args[1])); - } - case "NoDodges": case "DodgesDisabled": case "GetDodgesDisabled": @@ -1904,6 +1969,45 @@ namespace CalamityMod return new ArgumentNullException("ERROR: Must specify a bool."); return DisableAllDodges(disableDodges); + case "SetPlayerColdImmune": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and if the player should be immune to Death Mode cold effects as a bool."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify if a player should be immune to Death Mode cold effects as a bool."); + if (!(args[2] is bool)) + return new ArgumentException("ERROR: The second argument to \"SetPlayerColdImmune\" must be a bool."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"SetPlayerColdImmune\" must be a Player or an int."); + bool coldImmune = (bool)args[2]; + SetPlayerColdImmune(castPlayer(args[1]), coldImmune); + return null; + + case "SetPlayerHeatImmune": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and if the player should be immune to Death Mode heat effects as a bool."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify if a player should be immune to Death Mode heat effects as a bool."); + if (!(args[2] is bool)) + return new ArgumentException("ERROR: The second argument to \"SetPlayerHeatImmune\" must be a bool."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"SetPlayerHeatImmune\" must be a Player or an int."); + bool heatImmune = (bool)args[2]; + SetPlayerHeatImmune(castPlayer(args[1]), heatImmune); + return null; + + case "SetPlayerDefenseDamageImmune": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and if the player should be immune to defense damage as a bool."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify if a player should be immune to defense damage as a bool."); + if (!(args[2] is bool)) + return new ArgumentException("ERROR: The second argument to \"SetPlayerDefenseDamageImmune\" must be a bool."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"SetPlayerDefenseDamageImmune\" must be a Player or an int."); + bool defenseDamageImmune = (bool)args[2]; + SetPlayerDefenseDamageImmune(castPlayer(args[1]), defenseDamageImmune); + return null; + case "AcidRainActive": case "IsAcidRainActive": case "GetAcidRainActive": @@ -2180,7 +2284,7 @@ namespace CalamityMod case "GetBossHealthBoost": case "BossHealthMultiplier": case "GetBossHealthMultiplier": - return CalamityConfig.Instance.BossHealthBoost; + return CalamityServerConfig.Instance.BossHealthBoost; case "HasPermanentPowerup": case "GetPermanentPowerup": diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 73ab93575a..e5aaf5bc23 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -21,7 +21,6 @@ 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; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; @@ -119,7 +118,7 @@ namespace CalamityMod public static readonly Func DownedBossRush = () => DownedBossSystem.downedBossRush; } - internal class WeakReferenceSupport + internal class WeakReferenceSupport : ModSystem { public const string CalamityWikiURLOld = "calamitymod.wiki.gg"; public const string CalamityWikiURL = "https://calamitymod.wiki.gg/wiki/{}"; @@ -189,33 +188,80 @@ namespace CalamityMod // { "Xeroc", 26f }, }; - public static void Setup() + public override void PostSetupContent() { + LavaStyleToBiomeLava(); BossChecklistSupport(); 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(); + WikiThisSupport(); } } + #region BiomeLava + private static void LavaStyleToBiomeLava() + { + CalamityMod calamity = GetInstance(); + Mod biomelava = ExternalMods.biomeLava; + if (biomelava == null) + return; + + foreach (ModLavaStyle item in LavaStylesLoader.Content) + { + int type = item.Slot; + ModLavaStyle lavaStyle = LavaStylesLoader.Get(type); + if (lavaStyle != null) + { + Func GetSplashDust = lavaStyle.GetSplashDust; + Func GetDropletGore = lavaStyle.GetDropletGore; + Func ModifyLightFunc = ModifyLight; + Func IsLavaActive = lavaStyle.IsLavaActive; + Func lavafallGlowmask = lavaStyle.LavafallGlowmask; + Func InflictDebuffFunc = InflictDebuff; + Func yes = InflictsOnFire; + + Vector3 ModifyLight(int x, int y, float r, float g, float b) + { + lavaStyle.ModifyLight(x, y, ref r, ref g, ref b); + return new Vector3(r, g, b); + } + + Action InflictDebuff(Player player, NPC npc, int onfireDuration) + { + if (player != null && npc == null) + { + lavaStyle.InflictDebuff(player, onfireDuration); + } + return null; + } + + bool InflictsOnFire() + { + return true; + } + + biomelava.Call("ModLavaStyle", calamity, lavaStyle.Name, lavaStyle.Texture, lavaStyle.BlockTexture, lavaStyle.SlopeTexture, lavaStyle.WaterfallTexture, GetSplashDust, GetDropletGore, ModifyLightFunc, IsLavaActive, lavafallGlowmask, InflictDebuffFunc, yes); + } + } + } + #endregion + #region WikiThis // This is a separate function because it only runs clientside - public static void WikiThisSupport() + private static void WikiThisSupport() { // Wikithis is a clientside mod - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; CalamityMod calamity = GetInstance(); - Mod wiki = calamity.wikithis; + Mod wiki = ExternalMods.wikithis; if (wiki is null) return; @@ -233,8 +279,6 @@ namespace CalamityMod // Items ItemRedirect(ItemType(), "Pineapple (calamity)"); ItemRedirect(ItemType(), "Trash Can (pet)"); - ItemRedirect(ItemType(), "Sandstorm (weapon)"); - ItemRedirect(ItemType(), "Thunderstorm (weapon)"); // Lore items ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); @@ -305,15 +349,15 @@ namespace CalamityMod // Wrapper function to detect if a subworld is in use for Subworld Library. internal static bool InAnySubworld() { - if (CalamityMod.Instance.subworldLibrary is null) + if (ExternalMods.subworldLibrary is null) return false; foreach (Mod mod in ModLoader.Mods) { - if (mod.Name.Equals(CalamityMod.Instance.subworldLibrary.Name)) + if (mod.Name.Equals(ExternalMods.subworldLibrary.Name)) continue; - bool anySubworldForMod = (CalamityMod.Instance.subworldLibrary.Call("AnyActive", mod) as bool?) ?? false; + bool anySubworldForMod = (ExternalMods.subworldLibrary.Call("AnyActive", mod) as bool?) ?? false; if (anySubworldForMod) return true; } @@ -341,8 +385,8 @@ namespace CalamityMod private static void BossChecklistSupport() { - CalamityMod calamity = GetInstance(); - Mod bossChecklist = calamity.bossChecklist; + CalamityMod calamity = CalamityMod.Instance; + Mod bossChecklist = ExternalMods.bossChecklist; if (bossChecklist is null) return; @@ -577,6 +621,7 @@ namespace CalamityMod ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), + ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait }); @@ -1033,7 +1078,6 @@ namespace CalamityMod bossChecklist.Call("SubmitEntrySpawnItems", calamity, new Dictionary() { { "Terraria Plantera", ItemType() }, - { "Terraria Golem", ItemType() }, { "Terraria CultistBoss", ItemType() } }); @@ -1066,7 +1110,7 @@ namespace CalamityMod #region Fargo's Mutant Mod private static void FargosSupport() { - Mod fargos = GetInstance().fargos; + Mod fargos = ExternalMods.fargos; if (fargos is null) return; @@ -1074,8 +1118,8 @@ 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(); - DamageClass rogueDamageClass = ModContent.GetInstance(); + int rogueItem = ItemType(); + DamageClass rogueDamageClass = GetInstance(); Func rogueDamage = () => $"Rogue Damage: {Damage(rogueDamageClass)}%"; Func rogueCrit = () => $"Rogue Critical: {Crit(rogueDamageClass)}%"; fargos.Call("AddStat", rogueItem, rogueDamage); @@ -1096,10 +1140,10 @@ namespace CalamityMod #region Dialogue Tweaks private static void DialogueTweakSupport() { - Mod dialogueMod = GetInstance().dialogueTweak; + Mod dialogueMod = ExternalMods.dialogueTweak; if (dialogueMod != null) { - dialogueMod.Call("ReplaceShopButtonIcon", NPCType(), "Head"); + dialogueMod.Call("ReplaceShopButtonIcon", NPCType(), "Head"); } } #endregion @@ -1107,7 +1151,7 @@ namespace CalamityMod #region Summoner's Association private static void SummonersAssociationSupport() { - Mod sAssociation = GetInstance().summonersAssociation; + Mod sAssociation = ExternalMods.summonersAssociation; if (sAssociation is null) return; @@ -1247,9 +1291,9 @@ namespace CalamityMod private static Color StealthDamageColor = new(185, 105, 250); private static Color StealthCritColor = new(144, 33, 235); - public static void ColoredDamageTypesSupport() + private static void ColoredDamageTypesSupport() { - Mod coloredDamageTypes = GetInstance().coloredDamageTypes; + Mod coloredDamageTypes = ExternalMods.coloredDamageTypes; if (coloredDamageTypes is null) return; @@ -1274,9 +1318,9 @@ namespace CalamityMod 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() + private static void LuminanceSupport() { - Mod luminance = GetInstance().luminance; + Mod luminance = ExternalMods.luminance; if (luminance is null) return; diff --git a/NPCs/Abyss/BabyCannonballJellyfish.cs b/NPCs/Abyss/BabyCannonballJellyfish.cs index b9dad300de..43e00656d4 100644 --- a/NPCs/Abyss/BabyCannonballJellyfish.cs +++ b/NPCs/Abyss/BabyCannonballJellyfish.cs @@ -23,9 +23,9 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; - Main.npcCatchable[NPC.type] = true; - NPCID.Sets.CountsAsCritter[NPC.type] = true; + Main.npcFrameCount[Type] = 4; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; } public override void SetDefaults() @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -140,12 +140,12 @@ namespace CalamityMod.NPCs.Abyss spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)TextureAssets.Npc[NPC.type].Value.Width, (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)TextureAssets.Npc[Type].Value.Width, (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[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(TextureAssets.Npc[NPC.type].Value, vector, + Main.spriteBatch.Draw(TextureAssets.Npc[Type].Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/BabyCannonballJellyfish.png b/NPCs/Abyss/BabyCannonballJellyfish.png index dc393d1f84..484293dd38 100644 Binary files a/NPCs/Abyss/BabyCannonballJellyfish.png and b/NPCs/Abyss/BabyCannonballJellyfish.png differ diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index e1a0033532..002ff2ebce 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -2,7 +2,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.Abyss { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; } public override void SetDefaults() @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 74; NPC.height = 94; NPC.defense = 100; - NPC.lifeMax = 7200; + NPC.lifeMax = 9000; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 30, 0); @@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.Abyss return; } NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -211,7 +211,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bloatfish").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bloatfish2").Type, NPC.scale); diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index ce50cbf3a2..b9218ec8df 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -13,11 +13,12 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync] public class BobbitWormHead : ModNPC { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { //Preferably would have its head animated, but this will do for now @@ -37,7 +38,7 @@ namespace CalamityMod.NPCs.Abyss NPC.height = 40; NPC.defense = 50; NPC.DR_NERD(0.25f); - NPC.lifeMax = 6000; + NPC.lifeMax = 7500; NPC.knockBackResist = 0f; AIType = -1; NPC.noGravity = true; @@ -214,7 +215,7 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -255,7 +256,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 300, true); + target.AddBuff(ModContent.BuffType(), 300, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) @@ -277,7 +278,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BobbitWorm").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BobbitWorm2").Type, 1f); diff --git a/NPCs/Abyss/BobbitWormSegment.cs b/NPCs/Abyss/BobbitWormSegment.cs index aad563ed48..5b65b917d6 100644 --- a/NPCs/Abyss/BobbitWormSegment.cs +++ b/NPCs/Abyss/BobbitWormSegment.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync(SyncWith = typeof(BobbitWormHead))] public class BobbitWormSegment : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.BobbitWormHead.DisplayName"); diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index c0a59b59c8..3852e1e332 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.Abyss { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 10; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -30,11 +30,11 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 30; NPC.height = 33; NPC.defense = 5; - NPC.lifeMax = 90; + NPC.lifeMax = 115; NPC.alpha = 20; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index 772500e4be..4658c23195 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; + Main.npcFrameCount[Type] = 4; } public override void SetDefaults() @@ -41,10 +41,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 54; NPC.height = 76; NPC.defense = 0; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.knockBackResist = 0f; NPC.alpha = 100; - NPC.value = Item.buyPrice(0, 0, 1, 5); + NPC.value = Item.buyPrice(0, 0, 4, 0); NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; @@ -212,8 +212,8 @@ namespace CalamityMod.NPCs.Abyss } } NPC.velocity.Y += 0.1f; - if (currentFrame == 5 && NPC.frameCounter == 0.0) - NPC.velocity.Y = -2.748f; // manually picked value :desolate: + if (currentFrame == 3 && NPC.frameCounter == 0.0) + NPC.velocity.Y = -1.35f; // manually picked value :desolate: // yeah this is desolate indeed _ YuH } else { @@ -224,12 +224,12 @@ namespace CalamityMod.NPCs.Abyss } } - public override void FindFrame(int frameHeight) //8 frames, 78 height + public override void FindFrame(int frameHeight) //4 frames, 78 height { NPC.frameCounter += 1.0; if (NPC.frameCounter >= 7) { - currentFrame = currentFrame == 7 ? 0 : currentFrame + 1; + currentFrame = currentFrame == 3 ? 0 : currentFrame + 1; NPC.netUpdate = true; //update current frame variable NPC.frameCounter = 0; } @@ -254,14 +254,14 @@ namespace CalamityMod.NPCs.Abyss spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - var texture = TextureAssets.Npc[NPC.type]; - Vector2 halfSizeTexture = new Vector2((float)(texture.Value.Width / 2), (float)(texture.Value.Height / Main.npcFrameCount[NPC.type] / 2)); + var texture = TextureAssets.Npc[Type]; + Vector2 halfSizeTexture = new Vector2((float)(texture.Value.Width / 2), (float)(texture.Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - var glowTexture = TextureAssets.Npc[NPC.type]; - vector -= new Vector2((float)glowTexture.Value.Width, (float)(glowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + var glowTexture = TextureAssets.Npc[Type]; + vector -= new Vector2((float)glowTexture.Value.Width, (float)(glowTexture.Value.Height / Main.npcFrameCount[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(TextureAssets.Npc[NPC.type].Value, vector, + Main.spriteBatch.Draw(TextureAssets.Npc[Type].Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/CannonballJellyfish.png b/NPCs/Abyss/CannonballJellyfish.png index 4c0fd135b7..bb2f3a683c 100644 Binary files a/NPCs/Abyss/CannonballJellyfish.png and b/NPCs/Abyss/CannonballJellyfish.png differ diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index e508bee9e5..db902d9ae9 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 11; + Main.npcFrameCount[Type] = 11; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 78; NPC.height = 78; NPC.defense = 50; - NPC.lifeMax = 5600; + NPC.lifeMax = 7000; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index e44d689057..2b7e4564fa 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 11; + Main.npcFrameCount[Type] = 11; } public override void SetDefaults() @@ -590,7 +590,7 @@ namespace CalamityMod.NPCs.Abyss { spriteEffects |= SpriteEffects.FlipVertically; } - Main.spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, + Main.spriteBatch.Draw(TextureAssets.Npc[Type].Value, new Vector2((float)(player.direction * 4), player.gfxOffY) + ((player.gravDir == 1f) ? player.Top : player.Bottom) - screenPos, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), NPC.GetAlpha(color), NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, spriteEffects, 0f); } @@ -608,7 +608,7 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { NPC.frameCounter += hasBeenHit ? 0.15f : 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -624,7 +624,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 300, true); + target.AddBuff(ModContent.BuffType(), 300, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) @@ -650,7 +650,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid2").Type, NPC.scale); diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index fe588479a6..8e5716a636 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Abyss public static Asset GlowTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -36,11 +36,11 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 58; NPC.height = 30; NPC.defense = 8; - NPC.lifeMax = 110; + NPC.lifeMax = 140; NPC.aiStyle = -1; AIType = -1; NPC.alpha = 150; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath28; NPC.knockBackResist = 0.3f; @@ -345,7 +345,7 @@ namespace CalamityMod.NPCs.Abyss return; } NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -394,7 +394,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cuttlefish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cuttlefish2").Type, 1f); diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index d8bb936e3b..ab478d5acd 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -3,7 +3,7 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Ores; using CalamityMod.World; @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 16; + Main.npcFrameCount[Type] = 16; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 5f @@ -51,10 +51,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 136; NPC.height = 62; NPC.defense = 999999; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.85f; @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.Abyss brokenMask = true; NPC.HitSound = SoundID.NPCHit1; NPC.defense = 15; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i < 4; i++) { @@ -318,7 +318,6 @@ namespace CalamityMod.NPCs.Abyss { 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); } @@ -337,7 +336,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Devilfish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Devilfish2").Type, 1f); diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 607e863a20..f1be9b6e3a 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 16; + Main.npcFrameCount[Type] = 16; this.HideFromBestiary(); if (!Main.dedServ) { @@ -41,10 +41,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 136; NPC.height = 62; NPC.defense = 999999; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.85f; @@ -92,7 +92,7 @@ namespace CalamityMod.NPCs.Abyss brokenMask = true; NPC.HitSound = SoundID.NPCHit1; NPC.defense = 15; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i < 4; i++) { @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DevilfishAlt").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DevilfishAlt2").Type, 1f); diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index 5e0b418ef0..02450d05e6 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync(SyncWith = typeof(EidolonWyrmHead))] public class EidolonWyrmBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); @@ -138,9 +139,9 @@ namespace CalamityMod.NPCs.Abyss spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -160,7 +161,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Wyrm2").Type, 1f); } diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index 9e31e16946..bb6bcfa664 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync(SyncWith = typeof(EidolonWyrmHead))] public class EidolonWyrmBodyAlt : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); @@ -138,9 +139,9 @@ namespace CalamityMod.NPCs.Abyss spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -160,7 +161,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Wyrm3").Type, 1f); } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index b7b311396f..3ad3252016 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -4,7 +4,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -26,6 +26,7 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync] public class EidolonWyrmHead : ModNPC { private Vector2 patrolSpot = Vector2.Zero; @@ -40,7 +41,6 @@ namespace CalamityMod.NPCs.Abyss { NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/EidolonWyrm_Bestiary", PortraitPositionXOverride = 40 }; value.Position.X += 40; @@ -418,17 +418,28 @@ namespace CalamityMod.NPCs.Abyss return null; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + { + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, TextureAssets.Npc[ModContent.NPCType()].Value, 2, 26, 0.6f, new Vector2(70, 30), 2, 20); + } + return true; + } + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + if (NPC.IsABestiaryIconDummy) + return; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -455,14 +466,14 @@ namespace CalamityMod.NPCs.Abyss aewMinionCondition.Add(ModContent.ItemType(), 50); // Post-Polterghast: Soul Edge, Eidolic Wail, Stardust Staff - LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(DropHelper.PostPolter()); + LeadingConditionRule postPolter = new LeadingConditionRule(DropHelper.If(() => DownedBossSystem.downedPolterghast)); aewMinionCondition.Add(postPolter); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); // Post-Leviathan: 6-8 Lumenyl (8-11 on Expert) - LeadingConditionRule postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + LeadingConditionRule postLevi = new LeadingConditionRule(DropHelper.If(() => DownedBossSystem.downedLeviathan)); aewMinionCondition.Add(postLevi); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 8, 11)); @@ -482,7 +493,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Wyrm").Type, 1f); } @@ -501,7 +512,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 300, true); + target.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index 78045ad275..dba229a146 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync(SyncWith = typeof(EidolonWyrmHead))] public class EidolonWyrmTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); @@ -138,9 +139,9 @@ namespace CalamityMod.NPCs.Abyss spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -160,7 +161,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Wyrm4").Type, 1f); } diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index c6e40661f5..9651d90ae0 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -38,10 +38,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 62; NPC.height = 226; NPC.defense = 18; - NPC.lifeMax = 800; + NPC.lifeMax = 1000; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; Banner = NPC.type; @@ -219,7 +219,7 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { NPC.frameCounter += hasBeenHit ? 0.15f : 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -256,7 +256,6 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); - postLevi.Add(ModContent.ItemType(), 2); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 4, 3, 6)); } @@ -272,7 +271,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GiantSquid").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GiantSquid2").Type, 1f); diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index 819cae17cd..fffdbe9751 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync(SyncWith = typeof(GulperEelHead))] public class GulperEelBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); @@ -132,9 +133,9 @@ namespace CalamityMod.NPCs.Abyss NPC.position.Y = NPC.position.Y + targetYDirection; if (targetXDirection < 0f) - NPC.spriteDirection = 1; - else if (targetXDirection > 0f) NPC.spriteDirection = -1; + else if (targetXDirection > 0f) + NPC.spriteDirection = 1; } } @@ -146,9 +147,9 @@ namespace CalamityMod.NPCs.Abyss spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -172,7 +173,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel3").Type, 1f); diff --git a/NPCs/Abyss/GulperEelBody.png b/NPCs/Abyss/GulperEelBody.png index fb79dc639f..5d16178519 100644 Binary files a/NPCs/Abyss/GulperEelBody.png and b/NPCs/Abyss/GulperEelBody.png differ diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index 73d68d7b0f..700c7a225a 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync(SyncWith = typeof(GulperEelHead))] public class GulperEelBodyAlt : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); @@ -132,9 +133,9 @@ namespace CalamityMod.NPCs.Abyss NPC.position.Y = NPC.position.Y + targetYDirection; if (targetXDirection < 0f) - NPC.spriteDirection = 1; - else if (targetXDirection > 0f) NPC.spriteDirection = -1; + else if (targetXDirection > 0f) + NPC.spriteDirection = 1; } } @@ -146,9 +147,9 @@ namespace CalamityMod.NPCs.Abyss spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -172,7 +173,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel3").Type, 1f); diff --git a/NPCs/Abyss/GulperEelBodyAlt.png b/NPCs/Abyss/GulperEelBodyAlt.png index b913ecfe72..f7788755bc 100644 Binary files a/NPCs/Abyss/GulperEelBodyAlt.png and b/NPCs/Abyss/GulperEelBodyAlt.png differ diff --git a/NPCs/Abyss/GulperEelBodyAltGlow.png b/NPCs/Abyss/GulperEelBodyAltGlow.png index 363279be79..f12ca35945 100644 Binary files a/NPCs/Abyss/GulperEelBodyAltGlow.png and b/NPCs/Abyss/GulperEelBodyAltGlow.png differ diff --git a/NPCs/Abyss/GulperEelBodyGlow.png b/NPCs/Abyss/GulperEelBodyGlow.png index bd7324a232..2fb2ddd0c8 100644 Binary files a/NPCs/Abyss/GulperEelBodyGlow.png and b/NPCs/Abyss/GulperEelBodyGlow.png differ diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 395fc3d696..5c3bad9db5 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -16,6 +16,7 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync] public class GulperEelHead : ModNPC { private Vector2 patrolSpot = Vector2.Zero; @@ -32,7 +33,6 @@ namespace CalamityMod.NPCs.Abyss NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.75f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/GulperEel_Bestiary", PortraitPositionXOverride = 40, PortraitPositionYOverride = 20 }; @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Abyss NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.value = Item.buyPrice(0, 1, 0, 0); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -156,9 +156,9 @@ namespace CalamityMod.NPCs.Abyss } if (NPC.velocity.X < 0f) - NPC.spriteDirection = 1; - else if (NPC.velocity.X > 0f) NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; if (Main.player[NPC.target].dead) NPC.TargetClosest(false); @@ -338,17 +338,29 @@ namespace CalamityMod.NPCs.Abyss return null; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + { + Texture2D mainBody = TextureAssets.Npc[ModContent.NPCType()].Value; + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, [TextureAssets.Npc[ModContent.NPCType()].Value, mainBody, mainBody], 3, 26, 0.3f, new Vector2(0, 20), 3, 10, 0, 0.1f); + } + return true; + } + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + if (NPC.IsABestiaryIconDummy) + return; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -369,7 +381,6 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { 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)); } @@ -385,7 +396,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GulperEel").Type, 1f); } diff --git a/NPCs/Abyss/GulperEelHead.png b/NPCs/Abyss/GulperEelHead.png index b840a7904d..9b4a5926eb 100644 Binary files a/NPCs/Abyss/GulperEelHead.png and b/NPCs/Abyss/GulperEelHead.png differ diff --git a/NPCs/Abyss/GulperEelHeadGlow.png b/NPCs/Abyss/GulperEelHeadGlow.png index f7d7b57f39..bd708820e2 100644 Binary files a/NPCs/Abyss/GulperEelHeadGlow.png and b/NPCs/Abyss/GulperEelHeadGlow.png differ diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index 8c0444d4c1..edd3285342 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync(SyncWith = typeof(GulperEelHead))] public class GulperEelTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); @@ -132,9 +133,9 @@ namespace CalamityMod.NPCs.Abyss NPC.position.Y = NPC.position.Y + targetYDirection; if (targetXDirection < 0f) - NPC.spriteDirection = 1; - else if (targetXDirection > 0f) NPC.spriteDirection = -1; + else if (targetXDirection > 0f) + NPC.spriteDirection = 1; } } @@ -146,9 +147,9 @@ namespace CalamityMod.NPCs.Abyss spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -172,7 +173,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel4").Type, 1f); } diff --git a/NPCs/Abyss/GulperEelTail.png b/NPCs/Abyss/GulperEelTail.png index acade0c0a0..bda0f5f11c 100644 Binary files a/NPCs/Abyss/GulperEelTail.png and b/NPCs/Abyss/GulperEelTail.png differ diff --git a/NPCs/Abyss/GulperEelTailGlow.png b/NPCs/Abyss/GulperEelTailGlow.png index b07de25a2d..3ef3b136e7 100644 Binary files a/NPCs/Abyss/GulperEelTailGlow.png and b/NPCs/Abyss/GulperEelTailGlow.png differ diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 2550cd0e7d..e15e91f222 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.Abyss public static Asset GlowTexture; public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.NeedsExpertScaling[Type] = true; + Main.npcFrameCount[Type] = 6; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 58; NPC.height = 32; NPC.defense = 15; - NPC.lifeMax = 480; + NPC.lifeMax = 600; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 10, 0); @@ -96,7 +96,7 @@ namespace CalamityMod.NPCs.Abyss return; } NPC.frameCounter += NPC.chaseable ? 0.15f : 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -127,7 +127,9 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(DropHelper.PostLevi(), ModContent.ItemType(), 2); + DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); } public override void HitEffect(NPC.HitInfo hit) @@ -142,7 +144,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Laserfish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Laserfish2").Type, 1f); diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index a729bdce48..6b95e594c6 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -4,7 +4,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; + Main.npcFrameCount[Type] = 8; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -45,10 +45,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 68; NPC.height = 58; NPC.defense = 12; - NPC.lifeMax = 800; + NPC.lifeMax = 1000; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.85f; @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Abyss if (screamTimer == screamLimit) { SoundEngine.PlaySound(ScreamSound, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[NPC.target].dead && Main.player[NPC.target].active) { @@ -329,7 +329,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Confetti, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LuminousCorvina").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LuminousCorvina2").Type, 1f); diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index c57b37a7d0..5147891755 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = 20 @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 78; NPC.height = 170; NPC.defense = 10; - NPC.lifeMax = 6000; + NPC.lifeMax = 7500; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -209,7 +209,7 @@ Block: public override void FindFrame(int frameHeight) { NPC.frameCounter += hasBeenHit ? 0.15f : 0.1f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index e67b588fb1..dcbd788354 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Abyss { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.75f, @@ -34,10 +34,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 136; NPC.height = 40; NPC.defense = 8; - NPC.lifeMax = 360; + NPC.lifeMax = 450; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(0, 0, 4, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.75f; @@ -91,7 +91,7 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { NPC.frameCounter += NPC.chaseable || NPC.IsABestiaryIconDummy ? 0.15f : 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MorayEel").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MorayEel2").Type, 1f); diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index 2849ab2efa..b110c6b019 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync(SyncWith = typeof(OarfishHead))] public class OarfishBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.OarfishHead.DisplayName"); @@ -21,7 +22,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 16; //28 NPC.height = 16; //28 NPC.defense = 20; - NPC.lifeMax = 4000; + NPC.lifeMax = 5000; NPC.aiStyle = -1; //new AIType = -1; //new NPC.knockBackResist = 0f; @@ -146,7 +147,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OarfishBody").Type, 1f); } } diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 9459276e5a..c59d64fa26 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -5,7 +5,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +15,7 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync] public class OarfishHead : ModNPC { private Vector2 patrolSpot = Vector2.Zero; @@ -27,7 +30,6 @@ namespace CalamityMod.NPCs.Abyss { NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/Oarfish_Bestiary", PortraitPositionYOverride = 20 }; value.Position.X += 20; @@ -41,7 +43,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 59; NPC.height = 38; NPC.defense = 10; - NPC.lifeMax = 4000; + NPC.lifeMax = 5000; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -354,7 +356,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OarfishHead").Type, 1f); } } @@ -362,7 +364,16 @@ 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); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + { + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, 11, 10, 0.6f, Vector2.Zero, 3, 10); + } + return true; } } } diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index eb0ce07f93..e18c3657b6 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { + [LongDistanceNetSync(SyncWith = typeof(OarfishHead))] public class OarfishTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.OarfishHead.DisplayName"); @@ -21,7 +22,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 14; //28 NPC.height = 16; //28 NPC.defense = 30; - NPC.lifeMax = 4000; + NPC.lifeMax = 5000; NPC.aiStyle = -1; //new AIType = -1; //new NPC.knockBackResist = 0f; @@ -146,7 +147,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OarfishTail").Type, 1f); } } diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index e7ef0e456f..6fb205d54a 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -3,7 +3,7 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Rogue; @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; if (!Main.dedServ) { ManTexture = ModContent.Request(Texture + "Man", AssetRequestMode.ImmediateLoad); @@ -115,7 +115,9 @@ namespace CalamityMod.NPCs.Abyss NPC.soundDelay = 360; if (hasBeenHit) { - SoundEngine.PlaySound(EnragedRoarSound, NPC.Center); + // Roar becomes lower pitch when crippled + float pitch = phase3 ? -0.4f : 0; + SoundEngine.PlaySound(EnragedRoarSound with { Pitch = pitch }, NPC.Center); } else { @@ -681,7 +683,7 @@ namespace CalamityMod.NPCs.Abyss value.Position.Y -= 50f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPC.frameCounter += hasBeenHit || NPC.IsABestiaryIconDummy ? 0.15f : 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * newFrameHeight; } @@ -694,11 +696,11 @@ namespace CalamityMod.NPCs.Abyss SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Asset npcTexture = Main.zenithWorld ? ManTexture : TextureAssets.Npc[NPC.type]; + Asset npcTexture = Main.zenithWorld ? ManTexture : TextureAssets.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 origin = new Vector2((float)(npcTexture.Value.Width / 2), (float)(npcTexture.Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)npcTexture.Value.Width, (float)(npcTexture.Value.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset -= new Vector2((float)npcTexture.Value.Width, (float)(npcTexture.Value.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(npcTexture.Value, npcOffset, nframe, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); @@ -709,7 +711,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 300, true); + target.AddBuff(ModContent.BuffType(), 300, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index 14a0dbf9f7..a595aa9e36 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -2,8 +2,10 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Packets; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -40,7 +42,7 @@ namespace CalamityMod.NPCs.Abyss public static Asset GlowTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 23; + Main.npcFrameCount[Type] = 23; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -53,7 +55,7 @@ namespace CalamityMod.NPCs.Abyss NPC.height = 30; NPC.damage = BaseAttack; - NPC.lifeMax = 300; + NPC.lifeMax = 375; NPC.aiStyle = AIType = -1; @@ -91,8 +93,8 @@ namespace CalamityMod.NPCs.Abyss public override void SendExtraAI(BinaryWriter writer) { - writer.Write(NPC.localAI[0]); writer.Write(playerCrossed); + writer.Write(NPC.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -278,7 +280,7 @@ namespace CalamityMod.NPCs.Abyss HopTimer = ai2 == -1 ? 0 : ai2; CalmDownTimer = ai3 == -1 ? 0 : ai3; NPC.netUpdate = true; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI); } @@ -290,11 +292,7 @@ namespace CalamityMod.NPCs.Abyss } else { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncSlabCrabAI); - netMessage.Write(NPC.whoAmI); - netMessage.Write((int)phase); - netMessage.Send(); + SyncSlabCrabAIPacket.Send(this, phase: (int)phase); } } @@ -408,7 +406,10 @@ namespace CalamityMod.NPCs.Abyss if (player.ItemAnimationActive) { // ouch! - player.ApplyDamageToNPC(NPC, (int)player.GetDamage(DamageClass.MeleeNoSpeed).ApplyTo(player.HeldItem.damage), 0, player.direction); + Item pick = player.HeldItem; + int pickDamage = (int)player.GetDamage(pick.DamageType).ApplyTo(pick.damage); + Projectile hit = Projectile.NewProjectileDirect(pick.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), pickDamage, 0f, player.whoAmI, NPC.whoAmI); + hit.DamageType = pick.DamageType; SoundEngine.PlaySound(SoundID.Dig, NPC.Center); // this is the dig sound that shale piles use if (CurrentPhase < (int)AIState.Enraged) { @@ -452,7 +453,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Water, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i < 5; i++) { diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 02efa40f7b..c1aa1563e4 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Abyss public static Asset GlowTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.8f, @@ -42,10 +42,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 80; NPC.height = 40; NPC.defense = 20; - NPC.lifeMax = 240; + NPC.lifeMax = 300; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 4, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.15f; @@ -164,7 +164,7 @@ namespace CalamityMod.NPCs.Abyss else { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index c81ad502c2..2fed796aaa 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Abyss public static Asset GlowTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 @@ -43,10 +43,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 76; NPC.height = 36; NPC.defense = 10; - NPC.lifeMax = 320; + NPC.lifeMax = 400; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 4, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.85f; @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.Abyss else { NPC.frameCounter += NPC.chaseable ? 0.15f : 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -159,7 +159,6 @@ namespace CalamityMod.NPCs.Abyss { 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)); } @@ -175,7 +174,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ViperFish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ViperFish2").Type, 1f); diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index f507bcc990..feba4c4c47 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -30,9 +30,9 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; - NPCID.Sets.TrailCacheLength[NPC.type] = 12; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.TrailCacheLength[Type] = 12; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 @@ -71,7 +71,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 180; } - NPC.value = Item.buyPrice(0, 0, 3, 32); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.aiStyle = -1; AIType = -1; NPC.lavaImmune = false; @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) NPC.frame.Y = 0; } } @@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.AcidRain return false; } - Texture2D headTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D headTexture = TextureAssets.Npc[Type].Value; Texture2D tailTexture = TailTexture.Value; Vector2[] segmentPositions = (Vector2[])NPC.oldPos.Clone(); @@ -257,7 +257,7 @@ namespace CalamityMod.NPCs.AcidRain 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) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AcidEelGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AcidEelGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/BabyFlakCrab.cs b/NPCs/AcidRain/BabyFlakCrab.cs index b712830a88..5fc75e32ee 100644 --- a/NPCs/AcidRain/BabyFlakCrab.cs +++ b/NPCs/AcidRain/BabyFlakCrab.cs @@ -15,9 +15,9 @@ namespace CalamityMod.NPCs.AcidRain { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - Main.npcCatchable[NPC.type] = true; - NPCID.Sets.CountsAsCritter[NPC.type] = true; + Main.npcFrameCount[Type] = 6; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; } public override void SetDefaults() @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frame.Y += frameHeight; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) { NPC.frame.Y = frameHeight * 2; } @@ -149,7 +149,7 @@ namespace CalamityMod.NPCs.AcidRain { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BabyFlakCrabGore").Type, 1f); } diff --git a/NPCs/AcidRain/BloodwormFleeing.cs b/NPCs/AcidRain/BloodwormFleeing.cs index 95483b5893..8670ed3870 100644 --- a/NPCs/AcidRain/BloodwormFleeing.cs +++ b/NPCs/AcidRain/BloodwormFleeing.cs @@ -11,7 +11,7 @@ namespace CalamityMod.NPCs.AcidRain public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.BloodwormNormal.DisplayName"); public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; this.HideFromBestiary(); } @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) NPC.frame.Y = 0; } } diff --git a/NPCs/AcidRain/BloodwormNormal.cs b/NPCs/AcidRain/BloodwormNormal.cs index b95a54e1eb..3d61fbbac8 100644 --- a/NPCs/AcidRain/BloodwormNormal.cs +++ b/NPCs/AcidRain/BloodwormNormal.cs @@ -14,9 +14,9 @@ namespace CalamityMod.NPCs.AcidRain { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; - Main.npcCatchable[NPC.type] = true; - NPCID.Sets.CountsAsCritter[NPC.type] = true; + Main.npcFrameCount[Type] = 7; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; } public override void SetDefaults() @@ -93,7 +93,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) { NPC.frame.Y = 0; } @@ -117,6 +117,13 @@ namespace CalamityMod.NPCs.AcidRain int bloodwormAmt = NPC.CountNPCS(NPC.type); float spawnMult = bloodwormAmt > 5 ? 1f : (float)(0.16 * Math.Pow(5 - bloodwormAmt, 2)) + 1f; float baseSpawnRate = DownedBossSystem.downedBoomerDuke ? 0.1f : AcidRainEvent.OldDukeHasBeenEncountered ? 0.4f : 0.2f; + + float luck = spawnInfo.Player.luck; + if (luck > 0f && Main.rand.NextFloat() < luck) + spawnMult *= Main.rand.NextFloat(1f, 2f); + if (luck < 0f && Main.rand.NextFloat() < -luck) + spawnMult *= Main.rand.NextFloat(0.5f, 1f); + float spawnRate = baseSpawnRate * spawnMult; return spawnRate; diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index 336e418767..7cfa43f431 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; NPCID.Sets.BossBestiaryPriority.Add(Type); if (!Main.dedServ) { @@ -76,17 +76,18 @@ namespace CalamityMod.NPCs.AcidRain NPC.damage = 66; NPC.lifeMax = 4000; NPC.defense = 25; + NPC.value = Item.buyPrice(0, 2, 0, 0); if (DownedBossSystem.downedPolterghast) { NPC.damage = 160; NPC.lifeMax = 80630; NPC.defense = 80; + NPC.value *= 10f; } NPC.behindTiles = true; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 3, 60, 0); NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -120,7 +121,7 @@ namespace CalamityMod.NPCs.AcidRain if (InPhase2 && !HasMadeShellBreakGore) { SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.Find("CragmawMireP1Gore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.Find("CragmawMireP1Gore2").Type, NPC.scale); @@ -494,7 +495,7 @@ namespace CalamityMod.NPCs.AcidRain 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) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.Find("CragmawMireP2Gore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.Find("CragmawMireP2Gore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 758275f73c..c9505ec7fe 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.AcidRain public const int TotalHitsNeededToDoDamage = 10; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.AcidRain } NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 5, 55); + NPC.value = Item.buyPrice(0, 0, 4, 0); NPC.lavaImmune = true; NPC.noGravity = false; NPC.noTileCollide = false; @@ -203,7 +203,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frame.Y += frameHeight; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) { NPC.frame.Y = frameHeight * 3; // Frames 1 and 2 are for transitioning. Frame 0 is sitting still, and the rest are walking frames } @@ -226,7 +226,7 @@ namespace CalamityMod.NPCs.AcidRain { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("FlakCrabGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("FlakCrabGore2").Type, 1f); diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index bf2da35ba4..a901b64e48 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.knockBackResist = 0f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 8, 30); + NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.TargetClosest(false); - if (NPC.velocity.Y == 0f && LaserShootCountdown <= 0f && !Target.npcTypeNoAggro[NPC.type]) + if (NPC.velocity.Y == 0f && LaserShootCountdown <= 0f && !Target.npcTypeNoAggro[Type]) { NPC.velocity.X *= 0.8f; @@ -182,7 +182,7 @@ namespace CalamityMod.NPCs.AcidRain // Randomly prepare to shoot a laser. if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(Target.Center.X - NPC.Center.X) < 250f && Target.Center.X < NPC.Center.X && - LaserShootCountdown == 0f && Main.rand.NextBool(110) && !Target.npcTypeNoAggro[NPC.type]) + LaserShootCountdown == 0f && Main.rand.NextBool(110) && !Target.npcTypeNoAggro[Type]) { LaserShootCountdown = 600f; NPC.netUpdate = true; @@ -197,7 +197,7 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 20; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GammaSlimeGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GammaSlimeGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index d371fa1641..4a47bcbc42 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; AIType = NPCID.ToxicSludge; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -122,7 +122,7 @@ namespace CalamityMod.NPCs.AcidRain { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("IrradiatedSlime").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("IrradiatedSlime2").Type, 1f); diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index fa9a03aac0..0ab66f14c6 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -51,7 +51,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; + Main.npcFrameCount[Type] = 8; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 90000; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.value = Item.buyPrice(0, 20, 0, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath60; NPC.knockBackResist = 0f; @@ -163,7 +163,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.frameCounter++; if (NPC.frameCounter >= 5) { - CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[NPC.type]; + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[Type]; NPC.frameCounter = 0; } @@ -228,7 +228,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.frameCounter++; if (NPC.frameCounter >= 5) { - CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[NPC.type]; + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[Type]; NPC.frameCounter = 0; } @@ -331,7 +331,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.frameCounter++; if (NPC.frameCounter >= (hasCharged ? 4 : 7)) { - CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[NPC.type]; + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[Type]; NPC.frameCounter = 0; } @@ -423,7 +423,7 @@ namespace CalamityMod.NPCs.AcidRain public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; Vector2 origin = NPC.frame.Size() * 0.5f; @@ -447,7 +447,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.frameCounter++; if (NPC.frameCounter >= 5) { - CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[NPC.type]; + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[Type]; NPC.frameCounter = 0; } } @@ -477,7 +477,7 @@ namespace CalamityMod.NPCs.AcidRain for (int k = 0; k < 30; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Mauler").Type, NPC.scale); for (int i = 2; i <= 5; i++) diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index c3455067f5..95dcf1abeb 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -87,9 +87,9 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 14; - NPCID.Sets.TrailCacheLength[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 14; + NPCID.Sets.TrailCacheLength[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -156,8 +156,8 @@ namespace CalamityMod.NPCs.AcidRain hasDoneDeathray = reader.ReadBoolean(); AttackIndex = reader.ReadInt32(); DelayTime = reader.ReadInt32(); - DeathrayTime = reader.ReadInt32(); JumpTimer = reader.ReadSingle(); + DeathrayTime = reader.ReadInt32(); ShootPosition = reader.ReadVector2(); } @@ -180,12 +180,7 @@ namespace CalamityMod.NPCs.AcidRain if (NPC.target < 0 || NPC.target >= 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) { NPC.TargetClosest(false); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } if (TeleportCountdown > -TeleportCooldown) @@ -235,35 +230,21 @@ namespace CalamityMod.NPCs.AcidRain NPC.velocity.Y -= MathHelper.Clamp(Math.Abs(Target.Center.Y - NPC.Center.Y) / 12.5f, 8f, 18f); NPC.velocity.X = NPC.SafeDirectionTo(Target.Center).X * 18f; - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } else { if (Walking != Math.Abs(NPC.velocity.X) > 4f) { Walking = Math.Abs(NPC.velocity.X) > 4f; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } // Force a jump the next frame to overcome any horizontal obstacles if they exist. if (NPC.collideX) { JumpTimer = 50; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } // Otherwise walk towards the target if they're not super close. @@ -286,12 +267,7 @@ namespace CalamityMod.NPCs.AcidRain if (wrappedAttackTime == 255f) { ShootPosition = Target.Center; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); NPC.spriteDirection = (ShootPosition.X - NPC.Center.X < 0).ToDirectionInt(); } @@ -356,12 +332,7 @@ namespace CalamityMod.NPCs.AcidRain TeleportCountdown = TeleportTime; TeleportLocation = new Vector2(x, y - 6f); HorizontalCollisionSpamCounter = 0f; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); return; @@ -384,12 +355,7 @@ Continue: if (TeleportCountdown == 0f && TeleportLocation != Vector2.Zero) { NPC.position = TeleportLocation.ToWorldCoordinates(8f, 0f) - NPC.Size; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); NPC.velocity = Vector2.Zero; } @@ -606,7 +572,7 @@ Continue: NPC.frame.Y = frameHeight * 8; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type] && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type] && Main.netMode != NetmodeID.MultiplayerClient) NPC.StrikeInstantKill(); } else if (NPC.frame.Y >= (Walking ? 8 : 4) * frameHeight) @@ -636,12 +602,7 @@ Continue: NPC.life = 1; NPC.dontTakeDamage = true; NPC.velocity = Vector2.Zero; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); return false; } diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index 9057a3c886..5f50419754 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 8; value.PortraitPositionYOverride = 28f; @@ -77,7 +77,7 @@ namespace CalamityMod.NPCs.AcidRain } NPC.knockBackResist = 0.7f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.lavaImmune = false; NPC.noGravity = true; NPC.noTileCollide = false; @@ -175,7 +175,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) NPC.frame.Y = 0; } } @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.AcidRain if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("NuclearToadGore1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("NuclearToadGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 2bc519b439..ef3fd1d1f3 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -28,14 +28,14 @@ namespace CalamityMod.NPCs.AcidRain get => NPC.ai[3] == 1f; set { - if (Main.netMode == NetmodeID.Server && value != PerformingJump) + if (Main.dedServ && value != PerformingJump) NPC.netUpdate = true; NPC.ai[3] = value.ToInt(); } } public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.AcidRain } NPC.knockBackResist = 0.6f; - NPC.value = Item.buyPrice(0, 0, 4, 20); + NPC.value = Item.buyPrice(0, 0, 4, 0); NPC.lavaImmune = false; NPC.noGravity = true; NPC.noTileCollide = false; @@ -244,7 +244,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) NPC.frame.Y = 0; } } @@ -255,7 +255,7 @@ namespace CalamityMod.NPCs.AcidRain 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) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OrthoceraGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OrthoceraGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index fa5266c59c..08e6905be3 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.AcidRain { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; } public override void SetDefaults() @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.AcidRain } NPC.knockBackResist = 0.8f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -74,10 +74,10 @@ namespace CalamityMod.NPCs.AcidRain { Lighting.AddLight(NPC.Center, 0.3f, 1.5f, 0.3f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int auraSize = 200; //roughly 12 blocks (half the size of Wither Beast aura) - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (!player.dead && player.active && (player.Center - NPC.Center).Length() < auraSize && !player.creativeGodMode) { player.AddBuff(ModContent.BuffType(), 3, false); diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index a69b0c7964..2c95fabde1 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Rotation = MathHelper.Pi @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.DR_NERD(0.05f); } - NPC.value = Item.buyPrice(0, 0, 3, 65); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.lavaImmune = false; NPC.noGravity = true; NPC.noTileCollide = true; @@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) NPC.frame.Y = 0; } } @@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.AcidRain 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) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkyfinGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkyfinGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index 17b047ceb0..759e49aa4e 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -32,9 +32,9 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.TrailingMode[NPC.type] = 1; - NPCID.Sets.TrailCacheLength[NPC.type] = 6; + Main.npcFrameCount[Type] = 5; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.TrailCacheLength[Type] = 6; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.AcidRain } NPC.knockBackResist = 0.8f; - NPC.value = Item.buyPrice(0, 0, 5, 25); + NPC.value = Item.buyPrice(0, 0, 4, 0); NPC.lavaImmune = false; NPC.noGravity = true; NPC.noTileCollide = false; @@ -125,8 +125,7 @@ namespace CalamityMod.NPCs.AcidRain if (closestBubble.Hitbox.Intersects(NPC.Hitbox)) { Flying = true; - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); closestBubble.Kill(); } } @@ -152,8 +151,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.velocity.Y -= jumpSpeed; NPC.velocity.X = lungeForwardSpeed * (NPC.Center.X - destination.X < 0).ToDirectionInt(); NPC.spriteDirection = (NPC.Center.X - destination.X > 0).ToDirectionInt(); - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } } else @@ -178,8 +176,7 @@ namespace CalamityMod.NPCs.AcidRain if (NPC.WithinRange(Target.Center, Target.Size.Length())) { Flying = false; - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } } @@ -225,7 +222,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) NPC.frame.Y = frameHeight; } } @@ -248,7 +245,7 @@ namespace CalamityMod.NPCs.AcidRain } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { 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); diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index bea6a87290..f85ec39507 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -25,9 +25,9 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; - NPCID.Sets.TrailingMode[NPC.type] = 1; - NPCID.Sets.TrailCacheLength[NPC.type] = 5; + Main.npcFrameCount[Type] = 8; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.TrailCacheLength[Type] = 5; } public override void SetDefaults() @@ -189,7 +189,7 @@ namespace CalamityMod.NPCs.AcidRain { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) NPC.frame.Y = 0; } } @@ -202,7 +202,7 @@ namespace CalamityMod.NPCs.AcidRain } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("TrilobiteGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("TrilobiteGore2").Type, NPC.scale); diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 19c821436d..fa66f19776 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { + [LongDistanceNetSync(SyncWith = typeof(AquaticScourgeHead))] public class AquaticScourgeBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AquaticScourgeHead.DisplayName"); @@ -99,8 +100,8 @@ namespace CalamityMod.NPCs.AquaticScourge if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; @@ -152,7 +153,7 @@ namespace CalamityMod.NPCs.AquaticScourge { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASBody").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASBody2").Type, NPC.scale); diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 3a6540acf2..9ef8a4450b 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { + [LongDistanceNetSync(SyncWith = typeof(AquaticScourgeHead))] public class AquaticScourgeBodyAlt : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AquaticScourgeHead.DisplayName"); @@ -98,8 +99,8 @@ namespace CalamityMod.NPCs.AquaticScourge if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; @@ -151,7 +152,7 @@ namespace CalamityMod.NPCs.AquaticScourge { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASBodyAlt").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASBodyAlt2").Type, NPC.scale); diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index e908a11d6a..d40200466a 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -5,7 +5,7 @@ using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; @@ -16,6 +16,7 @@ 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.AcidRain; using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; @@ -33,6 +34,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { [AutoloadBossHead] + [LongDistanceNetSync] public class AquaticScourgeHead : ModNPC { public override void SetStaticDefaults() @@ -41,8 +43,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.6f, - PortraitScale = 0.6f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/AquaticScourge_Bestiary" + PortraitScale = 0.6f }; value.Position.X += 40f; value.Position.Y += 20f; @@ -64,7 +65,7 @@ namespace CalamityMod.NPCs.AquaticScourge if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) NPC.lifeMax *= 2; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 40, 0, 0); + NPC.value = Item.buyPrice(0, 16, 0, 0); NPC.behindTiles = true; NPC.chaseable = false; NPC.noGravity = true; @@ -134,12 +135,17 @@ namespace CalamityMod.NPCs.AquaticScourge public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + if (NPC.IsABestiaryIconDummy) + { + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, TextureAssets.Npc[ModContent.NPCType()].Value, 10, 12, 0.6f, new Vector2(20, 30), 3, 10); + } + SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; @@ -273,13 +279,11 @@ namespace CalamityMod.NPCs.AquaticScourge CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedAquaticScourge); - // If Aquatic Scourge has not yet been killed, notify players of buffed Acid Rain if (!DownedBossSystem.downedAquaticScourge) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(Mauler.RoarSound, Main.player[Main.myPlayer].Center); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(Mauler.RoarSound, Main.LocalPlayer.Center); string sulfSeaBoostKey = "Mods.CalamityMod.Status.Progression.WetWormBossText"; Color sulfSeaBoostColor = AcidRainEvent.TextColor; @@ -311,7 +315,7 @@ namespace CalamityMod.NPCs.AquaticScourge for (int k = 0; k < 15; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASHead").Type, NPC.scale); } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 8192a04f68..0c7761be5b 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { + [LongDistanceNetSync(SyncWith = typeof(AquaticScourgeHead))] public class AquaticScourgeTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AquaticScourgeHead.DisplayName"); @@ -98,8 +99,8 @@ namespace CalamityMod.NPCs.AquaticScourge if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; @@ -151,7 +152,7 @@ namespace CalamityMod.NPCs.AquaticScourge { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASTail").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASTail2").Type, NPC.scale); diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 1ea110d392..55856d0640 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; + Main.npcFrameCount[Type] = 8; if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AriesGlow", AssetRequestMode.AsyncLoad); } @@ -35,9 +35,9 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = NPCAIStyleID.Herpling; NPC.defense = 14; NPC.DR_NERD(0.15f); - NPC.lifeMax = 300; + NPC.lifeMax = 380; NPC.knockBackResist = 0.6f; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(0, 0, 3, 0); NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 85; NPC.defense = 24; NPC.knockBackResist = 0.5f; - NPC.lifeMax = 450; + NPC.lifeMax = 570; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 1, 3)); - npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); + npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 10); } } } diff --git a/NPCs/Astral/Astraglomerate.cs b/NPCs/Astral/Astraglomerate.cs index 5144e7a287..0d611c3384 100644 --- a/NPCs/Astral/Astraglomerate.cs +++ b/NPCs/Astral/Astraglomerate.cs @@ -25,10 +25,10 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstraglomerateGlow", AssetRequestMode.AsyncLoad); - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; } public override void SetDefaults() @@ -39,17 +39,17 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 0; NPC.defense = 15; NPC.DR_NERD(0.15f); - NPC.lifeMax = 480; + NPC.lifeMax = 600; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.value = Item.buyPrice(0, 0, 8, 0); Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 90; NPC.defense = 25; - NPC.lifeMax = 700; + NPC.lifeMax = 900; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -162,7 +162,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 3, 1, 4)); - npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); + npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 10); } } } diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 22dcb4d65a..faddb06bef 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -38,11 +38,11 @@ namespace CalamityMod.NPCs.Astral NPC.height = 30; //216 NPC.defense = 10; NPC.DR_NERD(0.15f); - NPC.lifeMax = 50; + NPC.lifeMax = 70; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0.95f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = SoundID.NPCDeath14; @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 30; NPC.defense = 20; NPC.knockBackResist = 0.85f; - NPC.lifeMax = 70; + NPC.lifeMax = 105; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -241,8 +241,8 @@ namespace CalamityMod.NPCs.Astral if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawPosition = NPC.Center - screenPos; drawPosition -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; drawPosition += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); @@ -288,7 +288,7 @@ namespace CalamityMod.NPCs.Astral Main.dust[cosmos].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = NPC.Center; int goreAmt = 3; diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 9959c22d91..573a6b45a8 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.Astral { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; } public override void SetDefaults() @@ -27,9 +27,9 @@ namespace CalamityMod.NPCs.Astral NPC.height = 31; NPC.aiStyle = NPCAIStyleID.Slime; NPC.defense = 8; - NPC.lifeMax = 200; + NPC.lifeMax = 250; NPC.knockBackResist = 0.6f; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.alpha = 60; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Astral { NPC.damage = 65; NPC.defense = 18; - NPC.lifeMax = 300; + NPC.lifeMax = 375; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -101,7 +101,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 1, 3)); - npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); + npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 10); var postDeus = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumDeus); postDeus.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 12, 11, 16)); diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 6037b4ad46..dbd069a50d 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaGroundGlow", AssetRequestMode.AsyncLoad); @@ -35,10 +35,10 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 55; NPC.defense = 20; NPC.DR_NERD(0.15f); - NPC.lifeMax = 500; + NPC.lifeMax = 630; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.38f; - NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.value = Item.buyPrice(0, 0, 8, 0); NPC.timeLeft = NPC.activeTime * 2; AnimationType = NPCID.WallCreeper; Banner = ModContent.NPCType(); @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 90; NPC.defense = 30; NPC.knockBackResist = 0.28f; - NPC.lifeMax = 750; + NPC.lifeMax = 945; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) { diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index ab3c5fc0d1..b4dd27e74b 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Astral public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstralachneaGround.DisplayName"); public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaWallGlow", AssetRequestMode.AsyncLoad); @@ -42,11 +42,11 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 55; NPC.defense = 20; NPC.DR_NERD(0.15f); - NPC.lifeMax = 500; + NPC.lifeMax = 630; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0f; NPC.noGravity = true; - NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.value = Item.buyPrice(0, 0, 8, 0); NPC.timeLeft = NPC.activeTime * 2; AnimationType = NPCID.BlackRecluseWall; Banner = NPC.type; @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Astral { NPC.damage = 90; NPC.defense = 30; - NPC.lifeMax = 750; + NPC.lifeMax = 945; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.Astral if (NPC.IsABestiaryIconDummy) { NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; NPC.frame.Y = (int)NPC.frameCounter * frameHeight; return; } @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) { @@ -158,7 +158,7 @@ namespace CalamityMod.NPCs.Astral { 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); + npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 10); } public override void ModifyNPCLoot(NPCLoot npcLoot) => ModifyAstralachneaLoot(npcLoot); diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index d3fc6d6641..435dcc51a2 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; //not really important seeing as custom drawing, but for heights sake, 6 //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 @@ -128,7 +128,7 @@ namespace CalamityMod.NPCs.Astral NPC.DR_NERD(0.15f); NPC.lifeMax = 1200; NPC.knockBackResist = 0.08f; - NPC.value = Item.buyPrice(0, 1, 0, 0); + NPC.value = Item.buyPrice(0, 0, 50, 0); NPC.aiStyle = -1; NPC.DeathSound = DeathSound; NPC.rarity = 1; @@ -139,7 +139,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 100; NPC.defense = 50; NPC.knockBackResist = 0.04f; - NPC.lifeMax = 1600; + NPC.lifeMax = 1800; } if (CalamityWorld.revenge) { @@ -464,7 +464,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { //head Gore.NewGore(NPC.GetSource_Death(), NPC.Top, NPC.velocity * 0.5f, Mod.Find("AtlasGore4").Type); @@ -584,7 +584,7 @@ namespace CalamityMod.NPCs.Astral SpriteEffects effect = NPC.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; //draw actual sprite - spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, position, NPC.frame, + spriteBatch.Draw(TextureAssets.Npc[Type].Value, position, NPC.frame, drawColor, 0f, default, 1f, //color, rotation, origin, scale effect, 0f); //effect, drawlayer @@ -658,7 +658,7 @@ namespace CalamityMod.NPCs.Astral { npcLoot.Add(ModContent.ItemType()); npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 7, 9)); - npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); + npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 10); } } } diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 9df2efe204..818c5c67b4 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Astral value.Position.X += 40f; value.Position.Y -= 6f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; } public override void SetDefaults() @@ -57,10 +57,10 @@ namespace CalamityMod.NPCs.Astral NPC.height = 48; NPC.damage = 45; NPC.aiStyle = -1; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.defense = 12; NPC.DR_NERD(0.15f); - NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.value = Item.buyPrice(0, 0, 8, 0); NPC.knockBackResist = 0.8f; NPC.behindTiles = true; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 65; NPC.defense = 22; NPC.knockBackResist = 0.7f; - NPC.lifeMax = 600; + NPC.lifeMax = 750; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -128,9 +128,6 @@ 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); @@ -170,9 +167,6 @@ namespace CalamityMod.NPCs.Astral } else { - // Avoid cheap bullshit - NPC.damage = 0; - // Rebound on collision. if (NPC.collideX) { @@ -218,9 +212,6 @@ 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. @@ -274,7 +265,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) { @@ -293,7 +284,7 @@ namespace CalamityMod.NPCs.Astral drawColor = Color.White; //draw shark - 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); + spriteBatch.Draw(TextureAssets.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.Value, NPC.Center - screenPos + offset, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); diff --git a/NPCs/Astral/Glomerling.cs b/NPCs/Astral/Glomerling.cs index 17d72cc3a0..4064e9380b 100644 --- a/NPCs/Astral/Glomerling.cs +++ b/NPCs/Astral/Glomerling.cs @@ -13,6 +13,7 @@ using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Banners; namespace CalamityMod.NPCs.Astral { @@ -24,10 +25,11 @@ namespace CalamityMod.NPCs.Astral { if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/GlomerlingGlow", AssetRequestMode.AsyncLoad); - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 8; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.PositiveNPCTypesExcludedFromDeathTally[Type] = true; } public override void SetDefaults() @@ -37,17 +39,19 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = -1; NPC.damage = 30; NPC.defense = 0; - NPC.lifeMax = 150; + NPC.lifeMax = 190; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.5f; NPC.noGravity = true; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 1, 0); + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 50; NPC.defense = 8; NPC.knockBackResist = 0.4f; - NPC.lifeMax = 220; + NPC.lifeMax = 285; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 8882cf68c8..8f004e0ea7 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Astral value.Position.X += 10f; value.Position.Y += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; } public override void SetDefaults() @@ -44,10 +44,10 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 50; NPC.defense = 8; NPC.DR_NERD(0.15f); - NPC.lifeMax = 330; + NPC.lifeMax = 420; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.75f; - NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.value = Item.buyPrice(0, 0, 8, 0); Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 80; NPC.defense = 18; NPC.knockBackResist = 0.65f; - NPC.lifeMax = 500; + NPC.lifeMax = 630; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -158,7 +158,7 @@ namespace CalamityMod.NPCs.Astral Vector2 position = NPC.Bottom - new Vector2(19f, 42f); //20 34 38 42 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); + spriteBatch.Draw(TextureAssets.Npc[Type].Value, position - screenPos, src, drawColor, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); //draw glowmask 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; @@ -190,7 +190,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 5; i++) { diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index f4416a41f4..de94ff79cf 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 14; + Main.npcFrameCount[Type] = 14; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = 0 @@ -45,9 +45,9 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = -1; NPC.defense = 6; NPC.DR_NERD(0.15f); - NPC.lifeMax = 340; + NPC.lifeMax = 430; NPC.knockBackResist = 0.2f; - NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 85; NPC.defense = 16; NPC.knockBackResist = 0.1f; - NPC.lifeMax = 510; + NPC.lifeMax = 645; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -251,7 +251,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 2, 1, 3)); - npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); + npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 10); } } } diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 19ad010c55..d14ec0d4dd 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; + Main.npcFrameCount[Type] = 8; if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/NovaGlow", AssetRequestMode.AsyncLoad); @@ -54,11 +54,11 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 45; NPC.defense = 15; NPC.DR_NERD(0.15f); - NPC.lifeMax = 230; + NPC.lifeMax = 290; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.noGravity = true; NPC.knockBackResist = 0.5f; - NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.aiStyle = -1; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -67,7 +67,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 75; NPC.defense = 25; NPC.knockBackResist = 0.4f; - NPC.lifeMax = 350; + NPC.lifeMax = 435; } if (CalamityWorld.revenge) { @@ -282,7 +282,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 7; i++) { @@ -298,10 +298,10 @@ namespace CalamityMod.NPCs.Astral // 2-3 Stardust (3-4 Expert+) exploded.OnFailedConditions(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); - exploded.OnFailedConditions(ItemDropRule.ByCondition(DropHelper.If(() => DownedBossSystem.downedAstrumAureus), ModContent.ItemType(), 7)); + exploded.OnFailedConditions(ItemDropRule.ByCondition(DropHelper.If(() => DownedBossSystem.downedAstrumAureus), ModContent.ItemType(), 10)); // If exploded, then have a chance to drop Glorious End and nothing else - exploded.Add(ModContent.ItemType(), 7); + exploded.Add(ModContent.ItemType(), 10); } public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/Astral/SightseerCollider.cs b/NPCs/Astral/SightseerCollider.cs index 5b0a72f09c..95120b8a6c 100644 --- a/NPCs/Astral/SightseerCollider.cs +++ b/NPCs/Astral/SightseerCollider.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerColliderGlow", AssetRequestMode.AsyncLoad); @@ -42,11 +42,11 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 38; NPC.defense = 16; NPC.DR_NERD(0.15f); - NPC.lifeMax = 310; + NPC.lifeMax = 390; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.noGravity = true; NPC.knockBackResist = 0.58f; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.aiStyle = -1; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 58; NPC.defense = 26; NPC.knockBackResist = 0.48f; - NPC.lifeMax = 460; + NPC.lifeMax = 585; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -120,7 +120,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 5; i++) { diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index 18a292029b..67d8668cfb 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerSpitterGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() @@ -44,11 +44,11 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 50; NPC.defense = 20; NPC.DR_NERD(0.15f); - NPC.lifeMax = 430; + NPC.lifeMax = 540; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.noGravity = true; NPC.knockBackResist = 0.8f; - NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.value = Item.buyPrice(0, 0, 8, 0); NPC.aiStyle = -1; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 85; NPC.defense = 30; NPC.knockBackResist = 0.7f; - NPC.lifeMax = 640; + NPC.lifeMax = 810; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 5; i++) { @@ -195,7 +195,6 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 1; NPCID.Sets.ProjectileNPC[Type] = true; } @@ -251,12 +250,11 @@ namespace CalamityMod.NPCs.Astral { if (modifiers.GetDamage(NPC.damage, 0f, 0f) > 0) { - if (target.HasNPCBannerBuff(ModContent.NPCType())) + int parent = ModContent.NPCType(); + if (target.HasNPCBannerBuff(parent)) { - if (Main.expertMode) - modifiers.IncomingDamageMultiplier *= 0.5f; - else - modifiers.IncomingDamageMultiplier *= 0.75f; + ItemID.BannerEffect effect = ItemID.Sets.BannerStrength[Item.BannerToItem(parent)]; + modifiers.IncomingDamageMultiplier *= (Main.expertMode ? effect.ExpertDamageReceived : effect.NormalDamageReceived); } if (Main.netMode != NetmodeID.MultiplayerClient) diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 979055f748..1da35af01f 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Astral { if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/StellarCulexGlow", AssetRequestMode.AsyncLoad); - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 10f @@ -45,8 +45,8 @@ namespace CalamityMod.NPCs.Astral NPC.defense = 18; NPC.DR_NERD(0.15f); NPC.knockBackResist = 0.65f; - NPC.lifeMax = 210; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.lifeMax = 270; + NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; AnimationType = NPCID.GiantFlyingFox; Banner = NPC.type; @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 90; NPC.defense = 28; NPC.knockBackResist = 0.55f; - NPC.lifeMax = 320; + NPC.lifeMax = 405; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -99,7 +99,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) { @@ -137,7 +137,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 2, 1, 3)); - npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); + npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 10); } } } diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index 236659fd72..c7ae6c354e 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -13,9 +13,9 @@ namespace CalamityMod.NPCs.Astral { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; - Main.npcCatchable[NPC.type] = true; - NPCID.Sets.CountsAsCritter[NPC.type] = true; + Main.npcFrameCount[Type] = 8; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; } public override void SetDefaults() diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 9cb628306b..20bc8703cc 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -60,8 +60,8 @@ namespace CalamityMod.NPCs.AstrumAureus public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -95,12 +95,12 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.width = 374; NPC.height = 374; NPC.defense = 40; - NPC.DR_NERD(0.5f); - NPC.LifeMaxNERB(100000, 120000, 740000); // 30 seconds in boss rush + NPC.DR_NERD(0.4f); + NPC.LifeMaxNERB(120000, 140000, 740000); // 30 seconds in boss rush NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 60, 0, 0); + NPC.value = Item.buyPrice(0, 25, 0, 0); NPC.boss = true; NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToHeat = true; @@ -251,15 +251,15 @@ namespace CalamityMod.NPCs.AstrumAureus float lifeRatio = NPC.life / (float)NPC.lifeMax; bool slimePhaseHP = lifeRatio <= 0.1f || (lifeRatio > 0.6f && lifeRatio <= 0.7f); - Texture2D NPCTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D GlowMaskTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D NPCTexture = TextureAssets.Npc[Type].Value; + Texture2D GlowMaskTexture = TextureAssets.Npc[Type].Value; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; if (NPC.ai[0] == 0f || (slimePhaseHP && Main.zenithWorld)) { - NPCTexture = TextureAssets.Npc[NPC.type].Value; + NPCTexture = TextureAssets.Npc[Type].Value; GlowMaskTexture = Texture_Glow.Value; } else if (NPC.ai[0] == 1f) //nothing special done here @@ -275,7 +275,7 @@ namespace CalamityMod.NPCs.AstrumAureus { if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 3f) //idle before jump { - NPCTexture = TextureAssets.Npc[NPC.type].Value; //idle frames + NPCTexture = TextureAssets.Npc[Type].Value; //idle frames GlowMaskTexture = Texture_Glow.Value; } else if (NPC.velocity.Y <= 0f || NPC.ai[1] < 0f) //jump frames if flying upward or if about to jump @@ -293,7 +293,7 @@ namespace CalamityMod.NPCs.AstrumAureus { if (NPC.velocity.Y == 0f) //idle before teleport { - NPCTexture = TextureAssets.Npc[NPC.type].Value; //idle frames + NPCTexture = TextureAssets.Npc[Type].Value; //idle frames GlowMaskTexture = Texture_Glow.Value; } else //in-air frames @@ -303,8 +303,8 @@ namespace CalamityMod.NPCs.AstrumAureus } } - int frameCount = Main.npcFrameCount[NPC.type]; - Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / frameCount / 2); + int frameCount = Main.npcFrameCount[Type]; + Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / frameCount / 2); Rectangle frame = NPC.frame; float scale = NPC.scale; float rotation = NPC.rotation; @@ -319,7 +319,7 @@ namespace CalamityMod.NPCs.AstrumAureus if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -349,7 +349,7 @@ namespace CalamityMod.NPCs.AstrumAureus attackingColor = slimePhase == 0 ? Color.Violet : Color.Yellow; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -431,7 +431,7 @@ namespace CalamityMod.NPCs.AstrumAureus CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Wizard, ModContent.NPCType() }, DownedBossSystem.downedAstrumAureus); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedAstrumAureus); // If Astrum Aureus has not yet been killed, notify players of new Astral enemy drops if (!DownedBossSystem.downedAstrumAureus) @@ -490,7 +490,7 @@ namespace CalamityMod.NPCs.AstrumAureus aureusDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[aureusDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Aureus1").Type, 1f); diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 97f8fea0ce..cb5ac7cbd0 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -24,8 +24,8 @@ namespace CalamityMod.NPCs.AstrumAureus public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 4; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -239,12 +239,12 @@ namespace CalamityMod.NPCs.AstrumAureus if (NPC.ai[0] >= 60f) NPC.DrawBackglow(Color.Lerp(Color.Cyan, Color.Orange, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) with { A = 0 }, 2f + 8f * ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f), spriteEffects, NPC.frame, screenPos); - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Color whiteColor = Color.White; int afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -253,21 +253,21 @@ namespace CalamityMod.NPCs.AstrumAureus afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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 = GlowTexture.Value; Color afterimageColorLerp = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -275,7 +275,7 @@ namespace CalamityMod.NPCs.AstrumAureus secondAfterimageColor = Color.Lerp(secondAfterimageColor, whiteColor, 0.5f); secondAfterimageColor *= (afterimageAmt - j) / 15f; Vector2 secondAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; secondAfterimagePos += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); } @@ -292,7 +292,7 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.Opacity = 1f; NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -331,7 +331,7 @@ namespace CalamityMod.NPCs.AstrumAureus // 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.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); + Projectile.NewProjectile(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) diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index be382a944d..48520d3f9e 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus { + [LongDistanceNetSync(SyncWith = typeof(AstrumDeusHead))] public class AstrumDeusBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstrumDeusHead.DisplayName"); @@ -30,7 +31,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { AltTexture = ModContent.Request(Texture + "AltSpectral", AssetRequestMode.AsyncLoad); @@ -121,9 +122,9 @@ 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 ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D mainWormTex = altBodyTextures ? AltTexture.Value : TextureAssets.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 halfSizeTex = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(mainWormTex.Width, mainWormTex.Height) * NPC.scale / 2f; @@ -192,7 +193,7 @@ namespace CalamityMod.NPCs.AstrumDeus astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[astralDust].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; if (NPC.localAI[3] == 1f) diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index e76fdd2af3..e1e14712ef 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -17,6 +17,7 @@ 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.CalamityAIs.CalamityBossAIs; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; @@ -34,6 +35,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus { [AutoloadBossHead] + [LongDistanceNetSync] public class AstrumDeusHead : ModNPC { public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusSpawn"); @@ -51,13 +53,12 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetStaticDefaults() { - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.70f, - PortraitScale = 0.75f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/AstrumDeus_Bestiary" + PortraitScale = 0.75f }; value.Position.X += 55f; value.Position.Y += 23f; @@ -96,7 +97,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.boss = true; NPC.BossBar = ModContent.GetInstance(); - NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.value = Item.buyPrice(0, 50, 0, 0); NPC.alpha = 255; NPC.behindTiles = true; NPC.noGravity = true; @@ -156,7 +157,10 @@ namespace CalamityMod.NPCs.AstrumDeus public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.IsABestiaryIconDummy) + { NPC.Opacity = 1f; + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, AstrumDeusBody.AltTexture.Value, 7, 26, 0.3f, new Vector2(0, 10), 5, 10, 4); + } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) @@ -166,9 +170,9 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = NPC.Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D mainWormTex = TextureAssets.Npc[NPC.type].Value; + Texture2D mainWormTex = TextureAssets.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 halfSizeTex = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(mainWormTex.Width, mainWormTex.Height) * NPC.scale / 2f; @@ -226,7 +230,7 @@ namespace CalamityMod.NPCs.AstrumDeus astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[astralDust].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("AstrumDeusHead1").Type, 1f); diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 3413cad9a3..df4cda8149 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus { + [LongDistanceNetSync(SyncWith = typeof(AstrumDeusHead))] public class AstrumDeusTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstrumDeusHead.DisplayName"); @@ -25,7 +26,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -108,8 +109,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 wormTexture = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D wormTexture = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(wormTexture.Width, wormTexture.Height) * NPC.scale / 2f; @@ -163,7 +164,7 @@ namespace CalamityMod.NPCs.AstrumDeus astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[astralDust].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("AstrumDeusTail1").Type, 1f); diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 853b2a0c18..478a14704b 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -22,8 +22,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - Main.npcFrameCount[NPC.type] = 8; + NPCID.Sets.NeedsExpertScaling[Type] = true; + Main.npcFrameCount[Type] = 8; NPCID.Sets.BossBestiaryPriority.Add(Type); } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 6931c0d21c..ca14fd91ab 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -51,7 +51,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 12; + Main.npcFrameCount[Type] = 12; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -70,8 +70,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.width = 100; NPC.height = 150; NPC.defense = 15; - NPC.value = Item.buyPrice(0, 40, 0, 0); - NPC.LifeMaxNERB(41000, 49200, 780000); + NPC.value = Item.buyPrice(0, 16, 0, 0); + NPC.LifeMaxNERB(41000, 49200, 500000); NPC.DR_NERD(0.2f); NPC.knockBackResist = 0f; NPC.aiStyle = -1; @@ -112,8 +112,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void ReceiveExtraAI(BinaryReader reader) { - NPC.chaseable = reader.ReadBoolean(); currentMode = reader.ReadInt32(); + NPC.chaseable = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); @@ -203,10 +203,10 @@ namespace CalamityMod.NPCs.BrimstoneElemental { ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); - normalOnly.Add(ModContent.ItemType(), 10); // Materials normalOnly.Add(ModContent.ItemType(), 1, 8, 10); @@ -247,8 +247,6 @@ namespace CalamityMod.NPCs.BrimstoneElemental CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, DownedBossSystem.downedBrimstoneElemental); - // Mark brimmy as dead DownedBossSystem.downedBrimstoneElemental = true; CalamityNetcode.SyncWorld(); @@ -292,7 +290,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental 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) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("BrimstoneGore1").Type, 1f); @@ -311,10 +309,10 @@ namespace CalamityMod.NPCs.BrimstoneElemental SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D npcTexture = TextureAssets.Npc[NPC.type].Value; - Vector2 frameLocation = new Vector2((float)(npcTexture.Width / 2), (float)(npcTexture.Height / Main.npcFrameCount[NPC.type] / 2)); + Texture2D npcTexture = TextureAssets.Npc[Type].Value; + Vector2 frameLocation = new Vector2((float)(npcTexture.Width / 2), (float)(npcTexture.Height / Main.npcFrameCount[Type] / 2)); Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)npcTexture.Width, (float)(npcTexture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset -= new Vector2((float)npcTexture.Width, (float)(npcTexture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; npcOffset += frameLocation * NPC.scale + new Vector2(0f, NPC.gfxOffY); // Give brimmy an outline based on current elemental mode diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 9ef4b90ec1..6b934b0360 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -38,8 +38,8 @@ namespace CalamityMod.NPCs.Bumblebirb public static Asset GlowTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -77,7 +77,7 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.noTileCollide = true; NPC.lavaImmune = true; NPC.noGravity = true; - NPC.value = Item.buyPrice(1, 25, 0, 0); + NPC.value = Item.buyPrice(1, 0, 0, 0); NPC.HitSound = SoundID.NPCHit51; NPC.DeathSound = SoundID.NPCDeath46; NPC.Calamity().VulnerableToHeat = true; @@ -236,8 +236,8 @@ namespace CalamityMod.NPCs.Bumblebirb if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Color color = drawColor; Color altColor = Color.White; @@ -280,7 +280,7 @@ namespace CalamityMod.NPCs.Bumblebirb color = altColor; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { @@ -289,7 +289,7 @@ namespace CalamityMod.NPCs.Bumblebirb afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -333,7 +333,7 @@ namespace CalamityMod.NPCs.Bumblebirb } } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 0; j < extraAfterimageAmt; j++) { @@ -342,7 +342,7 @@ namespace CalamityMod.NPCs.Bumblebirb extraAfterimageColor = NPC.GetAlpha(extraAfterimageColor); extraAfterimageColor *= 1f - extraAfterimageDampener; Vector2 extraAfterimageDrawPos = NPC.Center + ((float)j / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; - extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -352,7 +352,7 @@ namespace CalamityMod.NPCs.Bumblebirb mainDrawingColor = Color.Lerp(mainDrawingColor, altColor, lerpDrawTransition); mainDrawingColor = NPC.GetAlpha(mainDrawingColor); Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(altColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -375,7 +375,7 @@ namespace CalamityMod.NPCs.Bumblebirb glowmaskColor *= glowmaskDampener; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int k = 1; k < afterimageAmt; k += afterimageIncrement) { @@ -383,7 +383,7 @@ namespace CalamityMod.NPCs.Bumblebirb glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, altColor, lerpDrawTransition); glowmaskAfterimageColor *= (float)(afterimageAmt - k) / 15f; Vector2 glowmaskAfterimageDrawPos = NPC.oldPos[k] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; glowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, glowmaskAfterimageDrawPos, NPC.frame, glowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -395,7 +395,7 @@ namespace CalamityMod.NPCs.Bumblebirb extraGlowmaskAfterimageColor = NPC.GetAlpha(extraGlowmaskAfterimageColor); extraGlowmaskAfterimageColor *= 1f - extraAfterimageDampener; Vector2 extraGlowmaskAfterimageDrawPos = NPC.Center + ((float)l / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; - extraGlowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraGlowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; extraGlowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, extraGlowmaskAfterimageDrawPos, NPC.frame, extraGlowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -521,7 +521,7 @@ namespace CalamityMod.NPCs.Bumblebirb { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now { diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index a42507bd10..ef8f02eaf5 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -16,8 +16,8 @@ namespace CalamityMod.NPCs.Bumblebirb { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 5; + NPCID.Sets.TrailingMode[Type] = 1; this.HideFromBestiary(); } @@ -100,11 +100,11 @@ namespace CalamityMod.NPCs.Bumblebirb if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -113,14 +113,14 @@ namespace CalamityMod.NPCs.Bumblebirb afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimageDrawPos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimageDrawPos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); diff --git a/NPCs/CalClone/CalSky.cs b/NPCs/CalClone/CalSky.cs index 21beea7407..ae64f31690 100644 --- a/NPCs/CalClone/CalSky.cs +++ b/NPCs/CalClone/CalSky.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.CalClone float x = 0f; if (this.CalIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.CalIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.CalIndex].Center); } return (1f - Utils.SmoothStep(3000f, 6000f, x)); } diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 6d40ea4a90..4a97327806 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -44,8 +44,8 @@ namespace CalamityMod.NPCs.CalClone public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.CalClone NPC.scale *= 0.8f; NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 12 : 25; - NPC.value = Item.buyPrice(0, 50, 0, 0); + NPC.value = Item.buyPrice(0, 20, 0, 0); NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.075f : 0.15f); NPC.LifeMaxNERB(37500, 45000, 520000); NPC.aiStyle = -1; @@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.CalClone public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -143,13 +143,13 @@ namespace CalamityMod.NPCs.CalClone if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); Color white = Color.White; float colorLerpAmt = 0.5f; int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -158,14 +158,14 @@ namespace CalamityMod.NPCs.CalClone afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, offset, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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); @@ -176,7 +176,7 @@ namespace CalamityMod.NPCs.CalClone color = Color.CornflowerBlue; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i++) { @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.CalClone extraAfterimageColor = Color.Lerp(extraAfterimageColor, white, colorLerpAmt); extraAfterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, offset, NPC.frame, extraAfterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.CalClone CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedCalamitasClone); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedCalamitasClone); // Mark the Calamitas Clone as dead DownedBossSystem.downedCalamitasClone = true; @@ -266,7 +266,7 @@ namespace CalamityMod.NPCs.CalClone } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Calamitas").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Calamitas2").Type, NPC.scale); diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index ab7be72dab..c5b3cbf9c1 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -31,8 +31,8 @@ namespace CalamityMod.NPCs.CalClone public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.CalClone public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -118,11 +118,11 @@ namespace CalamityMod.NPCs.CalClone if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -131,21 +131,21 @@ namespace CalamityMod.NPCs.CalClone afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.CalClone extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f); extraAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.CalClone } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cataclysm").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cataclysm2").Type, NPC.scale); diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index 79ea1ef840..ee72d7ea16 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -25,8 +25,8 @@ namespace CalamityMod.NPCs.CalClone public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -96,7 +96,7 @@ namespace CalamityMod.NPCs.CalClone public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -112,11 +112,11 @@ namespace CalamityMod.NPCs.CalClone if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -125,21 +125,21 @@ namespace CalamityMod.NPCs.CalClone afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.CalClone extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f); extraAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.CalClone } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Catastrophe").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Catastrophe2").Type, NPC.scale); diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index 2896c962f3..d6a78285ce 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -22,9 +22,9 @@ namespace CalamityMod.NPCs.CalClone public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 5; + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); if (!Main.dedServ) { @@ -75,7 +75,7 @@ namespace CalamityMod.NPCs.CalClone public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -130,6 +130,7 @@ namespace CalamityMod.NPCs.CalClone double dist = death ? 180 : 150; NPC.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - NPC.width / 2; NPC.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - NPC.height / 2; + NPC.velocity = Vector2.Zero; NPC.ai[1] += death ? 0.5f : 2f; return false; } @@ -142,7 +143,7 @@ namespace CalamityMod.NPCs.CalClone } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SoulSeeker").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SoulSeeker2").Type, 1f); @@ -187,13 +188,13 @@ namespace CalamityMod.NPCs.CalClone if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / Main.npcFrameCount[NPC.type] / 2f); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / Main.npcFrameCount[Type] / 2f); Color white = Color.White; float colorLerpAmt = 0.5f; int afterImageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int a = 1; a < afterImageAmt; a += 2) { @@ -202,21 +203,21 @@ namespace CalamityMod.NPCs.CalClone afterImageColor = NPC.GetAlpha(afterImageColor); afterImageColor *= (afterImageAmt - a) / 15f; Vector2 afterimagePos = NPC.oldPos[a] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, afterimagePos, NPC.frame, afterImageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } Vector2 drawPos = NPC.Center - screenPos; - drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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 = GlowTexture.Value; Color glow = Color.Lerp(Color.White, Color.Red, colorLerpAmt); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int a = 1; a < afterImageAmt; a++) { @@ -224,7 +225,7 @@ namespace CalamityMod.NPCs.CalClone glowColor = Color.Lerp(glowColor, white, colorLerpAmt); glowColor *= (afterImageAmt - a) / 15f; Vector2 afterimagePos = NPC.oldPos[a] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, afterimagePos, NPC.frame, glowColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs index 2ddd4e677e..b4b7b4b27b 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Kiss my motherfucking ass you piece of shit game npc.timeLeft *= 20; npc.npcSlots = 16f; - CalamityMod.bossKillTimes.TryGetValue(npc.type, out int revKillTime); + CalamityGlobalNPC.BossKillTimes.TryGetValue(npc.type, out int revKillTime); calamityGlobalNPC.KillTime = revKillTime; calamityGlobalNPC.newAI[0] = 1f; nonHostile = false; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs index e506af99b7..6762f39117 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Exhaustion bool exhausted = npc.ai[2] >= (phase3 ? 2f : 1f); - calamityGlobalNPC.DR = exhausted ? 0.25f : 0.5f; + calamityGlobalNPC.DR = exhausted ? 0.2f : 0.4f; npc.defense = exhausted ? npc.defDefense / 2 : npc.defDefense; // Get a target @@ -916,7 +916,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.life < 1) npc.life = 1; - npc.HealEffect(-damageAmt, true); + npc.DamageEffect(damageAmt); } } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs index 826432bb36..4ae6fd1ae2 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs @@ -17,6 +17,7 @@ using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Packets; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.Sounds; @@ -69,10 +70,10 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Inflict Extreme Gravity to nearby players if (revenge) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - 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); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } } @@ -214,20 +215,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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; + Main.npc[headOneID].ForceNetUpdate(); // On server, immediately send the correct extra AI of this head to clients. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { - 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(); + SyncCalamityNPCAIArrayPacket.Send(Main.npc[headOneID]); } // Make sure the second split worm is also contiguous. @@ -237,20 +230,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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; + Main.npc[headTwoID].ForceNetUpdate(); // On server, immediately send the correct extra AI of this head to clients. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { - 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(); + SyncCalamityNPCAIArrayPacket.Send(Main.npc[headTwoID]); } } @@ -340,12 +325,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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; + npc.ForceNetUpdate(false); } } @@ -380,16 +360,9 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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) + if (Main.dedServ) { - 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(); + SyncCalamityNPCAIArrayPacket.Send(Main.npc[lol]); } Main.npc[lol].ai[2] = npc.whoAmI; @@ -517,12 +490,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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; + Main.npc[i].ForceNetUpdate(false); } } } @@ -726,38 +694,20 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); 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.ForceNetUpdate(false); 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.ForceNetUpdate(false); npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs index 8a8807a89e..3719557ee3 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs @@ -102,11 +102,11 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f || bossRush; - float enrageScale = bossRush ? 1f : 0f; + float enrageScale = bossRush ? 0.5f : 0f; if (biomeEnraged && (!player.ZoneUnderworldHeight || bossRush)) { npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; + enrageScale += 0.5f; } if (biomeEnraged && (!modPlayer.ZoneCalamity || bossRush)) { @@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs enrageScale += 1f; } - npc.Calamity().DR = npc.ai[0] == 4f ? 0.6f : 0.15f; + npc.Calamity().DR = npc.ai[0] == 4f ? 0.6f : 0.2f; // Emit dust int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; @@ -223,12 +223,9 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HideInShellSound, player.Center); } - 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; + npc.ForceNetUpdate(false); } } @@ -247,7 +244,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.Distance(player.Center) < 160f) npc.localAI[1] += masterMode ? 4f : expertMode ? 2f : 1f; - if (npc.localAI[1] >= (bossRush ? 60f : death ? 120f : 180f)) + if (npc.localAI[1] >= (bossRush ? 90f : death ? 120f : 180f)) { npc.TargetClosest(); npc.localAI[1] = 0f; @@ -301,7 +298,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; } - npc.alpha += bossRush ? 15 : death ? 5 : revenge ? 4 : expertMode ? 3 : 2; + npc.alpha += bossRush ? 8 : death ? 5 : revenge ? 4 : expertMode ? 3 : 2; if (npc.alpha >= 255) { int spawnType = brimmy.currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType(); diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs index 0882a65f4f..7ee45394c2 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs @@ -120,11 +120,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); } return; @@ -202,12 +198,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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; + npc.ForceNetUpdate(false); } } else @@ -248,12 +239,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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; + npc.ForceNetUpdate(false); } } @@ -507,12 +493,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } } - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - + npc.ForceNetUpdate(false); npc.SyncExtraAI(); } } @@ -539,12 +520,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); npc.SyncExtraAI(); } @@ -569,12 +545,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); npc.SyncExtraAI(); } @@ -610,12 +581,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); npc.SyncExtraAI(); } } @@ -647,12 +613,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); npc.SyncExtraAI(); } @@ -704,12 +665,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); npc.SyncExtraAI(); } } @@ -732,12 +688,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); } else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) { @@ -745,12 +696,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); } } @@ -780,12 +726,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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; + npc.ForceNetUpdate(false); } } else @@ -839,11 +780,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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.ForceNetUpdate(false); } } @@ -856,12 +793,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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; + npc.ForceNetUpdate(false); } } @@ -889,12 +821,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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; + npc.ForceNetUpdate(false); } if (Main.zenithWorld) @@ -922,12 +849,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { 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; + npc.ForceNetUpdate(false); } } } @@ -1063,9 +985,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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); + npc.ForceNetUpdate(); return; } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs index 33e2529e3d..7dfb5557da 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs @@ -74,18 +74,21 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs calamityGlobalNPC.newAI[1] = 1f; } + // CIT 14SEP2024: Fixed bug where her phases would get offset by dealing a large amount of damage in a single hit to take her into a new phase. + // newAI[0] now starts at 1 and has 0.3 subtracted from it for each phase, instead of it storing her current health when she enters a new phase. + // Do bullet hell or spawn brothers if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = npc.lifeMax; + calamityGlobalNPC.newAI[0] = 1f; // 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]) + if (((npc.life + calClonePhaseThreshold) / (float)npc.lifeMax) < calamityGlobalNPC.newAI[0]) { - calamityGlobalNPC.newAI[0] = npc.life; - if (calamityGlobalNPC.newAI[0] <= npc.lifeMax * 0.1) + calamityGlobalNPC.newAI[0] -= 0.3f; + if (calamityGlobalNPC.newAI[0] <= 0.1f) { SoundEngine.PlaySound(SoundID.Item109, npc.Center); calamityGlobalNPC.newAI[2] = 2f; @@ -95,7 +98,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs SpawnDust(); } - else if (calamityGlobalNPC.newAI[0] <= npc.lifeMax * 0.4) + else if (calamityGlobalNPC.newAI[0] <= 0.4f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -382,7 +385,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - float projSpeed = bossRush ? 5f : 4f; + float projSpeed = bossRush ? 4.5f : 4f; if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) { float distance = Main.rand.NextBool() ? -1000f : 1000f; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs index 203ecf35ff..cac49fe66f 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs @@ -230,7 +230,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { int damageAmt = npc.lifeMax / 200; npc.life -= damageAmt; - npc.HealEffect(-damageAmt, true); + npc.DamageEffect(damageAmt); } if (npc.life <= ((npc.lifeMax / 200) * 5) && !npc.ModNPC().playedbuildsound) @@ -391,7 +391,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Destroy all Dark Energies if their total HP is below 20% int darkEnergyMaxHP = bossRush ? DarkEnergy.MaxBossRushHP : DarkEnergy.MaxHP; //These are still needed so that CV Dark energy despawn works properly - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; darkEnergyMaxHP += (int)(darkEnergyMaxHP * HPBoost); int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs index ad6d55af05..abd55657ee 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs @@ -69,10 +69,10 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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(); + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); else if (!Main.raining && !BossRushEvent.BossRushActive) - CalamityUtils.StartRain(); + CalamityWorld.StartRain(); // Adjust stats int setDamage = npc.defDamage; @@ -213,7 +213,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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) + if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < 2800f) SoundEngine.PlaySound(OldDuke.OldDuke.HuffSound with { Volume = OldDuke.OldDuke.HuffSound.Volume * 1.25f }, Main.LocalPlayer.Center); if (Main.zenithWorld) @@ -255,7 +255,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (Main.remixWorld) { enrage = !bossRush && - (player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.Y < Main.UnderworldLayer * 16 * 0.8f || player.position.Y > Main.UnderworldLayer * 16 || (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); } diff --git a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs b/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs index 0d84546947..f0ec92c278 100644 --- a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs +++ b/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs @@ -322,7 +322,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs Dust.NewDust(npc.position, npc.width, npc.height, DustID.Water, 0f, -1f, 0, default, 1f); } } - if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + if (npc.type == ModContent.NPCType()) { for (int k = 0; k < 5; k++) { @@ -521,19 +521,18 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.noGravity = true; if (npc.direction == 0) - { - npc.TargetClosest(true); - } + npc.TargetClosest(); + 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) { @@ -542,50 +541,49 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs if (target.wet && !target.dead) { hasWetTarget = true; - npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up + 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 + 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)) + 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 + 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); + npc.TargetClosest(false); target = Main.player[npc.target]; } + if (npc.collideX) { - npc.velocity.X = npc.velocity.X * -1f; + npc.velocity.X *= -1f; npc.direction *= -1; npc.netUpdate = true; } + if (npc.collideY) { npc.netUpdate = true; @@ -606,8 +604,9 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs if (hasWetTarget && passiveness != 2) { - npc.TargetClosest(true); + npc.TargetClosest(); target = Main.player[npc.target]; + // Swim away from the player if (passiveness == 3) { @@ -620,6 +619,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs 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); @@ -679,72 +679,60 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } // Sea Minnows face away from the player - if (npc.type == ModContent.NPCType()) - { + if (npc.type == ModContent.NPCType() || 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; - } + npc.velocity.Y *= 0.95f; } else { // Out of water behavior if (npc.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; + 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; + + 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); diff --git a/NPCs/CalamityDrawParameterNPC.cs b/NPCs/CalamityDrawParameterNPC.cs new file mode 100644 index 0000000000..ca630f4f02 --- /dev/null +++ b/NPCs/CalamityDrawParameterNPC.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.ExoMechs.Ares; +using Steamworks; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs +{ + // Why this class is exist? + // It because we want to avoid Threading Issues while We using NPC's properties on Draw Thread + public sealed class CalamityDrawParameterNPC : GlobalNPC + { + public override bool InstancePerEntity => false; + + #region Draw Parameters + public static bool[] DrawingMiracleBlight { get; private set; } + public static bool[] DrawingPolarity { get; private set; } + #endregion + + #region Filtering Fields + public static List MiracleBlightExcludedNPCs => new() + { + // List the reason why the NPC(s) are excluded :) + + // The particle sets break with the visuals and this is the easiest way to fix this that isn't stupidly complex. + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + + // Breaks with being behind tiles, and causes a funny interaction where his head goes behind his neck. + NPCID.MoonLordCore, + NPCID.MoonLordHand, + NPCID.MoonLordHead + }; + #endregion + + #region Load / Unload + public override void Load() + { + DrawingMiracleBlight = new bool[Main.maxNPCs]; + DrawingPolarity = new bool[Main.maxNPCs]; + } + + public override void Unload() + { + DrawingMiracleBlight = null; + DrawingPolarity = null; + } + #endregion + + public override void SetDefaults(NPC entity) => ResetParameters(entity); + public override bool PreAI(NPC npc) + { + if (npc is null) + return true; + + var whoAmI = npc.whoAmI; + DrawingMiracleBlight[whoAmI] = ShouldDrawMiracleBlight(npc); + DrawingPolarity[whoAmI] = ShouldDrawPolarity(npc); + + return true; + } + + public static void ResetParameters(NPC npc) + { + if (npc is null) + return; + + var whoAmI = npc.whoAmI; + DrawingMiracleBlight[whoAmI] = false; + DrawingPolarity[whoAmI] = false; + } + + public static bool ShouldDrawMiracleBlight(NPC npc) + { + if (npc is null || !npc.active) + return false; + + // Do not draw weird MP types less than or equal to 0. + if (npc.type <= NPCID.None) + return false; + + // Do not draw other mod's bosses. + if (npc.ModNPC != null && npc.ModNPC.Mod != CalamityMod.Instance && npc.boss) + return false; + + // Don't draw excluded NPCs, or if the npc is a bestiary dummy. + if (MiracleBlightExcludedNPCs.Contains(npc.type) || npc.IsABestiaryIconDummy) + return false; + + // Safety check for weird MP bug when getting global npcs. + if (!npc.TryGetGlobalNPCSafer(out var calNPC) || !npc.TryGetGlobalNPCSafer(out var polNPC)) + return false; + + // Do not draw if the npc does not have miracle blight, or has the polarity effect. + if (calNPC.miracleBlight <= 0 || polNPC.CurPolarity > 0f) + return false; + + // Do not draw if the current player has the trippy effect. + if (Main.LocalPlayer.Calamity().trippy) + return false; + + return true; + } + + public static bool ShouldDrawPolarity(NPC npc) + { + if (npc is null || !npc.active) + return false; + + // Safety check for weird MP bug when getting global npcs. + if (!npc.TryGetGlobalNPCSafer(out var calNPC) || !npc.TryGetGlobalNPCSafer(out var polNPC)) + return false; + + // I don't know who would be using this while also inflicting miracle blight, but in that rare case, do not draw these. + if (calNPC.miracleBlight > 0) + return false; + + // Do not draw if the npc doesn't have the polarity effect. + if (polNPC.CurPolarity <= 0f) + return false; + + return true; + } + } +} diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index fad87e4254..c41a0f55c1 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3,18 +3,24 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using CalamityMod.Balancing; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.ExtraTextures; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Renderers.CalamityRenderers; +using CalamityMod.Items; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Typeless; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; @@ -35,6 +41,7 @@ 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.PlagueEnemies; using CalamityMod.NPCs.Polterghast; @@ -44,18 +51,21 @@ using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; +using CalamityMod.Packets; using CalamityMod.Particles; using CalamityMod.Projectiles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.UI; @@ -65,18 +75,20 @@ using CalamityMod.World; using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using MonoMod.Utils; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent; using Terraria.GameContent.Achievements; +using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; -using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; +using Terraria.UI.Chat; using Terraria.Utilities; using static Terraria.ModLoader.ModContent; @@ -85,15 +97,21 @@ namespace CalamityMod.NPCs public partial class CalamityGlobalNPC : GlobalNPC { #region Variables + + /// Data structure used for storing Calamity's intended boss kill times. + public static SortedDictionary BossKillTimes; + + /// Data structure used for storing the damage reduction values of NPCs. + public static SortedDictionary DRValues { get; set; } + + /// Damage Reduction Value public float DR { get; set; } = 0f; - /// - /// If this is set to true, the NPC's DR cannot be reduced via any means. This applies regardless of whether customDR is true or false. - /// + /// If set to true, the NPC's damage reduction cannot be reduced via any means. This applies regardless of whether is true or false. public bool unbreakableDR = false; /// - /// Overrides the normal DR math and uses custom DR reductions for each debuff, registered separately.

+ /// Overrides the normal DR math and uses custom DR reductions for each debuff, registered separately.
/// Used primarily by post-Moon Lord bosses. ///
public bool customDR = false; @@ -102,110 +120,150 @@ namespace CalamityMod.NPCs public int KillTime { get; set; } = 0; - public const int DoGPhase1KillTime = 5400; - - // Debuff Vulnerabilities - // null = neutral, true = vulnerable, false = resistant - // neutral = 100% effective, vulnerable = 400% effective DoT and 200% effective non-DoT effects (within reason, some aren't exactly 200% more effective), resistant = 50% effective + /// + /// Controls the effectiveness of heat debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToHeat = null; + /// + /// Controls the effectiveness of cold debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToCold = null; + /// + /// Controls the effectiveness of sickness debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToSickness = null; + /// + /// Controls the effectiveness of electricity debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToElectricity = null; + /// + /// Controls the effectiveness of water debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToWater = null; public const double BaseDoTDamageMult = 1D; public const double VulnerableToDoTDamageMult = 2D; public const double VulnerableToDoTDamageMult_Worms_SlimeGod = 1.5; + public const double ResistantToDoTDamageMult = 0.5; // Cold debuff effects public bool IncreasedColdEffects_EskimoSet = false; public bool IncreasedColdEffects_FrozenWings = false; public bool IncreasedColdEffects_CryoStone = false; - // Transformer effect - public bool IncreasedElectricityEffects_Transformer = false; + // Electric effects + public bool IncreasedElectricityEffects_Unused = false; // Heat debuff effects public bool IncreasedHeatEffects_Fireball = false; public bool IncreasedHeatEffects_CinnamonRoll = false; - public bool IncreasedHeatEffects_FlameWakerBoots = false; - public bool IncreasedHeatEffects_HellfireTreads = false; + public int IncreasedHeatEffects_FireBoots = 0; + public bool IncreasedHeatEffects_FlameWings = false; // Toxic Heart effect public bool IncreasedSicknessEffects_ToxicHeart = false; - // Evergreen Gin effect - public bool IncreasedSicknessAndWaterEffects_EvergreenGin = false; + // Amulets effects + public bool IncreasedWaterEffects_Amulet1 = false; + public bool IncreasedWaterEffects_Amulet2 = false; - // Biome enrage timer max + // Sickness and Water debuff effects + public bool IncreasedSicknessAndWaterEffects_EvergreenGin = false; + public bool IncreasedSicknessAndWaterEffects_CorrosiveSpine = false; + + /// Constant variable representing the grace period, in frames, in which a boss can remain outside of its native biome before enraging. public const int biomeEnrageTimerMax = 300; - // Variable for certain worm bosses used to prevent them from moving too fast upon swapping phases while far away from their target - // Currently only used by DoG + /// + /// Variable for worm bosses used to prevent them from moving too fast upon swapping phases while far away from their target.
+ /// Currently only used by DoG. + ///
public float velocityPriorToPhaseSwap = 0f; public const float velocityPriorToPhaseSwapIncrement = 0.1f; public bool ShouldFallThroughPlatforms; - /// - /// Allows hostile NPCs to deal damage to the player's defense stat, used mostly for hard-hitting bosses. - /// + /// Allows hostile NPCs to deal defense damage to the player, used mostly for hard-hitting bosses. public bool canBreakPlayerDefense = false; - // Total defense loss from some true melee hits and other things that reduce defense + /// Set this value to reduce target defense by a flat amount. public int miscDefenseLoss = 0; - // Distance values for when bosses increase velocity to catch up to their target + /// + /// Constant representing a distance of 200 tiles in pixel measurement.
+ /// Used by bosses to increase their velocity in order to catch up to their target. + ///
public const float CatchUpDistance200Tiles = 3200f; + /// + /// Constant representing a distance of 350 tiles in pixel measurement.
+ /// Used by bosses to increase their velocity in order to catch up to their target. + ///
public const float CatchUpDistance350Tiles = 5600f; + /// + /// Constant representing a distance of 400 tiles in pixel measurement.
+ /// Used as a cap on the distance away from a boss a player can be inflicted with Boss Effects. + ///
+ private const float BossZenDistance = 6400f; /// - /// Destroyer laser colors, used for telegraphs + /// 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 + /// Constant multiplier used to increase vanilla enemy health. + private const double EnemyHPMultiplier = 1.25; + /// Constant multiplier used to decrease the health and/or damage of pre-Hardmode Desert enemies. private const double DesertEnemyStatMultiplier = 0.75; - - // Used to nerf Master Mode boss HP (base is 27.5% more than Expert) + /// + /// Constant multiplier used to decrease vanilla boss health in Master Mode.
+ /// When combined with the universal health multiplier, results in 27.5% more health than Expert Mode. + ///
public const double MasterModeBossHPMultiplier = 0.85; - // Used to nerf Master Mode enemies + /// Constant multiplier used to decrease enemy health in Master Mode. public const double MasterModeEnemyHPMultiplier = 0.75; + /// Constant multiplier used to decrease enemy damage in Master Mode. public const double MasterModeEnemyDamageMultiplier = 0.9; - - // Used to nerf Expert and Master Mode enemies + /// Constant multiplier used to decrease enemy knockback resistance. public const float ExpertModeEnemyKnockbackMultiplier = 0.05f; + /// public const float MasterModeEnemyKnockbackMultiplier = 0.1f; - // HP and damage multipliers for the Early Hardmode Progression Rework + /// Constant multiplier used for decreasing the health and damage of mechanical bosses if the Early Hardmode Progression Rework config is enabled. 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; - - // Used to decrease coin drops in Expert Mode + /// Constant multiplier used to increase coin drops in Classic Mode. + private const double NPCValueMultiplier_ClassicCalamity = 1.5; + /// Constant multiplier used to decrease coin drops in Expert Mode. private const double NPCValueMultiplier_ExpertVanilla = 2.5; - - // Used to change the Expert Mode coin drop multiplier + /// private const double NPCValueMultiplier_ExpertCalamity = 1.5; // Dash damage immunity timer public const int maxPlayerImmunities = Main.maxPlayers + 1; public int[] dashImmunityTime = new int[maxPlayerImmunities]; - // Town NPC shop alert animation variables + /// Used to control the animation of the Town NPC Shop Alert icon, if the respective config is enabled. public int shopAlertAnimTimer = 0; + /// public int shopAlertAnimFrame = 0; - // Set to false for this NPC to be unable to generate proximity Rage, regardless of other factors + /// + /// If set to false, prevents this NPC from allowing Rage to be generated by nearby players, regardless of other factors.
+ /// Defaults to true. + ///
public bool ProvidesProximityRage = true; // NewAI @@ -213,28 +271,21 @@ namespace CalamityMod.NPCs public float[] newAI = new float[maxAIMod]; public int AITimer = 0; - // Town NPC Patreon + /// Used for allowing Patreon names for Town NPCs. public bool setNewName = true; - // Stuff used by the Boss Health UI + /// If set to true, the Boss Health Bar for this NPC will count the total health of all individual segments using worm segment logic. public bool SplittingWorm = false; + /// If set to true, allows this NPC to draw a Boss Health Bar, regardless of other factors. public bool CanHaveBossHealthBar = false; + /// If set to true, allows for manually disabling this NPC's Boss Health Bar, even if they are still active. public bool ShouldCloseHPBar = false; - // Timer for how long an NPC is immune to certain debuffs + /// Constant representing the cooldown, in frames, before a boss can be affected by a slowing debuff. public const int slowingDebuffResistanceMin = 1800; + /// Tracks the current slowing debuff cooldown for this NPC. public int debuffResistanceTimer = 0; - // If a boss is affected by knockback and a timer for how long that boss is immune to knockback after being knocked back - public bool bossCanBeKnockedBack = false; - public const int knockbackResistanceMin = 180; - public int knockbackResistanceTimer = 0; - - // Used for NPCs affected by vanilla Cobalt/Mythril weapons - public const int cobaltAndMythrilNerfTime = 600; - public int cobaltNerfTimer = 0; - public int mythrilNerfTimer = 0; - // Debuffs public int vaporfied = 0; public int timeSlow = 0; @@ -246,33 +297,74 @@ namespace CalamityMod.NPCs public int slowed = 0; public int electrified = 0; public int pearlAura = 0; + /// + /// Counter variable that increments while the NPC is inflicted with Pearl Aura.
+ /// Used to determine when Giant Pearl's pearl shards should rain down onto the NPC. + ///
+ public int pearlAuraCounter = 0; + /// + /// When an NPC is inflicted with Pearl Aura, this variable is set to index of the player who inflicted it.
+ /// Used for properly counting pearl shard amount and for giving pearl shards an owner. + ///
+ public int pearlAuraOwner = -1; public int bBlood = 0; public int brainRot = 0; + public int heavybleeding = 0; public int laceration = 0; public int elementalMix = 0; public int marked = 0; public int absorberAffliction = 0; public int irradiated = 0; public int bFlames = 0; + public int demonicFlames = 0; + public int demonicFlamesBonusDamage = 0; public int hFlames = 0; + /// Plague debuff. public int pFlames = 0; public int aCrunch = 0; public int crumble = 0; + public int antlionCloudDebuffTimer = 0; + public int warbannerBurnTime = 0; // Determines the rate that the enemy is damaged + public int warbannerBurnTimer = 0; // The duration of the debuff + public int warbannerBurnStacks = 0; // The stacks increase how fast the debuff hits + public int warbannerBurnDamage = 0; // Damage of the hits based on player's damage + public Vector2 warbannerBurnDirection; + public float warbannerBurnIntensity = 0; + public bool warbannerBurnMarked = false; + public bool warbannerBurnHideEffects = false; + /// Constant variable representing the delay, in frames, before Verium Bolt's extra damage applies. public const int veriumDoomTime = 90; public int veriumDoomTimer = 0; public int veriumDoomStacks = 0; public bool veriumDoomMarked = false; + /// + /// Tracks the strength of Calamity's cursor effect; increments by 2 on every frame.
+ /// If this value reaches , the enemy is afflicted with True Vulnerability Hex. + ///
+ public int cursorFocus = 0; + public const int cursorFocusMax = 300; + public int demonSwordImpales = 0; + public int impalePacketTimer = 0; + + /// + /// If set to true, prevents this NPC from dealing contact damage.
+ /// Used by Septic Skewer's execution attack. + ///
+ public bool pacified = 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 + /// Tracks how many stacks of the Shred debuff this NPC is inflicted with. public int somaShredStacks = 0; + /// Tracks the index of the player that inflicted this NPC with Shred, for the purpose of scaling damage. public int somaShredApplicator = -1; - // Reduced by the number of active stacks every frame. If it hits zero, one stack disappears. + /// Counter used for removing stacks of Shred. The number of stacks is subtracted every frame, and when it hits zero, it is reset and one stack is removed. public int somaShredFalloff = Shred.StackFalloffFrames; public int cDepth = 0; public int rTide = 0; + public int hPressure = 0; public int gsInferno = 0; public int dragonFire = 0; public int vermillionFlux = 0; @@ -282,20 +374,29 @@ namespace CalamityMod.NPCs public int astralInfection = 0; public int wDeath = 0; public int nightwither = 0; + /// If greater than 0, this NPC has been "shocked" by Amidias' Spark's on hurt effect. + public int shocked = 0; + public int voidfrost = 0; public int shellfishVore = 0; public int clamDebuff = 0; public int sulphurPoison = 0; + /// If greater than 0, makes this NPC constantly spawn heart gores. public int ladHearts = 0; public int kamiFlu = 0; - public int relicOfResilienceCooldown = 0; public int relicOfResilienceWeakness = 0; + /// Cooldown variable for spawning Gauss Dagger's gauss flux projectiles. public int GaussFluxTimer = 0; public int sagePoisonTime = 0; public int sagePoisonDamage = 0; public int vulnerabilityHex = 0; + public int trueVulnerabilityHex = 0; public int banishingFire = 0; public int wither = 0; - public int RancorBurnTime = 0; + /// + /// If greater than 0, this enemy will appear to disintegrate into ash when killed.
+ /// Used by Rancor's laser beam. + ///
+ public int ashesOnDeath = 0; // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; @@ -356,28 +457,35 @@ namespace CalamityMod.NPCs // Drawing variables. public FireParticleSet VulnerabilityHexFireDrawer = null; - // Boss Enrage variable for use with the boss health UI. - // The logic behind this is as follows: - // 1 - For special cases with super-enrages (specifically Yharon/SCal with their arenas), go solely based on whether that enrage is active. That information is most important to the player. - // 2 - Otherwise, check if the demonshade enrage is active. If it is, register this as true. If not, go to step 3. - // 3 - Check if a specific enrage condition (such as Duke Fishron's Ocean check) is met. If it is, and Boss Rush is not active, set this to true. If not, go to step 4. - // 4 - Check if Boss Rush isn't active. If so, set this to true. + /// + /// Boss Enrage variable for use with the boss health UI.
+ /// The logic behind this is as follows: + /// 1 - For special cases with super-enrages (specifically Yharon/SCal with their arenas), go solely based on whether that enrage is active. That information is most important to the player. + /// 2 - Check if the Demonshade enrage is active. If it is, register this as true. If not, go to step 3. + /// 3 - Check if a specific enrage condition (such as Duke Fishron's Ocean check) is met. If it is, and Boss Rush is not active, set this to true. If not, go to step 4. + /// 4 - Check if Boss Rush isn't active. If so, set this to true. + ///
public bool CurrentlyEnraged; - // Increased defense or DR variable for use with the boss health UI. - // The logic behind this is as follows: - // 1 - When bosses are transitioning phases they gain a massive DR increase. - // 2 - When bosses are using certain attacks that make them particularly vulnerable they gain a massive DR or defense increase. + /// + /// Increased defense or DR variable for use with the boss health UI.
+ /// The logic behind this is as follows: + /// 1 - When bosses are transitioning phases they gain a massive DR increase. + /// 2 - When bosses are using certain attacks that make them particularly vulnerable they gain a massive DR or defense increase. + /// While either of these are occuring, this variable should be set to true. + ///
public bool CurrentlyIncreasingDefenseOrDR; - // Other Boss Rush stuff + /// If set to true, this NPC will be ignored by Boss Rush's whitelist and will always be allowed to exist. public bool DoesNotDisappearInBossRush; - // On-Kill variables + /// Variable used for Gladiator's Locket's on-kill effect to ensure it only triggers once per kill. public bool gladiatorOnKill = true; - - // Variable for if enemy has been recently hit by an ArcZap + /// Cooldown variable for Unstable Granite Core's arc zap effect. public int arcZapCooldown = 0; + + /// Timer for animating worm enemies in the bestiary. + public float bestiaryWormTimer = 0; #endregion #region Instance Per Entity and TML 1.4 Cloning @@ -414,12 +522,15 @@ namespace CalamityMod.NPCs myClone.IncreasedColdEffects_EskimoSet = IncreasedColdEffects_EskimoSet; myClone.IncreasedColdEffects_FrozenWings = IncreasedColdEffects_FrozenWings; myClone.IncreasedColdEffects_CryoStone = IncreasedColdEffects_CryoStone; - myClone.IncreasedElectricityEffects_Transformer = IncreasedElectricityEffects_Transformer; + myClone.IncreasedElectricityEffects_Unused = IncreasedElectricityEffects_Unused; myClone.IncreasedHeatEffects_Fireball = IncreasedHeatEffects_Fireball; myClone.IncreasedHeatEffects_CinnamonRoll = IncreasedHeatEffects_CinnamonRoll; - myClone.IncreasedHeatEffects_FlameWakerBoots = IncreasedHeatEffects_FlameWakerBoots; - myClone.IncreasedHeatEffects_HellfireTreads = IncreasedHeatEffects_HellfireTreads; + myClone.IncreasedHeatEffects_FireBoots = IncreasedHeatEffects_FireBoots; + myClone.IncreasedHeatEffects_FlameWings = IncreasedHeatEffects_FlameWings; myClone.IncreasedSicknessEffects_ToxicHeart = IncreasedSicknessEffects_ToxicHeart; + myClone.IncreasedWaterEffects_Amulet1 = IncreasedWaterEffects_Amulet1; + myClone.IncreasedWaterEffects_Amulet2 = IncreasedWaterEffects_Amulet2; + myClone.IncreasedSicknessAndWaterEffects_CorrosiveSpine = IncreasedSicknessAndWaterEffects_CorrosiveSpine; myClone.IncreasedSicknessAndWaterEffects_EvergreenGin = IncreasedSicknessAndWaterEffects_EvergreenGin; myClone.velocityPriorToPhaseSwap = velocityPriorToPhaseSwap; @@ -454,12 +565,6 @@ namespace CalamityMod.NPCs myClone.debuffResistanceTimer = debuffResistanceTimer; - myClone.bossCanBeKnockedBack = bossCanBeKnockedBack; - myClone.knockbackResistanceTimer = knockbackResistanceTimer; - - myClone.cobaltNerfTimer = cobaltNerfTimer; - myClone.mythrilNerfTimer = mythrilNerfTimer; - myClone.vaporfied = vaporfied; myClone.timeSlow = timeSlow; myClone.gState = gState; @@ -470,22 +575,40 @@ namespace CalamityMod.NPCs myClone.slowed = slowed; myClone.electrified = electrified; myClone.pearlAura = pearlAura; + myClone.pearlAuraCounter = pearlAuraCounter; myClone.bBlood = bBlood; myClone.brainRot = brainRot; + myClone.heavybleeding = heavybleeding; myClone.laceration = laceration; myClone.elementalMix = elementalMix; myClone.marked = marked; myClone.absorberAffliction = absorberAffliction; myClone.irradiated = irradiated; myClone.bFlames = bFlames; + myClone.demonicFlames = demonicFlames; + myClone.demonicFlamesBonusDamage = demonicFlamesBonusDamage; myClone.hFlames = hFlames; myClone.pFlames = pFlames; myClone.aCrunch = aCrunch; myClone.crumble = crumble; + myClone.antlionCloudDebuffTimer = antlionCloudDebuffTimer; + myClone.warbannerBurnTime = warbannerBurnTime; + myClone.warbannerBurnTimer = warbannerBurnTimer; + myClone.warbannerBurnStacks = warbannerBurnStacks; + myClone.warbannerBurnDamage = warbannerBurnDamage; + myClone.warbannerBurnDirection = warbannerBurnDirection; + myClone.warbannerBurnIntensity = warbannerBurnIntensity; + myClone.warbannerBurnMarked = warbannerBurnMarked; + myClone.warbannerBurnHideEffects = warbannerBurnHideEffects; myClone.veriumDoomTimer = veriumDoomTimer; myClone.veriumDoomStacks = veriumDoomStacks; myClone.veriumDoomMarked = veriumDoomMarked; + myClone.cursorFocus = cursorFocus; + myClone.demonSwordImpales = demonSwordImpales; + myClone.impalePacketTimer = impalePacketTimer; + + myClone.pacified = pacified; myClone.somaShredStacks = somaShredStacks; myClone.somaShredApplicator = somaShredApplicator; @@ -493,6 +616,7 @@ namespace CalamityMod.NPCs myClone.cDepth = cDepth; myClone.rTide = rTide; + myClone.hPressure = hPressure; myClone.gsInferno = gsInferno; myClone.miracleBlight = miracleBlight; myClone.dragonFire = dragonFire; @@ -502,20 +626,22 @@ namespace CalamityMod.NPCs myClone.astralInfection = astralInfection; myClone.wDeath = wDeath; myClone.nightwither = nightwither; + myClone.shocked = shocked; + myClone.voidfrost = voidfrost; myClone.shellfishVore = shellfishVore; myClone.clamDebuff = clamDebuff; myClone.sulphurPoison = sulphurPoison; myClone.ladHearts = ladHearts; myClone.kamiFlu = kamiFlu; - myClone.relicOfResilienceCooldown = relicOfResilienceCooldown; myClone.relicOfResilienceWeakness = relicOfResilienceWeakness; myClone.GaussFluxTimer = GaussFluxTimer; myClone.sagePoisonTime = sagePoisonTime; myClone.sagePoisonDamage = sagePoisonDamage; myClone.vulnerabilityHex = vulnerabilityHex; + myClone.trueVulnerabilityHex = trueVulnerabilityHex; myClone.banishingFire = banishingFire; myClone.wither = wither; - myClone.RancorBurnTime = RancorBurnTime; + myClone.ashesOnDeath = ashesOnDeath; // This gets set up as needed. myClone.VulnerabilityHexFireDrawer = null; @@ -635,7 +761,8 @@ namespace CalamityMod.NPCs npc.AddBuff(BuffType(), 2); } - // Special venom debuff case for the Lionfish and certain other projectiles. + #region Stacking Debuff Effects + // Lionfish, Leviathan Teeth, and Jaws of Oblivion debuff stacking if (npc.venom) { if (npc.lifeRegen > 0) @@ -660,6 +787,7 @@ namespace CalamityMod.NPCs } } + // Bonebreaker debuff stacking if (npc.javelined) { if (npc.lifeRegen > 0) @@ -684,6 +812,7 @@ namespace CalamityMod.NPCs } } + // Shellfish Staff (and Mollusk armor) debuff stacking if (shellfishVore > 0) { int projectileCount = 0; @@ -713,6 +842,7 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(projectileCount * totalDamage, projectileCount * totalDisplayedDamage, ref npc.lifeRegen, ref damage); } + // Snap Clam debuff stacking if (clamDebuff > 0) { int projectileCount = 0; @@ -730,6 +860,7 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(projectileCount * 15, projectileCount * 3, ref npc.lifeRegen, ref damage); } + // Parasitic Scepter debuff stacking if (irradiated > 0) { int projectileCount = 0; @@ -747,62 +878,27 @@ namespace CalamityMod.NPCs else ApplyDPSDebuff(20, 4, ref npc.lifeRegen, ref damage); } - - // Glacial State and Temporal Sadness don't work on normal/expert Queen Bee. - if (debuffResistanceTimer <= 0 || (debuffResistanceTimer > slowingDebuffResistanceMin)) - { - if (npc.type != NPCID.QueenBee || CalamityWorld.revenge || BossRushEvent.BossRushActive) - { - float baseXVelocityMult = 0.9f; - float baseYVelocityIncrease = 0.05f; - if (VulnerableToCold.HasValue) - { - if (VulnerableToCold.Value) - { - baseXVelocityMult = 0.5f; - baseYVelocityIncrease = 0.2f; - } - else - { - baseXVelocityMult = 0.98f; - baseYVelocityIncrease = 0.01f; - } - } - - if (gState > 0) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - npc.velocity.X *= baseXVelocityMult; - npc.velocity.Y += baseYVelocityIncrease * 0.5f; - if (npc.velocity.Y > 15f) - npc.velocity.Y = 15f; - } - else - { - npc.velocity *= baseXVelocityMult; - } - } - else if (tSad > 0) - npc.velocity *= 0.5f; - } - } + #endregion // Debuff vulnerabilities and resistances. // Damage multiplier calcs. // Worms that are vulnerable to debuffs and Slime God slimes take reduced damage from vulnerabilities. - bool wormBoss = CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || CalamityLists.PerforatorIDs.Contains(npc.type) || - CalamityLists.AquaticScourgeIDs.Contains(npc.type) || CalamityLists.AstrumDeusIDs.Contains(npc.type) || CalamityLists.StormWeaverIDs.Contains(npc.type); - bool slimeGod = CalamityLists.SlimeGodIDs.Contains(npc.type); + #region Debuff System Multiplier Calculations + bool wormBoss = DesertScourgeIDList.Includes(npc.type) || EaterOfWorldsIDList.Includes(npc.type) || PerforatorWormIDList.Includes(npc.type) || + AquaticScourgeIDList.Includes(npc.type) || AstrumDeusIDList.Includes(npc.type) || StormWeaverIDList.Includes(npc.type); + bool slimeGod = SlimeGodIDList.Includes(npc.type); bool slimed = npc.drippingSlime || npc.drippingSparkleSlime; + bool wetReducedEffectiveness = npc.wet || npc.honeyWet || npc.dripping; double heatDamageMult = slimed ? ((wormBoss || slimeGod) ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; + if (wetReducedEffectiveness) + heatDamageMult *= wormBoss || slimeGod ? 0.66 : ResistantToDoTDamageMult; if (VulnerableToHeat.HasValue) { if (VulnerableToHeat.Value) heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 1.25 : 1.5) : ((wormBoss || slimeGod) ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); else - heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 0.66 : 0.5) : 0.5; + heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 0.66 : ResistantToDoTDamageMult) : ResistantToDoTDamageMult; } double coldDamageMult = BaseDoTDamageMult; @@ -811,7 +907,7 @@ namespace CalamityMod.NPCs if (VulnerableToCold.Value) coldDamageMult *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else - coldDamageMult *= 0.5; + coldDamageMult *= ResistantToDoTDamageMult; } double sicknessDamageMult = irradiated > 0 ? (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; @@ -820,7 +916,7 @@ namespace CalamityMod.NPCs if (VulnerableToSickness.Value) sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 1.25 : 1.5) : (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); else - sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 0.66 : 0.5) : 0.5; + sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 0.66 : ResistantToDoTDamageMult) : ResistantToDoTDamageMult; } bool increasedElectricityDamage = npc.wet || npc.honeyWet || npc.lavaWet || npc.dripping; @@ -830,7 +926,7 @@ namespace CalamityMod.NPCs if (VulnerableToElectricity.Value) electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 1.25 : 1.5) : (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); else - electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 0.66 : 0.5) : 0.5; + electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 0.66 : ResistantToDoTDamageMult) : ResistantToDoTDamageMult; } double waterDamageMult = BaseDoTDamageMult; @@ -839,7 +935,7 @@ namespace CalamityMod.NPCs if (VulnerableToWater.Value) waterDamageMult *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else - waterDamageMult *= 0.5; + waterDamageMult *= ResistantToDoTDamageMult; } if (IncreasedColdEffects_EskimoSet) @@ -849,32 +945,128 @@ namespace CalamityMod.NPCs if (IncreasedColdEffects_CryoStone) coldDamageMult += 0.5; - if (IncreasedElectricityEffects_Transformer) + if (IncreasedElectricityEffects_Unused) electricityDamageMult += 0.5; if (IncreasedHeatEffects_Fireball) - heatDamageMult += 0.25; - if (IncreasedHeatEffects_FlameWakerBoots) - heatDamageMult += 0.25; + heatDamageMult += Fireball.HeatDebuffBoost; + if (IncreasedHeatEffects_FireBoots > 0) + heatDamageMult += 0.25 * IncreasedHeatEffects_FireBoots; if (IncreasedHeatEffects_CinnamonRoll) - heatDamageMult += 0.5; - if (IncreasedHeatEffects_HellfireTreads) - heatDamageMult += 0.5; + heatDamageMult += CinnamonRoll.HeatDebuffBoost; + if (IncreasedHeatEffects_FlameWings) + heatDamageMult += 0.25; if (IncreasedSicknessEffects_ToxicHeart) sicknessDamageMult += 0.5; - if (IncreasedSicknessAndWaterEffects_EvergreenGin) + if (IncreasedWaterEffects_Amulet1) + waterDamageMult += 0.35; + if (IncreasedWaterEffects_Amulet2) + waterDamageMult += 0.75; + + if (IncreasedSicknessAndWaterEffects_CorrosiveSpine) { sicknessDamageMult += 0.25; waterDamageMult += 0.25; } + if (IncreasedSicknessAndWaterEffects_EvergreenGin) + { + sicknessDamageMult += EvergreenGin.SicknessWaterDebuffBoost; + waterDamageMult += EvergreenGin.SicknessWaterDebuffBoost; + } // Subtract 1 for the vanilla damage multiplier because it's already dealing DoT in the vanilla regen code. double vanillaHeatDamageMult = heatDamageMult - BaseDoTDamageMult; double vanillaColdDamageMult = coldDamageMult - BaseDoTDamageMult; double vanillaSicknessDamageMult = sicknessDamageMult - BaseDoTDamageMult; + #endregion + // Oiled + bool hasColdOil = npc.onFrostBurn || npc.onFrostBurn2; + bool hasHotOil = npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame; + bool hasModHotOil = bFlames > 0 || demonicFlames > 0 || hFlames > 0 || gsInferno > 0 || dragonFire > 0 || banishingFire > 0 || vulnerabilityHex > 0; + if (npc.oiled && (hasColdOil || hasHotOil || hasModHotOil)) + { + double multiplier = 1D; + if (hasColdOil) + multiplier *= vanillaColdDamageMult; + if (hasHotOil || (hasModHotOil && hasColdOil)) + multiplier *= vanillaHeatDamageMult; + if (hasModHotOil && !hasColdOil && !hasHotOil) + multiplier *= heatDamageMult; + + int baseOiledDoTValue = (int)(50 * multiplier); + npc.lifeRegen -= baseOiledDoTValue; + if (damage < baseOiledDoTValue / 4) + damage = baseOiledDoTValue / 4; + } + + #region Cold Debuffs + // Frostburn + if (npc.onFrostBurn) + { + int baseFrostBurnDoTValue = (int)(16 * vanillaColdDamageMult); + npc.lifeRegen -= baseFrostBurnDoTValue; + if (damage < baseFrostBurnDoTValue / 4) + damage = baseFrostBurnDoTValue / 4; + } + + // Frostbite + if (npc.onFrostBurn2) + { + int baseFrostBiteDoTValue = (int)(50 * vanillaColdDamageMult); + npc.lifeRegen -= baseFrostBiteDoTValue; + if (damage < baseFrostBiteDoTValue / 4) + damage = baseFrostBiteDoTValue / 4; + } + + // Nightwither + if (nightwither > 0) + { + int baseNightwitherDoTValue = (int)(200 * coldDamageMult); + ApplyDPSDebuff(baseNightwitherDoTValue, baseNightwitherDoTValue / 5, ref npc.lifeRegen, ref damage); + } + + // Voidfrost + if (voidfrost > 0) + { + int baseVoidfrostDoTValue = (int)(300 * coldDamageMult); + ApplyDPSDebuff(baseVoidfrostDoTValue, baseVoidfrostDoTValue / 5, ref npc.lifeRegen, ref damage); + } + #endregion + + #region Electricity Debuffs + // Static Discharge + if (staticDischarge > 0) + { + int baseStaticDischargeDoTValue = (int)(5 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 24 on moving targets + ApplyDPSDebuff(baseStaticDischargeDoTValue, baseStaticDischargeDoTValue / 15, ref npc.lifeRegen, ref damage); + } + + // Electrified + if (electrified > 0) + { + int baseElectrifiedDoTValue = (int)(21 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 84 on moving targets + ApplyDPSDebuff(baseElectrifiedDoTValue, baseElectrifiedDoTValue / 22, ref npc.lifeRegen, ref damage); + } + + // Vermillion Flux + if (vermillionFlux > 0) + { + int baseVermillionFluxDoTValue = (int)(100 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 400 on moving targets + ApplyDPSDebuff(baseVermillionFluxDoTValue, baseVermillionFluxDoTValue / 40, ref npc.lifeRegen, ref damage); + } + + // Auric Rebuke + if (auricRebuke > 0) + { + int baseAuricRebukeDoTValue = (int)(200 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 800 on moving targets + ApplyDPSDebuff(baseAuricRebukeDoTValue, baseAuricRebukeDoTValue / 70, ref npc.lifeRegen, ref damage); + } + #endregion + + #region Heat Debuffs // On Fire if (npc.onFire) { @@ -884,6 +1076,15 @@ namespace CalamityMod.NPCs damage = baseOnFireDoTValue / 4; } + // Hellfire + if (npc.onFire3) + { + int baseHellfireDoTValue = (int)(30 * vanillaHeatDamageMult); + npc.lifeRegen -= baseHellfireDoTValue; + if (damage < baseHellfireDoTValue / 4) + damage = baseHellfireDoTValue / 4; + } + // Cursed Inferno if (npc.onFire2) { @@ -893,13 +1094,13 @@ namespace CalamityMod.NPCs damage = baseCursedInfernoDoTValue / 4; } - // Hellfire - if (npc.onFire3) + // Shadowflame + if (npc.shadowFlame) { - int baseHellfireDoTValue = (int)(30 * vanillaHeatDamageMult); - npc.lifeRegen -= baseHellfireDoTValue; - if (damage < baseHellfireDoTValue / 4) - damage = baseHellfireDoTValue / 4; + int baseShadowFlameDoTValue = (int)(60 * vanillaHeatDamageMult); + npc.lifeRegen -= baseShadowFlameDoTValue; + if (damage < baseShadowFlameDoTValue / 4) + damage = baseShadowFlameDoTValue / 4; } // Daybroken @@ -927,15 +1128,6 @@ namespace CalamityMod.NPCs damage = baseDaybreakDoTValue / 4; } - // Shadowflame - if (npc.shadowFlame) - { - int baseShadowFlameDoTValue = (int)(60 * vanillaHeatDamageMult); - npc.lifeRegen -= baseShadowFlameDoTValue; - if (damage < baseShadowFlameDoTValue / 4) - damage = baseShadowFlameDoTValue / 4; - } - // Brimstone Flames if (bFlames > 0) { @@ -943,6 +1135,15 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseBrimstoneFlamesDoTValue, baseBrimstoneFlamesDoTValue / 5, ref npc.lifeRegen, ref damage); } + // Demonic Flames + // An unresistable fire debuff that you can set the damage of when it is applied + // This way it can be viable for multiple tiers + if (demonicFlames > 0) + { + int baseDemonicFlamesDoTValue = (int)((demonicFlamesBonusDamage) * Math.Max(heatDamageMult, 1)); + ApplyDPSDebuff(baseDemonicFlamesDoTValue, baseDemonicFlamesDoTValue / 15, ref npc.lifeRegen, ref damage); + } + // Holy Flames if (hFlames > 0) { @@ -964,25 +1165,18 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseDragonFireDoTValue, baseDragonFireDoTValue / 5, ref npc.lifeRegen, ref damage); } - // Vermillion Flux - if (vermillionFlux > 0) + // Vulnerability Hex + if (vulnerabilityHex > 0) { - int baseVermillionFluxDoTValue = (int)(100 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 400 on moving targets - ApplyDPSDebuff(baseVermillionFluxDoTValue, baseVermillionFluxDoTValue / 40, ref npc.lifeRegen, ref damage); + int baseVulnerabilityHexDoTValue = (int)(VulnerabilityHex.DPS * heatDamageMult); + ApplyDPSDebuff(baseVulnerabilityHexDoTValue, VulnerabilityHex.TickNumber, ref npc.lifeRegen, ref damage); } - // Auric Rebuke - if (auricRebuke > 0) + // True Vulnerability Hex + if (trueVulnerabilityHex > 0) { - int baseAuricRebukeDoTValue = (int)(200 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 800 on moving targets - ApplyDPSDebuff(baseAuricRebukeDoTValue, baseAuricRebukeDoTValue / 70, ref npc.lifeRegen, ref damage); - } - - // Static Discharge - if (staticDischarge > 0) - { - int baseStaticDischargeDoTValue = (int)(6 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 24 on moving targets - ApplyDPSDebuff(baseStaticDischargeDoTValue, baseStaticDischargeDoTValue / 15, ref npc.lifeRegen, ref damage); + int baseTrueVHexDoTValue = (int)(TrueVulnerabilityHex.DPS * heatDamageMult); + ApplyDPSDebuff(baseTrueVHexDoTValue, TrueVulnerabilityHex.TickNumber, ref npc.lifeRegen, ref damage); } // Banishing Fire @@ -991,103 +1185,9 @@ namespace CalamityMod.NPCs int baseBanishingFireDoTValue = (int)((npc.lifeMax >= 1000000 ? npc.lifeMax / 500 : 4000) * heatDamageMult); ApplyDPSDebuff(baseBanishingFireDoTValue, baseBanishingFireDoTValue / 5, ref npc.lifeRegen, ref damage); } + #endregion - // Vulnerability Hex - if (vulnerabilityHex > 0) - { - int baseVulnerabilityHexDoTValue = (int)(VulnerabilityHex.DPS * heatDamageMult); - ApplyDPSDebuff(baseVulnerabilityHexDoTValue, VulnerabilityHex.TickNumber, ref npc.lifeRegen, ref damage); - } - - // Frostburn - if (npc.onFrostBurn) - { - int baseFrostBurnDoTValue = (int)(16 * vanillaColdDamageMult); - npc.lifeRegen -= baseFrostBurnDoTValue; - if (damage < baseFrostBurnDoTValue / 4) - damage = baseFrostBurnDoTValue / 4; - } - - // Frostbite - if (npc.onFrostBurn2) - { - int baseFrostBiteDoTValue = (int)(50 * vanillaColdDamageMult); - npc.lifeRegen -= baseFrostBiteDoTValue; - if (damage < baseFrostBiteDoTValue / 4) - damage = baseFrostBiteDoTValue / 4; - } - - // Oiled - bool hasColdOil = npc.onFrostBurn || npc.onFrostBurn2; - bool hasHotOil = npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame; - bool hasModHotOil = bFlames > 0 || hFlames > 0 || gsInferno > 0 || dragonFire > 0 || banishingFire > 0 || vulnerabilityHex > 0; - if (npc.oiled && (hasColdOil || hasHotOil || hasModHotOil)) - { - double multiplier = 1D; - if (hasColdOil) - multiplier *= vanillaColdDamageMult; - if (hasHotOil || (hasModHotOil && hasColdOil)) - multiplier *= vanillaHeatDamageMult; - if (hasModHotOil && !hasColdOil && !hasHotOil) - multiplier *= heatDamageMult; - - int baseOiledDoTValue = (int)(50 * multiplier); - npc.lifeRegen -= baseOiledDoTValue; - if (damage < baseOiledDoTValue / 4) - damage = baseOiledDoTValue / 4; - } - - // Nightwither - if (nightwither > 0) - { - int baseNightwitherDoTValue = (int)(200 * coldDamageMult); - ApplyDPSDebuff(baseNightwitherDoTValue, baseNightwitherDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Plague - if (pFlames > 0) - { - int basePlagueDoTValue = (int)(100 * sicknessDamageMult); - ApplyDPSDebuff(basePlagueDoTValue, basePlagueDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Astral Infection - if (astralInfection > 0) - { - int baseAstralInfectionDoTValue = (int)(75 * sicknessDamageMult); - ApplyDPSDebuff(baseAstralInfectionDoTValue, baseAstralInfectionDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Sulphuric Poisoning - if (sulphurPoison > 0) - { - int baseSulphurPoisonDoTValue = (int)(240 * sicknessDamageMult); - ApplyDPSDebuff(baseSulphurPoisonDoTValue, baseSulphurPoisonDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Sage Poison - if (sagePoisonTime > 0) - { - // npc.Calamity().sagePoisonDamage = 50 * (float)(Math.Pow(totalSageSpirits, 0.73D) + Math.Pow(totalSageSpirits, 1.1D)) * 0.5f - // See SageNeedle.cs for details - int baseSagePoisonDoTValue = (int)(npc.Calamity().sagePoisonDamage * sicknessDamageMult); - ApplyDPSDebuff(baseSagePoisonDoTValue, baseSagePoisonDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Kami Debuff from Yanmei's Knife - if (kamiFlu > 0) - { - int baseKamiFluDoTValue = (int)(250 * sicknessDamageMult); - ApplyDPSDebuff(baseKamiFluDoTValue, baseKamiFluDoTValue / 10, ref npc.lifeRegen, ref damage); - } - - //Absorber Affliction - if (absorberAffliction > 0) - { - int baseAbsorberDoTValue = (int)(400 * sicknessDamageMult); - ApplyDPSDebuff(baseAbsorberDoTValue, baseAbsorberDoTValue / 65, ref npc.lifeRegen, ref damage); - } - + #region Sickness Debuffs // Poisoned if (npc.poisoned) { @@ -1106,11 +1206,71 @@ namespace CalamityMod.NPCs damage = baseVenomDoTValue / 4; } - // Electrified - if (electrified > 0) + // Burning Blood + if (bBlood > 0) { - int baseElectrifiedDoTValue = (int)(21 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 84 on moving targets - ApplyDPSDebuff(baseElectrifiedDoTValue, baseElectrifiedDoTValue / 22, ref npc.lifeRegen, ref damage); + int baseBurningBloodDoTValue = (int)(40 * sicknessDamageMult); + ApplyDPSDebuff(baseBurningBloodDoTValue, baseBurningBloodDoTValue / 5, ref npc.lifeRegen, ref damage); + } + + // Brain Rot + if (brainRot > 0) + { + int baseBrainRotDoTValue = (int)(40 * sicknessDamageMult); + ApplyDPSDebuff(baseBrainRotDoTValue, baseBrainRotDoTValue / 5, ref npc.lifeRegen, ref damage); + } + + // Sage Poison + if (sagePoisonTime > 0) + { + // npc.Calamity().sagePoisonDamage = 50 * (float)(Math.Pow(totalSageSpirits, 0.73D) + Math.Pow(totalSageSpirits, 1.1D)) * 0.5f + // See SageNeedle.cs for details + int baseSagePoisonDoTValue = (int)(npc.Calamity().sagePoisonDamage * sicknessDamageMult); + ApplyDPSDebuff(baseSagePoisonDoTValue, baseSagePoisonDoTValue / 5, ref npc.lifeRegen, ref damage); + } + + // Astral Infection + if (astralInfection > 0) + { + int baseAstralInfectionDoTValue = (int)(75 * sicknessDamageMult); + ApplyDPSDebuff(baseAstralInfectionDoTValue, baseAstralInfectionDoTValue / 5, ref npc.lifeRegen, ref damage); + } + + // Plague + if (pFlames > 0) + { + int basePlagueDoTValue = (int)(100 * sicknessDamageMult); + ApplyDPSDebuff(basePlagueDoTValue, basePlagueDoTValue / 5, ref npc.lifeRegen, ref damage); + } + + // Sulphuric Poisoning + if (sulphurPoison > 0) + { + int baseSulphurPoisonDoTValue = (int)(240 * sicknessDamageMult); + ApplyDPSDebuff(baseSulphurPoisonDoTValue, baseSulphurPoisonDoTValue / 5, ref npc.lifeRegen, ref damage); + } + + // Kami Debuff from Yanmei's Knife + if (kamiFlu > 0) + { + int baseKamiFluDoTValue = (int)(YanmeisKnife.DebuffDoT * sicknessDamageMult); + ApplyDPSDebuff(baseKamiFluDoTValue, baseKamiFluDoTValue / 10, ref npc.lifeRegen, ref damage); + } + + //Absorber Affliction + if (absorberAffliction > 0) + { + int baseAbsorberDoTValue = (int)(400 * sicknessDamageMult); + ApplyDPSDebuff(baseAbsorberDoTValue, baseAbsorberDoTValue / 65, ref npc.lifeRegen, ref damage); + } + #endregion + + #region Water Debuffs + // Riptide + if (rTide > 0) + { + int baseRiptideDoTValue = (int)(30 * waterDamageMult); + ApplyDPSDebuff(baseRiptideDoTValue, baseRiptideDoTValue / 3, ref npc.lifeRegen, ref damage); } // Crush Depth @@ -1120,11 +1280,49 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseCrushDepthDoTValue, baseCrushDepthDoTValue / 2, ref npc.lifeRegen, ref damage); } - //Riptide - if (rTide > 0) + //Hadopelagic Pressure + if (hPressure > 0) { - int baseRiptideDoTValue = (int)(30 * waterDamageMult); - ApplyDPSDebuff(baseRiptideDoTValue, baseRiptideDoTValue / 3, ref npc.lifeRegen, ref damage); + int baseHadopelagicPressureDoTValue = (int)(400 * waterDamageMult); + ApplyDPSDebuff(baseHadopelagicPressureDoTValue, baseHadopelagicPressureDoTValue / 2, ref npc.lifeRegen, ref damage); + } + #endregion + + if (npc.dryadBane) + { + // Buffs match 1:1 with Town NPC buffs + // See CalamityGlobalTownNPC: BuffTownNPC + float buffedDryadsBaneMult = 0f + + (NPC.downedMoonlord ? 0.6f : 0f) + + (DownedBossSystem.downedProvidence ? 0.2f : 0f) + + (DownedBossSystem.downedPolterghast ? 0.2f : 0f) + + (DownedBossSystem.downedDoG ? 0.2f : 0f) + + (DownedBossSystem.downedYharon ? 0.2f : 0f) + + (DownedBossSystem.downedExoMechs ? 0.6f : 0f) + + (DownedBossSystem.downedCalamitas ? 0.6f : 0f); + if (Main.expertMode) + buffedDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; + int buffedDryadsBaneDoTValue = 2 * (int)(4 * buffedDryadsBaneMult); + npc.lifeRegen -= buffedDryadsBaneDoTValue; + + // Scales damage tick if greater than the vanilla amount + float vanillaDryadsBaneMult = 1f + + (NPC.downedBoss1 ? 0.1f : 0f) + + (NPC.downedBoss2 ? 0.1f : 0f) + + (NPC.downedBoss3 ? 0.1f : 0f) + + (NPC.downedQueenBee ? 0.1f : 0f) + + (Main.hardMode ? 0.4f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedPlantBoss ? 0.15f : 0f) + + (NPC.downedGolemBoss ? 0.15f : 0f) + + (NPC.downedAncientCultist ? 0.15f : 0f); + if (Main.expertMode) + vanillaDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; + int totalDryadsBaneDoTValue = 2 * (int)(4 * vanillaDryadsBaneMult) + buffedDryadsBaneDoTValue; + if (damage < totalDryadsBaneDoTValue / 6) + damage = totalDryadsBaneDoTValue / 6; } // Debuffs that aren't affected by weaknesses or resistances. @@ -1132,16 +1330,14 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(30, 6, ref npc.lifeRegen, ref damage); if (somaShredStacks > 0) Shred.TickDebuff(npc, this); - if (bBlood > 0) - ApplyDPSDebuff(40, 10, ref npc.lifeRegen, ref damage); - if (brainRot > 0) - ApplyDPSDebuff(40, 10, ref npc.lifeRegen, ref damage); - if (laceration > 0) + if (heavybleeding > 0) ApplyDPSDebuff(80, 10, ref npc.lifeRegen, ref damage); + if (laceration > 0) + ApplyDPSDebuff(400, 100, ref npc.lifeRegen, ref damage); if (elementalMix > 0) - ApplyDPSDebuff(400, 80, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(400, 100, ref npc.lifeRegen, ref damage); if (miracleBlight > 0) - ApplyDPSDebuff(2500, 500, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(3000, 500, ref npc.lifeRegen, ref damage); // Reduce DoT on worm bosses and Creepers by 75%. if ((wormBoss || npc.type == NPCID.Creeper) && npc.lifeRegen < 0) @@ -1168,12 +1364,244 @@ namespace CalamityMod.NPCs } #endregion + #region Load/Unload + public override void Load() + { + #region Setup Vanilla DR Values + DRValues = new SortedDictionary { + { NPCID.AngryBonesBig, 0.2f }, + { NPCID.AngryBonesBigHelmet, 0.2f }, + { NPCID.AngryBonesBigMuscle, 0.2f }, + { NPCID.AnomuraFungus, 0.1f }, + { NPCID.Antlion, 0.1f }, + { NPCID.Arapaima, 0.1f }, + { NPCID.ArmoredSkeleton, 0.15f }, + { NPCID.ArmoredViking, 0.1f }, + { NPCID.BigMimicCorruption, 0.3f }, + { NPCID.BigMimicCrimson, 0.3f }, + { NPCID.BigMimicHallow, 0.3f }, + { NPCID.BigMimicJungle, 0.3f }, + { NPCID.BlueArmoredBones, 0.2f }, + { NPCID.BlueArmoredBonesMace, 0.2f }, + { NPCID.BlueArmoredBonesNoPants, 0.2f }, + { NPCID.BlueArmoredBonesSword, 0.2f }, + { NPCID.BoneLee, 0.2f }, + { NPCID.Crab, 0.05f }, + { NPCID.Crawdad, 0.2f }, + { NPCID.Crawdad2, 0.2f }, + { NPCID.CultistBoss, 0.15f }, + { NPCID.Deerclops, 0.05f }, + { NPCID.DD2Betsy, 0.1f }, + { NPCID.DD2OgreT2, 0.1f }, + { NPCID.DD2OgreT3, 0.15f }, + { NPCID.DeadlySphere, 0.4f }, + { NPCID.DiabolistRed, 0.2f }, + { NPCID.DiabolistWhite, 0.2f }, + { NPCID.DukeFishron, 0.15f }, + { NPCID.DungeonGuardian, 0.9f }, + { NPCID.DungeonSpirit, 0.2f }, + { NPCID.ElfCopter, 0.15f }, + { NPCID.Everscream, 0.1f }, + { NPCID.FlyingAntlion, 0.05f }, + { NPCID.GiantCursedSkull, 0.2f }, + { NPCID.GiantShelly, 0.2f }, + { NPCID.GiantShelly2, 0.2f }, + { NPCID.GiantTortoise, 0.35f }, + { NPCID.Golem, 0.25f }, + { NPCID.GolemFistLeft, 0.25f }, + { NPCID.GolemFistRight, 0.25f }, + { NPCID.GolemHead, 0.25f }, + { NPCID.GolemHeadFree, 0.25f }, + { NPCID.GraniteFlyer, 0.1f }, + { NPCID.GraniteGolem, 0.15f }, + { NPCID.GreekSkeleton, 0.1f }, + { NPCID.HellArmoredBones, 0.2f }, + { NPCID.HellArmoredBonesMace, 0.2f }, + { NPCID.HellArmoredBonesSpikeShield, 0.2f }, + { NPCID.HellArmoredBonesSword, 0.2f }, + { NPCID.IceGolem, 0.1f }, + { NPCID.IceQueen, 0.1f }, + { NPCID.IceTortoise, 0.35f }, + { NPCID.HeadlessHorseman, 0.05f }, + { NPCID.MartianDrone, 0.2f }, + { NPCID.MartianSaucer, 0.2f }, + { NPCID.MartianSaucerCannon, 0.2f }, + { NPCID.MartianSaucerCore, 0.2f }, + { NPCID.MartianSaucerTurret, 0.2f }, + { NPCID.MartianTurret, 0.2f }, + { NPCID.MartianWalker, 0.35f }, + { NPCID.Mimic, 0.3f }, + { NPCID.MoonLordCore, 0.15f }, + { NPCID.MoonLordHand, 0.15f }, + { NPCID.MoonLordHead, 0.15f }, + { NPCID.Mothron, 0.2f }, + { NPCID.MothronEgg, 0.5f }, + { NPCID.MourningWood, 0.1f }, + { NPCID.Necromancer, 0.2f }, + { NPCID.NecromancerArmored, 0.2f }, + { NPCID.Paladin, 0.45f }, + { NPCID.PirateCaptain, 0.05f }, + { NPCID.PirateShipCannon, 0.15f }, + { NPCID.Plantera, 0.15f }, + { NPCID.PlanterasTentacle, 0.1f }, + { NPCID.HallowBoss, 0.15f }, + { NPCID.PossessedArmor, 0.25f }, + { NPCID.PresentMimic, 0.3f }, + { NPCID.PrimeCannon, 0.2f }, + { NPCID.PrimeLaser, 0.2f }, + { NPCID.PrimeSaw, 0.2f }, + { NPCID.PrimeVice, 0.2f }, + { NPCID.Probe, 0.2f }, + { NPCID.Pumpking, 0.1f }, + { NPCID.QueenBee, 0.05f }, + { NPCID.RaggedCaster, 0.2f }, + { NPCID.RaggedCasterOpenCoat, 0.2f }, + { NPCID.Retinazer, 0.2f }, + { NPCID.RustyArmoredBonesAxe, 0.2f }, + { NPCID.RustyArmoredBonesFlail, 0.2f }, + { NPCID.RustyArmoredBonesSword, 0.2f }, + { NPCID.RustyArmoredBonesSwordNoArmor, 0.2f }, + { NPCID.SandElemental, 0.1f }, + { NPCID.SantaNK1, 0.35f }, + { NPCID.SeaSnail, 0.05f }, + { NPCID.SkeletonArcher, 0.1f }, + { NPCID.SkeletonCommando, 0.2f }, + { NPCID.SkeletonSniper, 0.2f }, + { NPCID.SkeletronHand, 0.05f }, + { NPCID.SkeletronHead, 0.05f }, + { NPCID.SkeletronPrime, 0.2f }, + { NPCID.Spazmatism, 0.2f }, + { NPCID.TacticalSkeleton, 0.2f }, + { NPCID.TheDestroyer, 0.1f }, + { NPCID.TheDestroyerBody, 0.2f }, + { NPCID.TheDestroyerTail, 0.35f }, + { NPCID.TheHungry, 0.1f }, + { NPCID.UndeadViking, 0.1f }, + { NPCID.WalkingAntlion, 0.1f }, + { NPCID.WallofFlesh, 0.5f }, + }; + #endregion + + // Somehow the SetStatic is called few times before SetStaticDefaults + // So We Initialize the Dictionary first. And Push Data later (At SetStaticDefaults) + BossKillTimes = []; + } + + public override void Unload() + { + DRValues?.Clear(); + DRValues = null; + + BossKillTimes?.Clear(); + BossKillTimes = null; + } + #endregion + #region Set Defaults public override void SetStaticDefaults() { + #region Add Entries to BossKillTimes + BossKillTimes.AddRange(new Dictionary(){ + + // + // VANILLA BOSSES + // + { 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, 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) + { NPCID.SkeletronHead, 9000 }, // 2:30 (150 seconds) + { NPCID.WallofFlesh, 7200 }, // 2:00 (120 seconds) + { NPCID.WallofFleshEye, 7200 }, + { NPCID.QueenSlimeBoss, 7200 }, // 2:00 (120 seconds) + { NPCID.Spazmatism, 10800 }, // 3:00 (180 seconds) + { NPCID.Retinazer, 10800 }, + { NPCID.TheDestroyer, 10800 }, // 3:00 (180 seconds) + { NPCID.TheDestroyerBody, 10800 }, + { NPCID.TheDestroyerTail, 10800 }, + { NPCID.SkeletronPrime, 10800 }, // 3:00 (180 seconds) + { NPCID.Plantera, 10800 }, // 3:00 (180 seconds) + { NPCID.HallowBoss, 10800 }, // 3:00 (180 seconds) + { NPCID.Golem, 9000 }, // 2:30 (150 seconds) + { NPCID.GolemHead, 3600 }, // 1:00 (60 seconds) + { NPCID.DukeFishron, 9000 }, // 2:30 (150 seconds) + { NPCID.CultistBoss, 9000 }, // 2:30 (150 seconds) + { NPCID.MoonLordCore, 14400 }, // 4:00 (240 seconds) + { NPCID.MoonLordHand, 7200 }, // 2:00 (120 seconds) + { NPCID.MoonLordHead, 7200 }, // 2:00 (120 seconds) + + // + // CALAMITY BOSSES + // + { NPCType(), 5400 }, // 1:30 (90 seconds) + { NPCType(), 5400 }, + { NPCType(), 5400 }, + { NPCType(), 5400 }, // 1:30 (90 seconds) + { NPCType(), 7200 }, // 2:00 (120 seconds) + { NPCType(), 7200 }, // 2:00 (120 seconds) + { NPCType(), 9000 }, // 2:30 (150 seconds) -- total length of Slime God fight + { NPCType(), 4500 }, // 1:15 (75 seconds) + { NPCType(), 4500 }, // 1:15 (75 seconds) + { NPCType(), 4500 }, // 1:15 (75 seconds) -- split slimes should spawn at 1:15 and die at around 2:30 + { NPCType(), 4500 }, // 1:15 (75 seconds) + { NPCType(), 10800 }, // 3:00 (180 seconds) + { NPCType(), 9000 }, // 2:30 (150 seconds) + { NPCType(), 9000 }, + { NPCType(), 9000 }, + { NPCType(), 9000 }, + { NPCType(), 10800 }, // 3:00 (180 seconds) + { NPCType(), 14400 }, // 4:00 (240 seconds) + { NPCType(), 10800 }, // 3:00 (180 seconds) + { NPCType(), 10800 }, + { NPCType(), 10800 }, // 3:00 (180 seconds) + { NPCType(), 7200 }, // 2:00 (120 seconds) -- first phase is 1:00 + { NPCType(), 7200 }, + { NPCType(), 7200 }, + { NPCType(), 10800 }, // 3:00 (180 seconds) + { NPCType(), 10800 }, // 3:00 (180 seconds) + { NPCType(), 5400 }, // 1:30 (90 seconds) + { NPCType(), 7200 }, // 2:00 (120 seconds) + { NPCType(), 14400 }, // 4:00 (240 seconds) + { NPCType(), 10800 }, // 3:00 (180 seconds) + { NPCType(), 1200 }, // 0:20 (20 seconds) + { NPCType(), 8100 }, // 2:15 (135 seconds) + { NPCType(), 8100 }, + { NPCType(), 8100 }, + { NPCType(), 7200 }, // 2:00 (120 seconds) + { NPCType(), 10800 }, // 3:00 (180 seconds) + { NPCType(), 10800 }, // 3:00 (180 seconds) + { NPCType(), 14400 }, // 4:00 (240 seconds) + { NPCType(), 14400 }, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30 + { NPCType(), 14400 }, + { NPCType(), 14700 }, // 4:05 (245 seconds) -- he spends 5 seconds invincible where you can't do anything + { NPCType(), 21600 }, // 6:00 (360 seconds) + { NPCType(), 21600 }, + { NPCType(), 21600 }, // 6:00 (360 seconds) + { NPCType(), 21600 }, + { NPCType(), 21600 }, + { NPCType(), 21600 }, + { NPCType(), 21600 }, + { NPCType(), 21600 }, // 6:00 (360 seconds) + { NPCType(), 21600 }, + { NPCType(), 21600 }, + { NPCType(), 21600 }, + { NPCType(), 18000 }, // 5:00 (300 seconds) + { NPCType(), 18000 } // 5:00 (300 seconds) + }); + #endregion + // 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; + + // Allow Moon Lord to directly be summoned in Multiplayer. + // This is used for the modified Celestial Sigil without Impending Doom. + NPCID.Sets.MPAllowedEnemies[NPCID.MoonLordCore] = true; } public override void SetDefaults(NPC npc) @@ -1188,16 +1616,15 @@ namespace CalamityMod.NPCs // Apply DR to vanilla NPCs. // This also applies DR to other mods' NPCs who have set up their NPCs to have DR. - if (CalamityMod.DRValues.ContainsKey(npc.type)) + if (DRValues.ContainsKey(npc.type)) { - CalamityMod.DRValues.TryGetValue(npc.type, out float newDR); + DRValues.TryGetValue(npc.type, out float newDR); DR = newDR; } // Aquatic Scourge sets kill time in AI, not here. - if (CalamityMod.bossKillTimes.ContainsKey(npc.type) && !CalamityLists.AquaticScourgeIDs.Contains(npc.type)) + if (BossKillTimes.TryGetValue(npc.type, out int revKillTime) && !AquaticScourgeIDList.Includes(npc.type)) { - CalamityMod.bossKillTimes.TryGetValue(npc.type, out int revKillTime); KillTime = revKillTime; } @@ -1295,7 +1722,7 @@ namespace CalamityMod.NPCs break; case NPCID.Plantera: - npc.lifeMax = 75000; + npc.lifeMax = 80000; break; case NPCID.PlanterasTentacle: @@ -1343,13 +1770,9 @@ namespace CalamityMod.NPCs #region Boss Rush Stat Changes private void BossRushStatChanges(NPC npc, Mod mod) { - foreach (KeyValuePair BossRushHPChange in CalamityLists.BossRushHPChanges) + if (BossRushHPChangeDict.TryGet(npc.type, out var newHP)) { - if (npc.type == BossRushHPChange.Key) - { - npc.lifeMax = BossRushHPChange.Value; - break; - } + npc.lifeMax = newHP; } } #endregion @@ -1357,13 +1780,9 @@ namespace CalamityMod.NPCs #region Boss Value Changes private void BossValueChanges(NPC npc) { - foreach (KeyValuePair BossValue in CalamityLists.BossValues) + if (BossValueDict.TryGet(npc.type, out var value)) { - if (npc.type == BossValue.Key) - { - npc.value = BossValue.Value; - break; - } + npc.value = value; } } #endregion @@ -1371,7 +1790,7 @@ namespace CalamityMod.NPCs #region Revengeance and Death Mode Stat Changes private void RevDeathStatChanges(NPC npc, Mod mod) { - if (CalamityLists.DeathModeSplittingWormIDs.Contains(npc.type)) + if (DeathModeSplittingWormList.Includes(npc.type)) { if (CalamityWorld.death) npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.15); @@ -1425,7 +1844,7 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 32f; } - else if (CalamityLists.DestroyerIDs.Contains(npc.type)) + else if (DestroyerIDList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.25); npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; @@ -1438,7 +1857,7 @@ namespace CalamityMod.NPCs npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; } - else if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { // 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)); @@ -1446,10 +1865,9 @@ namespace CalamityMod.NPCs } else if (npc.type <= NPCID.PrimeLaser && npc.type >= NPCID.PrimeCannon) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.65); - npc.scale = 1.2f; + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.55); } - else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism || npc.type == ModContent.NPCType()) + else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism || npc.type == NPCType()) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 10f; @@ -1507,7 +1925,7 @@ namespace CalamityMod.NPCs { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4); } - else if (CalamityLists.EaterofWorldsIDs.Contains(npc.type)) + else if (EaterOfWorldsIDList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); @@ -1529,9 +1947,9 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.KingSlime) { if (CalamityWorld.death) - npc.scale = Main.getGoodWorld ? 6f : 3f; + npc.scale = Main.getGoodWorld ? 6f : 2.5f; else - npc.scale = Main.getGoodWorld ? 3f : 1.25f; + npc.scale = Main.getGoodWorld ? 3f : 1.5f; npc.lifeMax = (int)Math.Round(npc.lifeMax * (Main.getGoodWorld ? 1.8 : 1.5)); } @@ -1628,6 +2046,7 @@ namespace CalamityMod.NPCs case NPCID.BlackSlime: case NPCID.BlueSlime: case NPCID.CorruptSlime: + case NPCID.GoldenSlime: case NPCID.GreenSlime: case NPCID.IlluminantSlime: case NPCID.JungleSlime: @@ -1636,6 +2055,7 @@ namespace CalamityMod.NPCs case NPCID.PurpleSlime: case NPCID.RainbowSlime: case NPCID.RedSlime: + case NPCID.ShimmerSlime: case NPCID.Slimeling: case NPCID.SlimeMasked: case NPCID.Slimer: @@ -1817,6 +2237,7 @@ namespace CalamityMod.NPCs // Organic enemies. case NPCID.HallowBoss: + case NPCID.Dandelion: case NPCID.Gnome: case NPCID.BloodEelHead: case NPCID.BloodEelBody: @@ -1897,6 +2318,7 @@ namespace CalamityMod.NPCs case NPCID.ArmedZombiePincussion: case NPCID.ArmedZombieSwamp: case NPCID.ArmedZombieTwiggy: + case NPCID.ArmedTorchZombie: case NPCID.BaldZombie: case NPCID.BigBaldZombie: case NPCID.BigFemaleZombie: @@ -1917,6 +2339,7 @@ namespace CalamityMod.NPCs case NPCID.SmallTwiggyZombie: case NPCID.SmallZombie: case NPCID.SwampZombie: + case NPCID.TorchZombie: case NPCID.TwiggyZombie: case NPCID.Zombie: case NPCID.ZombieDoctor: @@ -2162,6 +2585,7 @@ namespace CalamityMod.NPCs case NPCID.IceSlime: case NPCID.SpikedIceSlime: case NPCID.IceGolem: + case NPCID.IceMimic: case NPCID.MisterStabby: case NPCID.SnowBalla: case NPCID.SnowmanGangsta: @@ -2253,9 +2677,9 @@ namespace CalamityMod.NPCs npc.GetNPCDamage(); npc.defDamage = npc.damage; } - if ((npc.boss && npc.type != NPCID.MartianSaucerCore) || CalamityLists.bossHPScaleList.Contains(npc.type)) + if ((npc.boss && npc.type != NPCID.MartianSaucerCore) || BossHPScalingList.Includes(npc.type)) { - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)Math.Round(npc.lifeMax * HPBoost); } @@ -2448,9 +2872,9 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = true; break; - // Make Fishron and Anahita Bubbles immune to damage in Rev+ Master Mode + // Make Fishron and Anahita Bubbles immune to damage in Death Mode case NPCID.DetonatingBubble: - npc.dontTakeDamage = Main.masterMode && CalamityWorld.revenge; + npc.dontTakeDamage = CalamityWorld.death; break; default: @@ -2458,11 +2882,11 @@ namespace CalamityMod.NPCs } // Reduce mech boss HP and damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { if (!NPC.downedMechBossAny) { - if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == ModContent.NPCType()) + if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2472,7 +2896,7 @@ namespace CalamityMod.NPCs } else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) { - if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == ModContent.NPCType()) + if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2499,7 +2923,7 @@ namespace CalamityMod.NPCs } } - if (Main.hardMode && CalamityLists.HardmodeNPCNerfList.Contains(npc.type)) + if (Main.hardMode && HardmodeNPCNerfList.Includes(npc.type)) { npc.damage = (int)Math.Round(npc.damage * 0.75); npc.defDamage = npc.damage; @@ -2507,21 +2931,21 @@ namespace CalamityMod.NPCs if (DownedBossSystem.downedDoG) { - if (CalamityLists.pumpkinMoonBuffList.Contains(npc.type)) + if (PumpkinMoonBuffList.Includes(npc.type)) { 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)) + else if (FrostMoonBuffList.Includes(npc.type)) { 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)) + else if (EclipseBuffList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 5D); npc.damage += 30; @@ -2532,7 +2956,7 @@ namespace CalamityMod.NPCs if (NPC.downedMoonlord) { - if (CalamityLists.dungeonEnemyBuffList.Contains(npc.type)) + if (BuffedDungeonEnemiesList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.5); npc.damage += 30; @@ -2545,550 +2969,569 @@ namespace CalamityMod.NPCs 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) + // Adjust a ton of enemy stats + switch (npc.type) { - switch (npc.type) - { - 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: + 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.SlimeSpiked: + + // Buff enemy HP by 25% + npc.lifeMax = (int)Math.Round(npc.lifeMax * EnemyHPMultiplier); + + // 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) + { AdjustMasterModeStatScaling(npc); npc.defDamage = npc.damage; - break; + } - case NPCID.KingSlime: - case NPCID.EyeofCthulhu: - case NPCID.EaterofWorldsHead: - case NPCID.EaterofWorldsBody: - case NPCID.EaterofWorldsTail: - case NPCID.BrainofCthulhu: - case NPCID.Creeper: - case NPCID.QueenBee: - case NPCID.SkeletronHead: - case NPCID.SkeletronHand: - case NPCID.Deerclops: - case NPCID.WallofFlesh: - case NPCID.WallofFleshEye: - case NPCID.QueenSlimeBoss: - case NPCID.Retinazer: - case NPCID.Spazmatism: - case NPCID.TheDestroyer: - case NPCID.TheDestroyerBody: - case NPCID.TheDestroyerTail: - case NPCID.SkeletronPrime: - case NPCID.PrimeCannon: - case NPCID.PrimeLaser: - case NPCID.PrimeSaw: - case NPCID.PrimeVice: - case NPCID.Plantera: - case NPCID.PlanterasTentacle: - case NPCID.Golem: - case NPCID.GolemHead: - case NPCID.GolemHeadFree: - case NPCID.GolemFistLeft: - case NPCID.GolemFistRight: - case NPCID.HallowBoss: - case NPCID.DukeFishron: - case NPCID.CultistBoss: - case NPCID.MoonLordCore: - case NPCID.MoonLordFreeEye: - case NPCID.MoonLordHand: - case NPCID.MoonLordHead: + break; + + case NPCID.AncientCultistSquidhead: + // This guy only gets Master Mode nerfs + // 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) + { + AdjustMasterModeStatScaling(npc); + npc.defDamage = npc.damage; + } + break; + + case NPCID.KingSlime: + case NPCID.EyeofCthulhu: + case NPCID.EaterofWorldsHead: + case NPCID.EaterofWorldsBody: + case NPCID.EaterofWorldsTail: + case NPCID.BrainofCthulhu: + case NPCID.Creeper: + case NPCID.QueenBee: + case NPCID.SkeletronHead: + case NPCID.SkeletronHand: + case NPCID.Deerclops: + case NPCID.WallofFlesh: + case NPCID.WallofFleshEye: + case NPCID.QueenSlimeBoss: + case NPCID.Retinazer: + case NPCID.Spazmatism: + case NPCID.TheDestroyer: + case NPCID.TheDestroyerBody: + case NPCID.TheDestroyerTail: + case NPCID.SkeletronPrime: + case NPCID.PrimeCannon: + case NPCID.PrimeLaser: + case NPCID.PrimeSaw: + case NPCID.PrimeVice: + case NPCID.Plantera: + case NPCID.PlanterasTentacle: + case NPCID.Golem: + case NPCID.GolemHead: + case NPCID.GolemHeadFree: + case NPCID.GolemFistLeft: + case NPCID.GolemFistRight: + case NPCID.HallowBoss: + case NPCID.DukeFishron: + case NPCID.CultistBoss: + case NPCID.MoonLordCore: + case NPCID.MoonLordFreeEye: + case NPCID.MoonLordHand: + case NPCID.MoonLordHead: + + if (Main.masterMode) AdjustMasterModeStatScaling(npc, true); - break; - } + + break; } } #endregion @@ -3101,7 +3544,7 @@ namespace CalamityMod.NPCs // Rebalance coin drops so that Normal Mode enemies and bosses drop an adequate amount of coins. // Increase Normal Mode coin drops by 1.5x. - npc.value = (int)(npc.value * NPCValueMultiplier_NormalCalamity); + npc.value = (int)(npc.value * NPCValueMultiplier_ClassicCalamity); // Change the Expert Mode coin drop multiplier. if (Main.expertMode) @@ -3158,7 +3601,7 @@ namespace CalamityMod.NPCs Texture2D npcTexture = texture ?? TextureAssets.Npc[npc.type].Value; Vector2 screenOffset = npc.IsABestiaryIconDummy ? Vector2.Zero : Main.screenPosition; int afterimageCounter = 1; - while (afterimageCounter < NPCID.Sets.TrailCacheLength[npc.type] && CalamityConfig.Instance.Afterimages) + while (afterimageCounter < NPCID.Sets.TrailCacheLength[npc.type] && CalamityClientConfig.Instance.Afterimages) { Color colorToDraw = Color.Lerp(drawColor, endingColor, afterimageCounter / (float)NPCID.Sets.TrailCacheLength[npc.type]); colorToDraw *= afterimageCounter / (float)NPCID.Sets.TrailCacheLength[npc.type]; @@ -3184,7 +3627,7 @@ namespace CalamityMod.NPCs return; bool countsAsBoss = npc.boss || NPCID.Sets.ShouldBeCountedAsBoss[npc.type]; - bool scalesLikeBoss = countsAsBoss || CalamityLists.bossHPScaleList.Contains(npc.type); + bool scalesLikeBoss = countsAsBoss || BossHPScalingList.List.Contains(npc.type); bool isCalamityNPC = npc.ModNPC != null && npc.ModNPC.Mod == CalamityMod.Instance; // All bosses, NPCs that are supposed to scale like bosses, and Calamity NPCs follow these rules. @@ -3230,6 +3673,9 @@ namespace CalamityMod.NPCs #region Can Hit Player public override bool CanHitPlayer(NPC npc, Player target, ref int cooldownSlot) { + if (pacified) + return false; + if (target.Calamity().prismaticHelmet && !CalamityPlayer.areThereAnyDamnBosses) { if (npc.lifeMax < 500) @@ -3250,18 +3696,18 @@ namespace CalamityMod.NPCs // 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; + int defenseReduction = (marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) + (wither > 0 ? RemsRevenge.WitherDefenseReduction : 0) + miscDefenseLoss; modifiers.ArmorPenetration += defenseReduction; // DR applies after vanilla defense. ApplyDR(npc, ref modifiers); // Damage reduction on spawn for certain worm bosses. - if (CalamityLists.EaterofWorldsIDs.Contains(npc.type) && newAI[1] < EaterOfWorldsAI.DRIncreaseTime) + if (EaterOfWorldsIDList.Includes(npc.type) && newAI[1] < EaterOfWorldsAI.DRIncreaseTime) modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(BossRushEvent.BossRushActive ? 0.6f : 0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / EaterOfWorldsAI.DRIncreaseTime, 0f, 1f))); - if (CalamityLists.DestroyerIDs.Contains(npc.type) && newAI[1] < DestroyerAI.DRIncreaseTime) + if (DestroyerIDList.Includes(npc.type) && newAI[1] < DestroyerAI.DRIncreaseTime) modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / DestroyerAI.DRIncreaseTime, 0f, 1f))); - if (CalamityLists.AstrumDeusIDs.Contains(npc.type)) + if (AstrumDeusIDList.Includes(npc.type)) { float drTime = newAI[0] != 0f ? 300f : 600f; if (newAI[1] < drTime) @@ -3289,15 +3735,15 @@ namespace CalamityMod.NPCs // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac // Cirrus being active makes the extra DR cease to function bool cirrusBossActive = false; - if (CalamityGlobalNPC.SCal != -1) + if (SCal != -1) { - if (Main.npc[CalamityGlobalNPC.SCal].active) - cirrusBossActive = Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus; + if (Main.npc[SCal].active) + cirrusBossActive = Main.npc[SCal].ModNPC().cirrus; } - bool nightProvi = npc.type == NPCType() && !Main.IsItDay(); + bool enragedProvi = npc.type == NPCType() && !ProvUtils.StandardAI(); bool dayEmpress = npc.type == NPCID.HallowBoss && NPC.ShouldEmpressBeEnraged(); - if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && !cirrusBossActive && (nightProvi || dayEmpress)) + if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && !cirrusBossActive && (enragedProvi || dayEmpress)) { // Set the DR scaling factor float DRScalar = 10f; @@ -3333,14 +3779,14 @@ namespace CalamityMod.NPCs calcDR *= 0.5f; if (absorberAffliction > 0) calcDR *= 0.8f; - if (npc.betsysCurse) - calcDR *= 0.66f; if (npc.Calamity().kamiFlu > 0) - calcDR *= KamiFlu.MultiplicativeDamageReduction; + calcDR *= YanmeisKnife.DebuffDamageReductionMult; if (npc.Calamity().aCrunch > 0) calcDR *= ArmorCrunch.MultiplicativeDamageReductionEnemy; if (npc.Calamity().crumble > 0) calcDR *= Crumbling.MultiplicativeDamageReductionEnemy; + if (relicOfResilienceWeakness > 0) + calcDR *= 0.5f; return calcDR; @@ -3369,7 +3815,6 @@ namespace CalamityMod.NPCs FlatEditDR(ref calcDR, npc.onFrostBurn, BuffID.Frostburn); FlatEditDR(ref calcDR, npc.shadowFlame, BuffID.ShadowFlame); FlatEditDR(ref calcDR, npc.daybreak, BuffID.Daybreak); - FlatEditDR(ref calcDR, npc.betsysCurse, BuffID.BetsysCurse); FlatEditDR(ref calcDR, npc.onFire2, BuffID.CursedInferno); // Modded debuffs are handled modularly and use HasBuff. @@ -3388,7 +3833,6 @@ namespace CalamityMod.NPCs MultEditDR(ref calcDR, npc.onFrostBurn, BuffID.Frostburn); MultEditDR(ref calcDR, npc.shadowFlame, BuffID.ShadowFlame); MultEditDR(ref calcDR, npc.daybreak, BuffID.Daybreak); - MultEditDR(ref calcDR, npc.betsysCurse, BuffID.BetsysCurse); MultEditDR(ref calcDR, npc.onFire2, BuffID.CursedInferno); // Modded debuffs are handled modularly and use HasBuff. @@ -3401,6 +3845,11 @@ namespace CalamityMod.NPCs return calcDR; } + + public bool IsArmored() + { + return unbreakableDR && DR > 0.9f; + } #endregion #region Boss Head Slot @@ -3408,11 +3857,14 @@ namespace CalamityMod.NPCs { if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { + if (npc.type == NPCID.SkeletronPrime && (Main.masterMode || BossRushEvent.BossRushActive)) + index = ExtraTextureRefs.BossHeadIndex_ChadPrime; + if (npc.type == NPCID.DukeFishron && (CalamityWorld.death || BossRushEvent.BossRushActive)) { float lifeRatio = npc.life / (float)npc.lifeMax; float mapIconVanishValue = Main.masterMode ? 0.3f : 0.4f; - if (lifeRatio < mapIconVanishValue || (lifeRatio > 0.9f && Main.masterMode)) + if (lifeRatio < mapIconVanishValue || (lifeRatio > 0.9f && (Main.masterMode || BossRushEvent.BossRushActive))) index = -1; } } @@ -3423,7 +3875,7 @@ namespace CalamityMod.NPCs public override bool PreAI(NPC npc) { // Change Spaz and Ret weaknesses and resistances when phase 2 starts. - if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == ModContent.NPCType()) + if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { if (npc.ai[0] >= 2f) { @@ -3449,10 +3901,13 @@ namespace CalamityMod.NPCs if (KillTime > 0 || npc.type == NPCType()) { // Apply Boss Effects while any boss NPC is active - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < BossZenDistance) - Main.player[Main.myPlayer].AddBuff(BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < BossZenDistance) + Main.LocalPlayer.AddBuff(BuffType(), 2); + + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && npc.type == NPCType() && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < BossZenDistance) + Main.LocalPlayer.AddBuff(BuffType(), 2); } if (npc.type != NPCType()) @@ -3474,8 +3929,8 @@ namespace CalamityMod.NPCs } // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - if (CalamityLists.ZeroContactDamageNPCList.Contains(npc.type) && (npc.type != NPCID.RuneWizard || !Main.zenithWorld)) - npc.damage = npc.defDamage = 0; + if (ZeroContactDamageNPCList.Includes(npc.type) && (npc.type != NPCID.RuneWizard || !Main.zenithWorld)) + npc.damage = 0; // Don't do damage for 42 frames after spawning in if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) @@ -3551,6 +4006,10 @@ namespace CalamityMod.NPCs return RevengeanceAndDeathAI.BuffedSpiderAI(npc, Mod); } + // Servant of Cthulhu light + if (npc.type == NPCID.ServantofCthulhu) + Lighting.AddLight(npc.Center, 0.2f, 0.2f, 0.2f); + if (npc.type == NPCID.CultistBoss || npc.type == NPCID.CultistBossClone) { if (npc.type == NPCID.CultistBossClone) @@ -3589,7 +4048,7 @@ namespace CalamityMod.NPCs return QueenBeeAI.BuffedQueenBeeAI(npc, Mod); } - if (Main.masterMode && CalamityWorld.revenge) + if (CalamityWorld.death) { if (npc.type == NPCID.DetonatingBubble) return DukeFishronAI.BuffedDetonatingBubbleAI(npc, Mod); @@ -3631,7 +4090,7 @@ namespace CalamityMod.NPCs SoundEngine.PlaySound(SoundID.NPCDeath9, npc.Center); for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f) + npc.netOffset, npc.width, npc.height, 18, 0f, 0f, 100, default, 1.8f); + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f) + npc.netOffset, npc.width, npc.height, DustID.CorruptGibs, 0f, 0f, 100, default, 1.8f); Main.dust[dust].velocity *= 1.3f; Main.dust[dust].velocity += npc.velocity; Main.dust[dust].noGravity = true; @@ -3649,7 +4108,7 @@ namespace CalamityMod.NPCs npc.position += npc.netOffset; for (int i = 0; i < 2; i++) { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 1.3f); + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.CorruptGibs, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 1.3f); Main.dust[dust].velocity *= 0.3f; Main.dust[dust].noGravity = true; } @@ -4618,7 +5077,7 @@ namespace CalamityMod.NPCs } Lighting.AddLight(npc.Center, dustLerpColor1.ToVector3() * 0.7f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Player localPlayer = Main.LocalPlayer; if (!localPlayer.dead && localPlayer.HitboxForBestiaryNearbyCheck.Intersects(npc.Hitbox)) @@ -5136,8 +5595,6 @@ namespace CalamityMod.NPCs // Debuff decrements if (debuffResistanceTimer > 0) debuffResistanceTimer--; - if (knockbackResistanceTimer > 0) - knockbackResistanceTimer--; if (timeSlow > 0) timeSlow--; @@ -5166,10 +5623,19 @@ namespace CalamityMod.NPCs bBlood--; if (brainRot > 0) brainRot--; + if (heavybleeding > 0) + heavybleeding--; if (laceration > 0) laceration--; if (elementalMix > 0) elementalMix--; + if (trueVulnerabilityHex > 0) + { + vulnerabilityHex = 0; // You cannot stack True VHex with its lesser counterpart. + trueVulnerabilityHex--; + if (trueVulnerabilityHex == 0) + cursorFocus = 0; + } if (vulnerabilityHex > 0) vulnerabilityHex--; if (marked > 0) @@ -5180,6 +5646,10 @@ namespace CalamityMod.NPCs irradiated--; if (bFlames > 0) bFlames--; + if (demonicFlames > 0) + demonicFlames--; + else + demonicFlamesBonusDamage = 0; if (hFlames > 0) hFlames--; if (pFlames > 0) @@ -5191,6 +5661,8 @@ namespace CalamityMod.NPCs crumble--; if (cDepth > 0) cDepth--; + if (hPressure > 0) + hPressure--; if (rTide > 0) rTide--; if (gsInferno > 0) @@ -5211,6 +5683,10 @@ namespace CalamityMod.NPCs wDeath--; if (nightwither > 0) nightwither--; + if (shocked > 0) + shocked--; + if (voidfrost > 0) + voidfrost--; if (shellfishVore > 0) shellfishVore--; if (clamDebuff > 0) @@ -5219,29 +5695,92 @@ namespace CalamityMod.NPCs sulphurPoison--; if (sagePoisonTime > 0) sagePoisonTime--; - if (kamiFlu > 0) - kamiFlu--; - if (relicOfResilienceCooldown > 0) - relicOfResilienceCooldown--; - if (relicOfResilienceWeakness > 0) - relicOfResilienceWeakness--; if (GaussFluxTimer > 0) GaussFluxTimer--; if (ladHearts > 0) ladHearts--; - if (vulnerabilityHex > 0) - vulnerabilityHex--; if (banishingFire > 0) banishingFire--; if (wither > 0) wither--; - if (RancorBurnTime > 0) - RancorBurnTime--; + if (ashesOnDeath > 0) + ashesOnDeath--; - if (cobaltNerfTimer > 0) - cobaltNerfTimer--; - if (mythrilNerfTimer > 0) - mythrilNerfTimer--; + if (antlionCloudDebuffTimer > 0) + antlionCloudDebuffTimer--; + if (cursorFocus > 0 && cursorFocus < cursorFocusMax) + cursorFocus--; + + if (relicOfResilienceWeakness > 0) + relicOfResilienceWeakness--; + + if (warbannerBurnTimer > 0) + warbannerBurnTimer--; + if (warbannerBurnTimer == 0 && warbannerBurnMarked) + { + warbannerBurnTime = 0; + warbannerBurnDamage = 0; + warbannerBurnMarked = false; + warbannerBurnStacks = 0; + } + if (warbannerBurnMarked) + { + int maxStacks = 300; // Time in frames needed to reach max power + int fastestBurnRate = 2; + int slowestBurnRate = 15; + float burnPower = Utils.Remap(warbannerBurnStacks, 0, maxStacks, slowestBurnRate, fastestBurnRate, true); + + float sizeBonus = (1 + Utils.GetLerpValue(0, 170, Math.Max(npc.Hitbox.Width / 2f, npc.Hitbox.Height / 2f))); + + if (!warbannerBurnHideEffects) + { + Lighting.AddLight(npc.Center, Color.Gold.ToVector3() * 0.3f * warbannerBurnIntensity); + } + if (warbannerBurnStacks == maxStacks && !warbannerBurnHideEffects) + { + // Sound and visual for hitting max stacks + for (int i = 0; i < 15; i++) + { + Particle spark = new SparkParticle(npc.Center, new Vector2(13, 13).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 45, 0.85f, Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundStyle fullPower = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn"); + SoundEngine.PlaySound(fullPower with { Volume = 0.7f, Pitch = 0.7f }, npc.Center); + warbannerBurnStacks++; + } + if (warbannerBurnIntensity > 2.5f && npc.CanBeMoved(true)) + { + npc.velocity *= 1f - 0.25f * Utils.GetLerpValue(2.5f, 3, warbannerBurnIntensity); + if (npc.velocity.Length() > 5 && warbannerBurnIntensity > 2.85f) // Repel leaping enemies + npc.velocity = -npc.velocity * 0.7f; + } + if (warbannerBurnTime == 0) + { + if (!warbannerBurnHideEffects) + { + int particleLevel = (int)(MathHelper.Clamp((slowestBurnRate - burnPower) * 0.15f, 1, 2) * warbannerBurnIntensity); + for (int d = 0; d < particleLevel; d++) + { + Color color = Main.rand.NextBool() ? Color.Goldenrod : Color.Lerp(Color.OrangeRed, Color.Orange, Main.rand.NextFloat(0, 1)); ; + Vector2 sparkPos = npc.Center - warbannerBurnDirection * 220 * Utils.GetLerpValue(0, 200, Math.Max(npc.Hitbox.Width / 2f, npc.Hitbox.Height / 2f)); + float velAdjust = Main.rand.NextFloat(2, 7) * warbannerBurnIntensity * sizeBonus; + Vector2 endVel = warbannerBurnDirection * velAdjust; + Vector2 startVel = (warbannerBurnDirection * velAdjust).RotatedByRandom(0.6f * warbannerBurnIntensity); + Particle sparks = new VelChangingSpark(sparkPos, startVel, endVel, "CalamityMod/Particles/SmallBloom", Main.rand.Next(18, 22 + 1), Main.rand.NextFloat(0.1f, 0.25f) * sizeBonus, color * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.45f, 0.1f); + GeneralParticleHandler.SpawnParticle(sparks); + Dust lust2 = Dust.NewDustPerfect(sparkPos, DustType(), startVel, Scale: Main.rand.NextFloat(0.7f, 1.1f) * sizeBonus); + lust2.noGravity = true; + lust2.color = color; + lust2.noLightEmittence = true; + } + } + var player = Main.LocalPlayer; + Projectile burnHit = Projectile.NewProjectileDirect(player.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), (int)(warbannerBurnDamage * warbannerBurnIntensity), 0, Main.myPlayer, npc.whoAmI); + burnHit.ArmorPenetration = 50; + warbannerBurnTime = (int)(burnPower + (3 - warbannerBurnIntensity) * 4); + } + warbannerBurnTime--; + } if (veriumDoomTimer > 0) veriumDoomTimer--; @@ -5252,70 +5791,151 @@ namespace CalamityMod.NPCs 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); + Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), 100 + (15 * veriumDoomStacks), 0, Main.myPlayer, npc.whoAmI); veriumDoomMarked = false; veriumDoomStacks = 0; } + // Amidias' Spark spark spawning + if (shocked > 0) + { + var player = Main.LocalPlayer; + + int frequency = 15; + + // Spawn sparks from the enemy + if (player.miscCounter % frequency == 0) + { + int sDamage = 10; + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 5f; + Projectile spark = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), npc.Center, velocity, ProjectileType(), sDamage, 0f, player.whoAmI, 0f, 1f); + spark.timeLeft = 120; + spark.penetrate = 3; + } + } + + // Pearl Aura shard spawning + // Slowing is handled in the general slowing code below + if (pearlAura > 0) + { + pearlAuraCounter++; + if (pearlAuraCounter >= 45) + { + pearlAuraCounter = 0; + SoundEngine.PlaySound(SoundID.Item49, npc.Center); + + // Prevent things from getting too crazy + // CIT 8MAR2025: It is assumed that pearlAuraOwner is always set to something other than -1 when this code is run. + if (CalamityUtils.CountOwnedProjectiles(ProjectileType(), pearlAuraOwner) <= 3) + { + for (int i = 0; i < 3; i++) + { + Vector2 shardPos = npc.Center + new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-500f, -650f)); + Vector2 shardVel = Vector2.Normalize(npc.Center - shardPos).RotatedByRandom(MathHelper.Pi / 55f) * 20f; + int damage = 20; + Projectile.NewProjectile(npc.GetSource_FromThis(), shardPos, shardVel, ProjectileType(), damage, 5f, pearlAuraOwner); + } + } + } + } + else + { + pearlAuraCounter = 0; + pearlAuraOwner = -1; + } + + if (demonSwordImpales > 0 && npc.CanBeMoved(true)) + { + npc.velocity *= Utils.Remap(demonSwordImpales, 1, 5, 0.95f, 0.3f, true); + if (impalePacketTimer > 30) // There's probably a better solution, but this is the best for now + { + npc.SyncMotionToServer(); + impalePacketTimer = 0; + } + } + impalePacketTimer++; + // 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; + // Apply slowing debuff effects if (debuffResistanceTimer <= 0 || (debuffResistanceTimer > slowingDebuffResistanceMin)) { - if (gState <= 0 && tSad <= 0) + // Slowing debuffs which set a velocity hard cap take priority first. + if (vulnerabilityHex > 0) + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-Calamity.MaxNPCSpeed), new Vector2(Calamity.MaxNPCSpeed, 10f)); + else if (kamiFlu > 360) + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-YanmeisKnife.DebuffNPCSpeedCap), new Vector2(YanmeisKnife.DebuffNPCSpeedCap)); + + // Then debuffs which apply a multiplier to velocity. + // These multipliers can stack with each other, even if you'll rarely see this on a boss. + float velocitySlownessFactor = 1f; + + if (tSad > 0) + velocitySlownessFactor += 0.2f; + + if (timeSlow > 0) + velocitySlownessFactor += 0.15f; + + if (webbed > 0) + velocitySlownessFactor += 0.15f; + + if (gState > 0) { - if (eutrophication > 0) + float baseSlownessFactor = 0.1f; + if (VulnerableToCold.HasValue) { - float velocityMult = 0.95f; - if (VulnerableToWater.HasValue) - { - if (VulnerableToWater.Value) - velocityMult = 0.6f; - else - velocityMult = 0.99f; - } - npc.velocity *= velocityMult; + if (VulnerableToCold.Value) + baseSlownessFactor = 0.4f; + else + baseSlownessFactor = 0.025f; } - else if (timeSlow > 0 || webbed > 0) - { - npc.velocity *= 0.85f; - } - else if (slowed > 0 || tesla > 0 || vaporfied > 0) - { - float velocityMult = 0.95f; - if (tesla > 0) - { - if (VulnerableToElectricity.HasValue) - { - if (VulnerableToElectricity.Value) - velocityMult = 0.6f; - else - velocityMult = 0.99f; - } - } - npc.velocity *= velocityMult; - } - else if (vulnerabilityHex > 0) - { - npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-Calamity.MaxNPCSpeed), new Vector2(Calamity.MaxNPCSpeed, 10f)); - } - else if (kamiFlu > 420) - { - npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-KamiFlu.MaxNPCSpeed), new Vector2(KamiFlu.MaxNPCSpeed)); - } + velocitySlownessFactor += baseSlownessFactor; } - } - if (!CalamityPlayer.areThereAnyDamnBosses && !CalamityLists.enemyImmunityList.Contains(npc.type)) - { if (pearlAura > 0) - npc.velocity *= 0.9f; + velocitySlownessFactor += 0.1f; + + if (eutrophication > 0) + { + float baseSlownessFactor = 0.05f; + if (VulnerableToWater.HasValue) + { + if (VulnerableToWater.Value) + baseSlownessFactor = 0.2f; + else + baseSlownessFactor = 0.0125f; + } + velocitySlownessFactor += baseSlownessFactor; + } + + if (slowed > 0) + velocitySlownessFactor += 0.05f; + + if (tesla > 0) + { + float baseSlownessFactor = 0.05f; + if (VulnerableToElectricity.HasValue) + { + if (VulnerableToElectricity.Value) + baseSlownessFactor = 0.2f; + else + baseSlownessFactor = 0.0125f; + } + velocitySlownessFactor += baseSlownessFactor; + } + + if (vaporfied > 0) + velocitySlownessFactor += 0.05f; + + // Divide 1 by the slowness factor to get the amount to slow by. + // This scales with diminishing returns, though getting slowed every frame means they quickly slow down either way. + velocitySlownessFactor = 1f / velocitySlownessFactor; + npc.velocity *= velocitySlownessFactor; } // Auric Ore/Repulsers reject Town NPCs and dummies (Auric Land Mines work on them too) @@ -5380,7 +6000,7 @@ namespace CalamityMod.NPCs SoundEngine.PlaySound(explode with { Pitch = 0.8f }, touchedTile.ToWorldCoordinates()); GenericSparkle sparker = new GenericSparkle(touchedTile.ToWorldCoordinates(), Vector2.Zero, Color.Goldenrod, Color.Gold, 2.5f, 9, Main.rand.NextFloat(-0.01f, 0.01f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Projectile.NewProjectile(new EntitySource_TileInteraction(npc, touchedTile.X, touchedTile.Y), touchedTile.ToWorldCoordinates(), Vector2.Zero, ModContent.ProjectileType(), 40000, 0f); + Projectile.NewProjectile(new EntitySource_TileInteraction(npc, touchedTile.X, touchedTile.Y), touchedTile.ToWorldCoordinates(), Vector2.Zero, ProjectileType(), 40000, 0f); WorldGen.KillTile(touchedTile.X, touchedTile.Y, noItem: true); continue; } @@ -5402,7 +6022,7 @@ namespace CalamityMod.NPCs if (tile.TileType == auricOreID) { npc.SimpleStrikeNPC((int)(npc.lifeMax * 0.2f), 0); - npc.AddBuff(ModContent.BuffType(), 120); + npc.AddBuff(BuffType(), 120); } SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), npc.Center); break; @@ -5420,6 +6040,11 @@ namespace CalamityMod.NPCs if (target.Calamity().sulphurSet) npc.AddBuff(BuffID.Poisoned, 60); + if (target.Calamity().ilSpark) + { + shocked = 120; + } + if (target.Calamity().snowman) { if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) @@ -5463,16 +6088,16 @@ namespace CalamityMod.NPCs case NPCID.Spazmatism: if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - target.AddBuff(BuffID.Bleeding, 300); + target.AddBuff(BuffType(), 180, true); break; case NPCID.SkeletronPrime: if (npc.ai[1] == 1f || npc.ai[1] == 2f) - target.AddBuff(BuffID.Bleeding, 300); + target.AddBuff(BuffType(), 180, true); break; case NPCID.PrimeSaw: - target.AddBuff(BuffID.Bleeding, 180); + target.AddBuff(BuffType(), 120, true); break; case NPCID.Plantera: @@ -5495,6 +6120,10 @@ namespace CalamityMod.NPCs target.AddBuff(BuffType(), 240); break; + case NPCID.DukeFishron: + target.AddBuff(BuffType(), 120, true); + break; + case NPCID.AncientLight: target.AddBuff(BuffType(), 120); break; @@ -5583,29 +6212,84 @@ namespace CalamityMod.NPCs } #endregion + #region On Hit NPC + + public override void OnHitNPC(NPC npc, NPC target, NPC.HitInfo hit) + { + if (target.ModNPC is SunkenSeaNPC ssnpc) + ssnpc.OnHitByNPC(npc); + } + + #endregion + #region Modify Hit + public override void ModifyHitPlayer(NPC npc, Player target, ref Player.HurtModifiers modifiers) + { + List SharkIDs = + [ + NPCID.Shark, + NPCID.DukeFishron, + NPCID.Sharkron, + NPCID.Sharkron2, + NPCID.SandShark, + NPCID.SandsharkCorrupt, + NPCID.SandsharkCrimson, + NPCID.SandsharkHallow, + NPCID.GoblinShark, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + + // Kaguya hair boom GIF + if (SharkIDs.Contains(npc.type) && target.name == "Rebecca" && Main.zenithWorld) + { + SoundEngine.PlaySound(AresGaussNuke.NukeExplosionSound, target.Center); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 12f) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 12f; + + target.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Rebecca").Format(target.name)), 1000.0, 0); + modifiers.SourceDamage *= target.statLifeMax2 * Main.rand.NextFloat(3f, 6f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile explosion = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), 9999, 0f, Main.myPlayer, ItemID.MiniNukeII, 0.01f); + explosion.friendly = false; + explosion.hostile = true; + explosion.timeLeft = 5; + } + } + } + public override void ModifyHitByItem(NPC npc, Player player, Item item, ref NPC.HitModifiers modifiers) { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.camper && !player.StandingStill()) modifiers.SourceDamage *= 0.1f; + if (IsArmored()) //Hide combat text so we can draw our own for armored NPCs + { + modifiers.HideCombatText(); + } + // True melee resists - if (CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || - CalamityLists.PerforatorIDs.Contains(npc.type) || CalamityLists.AquaticScourgeIDs.Contains(npc.type) || CalamityLists.DestroyerIDs.Contains(npc.type) || - CalamityLists.AstrumDeusIDs.Contains(npc.type) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || - npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || + if (DesertScourgeIDList.Includes(npc.type) || EaterOfWorldsIDList.Includes(npc.type) || npc.type == NPCID.Creeper || + PerforatorWormIDList.Includes(npc.type) || AquaticScourgeIDList.Includes(npc.type) || DestroyerIDList.Includes(npc.type) || + AstrumDeusIDList.Includes(npc.type) || StormWeaverIDList.Includes(npc.type) || ThanatosIDList.Includes(npc.type) || + npc.type == NPCType() || npc.type == NPCType() || AresIDList.Includes(npc.type) || npc.type == NPCType() || npc.type == NPCType()) { - float damageMult = CalamityLists.ThanatosIDs.Contains(npc.type) ? 0.35f : 0.5f; - if (item.CountsAsClass() && item.type != ItemType() && item.type != ItemType()) + float damageMult = ThanatosIDList.Includes(npc.type) ? 0.35f : (DesertScourgeIDList.Includes(npc.type) || npc.type == NPCType()) ? 0.75f : 0.5f; + if (item.CountsAsClass() && item.type != ItemType()) modifiers.SourceDamage *= damageMult; } } #endregion #region Modify Hit By Projectile - public static bool DisableMultWhipTag = false; + public static bool DisableMultWhipTag = false; //this bool does nothing on this branch, its just here so that CalTestHelpers doesn't crash searching for it //if you want to mess with this, please do so in the summoner branch - Shade public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref NPC.HitModifiers modifiers) @@ -5615,6 +6299,11 @@ namespace CalamityMod.NPCs MakeTownNPCsTakeMoreDamage(npc, projectile, Mod, ref modifiers); + if (IsArmored()) //Hide combat text so we can draw our own for armored NPCs + { + modifiers.HideCombatText(); + } + // Block natural falling stars from killing boss spawners randomly if ((projectile.type == ProjectileID.FallingStar && projectile.damage >= 1000) && (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType())) modifiers.SourceDamage *= 0f; @@ -5636,12 +6325,17 @@ namespace CalamityMod.NPCs if (Main.rand.NextFloat(100f) <= lastLayerCritChance) ++supercritLayers; - // Apply supercrit damage. This projectile is already guaranteed to be a crit, which will double its damage at the end. - // As such, only 50% damage is added per supercrit layer here. - modifiers.SourceDamage *= 1f + 0.5f * supercritLayers; + // 08MAR2025: Ozzatron: changed supercrit implementation to actually increase crit multiplier instead of multiplying source damage + // This means supercrits don't affect on-hits, just like regular crits don't + // + // Apply supercrit damage as a direct increase to the critical strike damage multiplier, which starts at 2.0 (aka 200%). + modifiers.CritDamage += supercritLayers; } } + // 08MAR2025: Simplistic crit damage increase. Doesn't force a crit, though you can do that separately. + modifiers.CritDamage += cgp.bonusCritDamage; + // // DAAWNLIGHT SPIRIT ORIGIN AIM IMPLEMENTATION // @@ -5664,7 +6358,6 @@ namespace CalamityMod.NPCs // Don't allow large hitbox projectiles or explosions to "snipe" enemies. // Hitbox criteria were changed to allow long one dimensional projectiles so that Condemnation would work. - bool hitBullseye = false; bool acceptableVelocity = projectile.velocity != Vector2.Zero; bool acceptableHitbox = (projectile.width <= 36) || (projectile.height <= 36); if (bullseye != null && acceptableVelocity && acceptableHitbox) @@ -5695,26 +6388,50 @@ namespace CalamityMod.NPCs bool willStrikeBullseye = dotCenter > dotOne && dotCenter > dotTwo; // If a bullseye is triggered, set it as hit. - if (willStrikeBullseye && bullseye.ai[1] == 0f) + if (willStrikeBullseye) { - modifiers.SetCrit(); - hitBullseye = true; - bullseye.ai[1] = 1f; // Make the bullseye disappear immediately. + // 08OCT2024: Ozzatron: this can be abused by firing a ton of shots then hotswapping to AMR while they are in flight + // we will need IEntitySource item use time provenance to fix this, and even that is unreliable with holdouts + modPlayer.spiritOriginCritBoost += player.ActiveItem().useTime; + + if (bullseye.ai[2] == 0f) + { + bullseye.timeLeft = DaawnlightSpiritOrigin.BullseyeHitLifetime; + bullseye.ai[2] = 1f; + } + + if (Main.rand.NextBool(5)) + { + int randomStarAmount = Main.rand.Next(3, 6); + float randomCircleRotation = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < randomStarAmount; i++) + { + Particle fancyStars = new FancyStars( + bullseye.Center, + Main.rand.NextFloat(MathHelper.TwoPi) * Main.rand.NextBool().ToDirectionInt(), + Main.rand.NextFloat(0.42f, 0.63f), + (MathHelper.TwoPi / randomStarAmount * i).ToRotationVector2().RotatedBy(randomCircleRotation).RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(7f, 12f), + Main.rand.NextFloat(0.1f, 0.5f), + 55, + new Color(Main.rand.Next(256), Main.rand.Next(256), Main.rand.Next(256)) * 1.2f); + GeneralParticleHandler.SpawnParticle(fancyStars); + } + } + bullseye.netUpdate = true; } } - - // The bonus provided by Daawnlight Spirit Origin can be computed as a complete replacement to regular crits. - // As such, it is subtracted by the base critical strike damage boost of 200% - float bonus = DaawnlightSpiritOrigin.GetDamageMultiplier(player, modPlayer, hitBullseye, cgp.forcedCrit) - 2f; - modifiers.CritDamage += bonus; } - // Plague Reaper deals 1.1x damage to Plagued enemies if (!projectile.npcProj && !projectile.trap) { + // Plague Reaper deals 1.1x damage to Plagued enemies if (projectile.CountsAsClass() && modPlayer.plagueReaper && pFlames > 0) modifiers.SourceDamage *= 1.1f; + + // True Vulnerability Hex causes enemies to take 1.15x damage, 2.5x from Calamity itself + if (trueVulnerabilityHex > 0) + modifiers.SourceDamage *= (projectile.type == ProjectileType() && projectile.ai[1] == 1f) ? 2.5f : 1.15f; } // Any weapons that shoot projectiles from anywhere other than the player's center aren't affected by point-blank shot damage boost. @@ -5734,23 +6451,27 @@ namespace CalamityMod.NPCs // Apply balancing resists/vulnerabilities. BalancingChangesManager.ApplyFromProjectile(npc, ref modifiers, projectile); - if (CalamityLists.GrenadeResistIDs.Contains(projectile.type)) + if (GrenadeResistIDList.Includes(projectile.type)) { // Eater of Worlds has a vanilla resist in Expert+, this gives it to him in Normal mode - bool hasResist = CalamityLists.EaterofWorldsIDs.Contains(npc.type) && !Main.expertMode; + // Note that Calamity reduces the vanilla resist from 80% to 60% + bool hasResist = EaterOfWorldsIDList.Includes(npc.type) && !Main.expertMode; // Add a resist for BoC's creepers and Prehardmode worm bosses - if (npc.type == NPCID.Creeper || CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.PerforatorIDs.Contains(npc.type)) + if (npc.type == NPCID.Creeper || DesertScourgeIDList.Includes(npc.type) || PerforatorWormIDList.Includes(npc.type)) hasResist = true; if (hasResist) - modifiers.SourceDamage *= 0.2f; + modifiers.SourceDamage *= 0.4f; } - if (CalamityLists.pierceResistList.Contains(npc.type)) + if (PierceResistList.Includes(npc.type)) PierceResistGlobal(projectile, npc, ref modifiers); if (modPlayer.camper && !player.StandingStill()) modifiers.SourceDamage *= 0.1f; + if ((projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) && (player.ownedProjectileCounts[ProjectileType()] > 0 || player.ownedProjectileCounts[ProjectileType()] > 0 || (player.Calamity().rOfResilienceCooldown == 0 && player.HeldItem.type == ItemType()))) + modifiers.SourceDamage *= 0.1f; + if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) EditWhipTagDamage(projectile, npc, ref modifiers); } @@ -5760,11 +6481,11 @@ namespace CalamityMod.NPCs private void PierceResistGlobal(Projectile projectile, NPC npc, ref NPC.HitModifiers modifiers) { // Thanatos segments do not trigger pierce resistance if they are closed - if (CalamityLists.ThanatosIDs.Contains(npc.type) && unbreakableDR) + if (ThanatosIDList.Includes(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)) + if ((npc.type == NPCType() || npc.type == NPCType()) && PierceResistExceptionLeviAureusList.Includes(projectile.type)) return; float damageReduction = projectile.Calamity().timesPierced * CalamityGlobalProjectile.PierceResistHarshness; @@ -5773,10 +6494,28 @@ namespace CalamityMod.NPCs modifiers.FinalDamage *= 1f - damageReduction; - if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !CalamityLists.pierceResistExceptionList.Contains(projectile.type) && !projectile.CountsAsClass() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99) + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.Includes(projectile.type) && !projectile.CountsAsClass() && projectile.aiStyle != ProjAIStyleID.Flail && projectile.aiStyle != ProjAIStyleID.MechanicalPiranha && projectile.aiStyle != ProjAIStyleID.Yoyo) projectile.Calamity().timesPierced++; } + #endregion + #region OnHitBy overrides + public override void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) + { + if (IsArmored()) + { + CombatText.NewText(npc.Hitbox, Color.Gray, damagedone, hit.Crit); + } + } + public override void OnHitByItem(NPC npc, Player player, Item item, NPC.HitInfo hit, int damagedone) + { + if (IsArmored()) + { + CombatText.NewText(npc.Hitbox, Color.Gray, damagedone, hit.Crit); + } + } + #endregion + #region Whip Tag // Make whip tags multiplicative, by effectively reversing the process done to it private void EditWhipTagDamage(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers) { @@ -5836,9 +6575,9 @@ namespace CalamityMod.NPCs //20% is balanced for non empowered, while 40% helps ensure psc remains balanced at empowered tier //Some PSC projectiles receive a reduced amount of benefit from this, for balancing purposes modifiers.ScalingBonusDamage += (empowered ? 0.4f : 0.2f) * TagDamageMult; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - var color = ProvUtils.GetProjectileColor((int)(Main.dayTime ? Providence.Providence.BossMode.Day : Providence.Providence.BossMode.Night), 0); + var color = ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 0); float power = Math.Min(npc.height / 100f, 3f); var position = new Vector2(Main.rand.NextFloat(npc.Left.X, npc.Right.X), Main.rand.NextFloat(npc.Top.Y, npc.Bottom.Y)); var particle = new FlameParticle(position, 50, 0.25f, power, color * (Main.dayTime ? 1f : 1.25f), color * (Main.dayTime ? 1.25f : 1f)); @@ -5859,7 +6598,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < Main.maxNPCs; i++) { NPC nPC = Main.npc[i]; - if (nPC.active && nPC.type == ModContent.NPCType() && nPC.life > 0) + if (nPC.active && nPC.type == NPCType() && nPC.life > 0) { nPC.life = 0; nPC.HitEffect(); @@ -5880,9 +6619,10 @@ namespace CalamityMod.NPCs NPC.downedMoonlord && Main.player[npc.target].ZoneDungeon) { - int maxValue = Main.expertMode ? 4 : 6; + // This value can change by (on average) 0.75x or 1.25x depending on your having positive or negative luck + int baseValue = Main.expertMode ? 4 : 6; - if (Main.rand.NextBool(maxValue) && Main.wallDungeon[Main.tile[(int)npc.Center.X / 16, (int)npc.Center.Y / 16].WallType]) + if (Main.player[npc.target].RollLuck(baseValue) == 0 && Main.wallDungeon[Main.tile[(int)npc.Center.X / 16, (int)npc.Center.Y / 16].WallType]) { int randomType = Utils.SelectRandom(Main.rand, new int[] { @@ -5903,8 +6643,8 @@ namespace CalamityMod.NPCs #region Hit Effect public override void HitEffect(NPC npc, NPC.HitInfo hit) { - if (npc.life <= 0 && npc.Organic() && RancorBurnTime > 0) - DeathAshParticle.CreateAshesFromNPC(npc); + if (npc.life <= 0 && npc.Organic() && ashesOnDeath > 0) + DeathAshParticle.CreateAshesFromNPC(npc, Vector2.Zero); // Cultist shield flicker if (npc.type == NPCID.CultistBoss) @@ -5924,7 +6664,7 @@ namespace CalamityMod.NPCs if (npc.life <= 0) { if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), ModContent.NPCType()); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), NPCType()); } break; @@ -5945,7 +6685,7 @@ namespace CalamityMod.NPCs npc2.velocity.Y -= Main.rand.Next(0, 10) * (Main.getGoodWorld ? 0.5f : 0.1f) + s; npc2.ai[0] = -1000 * Main.rand.Next(3); - if (Main.netMode == NetmodeID.Server && slime < Main.maxNPCs) + if (Main.dedServ && slime < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slime, 0f, 0f, 0f, 0, 0, 0); } } @@ -6141,22 +6881,17 @@ namespace CalamityMod.NPCs spawnRate = (int)(spawnRate * 1.1); maxSpawns = (int)(maxSpawns * 0.9f); } - if (player.calmed) - { - spawnRate = (int)(spawnRate * 1.2); - maxSpawns = (int)(maxSpawns * 0.8f); - } if (player.Calamity().tranquilityCandle) { spawnRate = (int)(spawnRate * 1.4); maxSpawns = (int)(maxSpawns * 0.4f); } - if (player.Calamity().zen || (CalamityConfig.Instance.ForceTownSafety && player.townNPCs > 1f && Main.expertMode)) + if (player.Calamity().zen || (CalamityServerConfig.Instance.ForceTownSafety && player.townNPCs > 1f && Main.expertMode)) { spawnRate = (int)(spawnRate * 2.5); maxSpawns = (int)(maxSpawns * 0.3f); } - if (player.Calamity().isNearbyBoss && CalamityConfig.Instance.BossZen) + if (player.Calamity().isNearbyBoss && CalamityServerConfig.Instance.BossZen) { spawnRate *= 5; maxSpawns = (int)(maxSpawns * 0.001f); @@ -6221,7 +6956,7 @@ namespace CalamityMod.NPCs WeightedRandom pool = new WeightedRandom(); pool.Add(NPCID.None, 0f); pool.Add(NPCType(), 0.025f); - pool.Add(NPCType(), 0.001f); + pool.Add(NPCType(), 0.01f); // Normal droids are replaced with plague droids in the Jungle Lab. if (nearPlagueLab) { @@ -6239,7 +6974,7 @@ namespace CalamityMod.NPCs if (typeToSpawn != NPCID.None) { int spawnedNPC = NPCLoader.SpawnNPC(typeToSpawn, checkPositionX, checkPositionY - 1); - if (Main.netMode == NetmodeID.Server && spawnedNPC < Main.maxNPCs) + if (Main.dedServ && spawnedNPC < Main.maxNPCs) { Main.npc[spawnedNPC].position.Y -= 8f; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, spawnedNPC); @@ -6274,7 +7009,7 @@ namespace CalamityMod.NPCs } // Replace vanilla Lava Slimes with Calamity Lava Slimes to avoid annoying lava drops - if (spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone && CalamityConfig.Instance.RemoveLavaDropsFromLavaSlimes && Main.expertMode) + if (spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone && CalamityServerConfig.Instance.RemoveLavaDropsFromLavaSlimes && Main.expertMode) { pool.Add(NPCType(), SpawnCondition.Underworld.Chance); pool.Remove(NPCID.LavaSlime); @@ -6466,17 +7201,44 @@ namespace CalamityMod.NPCs { if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) npc.frameCounter = 0D; } + // Increment the bestiary worm timer when hovering over the NPC or having their entry open. Pauses otherwise + if (npc.IsABestiaryIconDummy) + { + bestiaryWormTimer += 0.02f; + // Resets after an hour. No sane human being is looking at a bestiary entry for an hour straight + if (bestiaryWormTimer > 4320) + { + bestiaryWormTimer = 0; + } + } } // Debuff visuals. Alphabetical order as per usual, please public override void DrawEffects(NPC npc, ref Color drawColor) { + if (!npc.canDisplayBuffs) + return; + if (absorberAffliction > 0) AbsorberAffliction.DrawEffects(npc, ref drawColor); + // Rancor's burn effect + if (ashesOnDeath > 0) + { + if (Main.rand.NextBool(4)) + { + Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0.475f); + } + if (Main.rand.NextBool(6)) + { + Vector2 randomPosition = new(npc.position.X + Main.rand.NextFloat(-10f, npc.width + 10f), npc.position.Y + Main.rand.NextFloat(-10f, npc.height + 10f)); + RancorLavaMetaball.SpawnParticle(randomPosition, Main.rand.NextFloat(30f, 37f)); + } + } + if (astralInfection > 0) AstralInfectionDebuff.DrawEffects(npc, ref drawColor); @@ -6485,6 +7247,9 @@ namespace CalamityMod.NPCs if (bFlames > 0 || npc.HasBuff()) BrimstoneFlames.DrawEffects(npc, ref drawColor); + if (demonicFlames > 0) + DemonicFlames.DrawEffects(npc, ref drawColor); + if (bBlood > 0) BurningBlood.DrawEffects(npc, ref drawColor); @@ -6494,6 +7259,9 @@ namespace CalamityMod.NPCs if (cDepth > 0) CrushDepth.DrawEffects(npc, ref drawColor); + if (hPressure > 0) + HadopelagicPressure.DrawEffects(npc, ref drawColor); + if (dragonFire > 0) Dragonfire.DrawEffects(npc, ref drawColor); @@ -6520,6 +7288,9 @@ namespace CalamityMod.NPCs if (hFlames > 0 || banishingFire > 0) HolyFlames.DrawEffects(npc, ref drawColor); + if (heavybleeding > 0) + HeavyBleeding.DrawEffects(npc, ref drawColor); + if (laceration > 0) Laceration.DrawEffects(npc, ref drawColor); @@ -6530,18 +7301,27 @@ namespace CalamityMod.NPCs if (nightwither > 0) Nightwither.DrawEffects(npc, ref drawColor); + if (pearlAura > 0) + PearlAura.DrawEffects(npc, ref drawColor); + if (pFlames > 0) // Plague debuff Plague.DrawEffects(npc, ref drawColor); + if (relicOfResilienceWeakness > 0) + ProfanedWeakness.DrawEffects(npc, ref drawColor); + if (rTide > 0) RiptideDebuff.DrawEffects(npc, ref drawColor); - if (somaShredStacks > 0 && Main.netMode != NetmodeID.Server) + if (somaShredStacks > 0 && !Main.dedServ) Shred.DrawEffects(npc, this, ref drawColor); if (sulphurPoison > 0) SulphuricPoisoning.DrawEffects(npc, ref drawColor); + if (trueVulnerabilityHex > 0) + TrueVulnerabilityHex.DrawEffects(npc, ref drawColor); + if (vaporfied > 0) Vaporfied.DrawEffects(npc, ref drawColor); @@ -6557,6 +7337,9 @@ namespace CalamityMod.NPCs } } + if (voidfrost > 0) + Voidfrost.DrawEffects(npc, ref drawColor); + // TODO -- These debuff visuals cannot be moved because they correspond to vanilla debuffs if (electrified > 0) { @@ -6596,44 +7379,8 @@ namespace CalamityMod.NPCs } } - // Cobalt weapons reduce NPC defense - if (cobaltNerfTimer > 0) - { - miscDefenseLoss = (int)(npc.defense * 0.25); - - // Particle effects - 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); - } - } - - // Mythril weapons reduce NPC contact damage - if (mythrilNerfTimer > 0) - { - // Ensure that it isn't trying to set a non-zero damage value if the NPC's damage is currently 0 - if (npc.damage == 0) - npc.damage = 0; - else - npc.damage = (int)(npc.defDamage * 0.9); - - // Particle effects - 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) + if (ladHearts > 0 && !npc.loveStruck && !Main.dedServ) { if (Main.rand.NextBool(5)) { @@ -6653,22 +7400,20 @@ namespace CalamityMod.NPCs if (gState > 0) drawColor = Color.Cyan; - else if (electrified > 0) + else if (auricRebuke > 0) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); - drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.SlateGray, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; + drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkBlue, Color.White, Utils.Remap(npc.width, 30, 400, 0.4f, 0.7f, true)) : Color.White; } - else if (vermillionFlux > 0) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkRed, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; } - - else if (auricRebuke > 0) + else if (electrified > 0) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); - drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkBlue, Color.White, Utils.Remap(npc.width, 30, 400, 0.4f, 0.7f, true)) : Color.White; + drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.SlateGray, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; } else if (absorberAffliction > 0) @@ -6678,7 +7423,7 @@ namespace CalamityMod.NPCs drawColor = Color.Fuchsia; else if (pearlAura > 0) - drawColor = Color.White; + drawColor = new Color(185, 185, 255); else if (timeSlow > 0 || tesla > 0) drawColor = Color.Aquamarine; @@ -6693,8 +7438,8 @@ namespace CalamityMod.NPCs if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && CalamityWorld.LegendaryMode && CalamityWorld.revenge)) 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.KingSlime && CalamityWorld.death) + return NPC.AnyNPCs(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) { @@ -6707,7 +7452,7 @@ namespace CalamityMod.NPCs if (npc.HasBuff()) return new Color(200, 50, 50, 255 - npc.alpha); - if (npc.Calamity().kamiFlu > 0 && !CalamityLists.kamiDebuffColorImmuneList.Contains(npc.type)) + if (npc.Calamity().kamiFlu > 0 && !KamiDebuffColorImmuneList.Includes(npc.type)) return new Color(51, 197, 108, 255 - npc.alpha); if (npc.type == NPCID.VileSpit || npc.type == NPCID.VileSpitEaterOfWorlds) @@ -6727,17 +7472,19 @@ namespace CalamityMod.NPCs ("CalamityMod/Buffs/DamageOverTime/BanishingFire", NPC => NPC.Calamity().banishingFire > 0), ("CalamityMod/Buffs/DamageOverTime/BrainRot", NPC => NPC.Calamity().brainRot > 0), ("CalamityMod/Buffs/DamageOverTime/BrimstoneFlames", NPC => NPC.Calamity().bFlames > 0), + ("CalamityMod/Buffs/DamageOverTime/DemonicFlames", NPC => NPC.Calamity().demonicFlames > 0), ("CalamityMod/Buffs/DamageOverTime/BurningBlood", NPC => NPC.Calamity().bBlood > 0), ("CalamityMod/Buffs/DamageOverTime/CrushDepth", NPC => NPC.Calamity().cDepth > 0), ("CalamityMod/Buffs/DamageOverTime/Dragonfire", NPC => NPC.Calamity().dragonFire > 0), ("CalamityMod/Buffs/DamageOverTime/ElementalMix", NPC => NPC.Calamity().elementalMix > 0), ("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno", NPC => NPC.Calamity().gsInferno > 0), + ("CalamityMod/Buffs/DamageOverTime/HadopelagicPressure", NPC => NPC.Calamity().hPressure > 0), ("CalamityMod/Buffs/DamageOverTime/HolyFlames", NPC => NPC.Calamity().hFlames > 0), ("CalamityMod/Buffs/DamageOverTime/Laceration", NPC => NPC.Calamity().laceration > 0), + ("CalamityMod/Buffs/DamageOverTime/HeavyBleeding", NPC => NPC.Calamity().heavybleeding > 0), ("CalamityMod/Buffs/DamageOverTime/MiracleBlight", NPC => NPC.Calamity().miracleBlight > 0), ("CalamityMod/Buffs/DamageOverTime/Nightwither", NPC => NPC.Calamity().nightwither > 0), ("CalamityMod/Buffs/DamageOverTime/Plague", NPC => NPC.Calamity().pFlames > 0), - ("CalamityMod/Buffs/DamageOverTime/RancorBurn", NPC => NPC.Calamity().RancorBurnTime > 0), ("CalamityMod/Buffs/DamageOverTime/RiptideDebuff", NPC => NPC.Calamity().rTide > 0), ("CalamityMod/Buffs/DamageOverTime/SagePoison", NPC => NPC.Calamity().sagePoisonTime > 0), ("CalamityMod/Buffs/DamageOverTime/ShellfishClaps", NPC => NPC.Calamity().shellfishVore > 0), @@ -6745,8 +7492,10 @@ namespace CalamityMod.NPCs ("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff", NPC => NPC.Calamity().clamDebuff > 0), ("CalamityMod/Buffs/DamageOverTime/StaticDischarge", NPC => NPC.Calamity().staticDischarge > 0), ("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning", NPC => NPC.Calamity().sulphurPoison > 0), + ("CalamityMod/Buffs/DamageOverTime/TrueVulnerabilityHex", NPC => NPC.Calamity().trueVulnerabilityHex > 0), ("CalamityMod/Buffs/DamageOverTime/Vaporfied", NPC => NPC.Calamity().vaporfied > 0), ("CalamityMod/Buffs/DamageOverTime/VermillionFlux", NPC => NPC.Calamity().vermillionFlux > 0), + ("CalamityMod/Buffs/DamageOverTime/Voidfrost", NPC => NPC.Calamity().voidfrost > 0), ("CalamityMod/Buffs/DamageOverTime/VulnerabilityHex", NPC => NPC.Calamity().vulnerabilityHex > 0), // All other important Calamity debuffs, in alphabetical order @@ -6769,9 +7518,35 @@ namespace CalamityMod.NPCs public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + // This is used so that NPCs with specific PreDraws can still have Odd Mushroom clone drawing. + // If Odd Mushroom clone drawing is done manually due to using a different texture, just return false instead of setting this. + bool shouldDrawBool = true; + + if (npc.IsABestiaryIconDummy) + { + switch (npc.netID) + { + case NPCID.DiggerHead: + case NPCID.GiantWormHead: + case NPCID.EaterofWorldsHead: + case NPCID.WyvernHead: + case NPCID.StardustWormHead: + case NPCID.SolarCrawltipedeHead: + case NPCID.CultistDragonHead: + case NPCID.TheDestroyer: + case NPCID.LeechHead: + case NPCID.DevourerHead: + case NPCID.TombCrawlerHead: + case NPCID.DuneSplicerHead: + case NPCID.BloodEelHead: + case NPCID.BoneSerpentHead: + case NPCID.SeekerHead: + return DrawVanillaBestiaryWorms(spriteBatch, npc, drawColor); + } + } if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f) && npc.active) { - if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityLists.needsDebuffIconDisplayList.Contains(npc.type))) + if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || NeedsDebuffIconDisplayList.Includes(npc.type))) { List currentDebuffs = new List() { }; @@ -6883,7 +7658,9 @@ namespace CalamityMod.NPCs var tex = currentDebuffs[i]; spriteBatch.Draw(tex, npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset), null, Color.White, 0f, default, 0.5f, SpriteEffects.None, 0f); - // TODO -- Show number of Shred stacks (how?) + // Shred stack display + if (currentDebuffs[i] == TextureAssets.Buff[BuffType()].Value) + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, somaShredStacks.ToString(), npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset) + Vector2.One * 4f, Color.Gold, 0f, Vector2.Zero, Vector2.One * Main.UIScale * 0.8f); } } } @@ -6892,8 +7669,8 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType() || CalamityLists.DestroyerIDs.Contains(npc.type)) - return false; + if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType() || DestroyerIDList.Includes(npc.type)) + shouldDrawBool = false; } if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid || npc.type == NPCID.Probe || (npc.type == NPCID.HornetHoney && npc.ai[3] == 1f)) @@ -6906,7 +7683,7 @@ namespace CalamityMod.NPCs Main.spriteBatch.Draw(texture, npc.Center - screenPos + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); - return false; + shouldDrawBool = false; } if (npc.type == NPCID.GolemHeadFree) @@ -6931,7 +7708,7 @@ namespace CalamityMod.NPCs 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; + shouldDrawBool = false; } if (Main.LocalPlayer.Calamity().trippy && !npc.IsABestiaryIconDummy) @@ -6947,97 +7724,97 @@ namespace CalamityMod.NPCs 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); + int totalAfterimages = Main.LocalPlayer.Calamity().trippyLevel == 3 ? 16 : (Main.LocalPlayer.Calamity().trippyLevel == 2 ? 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); + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); float smallDistanceMult = 0.48f; float largeDistanceMult = 1.33f; - bool whatTheFuck = Main.player[Main.myPlayer].Calamity().trippyLevel == 3; + bool whatTheFuck = Main.LocalPlayer.Calamity().trippyLevel == 3; switch (i) { case 0: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 1: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 2: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; break; case 3: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.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)); + position.X = Main.LocalPlayer.Center.X + (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.LocalPlayer.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)); + position.X = Main.LocalPlayer.Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.LocalPlayer.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)); + position.X = Main.LocalPlayer.Center.X - (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.LocalPlayer.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)); + position.X = Main.LocalPlayer.Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.LocalPlayer.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)); + position.X = Main.LocalPlayer.Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.LocalPlayer.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)); + position.X = Main.LocalPlayer.Center.X + (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.LocalPlayer.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)); + position.X = Main.LocalPlayer.Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.LocalPlayer.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)); + position.X = Main.LocalPlayer.Center.X - (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.LocalPlayer.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; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.LocalPlayer.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; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.LocalPlayer.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; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.LocalPlayer.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; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY * 0.5f; break; @@ -7058,7 +7835,7 @@ namespace CalamityMod.NPCs else { // VHex and Miracle Blight visuals do not appear if Odd Mushroom is in use for sanity reasons - if (npc.Calamity().vulnerabilityHex > 0) + if (npc.Calamity().vulnerabilityHex > 0 || npc.Calamity().trueVulnerabilityHex > 0) { float compactness = npc.width * 0.6f; if (compactness < 10f) @@ -7067,7 +7844,7 @@ namespace CalamityMod.NPCs if (power > 2.75f) power = 2.75f; if (VulnerabilityHexFireDrawer is null || VulnerabilityHexFireDrawer.LocalTimer >= VulnerabilityHexFireDrawer.SetLifetime) - VulnerabilityHexFireDrawer = new FireParticleSet(npc.Calamity().vulnerabilityHex, 1, Color.Red * 1.25f, Color.Red, compactness, power); + VulnerabilityHexFireDrawer = new FireParticleSet(npc.Calamity().trueVulnerabilityHex > 0 ? npc.Calamity().trueVulnerabilityHex : npc.Calamity().vulnerabilityHex, 1, Color.Red * 1.25f, Color.Red, compactness, power); else VulnerabilityHexFireDrawer.DrawSet(npc.Bottom - Vector2.UnitY * (12f - npc.gfxOffY)); } @@ -7079,31 +7856,6 @@ namespace CalamityMod.NPCs return MiracleBlightRenderer.ActuallyDoPreDraw; } - // Draw a pillar of light and fade the background as an animation when skipping things in the DD2 event. - if (npc.type == NPCID.DD2EterniaCrystal) - { - float animationTime = 120f - npc.ai[3]; - animationTime /= 120f; - - if (!Main.dedServ) - { - if (!Filters.Scene["CrystalDestructionColor"].IsActive()) - Filters.Scene.Activate("CrystalDestructionColor"); - - Filters.Scene["CrystalDestructionColor"].GetShader().UseIntensity((float)Math.Sin(animationTime * MathHelper.Pi) * 0.4f); - } - - Vector2 drawPosition = npc.Center - screenPos + Vector2.UnitY * 60f; - for (int i = 0; i < 4; i++) - { - float intensity = MathHelper.Clamp(animationTime * 2f - i / 3f, 0f, 1f); - Vector2 origin = new Vector2(TextureAssets.MagicPixel.Value.Width / 2f, TextureAssets.MagicPixel.Value.Height); - Vector2 scale = new Vector2((float)Math.Sqrt(intensity) * 50f, intensity * 4f); - Color beamColor = new Color(0.4f, 0.17f, 0.4f, 0f) * (intensity * (1f - MathHelper.Clamp((animationTime - 0.8f) / 0.2f, 0f, 1f))) * 0.5f; - spriteBatch.Draw(TextureAssets.MagicPixel.Value, drawPosition, null, beamColor, 0f, origin, scale, SpriteEffects.None, 0f); - } - } - if (Main.zenithWorld) { if (NPC.AnyNPCs(NPCType())) @@ -7115,7 +7867,7 @@ namespace CalamityMod.NPCs } } - return true; + return shouldDrawBool; } public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -7184,7 +7936,7 @@ namespace CalamityMod.NPCs } // Destroyer drawing and laser telegraphs - else if (CalamityLists.DestroyerIDs.Contains(npc.type)) + else if (DestroyerIDList.Includes(npc.type) && !npc.IsABestiaryIconDummy) { Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; @@ -7310,7 +8062,7 @@ namespace CalamityMod.NPCs } } - Texture2D glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[0].Value : TextureAssets.Dest[0].Value; + Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerHeadGlowmask.Value : TextureAssets.Dest[0].Value; switch (npc.type) { default: @@ -7318,11 +8070,11 @@ namespace CalamityMod.NPCs break; case NPCID.TheDestroyerBody: - glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[1].Value : TextureAssets.Dest[1].Value; + glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerBodyGlowmask.Value : TextureAssets.Dest[1].Value; break; case NPCID.TheDestroyerTail: - glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[2].Value : TextureAssets.Dest[2].Value; + glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerTailGlowmask.Value : TextureAssets.Dest[2].Value; break; } @@ -7332,10 +8084,10 @@ namespace CalamityMod.NPCs } // Laser telegraph - else if (npc.type == NPCID.Probe && CalamityConfig.Instance.NewVanillaTextures) + else if (npc.type == NPCID.Probe && CalamityClientConfig.Instance.EnableVanillaTextureEdits) { float eyeTelegraphGateValue = (NPC.IsMechQueenUp ? DestroyerAI.ProbeLaserGateValue_Mechdusa : BossRushEvent.BossRushActive ? DestroyerAI.ProbeLaserGateValue_BossRush : revenge ? DestroyerAI.ProbeLaserGateValue_Rev : DestroyerAI.ProbeLaserGateValue) - DestroyerAI.ProbeLaserTelegraphTime; - Texture2D glowTexture = CalamityMod.ProbeGlowmask.Value; + Texture2D glowTexture = ExtraTextureRefs.ProbeGlowmask.Value; Vector2 halfSize = npc.frame.Size() / 2; SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == -1) @@ -7362,7 +8114,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < totalAfterimages; i++) { Color currentColor = npc.GetAlpha(drawColor); - float opacityScale = 1f - MathHelper.Lerp(0.3f, 1f, npc.life / (float)secondAfterimageSetHealthValue); + float opacityScale = 1f - MathHelper.Lerp(0.34f, 1f, npc.life / (float)secondAfterimageSetHealthValue); float opacity = Main.getGoodWorld ? 0.7f : opacityScale; opacity = MathHelper.Clamp(opacity, 0f, 1f); @@ -7372,8 +8124,8 @@ namespace CalamityMod.NPCs currentColor.A = (byte)((float)(int)currentColor.A * opacity); 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); + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); if (i > 3) { currentColor *= 0.5f; @@ -7387,46 +8139,46 @@ namespace CalamityMod.NPCs { case 0: case 4: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y; break; case 1: case 5: - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; - position.X = Main.player[Main.myPlayer].Center.X; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X; break; case 2: case 6: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y; break; case 3: case 7: - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; - position.X = Main.player[Main.myPlayer].Center.X; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X; break; case 8: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 9: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 10: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; break; case 11: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; break; default: @@ -7478,18 +8230,18 @@ namespace CalamityMod.NPCs 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); + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); if (i == 0 || i == 2) - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; else - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; position.X -= npc.width / 2; if (i == 0 || i == 1) - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; else - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; position.Y -= npc.height / 2; @@ -7514,8 +8266,8 @@ namespace CalamityMod.NPCs 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); + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); if (i > 3) { currentColor *= 0.5f; @@ -7527,46 +8279,46 @@ namespace CalamityMod.NPCs { case 0: case 4: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromBrain.Y; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.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; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.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; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.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; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.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; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 9: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 10: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; break; case 11: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; break; default: @@ -7646,7 +8398,7 @@ namespace CalamityMod.NPCs 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; + Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.WallOfFleshEyeGlowmask.Value : TextureAssets.Npc[npc.type].Value; Vector2 halfSize = npc.frame.Size() / 2; SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) @@ -7666,9 +8418,9 @@ namespace CalamityMod.NPCs } // His afterimages I can't get to work, so fuck it - else if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { - Texture2D npcTexture = (masterMode && revenge && npc.type == NPCID.SkeletronPrime) ? CalamityMod.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; + Texture2D npcTexture = (death && npc.type == NPCID.SkeletronPrime) ? ExtraTextureRefs.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; npc.frame.Y = (int)newAI[3]; @@ -7731,11 +8483,11 @@ 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); Color eyesColor = new Color(200, 200, 200, 0); - if (masterMode && revenge) + if (death) { 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; + Texture2D glowTexture = npc.type == NPCID.SkeletronPrime ? ExtraTextureRefs.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 @@ -7798,7 +8550,7 @@ namespace CalamityMod.NPCs 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) + if (CalamityClientConfig.Instance.Afterimages) { int afterimageAmount = 10; int afterImageIncrement = 2; @@ -7824,7 +8576,7 @@ 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 (CalamityWorld.death || BossRushEvent.BossRushActive) { if (npc.type == NPCID.Creeper) { @@ -7865,6 +8617,92 @@ namespace CalamityMod.NPCs newColor.A = (byte)((float)newColor.A * A); return newColor; } + + public static bool DrawVanillaBestiaryWorms(SpriteBatch spriteBatch, NPC npc, Color drawColor) + { + npc.Opacity = 1; + int segments = 6; + int spacing = 20; + int bashLength = 0; + float bashSpeed = 0f; + int speed = 3; + float rotation = 0.6f; + Texture2D wyvernArm = TextureAssets.Npc[NPCID.WyvernLegs].Value; + Texture2D wyvernBody = TextureAssets.Npc[NPCID.WyvernBody].Value; + switch (npc.netID) + { + case NPCID.DiggerHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, segments, 24, 0.4f, Vector2.Zero, speed, 10, 10, 0.2f); + case NPCID.GiantWormHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, 8, 14, 0.6f, new Vector2(20, 0), 4, 10, 6, 0.18f); + case NPCID.EaterofWorldsHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, segments, 34, 0.2f, new Vector2(30, 0), speed, 10, 16, 0.24f); + case NPCID.WyvernHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, [wyvernArm, wyvernBody, wyvernBody, wyvernBody], 4, 28, 0.1f, new Vector2(36, 0), speed, 6, 50, 0.3f, true); + case NPCID.StardustWormHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, 8, 14, rotation, new Vector2(0, 10), 4, 10, 6, 0.18f); + case NPCID.SolarCrawltipedeHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, segments, spacing, rotation, Vector2.Zero, 6, 10, 16, 0.22f); + case NPCID.CultistDragonHead: + return DrawSpecialBestiaryWorm(spriteBatch, npc, drawColor); + case NPCID.TheDestroyer: + return DrawSpecialBestiaryWorm(spriteBatch, npc, drawColor); + case NPCID.LeechHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, 8, 14, 0.6f, new Vector2(20, 0), 4, 10, 6, 0.18f); + case NPCID.DevourerHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, segments, spacing, rotation, Vector2.Zero, speed, 20, 10, 0.2f); + case NPCID.TombCrawlerHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, 9, 14, rotation, Vector2.Zero, speed, 20, 6, 0.14f); + case NPCID.DuneSplicerHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, segments, 28, 0.4f, Vector2.Zero, speed, 10, bashLength, bashSpeed); + case NPCID.BloodEelHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, 6, 22, 0.1f, Vector2.Zero, speed, 6, 20, 0.2f, true); + case NPCID.BoneSerpentHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, 9, 16, rotation, Vector2.Zero, speed, 10, 30, 0.4f); + case NPCID.SeekerHead: + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, TextureAssets.Npc[npc.type].Value, TextureAssets.Npc[npc.type + 1].Value, segments, spacing, rotation, Vector2.Zero, speed, 20, 10, 0.2f); + } + return true; + } + + public static bool DrawSpecialBestiaryWorm(SpriteBatch spriteBatch, NPC npc, Color drawColor) + { + // This is solely for The Destroyer and the Phantasm Dragon due to having more than 1 frame each but only for specific segments + bool dragon = npc.type == NPCID.CultistDragonHead; + Texture2D headTexture = TextureAssets.Npc[npc.type].Value; + float wormTimer = npc.Calamity().bestiaryWormTimer; + // Dragon head has 3 frames, Destroyer has 1 + int frameAmt = dragon ? 3 : 1; + npc.frame = TextureAssets.Npc[npc.type].Frame(1, frameAmt, 0, 0); + Vector2 baseOffset = new Vector2(dragon ? 0 : 20, dragon ? 0 : 20); + // Buffers the segment position and rotations + float offset = -0.2f; + float startX = baseOffset.X; + float startY = baseOffset.Y; + int segmentSpacing = dragon ? 32 : 38; + int animationSpeed = 3; + int range = 10; + int headOffset = dragon ? 40 : 20; + float headSpeedOffset = dragon ? 0.2f : 0.16f; + float rotationStrength = 0.2f; + // Draw the body segments + for (int i = 4; i > 0; i--) + { + // The first segment is slightly closer to keep up with the head + float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; + + // Second dragon segment uses the arm, rest use the normal body + Texture2D toUse = i == 2 ? TextureAssets.Npc[NPCID.CultistDragonBody1].Value : TextureAssets.Npc[NPCID.CultistDragonBody2].Value; + // If it's The Destroyer instead use his texture and increase the frame count to two + if (!dragon) + toUse = TextureAssets.Npc[NPCID.TheDestroyerBody].Value; + int bodyFrameAmt = dragon ? 1 : 2; + spriteBatch.Draw(toUse, npc.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * range + startY), toUse.Frame(1, bodyFrameAmt, 0, 0), npc.GetAlpha(drawColor), npc.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * rotationStrength, new Vector2(toUse.Width * 0.5f, toUse.Height * 0.5f / bodyFrameAmt), npc.scale, SpriteEffects.FlipHorizontally, 0f); + } + // Draw the head + spriteBatch.Draw(headTexture, npc.position + new Vector2(startX + headOffset, MathF.Sin((wormTimer - headSpeedOffset) * animationSpeed) * range + startY), npc.frame, npc.GetAlpha(drawColor), npc.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer - headSpeedOffset) * animationSpeed) * MathHelper.PiOver4 * rotationStrength, new Vector2(headTexture.Width * 0.5f, headTexture.Height / (float)frameAmt), npc.scale, SpriteEffects.FlipHorizontally, 0f); + return false; + } #endregion #region Any Events @@ -8072,7 +8910,7 @@ namespace CalamityMod.NPCs { if (!GetDownedBossVariable(npc.type)) { - CalamityLists.bossTypes.TryGetValue(npc.type, out int newBossTypeJustDowned); + BossTypeDict.TryGet(npc.type, out int newBossTypeJustDowned); for (int i = 0; i < Main.maxPlayers; i++) { @@ -8082,7 +8920,7 @@ namespace CalamityMod.NPCs CalamityPlayer mp = player.Calamity(); mp.lastSplitType = newBossTypeJustDowned; - mp.lastSplit = mp.previousSessionTotal.Add(CalamityMod.SpeedrunTimer.Elapsed); + mp.lastSplit = mp.previousSessionTotal.Add(SpeedrunTimerSystem.Elapsed); } } } @@ -8115,13 +8953,13 @@ namespace CalamityMod.NPCs #region Should Affect NPC public static bool ShouldAffectNPC(NPC target) { - if (CalamityLists.EaterofWorldsIDs.Contains(target.type) || CalamityLists.DestroyerIDs.Contains(target.type)) + if (EaterOfWorldsIDList.Includes(target.type) || DestroyerIDList.Includes(target.type)) return false; if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Creeper && target.type != NPCType() && target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCID.GolemFistLeft && target.type != NPCID.GolemFistRight && - target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !CalamityLists.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) + target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !EnemyImmunitiesList.Includes(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) { return true; } @@ -8168,33 +9006,32 @@ namespace CalamityMod.NPCs // has an owner, hence the MyPlayer check. if (Main.myPlayer == projectile.owner) { + if (!player.active || player.dead) + return; + + Projectile proj = null; + foreach (Projectile p in Main.ActiveProjectiles) + { + proj = p; + if (p.bobber && p.owner == player.whoAmI) + { + break; + } + } + + if (proj is null) + return; + + var spawnPosX = (int)proj.Center.X; + var spawnPosY = (int)proj.Center.Y + 100; if (Main.netMode == NetmodeID.SinglePlayer) { - if (!player.active || player.dead) - return; - - Projectile proj = null; - foreach (Projectile p in Main.ActiveProjectiles) - { - proj = p; - if (p.bobber && p.owner == player.whoAmI) - { - break; - } - } - - if (proj is null) - return; - - int oldDuke = NPC.NewNPC(NPC.GetBossSpawnSource(player.whoAmI), (int)proj.Center.X, (int)proj.Center.Y + 100, NPCType()); + int oldDuke = NPC.NewNPC(NPC.GetBossSpawnSource(player.whoAmI), spawnPosX, spawnPosY, NPCType()); CalamityUtils.BossAwakenMessage(oldDuke); } - else + else if (Main.netMode == NetmodeID.MultiplayerClient) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ServersideSpawnOldDuke); - netMessage.Write((byte)player.whoAmI); - netMessage.Send(); + SpawnBossOnPositionPacket.Send(spawnPosX, spawnPosY, NPCType(), player); } } } @@ -8785,20 +9622,160 @@ namespace CalamityMod.NPCs #endregion #region Bestiary - public override void SetBestiary(NPC npc, Terraria.GameContent.Bestiary.BestiaryDatabase database, Terraria.GameContent.Bestiary.BestiaryEntry bestiaryEntry) + public override void SetBestiary(NPC npc, BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - // Create a string array containing all an NPC's debuff resistances - string[] elements = new string[5] + // Replace vanilla bestiary flavor text for certain NPCs + // These are ordered by their order in the bestiary, if you're wondering why it seems so arbitrary lmao + switch (npc.netID) { - NPCDebuffResistText(npc.Calamity().VulnerableToHeat, CalamityUtils.GetTextValue("UI.DebuffSystem.Heat")), - NPCDebuffResistText(npc.Calamity().VulnerableToSickness, CalamityUtils.GetTextValue("UI.DebuffSystem.Sickness")), + case NPCID.Guide: + case NPCID.Dryad: + case NPCID.Mechanic: + case NPCID.EmpressButterfly: + case NPCID.DemonEye: + case NPCID.CataractEye: + case NPCID.DialatedEye: + case NPCID.SleepyEye: + case NPCID.GreenEye: + case NPCID.PurpleEye: + case NPCID.Wraith: + case NPCID.BloodNautilus: + case NPCID.DiggerHead: + case NPCID.UndeadMiner: + case NPCID.GraniteGolem: + case NPCID.GraniteFlyer: + case NPCID.GreekSkeleton: + case NPCID.UndeadViking: + case NPCID.IcyMerman: + case NPCID.IceElemental: + case NPCID.DesertBeast: + case NPCID.DuneSplicerHead: + case NPCID.SandElemental: + case NPCID.SandShark: + case NPCID.SandsharkCorrupt: + case NPCID.SandsharkCrimson: + case NPCID.SandsharkHallow: + case NPCID.MeteorHead: + case NPCID.AngryBones: + case NPCID.AngryBonesBig: + case NPCID.AngryBonesBigMuscle: + case NPCID.AngryBonesBigHelmet: + case NPCID.BlueArmoredBones: + case NPCID.BlueArmoredBonesMace: + case NPCID.BlueArmoredBonesNoPants: + case NPCID.BlueArmoredBonesSword: + case NPCID.HellArmoredBones: + case NPCID.HellArmoredBonesSpikeShield: + case NPCID.HellArmoredBonesMace: + case NPCID.HellArmoredBonesSword: + case NPCID.RustyArmoredBonesAxe: + case NPCID.RustyArmoredBonesFlail: + case NPCID.RustyArmoredBonesSword: + case NPCID.RustyArmoredBonesSwordNoArmor: + case NPCID.SkeletonSniper: + case NPCID.TacticalSkeleton: + case NPCID.SkeletonCommando: + case NPCID.BoneLee: + case NPCID.Paladin: + case NPCID.DiabolistRed: + case NPCID.DiabolistWhite: + case NPCID.Necromancer: + case NPCID.NecromancerArmored: + case NPCID.RaggedCaster: + case NPCID.RaggedCasterOpenCoat: + case NPCID.DungeonGuardian: + case NPCID.BoneSerpentHead: + case NPCID.Demon: + case NPCID.VoodooDemon: + case NPCID.RedDevil: + case NPCID.WyvernHead: + case NPCID.Harpy: + case NPCID.MartianProbe: + case NPCID.SeekerHead: + case NPCID.DesertDjinn: + case NPCID.ChaosElemental: + case NPCID.GoblinThief: + case NPCID.GoblinSummoner: + case NPCID.GoblinSorcerer: + case NPCID.PirateCaptain: + case NPCID.Scutlix: + case NPCID.MartianSaucerCore: + case NPCID.TorchGod: + case NPCID.EyeofCthulhu: + case NPCID.BrainofCthulhu: + case NPCID.SkeletronHead: + case NPCID.WallofFlesh: + case NPCID.QueenSlimeBoss: + case NPCID.Retinazer: + case NPCID.Spazmatism: + case NPCID.TheDestroyer: + case NPCID.SkeletronPrime: + case NPCID.Plantera: + case NPCID.HallowBoss: + case NPCID.Golem: + case NPCID.DukeFishron: + case NPCID.CultistBoss: + case NPCID.CultistDevote: + case NPCID.LunarTowerNebula: + case NPCID.LunarTowerSolar: + case NPCID.LunarTowerVortex: + case NPCID.LunarTowerStardust: + case NPCID.MoonLordCore: + FlavorTextBestiaryInfoElement f = new("Hi CS0120"); + bestiaryEntry.Info.RemoveAll(i => i.GetType() == f.GetType()); + bestiaryEntry.Info.Add(new FlavorTextBestiaryInfoElement(CalamityUtils.GetTextValue($"Bestiary.Vanilla.{Lang.GetNPCName(npc.netID).Key}"))); + break; + default: + break; + + } + + // Create a string array containing all an NPC's debuff resistances + string[] elements = + [ NPCDebuffResistText(npc.Calamity().VulnerableToCold, CalamityUtils.GetTextValue("UI.DebuffSystem.Cold")), NPCDebuffResistText(npc.Calamity().VulnerableToElectricity, CalamityUtils.GetTextValue("UI.DebuffSystem.Electricity")), + NPCDebuffResistText(npc.Calamity().VulnerableToHeat, CalamityUtils.GetTextValue("UI.DebuffSystem.Heat")), + NPCDebuffResistText(npc.Calamity().VulnerableToSickness, CalamityUtils.GetTextValue("UI.DebuffSystem.Sickness")), 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)); + + // Add the Astral Infection to the Enchanted Nightcrawler's entry as it spawns there now + if (npc.type == NPCID.EnchantedNightcrawler) + { + bestiaryEntry.AddTags(GetInstance().ModBiomeBestiaryInfoElement); + } + + // Add the Surface Mushroom biome to the Truffle Worm's entry as it spawns there now + if (npc.type == NPCID.TruffleWorm) + { + bestiaryEntry.AddTags(BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SurfaceMushroom); + } + + // Remove the static portraits from vanilla worms so that Calamity's worm movement can be added in PreDraw + switch (npc.netID) + { + case NPCID.DiggerHead: + case NPCID.GiantWormHead: + case NPCID.EaterofWorldsHead: + case NPCID.WyvernHead: + case NPCID.StardustWormHead: + case NPCID.SolarCrawltipedeHead: + case NPCID.CultistDragonHead: + case NPCID.TheDestroyer: + case NPCID.LeechHead: + case NPCID.DevourerHead: + case NPCID.TombCrawlerHead: + case NPCID.DuneSplicerHead: + case NPCID.BloodEelHead: + case NPCID.BoneSerpentHead: + case NPCID.SeekerHead: + NPCID.Sets.NPCBestiaryDrawOffset[npc.type] = NPCID.Sets.NPCBestiaryDrawOffset[npc.type] with { CustomTexturePath = null }; + break; + } } public static string NPCDebuffResistText(bool? effectiveness, string name) diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index ffd619919b..55206d6a05 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -19,10 +19,8 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Typeless; -using CalamityMod.NPCs.AcidRain; -using CalamityMod.NPCs.Astral; -using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Ores; using CalamityMod.World; using CalamityMod.World.Planets; @@ -147,6 +145,12 @@ namespace CalamityMod.NPCs npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 3, 2)); break; + // Skeleton Merchant + // Punch Card @ 100% + case NPCID.SkeletonMerchant: + npcLoot.Add(ModContent.ItemType()); + break; + // Mimic // Drops all of its items Calamity Style @ 25% each // This requires erasing its vanilla behavior. @@ -160,25 +164,54 @@ namespace CalamityMod.NPCs return false; }); - int[] mimicItems = new int[] - { + // Yes, Mimics have three separate loot tables which we must reintegrate + int[] normalMimicItems = + [ ItemID.MagicDagger, ItemID.CrossNecklace, ItemID.PhilosophersStone, ItemID.StarCloak, ItemID.TitanGlove, ItemID.DualHook - }; + ]; + int[] remixPreHardMimicItems = + [ + ItemID.BandofRegeneration, + ItemID.MagicMirror, + ItemID.CloudinaBottle, + ItemID.HermesBoots, + ItemID.ShoeSpikes, + ItemID.Mace + ]; + int[] remixHardmodeMimicItems = + [ + ItemID.WandofSparking, + ItemID.CrossNecklace, + ItemID.PhilosophersStone, + ItemID.StarCloak, + ItemID.TitanGlove, + ItemID.DualHook + ]; // Mimics will not drop any items if spawned from statues. - var notStatue = npcLoot.DefineConditionalDropSet(new Conditions.NotFromStatue()); - notStatue.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, mimicItems)); + var notRemix = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !(npc.SpawnedFromStatue || Main.remixWorld))); + var remixPreHM = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !npc.SpawnedFromStatue && Main.remixWorld && !Main.hardMode)); + var remixHardmode = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !npc.SpawnedFromStatue && Main.remixWorld && Main.hardMode)); + notRemix.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, normalMimicItems)); + remixPreHM.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, remixPreHardMimicItems)); + remixHardmode.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, remixHardmodeMimicItems)); } catch (ArgumentNullException) { } break; #endregion #region Desert + // Antlion + // Antlion Skewer @ 5% + case NPCID.Antlion: + npcLoot.Add(ModContent.ItemType(), 20); + break; + // Tomb Crawler // Burnt Sienna @ 4% Normal, 6.67% Expert+ case NPCID.TombCrawlerHead: @@ -188,13 +221,22 @@ namespace CalamityMod.NPCs // Sand Elemental // Elemental in a Bottle @ 20% Normal, 33.33% Expert+ // Rare Elemental in a Bottle @ 10% Normal, 16.67% Expert+ + // Desert Key @ 10% case NPCID.SandElemental: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); + npcLoot.Add(ItemID.DungeonDesertKey, 10); break; #endregion #region Ice + + // Ice Bat. + // Frostbat Staff @ 6.67% + case NPCID.IceBat: + npcLoot.Add(ModContent.ItemType(), 15); + break; + // Icy Merman, Icy Tortoise, Ice Elemental, Wolf // Essence of Eleum @ 100% case NPCID.IcyMerman: @@ -223,53 +265,79 @@ namespace CalamityMod.NPCs return false; }); - int[] iceMimicItems = new int[] - { + // Yes, Ice Mimics have three separate loot tables which me must reintegrate + int[] normalIceMimicItems = + [ ItemID.Frostbrand, ItemID.IceBow, ItemID.FlowerofFrost - }; + ]; + int[] remixPreHardIceMimicItems = + [ + ItemID.IceBoomerang, + ItemID.IceBlade, + ItemID.IceBow, + ItemID.IceSkates, + ItemID.BlizzardinaBottle, + ItemID.FlurryBoots + ]; + int[] remixHardmodeIceMimicItems = + [ + ItemID.Frostbrand, + ItemID.SnowballCannon, + ItemID.FlowerofFrost + ]; // Ice Mimics will not drop any items if spawned from statues. - var notStatue = npcLoot.DefineConditionalDropSet(new Conditions.NotFromStatue()); - notStatue.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, iceMimicItems)); - notStatue.Add(ItemID.ToySled, 20, 1, 1); + var notRemix = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !(npc.SpawnedFromStatue || Main.remixWorld))); + var remixPreHM = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !npc.SpawnedFromStatue && Main.remixWorld && !Main.hardMode)); + var remixHardmode = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !npc.SpawnedFromStatue && Main.remixWorld && Main.hardMode)); + notRemix.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, normalIceMimicItems)); + remixPreHM.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, remixPreHardIceMimicItems)); + remixHardmode.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, remixHardmodeIceMimicItems)); + + // Independent from all of the Remix madness, Ice Mimics have a 5% chance to drop Toy Sled. + npcLoot.DefineConditionalDropSet(new Conditions.NotFromStatue()).Add(ItemID.ToySled, 20); } catch (ArgumentNullException) { } break; // Ice Golem // 8-10 Essence of Eleum @ 100%, 10-12 Expert+ + // Frozen Key @ 10% case NPCID.IceGolem: npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 10, 10, 12)); + npcLoot.Add(ItemID.FrozenKey, 10); break; #endregion #region Aquatic / Ocean // Pink Jellyfish - // Life Jelly @ 14.29% Normal, 25% Expert+ + // Life Jelly @ 10% Normal, 14.29% Expert+ case NPCID.PinkJellyfish: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 7)); break; // Blue Jellyfish - // Cleansing Jelly @ 14.29% Normal, 25% Expert+ + // Cleansing Jelly @ 10% Normal, 14.29% Expert+ case NPCID.BlueJellyfish: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 7)); break; // Green Jellyfish - // Vital Jelly @ 14.29% Normal, 25% Expert+ + // Vital Jelly @ 12.5% Normal, 20% Expert+ case NPCID.GreenJellyfish: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 8, 5)); break; // Shark // Shark Tooth Necklace @ 4% Normal, 6.67% Expert+ - // Joyful Heart @ 4% Normal, 6.67% Expert+ + // Joyful Heart @ 5% + // Sharky Plush @ 1% case NPCID.Shark: npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.SharkToothNecklace, 25, 15)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); + npcLoot.Add(ModContent.ItemType(), 20); + npcLoot.Add(ModContent.ItemType(), 100); break; // Blood Jelly, Fungo Fish @@ -299,13 +367,27 @@ namespace CalamityMod.NPCs npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); break; - // Biome Mimics + // Corrupt Mimic // Celestial Claymore @ 14.29% Normal, 25% Expert+ - case NPCID.BigMimicHallow: case NPCID.BigMimicCorruption: - case NPCID.BigMimicCrimson: - case NPCID.BigMimicJungle: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ItemID.CorruptionKey, 10); + break; + + // Crimson Mimic + // Celestial Claymore @ 14.29% Normal, 25% Expert+ + // Crimson Key @ 10% + case NPCID.BigMimicCrimson: + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ItemID.CrimsonKey, 10); + break; + + // Hallowed Mimic + // Celestial Claymore @ 14.29% Normal, 25% Expert+ + // Hallowed Key @ 10% + case NPCID.BigMimicHallow: + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ItemID.HallowedKey, 10); break; // World Feeder @@ -342,25 +424,25 @@ namespace CalamityMod.NPCs #region Jungle //Moss hornets are after all of this switching since it no longer works if placed here - // Jungle Slime, Spiked Jungle Slime, Arapaima - // Murky Paste @ 33.33% Normal, 50% Expert+ - case NPCID.JungleSlime: - case NPCID.SpikedJungleSlime: - case NPCID.Arapaima: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 3, 2)); - break; - - // Angry Trapper - // Trapper Bulb @ 50% Normal, 100% Expert+ - case NPCID.AngryTrapper: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 2, 1)); - break; - // Moth // Butterfly Dust @ 100% INSTEAD OF 50% case NPCID.Moth: npcLoot.ChangeDropRate(ItemID.ButterflyDust, 1, 1); break; + + // Jungle Mimic + // Celestial Claymore @ 14.29% Normal, 25% Expert+ + case NPCID.BigMimicJungle: + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + break; + + // Lihzahrd + Flying Snake + // Jungle Key @ 0.67% + case NPCID.Lihzahrd: + case NPCID.LihzahrdCrawler: + case NPCID.FlyingSnake: + npcLoot.Add(ItemID.JungleKey, 150); + break; #endregion #region Dungeon @@ -391,13 +473,6 @@ namespace CalamityMod.NPCs npcLoot.ChangeDropRate(ItemID.WispinaBottle, 1, 200); break; - // Necromancer - // Wrath of the Ancients @ 4% Normal, 6.67% Expert+ - case NPCID.Necromancer: - case NPCID.NecromancerArmored: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); - break; - // Giant Cursed Skull // Keelhaul @ 6.67% IF Leviathan dead case NPCID.GiantCursedSkull: @@ -422,37 +497,41 @@ namespace CalamityMod.NPCs #endregion #region Hell + + // Hellbat. + // Flarebat Staff @ 4% + case NPCID.Hellbat: + npcLoot.Add(ModContent.ItemType(), 25); + break; + // Fire Imp - // Ashen Stalactite @ 10% Normal, 16.67% Expert+ + // Ashen Stalactite @ 4%, 14.28% after defeating EoW/BoC case NPCID.FireImp: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); + npcLoot.AddIf((info) => !NPC.downedBoss2, ModContent.ItemType(), 25); + npcLoot.AddIf((info) => NPC.downedBoss2, ModContent.ItemType(), 7); break; // Demon, Voodoo Demon - // Demonic Bone Ash @ 33.33% Normal, 50% Expert+ - // Bladecrest Oathsword @ 4% Normal, 6.67% Expert+ + // Bladecrest Oathsword @ 2%, 6.67% after defeating EoW/BoC case NPCID.Demon: case NPCID.VoodooDemon: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 3, 2)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); + npcLoot.AddIf((info) => !NPC.downedBoss2, ModContent.ItemType(), 50); + npcLoot.AddIf((info) => NPC.downedBoss2, ModContent.ItemType(), 15); break; // Bone Serpent - // Demonic Bone Ash @ 33.33% Normal, 50% Expert+ - // Old Lord Oathsword @ 8.33% Normal, 14.29% Expert+ + // Old Lord Oathsword @ 4% Normal, 14.29% after defeating EoW/BoC case NPCID.BoneSerpentHead: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 3, 2)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 12, 7)); + npcLoot.AddIf((info) => !NPC.downedBoss2, ModContent.ItemType(), 25); + npcLoot.AddIf((info) => NPC.downedBoss2, ModContent.ItemType(), 4); break; // Red Devil // Fire Feather @ 10% INSTEAD OF 1.33% - // Demonic Bone Ash @ 33.33% Normal, 50% Expert+ // Abbadon @ 8.33% Normal, 14.29% Expert+ // Essence of Chaos @ 50% case NPCID.RedDevil: npcLoot.ChangeDropRate(ItemID.FireFeather, 1, 10); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 3, 2)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 12, 7)); npcLoot.Add(ModContent.ItemType(), 2); break; @@ -463,18 +542,25 @@ namespace CalamityMod.NPCs case NPCID.MaggotZombie: case NPCID.TheBride: case NPCID.TheGroom: - npcLoot.Add(ModContent.ItemType(), 10); + postEoC.Add(ModContent.ItemType(), 10); + break; + + // Ghost Bracelet @ 5% (Dandy requests this drops at a "high chance" but inventory clutter is real so) + case NPCID.Ghost: + npcLoot.Add(ModContent.ItemType(), 20); break; #endregion #region Blood Moon - // All Blood Moon enemies + // After EoC, All Blood Moon enemies // Drop Blood Orbs @ 100% (25% for common enemies) case NPCID.BloodZombie: case NPCID.Drippler: - npcLoot.Add(ModContent.ItemType(), 4); + postEoC.Add(ModContent.ItemType(), 4); break; - + + //Hardmode enemies drop orbs even if EoC is not dead + //99% of players will not encounter this and challenge runners will appreciate it case NPCID.Clown: npcLoot.Add(ModContent.ItemType(), 1, 6, 12); break; @@ -483,11 +569,11 @@ namespace CalamityMod.NPCs // Bouncing Eyeball @ 10% Normal, 16.66% Expert+ case NPCID.EyeballFlyingFish: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); - npcLoot.Add(ModContent.ItemType(), 1, 10, 12); + postEoC.Add(ModContent.ItemType(), 1, 10, 12); break; case NPCID.ZombieMerman: - npcLoot.Add(ModContent.ItemType(), 1, 10, 12); + postEoC.Add(ModContent.ItemType(), 1, 10, 12); break; case NPCID.GoblinShark: @@ -618,8 +704,17 @@ namespace CalamityMod.NPCs break; // Mothron - // 20-30 Darksun Fragment @ 100% IF Devourer of Gods dead case NPCID.Mothron: + // Make all drops accessible pre-Mechs as Mothrons already only spawn post-Plantera (linearity rule removal) + // This is identical to vanilla drop rates + // This loot is already reported in vanilla regardless of condition so we don't need to report it twice + LeadingConditionRule postMechs = new LeadingConditionRule(new Conditions.DownedAllMechBosses()); + postMechs.OnFailedConditions(ItemDropRule.ExpertGetsRerolls(ItemID.BrokenHeroSword, 4, 1), hideLootReport: true); + postMechs.OnFailedConditions(ItemDropRule.ExpertGetsRerolls(ItemID.MothronWings, 20, 1), hideLootReport: true); + postMechs.OnFailedConditions(ItemDropRule.ExpertGetsRerolls(ItemID.TheEyeOfCthulhu, 3, 1), hideLootReport: true); + npcLoot.Add(postMechs); + + // 20-30 Darksun Fragment @ 100% IF Devourer of Gods dead postDoG.Add(ModContent.ItemType(), 1, 20, 30); break; @@ -731,26 +826,33 @@ namespace CalamityMod.NPCs #region Martian Madness // Martian Madness On-Foot Soldiers - // 1-4 Shock Grenade @ 25% + // 1.5% chance to drop any of the three Calamity martian drops case NPCID.BrainScrambler: case NPCID.GrayGrunt: case NPCID.GigaZapper: - case NPCID.MartianEngineer: case NPCID.RayGunner: case NPCID.ScutlixRider: - npcLoot.Add(ModContent.ItemType(), 4, 1, 4); + npcLoot.Add(ModContent.ItemType(), 66); + npcLoot.Add(ModContent.ItemType(), 66); + npcLoot.Add(ModContent.ItemType(), 66); + break; + + // Martian Engineer + // 10% chance to drop Wingman + case NPCID.MartianEngineer: + npcLoot.Add(ModContent.ItemType(), 10); break; // Martian Officer - // 3-8 Shock Grenade @ 33.33% + // 8% chance to drop Shock Grenade case NPCID.MartianOfficer: - npcLoot.Add(ModContent.ItemType(), 3, 3, 8); + npcLoot.Add(ModContent.ItemType(), 12); break; // Martian Walker - // Wingman @ 14.29% Normal, 25% Expert+ + // 12% chance to drop Nullification Pistol case NPCID.MartianWalker: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ModContent.ItemType(), 8); break; // Martian Saucer @@ -773,7 +875,6 @@ namespace CalamityMod.NPCs ItemID.LaserMachinegun, ItemID.ElectrosphereLauncher, ItemID.InfluxWaver, - ModContent.ItemType() }; npcLoot.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, saucerItems)); @@ -888,6 +989,9 @@ namespace CalamityMod.NPCs npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.RoyalGel)); // Would be in the bag otherwise + npcLoot.AddNormalOnly(ItemDropRule.ByCondition(DropHelper.Remix, ItemID.Keybrand, 4)); + npcLoot.AddNormalOnly(ItemDropRule.ByCondition(DropHelper.NotRemix, ItemID.Katana, 4)); + npcLoot.AddNormalOnly(ModContent.ItemType(), 10); npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1026,14 +1130,13 @@ namespace CalamityMod.NPCs }); // Define a replacement rule which drops the weapons Calamity style. - npcLoot.AddNormalOnly(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, ItemID.BeeKeeper, ItemID.BeesKnees, ItemID.BeeGun)); + npcLoot.AddNormalOnly(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, ItemID.BeeKeeper, ItemID.BeesKnees, ItemID.BeeGun, ModContent.ItemType())); // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.HiveBackpack)); npcLoot.AddNormalOnly(ModContent.ItemType(), 10); // Would be in the bag otherwise - npcLoot.AddNormalOnly(ModContent.ItemType(), 1, 30, 50); npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); // Queen Bee drops Stingers in Calamity @@ -1152,10 +1255,6 @@ namespace CalamityMod.NPCs // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); - // WoF drops Evil Keys - npcLoot.Add(ItemID.CorruptionKey, 3); - npcLoot.Add(ItemID.CrimsonKey, 3); - // Master items drop in Revengeance rev.Add(ItemID.WallofFleshMasterTrophy); rev.Add(ItemID.WallOfFleshGoatMountItem, 4); @@ -1178,9 +1277,6 @@ namespace CalamityMod.NPCs // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); - // Queen Slime drops the Hallowed Key - npcLoot.Add(ItemID.HallowedKey, 3); - // Master items drop in Revengeance rev.Add(ItemID.QueenSlimeMasterTrophy); rev.Add(ItemID.QueenSlimePetItem, 4); @@ -1334,9 +1430,6 @@ namespace CalamityMod.NPCs npcLoot.AddNormalOnly(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); - // Plantera drops Jungle Key - npcLoot.Add(ItemID.JungleKey, 3); - // Master items drop in Revengeance rev.Add(ItemID.PlanteraMasterTrophy); rev.Add(ItemID.PlanteraPetItem, 4); @@ -1562,8 +1655,8 @@ DukeEditFailed: rev.Add(ItemID.FairyQueenMasterTrophy); rev.Add(ItemID.FairyQueenPetItem, 4); - // GFB Fabsol's Vodka and Terraformer drop - GFB.Add(ModContent.ItemType(), 1, 1, 9999, true); + // GFB Cirrus' Vodka and Terraformer drop + GFB.Add(ModContent.ItemType(), 1, 1, 9999, true); GFB.Add(ItemID.Clentaminator2, hideLootReport: true); // Lore @@ -1644,19 +1737,53 @@ DukeEditFailed: // All Moss Hornets // Needler @ 4% Normal, 6.67% Expert+ - if (CalamityLists.mossHornetList.Contains(npc.type)) + if (MossHornetIDList.Includes(npc.type)) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); // All Skeletons // Ancient Bone Dust @ 20% Normal, 33.33% Expert+ - if (CalamityLists.skeletonList.Contains(npc.type)) + if (SkeletonIDList.Includes(npc.type)) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); // All Hardmode Dungeon Enemies // Ectoplasm @ 20% - if (CalamityLists.dungeonEnemyBuffList.Contains(npc.type)) + if (BuffedDungeonEnemiesList.Includes(npc.type)) npcLoot.Add(ItemID.Ectoplasm, 5); #endregion + + // Blanket remove all specific food item drops that have changed obtainment methods in Calamity + // This is type-indiscriminate and will also most probably hit modded NPCs too + + // CIT 7NOV2024: Yeah it hits modded NPCs; in fact it removes GFB drops from Ravager and Deus + // Fixing this by making the code only run if the NPC is not a boss + if (!npc.boss) + { + int[] randomFoodItems = new int[] +{ + ItemID.ApplePie, + ItemID.BananaSplit, + ItemID.BBQRibs, + ItemID.Burger, + ItemID.MilkCarton, + ItemID.ChocolateChipCookie, + ItemID.CoffeeCup, + ItemID.CreamSoda, + ItemID.FriedEgg, + ItemID.Fries, + ItemID.Grapes, + ItemID.Hotdog, + ItemID.IceCream, + ItemID.Milkshake, + ItemID.Nachos, + ItemID.Pizza, + ItemID.PotatoChips, + ItemID.ShrimpPoBoy, + ItemID.Spaghetti, + ItemID.Steak +}; + foreach (int foodItemID in randomFoodItems) + npcLoot.RemoveWhere((rule) => rule is ItemDropWithConditionRule foodRule && foodRule.itemId == foodItemID); + } } #endregion @@ -1687,34 +1814,8 @@ DukeEditFailed: #region Pre Kill public override bool PreKill(NPC npc) { - // Stop all random food drops that aren't sold, crafted or etc. - var randomFoodItems = new int[] - { - ItemID.ApplePie, - ItemID.BananaSplit, - ItemID.BBQRibs, - ItemID.Burger, - ItemID.MilkCarton, - ItemID.ChocolateChipCookie, - ItemID.CoffeeCup, - ItemID.CreamSoda, - ItemID.FriedEgg, - ItemID.Fries, - ItemID.Grapes, - ItemID.Hotdog, - ItemID.IceCream, - ItemID.Milkshake, - ItemID.Nachos, - ItemID.Pizza, - ItemID.PotatoChips, - ItemID.ShrimpPoBoy, - ItemID.Spaghetti, - ItemID.Steak - }; - DropHelper.BlockDrops(randomFoodItems); - // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping partial loot in Rev+ - if (CalamityWorld.revenge && (CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper)) + if (CalamityWorld.revenge && (EaterOfWorldsIDList.Includes(npc.type) || npc.type == NPCID.Creeper)) DropHelper.BlockDrops(ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); // Boss Rush pre-kill effects @@ -1749,9 +1850,6 @@ DukeEditFailed: if (npc.AnyInteractions()) SplittingWormBestiaryUpdate(npc); - // Check whether bosses should be spawned naturally as a result of this NPC's death. - CheckBossSpawn(npc); - // Determine whether this NPC is the second Twin killed in a fight, regardless of which Twin it is. bool lastTwinStanding = false; if (npc.type == NPCID.Retinazer) @@ -1762,7 +1860,7 @@ DukeEditFailed: // On-kill NON-LOOT behavior for Eater of Worlds if ((npc.boss && (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)) || npc.type == NPCID.BrainofCthulhu) { - SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Demolitionist }, NPC.downedBoss2); + SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad }, NPC.downedBoss2); SetNewBossJustDowned(npc); } @@ -1775,7 +1873,7 @@ DukeEditFailed: break; case NPCID.EyeofCthulhu: - SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad, NPCID.Demolitionist }, NPC.downedBoss1); + SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss1); SetNewBossJustDowned(npc); break; @@ -1789,7 +1887,7 @@ DukeEditFailed: break; case NPCID.SkeletronHead: - SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad, NPCID.Demolitionist }, NPC.downedBoss3); + SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss3); SetNewBossJustDowned(npc); // First kill: Notify of Abyss chests being unlocked. @@ -1805,13 +1903,13 @@ DukeEditFailed: break; case NPCID.WallofFlesh: - SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Painter, NPCID.WitchDoctor, NPCID.Stylist, NPCID.DyeTrader, NPCID.Demolitionist, NPCID.PartyGirl, NPCID.Clothier, NPCID.SkeletonMerchant, NPCID.BestiaryGirl, ModContent.NPCType() }, Main.hardMode); + SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Painter, NPCID.WitchDoctor, NPCID.Stylist, NPCID.DyeTrader, NPCID.Demolitionist, NPCID.PartyGirl, NPCID.Clothier, NPCID.SkeletonMerchant, NPCID.BestiaryGirl }, Main.hardMode); SetNewBossJustDowned(npc); if (!Main.hardMode && !BossRushEvent.BossRushActive) { // Increase altar count to allow natural mech boss spawning. - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) WorldGen.altarCount++; string key2 = "Mods.CalamityMod.Status.Progression.UglyBossText"; @@ -1831,11 +1929,11 @@ DukeEditFailed: break; case NPCID.TheDestroyer: - SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); - SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); + SetNewShopVariable(new int[] { NPCID.Demolitionist, NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); - if (!NPC.downedMechBoss1 && CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (!NPC.downedMechBoss1 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) SpawnMechBossHardmodeOres(); break; @@ -1843,26 +1941,26 @@ DukeEditFailed: case NPCID.Retinazer: if (lastTwinStanding) { - SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); - SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); + SetNewShopVariable(new int[] { NPCID.Demolitionist, NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); - if (!NPC.downedMechBoss2 && CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (!NPC.downedMechBoss2 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) SpawnMechBossHardmodeOres(); } break; case NPCID.SkeletronPrime: - SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); - SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); + SetNewShopVariable(new int[] { NPCID.Demolitionist, NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); SetNewBossJustDowned(npc); - if (!NPC.downedMechBoss3 && CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (!NPC.downedMechBoss3 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) SpawnMechBossHardmodeOres(); break; case NPCID.Plantera: - SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, NPCID.BestiaryGirl, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); + SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, NPCID.BestiaryGirl, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); SetNewBossJustDowned(npc); // Spawn Perennial Ore if Plantera has never been killed @@ -1886,26 +1984,26 @@ DukeEditFailed: break; case NPCID.Everscream: - SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedChristmasTree || !NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); + SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedChristmasTree || !NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); break; case NPCID.SantaNK1: - SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); + SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); break; case NPCID.IceQueen: - SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || !NPC.downedChristmasSantank || NPC.downedChristmasIceQueen); + SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || !NPC.downedChristmasSantank || NPC.downedChristmasIceQueen); break; case NPCID.Golem: - SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); + SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); SetNewBossJustDowned(npc); // If Golem has never been killed, send a message about the Plague. if (!NPC.downedGolemBoss && !BossRushEvent.BossRushActive) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(PlagueSound, Main.player[Main.myPlayer].Center); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(PlagueSound, Main.LocalPlayer.Center); string key3 = "Mods.CalamityMod.Status.Progression.BabyBossText"; Color messageColor3 = Color.Lime; @@ -1933,7 +2031,7 @@ DukeEditFailed: break; case NPCID.MoonLordCore: - SetNewShopVariable(new int[] { NPCID.Princess, ModContent.NPCType() }, NPC.downedMoonlord); + SetNewShopVariable(new int[] { NPCID.Princess, ModContent.NPCType() }, NPC.downedMoonlord); SetNewBossJustDowned(npc); string key5 = "Mods.CalamityMod.Status.Progression.MoonBossText"; @@ -2120,88 +2218,5 @@ DukeEditFailed: return true; } #endregion - - #region Check Boss Spawn - // TODO -- not loot code, should be moved eventually - private void CheckBossSpawn(NPC npc) - { - if ((npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !DownedBossSystem.downedPolterghast) - { - CalamityMod.ghostKillCount++; - if (CalamityMod.ghostKillCount == 10) - { - string key = "Mods.CalamityMod.Status.Boss.GhostBossText2"; - Color messageColor = Color.Cyan; - - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - else if (CalamityMod.ghostKillCount == 20) - { - string key = "Mods.CalamityMod.Status.Boss.GhostBossText3"; - Color messageColor = Color.Cyan; - - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - - if (CalamityMod.ghostKillCount >= 30 && Main.netMode != NetmodeID.MultiplayerClient) - { - int lastPlayer = npc.lastInteraction; - - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) - { - lastPlayer = npc.FindClosestPlayer(); - } - - if (lastPlayer >= 0) - { - SoundEngine.PlaySound(Polterghast.Polterghast.SpawnSound, Main.player[lastPlayer].Center); - NPC.SpawnOnPlayer(lastPlayer, ModContent.NPCType()); - CalamityMod.ghostKillCount = 0; - } - } - } - - bool normalShark = npc.type == NPCID.SandShark || npc.type == NPCID.SandsharkHallow || npc.type == NPCID.SandsharkCorrupt || npc.type == NPCID.SandsharkCrimson; - if (NPC.downedPlantBoss && (normalShark || (npc.type == ModContent.NPCType() && Main.zenithWorld)) && !NPC.AnyNPCs(ModContent.NPCType())) - { - CalamityMod.sharkKillCount++; - if (CalamityMod.sharkKillCount == 4) - { - string key = "Mods.CalamityMod.Status.Boss.SandSharkText"; - Color messageColor = Color.Goldenrod; - - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - else if (CalamityMod.sharkKillCount == 8) - { - string key = "Mods.CalamityMod.Status.Boss.SandSharkText2"; - Color messageColor = Color.Goldenrod; - - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - if (CalamityMod.sharkKillCount >= 10 && Main.netMode != NetmodeID.MultiplayerClient) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - SoundEngine.PlaySound(Mauler.RoarSound, Main.player[Main.myPlayer].Center); - } - - int lastPlayer = npc.lastInteraction; - - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) - { - lastPlayer = npc.FindClosestPlayer(); - } - - if (lastPlayer >= 0) - { - NPC.SpawnOnPlayer(lastPlayer, ModContent.NPCType()); - CalamityMod.sharkKillCount = -5; - } - } - } - } - #endregion } } diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index abf91440b3..ccf0720218 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -9,6 +9,8 @@ using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Dyes; using CalamityMod.Items.Dyes.HairDye; using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Potions; @@ -18,6 +20,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -77,7 +80,6 @@ namespace CalamityMod.NPCs "XiaoEn0426", // <@!440448864772816896> (xiaoen0426) "Jeffred", // <@!295362230038560768> (paladinsamuel) "The Cooler Arthur", // <@!568263512523014154> (gokuartillery) - "Markie", // <@!291141964039061504> (markie_) "Shark", // <@!874464051697172492> (congratsistrash) "Sagi", // <@!508233115781693441> (sagittariod) }; @@ -89,6 +91,7 @@ namespace CalamityMod.NPCs private static readonly string[] CyborgNames = { "Sylux", // <@!331812782183809025> (gonkachino) + "XL-39 Nemesis", // <@!1104036024063107082> (yashimayamanata) }; private static readonly string[] DemolitionistNames = { @@ -137,6 +140,7 @@ namespace CalamityMod.NPCs "Leeman", // <@!281999243168841728> (tweee) "Mihai", // <@!373941893467209730> (cmihaii.) "Cooler Kevin", // <@!614126424751603714> (exellent.) + "Dinkleberg", // <@!581993958037520404> (hyperionzx) }; private static readonly string[] MechanicNames = { @@ -144,7 +148,7 @@ namespace CalamityMod.NPCs "Daawn", // <@!206162323541458944> (daawnily) "Robin", // <@!654737510030639112> (altzeus) "Curly", // <@!673092101780668416> (curly4830) - "Cobalt", // <@!132962828922388481> (cobalt_44) + "Cobalt", // <@!132962828922388481> (cobalt_44) }; private static readonly string[] MerchantNames = { @@ -155,14 +159,17 @@ namespace CalamityMod.NPCs "Farsni", "Fanny", // <@!799749125720637460> (zombiewolf511) "Mausi", // <@!194156349347594241> (sadouken) + "Fiona", // <@!475216964168450048> (thatgayguy69) }; private static readonly string[] PainterNames = { "Picasso", // <@!353316526306361347> (sconicboom -- for the late picassosbean2819) + "Bew", // <@!232291351167893505> (dmshi) }; private static readonly string[] PartyGirlNames = { "Arin", // <@!268169458302976012> (kiyotu) + "Typhäne", // <@!222064016107896832> (typhane.) }; private static readonly string[] PirateNames = { @@ -170,6 +177,7 @@ namespace CalamityMod.NPCs "Cap'n Deek", // "Alex N" on Patreon (No discord account) "Captain Billy Bones", // <@!699589229507772416> (djackv) "Captain J. Crackers", // <@!233232602994049024> (qyuuno) + "Gol D. Roger", // <@!256228859110752257> (xtra3678) }; private static readonly string[] PrincessNames = { @@ -179,6 +187,7 @@ namespace CalamityMod.NPCs "Nyavi Aceso", // <@!270260920888852480> (navigator.) "everquartz", // <@!451343554451865611> (everquartz) "Gwynevere", // <@!142752927348424704> (nuclearchaosazathoth) + "Hael", // <@!641747280944431156> (kalebtull) }; private static readonly string[] SantaClausNames = { @@ -195,12 +204,15 @@ namespace CalamityMod.NPCs "Vorbis", "Angel", "Mòrag Ladair", // <@!161893929485074432> (jalapeno9) + "Linn", // <@!277983612383526913> (duckycolors) + "Eira", // <@!1166136068408623234> (taela_gemetha) }; private static readonly string[] StylistNames = { "Amber", // <@!114677116473180169> (mishirousui) "Faith", // <@!509050283871961123> (toasty1007) "Xsiana", // <@!625780237489143839> (lokistic) + "Lain", // <@!655201622863118337> (literallyadeerfr) }; private static readonly string[] TavernkeepNames = { @@ -217,6 +229,7 @@ namespace CalamityMod.NPCs { "Stan Pines", "Slap Battles", // <@!923504188615450654> (gravityglider.) + "Borgus", // <@!539127427482255376> (therealmeepman) }; private static readonly string[] TruffleNames = { @@ -238,7 +251,7 @@ namespace CalamityMod.NPCs "Merasmus", // <@!288066987819663360> (spiderprovidence) "Habolo", // <@!163028025494077441> (hellgoat2) "Ortho", // <@!264984390910738432> (worcuus) - "Chris Tallballs", // <@!770211589076418571> (bewearium) + "Chris Tallballs", // <@!770211589076418571> (vysterx) (previously: bewearium) "Syethas", // <@!325413275066171393> (cosmicstariight) "Nextdoor Psycho", // <@!173261518572486656> (nextdoorpsycho) }; @@ -297,6 +310,7 @@ namespace CalamityMod.NPCs "Lucerne", // <@!271954788676141066> (lord_lucerne) "Milo", // <@!401849201597874179> (maskedmilo) "Octo", // <@!796112889353994281> (octolinggrimm) + "Chease", // <@!1039460813490102293> (parmiigianoreggiano) }; private static readonly string[] TownCatSiameseNames = null; private static readonly string[] TownCatBlackNames = @@ -668,16 +682,16 @@ namespace CalamityMod.NPCs (NPCID.Cyborg,(Player player) => player.Calamity().newCyborgInventory, (Player player, bool enabled) =>{ player.Calamity().newCyborgInventory = enabled; }), (NPCID.Princess, (Player player) => player.Calamity().newPrincessInventory,(Player player, bool enabled) =>{ player.Calamity().newPrincessInventory = enabled; }), (NPCID.SkeletonMerchant, (Player player) => player.Calamity().newSkeletonMerchantInventory, (Player player, bool enabled) =>{ player.Calamity().newSkeletonMerchantInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newAmidiasInventory,(Player player, bool enabled) =>{ player.Calamity().newAmidiasInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newBanditInventory,(Player player, bool enabled) =>{ player.Calamity().newBanditInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newCirrusInventory,(Player player, bool enabled) =>{ player.Calamity().newCirrusInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newPermafrostInventory,(Player player, bool enabled) =>{ player.Calamity().newPermafrostInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newCalamitasInventory,(Player player, bool enabled) =>{ player.Calamity().newCalamitasInventory = enabled; }) // lol + (NPCType(), (Player player) => player.Calamity().newAmidiasInventory,(Player player, bool enabled) =>{ player.Calamity().newAmidiasInventory = enabled; }), + (NPCType(), (Player player) => player.Calamity().newBanditInventory,(Player player, bool enabled) =>{ player.Calamity().newBanditInventory = enabled; }), + (NPCType(), (Player player) => player.Calamity().newCirrusInventory,(Player player, bool enabled) =>{ player.Calamity().newCirrusInventory = enabled; }), + (NPCType(), (Player player) => player.Calamity().newPermafrostInventory,(Player player, bool enabled) =>{ player.Calamity().newPermafrostInventory = enabled; }), + (NPCType(), (Player player) => player.Calamity().newCalamitasInventory,(Player player, bool enabled) =>{ player.Calamity().newCalamitasInventory = enabled; }) // lol }; public void TownNPCAlertSystem(NPC npc, Mod mod, SpriteBatch spriteBatch) { - if (CalamityConfig.Instance.ShopNewAlert && npc.townNPC) + if (CalamityClientConfig.Instance.ShopNewAlert && npc.townNPC) { for (int i = 0; i < npcAlertList.Count; i++) { @@ -750,10 +764,10 @@ namespace CalamityMod.NPCs #region NPC Chat public override void GetChat(NPC npc, ref string chat) { - int fapsol = NPC.FindFirstNPC(NPCType()); - int permadong = NPC.FindFirstNPC(NPCType()); - int seahorse = NPC.FindFirstNPC(NPCType()); - int thief = NPC.FindFirstNPC(NPCType()); + int cirrus = NPC.FindFirstNPC(NPCType()); + int permadong = NPC.FindFirstNPC(NPCType()); + int seahorse = NPC.FindFirstNPC(NPCType()); + int thief = NPC.FindFirstNPC(NPCType()); int angelstatue = NPC.FindFirstNPC(NPCID.Merchant); switch (npc.type) @@ -797,6 +811,8 @@ namespace CalamityMod.NPCs case NPCID.Demolitionist: if (Main.rand.NextBool(5) && DownedBossSystem.downedDoG) chat = CalamityUtils.GetTextValue("Vanilla.DemolitionistChat.DoGDefeated"); + else if (Main.rand.NextBool(10)) + chat = CalamityUtils.GetTextValue("Vanilla.DemolitionistChat.MentionSkynamite"); break; case NPCID.Dryad: @@ -804,8 +820,8 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.DarksunEclipse"); else if (Main.rand.NextBool(5) && Main.LocalPlayer.ZoneGlowshroom) { - if (Main.rand.NextBool() && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.DryadChat.DrunkPrincessShroom").Format(Main.npc[fapsol].GivenName); + if (Main.rand.NextBool() && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.DryadChat.DrunkPrincessShroom").Format(Main.npc[cirrus].GivenName); else chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.Mushroom"); } @@ -839,14 +855,16 @@ namespace CalamityMod.NPCs break; case NPCID.Mechanic: - if (Main.rand.NextBool(5) && NPC.downedMoonlord) + if (Main.rand.NextBool(5) && Main.LocalPlayer.InventoryHas(ItemID.PortalGun)) + chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.HasPortalGun"); + else if (Main.rand.NextBool(5) && NPC.downedMoonlord) chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.MoonLordDefeated"); else if (Main.rand.NextBool(5) && Main.eclipse) chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.Eclipse"); else if (Main.rand.NextBool(5) && AcidRainEvent.AcidRainEventIsOngoing) chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.AcidRain"); - else if (Main.rand.NextBool(5) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.MechanicChat.DrunkPrincess").Format(Main.npc[fapsol].GivenName); + else if (Main.rand.NextBool(5) && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.MechanicChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.Merchant: @@ -895,8 +913,8 @@ namespace CalamityMod.NPCs case NPCID.PartyGirl: if (Main.rand.NextBool(4) && Main.eclipse) chat = CalamityUtils.GetTextValue("Vanilla.PartyGirlChat.Eclipse" + Main.rand.Next(1, 2 + 1)); - else if (Main.rand.NextBool(10) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.PartyGirlChat.DrunkPrincess").Format(Main.npc[fapsol].GivenName); + else if (Main.rand.NextBool(10) && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.PartyGirlChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.Pirate: @@ -904,7 +922,7 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.PreLeviathan"); else if (Main.rand.NextBool(5) && DownedBossSystem.downedAquaticScourge) chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.WetScourgeDefeated"); - else if (Main.rand.NextBool(5) && fapsol != -1) + else if (Main.rand.NextBool(5) && cirrus != -1) chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.DrunkPrincess"); else if (Main.rand.NextBool(5) && seahorse != -1) chat = CalamityUtils.GetText("Vanilla.PirateChat.SeaKing").Format(Main.npc[seahorse].GivenName); @@ -920,9 +938,7 @@ namespace CalamityMod.NPCs break; case NPCID.Steampunker: - if (Main.rand.NextBool(5) && Main.LocalPlayer.InventoryHas(ItemID.PortalGun)) - chat = CalamityUtils.GetTextValue("Vanilla.SteampunkerChat.HasPortalGun"); - else if (Main.rand.NextBool(5) && NPC.downedMoonlord) + if (Main.rand.NextBool(5) && NPC.downedMoonlord) chat = CalamityUtils.GetTextValue("Vanilla.SteampunkerChat.MoonLordDefeated"); else if (Main.rand.NextBool(5) && Main.LocalPlayer.Calamity().ZoneAstral) chat = CalamityUtils.GetTextValue("Vanilla.SteampunkerChat.Astral"); @@ -934,8 +950,12 @@ namespace CalamityMod.NPCs string worldEvil = Language.GetTextValue("LegacyMisc." + (WorldGen.crimson ? 102 : 101)); if (Main.rand.NextBool(15) && Main.hardMode) chat = CalamityUtils.GetText("Vanilla.StylistChat.Hardmode").Format(worldEvil); - if (Main.rand.NextBool(15) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.StylistChat.DrunkPrincess" + (ChildSafety.Disabled ? Main.rand.Next(1, 2 + 1) : 1)).Format(Main.npc[fapsol].GivenName); + if (Main.rand.NextBool(15) && cirrus != -1) + { + int noChildSafetyCirrusLines = NPC.downedMoonlord ? Main.rand.Next(2, 3 + 1) : Main.rand.Next(1, 2 + 1); + int childSafetyCirrusLines = NPC.downedMoonlord ? 3 : 1; + chat = CalamityUtils.GetText("Vanilla.StylistChat.DrunkPrincess" + (ChildSafety.Disabled ? noChildSafetyCirrusLines : childSafetyCirrusLines)).Format(Main.npc[cirrus].GivenName); + } if ((Main.rand.NextBool(npc.GivenName == "Amber" ? 10 : 15)) && Main.LocalPlayer.Calamity().pSoulArtifact) { if (Main.LocalPlayer.Calamity().profanedCrystalBuffs) @@ -948,8 +968,8 @@ namespace CalamityMod.NPCs case NPCID.DD2Bartender: if (Main.rand.NextBool(5) && !Main.dayTime && Main.moonPhase == 0) chat = CalamityUtils.GetTextValue("Vanilla.TavernkeepChat.FullMoon"); - else if (Main.rand.NextBool(10) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.TavernkeepChat.DrunkPrincess").Format(Main.npc[fapsol].GivenName); + else if (Main.rand.NextBool(10) && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.TavernkeepChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.TaxCollector: @@ -979,13 +999,13 @@ namespace CalamityMod.NPCs break; case NPCID.TravellingMerchant: - if (Main.rand.NextBool(5) && fapsol != -1 && angelstatue != -1) - chat = CalamityUtils.GetText("Vanilla.TravellingMerchantChat.DrunkPrincessMerchant").Format(Main.npc[fapsol].GivenName, Main.npc[angelstatue].GivenName); + if (Main.rand.NextBool(5) && cirrus != -1 && angelstatue != -1) + chat = CalamityUtils.GetText("Vanilla.TravellingMerchantChat.DrunkPrincessMerchant").Format(Main.npc[cirrus].GivenName, Main.npc[angelstatue].GivenName); break; case NPCID.Truffle: - if (Main.rand.NextBool(4) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.TruffleChat.DrunkPrincess").Format(Main.npc[fapsol].GivenName); + if (Main.rand.NextBool(4) && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.TruffleChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); else if (Main.rand.NextBool(8)) chat = CalamityUtils.GetTextValue("Vanilla.TruffleChat.Normal"); break; @@ -1000,7 +1020,7 @@ namespace CalamityMod.NPCs break; case NPCID.Wizard: - if (Main.rand.NextBool(6) && !Main.LocalPlayer.InventoryHas(ItemID.RodofDiscord) && !Main.LocalPlayer.InventoryHas(ModContent.ItemType()) && !Main.LocalPlayer.ZoneHallow) + if (Main.rand.NextBool(6) && !Main.LocalPlayer.InventoryHas(ItemID.RodofDiscord) && !Main.LocalPlayer.InventoryHas(ItemType()) && !Main.LocalPlayer.ZoneHallow) chat = CalamityUtils.GetTextValue("Vanilla.WizardChat.MentionRoD"); if (Main.rand.NextBool(10) && Main.hardMode) chat = CalamityUtils.GetTextValue("Vanilla.WizardChat.Hardmode"); @@ -1016,7 +1036,7 @@ namespace CalamityMod.NPCs public void BoundNPCSafety(Mod mod, NPC npc) { // Make Bound Town NPCs take no damage - if (CalamityLists.BoundNPCIDs.Contains(npc.type)) + if (BoundNPCIDList.Includes(npc.type)) { npc.dontTakeDamageFromHostiles = true; } @@ -1028,6 +1048,8 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 2f; } + // Does not affect Dryad's Bane + // See CalamityGlobalNPC: UpdateLifeRegen public override void BuffTownNPC(ref float damageMult, ref int defense) { if (NPC.downedMoonlord) @@ -1070,7 +1092,7 @@ namespace CalamityMod.NPCs public override bool? CanBeHitByProjectile(NPC npc, Projectile projectile) { //Not an axe but close enough - if (npc.type == NPCID.TaxCollector && projectile.type == ModContent.ProjectileType()) + if (npc.type == NPCID.TaxCollector && projectile.type == ProjectileType()) return true; return base.CanBeHitByProjectile(npc, projectile); } @@ -1084,7 +1106,6 @@ namespace CalamityMod.NPCs bool happy = Main.LocalPlayer.currentShoppingSettings.PriceAdjustment <= 0.9; - Condition potionSells = CalamityConditions.PotionSellingConfig; Condition hasFlareGunUpgrade = new(CalamityUtils.GetText("Condition.HasFlareGun"), () => (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); Condition roguePlayer = CalamityConditions.PlayerHasRogueArmor; Condition wingedPlayer = CalamityConditions.PlayerHasWings; @@ -1095,27 +1116,25 @@ namespace CalamityMod.NPCs if (type == NPCID.Merchant) { - shop.AddWithCustomValue(ItemID.Bottle, Item.buyPrice(copper: 20), 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) + shop.AddWithCustomValue(ItemID.Bottle, Item.buyPrice(copper: 20)) + .AddWithCustomValue(ItemID.WormholePotion, Item.buyPrice(silver: 5), Condition.HappyEnoughToSellPylons); + shop.Add(ItemID.Flare, hasFlareGunUpgrade) .Add(ItemID.BlueFlare, hasFlareGunUpgrade) - .AddWithCustomValue(ItemID.AngelStatue, Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCType())) - .AddWithCustomValue(ItemID.Burger, Item.buyPrice(gold: 5), Condition.HappyEnough, Condition.DownedSkeletron) - .AddWithCustomValue(ItemID.Hotdog, Item.buyPrice(gold: 5), Condition.HappyEnough, Condition.DownedSkeletron) - .AddWithCustomValue(ItemID.CoffeeCup, Item.buyPrice(gold: 2), Condition.HappyEnough); + .AddWithCustomValue(ItemID.AngelStatue, Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCType())) + .AddWithCustomValue(ItemID.Burger, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) + .AddWithCustomValue(ItemID.Hotdog, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) + .AddWithCustomValue(ItemID.CoffeeCup, Item.buyPrice(gold: 2), Condition.HappyEnoughToSellPylons); } if (type == NPCID.DyeTrader) { - shop.AddWithCustomValue(ItemType(), Item.buyPrice(gold: 10), Condition.Hardmode) + shop.Add(ItemType(), Condition.Hardmode) .AddWithCustomValue(ItemID.DyeTradersScimitar, Item.buyPrice(gold: 15)); } if (type == NPCID.Demolitionist) { - shop.Add(ModContent.ItemType(), Condition.DownedMechBossAny); + shop.Add(ItemType(), Condition.DownedMechBossAny); } if (type == NPCID.ArmsDealer) @@ -1136,8 +1155,8 @@ namespace CalamityMod.NPCs .Add(ItemType(), revengeance) .Add(ItemType(), revengeance) .AddWithCustomValue(ItemID.StylistKilLaKillScissorsIWish, Item.buyPrice(gold: 15)) - .Add(ItemType(), Condition.NpcIsPresent(NPCType()), drunk) - .AddWithCustomValue(ItemID.ChocolateChipCookie, Item.buyPrice(gold: 3), Condition.HappyEnough, Condition.NpcIsPresent(NPCType())); + .Add(ItemType(), Condition.NpcIsPresent(NPCType()), drunk) + .AddWithCustomValue(ItemID.ChocolateChipCookie, Item.buyPrice(gold: 3), Condition.HappyEnoughToSellPylons, Condition.NpcIsPresent(NPCType())); } if (type == NPCID.Cyborg) @@ -1152,21 +1171,23 @@ namespace CalamityMod.NPCs shop.AddWithCustomValue(ItemID.JungleRose, Item.buyPrice(gold: 2)) .AddWithCustomValue(ItemID.NaturesGift, Item.buyPrice(gold: 10)) .Add(ItemType()) - .AddWithCustomValue(ItemID.Grapes, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnough, Condition.DownedSkeletron) - .Add(ItemID.CorruptSeeds, Condition.CrimsonWorld, Condition.InGraveyard) - .Add(ItemID.CrimsonSeeds, Condition.CorruptWorld, Condition.InGraveyard); + .AddWithCustomValue(ItemID.Grapes, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) + .Add(ItemType(), Condition.DownedSkeletron) + .Add(ItemID.CorruptSeeds, Condition.CrimsonWorld, Condition.InGraveyard, Condition.PreHardmode) + .Add(ItemID.CrimsonSeeds, Condition.CorruptWorld, Condition.InGraveyard, Condition.PreHardmode) // Vanilla sells these in Hardmode, we just make them available at all times + .Add(ItemType(), Condition.NotBloodMoon, Condition.Hardmode); } if (type == NPCID.GoblinTinkerer) { - shop.AddWithCustomValue(ItemID.StinkPotion, Item.buyPrice(silver: 25), potionSells, Condition.HappyEnough) - .Add(ItemType()) - .AddWithCustomValue(ItemID.Spaghetti, Item.buyPrice(gold: 5), Condition.HappyEnough, Condition.DownedSkeletron); + shop.Add(ItemType()) + .Add(ItemID.Toolbox, Condition.NpcIsPresent(NPCID.Mechanic)) + .AddWithCustomValue(ItemID.Spaghetti, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron); } if (type == NPCID.Mechanic) { - shop.AddWithCustomValue(ItemID.BuilderPotion, Item.buyPrice(gold: 4), potionSells, Condition.HappyEnough) + shop.AddWithCustomValue(ItemID.BuilderPotion, Item.buyPrice(gold: 4), Condition.HappyEnoughToSellPylons) .AddWithCustomValue(ItemID.CombatWrench, Item.buyPrice(gold: 10)); } @@ -1212,31 +1233,31 @@ namespace CalamityMod.NPCs .Add(ItemType()) .Add(ItemType()) .AddWithCustomValue(ItemID.ButterflyDust, Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ItemID.FriedEgg, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnough); + .AddWithCustomValue(ItemID.FriedEgg, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnoughToSellPylons); } if (type == NPCID.PartyGirl) { - shop.AddWithCustomValue(ItemID.GenderChangePotion, Item.buyPrice(silver: 25), potionSells, Condition.HappyEnough) - .AddWithCustomValue(ItemID.Pizza, Item.buyPrice(gold: 5), Condition.HappyEnough, Condition.DownedSkeletron) - .AddWithCustomValue(ItemID.CreamSoda, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnough); + shop.AddWithCustomValue(ItemID.GenderChangePotion, Item.buyPrice(silver: 25), Condition.HappyEnoughToSellPylons) + .AddWithCustomValue(ItemID.Pizza, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) + .AddWithCustomValue(ItemID.CreamSoda, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnoughToSellPylons); } if (type == NPCID.Princess) { shop.AddWithCustomValue(ItemID.PrincessWeapon, Item.buyPrice(gold: 50)) .Add(ItemType()) - .Add(ItemID.AppleJuice, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.FruitJuice, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.Lemonade, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.PrismaticPunch, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.SmoothieofDarkness, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.TropicalSmoothie, Condition.NpcIsPresent(NPCType())); + .Add(ItemID.AppleJuice, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.FruitJuice, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.Lemonade, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.PrismaticPunch, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.SmoothieofDarkness, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.TropicalSmoothie, Condition.NpcIsPresent(NPCType())); } if (type == NPCID.SkeletonMerchant) { - shop.AddWithCustomValue(ItemType(), Item.buyPrice(silver: 25), potionSells) + shop.AddWithCustomValue(ItemType(), Item.buyPrice(silver: 25)) .Add(ItemID.MilkCarton) .AddWithCustomValue(ItemID.Marrow, Item.buyPrice(gold: 25), Condition.Hardmode) .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 12)) @@ -1245,12 +1266,12 @@ namespace CalamityMod.NPCs if (type == NPCID.Golfer) { - shop.AddWithCustomValue(ItemID.PotatoChips, Item.buyPrice(gold: 1), Condition.HappyEnough); + shop.AddWithCustomValue(ItemID.PotatoChips, Item.buyPrice(gold: 1), Condition.HappyEnoughToSellPylons); } if (type == NPCID.BestiaryGirl) { - shop.AddWithCustomValue(ItemID.Steak, Item.buyPrice(gold: 5), Condition.HappyEnough, Condition.Hardmode); + shop.AddWithCustomValue(ItemID.Steak, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.Hardmode); } } #endregion diff --git a/NPCs/CalamityNaturalSpawnBossNPC.cs b/NPCs/CalamityNaturalSpawnBossNPC.cs new file mode 100644 index 0000000000..a549a45289 --- /dev/null +++ b/NPCs/CalamityNaturalSpawnBossNPC.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.NormalNPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs +{ + public sealed class CalamityNaturalSpawnBossNPC : GlobalNPC + { + public override bool InstancePerEntity => false; + + public static int ghostKillCount = 0; + public static int sharkKillCount = 0; + + private static int[] _PolterghastTriggerNPCS; + private static int[] _GreatSharkTriggerNPCS; + + public override void SetStaticDefaults() + { + ghostKillCount = 0; + sharkKillCount = 0; + + _PolterghastTriggerNPCS = [ + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + ]; + + _GreatSharkTriggerNPCS = [ + NPCID.SandShark, + NPCID.SandsharkHallow, + NPCID.SandsharkCorrupt, + NPCID.SandsharkCrimson + ]; + } + + public override void Unload() + { + _PolterghastTriggerNPCS = null; + _GreatSharkTriggerNPCS = null; + } + + public override void OnKill(NPC npc) + { + CheckPolterghastCondition(npc); + CheckGreatSandSharkCondition(npc); + } + + private static void CheckPolterghastCondition(NPC slainedNPC) + { + if (DownedBossSystem.downedPolterghast) + return; + + if (NPC.AnyNPCs(ModContent.NPCType())) + return; + + if (!_PolterghastTriggerNPCS.Contains(slainedNPC.type)) + return; + + ghostKillCount++; + if (ghostKillCount == 10) + { + string key = "Mods.CalamityMod.Status.Boss.GhostBossText2"; + Color messageColor = Color.Cyan; + + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + else if (ghostKillCount == 20) + { + string key = "Mods.CalamityMod.Status.Boss.GhostBossText3"; + Color messageColor = Color.Cyan; + + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + + if (ghostKillCount >= 30 && Main.netMode != NetmodeID.MultiplayerClient) + { + int lastPlayer = slainedNPC.lastInteraction; + + if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) + { + lastPlayer = slainedNPC.FindClosestPlayer(); + } + + if (lastPlayer >= 0) + { + SoundEngine.PlaySound(Polterghast.Polterghast.SpawnSound, Main.player[lastPlayer].Center); + NPC.SpawnOnPlayer(lastPlayer, ModContent.NPCType()); + ghostKillCount = 0; + } + } + } + + private static void CheckGreatSandSharkCondition(NPC slainedNPC) + { + if (!NPC.downedPlantBoss) + return; + + if (NPC.AnyNPCs(ModContent.NPCType())) + return; + + var fusionFeeder = slainedNPC.type == ModContent.NPCType() && Main.zenithWorld; + if (!_GreatSharkTriggerNPCS.Contains(slainedNPC.type) && !fusionFeeder) + return; + + sharkKillCount++; + if (sharkKillCount == 4) + { + string key = "Mods.CalamityMod.Status.Boss.SandSharkText"; + Color messageColor = Color.Goldenrod; + + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + else if (sharkKillCount == 8) + { + string key = "Mods.CalamityMod.Status.Boss.SandSharkText2"; + Color messageColor = Color.Goldenrod; + + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + if (sharkKillCount >= 10 && Main.netMode != NetmodeID.MultiplayerClient) + { + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + { + SoundEngine.PlaySound(Mauler.RoarSound, Main.LocalPlayer.Center); + } + + int lastPlayer = slainedNPC.lastInteraction; + + if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) + { + lastPlayer = slainedNPC.FindClosestPlayer(); + } + + if (lastPlayer >= 0) + { + NPC.SpawnOnPlayer(lastPlayer, ModContent.NPCType()); + sharkKillCount = -5; + } + } + } + } +} diff --git a/NPCs/CalamityNetImportantNPC.cs b/NPCs/CalamityNetImportantNPC.cs new file mode 100644 index 0000000000..065b2138d8 --- /dev/null +++ b/NPCs/CalamityNetImportantNPC.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.CommandLine.Parsing; +using System.Linq; +using System.Reflection; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Core; + +namespace CalamityMod.NPCs +{ + public sealed class CalamityNetImportantNPC : GlobalNPC + { + private static Dictionary typesToUpdate; + + public override void Load() + { + typesToUpdate = new(); + } + + public override void Unload() + { + typesToUpdate?.Clear(); + typesToUpdate = null; + } + + public override void SetStaticDefaults() + { + int uniqueNetOffsetID = 0; + + #region Vanilla Enemies + MarkNPCToLongDistanceSync(NPCID.EaterofWorldsHead, uniqueNetOffsetID); + MarkNPCToLongDistanceSync(NPCID.EaterofWorldsBody, uniqueNetOffsetID); + MarkNPCToLongDistanceSync(NPCID.EaterofWorldsTail, uniqueNetOffsetID); + uniqueNetOffsetID++; + + MarkNPCToLongDistanceSync(NPCID.TheDestroyer, uniqueNetOffsetID); + MarkNPCToLongDistanceSync(NPCID.TheDestroyerBody, uniqueNetOffsetID); + MarkNPCToLongDistanceSync(NPCID.TheDestroyerTail, uniqueNetOffsetID); + uniqueNetOffsetID++; + #endregion Vanilla Enemies + + var types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code) + .Where(type => !type.IsAbstract && type.IsSubclassOf(typeof(ModNPC))); + + // Caching this for better performance + var npcTypeMethod = typeof(ModContent).GetMethod(nameof(ModContent.NPCType)); + var netOffsetTable = new Dictionary(); + foreach (var type in types) + { + try + { + var longDistSync = type.GetCustomAttribute(); + + if (longDistSync == null) + continue; + + var npcTypeActualMethod = npcTypeMethod.MakeGenericMethod(typeArguments: type); + + int npcType = (int)npcTypeActualMethod.Invoke(null, null); + int netOffset = uniqueNetOffsetID; + + Type typeToCheck = longDistSync.SyncWith ?? type; + if (netOffsetTable.TryGetValue(typeToCheck, out int savedUniqueID)) + { + netOffset = savedUniqueID; + } + else + { + netOffsetTable[typeToCheck] = netOffset; + uniqueNetOffsetID++; + } + + MarkNPCToLongDistanceSync(npcType, netOffset); + } + catch (Exception e) + { + CalamityMod.Instance.Logger.Error($"Exception thrown while evaluating type \"{type.Name}\": {e}"); + } + } + + netOffsetTable?.Clear(); + } + + public override void PostAI(NPC npc) + { + // Only Server should update this! + if (!Main.dedServ) + return; + + // Obviously deactived npc is not on our interest (not sure if this is case though) + if (!npc.active) + return; + + if (!typesToUpdate.TryGetValue(npc.type, out var netUpdateTickOffset)) + return; + + if ((Main.GameUpdateCount + netUpdateTickOffset) % 45 != 0) + return; + + foreach (var player in Main.ActivePlayers) + { + // distance between 1000~1500 update with 8 tick period + // and distance over 1500 will never update + // So we forcely update NPC distanced over 1500 with 45 tick period + float distance = CalamityUtils.ManhattanDistance(player.position, npc.position); + if (distance <= 1499.0f) + continue; + + npc.SyncNPCPosAndRotOnly(); //Light-weight version to sync it's position + } + } + + private static void MarkNPCToLongDistanceSync(int netUpdateTickOffset = 0) where NPCType : ModNPC + { + MarkNPCToLongDistanceSync(ModContent.NPCType(), netUpdateTickOffset); + } + + private static void MarkNPCToLongDistanceSync(int npcType, int netUpdateTickOffset = 0) + { + typesToUpdate[npcType] = netUpdateTickOffset; + } + } +} diff --git a/NPCs/CalamityPolarityNPC.cs b/NPCs/CalamityPolarityNPC.cs index b414c40154..62389ac49f 100644 --- a/NPCs/CalamityPolarityNPC.cs +++ b/NPCs/CalamityPolarityNPC.cs @@ -96,7 +96,7 @@ namespace CalamityMod.NPCs public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { // I don't know who would be using this while also inflicting miracle blight, but in that rare case, do not draw these. - if (npc.Calamity().miracleBlight > 0) + if (CalamityDrawParameterNPC.DrawingMiracleBlight[npc.whoAmI]) return; Main.spriteBatch.End(); diff --git a/NPCs/CalamityTileCollisionHarmNPC.cs b/NPCs/CalamityTileCollisionHarmNPC.cs index dca4acc4d9..0e1c4d420a 100644 --- a/NPCs/CalamityTileCollisionHarmNPC.cs +++ b/NPCs/CalamityTileCollisionHarmNPC.cs @@ -1,8 +1,10 @@ using System; using CalamityMod.Projectiles.Healing; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using static System.Net.Mime.MediaTypeNames; namespace CalamityMod.NPCs { @@ -23,7 +25,13 @@ namespace CalamityMod.NPCs private float terminalVelocityForFullFallDamage = 0; private bool CheckTiles = false; private Vector2 ForcedVel = Vector2.Zero; + /// + /// Set to true if you only want the npc to receive forced velocity and not receive damage. + /// + private bool ForceVelocityOnly = false; private bool hitVoid = false; + private Player attacker; + private int packetTimer = 0; public int PotentialEnergyDamage { @@ -39,7 +47,7 @@ namespace CalamityMod.NPCs } } - public bool FallDamageSusceptible => PotentialEnergyDamage > 0; + public bool FallDamageSusceptible => PotentialEnergyDamage > 0 || ForceVelocityOnly; public override bool InstancePerEntity => true; @@ -63,13 +71,14 @@ namespace CalamityMod.NPCs } /// - /// Sets up a NPC to recieve fall damage when they hit the ground. + /// Sets up a NPC to recieve forced velocity in a direction and receive fall damage when they hit the ground. /// /// The npc to apply fall damage to + /// The player applying fall damage to the npc /// The maximum fall damage taken by the npc once they hit the ground /// The downwards velocity necessary to recieve the full fall damage. By default 10, the npc max fall speed /// Will check for tiles in the collision instead of velocity - public void ApplyCollisionDamage(NPC npc, int potentialDamage, Vector2 forcedVel, float terminalVelocityForFullDamage = 10f, bool checkTiles = false) + public void ApplyCollisionDamage(NPC npc, Player player, int potentialDamage, Vector2 forcedVel, float terminalVelocityForFullDamage = 10f, bool checkTiles = false) { //NPCs that don't collide with tiles simply don't get fall damage, lol. if (npc.noTileCollide) @@ -81,6 +90,28 @@ namespace CalamityMod.NPCs terminalVelocityForFullFallDamage = terminalVelocityForFullDamage; CheckTiles = checkTiles; ForcedVel = forcedVel; + attacker = player; + } + + /// + /// Sets up a NPC to recieve forced velocity in a direction. + /// + /// The npc to apply velocity to + /// The player applying velocity to the npc + /// The velocity being applied to the npc + /// Will check for tiles in the collision instead of velocity + public void ApplyForcedVelocity(NPC npc, Player player, Vector2 forcedVel, bool checkTiles = false) + { + // NPCs that don't collide with tiles simply don't get velocity, lol. + if (npc.noTileCollide) + return; + + OldVelocity = npc.velocity; + OlderVelocity = npc.velocity; + CheckTiles = checkTiles; + ForcedVel = forcedVel; + attacker = player; + ForceVelocityOnly = true; } public override void PostAI(NPC npc) @@ -93,21 +124,29 @@ namespace CalamityMod.NPCs if (Collision.SolidCollision(npc.Center, (int)(npc.width * 0.5f), (int)(npc.height * 0.5f)) || !WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40)) { - npc.StrikeNPC(npc.CalculateHitInfo((int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f)), 1), true); + if (!ForceVelocityOnly) + { + int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); + Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI); + wallImpact.DamageType = DamageClass.Melee; + } + PotentialEnergyDamage = 0; + ForceVelocityOnly = false; hitVoid = false; } - oldVelocity = npc.velocity.Length(); npc.Center += ForcedVel; ForcedVel *= 0.995f; - + if (packetTimer % 30 == 0) + npc.SyncMotionToServer(); if (!WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40) && !hitVoid) { npc.velocity = -npc.velocity * 0.5f; ForcedVel = -ForcedVel * 0.5f; hitVoid = true; } + packetTimer++; } else { @@ -127,9 +166,15 @@ namespace CalamityMod.NPCs //If the npc hit a tile/Came to a stop after falling if (newVerticalVelocity == 0 && oldVerticalVelocity > 0) //Collision.SolidCollision(npc.Center, npc.width, npc.height)) { - //I don't think a tile check below the npc is necessary but if we find weird edge cases ill add it - npc.StrikeNPC(npc.CalculateHitInfo((int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f)), 1), true); + if (!ForceVelocityOnly) + { + int impactDamage = (int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); + Projectile impact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), impactDamage, 0f, attacker.whoAmI, npc.whoAmI); + impact.DamageType = DamageClass.Melee; + } + PotentialEnergyDamage = 0; + ForceVelocityOnly = false; } OlderVelocity = OldVelocity; diff --git a/NPCs/CalamityVanillaMinibossesAI.cs b/NPCs/CalamityVanillaMinibossesAI.cs index 10d1ddeb09..17167c14af 100644 --- a/NPCs/CalamityVanillaMinibossesAI.cs +++ b/NPCs/CalamityVanillaMinibossesAI.cs @@ -142,8 +142,7 @@ namespace CalamityMod.NPCs else if (selection == 2 && NPC.CountNPCS(NPCID.MothronEgg) + NPC.CountNPCS(NPCID.MothronSpawn) < 2) aiState = (int)MothronAIState.PickSpotToLayEgg; } - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); } break; @@ -255,8 +254,7 @@ namespace CalamityMod.NPCs { aiState = (int)MothronAIState.ChargePreparation; flySpeedAdditive = 0f; - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); } flySpeedAdditive += 0.0333333351f; @@ -297,8 +295,7 @@ namespace CalamityMod.NPCs aiState = (int)MothronAIState.DoTheFuckingCharge; chargeDirection = npc.direction; - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); } } break; @@ -325,7 +322,7 @@ namespace CalamityMod.NPCs aiState = (int)MothronAIState.NewAISelection; chargeDirection = 0f; flySpeedAdditive = 0f; - npc.netUpdate = true; + npc.ForceNetUpdate(); } // Otherwise, if somewhat horizontally far from the target, go to typical flying by default. @@ -334,9 +331,8 @@ namespace CalamityMod.NPCs aiState = (int)MothronAIState.FlyTowardsPlayer; chargeDirection = 0f; flySpeedAdditive = 0f; - npc.netUpdate = true; + npc.ForceNetUpdate(); } - npc.netSpam = 0; } npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; break; @@ -383,8 +379,7 @@ namespace CalamityMod.NPCs } } } - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); } break; @@ -622,7 +617,7 @@ namespace CalamityMod.NPCs if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 58) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 929abfba7b..41817f7e07 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -41,8 +41,8 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -67,7 +67,7 @@ namespace CalamityMod.NPCs.CeaselessVoid CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.5f; NPC.LifeMaxNERB(65000, 78000, 72000); - NPC.value = Item.buyPrice(2, 0, 0, 0); + NPC.value = Item.buyPrice(1, 0, 0, 0); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -94,11 +94,11 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SendExtraAI(BinaryWriter writer) { writer.Write(NPC.dontTakeDamage); + writer.Write(playedbuildsound); writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); - writer.Write(playedbuildsound); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -160,11 +160,11 @@ namespace CalamityMod.NPCs.CeaselessVoid if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -173,21 +173,21 @@ namespace CalamityMod.NPCs.CeaselessVoid afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -195,7 +195,7 @@ namespace CalamityMod.NPCs.CeaselessVoid extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f); extraAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -322,7 +322,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Main.dust[purpleDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("CeaselessVoid").Type, 1f); diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 591887a1cc..52c4728c43 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -32,8 +32,8 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = FrameCount; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = FrameCount; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); if (!Main.dedServ) { @@ -99,7 +99,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -207,10 +207,10 @@ namespace CalamityMod.NPCs.CeaselessVoid public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D mainTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D mainTexture = TextureAssets.Npc[Type].Value; Vector2 drawPos = NPC.Center - screenPos; SpriteEffects spriteEffects = SpriteEffects.None; - Vector2 drawOrigin = new Vector2(mainTexture.Width / 2, mainTexture.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 drawOrigin = new Vector2(mainTexture.Width / 2, mainTexture.Height / Main.npcFrameCount[Type] / 2); if (NPC.IsABestiaryIconDummy) { @@ -225,10 +225,10 @@ namespace CalamityMod.NPCs.CeaselessVoid Color white = Color.White * NPC.Opacity; int trailCount = 5; - drawPos -= new Vector2(mainTexture.Width, mainTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos -= new Vector2(mainTexture.Width, mainTexture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < trailCount; i += 2) { @@ -237,7 +237,7 @@ namespace CalamityMod.NPCs.CeaselessVoid trailColor = NPC.GetAlpha(trailColor); trailColor *= (trailCount - i) / 15f; Vector2 trailPos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - trailPos -= new Vector2(mainTexture.Width, mainTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + trailPos -= new Vector2(mainTexture.Width, mainTexture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; trailPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(mainTexture, trailPos, NPC.frame, trailColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } @@ -251,7 +251,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Texture2D glowTexture = GlowTexture.Value; Color glowColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * NPC.Opacity; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < trailCount; i++) { @@ -260,7 +260,7 @@ namespace CalamityMod.NPCs.CeaselessVoid trailColor2 = NPC.GetAlpha(trailColor2); trailColor2 *= (trailCount - i) / 15f; Vector2 trailPos2 = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - trailPos2 -= new Vector2(glowTexture.Width, glowTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + trailPos2 -= new Vector2(glowTexture.Width, glowTexture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; trailPos2 += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(glowTexture, trailPos2, NPC.frame, trailColor2, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index d97ac27fe5..2c3e928208 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.Crabulon public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.BossBestiaryPriority.Add(Type); if (!Main.dedServ) { @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Crabulon if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) NPC.scale = 2f; - NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 30; + NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 15; if (BossRushEvent.BossRushActive) NPC.lifeMax = 8000; if (Main.getGoodWorld) @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.Crabulon public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -135,7 +135,7 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].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); @@ -143,9 +143,9 @@ namespace CalamityMod.NPCs.Crabulon int ClonesAroundShroom = Main.zenithWorld ? 4 : 0; for (int c = 0; c < 1 + ClonesAroundShroom; c++) { - Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[Type] / 2); Vector2 drawPos = NPC.Center - screenPos + (Vector2.UnitX * texture.Width * c).RotatedByRandom(c); - drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index b34cac0c65..ebc7f6a7a6 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -43,9 +43,14 @@ namespace CalamityMod.NPCs.Crabulon public static Asset AltTexture_Glow; public static Asset AttackTexture_Glow; + public static readonly SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/Crabulon/CrabJump"); + public static readonly SoundStyle SlamSound = new("CalamityMod/Sounds/Custom/Crabulon/CrabSlam", 2); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/CrabulonHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/CrabulonDeath"); + public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -74,16 +79,16 @@ namespace CalamityMod.NPCs.Crabulon NPC.width = 196; NPC.height = 196; NPC.defense = 8; - NPC.LifeMaxNERB(3700, 4400, 680000); + NPC.LifeMaxNERB(3700, 4400, 500000); NPC.aiStyle = -1; AIType = -1; NPC.noGravity = false; NPC.noTileCollide = false; NPC.boss = true; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 10, 0, 0); - NPC.HitSound = SoundID.NPCHit45; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.value = Item.buyPrice(0, 5, 0, 0); + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; @@ -257,8 +262,8 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] += 1f; if (phase3) NPC.ai[1] += 2f; - if (NPC.justHit) - NPC.ai[1] += masterMode ? 7f : expertMode ? 5f : 3f; + if (NPC.justHit && masterMode) + NPC.ai[1] += 4f; if (NPC.Distance(player.Center) < 160f) NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; @@ -471,6 +476,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.direction = playerLocation < 0 ? 1 : -1; NPC.velocity.X = velocityX * NPC.direction; + SoundEngine.PlaySound(JumpSound, NPC.Center); NPC.ai[0] = 3f; NPC.ai[1] = 0f; @@ -485,7 +491,7 @@ namespace CalamityMod.NPCs.Crabulon // Avoid cheap bullshit NPC.damage = 0; - SoundEngine.PlaySound(SoundID.Item14, NPC.Center); + SoundEngine.PlaySound(SlamSound, NPC.Center); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -651,7 +657,7 @@ namespace CalamityMod.NPCs.Crabulon Main.npc[crabShroom].SetDefaults(npcType); 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) + if (Main.dedServ && crabShroom < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, crabShroom); } } @@ -733,7 +739,7 @@ namespace CalamityMod.NPCs.Crabulon stomping = false; NPC.frameCounter += 0.15; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -772,7 +778,7 @@ namespace CalamityMod.NPCs.Crabulon stomping = false; NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -786,7 +792,7 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D textureIdle = TextureAssets.Npc[NPC.type].Value; + Texture2D textureIdle = TextureAssets.Npc[Type].Value; Texture2D glowIdle = Texture_Glow.Value; Texture2D textureWalk = AltTexture.Value; Texture2D glowWalk = AltTexture_Glow.Value; @@ -798,13 +804,13 @@ namespace CalamityMod.NPCs.Crabulon int ClonesOnEachSide = Main.zenithWorld ? 2 : 0; for (int c = 0 - ClonesOnEachSide; c < 1 + ClonesOnEachSide; c++) { - Vector2 drawOrigin = new Vector2(textureIdle.Width / 2, textureIdle.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 drawOrigin = new Vector2(textureIdle.Width / 2, textureIdle.Height / Main.npcFrameCount[Type] / 2); Vector2 drawPos = NPC.Center - screenPos + (Vector2.UnitX * textureIdle.Width * c * 1.6f); // Jumping if (NPC.ai[0] > 2f && NPC.velocity.Y != 0f) { drawOrigin = new Vector2(textureAttack.Width / 2, textureAttack.Height / 2); - drawPos -= new Vector2(textureAttack.Width, textureAttack.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos -= new Vector2(textureAttack.Width, textureAttack.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(textureAttack, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); @@ -814,7 +820,7 @@ namespace CalamityMod.NPCs.Crabulon else if (NPC.ai[0] == 1f) { drawOrigin = new Vector2(textureWalk.Width / 2, textureWalk.Height / 2); - drawPos -= new Vector2(textureWalk.Width, textureWalk.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos -= new Vector2(textureWalk.Width, textureWalk.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(textureWalk, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); @@ -823,7 +829,7 @@ namespace CalamityMod.NPCs.Crabulon // Standing still else { - drawPos -= new Vector2(textureIdle.Width, textureIdle.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos -= new Vector2(textureIdle.Width, textureIdle.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(textureIdle, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); @@ -833,6 +839,21 @@ namespace CalamityMod.NPCs.Crabulon return false; } + // GFB removes map icon, hover text, and health bar + public override void BossHeadSlot(ref int index) + { + if (Main.zenithWorld) + index = -1; + } + + public override void ModifyHoverBoundingBox(ref Rectangle boundingBox) + { + if (Main.zenithWorld) + boundingBox = Rectangle.Empty; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => Main.zenithWorld ? false : base.DrawHealthBar(hbPosition, ref scale, ref position); + public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); @@ -933,7 +954,7 @@ namespace CalamityMod.NPCs.Crabulon 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) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Crabulon").Type, NPC.scale); diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index 5ee0f09e36..1c8cbd99a4 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -14,7 +14,7 @@ namespace CalamityMod.NPCs.Crags { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 10f; value.PortraitPositionYOverride = -36f; @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Crags NPC.width = 30; NPC.height = 30; NPC.defense = 12; - NPC.lifeMax = 140; + NPC.lifeMax = 180; NPC.knockBackResist = 0.75f; AnimationType = NPCID.DemonEye; NPC.value = Item.buyPrice(0, 0, 5, 0); @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CalamityEye").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CalamityEye2").Type, 1f); diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index b26c85bc46..bb3e35e40d 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -3,8 +3,8 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Placeables.Crags; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Particles; using CalamityMod.World; @@ -32,11 +32,11 @@ namespace CalamityMod.NPCs.Crags NPC.aiStyle = -1; AIType = -1; NPC.damage = 40; - NPC.width = 72; - NPC.height = 72; + NPC.width = 66; + NPC.height = 64; NPC.defense = 38; NPC.DR_NERD(0.35f); - NPC.lifeMax = 120; + NPC.lifeMax = 180; NPC.knockBackResist = 0.1f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit41; @@ -186,7 +186,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DespairStone").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DespairStone2").Type, NPC.scale); diff --git a/NPCs/Crags/DespairStone.png b/NPCs/Crags/DespairStone.png index e7ab63c022..dc97d93a90 100644 Binary files a/NPCs/Crags/DespairStone.png and b/NPCs/Crags/DespairStone.png differ diff --git a/NPCs/Crags/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs index f2837be0e0..1c14f41f6e 100644 --- a/NPCs/Crags/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.World; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.Crags { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = -1, @@ -28,7 +29,8 @@ namespace CalamityMod.NPCs.Crags public override void SetDefaults() { - NPC.aiStyle = NPCAIStyleID.AncientVision; + NPC.lavaImmune = true; + NPC.aiStyle = -1; NPC.damage = 33; NPC.width = 40; NPC.height = 40; @@ -38,6 +40,7 @@ namespace CalamityMod.NPCs.Crags NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; + NPC.noGravity = true; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; @@ -86,7 +89,7 @@ namespace CalamityMod.NPCs.Crags NPC.rotation = (float)Math.Atan2((double)(NPC.velocity.Y * (float)NPC.direction), (double)(NPC.velocity.X * (float)NPC.direction)); } NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -94,6 +97,8 @@ namespace CalamityMod.NPCs.Crags 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.5f, 0f, 0.05f); + + CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 12.8f : CalamityWorld.revenge ? 8.8f : 7.8f), (CalamityWorld.death ? 0.1f : CalamityWorld.revenge ? 0.05f : 0.04f), 350f); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/Crags/InfernalCongealment.cs b/NPCs/Crags/InfernalCongealment.cs index 984dc9505e..99a577e956 100644 --- a/NPCs/Crags/InfernalCongealment.cs +++ b/NPCs/Crags/InfernalCongealment.cs @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.Crags { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; } public override void SetDefaults() @@ -26,10 +26,10 @@ namespace CalamityMod.NPCs.Crags NPC.width = 40; NPC.height = 30; NPC.defense = 10; - NPC.lifeMax = 250; + NPC.lifeMax = 380; NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.alpha = 50; NPC.lavaImmune = true; NPC.noGravity = false; diff --git a/NPCs/Crags/RenegadeWarlock.cs b/NPCs/Crags/RenegadeWarlock.cs index 3e8ae54d4c..770a2ab412 100644 --- a/NPCs/Crags/RenegadeWarlock.cs +++ b/NPCs/Crags/RenegadeWarlock.cs @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.Crags { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; } public override void SetDefaults() @@ -26,11 +26,11 @@ namespace CalamityMod.NPCs.Crags NPC.width = 18; NPC.height = 40; NPC.defense = 16; - NPC.lifeMax = 80; + NPC.lifeMax = 100; NPC.knockBackResist = 0.5f; AnimationType = NPCID.ZombieXmas; AIType = NPCID.ChaosElemental; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath50; if (DownedBossSystem.downedProvidence) @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int count = Main.zenithWorld ? 20 : 1; // remember that old oversight in the draedon update? for (int g = 0; g < count; g++) diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 779cc3ccd6..9be31715aa 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.Crags NPC.width = 80; NPC.height = 80; NPC.defense = 18; - NPC.lifeMax = 90; + NPC.lifeMax = 120; NPC.alpha = 100; NPC.knockBackResist = 0.7f; NPC.value = Item.buyPrice(0, 0, 5, 0); @@ -134,7 +134,7 @@ namespace CalamityMod.NPCs.Crags break; } } - if (Main.player[NPC.target].npcTypeNoAggro[NPC.type]) + if (Main.player[NPC.target].npcTypeNoAggro[Type]) { bool inTileNoAggro = false; for (int loopInc2 = npcTileY; loopInc2 < npcTileY + tileCheckLoopAmt - 2; loopInc2++) @@ -296,7 +296,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Scryllar").Type, NPC.scale); } diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 6fa5a79a6f..45bf652574 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Crags NPC.width = 80; NPC.height = 80; NPC.defense = 10; - NPC.lifeMax = 50; + NPC.lifeMax = 75; NPC.alpha = 100; NPC.knockBackResist = 0.9f; NPC.value = Item.buyPrice(0, 0, 5, 0); @@ -116,7 +116,7 @@ namespace CalamityMod.NPCs.Crags break; } } - if (Main.player[NPC.target].npcTypeNoAggro[NPC.type]) + if (Main.player[NPC.target].npcTypeNoAggro[Type]) { bool inTileNoAggro = false; for (int loopInc2 = npcTileY; loopInc2 < npcTileY + tileCheckLoopAmt - 2; loopInc2++) @@ -257,17 +257,6 @@ namespace CalamityMod.NPCs.Crags 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 HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) @@ -280,7 +269,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScryllarRage").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScryllarRage2").Type, NPC.scale); diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 7c12cf4ae5..fedf150195 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -23,8 +23,8 @@ namespace CalamityMod.NPCs.Crags public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Crags NPC.height = 40; NPC.defense = 30; NPC.DR_NERD(0.15f); - NPC.lifeMax = 60; + NPC.lifeMax = 80; NPC.knockBackResist = 0.65f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.noGravity = true; @@ -248,11 +248,11 @@ namespace CalamityMod.NPCs.Crags if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Vector2 halfSizeTexture = new Vector2((float)(texture.Width / 2), (float)(texture.Height / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -275,7 +275,7 @@ namespace CalamityMod.NPCs.Crags texture = GlowTexture.Value; Color redGlow = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -320,7 +320,7 @@ namespace CalamityMod.NPCs.Crags } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SoulSlurper").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SoulSlurper2").Type, NPC.scale); diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index d77b5ef431..bdf1c00e8a 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Effects; @@ -38,7 +39,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Cryogen { - [AutoloadBossHead] + [LongDistanceNetSync] // Cryogen follows you forever like Queen Bee in vanilla, So we need this to sync it's position on minimap public class Cryogen : ModNPC { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; @@ -65,16 +66,13 @@ namespace CalamityMod.NPCs.Cryogen public static int cryoIconIndex; public static int pyroIconIndex; - internal static void LoadHeadIcons() + public override void Load() { string cryoIconPath = "CalamityMod/NPCs/Cryogen/Cryogen_Phase1_Head_Boss"; string pyroIconPath = "CalamityMod/NPCs/Cryogen/Pyrogen_Head_Boss"; - - CalamityMod.Instance.AddBossHeadTexture(cryoIconPath, -1); - cryoIconIndex = ModContent.GetModBossHeadSlot(cryoIconPath); - - CalamityMod.Instance.AddBossHeadTexture(pyroIconPath, -1); - pyroIconIndex = ModContent.GetModBossHeadSlot(pyroIconPath); + + cryoIconIndex = CalamityMod.Instance.AddBossHeadTexture(cryoIconPath, -1); + pyroIconIndex = CalamityMod.Instance.AddBossHeadTexture(pyroIconPath, -1); } public override void SetStaticDefaults() @@ -104,7 +102,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 40, 0, 0); + NPC.value = Item.buyPrice(0, 16, 0, 0); NPC.boss = true; NPC.BossBar = ModContent.GetInstance(); NPC.noGravity = true; @@ -155,6 +153,7 @@ namespace CalamityMod.NPCs.Cryogen writer.Write(biomeEnrageTimer); writer.Write(teleportLocationX); writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[1]); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -164,6 +163,7 @@ namespace CalamityMod.NPCs.Cryogen biomeEnrageTimer = reader.ReadInt32(); teleportLocationX = reader.ReadInt32(); NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[1] = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -236,15 +236,18 @@ namespace CalamityMod.NPCs.Cryogen if ((int)NPC.ai[0] + 1 > currentPhase) HandlePhaseTransition((int)NPC.ai[0] + 1); - if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (NPC.ai[0] < 3f || bossRush || (death && NPC.ai[0] > 3f))) //spawn shield for phase 0 1 2, not 3 4 5 + if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f) { + NPC.localAI[1] = 1f; SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); - int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); - NPC.ai[2] = shieldSpawn + 1; - NPC.localAI[1] = -1f; - NPC.netUpdate = true; - Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; - Main.npc[shieldSpawn].netUpdate = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + NPC.netUpdate = true; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } } int shieldTracker = (int)NPC.ai[2] - 1; @@ -256,17 +259,12 @@ namespace CalamityMod.NPCs.Cryogen { NPC.dontTakeDamage = false; NPC.ai[2] = 0f; - - if (NPC.localAI[1] == -1f) - NPC.localAI[1] = death ? 540f : expertMode ? 720f : 1080f; - if (NPC.localAI[1] > 0f) - NPC.localAI[1] -= 1f; } - if (CalamityConfig.Instance.BossesStopWeather) - CalamityMod.StopRain(); + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); else if (!Main.raining && !BossRushEvent.BossRushActive) - CalamityUtils.StartRain(); + CalamityWorld.StartRain(); if (!player.active || player.dead) { @@ -313,7 +311,7 @@ namespace CalamityMod.NPCs.Cryogen if (!WorldGen.SolidTile(enemySpawnX, enemySpawnY)) { int legendEnemySpawn = NPC.NewNPC(NPC.GetSource_FromAI(), enemySpawnX * 16 + 8, enemySpawnY * 16, spawnType); - if (Main.netMode == NetmodeID.Server && legendEnemySpawn < Main.maxNPCs) + if (Main.dedServ && legendEnemySpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, legendEnemySpawn); break; @@ -428,6 +426,15 @@ namespace CalamityMod.NPCs.Cryogen NPC.ai[0] = 1f; NPC.localAI[0] = 0f; NPC.netUpdate = true; + + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); + if (NPC.ai[2] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } } } else if (NPC.ai[0] == 1f) @@ -617,6 +624,15 @@ namespace CalamityMod.NPCs.Cryogen calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; + + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); + if (NPC.ai[2] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } } } else if (NPC.ai[0] == 2f) @@ -968,6 +984,18 @@ namespace CalamityMod.NPCs.Cryogen calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; + if (death) + { + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); + if (NPC.ai[2] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } + } + int chance = 100; if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) chance = 20; @@ -1212,7 +1240,7 @@ namespace CalamityMod.NPCs.Cryogen { SoundStyle sound = Main.zenithWorld ? SoundID.NPCDeath14 : TransitionSound; SoundEngine.PlaySound(sound, NPC.Center); - if (Main.netMode != NetmodeID.Server && !Main.zenithWorld) + if (!Main.dedServ && !Main.zenithWorld) { int chipGoreAmount = newPhase >= 5 ? 3 : newPhase >= 3 ? 2 : 1; for (int i = 1; i < chipGoreAmount; i++) @@ -1271,7 +1299,7 @@ namespace CalamityMod.NPCs.Cryogen FireDrawer = null; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; switch (currentPhase) { case 2: @@ -1290,7 +1318,7 @@ namespace CalamityMod.NPCs.Cryogen texture = Phase6Texture.Value; break; default: - texture = TextureAssets.Npc[NPC.type].Value; + texture = TextureAssets.Npc[Type].Value; break; } @@ -1300,9 +1328,9 @@ namespace CalamityMod.NPCs.Cryogen NPC.DrawBackglow(Main.zenithWorld ? Color.Red : BackglowColor, 4f, spriteEffects, NPC.frame, screenPos); - Vector2 origin = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 origin = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 drawPos = NPC.Center - screenPos; - drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color overlay = Main.zenithWorld ? Color.Red : drawColor; spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(overlay), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); @@ -1351,7 +1379,7 @@ namespace CalamityMod.NPCs.Cryogen 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) + if (!Main.dedServ && !Main.zenithWorld) { float randomSpread = Main.rand.Next(-200, 201) / 100f; for (int i = 1; i < 4; i++) @@ -1400,8 +1428,6 @@ namespace CalamityMod.NPCs.Cryogen normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); } - npcLoot.Add(ItemID.FrozenKey, 3); - // Trophy (always directly from boss, never in bag) npcLoot.Add(ModContent.ItemType(), 10); @@ -1424,18 +1450,29 @@ namespace CalamityMod.NPCs.Cryogen CalamityGlobalNPC.SetNewBossJustDowned(NPC); // Spawn Permafrost if he isn't in the world - int permafrostNPC = NPC.FindFirstNPC(ModContent.NPCType()); + int permafrostNPC = NPC.FindFirstNPC(ModContent.NPCType()); if (permafrostNPC == -1 && !BossRushEvent.BossRushActive) - NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); // If Cryogen has not been killed, notify players about Cryonic Ore if (!DownedBossSystem.downedCryogen) { string key = "Mods.CalamityMod.Status.Progression.IceOreText"; - Color messageColor = Color.LightSkyBlue; - CalamityUtils.SpawnOre(ModContent.TileType(), 16E-05, 0.45f, 0.7f, 6, 11, TileID.SnowBlock, TileID.IceBlock, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, ModContent.TileType(), ModContent.TileType()); + List tileTypes = [ + TileID.SnowBlock, + TileID.IceBlock, + TileID.CorruptIce, + TileID.FleshIce, + TileID.HallowedIce, + ModContent.TileType(), + ModContent.TileType() + ]; + // In Drunk world, it can also generate in Jungle grass due to Jungle/Snow overlap + if (Main.drunkWorld) + tileTypes.Add(TileID.JungleGrass); + CalamityUtils.SpawnOre(ModContent.TileType(), 16E-05, 0.45f, 0.7f, 6, 11, tileTypes); - CalamityUtils.DisplayLocalizedText(key, messageColor); + CalamityUtils.DisplayLocalizedText(key, Color.LightSkyBlue); } // Mark Cryogen as dead diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index 19e69bdb32..aff0c00efc 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Cryogen { + [LongDistanceNetSync(SyncWith = typeof(Cryogen))] public class CryogenShield : ModNPC { public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/NPCKilled/CryogenShieldBreak"); @@ -32,11 +33,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.height = 216; NPC.scale *= (CalamityWorld.death || BossRushEvent.BossRushActive || Main.getGoodWorld) ? 0.8f : 1f; NPC.DR_NERD(0.4f); - NPC.lifeMax = CalamityWorld.death ? 700 : 1400; - if (BossRushEvent.BossRushActive) - { - NPC.lifeMax = 10000; - } + NPC.LifeMaxNERB(2800, 3360, 33600); NPC.Opacity = 0f; NPC.HitSound = Cryogen.HitSound; NPC.DeathSound = BreakSound; @@ -136,9 +133,9 @@ namespace CalamityMod.NPCs.Cryogen NPC.DrawBackglow(Main.zenithWorld ? Color.Red : Cryogen.BackglowColor, 4f, SpriteEffects.None, NPC.frame, screenPos); - Vector2 origin = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 origin = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 drawPos = NPC.Center - screenPos; - drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color overlay = Main.zenithWorld ? Color.Red : drawColor; spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(overlay), NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); @@ -190,7 +187,7 @@ namespace CalamityMod.NPCs.Cryogen Main.dust[icyDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server && !Main.zenithWorld) + if (!Main.dedServ && !Main.zenithWorld) { int totalGores = 16; double radians = MathHelper.TwoPi / totalGores; diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index ae264605b6..e0164802fe 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [LongDistanceNetSync(SyncWith = typeof(DesertNuisanceHead))] public class DesertNuisanceBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertNuisanceHead.DisplayName"); @@ -23,7 +24,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; this.HideFromBestiary(); @@ -90,11 +91,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.position = NPC.Center; NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, BodyTexture2 is null ? 0 : BodyTexture2.Width(), BodyTexture2 is null ? 0 : BodyTexture2.Height()); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; @@ -105,11 +102,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.position = NPC.Center; NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, BodyTexture3 is null ? 0 : BodyTexture3.Width(), BodyTexture3 is null ? 0 : BodyTexture3.Height()); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; @@ -120,11 +113,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.position = NPC.Center; NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, BodyTexture4 is null ? 0 : BodyTexture4.Width(), BodyTexture4 is null ? 0 : BodyTexture4.Height()); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; } @@ -280,7 +269,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) NPC.frame.Y = 0; } } @@ -294,7 +283,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { switch ((int)NPC.ai[3]) { diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs index 787ae41d58..d3448785a3 100644 --- a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [LongDistanceNetSync(SyncWith = typeof(DesertNuisanceHeadYoung))] public class DesertNuisanceBodyYoung : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertNuisanceHeadYoung.DisplayName"); @@ -23,7 +24,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; this.HideFromBestiary(); @@ -90,11 +91,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.position = NPC.Center; NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, BodyTexture2 is null ? 0 : BodyTexture2.Width(), BodyTexture2 is null ? 0 : BodyTexture2.Height()); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; @@ -105,11 +102,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.position = NPC.Center; NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, BodyTexture3 is null ? 0 : BodyTexture3.Width(), BodyTexture3 is null ? 0 : BodyTexture3.Height()); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; @@ -120,11 +113,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.position = NPC.Center; NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, BodyTexture4 is null ? 0 : BodyTexture4.Width(), BodyTexture4 is null ? 0 : BodyTexture4.Height()); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; } @@ -288,7 +277,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) NPC.frame.Y = 0; } } @@ -302,7 +291,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { switch ((int)NPC.ai[3]) { diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 1eaaaa9dff..3b033e67f9 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -12,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { [AutoloadBossHead] + [LongDistanceNetSync] public class DesertNuisanceHead : ModNPC { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; @@ -30,7 +31,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() @@ -518,7 +519,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceHead").Type, NPC.scale); for (int k = 0; k < 10; k++) @@ -549,11 +550,10 @@ namespace CalamityMod.NPCs.DesertScourge NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) { NPC.ai[3] = 2f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); NPC.frame.Y = 0; } } @@ -574,12 +574,11 @@ namespace CalamityMod.NPCs.DesertScourge { if (NPC.frame.Y > 0) { - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) { NPC.frame.Y = 0; NPC.ai[3] = 0f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else { @@ -594,8 +593,7 @@ namespace CalamityMod.NPCs.DesertScourge else { NPC.ai[3] = 0f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } } } @@ -611,8 +609,7 @@ namespace CalamityMod.NPCs.DesertScourge { target.AddBuff(BuffID.Bleeding, 180); NPC.ai[3] = 1f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } } diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index 3864912700..55f0ff65dd 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -14,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { [AutoloadBossHead] + [LongDistanceNetSync] public class DesertNuisanceHeadYoung : ModNPC { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; @@ -34,7 +35,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; this.HideFromBestiary(); NPCID.Sets.MPAllowedEnemies[Type] = true; NPCID.Sets.CantTakeLunchMoney[Type] = true; @@ -559,7 +560,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Head").Type, NPC.scale); for (int k = 0; k < 10; k++) @@ -592,11 +593,10 @@ namespace CalamityMod.NPCs.DesertScourge NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) { NPC.ai[3] = 2f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); NPC.frame.Y = 0; } } @@ -617,12 +617,11 @@ namespace CalamityMod.NPCs.DesertScourge { if (NPC.frame.Y > 0) { - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) { NPC.frame.Y = 0; NPC.ai[3] = 0f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else { @@ -637,8 +636,7 @@ namespace CalamityMod.NPCs.DesertScourge else { NPC.ai[3] = 0f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } } } @@ -654,8 +652,7 @@ namespace CalamityMod.NPCs.DesertScourge { target.AddBuff(BuffID.Bleeding, 180); NPC.ai[3] = 1f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } } diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index 8c77bb0058..7c83738f4c 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -8,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [LongDistanceNetSync(SyncWith = typeof(DesertNuisanceHead))] public class DesertNuisanceTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertNuisanceHead.DisplayName"); @@ -184,7 +185,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceTail").Type, NPC.scale); for (int k = 0; k < 10; k++) diff --git a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs index c5afd07b25..00290efb8d 100644 --- a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs @@ -8,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [LongDistanceNetSync(SyncWith = typeof(DesertNuisanceHeadYoung))] public class DesertNuisanceTailYoung : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertNuisanceHeadYoung.DisplayName"); @@ -192,7 +193,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Tail").Type, NPC.scale); for (int k = 0; k < 10; k++) diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 5bed31d655..4f71aff1f7 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [LongDistanceNetSync(SyncWith = typeof(DesertScourgeHead))] public class DesertScourgeBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertScourgeHead.DisplayName"); @@ -27,7 +28,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; this.HideFromBestiary(); @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.defense = 6; NPC.DR_NERD(0.05f); - NPC.LifeMaxNERB(4200, 5000, 1650000); + NPC.LifeMaxNERB(4200, 5000, 1400000); if (Main.getGoodWorld) NPC.lifeMax *= 4; NPC.aiStyle = -1; @@ -108,11 +109,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.position = NPC.Center; NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, BodyTexture2 is null ? 0 : BodyTexture2.Width(), BodyTexture2 is null ? 0 : BodyTexture2.Height()); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; @@ -123,11 +120,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.position = NPC.Center; NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, BodyTexture3 is null ? 0 : BodyTexture3.Width(), BodyTexture3 is null ? 0 : BodyTexture3.Height()); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; @@ -138,11 +131,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.position = NPC.Center; NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, BodyTexture4 is null ? 0 : BodyTexture4.Width(), BodyTexture4 is null ? 0 : BodyTexture4.Height()); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; } @@ -155,6 +144,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.life = Main.npc[(int)NPC.ai[1]].life; NPC.dontTakeDamage = Main.npc[(int)NPC.ai[1]].dontTakeDamage; + NPC.canDisplayBuffs = Main.npc[(int)NPC.ai[1]].canDisplayBuffs; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -322,7 +312,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) NPC.frame.Y = 0; } } @@ -338,7 +328,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { switch ((int)NPC.ai[3]) { @@ -378,7 +368,7 @@ namespace CalamityMod.NPCs.DesertScourge // Sometimes "Deflect" projectiles in gfb into water blasts. if (Main.rand.NextBool(20) && Main.zenithWorld) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 velocity = new Vector2(-projectile.velocity.X, -projectile.velocity.Y); velocity.Normalize(); diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 1ae1b44ac5..e39685f9e3 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -32,6 +32,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { [AutoloadBossHead] + [LongDistanceNetSync] public class DesertScourgeHead : ModNPC { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; @@ -66,7 +67,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() @@ -92,14 +93,14 @@ namespace CalamityMod.NPCs.DesertScourge NPC.width = 104; NPC.height = 104; - NPC.LifeMaxNERB(4200, 5000, 1650000); + NPC.LifeMaxNERB(4200, 5000, 1400000); if (Main.getGoodWorld) NPC.lifeMax *= 4; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; NPC.boss = true; - NPC.value = Item.buyPrice(0, 5, 0, 0); + NPC.value = Item.buyPrice(0, 2, 0, 0); NPC.alpha = 255; NPC.behindTiles = true; NPC.noGravity = true; @@ -181,6 +182,7 @@ namespace CalamityMod.NPCs.DesertScourge } NPC.dontTakeDamage = hide; + NPC.canDisplayBuffs = !hide; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -866,11 +868,10 @@ namespace CalamityMod.NPCs.DesertScourge NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) { NPC.ai[3] = 2f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); NPC.frame.Y = 0; } } @@ -891,12 +892,11 @@ namespace CalamityMod.NPCs.DesertScourge { if (NPC.frame.Y > 0) { - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) { NPC.frame.Y = 0; NPC.ai[3] = 0f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else { @@ -911,8 +911,7 @@ namespace CalamityMod.NPCs.DesertScourge else { NPC.ai[3] = 0f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } } } @@ -942,7 +941,7 @@ namespace CalamityMod.NPCs.DesertScourge CalamityUtils.DisplayLocalizedText(key2, messageColor2); if (!Terraria.GameContent.Events.Sandstorm.Happening) - CalamityUtils.StartSandstorm(); + CalamityWorld.StartSandstorm(); } // Mark Desert Scourge as dead. @@ -1020,7 +1019,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { 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); @@ -1052,8 +1051,7 @@ namespace CalamityMod.NPCs.DesertScourge { target.AddBuff(BuffID.Bleeding, 600); NPC.ai[3] = 1f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } } diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 57cc5f1694..31d98c95c6 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [LongDistanceNetSync(SyncWith = typeof(DesertScourgeHead))] public class DesertScourgeTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertScourgeHead.DisplayName"); @@ -27,7 +28,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.defense = 9; NPC.DR_NERD(0.1f); - NPC.LifeMaxNERB(4200, 5000, 1650000); + NPC.LifeMaxNERB(4200, 5000, 1400000); if (Main.getGoodWorld) NPC.lifeMax *= 4; NPC.aiStyle = -1; @@ -81,6 +82,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.life = Main.npc[(int)NPC.ai[1]].life; NPC.dontTakeDamage = Main.npc[(int)NPC.ai[1]].dontTakeDamage; + NPC.canDisplayBuffs = Main.npc[(int)NPC.ai[1]].canDisplayBuffs; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -216,7 +218,7 @@ namespace CalamityMod.NPCs.DesertScourge if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= 30f * NPC.scale && NPC.alpha <= 0; + return minDist <= 20f * NPC.scale && NPC.alpha <= 0; } public override void HitEffect(NPC.HitInfo hit) @@ -226,7 +228,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeTail").Type, NPC.scale); for (int k = 0; k < 10; k++) diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 108dabfd4c..51946e7d4c 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -13,6 +13,7 @@ using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))] public class CosmicGuardianBody : ModNPC { public int invinceTime = 180; @@ -163,8 +164,8 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -194,7 +195,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT2").Type, 1f); diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index b0c03b3185..d85e147d7e 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [LongDistanceNetSync] public class CosmicGuardianHead : ModNPC { private bool tail = false; @@ -32,7 +33,6 @@ namespace CalamityMod.NPCs.DevourerofGods { Scale = 0.75f, PortraitScale = 0.75f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/CosmicGuardian_Bestiary", PortraitPositionXOverride = 40, PortraitPositionYOverride = 40 }; @@ -137,7 +137,7 @@ namespace CalamityMod.NPCs.DevourerofGods } tail = true; } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) { NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -361,8 +361,14 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); + + + if (NPC.IsABestiaryIconDummy) + { + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, texture2D15, TextureAssets.Npc[ModContent.NPCType()].Value, 8, 26, 0.2f, new Vector2(-10, 0), 4, 5); + } Vector2 distFromHead3 = NPC.Center - screenPos; distFromHead3 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -410,7 +416,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoT").Type, 1f); } diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index 093805d776..7bcc59229f 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -13,6 +13,7 @@ using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))] public class CosmicGuardianTail : ModNPC { public int invinceTime = 180; @@ -160,8 +161,8 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -186,7 +187,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT2").Type, 1f); diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index cd5c8feaf7..5404aa006f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -20,16 +20,15 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [LongDistanceNetSync(SyncWith = typeof(DevourerofGodsHead))] public class DevourerofGodsBody : ModNPC { public static int phase2IconIndex; - internal static void LoadHeadIcons() + public override void Load() { string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS_Head_Boss"; - - CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); - phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); } private const float LaserVelocityMultiplierMin = 0.5f; @@ -180,12 +179,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = (int)(70 * NPC.scale); NPC.frame = new Rectangle(0, 0, 114, 88); NPC.position -= NPC.Size * 0.5f; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } @@ -231,7 +225,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (phase2) { // Fire lasers from every 15th (20th in normal mode) body segment if not in laser wall phase - float laserWallPhaseGateValue = 720f; + float laserWallPhaseGateValue = DevourerofGodsHead.LaserWallCooldown - (bossRush ? 360f : death ? 180f : 0f); if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] < laserWallPhaseGateValue - 180f) { NPC.localAI[0] += 1f; @@ -259,14 +253,14 @@ namespace CalamityMod.NPCs.DevourerofGods } else { - // Fire lasers from every 15th (20th in normal mode) body segment if not in laser barrage phase - float laserBarrageGateValue = bossRush ? 780f : death ? 900f : 960f; + // Fire lasers from every 20th (25th in normal mode) body segment if not in laser barrage phase + float laserBarrageGateValue = bossRush ? 1080f : death ? 1320f : 1440f; float laserBarrageShootGateValue = bossRush ? 160f : 240f; float laserBarragePhaseGateValue = laserBarrageGateValue - laserBarrageShootGateValue * 1.5f; if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[1] < laserBarragePhaseGateValue) { NPC.localAI[0] += 1f; - if (NPC.localAI[0] >= laserBarrageGateValue * (Main.getGoodWorld ? 0.1f : 0.2f) && NPC.ai[0] % (expertMode ? 15f : 20f) == 0f) + if (NPC.localAI[0] >= laserBarrageGateValue * (Main.getGoodWorld ? 0.1f : 0.2f) && NPC.ai[0] % (expertMode ? 20f : 25f) == 0f) { NPC.TargetClosest(); SoundEngine.PlaySound(SoundID.Item12, player.Center); @@ -320,11 +314,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.Opacity < 0.2f) NPC.Opacity = 0f; - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } } @@ -399,7 +389,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; - Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -473,12 +463,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.life = 1; NPC.dontTakeDamage = true; NPC.active = true; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); if (NPC.realLife >= 0) { @@ -488,12 +473,7 @@ namespace CalamityMod.NPCs.DevourerofGods Head.ModNPC().Dying = true; Head.dontTakeDamage = true; - - Head.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (Head.netSpam >= 10) - Head.netSpam = 9; + Head.ForceNetUpdate(false); } return false; } @@ -502,7 +482,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoGS6").Type, NPC.scale); diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index d314df271a..d377a711a7 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -44,6 +44,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [LongDistanceNetSync] public class DevourerofGodsHead : ModNPC { public static int phase1IconIndex; @@ -55,16 +56,13 @@ namespace CalamityMod.NPCs.DevourerofGods public static Asset Phase2Texture_Glow; public static Asset Phase2Texture_Glow2; - internal static void LoadHeadIcons() + public override void Load() { string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadS_Head_Boss"; - - CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); - phase1IconIndex = ModContent.GetModBossHeadSlot(phase1IconPath); - - CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); - phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + + phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); + phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); } // Laser velocity @@ -82,9 +80,9 @@ namespace CalamityMod.NPCs.DevourerofGods } // Laser spread variables - private const int shotSpacingMax = 1470; + private const int shotSpacingMax = 1440; private int shotSpacing = shotSpacingMax; - private const int totalShots = 14; + private const int totalShots = 10; private const int spacingVar = shotSpacingMax / totalShots * 2; private int laserWallType = 0; private const float laserWallSpacingOffset = 16f; @@ -125,11 +123,11 @@ namespace CalamityMod.NPCs.DevourerofGods } // Laser wall variables - private const int shotSpacingMax_Phase2 = 1470; + private const int shotSpacingMax_Phase2 = 1440; private int[] shotSpacing_Phase2 = new int[4] { shotSpacingMax_Phase2, shotSpacingMax_Phase2, shotSpacingMax_Phase2, shotSpacingMax_Phase2 }; - private const int spacingVar_Phase2 = 105; - private const int totalShots_Phase2 = 28; - private const int totalDiagonalShots = 8; + private const int spacingVar_Phase2 = 120; + private const int totalShots_Phase2 = 24; + private const int totalDiagonalShots = 6; private const int diagonalSpacingVar = shotSpacingMax_Phase2 / totalDiagonalShots * 2; private int laserWallType_Phase2 = 0; public int laserWallPhase = 0; @@ -137,6 +135,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Phase variables private const int idleCounterMax = 300; private int idleCounter = idleCounterMax; + public const float LaserWallCooldown = 1200f; private int postTeleportTimer = 0; private int teleportTimer = -1; private const int TimeBeforeTeleport_Death = 120; @@ -144,7 +143,7 @@ namespace CalamityMod.NPCs.DevourerofGods private const int TimeBeforeTeleport_Expert = 160; private const int TimeBeforeTeleport_Normal = 180; private bool spawnedGuardians3 = false; - private const float alphaGateValue = 669f; + private const float AlphaGateValue = 1060f; public const float SkyColorTransitionTime = 90f; // Death animation variables @@ -167,7 +166,6 @@ namespace CalamityMod.NPCs.DevourerofGods { Scale = 0.6f, PortraitScale = 0.6f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/DevourerofGods_Bestiary", PortraitPositionXOverride = 60, PortraitPositionYOverride = 40 }; @@ -207,7 +205,7 @@ namespace CalamityMod.NPCs.DevourerofGods AIType = -1; NPC.knockBackResist = 0f; NPC.boss = true; - NPC.value = Item.buyPrice(6, 0, 0, 0); + NPC.value = Item.buyPrice(2, 0, 0, 0); NPC.Opacity = 0f; NPC.behindTiles = true; NPC.noGravity = true; @@ -289,11 +287,8 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(extrapitch); // Be sure to inform clients of the fact that The Devourer of Gods is dying if only the server recieved this packet. - if (Main.netMode == NetmodeID.Server && !wasDyingBefore && Dying) - { - NPC.netSpam = 0; - NPC.netUpdate = true; - } + if (Main.dedServ && !wasDyingBefore && Dying) + NPC.ForceNetUpdate(); } public override void ReceiveExtraAI(BinaryReader reader) @@ -353,8 +348,8 @@ namespace CalamityMod.NPCs.DevourerofGods CalamityGlobalNPC.DoGP2 = -1; // Stop rain - if (CalamityConfig.Instance.BossesStopWeather) - CalamityMod.StopRain(); + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); // Get a target (time is checked in the second check to ensure a new target isn't being set constantly) if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -474,11 +469,7 @@ namespace CalamityMod.NPCs.DevourerofGods continue; Main.npc[a].active = false; - Main.npc[a].netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (Main.npc[a].netSpam >= 10) - Main.npc[a].netSpam = 9; + Main.npc[a].ForceNetUpdate(false); } } } @@ -536,8 +527,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.ai[3] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } // Phase 2 countdown @@ -556,12 +546,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = (int)(186 * NPC.scale); NPC.position -= NPC.Size * 0.5f; NPC.frame = new Rectangle(0, 0, 134, 196); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } // Dialogue the moment the second phase starts @@ -600,12 +585,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.MultiplayerClient && newOpacity > 0f && NPC.Opacity > newOpacity) { NPC.Opacity = newOpacity; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } if (NPC.Opacity < 0.2f) @@ -622,12 +602,7 @@ namespace CalamityMod.NPCs.DevourerofGods PortalIndex = Projectile.NewProjectile(NPC.GetSource_FromAI(), portalSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); hasCreatedPhase1Portal = true; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } AttemptingToEnterPortal = true; @@ -661,30 +636,26 @@ namespace CalamityMod.NPCs.DevourerofGods { Dying = true; NPC.dontTakeDamage = true; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); return; } // Laser walls + float adjustedAlphaGateValue = AlphaGateValue - (bossRush ? 360f : death ? 180f : 0f); if (phase4 && !spawnedGuardians3 && postTeleportTimer <= 0) { if (laserWallPhase == (int)LaserWallPhase.SetUp) { // Enter laser wall phase very quickly when final phase starts - if (phase6 && calamityGlobalNPC.newAI[3] < alphaGateValue) - calamityGlobalNPC.newAI[3] = alphaGateValue; + if (phase6 && calamityGlobalNPC.newAI[3] < adjustedAlphaGateValue) + calamityGlobalNPC.newAI[3] = adjustedAlphaGateValue; // Increment next laser wall phase timer calamityGlobalNPC.newAI[3] += 1f; // Set alpha value prior to firing laser walls - if (calamityGlobalNPC.newAI[3] > alphaGateValue) + if (calamityGlobalNPC.newAI[3] > adjustedAlphaGateValue) { // Disable teleports if (teleportTimer > 0) @@ -693,11 +664,12 @@ namespace CalamityMod.NPCs.DevourerofGods teleportTimer = 0; } - NPC.Opacity = 1f - (MathHelper.Clamp((calamityGlobalNPC.newAI[3] - alphaGateValue) * 5f, 0f, 255f) / 255f); + NPC.Opacity = 1f - (MathHelper.Clamp((calamityGlobalNPC.newAI[3] - adjustedAlphaGateValue) * 5f, 0f, 255f) / 255f); } - // Fire laser walls every 12 seconds after a laser wall phase ends - if (calamityGlobalNPC.newAI[3] >= 720f) + // Fire laser walls every X seconds after a laser wall phase ends + float laserWallGateValue = LaserWallCooldown - (bossRush ? 360f : death ? 180f : 0f); + if (calamityGlobalNPC.newAI[3] >= laserWallGateValue) { NPC.Opacity = 0f; @@ -710,7 +682,7 @@ namespace CalamityMod.NPCs.DevourerofGods } else if (laserWallPhase == (int)LaserWallPhase.FireLaserWalls) { - // Remain in laser wall firing phase for 4 seconds + // Remain in laser wall firing phase for X seconds idleCounter--; if (idleCounter <= 0) { @@ -950,7 +922,7 @@ namespace CalamityMod.NPCs.DevourerofGods Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[3], laserVelocity, 0f, type, damage, 0f, Main.myPlayer); } - shotSpacing_Phase2[3] -= Main.rand.NextBool() ? 180 : 200; + shotSpacing_Phase2[3] -= Main.rand.NextBool() ? 215 : 235; } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1030,12 +1002,10 @@ namespace CalamityMod.NPCs.DevourerofGods // Set flight time to max during laser walls if (!spawnedGuardians3 && laserWallPhase == (int)LaserWallPhase.FireLaserWalls) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - 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].Calamity().infiniteFlight = true; - } + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.Calamity().infiniteFlight = true; } } @@ -1062,10 +1032,10 @@ namespace CalamityMod.NPCs.DevourerofGods // Flight if (NPC.ai[3] == 0f) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - 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); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } // Charge in a direction for a second until the timer is back at 0 @@ -1084,13 +1054,9 @@ namespace CalamityMod.NPCs.DevourerofGods // Go to ground phase sooner if (increaseSpeedMore) { - if (laserWallPhase == (int)LaserWallPhase.SetUp && calamityGlobalNPC.newAI[3] <= alphaGateValue) + if (laserWallPhase == (int)LaserWallPhase.SetUp && calamityGlobalNPC.newAI[3] <= adjustedAlphaGateValue) SpawnTeleportLocation(player); - else - calamityGlobalNPC.newAI[2] += 10f; } - else - calamityGlobalNPC.newAI[2] += 2f; float speedCopy = speed; float turnSpeedCopy = turnSpeed; @@ -1269,22 +1235,17 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; NPC.TargetClosest(); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } // Ground else { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - 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); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } // Charge in a direction for a second until the timer is back at 0 @@ -1301,7 +1262,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Enrage if (increaseSpeedMore) { - if (laserWallPhase == (int)LaserWallPhase.SetUp && calamityGlobalNPC.newAI[3] <= alphaGateValue) + if (laserWallPhase == (int)LaserWallPhase.SetUp && calamityGlobalNPC.newAI[3] <= adjustedAlphaGateValue) SpawnTeleportLocation(player); else groundPhaseTurnSpeed *= 4f; @@ -1530,38 +1491,20 @@ namespace CalamityMod.NPCs.DevourerofGods if (flies) { 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.ForceNetUpdate(false); 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.ForceNetUpdate(false); 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.ForceNetUpdate(false); if (calamityGlobalNPC.newAI[2] > phaseLimit) { @@ -1569,12 +1512,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; NPC.TargetClosest(); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } } @@ -1644,7 +1582,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Laser barrage attack variables - float laserBarrageGateValue = bossRush ? 780f : death ? 900f : 960f; + float laserBarrageGateValue = bossRush ? 1080f : death ? 1320f : 1440f; float laserBarrageShootGateValue = bossRush ? 160f : 240f; float laserBarragePhaseGateValue = laserBarrageGateValue - laserBarrageShootGateValue; @@ -1871,10 +1809,10 @@ namespace CalamityMod.NPCs.DevourerofGods // Flight if (NPC.ai[3] == 0f) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - 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); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } // Flying movement @@ -1882,12 +1820,6 @@ namespace CalamityMod.NPCs.DevourerofGods calamityGlobalNPC.newAI[2] += 1f; - // Go to ground phase sooner - if (increaseSpeedMore) - calamityGlobalNPC.newAI[2] += 10f; - else if (increaseSpeed) - calamityGlobalNPC.newAI[2] += 2f; - float speedCopy = speed; float turnSpeedCopy = turnSpeed; Vector2 npcCenter = NPC.Center; @@ -2062,22 +1994,17 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; NPC.TargetClosest(); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } // Ground else { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - 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); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } calamityGlobalNPC.newAI[2] += 1f; @@ -2309,38 +2236,20 @@ namespace CalamityMod.NPCs.DevourerofGods if (flies) { 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.ForceNetUpdate(false); 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.ForceNetUpdate(false); 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.ForceNetUpdate(false); if (calamityGlobalNPC.newAI[2] > phaseLimit) { @@ -2450,12 +2359,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Prediction is Death Mode only for now because it's weird without the line telegraph that Shayy spoke about Vector2 predictionVector = death ? player.velocity * 40f : Vector2.Zero; NPC.velocity = Vector2.Normalize(player.Center + predictionVector - NPC.Center) * chargeVelocity; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); foreach (NPC n in Main.ActiveNPCs) { @@ -2466,11 +2370,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (n.type == ModContent.NPCType()) ((DevourerofGodsTail)n.ModNPC).setInvulTime(720); - n.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (n.netSpam >= 10) - n.netSpam = 9; + n.ForceNetUpdate(false); } } @@ -2517,12 +2417,7 @@ namespace CalamityMod.NPCs.DevourerofGods n.life = 0; n.HitEffect(); n.active = false; - - n.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (n.netSpam >= 10) - n.netSpam = 9; + n.ForceNetUpdate(false); destroyedSegments++; break; @@ -2552,7 +2447,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { SoundEngine.PlaySound(DeathAnimationSound, NPC.Center); @@ -2578,12 +2473,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.HitEffect(); NPC.NPCLoot(); NPC.active = false; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } DeathAnimationTimer++; } @@ -2629,10 +2519,12 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = (Phase2Started && NPC.localAI[2] <= 60f) || NPC.IsABestiaryIconDummy; - Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); if (NPC.IsABestiaryIconDummy) - NPC.frame = texture2D15.Frame(); + { + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, texture2D15, DevourerofGodsBody.Phase2Texture.Value, 4, 26, 0.5f, new Vector2(30, 10), 2, 20); + } Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; @@ -2671,7 +2563,7 @@ namespace CalamityMod.NPCs.DevourerofGods CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedDoG); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedDoG); // If DoG has not been killed yet, notify players that the holiday moons are buffed if (!DownedBossSystem.downedDoG) @@ -2711,8 +2603,8 @@ namespace CalamityMod.NPCs.DevourerofGods // Extraneous potions 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()); + // Alicorn Mount + npcLoot.AddIf((info) => info.player.Calamity().cirrusVodka, ModContent.ItemType()); // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); @@ -2847,12 +2739,7 @@ namespace CalamityMod.NPCs.DevourerofGods Dying = true; NPC.dontTakeDamage = true; NPC.active = true; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); return false; } @@ -2866,7 +2753,7 @@ namespace CalamityMod.NPCs.DevourerofGods } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoGS").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoGS2").Type, NPC.scale); @@ -2922,7 +2809,31 @@ namespace CalamityMod.NPCs.DevourerofGods }); Color messageColor = Color.Cyan; Rectangle location = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + + // Speak in Wingdings if the Punch Card is equipped + if (target.Calamity().punchCard && DoGWingdings.Wingdings != null && System.Environment.OSVersion.Platform == PlatformID.Win32NT && !GameCulture.FromCultureName(GameCulture.CultureName.Chinese).IsActive && !GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive) + { + Vector2 vector = DoGWingdings.Wingdings.MeasureString(Language.GetTextValue(text)); + // This is how normal combat text spawn positioning is handled + float positionX = (float)location.X + (float)location.Width * 0.5f - vector.X * 0.5f + Main.rand.Next(-(int)((double)location.Width * 0.5), (int)((double)location.Width * 0.5) + 1); + float positionY = (float)location.Y + (float)location.Height * 0.25f - vector.Y * 0.5f + Main.rand.Next(-(int)((double)location.Height * 0.5), (int)((double)location.Height * 0.5) + 1); + if (target.gravDir == -1f) + { + positionY = (float)location.Y + (float)location.Height * 0.75f + vector.Y * 0.5f; + } + // Spawn a projectile that mimmicks combat text behaviour + int p = Projectile.NewProjectile(NPC.GetSource_FromThis(), new Vector2(positionX, positionY), new Vector2((float)Main.rand.Next(-25, 26) * 0.05f , - 14f * target.gravDir), ModContent.ProjectileType(), 0, 0, -1, -1); + Projectile proj = Main.projectile[p]; + proj.rotation = proj.velocity.X < 0 ? -0.06f : 0.06f; + + // Pass the spoken dialogue into it + DoGWingdings wingdings = Main.projectile[p].ModProjectile(); + wingdings.dialogue = Language.GetTextValue(text); + } + else + { + CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + } target.Calamity().dogTextCooldown = 60; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index a741f40fbc..cc6792d10a 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -19,6 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [LongDistanceNetSync(SyncWith = typeof(DevourerofGodsHead))] public class DevourerofGodsTail : ModNPC { public static int phase1IconIndex; @@ -30,16 +31,13 @@ namespace CalamityMod.NPCs.DevourerofGods public static Asset Phase2Texture_Glow; public static Asset Phase2Texture_Glow2; - internal static void LoadHeadIcons() + public override void Load() { string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsTail_Head_Boss"; string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS_Head_Boss"; - - CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); - phase1IconIndex = ModContent.GetModBossHeadSlot(phase1IconPath); - - CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); - phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + + phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); + phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); } private int invinceTime = 720; @@ -181,12 +179,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = (int)(140 * NPC.scale); NPC.frame = new Rectangle(0, 0, 86, 148); NPC.position -= NPC.Size * 0.5f; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } @@ -270,11 +263,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.Opacity < 0.2f) NPC.Opacity = 0f; - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } } @@ -363,7 +352,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; - Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 drawPosition = NPC.Center - screenPos; @@ -422,7 +411,7 @@ namespace CalamityMod.NPCs.DevourerofGods } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoGS3").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoGS4").Type, NPC.scale); @@ -476,12 +465,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.life = 1; NPC.dontTakeDamage = true; NPC.active = true; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); if (NPC.realLife >= 0) { @@ -491,12 +475,7 @@ namespace CalamityMod.NPCs.DevourerofGods Head.ModNPC().Dying = true; Head.dontTakeDamage = true; - - Head.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (Head.netSpam >= 10) - Head.netSpam = 9; + Head.ForceNetUpdate(false); } return false; } diff --git a/NPCs/DevourerofGods/DoGSky.cs b/NPCs/DevourerofGods/DoGSky.cs index ded6e6fd46..4fe73de101 100644 --- a/NPCs/DevourerofGods/DoGSky.cs +++ b/NPCs/DevourerofGods/DoGSky.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.DevourerofGods { float x = 0f; if (DoGIndex != -1) - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[DoGIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[DoGIndex].Center); float intensityScalar = 0.5f; return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar; diff --git a/NPCs/DraedonLabThings/Androomba.cs b/NPCs/DraedonLabThings/Androomba.cs index 012e36788c..0685a9f629 100644 --- a/NPCs/DraedonLabThings/Androomba.cs +++ b/NPCs/DraedonLabThings/Androomba.cs @@ -22,9 +22,9 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 22; - NPCID.Sets.CountsAsCritter[NPC.type] = true; - Main.npcCatchable[NPC.type] = true; + Main.npcFrameCount[Type] = 22; + NPCID.Sets.CountsAsCritter[Type] = true; + Main.npcCatchable[Type] = true; NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 18; @@ -256,7 +256,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D critterTexture = TextureAssets.Npc[Type].Value; Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; drawPosition.Y += DrawOffsetY; diff --git a/NPCs/DraedonLabThings/Nanodroid.cs b/NPCs/DraedonLabThings/Nanodroid.cs index 5730109ccb..bc9a1f74ee 100644 --- a/NPCs/DraedonLabThings/Nanodroid.cs +++ b/NPCs/DraedonLabThings/Nanodroid.cs @@ -17,9 +17,9 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; - NPCID.Sets.CountsAsCritter[NPC.type] = true; - Main.npcCatchable[NPC.type] = true; + Main.npcFrameCount[Type] = 8; + NPCID.Sets.CountsAsCritter[Type] = true; + Main.npcCatchable[Type] = true; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { NPC.spriteDirection = NPC.direction; NPC.frameCounter += 0.3f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -71,7 +71,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D critterTexture = TextureAssets.Npc[Type].Value; Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/DraedonLabThings/NanodroidDysfunctional.cs b/NPCs/DraedonLabThings/NanodroidDysfunctional.cs index c2ffabf81f..c8fda4b19b 100644 --- a/NPCs/DraedonLabThings/NanodroidDysfunctional.cs +++ b/NPCs/DraedonLabThings/NanodroidDysfunctional.cs @@ -17,9 +17,9 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 8; - NPCID.Sets.CountsAsCritter[NPC.type] = true; - Main.npcCatchable[NPC.type] = true; + Main.npcFrameCount[Type] = 8; + NPCID.Sets.CountsAsCritter[Type] = true; + Main.npcCatchable[Type] = true; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { NPC.spriteDirection = NPC.direction; NPC.frameCounter += 0.3f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -75,7 +75,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D critterTexture = TextureAssets.Npc[Type].Value; Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs b/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs index babe18e052..2a009ae63f 100644 --- a/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs +++ b/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs @@ -17,9 +17,9 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 8; - NPCID.Sets.CountsAsCritter[NPC.type] = true; - Main.npcCatchable[NPC.type] = true; + Main.npcFrameCount[Type] = 8; + NPCID.Sets.CountsAsCritter[Type] = true; + Main.npcCatchable[Type] = true; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); @@ -52,6 +52,9 @@ namespace CalamityMod.NPCs.DraedonLabThings break; } } + // The only purpose of this is to make them not take forever to appear when shimmering Plagued Containment Brick + if (NPC.shimmerTransparency > 0f) + NPC.shimmerTransparency -= 0.05f; } public override bool? CanBeHitByItem(Player player, Item item) => null; @@ -62,7 +65,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { NPC.spriteDirection = NPC.direction; NPC.frameCounter += 0.3f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -75,7 +78,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D critterTexture = TextureAssets.Npc[Type].Value; Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/DraedonLabThings/NanodroidPlagueRed.cs b/NPCs/DraedonLabThings/NanodroidPlagueRed.cs index ca28f3ce7f..094e9cc3f4 100644 --- a/NPCs/DraedonLabThings/NanodroidPlagueRed.cs +++ b/NPCs/DraedonLabThings/NanodroidPlagueRed.cs @@ -17,9 +17,9 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 8; - NPCID.Sets.CountsAsCritter[NPC.type] = true; - Main.npcCatchable[NPC.type] = true; + Main.npcFrameCount[Type] = 8; + NPCID.Sets.CountsAsCritter[Type] = true; + Main.npcCatchable[Type] = true; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); @@ -52,6 +52,9 @@ namespace CalamityMod.NPCs.DraedonLabThings break; } } + // The only purpose of this is to make them not take forever to appear when shimmering Plagued Containment Brick + if (NPC.shimmerTransparency > 0f) + NPC.shimmerTransparency -= 0.05f; } public override bool? CanBeHitByItem(Player player, Item item) => null; @@ -62,7 +65,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { NPC.spriteDirection = NPC.direction; NPC.frameCounter += 0.3f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -75,7 +78,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D critterTexture = TextureAssets.Npc[Type].Value; Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index 0edf8ef94a..9134f87a5f 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -55,9 +55,9 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 17; - Main.npcCatchable[NPC.type] = true; - NPCID.Sets.CountsAsCritter[NPC.type] = true; + Main.npcFrameCount[Type] = 17; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; NPCID.Sets.CantTakeLunchMoney[Type] = true; NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); @@ -316,7 +316,7 @@ namespace CalamityMod.NPCs.DraedonLabThings if (CurrentFrame < 9) CurrentFrame = 9f; CurrentFrame++; - if (CurrentFrame >= Main.npcFrameCount[NPC.type]) + if (CurrentFrame >= Main.npcFrameCount[Type]) CurrentFrame = 9f; NPC.frameCounter = 0; } @@ -336,7 +336,7 @@ namespace CalamityMod.NPCs.DraedonLabThings Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 3; i++) Gore.NewGorePerfect(NPC.GetSource_Death(), NPC.Center, NPC.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.7f, 1f), Mod.Find($"RepairUnit{i}").Type); @@ -369,7 +369,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D critterTexture = TextureAssets.Npc[Type].Value; Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 92b9bf0991..0aa51994f3 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -32,16 +32,13 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public static Asset GlowTexture; - internal static void LoadHeadIcons() + public override void Load() { string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Apollo/ApolloHead"; string phase2IconPath = "CalamityMod/NPCs/ExoMechs/Apollo/ApolloPhase2Head"; - - CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); - phase1IconIndex = ModContent.GetModBossHeadSlot(phase1IconPath); - - CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); - phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + + phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); + phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); } public enum Phase @@ -126,8 +123,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void SetStaticDefaults() { - NPCID.Sets.TrailingMode[NPC.type] = 3; - NPCID.Sets.TrailCacheLength[NPC.type] = 15; + NPCID.Sets.TrailingMode[Type] = 3; + NPCID.Sets.TrailCacheLength[Type] = 15; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -158,7 +155,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(15, 0, 0, 0); + NPC.value = Item.buyPrice(1, 0, 0, 0); NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -854,8 +851,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Do nothing while immune AIState = (float)Phase.Normal; - // Enter the fight again if any of the other exo mechs is below 70% and other mechs aren't berserk - if ((exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk) + // Enter the fight again if any of the other exo mechs is below 70% or dead and other mechs aren't berserk + // CIT 10FEB2025: Added checks for if the other mechs are alive, to fix softlocks if you somehow skip straight to berserk + if ((!exoWormAlive || exoWormLifeRatio < 0.7f || !exoPrimeAlive || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk) { // Set Artemis variables if (exoMechTwinRedAlive) @@ -1166,8 +1164,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.velocity = Vector2.Normalize(chargeLocations[(int)calamityGlobalNPC.newAI[2] + 1] - chargeLocations[(int)calamityGlobalNPC.newAI[2]]) * chargeVelocity; NPC.localAI[2] = 1f; - NPC.netUpdate = true; - NPC.netSpam -= 5; + NPC.ForceNetUpdate(); // Plasma bolts on charge if (Main.netMode != NetmodeID.MultiplayerClient && (!(Main.zenithWorld && !exoMechdusa) || (CalamityWorld.LegendaryMode && revenge))) // I'm not that evil (you aren't, but I am - Fab) @@ -1519,7 +1516,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); int numAfterimages = ChargeComboFlash > 0f ? 0 : 5; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); Vector2 origin = NPC.Size * 0.5f; Vector2 center = NPC.Center - screenPos; @@ -1529,7 +1526,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // This is created to allow easy duplication of them when drawing the charge. void drawInstance(Vector2 drawOffset, Color baseColor) { - if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) + if (CalamityClientConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) { @@ -1600,7 +1597,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } texture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) + if (CalamityClientConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) { @@ -1753,7 +1750,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Apollo1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Apollo2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index ea1654d11d..0eac5b0b48 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -182,8 +182,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { - NPCID.Sets.TrailingMode[NPC.type] = 3; - NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + NPCID.Sets.TrailingMode[Type] = 3; + NPCID.Sets.TrailCacheLength[Type] = NPC.oldPos.Length; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -229,7 +229,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(15, 0, 0, 0); + NPC.value = Item.buyPrice(1, 0, 0, 0); NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -750,8 +750,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fly above target and become immune case (int)SecondaryPhase.PassiveAndImmune: - // Enter the fight again if any of the other exo mechs is below 70% and other mechs aren't berserk - if ((exoWormLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk) + // Enter the fight again if any of the other exo mechs is below 70% or dead and other mechs aren't berserk + // CIT 10FEB2025: Added checks for if the other mechs are alive, to fix softlocks if you somehow skip straight to berserk + if (((!exoWormAlive || exoWormLifeRatio < 0.7f) || (!exoTwinsAlive || exoTwinsLifeRatio < 0.7f)) && !otherMechIsBerserk) { // Tells Ares to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed @@ -853,11 +854,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case (int)Phase.Deathrays: // Set flight time to max during Deathray Spiral - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < DeathrayEnrageDistance) + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < DeathrayEnrageDistance) { - Main.player[Main.myPlayer].Calamity().infiniteFlight = true; + Main.LocalPlayer.Calamity().infiniteFlight = true; } } @@ -872,9 +873,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if ((distanceFromTarget > DeathrayEnrageDistance || (CalamityWorld.LegendaryMode && revenge)) && EnragedState == (float)Enraged.No) { // Play enrage sound - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) { - SoundEngine.PlaySound(EnragedSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(EnragedSound, Main.LocalPlayer.Center); } // Draedon comments on how foolish it is to run @@ -983,10 +984,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } + // The sound stops a few seconds before the attack ends as the lasers shrink in size + float stopSound = deathrayTelegraphDuration + deathrayDuration - 160; + // Update the deathray sound if it's being played. - if (SoundEngine.TryGetActiveSound(DeathraySoundSlot, out var deathraySound) && deathraySound.IsPlaying) + if (SoundEngine.TryGetActiveSound(DeathraySoundSlot, out var deathraySound) && deathraySound.IsPlaying && calamityGlobalNPC.newAI[2] < stopSound) deathraySound.Position = NPC.Center; - if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration) + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration && calamityGlobalNPC.newAI[2] < stopSound) { // Start the loop sound if the start sound finished. if (deathraySound is null || !deathraySound.IsPlaying || calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration + 180f) @@ -1001,6 +1005,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } + // Stop the laser loop and play the end sound. + if (calamityGlobalNPC.newAI[2] == stopSound) + { + deathraySound?.Stop(); + SoundEngine.PlaySound(LaserEndSound, NPC.Center); + } + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) { if (!Main.zenithWorld || exoMechdusa) @@ -1066,10 +1077,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares EnragedState = (float)Enraged.No; } - // Stop the laser loop and play the end sound. - deathraySound?.Stop(); - SoundEngine.PlaySound(LaserEndSound, NPC.Center); - NPC.localAI[0] += 1f; NPC.TargetClosest(); NPC.netUpdate = true; @@ -1237,12 +1244,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares DrawArm(spriteBatch, NPC.Center + NPC.scale * new Vector2(400f, 300f), screenPos, armGlowmaskColor, 1, false); } - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].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); int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -1262,7 +1269,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares texture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -1577,6 +1584,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Relic npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf(CanDropLoot, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf(CanDropLoot, ModContent.ItemType(), 4); // GFB Broken Water Filter var GFBOnly = npcLoot.DefineConditionalDropSet(DropHelper.GFB); @@ -1666,7 +1674,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresBody1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresBody2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 25711cd7e6..29284604a7 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -76,8 +76,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 3; - NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + NPCID.Sets.TrailingMode[Type] = 3; + NPCID.Sets.TrailCacheLength[Type] = NPC.oldPos.Length; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -546,13 +546,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].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 = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -593,7 +593,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D glowTexture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -660,7 +660,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares for (int k = 0; k < 3; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (NPC.soundDelay == 1) + if (NPC.soundDelay == 0) { NPC.soundDelay = 3; SoundEngine.PlaySound(CommonCalamitySounds.ExoHitSound, NPC.Center); @@ -682,7 +682,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresGaussNuke1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresGaussNuke2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index e3cae35c3b..5aed8336db 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -79,8 +79,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 3; - NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + NPCID.Sets.TrailingMode[Type] = 3; + NPCID.Sets.TrailCacheLength[Type] = NPC.oldPos.Length; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -470,9 +470,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.SimpleFlyMovement(desiredVelocity, baseAcceleration); float velocityX = flyLeft ? deathrayPhaseVelocity : -deathrayPhaseVelocity; NPC.velocity = horizontalLaserSweep ? new Vector2(velocityX, NPC.velocity.Y) : new Vector2(NPC.velocity.X, deathrayPhaseVelocity * 0.75f); - - NPC.netUpdate = true; - NPC.netSpam -= 5; + NPC.ForceNetUpdate(); // Fire deathray if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) @@ -594,13 +592,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].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 = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -639,7 +637,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D glowTexture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -732,7 +730,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresLaserCannon1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresLaserCannon2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 92d41aaa67..fc227df3a3 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -73,8 +73,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 3; - NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + NPCID.Sets.TrailingMode[Type] = 3; + NPCID.Sets.TrailCacheLength[Type] = NPC.oldPos.Length; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -545,13 +545,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].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 = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -591,7 +591,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D glowTexture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -681,7 +681,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresPlasmaFlamethrower1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresPlasmaFlamethrower2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index ad5752378b..e4dc3a1fb2 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -74,8 +74,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 3; - NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + NPCID.Sets.TrailingMode[Type] = 3; + NPCID.Sets.TrailCacheLength[Type] = NPC.oldPos.Length; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -540,13 +540,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].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 = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -585,7 +585,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D glowTexture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -675,7 +675,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresTeslaCannon1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresTeslaCannon2").Type, 1f); diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index e1b8f140a2..7818bae958 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -44,16 +44,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public static Asset GlowTexture; - internal static void LoadHeadIcons() + public override void Load() { string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Artemis/ArtemisHead"; string phase2IconPath = "CalamityMod/NPCs/ExoMechs/Artemis/ArtemisPhase2Head"; - - CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); - phase1IconIndex = ModContent.GetModBossHeadSlot(phase1IconPath); - - CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); - phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + + phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); + phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); } public enum Phase @@ -159,8 +156,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void SetStaticDefaults() { - NPCID.Sets.TrailingMode[NPC.type] = 3; - NPCID.Sets.TrailCacheLength[NPC.type] = 15; + NPCID.Sets.TrailingMode[Type] = 3; + NPCID.Sets.TrailCacheLength[Type] = 15; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -1414,7 +1411,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); int numAfterimages = ChargeFlash > 0f ? 0 : 5; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); Vector2 origin = NPC.Size * 0.5f; Vector2 center = NPC.Center - screenPos; @@ -1424,7 +1421,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // This is created to allow easy duplication of them when drawing the charge. void drawInstance(Vector2 drawOffset, Color baseColor) { - if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) + if (CalamityClientConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) { @@ -1495,7 +1492,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } texture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) + if (CalamityClientConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) { @@ -1584,7 +1581,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Artemis1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Artemis2").Type, 1f); diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index 623673c9f1..5527da2298 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -4,6 +4,7 @@ using CalamityMod.Events; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Packets; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -22,6 +23,7 @@ using ArtemisBoss = CalamityMod.NPCs.ExoMechs.Artemis.Artemis; namespace CalamityMod.NPCs.ExoMechs { + [LongDistanceNetSync] public class Draedon : ModNPC { public int KillReappearTextCountdown; @@ -89,7 +91,7 @@ namespace CalamityMod.NPCs.ExoMechs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 12; + Main.npcFrameCount[Type] = 12; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = 40f, @@ -99,8 +101,8 @@ namespace CalamityMod.NPCs.ExoMechs }; value.Position.Y += 45f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.ShouldBeCountedAsBoss[NPC.type] = true; - NPCID.Sets.MustAlwaysDraw[NPC.type] = true; + NPCID.Sets.ShouldBeCountedAsBoss[Type] = true; + NPCID.Sets.MustAlwaysDraw[Type] = true; if (!Main.dedServ) { Texture_Glow = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); @@ -221,12 +223,7 @@ namespace CalamityMod.NPCs.ExoMechs CalamityWorld.DraedonMechdusa = false; if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.CodebreakerSummonStuff); - netMessage.Write(CalamityWorld.DraedonSummonCountdown); - netMessage.WriteVector2(CalamityWorld.DraedonSummonPosition); - netMessage.Write(CalamityWorld.DraedonMechdusa); - netMessage.Send(); + CodebreakerSummonStuffPacket.Send(); } } @@ -335,10 +332,7 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ExoMechSelection); - netMessage.Write((int)CalamityWorld.DraedonMechToSummon); - netMessage.Send(); + ExoMechSelectionPacket.Send(); } } } @@ -385,7 +379,7 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.MultiplayerClient) SummonExoMech(); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { SoundEngine.PlaySound(CommonCalamitySounds.FlareSound with { Volume = CommonCalamitySounds.FlareSound.Volume * 1.55f }, PlayerToFollow.Center); if (!exoMechdusa) @@ -539,7 +533,6 @@ namespace CalamityMod.NPCs.ExoMechs } } - // TODO -- Make this work in conjunction with exo mech transitions. This requires that the exo mech AIs be finished. public void FlyAroundInGamerChair() { // Define a hover destination offset if one hasn't been decided yet. @@ -687,7 +680,7 @@ namespace CalamityMod.NPCs.ExoMechs ShouldStartStandingUp = true; // Different text if Exo Mechdusa - if (exoMechdusa) + if (exoMechdusa && Main.netMode != NetmodeID.MultiplayerClient) { if (DefeatTimer == DelayBeforeDefeatStandup + 50f) CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonMechdusaEndText1", TextColor); @@ -696,7 +689,7 @@ namespace CalamityMod.NPCs.ExoMechs CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonMechdusaEndText2", TextColor); } // Otherwise do normal text - else + else if (Main.netMode != NetmodeID.MultiplayerClient) { if (DefeatTimer == DelayBeforeDefeatStandup + 50f) CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonEndText1", TextColor); @@ -748,7 +741,7 @@ namespace CalamityMod.NPCs.ExoMechs int xFrame = NPC.frame.X / NPC.frame.Width; int yFrame = NPC.frame.Y / frameHeight; - int frame = xFrame * Main.npcFrameCount[NPC.type] + yFrame; + int frame = xFrame * Main.npcFrameCount[Type] + yFrame; // Prepare to stand up if called for and not already doing so. if (ShouldStartStandingUp && frame > 23) @@ -778,8 +771,8 @@ namespace CalamityMod.NPCs.ExoMechs NPC.frameCounter = 0; } - NPC.frame.X = frame / Main.npcFrameCount[NPC.type] * NPC.frame.Width; - NPC.frame.Y = frame % Main.npcFrameCount[NPC.type] * frameHeight; + NPC.frame.X = frame / Main.npcFrameCount[Type] * NPC.frame.Width; + NPC.frame.Y = frame % Main.npcFrameCount[Type] * frameHeight; // Handle framing for the projector ProjFrameChangeCounter++; @@ -801,7 +794,7 @@ namespace CalamityMod.NPCs.ExoMechs if (NPC.life > 0) return; - if (Main.netMode != NetmodeID.Server && !HasBeenKilled) + if (!Main.dedServ && !HasBeenKilled) { for (int i = 1; i <= 4; i++) { @@ -848,7 +841,7 @@ namespace CalamityMod.NPCs.ExoMechs spriteBatch.EnterShaderRegion(); bool holo = HasBeenKilled && KillReappearDelay <= 0; bool leaving = HasBeenKilled && DefeatTimer > DelayBeforeDefeatStandup + TalkDelay * 8f + 200f; - Texture2D texture = HasBeenKilled && KillReappearDelay <= 0f ? HoloTexture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = HasBeenKilled && KillReappearDelay <= 0f ? HoloTexture.Value : TextureAssets.Npc[Type].Value; Texture2D glowmask = Texture_Glow.Value; Texture2D projector = ProjectorTexture.Value; Texture2D projectorglow = ProjectorTexture_Glow.Value; @@ -878,7 +871,7 @@ namespace CalamityMod.NPCs.ExoMechs GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseOpacity(MathHelper.Clamp(1f - HologramEffectTimer / HologramFadeinTime, 0f, 1f) * 0.38f); GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseSecondaryColor(color); GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseSaturation(color.A / 255f); - GameShaders.Misc["CalamityMod:TeleportDisplacement"].Shader.Parameters["frameCount"].SetValue(new Vector2(16f, Main.npcFrameCount[NPC.type])); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].Shader.Parameters["frameCount"].SetValue(new Vector2(16f, Main.npcFrameCount[Type])); GameShaders.Misc["CalamityMod:TeleportDisplacement"].Apply(); } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 405ba2e894..b34e664e92 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -17,21 +17,19 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [LongDistanceNetSync(SyncWith = typeof(ThanatosHead))] public class ThanatosBody1 : ModNPC { public static int normalIconIndex; public static int vulnerableIconIndex; - internal static void LoadHeadIcons() + public override void Load() { string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalBody"; string vulnerableIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody"; - - CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); - normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); - - CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); - vulnerableIconIndex = ModContent.GetModBossHeadSlot(vulnerableIconPath); + + normalIconIndex = CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + vulnerableIconIndex = CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); } // Whether the body is venting heat or not, it is vulnerable to damage during venting @@ -56,7 +54,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -444,7 +442,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - NPC.Calamity().DR = vulnerable ? 0f : 0.9999f; + NPC.Calamity().DR = vulnerable ? 0.15f : 0.9999f; NPC.Calamity().unbreakableDR = !vulnerable; // Vent noise and steam @@ -595,7 +593,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - int finalFrame = Main.npcFrameCount[NPC.type] - 1; + int finalFrame = Main.npcFrameCount[Type] - 1; if (NPC.frame.Y > frameHeight * finalFrame) NPC.frame.Y = frameHeight * finalFrame; } @@ -613,20 +611,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 center = NPC.Center - screenPos; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); texture = GlowTexture.Value; - spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); SmokeDrawer.DrawSet(NPC.Center); @@ -683,7 +677,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosBody1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosBody1_2").Type, 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 4b170b5933..51fbaba5ae 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -17,21 +17,19 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [LongDistanceNetSync(SyncWith = typeof(ThanatosHead))] public class ThanatosBody2 : ModNPC { public static int normalIconIndex; public static int vulnerableIconIndex; - internal static void LoadHeadIcons() + public override void Load() { string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalBody2"; string vulnerableIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody2"; - - CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); - normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); - - CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); - vulnerableIconIndex = ModContent.GetModBossHeadSlot(vulnerableIconPath); + + normalIconIndex = CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + vulnerableIconIndex = CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); } // Whether the body is venting heat or not, it is vulnerable to damage during venting @@ -55,7 +53,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -443,7 +441,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - NPC.Calamity().DR = vulnerable ? 0f : 0.9999f; + NPC.Calamity().DR = vulnerable ? 0.15f : 0.9999f; NPC.Calamity().unbreakableDR = !vulnerable; // Vent noise and steam @@ -598,7 +596,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - int finalFrame = Main.npcFrameCount[NPC.type] - 1; + int finalFrame = Main.npcFrameCount[Type] - 1; if (NPC.frame.Y > frameHeight * finalFrame) NPC.frame.Y = frameHeight * finalFrame; } @@ -616,20 +614,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 center = NPC.Center - screenPos; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); texture = GlowTexture.Value; - spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); SmokeDrawer.DrawSet(NPC.Center); @@ -688,7 +682,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosBody2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosBody2_2").Type, 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 528554af27..7b418c793b 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -22,6 +22,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [LongDistanceNetSync] public class ThanatosHead : ModNPC { public static int normalIconIndex; @@ -46,16 +47,13 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public static Asset ReticleTopTexture; public static Asset ReticleBottomTexture; - internal static void LoadHeadIcons() + public override void Load() { string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalHead"; string vulnerableIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosVulnerableHead"; - - CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); - normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); - - CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); - vulnerableIconIndex = ModContent.GetModBossHeadSlot(vulnerableIconPath); + + normalIconIndex = CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + vulnerableIconIndex = CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); } public enum Phase @@ -134,16 +132,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; // Ensure that the reticle is not culled due to the player being very far from Thanatos. - NPCID.Sets.MustAlwaysDraw[NPC.type] = true; + NPCID.Sets.MustAlwaysDraw[Type] = true; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.65f, PortraitScale = 0.6f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/Thanatos_Bestiary", PortraitPositionXOverride = 40 }; value.Position.X += 52f; @@ -177,7 +174,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(15, 0, 0, 0); + NPC.value = Item.buyPrice(1, 0, 0, 0); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -674,8 +671,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Do nothing while immune AIState = (float)Phase.UndergroundLaserBarrage; - // Enter the fight again if any of the other exo mechs is below 70% and other mechs aren't berserk - if ((exoPrimeLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk) + // Enter the fight again if any of the other exo mechs is below 70% or dead and other mechs aren't berserk + // CIT 10FEB2025: Added checks for if the other mechs are alive, to fix softlocks if you somehow skip straight to berserk + if ((!exoPrimeAlive || exoPrimeLifeRatio < 0.7f || !exoTwinsAlive || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk) { // Tells Thanatos to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed @@ -840,7 +838,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // If close enough to the target, prepare to fire deathray float slowDownDistance = GetSlowdownAreaEdgeRadius(lastMechAlive); bool readyToFireDeathray = distanceFromTarget < slowDownDistance; - if (readyToFireDeathray) + if (readyToFireDeathray && NPC.localAI[2] == 0f) NPC.localAI[2] = 1f; // Use a lerp to smoothly scale up velocity and turn speed @@ -869,7 +867,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos turnDistance = chargeLocationDistance; // Gradually turn and move slower if within 50 tiles of the target - if (NPC.localAI[2] == 1f) + if (NPC.localAI[2] >= 1f) { // Exponentially scale down velocity if close to the target float velocityScale = distanceFromTarget / slowDownDistance; @@ -879,6 +877,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos baseVelocity *= velocityScale; turnSpeed *= velocityScale; + // Increment localAI[2], this is used as a timer to control the pulsing of the telegraph + float pulseIncrement = 1f / 60f * (distanceFromTarget < slowDownDistance * 0.5f ? 0.75f : 1.5f); + NPC.localAI[2] += pulseIncrement; + calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { @@ -886,7 +888,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (calamityGlobalNPC.newAI[2] == 1f) { //Commented out in case we decide its better for it to simply play from anywhere in range - //if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + //if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) LaserSoundSlot = SoundEngine.PlaySound(LaserSound, NPC.Center); // Create a bunch of lightning bolts in the sky @@ -961,7 +963,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - NPC.Calamity().DR = vulnerable ? 0f : 0.9999f; + NPC.Calamity().DR = vulnerable ? 0.15f : 0.9999f; NPC.Calamity().unbreakableDR = !vulnerable; // Vent noise and steam @@ -1097,7 +1099,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - int finalFrame = Main.npcFrameCount[NPC.type] - 1; + int finalFrame = Main.npcFrameCount[Type] - 1; if (NPC.frame.Y >= frameHeight * finalFrame) NPC.frame.Y = frameHeight * finalFrame; } @@ -1108,22 +1110,44 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.IsABestiaryIconDummy) NPC.Opacity = 1f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + // Reimplementation of CalamityUtils.DrawAnimatedBestiaryWorm but tweaked due to Thanatos' animations + if (NPC.IsABestiaryIconDummy) + { + NPC.frame = texture.Frame(); + // Buffers the segment position and rotations + float offset = -0.2f; + float startX = 60; + float startY = 70; + int segmentSpacing = 40; + int animationSpeed = 5; + float wormTimer = NPC.Calamity().bestiaryWormTimer; + // Draw the body segments + for (int i = 3; i > 0; i--) + { + // The first segment is slightly closer to keep up with the head + float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; + + Texture2D toUse = i % 2 == 1 ? TextureAssets.Npc[ModContent.NPCType()].Value : TextureAssets.Npc[ModContent.NPCType()].Value; + spriteBatch.Draw(toUse, NPC.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * 2 + startY), toUse.Frame(1, 5, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(toUse.Width / 2, toUse.Width / 10), NPC.scale, SpriteEffects.None, 0f); + } + // Draw the head + spriteBatch.Draw(texture, NPC.position + new Vector2(startX + 24, MathF.Sin(wormTimer * animationSpeed) * 2 + startY), texture.Frame(1, 5, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(texture.Width * 0.5f, texture.Height / 5), NPC.scale, SpriteEffects.None, 0f); + + return false; + } Vector2 center = NPC.Center - screenPos; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, SpriteEffects.None, 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); + spriteBatch.Draw(texture, center, NPC.frame, glowmaskColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); SmokeDrawer.DrawSet(NPC.Center); @@ -1136,8 +1160,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // A large, faded circle. Is rescaled to fit the radius of the slowdown area. Texture2D auraTexture = AuraTexture.Value; - float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Yes, this is bizarre as fuck. int completelyUseless = 0; int otherExoMechsAlive = CheckForOtherMechs(ref completelyUseless, out _, out _); @@ -1148,14 +1170,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos auraGeneralPower *= Utils.GetLerpValue(deathrayTelegraphDuration + deathrayDuration, deathrayTelegraphDuration + deathrayDuration, NPC.Calamity().newAI[2], true); // Determine the characteristics of the aura. This requires intermediate computations to determine if Thanatos is in its final phase as well as for pulsing. + float lifeRatio = NPC.life / (float)NPC.lifeMax; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; - float pulse = Main.GlobalTimeWrappedHourly * 0.72f % 1f; + bool isCloseEnough = Vector2.Distance(NPC.Center, Main.player[NPC.target].Center) < GetSlowdownAreaEdgeRadius(lastMechAlive) * 0.5f; + + float pulse = NPC.localAI[2] % 1f; float auraRadius = GetSlowdownAreaEdgeRadius(lastMechAlive) * auraGeneralPower * 1.25f; Vector2 outerAuraScale = Vector2.One * auraRadius / auraTexture.Size(); - Vector2 innerAuraScale = outerAuraScale * pulse * 1.2f; - Color outerAuraColor = Color.White * auraGeneralPower * 0.6f; - Color innerAuraColor = outerAuraColor * (float)Math.Sqrt(1f - pulse); + Vector2 innerAuraScale = outerAuraScale * (1 - pulse) * 1.2f; + Color outerAuraColor = Color.White * auraGeneralPower * 0.65f; + Color innerAuraColor = (isCloseEnough ? outerAuraColor : Color.Red * auraGeneralPower * 0.65f) * (float)Math.Sqrt(pulse); // Draw the aura. spriteBatch.Draw(auraTexture, center, null, outerAuraColor, 0f, auraTexture.Size() * 0.5f, outerAuraScale, SpriteEffects.None, 0f); @@ -1311,7 +1336,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosHead").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosHead2").Type, 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index d2007749ad..e3758fb789 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -17,21 +17,19 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [LongDistanceNetSync(SyncWith = typeof(ThanatosHead))] public class ThanatosTail : ModNPC { public static int normalIconIndex; public static int vulnerableIconIndex; - internal static void LoadHeadIcons() + public override void Load() { string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalTail"; string vulnerableIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosVulnerableTail"; - - CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); - normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); - - CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); - vulnerableIconIndex = ModContent.GetModBossHeadSlot(vulnerableIconPath); + + normalIconIndex = CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + vulnerableIconIndex = CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); } // Whether the tail is venting heat or not, it is vulnerable to damage during venting @@ -55,7 +53,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -443,7 +441,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - NPC.Calamity().DR = vulnerable ? 0f : 0.9999f; + NPC.Calamity().DR = vulnerable ? 0.15f : 0.9999f; NPC.Calamity().unbreakableDR = !vulnerable; // Vent noise and steam @@ -596,7 +594,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.frame.Y += frameHeight; NPC.frameCounter = 0D; } - int finalFrame = Main.npcFrameCount[NPC.type] - 1; + int finalFrame = Main.npcFrameCount[Type] - 1; if (NPC.frame.Y > frameHeight * finalFrame) NPC.frame.Y = frameHeight * finalFrame; } @@ -614,20 +612,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 center = NPC.Center - screenPos; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); texture = GlowTexture.Value; - spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); SmokeDrawer.DrawSet(NPC.Center); @@ -686,7 +680,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosTail").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosTail2").Type, 1f); diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 3d1673db94..008c2637d5 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; @@ -29,7 +30,7 @@ namespace CalamityMod.NPCs.GreatSandShark public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; + Main.npcFrameCount[Type] = 8; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -57,8 +58,8 @@ namespace CalamityMod.NPCs.GreatSandShark AIType = -1; NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 5, 0, 0); - NPCID.Sets.TrailCacheLength[NPC.type] = 8; - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailCacheLength[Type] = 8; + NPCID.Sets.TrailingMode[Type] = 1; NPC.behindTiles = true; NPC.netAlways = true; NPC.DeathSound = DeathSound; @@ -118,7 +119,7 @@ namespace CalamityMod.NPCs.GreatSandShark if (!Terraria.GameContent.Events.Sandstorm.Happening) { - CalamityUtils.StartSandstorm(); + CalamityWorld.StartSandstorm(); CalamityNetcode.SyncWorld(); } @@ -582,7 +583,7 @@ namespace CalamityMod.NPCs.GreatSandShark NPC.spriteDirection = -NPC.direction; } NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -601,15 +602,15 @@ namespace CalamityMod.NPCs.GreatSandShark mainAfterimageColor = Color.Silver; extraAfterimageColor = Color.Orange; } - Texture2D texture2D3 = TextureAssets.Npc[NPC.type].Value; - int currentFrame = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; + Texture2D texture2D3 = TextureAssets.Npc[Type].Value; + int currentFrame = TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]; int y3 = currentFrame * (int)NPC.frameCounter; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, currentFrame); Vector2 halfRectSize = rectangle.Size() / 2f; int eightConst = 8; int afterimageInc = 2; int afterimageCounter = 1; - while (((afterimageInc > 0 && afterimageCounter < eightConst) || (afterimageInc < 0 && afterimageCounter > eightConst)) && CalamityConfig.Instance.Afterimages) + while (((afterimageInc > 0 && afterimageCounter < eightConst) || (afterimageInc < 0 && afterimageCounter > eightConst)) && CalamityClientConfig.Instance.Afterimages) { Color alphaAfterimageColor = NPC.GetAlpha(extraAfterimageColor); { @@ -624,7 +625,7 @@ IL_6899: { afterimagesRemaining = (float)(1 - afterimageCounter); } - alphaAfterimageColor *= afterimagesRemaining / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f); + alphaAfterimageColor *= afterimagesRemaining / ((float)NPCID.Sets.TrailCacheLength[Type] * 1.5f); Vector2 afterimagePos = NPC.oldPos[afterimageCounter]; float afterimageRotation = NPC.rotation; Main.spriteBatch.Draw(texture2D3, afterimagePos + NPC.Size / 2f - screenPos + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaAfterimageColor, afterimageRotation + NPC.rotation * 0f * (float)(afterimageCounter - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), halfRectSize, NPC.scale, spriteEffects, 0f); @@ -676,9 +677,6 @@ IL_6899: { npcLoot.Add(ItemID.AncientBattleArmorMaterial); - // Great Sand Shark drops the Desert Key - npcLoot.Add(ItemID.DungeonDesertKey, 3); - // 1 Grand Scale guaranteed; on Expert, 33% chance of getting a second one npcLoot.Add(ModContent.ItemType()); npcLoot.AddIf(() => Main.expertMode, ModContent.ItemType(), 3); @@ -709,7 +707,7 @@ IL_6899: public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Bleeding, 600, true); + target.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 0d568035bc..758f6cac73 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -13,11 +13,6 @@ namespace CalamityMod.NPCs.HiveMind { public class DankCreeper : ModNPC { - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; @@ -51,6 +46,16 @@ namespace CalamityMod.NPCs.HiveMind CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCorruption, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DankCreeper") + }); + } + public override void AI() { // Avoid cheap bullshit @@ -134,7 +139,7 @@ namespace CalamityMod.NPCs.HiveMind for (int k = 0; k < 20; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Glass, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DankCreeperGore").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DankCreeperGore2").Type, 1f); diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 9b25762cb0..9d4e8db3e6 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -14,9 +14,8 @@ namespace CalamityMod.NPCs.HiveMind { public override void SetStaticDefaults() { - this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.NeedsExpertScaling[Type] = true; + Main.npcFrameCount[Type] = 4; NPCID.Sets.BossBestiaryPriority.Add(Type); } @@ -44,10 +43,20 @@ namespace CalamityMod.NPCs.HiveMind NPC.Calamity().VulnerableToSickness = true; } + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCorruption, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DarkHeart") + }); + } + public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -85,25 +94,18 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.velocity.Y > 0f) NPC.velocity.Y *= deceleration; - NPC.velocity.Y -= acceleration; - - if (NPC.velocity.Y > velocity) - NPC.velocity.Y = velocity; + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y - acceleration, -velocity * 1.5f, velocity); } else if (NPC.position.Y < Main.player[NPC.target].position.Y - 450f) { if (NPC.velocity.Y < 0f) NPC.velocity.Y *= deceleration; - NPC.velocity.Y += acceleration; - - if (NPC.velocity.Y < -velocity) - NPC.velocity.Y = -velocity; + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + acceleration, -velocity, velocity * 1.5f); } bool dropRain = NPC.Bottom.Y < Main.player[NPC.target].position.Y - 300f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height); float distanceX = masterMode ? 200f : 400f; - float velocityX = velocity * 1.5f; if (NPC.Center.X > Main.player[NPC.target].Center.X + distanceX) { dropRain = false; @@ -111,10 +113,7 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.velocity.X > 0f) NPC.velocity.X *= deceleration; - NPC.velocity.X -= acceleration; - - if (NPC.velocity.X > velocityX) - NPC.velocity.X = velocityX; + NPC.velocity.X = MathHelper.Clamp(NPC.velocity.X - acceleration, -velocity * 1.5f, velocity); } if (NPC.Center.X < Main.player[NPC.target].Center.X - distanceX) { @@ -123,16 +122,13 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.velocity.X < 0f) NPC.velocity.X *= deceleration; - NPC.velocity.X += acceleration; - - if (NPC.velocity.X < -velocityX) - NPC.velocity.X = -velocityX; + NPC.velocity.X = MathHelper.Clamp(NPC.velocity.X + acceleration, -velocity, velocity * 1.5f); } if (dropRain && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] += 1f; - float rainDropRate = Main.getGoodWorld ? 8f : death ? 16f : revenge ? 20f : 24f; + float rainDropRate = Main.getGoodWorld ? 10f : death ? 20f : revenge ? 25f : 30f; if (NPC.ai[0] >= rainDropRate) { NPC.ai[0] = 0f; diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 5842cc6796..195befe9ea 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -20,8 +20,7 @@ namespace CalamityMod.NPCs.HiveMind public override void SetStaticDefaults() { - this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; } public override void SetDefaults() @@ -50,6 +49,16 @@ namespace CalamityMod.NPCs.HiveMind NPC.Calamity().VulnerableToSickness = true; } + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCorruption, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HiveBlob") + }); + } + public override void AI() { bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; @@ -210,8 +219,8 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 vector2 = NPC.Center - screenPos; vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index dd63f62274..0587b8edb2 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.HiveMind public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; } public override void SetDefaults() @@ -213,8 +213,8 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 vector2 = NPC.Center - screenPos; vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 19bd36f3e3..d8dcab9b15 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -16,13 +16,13 @@ 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 ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -44,16 +44,13 @@ namespace CalamityMod.NPCs.HiveMind public static int normalIconIndex; public static int phase2IconIndex; - internal static void LoadHeadIcons() + public override void Load() { string normalIconPath = "CalamityMod/NPCs/HiveMind/HiveMind_Head_Boss"; string phase2IconPath = "CalamityMod/NPCs/HiveMind/HiveMindP2_Head_Boss"; - - CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); - normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); - - CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); - phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + + normalIconIndex = CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); } // This block of values can be modified in SetDefaults() based on difficulty mode or something @@ -81,22 +78,43 @@ namespace CalamityMod.NPCs.HiveMind private int nextState = 0; private int reelCount = 0; private Vector2 deceleration; + private int frameX = 0; private int frameY = 0; - private const int maxFramesX_Phase2 = 2; - private const int maxFramesY_Phase2 = 8; - private const int height_Phase2 = 142; + private int frameWidth = 0; + private int frameHeight = 0; + private int maxFrameX = 0; + private int maxFrameY = 0; + + private bool IsPhaseTwo => (NPC.life / (float)NPC.lifeMax) < 0.8f; public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoar"); public static readonly SoundStyle FastRoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoarFast"); public static Asset Phase2Texture; + // Do not directly use those value in AI + // Those value should only be used on FindFrame + // Commented out variables are what you suppose to use commonly: + // - NPC.height, NPC.width, NPC.frame + // - frameX, frameY, frameWidth, frameHeight, maxFrameX, maxFrameY + private const int framesX_P1 = 1; + private const int framesY_P1 = 16; + + private const int framesX_P2 = 2; + private const int framesY_P2 = 8; + + private const int frameWidth_P1 = 178; + private const int frameHeight_P1 = 122; + + private const int frameWidth_P2 = 178; + private const int frameHeight_P2 = 142; + // + 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.TrailingMode[Type] = 1; + NPCID.Sets.TrailCacheLength[Type] = NPC.oldPos.Length; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -117,14 +135,18 @@ namespace CalamityMod.NPCs.HiveMind NPC.Calamity().canBreakPlayerDefense = true; NPC.npcSlots = 5f; NPC.GetNPCDamage(); - NPC.width = 178; - NPC.height = 122; + + // this is the only allowed case for using constant directly + // as it doesn't have proper frame info yet + NPC.width = frameWidth_P1; + NPC.height = frameHeight_P1; + NPC.defense = 8; NPC.LifeMaxNERB(7700, 9200, 350000); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 15, 0, 0); + NPC.value = Item.buyPrice(0, 8, 0, 0); NPC.boss = true; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; @@ -213,10 +235,7 @@ namespace CalamityMod.NPCs.HiveMind public override void BossHeadSlot(ref int index) { - if (NPC.life / (float)NPC.lifeMax < 0.8f) - index = phase2IconIndex; - else - index = normalIconIndex; + index = IsPhaseTwo ? phase2IconIndex : normalIconIndex; } public override void SendExtraAI(BinaryWriter writer) @@ -237,8 +256,6 @@ namespace CalamityMod.NPCs.HiveMind writer.Write(rotation); writer.Write(previousState); writer.Write(reelCount); - writer.Write(frameX); - writer.Write(frameY); } public override void ReceiveExtraAI(BinaryReader reader) @@ -259,85 +276,78 @@ namespace CalamityMod.NPCs.HiveMind rotation = reader.ReadDouble(); previousState = reader.ReadInt32(); reelCount = reader.ReadInt32(); - frameX = reader.ReadInt32(); - frameY = reader.ReadInt32(); } - public override void FindFrame(int frameHeight) + public override void FindFrame(int _) { - // When Hive Mind starts flying around - bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; + maxFrameX = framesX_P1; + maxFrameY = framesY_P1; + frameWidth = frameWidth_P1; + frameHeight = frameHeight_P1; - if (phase2) + if (IsPhaseTwo) { - if (frameY >= maxFramesY_Phase2) - frameY = 0; + maxFrameX = framesX_P2; + maxFrameY = framesY_P2; + frameWidth = frameWidth_P2; + frameHeight = frameHeight_P2; + } - NPC.frameCounter++; - if (NPC.frameCounter >= 6D) + // Update NPC Size accordingly + NPC.width = frameWidth; + NPC.height = frameHeight - 2; //Phase 1 Sprite have 2 pixel margin + + NPC.frameCounter += 1.0; // Update each 6 ticks + if (NPC.frameCounter >= 6.0) + { + NPC.frameCounter = 0.0; // Reset the counter + + // Increment Y frame + frameY++; + frameY %= maxFrameY; + + if (frameY == 0) // When reached start of Y -> Increment X { - // Reset frame counter - NPC.frameCounter = 0D; - - // Increment the Y frame - frameY++; - - // Reset the Y frame if greater than 8 - if (frameY == maxFramesY_Phase2) - { - frameX++; - frameY = 0; - } - - // Reset the frames to frame 0 - if ((frameX * maxFramesY_Phase2) + frameY > 15) - frameX = frameY = 0; + // Increment X frame + frameX++; + frameX %= maxFrameX; } } - else - { - NPC.frameCounter += 1f / 6f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - } + + NPC.frame = new Rectangle(frameWidth * frameX, frameHeight * frameY, NPC.width, NPC.height); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - // When Hive Mind starts flying around - bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; + if (Main.dedServ) + return true; - if (phase2) + Texture2D texture = IsPhaseTwo ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; + SpriteEffects spriteEffects = NPC.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 origin = new Vector2(NPC.width / 2, NPC.height); + Vector2 center = NPC.position - screenPos + origin; + + // AfterImage Effect for Phase Two + if (CalamityClientConfig.Instance.Afterimages && state != 0 && IsPhaseTwo) { - SpriteEffects spriteEffects = NPC.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Phase2Texture.Value; - Vector2 vector = new Vector2(NPC.width / 2, height_Phase2 / 2); Color afterimageBaseColor = Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages && state != 0) + for (int i = 1; i < numAfterimages; i += 2) { - for (int i = 1; i < numAfterimages; i += 2) - { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, height_Phase2) / 2f - screenPos; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX_Phase2, maxFramesY_Phase2) * NPC.scale / 2f; - afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, new Rectangle(NPC.width * frameX, height_Phase2 * frameY, NPC.width, height_Phase2), afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); - } + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFrameX, maxFrameY) * NPC.scale / 2f; + afterimageCenter += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], origin, NPC.scale, spriteEffects, 0f); } - - Vector2 center = NPC.Center - screenPos; - spriteBatch.Draw(texture, center, new Rectangle(NPC.width * frameX, height_Phase2 * frameY, NPC.width, height_Phase2), NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - - return false; } - return true; + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + return false; } private void SpawnStuff() @@ -376,12 +386,12 @@ namespace CalamityMod.NPCs.HiveMind while (NPC.AnyNPCs(type) && choice < 5); if (choice < 5) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + Main.rand.Next(NPC.width), (int)NPC.position.Y + Main.rand.Next(height_Phase2), type); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + Main.rand.Next(NPC.width), (int)NPC.position.Y + Main.rand.Next(NPC.height), type); } // Spawn a Hive Cyst if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + Main.rand.Next(NPC.width), (int)NPC.position.Y + Main.rand.Next(height_Phase2), ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + Main.rand.Next(NPC.width), (int)NPC.position.Y + Main.rand.Next(NPC.height), ModContent.NPCType()); } private void ReelBack() @@ -401,7 +411,10 @@ namespace CalamityMod.NPCs.HiveMind else { if (Main.netMode != NetmodeID.MultiplayerClient) - SpawnStuff(); + { + if (NPC.Distance(Main.player[NPC.target].Center) > 80f) + SpawnStuff(); + } state = nextState; nextState = 0; @@ -411,6 +424,7 @@ namespace CalamityMod.NPCs.HiveMind else SoundEngine.PlaySound(FastRoarSound, NPC.Center); } + NPC.netUpdate = true; } public override void AI() @@ -453,28 +467,24 @@ namespace CalamityMod.NPCs.HiveMind enrageScale += 1f; } - // When Hive Mind starts flying around - bool phase2 = lifeRatio < 0.8f; - // Phase 2 settings - if (phase2) + if (IsPhaseTwo) { // Spawn gores, play sound and reset every crucial variable at the start if (NPC.localAI[1] == 0f) { NPC.localAI[1] = 1f; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreAmount = 7; for (int i = 1; i <= goreAmount; i++) - Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("HiveMindGore" + i).Type, 1f); + Gore.NewGore(NPC.GetSource_FromAI(), NPC.Center, NPC.velocity, Mod.Find("HiveMindGore" + i).Type, 1f); } SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.Center); NPC.position = NPC.Center; - NPC.height = height_Phase2; NPC.position -= NPC.Size * 0.5f; NPC.noGravity = true; @@ -483,8 +493,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.alpha = 0; NPC.dontTakeDamage = false; NPC.damage = 0; - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } } else @@ -595,7 +604,7 @@ namespace CalamityMod.NPCs.HiveMind int fivePercentMinions = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type); Main.npc[fivePercentMinions].SetDefaults(type); - if (Main.netMode == NetmodeID.Server && fivePercentMinions < Main.maxNPCs) + if (Main.dedServ && fivePercentMinions < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, fivePercentMinions); } @@ -674,8 +683,7 @@ namespace CalamityMod.NPCs.HiveMind } } } - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else if (burrowTimer < 0) { @@ -743,7 +751,7 @@ namespace CalamityMod.NPCs.HiveMind if (nextState == 0) { NPC.TargetClosest(); - if (revenge && lifeRatio < 0.53f) + if (revenge && lifeRatio < 0.5f) { if (death) { @@ -752,7 +760,7 @@ namespace CalamityMod.NPCs.HiveMind while (nextState == previousState); previousState = nextState; } - else if (lifeRatio < 0.27f) + else if (lifeRatio < 0.25f) { do nextState = Main.rand.Next(3, 6); @@ -793,8 +801,7 @@ namespace CalamityMod.NPCs.HiveMind if (nextState == 3) rotation = MathHelper.ToRadians(Main.rand.Next(360)); - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 8000f) @@ -850,8 +857,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.velocity *= 2f / 255f * (reelbackFade + 2 * (int)enrageScale); ReelBack(); - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else { @@ -881,12 +887,11 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[1] != 0f && NPC.ai[2] != 0f) { NPC.position.X = NPC.ai[1] * 16 - NPC.width / 2; - NPC.position.Y = NPC.ai[2] * 16 - height_Phase2 / 2; + NPC.position.Y = NPC.ai[2] * 16 - NPC.height / 2; } phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else if (NPC.ai[1] == 0f && NPC.ai[2] == 0f) { @@ -898,8 +903,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.ai[1] = posX; NPC.ai[2] = posY; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); break; } } @@ -945,8 +949,7 @@ namespace CalamityMod.NPCs.HiveMind // Avoid cheap bullshit NPC.damage = 0; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); if (NPC.alpha > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -984,6 +987,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.velocity *= teleportRadius / (lungeTime - (int)enrageScale); dashStarted = true; SoundEngine.PlaySound(RoarSound, NPC.Center); + NPC.netUpdate = true; } else { @@ -1038,8 +1042,7 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.alpha < 0) NPC.alpha = 0; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else { @@ -1052,8 +1055,7 @@ namespace CalamityMod.NPCs.HiveMind SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.velocity.X = MathHelper.Pi * teleportRadius / arcTime; NPC.velocity *= rotationDirection; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else { @@ -1069,20 +1071,18 @@ namespace CalamityMod.NPCs.HiveMind NPC.ai[0] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient && Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height)) { - if (NPC.ai[0] == 2f || (NPC.ai[0] == 4f && death)) - { - int maxHearts = revenge ? 2 : 1; - if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < maxHearts) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); - } - else if (!NPC.AnyNPCs(NPCID.EaterofSouls)) + int maxEaters = revenge ? 3 : 2; + if (NPC.CountNPCS(NPCID.EaterofSouls) < maxEaters && NPC.Distance(Main.player[NPC.target].Center) > 80f) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.EaterofSouls); } if (NPC.ai[0] == 6f) { NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); - SpawnStuff(); + + if (NPC.Distance(Main.player[NPC.target].Center) > 80f) + SpawnStuff(); + state = 6; NPC.ai[0] = 0f; deceleration = NPC.velocity / decelerationTime; @@ -1111,8 +1111,7 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.alpha < 0) NPC.alpha = 0; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else { @@ -1125,8 +1124,7 @@ namespace CalamityMod.NPCs.HiveMind SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.velocity.X = teleportRadius / arcTime * 3; NPC.velocity *= -rotationDirection; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } else { @@ -1142,7 +1140,7 @@ namespace CalamityMod.NPCs.HiveMind { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 cloudSpawnPos = new Vector2(NPC.position.X + Main.rand.Next(NPC.width), NPC.position.Y + Main.rand.Next(height_Phase2)); + Vector2 cloudSpawnPos = new Vector2(NPC.position.X + Main.rand.Next(NPC.width), NPC.position.Y + Main.rand.Next(NPC.height)); Vector2 randomVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.rand.NextVector2CircularEdge(4f, 4f) : Vector2.Zero; Projectile.NewProjectile(NPC.GetSource_FromAI(), cloudSpawnPos, randomVelocity, type, damage, 0, Main.myPlayer, 11f); } @@ -1170,12 +1168,60 @@ namespace CalamityMod.NPCs.HiveMind { phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); state = 0; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } break; } + + // Dark Heart spawns in phase 2 + if (NPC.life > 0 && expertMode && lifeRatio < 0.5f) + { + if (NPC.ai[3] > NPC.lifeMax * 0.6f) + NPC.ai[3] = NPC.lifeMax * 0.6f; + + int tenPercentHP = (int)(NPC.lifeMax * 0.1); + if ((NPC.life + tenPercentHP) < NPC.ai[3]) + { + NPC.ai[3] = NPC.life; + + int maxDarkHearts = ((revenge && lifeRatio < 0.25f) || death) ? 2 : 1; + if (NPC.CountNPCS(ModContent.NPCType()) < maxDarkHearts) + { + SoundEngine.PlaySound(SoundID.NPCDeath22, NPC.Center); + + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 35; j++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32)); + int type = ModContent.NPCType(); + int tenPercentMinions = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type); + Main.npc[tenPercentMinions].SetDefaults(type); + if (Main.dedServ && tenPercentMinions < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, tenPercentMinions); + } + } + } + } } public override bool CanHitNPC(NPC target) => NPC.alpha == 0; // Can only be hit while fully visible @@ -1217,8 +1263,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.velocity *= -4f; ReelBack(); - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } } @@ -1230,13 +1275,10 @@ namespace CalamityMod.NPCs.HiveMind public override void HitEffect(NPC.HitInfo hit) { - // When Hive Mind starts flying around - bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; - for (int k = 0; k < hit.Damage / NPC.lifeMax * 100.0; k++) - Dust.NewDust(NPC.position, NPC.width, phase2 ? height_Phase2 : NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); - if (!phase2) + if (!IsPhaseTwo && NPC.Distance(Main.player[NPC.target].Center) > 80f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1256,22 +1298,22 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreAmount = 10; for (int i = 1; i <= goreAmount; i++) - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HiveMindP2Gore" + i).Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("HiveMindP2Gore" + i).Type, 1f); } NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (height_Phase2 / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); NPC.width = 200; NPC.height = 150; NPC.position.X = NPC.position.X - (NPC.width / 2); - NPC.position.Y = NPC.position.Y - (height_Phase2 / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) { - int killDust = Dust.NewDust(NPC.position, NPC.width, height_Phase2, DustID.Demonite, 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()) { @@ -1281,10 +1323,10 @@ namespace CalamityMod.NPCs.HiveMind } for (int j = 0; j < 70; j++) { - int killDust2 = Dust.NewDust(NPC.position, NPC.width, height_Phase2, DustID.Demonite, 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(NPC.position, NPC.width, height_Phase2, DustID.Demonite, 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; } } @@ -1332,7 +1374,7 @@ namespace CalamityMod.NPCs.HiveMind ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), + ModContent.ItemType(), })); // Materials diff --git a/NPCs/HiveMind/HiveTumor.cs b/NPCs/HiveMind/HiveTumor.cs index 0aec6bbfe8..8a3269a23c 100644 --- a/NPCs/HiveMind/HiveTumor.cs +++ b/NPCs/HiveMind/HiveTumor.cs @@ -11,7 +11,7 @@ namespace CalamityMod.NPCs.HiveMind { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.CantTakeLunchMoney[Type] = true; NPCID.Sets.BossBestiaryPriority.Add(Type); } @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.HiveMind public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index f71114cb94..04d468c868 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -28,6 +28,8 @@ namespace CalamityMod.NPCs.Leviathan private bool forceChargeFrames = false; private int frameUsed = 0; public bool HasBegunSummoningLeviathan = false; + private int DrawProjectileTelegraphTimer = 0; + private int LegendaryModeAttackChosen = 0; public static Asset ChargeTexture; public bool WaitingForLeviathan { @@ -44,7 +46,7 @@ namespace CalamityMod.NPCs.Leviathan public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -71,7 +73,7 @@ namespace CalamityMod.NPCs.Leviathan AIType = -1; NPC.boss = true; NPC.BossBar = ModContent.GetInstance(); - NPC.value = Item.buyPrice(0, 60, 0, 0); + NPC.value = Item.buyPrice(0, 12, 50, 0); NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = HitSound; @@ -112,6 +114,7 @@ namespace CalamityMod.NPCs.Leviathan writer.Write(NPC.dontTakeDamage); writer.Write(NPC.Calamity().newAI[0]); writer.Write(HasBegunSummoningLeviathan); + writer.Write(DrawProjectileTelegraphTimer); } public override void ReceiveExtraAI(BinaryReader reader) @@ -126,6 +129,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.dontTakeDamage = reader.ReadBoolean(); NPC.Calamity().newAI[0] = reader.ReadSingle(); HasBegunSummoningLeviathan = reader.ReadBoolean(); + DrawProjectileTelegraphTimer = reader.ReadInt32(); } public override void AI() @@ -162,6 +166,7 @@ namespace CalamityMod.NPCs.Leviathan bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); // Enrage @@ -175,7 +180,7 @@ namespace CalamityMod.NPCs.Leviathan bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - float enrageScale = bossRush ? 0.5f : 0f; + float enrageScale = 0f; if (biomeEnraged) { NPC.Calamity().CurrentlyEnraged = !bossRush; @@ -205,6 +210,8 @@ namespace CalamityMod.NPCs.Leviathan { // Avoid cheap bullshit NPC.damage = 0; + // Remove projectile telegraph + DrawProjectileTelegraphTimer = 0; // Use charging frames. NPC.ai[0] = 3f; @@ -626,89 +633,150 @@ namespace CalamityMod.NPCs.Leviathan NPC.ai[1] += 1f; - float divisor = 140f; - divisor -= (int)(30f * enrageScale); + float attackDivisor = 140f - (int)(30f * enrageScale); + float telegraphOffset = death ? 45f : 60f; if (!leviAlive || phase4) - divisor -= (float)Math.Ceiling(50f * (1f - lifeRatio)); - - bool shootProjectiles = NPC.ai[1] % divisor == 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && shootProjectiles) { - float projectileVelocity = expertMode ? 3f : 2f; - projectileVelocity += enrageScale; - if (!leviAlive || phase4) - projectileVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + attackDivisor -= (float)Math.Ceiling(50f * (1f - lifeRatio)); + telegraphOffset = (float)Math.Ceiling(telegraphOffset * 0.66f); + } - int totalProjectiles = 8; - int projectileDistance = 600; - int type = ModContent.ProjectileType(); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + bool telegraphProjectiles = NPC.ai[1] % attackDivisor == (attackDivisor - telegraphOffset); + bool shootProjectiles = NPC.ai[1] % attackDivisor == 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (telegraphProjectiles) { - float radians = MathHelper.TwoPi / totalProjectiles; - int damage = NPC.GetProjectileDamage(type); - for (int i = 0; i < totalProjectiles; i++) + DrawProjectileTelegraphTimer = (int)telegraphOffset; + // For telegraph projectiles: + // ai[0] holds the index of the targeted player + // ai[1] is used to determine what type of projectile it is a telegraph for + int totalTelegraphs = 8; + float telegraphDist = 500f; + + // In Legendary, the projectiles she fires is randomized + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) { - switch (Main.rand.Next(3)) + LegendaryModeAttackChosen = Main.rand.Next(3); + if (LegendaryModeAttackChosen == 2) + telegraphDist -= 50f; + + for (int i = 0; i < totalTelegraphs; i++) + { + Vector2 spawnVector = player.Center - Vector2.UnitY.RotatedBy(MathHelper.TwoPi / totalTelegraphs * i) * telegraphDist; + int tele = Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, player.whoAmI, LegendaryModeAttackChosen); + Main.projectile[tele].netUpdate = true; + + } + } + else + { + switch ((int)NPC.localAI[3]) + { + case 0: + break; + case 1: + totalTelegraphs = 3; + break; + case 2: + totalTelegraphs = 6; + telegraphDist -= 50f; + break; + } + if ((phase2 && !leviAlive) || phase4) + totalTelegraphs += totalTelegraphs / 2; + + for (int i = 0; i < totalTelegraphs; i++) + { + Vector2 spawnVector = player.Center - Vector2.UnitY.RotatedBy(MathHelper.TwoPi / totalTelegraphs * i) * telegraphDist; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, player.whoAmI, NPC.localAI[3]); + + } + } + } + else // Decrement the telegraph counter constantly + { + DrawProjectileTelegraphTimer--; + } + + if (shootProjectiles) + { + float projectileVelocity = expertMode ? 3f : 2f; + projectileVelocity += enrageScale; + if (!leviAlive || phase4) + projectileVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + + int totalProjectiles = 8; + int projectileDistance = 600; + int type = ModContent.ProjectileType(); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + { + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < totalProjectiles; i++) + { + switch (LegendaryModeAttackChosen) + { + case 0: + SoundEngine.PlaySound(SoundID.Item21, player.Center); + break; + + case 1: + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item30, player.Center); + break; + + case 2: + type = ModContent.ProjectileType(); + float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; + Main.musicPitch = soundPitch; + SoundEngine.PlaySound(SoundID.Item26, player.Center); + break; + } + + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -projectileVelocity).RotatedBy(radians * i)) * projectileDistance; + Vector2 projVelocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity; + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, projVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].netUpdate = true; + } + } + else + { + switch ((int)NPC.localAI[3]) { case 0: SoundEngine.PlaySound(SoundID.Item21, player.Center); break; case 1: + totalProjectiles = 3; type = ModContent.ProjectileType(); SoundEngine.PlaySound(SoundID.Item30, player.Center); break; case 2: + totalProjectiles = 6; type = ModContent.ProjectileType(); float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; Main.musicPitch = soundPitch; SoundEngine.PlaySound(SoundID.Item26, player.Center); break; } + NPC.localAI[3] += 1f; + if (NPC.localAI[3] > 2f) + NPC.localAI[3] = 0f; - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -projectileVelocity).RotatedBy(radians * i)) * projectileDistance; - Vector2 projVelocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, projVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].netUpdate = true; - } - } - else - { - switch ((int)NPC.localAI[3]) - { - case 0: - SoundEngine.PlaySound(SoundID.Item21, player.Center); - break; + if ((phase2 && !leviAlive) || phase4) + totalProjectiles += totalProjectiles / 2; - case 1: - totalProjectiles = 3; - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item30, player.Center); - break; - - case 2: - totalProjectiles = 6; - type = ModContent.ProjectileType(); - float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; - Main.musicPitch = soundPitch; - SoundEngine.PlaySound(SoundID.Item26, player.Center); - break; - } - NPC.localAI[3] += 1f; - if (NPC.localAI[3] > 2f) - NPC.localAI[3] = 0f; - - if ((phase2 && !leviAlive) || phase4) - totalProjectiles += totalProjectiles / 2; - - float radians = MathHelper.TwoPi / totalProjectiles; - int damage = NPC.GetProjectileDamage(type); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -projectileVelocity).RotatedBy(radians * i)) * projectileDistance; - Vector2 projVelocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, projVelocity, type, damage, 0f, Main.myPlayer); + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -projectileVelocity).RotatedBy(radians * i)) * projectileDistance; + Vector2 projVelocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, projVelocity, type, damage, 0f, Main.myPlayer); + } } } } @@ -738,6 +806,8 @@ namespace CalamityMod.NPCs.Leviathan { // Avoid cheap bullshit NPC.damage = 0; + // Remove projectile telegraph + DrawProjectileTelegraphTimer = 0; ChargeLocation(player, leviAlive && !phase4, revenge); @@ -889,11 +959,11 @@ namespace CalamityMod.NPCs.Leviathan public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; switch (frameUsed) { case 0: - texture = TextureAssets.Npc[NPC.type].Value; + texture = TextureAssets.Npc[Type].Value; break; case 1: texture = ChargeTexture.Value; @@ -901,12 +971,34 @@ namespace CalamityMod.NPCs.Leviathan } bool charging = NPC.ai[0] > 2f || forceChargeFrames; - int height = texture.Height / Main.npcFrameCount[NPC.type]; + int height = texture.Height / Main.npcFrameCount[Type]; int width = texture.Width; SpriteEffects spriteEffects = charging ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (NPC.spriteDirection == -1) spriteEffects = charging ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Main.spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2((float)width / 2f, (float)height / 2f), NPC.scale, spriteEffects, 0f); + + // Draw colored outline as telegraph for projectile attacks + if (DrawProjectileTelegraphTimer > 0) + { + Color telegraphColor = Color.Black; + switch (CalamityWorld.LegendaryMode && CalamityWorld.revenge ? LegendaryModeAttackChosen : (int)NPC.localAI[3]) + { + case 0: + telegraphColor = new Color(55, 70, 240); + break; + case 1: + telegraphColor = Color.White * 0.9f; + break; + case 2: + telegraphColor = new Color(199, 90, 67); + break; + } + + Lighting.AddLight(NPC.Center, telegraphColor.ToVector3() * 0.75f); + NPC.DrawBackglow(telegraphColor * 0.35f, 9f, spriteEffects, NPC.frame, screenPos, texture); + } + + Main.spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(width / 2f, height / 2f), NPC.scale, spriteEffects, 0f); return false; } @@ -919,11 +1011,11 @@ namespace CalamityMod.NPCs.Leviathan int timeBetweenFrames = 8; NPC.frameCounter++; - if (NPC.frameCounter > timeBetweenFrames * Main.npcFrameCount[NPC.type]) + if (NPC.frameCounter > timeBetweenFrames * Main.npcFrameCount[Type]) NPC.frameCounter = 0; NPC.frame.Y = frameHeight * (int)(NPC.frameCounter / timeBetweenFrames); - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) NPC.frame.Y = 0; //100x1140 diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index e469609631..8a7e1f5543 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Leviathan public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 25; @@ -77,7 +77,7 @@ namespace CalamityMod.NPCs.Leviathan public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/Leviathan/LevSky.cs b/NPCs/Leviathan/LevSky.cs index fbe87825de..6a401591d9 100644 --- a/NPCs/Leviathan/LevSky.cs +++ b/NPCs/Leviathan/LevSky.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Leviathan float x = 0f; if (LevIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[LevIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[LevIndex].Center); } float spawnAnimationTimer = 180f; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index c6ac66eec0..3e991ea360 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.Leviathan public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 3; + Main.npcFrameCount[Type] = 3; NPCID.Sets.BossBestiaryPriority.Add(Type); if (!Main.dedServ) AttackTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanAttack", AssetRequestMode.AsyncLoad); @@ -64,13 +64,13 @@ namespace CalamityMod.NPCs.Leviathan NPC.width = 900; NPC.height = 450; NPC.defense = 40; - NPC.DR_NERD(0.35f); + NPC.DR_NERD(0.3f); NPC.LifeMaxNERB(60000, 72000, 600000); NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; NPC.Opacity = 0f; - NPC.value = Item.buyPrice(0, 60, 0, 0); + NPC.value = Item.buyPrice(0, 12, 50, 0); NPC.HitSound = SoundID.NPCHit56; NPC.DeathSound = SoundID.NPCDeath60; NPC.noTileCollide = true; @@ -595,9 +595,13 @@ namespace CalamityMod.NPCs.Leviathan return; } + // Used to scale lineup speed and acceleration + if (NPC.ai[2] < 300f) + NPC.ai[2]++; + // Velocity calculations - float chargeSpeed = revenge ? 7.5f : 6.5f; - float chargeAcceleration = revenge ? 0.12f : 0.11f; + float chargeSpeed = (revenge ? 7.5f : 6.5f) + (NPC.ai[2] * 0.0083f); + float chargeAcceleration = (revenge ? 0.12f : 0.11f) + (NPC.ai[2] * 0.001f); chargeSpeed += 2f * enrageScale; chargeAcceleration += 0.04f * enrageScale; @@ -643,10 +647,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.direction = playerLocation2 < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - NPC.netUpdate = true; - - if (NPC.netSpam > 10) - NPC.netSpam = 10; + NPC.ForceNetUpdate(false); } else { @@ -695,10 +696,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.TargetClosest(); } - NPC.netUpdate = true; - - if (NPC.netSpam > 10) - NPC.netSpam = 10; + NPC.ForceNetUpdate(false); } } } @@ -801,7 +799,7 @@ namespace CalamityMod.NPCs.Leviathan 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) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("LeviGore").Type, NPC.scale); @@ -831,8 +829,8 @@ namespace CalamityMod.NPCs.Leviathan if (!DownedBossSystem.downedLeviathan) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.player[Main.myPlayer].Center); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.LocalPlayer.Center); CalamityUtils.DisplayLocalizedText(key, messageColor); } @@ -870,7 +868,7 @@ namespace CalamityMod.NPCs.Leviathan ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); @@ -878,7 +876,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(), 10); normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Equipment @@ -916,20 +914,17 @@ namespace CalamityMod.NPCs.Leviathan public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Bleeding, 600, true); + target.AddBuff(ModContent.BuffType(), 180, true); } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D texture = AttackTexture.Value; if (NPC.ai[0] == 1f || NPC.Calamity().newAI[3] < 180f) { - texture = TextureAssets.Npc[NPC.type].Value; + texture = TextureAssets.Npc[Type].Value; } SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; float xOffset = -50f; diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index f53a972388..19205bd748 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.Leviathan public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.CantTakeLunchMoney[Type] = true; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() @@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.Opacity = 1f; NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -124,7 +124,7 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D drawTex = Main.zenithWorld ? TextureAssets.Npc[ModContent.NPCType()].Value : TextureAssets.Npc[NPC.type].Value; + Texture2D drawTex = Main.zenithWorld ? TextureAssets.Npc[ModContent.NPCType()].Value : TextureAssets.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); @@ -135,7 +135,7 @@ namespace CalamityMod.NPCs.Leviathan } else { - drawPos -= new Vector2(drawTex.Width, drawTex.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos -= new Vector2(drawTex.Width, drawTex.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); } Color color = Main.zenithWorld ? Color.Purple : drawColor; diff --git a/NPCs/LongDistanceNetSyncAttribute.cs b/NPCs/LongDistanceNetSyncAttribute.cs new file mode 100644 index 0000000000..b66d997580 --- /dev/null +++ b/NPCs/LongDistanceNetSyncAttribute.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs +{ + /// + /// This attribute allows ModNPC to always sync for their position and rotation data at least every 45 frames + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] + public sealed class LongDistanceNetSyncAttribute : Attribute + { + /// + /// Syncs this NPC to other NPC's sync frame + /// If this is not present, We cannot properly sync full NPC bodyparts in same frame! (This is important for Worm-type NPCs) + /// + public Type SyncWith { get; set; } = null; + + public LongDistanceNetSyncAttribute() + { + + } + } +} diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 45ce3a6124..a72b4648a6 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 6; value.PortraitPositionYOverride = -36f; @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 30; NPC.defense = 6; - NPC.lifeMax = 50; + NPC.lifeMax = 75; NPC.knockBackResist = 0.8f; AnimationType = NPCID.Slimer; NPC.value = Item.buyPrice(0, 0, 1, 0); diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 26296ef13d..a4ea0b9aeb 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { + [LongDistanceNetSync(SyncWith = typeof(ArmoredDiggerHead))] public class ArmoredDiggerBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ArmoredDiggerHead.DisplayName"); @@ -185,7 +186,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerBody").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerBody2").Type, 1f); diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 1fc942cfb8..5f230ad2bb 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -1,18 +1,21 @@ using System; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; 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.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { + [LongDistanceNetSync] public class ArmoredDiggerHead : ModNPC { bool TailSpawned = false; @@ -21,7 +24,6 @@ namespace CalamityMod.NPCs.NormalNPCs { NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/ArmoredDigger_Bestiary", PortraitPositionXOverride = 40, PortraitPositionYOverride = 40 }; @@ -429,6 +431,21 @@ namespace CalamityMod.NPCs.NormalNPCs } } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + Player player = spawnInfo.Player; + bool gfbCondition = Main.zenithWorld && (player.ZoneHallow || player.ZoneUnderworldHeight) && NPC.downedMoonlord; + if ((gfbCondition || (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneJungle)) && !player.ZoneDungeon && !player.Calamity().ZoneSunkenSea && !player.Calamity().ZoneAbyss) + { + if (!CalamityPlayer.areThereAnyDamnBosses && NPC.downedPlantBoss && !NPC.AnyNPCs(ModContent.NPCType())) + { + float spawnRateDivisor = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 125f : CalamityWorld.revenge ? 425f : 500f; + return 1 / spawnRateDivisor; + } + } + return 0f; + } + public override void BossLoot(ref string name, ref int potionType) { potionType = ItemID.GreaterHealingPotion; @@ -451,7 +468,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerHead").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerHead2").Type, 1f); @@ -471,11 +488,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 1, 4, 8); npcLoot.Add(ModContent.ItemType(), 1, 4, 8); - npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 1, 3, 6); - npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 10); + npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 1, 3, 6, ui: false); + npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 10, ui: false); } public override void ModifyTypeName(ref string typeName) @@ -495,5 +511,13 @@ namespace CalamityMod.NPCs.NormalNPCs } else return null; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + { + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, 4, 26, 0.6f, new Vector2(10, -10), 4, 16); + } + return true; + } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 62104f3a10..8aa015ef78 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { + [LongDistanceNetSync(SyncWith = typeof(ArmoredDiggerHead))] public class ArmoredDiggerTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ArmoredDiggerHead.DisplayName"); @@ -140,7 +141,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerTail").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerTail2").Type, 1f); diff --git a/NPCs/NormalNPCs/AuroraSpirit.cs b/NPCs/NormalNPCs/AuroraSpirit.cs index 8052c470be..8c65b93520 100644 --- a/NPCs/NormalNPCs/AuroraSpirit.cs +++ b/NPCs/NormalNPCs/AuroraSpirit.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -12,7 +13,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = -1, @@ -31,12 +32,14 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 24; NPC.defense = 8; NPC.alpha = 100; - NPC.lifeMax = 50; + NPC.lifeMax = 65; NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.knockBackResist = 0f; NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath15; NPC.coldDamage = true; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; @@ -60,9 +63,9 @@ namespace CalamityMod.NPCs.NormalNPCs int currentFrame = 1; if (!Main.dedServ) { - if (TextureAssets.Npc[NPC.type].Value == null) + if (TextureAssets.Npc[Type].Value == null) return; - currentFrame = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; + currentFrame = TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]; } if (!NPC.IsABestiaryIconDummy) @@ -84,7 +87,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.frame.Y += currentFrame; NPC.frameCounter = 0; } - if (NPC.frame.Y / currentFrame >= Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y / currentFrame >= Main.npcFrameCount[Type]) NPC.frame.Y = 0; } @@ -124,7 +127,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.IceRod, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CryoSpirit").Type, 1f); } diff --git a/NPCs/NormalNPCs/BloodlettingServant.cs b/NPCs/NormalNPCs/BloodlettingServant.cs index 7111f3a916..d2b172c462 100644 --- a/NPCs/NormalNPCs/BloodlettingServant.cs +++ b/NPCs/NormalNPCs/BloodlettingServant.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f); + Lighting.AddLight(NPC.Center, 0.3f, 0.3f, 0.3f); NPC.TargetClosest(); Player target = Main.player[NPC.target]; @@ -101,8 +101,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.ai[3] > projectileShootGateValue * 0.5f) NPC.ai[3] = projectileShootGateValue * 0.5f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } if (NPC.ai[1] < ChargeDuration + 1f) @@ -115,8 +114,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.ai[0] = 0f; NPC.ai[1] = 0f; - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } } } @@ -125,12 +123,12 @@ namespace CalamityMod.NPCs.NormalNPCs if (lookAt.X > 0f) { NPC.spriteDirection = 1; - NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); + NPC.rotation = lookAt.ToRotation(); } if (lookAt.X < 0f) { NPC.spriteDirection = -1; - NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X) + MathHelper.Pi; + NPC.rotation = lookAt.ToRotation() + MathHelper.Pi; } } @@ -142,10 +140,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.ai[0] += 1f; if (NPC.ai[0] == ChargeGateValue) - { - NPC.netUpdate = true; - NPC.netSpam = 0; - } + NPC.ForceNetUpdate(); } } else @@ -177,8 +172,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.projectile[proj].timeLeft = 600; } - NPC.netUpdate = true; - NPC.netSpam = 0; + NPC.ForceNetUpdate(); } float pushVelocity = 0.2f * enrageScale; @@ -251,7 +245,7 @@ namespace CalamityMod.NPCs.NormalNPCs { if (NPC.ai[0] >= ChargeTelegraphGateValue) { - Texture2D npcTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D npcTexture = TextureAssets.Npc[Type].Value; Color originalColor = NPC.GetAlpha(drawColor); Color newColor = new Color(192, 0, 0, 255 - NPC.alpha); Vector2 drawPosition = NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY); @@ -264,7 +258,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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) + if (CalamityClientConfig.Instance.Afterimages && NPC.ai[1] > 0f) { int afterimageAmount = 10; int afterImageIncrement = 2; @@ -275,7 +269,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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 -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[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); } @@ -291,6 +285,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(NPC.HitInfo hit) { + if (Main.dedServ) + return; + if (NPC.life > 0) { for (int i = 0; i < hit.Damage / (double)NPC.lifeMax * 100; i++) diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index 881bde1018..bc4f8c9849 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -6,13 +6,14 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class BloomSlime : ModNPC { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; } public override void SetDefaults() @@ -23,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 30; NPC.defense = 25; - NPC.lifeMax = 1000; + NPC.lifeMax = 1500; NPC.knockBackResist = 0.3f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 25, 0); diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index 68c3582f54..a6a4b88510 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.SummonItems; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.NPCs.Other; @@ -22,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 40; NPC.defense = 18; - NPC.lifeMax = 300; + NPC.lifeMax = 375; NPC.knockBackResist = 0.95f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit7; @@ -73,7 +74,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ambient_DarkBrown, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bohldohr").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bohldohr2").Type, 1f); @@ -99,6 +100,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.LihzahrdBrick, 1, 10, 26); + npcLoot.Add(ModContent.ItemType(), 1, 10, 26); npcLoot.Add(ItemID.LunarTabletFragment, 7, 10, 26); npcLoot.Add(ItemID.LihzahrdPowerCell, 50); npcLoot.AddIf(() => DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs && Main.zenithWorld, ModContent.ItemType(), 2, ui: false); diff --git a/NPCs/NormalNPCs/BucketZombie.cs b/NPCs/NormalNPCs/BucketZombie.cs new file mode 100644 index 0000000000..d0b4edf209 --- /dev/null +++ b/NPCs/NormalNPCs/BucketZombie.cs @@ -0,0 +1,124 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Summon; +using CalamityMod.World; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.NormalNPCs +{ + // This is intended to be a new variant for the vanilla Zombie + public class BucketZombie : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 3; + NPCID.Sets.Zombies[Type] = true; + } + + public override void SetDefaults() + { + AIType = NPCID.Zombie; + AnimationType = NPCID.Zombie; + NPC.aiStyle = NPCAIStyleID.Fighter; + NPC.CloneDefaults(NPCID.Zombie); + NPC.lifeMax = 50; + NPC.defense = 15; + NPC.damage = 16; + NPC.knockBackResist = 0.45f; + NPC.value = Item.buyPrice(0, 0, 1, 0); + Banner = NPCID.Zombie; + BannerItem = ItemID.ZombieBanner; + 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 PreAI() + { + if (CalamityWorld.revenge) + { + VanillaNPCAIOverrides.RegularEnemies.RevengeanceAndDeathAI.BuffedFighterAI(NPC, Mod); + return false; + } + return true; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("CommonBestiaryFlavor.Zombie") + }); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldNightMonster.Chance * 0.05f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + 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 < 20; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie4").Type, 1f); + } + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + // Copy over all loot from real Zombies + List zombieRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.Zombie, false); + foreach (var v in zombieRules) + { + npcLoot.Add(v); + } + npcLoot.Add(ItemID.EmptyBucket, 10); + } + + public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) + { + // Takes greatly reduced damage from sentries because thats how it is in Plants versus Zombies + // Pumpoem will be none the wiser + if (projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) + { + modifiers.SourceDamage *= 0.05f; + SoundEngine.PlaySound(SoundID.NPCHit4 with { Pitch = -1, Volume = 0.8f }, NPC.Center); + + // Just straight up reflect them in gfb + if (Main.zenithWorld) + { + projectile.velocity *= -1; + modifiers.SetMaxDamage(1); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/BucketZombie.png b/NPCs/NormalNPCs/BucketZombie.png new file mode 100644 index 0000000000..9a24d61249 Binary files /dev/null and b/NPCs/NormalNPCs/BucketZombie.png differ diff --git a/NPCs/NormalNPCs/CladCrab.cs b/NPCs/NormalNPCs/CladCrab.cs new file mode 100644 index 0000000000..7696168219 --- /dev/null +++ b/NPCs/NormalNPCs/CladCrab.cs @@ -0,0 +1,308 @@ +using System; +using CalamityMod.Items.Placeables.Banners; +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 Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.NormalNPCs +{ + public class CladCrab : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 8; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + SpriteDirection = 1 + }; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + } + + public override void SetDefaults() + { + NPC.chaseable = false; + NPC.damage = 12; + NPC.defense = 7; + NPC.width = 56; + NPC.height = 54; + NPC.lifeMax = 100; + NPC.aiStyle = -1; + NPC.knockBackResist = 0.4f; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.HitSound = SoundID.NPCHit41 with { Pitch = 0.6f }; + NPC.DeathSound = SoundID.NPCDeath36 with { Pitch = -0.4f }; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + 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() + { + NPC.TargetClosest(false); + float movementSpeed = 1; + + // Enrage if target is close enough + if (NPC.HasPlayerTarget) + { + Player target = Main.player[NPC.target]; + // Enrage if the player is close enough, not too far above, and in its line of sight + if (target.Distance(NPC.Center) < 320 && target.Bottom.Y > NPC.Top.Y - 40 && Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1)) + { + // Enter attack mode + if (NPC.ai[0] != 2) + { + NPC.ai[1] = 60; + NPC.ai[0] = 2; + } + // Set calm down timer to 0 as long as these conditions are met + NPC.ai[2] = 0; + } + else + { + // Calm down + NPC.ai[2]++; + // After 5 seconds of no valid target, go back to passive behaviour + if (NPC.ai[2] > 300) + { + NPC.ai[0] = Main.rand.Next(0, 2); + NPC.ai[1] = Main.rand.Next(120, 301); + NPC.ai[2] = 0; + NPC.ai[3] = 0; + } + } + } + + if (NPC.direction == 0) + { + NPC.direction = Main.rand.NextBool() ? -1 : 1; + } + + // If not enraged and the phase timer is at 0, change phase + if (NPC.ai[1] <= 0 && NPC.ai[0] != 2) + { + NPC.ai[0] = NPC.ai[0] == 0 ? 1 : 0; + NPC.ai[1] = Main.rand.Next(120, 301); // Set the phase timer + NPC.direction = Main.rand.NextBool() ? -1 : 1; // Flip direction randomly + } + + // Passive walking + if (NPC.ai[0] == 0) + { + // If it bumps into something, turn around + if (NPC.ai[3] <= 0 && NPC.velocity.X == 0) + { + NPC.direction *= -1; + NPC.ai[3] = 30; + } + // Move + if (!NPC.justHit) + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); + // Don't get stuck on 1 block obstacles + StepUp(); + } + // Stand still + else if (NPC.ai[0] == 1) + { + // Slow to a stop if not falling/being moved up + if (NPC.velocity.Y == 0) + NPC.velocity.X *= 0; + // Start running if hit + // This behavior is mostly only here for if it gets hurt but you aren't within its aggro range + if (NPC.justHit) + { + NPC.ai[0] = 0; + NPC.ai[1] = Main.rand.Next(120, 301); + } + } + // Enrage + else + { + Player target = Main.player[NPC.target]; + // If it bumps into something, turn around + if (NPC.ai[3] <= 0 && NPC.velocity.X == 0) + { + NPC.direction *= -1; + NPC.ai[3] = 30; + } + // If it's too far from the player, turn around + else if ((NPC.ai[3] <= 0 && target.Distance(NPC.Center) > 160) || NPC.ai[3] < -180) + { + int dir = Math.Sign(Main.player[NPC.target].Center.X - NPC.Center.X); + NPC.direction = dir; + NPC.ai[3] = 120; + } + // Move + if (!NPC.justHit) + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); + StepUp(); + } + + // Phase timer + if (NPC.ai[1] > 0) + { + NPC.ai[1]--; + } + // Change direction cooldown + NPC.ai[3]--; + + NPC.spriteDirection = -NPC.direction; + } + + public static bool IsPassableTile(int x, int y) + { + return (!Main.tile[x, y].HasUnactuatedTile || + !Main.tileSolid[(int)Main.tile[x, y].TileType] || Main.tileSolidTop[(int)Main.tile[x, y].TileType]); + } + + public void StepUp() + { + Vector2 position = NPC.position; + position.X += NPC.velocity.X; + int x = (int)((position.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1)) * NPC.direction) / 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) + return; + + bool nextTileValid = 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]; + bool aboveTileHalfBlock = Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile; + bool aboveTileHasRoom = Main.tile[x, y - 1].IsHalfBlock && IsPassableTile(x, y - 4); + bool aboveTileEmpty = !Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || aboveTileHasRoom; + bool tile3AbovePassable = !Main.tile[x - NPC.direction, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - NPC.direction, y - 3].TileType]; + + if ((nextTileValid || aboveTileHalfBlock) && aboveTileEmpty && IsPassableTile(x, y - 2) && IsPassableTile(x, y - 3) && tile3AbovePassable) + { + 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; + } + } + } + } + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CladCrab") + }); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneSunkenSea || !spawnInfo.Player.InZonePurity()) + { + return 0f; + } + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * 0.1f; + } + + public override void FindFrame(int frameHeight) + { + if (NPC.velocity.Y == 0f) + { + if (!NPC.IsABestiaryIconDummy) + { + if (NPC.direction == 1) + { + NPC.spriteDirection = -1; + } + if (NPC.direction == -1) + { + NPC.spriteDirection = 1; + } + + if (NPC.velocity.X == 0f) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0.0; + return; + } + } + NPC.frameCounter += NPC.IsABestiaryIconDummy ? 0.6f : Math.Abs(NPC.velocity.X) * 0.5f; + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) + { + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + } + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type] - 1) + { + NPC.frame.Y = frameHeight; + } + } + else + { + NPC.frameCounter = 0.0; + NPC.frame.Y = frameHeight * (Main.npcFrameCount[Type] - 1); + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ItemID.StoneBlock, 1, 10, 20); + npcLoot.Add(ItemID.Daybloom, 1, 1, 4); + npcLoot.Add(ItemID.Blinkroot, 1, 1, 3); + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 7; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, hit.HitDirection, -1f, 0, default, 1f); + } + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab2").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab3").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab4").Type); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/CladCrab.png b/NPCs/NormalNPCs/CladCrab.png new file mode 100644 index 0000000000..87d6986193 Binary files /dev/null and b/NPCs/NormalNPCs/CladCrab.png differ diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/CloudElemental.cs similarity index 96% rename from NPCs/NormalNPCs/ThiccWaifu.cs rename to NPCs/NormalNPCs/CloudElemental.cs index 7350d5cef0..11bbb3861e 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/CloudElemental.cs @@ -20,7 +20,7 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.NormalNPCs { - public class ThiccWaifu : ModNPC + public class CloudElemental : ModNPC { public enum AttackState { @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; + Main.npcFrameCount[Type] = 8; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Position = new Vector2(28f, 20f), @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.NormalNPCs { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Events.Rain, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ThiccWaifu") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CloudElemental") }); } @@ -224,7 +224,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Cloud); - if (Main.rand.NextBool(15) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(15) && !Main.dedServ) { int smokeType = Utils.SelectRandom(Main.rand, GoreID.ChimneySmoke1, GoreID.ChimneySmoke2, GoreID.ChimneySmoke3); Vector2 smokeVelocity = Main.rand.NextVector2CircularEdge(6f, 6f); @@ -288,9 +288,9 @@ namespace CalamityMod.NPCs.NormalNPCs float cloudSpawnOutwardness = (AttackTimer - cloudSummonDelay) / cloudSummonRate * 50f; Vector2 spawnPosition = NPC.Top + new Vector2(cloudSpawnOutwardness, -36); - Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), spawnPosition, Vector2.Zero, projectileType, lightningDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition, Vector2.Zero, projectileType, lightningDamage, 0f, Main.myPlayer); spawnPosition = NPC.Top + new Vector2(-cloudSpawnOutwardness, -36); - Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), spawnPosition, Vector2.Zero, projectileType, lightningDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition, Vector2.Zero, projectileType, lightningDamage, 0f, Main.myPlayer); } } @@ -422,7 +422,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); else { - texture = TextureAssets.Npc[NPC.type].Value; + texture = TextureAssets.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) @@ -452,7 +452,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || !Main.hardMode || !Main.raining || !spawnInfo.Player.ZoneSkyHeight) + if (spawnInfo.PlayerSafe || !Main.hardMode || (!Main.raining && !Main.remixWorld) || !spawnInfo.Player.ZoneSkyHeight) return 0f; // Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly. diff --git a/NPCs/NormalNPCs/ThiccWaifu.png b/NPCs/NormalNPCs/CloudElemental.png similarity index 100% rename from NPCs/NormalNPCs/ThiccWaifu.png rename to NPCs/NormalNPCs/CloudElemental.png diff --git a/NPCs/NormalNPCs/ThiccWaifuAttack.png b/NPCs/NormalNPCs/CloudElementalAttack.png similarity index 100% rename from NPCs/NormalNPCs/ThiccWaifuAttack.png rename to NPCs/NormalNPCs/CloudElementalAttack.png diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 94d8317100..a1455124e3 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -15,8 +15,8 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - Main.npcFrameCount[NPC.type] = 10; + NPCID.Sets.NeedsExpertScaling[Type] = true; + Main.npcFrameCount[Type] = 10; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.8f, @@ -90,7 +90,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -324,7 +324,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 4); + npcLoot.Add(ModContent.ItemType(), 4); npcLoot.Add(ItemID.FossilOre, 1, 4, 5); } } diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index a2ac0b57eb..f954995ab2 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -27,9 +28,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 10; - NPC.lifeMax = 90; + NPC.lifeMax = 115; NPC.knockBackResist = 0.3f; - NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -116,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sand, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmber").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmber2").Type, 1f); @@ -130,6 +131,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ItemID.Amber, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 6); + npcLoot.Add(ModContent.ItemType(), 25); } } } diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 6a432d29cf..a4e87c0b90 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -26,10 +27,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 4; - NPC.lifeMax = 60; + NPC.lifeMax = 75; NPC.knockBackResist = 0.75f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 0, 30); + NPC.value = Item.buyPrice(0, 0, 0, 60); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } @@ -116,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.PurpleCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmethyst").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmethyst2").Type, 1f); @@ -130,6 +131,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ItemID.Amethyst, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 6); + npcLoot.Add(ModContent.ItemType(), 25); } } } diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index aa32b01389..e1a0792b18 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; @@ -16,7 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -27,7 +28,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 12; - NPC.lifeMax = 300; + NPC.lifeMax = 375; NPC.knockBackResist = 0.15f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 5, 0); @@ -48,7 +49,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundHallow, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } @@ -117,7 +118,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerCrystal").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerCrystal2").Type, 1f); @@ -131,6 +132,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ItemID.CrystalShard, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 6); + npcLoot.Add(ModContent.ItemType(), 25); } } } diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index a53c26e4a7..09e32974f5 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -26,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 8; - NPC.lifeMax = 150; + NPC.lifeMax = 190; NPC.knockBackResist = 0.35f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 2, 0); @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } @@ -116,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemDiamond, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerDiamond").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerDiamond2").Type, 1f); @@ -130,6 +131,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ItemID.Diamond, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 6); + npcLoot.Add(ModContent.ItemType(), 25); } } } diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 187e18bbe4..83098672ad 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -26,10 +27,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 6; - NPC.lifeMax = 105; + NPC.lifeMax = 135; NPC.knockBackResist = 0.55f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(0, 0, 1, 20); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } @@ -116,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerEmerald").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerEmerald2").Type, 1f); @@ -130,6 +131,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ItemID.Emerald, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 6); + npcLoot.Add(ModContent.ItemType(), 25); } } } diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 7a70aadd97..85e11808ee 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -26,10 +27,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 8; - NPC.lifeMax = 135; + NPC.lifeMax = 170; NPC.knockBackResist = 0.45f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(0, 0, 1, 60); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } @@ -116,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.HeartCrystal, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerRuby").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerRuby2").Type, 1f); @@ -130,6 +131,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ItemID.Ruby, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 6); + npcLoot.Add(ModContent.ItemType(), 25); } } } diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 67894c8546..82e676db37 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -26,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 6; - NPC.lifeMax = 90; + NPC.lifeMax = 115; NPC.knockBackResist = 0.65f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 1, 0); @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } @@ -116,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerSapphire").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerSapphire2").Type, 1f); @@ -130,6 +131,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ItemID.Sapphire, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 6); + npcLoot.Add(ModContent.ItemType(), 25); } } } diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index 36752b68e0..3ce4c15784 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -26,10 +27,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 4; - NPC.lifeMax = 45; + NPC.lifeMax = 60; NPC.knockBackResist = 0.85f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 0, 30); + NPC.value = Item.buyPrice(0, 0, 0, 60); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } @@ -116,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.t_Honey, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerTopaz").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerTopaz2").Type, 1f); @@ -130,6 +131,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ItemID.Topaz, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 6); + npcLoot.Add(ModContent.ItemType(), 25); } } } diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 17442a18d1..18f99bbfbf 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -11,7 +11,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; } public override void SetDefaults() @@ -22,10 +22,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 42; NPC.defense = 8; - NPC.lifeMax = 130; + NPC.lifeMax = 165; NPC.knockBackResist = 0.3f; AnimationType = NPCID.RainbowSlime; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.alpha = 105; NPC.lavaImmune = false; NPC.noGravity = false; diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 7c5c2a66ed..677e543ea6 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -5,13 +5,14 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class CryoSlime : ModNPC { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; } public override void SetDefaults() @@ -22,10 +23,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 30; NPC.defense = 8; - NPC.lifeMax = 120; + NPC.lifeMax = 180; NPC.knockBackResist = 0.6f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -74,7 +75,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(NPC.HitInfo hit) { - // TODO -- This dust was an invalid dust. Replaced with a random dust. int dustType = 91; for (int k = 0; k < 5; k++) { diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 28a4efa960..1467b1f3b6 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; } public override void SetDefaults() @@ -25,9 +25,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 64; NPC.defense = 10; NPC.DR_NERD(0.1f); - NPC.lifeMax = 300; + NPC.lifeMax = 375; NPC.knockBackResist = 0.4f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 3, 0); NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath7; Banner = NPC.type; diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index 1cda527552..0511fb85cf 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -11,7 +11,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; } public override void SetDefaults() @@ -22,10 +22,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 42; NPC.defense = 8; - NPC.lifeMax = 130; + NPC.lifeMax = 165; NPC.knockBackResist = 0.3f; AnimationType = NPCID.RainbowSlime; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.alpha = 105; NPC.lavaImmune = false; NPC.noGravity = false; diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index a056fdde37..fe9bf61205 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -23,8 +23,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.NeedsExpertScaling[Type] = true; + Main.npcFrameCount[Type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.75f, @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.lifeMax = 5000; NPC.knockBackResist = 0.5f; - NPC.value = Item.buyPrice(0, 1, 0, 0); + NPC.value = Item.buyPrice(0, 0, 30, 0); NPC.Opacity = 0f; NPC.noGravity = true; NPC.noTileCollide = false; @@ -309,7 +309,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Opacity = 1f; NPC.frameCounter += hasBeenHit ? 0.15f : 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -346,7 +346,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Eidolist").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Eidolist2").Type, NPC.scale); diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 6b730dc634..0877b823af 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 10; + Main.npcFrameCount[Type] = 10; } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 36; NPC.height = 32; NPC.defense = Main.hardMode ? 10 : 2; - NPC.lifeMax = Main.hardMode ? 150 : 50; + NPC.lifeMax = Main.hardMode ? 190 : 65; NPC.knockBackResist = Main.hardMode ? 0.2f : 0.5f; NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit1; @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[3] = (float)backUpTimer; NPC.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenDoor) + if (Main.dedServ & canOpenDoor) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 0, (float)doorCheckX, (float)(doorCheckY - 1), (float)NPC.direction, 0, 0, 0); } @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[3] = (float)backUpTimer; NPC.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenTallGate) + if (Main.dedServ & canOpenTallGate) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 4, (float)doorCheckX, (float)(doorCheckY - 1), 0f, 0, 0, 0); } diff --git a/NPCs/NormalNPCs/Foveanator.cs b/NPCs/NormalNPCs/Foveanator.cs index b20ce40bf3..30d5b09bca 100644 --- a/NPCs/NormalNPCs/Foveanator.cs +++ b/NPCs/NormalNPCs/Foveanator.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.DataStructures; using CalamityMod.Events; +using CalamityMod.NPCs.AstrumDeus; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -21,35 +22,37 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - [AutoloadBossHead] public class Foveanator : ModNPC { public static int phase1IconIndex; public static int phase2IconIndex; - internal static void LoadHeadIcons() + public static Asset GlowTexture; + + public override void Load() { string phase1IconPath = "CalamityMod/NPCs/NormalNPCs/Foveanator_Head_Boss"; string phase2IconPath = "CalamityMod/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss"; - - CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); - phase1IconIndex = ModContent.GetModBossHeadSlot(phase1IconPath); - - CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); - phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + + phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); + phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); } public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + + if (!Main.dedServ) + GlowTexture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/FoveanatorGlow", AssetRequestMode.AsyncLoad); } public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.aiStyle = NPCAIStyleID.Retinazer; + NPC.aiStyle = -1; + AIType = -1; NPC.GetNPCDamage(); NPC.DR_NERD(0.2f); @@ -109,11 +112,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(NPC, options); - } + CalamityUtils.CalamityTargeting(NPC, default); float enrageScale = bossRush ? 0.5f : 0.3f; if (Main.IsItDay() || bossRush) @@ -145,41 +144,18 @@ namespace CalamityMod.NPCs.NormalNPCs return; } - float foveanatorHoverXDest = NPC.Center.X - Main.player[NPC.target].position.X - (Main.player[NPC.target].width / 2); - float foveanatorHoverYDest = NPC.position.Y + NPC.height - 59f - Main.player[NPC.target].position.Y - (Main.player[NPC.target].height / 2); + Vector2 lookDirection = NPC.Center - Main.player[NPC.target].Center; + int direction = (NPC.Center.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width) ? -1 : 1; - float foveanatorHoverRotation = (float)Math.Atan2(foveanatorHoverYDest, foveanatorHoverXDest) + MathHelper.PiOver2; - if (foveanatorHoverRotation < 0f) - foveanatorHoverRotation += MathHelper.TwoPi; - else if (foveanatorHoverRotation > MathHelper.TwoPi) - foveanatorHoverRotation -= MathHelper.TwoPi; + float hoverRotation = lookDirection.ToRotation() + MathHelper.PiOver2; + if (hoverRotation < 0f) + hoverRotation += MathHelper.TwoPi; + else if (hoverRotation > MathHelper.TwoPi) + hoverRotation -= MathHelper.TwoPi; - float foveanatorRotationSpeed = 0.1f; - if (NPC.rotation < foveanatorHoverRotation) - { - if ((foveanatorHoverRotation - NPC.rotation) > MathHelper.Pi) - NPC.rotation -= foveanatorRotationSpeed; - else - NPC.rotation += foveanatorRotationSpeed; - } - else if (NPC.rotation > foveanatorHoverRotation) - { - if ((NPC.rotation - foveanatorHoverRotation) > MathHelper.Pi) - NPC.rotation += foveanatorRotationSpeed; - else - NPC.rotation -= foveanatorRotationSpeed; - } - - if (NPC.rotation > foveanatorHoverRotation - foveanatorRotationSpeed && NPC.rotation < foveanatorHoverRotation + foveanatorRotationSpeed) - NPC.rotation = foveanatorHoverRotation; - - if (NPC.rotation < 0f) - NPC.rotation += MathHelper.TwoPi; - else if (NPC.rotation > MathHelper.TwoPi) - NPC.rotation -= MathHelper.TwoPi; - - if (NPC.rotation > foveanatorHoverRotation - foveanatorRotationSpeed && NPC.rotation < foveanatorHoverRotation + foveanatorRotationSpeed) - NPC.rotation = foveanatorHoverRotation; + // Rotate faster during energy bomb and laser barrage + float rotationRate = NPC.ai[1] == 3f ? 0.25f : 0.15f; + NPC.rotation = NPC.rotation.AngleTowards(hoverRotation, rotationRate); if (Main.rand.NextBool(5)) { @@ -205,12 +181,13 @@ namespace CalamityMod.NPCs.NormalNPCs // Movement variables float phase1MaxSpeedIncrease = 2f; float phase1MaxAccelerationIncrease = 0.025f; - float phase1MaxChargeSpeedIncrease = 3f; + float phase1MaxChargeSpeedIncrease = 1f; // Phase duration variables float phase1MaxLaserPhaseDurationDecrease = 120f; // Go to phase 2 early if Spaz and Ret health total goes below 50% + // Go to final phase early if Spaz and Ret health total goes below 20% float retAndSpazHPRatio = 0f; if (CalamityGlobalNPC.fireEye != -1) { @@ -225,14 +202,14 @@ namespace CalamityMod.NPCs.NormalNPCs // Phase checks bool phase2 = lifeRatio < phase2LifeRatio || retAndSpazHPRatio < 0.5f; - bool finalPhase = lifeRatio < finalPhaseLifeRatio; + bool finalPhase = lifeRatio < finalPhaseLifeRatio || retAndSpazHPRatio < 0.2f; Vector2 mechQueenSpacing = Vector2.Zero; if (NPC.IsMechQueenUp) { NPC NPC = Main.npc[NPC.mechQueen]; Vector2 mechQueenCenter = NPC.GetMechQueenCenter(); - Vector2 eyePosition = new Vector2(-150f, -250f); + Vector2 eyePosition = new Vector2(0f, -300f); eyePosition *= 0.75f; float mechdusaRotation = NPC.velocity.X * 0.025f; mechQueenSpacing = mechQueenCenter + eyePosition; @@ -259,110 +236,68 @@ namespace CalamityMod.NPCs.NormalNPCs // Avoid cheap bullshit NPC.damage = 0; - float foveanatorPhase1MaxSpeed = 8.25f; - float foveanatorPhase1Acceleration = 0.115f; - foveanatorPhase1MaxSpeed += 4f * enrageScale; - foveanatorPhase1Acceleration += 0.05f * enrageScale; + float maxVelocity = 8.5f; + float acceleration = 0.12f; + maxVelocity += 4.5f * enrageScale; + acceleration += 0.06f * enrageScale; if (death) { - foveanatorPhase1MaxSpeed += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - foveanatorPhase1Acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); } if (Main.getGoodWorld) { - foveanatorPhase1MaxSpeed *= 1.15f; - foveanatorPhase1Acceleration *= 1.15f; + maxVelocity *= 1.15f; + acceleration *= 1.15f; } - - int foveanatorFaceDirection = 1; - if (NPC.Center.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width) - foveanatorFaceDirection = -1; - - Vector2 foveanatorPosition = NPC.Center; - float distanceFromTarget = 300f; - float foveanatorTargetX = Main.player[NPC.target].Center.X + (foveanatorFaceDirection * distanceFromTarget) - foveanatorPosition.X; - float foveanatorTargetY = Main.player[NPC.target].Center.Y - distanceFromTarget - foveanatorPosition.Y; + + // Foveanator stays further away from the player than Retinazer (Retinazer distance is 300, Foveanator distance is 450) + float distanceFromTarget = 450f; + Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction - Vector2.UnitY * distanceFromTarget; + float distanceFromDestination = (destination - NPC.Center).Length(); + Vector2 idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitX * direction); if (NPC.IsMechQueenUp) { - foveanatorPhase1MaxSpeed = 14f; - foveanatorTargetX = mechQueenSpacing.X; - foveanatorTargetY = mechQueenSpacing.Y; - foveanatorTargetX -= foveanatorPosition.X; - foveanatorTargetY -= foveanatorPosition.Y; - } + maxVelocity = 14f; - float foveanatorTargetDist = (float)Math.Sqrt(foveanatorTargetX * foveanatorTargetX + foveanatorTargetY * foveanatorTargetY); - float foveanatorTargetDistCopy = foveanatorTargetDist; + destination = mechQueenSpacing; + distanceFromDestination = (destination - NPC.Center).Length(); + idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitY); - if (NPC.IsMechQueenUp) - { - if (foveanatorTargetDist > foveanatorPhase1MaxSpeed) - { - foveanatorTargetDist = foveanatorPhase1MaxSpeed / foveanatorTargetDist; - foveanatorTargetX *= foveanatorTargetDist; - foveanatorTargetY *= foveanatorTargetDist; - } + if (distanceFromDestination > maxVelocity) + idealVelocity *= maxVelocity / distanceFromDestination; - NPC.velocity.X = (NPC.velocity.X * 59f + foveanatorTargetX) / 60f; - NPC.velocity.Y = (NPC.velocity.Y * 59f + foveanatorTargetY) / 60f; + float inertia = 60f; + NPC.velocity = (NPC.velocity * (inertia - 1f) + idealVelocity) / inertia; } else - { - foveanatorTargetDist = foveanatorPhase1MaxSpeed / foveanatorTargetDist; - foveanatorTargetX *= foveanatorTargetDist; - foveanatorTargetY *= foveanatorTargetDist; + NPC.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); - if (NPC.velocity.X < foveanatorTargetX) - { - NPC.velocity.X += foveanatorPhase1Acceleration; - if (NPC.velocity.X < 0f && foveanatorTargetX > 0f) - NPC.velocity.X += foveanatorPhase1Acceleration; - } - else if (NPC.velocity.X > foveanatorTargetX) - { - NPC.velocity.X -= foveanatorPhase1Acceleration; - if (NPC.velocity.X > 0f && foveanatorTargetX < 0f) - NPC.velocity.X -= foveanatorPhase1Acceleration; - } - if (NPC.velocity.Y < foveanatorTargetY) - { - NPC.velocity.Y += foveanatorPhase1Acceleration; - if (NPC.velocity.Y < 0f && foveanatorTargetY > 0f) - NPC.velocity.Y += foveanatorPhase1Acceleration; - } - else if (NPC.velocity.Y > foveanatorTargetY) - { - NPC.velocity.Y -= foveanatorPhase1Acceleration; - if (NPC.velocity.Y > 0f && foveanatorTargetY < 0f) - NPC.velocity.Y -= foveanatorPhase1Acceleration; - } + // Foveanator stays in this phase longer than Retinazer (Foveanator time is 450, Retinazer time is 300) + // Foveanator has longer cooldown between firing projectiles than Retinazer (Foveanator cooldown is 60, Retinazer cooldown is 30) + float phaseGateValue = 450f - (death ? phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float laserGateValue = 60f; + if (NPC.IsMechQueenUp) + { + phaseGateValue = 1350f; + laserGateValue = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 120f : 180f); } NPC.ai[2] += 1f; - float phaseGateValue = 300f - (death ? phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 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; - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(NPC, options); + CalamityUtils.CalamityTargeting(NPC, default); NPC.netUpdate = true; } - - else if (foveanatorTargetDistCopy < (death ? 960f : 800f)) + else if (distanceFromDestination < (death ? 960f : 800f)) { if (!Main.player[NPC.target].dead) { @@ -374,19 +309,17 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.ai[3] >= laserGateValue) { NPC.ai[3] = 0f; - foveanatorPosition = NPC.Center; - foveanatorTargetX = Main.player[NPC.target].Center.X - foveanatorPosition.X; - foveanatorTargetY = Main.player[NPC.target].Center.Y - foveanatorPosition.Y; + + SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float foveanatorSpeed = 10.5f; - foveanatorSpeed += 3f * enrageScale; - int type = ProjectileID.EyeLaser; + float laserSpeed = 6f + 1.5f * enrageScale; + 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -396,38 +329,28 @@ namespace CalamityMod.NPCs.NormalNPCs damage = (int)(damage * secondMechMultiplier); } - foveanatorTargetDist = (float)Math.Sqrt(foveanatorTargetX * foveanatorTargetX + foveanatorTargetY * foveanatorTargetY); - foveanatorTargetDist = foveanatorSpeed / foveanatorTargetDist; - foveanatorTargetX *= foveanatorTargetDist; - foveanatorTargetY *= foveanatorTargetDist; - - Vector2 laserVelocity = new Vector2(foveanatorTargetX, foveanatorTargetY); - Projectile.NewProjectile(NPC.GetSource_FromAI(), foveanatorPosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + Vector2 laserVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 60f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } } - else if (NPC.ai[1] == 1f) { // Set damage NPC.damage = NPC.defDamage; - NPC.rotation = foveanatorHoverRotation; - float foveanatorChargeSpeed = 15f; - foveanatorChargeSpeed += 10f * enrageScale; + NPC.rotation = hoverRotation; + + float chargeSpeed = 4f; + chargeSpeed += 1f * enrageScale; if (death) - foveanatorChargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) - foveanatorChargeSpeed += 2f; + chargeSpeed += 1f; + + NPC.velocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed; - Vector2 foveanatorChargePos = NPC.Center; - float foveanatorChargeTargetX = Main.player[NPC.target].Center.X - foveanatorChargePos.X; - float foveanatorChargeTargetY = Main.player[NPC.target].Center.Y - foveanatorChargePos.Y; - float foveanatorChargeTargetDist = (float)Math.Sqrt(foveanatorChargeTargetX * foveanatorChargeTargetX + foveanatorChargeTargetY * foveanatorChargeTargetY); - foveanatorChargeTargetDist = foveanatorChargeSpeed / foveanatorChargeTargetDist; - NPC.velocity.X = foveanatorChargeTargetX * foveanatorChargeTargetDist; - NPC.velocity.Y = foveanatorChargeTargetY * foveanatorChargeTargetDist; NPC.ai[1] = 2f; } else if (NPC.ai[1] == 2f) @@ -436,37 +359,58 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = NPC.defDamage; NPC.ai[2] += 1f; - float decelerateGateValue = 36f + (death ? 6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float decelerateGateValue = 72f + (death ? 12f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); if (NPC.ai[2] >= decelerateGateValue) { // Avoid cheap bullshit NPC.damage = 0; - float decelerationMultiplier = 0.84f - (death ? 0.16f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float decelerationMultiplier = 0.8f - (death ? 0.2f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); NPC.velocity *= decelerationMultiplier; - if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + + if (Math.Abs(NPC.velocity.X) < 0.1) NPC.velocity.X = 0f; - if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + if (Math.Abs(NPC.velocity.Y) < 0.1) NPC.velocity.Y = 0f; } else - NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + { + // Accelerative charge + float maxVelocity = 24f; + maxVelocity += 6f * enrageScale; + if (death) + maxVelocity += (phase1MaxChargeSpeedIncrease * 6f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + if (Main.getGoodWorld) + maxVelocity += 6f; - float delayBeforeChargingAgain = 48f - (death ? 3f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + if (NPC.velocity.Length() < maxVelocity) + { + NPC.velocity *= 1.04f; + if (NPC.velocity.Length() > maxVelocity) + { + NPC.velocity.Normalize(); + NPC.velocity *= maxVelocity; + } + } + + NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2; + } + + float delayBeforeChargingAgain = 96f - (death ? 6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); if (NPC.ai[2] >= delayBeforeChargingAgain) { NPC.ai[3] += 1f; NPC.ai[2] = 0f; - NPC.rotation = foveanatorHoverRotation; - float totalCharges = death ? 6f : 5f; + + NPC.rotation = hoverRotation; + + float totalCharges = death ? 3f : 2f; if (NPC.ai[3] >= totalCharges) { NPC.ai[1] = 0f; NPC.ai[3] = 0f; - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(NPC, options); + CalamityUtils.CalamityTargeting(NPC, default); } else NPC.ai[1] = 1f; @@ -481,9 +425,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[2] = 0f; NPC.ai[3] = 0f; - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(NPC, options); + CalamityUtils.CalamityTargeting(NPC, default); NPC.netUpdate = true; } @@ -500,7 +442,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.ai[0] == 1f) { NPC.ai[2] += 0.005f; - if (NPC.ai[2] > 0.5) + if (NPC.ai[2] > 0.5f) NPC.ai[2] = 0.5f; } else @@ -517,15 +459,16 @@ namespace CalamityMod.NPCs.NormalNPCs { if (NPC.ai[1] % 10f == 0f) { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); + SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { bool shootLaser = NPC.ai[1] % 20f == 0f; - int type = shootLaser ? ProjectileID.DeathLaser : ModContent.ProjectileType(); + + int type = shootLaser ? ModContent.ProjectileType() : 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -535,15 +478,16 @@ namespace CalamityMod.NPCs.NormalNPCs damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 7f; - int numProj = shootLaser ? 6 : 2; - int spread = shootLaser ? 20 : 80; + float projectileSpeed = shootLaser ? (6f + 1.5f * enrageScale) : 16f; + float ai0 = shootLaser ? 0f : (death ? 1f : 0f); + Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; + int numProj = shootLaser ? 4 : 2; + int spread = shootLaser ? 15 : 30; 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); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, ai0); } } } @@ -561,13 +505,13 @@ namespace CalamityMod.NPCs.NormalNPCs { SoundEngine.PlaySound(SoundID.NPCHit1, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { 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); + Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), Mod.Find("Foveanator1").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, NPC.scale); + Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, NPC.scale); } } @@ -581,9 +525,9 @@ namespace CalamityMod.NPCs.NormalNPCs 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) + if (Math.Abs(NPC.velocity.X) < 0.1) NPC.velocity.X = 0f; - if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + if (Math.Abs(NPC.velocity.Y) < 0.1) NPC.velocity.Y = 0f; } else @@ -604,7 +548,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.chaseable = !spazOrRetInPhase1; int setDamage = (int)Math.Round(NPC.defDamage * 1.5); - NPC.defense = NPC.defDefense + 10; + NPC.defense = NPC.defDefense + 14; calamityGlobalNPC.DR = spazOrRetInPhase1 ? 0.9999f : 0.2f; calamityGlobalNPC.unbreakableDR = spazOrRetInPhase1; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = spazOrRetInPhase1; @@ -616,113 +560,71 @@ namespace CalamityMod.NPCs.NormalNPCs // Avoid cheap bullshit NPC.damage = 0; - float foveanatorPhase2MaxSpeed = 9.5f + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float foveanatorPhase2Accel = 0.175f + (death ? 0.05f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - foveanatorPhase2MaxSpeed += 4.5f * enrageScale; - foveanatorPhase2Accel += 0.075f * enrageScale; + float maxVelocity = 4f + (death ? 1.2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float acceleration = 0.06f + (death ? 0.02f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + maxVelocity += 2f * enrageScale; + acceleration += 0.04f * enrageScale; - if (Main.getGoodWorld) + float distanceFromTarget = 360f; + Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction; + float distanceFromDestination = (destination - NPC.Center).Length(); + Vector2 idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitX * direction); + + if (!NPC.IsMechQueenUp) { - foveanatorPhase2MaxSpeed *= 1.15f; - foveanatorPhase2Accel *= 1.15f; + // Boost speed if too far from target + if (distanceFromDestination > distanceFromTarget) + maxVelocity += MathHelper.Lerp(0f, 12f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); + + if (Main.getGoodWorld) + { + maxVelocity *= 1.15f; + acceleration *= 1.15f; + } + + NPC.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); } - Vector2 eyePosition = NPC.Center; - float foveanatorPhase2TargetX = Main.player[NPC.target].Center.X - eyePosition.X; - float distanceFromTarget = 420f; - float foveanatorPhase2TargetY = Main.player[NPC.target].Center.Y - distanceFromTarget - eyePosition.Y; - - if (NPC.IsMechQueenUp) - { - foveanatorPhase2MaxSpeed = 14f; - foveanatorPhase2TargetX = mechQueenSpacing.X; - foveanatorPhase2TargetY = mechQueenSpacing.Y; - foveanatorPhase2TargetX -= eyePosition.X; - foveanatorPhase2TargetY -= eyePosition.Y; - } - - float foveanatorPhase2TargetDist = (float)Math.Sqrt(foveanatorPhase2TargetX * foveanatorPhase2TargetX + foveanatorPhase2TargetY * foveanatorPhase2TargetY); - - if (NPC.IsMechQueenUp) - { - if (foveanatorPhase2TargetDist > foveanatorPhase2MaxSpeed) - { - foveanatorPhase2TargetDist = foveanatorPhase2MaxSpeed / foveanatorPhase2TargetDist; - foveanatorPhase2TargetX *= foveanatorPhase2TargetDist; - foveanatorPhase2TargetY *= foveanatorPhase2TargetDist; - } - - NPC.velocity.X = (NPC.velocity.X * 4f + foveanatorPhase2TargetX) / 5f; - NPC.velocity.Y = (NPC.velocity.Y * 4f + foveanatorPhase2TargetY) / 5f; - } - else - { - foveanatorPhase2TargetDist = foveanatorPhase2MaxSpeed / foveanatorPhase2TargetDist; - foveanatorPhase2TargetX *= foveanatorPhase2TargetDist; - foveanatorPhase2TargetY *= foveanatorPhase2TargetDist; - - if (NPC.velocity.X < foveanatorPhase2TargetX) - { - NPC.velocity.X += foveanatorPhase2Accel; - if (NPC.velocity.X < 0f && foveanatorPhase2TargetX > 0f) - NPC.velocity.X += foveanatorPhase2Accel; - } - else if (NPC.velocity.X > foveanatorPhase2TargetX) - { - NPC.velocity.X -= foveanatorPhase2Accel; - if (NPC.velocity.X > 0f && foveanatorPhase2TargetX < 0f) - NPC.velocity.X -= foveanatorPhase2Accel; - } - if (NPC.velocity.Y < foveanatorPhase2TargetY) - { - NPC.velocity.Y += foveanatorPhase2Accel; - if (NPC.velocity.Y < 0f && foveanatorPhase2TargetY > 0f) - NPC.velocity.Y += foveanatorPhase2Accel; - } - else if (NPC.velocity.Y > foveanatorPhase2TargetY) - { - NPC.velocity.Y -= foveanatorPhase2Accel; - if (NPC.velocity.Y > 0f && foveanatorPhase2TargetY < 0f) - NPC.velocity.Y -= foveanatorPhase2Accel; - } - } - - NPC.ai[2] += (!spazAlive || !retAlive) ? 1.5f : 1f; - float phaseGateValue = NPC.IsMechQueenUp ? 900f : 300f - (death ? 120f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + // Fire flamethrower for x seconds + NPC.ai[2] += (retAlive && spazAlive) ? 1f : 2f; + float phaseGateValue = NPC.IsMechQueenUp ? 1350f : 360f - (death ? 90f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (NPC.ai[2] >= phaseGateValue) { - NPC.ai[1] = 1f; + // Go to charge phase or fire large barrage of lasers and energy bombs if in final phase + NPC.ai[1] = finalPhase ? 3f : 1f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(NPC, options); - NPC.netUpdate = true; } - eyePosition = NPC.Center; - foveanatorPhase2TargetX = Main.player[NPC.target].Center.X - eyePosition.X; - foveanatorPhase2TargetY = Main.player[NPC.target].Center.Y - eyePosition.Y; - NPC.rotation = (float)Math.Atan2(foveanatorPhase2TargetY, foveanatorPhase2TargetX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient) + // Fire fireballs and flamethrower + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - NPC.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (NPC.localAI[1] >= ((spazAlive && retAlive) ? 52f : 26f)) + // Play flame sound on timer + NPC.localAI[2] += 1f; + if (NPC.localAI[2] > 22f) { - 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 || !retAlive || finalPhase) + NPC.localAI[2] = 0f; + SoundEngine.PlaySound(SoundID.Item34, NPC.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + if (NPC.localAI[1] > 4f) { NPC.localAI[1] = 0f; - float foveanatorPhase2LaserSpeed = 10f; - foveanatorPhase2LaserSpeed += enrageScale; - int type = ProjectileID.DeathLaser; + + float foveanatorFlamethrowerSpeed = 4f + 2f * enrageScale; + float timeForFlamethrowerToReachMaxVelocity = (retAlive && spazAlive) ? 120f : 60f; + float flamethrowerSpeedScalar = MathHelper.Clamp(NPC.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); + foveanatorFlamethrowerSpeed = MathHelper.Lerp(0.1f, foveanatorFlamethrowerSpeed, flamethrowerSpeedScalar); + + 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -732,348 +634,257 @@ namespace CalamityMod.NPCs.NormalNPCs damage = (int)(damage * secondMechMultiplier); } - foveanatorPhase2TargetDist = (float)Math.Sqrt(foveanatorPhase2TargetX * foveanatorPhase2TargetX + foveanatorPhase2TargetY * foveanatorPhase2TargetY); - foveanatorPhase2TargetDist = foveanatorPhase2LaserSpeed / foveanatorPhase2TargetDist; - foveanatorPhase2TargetX *= foveanatorPhase2TargetDist; - foveanatorPhase2TargetY *= foveanatorPhase2TargetDist; + Vector2 flamethrowerVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * foveanatorFlamethrowerSpeed + NPC.velocity * 0.5f; - Vector2 laserVelocity = new Vector2(foveanatorPhase2TargetX, foveanatorPhase2TargetY); - 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; - } + if (NPC.IsMechQueenUp) + flamethrowerVelocity = (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * foveanatorFlamethrowerSpeed + NPC.velocity * 0.5f; + + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 100f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); } } } + + if (NPC.IsMechQueenUp) + { + maxVelocity = 14f; + + destination = mechQueenSpacing; + distanceFromDestination = (destination - NPC.Center).Length(); + idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitY); + + if (distanceFromDestination > maxVelocity) + idealVelocity *= maxVelocity / distanceFromDestination; + + float inertia = 60f; + NPC.velocity = (NPC.velocity * (inertia - 1f) + idealVelocity) / inertia; + } } - else + + // Charge + else if (NPC.ai[1] == 1f) { - if (NPC.ai[1] == 1f) + // Set damage + NPC.damage = setDamage; + + // Play charge sound + // TODO - Make this a jet turbine sound or something + //SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); + + // Set rotation and velocity + NPC.rotation = hoverRotation; + + float chargeSpeed = 4.5f + (death ? 1.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + chargeSpeed += 4f * enrageScale; + if (Main.getGoodWorld) + chargeSpeed *= 1.2f; + + NPC.velocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed; + + NPC.ai[1] = 2f; + } + + // Maintain charge velocity until deceleration + else if (NPC.ai[1] == 2f) + { + // Set damage + NPC.damage = setDamage; + + NPC.ai[2] += 1f; + + float chargeTime = 60f - (death ? 20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + + // Slow down + if (NPC.ai[2] >= chargeTime) { // Avoid cheap bullshit NPC.damage = 0; - int foveanatorPhase2FaceDirection = 1; - if (NPC.Center.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width) - foveanatorPhase2FaceDirection = -1; - - float foveanatorPhase2RapidFireMaxSpeed = 9.5f + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float foveanatorPhase2RapidFireAccel = 0.25f + (death ? 0.075f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - foveanatorPhase2RapidFireMaxSpeed += 4.5f * enrageScale; - foveanatorPhase2RapidFireAccel += 0.15f * enrageScale; + float deceleration = 0.8f - (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + NPC.velocity *= deceleration; + if (Math.Abs(NPC.velocity.X) < 0.1) + NPC.velocity.X = 0f; + if (Math.Abs(NPC.velocity.Y) < 0.1) + NPC.velocity.Y = 0f; + } + else + { + // Accelerative charge + float maxVelocity = 27f; + maxVelocity += 6f * enrageScale; + if (death) + maxVelocity += 7.5f * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) - { - foveanatorPhase2RapidFireMaxSpeed *= 1.15f; - foveanatorPhase2RapidFireAccel *= 1.15f; - } + maxVelocity *= 1.2f; - Vector2 foveanatorPhase2RapidFirePos = NPC.Center; - float distanceFromTarget = 420f; - float foveanatorPhase2RapidFireTargetX = Main.player[NPC.target].Center.X + (foveanatorPhase2FaceDirection * distanceFromTarget) - foveanatorPhase2RapidFirePos.X; - float foveanatorPhase2RapidFireTargetY = Main.player[NPC.target].Center.Y - foveanatorPhase2RapidFirePos.Y; - float foveanatorPhase2RapidFireTargetDist = (float)Math.Sqrt(foveanatorPhase2RapidFireTargetX * foveanatorPhase2RapidFireTargetX + foveanatorPhase2RapidFireTargetY * foveanatorPhase2RapidFireTargetY); - foveanatorPhase2RapidFireTargetDist = foveanatorPhase2RapidFireMaxSpeed / foveanatorPhase2RapidFireTargetDist; - foveanatorPhase2RapidFireTargetX *= foveanatorPhase2RapidFireTargetDist; - foveanatorPhase2RapidFireTargetY *= foveanatorPhase2RapidFireTargetDist; - - if (NPC.velocity.X < foveanatorPhase2RapidFireTargetX) + // Spawn Energy Bombs along the way + float energyBombFireRate = 8f; + if (NPC.ai[2] % energyBombFireRate == 0f) { - NPC.velocity.X += foveanatorPhase2RapidFireAccel; - if (NPC.velocity.X < 0f && foveanatorPhase2RapidFireTargetX > 0f) - NPC.velocity.X += foveanatorPhase2RapidFireAccel; - } - else if (NPC.velocity.X > foveanatorPhase2RapidFireTargetX) - { - NPC.velocity.X -= foveanatorPhase2RapidFireAccel; - if (NPC.velocity.X > 0f && foveanatorPhase2RapidFireTargetX < 0f) - NPC.velocity.X -= foveanatorPhase2RapidFireAccel; - } - if (NPC.velocity.Y < foveanatorPhase2RapidFireTargetY) - { - NPC.velocity.Y += foveanatorPhase2RapidFireAccel; - if (NPC.velocity.Y < 0f && foveanatorPhase2RapidFireTargetY > 0f) - NPC.velocity.Y += foveanatorPhase2RapidFireAccel; - } - else if (NPC.velocity.Y > foveanatorPhase2RapidFireTargetY) - { - NPC.velocity.Y -= foveanatorPhase2RapidFireAccel; - if (NPC.velocity.Y > 0f && foveanatorPhase2RapidFireTargetY < 0f) - NPC.velocity.Y -= foveanatorPhase2RapidFireAccel; - } - - foveanatorPhase2RapidFirePos = NPC.Center; - foveanatorPhase2RapidFireTargetX = Main.player[NPC.target].Center.X - foveanatorPhase2RapidFirePos.X; - foveanatorPhase2RapidFireTargetY = Main.player[NPC.target].Center.Y - foveanatorPhase2RapidFirePos.Y; - NPC.rotation = (float)Math.Atan2(foveanatorPhase2RapidFireTargetY, foveanatorPhase2RapidFireTargetX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (NPC.localAI[1] > ((spazAlive && retAlive) ? 20f : 10f)) + SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) { - 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 || !retAlive || finalPhase) + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { - 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); - } - - foveanatorPhase2RapidFireTargetDist = (float)Math.Sqrt(foveanatorPhase2RapidFireTargetX * foveanatorPhase2RapidFireTargetX + foveanatorPhase2RapidFireTargetY * foveanatorPhase2RapidFireTargetY); - foveanatorPhase2RapidFireTargetDist = 9f / foveanatorPhase2RapidFireTargetDist; - foveanatorPhase2RapidFireTargetX *= foveanatorPhase2RapidFireTargetDist; - foveanatorPhase2RapidFireTargetY *= foveanatorPhase2RapidFireTargetDist; - - Vector2 laserVelocity = new Vector2(foveanatorPhase2RapidFireTargetX, foveanatorPhase2RapidFireTargetY); - if (canHit) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), foveanatorPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - else - { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), foveanatorPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 300; - } + 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); } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.velocity.SafeNormalize(Vector2.UnitY) * 60f, Vector2.Zero, type, damage, 0f, Main.myPlayer, death ? 2f : 1f); } } - NPC.ai[2] += (spazAlive && retAlive) ? 1f : 1.5f; - if (NPC.ai[2] >= 150f - (death ? 60f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) + if (NPC.velocity.Length() < maxVelocity) { - NPC.ai[1] = (!spazAlive || !retAlive || finalPhase) ? 4f : 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(NPC, options); - - NPC.netUpdate = true; + NPC.velocity *= 1.06f; + if (NPC.velocity.Length() > maxVelocity) + { + NPC.velocity.Normalize(); + NPC.velocity *= maxVelocity; + } } + + NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2; } - // Charge - else if (NPC.ai[1] == 2f) + // Charge 2 times + if (NPC.ai[2] >= chargeTime * 1.3f) { - // Set damage - NPC.damage = setDamage; + NPC.ai[3] += 1f; + NPC.ai[2] = 0f; - // Set rotation and velocity - NPC.rotation = foveanatorHoverRotation; - float foveanatorPhase3ChargeSpeed = 22f + (death ? 8f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - foveanatorPhase3ChargeSpeed += 10f * enrageScale; + NPC.rotation = hoverRotation; - if (!spazAlive || !retAlive) - foveanatorPhase3ChargeSpeed += 2f; - - if (Main.getGoodWorld) - foveanatorPhase3ChargeSpeed += 2f; - - Vector2 foveanatorPhase3ChargePos = NPC.Center; - float foveanatorPhase3ChargeTargetX = Main.player[NPC.target].Center.X - foveanatorPhase3ChargePos.X; - float foveanatorPhase3ChargeTargetY = Main.player[NPC.target].Center.Y - foveanatorPhase3ChargePos.Y; - float foveanatorPhase3ChargeTargetDist = (float)Math.Sqrt(foveanatorPhase3ChargeTargetX * foveanatorPhase3ChargeTargetX + foveanatorPhase3ChargeTargetY * foveanatorPhase3ChargeTargetY); - foveanatorPhase3ChargeTargetDist = foveanatorPhase3ChargeSpeed / foveanatorPhase3ChargeTargetDist; - NPC.velocity.X = foveanatorPhase3ChargeTargetX * foveanatorPhase3ChargeTargetDist; - NPC.velocity.Y = foveanatorPhase3ChargeTargetY * foveanatorPhase3ChargeTargetDist; - NPC.ai[1] = 3f; - } - - else if (NPC.ai[1] == 3f) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[2] += 1f; - - float chargeTime = (spazAlive && retAlive) ? 45f : 30f; - if (NPC.ai[3] % 3f == 0f) - chargeTime = (spazAlive && retAlive) ? 90f : 60f; - if (death) - chargeTime -= chargeTime * 0.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio); - chargeTime -= chargeTime / 5 * enrageScale; - - // Slow down - if (NPC.ai[2] >= chargeTime) + float maxCharges = 2f; + if (NPC.ai[3] >= maxCharges) { - // 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; + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; } else - { - NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + NPC.ai[1] = 1f; + } + } - if (NPC.ai[3] % 3f == 0f) - { - float fireRate = (spazAlive && retAlive) ? 13f : 9f; + // Laser and energy bomb barrage + else if (NPC.ai[1] == 3f) + { + float maxVelocity = 12f + (death ? 2.4f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float acceleration = 0.16f + (death ? 0.32f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + maxVelocity += 6f * enrageScale; + acceleration += 0.08f * enrageScale; - if (NPC.ai[2] % fireRate == 0f) - { - Vector2 foveanatorPhase3ChargeLaserPos = NPC.Center; - float foveanatorPhase3ChargeLaserTargetX = Main.player[NPC.target].Center.X - foveanatorPhase3ChargeLaserPos.X; - float foveanatorPhase3ChargeLaserTargetY = Main.player[NPC.target].Center.Y - foveanatorPhase3ChargeLaserPos.Y; - float foveanatorPhase3ChargeLaserTargetDist = (float)Math.Sqrt(foveanatorPhase3ChargeLaserTargetX * foveanatorPhase3ChargeLaserTargetX + foveanatorPhase3ChargeLaserTargetY * foveanatorPhase3ChargeLaserTargetY); - - 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 && retAlive) ? 1f : 1.5f); - foveanatorPhase3ChargeLaserPos = NPC.Center; - foveanatorPhase3ChargeLaserTargetX = Main.player[NPC.target].Center.X - foveanatorPhase3ChargeLaserPos.X; - foveanatorPhase3ChargeLaserTargetY = Main.player[NPC.target].Center.Y - foveanatorPhase3ChargeLaserPos.Y; - foveanatorPhase3ChargeLaserTargetDist = (float)Math.Sqrt(foveanatorPhase3ChargeLaserTargetX * foveanatorPhase3ChargeLaserTargetX + foveanatorPhase3ChargeLaserTargetY * foveanatorPhase3ChargeLaserTargetY); - foveanatorPhase3ChargeLaserTargetDist = laserDartVelocity / foveanatorPhase3ChargeLaserTargetDist; - foveanatorPhase3ChargeLaserTargetX *= foveanatorPhase3ChargeLaserTargetDist; - foveanatorPhase3ChargeLaserTargetY *= foveanatorPhase3ChargeLaserTargetDist; - - Vector2 laserVelocity = new Vector2(foveanatorPhase3ChargeLaserTargetX, foveanatorPhase3ChargeLaserTargetY); - Projectile.NewProjectile(NPC.GetSource_FromAI(), foveanatorPhase3ChargeLaserPos + 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 (Main.rand.NextBool() && NPC.ai[3] < ((spazAlive && retAlive) ? 1f : 3f)) - { - chargeIncrement = 2f; - - // Net update due to the randomness in Master Mode - NPC.netUpdate = true; - } - - NPC.ai[3] += chargeIncrement; - - NPC.rotation = foveanatorHoverRotation; - float maxChargeAmt = (spazAlive && retAlive) ? 2f : 4f; - if (NPC.ai[3] >= maxChargeAmt) - { - NPC.ai[1] = 0f; - NPC.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(NPC, options); - } - else - NPC.ai[1] = 4f; - } + if (Main.getGoodWorld) + { + maxVelocity *= 1.15f; + acceleration *= 1.15f; } - // Get in position for charge - else if (NPC.ai[1] == 4f) + float distanceFromTarget = 640f; + Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction; + float distanceFromDestination = (destination - NPC.Center).Length(); + Vector2 idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitX * direction); + + bool gettingIntoPosition = NPC.ai[2] == 0f; + if (NPC.Distance(Main.player[NPC.target].Center) < distanceFromTarget && gettingIntoPosition) { - // Avoid cheap bullshit - NPC.damage = 0; + NPC.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); + } + else + { + NPC.SimpleFlyMovement(idealVelocity * maxVelocity * 0.5f, acceleration * 0.5f); - int chargeLineUpDist = (spazAlive && retAlive) ? 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; + // Fire 2 spreads (3 in Death Mode) of energy bombs and lasers + int totalSpreads = death ? 6 : 4; - if (spazAlive && retAlive) - { - chargeSpeed *= 0.75f; - chargeAccel *= 0.75f; - } + // Fire rates + float laserBarrageFireRate = 45f; + float energyBombFireRate = 90f; - if (Main.getGoodWorld) - { - chargeSpeed *= 1.15f; - chargeAccel *= 1.15f; - } - - int foveanatorPhase2FaceDirection = 1; - if (NPC.Center.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width) - foveanatorPhase2FaceDirection = -1; - - Vector2 spazmatismRetDeadChargePos = NPC.Center; - float chargeTargetX = Main.player[NPC.target].Center.X + (chargeLineUpDist * foveanatorPhase2FaceDirection) - 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 && retAlive) ? 75f : 60f) - (death ? 20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) + + // Energy bombs + if (NPC.ai[2] % energyBombFireRate == 0f) { - NPC.ai[1] = 2f; + SoundEngine.PlaySound(AstrumDeusHead.LaserSound, 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 (CalamityServerConfig.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) * 16f; + int numProj = 3; + int spread = 30; + 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) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, death ? 1f : 0f); + } + } + + NPC.ai[3] += 1f; + } + + else if (NPC.ai[2] % laserBarrageFireRate == 0f) + { + SoundEngine.PlaySound(AstrumDeusHead.LaserSound, 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 (CalamityServerConfig.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 projectileSpeed = 8f + 2f * enrageScale; + Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; + int numProj = 4; + int spread = 40; + 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) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + + NPC.ai[3] += 1f; + } + + // Charge + if (NPC.ai[3] >= totalSpreads) + { + NPC.ai[1] = 1f; NPC.ai[2] = 0f; + NPC.ai[3] = 0f; NPC.netUpdate = true; } } @@ -1091,13 +902,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == -1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(TextureAssets.Npc[Type].Value, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f); + + Texture2D glowTexture = GlowTexture.Value; + spriteBatch.Draw(glowTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, Color.White, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f); return false; } @@ -1115,14 +927,14 @@ namespace CalamityMod.NPCs.NormalNPCs for (int i = 0; i < 150; i++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2 * hit.HitDirection, -2f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 2; i++) { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 2); - Gore.NewGore(NPC.GetSource_Death(), 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_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 9); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), Mod.Find("Foveanator2").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 2, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 9, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), Mod.Find("Foveanator2").Type, NPC.scale); } } @@ -1141,7 +953,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.dust[dust].velocity *= 3f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); Main.gore[gore].velocity *= 0.4f; diff --git a/NPCs/NormalNPCs/FoveanatorGlow.png b/NPCs/NormalNPCs/FoveanatorGlow.png new file mode 100644 index 0000000000..d8b3325658 Binary files /dev/null and b/NPCs/NormalNPCs/FoveanatorGlow.png differ diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index 2cabc312e1..3c4fe4c6f8 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; } public override void SetDefaults() @@ -23,10 +23,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 50; NPC.defense = 10; - NPC.lifeMax = 80; + NPC.lifeMax = 100; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.5f; @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.NormalNPCs return; } NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -139,7 +139,7 @@ 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) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Frogfish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Frogfish2").Type, 1f); diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 45b580ff0a..9d463af369 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.4f, @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.frameCounter++; if (NPC.frameCounter >= 8) { - NPC.frame.Y = (NPC.frame.Y + frameHeight) % (Main.npcFrameCount[NPC.type] * frameHeight); + NPC.frame.Y = (NPC.frame.Y + frameHeight) % (Main.npcFrameCount[Type] * frameHeight); NPC.frameCounter = 0; } } @@ -150,7 +150,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.dust[earthDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = NPC.Center; int goreAmt = 3; diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index fca3afe2b1..3bd82cae9d 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -65,12 +65,12 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Rotation = MathHelper.ToRadians(135); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.TrailingMode[NPC.type] = 0; - NPCID.Sets.TrailCacheLength[NPC.type] = 6; + NPCID.Sets.TrailingMode[Type] = 0; + NPCID.Sets.TrailCacheLength[Type] = 6; } public override void SetDefaults() @@ -81,12 +81,12 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 50; NPC.height = 50; NPC.defense = 12; - NPC.lifeMax = 500; + NPC.lifeMax = 750; NPC.knockBackResist = 0.25f; NPC.noTileCollide = true; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 25, 0); + NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath7; NPC.rarity = 2; @@ -275,7 +275,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += (isDashing) ? 0.4f : 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Frost, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("IceClasper").Type); Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("IceClasper2").Type); @@ -330,10 +330,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Vector2 position = NPC.Center - screenPos; - Vector2 origin = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - position -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + Vector2 origin = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); + position -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; position += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); // If the enemy is preparing to dash, it'll fade in afterimages. @@ -342,7 +342,7 @@ namespace CalamityMod.NPCs.NormalNPCs (MathHelper.Clamp(AITimer, 0f, TimeBeforeDash) / TimeBeforeDash); float AfterimageFade = MathHelper.Lerp(0f, 1f, interpolant); - if (CurrentState == IceClasperAIState.Dashing && CalamityConfig.Instance.Afterimages) + if (CurrentState == IceClasperAIState.Dashing && CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < NPC.oldPos.Length; i++) { diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index f7bbddab06..923a6e30ad 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -21,8 +21,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + Main.npcFrameCount[Type] = 4; + NPCID.Sets.NeedsExpertScaling[Type] = true; } public override void SetDefaults() @@ -248,14 +248,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += hasBeenHit ? 0.25f : 0.125f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity) + if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity || Main.pumpkinMoon || Main.snowMoon || Main.eclipse) { return 0f; } @@ -285,7 +285,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ImpiousImmolator").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ImpiousImmolator2").Type, 1f); diff --git a/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs b/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs index 74355553d6..18b6c3c052 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs @@ -1,10 +1,17 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Events; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; 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.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -12,9 +19,9 @@ namespace CalamityMod.NPCs.NormalNPCs { public class KingSlimeJewelEmerald : ModNPC { - public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel"; + public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald"; - private const int ChargePhaseGateValue = 90; + private const int ChargePhaseGateValue = 120; private const int ChargeGateValue = 60; private const int ChargeGateValue_Death = 40; private const float LightTelegraphDuration = 30f; @@ -30,8 +37,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.aiStyle = -1; AIType = -1; NPC.GetNPCDamage(); - NPC.width = 22; - NPC.height = 22; + NPC.width = 32; + NPC.height = 32; NPC.defense = 15; NPC.DR_NERD(0.15f); NPC.lifeMax = 240; @@ -49,7 +56,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (!CalamityPlayer.areThereAnyDamnBosses) { NPC.life = 0; - NPC.HitEffect(); + OnKill(); NPC.active = false; NPC.netUpdate = true; return; @@ -113,15 +120,20 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[0] = 2f; NPC.ai[1] = 0f; - - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } else if (NPC.ai[0] == 2f) { // Set damage NPC.damage = NPC.defDamage; + NPC.rotation += MathHelper.ToRadians(Math.Sign(NPC.velocity.X) * 15); + + CustomSprite spriteParticle = new CustomSprite(NPC.Center - NPC.velocity, NPC.velocity * 0.8f, 10, "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald", 1.2f, Color.DarkGreen.MultiplyRGBA(new Color(1f, 1f, 1f, 0f))); + spriteParticle.Rotation = NPC.rotation; + + GeneralParticleHandler.SpawnParticle(spriteParticle); + NPC.ai[1] += 1f; if (NPC.ai[1] >= (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue)) { @@ -216,19 +228,44 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override Color? GetAlpha(Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Color initialColor = new Color(100, 175, 100); - Color newColor = initialColor; - Color finalColor = new Color(150, 255, 150); - 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); + Color col = Color.DarkOliveGreen; + Color flashCol = Color.Lime; - return newColor; + float alph = 0f; + + float colorTelegraphGateValue = (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue) - LightTelegraphDuration; + + if (NPC.ai[0] > colorTelegraphGateValue) + alph = MathHelper.Lerp(0f, 1f, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); + + Asset tex = ModContent.Request(Texture); + Asset tex2 = ModContent.Request("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash"); + + Main.EntitySpriteDraw(tex.Value, NPC.Center - screenPos, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex2.Value, NPC.Center - screenPos, tex2.Frame(), Color.Lerp(col, flashCol, alph).MultiplyRGBA(new Color(alph, alph, alph, 0f)), NPC.rotation, tex2.Frame().Center(), alph * 1.2f, SpriteEffects.None); + + return false; } + public override void OnKill() + { + for (int i = 0; i < 6; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.DarkSeaGreen)); + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Lime)); + } + + float start = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 3; i++) + GeneralParticleHandler.SpawnParticle(new CustomSprite(NPC.Center, new Vector2(0, -2).RotatedByRandom(start + MathHelper.ToRadians(20f)).RotatedBy(MathHelper.ToRadians(i * 125)), 120, "CalamityMod/Particles/KingSlimeEmeraldShards", 1f, new Color(255, 255, 255), Main.rand.NextFloat(0.2f, 0.6f), frameCount: 3, frame: i)); + + SoundEngine.PlaySound(KingSlimeJewelRuby.ShatterSound, NPC.Center); + } + + public override Color? GetAlpha(Color drawColor) => Color.White; + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * balance); diff --git a/NPCs/NormalNPCs/KingSlimeJewelEmerald.png b/NPCs/NormalNPCs/KingSlimeJewelEmerald.png new file mode 100644 index 0000000000..ce97f974b7 Binary files /dev/null and b/NPCs/NormalNPCs/KingSlimeJewelEmerald.png differ diff --git a/NPCs/NormalNPCs/KingSlimeJewelFlash.png b/NPCs/NormalNPCs/KingSlimeJewelFlash.png new file mode 100644 index 0000000000..86950b1323 Binary files /dev/null and b/NPCs/NormalNPCs/KingSlimeJewelFlash.png differ diff --git a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs index 4124af61d1..9a644aa5ae 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs @@ -1,18 +1,27 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using CalamityMod.CalPlayer; using CalamityMod.Events; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; 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.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using static System.Net.Mime.MediaTypeNames; namespace CalamityMod.NPCs.NormalNPCs { public class KingSlimeJewelRuby : ModNPC { - public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel"; + public static readonly SoundStyle ShatterSound = new SoundStyle("CalamityMod/Sounds/NPCKilled/CrownJewelShatter"); + public static readonly SoundStyle ShootSound = new SoundStyle("CalamityMod/Sounds/Custom/RedJewelFire"); private const int BoltShootGateValue = 60; private const int BoltShootGateValue_Death = 75; @@ -21,7 +30,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); } @@ -31,8 +40,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.aiStyle = -1; AIType = -1; NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats - NPC.width = 22; - NPC.height = 22; + NPC.width = 32; + NPC.height = 32; NPC.defense = 10; NPC.DR_NERD(0.1f); NPC.lifeMax = 120; @@ -46,11 +55,12 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { + // Despawn if (!CalamityPlayer.areThereAnyDamnBosses) { NPC.life = 0; - NPC.HitEffect(); + OnKill(); NPC.active = false; NPC.netUpdate = true; return; @@ -131,21 +141,13 @@ namespace CalamityMod.NPCs.NormalNPCs projVector.X *= projLength; projVector.Y *= projLength; - for (int dusty = 0; dusty < 10; dusty++) + for (int i = 0; i < 6; i++) { - Vector2 dustVel = projVector; - dustVel.Normalize(); - 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()) - { - Main.dust[ruby].scale = 0.5f; - Main.dust[ruby].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Pink)); } - SoundEngine.PlaySound(SoundID.Item8, NPC.Center); + SoundEngine.PlaySound(ShootSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -168,19 +170,44 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override Color? GetAlpha(Color drawColor) + public override void OnKill() { - Color initialColor = new Color(175, 100, 100); - Color newColor = initialColor; - Color finalColor = new Color(255, 150, 150); - 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); - newColor.A = (byte)(255 * NPC.Opacity); + for (int i = 0; i < 6; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Pink)); + } - return newColor; + float start = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 3; i++) + GeneralParticleHandler.SpawnParticle(new CustomSprite(NPC.Center, new Vector2(0, -2).RotatedByRandom(start + MathHelper.ToRadians(20f)).RotatedBy(MathHelper.ToRadians(i * 125)), 120, "CalamityMod/Particles/KingSlimeRubyShards", 1f, new Color(255, 255, 255), Main.rand.NextFloat(0.2f, 0.6f), frameCount: 3, frame: i)); + + SoundEngine.PlaySound(ShatterSound, NPC.Center); } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Color col = Color.Red; + Color flashCol = Color.Pink; + + float alph = 0f; + + float colorTelegraphGateValue = (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : (CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue)) - LightTelegraphDuration; + + if (NPC.ai[0] > colorTelegraphGateValue) + alph = MathHelper.Lerp(0f, 1f, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); + + Asset tex = ModContent.Request(Texture); + Asset tex2 = ModContent.Request("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash"); + + Main.EntitySpriteDraw(tex.Value, NPC.Center - screenPos, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex2.Value, NPC.Center - screenPos, tex2.Frame(), Color.Lerp(col, flashCol, alph).MultiplyRGBA(new Color(alph, alph, alph, 0f)), NPC.rotation, tex2.Frame().Center(), alph * 1.2f, SpriteEffects.None); + + return false; + } + + public override Color? GetAlpha(Color drawColor) => Color.White; + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * balance); @@ -190,38 +217,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(NPC.HitInfo hit) { - 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 = 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.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(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(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 2f); - Main.dust[rubyDust2].noGravity = true; - Main.dust[rubyDust2].velocity *= 2f; - } - } + for (int i = 0; i < 6; i++) + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); } } } diff --git a/NPCs/NormalNPCs/KingSlimeJewelRuby.png b/NPCs/NormalNPCs/KingSlimeJewelRuby.png new file mode 100644 index 0000000000..f94f29c1af Binary files /dev/null and b/NPCs/NormalNPCs/KingSlimeJewelRuby.png differ diff --git a/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs b/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs index 01939954f6..fc02f5133c 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs @@ -1,11 +1,17 @@ using System; +using System.Collections.Generic; using CalamityMod.CalPlayer; using CalamityMod.Events; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; 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.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -13,14 +19,12 @@ namespace CalamityMod.NPCs.NormalNPCs { public class KingSlimeJewelSapphire : 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.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); } @@ -30,8 +34,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.aiStyle = -1; AIType = -1; NPC.damage = 0; - NPC.width = 22; - NPC.height = 22; + NPC.width = 32; + NPC.height = 32; NPC.defense = 5; NPC.DR_NERD(0.05f); NPC.lifeMax = 120; @@ -49,7 +53,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (!CalamityPlayer.areThereAnyDamnBosses) { NPC.life = 0; - NPC.HitEffect(); + OnKill(); NPC.active = false; NPC.netUpdate = true; return; @@ -184,6 +188,24 @@ namespace CalamityMod.NPCs.NormalNPCs } } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Color col = Color.BlueViolet; + Color flashCol = Color.LightSkyBlue; + + NPC.localAI[1]++; + + float alph = 0.4f + (float)(Math.Sin(NPC.localAI[1] / 30f) * 0.4f); + + Asset tex = ModContent.Request(Texture); + Asset tex2 = ModContent.Request("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash"); + + Main.EntitySpriteDraw(tex.Value, NPC.Center - screenPos, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex2.Value, NPC.Center - screenPos, tex2.Frame(), Color.Lerp(col, flashCol, alph).MultiplyRGBA(new Color(alph, alph, alph, 0f)), NPC.rotation, tex2.Frame().Center(), alph * 1.2f, SpriteEffects.None); + + return false; + } + public override Color? GetAlpha(Color drawColor) { Color initialColor = new Color(100, 100, 175); @@ -202,6 +224,21 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = (int)(NPC.lifeMax * balance); } + public override void OnKill() + { + for (int i = 0; i < 6; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.BlueViolet)); + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.LightSkyBlue)); + } + + float start = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 3; i++) + GeneralParticleHandler.SpawnParticle(new CustomSprite(NPC.Center, new Vector2(0, -2).RotatedByRandom(start + MathHelper.ToRadians(20f)).RotatedBy(MathHelper.ToRadians(i * 125)), 120, "CalamityMod/Particles/KingSlimeSapphireShards", 1f, new Color(255, 255, 255), Main.rand.NextFloat(0.2f, 0.6f), frameCount: 3, frame: i)); + + SoundEngine.PlaySound(KingSlimeJewelRuby.ShatterSound, NPC.Center); + } + public override bool CheckActive() => false; public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/KingSlimeJewelSapphire.png b/NPCs/NormalNPCs/KingSlimeJewelSapphire.png new file mode 100644 index 0000000000..275d2722fa Binary files /dev/null and b/NPCs/NormalNPCs/KingSlimeJewelSapphire.png differ diff --git a/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs b/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs index ca5764da80..38cd0a6c25 100644 --- a/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs +++ b/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs @@ -10,7 +10,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; this.HideFromBestiary(); } diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 15eb09e912..5dd4b71209 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -14,7 +14,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 24; NPC.defense = 10; NPC.DR_NERD(0.1f); - NPC.lifeMax = 30; + NPC.lifeMax = 50; NPC.aiStyle = NPCAIStyleID.Fighter; AIType = NPCID.Crab; NPC.value = Item.buyPrice(0, 0, 1, 0); @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -139,7 +139,7 @@ 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) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MantisShrimp").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MantisShrimp2").Type, 1f); diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 0c9fe9bb28..737a0269d0 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -18,7 +18,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 14; + Main.npcFrameCount[Type] = 14; } public override void SetDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 40; NPC.defense = 18; NPC.DR_NERD(0.15f); - NPC.lifeMax = NPC.downedMoonlord ? 1350 : 135; + NPC.lifeMax = NPC.downedMoonlord ? 1700 : 170; NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit2; @@ -300,7 +300,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[3] = (float)backUpTimer; NPC.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenDoor) + if (Main.dedServ & canOpenDoor) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 0, (float)doorCheckX, (float)(doorCheckY - 1), (float)NPC.direction, 0, 0, 0); } @@ -313,7 +313,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[3] = (float)backUpTimer; NPC.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenTallGate) + if (Main.dedServ & canOpenTallGate) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 4, (float)doorCheckX, (float)(doorCheckY - 1), 0f, 0, 0, 0); } diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index a4027c898b..eb62be6480 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -5,13 +5,14 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class PerennialSlime : ModNPC { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; } public override void SetDefaults() @@ -22,10 +23,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 30; NPC.defense = 12; - NPC.lifeMax = 150; + NPC.lifeMax = 225; NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -68,7 +69,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(NPC.HitInfo hit) { - // TODO -- This dust was an invalid dust. Replaced with a random dust. int dustType = 115; for (int k = 0; k < 5; k++) { diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 9f81e50f1d..1f94654c10 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -14,7 +14,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 3; + Main.npcFrameCount[Type] = 3; } public override void SetDefaults() @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 16; NPC.height = 16; NPC.defense = 10; - NPC.lifeMax = 1000; + NPC.lifeMax = 1250; NPC.knockBackResist = 0.2f; AnimationType = NPCID.DungeonSpirit; AIType = -1; diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index b6edcf000f..2f7849b747 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PhantomSpirit.DisplayName"); public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.scale *= 1.2f; NPC.defense = 30; - NPC.lifeMax = 3000; + NPC.lifeMax = 3750; NPC.knockBackResist = 0.1f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 60, 0); @@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index a018061991..5d35236eba 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PhantomSpirit.DisplayName"); public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.scale *= 1.1f; NPC.defense = 25; - NPC.lifeMax = 2000; + NPC.lifeMax = 2500; NPC.knockBackResist = 0.15f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 40, 0); @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 7d375805c5..9608b72321 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PhantomSpirit.DisplayName"); public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 32; NPC.height = 80; NPC.defense = 20; - NPC.lifeMax = 1500; + NPC.lifeMax = 1875; NPC.knockBackResist = 0.2f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 30, 0); @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index c92aebd1e2..4b2106e519 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -12,9 +12,9 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; - Main.npcCatchable[NPC.type] = true; - NPCID.Sets.CountsAsCritter[NPC.type] = true; + Main.npcFrameCount[Type] = 5; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.frame.Y = NPC.frame.Y + frameHeight; NPC.frameCounter = 0.0; } - if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type] - 1) + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type] - 1) { NPC.frame.Y = frameHeight; } diff --git a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs index b5619abceb..1feaea149e 100644 --- a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs +++ b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); } @@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.frame.Y += frameHeight; NPC.frameCounter = 0.0; } - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) NPC.frame.Y = 0; } @@ -101,6 +101,8 @@ namespace CalamityMod.NPCs.NormalNPCs // If vomited out during Master Mode, maintain velocity until a certain time has passed if (NPC.ai[0] > 0f) { + NPC.knockBackResist = 0f; + NPC.ai[0] -= 1f; if (NPC.velocity.Length() < NPC.ai[1]) @@ -127,63 +129,19 @@ namespace CalamityMod.NPCs.NormalNPCs return; } + NPC.knockBackResist = 0.4f; + // Velocity and acceleration - 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; + Vector2 idealVelocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (death ? 7f : 5.5f); + float acceleration = death ? 0.14f : 0.105f; if (Main.getGoodWorld) { idealVelocity *= 1.2f; - accelerationX *= 1.4f; - accelerationY *= 1.4f; + acceleration *= 1.4f; } - if (NPC.direction == -1 && NPC.velocity.X > -idealVelocity.X) - { - NPC.velocity.X -= accelerationX; - if (NPC.velocity.X > idealVelocity.X) - NPC.velocity.X -= accelerationX; - else if (NPC.velocity.X > 0f) - NPC.velocity.X -= accelerationX * 2f; - - if (NPC.velocity.X < -idealVelocity.X) - NPC.velocity.X = -idealVelocity.X; - } - else if (NPC.direction == 1 && NPC.velocity.X < idealVelocity.X) - { - NPC.velocity.X += accelerationX; - if (NPC.velocity.X < -idealVelocity.X) - NPC.velocity.X += accelerationX; - else if (NPC.velocity.X < 0f) - NPC.velocity.X += accelerationX * 2f; - - if (NPC.velocity.X > idealVelocity.X) - NPC.velocity.X = idealVelocity.X; - } - - if (NPC.directionY == -1 && (double)NPC.velocity.Y > -idealVelocity.Y) - { - NPC.velocity.Y -= accelerationY - 0.02f; - if ((double)NPC.velocity.Y > idealVelocity.Y) - NPC.velocity.Y -= accelerationY; - else if (NPC.velocity.Y > 0f) - NPC.velocity.Y -= accelerationY * 2.5f; - - if ((double)NPC.velocity.Y < -idealVelocity.Y) - NPC.velocity.Y = -idealVelocity.Y; - } - else if (NPC.directionY == 1 && (double)NPC.velocity.Y < idealVelocity.Y * 0.6f) - { - NPC.velocity.Y += accelerationY - 0.02f; - if ((double)NPC.velocity.Y < -idealVelocity.Y) - NPC.velocity.Y += accelerationY; - else if (NPC.velocity.Y < 0f) - NPC.velocity.Y += accelerationY * 2.5f; - - if ((double)NPC.velocity.Y > idealVelocity.Y) - NPC.velocity.Y = idealVelocity.Y; - } + NPC.SimpleFlyMovement(idealVelocity, acceleration); if (NPC.wet) { @@ -254,7 +212,7 @@ namespace CalamityMod.NPCs.NormalNPCs for (int i = 0; i < 150; i++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Plantera_Green, 2 * hit.HitDirection, -2f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), new Vector2(NPC.position.X + (float)Main.rand.Next(NPC.width), NPC.position.Y + (float)Main.rand.Next(NPC.height)), NPC.velocity, 388, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), new Vector2(NPC.position.X + (float)Main.rand.Next(NPC.width), NPC.position.Y + (float)Main.rand.Next(NPC.height)), NPC.velocity, 389, NPC.scale); diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index d5f9bc16ec..31fd92aaa5 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.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; 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 @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity || (!spawnInfo.Player.ZoneUnderworldHeight && !spawnInfo.Player.ZoneHallow)) + if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity || (!spawnInfo.Player.ZoneUnderworldHeight && !spawnInfo.Player.ZoneHallow) || Main.pumpkinMoon || Main.snowMoon || Main.eclipse) return 0f; // Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly. @@ -105,7 +105,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedEnergyBody").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedEnergyBody2").Type, 1f); diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index 96f0ffcbf5..e1a3df77e2 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -20,11 +21,12 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; if (!Main.dedServ) { ChainTexture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment", AssetRequestMode.AsyncLoad); } + NPCID.Sets.PositiveNPCTypesExcludedFromDeathTally[Type] = true; // You can't kill this thing but just in case anyway } public override void SetDefaults() @@ -42,6 +44,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.dontTakeDamage = true; NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); } public override void AI() @@ -193,7 +197,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index 62242cd86d..4fb5748983 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 9; + Main.npcFrameCount[Type] = 9; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.7f, @@ -38,17 +38,17 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 56; NPC.height = 56; NPC.defense = 4; - NPC.lifeMax = 50; + NPC.lifeMax = 65; if (DownedBossSystem.downedCryogen) { NPC.damage = 60; NPC.defense = 10; - NPC.lifeMax = 1000; + NPC.lifeMax = 1250; } NPC.knockBackResist = 0.3f; AnimationType = NPCID.Hellhound; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 3, 0); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = HitSound; NPC.DeathSound = SoundID.NPCDeath5; Banner = NPC.type; @@ -171,7 +171,7 @@ 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) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AngryDog").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AngryDog2").Type, 1f); diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index 4e800c0d76..c27214493c 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -12,7 +12,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 10; + Main.npcFrameCount[Type] = 10; } public override void SetDefaults() @@ -22,10 +22,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 46; NPC.height = 30; NPC.defense = 4; - NPC.lifeMax = 60; + NPC.lifeMax = 75; NPC.knockBackResist = 0.3f; AIType = NPCID.Wolf; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(0, 0, 1, 50); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath5; Banner = NPC.type; @@ -124,7 +124,7 @@ 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) + if (!Main.dedServ) { 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); diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 477c6cd292..595c902888 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.4f, @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.knockBackResist = 0.1f; AIType = -1; NPC.lavaImmune = true; - NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.value = Item.buyPrice(0, 0, 75, 0); NPC.DeathSound = DeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -189,7 +189,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity) + if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity || Main.pumpkinMoon || Main.snowMoon || Main.eclipse) { return 0f; } @@ -223,7 +223,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScornEater").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScornEater2").Type, 1f); diff --git a/NPCs/NormalNPCs/SeaUrchin.cs b/NPCs/NormalNPCs/SeaUrchin.cs deleted file mode 100644 index b031da27b0..0000000000 --- a/NPCs/NormalNPCs/SeaUrchin.cs +++ /dev/null @@ -1,86 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; -using Terraria; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class SeaUrchin : ModNPC - { - public override void SetDefaults() - { - NPC.aiStyle = -1; - AIType = -1; - NPC.damage = 20; - NPC.width = 40; - NPC.height = 40; - NPC.defense = 10; - NPC.lifeMax = 30; - NPC.knockBackResist = 0.8f; - NPC.value = Item.buyPrice(0, 0, 0, 80); - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath15; - NPC.behindTiles = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - 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[] - { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaUrchin") - }); - } - - public override void AI() - { - 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) - { - if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Venom, 120, true); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OceanMonster.Chance * 0.2f; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 30, 50); - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - 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 < 20; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - } - } - } -} diff --git a/NPCs/NormalNPCs/SeaUrchin.png b/NPCs/NormalNPCs/SeaUrchin.png deleted file mode 100644 index 5123ef7337..0000000000 Binary files a/NPCs/NormalNPCs/SeaUrchin.png and /dev/null differ diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 6c011593df..c41c3b21dc 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -17,8 +17,8 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + Main.npcFrameCount[Type] = 4; + NPCID.Sets.NeedsExpertScaling[Type] = true; } public override void SetDefaults() @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 38; NPC.defense = 15; NPC.DR_NERD(0.15f); - NPC.lifeMax = 150; + NPC.lifeMax = 190; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0.5f; @@ -376,7 +376,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -393,7 +393,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BoneTorch, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ShockstormShuttle").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ShockstormShuttle2").Type, 1f); @@ -415,7 +415,6 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.AddIf(() => NPC.downedGolemBoss, ItemID.MartianConduitPlating, 1, 10, 30); npcLoot.Add(ModContent.ItemType(), 2); - npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType(), (DateTime.Now.Day == 21 && DateTime.Now.Month == 8) ? 9 : 20); var postML = npcLoot.DefineConditionalDropSet(() => NPC.downedMoonlord); postML.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 12, 11, 16)); diff --git a/NPCs/NormalNPCs/Shroomble.cs b/NPCs/NormalNPCs/Shroomble.cs new file mode 100644 index 0000000000..4e9f5de5f8 --- /dev/null +++ b/NPCs/NormalNPCs/Shroomble.cs @@ -0,0 +1,190 @@ +using System; +using System.Numerics; +using CalamityMod.Items.Critters; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.NormalNPCs +{ + public class Shroomble : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 8; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + SpriteDirection = 1 + }; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.CantTakeLunchMoney[Type] = true; + } + + public override void SetDefaults() + { + NPC.chaseable = false; + NPC.damage = 0; + NPC.width = 28; + NPC.height = 24; + NPC.lifeMax = 25; // This is how much Mushrooms heal with Calamity + NPC.aiStyle = NPCAIStyleID.Passive; + AIType = NPCID.Squirrel; + NPC.knockBackResist = 0.5f; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.catchItem = (short)ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + } + + public override void AI() + { + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (player is null || !player.active) + continue; + + if (NPC.Hitbox.Intersects(player.HitboxForBestiaryNearbyCheck)) + { + Main.BestiaryTracker.Kills.RegisterKill(NPC); + break; + } + } + bool walking = NPC.ai[0] == 1; + // Do a cute lil' hop randomly + int jumpChance = walking ? 600 : 100; + if (NPC.velocity.Y == 0 && Main.rand.NextBool(jumpChance) && NPC.ai[2] <= 0) + { + SoundEngine.PlaySound(HarvestStaffMinion.JumpSound, NPC.Center); + NPC.velocity.Y = Main.rand.NextFloat(-6, -4); + // Cooldown + NPC.ai[2] = walking ? 180 : 90; + // Ai[1] is time left for a NPCAIStyleID.Passive critter to cycle between standing still and walking + // Increment it here so that it doesn't suddenly start walking when doing it's baby hop + NPC.ai[1] += 60; + } + + // Randomly look around while standing still + if (!walking && Main.rand.NextBool(200) && NPC.velocity.Y == 0) + { + NPC.direction *= -1; + } + + // Decrement cooldown + if (NPC.ai[2] > 0) + { + NPC.ai[2]--; + } + // Don't idle for too long + if (NPC.ai[1] > 300) + { + NPC.ai[1] = 300; + } + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Shroomble") + }); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDay.Chance) * 0.1f; + } + + public override void FindFrame(int frameHeight) + { + if (NPC.velocity.Y == 0f) + { + if (!NPC.IsABestiaryIconDummy) + { + if (NPC.direction == 1) + { + NPC.spriteDirection = -1; + } + if (NPC.direction == -1) + { + NPC.spriteDirection = 1; + } + + if (NPC.velocity.X == 0f) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0.0; + return; + } + } + NPC.frameCounter += NPC.IsABestiaryIconDummy ? 0.6f : Math.Abs(NPC.velocity.X) * 0.5f; + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) + { + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + } + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type] - 1) + { + NPC.frame.Y = frameHeight; + } + } + else + { + NPC.frameCounter = 0.0; + NPC.frame.Y = frameHeight * (Main.npcFrameCount[Type] - 1); + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Mushroom, 1, 1, 4); + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Pixie, hit.HitDirection * 0.5f, -0.5f, 0, default, 0.5f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Pixie, hit.HitDirection * 0.5f, -0.5f, 0, default, 0.5f); + } + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Shroomble").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Shroomble2").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Shroomble3").Type); + } + } + } + + public override Color? GetAlpha(Color drawColor) + { + // Psychedelic in gfb + if (Main.zenithWorld) + { + Color lightColor = new Color(Main.DiscoR, Main.DiscoB, Main.DiscoG, drawColor.A); + return lightColor * NPC.Opacity; + } + else return null; + } + } +} diff --git a/NPCs/NormalNPCs/Shroomble.png b/NPCs/NormalNPCs/Shroomble.png new file mode 100644 index 0000000000..d459a2529a Binary files /dev/null and b/NPCs/NormalNPCs/Shroomble.png differ diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs index 60d0a2d6ad..dcbd25f0ae 100644 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -19,6 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { + [AutoloadBossHead] public class SkeletronPrime2 : ModNPC { public override string BossHeadTexture => $"Terraria/Images/NPC_Head_Boss_18"; @@ -29,7 +30,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); if (!Main.dedServ) @@ -58,7 +59,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.noGravity = true; NPC.noTileCollide = true; NPC.boss = true; - NPC.value = 200000f; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToElectricity = true; @@ -225,7 +225,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.npc[spazmatism].localAI[3] = 1f; Main.npc[spazmatism].SyncVanillaLocalAI(); string typeName = Main.npc[spazmatism].TypeName; - if (Main.netMode == NetmodeID.Server && spazmatism < Main.maxNPCs) + if (Main.dedServ && spazmatism < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, spazmatism); AchievementsHelper.CheckMechaMayhem(); @@ -290,7 +290,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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 && + bool shouldSpinAround = NPC.ai[1] == 4f && NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - 320f && 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; bool shouldCharge = !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode; @@ -319,22 +319,22 @@ namespace CalamityMod.NPCs.NormalNPCs else NPC.rotation = NPC.velocity.X / 15f; - float acceleration = (bossRush ? 0.2f : 0.125f) + (death ? 0.05f * (1f - lifeRatio) : 0f); + float acceleration = (bossRush ? 0.16f : 0.12f) + (death ? 0.05f * (1f - lifeRatio) : 0f); float accelerationMult = 1f; if (!cannonAlive) { - acceleration += 0.025f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!laserAlive) { - acceleration += 0.025f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!viceAlive) - acceleration += 0.025f; + acceleration += 0.0125f; if (!sawAlive) - acceleration += 0.025f; + acceleration += 0.0125f; acceleration *= accelerationMult; float topVelocity = acceleration * 100f; @@ -351,7 +351,7 @@ namespace CalamityMod.NPCs.NormalNPCs headDecelerationDownDist = 50f; } - if (NPC.position.Y > Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (400f + headDecelerationUpDist)) + if (NPC.position.Y > Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (320f + headDecelerationUpDist)) { if (NPC.velocity.Y > 0f) NPC.velocity.Y *= deceleration; @@ -361,7 +361,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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)) + else if (NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (360f + headDecelerationDownDist)) { if (NPC.velocity.Y < 0f) NPC.velocity.Y *= deceleration; @@ -417,7 +417,7 @@ namespace CalamityMod.NPCs.NormalNPCs int damage = NPC.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -682,7 +682,7 @@ namespace CalamityMod.NPCs.NormalNPCs int damage = NPC.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -725,10 +725,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.rotation = NPC.velocity.X / 15f; - float flightVelocity = bossRush ? 32f : death ? 28f : 24f; - float flightAcceleration = bossRush ? 1.28f : death ? 1.12f : 0.96f; + float flightVelocity = bossRush ? 28f : death ? 25f : 22f; + float flightAcceleration = bossRush ? 1.16f : death ? 0.96f : 0.76f; - 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); + 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 - 420f); NPC.SimpleFlyMovement((destination - NPC.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration); // Spit bombs and then go to floating phase @@ -750,7 +750,7 @@ namespace CalamityMod.NPCs.NormalNPCs int damage = NPC.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -875,52 +875,46 @@ namespace CalamityMod.NPCs.NormalNPCs { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, 149); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, 150); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkeletronPrime2_1").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkeletronPrime2_2").Type, NPC.scale); - 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; + int gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].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; + gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].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; + gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].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; + gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].velocity.Y -= 1f; } - for (int num798 = 0; num798 < 10; num798++) + for (int i = 0; i < 10; i++) { - 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; + 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 num800 = 0; num800 < 5; num800++) + for (int i = 0; i < 5; i++) { - 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; + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 2.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + + dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[dust].velocity *= 3f; } } } diff --git a/NPCs/NormalNPCs/SkeletronPrime2_Head_Boss.png b/NPCs/NormalNPCs/SkeletronPrime2_Head_Boss.png new file mode 100644 index 0000000000..38362cb253 Binary files /dev/null and b/NPCs/NormalNPCs/SkeletronPrime2_Head_Boss.png differ diff --git a/NPCs/NormalNPCs/Stormlion.cs b/NPCs/NormalNPCs/Stormlion.cs index e3ce948f29..7a00d1fa3a 100644 --- a/NPCs/NormalNPCs/Stormlion.cs +++ b/NPCs/NormalNPCs/Stormlion.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/StormlionDeath"); public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 33; NPC.height = 31; NPC.defense = 8; - NPC.lifeMax = 80; + NPC.lifeMax = 100; NPC.knockBackResist = 0.2f; AnimationType = NPCID.WalkingAntlion; NPC.value = Item.buyPrice(0, 0, 2, 0); @@ -74,7 +74,7 @@ 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) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Stormlion").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Stormlion2").Type, NPC.scale); diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 055a41c4e5..f4776d4331 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; } public override void SetDefaults() @@ -34,10 +34,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 58; NPC.height = 22; NPC.defense = 4; - NPC.lifeMax = 100; + NPC.lifeMax = 125; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(0, 0, 3, 0); NPC.HitSound = SoundID.NPCHit50; NPC.DeathSound = Main.zenithWorld ? AresGaussNuke.NukeExplosionSound : DeathSound; NPC.knockBackResist = 0.7f; @@ -211,7 +211,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter += hasBeenHit ? 0.15f : 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/NormalNPCs/SuperDummyNPC.cs b/NPCs/NormalNPCs/SuperDummyNPC.cs index d263335bc5..f5a06984a4 100644 --- a/NPCs/NormalNPCs/SuperDummyNPC.cs +++ b/NPCs/NormalNPCs/SuperDummyNPC.cs @@ -1,8 +1,8 @@ using System.IO; using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,10 +11,11 @@ namespace CalamityMod.NPCs.NormalNPCs public class SuperDummyNPC : ModNPC { public int deathCounter = 0; + public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 11; + Main.npcFrameCount[Type] = 11; NPCID.Sets.CantTakeLunchMoney[Type] = true; } @@ -25,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = 0; NPC.defense = 0; NPC.lifeMax = 9999999; - NPC.HitSound = SoundID.NPCHit15; + NPC.HitSound = null; NPC.DeathSound = SoundID.NPCDeath2; NPC.value = 0f; NPC.knockBackResist = 0f; @@ -71,51 +72,64 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(NPC.HitInfo hit) { // Dummy AI, no way - NPC.ai[0] = hit.HitDirection * -NPC.direction; + NPC.localAI[0] = (int)hit.Damage; + if (NPC.localAI[0] < 20f) + { + NPC.localAI[0] = 20f; + } + if (NPC.localAI[0] > 120f) + { + NPC.localAI[0] = 120f; + } + NPC.localAI[1] = hit.HitDirection; // Reset hit timer if it isn't enraged if (deathCounter > 0 && deathCounter < 6000) { deathCounter = 0; } + SoundStyle toPlay = Main.rand.Next(3) switch + { + 0 => SoundID.NPCHit15, + 1 => SoundID.NPCHit16, + 2 => SoundID.NPCHit17, + _ => SoundID.NPCHit15 + }; + if (NPC.soundDelay <= 0) + { + SoundEngine.PlaySound(toPlay, NPC.Center); + } } public override void FindFrame(int frameHeight) { - // Start animating when hit. Continue animating as long as the animation isn't finished - if (NPC.justHit || NPC.frameCounter > 0 || (NPC.frame.Y != 0 && NPC.frame.Y != frameHeight * 4)) + int hitDirection = (int)NPC.localAI[1]; + if (NPC.direction == 1) { - NPC.frameCounter += 1.0; + hitDirection *= -1; } - if (NPC.frameCounter > 6.0) + if (NPC.localAI[0] > 24f) { - NPC.frameCounter = 0.0; - NPC.frame.Y += frameHeight; + NPC.localAI[0] = 24f; } - - // Hit from behind - if (NPC.ai[0] == -1 || deathCounter > 6000) + if (NPC.localAI[0] > 0f) { - 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; - } + NPC.localAI[0] -= 1f; } - // Hit from in front - else + if (NPC.localAI[0] < 0f) { - if (NPC.justHit && NPC.frame.Y > frameHeight * 7) - { - NPC.frame.Y = frameHeight * 5; - } - else if (NPC.frame.Y > frameHeight * 10 || NPC.frame.Y < frameHeight * 4) - { - NPC.frame.Y = frameHeight * 4; - } + NPC.localAI[0] = 0f; } + int animationSpeed = ((hitDirection == -1) ? 4 : 6); + int currentFrame = (int)NPC.localAI[0] / animationSpeed; + if (NPC.localAI[0] % (float)animationSpeed != 0f) + { + currentFrame++; + } + if (currentFrame != 0 && hitDirection == 1) + { + currentFrame += 5; + } + NPC.frame.Y = currentFrame * frameHeight; } public override bool CheckDead() diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs index 8421f495ff..b0be162495 100644 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ b/NPCs/NormalNPCs/WildBumblefuck.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; @@ -19,8 +20,8 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 5; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Position = Vector2.UnitX * 36f @@ -46,6 +47,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.noGravity = true; NPC.HitSound = SoundID.NPCHit51; NPC.DeathSound = SoundID.NPCDeath46; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; @@ -125,11 +128,11 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -138,14 +141,14 @@ namespace CalamityMod.NPCs.NormalNPCs afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); diff --git a/NPCs/NormalNPCs/WulfrumAmplifier.cs b/NPCs/NormalNPCs/WulfrumAmplifier.cs index 24b60695c5..80a086b0d8 100644 --- a/NPCs/NormalNPCs/WulfrumAmplifier.cs +++ b/NPCs/NormalNPCs/WulfrumAmplifier.cs @@ -7,6 +7,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -16,6 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public class WulfrumAmplifier : ModNPC { + public static readonly SoundStyle Hit = new("CalamityMod/Sounds/NPCHit/WulfrumHit", 3); public bool Charging { get => NPC.ai[0] != 0f; @@ -32,8 +34,8 @@ namespace CalamityMod.NPCs.NormalNPCs public int laserDelay = 150; public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.NeedsExpertScaling[Type] = true; + Main.npcFrameCount[Type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -49,12 +51,12 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 44; NPC.defense = 4; - NPC.lifeMax = Main.zenithWorld ? 72 : 46; + NPC.lifeMax = Main.zenithWorld ? 90 : 58; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 1, 50); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.noGravity = false; NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit4; + NPC.HitSound = Hit; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -205,7 +207,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter++; - int frame = (int)(NPC.frameCounter / 8) % Main.npcFrameCount[NPC.type]; + int frame = (int)(NPC.frameCounter / 8) % Main.npcFrameCount[Type]; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index e3d97d8ecd..58beddcec3 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -54,7 +54,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -70,12 +70,12 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 32; NPC.height = 32; NPC.defense = 4; - NPC.lifeMax = 21; + NPC.lifeMax = 27; NPC.knockBackResist = 0.35f; - NPC.value = Item.buyPrice(0, 0, 1, 20); + NPC.value = Item.buyPrice(0, 0, 0, 80); NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit4; + NPC.HitSound = WulfrumAmplifier.Hit; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -108,16 +108,14 @@ namespace CalamityMod.NPCs.NormalNPCs Player player = Main.player[NPC.target]; bool farFromPlayer = NPC.Distance(player.Center) > 960f; - 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 >= Main.maxPlayers || farFromPlayer || obstacleInFrontOfPlayer || player.dead || !player.active) + if (NPC.target < 0 || NPC.target >= Main.maxPlayers || farFromPlayer || player.dead || !player.active) { NPC.TargetClosest(false); player = Main.player[NPC.target]; farFromPlayer = NPC.Distance(player.Center) > 960f; - 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 || obstacleInFrontOfPlayer) + if (player.dead || !player.active || farFromPlayer) { if (FlyAwayTimer > 420) { @@ -222,9 +220,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter++; - int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[NPC.type] / 2); + int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[Type] / 2); if (Supercharged) - frame += Main.npcFrameCount[NPC.type] / 2; + frame += Main.npcFrameCount[Type] / 2; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs index 6c40b1dd86..8427304eff 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 10; + Main.npcFrameCount[Type] = 10; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -55,10 +55,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 40; NPC.defense = 5; - NPC.lifeMax = 18; + NPC.lifeMax = 23; NPC.knockBackResist = 0.15f; - NPC.value = Item.buyPrice(0, 0, 1, 15); - NPC.HitSound = SoundID.NPCHit4; + NPC.value = Item.buyPrice(0, 0, 0, 75); + NPC.HitSound = WulfrumAmplifier.Hit; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -87,9 +87,9 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.frameCounter += 1; } - int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[NPC.type] / 2); + int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[Type] / 2); if (Supercharged) - frame += Main.npcFrameCount[NPC.type] / 2; + frame += Main.npcFrameCount[Type] / 2; NPC.frame.Y = frame * frameHeight; } @@ -109,8 +109,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.netMode != NetmodeID.MultiplayerClient && jumpWouldHitPlayer && NPC.collideY && NPC.velocity.Y == 0f) { NPC.velocity.Y = chargeJumpSpeed; - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } SuperchargeTimer--; @@ -120,8 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.netMode != NetmodeID.MultiplayerClient && HoleAtPosition(NPC.Center.X + NPC.velocity.X * 4f) && NPC.collideY && NPC.velocity.Y == 0f) { NPC.velocity.Y = JumpSpeed; - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } if (Collision.CanHitLine(player.position, player.width, player.height, NPC.position, NPC.width, NPC.height) && @@ -132,8 +130,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.direction != direction) { NPC.direction = direction; - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } //GOTTA GO FAST (Legendary only) if (CalamityWorld.LegendaryMode) @@ -155,8 +152,7 @@ namespace CalamityMod.NPCs.NormalNPCs else if (Main.netMode != NetmodeID.MultiplayerClient && NPC.collideX && NPC.collideY && NPC.velocity.Y == 0f) { NPC.velocity.Y = JumpSpeed; - NPC.netSpam = 0; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } if (NPC.oldPosition == NPC.position) diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs index a63b1c1fc8..b278e299f7 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 12; + Main.npcFrameCount[Type] = 12; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -78,9 +78,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 38; NPC.defense = 4; - NPC.lifeMax = 20; - NPC.value = Item.buyPrice(0, 0, 1, 50); - NPC.HitSound = SoundID.NPCHit4; + NPC.lifeMax = 25; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = WulfrumAmplifier.Hit; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; NPC.noGravity = true; NPC.noTileCollide = true; @@ -119,9 +119,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter++; - int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[NPC.type] / 2); + int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[Type] / 2); if (Supercharged) - frame += Main.npcFrameCount[NPC.type] / 2; + frame += Main.npcFrameCount[Type] / 2; NPC.frame.Y = frame * frameHeight; } @@ -132,16 +132,14 @@ namespace CalamityMod.NPCs.NormalNPCs Player player = Main.player[NPC.target]; bool farFromPlayer = NPC.Distance(player.Center) > 960f; - 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 || obstacleInFrontOfPlayer || player.dead || !player.active) + if (NPC.target < 0 || NPC.target >= 255 || farFromPlayer|| player.dead || !player.active) { NPC.TargetClosest(false); player = Main.player[NPC.target]; farFromPlayer = NPC.Distance(player.Center) > 960f; - 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 || obstacleInFrontOfPlayer) + // Fly away if there is no living target, or the closest target is too far away. + if (player.dead || !player.active || farFromPlayer) { if (FlyAwayTimer > 420) { diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index 52be53013a..32f84de137 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 16; + Main.npcFrameCount[Type] = 16; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -57,10 +57,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 40; NPC.defense = 4; - NPC.lifeMax = 32; + NPC.lifeMax = 40; NPC.knockBackResist = Main.zenithWorld ? 0f : 0.15f; - NPC.value = Item.buyPrice(0, 0, 1, 15); - NPC.HitSound = SoundID.NPCHit4; + NPC.value = Item.buyPrice(0, 0, 0, 75); + NPC.HitSound = WulfrumAmplifier.Hit; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -87,9 +87,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter++; - int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[NPC.type] / 2); + int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[Type] / 2); if (Supercharged) - frame += Main.npcFrameCount[NPC.type] / 2; + frame += Main.npcFrameCount[Type] / 2; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 6a35998d40..a0aa82aad3 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -47,8 +47,8 @@ namespace CalamityMod.NPCs.OldDuke public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 7; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -79,7 +79,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.npcSlots = 15f; NPC.HitSound = SoundID.NPCHit14; NPC.DeathSound = SoundID.NPCDeath20; - NPC.value = Item.buyPrice(4, 0, 0, 0); + NPC.value = Item.buyPrice(2, 0, 0, 0); NPC.boss = true; NPC.netAlways = true; NPC.timeLeft = NPC.activeTime * 30; @@ -215,8 +215,8 @@ namespace CalamityMod.NPCs.OldDuke { spriteEffects = SpriteEffects.FlipHorizontally; } - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / Main.npcFrameCount[Type] / 2); Color color = drawColor; Color drawLerpColor = Color.White; float drawLerpValue = 0f; @@ -259,7 +259,7 @@ namespace CalamityMod.NPCs.OldDuke color = drawColor; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { @@ -268,7 +268,7 @@ namespace CalamityMod.NPCs.OldDuke afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.OldDuke afterimageScale = 20f; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 0; j < secondAfterimageAmt; j++) { @@ -319,7 +319,7 @@ namespace CalamityMod.NPCs.OldDuke secondAfterimageColor = NPC.GetAlpha(secondAfterimageColor); secondAfterimageColor *= 1f - afterimageOpacity; Vector2 secondAfterimagePos = NPC.Center + (j / (float)secondAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * afterimageOpacity - screenPos; - secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -329,7 +329,7 @@ namespace CalamityMod.NPCs.OldDuke finalDrawColor = Color.Lerp(finalDrawColor, drawLerpColor, drawLerpValue); finalDrawColor = NPC.GetAlpha(finalDrawColor); Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (NPC.ai[0] > 9f ? finalDrawColor : NPC.GetAlpha(drawColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -366,7 +366,7 @@ namespace CalamityMod.NPCs.OldDuke yellowLerpColor *= ai2Opacity; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int k = 1; k < afterimageAmt; k += afterimageIncrement) { @@ -374,7 +374,7 @@ namespace CalamityMod.NPCs.OldDuke yellowAfterimageColor = Color.Lerp(yellowAfterimageColor, drawLerpColor, drawLerpValue); yellowAfterimageColor *= (afterimageAmt - k) / 15f; Vector2 yellowAfterimagePos = NPC.oldPos[k] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - yellowAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + yellowAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; yellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, yellowAfterimagePos, NPC.frame, yellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -386,7 +386,7 @@ namespace CalamityMod.NPCs.OldDuke secondYellowAfterimageColor = NPC.GetAlpha(secondYellowAfterimageColor); secondYellowAfterimageColor *= 1f - afterimageOpacity; Vector2 secondYellowAfterimagePos = NPC.Center + (l / (float)secondAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * afterimageOpacity - screenPos; - secondYellowAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + secondYellowAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; secondYellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, secondYellowAfterimagePos, NPC.frame, secondYellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -411,7 +411,7 @@ namespace CalamityMod.NPCs.OldDuke CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedBoomerDuke); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedBoomerDuke); // Mark Old Duke as dead DownedBossSystem.downedBoomerDuke = true; @@ -498,7 +498,7 @@ namespace CalamityMod.NPCs.OldDuke Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 2 * hit.HitDirection, -2f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center + Vector2.UnitX * 20f * NPC.direction, NPC.velocity, Mod.Find("OldDukeGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.Center + Vector2.UnitX * 20f * NPC.direction, NPC.velocity, Mod.Find("OldDukeGore2").Type, NPC.scale); diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 481b7c2a6e..be2fa69fef 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -264,7 +264,7 @@ namespace CalamityMod.NPCs.OldDuke Main.dust[toxicDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OldDukeToothBallGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OldDukeToothBallGore2").Type, NPC.scale); diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index f49346796a..fd999977ae 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.OldDuke public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -239,11 +239,11 @@ namespace CalamityMod.NPCs.OldDuke if (NPC.spriteDirection == -1) spriteEffects = SpriteEffects.None; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); int afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -252,14 +252,14 @@ namespace CalamityMod.NPCs.OldDuke afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); @@ -317,7 +317,7 @@ namespace CalamityMod.NPCs.OldDuke Main.dust[bloody].velocity.X *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSharkronGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSharkronGore2").Type, NPC.scale); diff --git a/NPCs/Other/CalamitasEnchantDemon.cs b/NPCs/Other/CalamitasEnchantDemon.cs index 1096142fb6..831470fdd5 100644 --- a/NPCs/Other/CalamitasEnchantDemon.cs +++ b/NPCs/Other/CalamitasEnchantDemon.cs @@ -14,7 +14,7 @@ namespace CalamityMod.NPCs.Other public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.Other if (NPC.frameCounter % 5f == 4f) NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[Type]) NPC.frame.Y = 0; } diff --git a/NPCs/Other/DemonPortal.cs b/NPCs/Other/DemonPortal.cs index 630cd48ca1..4c870617d8 100644 --- a/NPCs/Other/DemonPortal.cs +++ b/NPCs/Other/DemonPortal.cs @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.Other { spriteBatch.SetBlendState(BlendState.AlphaBlend); - Texture2D portalTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D portalTexture = TextureAssets.Npc[Type].Value; Vector2 drawPosition = NPC.Center - screenPos; Vector2 origin = portalTexture.Size() * 0.5f; Color baseColor = Color.White; diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs index 3816d66fed..dd0a285bbe 100644 --- a/NPCs/Other/ExhumedHeart.cs +++ b/NPCs/Other/ExhumedHeart.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Other public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; } public override void SetDefaults() @@ -45,8 +45,6 @@ namespace CalamityMod.NPCs.Other NPC.Calamity().VulnerableToWater = true; } - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) => NPC.lifeMax = 50000; - public override void AI() { NPC.Opacity = Utils.GetLerpValue(0f, 25f, Time, true); @@ -68,7 +66,7 @@ namespace CalamityMod.NPCs.Other public override void FindFrame(int frameHeight) { NPC.frameCounter++; - NPC.frame.Y = (int)(NPC.frameCounter / 5) % Main.npcFrameCount[NPC.type] * frameHeight; + NPC.frame.Y = (int)(NPC.frameCounter / 5) % Main.npcFrameCount[Type] * frameHeight; } public override Color? GetAlpha(Color drawColor) diff --git a/NPCs/Other/LecherousOrb.cs b/NPCs/Other/LecherousOrb.cs index e1d2d20113..5d6d4e7e7d 100644 --- a/NPCs/Other/LecherousOrb.cs +++ b/NPCs/Other/LecherousOrb.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.Other // Notify the owner that the orb has indeed spawned. Owner.Calamity().awaitingLecherousOrbSpawn = false; - Vector2 destination = Vector2.Lerp(Owner.Center, Main.MouseWorld, 0.625f); + Vector2 destination = Vector2.Lerp(Owner.Center, Owner.ClampedMouseWorld(), 0.625f); NPC.Center = Vector2.Lerp(NPC.Center, destination, 0.035f).MoveTowards(destination, 8f); if (NPC.WithinRange(destination, 5f)) NPC.Center = destination; @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Other magic.noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 4; i++) Gore.NewGoreDirect(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2Circular(3f, 3f), Mod.Find($"LecherousGore{i}").Type); @@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.Other public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Vector2 drawPosition = NPC.Center - screenPos; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index dc4b4ad615..360e1a19fa 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Other NPCID.Sets.ImmuneToRegularBuffs[Type] = true; NPCID.Sets.ShouldBeCountedAsBoss[Type] = true; this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; if (!Main.dedServ) { DeathAnimationTexture = ModContent.Request(Texture + "DEATH", AssetRequestMode.AsyncLoad); @@ -130,6 +130,8 @@ namespace CalamityMod.NPCs.Other aiSwitchCounter++; if (ajitPaiDidNothingWrong && invincibleCounter < 6000) { + // On a technical level, the defense/DR stat is not being increased, but for player purposes he may as well be + NPC.Calamity().CurrentlyIncreasingDefenseOrDR = true; invincibleCounter++; } NPC.alpha -= 100; @@ -155,6 +157,7 @@ namespace CalamityMod.NPCs.Other // Trigger the death animation else if (NPC.life <= 1 && invincibleCounter >= 6000) { + NPC.Calamity().CurrentlyIncreasingDefenseOrDR = false; NPC.life = 1; if (!Dying) { @@ -176,7 +179,7 @@ namespace CalamityMod.NPCs.Other playerLOL.velocity.Y *= 0.99f; if (!DownedBossSystem.downedCalamitas && !DownedBossSystem.downedExoMechs) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!playerLOL.dead && playerLOL.active) { @@ -419,7 +422,7 @@ namespace CalamityMod.NPCs.Other SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Rectangle frameUsed = texture.Frame(2, 7, 0, 1); // the idle frame by default Rectangle squintFrame = texture.Frame(2, 7, 0, 0); diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 4cfa590fcc..2154470e3a 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadLarge))] public class PerforatorBodyLarge : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); @@ -174,8 +175,8 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - 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)); + Texture2D texture2D15 = NPC.localAI[3] == 1f ? AltTexture.Value : TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -207,7 +208,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf2").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf3").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 7ba1995c8d..a15339120e 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadMedium))] public class PerforatorBodyMedium : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); @@ -143,7 +144,7 @@ namespace CalamityMod.NPCs.Perforator NPC.whoAmI = whoAmI2; } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -206,8 +207,8 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -261,7 +262,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf2").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf3").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 6836d44ed7..552626f6b9 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadSmall))] public class PerforatorBodySmall : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); @@ -170,8 +171,8 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -203,7 +204,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SmallPerf2").Type, NPC.scale); } diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index eaf3858d0e..4121184f96 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -18,7 +18,7 @@ namespace CalamityMod.NPCs.Perforator public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.CantTakeLunchMoney[Type] = true; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Perforator public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -73,11 +73,11 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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); diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 3156e69a28..af7e943b92 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] + [LongDistanceNetSync] public class PerforatorHeadLarge : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); @@ -34,7 +35,6 @@ namespace CalamityMod.NPCs.Perforator { Scale = 0.75f, PortraitScale = 0.75f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/PerforatorLarge_Bestiary", PortraitPositionXOverride = 40, PortraitPositionYOverride = 40 }; @@ -532,14 +532,17 @@ namespace CalamityMod.NPCs.Perforator public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.IsABestiaryIconDummy) + { NPC.Opacity = 1f; + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, PerforatorBodyLarge.AltTexture.Value, 3, 40, 0.3f, Vector2.Zero, 3, 10); + } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -571,7 +574,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf2").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index cea75c7ee6..e3cf886284 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -16,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] + [LongDistanceNetSync] public class PerforatorHeadMedium : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); @@ -30,7 +31,6 @@ namespace CalamityMod.NPCs.Perforator { Scale = 0.7f, PortraitScale = 0.7f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/PerforatorMedium_Bestiary", PortraitPositionXOverride = 40, PortraitPositionYOverride = 40 }; @@ -174,7 +174,7 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -457,14 +457,17 @@ namespace CalamityMod.NPCs.Perforator public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.IsABestiaryIconDummy) + { NPC.Opacity = 1f; + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, 5, 34, 0.3f, Vector2.Zero, 5, 6); + } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -496,7 +499,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf2").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index a1a59b4840..1931ce9a48 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] + [LongDistanceNetSync] public class PerforatorHeadSmall : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); @@ -34,7 +36,6 @@ namespace CalamityMod.NPCs.Perforator { Scale = 0.8f, PortraitScale = 0.8f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/PerforatorSmall_Bestiary", PortraitPositionXOverride = 40, PortraitPositionYOverride = 60 }; @@ -490,14 +491,17 @@ namespace CalamityMod.NPCs.Perforator public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.IsABestiaryIconDummy) + { NPC.Opacity = 1f; + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, 5, 22, 0.6f, new Vector2(-20, -20), 4, 10); + } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 glowmaskDrawLocation = NPC.Center - screenPos; glowmaskDrawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -529,7 +533,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SmallPerf").Type, NPC.scale); } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 50dc767c66..6968d2f8cc 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.Perforator public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 10; + Main.npcFrameCount[Type] = 10; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -75,7 +75,7 @@ namespace CalamityMod.NPCs.Perforator NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 15, 0, 0); + NPC.value = Item.buyPrice(0, 8, 0, 0); NPC.boss = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Perforator public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -517,11 +517,11 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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); @@ -552,8 +552,6 @@ namespace CalamityMod.NPCs.Perforator CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, DownedBossSystem.downedPerforator); - // If neither The Hive Mind nor The Perforator Hive have been killed yet, notify players of Aerialite Ore if (!DownedBossSystem.downedHiveMind && !DownedBossSystem.downedPerforator) { @@ -585,7 +583,7 @@ namespace CalamityMod.NPCs.Perforator ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), + ModContent.ItemType(), })); // Materials @@ -631,7 +629,7 @@ namespace CalamityMod.NPCs.Perforator } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Hive").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Hive2").Type, 1f); diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 30ebbb47f0..20cfe2cf62 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadLarge))] public class PerforatorTailLarge : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); @@ -170,8 +171,8 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -198,7 +199,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf4").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf5").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index f9ac6114cc..5363704b89 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadMedium))] public class PerforatorTailMedium : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); @@ -114,7 +115,7 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -177,8 +178,8 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -205,7 +206,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf3").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf4").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 256ee1dae6..da90401b93 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadSmall))] public class PerforatorTailSmall : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); @@ -171,8 +172,8 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; @@ -199,7 +200,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SmallPerf3").Type, NPC.scale); } diff --git a/NPCs/PlagueEnemies/Melter.cs b/NPCs/PlagueEnemies/Melter.cs index bd097cbde3..4203d6ee5e 100644 --- a/NPCs/PlagueEnemies/Melter.cs +++ b/NPCs/PlagueEnemies/Melter.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.PortraitPositionYOverride = -32f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.width = 38; NPC.height = 34; NPC.defense = 15; - NPC.lifeMax = 500; + NPC.lifeMax = 630; NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit1; @@ -85,7 +85,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Melter").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Melter2").Type, 1f); diff --git a/NPCs/PlagueEnemies/PestilentSlime.cs b/NPCs/PlagueEnemies/PestilentSlime.cs index e59ceb3545..8e662822ae 100644 --- a/NPCs/PlagueEnemies/PestilentSlime.cs +++ b/NPCs/PlagueEnemies/PestilentSlime.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; } public override void SetDefaults() @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.width = 40; NPC.height = 30; NPC.defense = 12; - NPC.lifeMax = 350; + NPC.lifeMax = 440; NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 10, 0); @@ -67,7 +67,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { spikeTimer -= 1f; } - if (!NPC.wet && !Main.player[NPC.target].npcTypeNoAggro[NPC.type]) + if (!NPC.wet && !Main.player[NPC.target].npcTypeNoAggro[Type]) { Vector2 slimePosition = 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 * 0.5f - slimePosition.X; diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index 1f79c757cc..54f956edec 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -23,8 +23,8 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 4; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 30; NPC.defense = 20; NPC.scale *= 0.5f; - NPC.lifeMax = 200; + NPC.lifeMax = 250; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; NPC.knockBackResist = 0.4f; @@ -73,11 +73,11 @@ namespace CalamityMod.NPCs.PlagueEnemies if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -86,21 +86,21 @@ namespace CalamityMod.NPCs.PlagueEnemies afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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 = GlowTexture.Value; Color redEyeColor = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.PlagueEnemies redEyeAfterimageColor = Color.Lerp(redEyeAfterimageColor, Color.White, 0.5f); redEyeAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 redEyeAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - redEyeAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + redEyeAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; redEyeAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, redEyeAfterimagePos, NPC.frame, redEyeAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger").Type, 0.5f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger2").Type, 0.5f); diff --git a/NPCs/PlagueEnemies/PlagueChargerLarge.cs b/NPCs/PlagueEnemies/PlagueChargerLarge.cs index c6b4e66b75..dad5fb445f 100644 --- a/NPCs/PlagueEnemies/PlagueChargerLarge.cs +++ b/NPCs/PlagueEnemies/PlagueChargerLarge.cs @@ -22,8 +22,8 @@ namespace CalamityMod.NPCs.PlagueEnemies public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PlagueCharger.DisplayName"); public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 4; + NPCID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 30; NPC.defense = 25; NPC.scale *= 0.75f; - NPC.lifeMax = 300; + NPC.lifeMax = 380; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; NPC.knockBackResist = 0.3f; @@ -68,11 +68,11 @@ namespace CalamityMod.NPCs.PlagueEnemies if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -81,21 +81,21 @@ namespace CalamityMod.NPCs.PlagueEnemies afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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; Color redEyeColor = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.PlagueEnemies redEyeAfterimageColor = Color.Lerp(redEyeAfterimageColor, Color.White, 0.5f); redEyeAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 redEyeAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - redEyeAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + redEyeAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; redEyeAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, redEyeAfterimagePos, NPC.frame, redEyeAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger").Type, 0.75f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger2").Type, 0.75f); diff --git a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs index 9ad8a39ed9..db13bc4c31 100644 --- a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs +++ b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs @@ -23,8 +23,8 @@ namespace CalamityMod.NPCs.PlagueEnemies { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 12; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 12; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.7f, @@ -370,7 +370,7 @@ namespace CalamityMod.NPCs.PlagueEnemies } } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI); } @@ -380,10 +380,10 @@ namespace CalamityMod.NPCs.PlagueEnemies if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { if (NPC.ai[0] == 0f && NPC.localAI[0] == 1f) { @@ -395,7 +395,7 @@ namespace CalamityMod.NPCs.PlagueEnemies afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(chargeAfterimageAmount - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -403,7 +403,7 @@ namespace CalamityMod.NPCs.PlagueEnemies } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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); diff --git a/NPCs/PlagueEnemies/Plagueshell.cs b/NPCs/PlagueEnemies/Plagueshell.cs index 122ac2e63b..9e5acf2b08 100644 --- a/NPCs/PlagueEnemies/Plagueshell.cs +++ b/NPCs/PlagueEnemies/Plagueshell.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; + Main.npcFrameCount[Type] = 8; } public override void SetDefaults() @@ -28,10 +28,10 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.width = 46; NPC.height = 32; NPC.defense = 32; - NPC.lifeMax = 800; + NPC.lifeMax = 1000; NPC.knockBackResist = 0.2f; AnimationType = NPCID.GiantTortoise; - NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.value = Item.buyPrice(0, 0, 15, 0); NPC.HitSound = SoundID.NPCHit24; NPC.noGravity = false; Banner = NPC.type; @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Plagueshell").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Plagueshell2").Type, 1f); diff --git a/NPCs/PlagueEnemies/Viruling.cs b/NPCs/PlagueEnemies/Viruling.cs index 47819df894..d2c2f4d31f 100644 --- a/NPCs/PlagueEnemies/Viruling.cs +++ b/NPCs/PlagueEnemies/Viruling.cs @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.width = 58; NPC.height = 44; NPC.defense = 18; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit22; @@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -200,7 +200,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Viruling").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Viruling2").Type, 1f); diff --git a/NPCs/PlaguebringerGoliath/PbGSky.cs b/NPCs/PlaguebringerGoliath/PbGSky.cs index 39e5888f4a..0a3a2fb545 100644 --- a/NPCs/PlaguebringerGoliath/PbGSky.cs +++ b/NPCs/PlaguebringerGoliath/PbGSky.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float x = 0f; if (this.PbGIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.PbGIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.PbGIndex].Center); } return (1f - Utils.SmoothStep(3000f, 6000f, x)); } diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index 9b7de91cea..a65955b46d 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -21,8 +21,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 4; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { GlowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow", AssetRequestMode.AsyncLoad); @@ -164,8 +164,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].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)); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 5; Vector2 drawLocation = NPC.Center - screenPos; @@ -176,7 +176,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath spriteBatch.Draw(texture, drawLocation + drawOffset, NPC.frame, backAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -185,20 +185,20 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - drawLocation -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * 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); texture = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -206,7 +206,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath secondAfterimageColor = Color.Lerp(secondAfterimageColor, Color.White, 0.5f); secondAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 secondAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - secondAfterimagePos -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + secondAfterimagePos -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -220,7 +220,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 6d3571c909..e95079f7ee 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; if (!Main.dedServ) { GlowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow", AssetRequestMode.AsyncLoad); @@ -113,7 +113,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.frameCounter % 6 == 5) NPC.frame.Y += frameHeight; - if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type]) NPC.frame.Y = 0; } @@ -123,10 +123,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color backAfterimageColor = PlaguebringerGoliath.BackglowColor * NPC.Opacity; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index e9acfe7182..e9b5eeeb5b 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -62,8 +62,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -98,7 +98,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.aiStyle = -1; AIType = -1; NPC.boss = true; - NPC.value = Item.buyPrice(0, 75, 0, 0); + NPC.value = Item.buyPrice(0, 30, 0, 0); NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit4; @@ -346,12 +346,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.TargetClosest(); - 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; + NPC.ForceNetUpdate(false); SoundEngine.PlaySound(AttackSwitchSound, NPC.Center); } @@ -387,12 +385,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[0] = -1f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - 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; + NPC.ForceNetUpdate(false); SoundEngine.PlaySound(AttackSwitchSound, NPC.Center); @@ -456,9 +452,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.spriteDirection != 1) NPC.rotation += (float)Math.PI; - NPC.netUpdate = true; - NPC.netSpam -= 5; - + NPC.ForceNetUpdate(); SoundEngine.PlaySound(DashSound, NPC.Center); return; @@ -510,9 +504,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - - NPC.netUpdate = true; - NPC.netSpam -= 5; + NPC.ForceNetUpdate(); } // Slow down after charge @@ -644,12 +636,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[0] = (phase3 || bossRush) ? 5f : 1f; NPC.ai[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; - 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; + NPC.ForceNetUpdate(false); SoundEngine.PlaySound(AttackSwitchSound, NPC.Center); @@ -732,12 +722,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[0] = -1f; NPC.ai[1] = 2f; NPC.ai[2] = 0f; - 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; + NPC.ForceNetUpdate(false); SoundEngine.PlaySound(AttackSwitchSound, NPC.Center); } @@ -821,12 +809,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[0] = -1f; NPC.ai[1] = 2f; NPC.ai[2] = 0f; - 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; + NPC.ForceNetUpdate(false); SoundEngine.PlaySound(AttackSwitchSound, NPC.Center); } @@ -913,12 +899,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[0] = -1f; NPC.ai[1] = 3f; NPC.ai[2] = 0f; - 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; + NPC.ForceNetUpdate(false); SoundEngine.PlaySound(AttackSwitchSound, NPC.Center); } @@ -944,12 +928,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[0] = -1f; NPC.ai[1] = -1f; NPC.ai[2] = 0f; - 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; + NPC.ForceNetUpdate(false); SoundEngine.PlaySound(AttackSwitchSound, NPC.Center); @@ -1206,7 +1188,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i < 7; i++) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlaguebringerGoliathGore" + i).Type, NPC.scale); @@ -1241,7 +1223,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Texture2D glowTexture = Texture_Glow.Value; if (curTex != (charging ? 2 : 1)) { @@ -1267,7 +1249,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 posOffset = new Vector2(charging ? 175 : 125, 0); int chargeAfterimageAmount = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { if ((NPC.ai[0] == 0f || NPC.ai[0] == 4f) && charging) { @@ -1292,7 +1274,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { if ((NPC.ai[0] == 0f || NPC.ai[0] == 4f) && charging) { @@ -1363,7 +1345,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath int[] weapons = new int[] { ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index f1920158ab..5e0b097a77 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -19,8 +19,8 @@ namespace CalamityMod.NPCs.Polterghast public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -33,6 +33,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.DR_NERD(0.1f); NPC.noGravity = true; NPC.noTileCollide = true; + NPC.chaseable = false; NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats NPC.lifeMax = 20000; NPC.HitSound = SoundID.NPCHit36; @@ -145,11 +146,11 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index e8796595e5..d5de2b05cd 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -24,8 +24,8 @@ namespace CalamityMod.NPCs.Polterghast public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.TrailingMode[NPC.type] = 1; + 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); if (!Main.dedServ) @@ -424,12 +424,9 @@ namespace CalamityMod.NPCs.Polterghast } } - NPC.netUpdate = true; + NPC.ForceNetUpdate(false); - if (NPC.netSpam > 10) - NPC.netSpam = 10; - - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } @@ -450,12 +447,12 @@ namespace CalamityMod.NPCs.Polterghast float colorChangeTime = 180f; float changeColorGateValue = chargePhaseGateValue - colorChangeTime; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Color lightRed = new Color(255, 100, 100, 255) * NPC.Opacity; int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -468,7 +465,7 @@ namespace CalamityMod.NPCs.Polterghast afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -480,7 +477,7 @@ namespace CalamityMod.NPCs.Polterghast color = Color.Lerp(color, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -490,12 +487,12 @@ namespace CalamityMod.NPCs.Polterghast Color blackWhiteLerp = Color.Lerp(Color.White, c, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { Vector2 otherAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - otherAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + otherAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; otherAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color otherAfterimageColor = blackWhiteLerp; otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 695428ba63..dba87d1578 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -39,17 +39,14 @@ namespace CalamityMod.NPCs.Polterghast { public static int phase1IconIndex; public static int phase3IconIndex; - - internal static void LoadHeadIcons() + + public override void Load() { string phase1IconPath = "CalamityMod/NPCs/Polterghast/Polterghast_Head_Boss"; string phase3IconPath = "CalamityMod/NPCs/Polterghast/Necroplasm_Head_Boss"; - CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); - phase1IconIndex = ModContent.GetModBossHeadSlot(phase1IconPath); - - CalamityMod.Instance.AddBossHeadTexture(phase3IconPath, -1); - phase3IconIndex = ModContent.GetModBossHeadSlot(phase3IconPath); + phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath); + phase3IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase3IconPath); } private const int DespawnTimerMax = 900; @@ -95,8 +92,8 @@ namespace CalamityMod.NPCs.Polterghast public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 12; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 12; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.MPAllowedEnemies[Type] = true; if (!Main.dedServ) @@ -119,7 +116,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(3, 50, 0, 0); + NPC.value = Item.buyPrice(1, 50, 0, 0); NPC.boss = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -307,8 +304,8 @@ namespace CalamityMod.NPCs.Polterghast } // Stop rain - if (CalamityConfig.Instance.BossesStopWeather) - CalamityMod.StopRain(); + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); // Set time left if (NPC.timeLeft < 1800) @@ -660,12 +657,9 @@ namespace CalamityMod.NPCs.Polterghast NPC.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); } - NPC.netUpdate = true; + NPC.ForceNetUpdate(false); - if (NPC.netSpam > 10) - NPC.netSpam = 10; - - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); } @@ -706,28 +700,13 @@ namespace CalamityMod.NPCs.Polterghast } int damage = NPC.GetProjectileDamage(type); - - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = baseProjectileVelocity / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - float rotation = MathHelper.ToRadians(65); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / 6; - double offsetAngle; + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * baseProjectileVelocity; + Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = type == ModContent.ProjectileType() ? 450 : 1800; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-32.5f, 32.5f, i / 5f)); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + shot.timeLeft = (type == ModContent.ProjectileType() ? 450 : 1800); } } else @@ -735,27 +714,13 @@ namespace CalamityMod.NPCs.Polterghast int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = (baseProjectileVelocity + 5f) / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - float rotation = MathHelper.ToRadians(80); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / 6; - double offsetAngle; + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (baseProjectileVelocity + 5f); + Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 450; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-40f, 40f, i / 5f)); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + shot.timeLeft = 450; } } } @@ -778,7 +743,7 @@ namespace CalamityMod.NPCs.Polterghast SoundEngine.PlaySound(P2Sound, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt").Type, 1f); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt2").Type, 1f); @@ -840,58 +805,26 @@ namespace CalamityMod.NPCs.Polterghast } int damage = NPC.GetProjectileDamage(type); - - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = (baseProjectileVelocity + 1f) / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - int numProj = 7; - float rotation = MathHelper.ToRadians(80); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / numProj; - double offsetAngle; - for (int i = 0; i < numProj; i++) + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (baseProjectileVelocity + 1f); + Vector2 firingPos = NPC.Center + spreadVel * 3f; + for (int i = 0; i < 7; i++) { - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = type == ModContent.ProjectileType() ? 450 : 1800; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-40f, 40f, i / 6f)); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + shot.timeLeft = (type == ModContent.ProjectileType() ? 450 : 1800); } } else { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = (baseProjectileVelocity + 5f) / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - int numProj = 7; - float rotation = MathHelper.ToRadians(100); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / numProj; - double offsetAngle; - for (int i = 0; i < numProj; i++) + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (baseProjectileVelocity + 5f); + Vector2 firingPos = NPC.Center + spreadVel * 3f; + for (int i = 0; i < 7; i++) { - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 450; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-50f, 50f, i / 6f)); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + shot.timeLeft = 450; } } } @@ -931,7 +864,7 @@ namespace CalamityMod.NPCs.Polterghast SoundEngine.PlaySound(P3Sound, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt").Type, 1f); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt2").Type, 1f); @@ -972,31 +905,16 @@ namespace CalamityMod.NPCs.Polterghast NPC.localAI[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase) { - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = baseProjectileVelocity / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - int numProj = 6 + (getPissed ? 4 : 2); - float rotation = MathHelper.ToRadians(110 + (getPissed ? 15 : 0)); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / numProj; - double offsetAngle; - + int numProj = (getPissed ? 10 : 8); + float maxSpread = getPissed ? 125 : 110; int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * baseProjectileVelocity; + Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < numProj; i++) { - offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + float offset = MathHelper.ToRadians(MathHelper.Lerp(-maxSpread * 0.5f, maxSpread * 0.5f, i / (numProj - 1f))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); } } } @@ -1049,8 +967,8 @@ namespace CalamityMod.NPCs.Polterghast // If Polterghast has not been killed, notify players about the Abyss minibosses now dropping items if (!DownedBossSystem.downedPolterghast) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(ReaperShark.SearchRoarSound, Main.player[Main.myPlayer].Center); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(ReaperShark.SearchRoarSound, Main.LocalPlayer.Center); string key = "Mods.CalamityMod.Status.Progression.GhostBossText"; Color messageColor = Color.RoyalBlue; @@ -1164,12 +1082,12 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = TextureAssets.Npc[Type].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); + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -1178,14 +1096,14 @@ namespace CalamityMod.NPCs.Polterghast afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; vector43 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color c = NPC.IsABestiaryIconDummy ? Color.White : NPC.GetAlpha(drawColor); spriteBatch.Draw(texture2D15, vector43, NPC.frame, c, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -1213,7 +1131,7 @@ namespace CalamityMod.NPCs.Polterghast Color veinColor = Color.Lerp(Color.White, (NPC.ai[2] >= changeColorGateValue || NPC.Calamity().newAI[0] > changeColorGateValue) ? Color.Red : Color.Black, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -1222,7 +1140,7 @@ namespace CalamityMod.NPCs.Polterghast otherAfterimageColor = NPC.GetAlpha(otherAfterimageColor); otherAfterimageColor *= (afterimageAmt - j) / 15f; Vector2 otherAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - otherAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + otherAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; otherAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, otherAfterimagePos, NPC.frame, otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index 50c6039a49..a31142c7f1 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -23,8 +23,8 @@ namespace CalamityMod.NPCs.Polterghast public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 2; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 2; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -162,7 +162,7 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.ai[2] > 40f) NPC.ai[3] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 20f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 20f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 192f) { float shotSpeed = 10f * tileEnrageMult; int type = ModContent.ProjectileType(); @@ -371,11 +371,11 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -384,14 +384,14 @@ namespace CalamityMod.NPCs.Polterghast afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); @@ -401,7 +401,7 @@ namespace CalamityMod.NPCs.Polterghast if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) cyanLerp2 = Color.Lerp(cyanLerp2, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -410,7 +410,7 @@ namespace CalamityMod.NPCs.Polterghast otherAfterimageColor = NPC.GetAlpha(otherAfterimageColor); otherAfterimageColor *= (afterimageAmt - j) / 15f; Vector2 otherAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - otherAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + otherAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; otherAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, otherAfterimagePos, NPC.frame, otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs index 6be9af3885..b09d815870 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs @@ -12,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.PrimordialWyrm { + [LongDistanceNetSync(SyncWith = typeof(PrimordialWyrmHead))] public class PrimordialWyrmBody : ModNPC { public static Asset GlowTexture; @@ -23,14 +24,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm this.HideFromBestiary(); if (!Main.dedServ) { - GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture = ModContent.Request(Texture + "_Lightmask", AssetRequestMode.AsyncLoad); } } public override void SetDefaults() { NPC.damage = 100; - NPC.width = 60; + NPC.width = 100; NPC.height = 88; NPC.defense = 0; NPC.LifeMaxNERB(2500000, 3000000); @@ -167,11 +168,11 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 center = NPC.Center - screenPos; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); @@ -190,9 +191,9 @@ namespace CalamityMod.NPCs.PrimordialWyrm for (int k = 0; k < 10; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("PrimordialWyrm2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("PrimordialWyrm3").Type, 1f); } } } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBody.png b/NPCs/PrimordialWyrm/PrimordialWyrmBody.png index 5c613e3319..cdeb214632 100644 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrmBody.png and b/NPCs/PrimordialWyrm/PrimordialWyrmBody.png differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs index fa14d83ec9..07d140904b 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs @@ -12,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.PrimordialWyrm { + [LongDistanceNetSync(SyncWith = typeof(PrimordialWyrmHead))] public class PrimordialWyrmBodyAlt : ModNPC { public static Asset GlowTexture; @@ -22,14 +23,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm this.HideFromBestiary(); if (!Main.dedServ) { - GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture = ModContent.Request(Texture + "_Lightmask", AssetRequestMode.AsyncLoad); } } public override void SetDefaults() { NPC.damage = 100; - NPC.width = 60; + NPC.width = 110; NPC.height = 88; NPC.defense = 0; NPC.LifeMaxNERB(2500000, 3000000); @@ -166,11 +167,11 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 center = NPC.Center - screenPos; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); @@ -189,9 +190,9 @@ namespace CalamityMod.NPCs.PrimordialWyrm for (int k = 0; k < 10; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("PrimordialWyrm3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("PrimordialWyrm4").Type, 1f); } } } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.png b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.png index f65aeb43ac..4154b97d28 100644 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.png and b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.png differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAltGlow.png b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAltGlow.png deleted file mode 100644 index d53ea77ae9..0000000000 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAltGlow.png and /dev/null differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt_Lightmask.png b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt_Lightmask.png new file mode 100644 index 0000000000..805d9ac119 Binary files /dev/null and b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt_Lightmask.png differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyGlow.png b/NPCs/PrimordialWyrm/PrimordialWyrmBodyGlow.png deleted file mode 100644 index 941007fbbd..0000000000 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrmBodyGlow.png and /dev/null differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBody_Lightmask.png b/NPCs/PrimordialWyrm/PrimordialWyrmBody_Lightmask.png new file mode 100644 index 0000000000..344697718e Binary files /dev/null and b/NPCs/PrimordialWyrm/PrimordialWyrmBody_Lightmask.png differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 4f307c362c..086ac9f062 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -5,7 +5,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Magic; @@ -13,6 +13,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Perforator; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -28,6 +29,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.PrimordialWyrm { [AutoloadBossHead] + [LongDistanceNetSync] public class PrimordialWyrmHead : ModNPC { public enum Phase @@ -86,20 +88,20 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void SetStaticDefaults() { + NPCID.Sets.CantTakeLunchMoney[Type] = true; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - Scale = 0.50f, - PortraitScale = 0.6f, + Scale = 0.5f, + PortraitScale = 0.5f, PortraitPositionXOverride = 40, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/PrimordialWyrm_Bestiary" }; value.Position.X += 55; value.Position.Y += 5; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; if (!Main.dedServ) { - GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture = ModContent.Request(Texture + "_Lightmask", AssetRequestMode.AsyncLoad); } } @@ -108,14 +110,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm NPC.Calamity().canBreakPlayerDefense = true; NPC.npcSlots = 50f; NPC.GetNPCDamage(); - NPC.width = 254; + NPC.width = 230; NPC.height = 138; NPC.LifeMaxNERB(2500000, 3000000); NPC.aiStyle = -1; AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(10, 0, 0, 0); + NPC.value = Item.buyPrice(5, 0, 0, 0); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -219,8 +221,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm // Play spawn sound if (!TailSpawned && NPC.ai[0] == 0f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(SpawnSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(SpawnSound, Main.LocalPlayer.Center); } // Spawn segments @@ -469,23 +471,31 @@ namespace CalamityMod.NPCs.PrimordialWyrm SoundEngine.PlaySound(SoundID.Item117, player.Center); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 40; i++) { - 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; + // Dust that moves in the opposite direction of the player + Dust dust = Dust.NewDustDirect(player.position, player.width, player.height, DustID.MushroomSpray, -player.velocity.X, -player.velocity.Y, 1, Color.SkyBlue, 1); + dust.velocity.Normalize(); + dust.velocity *= Main.rand.Next(20); + 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.scale = 0.5f; + dust.fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int j = 0; j < 30; j++) { - 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, DustID.FrostHydra, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 0.2f; + // Dust that moves in the direction of PW + Vector2 velocityToNPC = player.DirectionTo(NPC.Center) * Main.rand.Next(40); + Dust dust = Dust.NewDustDirect(player.position, player.width, player.height, DustID.Flare, velocityToNPC.X * 5, velocityToNPC.Y * 5, 1, default, 3); + dust.noGravity = true; + // Dust that emanataes outward from the player's position + dust = Dust.NewDustDirect(player.position, player.width, player.height, DustID.Flare, Main.rand.Next(5), Main.rand.Next(5), 1, default, 1); + dust.fadeIn = 1f + Main.rand.Next(8) * 0.1f; + dust.noGravity = true; } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -504,7 +514,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) { - ChargeDust(7, (float)Math.PI); + ChargeDust(); // Use a lerp to smoothly scale up velocity and turn speed chargeVelocityScalar += chargeVelocityScalarIncrement; @@ -536,8 +546,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(ChargeSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(ChargeSound, Main.LocalPlayer.Center); } // Lock into the charge phase and use this for a charge time check @@ -596,8 +606,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] % 30f == 0f && calamityGlobalNPC.newAI[2] < lightningRainDuration) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Main.LocalPlayer.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -692,7 +702,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) { - ChargeDust(7, (float)Math.PI); + ChargeDust(); // Use a lerp to smoothly scale up velocity and turn speed chargeVelocityScalar += chargeVelocityScalarIncrement; @@ -724,8 +734,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(ChargeSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(ChargeSound, Main.LocalPlayer.Center); } // Lock into the charge phase and use this for a charge time check @@ -804,7 +814,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) { - ChargeDust(7, (float)Math.PI); + ChargeDust(); // Use a lerp to smoothly scale up velocity and turn speed chargeVelocityScalar += chargeVelocityScalarIncrement; @@ -836,8 +846,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(ChargeSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(ChargeSound, Main.LocalPlayer.Center); } // Lock into the charge phase and use this for a charge time check @@ -1084,7 +1094,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (calamityGlobalNPC.newAI[2] >= lightningChargePhaseGateValue) { - ChargeDust(7, (float)Math.PI); + ChargeDust(); // Use a lerp to smoothly scale up velocity and turn speed chargeVelocityScalar += chargeVelocityScalarIncrement; @@ -1116,8 +1126,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] == lightningChargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(ChargeSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(ChargeSound, Main.LocalPlayer.Center); } // Lock into the charge phase and use this for a charge time check @@ -1129,8 +1139,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm // Lightning barrage if (NPC.localAI[3] == 0f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Main.LocalPlayer.Center); NPC.localAI[3] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1185,8 +1195,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (!NPC.AnyNPCs(ModContent.NPCType())) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(Eidolist.DeathSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Eidolist.DeathSound, Main.LocalPlayer.Center); // Spawn Eidolists randomly around the target for (int i = 0; i < maxEidolists; i++) @@ -1368,18 +1378,23 @@ namespace CalamityMod.NPCs.PrimordialWyrm } } - private void ChargeDust(int dustAmt, float pie) + private void ChargeDust() { - for (int num1474 = 0; num1474 < dustAmt; num1474++) + for (int dustCount = 0; dustCount < 5; dustCount++) { - 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, 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; - Main.dust[chargeDust].velocity -= NPC.velocity; + // 184 and 77 offsets are for outer horns, 119 and 47 for inner + //outer left horn + Dust dust = Dust.NewDustPerfect(new Vector2(NPC.Center.X - 184, NPC.Center.Y + 77).RotatedBy(NPC.rotation, NPC.Center), DustID.MushroomSpray, -NPC.velocity, 1, Color.SkyBlue, 1f); + dust.velocity.Normalize(); + //outer right horn + dust = Dust.NewDustPerfect(new Vector2(NPC.Center.X + 184, NPC.Center.Y + 77).RotatedBy(NPC.rotation, NPC.Center), DustID.MushroomSpray, -NPC.velocity, 1, Color.SkyBlue, 1f); + dust.velocity.Normalize(); + //inner left horn + dust = Dust.NewDustPerfect(new Vector2(NPC.Center.X - 119, NPC.Center.Y + 47).RotatedBy(NPC.rotation, NPC.Center), DustID.MushroomSpray, -NPC.velocity, 1, Color.SkyBlue, 0.7f); + dust.velocity.Normalize(); + //inner right horn + dust = Dust.NewDustPerfect(new Vector2(NPC.Center.X + 119, NPC.Center.Y + 47).RotatedBy(NPC.rotation, NPC.Center), DustID.MushroomSpray, -NPC.velocity, 1, Color.SkyBlue, 0.7f); + dust.velocity.Normalize(); } } @@ -1425,17 +1440,20 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.IsABestiaryIconDummy) + { NPC.Opacity = 1f; + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, TextureAssets.Npc[ModContent.NPCType()].Value, 3, 36, 0.2f, new Vector2(130, 60), 3, 10); + } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 center = NPC.Center - screenPos; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); @@ -1458,16 +1476,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType(), 1, 80, 100); npcLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - - var postLevi = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedLeviathan); - postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 50, 108, 65, 135)); - postLevi.Add(ItemID.Ectoplasm, 1, 21, 32); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 50, 108, 65, 135)); + npcLoot.Add(ItemID.Ectoplasm, 1, 21, 32); } public override void HitEffect(NPC.HitInfo hit) { // Create gore and dust hit effects. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; for (int k = 0; k < 15; k++) @@ -1479,6 +1495,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm 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); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrimordialWyrm2").Type, 1f); + } } @@ -1501,7 +1519,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (NPC.Opacity == 1f && hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 1200, true); + target.AddBuff(ModContent.BuffType(), 1200, true); } } } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.png b/NPCs/PrimordialWyrm/PrimordialWyrmHead.png index e4d8c3a596..a9e5bd803c 100644 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrmHead.png and b/NPCs/PrimordialWyrm/PrimordialWyrmHead.png differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHeadGlow.png b/NPCs/PrimordialWyrm/PrimordialWyrmHeadGlow.png deleted file mode 100644 index 98d36bb3fd..0000000000 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrmHeadGlow.png and /dev/null differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead_Head_Boss.png b/NPCs/PrimordialWyrm/PrimordialWyrmHead_Head_Boss.png index ffafb0bc3b..f44e22d0b0 100644 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrmHead_Head_Boss.png and b/NPCs/PrimordialWyrm/PrimordialWyrmHead_Head_Boss.png differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead_Lightmask.png b/NPCs/PrimordialWyrm/PrimordialWyrmHead_Lightmask.png new file mode 100644 index 0000000000..88312e6018 Binary files /dev/null and b/NPCs/PrimordialWyrm/PrimordialWyrmHead_Lightmask.png differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs index 6b18f08c58..83b94b364b 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.PrimordialWyrm { + [LongDistanceNetSync(SyncWith = typeof(PrimordialWyrmHead))] public class PrimordialWyrmTail : ModNPC { public static Asset GlowTexture; @@ -21,14 +22,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm this.HideFromBestiary(); if (!Main.dedServ) { - GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture = ModContent.Request(Texture + "_Lightmask", AssetRequestMode.AsyncLoad); } } public override void SetDefaults() { NPC.damage = 100; - NPC.width = 86; + NPC.width = 100; NPC.height = 120; NPC.defense = 0; NPC.LifeMaxNERB(2500000, 3000000); @@ -128,11 +129,11 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 center = NPC.Center - screenPos; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); @@ -151,9 +152,9 @@ namespace CalamityMod.NPCs.PrimordialWyrm for (int k = 0; k < 10; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("PrimordialWyrm4").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("PrimordialWyrm5").Type, 1f); } } } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTail.png b/NPCs/PrimordialWyrm/PrimordialWyrmTail.png index 4e63dd0139..850d1adf3e 100644 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrmTail.png and b/NPCs/PrimordialWyrm/PrimordialWyrmTail.png differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTailGlow.png b/NPCs/PrimordialWyrm/PrimordialWyrmTailGlow.png deleted file mode 100644 index 15d11a8d7e..0000000000 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrmTailGlow.png and /dev/null differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTail_Lightmask.png b/NPCs/PrimordialWyrm/PrimordialWyrmTail_Lightmask.png new file mode 100644 index 0000000000..5c072c93e8 Binary files /dev/null and b/NPCs/PrimordialWyrm/PrimordialWyrmTail_Lightmask.png differ diff --git a/NPCs/PrimordialWyrm/PrimordialWyrm_BossChecklist.png b/NPCs/PrimordialWyrm/PrimordialWyrm_BossChecklist.png index c3df239550..48191f5533 100644 Binary files a/NPCs/PrimordialWyrm/PrimordialWyrm_BossChecklist.png and b/NPCs/PrimordialWyrm/PrimordialWyrm_BossChecklist.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 9e0f1118b9..c4fc204d4b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -12,6 +12,7 @@ using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; @@ -44,8 +45,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 10; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 10; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -132,7 +133,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.12f + NPC.velocity.Length() / 120f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -334,14 +335,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[3] < 0f) NPC.ai[3] = 0f; - // Enrage at nighttime - bool enraged = false; - if (!Main.dayTime && !Main.remixWorld) - { - enraged = true; - NPC.Calamity().CurrentlyEnraged = true; - } - bool phase1 = healerAlive || defenderAlive; NPC.chaseable = !phase1; @@ -366,7 +359,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians float goLowOrHighDistance = 540f; // Side swap variables for Phase 2 - float defenderCommanderGuardPhase2Duration = (bossRush || enraged) ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float defenderCommanderGuardPhase2Duration = bossRush ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; float moveToOtherSideInPhase2GateValue = defenderCommanderGuardPhase2Duration - 120f; float timeBeforeMoveToOtherSideInPhase2Reset = moveToOtherSideInPhase2GateValue * 2f; float totalGoLowDurationPhase2 = 210f; @@ -374,13 +367,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge variables float chargeVelocityMult = 0.25f; - float maxChargeVelocity = (bossRush || enraged) ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; + float maxChargeVelocity = bossRush ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; if (Main.getGoodWorld) maxChargeVelocity *= 1.15f; if (CalamityWorld.LegendaryMode && revenge) maxChargeVelocity *= 2f; - float inertia = (bossRush || enraged) ? 40f : death ? 45f : revenge ? 47f : expertMode ? 50f : 55f; + float inertia = bossRush ? 40f : death ? 45f : revenge ? 47f : expertMode ? 50f : 55f; if (lifeRatio < 0.5f) inertia *= 0.8f; if (!phase1) @@ -463,7 +456,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (!goLow && !goLowPhase2 && !goHigh) calamityGlobalNPC.newAI[0] = -NPC.direction; - float velocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float velocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) velocity *= 1.25f; if (healerAlive) @@ -500,7 +493,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 targetVector = destination - NPC.Center; Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; - float phaseGateValue = (bossRush || enraged) ? 50f : death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; + float phaseGateValue = bossRush ? 50f : death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; bool continueShootingProjectiles = phase1 || (NPC.ai[2] < (phaseGateValue * 5f)); if (continueShootingProjectiles) @@ -514,7 +507,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Alternate between firing profaned spears and holy fire // Shoot holy blasts in final phase NPC.ai[2] += 1f; - float projectileShootGateValue = (bossRush || enraged) ? 40f : death ? 60f : revenge ? 90f : expertMode ? 100f : 150f; + float projectileShootGateValue = bossRush ? 40f : death ? 60f : revenge ? 90f : expertMode ? 100f : 150f; if (NPC.ai[2] % projectileShootGateValue == 0f) { if (phase1) @@ -528,7 +521,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } bool shootSpear = NPC.ai[2] % (projectileShootGateValue * 2f) == 0f; - float projectileVelocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float projectileVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; Vector2 finalProjectileVelocity = Vector2.Normalize(player.Center - shootFrom) * projectileVelocity; int type = shootSpear ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -541,8 +534,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (fireExtraProjectiles && shootSpear) { - int baseProjectileAmt = (bossRush || enraged) ? 4 : 2; - int spread = (bossRush || enraged) ? 18 : 10; + int baseProjectileAmt = bossRush ? 4 : 2; + int spread = bossRush ? 18 : 10; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < baseProjectileAmt; i++) { @@ -561,7 +554,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians else { // Shoot holy blasts - float holyBlastVelocity = (bossRush || enraged) ? 20f : death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; + float holyBlastVelocity = bossRush ? 20f : death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; int projTimeLeft = (int)(2000f / holyBlastVelocity); Vector2 finalHolyBlastVelocity = Vector2.Normalize(player.Center - shootFrom) * holyBlastVelocity; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -570,7 +563,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians int damage = NPC.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, finalHolyBlastVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, finalHolyBlastVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y, 1f); Main.projectile[proj].timeLeft = projTimeLeft; } } @@ -674,7 +667,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.spriteDirection = Math.Sign(NPC.velocity.X); NPC.ai[1] += 1f; - float phaseGateValue = (bossRush || enraged) ? 90f : death ? 100f : revenge ? 110f : expertMode ? 120f : 135f; + float phaseGateValue = bossRush ? 90f : death ? 100f : revenge ? 110f : expertMode ? 120f : 135f; if (NPC.ai[1] >= phaseGateValue) { NPC.ai[0] = 3f; @@ -695,7 +688,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Accelerate if (NPC.velocity.Length() < maxChargeVelocity) { - float velocityMult = (bossRush || enraged) ? 1.053333f : death ? 1.05037f : revenge ? 1.047407f : expertMode ? 1.044444f : 1.04f; + float velocityMult = bossRush ? 1.053333f : death ? 1.05037f : revenge ? 1.047407f : expertMode ? 1.044444f : 1.04f; NPC.velocity = targetVector * (NPC.velocity.Length() * velocityMult); if (NPC.velocity.Length() > maxChargeVelocity) { @@ -704,10 +697,25 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } } - else + else if (NPC.localAI[2] == 1f) { inertia *= 1.5f; NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia; + + // Stop charging towards the player when within a certain distance + if (NPC.Distance(player.Center) < 160f * NPC.scale) + NPC.localAI[2] = 2f; + } + else + { + // Slow down + if (NPC.Distance(player.Center) >= 240f * NPC.scale || NPC.localAI[2] == 3f) + { + if (NPC.localAI[2] != 3f) + NPC.localAI[2] = 3f; + + NPC.velocity *= 0.98f; + } } // Throw down holy fire while charging @@ -783,7 +791,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool targetRanAwayAndWillNowBeFucked = NPC.ai[2] == 1f; bool boostVelocityToCatchUp = NPC.ai[1] == 0f || targetRanAwayAndWillNowBeFucked; - float velocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float velocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) velocity *= 1.25f; if (boostVelocityToCatchUp) @@ -795,7 +803,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; float totalSpears = 12f; - float shootDuration = (bossRush || enraged) ? 240f : death ? 280f : revenge ? 300f : expertMode ? 320f : 360f; + float shootDuration = bossRush ? 240f : death ? 280f : revenge ? 300f : expertMode ? 320f : 360f; float dontShootTime = shootDuration * 0.3f; float phaseGateValue = dontShootTime + shootDuration; @@ -840,7 +848,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } else if (NPC.ai[1] % spearShootDivisor == 0f) { - float spearVelocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float spearVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) spearVelocity *= 1.25f; if (boostVelocityToCatchUp) @@ -858,8 +866,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[1] % (spearShootDivisor * 3) == 0f || targetRanAwayAndWillNowBeFucked) { knockbackVelocity *= 2f; - int baseProjectileAmt = (bossRush || enraged) ? 8 : expertMode ? 6 : 4; - int spread = (bossRush || enraged) ? 60 : expertMode ? 50 : 40; + int baseProjectileAmt = bossRush ? 8 : expertMode ? 6 : 4; + int spread = bossRush ? 60 : expertMode ? 50 : 40; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < baseProjectileAmt; i++) { @@ -895,7 +903,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } float laserGateValue = 120f; - float velocity = (bossRush || enraged) ? 4.5f : death ? 4f : revenge ? 3.75f : expertMode ? 3.5f : 3f; + float velocity = bossRush ? 4.5f : death ? 4f : revenge ? 3.75f : expertMode ? 3.5f : 3f; if (NPC.ai[1] < laserGateValue) velocity *= 6f; if (Main.getGoodWorld) @@ -951,9 +959,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians { if (NPC.ai[2] == laserGateValue) { - float rotation = (bossRush || enraged) ? 435f : death ? 445f : revenge ? 450f : expertMode ? 455f : 465f; + float rotation = bossRush ? 435f : death ? 445f : revenge ? 450f : expertMode ? 455f : 465f; - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < 2800f) + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < 2800f) SoundEngine.PlaySound(HolyRaySound, Main.LocalPlayer.Center); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1009,14 +1017,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; Vector2 drawPos = NPC.Center - screenPos; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); int afterimageAmt = 5; if (NPC.ai[0] == 2f) afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -1028,24 +1036,19 @@ namespace CalamityMod.NPCs.ProfanedGuardians afterimageColor = colorOverride.Value; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = drawPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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 = Texture_Glow.Value; Color timeBasedColorLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (NPC.Calamity().CurrentlyEnraged) - { - texture2D15 = TextureNight_Glow.Value; - timeBasedColorLerp = Color.Lerp(Color.White, Color.Cyan, 0.75f); - } if (Main.zenithWorld) { texture2D15 = TextureNight_Glow.Value; @@ -1054,7 +1057,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (colorOverride != null) timeBasedColorLerp = colorOverride.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -1066,13 +1069,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians timeBasedAfterimageColor = colorOverride.Value; Vector2 timeBasedAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - timeBasedAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + timeBasedAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; timeBasedAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, timeBasedAfterimagePos, NPC.frame, timeBasedAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, timeBasedColorLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(Main.zenithWorld ? Main.DiscoColor : new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects @@ -1148,14 +1153,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 shieldDrawPos = NPC.Center - screenPos; shieldDrawPos -= new Vector2(shieldTexture.Width, shieldTexture.Height) * NPC.scale / 2f; shieldDrawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - float minHue = NPC.Calamity().CurrentlyEnraged ? 0.4f : (defenderAlive && healerAlive) ? 0.18f : 0.06f; + float minHue = (defenderAlive && healerAlive) ? 0.18f : 0.06f; float maxHue = minHue + 0.12f; float opacityScaleDuringShieldDespawn = (TimeForShieldDespawn - NPC.localAI[1]) / TimeForShieldDespawn; float scaleDuringShieldDespawnScale = 1.8f; float scaleDuringShieldDespawn = (1f - opacityScaleDuringShieldDespawn) * scaleDuringShieldDespawnScale; float colorScale = MathHelper.Lerp(0f, shieldOpacity, opacityScaleDuringShieldDespawn); - Color color = Main.hslToRgb(MathHelper.Lerp(NPC.Calamity().CurrentlyEnraged ? minHue : maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; - Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, NPC.Calamity().CurrentlyEnraged ? maxHue : maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color = Main.hslToRgb(MathHelper.Lerp(maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; color2.A = 0; color *= 0.6f; color2 *= 0.6f; @@ -1182,20 +1187,20 @@ namespace CalamityMod.NPCs.ProfanedGuardians shieldEffect.Parameters["shieldColor"].SetValue(color.ToVector3()); shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + // The shield for the border MUST be drawn before the main shield, it becomes incredibly visually obnoxious otherwise. 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; - Main.spriteBatch.Draw(heatTex, shieldDrawPos, null, Color.White, 0, heatTex.Size() / 2f, shieldScale * scaleMult * 0.5f, 0, 0); + var matrix = Main.GameViewMatrix.TransformationMatrix; + Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, matrix, () => + { + // 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; + Main.spriteBatch.Draw(heatTex, shieldDrawPos, null, Color.White, 0, heatTex.Size() / 2f, shieldScale * scaleMult * 0.5f, 0, 0); + }); } return false; @@ -1207,7 +1212,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { npcLoot.Add(ModContent.ItemType(), 4); npcLoot.Add(ModContent.ItemType(), 7); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 5); npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType()); npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 10, 15, 15, 20)); @@ -1284,7 +1289,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA2").Type, 1f); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png index 2eca7f5a61..ebb165bb65 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png and b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index e3c251eba4..d15b591dfc 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -4,7 +4,8 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Items; +using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -34,8 +35,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 10; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 10; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -117,7 +118,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.12f + NPC.velocity.Length() / 120f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -246,20 +247,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - // Enrage at nighttime - bool enraged = false; - if (!Main.dayTime && !Main.remixWorld) - { - enraged = true; - NPC.Calamity().CurrentlyEnraged = true; - } - bool phase1 = healerAlive; NPC.chaseable = !phase1; // Phase durations - float commanderGuardPhase2Duration = (bossRush || enraged) ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float commanderGuardPhase2Duration = bossRush ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; float timeBeforeRocksRespawnInPhase2 = 90f; float throwRocksGateValue = 60f; @@ -268,7 +261,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge variables float chargeVelocityMult = 0.25f; - float maxChargeVelocity = (bossRush || enraged) ? 25f : death ? 22f : revenge ? 20.5f : expertMode ? 19f : 16f; + float maxChargeVelocity = bossRush ? 25f : death ? 22f : revenge ? 20.5f : expertMode ? 19f : 16f; if (Main.getGoodWorld) maxChargeVelocity *= 1.15f; @@ -388,7 +381,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - float moveVelocity = (bossRush || enraged) ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; + float moveVelocity = bossRush ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; if (Main.getGoodWorld) moveVelocity *= 1.25f; if (healerAlive) @@ -438,7 +431,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Lay a holy bomb every once in a while in phase 1 and while not doing the laser attack if (!commanderUsingLaser) { - float projectileShootGateValue = (bossRush || enraged) ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float projectileShootGateValue = bossRush ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; NPC.ai[1] += 1f; if (NPC.ai[1] >= projectileShootGateValue) { @@ -508,7 +501,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians float shootMoltenBlastsGateValue = commanderGuardPhase2Duration / moltenBlastsDivisor; if (NPC.ai[1] % shootMoltenBlastsGateValue == 0f && !commanderGoingLowOrHighInPhase2) { - float moltenBlastVelocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float moltenBlastVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; int projTimeLeft = (int)(2400f / moltenBlastVelocity); Vector2 velocity = Vector2.Normalize(player.Center - shootFrom) * moltenBlastVelocity; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -517,7 +510,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians int damage = NPC.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y, 1f); Main.projectile[proj].timeLeft = projTimeLeft; } } @@ -615,7 +608,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.spriteDirection = Math.Sign(NPC.velocity.X); NPC.ai[1] += 1f; - float phaseGateValue = (bossRush || enraged) ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; + float phaseGateValue = bossRush ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; if (NPC.ai[1] >= phaseGateValue) { NPC.ai[0] = 3f; @@ -636,7 +629,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Accelerate if (NPC.velocity.Length() < maxChargeVelocity) { - float velocityMult = (bossRush || enraged) ? 1.04f : death ? 1.036667f : revenge ? 1.035f : expertMode ? 1.033333f : 1.03f; + float velocityMult = bossRush ? 1.04f : death ? 1.036667f : revenge ? 1.035f : expertMode ? 1.033333f : 1.03f; NPC.velocity = targetVector * (NPC.velocity.Length() * velocityMult); if (NPC.velocity.Length() > maxChargeVelocity) { @@ -645,11 +638,26 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } } - else + else if (NPC.localAI[2] == 1f) { // Charge towards target - float inertia = (bossRush || enraged) ? 57f : death ? 63f : revenge ? 66f : expertMode ? 69f : 75f; + float inertia = bossRush ? 57f : death ? 63f : revenge ? 66f : expertMode ? 69f : 75f; NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia; + + // Stop charging towards the player when within a certain distance + if (NPC.Distance(player.Center) < 160f * NPC.scale) + NPC.localAI[2] = 2f; + } + else + { + // Slow down + if (NPC.Distance(player.Center) >= 240f * NPC.scale || NPC.localAI[2] == 3f) + { + if (NPC.localAI[2] != 3f) + NPC.localAI[2] = 3f; + + NPC.velocity *= 0.98f; + } } // Lay holy bombs while charging @@ -729,14 +737,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; Vector2 drawPos = NPC.Center - screenPos; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); int afterimageAmt = 5; if (NPC.ai[0] == 2f) afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -748,24 +756,19 @@ namespace CalamityMod.NPCs.ProfanedGuardians afterimageColor = colorOverride.Value; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = drawPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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 = Texture_Glow.Value; Color timeBasedGlowColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (NPC.Calamity().CurrentlyEnraged) - { - texture2D15 = TextureNight_Glow.Value; - timeBasedGlowColor = Color.Lerp(Color.White, Color.Cyan, 0.75f); - } if (Main.zenithWorld) { texture2D15 = TextureNight_Glow.Value; @@ -774,7 +777,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (colorOverride != null) timeBasedGlowColor = colorOverride.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -786,13 +789,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians timeBasedAfterimageColor = colorOverride.Value; Vector2 timeBasedAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - timeBasedAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + timeBasedAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; timeBasedAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, timeBasedAfterimagePos, NPC.frame, timeBasedAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, timeBasedGlowColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(Main.zenithWorld ? Main.DiscoColor : new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects @@ -860,14 +865,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 shieldDrawPos = NPC.Center - screenPos; shieldDrawPos -= new Vector2(shieldTexture.Width, shieldTexture.Height) * NPC.scale / 2f; shieldDrawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - float minHue = NPC.Calamity().CurrentlyEnraged ? 0.4f : 0.06f; + float minHue = 0.06f; float maxHue = minHue + 0.12f; float opacityScaleDuringShieldDespawn = (TimeForShieldDespawn - NPC.localAI[1]) / TimeForShieldDespawn; float scaleDuringShieldDespawnScale = 1.8f; float scaleDuringShieldDespawn = (1f - opacityScaleDuringShieldDespawn) * scaleDuringShieldDespawnScale; float colorScale = MathHelper.Lerp(0f, shieldOpacity, opacityScaleDuringShieldDespawn); - Color color = Main.hslToRgb(MathHelper.Lerp(NPC.Calamity().CurrentlyEnraged ? minHue : maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; - Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, NPC.Calamity().CurrentlyEnraged ? maxHue : maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color = Main.hslToRgb(MathHelper.Lerp(maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; color2.A = 0; color *= 0.6f; color2 *= 0.6f; @@ -894,19 +899,21 @@ namespace CalamityMod.NPCs.ProfanedGuardians shieldEffect.Parameters["shieldColor"].SetValue(color.ToVector3()); shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + var matrix = Main.GameViewMatrix.TransformationMatrix; + + // The shield for the border MUST be drawn before the main shield, it becomes incredibly visually obnoxious otherwise. 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; - Main.spriteBatch.Draw(heatTex, shieldDrawPos, null, Color.White, 0, heatTex.Size() / 2f, shieldScale * scaleMult * 0.5f, 0, 0); + Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, matrix, () => + { + // 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; + Main.spriteBatch.Draw(heatTex, shieldDrawPos, null, Color.White, 0, heatTex.Size() / 2f, shieldScale * scaleMult * 0.5f, 0, 0); + }); } return false; @@ -967,7 +974,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT2").Type, 1f); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png index fc376c8f91..7a5a231e59 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png and b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 1a431ca882..1ea8449522 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items; +using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -46,8 +47,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 10; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 10; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -124,7 +125,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.12f + NPC.velocity.Length() / 120f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -176,14 +177,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[0] >= 300f) NPC.ai[1] = 1f; - // Enrage at nighttime - bool enraged = false; - if (!Main.dayTime && !Main.remixWorld) - { - enraged = true; - NPC.Calamity().CurrentlyEnraged = true; - } - // Direction if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -223,7 +216,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } bool useCrystalShards = AIState == (float)Phase.CrystalShards; - float velocity = useCrystalShards ? ((bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) : (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f); + float velocity = useCrystalShards ? (bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) : (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f); if (Main.getGoodWorld) velocity *= 1.25f; @@ -311,7 +304,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - int totalProjectiles = (bossRush || enraged) ? 18 : death ? 16 : revenge ? 14 : expertMode ? 12 : 10; + int totalProjectiles = bossRush ? 18 : death ? 16 : revenge ? 14 : expertMode ? 12 : 10; float speedX = -12f; float speedAdjustment = Math.Abs(speedX * 2f / (totalProjectiles - 1)); float speedY = -4f; @@ -350,7 +343,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, shootFrom); - int totalFlameProjectiles = (bossRush || enraged) ? 20 : 16; + int totalFlameProjectiles = bossRush ? 20 : 16; int totalRings = revenge ? 3 : 2; int healingStarChance = revenge ? 8 : expertMode ? 6 : 4; double radians = MathHelper.TwoPi / totalFlameProjectiles; @@ -368,7 +361,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians int type = ModContent.ProjectileType(); int dmgAmt = NPC.GetProjectileDamage(type); - if (Main.rand.NextBool(healingStarChance) && !enraged && !death) + if (Main.rand.NextBool(healingStarChance) && !death) { type = ModContent.ProjectileType(); dmgAmt = NPC.GetProjectileDamageNoScaling(type); @@ -411,7 +404,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Move towards a location above the player if (distanceFromDestination.Length() > idealDistanceFromDestination) { - float inertia = (bossRush || enraged) ? 28f : death ? 32f : revenge ? 34f : expertMode ? 36f : 40f; + float inertia = bossRush ? 28f : death ? 32f : revenge ? 34f : expertMode ? 36f : 40f; if (lifeRatio < 0.5f) inertia *= 0.8f; if (Main.getGoodWorld) @@ -436,12 +429,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = TextureAssets.Npc[Type].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); + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -453,24 +446,19 @@ namespace CalamityMod.NPCs.ProfanedGuardians afterimageColor = colorOverride.Value; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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 = Texture_Glow.Value; Color timeBasedDrawColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (NPC.Calamity().CurrentlyEnraged) - { - texture2D15 = TextureNight_Glow.Value; - timeBasedDrawColor = Color.Lerp(Color.White, Color.Cyan, 0.75f); - } if (Main.zenithWorld) { texture2D15 = TextureNight_Glow.Value; @@ -483,7 +471,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians overrideColor = colorOverride.Value; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -495,7 +483,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians timeBasedAfterimageColor = colorOverride.Value; Vector2 timeBasedAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - timeBasedAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + timeBasedAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; timeBasedAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, timeBasedAfterimagePos, NPC.frame, timeBasedAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -510,7 +498,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, timeBasedDrawColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(Main.zenithWorld ? Main.DiscoColor : new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, overrideColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -591,7 +581,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH2").Type, 1f); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png index c793ba7e51..9e5f5ea74d 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png and b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index 424fa991ee..cf2bb60939 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { for (int i = 0; i < 6; i++) @@ -326,7 +326,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Rectangle frame = new Rectangle(0, 0, texture.Width, texture.Height); if (!NPC.dontTakeDamage) - NPC.DrawBackglow(Color.Orange, 4f, SpriteEffects.None, frame, screenPos, texture); + NPC.DrawBackglow(Color.Orange.MultiplyRGBA(new Color(255, 255, 255, 0)), 4f, SpriteEffects.None, frame, screenPos, texture); spriteBatch.Draw(texture, drawPos, frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, SpriteEffects.None, 0f); @@ -375,7 +375,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int npcType = (int)NPC.ai[2]; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedRocksGore" + npcType.ToString()).Type, NPC.scale); diff --git a/NPCs/Providence/Glowmasks/ProvidenceAltGlow.png b/NPCs/Providence/Glowmasks/ProvidenceAltGlow.png index 5eb0e426b9..99b6e2d0a5 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAltGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceAltGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAltGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceAltGlow2.png index 60af8aa914..3259cd5af7 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAltGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceAltGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAltGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceAltGlow2Night.png deleted file mode 100644 index 04cb6c8f39..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAltGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow.png b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow.png index 0b219d9c96..b99318ed88 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2.png index 9cc5fd91d0..0715bea009 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2Night.png deleted file mode 100644 index b019542ded..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow.png b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow.png index e500c7d85b..66778d1c6f 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2.png index 32d83dd410..59773a389b 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2Night.png deleted file mode 100644 index 0ce832dc3f..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackGlowNight.png b/NPCs/Providence/Glowmasks/ProvidenceAttackGlowNight.png index 8a8fab82c6..2394c98c2f 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackGlowNight.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackGlowNight.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow.png index d95fd5fac7..bfc7b4d123 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2.png index 8672089e76..a51a57aad6 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2Night.png deleted file mode 100644 index 687d9e3336..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlowNight.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlowNight.png index 3b9c2e7427..bfdd7e0b67 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlowNight.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlowNight.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow.png index 858b3dbff1..e9b80e61be 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2.png index c0ea7d61ed..e5f4272ac7 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2Night.png deleted file mode 100644 index 78d8a5d5df..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlowNight.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlowNight.png index bd27430046..f75ec70fd8 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlowNight.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlowNight.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceGlow.png b/NPCs/Providence/Glowmasks/ProvidenceGlow.png index 0edb725458..3a35e2d9af 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceGlow2.png index f4268ee8df..e1003731dc 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceGlow2Night.png deleted file mode 100644 index d9e79a8288..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceGlowNight.png b/NPCs/Providence/Glowmasks/ProvidenceGlowNight.png index 3d1a8a1623..7452b5d31e 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceGlowNight.png and b/NPCs/Providence/Glowmasks/ProvidenceGlowNight.png differ diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index fa20dda140..378213ad2d 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -21,9 +21,9 @@ namespace CalamityMod.NPCs.Providence public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 10; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 10; + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.Providence else NPC.frameCounter += 0.12f + Main.npc[CalamityGlobalNPC.holyBoss].velocity.Length() / 120f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -114,11 +114,11 @@ namespace CalamityMod.NPCs.Providence if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -127,21 +127,21 @@ namespace CalamityMod.NPCs.Providence afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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 = ProfanedGuardianDefender.Texture_Glow.Value; Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -150,13 +150,15 @@ namespace CalamityMod.NPCs.Providence yellowAfterimageColor = NPC.GetAlpha(yellowAfterimageColor); yellowAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 yellowAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - yellowAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + yellowAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; yellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, yellowAfterimagePos, NPC.frame, yellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, yellowLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, vector43, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -177,7 +179,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT2").Type, 1f); diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 7304ea3029..a89548e32b 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -21,9 +21,9 @@ namespace CalamityMod.NPCs.Providence public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 10; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 10; + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -64,7 +64,7 @@ namespace CalamityMod.NPCs.Providence else NPC.frameCounter += 0.12f + Main.npc[CalamityGlobalNPC.holyBoss].velocity.Length() / 120f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -113,12 +113,12 @@ namespace CalamityMod.NPCs.Providence if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = TextureAssets.Npc[Type].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)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -127,14 +127,14 @@ namespace CalamityMod.NPCs.Providence afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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); @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.Providence Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); Color violetLerp = Color.Lerp(Color.White, Color.Violet, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -151,7 +151,7 @@ namespace CalamityMod.NPCs.Providence yellowAfterimageColor = NPC.GetAlpha(yellowAfterimageColor); yellowAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 yellowAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - yellowAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + yellowAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; yellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, yellowAfterimagePos, NPC.frame, yellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -163,7 +163,9 @@ namespace CalamityMod.NPCs.Providence } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, yellowLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, violetLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -186,7 +188,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH2").Type, 1f); diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 4cf657f7f5..2466f1a134 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -21,9 +21,9 @@ namespace CalamityMod.NPCs.Providence public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 10; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 10; + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.Providence else NPC.frameCounter += 0.12f + Main.npc[CalamityGlobalNPC.holyBoss].velocity.Length() / 120f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -114,13 +114,13 @@ namespace CalamityMod.NPCs.Providence if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 5; if (NPC.ai[0] == 2f) afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -129,21 +129,21 @@ namespace CalamityMod.NPCs.Providence afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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 = ProfanedGuardianCommander.Texture_Glow.Value; Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -152,13 +152,15 @@ namespace CalamityMod.NPCs.Providence yellowAfterimageColor = NPC.GetAlpha(yellowAfterimageColor); yellowAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 yellowAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - yellowAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + yellowAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; yellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, yellowAfterimagePos, NPC.frame, yellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, yellowLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -179,7 +181,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA2").Type, 1f); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 66c3a7bb2f..2130aad947 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -3,8 +3,10 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Wings; using CalamityMod.Items.Armor.Vanity; @@ -22,6 +24,8 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Packets; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -38,6 +42,7 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -69,16 +74,13 @@ namespace CalamityMod.NPCs.Providence public enum BossMode { - Night = -1, - Day = 0, - Red = 1, - Orange = 2, - Yellow = 3, - Green = 4, - Blue = 5, - Violet = 6 + Enraged = -1, + Normal = 0, + Rainbow = 1, } - public int colorShiftTimer = -1; + + Color HighFireColor = new Color(255, 191, 73); + Color LowFireColor = new Color(116, 45, 23); private bool text = false; private bool useDefenseFrames = false; @@ -88,25 +90,27 @@ namespace CalamityMod.NPCs.Providence private int phaseChange = 0; private int frameUsed = 0; private int healTimer = 0; - internal bool challenge = Main.expertMode; //Used to determine if Profaned Soul Crystal should drop, couldn't figure out mp mems always dropping it so challenge is singleplayer only. - internal bool hasTakenDaytimeDamage = false; - public static bool shouldDrawInfernoBorder = true; //This is only here for other mods to disable it if they don't want it drawing. + internal bool challenge = Main.expertMode; // Used to determine if Profaned Soul Crystal should drop, couldn't figure out mp mems always dropping it so challenge is singleplayer only. + public bool hasBeenGivenFullPower = false; + public static bool shouldDrawInfernoBorder = true; // This is only here for other mods to disable it if they don't want it drawing. public bool Dying = false; public int DeathAnimationTimer; public static float borderRadius = 3000f; - //Sounds + // Sounds public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceSpawn") { Volume = 1.2f }; - public static readonly SoundStyle HolyRaySound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyRay") { Volume = 1.25f }; //note : Volume gets clamped between 0 and 1. I don't think this does anything, but it was in the original ModSound so im keeping it just in case + public static readonly SoundStyle HolyRaySound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyRay") { Volume = 1.25f }; // NOTE : Volume gets clamped between 0 and 1. I don't think this does anything, but it was in the original ModSound so im keeping it just in case public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/ProvidenceHurt"); public static readonly SoundStyle DeathAnimationSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceDeathAnimation"); public static readonly SoundStyle NearBurnSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceSizzle"); public static readonly SoundStyle BurnStartSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn"); public static readonly SoundStyle BurnLoopSound = new SoundStyle("CalamityMod/Sounds/Custom/Providence/ProvidenceBurnLoop") with { IsLooped = true }; - //Sound slot for the burning damage over time effect + + // Sound slot for the burning damage over time effect public SlotId BurningSoundSlot; - //Level of sound playing + + // Level of sound playing public float SoundWarningLevel = -1f; public static float normalDR = 0.3f; @@ -115,7 +119,7 @@ namespace CalamityMod.NPCs.Providence private const float TimeForStarDespawn = 120f; private const float TimeForShieldDespawn = 120f; - // Every single one of Providence's sprites, both night and day, and their glowmasks + // Every single one of Providence's sprites, both normal and enraged, and their glowmasks #region Textures public static Asset TextureAlt; public static Asset TextureAltNight; @@ -155,10 +159,15 @@ namespace CalamityMod.NPCs.Providence public static Asset TextureNight_Glow_2; #endregion + public override void OnSpawn(IEntitySource source) + { + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, -1); + } + public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 3; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 3; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -178,16 +187,16 @@ namespace CalamityMod.NPCs.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); + 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); @@ -206,20 +215,28 @@ namespace CalamityMod.NPCs.Providence // 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 ModifyHoverBoundingBox(ref Rectangle boundingBox) + { + // Is in spawning animation + float spawnAnimationTime = 180f; + bool spawnAnimation = NPC.Calamity().newAI[3] < spawnAnimationTime; + + if (spawnAnimation) + { + boundingBox = new Rectangle(0, 0, 0, 0); + } + + base.ModifyHoverBoundingBox(ref boundingBox); + } + public override void SetDefaults() { NPC.npcSlots = 36f; @@ -232,7 +249,7 @@ namespace CalamityMod.NPCs.Providence NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(3, 0, 0, 0); + NPC.value = Item.buyPrice(1, 50, 0, 0); NPC.boss = true; NPC.Opacity = 0f; NPC.noGravity = true; @@ -266,7 +283,6 @@ namespace CalamityMod.NPCs.Providence writer.Write(text); writer.Write(useDefenseFrames); writer.Write(biomeType); - writer.Write(colorShiftTimer); writer.Write(phaseChange); writer.Write(frameUsed); writer.Write(healTimer); @@ -292,7 +308,6 @@ namespace CalamityMod.NPCs.Providence text = reader.ReadBoolean(); useDefenseFrames = reader.ReadBoolean(); biomeType = reader.ReadInt32(); - colorShiftTimer = reader.ReadInt32(); phaseChange = reader.ReadInt32(); frameUsed = reader.ReadInt32(); healTimer = reader.ReadInt32(); @@ -313,11 +328,8 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().newAI[i] = reader.ReadSingle(); // Be sure to inform clients of the fact that Providence is dying if only the server recieved this packet. - if (Main.netMode == NetmodeID.Server && !wasDyingBefore && Dying) - { - NPC.netSpam = 0; - NPC.netUpdate = true; - } + if (Main.dedServ && !wasDyingBefore && Dying) + NPC.ForceNetUpdate(); } public override void AI() @@ -332,7 +344,7 @@ namespace CalamityMod.NPCs.Providence CalamityGlobalNPC.holyBoss = NPC.whoAmI; // Rotation - NPC.rotation = NPC.velocity.X * 0.004f; + NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.velocity.X * 0.006f, 0.1f); // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -345,40 +357,24 @@ namespace CalamityMod.NPCs.Providence // Target variable and boss center Player player = Main.player[NPC.target]; - // Night bool and Color shifting + // Enraged bool and Color shifting bool bossRush = BossRushEvent.BossRushActive; bool getFuckedAI = Main.zenithWorld; - int timeToShift = 30; //Switches color every half-second if (getFuckedAI) - { - colorShiftTimer++; - - if (colorShiftTimer == -1) //Initiate - { - NPC.localAI[1] = (float)BossMode.Red; - colorShiftTimer = 0; - } - else if (colorShiftTimer >= timeToShift) - { - NPC.localAI[1]++; - if (NPC.localAI[1] > (float)BossMode.Violet) - NPC.localAI[1] = (float)BossMode.Red; - colorShiftTimer = 0; - } - } - else if ((!Main.dayTime && !Main.remixWorld) || bossRush) //Normal Night time activity - NPC.localAI[1] = (float)BossMode.Night; + NPC.localAI[1] = (float)BossMode.Rainbow; + else if (hasBeenGivenFullPower || bossRush) // Enraged behavior + NPC.localAI[1] = (float)BossMode.Enraged; else - NPC.localAI[1] = (float)BossMode.Day; + NPC.localAI[1] = (float)BossMode.Normal; - //Has Night AI if it's any color except day - bool nightAI = NPC.localAI[1] != (float)BossMode.Day; + // Fully powered up AI if it's any color except normal + bool fullPowerAI = NPC.localAI[1] != (float)BossMode.Normal; // Difficulty bools - bool death = CalamityWorld.death || nightAI; - bool revenge = CalamityWorld.revenge || nightAI; - bool expertMode = Main.expertMode || nightAI; + bool death = CalamityWorld.death || fullPowerAI; + bool revenge = CalamityWorld.revenge || fullPowerAI; + bool expertMode = Main.expertMode || fullPowerAI; // Target's current biome bool isHoly = player.ZoneHallow; @@ -391,11 +387,16 @@ namespace CalamityMod.NPCs.Providence float spawnAnimationTime = 180f; bool spawnAnimation = calamityGlobalNPC.newAI[3] < spawnAnimationTime; + if (!spawnAnimation) + { + NPC.Opacity = 1f; + } + // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Play enrage animation if night starts - if (!getFuckedAI && nightAI && calamityGlobalNPC.newAI[3] == spawnAnimationTime) + // Play enrage animation if she gets angy + if (!getFuckedAI && fullPowerAI && calamityGlobalNPC.newAI[3] == spawnAnimationTime) { AIState = (int)Phase.HolyBlast; NPC.ai[1] = 0f; @@ -404,19 +405,23 @@ namespace CalamityMod.NPCs.Providence calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - NPC.netUpdate = true; - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + // Despawn existing projectiles and summon the aura again + DespawnSpecificProjectiles(true); + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, -1); + if (Main.netMode != NetmodeID.SinglePlayer) + ProvidenceDyeConditionSyncPacket.Send(this); + NPC.ForceNetUpdate(false); } - // Increase all projectile damage at night, but reduce to 0 for Zenith + // Increase all projectile damage while enraged, but reduce to 0 for Zenith int projectileDamageMult = 1; - if (nightAI) + if (getFuckedAI) + projectileDamageMult = 0; + else if (fullPowerAI) projectileDamageMult = 2; - NPC.Calamity().CurrentlyEnraged = !bossRush && nightAI; + NPC.Calamity().CurrentlyEnraged = !bossRush && fullPowerAI; // Projectile damage values int holyLaserDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; @@ -428,19 +433,19 @@ namespace CalamityMod.NPCs.Providence int holyBlastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; int holyStarDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - // Change dust type at night - int dustType = ProvUtils.GetDustID(NPC.localAI[1]); + // Change dust type while enraged + int dustType = ProvUtils.GetDustID(); // Phase times - float phaseTime = nightAI ? (240f - 60f * (1f - lifeRatio)) : 300f; - float crystalPhaseTime = nightAI ? (float)Math.Round(60f * lifeRatio) : death ? 60f : 120f; - int nightCrystalTime = 210; - int gfbCrystalTime = 1500 + nightCrystalTime; + float phaseTime = fullPowerAI ? (240f - 60f * (1f - lifeRatio)) : 300f; + float crystalPhaseTime = fullPowerAI ? (float)Math.Round(60f * lifeRatio) : death ? 60f : 120f; + int enragedCrystalTime = 210; + int gfbCrystalTime = 1500 + enragedCrystalTime; float attackDelayAfterCocoon = phaseTime * 0.3f; // Phases bool ignoreGuardianAmt = lifeRatio < (death ? 0.2f : 0.15f); - bool phase2 = lifeRatio < 0.75f && !nightAI; + bool phase2 = lifeRatio < 0.75f && !fullPowerAI; bool delayAttacks = NPC.localAI[2] > 0f; // Spear phase @@ -470,40 +475,45 @@ namespace CalamityMod.NPCs.Providence // Inflict Holy Inferno if target is too far away float burnIntensity = CalculateBurnIntensity(attackDelayAfterCocoon); + // Color determination + Color hiColor = ProvUtils.GetProjectileColor(0); + Color medColor = ProvUtils.GetProjectileColor(255); + Color loColor = ProvUtils.GetProjectileColor(255, true); + if (!player.dead && player.active && !player.creativeGodMode && !Dying) { - //The debuff applies + // The debuff applies if (burnIntensity >= 1f) { if (SoundWarningLevel < 2f) { - //Initialize sound + // Initialize sound SoundEngine.PlaySound(BurnStartSound, player.Center); BurningSoundSlot = SoundEngine.PlaySound(BurnLoopSound, player.Center); SoundWarningLevel = 2f; } player.AddBuff(ModContent.BuffType(), 2); } - //If the sound is still playing, make it go slowly kinda + // If the sound is still playing, make it go slowly kinda else if (SoundWarningLevel > 1f) { SoundWarningLevel -= 1 / 100f; if (SoundWarningLevel < 1f) SoundWarningLevel = 1f; } - //The player starts to get fire particles + // The player starts to get fire particles else if (burnIntensity > 0.45f) { - //If the player goes from 0 to 1, then play the sound. Doesn't play when descending. + // If the player goes from 0 to 1, then play the sound. Doesn't play when descending. if (SoundWarningLevel < 1f) SoundEngine.PlaySound(NearBurnSound, player.Center); SoundWarningLevel = 1f; } - //The player has sparks if intensity is above 0, otherwise nothing happens + // The player has sparks if intensity is above 0, otherwise nothing happens else if (burnIntensity <= 0f) { - //Reset the sound + // Reset the sound SoundWarningLevel = 0f; } } @@ -614,8 +624,8 @@ namespace CalamityMod.NPCs.Providence NPC.chaseable = normalAttackRate; // Prevent lag by stopping rain - if (CalamityConfig.Instance.BossesStopWeather) - CalamityMod.StopRain(); + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); // Set target biome type if (biomeType == 0) @@ -639,11 +649,7 @@ namespace CalamityMod.NPCs.Providence DespawnSpecificProjectiles(true); Dying = true; NPC.dontTakeDamage = true; - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); return; } @@ -729,12 +735,7 @@ namespace CalamityMod.NPCs.Providence { NPC.life += healAmt; NPC.HealEffect(healAmt, true); - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; - - NPC.netUpdate = true; + NPC.ForceNetUpdate(false); } } } @@ -768,8 +769,8 @@ namespace CalamityMod.NPCs.Providence else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - // Guardian spawn unless it's night time specifically (can still spawn on Zenith) - if (NPC.localAI[1] != (float)BossMode.Night) + // Guardian spawn unless she's enraged specifically (can still spawn on Zenith) + if (NPC.localAI[1] != (float)BossMode.Enraged) { if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -804,17 +805,16 @@ namespace CalamityMod.NPCs.Providence calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon || AIState == (int)Phase.Laser || spawnAnimation; + // Providence fires predictive holy/molten blasts if she is ahead of her target's movement + bool predictiveShots = false; + // Movement if (getFuckedAI || (AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon)) { // Slowly drift down when spawning if (spawnAnimation) { - colorShiftTimer++; // Also double the shift speed in the mean time :) - float minSpawnVelocity = 0.4f; - float maxSpawnVelocity = 4f; - float velocityY = maxSpawnVelocity - MathHelper.Lerp(minSpawnVelocity, maxSpawnVelocity, calamityGlobalNPC.newAI[3] / spawnAnimationTime); - NPC.velocity = new Vector2(0f, velocityY); + NPC.velocity = Vector2.Zero; } else { @@ -854,14 +854,18 @@ namespace CalamityMod.NPCs.Providence if (NPC.Center.X > player.Center.X && flightPath > 0 && distanceX > changeDirectionThreshold) flightPath = 0; + // Predictive shot checks + if ((NPC.velocity.X > 0f && (NPC.Center.X - player.Center.X) > 0f && player.velocity.X > 0f) || (NPC.velocity.X < 0f && (NPC.Center.X - player.Center.X) < 0f && player.velocity.X < 0f)) + predictiveShots = true; + // Velocity and acceleration - float speedIncreaseTimer = nightAI ? 75f : death ? 120f : 150f; + float speedIncreaseTimer = fullPowerAI ? 75f : death ? 120f : 150f; bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer || bossRush; float accelerationBoost = death ? 0.3f * (1f - lifeRatio) : 0.2f * (1f - lifeRatio); float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); float acceleration = (expertMode ? 1.1f : 1.05f) + accelerationBoost; float velocity = (expertMode ? 16f : 15f) + velocityBoost; - if (nightAI) + if (fullPowerAI) { acceleration = 1.5f; velocity = 25f; @@ -942,7 +946,7 @@ namespace CalamityMod.NPCs.Providence phase = (int)Phase.HolyBlast; break; case 3: - phase = (useCrystal || nightAI) ? (int)Phase.Crystal : (int)Phase.MoltenBlobs; + phase = (useCrystal || fullPowerAI) ? (int)Phase.Crystal : (int)Phase.MoltenBlobs; break; case 4: phase = useCrystal ? (int)Phase.MoltenBlobs : (int)Phase.FlameCocoon; @@ -951,31 +955,31 @@ namespace CalamityMod.NPCs.Providence phase = useCrystal ? (int)Phase.FlameCocoon : (int)Phase.HolyFire; break; case 6: - phase = (useLaser || nightAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; + phase = (useLaser || fullPowerAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; break; case 7: - phase = (useLaser || nightAI) ? (int)Phase.HolyBomb : (int)Phase.MoltenBlobs; + phase = (useLaser || fullPowerAI) ? (int)Phase.HolyBomb : (int)Phase.MoltenBlobs; break; case 8: - phase = (useLaser || nightAI) ? (int)Phase.MoltenBlobs : (int)Phase.SpearCocoon; + phase = (useLaser || fullPowerAI) ? (int)Phase.MoltenBlobs : (int)Phase.SpearCocoon; break; case 9: phase = (int)Phase.HolyBlast; break; case 10: - phase = (useCrystal || nightAI) ? (int)Phase.Crystal : (int)Phase.FlameCocoon; + phase = (useCrystal || fullPowerAI) ? (int)Phase.Crystal : (int)Phase.FlameCocoon; break; case 11: - phase = nightAI ? (int)Phase.FlameCocoon : (int)Phase.MoltenBlobs; + phase = fullPowerAI ? (int)Phase.FlameCocoon : (int)Phase.MoltenBlobs; break; case 12: - phase = (useLaser || nightAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; + phase = (useLaser || fullPowerAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; break; case 13: phase = (int)Phase.SpearCocoon; break; case 14: - phase = (useLaser || nightAI) ? (int)Phase.HolyBomb : (int)Phase.HolyBlast; + phase = (useLaser || fullPowerAI) ? (int)Phase.HolyBomb : (int)Phase.HolyBlast; break; default: break; @@ -1050,12 +1054,7 @@ namespace CalamityMod.NPCs.Providence NPC.ai[3] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; - - NPC.netUpdate = true; + NPC.ForceNetUpdate(false); break; @@ -1063,58 +1062,88 @@ namespace CalamityMod.NPCs.Providence if (spawnAnimation) { - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[3] == 0f) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + new Vector2(0f, -80f), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, biomeType, 0f); + CalamityUtils.AddScreenshakeAt(NPC.Center, MathHelper.Lerp(0f, 0.25f, calamityGlobalNPC.newAI[3] / spawnAnimationTime), 2000); - if (calamityGlobalNPC.newAI[3] == 10f) - SoundEngine.PlaySound(HolyRaySound, NPC.Center); + NPC.dontTakeDamage = true; - if (calamityGlobalNPC.newAI[3] > 10f && calamityGlobalNPC.newAI[3] < 150f) + if (calamityGlobalNPC.newAI[3] == spawnAnimationTime - 1) { - int dustAmt = (int)MathHelper.Lerp(4f, 8f, calamityGlobalNPC.newAI[3] / spawnAnimationTime); - for (int m = 0; m < dustAmt; m++) + NPC.dontTakeDamage = false; + + CalamityUtils.AddScreenshakeAt(NPC.Center, 8, 2000); + SoundEngine.PlaySound(HolyRaySound, NPC.Center); + bool photos = CalamityClientConfig.Instance.Photosensitivity; + + for (int i = 0; i < 20; i++) { - float fade = MathHelper.Lerp(1.3f, 0.7f, NPC.Opacity) * Utils.GetLerpValue(0f, 120f, calamityGlobalNPC.newAI[3], clamped: true); - Color newColor = Main.hslToRgb(calamityGlobalNPC.newAI[3] / 180f, 1f, 0.5f); + Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(1f, 1.6f), Main.rand.NextFloat(2f, 5f), hiColor * (photos ? 0.5f : 1f), loColor * (photos ? 0.5f : 1f)); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(NPC.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor * (photos ? 0.5f : 1f), 60, Main.rand.NextFloat(2.5f, 5.5f), 2f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } + CalamityUtils.AddScreenshakeAt(NPC.Center, 10, 2000); - if (!nightAI) - { - newColor.R = 255; - if (biomeType == 2) - newColor.B = 0; - } - else - { - newColor.B = 255; - if (biomeType == 2) - newColor.G = 0; - else - newColor.R = 0; - } + Color hColor = ProvUtils.GetProjectileColor(255, false) * (photos ? 0.5f : 1f); + Color lColor = ProvUtils.GetProjectileColor(0, true) * (photos ? 0.5f : 1f); - 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; - Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * fade; - Main.dust[dust].velocity += Vector2.UnitY * 3f; - Main.dust[dust].scale = 1.2f; + for (int i = 0; i < 20; i++) + { + Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(0.5f, 0.75f), Main.rand.NextFloat(1f, 2.5f), hColor, lColor); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(NPC.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor * (photos ? 0.5f : 1f), 60, Main.rand.NextFloat(0.75f, 1.75f), 1f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } - if (dust != 6000) + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.1f, 15)); + + for (float i = 0; i < 2.8f; i += 0.35f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.35f, 35)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.475f, 25)); + } + } + + float sc = calamityGlobalNPC.newAI[3] / spawnAnimationTime; + + if (calamityGlobalNPC.newAI[3] > 10f && calamityGlobalNPC.newAI[3] < spawnAnimationTime) + { + // Move effects slightly lower during enrage animation to appear as if they're converging on her core + Vector2 destination = NPC.Center + (NPC.localAI[1] != (float)BossMode.Normal ? new Vector2(0f, 40f) : Vector2.Zero); + + if (calamityGlobalNPC.newAI[3] % (CalamityClientConfig.Instance.Photosensitivity ? 15f : 10f) == 0) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(destination, Vector2.Zero, Color.Lerp(new Color(25, 25, 25, 0), medColor, sc), "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1.5f, 1f), Main.rand.NextBool() ? 0f : MathHelper.Pi, sc * 0.5f, sc * 0.1f, 20)); + + SoundStyle SpawnFlareSound = SoundID.Item74; + SpawnFlareSound.MaxInstances = 10; + SoundEngine.PlaySound(SpawnFlareSound.WithVolumeScale(calamityGlobalNPC.newAI[3] / spawnAnimationTime).WithPitchOffset(-1 + (calamityGlobalNPC.newAI[3] / spawnAnimationTime)), NPC.Center); + } + + Vector2 startPos = destination + (new Vector2(Main.rand.NextFloat(80, 300) * (sc * 1.6f), 0).RotatedByRandom(Main.rand.NextFloat(MathHelper.TwoPi)) * new Vector2(1.5f, 1f)); + GeneralParticleHandler.SpawnParticle(new SparkParticle(startPos, startPos.DirectionTo(destination) * (startPos.Distance(destination) / 10), false, 10, Main.rand.NextFloat(0.2f, 0.5f) * (sc * 2), medColor)); + } + + // Used to heal her back to full HP during enrage animation + if (fullPowerAI && calamityGlobalNPC.newAI[3] % 9f == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = NPC.lifeMax / 400; + if (healAmt > NPC.lifeMax - NPC.life) + healAmt = NPC.lifeMax - NPC.life; + + if (healAmt > 0) { - Dust dust2 = Dust.CloneDust(dust); - dust2.scale /= 2f; - dust2.fadeIn *= 0.85f; - dust2.color = new Color(255, 255, 0, 255); + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.ForceNetUpdate(false); } } } - NPC.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); - calamityGlobalNPC.newAI[3] += 1f; - if (nightAI && calamityGlobalNPC.newAI[3] >= spawnAnimationTime) + if (fullPowerAI && calamityGlobalNPC.newAI[3] >= spawnAnimationTime) calamityGlobalNPC.newAI[3] += 1f; return; @@ -1141,23 +1170,13 @@ namespace CalamityMod.NPCs.Providence if (NPC.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 npcCenter = NPC.Center; - npcCenter.X += NPC.velocity.X * 7f; - float playerXDist = player.position.X + player.width * 0.5f - npcCenter.X; - float playerYDist = player.Center.Y - npcCenter.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - + Vector2 projectileFirePosition = new Vector2(NPC.Center.X + NPC.velocity.SafeNormalize(Vector2.UnitX).X * 120f, NPC.Center.Y); float velocityBoost = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); - float projSpeed = (expertMode ? 10.25f : 9f) + velocityBoost; - - if (revenge) - projSpeed *= 1.15f; - - playerDistance = projSpeed / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, playerXDist, playerYDist, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); + float projSpeed = (revenge ? 12f : expertMode ? 10.5f : 9f) + velocityBoost; + Vector2 predictionAmount = player.velocity * 100f; + Vector2 projectileVelocity = (player.Center + (predictiveShots ? predictionAmount : Vector2.Zero) - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; + Vector2 explodePosition = predictiveShots ? (player.position + predictionAmount) : player.position; + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); } } else if (NPC.ai[3] < 0f) @@ -1204,7 +1223,7 @@ namespace CalamityMod.NPCs.Providence projectileVelocityY += expertMode ? 4f : 3f; - if (nightAI) + if (fullPowerAI) projectileVelocityY *= 2f; Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom.X, shootFrom.Y, NPC.velocity.X * 0.25f, projectileVelocityY, ModContent.ProjectileType(), holyFireDamage, 0f, Main.myPlayer); @@ -1222,6 +1241,7 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.FlameCocoon: + Vector2 fireSparklesFrom = fireFrom + new Vector2(0, -30); if (!targetDead && !getFuckedAI) { if (NPC.velocity.Length() <= 2f) @@ -1263,40 +1283,17 @@ namespace CalamityMod.NPCs.Providence projectileType = ModContent.ProjectileType(); dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); } else if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); - - Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : (projectileType == ModContent.ProjectileType() ? Color.Orange : Color.Green)).X, 1f, 0.5f); - dustColor.A = 255; - int maxDust = 3; - for (int j = 0; j < maxDust; j++) - { - 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; - Main.dust[dust].scale = 1f + j; - Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); - Dust dust3 = dust2; - dust3.scale /= 2f; - dust3 = dust2; - dust3.fadeIn /= 2f; - dust2.color = new Color(255, 255, 255, 255); - } + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); } // Radial offset NPC.ai[2] += 10f; } - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } else { @@ -1323,29 +1320,10 @@ namespace CalamityMod.NPCs.Providence projectileType = ModContent.ProjectileType(); dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); } else if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); - - Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : (projectileType == ModContent.ProjectileType() ? Color.Orange : Color.Green)).X, 1f, 0.5f); - dustColor.A = 255; - int maxDust = 3; - for (int j = 0; j < maxDust; j++) - { - 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; - Main.dust[dust].scale = 1f + j; - Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); - Dust dust3 = dust2; - dust3.scale /= 2f; - dust3 = dust2; - dust3.fadeIn /= 2f; - dust2.color = new Color(255, 255, 255, 255); - } + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); } } } @@ -1364,12 +1342,12 @@ namespace CalamityMod.NPCs.Providence } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireFrom) * cocoonProjVelocity * 1.5f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireSparklesFrom) * cocoonProjVelocity * 1.5f; int type = ModContent.ProjectileType(); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, type, holyStarDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, velocity2, type, holyStarDamage, 0f, Main.myPlayer); - Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : Color.Orange).X, 1f, 0.5f); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(fullPowerAI ? new Color(100, 200, 250) : Color.Orange).X, 1f, 0.5f); dustColor.A = 255; int maxDust = 3; for (int j = 0; j < maxDust; j++) @@ -1407,9 +1385,9 @@ namespace CalamityMod.NPCs.Providence // Inflict Icarus Folly if (NPC.ai[3] >= (phaseTime * 2f)) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Player player2 = Main.player[Main.myPlayer]; + Player player2 = Main.LocalPlayer; bool inLiquid = (player2.wet || player2.honeyWet) && !player2.lavaWet; if (!player2.dead && player2.active && Vector2.Distance(player2.Center, NPC.Center) < 2800f && !inLiquid) @@ -1477,25 +1455,13 @@ namespace CalamityMod.NPCs.Providence if (NPC.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 npcCenter = NPC.Center; - npcCenter.X += NPC.velocity.X * 7f; - float playerXDist = player.position.X + player.width * 0.5f - npcCenter.X; - float playerYDist = player.Center.Y - npcCenter.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - float shootBoost2 = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); - float projSpeed = (expertMode ? 10.25f : 9f) + shootBoost2; - if (bossRush) - projSpeed = 12.75f; - - if (revenge) - projSpeed *= 1.15f; - - playerDistance = projSpeed / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, playerXDist * 0.1f, playerYDist, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Vector2 projectileFirePosition = new Vector2(NPC.Center.X + NPC.velocity.SafeNormalize(Vector2.UnitX).X * 120f, NPC.Center.Y); + float velocityBoost = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); + float projSpeed = (revenge ? 12f : expertMode ? 10.5f : 9f) + velocityBoost; + Vector2 predictionAmount = player.velocity * 100f; + Vector2 projectileVelocity = (player.Center + (predictiveShots ? predictionAmount : Vector2.Zero) - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; + Vector2 explodePosition = predictiveShots ? (player.position + predictionAmount) : player.position; + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); } } else if (NPC.ai[3] < 0f) @@ -1677,7 +1643,7 @@ namespace CalamityMod.NPCs.Providence if (j % dustDivisor == 0) { 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); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(fullPowerAI ? 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, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = currentDustPos + new Vector2(32f, 32f).RotatedByRandom(MathHelper.TwoPi) * i; @@ -1695,7 +1661,7 @@ namespace CalamityMod.NPCs.Providence } } - if (!nightAI) + if (!fullPowerAI) blue -= 255 / (maxDustLines - 1); } @@ -1706,7 +1672,7 @@ namespace CalamityMod.NPCs.Providence Vector2 dustSpawnPos = Vector2.Normalize(NPC.velocity) * new Vector2(80f, 160f); dustSpawnPos = dustSpawnPos.RotatedBy((double)((k - (totalDust / 2 - 1)) * MathHelper.TwoPi / totalDust), default) + dustLineEnd; 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); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(fullPowerAI ? 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, DustID.RainbowMk2, dustVelocity.X, dustVelocity.Y, 0, dustColor, 1.4f); Main.dust[dust].noGravity = true; @@ -1717,12 +1683,12 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { - float timeLeft = nightAI ? (float)(getFuckedAI ? gfbCrystalTime : nightCrystalTime) : 0f; + float timeLeft = fullPowerAI ? (float)(getFuckedAI ? gfbCrystalTime : enragedCrystalTime) : 0f; Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), crystalDamage, 0f, Main.myPlayer, lifeRatio, 0f, timeLeft); } } - if (NPC.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightAI) + if (NPC.ai[1] >= crystalPhaseTime + enragedCrystalTime || !fullPowerAI) { AIState = (int)Phase.PhaseChange; NPC.TargetClosest(); @@ -1735,7 +1701,7 @@ namespace CalamityMod.NPCs.Providence Vector2 dustPosOffset = new Vector2(27f, 59f); - float rotation = (nightAI ? 435f : 450f) + (guardianAmt * 5); + float rotation = (fullPowerAI ? 445f : 460f) + (guardianAmt * 5); NPC.ai[2] += 1f; if (NPC.ai[2] < 120f) @@ -1764,7 +1730,7 @@ namespace CalamityMod.NPCs.Providence { if (NPC.ai[2] == 120f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < 2800f) + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < 2800f) { SoundEngine.PlaySound(HolyRaySound, Main.LocalPlayer.Center); } @@ -1780,27 +1746,23 @@ namespace CalamityMod.NPCs.Providence // 60 degrees offset velocity = velocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); // -60 degrees offset if (revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); - if (nightAI && lifeRatio < 0.5f) + if (fullPowerAI && lifeRatio < 0.5f) { rotation *= 0.33f; velocity = velocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); if (revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); } - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } } @@ -1829,7 +1791,7 @@ namespace CalamityMod.NPCs.Providence // Play an animation sound immediately. Also delete various projectiles. if (DeathAnimationTimer == 1f) { - if (Main.netMode != NetmodeID.Server && Main.LocalPlayer.WithinRange(NPC.Center, 4800f)) + if (!Main.dedServ && Main.LocalPlayer.WithinRange(NPC.Center, 4800f)) SoundEngine.PlaySound(DeathAnimationSound with { Volume = 1.65f }); DespawnSpecificProjectiles(); @@ -1852,9 +1814,28 @@ namespace CalamityMod.NPCs.Providence // above defeat scene sound. if (DeathAnimationTimer == 92f) { + CalamityUtils.AddScreenshakeAt(NPC.Center, 5, 2000); + + Color hiColor = ProvUtils.GetProjectileColor( 255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 30; i++) + { + Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(0.5f, 0.75f), Main.rand.NextFloat(1f, 2.5f), hiColor, loColor); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(NPC.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor, 60, Main.rand.NextFloat(0.75f, 1.75f), 1f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.1f, 15)); + + for (float i = 0; i < 3; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.25f, 35)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.175f, 25)); + } + SoundEngine.PlaySound(HolyBlast.ImpactSound, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); } // Explode as an enormous holy star before dying and dropping loot. @@ -1865,29 +1846,28 @@ namespace CalamityMod.NPCs.Providence Vector2 sparkleVelocity = Main.rand.NextVector2Circular(23f, 23f); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, sparkleVelocity, ModContent.ProjectileType(), 0, 0f); } - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, 255); } // Idly release harmless cindiers. - int shootRate = (int)MathHelper.Lerp(12f, 5f, Utils.GetLerpValue(0f, 250f, DeathAnimationTimer, true)); - if (DeathAnimationTimer % shootRate == shootRate - 1f) + if (DeathAnimationTimer >= 92f) { - for (int i = 0; i < 3; i++) + CalamityUtils.AddScreenshakeAt(NPC.Center, MathHelper.Lerp(0, 0.6f, ((float)DeathAnimationTimer - 92f) / 300f), 1000); + + int shootRate = (int)MathHelper.Lerp(12f, 5f, Utils.GetLerpValue(0f, 250f, DeathAnimationTimer, true)); + if (DeathAnimationTimer % shootRate == shootRate - 1f) { - Vector2 shootVelocity = Main.rand.NextVector2CircularEdge(13f, 13f) * Main.rand.NextFloat(0.7f, 1.3f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, shootVelocity, ModContent.ProjectileType(), 0, 0f, 255); + for (int i = 0; i < 3; i++) + { + Vector2 shootVelocity = Main.rand.NextVector2CircularEdge(13f, 13f) * Main.rand.NextFloat(1.4f, 2.3f); + Projectile proj = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), NPC.Center, shootVelocity, ModContent.ProjectileType(), 0, 0f, 255, ai1: (int)NPC.localAI[1]); + proj.ai[2] = MathHelper.Lerp(0.5f, 2.5f, (float)DeathAnimationTimer / 300f); + } } } // Do periodic syncs. - if (Main.netMode == NetmodeID.Server && DeathAnimationTimer % 45f == 44f) - { - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; - } + if (Main.dedServ && DeathAnimationTimer % 45f == 44f) + NPC.ForceNetUpdate(false); // Die and create drops after the star is gone. if (DeathAnimationTimer >= 345f) @@ -1895,12 +1875,7 @@ namespace CalamityMod.NPCs.Providence NPC.active = false; NPC.HitEffect(); NPC.NPCLoot(); - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } @@ -1909,12 +1884,12 @@ namespace CalamityMod.NPCs.Providence float distanceToTarget = Vector2.Distance(Main.player[NPC.target].Center, NPC.Center); float aiTimer = NPC.ai[3]; - // This bool is only relevant for non-Zenith night AI - bool nightTime = NPC.localAI[1] == (float)BossMode.Night; + // This bool is only relevant for non-Zenith enraged AI + bool fullPower = NPC.localAI[1] == (float)BossMode.Enraged; float baseDistance = 2800f; - float shorterFlameCocoonDistance = (CalamityWorld.death || nightTime) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f; - float shorterSpearCocoonDistance = (CalamityWorld.death || nightTime) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f; + float shorterFlameCocoonDistance = (CalamityWorld.death || fullPower) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f; + float shorterSpearCocoonDistance = (CalamityWorld.death || fullPower) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f; float shorterDistance = AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance; bool guardianAlive = false; @@ -1935,8 +1910,8 @@ namespace CalamityMod.NPCs.Providence // 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) + // Distance does not get shorter if in GFB / Guardians are alive + if (!guardianAlive && NPC.localAI[1] < (float)BossMode.Rainbow) { maxDistance = baseDistance; if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) @@ -1948,12 +1923,13 @@ namespace CalamityMod.NPCs.Providence float drawFireDistanceStart = maxDistance - 800f; float previousBorderEnd = borderRadius; float clampedDistance = MathHelper.Clamp(maxDistance, previousBorderEnd - 10, previousBorderEnd + 10); + // Only set the border distance if it's not called from playermisceffects, that way it has mod compatability borderRadius = clampedDistance; return Utils.GetLerpValue(drawFireDistanceStart, clampedDistance, distanceToTarget, true); } - private void DespawnSpecificProjectiles(bool dying = false) + private void DespawnSpecificProjectiles(bool everything = false) { for (int x = 0; x < Main.maxProjectiles; x++) { @@ -1965,7 +1941,7 @@ namespace CalamityMod.NPCs.Providence else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) projectile.active = false; - if (dying) + if (everything) { if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || @@ -1988,27 +1964,40 @@ namespace CalamityMod.NPCs.Providence Dying = true; NPC.active = true; NPC.dontTakeDamage = true; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); return false; } public override void OnKill() { + CalamityUtils.AddScreenshakeAt(NPC.Center, 10, 2000); + + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 30; i++) + { + Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(0.5f, 0.75f), Main.rand.NextFloat(1f, 2.5f), hiColor, loColor); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(NPC.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor, 60, Main.rand.NextFloat(0.75f, 1.75f), 1f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.1f, 15)); + + for (float i = 0; i < 3; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.35f, 35)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.275f, 25)); + } + // Don't bother running any of this in Boss Rush. if (BossRushEvent.BossRushActive) return; CalamityGlobalNPC.SetNewBossJustDowned(NPC); - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.Top.Y >= (Main.maxTilesY - 240f) * 16f) - SpawnLootBox(); - // If Providence has not been killed, notify players of Uelibloom Ore if (!DownedBossSystem.downedProvidence) { @@ -2043,30 +2032,26 @@ namespace CalamityMod.NPCs.Providence // Drops Mark of Providence on first kill npcLoot.AddIf(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(info => - { - Providence prov = info.npc.ModNPC(); - return prov.biomeType != 2 || !prov.hasTakenDaytimeDamage; - }, ModContent.ItemType(), desc: DropHelper.ProvidenceHallowText); - npcLoot.AddConditionalPerPlayer(info => - { - Providence prov = info.npc.ModNPC(); - return prov.biomeType == 2 || !prov.hasTakenDaytimeDamage; - }, ModContent.ItemType(), desc: DropHelper.ProvidenceUnderworldText); + // Elysian Wings and Elysian Aegis drop outside of the Treasure Bag, for all players + npcLoot.Add(DropHelper.PerPlayer(ModContent.ItemType())); + npcLoot.Add(DropHelper.PerPlayer(ModContent.ItemType())); + npcLoot.DefineConditionalDropSet(DropHelper.If((info) => { Providence prov = info.npc.ModNPC(); return prov.challenge; }, () => Main.expertMode, DropHelper.ProvidenceChallengeText)).Add(ModContent.ItemType()); + npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); - return !prov.hasTakenDaytimeDamage; - }, ModContent.ItemType(), 1, 4, 4, desc: DropHelper.ProvidenceNightText); + return prov.hasBeenGivenFullPower; + }, ModContent.ItemType(), 1, 4, 4, desc: DropHelper.ProvidenceEnragedText); + npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); - return !prov.hasTakenDaytimeDamage; + return prov.hasBeenGivenFullPower; }, ModContent.ItemType(), 1, 30, 40); // Normal drops: Everything that would otherwise be in the bag @@ -2107,39 +2092,13 @@ namespace CalamityMod.NPCs.Providence var GFBOnly = npcLoot.DefineConditionalDropSet(DropHelper.GFB); { GFBOnly.Add(ModContent.ItemType(), 1, 1, 99, true); - GFBOnly.Add(ModContent.ItemType(), 1, 1117, 2201, true); // reference to the versions the guards were added and got their latest resprites + GFBOnly.Add(ModContent.ItemType(), 1, 1117, 2201, true); // Reference to the versions the guards were added and got their latest resprites } // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); } - private void SpawnLootBox() - { - int tileCenterX = (int)NPC.Center.X / 16; - int tileCenterY = (int)NPC.Center.Y / 16; - int halfBox = 5; - for (int x = tileCenterX - halfBox; x <= tileCenterX + halfBox; x++) - { - for (int y = tileCenterY - halfBox; y <= tileCenterY + halfBox; y++) - { - if ((x == tileCenterX - halfBox || x == tileCenterX + halfBox || y == tileCenterY - halfBox || y == tileCenterY + halfBox) - && !Main.tile[x, y].HasTile) - { - Main.tile[x, y].TileType = (ushort)ModContent.TileType(); - Main.tile[x, y].Get().HasTile = true; - } - Main.tile[x, y].Get().LiquidType = LiquidID.Water; - Main.tile[x, y].LiquidAmount = 0; - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - else - WorldGen.SquareTileFrame(x, y, true); - } - } - } - public override void BossLoot(ref string name, ref int potionType) { potionType = ModContent.ItemType(); @@ -2147,163 +2106,204 @@ namespace CalamityMod.NPCs.Providence public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + bool offColor = NPC.localAI[1] != (float)BossMode.Normal && (NPC.Calamity().newAI[3] >= 180f || Main.zenithWorld); + + Texture2D texture = offColor ? TextureNight.Value : TextureAssets.Npc[Type].Value; + Texture2D textureGlow = offColor ? TextureNight_Glow.Value : Texture_Glow.Value; + Texture2D textureGlow2 = Texture_Glow_2.Value; + void drawProvidenceInstance(Vector2 drawOffset, Color? colorOverride) { // This night bool is used for any off-color activity - bool offColor = NPC.localAI[1] != (float)BossMode.Day; string baseTextureString = "CalamityMod/NPCs/Providence/"; string baseGlowTextureString = baseTextureString + "Glowmasks/"; - 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) + float spawnAnimationTime = 180f; + bool spawnAnimation = NPC.Calamity().newAI[3] < spawnAnimationTime; + + // Bloom circle effect should only appear on spawn animation and not enrage animation, since you can't see it + // Okay it should also appear in Boss Rush as well + if (spawnAnimation && (NPC.localAI[1] == (float)BossMode.Normal || BossRushEvent.BossRushActive)) { - if (!useDefenseFrames) + Asset orbTex = ModContent.Request("CalamityMod/Particles/BloomCircle"); + float sc = CalamityUtils.CircInEasing((float)NPC.Calamity().newAI[3] / (float)spawnAnimationTime, 1); + + for (int i = 0; i < 3; i++) { - texture = offColor ? TextureDefenseNight.Value : TextureDefense.Value; - textureGlow = offColor ? TextureDefenseNight_Glow.Value : TextureDefense_Glow.Value; - textureGlow2 = offColor ? TextureDefenseNight_Glow_2.Value : TextureDefense_Glow_2.Value; + int frameY = (int)(NPC.Calamity().newAI[3] / 4) % 4; + float sc1 = MathHelper.Lerp(1, 0, sc); + Main.EntitySpriteDraw(orbTex.Value, NPC.Center - Main.screenPosition + new Vector2(Main.rand.NextFloat(MathHelper.Lerp(0f, 10f, sc)), 0).RotatedByRandom(MathHelper.TwoPi), orbTex.Frame(), ProvUtils.GetProjectileColor(0, false).MultiplyRGBA(new Color(sc * 45f, sc * 11f, sc * 22f, 0f)), 0f, orbTex.Frame().Center(), (sc * 4.4f) + (float)(Math.Cos((float)NPC.Calamity().newAI[3] / 10) * sc), SpriteEffects.None); + } + } + + { + if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) + { + if (!useDefenseFrames) + { + texture = offColor ? TextureDefenseNight.Value : TextureDefense.Value; + textureGlow = offColor ? TextureDefenseNight_Glow.Value : TextureDefense_Glow.Value; + textureGlow2 = TextureDefense_Glow_2.Value; + } + else + { + texture = offColor ? TextureDefenseAltNight.Value : TextureDefenseAlt.Value; + textureGlow = offColor ? TextureDefenseAltNight_Glow.Value : TextureDefenseAlt_Glow.Value; + textureGlow2 = TextureDefenseAlt_Glow_2.Value; + } } else { - texture = offColor ? TextureDefenseAltNight.Value : TextureDefenseAlt.Value; - textureGlow = offColor ? TextureDefenseAltNight_Glow.Value : TextureDefenseAlt_Glow.Value; - textureGlow2 = offColor ? TextureDefenseAltNight_Glow_2.Value : TextureDefenseAlt_Glow_2.Value; + switch (frameUsed) + { + case 1: + texture = offColor ? TextureAltNight.Value : TextureAlt.Value; + textureGlow = offColor ? TextureAltNight_Glow.Value : TextureAlt_Glow.Value; + textureGlow2 = TextureAlt_Glow_2.Value; + break; + + case 2: + texture = offColor ? TextureAttackNight.Value : TextureAttack.Value; + textureGlow = offColor ? TextureAttackNight_Glow.Value : TextureAttack_Glow.Value; + textureGlow2 = TextureAttack_Glow_2.Value; + break; + + case 3: + texture = offColor ? TextureAttackAltNight.Value : TextureAttackAlt.Value; + textureGlow = offColor ? TextureAttackAltNight_Glow.Value : TextureAttackAlt_Glow.Value; + textureGlow2 = TextureAttackAlt_Glow_2.Value; + break; + + default: + break; + } } - } - else - { - switch (frameUsed) + + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + // Draw the main boss texture + its afterimages + Vector2 RotationCenter = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); + Color BaseColor = Color.White; + float Brightness = 0.5f; // Ranges from 0 (full vibrance) to 1 (pure white) + int maxAfterimages = 5; + + if (CalamityClientConfig.Instance.Afterimages) { - 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; + for (int i = 1; i < maxAfterimages; i += 2) + { + Color AfterimageColor = drawColor; + AfterimageColor = Color.Lerp(AfterimageColor, BaseColor, Brightness); + AfterimageColor = NPC.GetAlpha(AfterimageColor); + AfterimageColor *= (maxAfterimages - i) / 15f; + if (colorOverride != null) + AfterimageColor = colorOverride.Value; - case 2: - 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: - 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: - break; + Vector2 AfterimageBodyPosition = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + AfterimageBodyPosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; + AfterimageBodyPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture, AfterimageBodyPosition, NPC.frame, AfterimageColor.MultiplyRGBA(Lighting.GetColor((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16)), NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + } } - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; + Vector2 BasePosition = NPC.Center - screenPos; + BasePosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; + BasePosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + Color finalDrawColor = NPC.IsABestiaryIconDummy ? Color.White : (colorOverride ?? Lighting.GetColor((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16)) * NPC.Opacity; + spriteBatch.Draw(texture, BasePosition, NPC.frame, finalDrawColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); - // Draw the main boss texture + its afterimages - Vector2 RotationCenter = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color BaseColor = Color.White; - float Brightness = 0.5f; // Ranges from 0 (full vibrance) to 1 (pure white) - int maxAfterimages = 5; + // Draw the glowmask textures + their afterimages + // These are the colors at their strongest point. It'll shift towards white by the brightness value used earlier. + Color WingColor = ProvUtils.GetProjectileColor(0); // Default to normal + Color CrystalColor = Color.Violet; - if (CalamityConfig.Instance.Afterimages) - { - for (int i = 1; i < maxAfterimages; i += 2) + if (NPC.localAI[1] == (float)BossMode.Rainbow) { - Color AfterimageColor = drawColor; - AfterimageColor = Color.Lerp(AfterimageColor, BaseColor, Brightness); - AfterimageColor = NPC.GetAlpha(AfterimageColor); - AfterimageColor *= (maxAfterimages - i) / 15f; - if (colorOverride != null) - AfterimageColor = colorOverride.Value; - - Vector2 AfterimageBodyPosition = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - AfterimageBodyPosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - AfterimageBodyPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture, AfterimageBodyPosition, NPC.frame, AfterimageColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + { + WingColor = Color.Magenta; + CrystalColor = Color.GreenYellow; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + { + WingColor = Color.Cyan; + CrystalColor = Color.BlueViolet; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + { + WingColor = Color.Green; + CrystalColor = Color.Gold; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + CrystalColor = Color.Violet; + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + { + WingColor = Color.Orange; + CrystalColor = Color.HotPink; + } + else // Red + { + WingColor = Color.Red; + CrystalColor = Color.BlueViolet; + } } - } - - Vector2 BasePosition = NPC.Center - screenPos; - BasePosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - BasePosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture, BasePosition, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); - - // Draw the glowmask textures + their afterimages - // These are the colors at their strongest point. It'll shift towards white by the brightness value used earlier. - Color WingColor = Color.Yellow; //Default to day - Color CrystalColor = Color.Violet; - switch (NPC.localAI[1]) - { - case (float)BossMode.Red: - WingColor = Color.Red; - CrystalColor = Color.BlueViolet; - break; - case (float)BossMode.Orange: - WingColor = Color.Orange; - CrystalColor = Color.HotPink; - break; - case (float)BossMode.Yellow: // Same as day - break; - case (float)BossMode.Green: - WingColor = Color.Green; - CrystalColor = Color.Gold; - break; - case (float)BossMode.Blue: // Same as night - case (float)BossMode.Night: + else if (NPC.localAI[1] == (float)BossMode.Enraged && !spawnAnimation) + { WingColor = Color.Cyan; CrystalColor = Color.BlueViolet; - break; - case (float)BossMode.Violet: - WingColor = Color.Magenta; - CrystalColor = Color.GreenYellow; - break; - default: - break; - } + } - Color BaseWingColor = Color.Lerp(WingColor, BaseColor, Brightness) * NPC.Opacity; - Color BaseCrystalColor = Color.Lerp(CrystalColor, BaseColor, Brightness) * NPC.Opacity; - if (colorOverride != null) - { - BaseWingColor = colorOverride.Value; - BaseCrystalColor = colorOverride.Value; - } - - if (CalamityConfig.Instance.Afterimages) - { - for (int j = 1; j < maxAfterimages; j++) + Color BaseWingColor = Color.Lerp(WingColor, BaseColor, Brightness) * NPC.Opacity; + Color BaseCrystalColor = Color.Lerp(CrystalColor, BaseColor, Brightness) * NPC.Opacity; + if (colorOverride != null) { - Color AfterimageWingColor = BaseWingColor; - AfterimageWingColor = Color.Lerp(AfterimageWingColor, BaseColor, Brightness); - AfterimageWingColor = NPC.GetAlpha(AfterimageWingColor); - AfterimageWingColor *= (maxAfterimages - j) / 15f; - if (colorOverride != null) - AfterimageWingColor = colorOverride.Value; + BaseWingColor = colorOverride.Value; + BaseCrystalColor = colorOverride.Value; + } - Vector2 AfterimageGlowPosition = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - AfterimageGlowPosition -= new Vector2(textureGlow.Width, textureGlow.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - AfterimageGlowPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(textureGlow, AfterimageGlowPosition, NPC.frame, AfterimageWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + Color GlowWingColor = ProvUtils.GetProjectileColor(NPC.GetAlpha(drawColor), true); - Color AfterimageCrystalColor = BaseCrystalColor; - AfterimageCrystalColor = Color.Lerp(AfterimageCrystalColor, BaseColor, Brightness); - AfterimageCrystalColor = NPC.GetAlpha(AfterimageCrystalColor); - AfterimageCrystalColor *= (maxAfterimages - j) / 15f; - if (colorOverride != null) - AfterimageCrystalColor = colorOverride.Value; - spriteBatch.Draw(textureGlow2, AfterimageGlowPosition, NPC.frame, AfterimageCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + if (CalamityClientConfig.Instance.Afterimages) + { + for (int j = 1; j < maxAfterimages; j++) + { + Color AfterimageWingColor = ProvUtils.GetProjectileColor(0, true); + AfterimageWingColor = Color.Lerp(AfterimageWingColor, BaseColor, Brightness); + AfterimageWingColor = NPC.GetAlpha(AfterimageWingColor); + AfterimageWingColor *= (maxAfterimages - j) / 15f; + + if (colorOverride != null) + AfterimageWingColor = colorOverride.Value; + + Vector2 AfterimageGlowPosition = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + AfterimageGlowPosition -= new Vector2(textureGlow.Width, textureGlow.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; + AfterimageGlowPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(textureGlow, AfterimageGlowPosition, NPC.frame, AfterimageWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + + Color AfterimageCrystalColor = BaseCrystalColor; + AfterimageCrystalColor = Color.Lerp(AfterimageCrystalColor, BaseColor, Brightness); + AfterimageCrystalColor = NPC.GetAlpha(AfterimageCrystalColor); + AfterimageCrystalColor *= (maxAfterimages - j) / 15f; + + if (colorOverride != null) + AfterimageCrystalColor = colorOverride.Value; + + spriteBatch.Draw(textureGlow2, AfterimageGlowPosition, NPC.frame, AfterimageCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + } + } + + if (!Dying) + { + NPC.DrawBackglow(GlowWingColor, 4f, SpriteEffects.None, NPC.frame, Main.screenPosition, textureGlow); + + spriteBatch.Draw(textureGlow, BasePosition, NPC.frame, BaseWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + + spriteBatch.Draw(textureGlow2, BasePosition, NPC.frame, BaseCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); } } - - spriteBatch.Draw(textureGlow, BasePosition, NPC.frame, BaseWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); - - spriteBatch.Draw(textureGlow2, BasePosition, NPC.frame, BaseCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); } float burnIntensity = Utils.GetLerpValue(0f, 45f, DeathAnimationTimer, true); @@ -2329,7 +2329,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.localAI[0] > 0f && NPC.localAI[0] < TimeForStarDespawn) { float lerpMult = MathHelper.Lerp(0.5f, 1.5f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) / 2f + 1f); - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; + Texture2D tex = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; float drawOffsetAmt = (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) ? 20f : 64f; Vector2 drawPos = NPC.Center + Vector2.UnitY * drawOffsetAmt * NPC.scale - Main.screenPosition; Color baseColor = Color.Lerp(Color.Yellow, Color.OrangeRed, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 1f); @@ -2343,20 +2343,20 @@ namespace CalamityMod.NPCs.Providence float colorScale = MathHelper.Lerp(0f, lerpMult, opacityScaleDuringStarDespawn); colorA *= colorScale; colorB *= colorScale; - Vector2 origin = texture.Size() / 2f; + Vector2 origin = tex.Size() / 2f; Vector2 scale = new Vector2(1.5f + scaleDuringStarDespawn, 2.5f + scaleDuringStarDespawn) * lerpMult; float upRight = MathHelper.PiOver4 + NPC.rotation; float up = MathHelper.PiOver2 + NPC.rotation; float upLeft = 3f * MathHelper.PiOver4 + NPC.rotation; float left = MathHelper.Pi + NPC.rotation; - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upLeft, origin, scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upRight, origin, scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorA, upLeft, origin, scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorA, upRight, origin, scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorB, upLeft, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorB, upRight, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorA, up, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorA, left, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorB, up, origin, scale * 0.36f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorB, left, origin, scale * 0.36f, SpriteEffects.None, 0); } // Draw shields while defender is alive @@ -2424,17 +2424,56 @@ namespace CalamityMod.NPCs.Providence 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; - Main.spriteBatch.Draw(heatTex, shieldDrawPos, null, Color.White, 0, heatTex.Size() / 2f, shieldScale * scaleMult * 0.5f, 0, 0); + var matrix = Main.GameViewMatrix.TransformationMatrix; + Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, matrix, () => + { + // 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; + Main.spriteBatch.Draw(heatTex, shieldDrawPos, null, Color.White, 0, heatTex.Size() / 2f, shieldScale * scaleMult * 0.5f, 0, 0); + }); } return false; } + public override Color? GetAlpha(Color drawColor) + { + return ProvUtils.GetProjectileColor(drawColor) * NPC.Opacity; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Providence/Providence_DeathSilhouette").Value; + + if (Dying) + { + if (DeathAnimationTimer > 91f) + { + // Without these four lines there is this weird overlap in the center over darker backgrounds + Main.EntitySpriteDraw(tex, NPC.Center + new Vector2(0, 10) - Main.screenPosition, new Rectangle(0, 0, tex.Width, tex.Height), Color.White, 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex, NPC.Center + new Vector2(0, 15) - Main.screenPosition, new Rectangle(0, 0, tex.Width, tex.Height), Color.White, 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex, NPC.Center + new Vector2(0, 20) - Main.screenPosition, new Rectangle(0, 0, tex.Width, tex.Height), Color.White, 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex, NPC.Center + new Vector2(0, 25) - Main.screenPosition, new Rectangle(0, 0, tex.Width, tex.Height), Color.White, 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + + Vector2 vec = new Vector2(Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(-2, 2)); + + float progress = MathHelper.Clamp(((float)DeathAnimationTimer - 200f) / 300f, 0f, 1f); + + for (int i = 0; i < NPC.frame.Height / 2; i++) + { + int outset = ((i - NPC.frame.Height / 4) * 2); + + int pr = (int)(progress * 30f); + + Color col = ProvUtils.GetProjectileColor(Color.DarkGray, true); + col.A = 255; + + Main.EntitySpriteDraw(tex, NPC.Center + vec + new Vector2(0, 310) - Main.screenPosition + new Vector2(Main.rand.Next(-pr, pr) * 2, outset), new Rectangle(0, i * 2, tex.Width, 2), Color.Lerp(col, Color.White, progress * 2f).MultiplyRGBA(new Color(255, 255, 255, MathHelper.Lerp(progress, 1f, 0.2f) * 2f)), 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + } + } + } + } + public override void FindFrame(int frameHeight) { if (NPC.IsABestiaryIconDummy) @@ -2509,23 +2548,6 @@ namespace CalamityMod.NPCs.Providence public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) { - if (!hasTakenDaytimeDamage) - { - if (NPC.localAI[1] == (float)BossMode.Day) - { - hasTakenDaytimeDamage = true; - - if (Main.netMode != NetmodeID.SinglePlayer) - { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ProvidenceDyeConditionSync); - netMessage.Write((byte)NPC.whoAmI); - netMessage.Write(hasTakenDaytimeDamage); - netMessage.Send(); - } - } - } - if (challenge) { List exceptionList = new List() @@ -2545,8 +2567,10 @@ namespace CalamityMod.NPCs.Providence 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. + + 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. bool allowedBabs = Main.player[projectile.owner].Calamity().pSoulArtifact && !Main.player[projectile.owner].Calamity().profanedCrystalBuffs; if ((exceptionList.TrueForAll(x => projectile.type != x) && !allowedDamage) || !allowedBabs) @@ -2555,11 +2579,7 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.PSCChallengeSync); - netMessage.Write((byte)NPC.whoAmI); - netMessage.Write(challenge); - netMessage.Send(); + PSCChallengeSyncPacket.Send(this); } } } @@ -2567,34 +2587,13 @@ namespace CalamityMod.NPCs.Providence public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) { - if (!hasTakenDaytimeDamage) - { - if (NPC.localAI[1] == (float)BossMode.Day) - { - hasTakenDaytimeDamage = true; - - if (Main.netMode != NetmodeID.SinglePlayer) - { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ProvidenceDyeConditionSync); - netMessage.Write((byte)NPC.whoAmI); - netMessage.Write(hasTakenDaytimeDamage); - netMessage.Send(); - } - } - } - if (challenge) { challenge = false; if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.PSCChallengeSync); - netMessage.Write((byte)NPC.whoAmI); - netMessage.Write(challenge); - netMessage.Send(); + PSCChallengeSyncPacket.Send(this); } } } @@ -2610,7 +2609,7 @@ namespace CalamityMod.NPCs.Providence SoundEngine.PlaySound(HurtSound, NPC.Center); } - int dustType = ProvUtils.GetDustID(NPC.localAI[1]); + int dustType = ProvUtils.GetDustID(); for (int k = 0; k < 15; k++) { int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); @@ -2619,7 +2618,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("Providence").Type, NPC.scale); @@ -2627,10 +2626,12 @@ namespace CalamityMod.NPCs.Providence Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("Providence3").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("Providence4").Type, NPC.scale); } + NPC.position = NPC.Center; NPC.width = (int)(400 * NPC.scale); NPC.height = (int)(350 * NPC.scale); NPC.position -= NPC.Size * 0.5f; + for (int d = 0; d < 60; d++) { int fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 2f); @@ -2655,35 +2656,197 @@ namespace CalamityMod.NPCs.Providence } } - //These will be used for almost every single one of her projectiles, so it's useful to have. + /// + /// Handles the holy flame effect on items just dropped by Providence in Hell. + /// + public class ProvItemFloating : GlobalItem + { + public override void Load() + { + On_CommonCode.ModifyItemDropFromNPC += On_CommonCode_ModifyItemDropFromNPC; + } + + public override void Unload() + { + On_CommonCode.ModifyItemDropFromNPC -= On_CommonCode_ModifyItemDropFromNPC; + } + + private void On_CommonCode_ModifyItemDropFromNPC(On_CommonCode.orig_ModifyItemDropFromNPC orig, NPC npc, int itemIndex) + { + if (npc.type == ModContent.NPCType() && !BossRushEvent.BossRushActive) + { + Main.item[itemIndex].GetGlobalItem().HolyFlame = 2f; + if ((npc.ModNPC as Providence).hasBeenGivenFullPower) + Main.item[itemIndex].GetGlobalItem().ProviWasEnraged = true; + } + else + { + orig(npc, itemIndex); + } + } + + public override bool InstancePerEntity => true; + + public float HolyFlame = 0f; + public float FlameTimer = 0f; + public bool ProviWasEnraged = false; + + public override void Update(Item item, ref float gravity, ref float maxFallSpeed) + { + float clp = MathHelper.Clamp(HolyFlame, 0f, 1f); + + maxFallSpeed *= MathHelper.Lerp(1, 0f, clp); + + if (maxFallSpeed > 0.3f) + { + HolyFlame *= 0.95f; + } + + HolyFlame *= 0.9975f; + HolyFlame = MathHelper.Clamp(HolyFlame, 0f, 2f); + + if (item.beingGrabbed) + { + HolyFlame = 0f; + } + } + + public override void UpdateInventory(Item item, Player player) + { + HolyFlame = 0f; + } + + public override bool PreDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + FlameTimer++; + + if (HolyFlame > 0f) + { + Color lColor = lightColor * MathHelper.Lerp(1f, 0f, MathHelper.Clamp(HolyFlame - 1f, 0f, 1f)); + lColor.A = 255; + + Color alph = new Color(255f * (HolyFlame / 2f), 255f * (HolyFlame / 2f), 0f, 0f); + Color alph2 = new Color(155f * (HolyFlame / 2f), 0f, 0f, 0f); + + if (ProviWasEnraged) + { + lColor.B = 255; + + alph = new Color(0f, 255f * (HolyFlame / 2f), 255f * (HolyFlame / 2f), 0f); + alph2 = new Color(0f, 0f, 155f * (HolyFlame / 2f), 0f); + } + + Rectangle frame = Item.GetDrawHitbox(item.type, Main.LocalPlayer); + + if (HolyFlame > 0) + { + for (float i = 0f; i < 360f; i += 90f) + { + Main.EntitySpriteDraw(TextureAssets.Item[item.type].Value, item.Center - Main.screenPosition + new Vector2(4 * MathHelper.Clamp(HolyFlame, 0f, 1f), 0).RotatedBy(MathHelper.ToRadians(i)), frame, alph, rotation, frame.Size() / 2, scale, SpriteEffects.None); + } + } + + float maxIterations = 20; + + for (float i = 0; i < maxIterations; i++) + { + Main.EntitySpriteDraw(TextureAssets.Item[item.type].Value, item.Center - Main.screenPosition + (new Vector2((float)Math.Sin((FlameTimer / 20) + (item.whoAmI * 13098.125f) - (i / 5)) * i, -i * 1.5f) * (HolyFlame)), frame, Color.Lerp(alph, alph2, i / maxIterations), rotation, frame.Size() / 2, MathHelper.Lerp(scale, 0f, (float)(i / maxIterations) * (HolyFlame / 2)), SpriteEffects.None); + } + + Main.EntitySpriteDraw(TextureAssets.Item[item.type].Value, item.Center - Main.screenPosition, frame, lColor, rotation, frame.Size() / 2, scale, SpriteEffects.None); + + return false; + } + + return base.PreDrawInWorld(item, spriteBatch, lightColor, alphaColor, ref rotation, ref scale, whoAmI); + } + } + + // These will be used for almost every single one of her projectiles, so it's useful to have. public static class ProvUtils { - public static Color GetProjectileColor(int Mode, int Alpha, bool Outline = false) + public static bool StandardAI() => (CalamityGlobalNPC.holyBoss == -1 || !Main.npc[CalamityGlobalNPC.holyBoss].Calamity().CurrentlyEnraged) && !Main.zenithWorld && !BossRushEvent.BossRushActive; + + // Simplified to day/night only. For PSC + public static Color GetColorBasedOnEnrage(int Alpha, bool Outline = false) => GetColorBasedOnEnrage(!Main.IsItDay() && !Main.remixWorld, Alpha, Outline); + public static Color GetColorBasedOnEnrage(bool Night, int Alpha, bool Outline = false) { - Color FinalColor = new Color(250, Outline ? 0 : 150, 0, Alpha); //Default to day - switch (Mode) + Color FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); // Default to day + + if (Night) + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); + + return FinalColor; + } + + public static Color GetProjectileColor(Color givenLightColor, bool Outline = false) + { + int alpha = 0; + + // Custom set alpha for GFB Yellow Mode + if (!Outline && Main.zenithWorld && Main.GlobalTimeWrappedHourly % 6f >= 2f && Main.GlobalTimeWrappedHourly % 6f < 3f) { - case (int)Providence.BossMode.Red: - FinalColor = new Color(250, 100, Outline ? 200 : 100, Alpha); - break; - case (int)Providence.BossMode.Orange: - FinalColor = new Color(250, 150, Outline ? 150 : 100, Alpha); - break; - case (int)Providence.BossMode.Yellow: //Same as day - break; - case (int)Providence.BossMode.Green: - FinalColor = new Color(Outline ? 200 : 100, 250, 100, Alpha); - break; - case (int)Providence.BossMode.Blue: //Same as night - case (int)Providence.BossMode.Night: - FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); - break; - case (int)Providence.BossMode.Violet: - FinalColor = new Color(Outline ? 100 : 150, Outline ? 150 : 100, 250, Alpha); - break; - default: - break; + float colorBrightness = (givenLightColor.R + givenLightColor.G + givenLightColor.B / 3) / 255f; + alpha = (int)MathHelper.Lerp(0f, 155f, colorBrightness); } + else + { + alpha = 100; + } + + Color FinalColor = new Color(255, Outline ? 0 : 255, Outline ? 0 : 255, alpha); // Default to normal + // Color changing should only occur with Providence's projectiles + if (CalamityGlobalNPC.holyBoss == -1) + return FinalColor; + + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + FinalColor = new Color(Outline ? 100 : 150, Outline ? 150 : 100, 250, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + FinalColor = new Color(Outline ? 200 : 100, 250, 100, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + FinalColor = new Color(255, Outline ? 0 : 255, Outline ? 0 : 255, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + FinalColor = new Color(250, 150, Outline ? 150 : 100, alpha); + else // Red + FinalColor = new Color(250, 100, Outline ? 200 : 100, alpha); + } + else if (!StandardAI()) + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, alpha); + + if (Outline) + FinalColor *= 0.1f; + + return FinalColor; + } + + public static Color GetProjectileColor(int Alpha, bool Outline = false) + { + Color FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); // Default to normal + // Color changing should only occur with Providence's projectiles + if (CalamityGlobalNPC.holyBoss == -1) + return FinalColor; + + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + FinalColor = new Color(Outline ? 100 : 150, Outline ? 150 : 100, 250, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + FinalColor = new Color(Outline ? 200 : 100, 250, 100, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + FinalColor = new Color(250, 150, Outline ? 150 : 100, Alpha); + else // Red + FinalColor = new Color(250, 100, Outline ? 200 : 100, Alpha); + } + else if (!StandardAI()) + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); if (Outline) FinalColor *= 0.1f; @@ -2691,77 +2854,102 @@ namespace CalamityMod.NPCs.Providence return FinalColor; } - public static int GetDustID(float Mode) + // Assign the night bool to turn it into a binary day/night state without accounting for GFB, used for PSC + public static int GetDustID(bool? Night = null) { - int DustType = (int)CalamityDusts.ProfanedFire; //Default to day - switch (Mode) + int DustType = (int)CalamityDusts.ProfanedFire; // Default to normal + + if (Night.HasValue) { - case (float)Providence.BossMode.Red: - DustType = DustID.RedTorch; - break; - case (float)Providence.BossMode.Orange: - DustType = DustID.OrangeTorch; - break; - case (float)Providence.BossMode.Yellow: //Same as day - break; - case (float)Providence.BossMode.Green: - DustType = DustID.GreenTorch; - break; - case (float)Providence.BossMode.Blue: //Same as night - case (float)Providence.BossMode.Night: + if (Night.Value) DustType = (int)CalamityDusts.Nightwither; - break; - case (float)Providence.BossMode.Violet: - DustType = DustID.PurpleTorch; - break; - default: - break; } + else if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + DustType = DustID.PurpleTorch; + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + DustType = (int)CalamityDusts.Nightwither; + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + DustType = DustID.GreenTorch; + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + DustType = (int)CalamityDusts.ProfanedFire; + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + DustType = DustID.OrangeTorch; + else // Red + DustType = DustID.RedTorch; + } + else if (!StandardAI()) + DustType = (int)CalamityDusts.Nightwither; + return DustType; } - //Include debuffs inflicted by Providence's projectiles for all her forms - //In the GFB seed, also includes negative healing - public static void ApplyHitEffects(Player Target, int Mode, int BaseDuration, int NegativeHealValue) + // Shortcut function for applying Burden Breaker-like negative healing to GFB Providence + public static void ApplyGFBDamage(Projectile proj, int BaseDuration, int NegativeHealValue) { - int BuffType = ModContent.BuffType(); //Default to day - float Multiplier = 1f; //Used to counterbalance Cursed Inferno and Shadowflame + if (!Main.zenithWorld) + return; - //Day and Night Providence inflicts 16-80 damage of debuffs depending on attacks - //GFB Providence inflicts 24-120 damage (+50%) for half the colors, 26-130 (+62.5%) for another half - switch (Mode) + int index = Player.FindClosest(proj.position, proj.width, proj.height); + Player player = Main.player[index]; + if (player is null) + return; + if (proj.Colliding(proj.Hitbox, player.Hitbox)) { - case (int)Providence.BossMode.Red: - BuffType = ModContent.BuffType(); - break; - case (int)Providence.BossMode.Orange: - BuffType = ModContent.BuffType(); - Multiplier = 0.5f; - break; - case (int)Providence.BossMode.Yellow: //Same as day - break; - case (int)Providence.BossMode.Green: - BuffType = BuffID.CursedInferno; - Multiplier = 0.75f; - break; - case (int)Providence.BossMode.Blue: //Same as night - case (int)Providence.BossMode.Night: - BuffType = ModContent.BuffType(); - break; - case (int)Providence.BossMode.Violet: - BuffType = ModContent.BuffType(); - Multiplier = 0.60f; - break; - default: - break; + ApplyDebuffs(player, BaseDuration, NegativeHealValue); + + if (proj.type == ModContent.ProjectileType()) + proj.Kill(); } + } + + // Include debuffs inflicted by Providence's projectiles for all her forms + // In the GFB seed, also includes negative healing + public static void ApplyDebuffs(Player Target, int BaseDuration, int NegativeHealValue = 0) + { + int BuffType = ModContent.BuffType(); // Default to non-GFB + + // All debuffs are adjusted to be 50% more powerful in GFB + float Multiplier = 1f; + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + { + BuffType = ModContent.BuffType(); + Multiplier = 2f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + { + BuffType = ModContent.BuffType(); + Multiplier = 1.5f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + { + BuffType = BuffID.CursedInferno; + Multiplier = 2.5f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + { + BuffType = ModContent.BuffType(); + Multiplier = 1.5f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + BuffType = ModContent.BuffType(); + else // Red + { + BuffType = ModContent.BuffType(); + Multiplier = 2f; + } + } + 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) + // A. Specifically inflicts Vaporfied in quirky RGB Mode because it's a colorful debuff + // B. Apply the negative healing + if (Main.zenithWorld) { - //Obligatory offensive guardian boosting negative heals + // Obligatory offensive guardian boosting negative heals if (CalamityGlobalNPC.holyBossAttacker != -1) { if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active) @@ -2775,6 +2963,7 @@ namespace CalamityMod.NPCs.Providence PlayerDeathReason CustomSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProvidenceAntiHealing").Format(Target.name)); Target.KillMe(CustomSource, NegativeHealValue, 0); } + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, Target.whoAmI, NegativeHealValue); Target.AddBuff(ModContent.BuffType(), (int)(BaseDuration * Multiplier)); diff --git a/NPCs/Providence/Providence.png b/NPCs/Providence/Providence.png index 78d9e24a29..2329e3b9fa 100644 Binary files a/NPCs/Providence/Providence.png and b/NPCs/Providence/Providence.png differ diff --git a/NPCs/Providence/ProvidenceAlt.png b/NPCs/Providence/ProvidenceAlt.png index 967c031428..51bfda1cbe 100644 Binary files a/NPCs/Providence/ProvidenceAlt.png and b/NPCs/Providence/ProvidenceAlt.png differ diff --git a/NPCs/Providence/ProvidenceAttack.png b/NPCs/Providence/ProvidenceAttack.png index f4886b1a47..95fa23bbd2 100644 Binary files a/NPCs/Providence/ProvidenceAttack.png and b/NPCs/Providence/ProvidenceAttack.png differ diff --git a/NPCs/Providence/ProvidenceAttackAlt.png b/NPCs/Providence/ProvidenceAttackAlt.png index 12a45fb050..c8d1b8c86b 100644 Binary files a/NPCs/Providence/ProvidenceAttackAlt.png and b/NPCs/Providence/ProvidenceAttackAlt.png differ diff --git a/NPCs/Providence/ProvidenceAttackNight.png b/NPCs/Providence/ProvidenceAttackNight.png index d49baf5c6f..ba0f4805f1 100644 Binary files a/NPCs/Providence/ProvidenceAttackNight.png and b/NPCs/Providence/ProvidenceAttackNight.png differ diff --git a/NPCs/Providence/ProvidenceDefense.png b/NPCs/Providence/ProvidenceDefense.png index 4f7cacf054..bb87edea39 100644 Binary files a/NPCs/Providence/ProvidenceDefense.png and b/NPCs/Providence/ProvidenceDefense.png differ diff --git a/NPCs/Providence/ProvidenceDefenseAlt.png b/NPCs/Providence/ProvidenceDefenseAlt.png index 8c4186844a..362376f994 100644 Binary files a/NPCs/Providence/ProvidenceDefenseAlt.png and b/NPCs/Providence/ProvidenceDefenseAlt.png differ diff --git a/NPCs/Providence/ProvidenceDefenseAltNight.png b/NPCs/Providence/ProvidenceDefenseAltNight.png index ecbd22e542..ea54026fac 100644 Binary files a/NPCs/Providence/ProvidenceDefenseAltNight.png and b/NPCs/Providence/ProvidenceDefenseAltNight.png differ diff --git a/NPCs/Providence/ProvidenceDefenseNight.png b/NPCs/Providence/ProvidenceDefenseNight.png index df1ff403ac..36e7062a16 100644 Binary files a/NPCs/Providence/ProvidenceDefenseNight.png and b/NPCs/Providence/ProvidenceDefenseNight.png differ diff --git a/NPCs/Providence/ProvidenceNight.png b/NPCs/Providence/ProvidenceNight.png index be68806d96..175ace4f62 100644 Binary files a/NPCs/Providence/ProvidenceNight.png and b/NPCs/Providence/ProvidenceNight.png differ diff --git a/NPCs/Providence/Providence_DeathSilhouette.png b/NPCs/Providence/Providence_DeathSilhouette.png new file mode 100644 index 0000000000..642e510c75 Binary files /dev/null and b/NPCs/Providence/Providence_DeathSilhouette.png differ diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 1da01e7aa9..78144eff7a 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.Ravager public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -128,12 +128,7 @@ namespace CalamityMod.NPCs.Ravager NPC.ai[2] += 1f; NPC.localAI[0] = 0f; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } else @@ -150,10 +145,10 @@ namespace CalamityMod.NPCs.Ravager if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; 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); diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 8a4f5afa68..e4ffb7b02e 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -51,7 +51,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; + Main.npcFrameCount[Type] = 7; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.Ravager NPC.width = 332; NPC.height = 214; NPC.defense = 55; - NPC.value = Item.buyPrice(0, 75, 0, 0); + NPC.value = Item.buyPrice(0, 30, 0, 0); NPC.DR_NERD(0.35f); NPC.LifeMaxNERB(45000, 54000, 460000); if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) @@ -88,7 +88,7 @@ namespace CalamityMod.NPCs.Ravager NPC.damage = (int)(NPC.damage * 1.5); NPC.defense *= 2; NPC.lifeMax *= 4; - NPC.value *= 1.5f; + NPC.value *= 3f; } NPC.knockBackResist = 0f; AIType = -1; @@ -140,7 +140,7 @@ namespace CalamityMod.NPCs.Ravager NPC.Opacity = 1f; NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -229,20 +229,20 @@ namespace CalamityMod.NPCs.Ravager NPC.dontTakeDamage = true; if (bossRush) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && revenge) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } } } else { NPC.dontTakeDamage = false; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && revenge) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } } @@ -666,7 +666,7 @@ namespace CalamityMod.NPCs.Ravager Main.dust[stompDust].velocity *= 0.2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int stompGore = Gore.NewGore(NPC.GetSource_FromAI(), new Vector2(stompDustArea - 30, NPC.position.Y + NPC.height - 12f), default, Main.rand.Next(61, 64), 1f); Main.gore[stompGore].velocity *= 0.4f; @@ -845,12 +845,7 @@ namespace CalamityMod.NPCs.Ravager if (Vector2.Distance(NPC.Center, player.Center) > distanceFromTarget) { NPC.active = false; - - NPC.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (NPC.netSpam >= 10) - NPC.netSpam = 9; + NPC.ForceNetUpdate(false); } } } @@ -878,9 +873,9 @@ namespace CalamityMod.NPCs.Ravager spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); Vector2 glowmaskPosition = center - screenPos; - glowmaskPosition -= new Vector2(GlowTexture.Value.Width, GlowTexture.Value.Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; + glowmaskPosition -= new Vector2(GlowTexture.Value.Width, GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, glowmaskPosition, @@ -925,7 +920,7 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerBody").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerBody2").Type, 1f); diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 924729ad72..d891497c47 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; @@ -309,7 +310,16 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 240, true); + { + if (DownedBossSystem.downedProvidence) + { + target.AddBuff(ModContent.BuffType(), 240, true); + } + else + { + target.AddBuff(ModContent.BuffType(), 240, true); + } + } } public override void HitEffect(NPC.HitInfo hit) @@ -325,7 +335,7 @@ namespace CalamityMod.NPCs.Ravager } else { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerClawLeft").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerClawLeft2").Type, 1f); diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index d6dfb0b0df..731b46802d 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; @@ -310,7 +311,16 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 240, true); + { + if (DownedBossSystem.downedProvidence) + { + target.AddBuff(ModContent.BuffType(), 240, true); + } + else + { + target.AddBuff(ModContent.BuffType(), 240, true); + } + } } public override void HitEffect(NPC.HitInfo hit) @@ -326,7 +336,7 @@ namespace CalamityMod.NPCs.Ravager } else { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerClawRight").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerClawRight2").Type, 1f); diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index e88c1a501d..e181a9e65d 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; } public override void SetDefaults() diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index fcd1c78b94..f33e45eb6e 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; } public override void SetDefaults() @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.Ravager bool fireProjectiles = NPC.ai[1] >= (bossRush ? 240f : 480f); if (fireProjectiles && Vector2.Distance(NPC.Center, player.Center) > 80f) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); float projectileVelocity = death ? 8f : 6f; @@ -198,7 +198,7 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerHead").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerHead2").Type, 1f); diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 44183292d9..14e5723fe7 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; } public override void SetDefaults() @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerLegLeft").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerLegLeft2").Type, 1f); diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index 58c8cf5991..b3be683e4a 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; } public override void SetDefaults() @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerLegRight").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerLegRight2").Type, 1f); diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 547b6ffe4a..4170c15cf3 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -178,7 +178,7 @@ namespace CalamityMod.NPCs.Ravager Main.dust[rockDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float y = NPC.height / 6f; float randomVelocityScale = 0.25f; diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 9fc04d2558..dc5150c594 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -1,4 +1,5 @@ using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; @@ -18,8 +19,8 @@ namespace CalamityMod.NPCs.Signus public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 4; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); if (!Main.dedServ) { @@ -79,7 +80,7 @@ namespace CalamityMod.NPCs.Signus NPC.Opacity = 1f; NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -127,11 +128,11 @@ namespace CalamityMod.NPCs.Signus if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -140,21 +141,21 @@ namespace CalamityMod.NPCs.Signus afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -163,7 +164,7 @@ namespace CalamityMod.NPCs.Signus flameAfterimageColor = NPC.GetAlpha(flameAfterimageColor); flameAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 flameAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - flameAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + flameAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; flameAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, flameAfterimagePos, NPC.frame, flameAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -179,6 +180,14 @@ namespace CalamityMod.NPCs.Signus return NPC.alpha == 0; } + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + target.AddBuff(ModContent.BuffType(), 180); + } + public override void HitEffect(NPC.HitInfo hit) { if (NPC.life <= 0) diff --git a/NPCs/Signus/CosmicMine.cs b/NPCs/Signus/CosmicMine.cs index 72c7f2a6e0..69af4f8c13 100644 --- a/NPCs/Signus/CosmicMine.cs +++ b/NPCs/Signus/CosmicMine.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.GameContent; +using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -17,8 +18,7 @@ namespace CalamityMod.NPCs.Signus { public override void SetStaticDefaults() { - this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -44,6 +44,15 @@ namespace CalamityMod.NPCs.Signus CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CosmicMine") + }); + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(NPC.dontTakeDamage); @@ -173,11 +182,11 @@ namespace CalamityMod.NPCs.Signus if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index a213b3dfff..344b2dbdec 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -46,8 +46,8 @@ namespace CalamityMod.NPCs.Signus public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.Signus NPC.height = 130; NPC.defense = 60; NPC.LifeMaxNERB(300000, 360000, 320000); - NPC.value = Item.buyPrice(2, 0, 0, 0); + NPC.value = Item.buyPrice(1, 0, 0, 0); NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; @@ -392,21 +392,21 @@ namespace CalamityMod.NPCs.Signus SoundEngine.PlaySound(SoundID.Item122, NPC.Center); int cosmicMineSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn, 0f, 0f, 0f, 0, 0, 0); int cosmicMineSpawn2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 750f), (int)player.position.Y, ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn2, 0f, 0f, 0f, 0, 0, 0); if (stealthTimer >= maxStealth) { int stealthCosmicMine = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 950f), (int)player.position.Y, ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine, 0f, 0f, 0f, 0, 0, 0); int stealthCosmicMine2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 950f), (int)player.position.Y, ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine2, 0f, 0f, 0f, 0, 0, 0); SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); @@ -590,21 +590,21 @@ namespace CalamityMod.NPCs.Signus type = ModContent.NPCType(); } int cosmicMineSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), type); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn, 0f, 0f, 0f, 0, 0, 0); int cosmicMineSpawn2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), type); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn2, 0f, 0f, 0f, 0, 0, 0); if (buffed) { int stealthCosmicMine = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX + spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine, 0f, 0f, 0f, 0, 0, 0); int stealthCosmicMine2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX - spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine2, 0f, 0f, 0f, 0, 0, 0); } @@ -809,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 NPCTexture = TextureAssets.Npc[Type].Value; Texture2D glowMaskTexture = Texture_Glow.Value; SpriteEffects spriteEffects = SpriteEffects.None; @@ -818,7 +818,7 @@ namespace CalamityMod.NPCs.Signus int afterimageAmt = 5; Rectangle frame = NPC.frame; - int frameCount = Main.npcFrameCount[NPC.type]; + int frameCount = Main.npcFrameCount[Type]; if (NPC.ai[0] == 4f) { @@ -838,7 +838,7 @@ namespace CalamityMod.NPCs.Signus } else { - NPCTexture = TextureAssets.Npc[NPC.type].Value; + NPCTexture = TextureAssets.Npc[Type].Value; glowMaskTexture = Texture_Glow.Value; } @@ -852,7 +852,7 @@ namespace CalamityMod.NPCs.Signus transparency = (100 - (stealthTimer - 300)) * 0.01f; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -878,7 +878,7 @@ namespace CalamityMod.NPCs.Signus eyeGlowColor = Color.MediumBlue; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -1019,7 +1019,7 @@ namespace CalamityMod.NPCs.Signus 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) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Signus").Type, 1f); diff --git a/NPCs/Signus/SignusSky.cs b/NPCs/Signus/SignusSky.cs index a128b08f8c..0b46939310 100644 --- a/NPCs/Signus/SignusSky.cs +++ b/NPCs/Signus/SignusSky.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Signus float x = 0f; if (this.SignusIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SignusIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.SignusIndex].Center); } float maxIntensity = 0.1f; diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index 0ad84b5084..bb36b36aca 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.SlimeGod { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.PortraitPositionYOverride = -32f; diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index 104f91d53a..535de4f3b2 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; } public override void SetDefaults() diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index 71a15d5a27..d080f997f1 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -14,7 +14,7 @@ namespace CalamityMod.NPCs.SlimeGod { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 2; + Main.npcFrameCount[Type] = 2; NPCID.Sets.BossBestiaryPriority.Add(Type); } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 9ceec3977c..2f75e80e5b 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.SlimeGod public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CrimsonSlimeSpawn.DisplayName"); public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; NPCID.Sets.BossBestiaryPriority.Add(Type); } @@ -63,9 +63,9 @@ namespace CalamityMod.NPCs.SlimeGod int frameY = 1; if (!Main.dedServ) { - if (TextureAssets.Npc[NPC.type].Value is null) + if (TextureAssets.Npc[Type].Value is null) return; - frameY = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; + frameY = TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]; } int aiState = 0; if (NPC.aiAction == 0) @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.frame.Y += frameY; NPC.frameCounter = 0f; } - if (NPC.frame.Y >= frameY * Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y >= frameY * Main.npcFrameCount[Type]) NPC.frame.Y = 0; } diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index 269c22f3ca..a91575514b 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -5,8 +5,10 @@ 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.ID; using Terraria.ModLoader; @@ -16,27 +18,27 @@ namespace CalamityMod.NPCs.SlimeGod public class CrimulanPaladin : ModNPC { private float bossLife; + private float addedStretch = 0f; + private float landingRecoil = 0f; public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; NPC.GetNPCDamage(); - NPC.width = 150; - NPC.height = 92; + NPC.width = 206; + NPC.height = 156; NPC.scale = 1.1f; NPC.defense = 12; NPC.LifeMaxNERB(7500, 9000, 160000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.knockBackResist = 0f; - AnimationType = NPCID.KingSlime; NPC.value = 0f; - NPC.Opacity = 0.8f; + NPC.Opacity = 1f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -91,6 +93,17 @@ namespace CalamityMod.NPCs.SlimeGod setDamage += 25; } + // Used for landing squash and stretch + if (landingRecoil > 0f) + { + landingRecoil *= 0.965f; + landingRecoil -= 0.01f; + } + else + landingRecoil = 0f; + + addedStretch = -landingRecoil; + float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; NPC.noTileCollide = false; @@ -100,10 +113,6 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - NPC.TargetClosest(); - Player player = Main.player[NPC.target]; if (NPC.ai[0] != 3f) @@ -137,10 +146,42 @@ namespace CalamityMod.NPCs.SlimeGod SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.Center); 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 - NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X, (int)spawnAt.Y - 30, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X - 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 0f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X + 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 45f); + 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 - 80, ModContent.NPCType(), 0, 0f, 0f, 90f); + + // Calculate stretch here so that the spike spread looks more natural. + float stretch = NPC.velocity.Y * 0.03f; + stretch = Math.Abs(stretch) + addedStretch; + + // Stretch rapidly if about to jump or teleport, stretch normally while idle. + if (NPC.velocity.Y == 0f) + stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); + + if (stretch > 0.5f) + stretch = 0.5f; + + Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; + + // Spread of spikes. + float projectileVelocity = 2f; + int type2 = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type2); + Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; + destination.Normalize(); + destination *= projectileVelocity; + int numProj = 9; + float rotation = MathHelper.ToRadians(100); + float maxVelocity = death ? 18f : revenge ? 16f : 14f; + float acceleration = death ? 1.03f : revenge ? 1.025f : 1.02f; + int spikeType = 0; + for (int i = 0; i < numProj; i++) + { + spikeType = numProj - 1 - i; + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 20f * scaleStretch, perturbedSpeed, type2, damage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); + } NPC.life = 0; NPC.HitEffect(); @@ -254,90 +295,103 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[3] = 0f; NPC.netUpdate = true; } - else if (NPC.velocity.Y == 0f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.TargetClosest(); - NPC.velocity.X *= 0.8f; - NPC.ai[1] += 1f; - - float jumpGateValue = 50f; - float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; - if (revenge) - { - float moveBoost = death ? 45f * (1f - lifeRatio) : 30f * (1f - lifeRatio); - float speedBoost = death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); - jumpGateValue -= moveBoost; - velocityX += speedBoost; - } - - float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += distanceBelowTarget * 0.002f; - - if (speedMult > 2f) - speedMult = 2f; - - float velocityY = 4f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - velocityY += 2f; - - if (NPC.ai[1] > jumpGateValue) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[3] += 1f; - if (NPC.ai[3] >= 2f) - { - NPC.ai[3] = 0f; - velocityX *= 1.25f; - } - - NPC.ai[1] = 0f; - NPC.velocity.Y -= velocityY * speedMult; - NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; - NPC.noTileCollide = true; - NPC.netUpdate = true; - } - else if (NPC.ai[1] >= jumpGateValue - 30f) - NPC.aiAction = 1; - } - else - { - // Set damage - NPC.damage = setDamage; - - NPC.velocity.X *= 0.99f; - if (NPC.direction < 0 && NPC.velocity.X > -1f) - NPC.velocity.X = -1f; - if (NPC.direction > 0 && NPC.velocity.X < 1f) - NPC.velocity.X = 1f; - - if (!player.dead) - { - if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) - NPC.noTileCollide = false; - else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - NPC.noTileCollide = false; - else - NPC.noTileCollide = true; - } - } - - NPC.ai[2] += 1f; - if (revenge) - NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit NPC.damage = 0; - float phaseSwitchGateValue = 360f; + NPC.ai[2] += 1f; + if (revenge) + NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + } + + float landingSquashTime = 10f; + float telegraphTime = 20f; + float phaseSwitchGateValue = 240f; + float jumpTelegraphGateValue = phaseSwitchGateValue - telegraphTime; + if (NPC.ai[2] < jumpTelegraphGateValue) + { + if (NPC.velocity.Y == 0f) + { + // Squash when landing + if (NPC.ai[1] < 0f) + landingRecoil += Math.Abs(NPC.ai[1]) / landingSquashTime; + + NPC.ai[1] += 1f; + + float jumpGateValue = 50f; + float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; + if (revenge) + { + float moveBoost = death ? 22f * (1f - lifeRatio) : 14f * (1f - lifeRatio); + float speedBoost = death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + jumpGateValue -= moveBoost; + velocityX += speedBoost; + } + + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += distanceBelowTarget * 0.002f; + + if (speedMult > 2f) + speedMult = 2f; + + float velocityY = 8f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + velocityY += 4f; + + float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; + if (NPC.ai[1] >= jumpGateValue) + { + // Set damage + NPC.damage = setDamage; + + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 2f) + { + NPC.ai[3] = 0f; + velocityX *= 1.25f; + } + + NPC.ai[1] = -landingSquashTime; + NPC.velocity.Y -= velocityY * speedMult; + NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; + NPC.netUpdate = true; + } + else if (NPC.ai[1] >= jumpTelegraphGateValue2) + landingRecoil += (NPC.ai[1] - jumpTelegraphGateValue2) / telegraphTime; + } + else + { + // Set damage + NPC.damage = setDamage; + + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) + NPC.velocity.X = -1f; + if (NPC.direction > 0 && NPC.velocity.X < 1f) + NPC.velocity.X = 1f; + + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; + } + } + } + + if (NPC.velocity.Y == 0f) + { bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) { @@ -371,8 +425,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } } - else if (NPC.ai[1] >= phaseSwitchGateValue - 30f) - NPC.aiAction = 1; + else if (NPC.ai[2] >= jumpTelegraphGateValue) + landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime; } } else if (NPC.ai[0] == 1f) @@ -489,6 +543,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[3] = 0f; NPC.netUpdate = true; } + else + landingRecoil += NPC.ai[1] / 10f; } else if (NPC.ai[2] == 0f) NPC.noTileCollide = true; @@ -538,7 +594,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[2] += 1f; } else - NPC.aiAction = 1; + landingRecoil += NPC.ai[1] / 10f; } else { @@ -558,12 +614,18 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.localAI[2] = NPC.ai[0]; - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.netUpdate = true; + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 23f) + { + NPC.localAI[2] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + else + landingRecoil += (NPC.ai[2] - 3f) / 10f; } } @@ -668,7 +730,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] = 0f; - NPC.ai[1] = 0f; + NPC.ai[1] = -10f; NPC.netUpdate = true; NPC.TargetClosest(); } @@ -676,7 +738,7 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) { NPC.ai[0] = 0f; - NPC.ai[1] = 0f; + NPC.ai[1] = -10f; NPC.TargetClosest(); } @@ -691,6 +753,10 @@ namespace CalamityMod.NPCs.SlimeGod } } + // Limit the landing recoil + if (landingRecoil > 0.36f) + landingRecoil = 0.36f; + if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -705,8 +771,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio; - NPC.width = (int)(150f * NPC.scale); - NPC.height = (int)(92f * NPC.scale); + NPC.width = (int)(206f * NPC.scale); + NPC.height = (int)(156f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -729,13 +795,34 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + if (Main.dedServ && slimeSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } } + // Can only hit the target if within certain distance + 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 <= 75f * NPC.scale; + } + public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha); @@ -743,6 +830,36 @@ namespace CalamityMod.NPCs.SlimeGod return newColor * NPC.Opacity; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = TextureAssets.Npc[Type].Value; + Color drawColorAlpha = NPC.GetAlpha(drawColor); + + // Stretch based on Y velocity. + float stretch = NPC.velocity.Y * 0.03f; + stretch = Math.Abs(stretch) + addedStretch; + + // Stretch rapidly if about to jump or teleport, stretch normally while idle. + if (NPC.velocity.Y == 0f) + stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); + + if (stretch > 0.5f) + stretch = 0.5f; + + Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; + float yOffset = stretch * 0.5f * NPC.height; + + spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation + SlimeRotationFactor(NPC), NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f); + + return false; + } + + public static float SlimeRotationFactor(NPC npc) + { + return MathHelper.ToRadians(npc.velocity.X * (-npc.velocity.Y / 10)); + } + public override void HitEffect(NPC.HitInfo hit) { Color dustColor = Color.Crimson; diff --git a/NPCs/SlimeGod/CrimulanPaladin.png b/NPCs/SlimeGod/CrimulanPaladin.png index 4496f5c719..dce53c4106 100644 Binary files a/NPCs/SlimeGod/CrimulanPaladin.png and b/NPCs/SlimeGod/CrimulanPaladin.png differ diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index 93dee0df3c..afc2c59e00 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -5,8 +5,11 @@ 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.ID; using Terraria.ModLoader; @@ -16,29 +19,37 @@ namespace CalamityMod.NPCs.SlimeGod public class EbonianPaladin : ModNPC { private float bossLife; + private float addedStretch = 0f; + private int wingFrameDrawn = 0; + private const int TotalWingFrames = 8; + + public static Asset WingTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 6; + + if (!Main.dedServ) + WingTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/ExtraTextures/EbonianPaladinWings", AssetRequestMode.AsyncLoad); } public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; NPC.GetNPCDamage(); - NPC.width = 150; - NPC.height = 92; + NPC.width = 134; + NPC.height = 150; NPC.scale = 1.1f; NPC.defense = 10; NPC.LifeMaxNERB(8000, 9600, 220000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; + NPC.noTileCollide = true; + NPC.noGravity = true; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - AnimationType = NPCID.KingSlime; NPC.value = 0f; - NPC.Opacity = 0.8f; + NPC.Opacity = 1f; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; @@ -50,7 +61,6 @@ namespace CalamityMod.NPCs.SlimeGod 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]); @@ -60,7 +70,6 @@ namespace CalamityMod.NPCs.SlimeGod 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(); @@ -90,17 +99,11 @@ namespace CalamityMod.NPCs.SlimeGod float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; - NPC.noTileCollide = false; - NPC.noGravity = 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(); - Player player = Main.player[NPC.target]; if (NPC.ai[0] != 4f) @@ -115,7 +118,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; - calamityGlobalNPC.newAI[0] = 0f; NPC.netUpdate = true; } } @@ -134,10 +136,10 @@ namespace CalamityMod.NPCs.SlimeGod SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.Center); 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()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X - 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 0f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X + 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 60f); 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.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X, (int)spawnAt.Y - 80, ModContent.NPCType(), 0, 0f, 0f, 120f); NPC.life = 0; NPC.HitEffect(); @@ -160,449 +162,151 @@ namespace CalamityMod.NPCs.SlimeGod hyperMode = true; } - // Teleport - float teleportGateValue = 720f; - if (!player.dead && NPC.timeLeft > 10 && calamityGlobalNPC.newAI[0] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) + // For animating the wings + NPC.localAI[0] += 1f; + + if (NPC.ai[0] == 0f) { // Avoid cheap bullshit NPC.damage = 0; - // Slow down dramatically - NPC.velocity.X *= 0.5f; + NPC.TargetClosest(); - NPC.ai[0] = 6f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) + FlyMovement(NPC); + + if (NPC.timeLeft > 10) { - NPC.netUpdate = true; - NPC.TargetClosest(false); - player = Main.player[NPC.target]; - - 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) + NPC.ai[1] += 1f; + int idleTime = bossRush ? 30 : death ? 75 : revenge ? 90 : 120; + if (NPC.ai[1] >= idleTime) { - 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[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 (teleportTries >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; - NPC.localAI[0] = bottom.X; - NPC.localAI[3] = bottom.Y; - calamityGlobalNPC.newAI[0] = 0f; - } - } - } - - // Get ready to teleport by increasing ai[3] - if (calamityGlobalNPC.newAI[0] < teleportGateValue) - { - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) - calamityGlobalNPC.newAI[0] += death ? 3f : 2f; - else - calamityGlobalNPC.newAI[0] += 1f; - } - - float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); - - if (NPC.ai[0] == 0f) - { - 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; - NPC.ai[3] = 0f; - NPC.netUpdate = true; - } - - if (NPC.velocity.Y == 0f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.TargetClosest(); - NPC.velocity.X *= 0.8f; - NPC.ai[1] += hyperMode ? 2f : 1f; - - float jumpGateValue = 60f; - float velocityX = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; - if (revenge) - { - float moveBoost = death ? 60f * (1f - lifeRatio) : 40f * (1f - lifeRatio); - float speedBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - jumpGateValue -= moveBoost; - velocityX += speedBoost; - } - - float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += distanceBelowTarget * 0.002f; - - if (speedMult > 2f) - speedMult = 2f; - - float velocityY = 5f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - velocityY += 2f; - - if (NPC.ai[1] > jumpGateValue) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[3] += 1f; - if (NPC.ai[3] >= 2f) - { - NPC.ai[3] = 0f; - velocityY *= 1.25f; - } - NPC.ai[1] = 0f; - NPC.velocity.Y -= velocityY * speedMult; - NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; - NPC.noTileCollide = true; + switch ((int)NPC.Calamity().newAI[0]) + { + default: + NPC.ai[0] = Main.rand.NextBool() ? 1f : 2f; + break; + case 1: + NPC.ai[0] = Main.rand.NextBool() ? 2f : 3f; + break; + case 2: + NPC.ai[0] = Main.rand.NextBool() ? 3f : 1f; + break; + } + + // Pick directional movements for slime bombardment + if (NPC.ai[0] == 2f) + NPC.ai[2] = NPC.Center.X - player.Center.X > 0f ? 1f : -1f; + NPC.netUpdate = true; } - else if (NPC.ai[1] >= jumpGateValue - 30f) - NPC.aiAction = 1; - } - else - { - // Set damage - NPC.damage = setDamage; - - NPC.velocity.X *= 0.99f; - if (NPC.direction < 0 && NPC.velocity.X > -1f) - NPC.velocity.X = -1f; - if (NPC.direction > 0 && NPC.velocity.X < 1f) - NPC.velocity.X = 1f; - - if (!player.dead) - { - if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) - NPC.noTileCollide = false; - else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - NPC.noTileCollide = false; - else - NPC.noTileCollide = true; - } - } - - NPC.ai[2] += 1f; - if (revenge) - NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - - if (NPC.velocity.Y == 0f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - float phaseSwitchGateValue = 420f; - bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; - if (switchPhase) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - switch ((int)NPC.localAI[2]) - { - default: - case 1: - NPC.ai[0] = Main.rand.NextBool() ? 2f : 3f; - break; - - case 2: - NPC.ai[0] = Main.rand.NextBool() ? 3f : (hyperMode ? 2f : 1f); - break; - - case 3: - NPC.ai[0] = Main.rand.NextBool() ? (hyperMode ? 3f : 1f) : 2f; - break; - } - - if (NPC.ai[0] == 2f) - { - // Set damage - NPC.damage = setDamage; - - NPC.noTileCollide = true; - NPC.velocity.Y = death ? -9f : revenge ? -8f : expertMode ? -7f : -6f; - } - - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.netUpdate = true; - } - } - else if (NPC.ai[1] >= phaseSwitchGateValue - 30f) - NPC.aiAction = 1; } } + + // Spread of slime projectiles else if (NPC.ai[0] == 1f) { // Avoid cheap bullshit NPC.damage = 0; - NPC.velocity.X *= 0.85f; + NPC.rotation *= 0.9f; - NPC.ai[1] += 1f; - if (NPC.ai[1] >= 30f) + if (NPC.ai[2] == 1f) { - if (revenge) + // Set animation timer to one in order to prevent weird quick animation here + NPC.localAI[0] = 1f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 10f) { - 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 numProjectiles = Main.getGoodWorld ? 12 : death ? 6 : 4; + float projectileVelocity = death ? 8f : 6f; 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 destination = (new Vector2(NPC.Center.X, NPC.Center.Y + 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); + destination *= projectileVelocity; + float rotation = MathHelper.ToRadians(80); + for (int i = 0; i < numProjectiles; i++) { - Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(3f, 3f); - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; + if (CalamityWorld.LegendaryMode) + destination *= Main.rand.NextFloat() + 0.5f; + + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProjectiles - 1))); 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; + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); + } + + NPC.Calamity().newAI[0] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + } + + 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; + } + } + + FlyMovement(NPC); } + + // Fly overhead in a horizontal line and drop slime else if (NPC.ai[0] == 2f) { // Avoid cheap bullshit NPC.damage = 0; - NPC.noTileCollide = true; - NPC.noGravity = true; + FlyMovement(NPC, true); - if (NPC.velocity.X < 0f) - NPC.direction = -1; - else - NPC.direction = 1; - - NPC.spriteDirection = NPC.direction; - NPC.TargetClosest(); - Vector2 targetCenter = player.Center; - targetCenter.Y -= 350f; - Vector2 targetDist = targetCenter - NPC.Center; - - if (NPC.ai[2] == 1f) + // Drop slime while flying horizontally + if (NPC.ai[1] == 1f) { - NPC.ai[1] += 1f; - targetDist = player.Center - NPC.Center; - targetDist.Normalize(); - targetDist *= death ? 9f : revenge ? 8f : expertMode ? 7f : 6f; - NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; - - if (NPC.ai[1] > 12f) + NPC.ai[3] += 1f; + float slimeDropGateValue = bossRush ? 10f : death ? 20f : revenge ? 25f : expertMode ? 30f : 40f; + if (NPC.ai[3] % slimeDropGateValue == 0f) { - NPC.ai[1] = 0f; - NPC.ai[0] = 2.1f; - NPC.ai[2] = 0f; - NPC.velocity = targetDist; - } - } - else - { - if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) - { - NPC.ai[1] = 0f; - NPC.ai[2] = 1f; - return; - } - - targetDist.Normalize(); - targetDist *= (death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; - } - } - 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)) - { - NPC.ai[2] = 1f; - NPC.netUpdate = true; - } - - if (atTargetPosition || NPC.velocity.Y <= 0f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.ai[1] += 1f; - if (NPC.ai[1] > 10f) - { - SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - // Eruption of slime balls - float projectileVelocity = 4f; + float projectileVelocity = 3f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; - destination.Normalize(); + Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y + 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; - int numProj = 11; - float rotation = MathHelper.ToRadians(90); - for (int i = 0; i < numProj; i++) - { - // Spawn projectiles 0, 1, 2, 3, 7, 8, 9 and 10 - if (i < 4 || i > 6) - { - Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f * NPC.scale + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } - - // Fire slime balls directly at players with a max of 2 - if (enraged && expertMode) - { - List targets = new List(); - foreach (Player plr in Main.ActivePlayers) - { - if (!plr.dead) - targets.Add(plr.whoAmI); - - if (targets.Count > 1) - break; - } - foreach (int t in targets) - { - Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); - } - } + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + destination.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale, destination, type, damage, 0f, Main.myPlayer, 1f); } - NPC.localAI[2] = NPC.ai[0] - 0.1f; - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.netUpdate = true; + SoundEngine.PlaySound(SlimeGodCore.ShotSound, NPC.Center); } - } - else if (NPC.ai[2] == 0f) - NPC.noTileCollide = true; - NPC.noGravity = true; - - NPC.velocity.Y += 0.5f; - float velocityLimit = bossRush ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; - if (NPC.velocity.Y > velocityLimit) - NPC.velocity.Y = velocityLimit; - } - else if (NPC.ai[0] == 3f) - { - 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; - if (player.position.Y + player.height < NPC.Center.Y) - NPC.velocity.Y -= 1.2f; - if (player.position.Y + player.height < NPC.Center.Y - 40f) - NPC.velocity.Y -= 1.4f; - if (player.position.Y + player.height < NPC.Center.Y - 80f) - NPC.velocity.Y -= 1.7f; - if (player.position.Y + player.height < NPC.Center.Y - 120f) - NPC.velocity.Y -= 2f; - if (player.position.Y + player.height < NPC.Center.Y - 160f) - NPC.velocity.Y -= 2.2f; - if (player.position.Y + player.height < NPC.Center.Y - 200f) - NPC.velocity.Y -= 2.4f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - NPC.velocity.Y -= 2f; - - NPC.velocity.X = ((death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost) * NPC.direction; - NPC.ai[2] += 1f; - } - else - NPC.aiAction = 1; - } - 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) - NPC.velocity.X = -velocityLimit; - if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) - NPC.velocity.X = velocityLimit; + NPC.aiAction = 1; } - if (NPC.ai[2] >= 2f && NPC.velocity.Y == 0f) + if (NPC.ai[1] == 2f) { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.localAI[2] = NPC.ai[0]; + NPC.Calamity().newAI[0] = NPC.ai[0]; NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; @@ -611,13 +315,139 @@ namespace CalamityMod.NPCs.SlimeGod } } + // Charge by swooping down + else if (NPC.ai[0] == 3f) + { + // Distance required to charge + float minChargeSafeDistance = 550f; + + // Charge variables + float chargeVelocityMult = 0.1f; + float maxChargeVelocity = (bossRush || enraged) ? 21f : death ? 18f : revenge ? 16.5f : expertMode ? 15f : 12f; + if (Main.getGoodWorld) + maxChargeVelocity *= 1.15f; + if (CalamityWorld.LegendaryMode && revenge) + maxChargeVelocity *= 2f; + + float inertia = (bossRush || enraged) ? 100f : death ? 110f : revenge ? 114f : expertMode ? 120f : 130f; + if (lifeRatio < 0.75f) + inertia *= 0.8f; + if (Main.getGoodWorld) + inertia *= 0.8f; + + // Start charge + if (NPC.ai[1] == 0f) + { + Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)) * maxChargeVelocity; + if (NPC.Distance(player.Center) < minChargeSafeDistance) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Move away if too close + NPC.SimpleFlyMovement(velocity * -1f, 0.25f); + } + else + { + // Set initial charge velocity + NPC.velocity = velocity * chargeVelocityMult; + + // Set damage + NPC.damage = setDamage; + + NPC.ai[1] = 1f; + NPC.netUpdate = true; + + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); + + NPC.aiAction = 1; + } + } + else if (NPC.ai[1] == 1f) + { + // Set damage + NPC.damage = setDamage; + + NPC.ai[2] += 1f; + float phaseGateValue = (bossRush || enraged) ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; + if (NPC.ai[2] >= phaseGateValue) + { + NPC.ai[1] = 2f; + float slowDownDurationAfterCharge = revenge ? 90f : 120f; + NPC.ai[2] = slowDownDurationAfterCharge; + NPC.localAI[2] = 0f; + NPC.velocity /= 2f; + NPC.netUpdate = true; + } + else + { + Vector2 targetVector = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)); + + if (NPC.localAI[2] == 0f) + { + // Accelerate + if (NPC.velocity.Length() < maxChargeVelocity) + { + float velocityMult = (bossRush || enraged) ? 1.15f : death ? 1.13f : revenge ? 1.12f : expertMode ? 1.11f : 1.1f; + NPC.velocity = targetVector * (NPC.velocity.Length() * velocityMult); + if (NPC.velocity.Length() > maxChargeVelocity) + { + NPC.localAI[2] = 1f; + NPC.velocity = NPC.velocity.SafeNormalize(new Vector2(NPC.direction, 0f)) * maxChargeVelocity; + } + } + } + else if (NPC.localAI[2] == 1f) + { + NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia; + + // Stop charging towards the player when within a certain distance + if (NPC.Distance(player.Center) < 130f * NPC.scale) + NPC.localAI[2] = 2f; + } + else + { + // Slow down + if (NPC.Distance(player.Center) >= 210f * NPC.scale || NPC.localAI[2] == 3f) + { + if (NPC.localAI[2] != 3f) + NPC.localAI[2] = 3f; + + NPC.velocity *= 0.97f; + } + } + } + + NPC.aiAction = 1; + } + else + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[2] -= 1f; + if (NPC.ai[2] <= 0f) + { + NPC.Calamity().newAI[0] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[2] = 0f; + + NPC.TargetClosest(); + NPC.netUpdate = true; + } + + NPC.velocity *= 0.95f; + } + } + // Despawn else if (NPC.ai[0] == 4f) { // Avoid cheap bullshit NPC.damage = 0; - NPC.noTileCollide = true; NPC.Opacity -= 0.03f; if (NPC.timeLeft > 10) @@ -629,112 +459,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } - else if (NPC.ai[0] == 5f) - { - // Set damage - NPC.damage = setDamage; - - if (NPC.velocity.X > 0f) - NPC.direction = 1; - else - NPC.direction = -1; - - NPC.spriteDirection = NPC.direction; - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.knockBackResist = 0f; - Vector2 distanceFromTarget = player.Center - NPC.Center; - distanceFromTarget.Y -= 16f; - 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; - NPC.ai[3] = 0f; - NPC.netUpdate = true; - } - - if (distanceFromTarget.Length() > 12f) - { - distanceFromTarget.Normalize(); - distanceFromTarget *= 12f; - } - - NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; - } - else if (NPC.ai[0] == 6f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.aiAction = 1; - NPC.ai[1] += 1f; - float teleportTime = bossRush ? 20f : death ? 30f : 40f; - scale = MathHelper.Clamp((teleportTime - NPC.ai[1]) / teleportTime, 0f, 1f); - scale = 0.5f + scale * 0.5f; - if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); - NPC.ai[0] = 7f; - NPC.ai[1] = 0f; - NPC.netUpdate = true; - } - - if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) - { - NPC.ai[0] = 7f; - NPC.ai[1] = 0f; - } - - // Emit teleport dust - Color dustColor = Color.Lavender; - dustColor.A = 150; - for (int i = 0; i < 10; i++) - { - 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; - } - } - else if (NPC.ai[0] == 7f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.ai[1] += 1f; - float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; - scale = MathHelper.Clamp(NPC.ai[1] / teleportEndTime, 0f, 1f); - scale = 0.5f + scale * 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 dustColor = Color.Lavender; - dustColor.A = 150; - for (int i = 0; i < 10; i++) - { - 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; - } - } - if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -749,8 +473,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio; - NPC.width = (int)(150f * NPC.scale); - NPC.height = (int)(92f * NPC.scale); + NPC.width = (int)(134f * NPC.scale); + NPC.height = (int)(150f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -773,14 +497,130 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); + if (Main.dedServ && slimeSpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn); } } } } } + public static void FlyMovement(NPC npc, bool slimeBombardment = false) + { + // Difficulty bools + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode; + bool death = CalamityWorld.death; + bool revenge = CalamityWorld.revenge; + bool ableToDropSlime = npc.ai[1] == 1f; + + float flyVelocity = bossRush ? 20f : death ? 15f : revenge ? 12.5f : 10f; + float flyAcceleration = bossRush ? 0.24f : death ? 0.18f : revenge ? 0.15f : 0.12f; + + if (slimeBombardment) + { + // Increase max velocity while attempting to line up the bombardment + if (!ableToDropSlime) + flyVelocity *= 1.5f; + + // Keep acceleration high to maintain the bombardment path + flyAcceleration *= 2f; + } + + float slimeBombardmentDistance = 720f; + float flyDistanceY = slimeBombardment ? -450f : masterMode ? -360f : -405f; + float flyDistanceX = slimeBombardment ? (ableToDropSlime ? (slimeBombardmentDistance * -npc.ai[2]) : (slimeBombardmentDistance * npc.ai[2])) : 0f; + Vector2 destination = Main.player[npc.target].Center + new Vector2(flyDistanceX, flyDistanceY); + + if (slimeBombardment) + { + if (!ableToDropSlime) + { + if (npc.Distance(destination) < 80f) + npc.ai[1] = 1f; + } + else + { + if (npc.ai[3] >= 180f || npc.Distance(destination) < 80f) + npc.ai[1] = 2f; + } + } + + Vector2 desiredVelocity = npc.Center; + + if (npc.timeLeft > 10) + { + if (!Collision.CanHit(npc, Main.player[npc.target]) && !slimeBombardment) + { + 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, -tileDistanceAboveTarget)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point.X, point.Y)) + { + desiredVelocity = center + new Vector2(0f, -tileDistanceAboveTarget + 16f) - npc.Center; + flyToSolidTilesAboveTarget = true; + break; + } + } + + if (!flyToSolidTilesAboveTarget) + desiredVelocity = center - npc.Center; + } + else + desiredVelocity = destination - 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 *= 1.5f; + + 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); + } + + // Can only hit the target if within certain distance + 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 <= 65f * NPC.scale; + } + public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(200, 150, Main.DiscoB, NPC.alpha); @@ -788,14 +628,83 @@ namespace CalamityMod.NPCs.SlimeGod return newColor * NPC.Opacity; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = TextureAssets.Npc[Type].Value; + Texture2D wingTexture = WingTexture.Value; + Color drawColorAlpha = NPC.GetAlpha(drawColor); + + // Stretch based on Y velocity. + float vel = NPC.velocity.Length(); + + float stretch = addedStretch; + + float rot = MathHelper.Lerp(0f, MathHelper.WrapAngle(Vector2.Zero.AngleTo(NPC.velocity) + MathHelper.ToRadians(90f)), Math.Clamp(vel / 30f, 0f, 1f)); + + NPC.rotation = MathHelper.Lerp(NPC.rotation, rot, 0.1f); + + // Stretch rapidly if about to jump or teleport. + if (NPC.aiAction == 1) + stretch += MathHelper.Lerp(-0.24f, 0.24f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 10f) / 2f + 0.5f) * (vel / 30); + + // Stretch while idle. + else + stretch += MathHelper.Lerp(-0.1f, 0.1f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) / 2f + 0.5f) * (vel / 30); + + if (stretch > 0.5f) + stretch = 0.5f; + + Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; + + // Used for animating the wings. + bool blobSpreadPhase = NPC.ai[0] == 1f; + bool useFurledWingFrame = blobSpreadPhase && NPC.ai[1] >= 20f; + bool useSpreadWingFrame = blobSpreadPhase && NPC.ai[2] == 1f; + bool slimeBombardmentPhase = NPC.ai[0] == 2f; + bool slightlyIncreaseWingAnimationSpeed = slimeBombardmentPhase && NPC.ai[1] == 1f; + bool swoopingPhase = NPC.ai[0] == 3f; + bool increaseWingAnimationSpeed = swoopingPhase && NPC.ai[1] < 2f; + bool decreaseWingAnimationSpeed = swoopingPhase && NPC.ai[1] == 2f; + if (useFurledWingFrame) + { + wingFrameDrawn = 4; + } + else if (useSpreadWingFrame) + { + wingFrameDrawn = 0; + } + else if (NPC.localAI[0] % (decreaseWingAnimationSpeed ? 9f : increaseWingAnimationSpeed ? 4f : slightlyIncreaseWingAnimationSpeed ? 5f : 6f) == 0f) + { + wingFrameDrawn++; + if (wingFrameDrawn >= TotalWingFrames) + wingFrameDrawn = 0; + } + Rectangle wingFrame1 = new Rectangle(0, wingTexture.Height / TotalWingFrames * wingFrameDrawn, wingTexture.Width / 2, wingTexture.Height / TotalWingFrames); + Rectangle wingFrame2 = new Rectangle(wingTexture.Width / 2, wingTexture.Height / TotalWingFrames * wingFrameDrawn, wingTexture.Width / 2, wingTexture.Height / TotalWingFrames); + + Vector2 wingOrigin1 = new Vector2(wingTexture.Width, wingTexture.Height / TotalWingFrames) * 0.5f; + Vector2 wingOrigin2 = new Vector2(0, wingTexture.Height / TotalWingFrames) * 0.5f; + + Vector2 wingOffset1 = Vector2.Zero; + Vector2 wingOffset2 = Vector2.Zero; + + // Draw the wings. + spriteBatch.Draw(wingTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY) + wingOffset1, wingFrame1, drawColorAlpha, 0f, wingOrigin1, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(wingTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY) + wingOffset2, wingFrame2, drawColorAlpha, 0f, wingOrigin2, NPC.scale, spriteEffects, 0f); + + // Draw the actual paladin. + spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY) + new Vector2(0, 16), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() * 0.5f + new Vector2(0, 8), scaleStretch, spriteEffects, 0f); + + return false; + } + public override void HitEffect(NPC.HitInfo hit) { Color dustColor = Color.Lavender; dustColor.A = 150; for (int k = 0; k < 5; k++) - { 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) diff --git a/NPCs/SlimeGod/EbonianPaladin.png b/NPCs/SlimeGod/EbonianPaladin.png index 11d5836fe5..ac53c2dc32 100644 Binary files a/NPCs/SlimeGod/EbonianPaladin.png and b/NPCs/SlimeGod/EbonianPaladin.png differ diff --git a/NPCs/SlimeGod/EbonianPaladinGlob.png b/NPCs/SlimeGod/EbonianPaladinGlob.png new file mode 100644 index 0000000000..d62b3450bc Binary files /dev/null and b/NPCs/SlimeGod/EbonianPaladinGlob.png differ diff --git a/NPCs/SlimeGod/ExtraTextures/EbonianPaladinWings.png b/NPCs/SlimeGod/ExtraTextures/EbonianPaladinWings.png new file mode 100644 index 0000000000..e77523d257 Binary files /dev/null and b/NPCs/SlimeGod/ExtraTextures/EbonianPaladinWings.png differ diff --git a/NPCs/SlimeGod/ExtraTextures/QueenSlimeGodCore.png b/NPCs/SlimeGod/ExtraTextures/QueenSlimeGodCore.png new file mode 100644 index 0000000000..274f324303 Binary files /dev/null and b/NPCs/SlimeGod/ExtraTextures/QueenSlimeGodCore.png differ diff --git a/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye.png b/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye.png new file mode 100644 index 0000000000..6e925fbe03 Binary files /dev/null and b/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye.png differ diff --git a/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEyeGlow.png b/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEyeGlow.png new file mode 100644 index 0000000000..a93444db0d Binary files /dev/null and b/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEyeGlow.png differ diff --git a/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay.png b/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay.png new file mode 100644 index 0000000000..13ec3b7498 Binary files /dev/null and b/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay.png differ diff --git a/NPCs/SlimeGod/ExtraTextures/SlimeGodCorePossession.png b/NPCs/SlimeGod/ExtraTextures/SlimeGodCorePossession.png new file mode 100644 index 0000000000..cd8a5d67a3 Binary files /dev/null and b/NPCs/SlimeGod/ExtraTextures/SlimeGodCorePossession.png differ diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index a0e8754706..a25fc02f8b 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -44,15 +44,37 @@ 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 ZenithSeedEyeTexture; public static Asset EyeTexture; + public static Asset OverlayTexture; + + private int eyeFrameDrawn = 0; + private int eyeFrameX = 0; + private const int TotalXEyeFrames = 2; + private const int TotalEyeFrames = 25; + private const int TotalEyeFrames_FirstColumn = 19; public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Scale = 0.5f, + PortraitScale = 0.6f, + CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SlimeGod_Bestiary", + PortraitPositionXOverride = 40, + PortraitPositionYOverride = 40 + }; + value.Position.X += 65; + value.Position.Y += 35; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) { - EyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes", AssetRequestMode.AsyncLoad); + ZenithSeedEyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes", AssetRequestMode.AsyncLoad); + EyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye", AssetRequestMode.AsyncLoad); + OverlayTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay", AssetRequestMode.AsyncLoad); } } @@ -61,19 +83,19 @@ namespace CalamityMod.NPCs.SlimeGod NPC.Calamity().canBreakPlayerDefense = true; NPC.GetNPCDamage(); NPC.npcSlots = 10f; - NPC.width = 44; - NPC.height = 44; + NPC.width = 96; + NPC.height = 98; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) NPC.scale = 2f; NPC.defense = 6; NPC.LifeMaxNERB(420); - NPCID.Sets.TrailCacheLength[NPC.type] = 8; - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailCacheLength[Type] = 8; + NPCID.Sets.TrailingMode[Type] = 1; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.value = Item.buyPrice(0, 12, 0, 0); NPC.Opacity = 0.8f; NPC.boss = true; NPC.BossBar = ModContent.GetInstance(); @@ -99,6 +121,57 @@ namespace CalamityMod.NPCs.SlimeGod }); } + public static bool ShouldDespawn(NPC npc) + { + return (!EbonianPaladinAlive(npc) && !CrimulanPaladinAlive(npc)) || npc.Calamity().newAI[3] == 1f || npc.ai[3] == 1f; + } + + public static bool EbonianPaladinAlive(NPC npc) + { + if (CalamityGlobalNPC.slimeGodPurple != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) + { + if ((npc.ModNPC as SlimeGodCore).buffedSlime == 1) + Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 1f; + else + Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 0f; + + npc.Calamity().newAI[0] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.X; + npc.Calamity().newAI[1] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.Y; + + // Despawn check + npc.Calamity().newAI[3] = Main.npc[CalamityGlobalNPC.slimeGodPurple].ai[0] == 4f ? 1f : 0f; + + return true; + } + } + return false; + } + + public static bool CrimulanPaladinAlive(NPC npc) + { + if (CalamityGlobalNPC.slimeGodRed != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) + { + if ((npc.ModNPC as SlimeGodCore).buffedSlime == 2) + Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 1f; + else + Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 0f; + + npc.ai[1] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.X; + npc.ai[2] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; + + // Despawn check + npc.Calamity().newAI[3] = Main.npc[CalamityGlobalNPC.slimeGodRed].ai[0] == 3f ? 1f : 0f; + + return true; + } + } + return false; + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(slimesSpawned); @@ -128,14 +201,13 @@ namespace CalamityMod.NPCs.SlimeGod bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + // For animating the eye + NPC.localAI[0] += 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]; if (!slimesSpawned) @@ -148,53 +220,34 @@ namespace CalamityMod.NPCs.SlimeGod } } + // Used to gauge how aggressive the core is, based on Paladins alive + // Stay near the Paladins and do nothing else at level 0 + // Fire projectiles at level 1 + // Charge at level 2 + // Follow the player around instead of the Paladins at level 3 + // Buff a Paladin far sooner, fire more projectiles, and charge faster at level 4 + int aggressionLevel = 0; + if (!NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) + { + aggressionLevel = 1; + int splitPaladinCount = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); + if (splitPaladinCount < 2) + aggressionLevel = 4; + else if (splitPaladinCount < 3) + aggressionLevel = 3; + else if (splitPaladinCount < 4) + aggressionLevel = 2; + } + // Enrage based on large slimes - bool purpleSlimeAlive = false; - bool redSlimeAlive = false; - - if (CalamityGlobalNPC.slimeGodPurple != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { - if (buffedSlime == 1) - Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 1f; - else - Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 0f; - - calamityGlobalNPC.newAI[0] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.X; - calamityGlobalNPC.newAI[1] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.Y; - - // Despawn check - calamityGlobalNPC.newAI[3] = Main.npc[CalamityGlobalNPC.slimeGodPurple].ai[0] == 4f ? 1f : 0f; - - purpleSlimeAlive = true; - } - } - - if (CalamityGlobalNPC.slimeGodRed != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { - if (buffedSlime == 2) - Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 1f; - else - Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 0f; - - NPC.ai[1] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.X; - NPC.ai[2] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; - - // Despawn check - calamityGlobalNPC.newAI[3] = Main.npc[CalamityGlobalNPC.slimeGodRed].ai[0] == 3f ? 1f : 0f; - - redSlimeAlive = true; - } - } + bool purpleSlimeAlive = EbonianPaladinAlive(NPC); + bool redSlimeAlive = CrimulanPaladinAlive(NPC); // Start shooting blobs more often, move faster and buff large slimes more often if one type of large slime is dead bool phase2 = !purpleSlimeAlive || !redSlimeAlive; // Vanish phase - if ((!purpleSlimeAlive && !redSlimeAlive) || calamityGlobalNPC.newAI[3] == 1f || NPC.ai[3] == 1f) + if (ShouldDespawn(NPC)) { // Avoid cheap bullshit NPC.damage = 0; @@ -305,11 +358,11 @@ namespace CalamityMod.NPCs.SlimeGod } // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > (bossRush ? CalamityGlobalNPC.CatchUpDistance350Tiles : CalamityGlobalNPC.CatchUpDistance200Tiles)) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > (bossRush ? CalamityGlobalNPC.CatchUpDistance350Tiles : CalamityGlobalNPC.CatchUpDistance200Tiles)) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles) { if (NPC.velocity.Y < -3f) NPC.velocity.Y = -3f; @@ -317,7 +370,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y > 16f) NPC.velocity.Y = 16f; - if (NPC.position.Y > Main.worldSurface * 16.0) + if (NPC.position.Y > Main.worldSurface * 16D) { for (int x = 0; x < Main.maxNPCs; x++) { @@ -346,7 +399,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.timeLeft = 1800; // Hide inside large slime - float hideInsideLargeSlimePhaseGateValue = phase2 ? 300f : 900f; + float hideInsideLargeSlimePhaseGateValue = aggressionLevel == 4 ? 120f : phase2 ? 300f : 900f; float hideInsideLargeSlimePhaseDuration = 600f; float exitLargeSlimeGateValue = hideInsideLargeSlimePhaseGateValue + hideInsideLargeSlimePhaseDuration; calamityGlobalNPC.newAI[2] += 1f; @@ -377,9 +430,11 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity = Vector2.Normalize(goToPosition) * 24f; // Reduce velocity to 0 to avoid spastic movement when inside big slime. - if (Vector2.Distance(NPC.Center, goToVector) < 24f) + float stickPositionAdjustment = buffedSlime == 1 ? 16f : 32f; + if (Vector2.Distance(NPC.Center, goToVector) < 80f + stickPositionAdjustment) { NPC.velocity = Vector2.Zero; + NPC.Center = goToVector + Vector2.UnitY * stickPositionAdjustment; NPC.Opacity -= 0.2f; if (NPC.Opacity < 0f) @@ -428,11 +483,12 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - if (expertMode) + if (expertMode && aggressionLevel >= 1) { - float divisor = bossRush ? 90f : death ? 180f : revenge ? 240f : 300f; - if (phase2) - divisor /= 2; + float divisor = bossRush ? 50f : death ? 90f : revenge ? 120f : 150f; + divisor -= (aggressionLevel - 1) * 10f; + if (aggressionLevel == 4) + divisor *= 0.5f; if (calamityGlobalNPC.newAI[2] % divisor == 0f) { @@ -441,7 +497,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (Main.rand.NextBool()) { - float projectileVelocity = 4f; + float projectileVelocity = 4f + (aggressionLevel - 1) * 2f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Vector2 velocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; @@ -449,7 +505,7 @@ namespace CalamityMod.NPCs.SlimeGod } else { - float projectileVelocity = 8f; + float projectileVelocity = 8f + (aggressionLevel - 1) * 2f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Vector2 velocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; @@ -466,51 +522,66 @@ namespace CalamityMod.NPCs.SlimeGod buffedSlime = 0; float flySpeed = death ? 15f : revenge ? 13.5f : expertMode ? 12f : 9f; + flySpeed += aggressionLevel; + if (aggressionLevel == 4) + flySpeed += 3f; if (phase2) - flySpeed *= 1.25f; + flySpeed *= 1.1f; if (bossRush) - flySpeed *= 1.25f; + flySpeed *= 1.2f; if (Main.getGoodWorld) - flySpeed *= 1.25f; + flySpeed *= 1.3f; Vector2 flyDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); - Vector2 flyDestination = GetFlyDestination(player); + Vector2 flyDestination = aggressionLevel >= 3 ? player.Center : GetFlyDestination(player); Vector2 idealVelocity = (flyDestination - flyDirection).SafeNormalize(Vector2.UnitY) * flySpeed; float distanceFromFlyDestination = NPC.Distance(flyDestination); - NPC.ai[0] -= 1f; - if (distanceFromFlyDestination < 200f || NPC.ai[0] > 0f) + if (aggressionLevel >= 2) { - // Set damage - NPC.damage = NPC.defDamage; + NPC.ai[0] -= 1f; + if (distanceFromFlyDestination < 200f || NPC.ai[0] > 0f) + { + // Set damage + NPC.damage = NPC.defDamage; - if (distanceFromFlyDestination < 200f) - NPC.ai[0] = 20f; + if (distanceFromFlyDestination < 200f) + NPC.ai[0] = 20f; - if (NPC.velocity.X < 0f) - NPC.direction = -1; - else - NPC.direction = 1; + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; - NPC.rotation += NPC.direction * 0.3f; + NPC.rotation += NPC.direction * 0.3f; - return; + return; + } } - float inertia = 50f; - if (Main.getGoodWorld) - inertia *= 0.8f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - inertia -= Main.rand.Next(31); + if (distanceFromFlyDestination < 150f && aggressionLevel < 2) + { + if (NPC.velocity.Length() > flySpeed * 0.2f) + NPC.velocity *= 0.9f; + } + else + { + float inertia = 50f; + inertia -= aggressionLevel * 3f; + if (Main.getGoodWorld) + inertia *= 0.8f; + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + inertia *= Main.rand.NextFloat(0.2f, 1f); - NPC.velocity = (NPC.velocity * inertia + idealVelocity) / (inertia + 1f); - if (distanceFromFlyDestination < 350f) - NPC.velocity = (NPC.velocity * 10f + idealVelocity) / 11f; - if (distanceFromFlyDestination < 300f) - NPC.velocity = (NPC.velocity * 7f + idealVelocity) / 8f; + NPC.velocity = (NPC.velocity * inertia + idealVelocity) / (inertia + 1f); + if (distanceFromFlyDestination < 350f) + NPC.velocity = (NPC.velocity * 10f + idealVelocity) / 11f; + if (distanceFromFlyDestination < 300f) + NPC.velocity = (NPC.velocity * 7f + idealVelocity) / 8f; + } - NPC.rotation = NPC.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.05f; } public Vector2 GetFlyDestination(Player target) @@ -569,57 +640,129 @@ namespace CalamityMod.NPCs.SlimeGod public override Color? GetAlpha(Color drawColor) { - Color newColor = buffedSlime == 0 ? new Color(255, 255, 255, drawColor.A) : drawColor; + Color newColor = new Color(255, 255, 255, 255); return newColor * NPC.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + float sc = 1f; + if (!ShouldDespawn(NPC)) { - spriteEffects = SpriteEffects.FlipHorizontally; - } - 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 = 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); - Vector2 halfRect = rectangle.Size() / 2f; - int twoConst = 2; - int coreID = 1; - spriteBatch.Draw(texture2D3, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); - if (Main.zenithWorld) - { - spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); - } - if (!Main.zenithWorld) - while (((twoConst > 0 && coreID < 8) || (twoConst < 0 && coreID > 8)) && CalamityConfig.Instance.Afterimages) + if (buffedSlime != 0f) { - Color colorLightingAlpha = NPC.GetAlpha(colorLightingArea); + NPC.scale = MathHelper.Lerp(NPC.scale, 0f, 0.2f); + NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 0.7f, 0.4f); + } + else + { + NPC.scale = MathHelper.Lerp(NPC.scale, sc, 0.2f); + NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 1f, 0.4f); + } + } + + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Color drawColorAlpha = (buffedSlime != 0f && !ShouldDespawn(NPC)) ? new Color(200, 150, Main.DiscoB, NPC.alpha) * NPC.Opacity : NPC.GetAlpha(drawColor); + Vector2 origin = NPC.frame.Size() * 0.5f; + Vector2 halfSize = NPC.Size * 0.5f; + + Texture2D texture = TextureAssets.Npc[Type].Value; + Texture2D eyeTexture = EyeTexture.Value; + Texture2D overlayTexture = OverlayTexture.Value; + Texture2D pog = ZenithSeedEyeTexture.Value; + + // Used for animating the eye + if (NPC.localAI[0] % 6f == 0f) + { + eyeFrameDrawn++; + if (eyeFrameX == 0) + { + if (eyeFrameDrawn >= TotalEyeFrames_FirstColumn) { - goto IL_6899; + eyeFrameDrawn = 0; + eyeFrameX = 1; } -IL_6881: - coreID += twoConst; - continue; -IL_6899: + } + else + { + if (eyeFrameDrawn >= TotalEyeFrames) + { + eyeFrameDrawn = 0; + eyeFrameX = 0; + } + } + } + Rectangle eyeFrame = new Rectangle(eyeTexture.Width / TotalXEyeFrames * eyeFrameX, eyeTexture.Height / TotalEyeFrames * eyeFrameDrawn, eyeTexture.Width / TotalXEyeFrames, eyeTexture.Height / TotalEyeFrames); + Vector2 eyeOrigin = new Vector2(eyeTexture.Width / TotalXEyeFrames, eyeTexture.Height / TotalEyeFrames) * 0.5f; + + if (!Main.zenithWorld) + { + Vector2 drawPositionAdjustment = halfSize - screenPos + new Vector2(0f, NPC.gfxOffY); + float colorAlphaDivisor = NPCID.Sets.TrailCacheLength[Type] * 1.5f; + int twoConst = 2; + int coreID = 1; + + while (((twoConst > 0 && coreID < 8) || (twoConst < 0 && coreID > 8)) && CalamityClientConfig.Instance.Afterimages) + { float trailLengthMult = (float)(8 - coreID); if (twoConst < 0) - { trailLengthMult = (float)(1 - coreID); - } - colorLightingAlpha *= trailLengthMult / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f); - Vector2 drawPosition = NPC.oldPos[coreID]; - float coreRotate = NPC.rotation; - Main.spriteBatch.Draw(texture2D3, drawPosition + NPC.Size / 2f - screenPos + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorLightingAlpha, coreRotate + NPC.rotation * 0f * (float)(coreID - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), halfRect, NPC.scale, spriteEffects, 0f); - goto IL_6881; + + drawColorAlpha *= trailLengthMult / colorAlphaDivisor; + Vector2 drawPosition = NPC.oldPos[coreID] + drawPositionAdjustment; + + // Draw the base texture afterimages + spriteBatch.Draw(texture, drawPosition, NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + // Draw the eye texture afterimages + spriteBatch.Draw(eyeTexture, drawPosition, eyeFrame, drawColorAlpha, 0f, eyeOrigin, 1f, spriteEffects, 0f); + + // Draw the overlay texture afterimages + spriteBatch.Draw(overlayTexture, drawPosition, NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + coreID += twoConst; } + } + + // Reset the color + drawColorAlpha = (buffedSlime != 0f && !ShouldDespawn(NPC)) ? new Color(200, 150, Main.DiscoB, NPC.alpha) * NPC.Opacity : NPC.GetAlpha(drawColor); + + // Draw the base texture + spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + // Draw the eye + spriteBatch.Draw(eyeTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), eyeFrame, drawColorAlpha, 0f, eyeOrigin, 1f, spriteEffects, 0f); + + // Draw the overlay + spriteBatch.Draw(overlayTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + if (Main.zenithWorld) + spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + return false; } + // Can only hit the target if within certain distance + 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 <= 40f * NPC.scale; + } + public override void BossLoot(ref string name, ref int potionType) { potionType = ItemID.HealingPotion; @@ -633,8 +776,6 @@ IL_6899: CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedSlimeGod); - // Mark the Slime God as dead DownedBossSystem.downedSlimeGod = true; CalamityNetcode.SyncWorld(); diff --git a/NPCs/SlimeGod/SlimeGodCore.png b/NPCs/SlimeGod/SlimeGodCore.png index 64d666f45d..be6295b7cf 100644 Binary files a/NPCs/SlimeGod/SlimeGodCore.png and b/NPCs/SlimeGod/SlimeGodCore.png differ diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index bc312da7d8..0de260db20 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -5,8 +5,10 @@ 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; @@ -17,10 +19,11 @@ namespace CalamityMod.NPCs.SlimeGod public class SplitCrimulanPaladin : ModNPC { private float bossLife; + private float addedStretch = 0f; + private float landingRecoil = 0f; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -38,14 +41,13 @@ namespace CalamityMod.NPCs.SlimeGod NPC.LifeMaxNERB(1875, 2250, 80000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.GetNPCDamage(); - NPC.width = 150; - NPC.height = 92; + NPC.width = 166; + NPC.height = 114; NPC.scale = 0.8f; NPC.defense = 10; NPC.knockBackResist = 0f; - AnimationType = NPCID.KingSlime; NPC.value = Item.buyPrice(0, 1, 0, 0); - NPC.Opacity = 0.8f; + NPC.Opacity = 1f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -106,6 +108,17 @@ namespace CalamityMod.NPCs.SlimeGod setDamage += 22; } + // Used for landing squash and stretch + if (landingRecoil > 0f) + { + landingRecoil *= 0.965f; + landingRecoil -= 0.01f; + } + else + landingRecoil = 0f; + + addedStretch = -landingRecoil; + float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; NPC.noTileCollide = false; @@ -115,10 +128,6 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - NPC.TargetClosest(); - Player player = Main.player[NPC.target]; if (NPC.ai[0] != 3f) @@ -251,79 +260,91 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; + NPC.ai[2] += 1f; + if (revenge) + NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio); + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; - NPC.ai[1] += 1f; + } - float jumpGateValue = 35f; - float velocityX = death ? 11.5f : revenge ? 10.5f : expertMode ? 9.5f : 7.5f; - if (revenge) + float landingSquashTime = 10f; + float telegraphTime = 20f; + float phaseSwitchGateValue = 120f; + float jumpTelegraphGateValue = phaseSwitchGateValue - telegraphTime; + if (NPC.ai[2] < jumpTelegraphGateValue) + { + if (NPC.velocity.Y == 0f) { - float moveBoost = death ? 11f * (1f - lifeRatio) : 7f * (1f - lifeRatio); - float speedBoost = death ? 2.25f * (1f - lifeRatio) : 1.5f * (1f - lifeRatio); - jumpGateValue -= moveBoost; - velocityX += speedBoost; + // Squash when landing + if (NPC.ai[1] < 0f) + landingRecoil += Math.Abs(NPC.ai[1]) / landingSquashTime; + + NPC.ai[1] += 1f; + + float jumpGateValue = 40f; + float velocityX = death ? 11.5f : revenge ? 10.5f : expertMode ? 9.5f : 7.5f; + if (revenge) + { + float moveBoost = death ? 11f * (1f - lifeRatio) : 7f * (1f - lifeRatio); + float speedBoost = death ? 2.25f * (1f - lifeRatio) : 1.5f * (1f - lifeRatio); + jumpGateValue -= moveBoost; + velocityX += speedBoost; + } + + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += distanceBelowTarget * 0.002f; + + if (speedMult > 2f) + speedMult = 2f; + + float velocityY = 8f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + velocityY += 4f; + + float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; + if (NPC.ai[1] >= jumpGateValue) + { + // Set damage + NPC.damage = setDamage; + + velocityX *= 1.25f; + NPC.ai[1] = -landingSquashTime; + NPC.velocity.Y -= velocityY * speedMult; + NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; + NPC.netUpdate = true; + } + else if (NPC.ai[1] >= jumpTelegraphGateValue2) + landingRecoil += (NPC.ai[1] - jumpTelegraphGateValue2) / telegraphTime; } - - float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += distanceBelowTarget * 0.002f; - - if (speedMult > 2f) - speedMult = 2f; - - float velocityY = 4f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - velocityY += 2f; - - if (NPC.ai[1] > jumpGateValue) + else { // Set damage NPC.damage = setDamage; - velocityX *= 1.25f; - NPC.ai[1] = 0f; - NPC.velocity.Y -= velocityY * speedMult; - NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; - NPC.noTileCollide = true; - NPC.netUpdate = true; - } - else if (NPC.ai[1] >= jumpGateValue - 30f) - NPC.aiAction = 1; - } - else - { - // Set damage - NPC.damage = setDamage; + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) + NPC.velocity.X = -1f; + if (NPC.direction > 0 && NPC.velocity.X < 1f) + NPC.velocity.X = 1f; - NPC.velocity.X *= 0.99f; - if (NPC.direction < 0 && NPC.velocity.X > -1f) - NPC.velocity.X = -1f; - if (NPC.direction > 0 && NPC.velocity.X < 1f) - NPC.velocity.X = 1f; - - if (!player.dead) - { - if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) - NPC.noTileCollide = false; - else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - NPC.noTileCollide = false; - else - NPC.noTileCollide = true; + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; + } } } - NPC.ai[2] += 1f; - if (revenge) - NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio); - if (NPC.velocity.Y == 0f) { - // Avoid cheap bullshit - NPC.damage = 0; - - float phaseSwitchGateValue = 180f; bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) { @@ -355,8 +376,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } } - else if (NPC.ai[1] >= phaseSwitchGateValue - 30f) - NPC.aiAction = 1; + else if (NPC.ai[2] >= jumpTelegraphGateValue) + landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime; } } else if (NPC.ai[0] == 1f) @@ -472,6 +493,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[2] = 0f; NPC.netUpdate = true; } + else + landingRecoil += NPC.ai[1] / 10f; } else if (NPC.ai[2] == 0f) NPC.noTileCollide = true; @@ -521,7 +544,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[2] += 1f; } else - NPC.aiAction = 1; + landingRecoil += NPC.ai[1] / 10f; } else { @@ -541,11 +564,17 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.localAI[2] = NPC.ai[0]; - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 23f) + { + NPC.localAI[2] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + else + landingRecoil += (NPC.ai[2] - 3f) / 10f; } } @@ -649,7 +678,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] = 0f; - NPC.ai[1] = 0f; + NPC.ai[1] = -10f; NPC.netUpdate = true; NPC.TargetClosest(); } @@ -657,7 +686,7 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) { NPC.ai[0] = 0f; - NPC.ai[1] = 0f; + NPC.ai[1] = -10f; NPC.TargetClosest(); } @@ -672,6 +701,10 @@ namespace CalamityMod.NPCs.SlimeGod } } + // Limit the landing recoil + if (landingRecoil > 0.36f) + landingRecoil = 0.36f; + if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -686,8 +719,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio * 0.75f; - NPC.width = (int)(150f * NPC.scale); - NPC.height = (int)(92f * NPC.scale); + NPC.width = (int)(166f * NPC.scale); + NPC.height = (int)(114f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -710,13 +743,34 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + if (Main.dedServ && slimeSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } } + // Can only hit the target if within certain distance + 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 <= 55f * NPC.scale; + } + public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha); @@ -724,6 +778,31 @@ namespace CalamityMod.NPCs.SlimeGod return newColor * NPC.Opacity; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = TextureAssets.Npc[Type].Value; + Color drawColorAlpha = NPC.GetAlpha(drawColor); + + // Stretch based on Y velocity. + float stretch = NPC.velocity.Y * 0.03f; + stretch = Math.Abs(stretch) + addedStretch; + + // Stretch rapidly if about to jump or teleport, stretch normally while idle. + if (NPC.velocity.Y == 0f) + stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); + + if (stretch > 0.5f) + stretch = 0.5f; + + Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; + float yOffset = stretch * 0.5f * NPC.height; + + spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation + CrimulanPaladin.SlimeRotationFactor(NPC), NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f); + + return false; + } + public override void OnKill() { int heartAmt = Main.rand.Next(3) + 3; diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.png b/NPCs/SlimeGod/SplitCrimulanPaladin.png index 4496f5c719..bddad0012c 100644 Binary files a/NPCs/SlimeGod/SplitCrimulanPaladin.png and b/NPCs/SlimeGod/SplitCrimulanPaladin.png differ diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index b0bd111e09..727a4065b5 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -5,8 +5,10 @@ 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; @@ -17,10 +19,11 @@ namespace CalamityMod.NPCs.SlimeGod public class SplitEbonianPaladin : ModNPC { private float bossLife; + private float addedStretch = 0f; + private float landingRecoil = 0f; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -38,16 +41,15 @@ namespace CalamityMod.NPCs.SlimeGod NPC.LifeMaxNERB(2000, 2400, 110000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.GetNPCDamage(); - NPC.width = 150; - NPC.height = 92; + NPC.width = 166; + NPC.height = 114; NPC.scale = 0.8f; NPC.defense = 8; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - AnimationType = NPCID.KingSlime; NPC.value = Item.buyPrice(0, 1, 0, 0); - NPC.Opacity = 0.8f; + NPC.Opacity = 1f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -106,6 +108,17 @@ namespace CalamityMod.NPCs.SlimeGod setDamage += 20; } + // Used for landing squash and stretch + if (landingRecoil > 0f) + { + landingRecoil *= 0.965f; + landingRecoil -= 0.01f; + } + else + landingRecoil = 0f; + + addedStretch = -landingRecoil; + float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; NPC.noTileCollide = false; @@ -115,10 +128,6 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - NPC.TargetClosest(); - Player player = Main.player[NPC.target]; if (NPC.ai[0] != 4f) @@ -249,79 +258,91 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; + NPC.ai[2] += 1f; + if (revenge) + NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio); + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; - NPC.ai[1] += hyperMode ? 2f : 1f; + } - float jumpGateValue = 40f; - float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; - if (revenge) + float landingSquashTime = 10f; + float telegraphTime = 20f; + float phaseSwitchGateValue = 150f; + float jumpTelegraphGateValue = phaseSwitchGateValue - telegraphTime; + if (NPC.ai[2] < jumpTelegraphGateValue) + { + if (NPC.velocity.Y == 0f) { - float moveBoost = death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio); - float speedBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - jumpGateValue -= moveBoost; - velocityX += speedBoost; + // Squash when landing + if (NPC.ai[1] < 0f) + landingRecoil += Math.Abs(NPC.ai[1]) / landingSquashTime; + + NPC.ai[1] += hyperMode ? 2f : 1f; + + float jumpGateValue = 45f; + float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; + if (revenge) + { + float moveBoost = death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio); + float speedBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + jumpGateValue -= moveBoost; + velocityX += speedBoost; + } + + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += distanceBelowTarget * 0.002f; + + if (speedMult > 2f) + speedMult = 2f; + + float velocityY = 10f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + velocityY += 2f; + + float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; + if (NPC.ai[1] > jumpGateValue) + { + // Set damage + NPC.damage = setDamage; + + velocityY *= 1.25f; + NPC.ai[1] = -landingSquashTime; + NPC.velocity.Y -= velocityY * speedMult; + NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; + NPC.netUpdate = true; + } + else if (NPC.ai[1] >= jumpTelegraphGateValue2) + landingRecoil += (NPC.ai[1] - jumpTelegraphGateValue2) / telegraphTime; } - - float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += distanceBelowTarget * 0.002f; - - if (speedMult > 2f) - speedMult = 2f; - - float velocityY = 5f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - velocityY += 2f; - - if (NPC.ai[1] > jumpGateValue) + else { // Set damage NPC.damage = setDamage; - velocityY *= 1.25f; - NPC.ai[1] = 0f; - NPC.velocity.Y -= velocityY * speedMult; - NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; - NPC.noTileCollide = true; - NPC.netUpdate = true; - } - else if (NPC.ai[1] >= jumpGateValue - 30f) - NPC.aiAction = 1; - } - else - { - // Set damage - NPC.damage = setDamage; + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) + NPC.velocity.X = -1f; + if (NPC.direction > 0 && NPC.velocity.X < 1f) + NPC.velocity.X = 1f; - NPC.velocity.X *= 0.99f; - if (NPC.direction < 0 && NPC.velocity.X > -1f) - NPC.velocity.X = -1f; - if (NPC.direction > 0 && NPC.velocity.X < 1f) - NPC.velocity.X = 1f; - - if (!player.dead) - { - if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) - NPC.noTileCollide = false; - else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - NPC.noTileCollide = false; - else - NPC.noTileCollide = true; + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; + } } } - NPC.ai[2] += 1f; - if (revenge) - NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio); - if (NPC.velocity.Y == 0f) { - // Avoid cheap bullshit - NPC.damage = 0; - - float phaseSwitchGateValue = 210f; bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) { @@ -357,8 +378,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } } - else if (NPC.ai[1] >= phaseSwitchGateValue - 30f) - NPC.aiAction = 1; + else if (NPC.ai[2] >= jumpTelegraphGateValue) + landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime; } } else if (NPC.ai[0] == 1f) @@ -390,7 +411,7 @@ namespace CalamityMod.NPCs.SlimeGod { 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); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 45f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } } @@ -519,6 +540,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[2] = 0f; NPC.netUpdate = true; } + else + landingRecoil += NPC.ai[1] / 10f; } else if (NPC.ai[2] == 0f) NPC.noTileCollide = true; @@ -568,7 +591,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[2] += 1f; } else - NPC.aiAction = 1; + landingRecoil += NPC.ai[1] / 10f; } else { @@ -588,11 +611,17 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.localAI[2] = NPC.ai[0]; - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 22f) + { + NPC.localAI[2] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + else + landingRecoil += (NPC.ai[2] - 2f) / 10f; } } @@ -696,7 +725,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] = 0f; - NPC.ai[1] = 0f; + NPC.ai[1] = -10f; NPC.netUpdate = true; NPC.TargetClosest(); } @@ -704,7 +733,7 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) { NPC.ai[0] = 0f; - NPC.ai[1] = 0f; + NPC.ai[1] = -10f; NPC.TargetClosest(); } @@ -719,6 +748,10 @@ namespace CalamityMod.NPCs.SlimeGod } } + // Limit the landing recoil + if (landingRecoil > 0.36f) + landingRecoil = 0.36f; + if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -733,8 +766,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio * 0.75f; - NPC.width = (int)(150f * NPC.scale); - NPC.height = (int)(92f * NPC.scale); + NPC.width = (int)(166f * NPC.scale); + NPC.height = (int)(114f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -754,13 +787,34 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + if (Main.dedServ && slimeSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } } + // Can only hit the target if within certain distance + 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 <= 55f * NPC.scale; + } + public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(200, 150, Main.DiscoB, NPC.alpha); @@ -768,6 +822,31 @@ namespace CalamityMod.NPCs.SlimeGod return newColor * NPC.Opacity; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = TextureAssets.Npc[Type].Value; + Color drawColorAlpha = NPC.GetAlpha(drawColor); + + // Stretch based on Y velocity. + float stretch = NPC.velocity.Y * 0.03f; + stretch = Math.Abs(stretch) + addedStretch; + + // Stretch rapidly if about to jump or teleport, stretch normally while idle. + if (NPC.velocity.Y == 0f) + stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); + + if (stretch > 0.5f) + stretch = 0.5f; + + Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; + float yOffset = stretch * 0.5f * NPC.height; + + spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation + CrimulanPaladin.SlimeRotationFactor(NPC), NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f); + + return false; + } + public override void OnKill() { int heartAmt = Main.rand.Next(3) + 3; diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.png b/NPCs/SlimeGod/SplitEbonianPaladin.png index 11d5836fe5..2c59858364 100644 Binary files a/NPCs/SlimeGod/SplitEbonianPaladin.png and b/NPCs/SlimeGod/SplitEbonianPaladin.png differ diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 973407845f..90e0b51f13 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -14,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.StormWeaver { + [LongDistanceNetSync(SyncWith = typeof(StormWeaverHead))] public class StormWeaverBody : ModNPC { public static Asset Phase2Texture; @@ -23,7 +24,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); @@ -123,7 +124,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorBody1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorBody2").Type, NPC.scale); @@ -275,7 +276,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; @@ -328,7 +329,7 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeBody1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeBody2").Type, NPC.scale); diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 732303ca07..6132f87145 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -13,7 +13,9 @@ 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.NPCs.Perforator; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.Sounds; @@ -31,21 +33,19 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.StormWeaver { + [LongDistanceNetSync] public class StormWeaverHead : ModNPC { public static int normalIconIndex; public static int vulnerableIconIndex; - internal static void LoadHeadIcons() + public override void Load() { string normalIconPath = "CalamityMod/NPCs/StormWeaver/StormWeaverHead_Head_Boss"; string vulnerableIconPath = "CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss"; - - CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); - normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); - - CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); - vulnerableIconIndex = ModContent.GetModBossHeadSlot(vulnerableIconPath); + + normalIconIndex = CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + vulnerableIconIndex = CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); } private const float BoltAngleSpread = 280; @@ -63,13 +63,12 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetStaticDefaults() { - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.85f, PortraitScale = 0.75f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/StormWeaver_Bestiary", PortraitPositionXOverride = 40, PortraitPositionYOverride = 40 }; @@ -92,7 +91,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.height = 74; NPC.lifeMax = 825000; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 500000); - NPC.value = Item.buyPrice(2, 0, 0, 0); + NPC.value = Item.buyPrice(1, 0, 0, 0); // Phase one settings CalamityGlobalNPC global = NPC.Calamity(); @@ -176,10 +175,10 @@ namespace CalamityMod.NPCs.StormWeaver bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - if (CalamityConfig.Instance.BossesStopWeather) - CalamityMod.StopRain(); + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); else if (!Main.raining && !bossRush) - CalamityUtils.StartRain(); + CalamityWorld.StartRain(); float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -202,7 +201,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorHead1").Type, NPC.scale); SoundEngine.PlaySound(ArmorShedSound, NPC.Center); @@ -371,7 +370,7 @@ namespace CalamityMod.NPCs.StormWeaver if (phase3 && !useTornadoes) { // Let it snow while able to use the frost wave attack - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 scaledSize = Main.Camera.ScaledSize; Vector2 scaledPosition = Main.Camera.ScaledPosition; @@ -447,9 +446,9 @@ namespace CalamityMod.NPCs.StormWeaver if (phase4) { // Lightning strike - if (!Main.DisableIntenseVisualEffects) + if (!Main.DisableIntenseVisualEffects && !CalamityClientConfig.Instance.Photosensitivity) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (lightningSpeed == 0f) { @@ -793,7 +792,7 @@ namespace CalamityMod.NPCs.StormWeaver if (phase4) { // Adjust lightning flash variables when in phase 3 - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (lightningSpeed > 0f) { @@ -816,7 +815,7 @@ namespace CalamityMod.NPCs.StormWeaver if (Main.netMode == NetmodeID.MultiplayerClient || (Main.netMode == NetmodeID.SinglePlayer && Main.gameMenu) || calamityGlobalNPC.newAI[1] > 0f || bossRush) return; - CalamityUtils.StartRain(true, true); + CalamityWorld.StartRain(true, true); calamityGlobalNPC.newAI[1] = 1f; } } @@ -824,7 +823,10 @@ namespace CalamityMod.NPCs.StormWeaver public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.IsABestiaryIconDummy) + { NPC.Opacity = 1f; + return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, 6, 24, 0.8f, Vector2.Zero, 3, 26, 10, 0.15f); + } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) @@ -847,7 +849,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; @@ -900,7 +902,7 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeHead1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeHead2").Type, NPC.scale); @@ -985,11 +987,14 @@ namespace CalamityMod.NPCs.StormWeaver // Weapons int[] weapons = new int[] { - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); - normalOnly.Add(ModContent.ItemType(), 10); + + // Equipment + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Materials normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 7)); diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index aa07b37d44..13bc6f7fc9 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.StormWeaver { + [LongDistanceNetSync(SyncWith = typeof(StormWeaverHead))] public class StormWeaverTail : ModNPC { private int invinceTime = 180; @@ -25,7 +26,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); @@ -129,7 +130,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorTail1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorTail2").Type, NPC.scale); @@ -271,7 +272,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; @@ -327,7 +328,7 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeTail1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeTail2").Type, NPC.scale); diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index 74d4d56dad..2c4804bbdd 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 16; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + Main.npcFrameCount[Type] = 16; + NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -38,9 +38,9 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 56; NPC.height = 42; NPC.defense = 22; - NPC.lifeMax = 900; + NPC.lifeMax = 1130; NPC.aiStyle = AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(0, 0, 8, 0); NPC.HitSound = SoundID.NPCHit38; NPC.DeathSound = SoundID.NPCDeath46; NPC.knockBackResist = 0.04f; @@ -237,7 +237,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AnthozoanCrabGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AnthozoanCrabGore2").Type, NPC.scale); diff --git a/NPCs/SulphurousSea/AquaticUrchin.cs b/NPCs/SulphurousSea/AquaticUrchin.cs index 57b90345a5..6d911aa579 100644 --- a/NPCs/SulphurousSea/AquaticUrchin.cs +++ b/NPCs/SulphurousSea/AquaticUrchin.cs @@ -29,9 +29,9 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 20; NPC.height = 20; NPC.defense = 10; - NPC.lifeMax = Main.hardMode ? 300 : 50; + NPC.lifeMax = Main.hardMode ? 380 : 70; NPC.knockBackResist = 0.8f; - NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.value = Item.buyPrice(0, 0, 3, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath15; NPC.behindTiles = true; @@ -150,7 +150,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 1, 30, 50); + npcLoot.Add(ModContent.ItemType(), 15); } public override void HitEffect(NPC.HitInfo hit) @@ -165,7 +165,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AquaticUrchin").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AquaticUrchin2").Type, 1f); diff --git a/NPCs/SulphurousSea/AquaticUrchin.png b/NPCs/SulphurousSea/AquaticUrchin.png index ccf814530b..c4c3362399 100644 Binary files a/NPCs/SulphurousSea/AquaticUrchin.png and b/NPCs/SulphurousSea/AquaticUrchin.png differ diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index bc8cf816d8..4034dc9a41 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.SulphurousSea public const float CheckDistance = 480f; public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 4; value.PortraitPositionYOverride = 24f; @@ -36,9 +36,9 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 54; NPC.height = 42; NPC.defense = 25; - NPC.lifeMax = 1000; + NPC.lifeMax = 1250; NPC.aiStyle = AIType = -1; - NPC.value = Item.buyPrice(0, 0, 3, 50); + NPC.value = Item.buyPrice(0, 0, 8, 0); NPC.HitSound = SoundID.NPCHit42; NPC.DeathSound = SoundID.NPCDeath5; NPC.knockBackResist = 0f; @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BelchingCoralGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BelchingCoralGore2").Type, NPC.scale); diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index f892ce143d..4c7bda3af5 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -1,7 +1,11 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -13,7 +17,7 @@ namespace CalamityMod.NPCs.SulphurousSea { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -23,19 +27,21 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { + NPC.noGravity = true; NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 25; NPC.width = 50; NPC.height = 36; NPC.defense = 30; NPC.DR_NERD(0.15f); - NPC.lifeMax = 35; + NPC.lifeMax = 50; NPC.knockBackResist = 0.25f; - NPC.aiStyle = NPCAIStyleID.Fighter; - AIType = NPCID.Crab; + NPC.aiStyle = -1; + AIType = -1; NPC.value = Item.buyPrice(0, 0, 0, 60); NPC.HitSound = SoundID.NPCHit50; NPC.DeathSound = SoundID.NPCDeath54; + NPC.chaseable = false; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; @@ -57,54 +63,94 @@ namespace CalamityMod.NPCs.SulphurousSea }); } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); + } + public override void AI() { - NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; - float targetDist = (Main.player[NPC.target].Center - NPC.Center).Length(); - targetDist *= 0.0025f; - if ((double)targetDist > 1.5) + float detectRange = Main.player[NPC.target].Calamity().GetAbyssAggro(120f); + + if (NPC.wet) { - targetDist = 1.5f; - } - float maxVelocity; - if (Main.expertMode) - { - maxVelocity = 2.5f - targetDist; + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 0, detectRange, 0.15f, 0.1f, 6f, 4f, 0.1f, false); } else { - maxVelocity = 2.25f - targetDist; - } - maxVelocity *= (CalamityWorld.death ? 1.2f : CalamityWorld.revenge ? 1f : 0.8f); - if (NPC.velocity.X < -maxVelocity || NPC.velocity.X > maxVelocity) - { - if (NPC.velocity.Y == 0f) + NPC.noGravity = false; + + if (NPC.justHit || (!Main.player[NPC.target].dead && (Main.player[NPC.target].Center - NPC.Center).Length() < detectRange && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height))) + NPC.chaseable = true; + + float deceleration = 0.8f; + + if (NPC.chaseable && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && !Main.player[NPC.target].dead) { - NPC.velocity *= 0.8f; + NPC.TargetClosest(); + + NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; + + float distanceFromTarget = MathHelper.Clamp((Main.player[NPC.target].Center - NPC.Center).Length() * 0.0025f, 0f, 1.5f); + float velocityMultiplier = CalamityWorld.death ? 1.2f : CalamityWorld.revenge ? 1f : 0.8f; + float maxVelocity = ((Main.expertMode ? 2.5f : 2.25f) - distanceFromTarget) * velocityMultiplier; + float accelerationX = CalamityWorld.death ? 0.7f : CalamityWorld.revenge ? 0.6f : 0.5f; + + if (NPC.velocity.X < -maxVelocity || NPC.velocity.X > maxVelocity) + { + if (NPC.velocity.Y == 0f) + NPC.velocity *= deceleration; + } + else if (NPC.velocity.X < maxVelocity && NPC.direction == 1) + { + NPC.velocity.X += accelerationX; + if (NPC.velocity.X > maxVelocity) + NPC.velocity.X = maxVelocity; + } + else if (NPC.velocity.X > -maxVelocity && NPC.direction == -1) + { + NPC.velocity.X -= accelerationX; + if (NPC.velocity.X < -maxVelocity) + NPC.velocity.X = -maxVelocity; + } } - } - else if (NPC.velocity.X < maxVelocity && NPC.direction == 1) - { - NPC.velocity.X = NPC.velocity.X + 1f; - if (NPC.velocity.X > maxVelocity) + else { - NPC.velocity.X = maxVelocity; - } - } - else if (NPC.velocity.X > -maxVelocity && NPC.direction == -1) - { - NPC.velocity.X = NPC.velocity.X - 1f; - if (NPC.velocity.X < -maxVelocity) - { - NPC.velocity.X = -maxVelocity; + NPC.TargetClosest(false); + + if (NPC.velocity != Vector2.Zero) + { + NPC.velocity *= deceleration; + if (NPC.velocity.Length() < 0.1f) + NPC.velocity = Vector2.Zero; + } } } } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) + return NPC.chaseable; + + return null; + } + public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + if (NPC.velocity == Vector2.Zero) + { + NPC.frame.Y = 0; + return; + } + + NPC.frameCounter += NPC.chaseable ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -118,31 +164,31 @@ namespace CalamityMod.NPCs.SulphurousSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.PlayerSafe) - { return 0f; - } - if (spawnInfo.Player.Calamity().ZoneSulphur) - { + + if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water) return 0.2f; - } + return 0f; } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.AddIf(() => Main.hardMode, ItemID.TurtleShell, 10); + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 5); + npcLoot.AddIf(() => Main.hardMode, ItemID.TurtleShell, 10); + } 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) { for (int k = 0; k < 15; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) + + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Gnasher").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Gnasher2").Type, 1f); diff --git a/NPCs/SulphurousSea/Sulflounder.cs b/NPCs/SulphurousSea/Sulflounder.cs index 6a2ccd8613..fcf3f4e3d8 100644 --- a/NPCs/SulphurousSea/Sulflounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -15,8 +15,8 @@ namespace CalamityMod.NPCs.SulphurousSea { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; + Main.npcFrameCount[Type] = 4; + NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 10f; value.PortraitPositionYOverride = -36f; @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 42; NPC.height = 32; NPC.defense = 15; - NPC.lifeMax = 40; + NPC.lifeMax = 50; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 0, 80); @@ -133,7 +133,7 @@ namespace CalamityMod.NPCs.SulphurousSea else { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -166,7 +166,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Sulflounder").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Sulflounder2").Type, 1f); diff --git a/NPCs/SulphurousSea/Toxicatfish.cs b/NPCs/SulphurousSea/Toxicatfish.cs index 675f63a5cb..70e1136ec5 100644 --- a/NPCs/SulphurousSea/Toxicatfish.cs +++ b/NPCs/SulphurousSea/Toxicatfish.cs @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.SulphurousSea { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 98; NPC.height = 40; NPC.defense = 12; - NPC.lifeMax = 120; + NPC.lifeMax = 150; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 1, 0); @@ -89,7 +89,7 @@ namespace CalamityMod.NPCs.SulphurousSea return; } NPC.frameCounter += NPC.chaseable ? 0.15f : 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Toxicatfish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Toxicatfish2").Type, 1f); diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index dd1c4000d4..eb6d2b20c1 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; + Main.npcFrameCount[Type] = 8; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1, @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 150; NPC.height = 40; NPC.defense = 22; - NPC.lifeMax = 200; + NPC.lifeMax = 250; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 3, 0); @@ -346,7 +346,7 @@ namespace CalamityMod.NPCs.SulphurousSea } if (spawnInfo.Player.Calamity().ZoneSulphur || (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water)) { - return 0.1f; + return 0.05f; } return 0f; } @@ -382,7 +382,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Trasher").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Trasher2").Type, 1f); diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.cs b/NPCs/SunkenSea/AlphaSeaMinnow.cs new file mode 100644 index 0000000000..58d3a2aeff --- /dev/null +++ b/NPCs/SunkenSea/AlphaSeaMinnow.cs @@ -0,0 +1,239 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Critters; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.DataStructures; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class AlphaSeaMinnow : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 8; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; + } + + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 40; + NPC.height = 32; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.catchItem = (short)ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AlphaSeaMinnow") + }); + } + + public override void OnSpawn(IEntitySource source) + { + // Alphas released by the player do not spawn a shoal of minnows + if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) + { + return; + } + // Spawn a shoal of minnows + int fishCount = Main.rand.Next(5, 10); + for (int i = 0; i < fishCount; i++) + { + int goldchance = NPC.type == ModContent.NPCType() ? 20 : 50; + int minnowtype = Main.rand.NextBool(goldchance) ? ModContent.NPCType() : ModContent.NPCType(); + int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, minnowtype); + Main.npc[n].ai[2] = NPC.whoAmI; // makes the spawned minnow recognize this one as the alpha + } + } + + public override void AI() + { + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 2, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + NPC.noGravity = true; + if (NPC.direction == 0) + { + NPC.TargetClosest(true); + } + if (NPC.wet) + { + NPC.TargetClosest(false); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) + { + NPC.velocity.X = NPC.velocity.X * 0.95f; + } + if (NPC.ai[0] == -1f) + { + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) + { + NPC.ai[0] = 1f; + } + } + else + { + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) + { + 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 ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) + { + NPC.velocity.Y = NPC.velocity.Y * 0.95f; + } + } + else + { + if (NPC.velocity.Y == 0f) + { + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) + { + NPC.velocity.X = 0f; + } + } + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 10f) + { + NPC.velocity.Y = 10f; + } + NPC.ai[0] = 1f; + } + NPC.rotation = NPC.velocity.X * 0.05f; + if ((double)NPC.rotation < -0.1) + { + NPC.rotation = -0.1f; + } + if ((double)NPC.rotation > 0.1) + { + NPC.rotation = 0.1f; + } + if (NPC.type == ModContent.NPCType()) + { + NPC.ProduceGoldCritterDust(); + } + } + + public override void ModifyTypeName(ref string typeName) + { + // Holy mackerel is that an Ultrakill reference!?!? + // (I have barely played the game as of writing this _ YuH) + if (Main.zenithWorld) + { + typeName = CalamityUtils.GetTextValue("NPCs.MinnowPrime"); + } + } + + public override void FindFrame(int frameHeight) + { + if (!NPC.wet && !NPC.IsABestiaryIconDummy) + { + NPC.frameCounter = 0.0; + return; + } + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[Type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + 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); + } + } + } + public class AlphaSeaMinnowGold : AlphaSeaMinnow + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 8; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; + this.HideFromBestiary(); + } + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 40; + NPC.height = 32; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + NPC.rarity = 3; + NPC.catchItem = ModContent.ItemType(); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.03f; + } + return 0f; + } + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); + } + } + } +} diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.png b/NPCs/SunkenSea/AlphaSeaMinnow.png new file mode 100644 index 0000000000..46d9558e2f Binary files /dev/null and b/NPCs/SunkenSea/AlphaSeaMinnow.png differ diff --git a/NPCs/SunkenSea/AlphaSeaMinnowGold.png b/NPCs/SunkenSea/AlphaSeaMinnowGold.png new file mode 100644 index 0000000000..97bcba564f Binary files /dev/null and b/NPCs/SunkenSea/AlphaSeaMinnowGold.png differ diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 812fa36cc2..bfa05e9ab3 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -1,34 +1,59 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.BiomeManagers; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Critters; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Summon; 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.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.SunkenSea { public class BabyGhostBell : ModNPC { public bool hasBeenHit = false; + public static Texture2D RadiantTexture; + public static Texture2D VoltaicTexture; + public static Texture2D RedTexture; + public static Texture2D GreenTexture; + public static Texture2D GoldTexture; + public ref float Variant => ref NPC.ai[1]; + public enum JellyColor + { + Blue = 0, + Green = 1, + Red = 2, + Radiant = 3, + Voltaic = 4, + Gold = 5 + } 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); + RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellRadiant", AssetRequestMode.ImmediateLoad).Value; + VoltaicTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellVoltaic", AssetRequestMode.ImmediateLoad).Value; + GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGreen", AssetRequestMode.ImmediateLoad).Value; + RedTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellRed", AssetRequestMode.ImmediateLoad).Value; + GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGold", AssetRequestMode.ImmediateLoad).Value; } + Main.npcFrameCount[Type] = 6; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; } public override void SetDefaults() @@ -73,6 +98,58 @@ namespace CalamityMod.NPCs.SunkenSea hasBeenHit = reader.ReadBoolean(); } + public override void OnSpawn(IEntitySource source) + { + // Bells released by the player do not randomize when spawned + if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) + { + return; + } + Variant = Main.rand.Next(1, 4); + if (Main.rand.NextBool(30)) + { + Variant = (int)JellyColor.Radiant; + } + if (Main.rand.NextBool(15)) + { + Variant = (int)JellyColor.Voltaic; + } + if (Main.rand.NextBool(50)) + { + Variant = (int)JellyColor.Gold; + } + switch (Variant) + { + case (int)JellyColor.Blue: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)JellyColor.Green: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)JellyColor.Red: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)JellyColor.Radiant: + { + NPC.catchItem = ModContent.ItemType(); + NPC.rarity = 3; + } + break; + case (int)JellyColor.Gold: + { + NPC.catchItem = ModContent.ItemType(); + NPC.rarity = 3; + } + break; + case (int)JellyColor.Voltaic: + { + NPC.catchItem = ModContent.ItemType(); + NPC.rarity = 3; + } + break; + } + } + public override void AI() { if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) @@ -96,22 +173,63 @@ namespace CalamityMod.NPCs.SunkenSea Main.dust[dust].scale *= 0.5f; } } - Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1f / 255f, (255 - NPC.alpha) * 1f / 255f); + // Quick lil hops in random directions for movement if (NPC.wet) { - NPC.noGravity = true; - if (NPC.velocity.Y < 0f) + NPC.height = (int)(36 * NPC.scale); + if (NPC.velocity.Length() < 1f) { - NPC.velocity.Y += 0.1f; - } - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = 0f; + NPC.velocity = Main.rand.NextVector2CircularEdge(8, 8); } + NPC.velocity *= 0.95f; + NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.velocity.ToRotation() + MathHelper.PiOver2, 0.5f); } else { - NPC.noGravity = false; + // Height is changed so that the jelly looks like it's actually laying on the ground when rotated + NPC.height = (int)(24 * NPC.scale); + // Gravy + if (NPC.velocity.Y < 10) + { + NPC.velocity.Y += 0.5f; + } + // Once it has hit the ground, fall over + if (Math.Abs(NPC.velocity.Y) < 1 && NPC.collideY) + { + // Splat + if (NPC.ai[2] == 0) + { + SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, NPC.Center); + NPC.ai[2] = 1; + } + NPC.rotation = MathHelper.Lerp(NPC.rotation, MathHelper.PiOver2, 0.7f); + } + // Reset the splat sound + else + { + NPC.ai[2] = 0; + } + } + // Lite + Color lightColor = Color.LightBlue; // Voltaic uses the same light blue + switch (Variant) + { + case (int)JellyColor.Red: + lightColor = Color.Pink; + break; + case (int)JellyColor.Green: + lightColor = Color.LightGreen; + break; + case (int)JellyColor.Radiant: + lightColor = Color.LightBlue * 1.1f; // Radiant glows brighter + break; + } + Lighting.AddLight(NPC.Center, (lightColor.R - NPC.alpha) * 1f / 255f, (lightColor.G - NPC.alpha) * 1f / 255f, (lightColor.B - NPC.alpha) * 1f / 255f); + + if (Variant == (int)JellyColor.Gold) + { + NPC.ProduceGoldCritterDust(); + NPC.rarity = 3; } } @@ -127,7 +245,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -141,36 +259,65 @@ namespace CalamityMod.NPCs.SunkenSea return 0f; } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - 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)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(GlowTexture.Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); - } - public override void HitEffect(NPC.HitInfo hit) { + int dustType = DustID.BlueCrystalShard; + switch (Variant) + { + case (int)JellyColor.Red: + dustType = DustID.RedTorch; + break; + case (int)JellyColor.Green: + dustType = DustID.GemEmerald; + break; + case (int)JellyColor.Gold: + dustType = DustID.GoldCritter; + break; + } for (int k = 0; k < 2; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 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, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); } } } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = TextureAssets.Npc[Type].Value; + switch (Variant) + { + case (int)JellyColor.Red: + texture = RedTexture; + break; + case (int)JellyColor.Green: + texture = GreenTexture; + break; + case (int)JellyColor.Radiant: + texture = RadiantTexture; + break; + case (int)JellyColor.Voltaic: + texture = VoltaicTexture; + break; + case (int)JellyColor.Gold: + texture = GoldTexture; + break; + } + Vector2 origin = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[Type] / 2); + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; + 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); + + return false; + } } } diff --git a/NPCs/SunkenSea/BabyGhostBell.png b/NPCs/SunkenSea/BabyGhostBell.png index ee927c6bed..083f1c0909 100644 Binary files a/NPCs/SunkenSea/BabyGhostBell.png and b/NPCs/SunkenSea/BabyGhostBell.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGlow.png b/NPCs/SunkenSea/BabyGhostBellGlow.png deleted file mode 100644 index ee927c6bed..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellGold.png b/NPCs/SunkenSea/BabyGhostBellGold.png new file mode 100644 index 0000000000..6a1935feff Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellGold.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGreen.png b/NPCs/SunkenSea/BabyGhostBellGreen.png new file mode 100644 index 0000000000..c2d4a7604e Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellGreen.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellRadiant.png b/NPCs/SunkenSea/BabyGhostBellRadiant.png new file mode 100644 index 0000000000..932587a820 Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellRadiant.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellRed.png b/NPCs/SunkenSea/BabyGhostBellRed.png new file mode 100644 index 0000000000..2e4dd1d457 Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellRed.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellVoltaic.png b/NPCs/SunkenSea/BabyGhostBellVoltaic.png new file mode 100644 index 0000000000..f714e78a35 Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellVoltaic.png differ diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs deleted file mode 100644 index d07b9c9fe4..0000000000 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ /dev/null @@ -1,155 +0,0 @@ -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 ReLogic.Content; -using Terraria; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -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() - { - NPC.noGravity = true; - NPC.damage = 150; - NPC.width = 56; - NPC.height = 44; - NPC.defense = 30; - NPC.DR_NERD(0.2f); - NPC.lifeMax = 750; - NPC.aiStyle = -1; - AIType = -1; - NPC.value = Item.buyPrice(0, 0, 40, 0); - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.knockBackResist = 0.1f; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - 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.BlindedAngler") - }); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.chaseable = reader.ReadBoolean(); - } - - 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); - CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 1, 100f, 0.1f, 0.1f, 3f, 3f, 0.1f); - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.15f : 0f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - } - - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - 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)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(GlowTexture.Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) - { - return NPC.chaseable; - } - return null; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.45f; - } - return 0f; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 4); - npcLoot.Add(ModContent.ItemType(), 1, 5, 9); - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - 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, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore1").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore2").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore3").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore4").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/BlindedAngler.png b/NPCs/SunkenSea/BlindedAngler.png deleted file mode 100644 index afdae09734..0000000000 Binary files a/NPCs/SunkenSea/BlindedAngler.png and /dev/null differ diff --git a/NPCs/SunkenSea/BlindedAnglerGlow.png b/NPCs/SunkenSea/BlindedAnglerGlow.png deleted file mode 100644 index c38e496699..0000000000 Binary files a/NPCs/SunkenSea/BlindedAnglerGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index 3ab87b9bfd..de57dfa6b1 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -1,8 +1,8 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Placeables.SunkenSea; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -18,7 +18,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.SunkenSea } NPC.aiStyle = -1; AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 10, 0) : Item.buyPrice(0, 0, 1, 0); + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit4; NPC.knockBackResist = 0.05f; Banner = NPC.type; @@ -228,7 +228,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam2").Type, 1f); diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 285dec213a..48e4ebabed 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 24f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.lifeMax = Main.hardMode ? 500 : 150; NPC.aiStyle = -1; AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath55; NPC.knockBackResist = 0.5f; @@ -176,7 +176,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { NPC.frameCounter += (hasBeenHit || NPC.IsABestiaryIconDummy) ? 0.15f : 0f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -189,9 +189,9 @@ namespace CalamityMod.NPCs.SunkenSea spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -228,7 +228,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore2").Type, 1f); diff --git a/NPCs/SunkenSea/FesteringRemains.cs b/NPCs/SunkenSea/FesteringRemains.cs new file mode 100644 index 0000000000..72137b1c30 --- /dev/null +++ b/NPCs/SunkenSea/FesteringRemains.cs @@ -0,0 +1,183 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Particles; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using System.IO; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class FesteringRemains : ModNPC + { + public List bones = new List(); + public override void SetDefaults() + { + NPC.width = 52; + NPC.height = 36; + NPC.defense = 0; + NPC.lifeMax = 200; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0f; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HauntedChum") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + // Spawn some bones around the remains + if (NPC.localAI[0] == 0) + { + int boneCount = Main.rand.Next(5, 8); + for (int i = 0; i < boneCount; i++) + { + int extraDistX = 120; + int extraDistY = 40; + Vector2 bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); + // If the bone spawns inside a tile, try to make it not spawn in a tile + for (int j = 0; j < 50; j++) + { + Tile tilePos = CalamityUtils.ParanoidTileRetrieval((int)bonePos.X / 16, (int)bonePos.Y / 16); + if (tilePos.HasTile) + { + bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); + } + } + Particle bone = new ChumBone(bonePos, Vector2.Zero, NPC.GetAlpha(Color.White), Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4), Main.rand.NextFloat(0.8f, 1.6f), 4, Main.rand.NextBool(), Main.rand.NextBool()); + GeneralParticleHandler.SpawnParticle(bone); + // Add to a list of bones + bones.Add(bone); + } + NPC.TargetClosest(); + NPC.localAI[0] = 1; + } + + // Enables expert scaling + NPC.damage = 0; + NPC.TargetClosest(); + int aggroRange = 80; + int spawnTime = 60; + Player target = Main.player[NPC.target]; + if (NPC.ai[1] == 0) + { + if (target != null && target.active && target.Distance(NPC.Center) < aggroRange) + { + NPC.ai[0]++; + if (NPC.ai[0] > spawnTime) + { + int head = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y - 48, ModContent.NPCType(), ai3: NPC.whoAmI); + NPC.ai[1] = 1; + NPC.ai[2] = head; + SoundEngine.PlaySound(SoundID.Item4 with { Pitch = -0.8f }, NPC.Center); + Main.npc[head].localAI[0] = -MathHelper.PiOver4; + } + } + else + { + if (NPC.ai[0] > 0) + { + NPC.ai[0]--; + } + } + } + NPC spawnedHead = Main.npc[(int)NPC.ai[2]]; + // If the head has already been spawned but there is no more head (no head?) start a countdown, once the countdown reaches full, the head respawns + if (NPC.ai[1] == 1) + { + if (spawnedHead == null || !spawnedHead.active || spawnedHead.type != ModContent.NPCType()) + { + if (NPC.ai[3] == 180) + { + // Spawn the head and reset ai3 back to 0 + int head = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y - 48, ModContent.NPCType(), ai3: NPC.whoAmI); + NPC.ai[2] = head; + NPC.ai[3] = 0; + SoundEngine.PlaySound(SoundID.Item4 with { Pitch = -0.8f }, NPC.Center); + Main.npc[head].localAI[0] = -MathHelper.PiOver4; + } + NPC.ai[3]++; + } + if (NPC.ai[0] > 0) + { + NPC.ai[0]--; + } + } + // Keep the bones alive + for (int i = 0; i < bones.Count; i++) + { + bones[i].Time = 2; + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.Cavern.Chance * 0.6f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt with { Volume = 0.8f, Pitch = 1.2f }, NPC.position); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + // Spooky glowey aura effect + if (NPC.ai[0] > 0) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color glowColor = Color.Red; + int xOffset = NPC.spriteDirection == 1 ? 16 : 22; + spriteBatch.Draw(bloom, NPC.position - Main.screenPosition + new Vector2(xOffset, 28), null, glowColor * (NPC.ai[0] / 120), 0f, bloom.Size() / 2f, 1f, SpriteEffects.None, 0); + foreach (ChumBone bone in bones) + { + spriteBatch.Draw(bloom, bone.Position - Main.screenPosition, null, glowColor * (NPC.ai[0] / 210), 0f, bloom.Size() / 2f, 0.4f * bone.Scale, SpriteEffects.None, 0); + } + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + return true; + } + } +} diff --git a/NPCs/SunkenSea/FesteringRemains.png b/NPCs/SunkenSea/FesteringRemains.png new file mode 100644 index 0000000000..75b78502a4 Binary files /dev/null and b/NPCs/SunkenSea/FesteringRemains.png differ diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index e0d4eee778..156617ae6c 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 6; if (!Main.dedServ) { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.lifeMax = Main.hardMode ? 400 : 120; NPC.knockBackResist = 0f; NPC.alpha = 100; - NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 20, 0) : Item.buyPrice(0, 0, 2, 0); + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; @@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -151,9 +151,9 @@ namespace CalamityMod.NPCs.SunkenSea spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 6e520e527b..664d6123eb 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -4,9 +4,9 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 12; + Main.npcFrameCount[Type] = 12; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.lifeMax = Main.hardMode ? 7500 : 1250; NPC.aiStyle = -1; AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(0, 8, 0, 0) : Item.buyPrice(0, 1, 0, 0); + NPC.value = Main.hardMode ? Item.buyPrice(0, 5, 0, 0) : Item.buyPrice(0, 1, 0, 0); NPC.HitSound = SoundID.NPCHit4; NPC.knockBackResist = 0f; NPC.rarity = 2; @@ -136,7 +136,7 @@ namespace CalamityMod.NPCs.SunkenSea if (hitAmount == 5) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[NPC.target].dead && Main.player[NPC.target].active) player.AddBuff(ModContent.BuffType(), 2); //CLAM INVASION @@ -276,7 +276,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.noGravity = false; attack = -1; SoundEngine.PlaySound(SlamSound, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int stompDustArea = (int)NPC.position.X - 30; stompDustArea < (int)NPC.position.X + NPC.width + 60; stompDustArea += 30) { @@ -375,27 +375,13 @@ namespace CalamityMod.NPCs.SunkenSea SoundEngine.PlaySound(SoundID.Item67, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - 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++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, NPC.SafeDirectionTo(Main.player[NPC.target].Center) * 5f, projectileShot, damage, 0f, Main.myPlayer); + for (int i = 0; i < 8; 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); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 3f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, projectileShot, damage, 0f, Main.myPlayer); } } attack = -1; @@ -503,7 +489,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GiantClam1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GiantClam2").Type, 1f); @@ -516,20 +502,20 @@ namespace CalamityMod.NPCs.SunkenSea public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = 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; } public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.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)); + Vector2 halfSizeTexture = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)glowmask.Width, (float)(glowmask.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)glowmask.Width, (float)(glowmask.Height / Main.npcFrameCount[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.EntitySpriteDraw(glowmask, vector, NPC.frame, color, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0); @@ -539,9 +525,9 @@ namespace CalamityMod.NPCs.SunkenSea { // Spawn Amidias if he isn't in the world // This doesn't check for Desert Scourge because Giant Clam only spawns post-Desert Scourge - int amidiasNPC = NPC.FindFirstNPC(ModContent.NPCType()); + int amidiasNPC = NPC.FindFirstNPC(ModContent.NPCType()); if (amidiasNPC == -1 && Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); // Mark Giant Clam as dead DownedBossSystem.downedCLAM = true; @@ -574,7 +560,6 @@ namespace CalamityMod.NPCs.SunkenSea // Equipment npcLoot.Add(ModContent.ItemType(), 3); - npcLoot.Add(ModContent.ItemType(), 3); // Trophy npcLoot.Add(ModContent.ItemType(), 10); diff --git a/NPCs/SunkenSea/HauntedChum.cs b/NPCs/SunkenSea/HauntedChum.cs new file mode 100644 index 0000000000..59ef4255be --- /dev/null +++ b/NPCs/SunkenSea/HauntedChum.cs @@ -0,0 +1,314 @@ +using System; +using System.Collections.Generic; +using CalamityMod.BiomeManagers; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class HauntedChum : ModNPC + { + public static Texture2D jawTexture; + public List Segments; + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + if (!Main.dedServ) + { + jawTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/HauntedChumMouth", AssetRequestMode.ImmediateLoad).Value; + } + } + public override void SetDefaults() + { + NPC.width = 36; + NPC.height = 50; + NPC.defense = 5; + NPC.lifeMax = 60; + NPC.damage = 20; + NPC.aiStyle = -1; + NPC.alpha = 255; + AIType = -1; + NPC.HitSound = SoundID.DD2_SkeletonHurt; + NPC.DeathSound = SoundID.DD2_SkeletonDeath; + NPC.noGravity = true; + NPC.noTileCollide = true; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void AI() + { + int aggroRange = 600; + if (NPC.direction == 0) + { + NPC.TargetClosest(); + } + Player target = Main.player[NPC.target]; + NPC body = Main.npc[(int)NPC.ai[3]]; + // Create a chain + if (Segments == null || Segments.Count < 10) + { + Segments = new List(10); + for (int i = 0; i < 10; i++) + { + VerletSimulatedSegment segment = new VerletSimulatedSegment(body.Center + Vector2.UnitY * i * 10); + Segments.Add(segment); + } + + Segments[0].locked = true; + Segments[Segments.Count - 1].locked = true; + } + if (body == null || !body.active || body.type != ModContent.NPCType()) + { + NPC.StrikeInstantKill(); + } + switch (NPC.ai[0]) + { + case 0: + NPC.velocity.Y = -1; + NPC.ai[1]++; + if (NPC.alpha > 0) + { + NPC.alpha -= 25; + } + if (NPC.ai[1] > 30) + { + NPC.ai[0] = 1; + NPC.ai[1] = 0; + } + break; + case 1: + if (target != null && target.active && target.Distance(body.Center) < aggroRange) + { + NPC.ai[0] = 2; + NPC.ai[1] = 0; + NPC.TargetClosest(); + SoundEngine.PlaySound(SoundID.Zombie7, NPC.Center); + } + NPC.TargetClosest(); + NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], -MathHelper.PiOver4, 0.05f); + if (NPC.velocity.Length() < 0.25f) + { + if (NPC.Distance(body.Center) > 320) + { + Vector2 direction = NPC.DirectionTo(body.Center); + direction.SafeNormalize(Vector2.Zero); + NPC.velocity = direction * 4; + } + else + { + Vector2 direction = Main.rand.NextVector2Circular(30, 30); + direction = direction.SafeNormalize(Vector2.Zero); + NPC.velocity = direction * 4; + } + } + // Lose brightness + if (NPC.ai[1] < 30) + { + NPC.localAI[1] = MathHelper.Max(NPC.localAI[1] - 0.01f, 0); + } + NPC.velocity *= 0.98f; + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + break; + case 2: + if (target == null || !target.active || target.Distance(body.Center) >= aggroRange) + { + NPC.ai[0] = 1; + NPC.ai[1] = 0; + } + else + { + NPC.ai[1]++; + float dist = target.Distance(NPC.Center); + if (dist < 32 || NPC.ai[1] > 50) + { + NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], -MathHelper.PiOver4, 0.3f); + } + else + { + NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], 0, 0.1f); + } + // Lose brightness + if (NPC.ai[1] < 30) + { + NPC.localAI[1] = MathHelper.Max(NPC.localAI[1] - 0.02f, 0); + } + // Gain brightness + else if (NPC.ai[1] > 60) + { + NPC.localAI[1] = MathHelper.Min(NPC.localAI[1] + 0.06f, 0.6f); + } + if (NPC.ai[1] > 70) + { + NPC.TargetClosest(); + Vector2 direction = NPC.DirectionTo(target.Center); + direction.SafeNormalize(Vector2.Zero); + NPC.velocity = direction * 7; + SoundEngine.PlaySound(SoundID.DD2_PhantomPhoenixShot with { Pitch = 0.8f, Volume = 0.8f }, NPC.Center); + NPC.ai[1] = 0; + } + else + { + NPC.velocity.X *= 0.99f; + NPC.velocity.Y *= 0.999f; + } + } + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + break; + } + NPC.spriteDirection = NPC.direction; + if (NPC.localAI[1] > 0) + { + Lighting.AddLight(NPC.Center, 1 * NPC.localAI[1], 0, 0); + } + for (int i = 0; i < 2; i++) + { + int dustPos = NPC.spriteDirection == 1 ? -10 : 0; + if (ChildSafety.Disabled) + { + Dust.NewDust(new Vector2(NPC.Center.X + dustPos, NPC.position.Y + NPC.height / 4), 0, NPC.height / 2, DustID.Blood, -NPC.spriteDirection * Main.rand.NextFloat(4f, 5f), Main.rand.NextFloat(-3, 3), Scale: Main.rand.NextFloat(0.6f, 1f)); + } + } + + // Update the chain + Segments[0].oldPosition = Segments[0].position; + Segments[0].position = body.Center + new Vector2(body.spriteDirection * 20, 8); + + Segments[Segments.Count - 1].oldPosition = Segments[Segments.Count - 1].position; + Segments[Segments.Count - 1].position = body.active ? NPC.Center : body.Center; + + Segments = VerletSimulatedSegment.SimpleSimulation(Segments, 10, loops: 1, gravity: 0.3f); + + NPC.ForceNetUpdate(); + } + + internal float WidthFunction(float completionRatio) + { + return MathHelper.Clamp(((float)Math.Cos(completionRatio * 60)) + 2, 1, 2) / 2; + } + + internal Color ColorFunction(float completionRatio) + { + return (int)(completionRatio * 100) % 2 == 0 ? new Color(69, 52, 0) : new Color(); + } + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 3f; + + internal Color BackgroundColorFunction(float completionRatio) + { + return Color.Black; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sandnado, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + // Drop a bone gore for each bone + if (Segments != null && Segments.Count > 0) + { + for (int i = 0; i < Segments.Count; i++) + { + VerletSimulatedSegment v = Segments[i]; + int goreType = i < Segments.Count / 2 ? Mod.Find("ChumBone2").Type : Mod.Find("ChumBone1").Type; + if (!Main.dedServ) + { + Gore.NewGorePerfect(NPC.GetSource_Death(), v.position, new Vector2(Main.rand.NextFloat(-2, 2), -6), goreType); + } + } + } + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChum").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChumMouth").Type, 1f); + } + } + } + + public override bool CheckActive() + { + return !(Main.npc[(int)NPC.ai[3]].active && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + List points = new List(); + if (Segments != null && Segments.Count > 0) + { + for (int i = 0; i < Segments.Count; i++) + { + points.Add(Segments[i].position); + } + } + + PrimitiveRenderer.RenderTrail(points, new(BackgroundWidthFunction, BackgroundColorFunction), 75); + PrimitiveRenderer.RenderTrail(points, new(WidthFunction, ColorFunction), 75); + + NPC body = Main.npc[(int)NPC.ai[3]]; + // Draw a chain of bones + if (body != null && body.active && body.type == ModContent.NPCType()) + { + if (Segments == null || Segments.Count <= 0) + { + return true; + } + for (int i = 0; i < Segments.Count - 1; i++) + { + VerletSimulatedSegment seg = Segments[i]; + float dist = i > 0 ? Vector2.Distance(seg.position, Segments[i - 1].position) : 0; + if (dist <= 2) + dist = 2; + dist += 2; + if (i == Segments.Count - 1) + { + dist = Vector2.Distance(seg.position, body.Center) + 2; + } + float rot = 0f; + if (i > 0) + rot = seg.position.DirectionTo(Segments[i - 1].position).ToRotation(); + SpriteEffects dir = NPC.Center.X > body.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; + Texture2D bone = i < Segments.Count / 2 ? ModContent.Request(ChumBone.Texture2).Value : ModContent.Request("CalamityMod/Particles/ChumBone1").Value; + spriteBatch.Draw(bone, seg.position - Main.screenPosition, null, Lighting.GetColor((int)(seg.position.X / 16), (int)(seg.position.Y / 16)) * NPC.Opacity, rot, bone.Size() / 2, 1f, dir, 0); + } + } + + // Spooky glowey aura effect + if (NPC.ai[0] == 2 && NPC.ai[1] < 50) + { + spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color glowColor = Color.Red; + int xOffset = NPC.spriteDirection == 1 ? 16 : 22; + spriteBatch.Draw(bloom, NPC.position - Main.screenPosition + new Vector2(xOffset, 28), null, glowColor * NPC.localAI[1], 0f, bloom.Size() / 2f, 0.8f, SpriteEffects.None, 0); + spriteBatch.ExitShaderRegion(); + } + + // Draw the chum itself and its jaw, rotated by localai[0] + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 origin = new Vector2(texture.Width / 2, texture.Height / 2); + Vector2 jawOrigin = new Vector2(NPC.spriteDirection == 1 ? jawTexture.Width - 22 : 22, 4); + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(jawTexture, npcOffset + new Vector2(16 * -NPC.spriteDirection, 4), null, NPC.GetAlpha(drawColor), NPC.localAI[0] * NPC.spriteDirection, jawOrigin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, npcOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } + } +} diff --git a/NPCs/SunkenSea/HauntedChum.png b/NPCs/SunkenSea/HauntedChum.png new file mode 100644 index 0000000000..11b9e1f220 Binary files /dev/null and b/NPCs/SunkenSea/HauntedChum.png differ diff --git a/NPCs/SunkenSea/HauntedChumMouth.png b/NPCs/SunkenSea/HauntedChumMouth.png new file mode 100644 index 0000000000..6fa25c049e Binary files /dev/null and b/NPCs/SunkenSea/HauntedChumMouth.png differ diff --git a/NPCs/SunkenSea/Jellyghoul.cs b/NPCs/SunkenSea/Jellyghoul.cs new file mode 100644 index 0000000000..d2dd52a8b2 --- /dev/null +++ b/NPCs/SunkenSea/Jellyghoul.cs @@ -0,0 +1,273 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Walls; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class Jellyghoul : ModNPC + { + public static Color lesserRed = new Color(255, 100, 100); + public static Color startColor = new Color(111, 115, 122); + public static Color endColor = new Color(87, 103, 113); + + // Cycle between two gray colors by default + public Color DefaultColor => Color.Lerp(startColor, endColor, NPC.localAI[1] * 0.25f + MathF.Sin(Main.GlobalTimeWrappedHourly)); + + // Turn red when enraged, otherwise just continue using DefaultColor + public Color FinalColor => NPC.ai[2] > 0 ? Color.Lerp(DefaultColor, lesserRed, NPC.ai[2]) : DefaultColor; + + + public static SoundStyle JellyGhoulScream = SoundID.NPCDeath51 with { Pitch = -1, Volume = 0.2f, MaxInstances = 0 }; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 1; + } + + public override void SetDefaults() + { + NPC.npcSlots = 1f; + NPC.noGravity = true; + NPC.aiStyle = -1; + AIType = -1; + NPC.damage = 0; + NPC.width = 28; + NPC.height = 36; + NPC.defense = 0; + NPC.lifeMax = 1; + NPC.knockBackResist = 0f; + NPC.alpha = 100; + NPC.HitSound = null; // instantly dies + NPC.DeathSound = SoundID.NPCDeath3; + NPC.chaseable = false; + NPC.noTileCollide = true; + // Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Jellyghoul") + }); + } + + public override void OnSpawn(IEntitySource source) + { + NPC.Center -= new Vector2(Main.rand.NextFloat(-16 * 16, 16 * 16), Main.rand.NextFloat(4 * 16, 16 * 16)); + } + public override void AI() + { + // LocalAI controls variance between jellies. Randomize it on spawn to desync them + if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[0] = 1f; + NPC.localAI[1] = Main.rand.NextFloat(0, 4f); + NPC.netUpdate = true; + } + + Lighting.AddLight(NPC.Center, FinalColor.R * 0.002f, FinalColor.G * 0.002f, FinalColor.B * 0.002f); + + NPC.ai[0]++; + // Play a scream randomly with a 5 second cooldown + // Chance decreases with amount of jellies active for sanity + if (NPC.ai[0] > 300 && Main.rand.NextBool(300 * NPC.CountNPCS(Type)) && NPC.ai[1] == 0) + { + SoundEngine.PlaySound(JellyGhoulScream, NPC.Center); + NPC.ai[1] = 1; + } + // While screaming, shake the screen + if (NPC.ai[1] > 0) + { + NPC.ai[1]++; + + float screenShakePower = 2 * Utils.GetLerpValue(500f, 0f, NPC.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + + // After 1 second, stop shaking and set the scream on cooldown + if (NPC.ai[1] > 60) + { + NPC.ai[0] = 0; + NPC.ai[1] = 0; + } + } + // Controls enrage coloring + if (NPC.ai[2] > 0) + { + NPC.ai[2] += 0.01f; + if (NPC.ai[2] > 1f) + { + NPC.ai[2] = 1f; + } + } + if (NPC.ai[2] >= 1) + { + NPC.TargetClosest(false); + NPC.ai[3]++; + if (NPC.ai[3] >= 120 + (NPC.localAI[1] * 10)) + { + int damage = Main.masterMode ? 4 : Main.expertMode ? 6 : 8; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound with { Pitch = 1f }); + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, NPC.SafeDirectionTo(Main.player[NPC.target].Center) * 16, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); + } + NPC.ai[3] = 0; + } + } + if (Main.rand.NextBool(80)) + { + Particle ash = new SquareAshParticle(Main.rand.NextVector2FromRectangle(NPC.getRect()), new Vector2(0, 2), Main.rand.Next(100, 200), Main.rand.NextFloat(0.8f, 1.2f), new Color(50, 50, 50)); + GeneralParticleHandler.SpawnParticle(ash); + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[Type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + Tile tile = Framing.GetTileSafely(spawnInfo.SpawnTileX, spawnInfo.SpawnTileY); + + return !spawnInfo.Player.Calamity().clamity && tile.WallType == ModContent.WallType() ? 0.05f : 0f; + + //fuck this + //if (spawnInfo.Player.Calamity().ZoneSunkenSeaShores && !spawnInfo.Player.Calamity().clamity && tile.WallType == ModContent.WallType()) + //{ + // return 0.05f; + //} + //return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.SpectreStaff, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.SpectreStaff, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); + } + } + } + + public override void OnKill() + { + bool soundPlayed = false; + // Cause nearby ghouls to become angry on death + foreach (NPC n in Main.ActiveNPCs) + { + if (n.life < 0) + continue; + if (n.type != Type) + continue; + if (n.Distance(NPC.Center) > 1000) + continue; + // If the jelly isn't enraged yet, enrage it + if (n.ai[2] == 0) + { + n.ai[2] = 0.01f; + // Play a sound if at least one jelly successfully enraged + if (!soundPlayed) + { + SoundEngine.PlaySound(SoundID.Zombie83 with { Pitch = -0.5f, Volume = 1.6f }, NPC.Center); + soundPlayed = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + return true; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + float afterimageRotationSpeed = 1; + float afterimageDistance = 2; + float rotationMultiplier = 0.15f; + // Make the jelly visually move in circles + Vector2 afterimageOffset = new Vector2((float)Math.Cos(Main.GlobalTimeWrappedHourly * afterimageRotationSpeed) + NPC.localAI[1], (float)Math.Sin(Main.GlobalTimeWrappedHourly * afterimageRotationSpeed) + NPC.localAI[1]) * afterimageDistance; + + // Spooky glowey aura effect + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; + + spriteBatch.Draw(bloom, NPC.Center - Main.screenPosition + afterimageOffset, null, FinalColor * 0.45f, 0f, bloom.Size() / 2f, 0.6f, SpriteEffects.None, 0); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); + + // Rotate back and forth like a bell + float rotation = NPC.rotation + MathF.Sin(Main.GlobalTimeWrappedHourly + NPC.localAI[1]) * rotationMultiplier; + + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + + // Draws transparent clones around itself to look woozy + int cloneAmt = 4; + for (int i = 0; i < cloneAmt; i++) + { + spriteBatch.Draw(texture, npcOffset + afterimageOffset + Vector2.One.RotatedBy((i + 1) * (MathHelper.TwoPi / cloneAmt) + Main.GlobalTimeWrappedHourly + NPC.localAI[1]) * cloneAmt * MathF.Sin(Main.GlobalTimeWrappedHourly + NPC.localAI[1]), NPC.frame, FinalColor * NPC.Opacity * 0.2f, rotation, origin, NPC.scale, spriteEffects, 0f); + } + spriteBatch.Draw(texture, npcOffset + afterimageOffset, NPC.frame, FinalColor * NPC.Opacity, rotation, origin, NPC.scale, spriteEffects, 0f); + + if (!NPC.HasValidTarget) + return false; + + // Telegraph + float shotGate = 30 + (NPC.localAI[1] * 10); + float shotCompletion = (NPC.ai[3] - 90) / shotGate; + + Effect effect = Terraria.Graphics.Effects.Filters.Scene["CalamityMod:SpreadTelegraph"].GetShader().Shader; + effect.Parameters["centerOpacity"].SetValue(MathHelper.Lerp(0, 0.7f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.05f, shotCompletion)); + effect.Parameters["mainOpacity"].SetValue(MathHelper.Lerp(0, 1f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.05f, shotCompletion)); + effect.Parameters["halfSpreadAngle"].SetValue(MathHelper.Lerp(0, MathHelper.PiOver4 * 0.33f, shotCompletion)); + effect.Parameters["edgeColor"].SetValue(Color.DarkRed.ToVector3()); + effect.Parameters["centerColor"].SetValue(Color.Red.ToVector3()); + effect.Parameters["edgeBlendLength"].SetValue(0.07f); + effect.Parameters["edgeBlendStrength"].SetValue(4f); + + Main.spriteBatch.EnterShaderRegion(BlendState.Additive, effect); + + Texture2D invis = ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value; + + Main.EntitySpriteDraw(invis, npcOffset + afterimageOffset, null, Color.White, NPC.DirectionTo(Main.player[NPC.target].Center).ToRotation(), new Vector2(invis.Width / 2f, invis.Height / 2f), 500f, 0, 0); + + Main.spriteBatch.ExitShaderRegion(); + + return false; + } + } +} diff --git a/NPCs/SunkenSea/Jellyghoul.png b/NPCs/SunkenSea/Jellyghoul.png new file mode 100644 index 0000000000..26bfb3154d Binary files /dev/null and b/NPCs/SunkenSea/Jellyghoul.png differ diff --git a/NPCs/SunkenSea/KelpieSeadragon.cs b/NPCs/SunkenSea/KelpieSeadragon.cs new file mode 100644 index 0000000000..8494c30093 --- /dev/null +++ b/NPCs/SunkenSea/KelpieSeadragon.cs @@ -0,0 +1,267 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.World; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +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 Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class KelpieSeadragon : ModNPC + { + public ref float SquishX => ref NPC.localAI[0]; + public ref float SquishY => ref NPC.localAI[1]; + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 13; + } + + public override void SetDefaults() + { + NPC.noGravity = true; + NPC.damage = 10; + NPC.width = 20; + NPC.height = 58; + NPC.defense = 5; + NPC.lifeMax = 150; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.15f; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.KelpieSeadragon") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if (NPC.direction == 0) + { + NPC.TargetClosest(); + } + Player target = Main.player[NPC.target]; + // Fall and be useless if out of water + if (!NPC.wet) + { + NPC.ai[0] = 0; + NPC.ai[1] = 0; + NPC.ai[2] = 0; + NPC.velocity.X *= 0.98f; + NPC.noGravity = false; + NPC.rotation = MathHelper.Lerp(NPC.rotation, MathHelper.PiOver2, 0.1f); + NPC.gfxOffY += 5; + return; + } + NPC.noGravity = true; + switch (NPC.ai[0]) + { + // Idle AI. Mostly sits still but occasionally moves in a random direction for a bit. + case 0: + NPC.chaseable = false; + if (target != null && target.active && target.Distance(NPC.Center) < 400 && Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1)) + { + NPC.ai[0] = 1; + NPC.ai[1] = 0; + NPC.ai[2] = 0; + SquishX = 0.9f; + SquishY = 1.05f; + NPC.TargetClosest(); + } + if (NPC.velocity.Length() < 0.1f) + { + NPC.ai[1]++; + // Randomly switch direction + if (Main.rand.NextBool(120)) + { + NPC.direction *= -1; + } + // Move in a random direction towards the direction the horse is facing + if (NPC.ai[1] > 120 || Main.rand.NextBool(90)) + { + Vector2 direction = new Vector2(NPC.direction * 30, Main.rand.Next(-30, 30)); + direction = direction.SafeNormalize(Vector2.Zero); + NPC.velocity = direction * 2; + NPC.ai[1] = 0; + } + } + // Reset any rotation from aggressive AI + NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); + NPC.velocity *= 0.99f; + break; + case 1: + if (target == null || !target.active || target.Distance(NPC.Center) > 600) + { + NPC.ai[0] = 0; + NPC.ai[1] = 0; + NPC.ai[2] = 0; + SquishX = 0; + SquishY = 0; + } + NPC.chaseable = true; + // If the target is too far from its shooting range or a tile is in the way, move closer + if (target.Distance(NPC.Center) > 300 || !Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1)) + { + NPC.ai[1] = 0; + NPC.ai[2]++; + NPC.velocity = NPC.DirectionTo(target.Center).SafeNormalize(Vector2.Zero) * 3f; + NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.direction * MathHelper.PiOver4 / 2, 0.05f); + // Loose interest if it can't reach the player for a few seconds + if (!Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1) && NPC.ai[2] > 180) + { + NPC.ai[0] = 0; + NPC.ai[1] = 0; + NPC.ai[2] = 0; + SquishX = 0; + SquishY = 0; + } + } + else + { + // Otherwise sit at a distance and fire projectiles + NPC.velocity *= 0.9f; + NPC.ai[1]++; + int fireRate = 30; // Do not change this without adjusting the frame rate as well + float currentTime = NPC.ai[1] % 36; + if (currentTime == fireRate) + { + SoundEngine.PlaySound(Sounds.CommonCalamitySounds.ExoPlasmaShootSound with { Volume = 0.2f, Pitch = 1.8f }, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 spawnPos = new Vector2(NPC.Center.X + NPC.direction * 18, NPC.position.Y + 22); + Vector2 projSpeed = spawnPos.DirectionTo(target.Center).SafeNormalize(Vector2.Zero) * 6; + Projectile.NewProjectile(NPC.GetSource_FromThis(), spawnPos, projSpeed, ModContent.ProjectileType(), NPC.damage, 0f); + } + } + // Squash and stretch + int shotTime = 24; // When to squash + if (currentTime < 24) + { + SquishX = MathHelper.Lerp(SquishX, 0.9f, currentTime / shotTime); + SquishY = MathHelper.Lerp(SquishY, 1.05f, currentTime / shotTime); + } + else + { + SquishX = MathHelper.Lerp(SquishX, 1.35f, (currentTime - shotTime) / (fireRate - shotTime)); + SquishY = MathHelper.Lerp(SquishY, 0.85f, (currentTime - shotTime) / (fireRate - shotTime)); + } + + NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); + } + if (Math.Abs(NPC.velocity.X) > 0) + { + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + } + else + { + NPC.direction = NPC.Center.X > target.Center.X ? -1 : 1; + } + break; + } + NPC.spriteDirection = NPC.direction; + } + + public override void FindFrame(int frameHeight) + { + if (!NPC.wet && !NPC.IsABestiaryIconDummy) + return; + NPC.frameCounter++; + if (NPC.frameCounter > 5) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; + } + // Anger + if (NPC.ai[0] == 1 && NPC.ai[1] > 0) + { + if (NPC.frame.Y > 12 * frameHeight || NPC.frame.Y < frameHeight * 7) + { + NPC.frame.Y = frameHeight * 7; + } + } + // Idle + else + { + if (NPC.frame.Y > 6 * frameHeight) + { + NPC.frame.Y = 0; + } + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + 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 < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Asset tex = TextureAssets.Npc[Type]; + SpriteEffects fx = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 stretch = NPC.ai[0] == 1 && NPC.ai[1] > 0 ? new Vector2(SquishX, SquishY): Vector2.One; + spriteBatch.Draw(tex.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColor, NPC.rotation, new Vector2(tex.Width() / 2, tex.Height() / 2 / Main.npcFrameCount[Type]), NPC.scale * stretch, fx, 0); + return false; + } + } +} diff --git a/NPCs/SunkenSea/KelpieSeadragon.png b/NPCs/SunkenSea/KelpieSeadragon.png new file mode 100644 index 0000000000..c42bfe0083 Binary files /dev/null and b/NPCs/SunkenSea/KelpieSeadragon.png differ diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs new file mode 100644 index 0000000000..71dc4e192a --- /dev/null +++ b/NPCs/SunkenSea/LostShoal.cs @@ -0,0 +1,441 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Critters; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent; +using Terraria.DataStructures; +using CalamityMod.Particles; +using Terraria.ModLoader.Utilities; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class LostShoal : ModNPC + { + public static Texture2D RedTexture; + public static Texture2D BlueTexture; + public static Texture2D GoldTexture; + + public float RandomOpacityOffset; + public ref float Variant => ref NPC.ai[1]; + public ref float Leader => ref NPC.ai[2]; + public ref float Role => ref NPC.ai[3]; + + public enum ShoalColor + { + Red = 0, + Blue = 1, + Green = 2, + Gold = 3 + } + + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 8; + NPCID.Sets.TrailingMode[Type] = 1; + if (!Main.dedServ) + { + RedTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalRed", AssetRequestMode.ImmediateLoad).Value; + BlueTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalBlue", AssetRequestMode.ImmediateLoad).Value; + GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalGold", AssetRequestMode.ImmediateLoad).Value; + } + NPCID.Sets.CountsAsCritter[Type] = true; + } + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 36; + NPC.height = 22; + NPC.defense = 0; + NPC.lifeMax = 1; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = null; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.noTileCollide = true; + NPC.alpha = 120; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.catchItem = ItemID.AshBlock; // yeah this is intentional + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LostShoal") + }); + } + + public override void OnSpawn(IEntitySource source) + { + // Randomize the color of the fish + Variant = Main.rand.Next(0, 3); + if (Main.rand.NextBool(50)) + { + Variant = (int)ShoalColor.Gold; + NPC.catchItem = ItemID.GoldCoin; + } + + RandomOpacityOffset = Main.rand.NextFloat(MathHelper.TwoPi); + NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); + } + + public override void AI() + { + // swim normally if the fish is the leader of the shoal + if (Role != 1) + { + LeaderMovement(); + if (NPC.direction == 0) + { + NPC.direction = Main.rand.NextBool(2) ? 1 : -1; + } + if (Main.rand.NextBool(1200)) + { + NPC.direction *= -1; + } + } + else + { + NPC owner = Main.npc[(int)Leader]; + // if the owner of the shoal isn't a lost shoal or is dead, find a new shoal to attach to + if (!owner.active || owner.type != ModContent.NPCType()) + { + bool anyShoals = false; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC n = Main.npc[k]; + if (!n.active) + continue; + if (owner.type == ModContent.NPCType()) + { + // if a nearby shoal leader is found, go follow it + if (Role != 1 && n.Distance(NPC.position) < 1200) + { + anyShoals = true; + Leader = n.whoAmI; + } + } + } + // if no leaders are found nearby, a new leader is picked + if (!anyShoals) + { + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC n = Main.npc[k]; + if (!n.active) + continue; + if (owner.type == ModContent.NPCType()) + { + if (n.Distance(NPC.position) < 1200) + { + // the found fish becomes the new leader, and this fish becomes a member of its school + n.ai[3] = 2; + Leader = n.whoAmI; + } + } + } + } + } + NPC.velocity = owner.velocity; + NPC.direction = owner.direction; + NPC.spriteDirection = owner.spriteDirection; + // gather behind the leader + // basically a pet + // if we want to make the fish scared of players or other predators, then set enemyClose to true. For now this is commented out. + //NPC.TargetClosest(false); + //bool enemyClose = Main.player[NPC.target] != null && Main.player[NPC.target].active && Main.player[NPC.target].Distance(NPC.position) < 128; + bool enemyClose = false; + float SAImovement = enemyClose ? 0.02f : 0.1f; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC otherFish = Main.npc[k]; + // Short circuits to make the loop as fast as possible + if (!otherFish.active || k == NPC.whoAmI || owner.type != ModContent.NPCType()) + continue; + + float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); + if (taxicabDist < NPC.width) + { + if (NPC.position.X < otherFish.position.X) + NPC.velocity.X -= SAImovement; + else + NPC.velocity.X += SAImovement; + + if (NPC.position.Y < otherFish.position.Y) + NPC.velocity.Y -= SAImovement; + else + NPC.velocity.Y += SAImovement; + } + } + } + NPC.noGravity = true; + // leaders will naturally spawn a school of followers upon spawning + if (Role == 0) + { + // the amount of fish to spawn + int fishCount = 5; + for (int i = 0; i < fishCount; i++) + { + int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); + Main.npc[n].ai[3] = 1; // the 1 means that the spawned fish will not be a leader, and will not spawn even more fish + Main.npc[n].ai[2] = NPC.whoAmI; // marks this fish as the owner of the spawned fish + } + Role = 2; // don't spawn any more fish + } + // leaders are a tiny bit more brighter + float intensity = Role == 1 ? 0.002f : 0.004f; + Color glowColor = new(0.983f, 1f, 0.78f); + switch (Variant) + { + case (int)ShoalColor.Blue: + glowColor = new(0.78f, 0.77f, 0.988f); + break; + case (int)ShoalColor.Red: + glowColor = new(1f, 0.83f, 0.819f); + break; + case (int)ShoalColor.Gold: + glowColor = new(1f, 1f, 0.678f); + break; + } + Lighting.AddLight(NPC.Center, glowColor.R * intensity, glowColor.G * intensity, glowColor.B * intensity); + // Formerly, sprinkle down ash particles + // Now they trail glowing dust as they move + // Keeping it as reference in case i want to use it somewhere else (i will) + if (Main.rand.NextBool(120)) + { + //Color ashColor = new(40, 48, 41); + int dustid = DustID.CoralTorch; + switch (Variant) + { + case (int)ShoalColor.Blue: + //ashColor = new(44, 63, 66); + dustid = DustID.BoneTorch; + break; + case (int)ShoalColor.Red: + //ashColor = new(79, 41, 42); + dustid = DustID.CrimsonTorch; + break; + case (int)ShoalColor.Gold: + //ashColor = Color.Yellow; + dustid = DustID.IchorTorch; + break; + } + //Particle ash = new SquareAshParticle(NPC.Center, new Vector2(0, 4), 150, Main.rand.NextFloat(0.85f, 1f), ashColor); + //GeneralParticleHandler.SpawnParticle(ash); + + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, dustid, Scale: 1.5f); + dust.velocity = Vector2.Zero; + } + if (Variant == (int)ShoalColor.Gold) + { + NPC.ProduceGoldCritterDust(); + } + } + + public void LeaderMovement() + { + // This is just usual swimmer ai with some modifications + NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; + + NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.06f; + NPC.noGravity = true; + 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 (NPC.Calamity().newAI[0] <= 0 && NPC.Distance(Main.player[NPC.target].Center) > (45 * 16)) + { + //NPC.velocity.X *= -1; + NPC.direction *= -1; + NPC.Calamity().newAI[0] = 300; + } + NPC.Calamity().newAI[0] -= 1; + // No target behavior + NPC.velocity.X += (float)NPC.direction * 0.02f; + if (NPC.velocity.X < -1.5f || NPC.velocity.X > 1.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; + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += 0.2f; + NPC.frameCounter %= Main.npcFrameCount[Type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Player.Calamity().clamity && !NPC.AnyNPCs(Type)) + { + return 0.125f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + int goreType = Main.rand.Next(11, 14); + Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-10, 11) * 0.2f, Main.rand.Next(-10, 11) * 0.2f), goreType, 0.2f); + } + } + + public override void OnCaughtBy(Player player, Item item, bool failed) + { + // Gold shoals drop Gold Coins instead of ash when caught + // The shoal drops 1 coin by default while the extra coins are spawned here in a spread + if (!failed) + { + if (Variant == (int)ShoalColor.Gold) + { + for (int i = 0; i < Main.rand.Next(0, 5); i++) + { + Item.NewItem(NPC.GetSource_CatchEntity(NPC), NPC.getRect(), ItemID.GoldCoin); + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + // Spooky glowey aura effect + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; + Color glowColor = Color.SeaGreen; + switch (Variant) + { + case (int)ShoalColor.Blue: + glowColor = Color.Cyan; + break; + case (int)ShoalColor.Red: + glowColor = Color.Pink; + break; + case (int)ShoalColor.Gold: + glowColor = Color.Yellow; + break; + } + + spriteBatch.Draw(bloom, NPC.Center - Main.screenPosition, null, glowColor * 0.45f, 0f, bloom.Size() / 2f, 0.3f, SpriteEffects.None, 0); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + // Regular stuff for drawing the actual fish and its afterimages + Texture2D texture = TextureAssets.Npc[Type].Value; + switch (Variant) + { + case (int)ShoalColor.Blue: + texture = BlueTexture; + break; + case (int)ShoalColor.Red: + texture = RedTexture; + break; + case (int)ShoalColor.Gold: + texture = GoldTexture; + break; + } + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); + Color white = Color.White; + float colorLerpAmt = 0.5f; + int afterimageAmt = 7; + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 1; i < afterimageAmt; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, white, colorLerpAmt); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; + offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, offset, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + } + } + + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 3f + RandomOpacityOffset) / 2f + 0.5f; + + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, npcOffset, NPC.frame, drawColor * MathHelper.Lerp(0.4f, 0.8f, sine), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } + } +} diff --git a/NPCs/SunkenSea/LostShoal.png b/NPCs/SunkenSea/LostShoal.png new file mode 100644 index 0000000000..00bfd5303b Binary files /dev/null and b/NPCs/SunkenSea/LostShoal.png differ diff --git a/NPCs/SunkenSea/LostShoalBlue.png b/NPCs/SunkenSea/LostShoalBlue.png new file mode 100644 index 0000000000..8d9eaecff9 Binary files /dev/null and b/NPCs/SunkenSea/LostShoalBlue.png differ diff --git a/NPCs/SunkenSea/LostShoalGold.png b/NPCs/SunkenSea/LostShoalGold.png new file mode 100644 index 0000000000..e868c21047 Binary files /dev/null and b/NPCs/SunkenSea/LostShoalGold.png differ diff --git a/NPCs/SunkenSea/LostShoalRed.png b/NPCs/SunkenSea/LostShoalRed.png new file mode 100644 index 0000000000..9a759540c3 Binary files /dev/null and b/NPCs/SunkenSea/LostShoalRed.png differ diff --git a/NPCs/SunkenSea/Pearlpod.cs b/NPCs/SunkenSea/Pearlpod.cs new file mode 100644 index 0000000000..e69ffade75 --- /dev/null +++ b/NPCs/SunkenSea/Pearlpod.cs @@ -0,0 +1,227 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Critters; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.GameContent.Bestiary; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.Audio; + +namespace CalamityMod.NPCs.SunkenSea +{ + public abstract class Pearlpod : ModNPC + { + public abstract int PearlType { get; } + public abstract float SpawnRate { get; } + public abstract int ItemType { get; } + + public override void SetDefaults() + { + NPC.aiStyle = NPCAIStyleID.Snail; + NPC.damage = 0; + NPC.width = 24; + NPC.height = 24; + NPC.defense = 0; + NPC.lifeMax = 20; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit38; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.GravityIgnoresLiquid = true; + AIType = NPCID.Snail; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.catchItem = ItemType; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + for (int i = 0; i < 2; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < 2; i++) + writer.Write(NPC.Calamity().newAI[i]); + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Pearlpod") + }); + } + + public override void AI() + { + Tile vine = Main.tile[(int)NPC.position.X / 16, (int)NPC.position.Y / 16]; + // Set newAI[0] to 1 if the Pearlpod is inside of a vine + if (vine.TileType == ModContent.TileType() && !NPC.justHit) + { + NPC.Calamity().newAI[0] = 1; + } + // Otherwise reset eating-related variables + else + { + NPC.Calamity().newAI[1] = 0; + NPC.Calamity().newAI[0] = 0; + } + // Eating behavior + if (NPC.Calamity().newAI[0] == 1) + { + NPC.velocity.X *= 0.1f; + // Play a crunch sound and spawn some grass dust randomly + if (Main.rand.NextBool(20)) + { + SoundEngine.PlaySound(SoundID.Item2 with { Volume = 0.4f, Pitch = 1.2f }, NPC.Center); + for (int i = 0; i < 4; i++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1), 40); + } + NPC.Calamity().newAI[1]++; + } + // After munching 10 times, the vine is broken and the Pearlpod continues about its day + if (NPC.Calamity().newAI[1] == 10) + { + if (vine.TileType == ModContent.TileType()) + { + WorldGen.KillTile((int)NPC.position.X / 16, (int)NPC.position.Y / 16); + } + } + } + if (NPC.type == ModContent.NPCType()) + { + NPC.ProduceGoldCritterDust(); + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter++; + if (NPC.frameCounter > 8) + { + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y > frameHeight * 5) + { + NPC.frame.Y = 0; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneGleamingBurrows && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * SpawnRate; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(PearlType); + } + } + + public class PearlpodWhite : Pearlpod + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 6; + } + public override int PearlType => ItemID.WhitePearl; + public override float SpawnRate => 0.6f; + public override int ItemType => ModContent.ItemType(); + } + public class PearlpodPink : Pearlpod + { + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + Main.npcFrameCount[Type] = 6; + } + + public override int PearlType => ItemID.PinkPearl; + public override float SpawnRate => 0.2f; + public override int ItemType => ModContent.ItemType(); + } + public class PearlpodBlack : Pearlpod + { + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + Main.npcFrameCount[Type] = 6; + } + public override int PearlType => ItemID.BlackPearl; + public override float SpawnRate => 0.05f; + public override int ItemType => ModContent.ItemType(); + } + public class PearlpodGold : Pearlpod + { + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + Main.npcFrameCount[Type] = 6; + } + public override void SetDefaults() + { + NPC.aiStyle = NPCAIStyleID.Snail; + NPC.damage = 0; + NPC.width = 24; + NPC.height = 24; + NPC.defense = 0; + NPC.lifeMax = 20; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit38; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.GravityIgnoresLiquid = true; + AIType = NPCID.Snail; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.catchItem = ItemType; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + NPC.rarity = 3; + } + public override int PearlType => ItemID.GoldCoin; + public override float SpawnRate => 0.0005f; + public override int ItemType => ModContent.ItemType(); + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); + } + } + } +} diff --git a/NPCs/SunkenSea/PearlpodBlack.png b/NPCs/SunkenSea/PearlpodBlack.png new file mode 100644 index 0000000000..d5712b33f6 Binary files /dev/null and b/NPCs/SunkenSea/PearlpodBlack.png differ diff --git a/NPCs/SunkenSea/PearlpodGold.png b/NPCs/SunkenSea/PearlpodGold.png new file mode 100644 index 0000000000..e6e92061d2 Binary files /dev/null and b/NPCs/SunkenSea/PearlpodGold.png differ diff --git a/NPCs/SunkenSea/PearlpodPink.png b/NPCs/SunkenSea/PearlpodPink.png new file mode 100644 index 0000000000..3c54290643 Binary files /dev/null and b/NPCs/SunkenSea/PearlpodPink.png differ diff --git a/NPCs/SunkenSea/PearlpodWhite.png b/NPCs/SunkenSea/PearlpodWhite.png new file mode 100644 index 0000000000..97ccc73385 Binary files /dev/null and b/NPCs/SunkenSea/PearlpodWhite.png differ diff --git a/NPCs/SunkenSea/PolypPanasea.cs b/NPCs/SunkenSea/PolypPanasea.cs new file mode 100644 index 0000000000..fb5c240400 --- /dev/null +++ b/NPCs/SunkenSea/PolypPanasea.cs @@ -0,0 +1,238 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Critters; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class PolypPanasea : ModNPC + { + #region Textures + // Welcome to the fish texture wall, have a nice stay, or just collapse this region, either works + public static Texture2D RadiantTexture; + public static Texture2D GreenTexture; + public static Texture2D PurpleTexture; + public static Texture2D TurquoiseTexture; + public static Texture2D GoldTexture; + public static Texture2D TextureCoated; + public static Texture2D RadiantTextureCoated; + public static Texture2D GreenTextureCoated; + public static Texture2D PurpleTextureCoated; + public static Texture2D TurquoiseTextureCoated; + public static Texture2D GoldTextureCoated; + #endregion + public ref float Variant => ref NPC.ai[1]; + public enum FishColor + { + Red = 0, + Turquoise = 1, + Green = 2, + Purple = 3, + Gold = 4, + Radiant = 5 + } + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 6; + if (!Main.dedServ) + { + RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiant", AssetRequestMode.ImmediateLoad).Value; + GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGold", AssetRequestMode.ImmediateLoad).Value; + GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreen", AssetRequestMode.ImmediateLoad).Value; + PurpleTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurple", AssetRequestMode.ImmediateLoad).Value; + TurquoiseTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaTurquoise", AssetRequestMode.ImmediateLoad).Value; + TextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRedCoated", AssetRequestMode.ImmediateLoad).Value; + RadiantTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiantCoated", AssetRequestMode.ImmediateLoad).Value; + GoldTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGoldCoated", AssetRequestMode.ImmediateLoad).Value; + GreenTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreenCoated", AssetRequestMode.ImmediateLoad).Value; + PurpleTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurpleCoated", AssetRequestMode.ImmediateLoad).Value; + TurquoiseTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated", AssetRequestMode.ImmediateLoad).Value; + } + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; + } + + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 36; + NPC.height = 22; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.catchItem = (short)ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void OnSpawn(IEntitySource source) + { + // Panaseas released by the player do not randomize when spawned + if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) + { + return; + } + // Randomize the color of the fish + NPC.ai[1] = Main.rand.Next(0, 4); + // 1 in 30 chance for a rare fish variant (rfv) + if (Main.rand.NextBool(30)) + { + NPC.ai[1] = Main.rand.Next(4, 6); + } + // 1 in 5 chance for a Panasea to be coated + if (Main.rand.NextBool(5)) + { + NPC.ai[2] = 61; + } + switch (NPC.ai[1]) + { + case (int)FishColor.Purple: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Green: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Turquoise: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Gold: + { + NPC.catchItem = ModContent.ItemType(); + NPC.rarity = 3; + } + break; + case (int)FishColor.Radiant: + NPC.catchItem = ModContent.ItemType(); + break; + } + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PolypPanasea") + }); + } + + public override void AI() + { + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 3, 60f, 0.2f, 0.1f, 4f, 4f, 0.05f); + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + // Assure it cant be caught when collecting panacea + if (NPC.ai[2] <= 60 && NPC.ai[2] > 0) + { + NPC.ai[2]--; + } + if (Variant == (int)FishColor.Gold) + { + NPC.ProduceGoldCritterDust(); + NPC.rarity = 3; + } + } + + public override void FindFrame(int frameHeight) + { + if (!NPC.wet && !NPC.IsABestiaryIconDummy) + { + NPC.frameCounter = 0.0; + return; + } + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[Type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + NPC.ai[3] = frame; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = TextureAssets.Npc[Type].Value; + switch (Variant) + { + case (int)FishColor.Radiant: + texture = NPC.ai[2] >= 61 ? RadiantTextureCoated : RadiantTexture; + break; + case (int)FishColor.Gold: + texture = NPC.ai[2] >= 61 ? GoldTextureCoated : GoldTexture; + break; + case (int)FishColor.Purple: + texture = NPC.ai[2] >= 61 ? PurpleTextureCoated : PurpleTexture; + break; + case (int)FishColor.Green: + texture = NPC.ai[2] >= 61 ? GreenTextureCoated : GreenTexture; + break; + case (int)FishColor.Turquoise: + texture = NPC.ai[2] >= 61 ? TurquoiseTextureCoated : TurquoiseTexture; + break; + case (int)FishColor.Red: + texture = NPC.ai[2] >= 61 ? TextureCoated : TextureAssets.Npc[Type].Value; + break; + } + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Rectangle frame = texture.Frame(1, 6, 0, (int)NPC.ai[3]); + spriteBatch.Draw(texture, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } + public override bool? CanBeCaughtBy(Item item, Player player) + { + if (NPC.ai[2] > 0) + { + if (NPC.ai[2] > 60) + { + Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, ItemID.FlaskofPoison); + NPC.ai[2] = 60; + } + return false; + } + return null; + } + } +} diff --git a/NPCs/SunkenSea/PolypPanasea.png b/NPCs/SunkenSea/PolypPanasea.png new file mode 100644 index 0000000000..08ba323d31 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanasea.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaGold.png b/NPCs/SunkenSea/PolypPanaseaGold.png new file mode 100644 index 0000000000..a48da65906 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaGold.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaGoldCoated.png b/NPCs/SunkenSea/PolypPanaseaGoldCoated.png new file mode 100644 index 0000000000..47dddda974 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaGoldCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaGreen.png b/NPCs/SunkenSea/PolypPanaseaGreen.png new file mode 100644 index 0000000000..7bd323fb82 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaGreen.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaGreenCoated.png b/NPCs/SunkenSea/PolypPanaseaGreenCoated.png new file mode 100644 index 0000000000..1f46bf5148 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaGreenCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaPurple.png b/NPCs/SunkenSea/PolypPanaseaPurple.png new file mode 100644 index 0000000000..3871e4e412 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaPurple.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png b/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png new file mode 100644 index 0000000000..6d9f423150 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaRadiant.png b/NPCs/SunkenSea/PolypPanaseaRadiant.png new file mode 100644 index 0000000000..2099da1dfb Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaRadiant.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png b/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png new file mode 100644 index 0000000000..74c021ef11 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaRedCoated.png b/NPCs/SunkenSea/PolypPanaseaRedCoated.png new file mode 100644 index 0000000000..bfbf7ba316 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaRedCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaTurquoise.png b/NPCs/SunkenSea/PolypPanaseaTurquoise.png new file mode 100644 index 0000000000..e45b512f09 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaTurquoise.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png b/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png new file mode 100644 index 0000000000..3d4c9475f8 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png differ diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index 037b2c6d94..1c73fd7386 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -1,6 +1,5 @@ using System.IO; using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; @@ -15,6 +14,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using ReLogic.Content; +using CalamityMod.Items.Placeables.SunkenSea; namespace CalamityMod.NPCs.SunkenSea { @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.lifeMax = Main.hardMode ? 1000 : 350; NPC.aiStyle = -1; AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 8, 0) : Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit24; NPC.DeathSound = SoundID.NPCDeath27; NPC.knockBackResist = 0.15f; @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.1f : 0f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } @@ -144,9 +144,9 @@ namespace CalamityMod.NPCs.SunkenSea spriteEffects = SpriteEffects.FlipHorizontally; } 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 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[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(GlowTexture.Value, vector, @@ -185,7 +185,7 @@ namespace CalamityMod.NPCs.SunkenSea } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismTurtleGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismTurtleGore2").Type, 1f); diff --git a/NPCs/SunkenSea/Probesnout.cs b/NPCs/SunkenSea/Probesnout.cs new file mode 100644 index 0000000000..e04e5115a0 --- /dev/null +++ b/NPCs/SunkenSea/Probesnout.cs @@ -0,0 +1,468 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Xml.XPath; +using CalamityMod.Enums; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class Probesnout : SunkenSeaNPC + { + #region Members + + public static int IdleRandomMovementUnlikeliness = 250; + public static int IdleMinPathDistance = 200; + public static int IdleMaxPathDistance = 400; + + public static int FleeTileAnticipationDistance = 5 * 16; + public static int FleeMinPathDistance = 80; + public static int FleeMaxPathDistance = 160; + + protected override List PreyIDs => + [ + // NPCType(), + ]; + + protected override List PredatorIDs => + [ + // NPCType(), + NPCType(), + // NPCType(), + // NPCType(), + // NPCType(), + ]; + + private enum AnimationState { Idle, Eating } + + private AnimationState Animation + { + get => (AnimationState)NPC.ai[1]; + set + { + if (value != Animation) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0; + } + + switch (value) + { + case AnimationState.Idle: + AnimationFrames = 8; + TimePerAnimationFrame = 5; + break; + case AnimationState.Eating: + AnimationFrames = 12; + TimePerAnimationFrame = 7; + break; + } + + NPC.ai[1] = (float)value; + } + } + + protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; + + private int AnimationFrames = 8; + + private int TimePerAnimationFrame = 5; + + private Vector2 ScaleSquish = Vector2.One; + + private Action _currentBehavior; + private Action CurrentBehavior + { + get => _currentBehavior; + set + { + _previousBehavior = _currentBehavior; + _currentBehavior = value; + } + } + + private Action _previousBehavior; + + private int HuntCooldown + { + get => (int)NPC.ai[3]; + set => NPC.ai[3] = value; + } + + public Vector2 Position => NPC.Center; + + public Vector2 Velocity { get => NPC.velocity; set => NPC.velocity = value; } + + public float Acceleration => 0.4f; + + public float MaxSpeed => 8f; + + private Vector2 SpongeFoundPosition; + + private bool HasEatenSponge; + + #endregion + + #region AI + + protected override bool PlayerSearchFilter(Player p) + { + return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; + } + + protected override bool NPCSearchFilter(NPC n) + { + return base.NPCSearchFilter(n) || (n == CurrentPrey || n == CurrentPredator) && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; + } + + public override void OnSpawn(IEntitySource source) + { + CurrentBehavior = IdlingBehavior; + NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + NPC.GravityMultiplier *= 2f; + NPC.MaxFallSpeedMultiplier *= 2f; + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.4f, + MaxSpeed = 8f, + MinimumPointDistance = 60f + }; + } + + public override void AI() + { + CurrentBehavior?.Invoke(); + + NPC.rotation = MathHelper.ToRadians(NPC.velocity.X * 3f); + if (CurrentBehavior == EatingBehavior && Vector2.DistanceSquared(NPC.Center, SpongeFoundPosition) <= 64f * 64f) + NPC.spriteDirection = NPC.direction = MathF.Sign(SpongeFoundPosition.X - NPC.Center.X); + else if (NPC.velocity.LengthSquared() != 0f) + NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); + + if (Main.rand.NextBool(150) && !HasEatenSponge && CurrentBehavior == IdlingBehavior) + ThreadPool.QueueUserWorkItem(_ => DetectSponges(), null); + + if (Main.rand.NextBool(300) && HasEatenSponge && Vector2.DistanceSquared(NPC.Center, SpongeFoundPosition) > 160f * 160f) + HasEatenSponge = false; + + if (!NPC.wet && CurrentBehavior != OutsideWaterBehavior) + { + NPC.noGravity = false; + CurrentBehavior = OutsideWaterBehavior; + } + + if (ScaleSquish.Y > 1f) + ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); + } + + protected override void OnPreyDetection(NPC prey) + { + // If it's not a small fish and it's not being chased by a predator, the Probesnout may hunt. + if (CurrentPredator != null) + return; + + CurrentBehavior = HuntBehavior; + ScaleSquish.Y += 0.4f; + } + + protected override void OnPredatorDetection(NPC predator) + { + // Regardless of anything, if it detects a predator, time to run. + CurrentBehavior = FleeingBehavior; + ScaleSquish.Y += 0.4f; + } + + protected override void OnPlayerDetection(Player player) + { + if (CurrentPredator != null) + return; + + ScaleSquish.Y += 0.4f; + } + + private void IdlingBehavior() + { + // At random, the mob will choose a random nearby point and pathfind there. + pathfinding.DoPathfinding(new(NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(500f, 3000f), SunkenSeaTileValidity)); + pathfinding.MaxSpeed = 6f; + } + + private void FleeingBehavior() + { + // If the avoided entity is gone, go back to idling. + if (CurrentPredator == null) + { + CurrentBehavior = IdlingBehavior; + return; + } + + // While it doesn't have any obstacles in front of it, run away in a straight line. + // Try to manuever if there are any obstacles. + var headedDirection = CurrentPredator.DirectionTo(NPC.Center) * 200f; + bool tileNotWater = GetIntersectingPointsInLine(NPC.Center, NPC.Center + headedDirection).Any(point => Main.tile[point].IsTileSolid() || Main.tile[point].LiquidAmount < 255); + + if (tileNotWater) + { + do + { + var randomNormalDirection = headedDirection.RotatedBy(MathHelper.PiOver2 * Main.rand.NextBool().ToDirectionInt()); + _randomPathPoint = randomNormalDirection.RotatedByRandom(MathHelper.PiOver4 * 0.7f); + if (!Main.tile[(NPC.Center + _randomPathPoint).ToTileCoordinates()].IsTileSolid()) + break; + } + while (!Main.tile[(NPC.Center + _randomPathPoint).ToTileCoordinates()].IsTileSolid()); + NPC.netUpdate = true; + pathfinding.DoPathfinding(new(NPC.Center, NPC.Center + _randomPathPoint, SunkenSeaTileValidity)); + pathfinding.MaxSpeed = 8f; + } + else + { + NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; + pathfinding.ClearResults(); + + // Cap the speed if MaxSpeed has been surpassed. + if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) + NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; + } + } + + private void HuntBehavior() + { + // If there's no more prey, go back to idling. + if (CurrentPrey is null) + { + CurrentBehavior = IdlingBehavior; + return; + } + + bool huntReady = HuntCooldown == 0; + if (huntReady) + HuntCooldown = Main.rand.Next(13, 30); + + // With sight, just go straight at him. Without it, try to pathfind over them. + pathfinding.DoPathfinding(new(NPC.Center, CurrentPrey.Center, tileValidity: SunkenSeaTileValidity), forceNewTask: huntReady); + pathfinding.MaxSpeed = 8f; + pathfinding.CustomIdleBehavior = () => + { + if (CurrentPrey != null) + { + NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * pathfinding.Acceleration; + + // Cap the speed if MaxSpeed has been surpassed. + if (NPC.velocity.LengthSquared() > pathfinding.MaxSpeed * pathfinding.MaxSpeed) + NPC.velocity = Vector2.Normalize(NPC.velocity) * pathfinding.MaxSpeed; + } + else + NPC.velocity *= 0.95f; + }; + + HuntCooldown--; + } + + private void EatingBehavior() + { + if (Vector2.DistanceSquared(NPC.Center, SpongeFoundPosition) <= 64f * 64f) + { + NPC.velocity *= 0.9f; + Animation = AnimationState.Eating; + if (NPC.frame.Y >= NPC.height * AnimationFrames) + { + HasEatenSponge = true; + Animation = AnimationState.Idle; + CurrentBehavior = IdlingBehavior; + SpongeFoundPosition = Vector2.Zero; + return; + } + } + else + { + pathfinding.DoPathfinding(new(NPC.Center, SpongeFoundPosition, SunkenSeaTileValidity)); + pathfinding.MaxSpeed = 6f; + } + } + + private void OutsideWaterBehavior() + { + if (NPC.wet) + { + NPC.noGravity = true; + CurrentBehavior = _previousBehavior; + } + } + + private void DetectSponges() + { + Vector2? spongeFoundPosition = null; + int? tileIndexFound = null; + for (int i = 0; i < 360 && spongeFoundPosition == null; i += 15) + { + var points = GetIntersectingPointsInLine(NPC.Center, NPC.Center - Vector2.UnitY.RotatedBy(MathHelper.ToRadians(i)) * 360f); + for (int j = points.Count - 1; j >= 0; j--) + { + if (Main.tile[points[j]].TileType == TileType()) + { + tileIndexFound = j; + break; + } + } + + if (tileIndexFound == null) + continue; + + for (int k = tileIndexFound.Value; k >= 0; k--) + { + Vector2 worldPos = points[k].ToWorldCoordinates(); + if (NPC.HasSight(worldPos) && SunkenSeaTileValidity(points[k])) + { + CurrentBehavior = EatingBehavior; + spongeFoundPosition = worldPos; + break; + } + } + + tileIndexFound = null; + } + + if (spongeFoundPosition.HasValue) + SpongeFoundPosition = spongeFoundPosition.Value; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int i = 0; i < 4; i++) + Gore.NewGoreDirect(NPC.GetSource_Death(), NPC.Center, new Vector2(hit.HitDirection, -1f), Mod.Find($"{Name}{i + 1}").Type); + } + } + + #endregion + + #region Drawing & Animation + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter++; + if (NPC.frameCounter > TimePerAnimationFrame) + { + NPC.frame.Y += frameHeight; + NPC.frame.Y = Math.Min(NPC.frame.Y, AnimationFrames * frameHeight); + NPC.frameCounter = 0; + if (Animation == AnimationState.Idle) + NPC.frame.Y %= AnimationFrames * frameHeight; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 drawPosition = NPC.Center - screenPos; + Rectangle frame = texture.Frame(horizontalFrames: 2, verticalFrames: 12, frameX: (int)Animation, frameY: NPC.frame.Y / NPC.height); + Vector2 anchorPoint = frame.Size() * 0.5f; + SpriteEffects flip = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + spriteBatch.Draw(texture, drawPosition, frame, NPC.GetAlpha(drawColor), NPC.rotation, anchorPoint, ScaleSquish, flip, 0f); + + return false; + } + + #endregion + + #region Other ModNPC Overrides + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + Main.npcFrameCount[Type] = 12; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; + } + + public override void SetDefaults() + { + base.SetDefaults(); + + BannerItem = ItemType(); + + NPC.lifeMax = 5; + + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.chaseable = false; + + NPC.width = 44; + NPC.height = 50; + + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.value = Item.buyPrice(0, 0, 5, 0); + + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + #endregion + + #region Syncing + + private Vector2 _randomPathPoint; + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(_randomPathPoint); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + _randomPathPoint = reader.ReadVector2(); + } + + #endregion + } + + public class ProbesnoutGold : Probesnout + { + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + base.SetDefaults(); + NPC.rarity = 3; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int i = 0; i < 4; i++) + Gore.NewGoreDirect(NPC.GetSource_Death(), NPC.Center, new Vector2(hit.HitDirection, -1f), Mod.Find($"{Name}{i + 1}").Type); + } + } + } +} diff --git a/NPCs/SunkenSea/Probesnout.png b/NPCs/SunkenSea/Probesnout.png new file mode 100644 index 0000000000..ed19b8ecb7 Binary files /dev/null and b/NPCs/SunkenSea/Probesnout.png differ diff --git a/NPCs/SunkenSea/ProbesnoutGold.png b/NPCs/SunkenSea/ProbesnoutGold.png new file mode 100644 index 0000000000..81f7389093 Binary files /dev/null and b/NPCs/SunkenSea/ProbesnoutGold.png differ diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs new file mode 100644 index 0000000000..3dad2ecb2e --- /dev/null +++ b/NPCs/SunkenSea/SandProwler.cs @@ -0,0 +1,660 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SandProwler : ModNPC + { + public const int maxLength = 14; + public float speed = 3f; + public float turnSpeed = 0.0625f; + bool TailSpawned = false; + #region Textures + public static Asset BodySprite1; + public static Asset BodySprite2; + public static Asset BodySprite3; + public static Asset BodySprite4; + public static Asset BodySprite5; + public static Asset BodySprite6; + public static Asset BodySprite7; + public static Asset TailSprite; + #endregion + + public enum AnimType + { + None = 0, + Blink = 1, + Bite = 2 + } + + public bool IsHead => NPC.ai[3] == 0; + + public bool IsTail => NPC.ai[3] == 8; + + public ref float CurrentAnimation => ref NPC.localAI[1]; + + public ref float CurrentFrame => ref NPC.localAI[0]; + + public ref float BlinkTimer => ref NPC.localAI[2]; + + public override void SetStaticDefaults() + { + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + PortraitPositionXOverride = 40, + PortraitPositionYOverride = 20 + }; + value.Position.Y += 20; + value.Position.X += 40; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.CantTakeLunchMoney[Type] = true; // It will only eat coins that the AI says it can, and when it does, you aren't getting them back + if (!Main.dedServ) + { + BodySprite1 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler2", AssetRequestMode.AsyncLoad); + BodySprite2 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler3", AssetRequestMode.AsyncLoad); + BodySprite3 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler4", AssetRequestMode.AsyncLoad); + BodySprite4 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler5", AssetRequestMode.AsyncLoad); + BodySprite5 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler6", AssetRequestMode.AsyncLoad); + BodySprite6 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler7", AssetRequestMode.AsyncLoad); + BodySprite7 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler8", AssetRequestMode.AsyncLoad); + TailSprite = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler9", AssetRequestMode.AsyncLoad); + } + Main.npcFrameCount[Type] = 11; + } + + public override void SetDefaults() + { + NPC.damage = 50; + NPC.width = 30; + NPC.height = 24; + NPC.defense = 10; + NPC.lifeMax = 300; + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + NPC.waterMovementSpeed = 1; + NPC.GravityIgnoresLiquid = true; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SandProwler") + }); + } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + // only the head gets a healthbar + return IsHead; + } + + + public override void AI() + { + if (IsHead) + HeadAI(); + else + SegmentAI(); + } + public void HeadAI() + { + Point point = NPC.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point); + bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; + if (createDust) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + + if (NPC.ai[2] > 0f) + { + NPC.realLife = (int)NPC.ai[2]; + } + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) + { + NPC.TargetClosest(true); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && NPC.ai[0] == 0f) + { + int Previous = NPC.whoAmI; + for (int segment = 0; segment < maxLength; segment++) + { + int 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] = (float)NPC.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + float spriteUse = segment % 2 == 0 ? 3 : 4; // Looping body 3 and 4 + int width = 18; + switch (segment) + { + case maxLength - 1: + spriteUse = 8; // Tail + break; + case maxLength - 2: + spriteUse = 7; // Body 7 + width = 14 ; + break; + case maxLength - 3: + spriteUse = 6; // Body 6 + width = 16; + break; + case maxLength - 4: + spriteUse = 5; // Body 5 + break; + case 0: + spriteUse = 1; // Body 1 + break; + case 1: + spriteUse = 2; // Body 2 + break; + } + Main.npc[lol].ai[3] = spriteUse; + Main.npc[lol].npcSlots = 0; + Main.npc[lol].dontCountMe = true; + Main.npc[lol].width = width; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + if (NPC.velocity.X < 0f) + { + NPC.spriteDirection = -1; + } + else if (NPC.velocity.X > 0f) + { + NPC.spriteDirection = 1; + } + if (Main.player[NPC.target].dead) + { + NPC.TargetClosest(false); + } + NPC.alpha -= 42; + if (NPC.alpha < 0) + { + NPC.alpha = 0; + } + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + { + NPC.active = false; + } + float currentSpeed = speed; + float currentTurnSpeed = turnSpeed; + Vector2 segmentPosition = 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); + bool coinTarget = false; + // Look for silver and gold coins to eat + for (int i = 0; i < Main.maxItems; i++) + { + Item item = Main.item[i]; + // continue if not an active silver or gold coin + if (item == null || !item.active || (item.type != ItemID.SilverCoin && item.type != ItemID.GoldCoin)) + continue; + // can only look for coins in a 75 tile radius + if (item.Distance(NPC.Center) > 1200) + continue; + // if its head touches the coin, eat it + if (item.getRect().Intersects(NPC.getRect())) + { + SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); + SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); + int dustType = item.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; + for (int j = 0; j < 4; j++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + } + item.active = false; + break; + } + // if it isn't touching the coin, go to it + targetXDist = item.Center.X; + targetYDist = item.Center.Y; + coinTarget = true; + break; + } + // aggro on coins takes priority over players + if (NPC.life > NPC.lifeMax * 0.99 && !coinTarget) + { + targetYDist += 300; + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) + { + if (NPC.velocity.X > 0f) + { + targetXDist = Main.player[NPC.target].Center.X + 300f; + } + else + { + targetXDist = Main.player[NPC.target].Center.X - 300f; + } + } + + // Blink every so often + if (Main.rand.NextBool(600) && CurrentAnimation == (int)AnimType.None && BlinkTimer <= 0) + { + CurrentAnimation = (int)AnimType.Blink; + BlinkTimer = Main.rand.NextBool(4) ? 48 : 24; + } + } + else + { + currentSpeed *= 1.5f; + currentTurnSpeed *= 1.5f; + } + float maxCurrentSpeed = currentSpeed * 1.3f; + float minCurrentSpeed = currentSpeed * 0.7f; + float speedCompare = NPC.velocity.Length(); + if (speedCompare > 0f) + { + if (speedCompare > maxCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= maxCurrentSpeed; + } + else if (speedCompare < minCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= minCurrentSpeed; + } + } + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + float absoluteTargetX = System.Math.Abs(targetXDist); + float absoluteTargetY = System.Math.Abs(targetYDist); + float timeToReachTarget = currentSpeed / targetDistance; + targetXDist *= timeToReachTarget; + targetYDist *= timeToReachTarget; + if (targetDistance < 128 && (NPC.life <= NPC.lifeMax * 0.99 || coinTarget)) + { + CurrentAnimation = (int)AnimType.Bite; + } + else if (CurrentAnimation != (int)AnimType.Blink) + { + CurrentAnimation = (int)AnimType.None; + } + BlinkTimer--; + if (BlinkTimer <= 0) + { + BlinkTimer = 0; + if (CurrentAnimation == (int)AnimType.Blink) + { + CurrentAnimation = (int)AnimType.None; + } + } + 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)) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; + } + } + if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 + } + } + } + else + { + if (absoluteTargetX > absoluteTargetY) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 + } + else if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + } + else + { + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; + } + else if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + } + } + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + } + + public void SegmentAI() + { + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + 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; + } + + Vector2 segmentPosition = 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); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float headDivisor = 1; + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2 / headDivisor) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override void FindFrame(int frameHeight) + { + if (IsTail) + { + NPC.frameCounter++; + if (NPC.frameCounter > 6) + { + NPC.localAI[0]++; + NPC.frameCounter = 0; + } + if (NPC.localAI[0] > 7) + { + NPC.localAI[0] = 0; + } + } + if (IsHead) + { + NPC.frameCounter++; + if (NPC.frameCounter > 6) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; + } + switch (CurrentAnimation) + { + case (int)AnimType.None: + NPC.frame.Y = 0; + break; + case (int)AnimType.Bite: + if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) + { + NPC.frame.Y = frameHeight * 5; + } + break; + case (int)AnimType.Blink: + if (NPC.frame.Y < frameHeight || NPC.frame.Y > frameHeight * 4) + { + NPC.frame.Y = frameHeight; + } + break; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && + !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + + return 0f; + } + + public override bool CheckActive() + { + return IsHead; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSandProwlerLoot(npcLoot); + + public static void DefineSandProwlerLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 4); + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, 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, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D segmentSprite = TextureAssets.Npc[Type].Value; + if (NPC.IsABestiaryIconDummy) + { + NPC.frame = segmentSprite.Frame(); + // Buffers the segment position and rotations + float offset = -0.2f; + float startX = 0; + float startY = 0; + int segmentSpacing = 16; + int animationSpeed = 5; + float wormTimer = NPC.Calamity().bestiaryWormTimer; + // Draw the body segments + for (int i = 7; i > 0; i--) + { + // The first segment is slightly closer to keep up with the head + float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; + + Texture2D toUse = i == 1 ? BodySprite1.Value : i == 2 ? BodySprite2.Value : i % 2 == 0 ? BodySprite3.Value : BodySprite4.Value; + spriteBatch.Draw(toUse, NPC.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * 2 + startY), toUse.Frame(1, 1, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(toUse.Width / 2, toUse.Width / 2), NPC.scale, SpriteEffects.None, 0f); + } + // Draw the head + spriteBatch.Draw(segmentSprite, NPC.position + new Vector2(startX, MathF.Sin(wormTimer * animationSpeed) * 2 + startY), segmentSprite.Frame(1, 11, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(segmentSprite.Width * 0.5f, segmentSprite.Height / 11), NPC.scale, SpriteEffects.None, 0f); + + return false; + } + switch (NPC.ai[3]) + { + case 0: + break; + case 1: + segmentSprite = BodySprite1.Value; + break; + case 2: + segmentSprite = BodySprite2.Value; + break; + case 3: + segmentSprite = BodySprite3.Value; + break; + case 4: + segmentSprite = BodySprite4.Value; + break; + case 5: + segmentSprite = BodySprite5.Value; + break; + case 6: + segmentSprite = BodySprite6.Value; + break; + case 7: + segmentSprite = BodySprite7.Value; + break; + case 8: + segmentSprite = TailSprite.Value; + break; + default: + segmentSprite = NPC.ai[3] % 2 == 0 ? BodySprite4.Value : BodySprite3.Value; + break; + } + float frameDivisor = IsTail ? 8 : IsHead ? Main.npcFrameCount[Type] : 1; + Vector2 origin = new Vector2(segmentSprite.Width / 2, segmentSprite.Height / 2 / frameDivisor); + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2(segmentSprite.Width, segmentSprite.Height / frameDivisor) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + SpriteEffects fx = NPC.oldPos[1].X < NPC.position.X ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Rectangle frame = segmentSprite.Frame(1, 1, 0, 0); + if (IsHead) + { + frame = NPC.frame; + } + else if (IsTail) + { + frame = segmentSprite.Frame(1, 8, 0, (int)NPC.localAI[0]); + } + spriteBatch.Draw(segmentSprite, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, fx, 0f); + return false; + } + } +} diff --git a/NPCs/SunkenSea/SandProwler.png b/NPCs/SunkenSea/SandProwler.png new file mode 100644 index 0000000000..a36c31ffbb Binary files /dev/null and b/NPCs/SunkenSea/SandProwler.png differ diff --git a/NPCs/SunkenSea/SandProwler2.png b/NPCs/SunkenSea/SandProwler2.png new file mode 100644 index 0000000000..bb3fe551b5 Binary files /dev/null and b/NPCs/SunkenSea/SandProwler2.png differ diff --git a/NPCs/SunkenSea/SandProwler3.png b/NPCs/SunkenSea/SandProwler3.png new file mode 100644 index 0000000000..7a33532959 Binary files /dev/null and b/NPCs/SunkenSea/SandProwler3.png differ diff --git a/NPCs/SunkenSea/SandProwler4.png b/NPCs/SunkenSea/SandProwler4.png new file mode 100644 index 0000000000..8588ffaa7e Binary files /dev/null and b/NPCs/SunkenSea/SandProwler4.png differ diff --git a/NPCs/SunkenSea/SandProwler5.png b/NPCs/SunkenSea/SandProwler5.png new file mode 100644 index 0000000000..c1b0777eeb Binary files /dev/null and b/NPCs/SunkenSea/SandProwler5.png differ diff --git a/NPCs/SunkenSea/SandProwler6.png b/NPCs/SunkenSea/SandProwler6.png new file mode 100644 index 0000000000..b9304a7630 Binary files /dev/null and b/NPCs/SunkenSea/SandProwler6.png differ diff --git a/NPCs/SunkenSea/SandProwler7.png b/NPCs/SunkenSea/SandProwler7.png new file mode 100644 index 0000000000..bbed0cae7f Binary files /dev/null and b/NPCs/SunkenSea/SandProwler7.png differ diff --git a/NPCs/SunkenSea/SandProwler8.png b/NPCs/SunkenSea/SandProwler8.png new file mode 100644 index 0000000000..c722b5e8f5 Binary files /dev/null and b/NPCs/SunkenSea/SandProwler8.png differ diff --git a/NPCs/SunkenSea/SandProwler9.png b/NPCs/SunkenSea/SandProwler9.png new file mode 100644 index 0000000000..594b3586ae Binary files /dev/null and b/NPCs/SunkenSea/SandProwler9.png differ diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs new file mode 100644 index 0000000000..0dd6be46cb --- /dev/null +++ b/NPCs/SunkenSea/SandProwlerNested.cs @@ -0,0 +1,484 @@ +using System; +using CalamityMod.BiomeManagers; +using CalamityMod.DataStructures; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.GameContent.Bestiary; +using CalamityMod.NPCs.Crags; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class SandProwlerNested : ModNPC + { + public bool PeekingOut; + public bool HasChosenSpotToHideIn => SpotToHideIn != Vector2.Zero; + public Point TileCoordsToHideIn + { + get => SpotToHideIn.ToTileCoordinates(); + set => SpotToHideIn = value.ToWorldCoordinates(); + } + public Vector2 SpotToHideIn + { + get => new Vector2(NPC.ai[0], NPC.ai[1]); + set + { + NPC.ai[0] = value.X; + NPC.ai[1] = value.Y; + } + } + + public bool InHidingSpot => NPC.WithinRange(SpotToHideIn, 8f); + + public bool RetreatingToHidingSpot + { + get => NPC.ai[2] == 1f; + set => NPC.ai[2] = value.ToInt(); + } + + public ref float SnapTimer => ref NPC.ai[3]; + public ref float SnapCooldown => ref NPC.localAI[0]; + public ref float InitialSnapDirection => ref NPC.localAI[1]; + public ref float CurrentSnapDirection => ref NPC.localAI[2]; + public override string Texture => "CalamityMod/NPCs/SunkenSea/SandProwler"; + + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + NPCID.Sets.TrailingMode[Type] = 0; + NPCID.Sets.TrailCacheLength[Type] = 60; + NPCID.Sets.UsesNewTargetting[Type] = true; + NPCID.Sets.CantTakeLunchMoney[Type] = true; + Main.npcFrameCount[Type] = 11; + } + + public override void SetDefaults() + { + NPC.damage = 50; + NPC.width = 30; + NPC.height = 30; //32 + NPC.defense = 10; + NPC.lifeMax = 300; + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + 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); + + NPC.waterMovementSpeed = 1f; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(PeekingOut); + writer.Write(SnapCooldown); + writer.Write(InitialSnapDirection); + writer.Write(CurrentSnapDirection); + writer.Write(NPC.Calamity().newAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + PeekingOut = reader.ReadBoolean(); + SnapCooldown = reader.ReadSingle(); + InitialSnapDirection = reader.ReadSingle(); + CurrentSnapDirection = reader.ReadSingle(); + NPC.Calamity().newAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + // Choose an initial tile to hide in. + if (Main.netMode != NetmodeID.MultiplayerClient && !HasChosenSpotToHideIn) + { + int tries; + for (tries = 0; tries < 1800; tries++) + { + int x = (int)(NPC.Center.X / 16f) + Main.rand.Next(-25, 25); + int y = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-25, 25); + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + + // Try again if the tile isn't solid or isn't exposed to air. + if (!WorldGen.SolidTile(tile) || !CalamityUtils.IsTileExposedToAir(x, y, out float? angleToOpenAir)) + continue; + + // Try again if there's no open water near the tile. + Vector2 moveDirection = angleToOpenAir.Value.ToRotationVector2(); + Vector2 collisionCheckPosition = new Vector2(x * 16f + 8f, y * 16f + 8f) + moveDirection * 16f; + float collisionDistance = CalamityUtils.DistanceToTileCollisionHit(collisionCheckPosition, moveDirection, 20) ?? 20; + if (collisionDistance <= 10) + continue; + + TileCoordsToHideIn = new Point(x, y); + break; + } + + // Just die if no spot was suitable. + if (tries >= 1799) + NPC.active = false; + + NPC.Center = SpotToHideIn; + NPC.netUpdate = true; + } + + Entity target = null; + + // Look for coins + for (int i = 0; i < Main.maxItems; i++) + { + Item n = Main.item[i]; + if (n == null || !n.active || (n.type != ItemID.SilverCoin && n.type != ItemID.GoldCoin)) + continue; + // if its head touches the coin, eat it + if (n.getRect().Intersects(NPC.getRect())) + { + SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); + SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); + int dustType = n.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; + for (int j = 0; j < 4; j++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + } + n.active = false; + break; + } + // Set the coin as the target + if (n.Distance(NPC.Center) <= 300 && Collision.CheckAABBvLineCollision(NPC.Center, NPC.Size, NPC.Center, n.Center)) + { + target = n; + } + } + // Go after sea minnows if not distracted by shiny coin + if (target == null) + { + if (NPC.life > NPC.lifeMax * 0.99f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC n = Main.npc[i]; + if (n == null || !n.active || n.type != ModContent.NPCType()) + continue; + if (n.Distance(NPC.Center) <= 300 && Collision.CheckAABBvLineCollision(NPC.Center, NPC.Size, NPC.Center, n.Center)) + { + target = n; + } + } + } + // If you've pissed it off, it now goes after YOU + else + { + NPC.TargetClosest(false); + target = Main.player[NPC.target]; + } + } + + // Open mouth when launching towards a target + if (SnapTimer > 0 && target != null && !PeekingOut) + { + NPC.Calamity().newAI[1] = 1; + } + else if (RetreatingToHidingSpot || InHidingSpot) + { + NPC.Calamity().newAI[1] = 0; + } + + // Become invulnerable and mostly transparent if hiding in a tile. + NPC.dontTakeDamage = InHidingSpot; + NPC.Opacity = MathHelper.Clamp(NPC.Opacity - NPC.dontTakeDamage.ToDirectionInt(), 0.35f, 1f); + + // Also emit some particle effects as an indicator. + if (InHidingSpot) + { + Dust sparkle = Dust.NewDustDirect(TileCoordsToHideIn.ToWorldCoordinates(0, 0), 16, 16, 261); + sparkle.color = Color.Orange; + sparkle.velocity = Main.rand.NextVector2Circular(4f, 4f); + sparkle.noGravity = true; + } + + // Decide rotation. + NPC.rotation = NPC.AngleFrom(SpotToHideIn) + MathHelper.PiOver2; + + // Prevent the tile from being destroyed. + FixExploitManEaters.ProtectSpot(TileCoordsToHideIn.X, TileCoordsToHideIn.Y); + + // Do nothing other than hiding if instructed to do so. + if (RetreatingToHidingSpot) + { + NPC.velocity = NPC.SafeDirectionTo(SpotToHideIn) * 0.002f; + NPC.position += NPC.velocity.SafeNormalize(Vector2.Zero) * 5f; + + // Stop once the hiding spot has been reached. + if (InHidingSpot) + { + NPC.Center = SpotToHideIn; + NPC.velocity = Vector2.Zero; + RetreatingToHidingSpot = false; + NPC.netUpdate = true; + } + + return; + } + + // Don't do any snapping and such if the cooldown is active. + if (SnapCooldown > 0f) + { + SnapCooldown--; + if (SnapCooldown <= 0f) + NPC.netUpdate = true; + return; + } + + if (SnapTimer > 0f) + { + int snapTime = PeekingOut ? 45 : 32; + float idealSpeed = PeekingOut ? 1.75f : 10f; + float newSpeed = MathHelper.Lerp(NPC.velocity.Length(), idealSpeed, 0.08f); + NPC.velocity = CurrentSnapDirection.ToRotationVector2() * newSpeed; + + // Get closer to the target if one not peeking. + if (!PeekingOut && target != null) + CurrentSnapDirection = CurrentSnapDirection.AngleTowards(NPC.AngleTo(target.Center), 0.0125f); + + // Retreat if velocity is zero for some reason. + if (NPC.velocity == Vector2.Zero) + { + SnapTimer = 0f; + RetreatingToHidingSpot = true; + NPC.netUpdate = true; + return; + } + + SnapTimer++; + if (SnapTimer >= snapTime || (Collision.SolidCollision(NPC.Center, 1, 1) && SnapTimer > 5f)) + { + SnapTimer = 0f; + SnapCooldown = 35f; + PeekingOut = false; + RetreatingToHidingSpot = true; + } + + return; + } + + Vector2 snapDirection = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * Main.rand.Next(4)); + + // Pick a potential direction to snap out. + // This is important for attacking. + int snapDirectionTries = 0; + float targetSnapAngularThreshold = 0.48f; + while ((CalamityUtils.DistanceToTileCollisionHit(SpotToHideIn, snapDirection, 50) ?? 50f) < 5f) + { + snapDirectionTries++; + snapDirection = snapDirection.RotatedBy(MathHelper.PiOver2); + + if (snapDirectionTries >= 8) + return; + + // Try again if there's a defined target and it isn't in the line of sight of the current direction. + if (target != null && snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) > targetSnapAngularThreshold) + continue; + } + + // Snap out if a suitable target gets close. + // Otherwise, sometimes randomly peek out. + bool canSnapAtTarget = + target != null && + snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) < targetSnapAngularThreshold && + Collision.CanHit(NPC.Center + snapDirection * 12f, 1, 1, target.Center, 1, 1); + if (Main.rand.NextBool(30) && !canSnapAtTarget) + PeekingOut = true; + + if (PeekingOut || canSnapAtTarget) + { + if (canSnapAtTarget) + SoundEngine.PlaySound(SoundID.Item96, NPC.Center); + else + SoundEngine.PlaySound(SoundID.Item95, NPC.Center); + + // Add some randomness when peeking. + if (PeekingOut) + snapDirection = snapDirection.RotatedByRandom(MathHelper.Pi / 6f); + + NPC.velocity = snapDirection * 4f; + InitialSnapDirection = CurrentSnapDirection = NPC.velocity.ToRotation(); + SnapTimer = 1f; + NPC.netUpdate = true; + } + } + + public override void FindFrame(int frameHeight) + { + if (NPC.Calamity().newAI[1] == 1) + { + NPC.frameCounter++; + if (NPC.frameCounter > 3) + { + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) + { + NPC.frame.Y = frameHeight * 5; + } + } + else + { + NPC.frameCounter = 0; + NPC.frame.Y = 0; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (InHidingSpot) + return false; + + Texture2D headTexture = ModContent.Request(Texture).Value; + Texture2D body1Texture = SandProwler.BodySprite1.Value; + Texture2D body2Texture = SandProwler.BodySprite2.Value; + Texture2D body3Texture = SandProwler.BodySprite3.Value; + Texture2D body4Texture = SandProwler.BodySprite4.Value; + + Vector2 idealDrawPosition = SpotToHideIn; + Vector2 backOffset = (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * -18f; + if (Collision.SolidCollision(idealDrawPosition + backOffset, 4, 4)) + idealDrawPosition += backOffset; + + List bezierPoints = new List() + { + idealDrawPosition + }; + + // Calculate points to create segments at based on a catmull-rom spine. + float bendFactor = Utils.GetLerpValue(80f, 250f, NPC.Distance(idealDrawPosition), true); + for (int i = 0; i < 20; i++) + { + Vector2 leftEnd = idealDrawPosition - InitialSnapDirection.ToRotationVector2() * bendFactor * 450f; + Vector2 rightEnd = NPC.Center + CurrentSnapDirection.ToRotationVector2() * bendFactor * 450f; + bezierPoints.Add(Vector2.CatmullRom(leftEnd, idealDrawPosition, NPC.Center, rightEnd, i / 19f)); + } + bezierPoints.Add(NPC.Center); + + // And then generalize them with a bezier curve. + BezierCurve bezierCurve = new BezierCurve(bezierPoints.ToArray()); + int totalChains = (int)(NPC.Distance(idealDrawPosition) / 16f); + totalChains = (int)MathHelper.Clamp(totalChains, 2f, 100f); + + for (int i = 0; i < totalChains - 1; i++) + { + Texture2D textureToUse; + + + if (i % 2 == 0) + { + textureToUse = body3Texture; + } + else + { + textureToUse = body4Texture; + } + + switch (totalChains - i - 1) + { + case 1: + textureToUse = headTexture; + break; + case 2: + textureToUse = body1Texture; + break; + case 3: + textureToUse = body2Texture; + break; + } + + Vector2 drawPosition = bezierCurve.Evaluate(i / (float)totalChains); + Color lightColor = Lighting.GetColor((int)(drawPosition.X / 16f), (int)(drawPosition.Y / 16f)); + float angle = (bezierCurve.Evaluate(i / (float)totalChains + 1f / totalChains) - drawPosition).ToRotation() + MathHelper.PiOver2; + Rectangle frame = textureToUse.Frame(1, 1, 0, 0); + if (textureToUse == headTexture) + { + frame = NPC.frame; + } + Vector2 origin = new Vector2(textureToUse.Width / 2, textureToUse.Height / (textureToUse == headTexture ? 22 : 2)); + spriteBatch.Draw(textureToUse, drawPosition - Main.screenPosition, frame, lightColor, angle, origin, NPC.scale, SpriteEffects.None, 0f); + } + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return NPC.life < NPC.lifeMax * 0.99f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => SandProwler.DefineSandProwlerLoot(npcLoot); + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0 && !Main.dedServ) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, NPC.scale); + } + } + public override void OnKill() + { + // Increase the kill count of Sand Prowlers for the Bestiary + if (NPC.GetWereThereAnyInteractions()) + { + NPC nPC = new NPC(); + nPC.SetDefaults(ModContent.NPCType()); + Main.BestiaryTracker.Kills.RegisterKill(nPC); + } + } + } +} diff --git a/NPCs/SunkenSea/SeaFloaty.cs b/NPCs/SunkenSea/SeaFloaty.cs index 5d1d30a8af..67acd56e5e 100644 --- a/NPCs/SunkenSea/SeaFloaty.cs +++ b/NPCs/SunkenSea/SeaFloaty.cs @@ -1,7 +1,10 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -14,10 +17,10 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[Type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - SpriteDirection = 1 + SpriteDirection = -1 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -28,7 +31,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.aiStyle = -1; AIType = -1; NPC.damage = 5; - NPC.width = 72; + NPC.width = 44; NPC.height = 22; NPC.defense = 0; NPC.lifeMax = 50; @@ -63,17 +66,18 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + NPC.TargetClosest(false); if (NPC.velocity.X > 0.25f) - { - NPC.spriteDirection = -1; - } - else if (NPC.velocity.X < 0.25f) { NPC.spriteDirection = 1; } + else if (NPC.velocity.X < 0.25f) + { + NPC.spriteDirection = -1; + } if (NPC.ai[0] == 0f) { - NPC.direction = 1; + NPC.direction = -1; NPC.ai[0] = 1f; } NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; @@ -87,12 +91,27 @@ namespace CalamityMod.NPCs.SunkenSea NPC.direction *= -1; NPC.netUpdate = true; } - - if (NPC.justHit && !hasBeenHit) + // panic when it gets hit or the player is close enough to it + if ((NPC.justHit || Main.player[NPC.target].Distance(NPC.Center) < 320) && !hasBeenHit) { hasBeenHit = true; NPC.noTileCollide = true; NPC.noGravity = true; + + SoundEngine.PlaySound(SoundID.NPCHit37 with { Pitch = 1 }, NPC.Center); + + if (!Main.dedServ) + { + var emoteDirection = -Vector2.UnitY * Main.rand.NextFloat(2f, 3f); + Particle emote = new EmoteExpressionParticle( + NPC.Center + emoteDirection * 2f, + emoteDirection, + 2.2f, + Color.Yellow, + Main.rand.Next(30, 46), + EmoteExpressionParticle.EmoteType.Exclamation); + GeneralParticleHandler.SpawnParticle(emote); + } } NPC.chaseable = hasBeenHit; if (hasBeenHit) @@ -133,14 +152,14 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { NPC.frameCounter += hasBeenHit ? 0.3f : 0.15f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneRadiantReefs && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.45f; } @@ -159,7 +178,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore2").Type, 1f); diff --git a/NPCs/SunkenSea/SeaFloaty.png b/NPCs/SunkenSea/SeaFloaty.png index cb786ed41d..1af90fa4cd 100644 Binary files a/NPCs/SunkenSea/SeaFloaty.png and b/NPCs/SunkenSea/SeaFloaty.png differ diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index 4aaa21eb56..c753fb8f07 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -3,7 +3,9 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -15,9 +17,9 @@ namespace CalamityMod.NPCs.SunkenSea { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; - Main.npcCatchable[NPC.type] = true; - NPCID.Sets.CountsAsCritter[NPC.type] = true; + Main.npcFrameCount[Type] = 8; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; } public override void SetDefaults() @@ -25,8 +27,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.npcSlots = 0.1f; NPC.noGravity = true; NPC.damage = 0; - NPC.width = 36; - NPC.height = 22; + NPC.width = 32; + NPC.height = 26; NPC.defense = 0; NPC.lifeMax = 5; NPC.aiStyle = -1; @@ -48,144 +50,272 @@ namespace CalamityMod.NPCs.SunkenSea }); } + public override void OnSpawn(IEntitySource source) + { + NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); + } public override void AI() { - 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; - if (NPC.direction == 0) - { - NPC.TargetClosest(true); - } + NPC owner = Main.npc[(int)NPC.ai[2]]; if (NPC.wet) { - NPC.TargetClosest(false); - if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && - (Main.player[NPC.target].Center - NPC.Center).Length() < 150f) + if (owner == null || !owner.active || (owner.type != ModContent.NPCType() && owner.type != ModContent.NPCType())) { - shouldSwimAway = true; - } - if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && shouldSwimAway) - { - shouldSwimAway = false; - } - if (!shouldSwimAway) - { - if (NPC.collideX || NPC.velocity.X == 0f) + 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; + if (NPC.direction == 0) { - NPC.velocity.X = NPC.velocity.X * -3f; + NPC.TargetClosest(true); + } + NPC.TargetClosest(false); + if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && + (Main.player[NPC.target].Center - NPC.Center).Length() < 150f) + { + shouldSwimAway = true; + } + if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && shouldSwimAway) + { + shouldSwimAway = false; + } + if (!shouldSwimAway) + { + if (NPC.collideX || NPC.velocity.X == 0f) + { + NPC.velocity.X = NPC.velocity.X * -3f; + 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) * -3f; + 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 (shouldSwimAway) + { + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.25f; + NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.15f; + if (NPC.velocity.X > 6f) + { + NPC.velocity.X = 6f; + } + if (NPC.velocity.X < -6f) + { + NPC.velocity.X = -6f; + } + if (NPC.velocity.Y > 6f) + { + NPC.velocity.Y = 6f; + } + if (NPC.velocity.Y < -6f) + { + NPC.velocity.Y = -6f; + } 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) * -3f; - 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 (shouldSwimAway) - { - NPC.TargetClosest(true); - NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.25f; - NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.15f; - if (NPC.velocity.X > 6f) - { - NPC.velocity.X = 6f; - } - if (NPC.velocity.X < -6f) - { - NPC.velocity.X = -6f; - } - if (NPC.velocity.Y > 6f) - { - NPC.velocity.Y = 6f; - } - if (NPC.velocity.Y < -6f) - { - NPC.velocity.Y = -6f; - } - NPC.direction *= -1; - } - else - { - NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; - if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) - { - NPC.velocity.X = NPC.velocity.X * 0.95f; - } - if (NPC.ai[0] == -1f) - { - NPC.velocity.Y = NPC.velocity.Y - 0.01f; - if ((double)NPC.velocity.Y < -0.3) - { - NPC.ai[0] = 1f; - } } else { - NPC.velocity.Y = NPC.velocity.Y + 0.01f; - if ((double)NPC.velocity.Y > 0.3) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) + { + NPC.velocity.X = NPC.velocity.X * 0.95f; + } + if (NPC.ai[0] == -1f) + { + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) + { + NPC.ai[0] = 1f; + } + } + else + { + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) + { + 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; } } - } - 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) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - NPC.ai[0] = -1f; - } - else if (Main.tile[npcTileX, npcTileY + 2].HasTile) - { - NPC.ai[0] = -1f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } - if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) + else { - NPC.velocity.Y = NPC.velocity.Y * 0.95f; + float SAImovement = 0.05f; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC otherFish = Main.npc[k]; + // Short circuits to make the loop as fast as possible + if (!otherFish.active || k == NPC.whoAmI || (otherFish.type != ModContent.NPCType() && otherFish.type != ModContent.NPCType() && otherFish.type != ModContent.NPCType())) + continue; + + float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); + if (taxicabDist < NPC.width * 1.5f) + { + if (NPC.position.X < otherFish.position.X) + NPC.velocity.X -= SAImovement; + else + NPC.velocity.X += SAImovement; + + if (NPC.position.Y < otherFish.position.Y) + NPC.velocity.Y -= SAImovement; + else + NPC.velocity.Y += SAImovement; + } + } + + if (!owner.active) + return; + + float passiveMvtFloat = 0.5f; + float range = 100f; + Vector2 fischPos = NPC.Center; + float xDist = owner.Center.X - fischPos.X; + float yDist = owner.Center.Y - fischPos.Y; + yDist += Main.rand.NextFloat(-10, 20); + xDist += Main.rand.NextFloat(-10, 20); + xDist += 30f * -(float)owner.direction; + Vector2 leaderVector = new Vector2(xDist, yDist); + float leaderDist = leaderVector.Length(); + float returnSpeed = 8f; + //If leader is close enough, resume normal + if (leaderDist < range && owner.velocity.Y == 0f && + NPC.Bottom.Y <= owner.Bottom.Y && + !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + if (NPC.velocity.Y < -6f) + { + NPC.velocity.Y = -6f; + } + } + + if (leaderDist < 50f) + { + if (Math.Abs(NPC.velocity.X) > 2f || Math.Abs(NPC.velocity.Y) > 2f) + { + NPC.velocity *= 0.99f; + } + passiveMvtFloat = 0.01f; + } + else + { + if (leaderDist < 100f) + { + passiveMvtFloat = 0.1f; + } + if (leaderDist > 300f) + { + passiveMvtFloat = 1f; + } + leaderDist = returnSpeed / leaderDist; + leaderVector.X *= leaderDist; + leaderVector.Y *= leaderDist; + } + if (NPC.velocity.X < leaderVector.X) + { + NPC.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.X < 0f) + { + NPC.velocity.X += passiveMvtFloat; + } + } + if (NPC.velocity.X > leaderVector.X) + { + NPC.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.X > 0f) + { + NPC.velocity.X -= passiveMvtFloat; + } + } + if (NPC.velocity.Y < leaderVector.Y) + { + NPC.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.Y < 0f) + { + NPC.velocity.Y += passiveMvtFloat * 2f; + } + } + if (NPC.velocity.Y > leaderVector.Y) + { + NPC.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.Y > 0f) + { + NPC.velocity.Y -= passiveMvtFloat * 2f; + } + } + if (NPC.velocity.X >= 0.25f) + { + NPC.direction = -1; + } + else if (NPC.velocity.X < -0.25f) + { + NPC.direction = 1; + } + NPC.spriteDirection = -NPC.direction; } } else { - if (NPC.velocity.Y == 0f) + { - NPC.velocity.X = NPC.velocity.X * 0.94f; - if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) + if (NPC.velocity.Y == 0f) { - NPC.velocity.X = 0f; + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) + { + NPC.velocity.X = 0f; + } } + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 10f) + { + NPC.velocity.Y = 10f; + } + NPC.ai[0] = 1f; } - NPC.velocity.Y = NPC.velocity.Y + 0.3f; - if (NPC.velocity.Y > 10f) + NPC.rotation = NPC.velocity.X * 0.05f; + if ((double)NPC.rotation < -0.1) { - NPC.velocity.Y = 10f; + NPC.rotation = -0.1f; + } + if ((double)NPC.rotation > 0.1) + { + NPC.rotation = 0.1f; + } + if (NPC.type == ModContent.NPCType()) + { + NPC.ProduceGoldCritterDust(); } - NPC.ai[0] = 1f; - } - NPC.rotation = NPC.velocity.X * 0.05f; - if ((double)NPC.rotation < -0.1) - { - NPC.rotation = -0.1f; - } - if ((double)NPC.rotation > 0.1) - { - NPC.rotation = 0.1f; - return; } } @@ -196,21 +326,12 @@ namespace CalamityMod.NPCs.SunkenSea NPC.frameCounter = 0.0; return; } - NPC.frameCounter += 0.075f; - NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) @@ -219,4 +340,41 @@ namespace CalamityMod.NPCs.SunkenSea } } } + public class SeaMinnowGold : SeaMinnow + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 8; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; + this.HideFromBestiary(); + } + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 36; + NPC.height = 22; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.catchItem = (short)ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + NPC.rarity = 3; + } + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); + } + } + } } diff --git a/NPCs/SunkenSea/SeaMinnow.png b/NPCs/SunkenSea/SeaMinnow.png index 456d61faab..4baf632a28 100644 Binary files a/NPCs/SunkenSea/SeaMinnow.png and b/NPCs/SunkenSea/SeaMinnow.png differ diff --git a/NPCs/SunkenSea/SeaMinnowGold.png b/NPCs/SunkenSea/SeaMinnowGold.png new file mode 100644 index 0000000000..f070775305 Binary files /dev/null and b/NPCs/SunkenSea/SeaMinnowGold.png differ diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs deleted file mode 100644 index 2cb2cdab19..0000000000 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ /dev/null @@ -1,323 +0,0 @@ -using System; -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Magic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent1 : ModNPC - { - public const int maxLength = 9; - public float speed = 3f; - public float turnSpeed = 0.0625f; - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 20 - }; - value.Position.Y += 20; - value.Position.X += 40; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - } - - public override void SetDefaults() - { - NPC.damage = 50; - NPC.width = 50; //42 - NPC.height = 24; //32 - NPC.defense = 10; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 20, 0); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - 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.SeaSerpent") - }); - } - - public override void AI() - { - Point point = NPC.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point); - bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; - if (createDust) - { - if (Main.rand.NextBool()) - { - 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; - } - } - - Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 0.3f / 255f, (255 - NPC.alpha) * 0.3f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) - NPC.TargetClosest(true); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && NPC.ai[0] == 0f) - { - int Previous = NPC.whoAmI; - for (int segment = 0; segment < maxLength; segment++) - { - int lol = 0; - if (segment == 0 || segment == 1 || segment == 4 || segment == 5) - 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 if (segment == 2 || segment == 3 || segment == 6) - 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 if (segment == 7) - 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 if (segment == 8) - 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] = (float)NPC.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - - TailSpawned = true; - } - } - - if (NPC.velocity.X < 0f) - NPC.spriteDirection = -1; - else if (NPC.velocity.X > 0f) - NPC.spriteDirection = 1; - - if (Main.player[NPC.target].dead) - NPC.TargetClosest(false); - - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) - { - NPC.TargetClosest(false); - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) - NPC.active = false; - } - - float currentSpeed = speed; - float currentTurnSpeed = turnSpeed; - Vector2 segmentPosition = 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); - if (NPC.life > NPC.lifeMax * 0.99) - { - targetYDist += 300; - if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) - { - if (NPC.velocity.X > 0f) - { - targetXDist = Main.player[NPC.target].Center.X + 300f; - } - else - { - targetXDist = Main.player[NPC.target].Center.X - 300f; - } - } - } - else - { - currentSpeed *= 1.5f; - currentTurnSpeed *= 1.5f; - } - float maxCurrentSpeed = currentSpeed * 1.3f; - float minCurrentSpeed = currentSpeed * 0.7f; - float speedCompare = NPC.velocity.Length(); - if (speedCompare > 0f) - { - if (speedCompare > maxCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= maxCurrentSpeed; - } - else if (speedCompare < minCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= minCurrentSpeed; - } - } - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - float absoluteTargetX = System.Math.Abs(targetXDist); - float absoluteTargetY = System.Math.Abs(targetYDist); - float timeToReachTarget = currentSpeed / 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)) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; - } - } - if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 - } - } - } - else - { - if (absoluteTargetX > absoluteTargetY) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 - } - else if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - } - else - { - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; - } - else if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - } - } - NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && - !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - return 0f; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 4); - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - 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, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent1.png b/NPCs/SunkenSea/SeaSerpent1.png deleted file mode 100644 index 0e144e18e2..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent1.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs deleted file mode 100644 index 4334908959..0000000000 --- a/NPCs/SunkenSea/SeaSerpent2.cs +++ /dev/null @@ -1,151 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent2 : ModNPC - { - public float speed = 6f; - public float turnSpeed = 0.125f; - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 40; - NPC.width = 24; //42 - NPC.height = 16; //24 - NPC.defense = 20; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - 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.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - 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) - { - return false; - } - - 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) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - 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; - } - - Vector2 segmentPosition = 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); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - 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 - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - 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, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore2").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent2.png b/NPCs/SunkenSea/SeaSerpent2.png deleted file mode 100644 index bdb5c315db..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent2.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs deleted file mode 100644 index 3258776809..0000000000 --- a/NPCs/SunkenSea/SeaSerpent3.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent3 : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 40; - NPC.width = 24; //42 - NPC.height = 16; //24 - NPC.defense = 20; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - 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.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - 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) - { - return false; - } - - 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) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - 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; - } - - Vector2 segmentPosition = 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); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - 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 - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - 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, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore3").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent3.png b/NPCs/SunkenSea/SeaSerpent3.png deleted file mode 100644 index 3ca49fc95e..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent3.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs deleted file mode 100644 index 336e640558..0000000000 --- a/NPCs/SunkenSea/SeaSerpent4.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent4 : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 30; - NPC.width = 28; //42 - NPC.height = 24; //34 - NPC.defense = 20; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - 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.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - 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) - { - return false; - } - - 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) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - 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; - } - - Vector2 segmentPosition = 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); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - 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 - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - 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, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore4").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent4.png b/NPCs/SunkenSea/SeaSerpent4.png deleted file mode 100644 index 5625d8cf2d..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent4.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs deleted file mode 100644 index 419b90c22f..0000000000 --- a/NPCs/SunkenSea/SeaSerpent5.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent5 : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 20; - NPC.width = 36; //42 - NPC.height = 30; //40 - NPC.defense = 30; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - 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.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - 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) - { - return false; - } - - 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) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - 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; - } - - Vector2 segmentPosition = 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); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - 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 - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - 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, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore5").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent5.png b/NPCs/SunkenSea/SeaSerpent5.png deleted file mode 100644 index 2772709ecb..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent5.png and /dev/null differ diff --git a/NPCs/SunkenSea/Sharkoon.cs b/NPCs/SunkenSea/Sharkoon.cs new file mode 100644 index 0000000000..11d3285bfa --- /dev/null +++ b/NPCs/SunkenSea/Sharkoon.cs @@ -0,0 +1,577 @@ +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Enums; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Enemy; +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 static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class Sharkoon : SunkenSeaNPC + { + #region Fields & Properties + + #region Static Fields + + public static int IdleRandomMovementUnlikeliness = 250; + public static int IdleMinPathDistance = 200; + public static int IdleMaxPathDistance = 400; + + public static int FleeTileAnticipationDistance = 64; + public static int FleeMinPathDistance = 80; + public static int FleeMaxPathDistance = 160; + + public static int ExplosionDistance = 80; + public static int ExplosionRadius = 80; + public static int ExplosionCooldown = 600; + public static int RecoveringTime = 120; + + #endregion + + /// + /// The different types of animation this enemy can have. + /// + private enum AnimationState { Normal, Explosion, Shrunk } + + /// + /// The current animation being played right now. + /// + private AnimationState Animation + { + get => (AnimationState)NPC.ai[1]; + set + { + // In case an animation is being set constantly, + // so we don't have it reset to the first frame every time, + // it'll only reset the current frame when actually changing animations. + if (value != Animation) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0; + } + + NPC.ai[1] = (float)value; + + switch (value) + { + case AnimationState.Normal: + ChangeAnimation(animationFrames: 7, timePerAnimationFrame: 7, loops: true); + break; + case AnimationState.Explosion: + ChangeAnimation(animationFrames: 16, timePerAnimationFrame: 8, loops: false); + break; + case AnimationState.Shrunk: + ChangeAnimation(animationFrames: 6, timePerAnimationFrame: 6, loops: true); + break; + } + } + } + + /// + /// The amount of frames that one column of sprites has.
+ /// Defaults to 7 since that's the first column's amount of frames. + ///
+ private int _animationFrames = 7; + + /// + /// The amount, in frames, that it takes to go to the next animation frame.
+ /// Defaults to 7. + ///
+ private int _timePerAnimationFrame = 7; + + /// + /// Whether or not the animation loops or not.
+ /// Defaults to . + ///
+ private bool _animationLoop = true; + + /// + /// The squish of this NPC while drawing. + /// + private Vector2 ScaleSquish = Vector2.One; + + private Entity _avoidedEntity; + + /// + /// A timer used to know when the NPC should recover after it explodes. + /// + private ref float RecoverTimer => ref NPC.ai[2]; + + /// + /// Whether or not the Sharkoon is capable of exploding. + /// + private bool CanExplode => Animation == AnimationState.Normal; + + /// + /// Whether or not the Sharkoon is currently exploding. + /// + private bool IsExploding => CurrentBehavior == ExplodingBehavior; + + private Action _currentBehavior; + private Action CurrentBehavior + { + get => _currentBehavior; + set + { + if (value != _currentBehavior) + OnBehaviorChange(value); + _previousBehavior = _currentBehavior; + _currentBehavior = value; + } + } + + private Action _previousBehavior; + + private int HuntCooldown + { + get => (int)NPC.ai[3]; + set => NPC.ai[3] = value; + } + + #region SunkenSeaNPC Implementation + + protected override List PreyIDs => + [ + // NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + ]; + + protected override List PredatorIDs => + [ + // NPCType(), + // NPCType(), + NPCType(), + // NPCType, + ]; + + protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; + + #endregion + + #endregion + + #region SetDefaults + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + Main.npcFrameCount[Type] = 16; + } + + public override void SetDefaults() + { + base.SetDefaults(); + + BannerItem = ItemType(); + + NPC.damage = 20; + NPC.lifeMax = 350; + NPC.defense = 5; + NPC.knockBackResist = 0.15f; + NPC.chaseable = false; + + NPC.width = 52; + NPC.height = 46; + NPC.noGravity = true; + + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.value = Item.buyPrice(0, 0, 5, 0); + + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + #endregion + + #region Behavior + + protected override bool PlayerSearchFilter(Player p) + { + return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; + } + + protected override bool NPCSearchFilter(NPC n) + { + return base.NPCSearchFilter(n) || (n == CurrentPrey || n == CurrentPredator) && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; + } + + public override void OnSpawn(IEntitySource source) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.3f, + MaxSpeed = 6f, + }; + CurrentBehavior = IdlingBehavior; + NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + NPC.GravityMultiplier *= 2f; + NPC.MaxFallSpeedMultiplier *= 2f; + } + + public override void AI() + { + CurrentBehavior?.Invoke(); + + // Leans the Sharkoon towards the direction it's going. + NPC.rotation = MathHelper.ToRadians(NPC.velocity.X * 3f); + NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); + + // When it has already exploded, a timer will start, which when finished it'll make the Sharkoon recover. + if (!CanExplode) + { + RecoverTimer++; + if (RecoverTimer > ExplosionCooldown) + CurrentBehavior = RecoveringBehavior; + } + + // When it gets outside of water, it'll try to gravitate downards towards the water. + if (!NPC.wet && !IsExploding) + CurrentBehavior = OutsideWaterBehavior; + + // Reset any squish that is done to the Sharkoon. + if (ScaleSquish.Y > 1f) + ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); + } + + private void IdlingBehavior() + { + // At random, the mob will choose a random nearby point and pathfind there. + pathfinding.DoPathfinding(new(NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * 2000f, SunkenSeaTileValidity)); + } + + private void HuntingBehavior() + { + // If there's no more prey, go back to idling. + if (CurrentPrey is null) + { + CurrentBehavior = IdlingBehavior; + return; + } + + bool huntReady = HuntCooldown == 0; + if (huntReady) + HuntCooldown = Main.rand.Next(13, 30); + + // With sight, just go straight at him. Without it, try to pathfind over them. + pathfinding.DoPathfinding(new(NPC.Center, CurrentPrey.Center, SunkenSeaTileValidity), forceNewTask: huntReady); + pathfinding.CustomIdleBehavior = () => + { + if (CurrentPrey != null) + { + NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * pathfinding.Acceleration; + + // Cap the speed if MaxSpeed has been surpassed. + if (NPC.velocity.LengthSquared() > pathfinding.MaxSpeed * pathfinding.MaxSpeed) + NPC.velocity = Vector2.Normalize(NPC.velocity) * pathfinding.MaxSpeed; + } + else + NPC.velocity *= 0.95f; + }; + + HuntCooldown--; + } + + private void FleeingBehavior() + { + // Check who is the avoided entity specifically. + _avoidedEntity = _avoidedEntity is NPC ? CurrentPredator : CurrentPlayer; + + // If the avoided entity is gone, go back to idling. + if (_avoidedEntity == null) + { + CurrentBehavior = IdlingBehavior; + return; + } + + // While it doesn't have any obstacles in front of it, run away in a straight line. + // Try to manuever if there are any obstacles. + if (!Main.tile[(NPC.Center + NPC.DirectionFrom(_avoidedEntity.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) + { + NPC.velocity += NPC.DirectionFrom(_avoidedEntity.Center) * pathfinding.Acceleration; + pathfinding.ClearResults(); + + // Cap the speed if MaxSpeed has been surpassed. + if (NPC.velocity.LengthSquared() > pathfinding.MaxSpeed * pathfinding.MaxSpeed) + NPC.velocity = Vector2.Normalize(NPC.velocity) * pathfinding.MaxSpeed; + } + else + { + float distanceFromAvoided = Vector2.Distance(NPC.Center, _avoidedEntity.Center); + _randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); + NPC.netUpdate = true; + pathfinding.DoPathfinding(new(NPC.Center, _randomPathPoint, SunkenSeaTileValidity)); + } + + // If it's capable of exploding and the predator's within distance, kaboom. + if (CanExplode && NPC.DistanceSQ(_avoidedEntity.Center) < ExplosionDistance * ExplosionDistance && _avoidedEntity is NPC predator && PredatorIDs.Contains(predator.type)) + CurrentBehavior = ExplodingBehavior; + } + + private void ExplodingBehavior() + { + // Deaccelerate. + NPC.velocity *= 0.95f; + + // Produces light while exploding. + Lighting.AddLight(NPC.Center, Color.Orange.ToVector3() * Utils.GetLerpValue(NPC.height, NPC.height * 9, NPC.frame.Y, true)); + + // On the exact frame that the NPC explodes, it'll will, indeed, explode. + if (NPC.frame.Y == NPC.height * 9 && NPC.frameCounter == 0) + Kaboom(); + + // When the animation's finished, go back to being a normal fish. + if (NPC.frame.Y >= NPC.height * 16) + { + Animation = AnimationState.Shrunk; + CurrentBehavior = _previousBehavior; + } + } + + private void RecoveringBehavior() + { + if (RecoverTimer >= RecoveringTime) + { + Animation = AnimationState.Normal; + CurrentBehavior = _previousBehavior; + } + + // Deaccelerates to stay still. + NPC.velocity *= 0.95f; + + // VFX and sound effects go here, + // a dedicated server doesn't need to load these. + if (!Main.dedServ) + { + float fade = Utils.GetLerpValue(RecoveringTime, 0, RecoverTimer); + if (Main.rand.NextBool()) + { + Vector2 velOffset = RandomVelocity(50f, 20f, 70f, 0.04f); + velOffset *= Main.rand.NextFloat(15, 20) * fade; + Dust dust = Dust.NewDustPerfect(NPC.Center + velOffset * 2.5f, 267, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.8f, 0.95f)); + dust.noGravity = true; + dust.color = Color.Aqua; + } + } + + RecoverTimer++; + } + + private void OutsideWaterBehavior() + { + if (NPC.wet) + { + NPC.noGravity = true; + CurrentBehavior = _previousBehavior; + } + } + + private void OnBehaviorChange(Action newBehavior) + { + // Obviously, when it gets to the exploding behaivor, it should make the explosion animation. + if (newBehavior == ExplodingBehavior) + Animation = AnimationState.Explosion; + + // Resets the timer when it needs to use it again. + if (newBehavior == RecoveringBehavior || CurrentBehavior == RecoveringBehavior) + RecoverTimer = 0f; + + // When it gets outside of water, it'll try to gravitate downards towards the water. + if (newBehavior == OutsideWaterBehavior) + NPC.noGravity = false; + + pathfinding.MinimumPointDistance = newBehavior == HuntingBehavior ? 20f : 48f; + } + + protected override void OnPreyDetection(NPC prey) + { + // If it's not a small fish and it's not being chased by a predator, the Sharkoon may hunt. + if (CanExplode && CurrentPredator is null && !IsExploding) + { + CurrentBehavior = HuntingBehavior; + ScaleSquish.Y += 0.4f; + } + } + + protected override void OnPredatorDetection(NPC predator) + { + // If it detects a predator, time to run. + if (!IsExploding) + { + CurrentBehavior = FleeingBehavior; + _avoidedEntity = predator; + ScaleSquish.Y += 0.4f; + } + } + + protected override void OnPlayerDetection(Player player) + { + // When there's a predator, player's shouldn't matter. + if (CurrentPredator is not null && !IsExploding) + return; + + CurrentBehavior = FleeingBehavior; + _avoidedEntity = player; + ScaleSquish.Y += 0.4f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + if (CanExplode) + { + for (int i = 0; i < 4; i++) + Gore.NewGoreDirect(NPC.GetSource_Death(), NPC.Center, new Vector2(hit.HitDirection, -1f), Mod.Find($"{Name}{i + 1}").Type); + } + else + { + for (int i = 0; i < 2; i++) + Gore.NewGoreDirect(NPC.GetSource_Death(), NPC.Center, new Vector2(hit.HitDirection, -1f), Mod.Find($"{Name}Small{i + 1}").Type); + } + } + } + + public override bool CanBeHitByNPC(NPC attacker) => attacker.type != Type; + + public override void OnHitByNPC(NPC attacker) + { + if (CanExplode) + CurrentBehavior = ExplodingBehavior; + } + + public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) + { + if (CanExplode) + CurrentBehavior = ExplodingBehavior; + } + + public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) + { + if (CanExplode) + CurrentBehavior = ExplodingBehavior; + } + + private void Kaboom() + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile( + NPC.GetSource_FromThis(), + NPC.Center, + Vector2.Zero, + ProjectileType(), + NPC.damage * 10, + 10f, + ai0: NPC.whoAmI); + } + + AddScreenshakeAt(NPC.Center, 15f); + + // VFX and sound effects go here, + // a dedicated server doesn't need to load these. + if (!Main.dedServ) + { + for (int i = 0; i < 10; i++) + { + Dust dust = Dust.NewDustPerfect(NPC.Center, 278, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.9f, 1.1f)); + dust.noGravity = false; + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Orange; + } + for (int i = 0; i < 18; i++) + { + Dust dust = Dust.NewDustPerfect(NPC.Center, 267, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.9f, 1.1f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Orange; + } + for (int i = 0; i < 8; i++) + { + Vector2 randVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); + Particle smoke = new HeavySmokeParticle(NPC.Center + randVel, randVel, Color.Lerp(Color.SlateGray, Color.Black, Main.rand.NextFloat(0.2f, 0.45f)), Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); + GeneralParticleHandler.SpawnParticle(smoke); + } + SoundStyle boom = new("CalamityMod/Sounds/Custom/SharkoonBoom"); + SoundEngine.PlaySound(boom with { Volume = 0.7f, PitchVariance = 0.15f }, NPC.Center); + } + } + + #endregion + + #region Drawing & Animation + + /// + /// A quick method to change all the animation's properties. + /// + private void ChangeAnimation(int animationFrames, int timePerAnimationFrame, bool loops) + { + _animationFrames = animationFrames; + _timePerAnimationFrame = timePerAnimationFrame; + _animationLoop = loops; + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter++; + if (NPC.frameCounter > _timePerAnimationFrame) + { + NPC.frame.Y += frameHeight; + NPC.frame.Y = Math.Min(NPC.frame.Y, _animationFrames * frameHeight); + NPC.frameCounter = 0; + if (_animationLoop) + NPC.frame.Y = NPC.frame.Y % (_animationFrames * frameHeight); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 drawPosition = NPC.Center - screenPos; + Rectangle frame = texture.Frame(horizontalFrames: 3, verticalFrames: 16, frameX: (int)Animation, frameY: NPC.frame.Y / NPC.height); + Vector2 anchorPoint = frame.Size() * 0.5f; + SpriteEffects flip = NPC.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + spriteBatch.Draw(texture, drawPosition, frame, NPC.GetAlpha(drawColor), NPC.rotation, anchorPoint, ScaleSquish, flip, 0f); + + return false; + } + + #endregion + + #region Sycning + + private Vector2 _randomPathPoint; + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(_randomPathPoint); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + _randomPathPoint = reader.ReadVector2(); + } + + #endregion + } +} diff --git a/NPCs/SunkenSea/Sharkoon.png b/NPCs/SunkenSea/Sharkoon.png new file mode 100644 index 0000000000..44b0698b16 Binary files /dev/null and b/NPCs/SunkenSea/Sharkoon.png differ diff --git a/NPCs/SunkenSea/SunkenSeaNPC.cs b/NPCs/SunkenSea/SunkenSeaNPC.cs new file mode 100644 index 0000000000..7ed695128d --- /dev/null +++ b/NPCs/SunkenSea/SunkenSeaNPC.cs @@ -0,0 +1,196 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Enums; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.Utilities.NPCUtils; + +namespace CalamityMod.NPCs.SunkenSea +{ + /// + /// An abstract class that provides the necessary members for an NPC to function as a Sunken Sea NPC.
+ /// These NPCs can hunt both players and other NPCs, and maintain lists of NPCs they hunt and avoid. + ///
+ public abstract class SunkenSeaNPC : ModNPC + { + protected PathfindingManager pathfinding = null; + + private NPC _currentPrey; + private NPC _currentPredator; + private Player _currentPlayer; + + /// + /// A list of NPC IDs that this creature hunts. + /// + protected abstract List PreyIDs { get; } + + /// + /// A list of NPC IDs that this creature avoids. + /// + protected abstract List PredatorIDs { get; } + + /// + /// The biome flags that define where this Sunken Sea NPC can spawn. + /// + protected abstract SunkenSeaBiomeFlags BiomeDesignation { get; } + + /// + /// The current NPC that this creature has identified as prey. + /// + protected NPC CurrentPrey + { + get => _currentPrey; + private set + { + if (value != null && (_currentPrey == null || _currentPrey.whoAmI != value.whoAmI)) + OnPreyDetection(value); + _currentPrey = value; + } + } + + /// + /// The current NPC that this creature has identified as a predator. + /// + protected NPC CurrentPredator + { + get => _currentPredator; + private set + { + if (value != null && (_currentPredator == null || _currentPredator.whoAmI != value.whoAmI)) + OnPredatorDetection(value); + _currentPredator = value; + } + } + + /// + /// The current player that this creature has detected. + /// + protected Player CurrentPlayer + { + get => _currentPlayer; + private set + { + if (value != null && (_currentPlayer == null || _currentPlayer.whoAmI != value.whoAmI)) + OnPlayerDetection(value); + _currentPlayer = value; + } + } + + public override void SetStaticDefaults() + { + NPCID.Sets.UsesNewTargetting[Type] = true; + NPCID.Sets.TakesDamageFromHostilesWithoutBeingFriendly[Type] = true; + } + + public override void SetDefaults() + { + NPC.aiStyle = -1; + AIType = -1; + + SpawnModBiomes = Enum.GetValues() + .Where(flag => flag != SunkenSeaBiomeFlags.None && + flag != SunkenSeaBiomeFlags.UndergroundDesert && + BiomeDesignation.HasFlag(flag)) + .Select(flag => SunkenSeaBiomeCorrespondentDict.Dict[flag].BiomeType) + .ToArray(); + + Banner = Type; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + => bestiaryEntry.Info.AddRange([new FlavorTextBestiaryInfoElement($"Mods.CalamityMod.Bestiary.{Name}")]); + + public override bool PreAI() + { + UpdateTargets(); + return true; + } + + /// + /// Called when this NPC is hit by another NPC. Override this method to define custom behavior when attacked. + /// + /// The NPC that attacked this creature. + public virtual void OnHitByNPC(NPC attacker) { } + + /// + /// Called when this creature detects a prey NPC. Override this method to define custom behavior upon detecting prey. + /// + /// The NPC that has been detected as prey. + protected virtual void OnPreyDetection(NPC prey) { } + + /// + /// Called when this creature detects a predator NPC. Override this method to define custom behavior upon detecting a predator. + /// + /// The NPC that has been detected as a predator. + protected virtual void OnPredatorDetection(NPC predator) { } + + /// + /// Called when this creature detects a player. Override this method to define custom behavior upon detecting a player. + /// + /// The player that has been detected. + protected virtual void OnPlayerDetection(Player player) { } + + /// + /// Determines whether a detected player is a valid target based on specific conditions. + /// + /// The player to evaluate. + /// if the NPC is a valid target; otherwise, . + protected virtual bool PlayerSearchFilter(Player p) => NPC.HasSight(p.Center) && Vector2.DistanceSquared(NPC.Center, p.Center) < 72900f; + + /// + /// Determines whether a detected NPC is a valid target based on specific conditions. + /// + /// The NPC to evaluate. + /// if the NPC is a valid target; otherwise, . + protected virtual bool NPCSearchFilter(NPC n) => NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 72900f; + + /// + /// Updates the current targets of this creature, including prey, predators, and players, based on detection logic. + /// + protected void UpdateTargets() + { + var searchResults = SearchForTarget(NPC, playerFilter: PlayerSearchFilter, npcFilter: NPCSearchFilter); + if (searchResults.FoundTarget) + { + if (searchResults.FoundNPC) + { + if (PredatorIDs.Contains(searchResults.NearestNPC.type)) + CurrentPredator = searchResults.NearestNPC; + else + CurrentPredator = null; + + if (PreyIDs.Contains(searchResults.NearestNPC.type)) + CurrentPrey = searchResults.NearestNPC; + else + CurrentPrey = null; + } + + CurrentPlayer = searchResults.NearestTankOwner; + } + else + { + CurrentPredator = null; + CurrentPrey = null; + CurrentPlayer = null; + } + } + + /// + /// Checks whether a specific tile is valid for this NPC, considering water level and entity size. + /// + /// The tile location to check. + /// if the tile is valid; otherwise, . + protected bool SunkenSeaTileValidity(Point point) + { + Point actualFuckingPoint = new Point(point.X * 16, point.Y * 16); + return NPC.Hitbox.Contains(actualFuckingPoint) + || !NPC.GetIntersectingHitboxPoints( + actualFuckingPoint, 10, 10).Any(a => Main.tile[a].IsTileSolidGround() || Main.tile[a].LiquidAmount < 255 || Main.tile[a].LiquidType != LiquidID.Water); + } + } +} diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index 7ed262a922..adca018fa0 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -2,8 +2,6 @@ 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 Terraria; @@ -19,8 +17,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetStaticDefaults() { this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.NeedsExpertScaling[Type] = true; + Main.npcFrameCount[Type] = 6; } public override void SetDefaults() @@ -100,9 +98,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.IsABestiaryIconDummy) NPC.Opacity = 1f; - int frame = (int)Math.Round((float)Math.Pow(Math.Sin(Main.GlobalTimeWrappedHourly * 2.6f + NPC.whoAmI * 1.3f), 6D) * Main.npcFrameCount[NPC.type]); - if (frame >= Main.npcFrameCount[NPC.type]) - frame = Main.npcFrameCount[NPC.type] - 1; + int frame = (int)Math.Round((float)Math.Pow(Math.Sin(Main.GlobalTimeWrappedHourly * 2.6f + NPC.whoAmI * 1.3f), 6D) * Main.npcFrameCount[Type]); + if (frame >= Main.npcFrameCount[Type]) + frame = Main.npcFrameCount[Type] - 1; NPC.frame.Y = frame * frameHeight; } @@ -111,16 +109,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.IsABestiaryIconDummy) return true; + spriteBatch.ExitShaderRegion(); + for (int i = 0; i < ChainEndpoints.Count; i++) { - List points = new List() - { - NPC.Center, - ChainEndpoints[i] + NPC.DirectionTo(ChainEndpoints[i]) * 25f - }; + float dist = NPC.Distance(ChainEndpoints[i]); + List points = new List(); + for (int j = 0; j < 4; j++) + points.Add(NPC.Center + NPC.DirectionTo(ChainEndpoints[i]) * dist * 0.25f * j); + points.Add(ChainEndpoints[i] + NPC.DirectionTo(ChainEndpoints[i]) * 18f); + PrimitiveRenderer.RenderTrail(points, new(PrimitiveWidthFunction, PrimitiveColorFunction), 40); } - return true; } @@ -139,7 +139,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 2; i++) { @@ -157,12 +157,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas Main.instance.DrawCacheNPCsBehindNonSolidTiles.Add(index); } - public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) - { - if (projectile.type == ModContent.ProjectileType()) - modifiers.SourceDamage *= 0.66f; - } - public override bool CheckActive() => false; } } diff --git a/NPCs/SupremeCalamitas/SepulcherArm.cs b/NPCs/SupremeCalamitas/SepulcherArm.cs index 4c7d0be1fa..ecc059ac8c 100644 --- a/NPCs/SupremeCalamitas/SepulcherArm.cs +++ b/NPCs/SupremeCalamitas/SepulcherArm.cs @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor_Unused) { - Texture2D armTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D armTexture = TextureAssets.Npc[Type].Value; Texture2D foreArmTexture = ForearmTexture.Value; Texture2D handTexture = HandTexture.Value; @@ -207,7 +207,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 forearmGoreSpawnPosition = Limbs[0].Center + Main.rand.NextVector2Circular(6f, 6f); Vector2 armGoreSpawnPosition = Limbs[1].Center + Main.rand.NextVector2Circular(6f, 6f); diff --git a/NPCs/SupremeCalamitas/SepulcherBody.cs b/NPCs/SupremeCalamitas/SepulcherBody.cs index b5f478fe6e..8ddb81bec1 100644 --- a/NPCs/SupremeCalamitas/SepulcherBody.cs +++ b/NPCs/SupremeCalamitas/SepulcherBody.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SupremeCalamitas { + [LongDistanceNetSync(SyncWith = typeof(SepulcherHead))] public class SepulcherBody : ModNPC { private bool setAlpha = false; @@ -123,17 +124,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - 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)); + Texture2D texture2D15 = NPC.localAI[3] / 2f % 2f == 0f ? AltTexture.Value : TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; 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); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, SpriteEffects.None, 0f); return false; } @@ -147,7 +144,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int variant = (int)(NPC.localAI[3] / 2f % 2f); if (variant == 0) diff --git a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs index 86b4d8ba2b..32fd48411e 100644 --- a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs +++ b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetStaticDefaults() { this.HideFromBestiary(); - Main.npcFrameCount[NPC.type] = 5; + Main.npcFrameCount[Type] = 5; } public override void SetDefaults() @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void FindFrame(int frameHeight) { NPC.frameCounter++; - NPC.frame.Y = ((int)(NPC.frameCounter / 5) + NPC.whoAmI) % Main.npcFrameCount[NPC.type] * frameHeight; + NPC.frame.Y = ((int)(NPC.frameCounter / 5) + NPC.whoAmI) % Main.npcFrameCount[Type] * frameHeight; } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/SupremeCalamitas/SepulcherHead.cs b/NPCs/SupremeCalamitas/SepulcherHead.cs index f2497fa630..244db411f1 100644 --- a/NPCs/SupremeCalamitas/SepulcherHead.cs +++ b/NPCs/SupremeCalamitas/SepulcherHead.cs @@ -16,6 +16,7 @@ using static Humanizer.In; namespace CalamityMod.NPCs.SupremeCalamitas { + [LongDistanceNetSync] public class SepulcherHead : ModNPC { public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/SepulcherDeath"); @@ -73,6 +74,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { + new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), // Gives black background new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Sepulcher") }); } @@ -168,7 +170,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } TailSpawned = true; } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) { NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -365,17 +367,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.IsABestiaryIconDummy) NPC.Opacity = 1f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; 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); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, SpriteEffects.None, 0f); return false; } @@ -395,7 +393,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 3; i++) { diff --git a/NPCs/SupremeCalamitas/SepulcherTail.cs b/NPCs/SupremeCalamitas/SepulcherTail.cs index d738106b33..c1610e2aa9 100644 --- a/NPCs/SupremeCalamitas/SepulcherTail.cs +++ b/NPCs/SupremeCalamitas/SepulcherTail.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SupremeCalamitas { + [LongDistanceNetSync(SyncWith = typeof(SepulcherHead))] public class SepulcherTail : ModNPC { private bool setAlpha = false; @@ -157,17 +158,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = 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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; 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); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, SpriteEffects.None, 0f); return false; } @@ -182,7 +179,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 2; i++) { diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index f3b693f785..ce3a029a3b 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -36,9 +36,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 6; + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -79,6 +79,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { + new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), // Gives black background new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SoulSeekerSupreme") }); } @@ -95,10 +96,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void FindFrame(int frameHeight) { + if (start) + { + NPC.frame.Y = Main.rand.Next(0, 5 + 1) * frameHeight; + start = false; + } + NPC.frameCounter++; if (NPC.frameCounter % 5 == 4) NPC.frame.Y += frameHeight; - if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type]) + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type]) NPC.frame.Y = 0; } @@ -119,7 +126,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 10; i++) Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); RotationalDegreeOffset = NPC.ai[0]; - start = false; } // Increase DR if the target leaves SCal's arena. @@ -206,6 +212,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float distanceFromSCal = Main.getGoodWorld ? 300f : 225f; NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * distanceFromSCal - NPC.Size * 0.5f; + NPC.velocity = Vector2.Zero; RotationalDegreeOffset += 0.5f; } @@ -245,7 +252,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Main.dust[brimDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 5; i++) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find($"SupremeSoulSeeker_Gore{i}").Type, NPC.scale); @@ -261,11 +268,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].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)); + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); int afterimageAmt = 2; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -274,21 +281,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; 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 = GlowTexture.Value; Color redLerp = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -296,7 +303,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas redAfterimageColor = Color.Lerp(redAfterimageColor, Color.White, 0.5f); redAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 redAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - redAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + redAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; redAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, redAfterimagePos, NPC.frame, redAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 0a349f4664..9b61f820d5 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -45,6 +45,7 @@ using CalamityMod.Projectiles.Ranged; using Steamworks; using CalamityMod.Particles; using Terraria.Utilities.Terraria.Utilities; +using CalamityMod.Systems.Collections; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -226,30 +227,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas public static Asset ForcefieldTexture; // TODO -- This is cumbersome. Change it to be better in 1.4. - internal static void LoadHeadIcons() + public override void Load() { string hoodedIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; string hoodlessIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon"; string cirrusIconPath = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon"; string cirrusIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon2"; - - CalamityMod.Instance.AddBossHeadTexture(hoodedIconPath, -1); - hoodedHeadIconIndex = ModContent.GetModBossHeadSlot(hoodedIconPath); - - CalamityMod.Instance.AddBossHeadTexture(hoodlessIconPath, -1); - hoodlessHeadIconIndex = ModContent.GetModBossHeadSlot(hoodlessIconPath); - - CalamityMod.Instance.AddBossHeadTexture(cirrusIconPath, -1); - cirrusHeadIconIndex = ModContent.GetModBossHeadSlot(cirrusIconPath); - - CalamityMod.Instance.AddBossHeadTexture(cirrusIconP2Path, -1); - cirrusHeadIconP2Index = ModContent.GetModBossHeadSlot(cirrusIconP2Path); + + hoodedHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(hoodedIconPath, -1); + hoodlessHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(hoodlessIconPath, -1); + cirrusHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(cirrusIconPath, -1); + cirrusHeadIconP2Index = CalamityMod.Instance.AddBossHeadTexture(cirrusIconP2Path, -1); } public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 21; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 21; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -276,7 +270,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.width = NPC.height = 44; NPC.defense = 100; NPC.DR_NERD(normalDR); - NPC.value = Item.buyPrice(30, 0, 0, 0); + NPC.value = Item.buyPrice(3, 0, 0, 0); NPC.LifeMaxNERB(960000, 1150000, 900000); NPC.aiStyle = -1; AIType = -1; @@ -298,6 +292,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { + new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), // Gives black background new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SupremeCalamitas") }); } @@ -456,8 +451,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas CalamityNetcode.SyncWorld(); } - if (CalamityConfig.Instance.BossesStopWeather) - CalamityMod.StopRain(); + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; @@ -673,7 +668,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Main.tile[i + xoffset, j + yoffset].TileType = (ushort)ModContent.TileType(); Main.tile[i + xoffset, j + yoffset].Get().HasTile = true; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i + xoffset, j + yoffset, 1, TileChangeType.None); } @@ -700,7 +695,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region Enrage and DR if ((spawnArena && !player.Hitbox.Intersects(safeBox)) || bossRush) { - float projectileVelocityMultCap = (!player.Hitbox.Intersects(safeBox) && spawnArena) ? 2f : 1.5f; + float projectileVelocityMultCap = (!player.Hitbox.Intersects(safeBox) && spawnArena) ? 2f : 1.35f; uDieLul = MathHelper.Clamp(uDieLul * 1.01f, 1f, projectileVelocityMultCap); protectionBoost = !bossRush; if (!player.Hitbox.Intersects(safeBox)) @@ -799,7 +794,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Make the town NPC spawn. if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); } NPC.active = false; @@ -1618,7 +1613,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { int buffID = NPC.buffType[l]; - bool shouldHalveDuration = CalamityLists.debuffList.Contains(buffID); + bool shouldHalveDuration = DebuffsList.Includes(buffID); if (shouldHalveDuration && NPC.buffTime[l] > 4) NPC.buffTime[l] = 4; @@ -1723,10 +1718,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) NPC.velocity.X *= 0.965f; - if (DownedBossSystem.downedCalamitas && !bossRush) + if (DownedBossSystem.downedCalamitas || bossRush) { if (giveUpCounter == 720) { + 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); @@ -1757,13 +1759,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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); @@ -3452,7 +3447,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Spawn the SCal NPC directly where the boss was if (!BossRushEvent.BossRushActive) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); // Mark Calamitas as defeated DownedBossSystem.downedCalamitas = true; @@ -3615,24 +3610,24 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[NPC.type].Value : HoodedTexture.Value; + Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.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 ? CirrusTexture2.Value : CirrusTexture.Value; - Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2f); + Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[Type] / 2f); Vector2 ponyOrigin = new Vector2(pony.Width / 2f, pony.Height / 30f); int afterimageAmt = 7; - Rectangle frame = texture2D15.Frame(2, Main.npcFrameCount[NPC.type], NPC.frame.Y / Main.npcFrameCount[NPC.type], NPC.frame.Y % Main.npcFrameCount[NPC.type]); + Rectangle frame = texture2D15.Frame(2, Main.npcFrameCount[Type], NPC.frame.Y / Main.npcFrameCount[Type], NPC.frame.Y % Main.npcFrameCount[Type]); Rectangle ponyFrame = pony.Frame(1, 15, 0, alicornFrame); Vector2 ponyPos = NPC.Center - screenPos; ponyPos -= new Vector2(pony.Width / 2f, pony.Height / 15) * NPC.scale / 2f; ponyPos += ponyOrigin * NPC.scale + new Vector2(-20, NPC.gfxOffY); - if (CalamityConfig.Instance.Afterimages && !(cirrus && NPC.ai[1] == 2f)) + if (CalamityClientConfig.Instance.Afterimages && !(cirrus && NPC.ai[1] == 2f)) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -3641,14 +3636,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, afterimagePos, frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); if (!(cirrus && NPC.ai[1] == 2f)) @@ -3884,7 +3879,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); break; case 5: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); + target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); break; case 6: target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index dfe67d8368..f20fb06bb9 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -3,8 +3,6 @@ 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; @@ -17,7 +15,6 @@ using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -48,6 +45,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public bool setMovement = true; public bool broIsAlive = true; + public bool isDeathmode = (CalamityWorld.death || BossRushEvent.BossRushActive); + public Player Target => Main.player[NPC.target]; public ref float PunchCounter => ref NPC.ai[1]; public ref float DartBurstCounter => ref NPC.ai[2]; @@ -59,9 +58,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 9; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 9; + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -107,8 +106,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { + new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), // Gives black background new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SupremeCataclysm") - }); + }); } public override void SendExtraAI(BinaryWriter writer) @@ -138,8 +138,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas CurrentFrame = (int)Math.Round(MathHelper.Lerp(12f, 21f, punchInterpolant)); } - int xFrame = CurrentFrame / Main.npcFrameCount[NPC.type]; - int yFrame = CurrentFrame % Main.npcFrameCount[NPC.type]; + int xFrame = CurrentFrame / Main.npcFrameCount[Type]; + int yFrame = CurrentFrame % Main.npcFrameCount[Type]; NPC.frame.Width = 212; NPC.frame.Height = 208; @@ -174,7 +174,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } NPC scal = Main.npc[CalamityGlobalNPC.SCal]; - if (scal.ModNPC().respawnBro == false && Main.masterMode && !broIsAlive) + if (scal.ModNPC().respawnBro == false && isDeathmode && !broIsAlive) { if (NPC.life > (NPC.lifeMax * 0.65f)) NPC.life = (int)(NPC.lifeMax * 0.65f); @@ -471,11 +471,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Vector2 origin = NPC.frame.Size() * 0.5f; int afterimageCount = 4; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i += 2) { @@ -492,7 +492,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i++) { @@ -553,7 +553,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.AnyNPCs(ModContent.NPCType())) { NPC scal = Main.npc[CalamityGlobalNPC.SCal]; - if (scal.ModNPC().respawnBro == true && Main.masterMode && !broIsAlive) + if (scal.ModNPC().respawnBro == true && isDeathmode && !broIsAlive) { for (int i = 0; i < 45; i++) { @@ -576,7 +576,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - DeathAshParticle.CreateAshesFromNPC(NPC); + DeathAshParticle.CreateAshesFromNPC(NPC, Vector2.Zero); } } } diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 60631d4c6e..596c9706a8 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -6,7 +6,6 @@ using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -16,7 +15,6 @@ using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using static Humanizer.In; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -47,13 +45,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas public ref float AttackDelayTimer => ref NPC.localAI[0]; public ref float BigAttackTimer => ref NPC.localAI[1]; + public bool isDeathmode = (CalamityWorld.death || BossRushEvent.BossRushActive); + public static Asset GlowTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 8; - NPCID.Sets.NeedsExpertScaling[NPC.type] = true; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 8; + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -99,6 +99,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { + new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), // Gives black background new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SupremeCatastrophe") }); } @@ -131,8 +132,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas CurrentFrame = (int)Math.Round(MathHelper.Lerp(6f, 15f, slashInterpolant)); } - int xFrame = CurrentFrame / Main.npcFrameCount[NPC.type]; - int yFrame = CurrentFrame % Main.npcFrameCount[NPC.type]; + int xFrame = CurrentFrame / Main.npcFrameCount[Type]; + int yFrame = CurrentFrame % Main.npcFrameCount[Type]; NPC.frame.Width = 400; NPC.frame.Height = 230; @@ -167,7 +168,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } NPC scal = Main.npc[CalamityGlobalNPC.SCal]; - if (scal.ModNPC().respawnBro == false && Main.masterMode && !broIsAlive) + if (scal.ModNPC().respawnBro == false && isDeathmode && !broIsAlive) { if (NPC.life > (NPC.lifeMax * 0.65f)) NPC.life = (int)(NPC.lifeMax * 0.65f); @@ -507,11 +508,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[Type].Value; Vector2 origin = NPC.frame.Size() * 0.5f; int afterimageCount = 4; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i += 2) { @@ -527,7 +528,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas texture = GlowTexture.Value; Color baseGlowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.35f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i++) { @@ -588,7 +589,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.AnyNPCs(ModContent.NPCType())) { NPC scal = Main.npc[CalamityGlobalNPC.SCal]; - if (scal.ModNPC().respawnBro == true && Main.masterMode && !broIsAlive) + if (scal.ModNPC().respawnBro == true && isDeathmode && !broIsAlive) { for (int i = 0; i < 45; i++) { @@ -611,7 +612,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - DeathAshParticle.CreateAshesFromNPC(NPC); + DeathAshParticle.CreateAshesFromNPC(NPC, Vector2.Zero); } } } diff --git a/NPCs/TownNPCs/AndroombaFriendly.cs b/NPCs/TownNPCs/AndroombaFriendly.cs index a1c3038966..0a62a3a2f0 100644 --- a/NPCs/TownNPCs/AndroombaFriendly.cs +++ b/NPCs/TownNPCs/AndroombaFriendly.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; +using CalamityMod.Packets; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -23,8 +24,8 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 9; - Main.npcCatchable[NPC.type] = true; + Main.npcFrameCount[Type] = 9; + Main.npcCatchable[Type] = true; NPCID.Sets.NoTownNPCHappiness[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 16; @@ -166,11 +167,7 @@ namespace CalamityMod.NPCs.TownNPCs } else { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncAndroombaAI); - netMessage.Write(NPC.whoAmI); - netMessage.Write(phase); - netMessage.Send(); + SyncAndroombaAIPacket.Send(this, phase: phase); } } @@ -184,7 +181,7 @@ namespace CalamityMod.NPCs.TownNPCs npc.ai[0] = phase; npc.ai[1] = 0; npc.netUpdate = true; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, index); } @@ -197,7 +194,7 @@ namespace CalamityMod.NPCs.TownNPCs npc.ai[3] = solutionType; npc.netUpdate = true; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, index); } @@ -259,7 +256,7 @@ namespace CalamityMod.NPCs.TownNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D critterTexture = TextureAssets.Npc[Type].Value; 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) diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/Archmage.cs similarity index 88% rename from NPCs/TownNPCs/DILF.cs rename to NPCs/TownNPCs/Archmage.cs index 9b2de8371c..1be98d5a41 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/Archmage.cs @@ -11,6 +11,8 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; @@ -23,17 +25,18 @@ using Terraria.Utilities; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class DILF : ModNPC + [LegacyName("DILF")] + public class Archmage : ModNPC { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 25; - NPCID.Sets.ExtraFramesCount[NPC.type] = 9; - NPCID.Sets.AttackFrameCount[NPC.type] = 4; - NPCID.Sets.DangerDetectRange[NPC.type] = 700; - NPCID.Sets.AttackType[NPC.type] = 0; - NPCID.Sets.AttackTime[NPC.type] = 90; - NPCID.Sets.AttackAverageChance[NPC.type] = 30; + Main.npcFrameCount[Type] = 25; + NPCID.Sets.ExtraFramesCount[Type] = 9; + NPCID.Sets.AttackFrameCount[Type] = 4; + NPCID.Sets.DangerDetectRange[Type] = 700; + NPCID.Sets.AttackType[Type] = 0; + NPCID.Sets.AttackTime[Type] = 90; + NPCID.Sets.AttackAverageChance[Type] = 30; NPCID.Sets.ShimmerTownTransform[Type] = false; NPC.Happiness .SetBiomeAffection(AffectionLevel.Like) @@ -69,7 +72,7 @@ namespace CalamityMod.NPCs.TownNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DILF") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Archmage") }); } @@ -96,7 +99,7 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); - if (Main.dayTime && !Main.player[Main.myPlayer].ZoneSnow) + if (Main.dayTime && !Main.LocalPlayer.ZoneSnow) { dialogue.Add(this.GetLocalizedValue("Chat.Day1")); dialogue.Add(this.GetLocalizedValue("Chat.Day2")); @@ -125,6 +128,8 @@ namespace CalamityMod.NPCs.TownNPCs return dialogue; } + public override void PartyHatPosition(ref Vector2 position, ref SpriteEffects spriteEffects) => position.X -= 5f * NPC.direction; + public override void SetChatButtons(ref string button, ref string button2) { button = Language.GetTextValue("LegacyInterface.28"); @@ -140,7 +145,6 @@ namespace CalamityMod.NPCs.TownNPCs public override void AddShops() { - Condition potionSells = CalamityConditions.PotionSellingConfig; NPCShop shop = new(Type); shop.Add(ModContent.ItemType()) .Add(ModContent.ItemType()) @@ -158,9 +162,9 @@ namespace CalamityMod.NPCs.TownNPCs .Add(ItemID.SuperManaPotion) .Add(ModContent.ItemType()) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(5)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(5)) + .Add(ModContent.ItemType()) .Add(ModContent.ItemType(), Condition.PlayerCarriesItem(ModContent.ItemType())) - .Add(ItemID.IceCream, Condition.HappyEnough, Condition.InSnow) + .Add(ItemID.IceCream, Condition.HappyEnoughToSellPylons, Condition.InSnow) .Register(); } @@ -169,14 +173,14 @@ namespace CalamityMod.NPCs.TownNPCs public override void TownNPCAttackStrength(ref int damage, ref float knockback) { - damage = 20; + damage = 150; knockback = 9f; } public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) { - cooldown = 10; - randExtraCooldown = 50; + cooldown = 30; + randExtraCooldown = 15; } public override void TownNPCAttackProj(ref int projType, ref int attackDelay) diff --git a/NPCs/TownNPCs/DILF.png b/NPCs/TownNPCs/Archmage.png similarity index 100% rename from NPCs/TownNPCs/DILF.png rename to NPCs/TownNPCs/Archmage.png diff --git a/NPCs/TownNPCs/DILF_Head.png b/NPCs/TownNPCs/Archmage_Head.png similarity index 100% rename from NPCs/TownNPCs/DILF_Head.png rename to NPCs/TownNPCs/Archmage_Head.png diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/Bandit.cs similarity index 82% rename from NPCs/TownNPCs/THIEF.cs rename to NPCs/TownNPCs/Bandit.cs index ff591a3aea..b102150c3c 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -3,6 +3,7 @@ using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Pets; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Packets; using CalamityMod.Projectiles.Rogue; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -10,6 +11,7 @@ using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; @@ -22,19 +24,20 @@ using Terraria.Utilities; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class THIEF : ModNPC + [LegacyName("THIEF")] + public class Bandit : ModNPC { public static Asset AltTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 23; - NPCID.Sets.ExtraFramesCount[NPC.type] = 9; - NPCID.Sets.AttackFrameCount[NPC.type] = 4; - NPCID.Sets.DangerDetectRange[NPC.type] = 500; - NPCID.Sets.AttackType[NPC.type] = 0; - NPCID.Sets.AttackTime[NPC.type] = 60; - NPCID.Sets.AttackAverageChance[NPC.type] = 10; + Main.npcFrameCount[Type] = 23; + NPCID.Sets.ExtraFramesCount[Type] = 9; + NPCID.Sets.AttackFrameCount[Type] = 4; + NPCID.Sets.DangerDetectRange[Type] = 500; + NPCID.Sets.AttackType[Type] = 0; + NPCID.Sets.AttackTime[Type] = 60; + NPCID.Sets.AttackAverageChance[Type] = 10; NPCID.Sets.ShimmerTownTransform[Type] = false; NPC.Happiness .SetBiomeAffection(AffectionLevel.Like) @@ -74,7 +77,7 @@ namespace CalamityMod.NPCs.TownNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.THIEF") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bandit") }); } @@ -154,12 +157,12 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalizedValue("Chat.Night2")); } - int witch = NPC.FindFirstNPC(ModContent.NPCType()); + int witch = NPC.FindFirstNPC(ModContent.NPCType()); if (witch != -1) dialogue.Add(this.GetLocalization("Chat.BrimstoneWitch").Format(Main.npc[witch].GivenName)); //please help me I'm stuck in a children's video game - Fabsol - int cirrusIndex = NPC.FindFirstNPC(ModContent.NPCType()); + int cirrusIndex = NPC.FindFirstNPC(ModContent.NPCType()); if (cirrusIndex != -1) dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrusIndex].GivenName)); @@ -217,20 +220,23 @@ namespace CalamityMod.NPCs.TownNPCs int goblinIndex = NPC.FindFirstNPC(NPCID.GoblinTinkerer); if (goblinIndex != -1 && CalamityWorld.Reforges >= 1) { - CalamityWorld.Reforges = 0; - int[] coinCounts = Utils.CoinsSplit(CalamityWorld.MoneyStolenByBandit); - if (coinCounts[0] > 0) - Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.CopperCoin, coinCounts[0]); - if (coinCounts[1] > 0) - Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.SilverCoin, coinCounts[1]); - if (coinCounts[2] > 0) - Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.GoldCoin, coinCounts[2]); - if (coinCounts[3] > 0) - Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.PlatinumCoin, coinCounts[3]); + if (Main.netMode == NetmodeID.SinglePlayer) + { + DoRefund(bandit: NPC); + } + else if (Main.netMode == NetmodeID.MultiplayerClient) + { + // Possible Bug here: Minor text bug when two players send request this simultaneously + // Which result to both player to have successful message but only one request got accepted on server + // But since this is how base gamecode works theres no way to fix this clean way (Unless someone implement net queued response for NPC dialog) + // And as this does not duplicate the coin amount, It's not that bad I think...? + // + // Other way possible is to having bandit stolen inventory per player + // But I didn't wanted to change system too much + WantToRefundReforgesPacket.Send(); + } - CalamityWorld.MoneyStolenByBandit = 0; SoundEngine.PlaySound(SoundID.Coins); // Money dink sound - CalamityNetcode.SyncWorld(); switch (Main.rand.Next(2)) { case 0: @@ -242,13 +248,36 @@ namespace CalamityMod.NPCs.TownNPCs return this.GetLocalizedValue("NoRefund"); } + public static void DoRefund(NPC bandit) + { + if (bandit == null) + return; + + if (CalamityWorld.Reforges <= 0) + return; + + int[] coinCounts = Utils.CoinsSplit(CalamityWorld.MoneyStolenByBandit); + if (coinCounts[0] > 0) + Item.NewItem(new EntitySource_Gift(bandit), bandit.Hitbox, ItemID.CopperCoin, coinCounts[0]); + if (coinCounts[1] > 0) + Item.NewItem(new EntitySource_Gift(bandit), bandit.Hitbox, ItemID.SilverCoin, coinCounts[1]); + if (coinCounts[2] > 0) + Item.NewItem(new EntitySource_Gift(bandit), bandit.Hitbox, ItemID.GoldCoin, coinCounts[2]); + if (coinCounts[3] > 0) + Item.NewItem(new EntitySource_Gift(bandit), bandit.Hitbox, ItemID.PlatinumCoin, coinCounts[3]); + + CalamityWorld.MoneyStolenByBandit = 0; + CalamityWorld.Reforges = 0; + CalamityNetcode.SyncWorld(); + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (Main.LocalPlayer.Calamity().trippy) return false; var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.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; } @@ -271,7 +300,6 @@ namespace CalamityMod.NPCs.TownNPCs } public override void AddShops() { - Condition potionSells = CalamityConditions.PotionSellingConfig; Condition downedCalclone = CalamityConditions.DownedCalamitasClone; Condition downedDoG = CalamityConditions.DownedDevourerOfGods; Condition downedYharon = CalamityConditions.DownedYharon; @@ -279,16 +307,12 @@ namespace CalamityMod.NPCs.TownNPCs NPCShop shop = new(Type); shop.AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 9)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 9)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 9)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 40)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 40)) .Add(ItemID.TigerClimbingGear) - .AddWithCustomValue(ItemID.InvisibilityPotion, Item.buyPrice(silver: 25), potionSells, Condition.HappyEnough) - .AddWithCustomValue(ItemID.NightOwlPotion, Item.buyPrice(silver: 25), potionSells, Condition.HappyEnough) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 25)) .Add(ModContent.ItemType(), Condition.DownedPirates) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 60), Condition.DownedMechBossAll) .Add(ModContent.ItemType(), downedCalclone) - .Add(ModContent.ItemType(), Condition.DownedPlantera) .Add(ModContent.ItemType(), Condition.DownedPlantera) .Add(ModContent.ItemType(), Condition.DownedPlantera) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(1), Condition.DownedGolem) @@ -303,7 +327,7 @@ namespace CalamityMod.NPCs.TownNPCs { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bandit").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bandit2").Type, 1f); @@ -324,8 +348,8 @@ namespace CalamityMod.NPCs.TownNPCs public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) { - cooldown = 180; - randExtraCooldown = 60; + cooldown = 90; + randExtraCooldown = 15; } public override void TownNPCAttackProj(ref int projType, ref int attackDelay) diff --git a/NPCs/TownNPCs/THIEF.png b/NPCs/TownNPCs/Bandit.png similarity index 100% rename from NPCs/TownNPCs/THIEF.png rename to NPCs/TownNPCs/Bandit.png diff --git a/NPCs/TownNPCs/THIEFAlt.png b/NPCs/TownNPCs/BanditAlt.png similarity index 100% rename from NPCs/TownNPCs/THIEFAlt.png rename to NPCs/TownNPCs/BanditAlt.png diff --git a/NPCs/TownNPCs/THIEF_Head.png b/NPCs/TownNPCs/Bandit_Head.png similarity index 100% rename from NPCs/TownNPCs/THIEF_Head.png rename to NPCs/TownNPCs/Bandit_Head.png diff --git a/NPCs/TownNPCs/BrimstoneWitch.cs b/NPCs/TownNPCs/BrimstoneWitch.cs new file mode 100644 index 0000000000..29717bcce1 --- /dev/null +++ b/NPCs/TownNPCs/BrimstoneWitch.cs @@ -0,0 +1,780 @@ +using System; +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 Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.Events; +using Terraria.GameContent.Personalities; +using Terraria.GameContent.UI; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; +using static Terraria.ModLoader.ModContent; +using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; + +namespace CalamityMod.NPCs.TownNPCs +{ + [AutoloadHead] + [LegacyName("WITCH")] + public class BrimstoneWitch : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 27; + NPCID.Sets.ExtraFramesCount[Type] = 11; + NPCID.Sets.AttackFrameCount[Type] = 6; + NPCID.Sets.DangerDetectRange[Type] = 700; + NPCID.Sets.AttackType[Type] = 1; + NPCID.Sets.AttackTime[Type] = 30; + NPCID.Sets.AttackAverageChance[Type] = 5; + NPCID.Sets.ShimmerTownTransform[Type] = false; + NPC.Happiness + .SetBiomeAffection(AffectionLevel.Like) + .SetBiomeAffection(AffectionLevel.Dislike) + .SetNPCAffection(NPCID.Clothier, AffectionLevel.Like) + .SetNPCAffection(NPCID.PartyGirl, AffectionLevel.Dislike); + 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() + { + NPC.townNPC = true; + NPC.friendly = true; + NPC.lavaImmune = true; + NPC.width = 18; + NPC.height = 40; + NPC.aiStyle = NPCAIStyleID.Passive; + NPC.damage = 10; + NPC.gfxOffY = -2f; + + // You should not be able to kill SCal under any typical circumstances. + NPC.lifeMax = 960000; + + NPC.defense = 120; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.knockBackResist = 0.8f; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BrimstoneWitch") + }); + } + + public override bool CanTownNPCSpawn(int numTownNPCs) => DownedBossSystem.downedCalamitas && !NPC.AnyNPCs(NPCType()); + + public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Calamitas") }; + + public override void FindFrame(int frameHeight) + { + int extraFrameAmt = (NPC.isLikeATownNPC ? NPCID.Sets.ExtraFramesCount[Type] : 0); + if (NPC.velocity.Y == 0f) + { + if (NPC.direction == 1) + NPC.spriteDirection = 1; + + if (NPC.direction == -1) + NPC.spriteDirection = -1; + + int nonAttackFrames = Main.npcFrameCount[Type] - NPCID.Sets.AttackFrameCount[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[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[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[Type] - extraFrameAmt) + NPC.frame.Y = walkFrameHeightLimit; + } + + return; + } + + NPC.frameCounter = 0D; + NPC.frame.Y = frameHeight; + } + + // 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 + // to the RNG via dialogue.Add("text", weight); + // Text can always appear assuming the weight is greater than 0 and there's no if condition deciding whether it can. + // The higher the weight is, the more likely it is to be selected from all the choices. + // To give an example of this, assume you have two possibilities: + // "a" with a weight of 1, and "b" with a weight of 5. The chance of "a" being displayed would be + // 1/6, while "b" wold have a 5/6 chance of being displayed. + // If only one possibility exists it will be the only thing that is displayed, regardless of weight. + public override string GetChat() + { + WeightedRandom dialogue = new WeightedRandom(); + + // Have a flat chance (1/4444) to simply ignore the below selection and say something humorous instead. + if (Main.rand.NextBool(4444)) + return this.GetLocalizedValue("Chat.EasterEgg"); + + if (NPC.homeless) + return this.GetLocalizedValue("Chat.Homeless" + Main.rand.Next(1, 2 + 1)); + + dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal4")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal5")); + + if (!Main.dayTime) + { + if (Main.bloodMoon) + { + dialogue.Add(this.GetLocalizedValue("Chat.BloodMoon1"), 5.15); + dialogue.Add(this.GetLocalizedValue("Chat.BloodMoon2"), 5.15); + } + else + { + dialogue.Add(this.GetLocalizedValue("Chat.Night1"), 2.8); + dialogue.Add(this.GetLocalizedValue("Chat.Night2"), 2.8); + } + } + + int cirrus = NPC.FindFirstNPC(NPCType()); + if (cirrus != -1 && ChildSafety.Disabled) + dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrus].GivenName), 1.45); + + if (NPC.AnyNPCs(NPCType())) + dialogue.Add(this.GetLocalizedValue("Chat.SeaKing"), 1.45); + + if (BirthdayParty.PartyIsUp) + dialogue.Add(this.GetLocalizedValue("Chat.Party"), 5.5); + + return dialogue; + } + + public override void SetChatButtons(ref string button, ref string button2) => button = this.GetLocalizedValue("EnchantButton"); + + public override void OnChatButtonClicked(bool firstButton, ref string shopName) + { + if (firstButton) + { + Main.playerInventory = true; + CalamitasEnchantUI.NPCIndex = NPC.whoAmI; + CalamitasEnchantUI.CurrentlyViewing = true; + + if (!Main.LocalPlayer.Calamity().GivenBrimstoneLocus) + { + Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemType()); + Main.LocalPlayer.Calamity().GivenBrimstoneLocus = true; + } + } + } + + // Make this Town NPC teleport to the Queen statue when triggered. + public override bool CanGoToStatue(bool toKingStatue) => !toKingStatue; + + public override void TownNPCAttackStrength(ref int damage, ref float knockback) + { + damage = 300; + knockback = 10f; + } + + public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) + { + cooldown = 10; + randExtraCooldown = 15; + } + + public override bool PreAI() + { + // Disappear if the SCal boss is active. She's supposed to be the boss. + // However, this doesn't happen in Boss Rush; the SCal there is a silent puppet created by Xeroc, not SCal herself. + if (NPC.AnyNPCs(NPCType()) && !BossRushEvent.BossRushActive) + { + NPC.active = false; + NPC.netUpdate = true; + return false; + } + return true; + } + + //public override void TownNPCAttackMagic(ref float auraLightMultiplier) + + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + { + projType = ProjectileType(); + attackDelay = 1; + } + + public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) + { + multiplier = 2f; + } + + // Explode into red dust on death. + public override void HitEffect(NPC.HitInfo hit) + { + if (NPC.life <= 0) + { + NPC.position = NPC.Center; + NPC.width = NPC.height = 50; + NPC.position.X -= NPC.width / 2; + NPC.position.Y -= NPC.height / 2; + for (int i = 0; i < 5; i++) + { + int brimstone = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimstone].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[brimstone].scale = 0.5f; + Main.dust[brimstone].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + + for (int i = 0; i < 10; i++) + { + int fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + + fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/TownNPCs/BrimstoneWitch.png b/NPCs/TownNPCs/BrimstoneWitch.png new file mode 100644 index 0000000000..9c0c8c8b18 Binary files /dev/null and b/NPCs/TownNPCs/BrimstoneWitch.png differ diff --git a/NPCs/TownNPCs/BrimstoneWitch_Head.png b/NPCs/TownNPCs/BrimstoneWitch_Head.png new file mode 100644 index 0000000000..031bd7ac2f Binary files /dev/null and b/NPCs/TownNPCs/BrimstoneWitch_Head.png differ diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/Cirrus.cs similarity index 82% rename from NPCs/TownNPCs/FAP.cs rename to NPCs/TownNPCs/Cirrus.cs index df48e4ee91..4b0de8366a 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/Cirrus.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -27,20 +28,22 @@ using Terraria.Utilities; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class FAP : ModNPC + [LegacyName("FAP")] + public class Cirrus : ModNPC { public static Asset AltTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 27; - NPCID.Sets.ExtraFramesCount[NPC.type] = 9; - NPCID.Sets.AttackFrameCount[NPC.type] = 4; - NPCID.Sets.DangerDetectRange[NPC.type] = 400; - NPCID.Sets.AttackType[NPC.type] = 0; - NPCID.Sets.AttackTime[NPC.type] = 60; - NPCID.Sets.AttackAverageChance[NPC.type] = 15; + Main.npcFrameCount[Type] = 27; + NPCID.Sets.ExtraFramesCount[Type] = 9; + NPCID.Sets.AttackFrameCount[Type] = 4; + NPCID.Sets.DangerDetectRange[Type] = 400; + NPCID.Sets.AttackType[Type] = 0; + NPCID.Sets.AttackTime[Type] = 60; + NPCID.Sets.AttackAverageChance[Type] = 15; NPCID.Sets.ShimmerTownTransform[Type] = false; + // Happiness is so fucking dogshit, I swear to christ. - Fabsol NPC.Happiness .SetBiomeAffection(AffectionLevel.Love) .SetBiomeAffection(AffectionLevel.Like) @@ -48,7 +51,7 @@ namespace CalamityMod.NPCs.TownNPCs .SetBiomeAffection(AffectionLevel.Hate) .SetNPCAffection(NPCID.Stylist, AffectionLevel.Love) .SetNPCAffection(NPCID.BestiaryGirl, AffectionLevel.Love) - .SetNPCAffection(NPCID.Truffle, AffectionLevel.Like) + .SetNPCAffection(NPCID.DyeTrader, AffectionLevel.Like) .SetNPCAffection(NPCID.PartyGirl, AffectionLevel.Like) .SetNPCAffection(NPCID.DD2Bartender, AffectionLevel.Dislike) .SetNPCAffection(NPCID.TaxCollector, AffectionLevel.Dislike) @@ -79,7 +82,6 @@ namespace CalamityMod.NPCs.TownNPCs NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath6; NPC.knockBackResist = 0.5f; - //AnimationType = NPCID.Guide; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -87,24 +89,13 @@ namespace CalamityMod.NPCs.TownNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.FAP") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cirrus") }); } 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; - } - }*/ - + int extraFrameAmt = (NPC.isLikeATownNPC ? NPCID.Sets.ExtraFramesCount[Type] : 0); if (NPC.velocity.Y == 0f) { if (NPC.direction == 1) @@ -113,7 +104,7 @@ namespace CalamityMod.NPCs.TownNPCs if (NPC.direction == -1) NPC.spriteDirection = -1; - int nonAttackFrames = Main.npcFrameCount[NPC.type] - NPCID.Sets.AttackFrameCount[NPC.type]; + int nonAttackFrames = Main.npcFrameCount[Type] - NPCID.Sets.AttackFrameCount[Type]; if (NPC.ai[0] == 23f) { NPC.frameCounter += 1D; @@ -299,7 +290,7 @@ namespace CalamityMod.NPCs.TownNPCs if (NPC.ai[1] < 10f) num254 = 0; - num254 = Main.npcFrameCount[NPC.type] - 2; + num254 = Main.npcFrameCount[Type] - 2; NPC.frame.Y = frameHeight * num254; } else if (NPC.ai[0] == 10f || NPC.ai[0] == 13f) // Attacking @@ -335,7 +326,7 @@ namespace CalamityMod.NPCs.TownNPCs NPC.frameCounter = 0D; } - float num260 = NPC.ai[1] / (float)NPCID.Sets.AttackTime[NPC.type]; + float num260 = NPC.ai[1] / (float)NPCID.Sets.AttackTime[Type]; int num261 = 0; num261 = ((num260 > 0.65f) ? nonAttackFrames : ((num260 > 0.5f) ? @@ -644,7 +635,7 @@ namespace CalamityMod.NPCs.TownNPCs NPC.frameCounter = 0D; } - if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type] - extraFrameAmt) + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type] - extraFrameAmt) NPC.frame.Y = walkFrameHeightLimit; } @@ -661,6 +652,17 @@ namespace CalamityMod.NPCs.TownNPCs CalamityWorld.spawnedCirrus = true; } + // I'm not sure what to do here, because she's always called Cirrus. - Fabsol + /*public override void ModifyTypeName(ref string typeName) + { + int wife = NPC.FindFirstNPC(NPCID.Stylist); + bool wifeIsAround = wife != -1; + bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; + + if (beLessDrunk) + typeName = "Cirrus"; + }*/ + public override bool CanTownNPCSpawn(int numTownNPCs) { if (NPC.AnyNPCs(ModContent.NPCType()) && Main.zenithWorld) @@ -671,9 +673,11 @@ namespace CalamityMod.NPCs.TownNPCs foreach (Player player in Main.ActivePlayers) { - bool hasVodka = player.InventoryHas(ModContent.ItemType()) || player.PortableStorageHas(ModContent.ItemType()); + bool hasVodka = player.InventoryHas(ModContent.ItemType()) || player.PortableStorageHas(ModContent.ItemType()); if (hasVodka) return Main.hardMode; + else + return DownedBossSystem.downedCalamitasClone || NPC.downedPlantBoss; } return false; } @@ -682,41 +686,72 @@ namespace CalamityMod.NPCs.TownNPCs public override string GetChat() { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (Main.zenithWorld) { player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).Format(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, player.Center); } + bool worldIsSafer = NPC.downedMoonlord; + if (CalamityUtils.AnyBossNPCS()) - return this.GetLocalizedValue("Chat.BossAlive"); + { + if (!worldIsSafer) + return this.GetLocalizedValue("Chat.BossAlive"); + else + return this.GetLocalizedValue("Chat.BossAliveAlt"); + } if (NPC.homeless) return this.GetLocalizedValue("Chat.Homeless" + Main.rand.Next(1, 2 + 1)); int wife = NPC.FindFirstNPC(NPCID.Stylist); + bool isHappy = Main.ShopHelper.GetShoppingSettings(player, NPC).PriceAdjustment < 1D; bool wifeIsAround = wife != -1; - bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; + bool wifeIsHappy = wifeIsAround ? Main.ShopHelper.GetShoppingSettings(player, Main.npc[wife]).PriceAdjustment < 1D : false; + bool beLessDrunk = wifeIsAround && worldIsSafer; if (Main.bloodMoon) { if (Main.rand.NextBool(4)) { - player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).Format(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); ; - SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, player.Center); - return this.GetLocalizedValue("Chat.BloodMoonSlap"); + if (!beLessDrunk) + { + player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).Format(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); ; + SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, player.Center); + return this.GetLocalizedValue("Chat.BloodMoonSlap1"); + } + else + return this.GetLocalizedValue("Chat.BloodMoonSlap2"); } return this.GetLocalizedValue("Chat.BloodMoon" + Main.rand.Next(1, 3 + 1)); } WeightedRandom dialogue = new WeightedRandom(); - dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); - if (ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.Normal4")); + if (!beLessDrunk) + { + dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); + + if (Main.zenithWorld) + dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); + + if (ChildSafety.Disabled) + dialogue.Add(this.GetLocalizedValue("Chat.Normal4")); + } + else + { + dialogue.Add(this.GetLocalizedValue("Chat.Normal1Alt")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal2Alt")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal3Alt")); + + if (ChildSafety.Disabled) + dialogue.Add(this.GetLocalization("Chat.Normal4Alt").Format(Main.npc[wife].GivenName)); + + dialogue.Add(this.GetLocalizedValue("Chat.NewOutfit")); + } int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); if (tavernKeep != -1) @@ -728,30 +763,63 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalizedValue("Chat.Tavernkeep3")); } - int permadong = NPC.FindFirstNPC(ModContent.NPCType()); + int permadong = NPC.FindFirstNPC(ModContent.NPCType()); if (permadong != -1) dialogue.Add(this.GetLocalization("Chat.Archmage").Format(Main.npc[permadong].GivenName)); - int witch = NPC.FindFirstNPC(ModContent.NPCType()); + int witch = NPC.FindFirstNPC(ModContent.NPCType()); if (witch != -1) dialogue.Add(this.GetLocalization("Chat.BrimstoneWitch").Format(Main.npc[witch].GivenName)); if (wifeIsAround) { - dialogue.Add(this.GetLocalization("Chat.Stylist1").Format(Main.npc[wife].GivenName)); - if (ChildSafety.Disabled) + if (worldIsSafer) { - dialogue.Add(this.GetLocalization("Chat.Stylist2").Format(Main.npc[wife].GivenName)); - dialogue.Add(this.GetLocalization("Chat.Stylist3").Format(Main.npc[wife].GivenName)); + if (wifeIsHappy && isHappy) + dialogue.Add(this.GetLocalization("Chat.Stylist1Alt").Format(Main.npc[wife].GivenName)); + + if (ChildSafety.Disabled) + { + if (!wifeIsHappy || !isHappy) + dialogue.Add(this.GetLocalization("Chat.Stylist2Alt").Format(Main.npc[wife].GivenName)); + + dialogue.Add(this.GetLocalization("Chat.Stylist3Alt").Format(Main.npc[wife].GivenName)); + } + } + else + { + dialogue.Add(this.GetLocalization("Chat.Stylist1").Format(Main.npc[wife].GivenName)); + if (ChildSafety.Disabled) + { + dialogue.Add(this.GetLocalization("Chat.Stylist2").Format(Main.npc[wife].GivenName)); + dialogue.Add(this.GetLocalization("Chat.Stylist3").Format(Main.npc[wife].GivenName)); + } } } if (Main.dayTime) { - dialogue.Add(this.GetLocalizedValue("Chat.Day1")); - dialogue.Add(this.GetLocalizedValue("Chat.Day2")); - dialogue.Add(this.GetLocalizedValue("Chat.Day3")); - dialogue.Add(this.GetLocalizedValue("Chat.Day4")); + if (!beLessDrunk) + { + dialogue.Add(this.GetLocalizedValue("Chat.Day1")); + dialogue.Add(this.GetLocalizedValue("Chat.Day2")); + dialogue.Add(this.GetLocalizedValue("Chat.Day3")); + } + else + { + dialogue.Add(this.GetLocalizedValue("Chat.Day1Alt")); + dialogue.Add(this.GetLocalizedValue("Chat.Day2Alt")); + dialogue.Add(this.GetLocalizedValue("Chat.Day3Alt")); + } + + if (!isHappy) + { + int annoyingChild = NPC.FindFirstNPC(NPCID.Angler); + if (annoyingChild != -1) + dialogue.Add(this.GetLocalization("Chat.Day4").Format(Main.npc[annoyingChild].GivenName)); + } + else + dialogue.Add(this.GetLocalizedValue("Chat.Day4Alt")); if (beLessDrunk) { @@ -767,54 +835,85 @@ namespace CalamityMod.NPCs.TownNPCs else { dialogue.Add(this.GetLocalizedValue("Chat.Night1")); - dialogue.Add(this.GetLocalizedValue("Chat.Night2")); - dialogue.Add(this.GetLocalizedValue("Chat.Night3")); + + if (!isHappy) + { + if (Main.zenithWorld) + dialogue.Add(this.GetLocalizedValue("Chat.Night2")); + + dialogue.Add(this.GetLocalizedValue("Chat.Night3")); + } + else + { + dialogue.Add(this.GetLocalizedValue("Chat.Night2Alt")); + dialogue.Add(this.GetLocalizedValue("Chat.Night3Alt")); + } + dialogue.Add(this.GetLocalizedValue("Chat.Night4")); - dialogue.Add(this.GetLocalizedValue("Chat.Night5")); if (wifeIsAround) dialogue.Add(this.GetLocalization("Chat.NightStylist").Format(Main.npc[wife].GivenName)); } + // She needs to be drunk to enjoy festive events, otherwise, she dislikes them. - Fabsol if (BirthdayParty.PartyIsUp) - dialogue.Add(this.GetLocalizedValue("Chat.Party")); + { + if (!beLessDrunk) + dialogue.Add(this.GetLocalizedValue("Chat.Party")); + else + dialogue.Add(this.GetLocalizedValue("Chat.PartyAlt")); + } + // She loves her hair and freaks out if it's threatened. Also a reference to the wicked witch of the west. - Fabsol if (AcidRainEvent.AcidRainEventIsOngoing) dialogue.Add(this.GetLocalizedValue("Chat.AcidRain")); + // ayy lmao meme reference (this isn't 4th-wall breaking enough to be put in GFB-only imo). - Fabsol if (Main.invasionType == InvasionID.MartianMadness) dialogue.Add(this.GetLocalizedValue("Chat.Martians")); + // Reference to insane thoughts I had years ago. - Fabsol if (DownedBossSystem.downedCryogen && ChildSafety.Disabled) dialogue.Add(this.GetLocalizedValue("Chat.CryogenDefeated")); + // Reference to the old Leviathan sprite. - Fabsol if (DownedBossSystem.downedLeviathan) dialogue.Add(this.GetLocalizedValue("Chat.LeviathanDefeated")); - if (NPC.downedMoonlord) + // Risque tentacle implication... - Fabsol + if (NPC.downedMoonlord && ChildSafety.Disabled) dialogue.Add(this.GetLocalizedValue("Chat.MoonLordDefeated")); + // Reference to some crazy shit I thought up at one point. - Fabsol if (DownedBossSystem.downedPolterghast) dialogue.Add(this.GetLocalizedValue("Chat.PolterghastDefeated")); - if (DownedBossSystem.downedDoG) + // MGS2 meme line. - Fabsol + if (DownedBossSystem.downedDoG && Main.zenithWorld) dialogue.Add(this.GetLocalizedValue("Chat.DoGDefeated")); + // Cirrus doesn't like the creature. - Fabsol if (player.Calamity().chibii) - dialogue.Add(this.GetLocalizedValue("Chat.HasChibii")); + { + if (!isHappy) + dialogue.Add(this.GetLocalizedValue("Chat.HasChibii")); + else + dialogue.Add(this.GetLocalizedValue("Chat.HasChibiiAlt")); + } - if (player.Calamity().aquaticHeart && !player.Calamity().aquaticHeartHide && ChildSafety.Disabled) + // She likes fish people (including Amidias, but she has no comments for him yet). - Fabsol + if (player.Calamity().aquaticHeart && !player.Calamity().aquaticHeartHide && ChildSafety.Disabled && isHappy) dialogue.Add(this.GetLocalizedValue("Chat.HasAnahitaTrans")); - if (player.Calamity().fabsolVodka) + if (player.Calamity().cirrusVodka) dialogue.Add(this.GetLocalizedValue("Chat.HasVodka")); - if (player.HasItem(ModContent.ItemType())) + // These are all a bit too risque for children to be seeing lol - Fabsol + if (player.HasItem(ModContent.ItemType()) && ChildSafety.Disabled) { dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn1")); dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn2")); - if (ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn3")); + dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn3")); } return dialogue; @@ -826,13 +925,13 @@ namespace CalamityMod.NPCs.TownNPCs return false; var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.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; + int deaths = Main.LocalPlayer.numberOfDeathsPVE; string text = this.GetLocalization("DeathCount").Format(deaths); @@ -851,16 +950,7 @@ namespace CalamityMod.NPCs.TownNPCs else if (deaths > 100) text += " " + this.GetLocalizedValue("Death100"); - IList donorList = new List(CalamityLists.donatorList); - int maxDonorsListed = 25; - string[] donors = new string[maxDonorsListed]; - for (int i = 0; i < maxDonorsListed; i++) - { - donors[i] = donorList[Main.rand.Next(donorList.Count)]; - donorList.Remove(donors[i]); - } - - text += ("\n\n" + this.GetLocalization("DonorShoutout").Format(donors)); + text += "\n\n" + this.GetLocalization("DonorShoutout").Format(DonatorsNameList.GetRandomDonors()); return text; } @@ -885,21 +975,20 @@ namespace CalamityMod.NPCs.TownNPCs public override void AddShops() { - Mod musicMod = CalamityMod.Instance.musicMod; + Mod musicMod = ExternalMods.musicMod; musicMod.TryFind("Interlude1MusicBox", out ModItem interlude1Box); musicMod.TryFind("Interlude2MusicBox", out ModItem interlude2Box); musicMod.TryFind("Interlude3MusicBox", out ModItem interlude3Box); musicMod.TryFind("DevourerofGodsEulogyMusicBox", out ModItem eulogyBox); NPCShop shop = new(Type); - shop.AddWithCustomValue(ItemID.LovePotion, Item.buyPrice(silver: 25), CalamityConditions.PotionSellingConfig, Condition.HappyEnough) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(silver: 30)) + shop.AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(silver: 30)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) @@ -928,9 +1017,11 @@ namespace CalamityMod.NPCs.TownNPCs .AddWithCustomValue(interlude2Box.Type, Item.buyPrice(gold: 10), Condition.DownedMoonLord) .AddWithCustomValue(interlude3Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedYharon) .AddWithCustomValue(eulogyBox.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedDevourerOfGods) - .AddWithCustomValue(ItemID.UnicornHorn, Item.buyPrice(0, 2, 50), Condition.HappyEnough, Condition.InHallow) - .AddWithCustomValue(ItemID.Milkshake, Item.buyPrice(gold: 5), Condition.HappyEnough, Condition.InHallow, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 25), Condition.HappyEnough, Condition.NpcIsPresent(NPCID.Stylist), Condition.NpcIsPresent(NPCID.BestiaryGirl)) + .AddWithCustomValue(ItemID.UnicornHorn, Item.buyPrice(0, 2, 50), Condition.HappyEnoughToSellPylons, Condition.InHallow) + .AddWithCustomValue(ItemID.Milkshake, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.InHallow, Condition.NpcIsPresent(NPCID.Stylist)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 25), Condition.HappyEnoughToSellPylons, Condition.NpcIsPresent(NPCID.Stylist), Condition.NpcIsPresent(NPCID.BestiaryGirl)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCID.Painter)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCID.Painter)) .Register(); } @@ -939,14 +1030,14 @@ namespace CalamityMod.NPCs.TownNPCs public override void TownNPCAttackStrength(ref int damage, ref float knockback) { - damage = 15; + damage = 60; knockback = 2f; } public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) { - cooldown = 180; - randExtraCooldown = 60; + cooldown = 60; + randExtraCooldown = 15; } public override void TownNPCAttackProj(ref int projType, ref int attackDelay) diff --git a/NPCs/TownNPCs/FAP.png b/NPCs/TownNPCs/Cirrus.png similarity index 100% rename from NPCs/TownNPCs/FAP.png rename to NPCs/TownNPCs/Cirrus.png diff --git a/NPCs/TownNPCs/FAPAlt.png b/NPCs/TownNPCs/CirrusAlt.png similarity index 100% rename from NPCs/TownNPCs/FAPAlt.png rename to NPCs/TownNPCs/CirrusAlt.png diff --git a/NPCs/TownNPCs/FAPShimmered_Head.png b/NPCs/TownNPCs/CirrusShimmered_Head.png similarity index 100% rename from NPCs/TownNPCs/FAPShimmered_Head.png rename to NPCs/TownNPCs/CirrusShimmered_Head.png diff --git a/NPCs/TownNPCs/FAP_Head.png b/NPCs/TownNPCs/Cirrus_Head.png similarity index 100% rename from NPCs/TownNPCs/FAP_Head.png rename to NPCs/TownNPCs/Cirrus_Head.png diff --git a/NPCs/TownNPCs/FAP_Shimmered.png b/NPCs/TownNPCs/Cirrus_Shimmered.png similarity index 100% rename from NPCs/TownNPCs/FAP_Shimmered.png rename to NPCs/TownNPCs/Cirrus_Shimmered.png diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SeaKing.cs similarity index 90% rename from NPCs/TownNPCs/SEAHOE.cs rename to NPCs/TownNPCs/SeaKing.cs index e8acfc2086..9e2c6cd3e8 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SeaKing.cs @@ -20,18 +20,19 @@ using Terraria.Utilities; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class SEAHOE : ModNPC + [LegacyName("SEAHOE")] + public class SeaKing : ModNPC { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 25; - NPCID.Sets.ExtraFramesCount[NPC.type] = 5; - NPCID.Sets.AttackFrameCount[NPC.type] = 4; - NPCID.Sets.DangerDetectRange[NPC.type] = 700; - NPCID.Sets.AttackType[NPC.type] = 0; - NPCID.Sets.AttackTime[NPC.type] = 90; - NPCID.Sets.AttackAverageChance[NPC.type] = 30; - NPCID.Sets.HatOffsetY[NPC.type] = 16; + Main.npcFrameCount[Type] = 25; + NPCID.Sets.ExtraFramesCount[Type] = 5; + NPCID.Sets.AttackFrameCount[Type] = 4; + NPCID.Sets.DangerDetectRange[Type] = 700; + NPCID.Sets.AttackType[Type] = 0; + NPCID.Sets.AttackTime[Type] = 90; + NPCID.Sets.AttackAverageChance[Type] = 30; + NPCID.Sets.HatOffsetY[Type] = 16; NPCID.Sets.ShimmerTownTransform[Type] = false; NPC.Happiness .SetBiomeAffection(AffectionLevel.Like) @@ -67,7 +68,7 @@ namespace CalamityMod.NPCs.TownNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SEAHOE") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaKing") }); } @@ -83,7 +84,7 @@ namespace CalamityMod.NPCs.TownNPCs public override string GetChat() { WeightedRandom dialogue = new WeightedRandom(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (NPC.homeless) return this.GetLocalizedValue("Chat.Homeless" + Main.rand.Next(1, 2 + 1)); @@ -109,11 +110,11 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalization("Chat.Angler2").Format(Main.npc[lilBitch].GivenName)); } - int witch = NPC.FindFirstNPC(ModContent.NPCType()); + int witch = NPC.FindFirstNPC(ModContent.NPCType()); if (witch != -1) dialogue.Add(this.GetLocalizedValue("Chat.BrimstoneWitch")); - int cirrus = NPC.FindFirstNPC(ModContent.NPCType()); + int cirrus = NPC.FindFirstNPC(ModContent.NPCType()); if (cirrus != -1) dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrus].GivenName)); @@ -192,7 +193,7 @@ namespace CalamityMod.NPCs.TownNPCs { Main.npcChatText = Lore(); NPC.Calamity().newAI[0]++; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; player.AddBuff(ModContent.BuffType(), 36000); } } @@ -205,14 +206,13 @@ namespace CalamityMod.NPCs.TownNPCs .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) - .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) + .AddWithCustomValue(ItemID.TruffleWorm, Item.buyPrice(gold: 20), Condition.Hardmode) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 40), downedOldDuke) + .AddWithCustomValue(ItemID.ShrimpPoBoy, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnoughToSellPylons, Condition.InBeach) + .AddWithCustomValue(ItemID.Fries, Item.buyPrice(gold: 2), Condition.HappyEnoughToSellPylons, Condition.InBeach, Condition.DownedEyeOfCthulhu) .Register(); } @@ -220,7 +220,7 @@ namespace CalamityMod.NPCs.TownNPCs { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Amidias").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Amidias2").Type, 1f); diff --git a/NPCs/TownNPCs/SEAHOE.png b/NPCs/TownNPCs/SeaKing.png similarity index 100% rename from NPCs/TownNPCs/SEAHOE.png rename to NPCs/TownNPCs/SeaKing.png diff --git a/NPCs/TownNPCs/SEAHOE_Head.png b/NPCs/TownNPCs/SeaKing_Head.png similarity index 100% rename from NPCs/TownNPCs/SEAHOE_Head.png rename to NPCs/TownNPCs/SeaKing_Head.png diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs deleted file mode 100644 index beefa5a4fb..0000000000 --- a/NPCs/TownNPCs/WITCH.cs +++ /dev/null @@ -1,223 +0,0 @@ -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 Terraria; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.GameContent.Events; -using Terraria.GameContent.Personalities; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Utilities; -using static Terraria.ModLoader.ModContent; -using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; - -namespace CalamityMod.NPCs.TownNPCs -{ - [AutoloadHead] - public class WITCH : ModNPC - { - public override void SetStaticDefaults() - { - Main.npcFrameCount[NPC.type] = 27; - NPCID.Sets.ExtraFramesCount[NPC.type] = 9; - NPCID.Sets.AttackFrameCount[NPC.type] = 4; - NPCID.Sets.DangerDetectRange[NPC.type] = 700; - NPCID.Sets.AttackType[NPC.type] = 1; - NPCID.Sets.AttackTime[NPC.type] = 30; - NPCID.Sets.AttackAverageChance[NPC.type] = 5; - NPCID.Sets.ShimmerTownTransform[Type] = false; - NPC.Happiness - .SetBiomeAffection(AffectionLevel.Like) - .SetBiomeAffection(AffectionLevel.Dislike) - .SetNPCAffection(NPCID.Clothier, AffectionLevel.Like) - .SetNPCAffection(NPCID.PartyGirl, AffectionLevel.Dislike); - 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() - { - NPC.townNPC = true; - NPC.friendly = true; - NPC.lavaImmune = true; - NPC.width = 18; - NPC.height = 40; - NPC.aiStyle = NPCAIStyleID.Passive; - NPC.damage = 10; - - // You should not be able to kill SCal under any typical circumstances. - NPC.lifeMax = 960000; - - NPC.defense = 120; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath6; - NPC.knockBackResist = 0.8f; - AnimationType = NPCID.Wizard; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - 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") }; - - // 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 - // to the RNG via dialogue.Add("text", weight); - // Text can always appear assuming the weight is greater than 0 and there's no if condition deciding whether it can. - // The higher the weight is, the more likely it is to be selected from all the choices. - // To give an example of this, assume you have two possibilities: - // "a" with a weight of 1, and "b" with a weight of 5. The chance of "a" being displayed would be - // 1/6, while "b" wold have a 5/6 chance of being displayed. - // If only one possibility exists it will be the only thing that is displayed, regardless of weight. - public override string GetChat() - { - WeightedRandom dialogue = new WeightedRandom(); - - // Have a flat chance (1/4444) to simply ignore the below selection and say something humorous instead. - if (Main.rand.NextBool(4444)) - return this.GetLocalizedValue("Chat.EasterEgg"); - - if (NPC.homeless) - return this.GetLocalizedValue("Chat.Homeless" + Main.rand.Next(1, 2 + 1)); - - dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal4")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal5")); - - if (!Main.dayTime) - { - if (Main.bloodMoon) - { - dialogue.Add(this.GetLocalizedValue("Chat.BloodMoon1"), 5.15); - dialogue.Add(this.GetLocalizedValue("Chat.BloodMoon2"), 5.15); - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.Night1"), 2.8); - dialogue.Add(this.GetLocalizedValue("Chat.Night2"), 2.8); - } - } - - int fab = NPC.FindFirstNPC(NPCType()); - if (fab != -1 && ChildSafety.Disabled) - dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[fab].GivenName), 1.45); - - if (NPC.AnyNPCs(NPCType())) - dialogue.Add(this.GetLocalizedValue("Chat.SeaKing"), 1.45); - - if (BirthdayParty.PartyIsUp) - dialogue.Add(this.GetLocalizedValue("Chat.Party"), 5.5); - - return dialogue; - } - - public override void SetChatButtons(ref string button, ref string button2) => button = this.GetLocalizedValue("EnchantButton"); - - public override void OnChatButtonClicked(bool firstButton, ref string shopName) - { - if (firstButton) - { - Main.playerInventory = true; - CalamitasEnchantUI.NPCIndex = NPC.whoAmI; - CalamitasEnchantUI.CurrentlyViewing = true; - - if (!Main.LocalPlayer.Calamity().GivenBrimstoneLocus) - { - Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemType()); - Main.LocalPlayer.Calamity().GivenBrimstoneLocus = true; - } - } - } - - // Make this Town NPC teleport to the Queen statue when triggered. - public override bool CanGoToStatue(bool toKingStatue) => !toKingStatue; - - public override void TownNPCAttackStrength(ref int damage, ref float knockback) - { - damage = 50; - knockback = 10f; - } - - public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) - { - cooldown = 10; - randExtraCooldown = 50; - } - - public override bool PreAI() - { - // Disappear if the SCal boss is active. She's supposed to be the boss. - // However, this doesn't happen in Boss Rush; the SCal there is a silent puppet created by Xeroc, not SCal herself. - if (NPC.AnyNPCs(NPCType()) && !BossRushEvent.BossRushActive) - { - NPC.active = false; - NPC.netUpdate = true; - return false; - } - return true; - } - - //public override void TownNPCAttackMagic(ref float auraLightMultiplier) - - public override void TownNPCAttackProj(ref int projType, ref int attackDelay) - { - projType = ProjectileType(); - attackDelay = 1; - } - - public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) - { - multiplier = 2f; - } - - // Explode into red dust on death. - public override void HitEffect(NPC.HitInfo hit) - { - if (NPC.life <= 0) - { - NPC.position = NPC.Center; - NPC.width = NPC.height = 50; - NPC.position.X -= NPC.width / 2; - NPC.position.Y -= NPC.height / 2; - for (int i = 0; i < 5; i++) - { - int brimstone = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[brimstone].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[brimstone].scale = 0.5f; - Main.dust[brimstone].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - - for (int i = 0; i < 10; i++) - { - int fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - - fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - } - } - } - } -} diff --git a/NPCs/TownNPCs/WITCH.png b/NPCs/TownNPCs/WITCH.png deleted file mode 100644 index 7b9a6af20e..0000000000 Binary files a/NPCs/TownNPCs/WITCH.png and /dev/null differ diff --git a/NPCs/TownNPCs/WITCH_Head.png b/NPCs/TownNPCs/WITCH_Head.png deleted file mode 100644 index 686a9f7aa6..0000000000 Binary files a/NPCs/TownNPCs/WITCH_Head.png and /dev/null differ diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index 5332d60a49..e458db81c1 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -22,7 +22,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.crimsonBoss = npc.whoAmI; bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -43,7 +42,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.CrimstoneUnsafe) enrage = false; - float enrageScale = bossRush ? 1.5f : masterMode ? 0.5f : 0f; + float enrageScale = bossRush ? 1.5f : death ? 0.5f : 0f; if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -100,7 +99,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } @@ -118,7 +117,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[2] = 1f; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { 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); @@ -153,19 +152,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool phase7 = lifeRatio < 0.1f; // Spawn Creepers in Master Mode - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f && masterMode && phase3) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f && death && phase3) { npc.localAI[0] = 2f; SpawnMasterModeCreepers(); } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 2f && masterMode && phase5) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 2f && death && phase5) { npc.localAI[0] = 3f; SpawnMasterModeCreepers(); } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 3f && masterMode && phase7) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 3f && death && phase7) { npc.localAI[0] = 4f; SpawnMasterModeCreepers(); @@ -235,32 +234,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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; + float nonChargeSpeed = (death ? 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 minInertia = death ? 50f : 75f; + float maxInertia = death ? 70f : 100f; 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); + + Vector2 destination = Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero); + Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitY) * nonChargeSpeed; + npc.velocity = (npc.velocity * (inertia - 1f) + idealVelocity) / inertia; } } @@ -304,7 +290,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + npc.velocity = (Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; if (Main.getGoodWorld) npc.velocity *= 1.15f; } @@ -324,10 +310,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (CalamityWorld.LegendaryMode) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - 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); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(BuffID.Confused, 90); } } } @@ -348,7 +334,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.ai[2] -= 1f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (-chargeVelocity - 2f * enrageScale); - if (masterMode) + if (death) npc.velocity *= 1.5f; if (Main.getGoodWorld) npc.velocity *= 1.15f; @@ -379,48 +365,48 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); switch (i) { case 0: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; if (diagonalShots) - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; else - position.Y = Main.player[Main.myPlayer].Center.Y; + position.Y = Main.LocalPlayer.Center.Y; break; case 1: - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; if (diagonalShots) - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; else - position.X = Main.player[Main.myPlayer].Center.X; + position.X = Main.LocalPlayer.Center.X; break; case 2: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; if (diagonalShots) - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; else - position.Y = Main.player[Main.myPlayer].Center.Y; + position.Y = Main.LocalPlayer.Center.Y; break; case 3: - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; if (diagonalShots) - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; else - position.X = Main.player[Main.myPlayer].Center.X; + position.X = Main.LocalPlayer.Center.X; break; @@ -438,23 +424,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int type = ProjectileID.BloodShot; int damage = npc.GetProjectileDamage(type); - int numProj = death ? 6 : 4; - int spread = death ? 22 : 15; + int numProj = death ? 9 : 4; + int spread = death ? 32 : 15; if (phase7) { - numProj = death ? 4 : 2; - spread = death ? 15 : 10; + numProj = death ? 7 : 2; + spread = death ? 25 : 10; } else if (phase5) { - numProj = death ? 5 : 3; - spread = death ? 30 : 20; - } - - if (masterMode) - { - numProj += 3; - spread += 10; + numProj = death ? 8 : 3; + spread = death ? 40 : 20; } float rotation = MathHelper.ToRadians(spread); @@ -477,28 +457,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int type = ProjectileID.BloodNautilusShot; int damage = npc.GetProjectileDamage(type); - int numProj = death ? 9 : 7; - int spread = death ? 45 : 40; + int numProj = death ? 13 : 7; + int spread = death ? 60 : 40; if (phase7) { - numProj = death ? 3 : 2; - spread = death ? 8 : 5; + numProj = death ? 7 : 2; + spread = death ? 23 : 5; } else if (phase5) { - numProj = death ? 4 : 2; - spread = death ? 15 : 10; + numProj = death ? 8 : 2; + spread = death ? 30 : 10; } else if (phase4) { - numProj = death ? 5 : 3; - spread = death ? 15 : 10; - } - - if (masterMode) - { - numProj += 4; - spread += 15; + numProj = death ? 9 : 3; + spread = death ? 30 : 10; } float rotation = MathHelper.ToRadians(spread); @@ -543,7 +517,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - int maxRandomTime = phase7 ? (masterMode ? 10 : 30) : (masterMode ? 20 : 60); + int maxRandomTime = phase7 ? (death ? 10 : 30) : (death ? 20 : 60); npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; npc.localAI[1] = 0f; npc.alpha = 0; @@ -617,8 +591,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[0] = npc.ai[0] == -6f ? -7f : -2f; npc.ai[1] = teleportTileX; npc.ai[2] = teleportTileY; - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); break; } @@ -669,8 +642,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); } npc.alpha = (int)npc.ai[3]; @@ -697,7 +669,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - int maxRandomTime = phase7 ? (masterMode ? 10 : 30) : (masterMode ? 20 : 60); + int maxRandomTime = phase7 ? (death ? 10 : 30) : (death ? 20 : 60); npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; } else @@ -707,8 +679,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = 0f; npc.ai[0] = -1f; } - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); } npc.alpha = (int)npc.ai[3]; @@ -755,7 +726,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float maxMoveVelocity = (death ? 4f : 1.5f) + velocityScale; if (Main.getGoodWorld) maxMoveVelocity *= 2f; @@ -780,7 +751,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!despawn) npc.localAI[1] += (death ? 2f : 1f) + velocityScale; - if (npc.localAI[1] >= (masterMode ? 540f : 360f)) + if (npc.localAI[1] >= (death ? 540f : 360f)) { // Teleport location npc.localAI[1] = 0f; @@ -888,7 +859,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -896,7 +866,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, default); float enrageScaleMax = 2f; - float enrageScale = bossRush ? enrageScaleMax : masterMode ? 0.5f : 0f; + float enrageScale = bossRush ? enrageScaleMax : death ? 0.5f : 0f; if ((npc.position.Y / 16f) < Main.worldSurface) enrageScale += 0.5f; if (!Main.player[npc.target].ZoneCrimson) @@ -914,7 +884,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses creeperCount = GetBrainOfCthuluCreepersCountRevDeath(); float creeperRatio = 1f; - if (masterMode && brainIsInPhase2) + if (death && brainIsInPhase2) { bool brainIsInPhase3 = Main.npc[NPC.crimsonBoss].localAI[0] == 2f; bool brainIsInPhase5 = Main.npc[NPC.crimsonBoss].localAI[0] == 3f; @@ -959,7 +929,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float velocity = (death ? 16f : 8f) + chargeAggressionScale; velocity += 2f * enrageScale; if (brainIsInPhase2) { @@ -1015,7 +985,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Always fully visible while charging npc.alpha = 0; - float chargeVelocity = (death ? (masterMode ? 12f : 9f) : (masterMode ? 9f : 6f)) + chargeAggressionScale; + float chargeVelocity = (death ? 12f : 6f) + chargeAggressionScale; chargeVelocity += 2f * enrageScale; float returnToBrainGateValue = 1f; if (!brainIsInPhase2) @@ -1023,7 +993,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - Vector2 destination = Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f : Vector2.Zero); + Vector2 destination = Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f : Vector2.Zero); Vector2 targetDirection = destination - npc.Center; targetDirection = targetDirection.SafeNormalize(Vector2.UnitY); if (Main.getGoodWorld) @@ -1034,12 +1004,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { targetDirection *= chargeVelocity; - float inertia = masterMode ? 75f : 100f; + float inertia = death ? 75f : 100f; npc.velocity = (npc.velocity * (inertia - 1f) + targetDirection) / inertia; } // Return to Brain after a set time - float chargeDistance = masterMode ? 900f : 600f; + float chargeDistance = death ? 900f : 600f; returnToBrainGateValue = chargeDistance / chargeVelocity; } @@ -1110,7 +1080,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } } @@ -1206,8 +1176,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[0] = -2f; npc.ai[1] = num847; npc.ai[2] = num848; - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); break; } } @@ -1233,8 +1202,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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.ForceNetUpdate(); } npc.alpha = (int)npc.ai[3]; @@ -1253,8 +1221,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.ai[3] = 0f; npc.ai[0] = -1f; - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); } npc.alpha = (int)npc.ai[3]; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index f37fe91619..2e195a2c06 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -36,15 +36,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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; + bool phase2 = lifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.7f || death; + bool phase4 = lifeRatio < (death ? 0.8f : 0.55f); + bool phase5 = lifeRatio < (death ? 0.6f : 0.4f); + bool phase6 = lifeRatio < (death ? 0.4f : 0.25f); + bool phase7 = death && lifeRatio < 0.2f; + bool phase8 = death && lifeRatio < 0.1f; // Variables bool isCultist = npc.type == NPCID.CultistBoss; @@ -52,7 +51,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float predictionDistance = 480f; float distanceAboveTarget = -240f; - float moveSpeed = masterMode ? (death ? 300f : 150f) : (death ? 100f : 75f); + float moveSpeed = death ? 300f : 75f; int iceMistDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossIceMist) : 0; int fireballDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossFireBall) : npc.GetProjectileDamage(ProjectileID.CultistBossFireBallClone); @@ -61,9 +60,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + int fireballFireRate = (phase5 ? 10 : 12) - (death ? 6 : 0); float fireballSpeed = ((phase7 ? 8f : phase6 ? 7f : 6f) + (death ? (1f - lifeRatio) : 0f)) * (isCultist ? 1f : 0.5f); - int fireballAmt = masterMode ? 20 : 4; + int fireballAmt = death ? 20 : 4; int lightningOrbPhaseTime = phase2 ? 90 : 120; int ancientLightSpawnRate = phase7 ? 20 : phase4 ? 25 : 30; int ancientLightAmt = phase7 ? 4 : phase4 ? 3 : 2; @@ -607,8 +606,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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, npc.Center.Y + (death ? 210f : -100f), 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); + if (death) { 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); @@ -1103,12 +1102,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + int rateOfChange = death ? 2 : 1; float splitProjVelocity = death ? 4.5f : 3f; // Percent life remaining for Cultist or Eidolon Wyrm @@ -1212,7 +1210,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + int totalProjectiles = CalamityWorld.LegendaryMode ? 9 : (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss && !phase3) ? 8 : death ? 5 : 4; float radians = MathHelper.TwoPi / totalProjectiles; Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); for (int k = 0; k < totalProjectiles; k++) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs index f89cc0576c..e981b3ac3c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs @@ -35,7 +35,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Difficulty bools bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Projectile types and damage @@ -267,8 +266,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (float)scoopRubbleGateValue) { Point sourceTileCoords = npc.Top.ToTileCoordinates(); - int numRubble = death ? (masterMode ? 60 : 40) : (masterMode ? 32 : 20); - int distancedByThisManyTiles = death ? (masterMode ? 3 : 4) : (masterMode ? 4 : 5); + int numRubble = death ? 60 : 20; + int distancedByThisManyTiles = death ? 3 : 5; sourceTileCoords.X += npc.direction * 3; sourceTileCoords.Y -= 10; int screenShakeGateValue = (int)npc.ai[1] - scoopRubbleGateValue; @@ -315,11 +314,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = (masterMode ? 7 : 5) + (int)MathHelper.Lerp(0f, 11f, 1f - lifeRatio); + int totalProjectiles = (death ? 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 randomRadialOffset = MathHelper.ToRadians(MathHelper.Lerp(0f, death ? 270f : 180f, 1f - lifeRatio)); float radians = MathHelper.TwoPi / totalProjectiles + randomRadialOffset; - float velocity = (masterMode ? 9f : 7f) + MathHelper.Lerp(0f, 3.5f, 1f - lifeRatio); + float velocity = (death ? 9f : 7f) + MathHelper.Lerp(0f, 3.5f, 1f - lifeRatio); Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { @@ -376,7 +375,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int handAmount = (int)MathHelper.Lerp(masterMode ? 5f : 3f, masterMode ? 12f : 10f, 1f - lifeRatio); + int handAmount = (int)MathHelper.Lerp(death ? 5f : 3f, death ? 12f : 10f, 1f - lifeRatio); for (int i = 0; i < handAmount; i++) { RandomizeInsanityShadowFor(Main.player[npc.target], death, isHostile: true, out var spawnposition, out var spawnvelocity, out var ai, out var ai2); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 66835d789d..2d1b34725c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -68,7 +68,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < DRIncreaseTime; @@ -77,8 +76,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 phase2 = lifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.7f || death; bool startFlightPhase = lifeRatio < 0.5f; bool phase4 = lifeRatio < (death ? 0.4f : 0.25f); bool phase5 = lifeRatio < (death ? 0.2f : 0.1f); @@ -182,7 +181,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else { - if (masterMode && !bossRush && npc.localAI[3] == 1f) + if (death && !bossRush && npc.localAI[3] == 1f) { for (int i = 0; i < Main.maxNPCs; i++) { @@ -215,14 +214,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + int noFlyZoneBoxHeight = death ? 1500 : 1800; // Speed and movement variables - float speed = masterMode ? 0.2f : 0.1f; - float turnSpeed = masterMode ? 0.3f : 0.15f; + float speed = death ? 0.2f : 0.1f; + float turnSpeed = death ? 0.3f : 0.15f; // Max velocity - float segmentVelocity = flyAtTarget ? (masterMode ? 22.5f : 15f) : (masterMode ? 30f : 20f); + float segmentVelocity = flyAtTarget ? (death ? 22.5f : 15f) : (death ? 30f : 20f); // Increase velocity based on distance float velocityMultiplier = increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; @@ -290,7 +289,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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) // This doesn't happen if Oblivion is alive - if (masterMode && probeLaunched && !oblivionAlive) + if (death && probeLaunched && !oblivionAlive) { npc.localAI[2] += 1f; if (npc.localAI[2] >= 600f) @@ -330,7 +329,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.type == NPCID.TheDestroyer) { // Spawn segments from head - if (npc.ai[0] == 0f) + if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.ai[3] = npc.whoAmI; npc.realLife = npc.whoAmI; @@ -341,13 +340,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + 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; } } @@ -397,7 +396,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -410,8 +409,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { 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; + int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? (death ? 9 : 7) : (death ? 6 : 4); + int spread = death ? 38 : 26; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { @@ -442,7 +441,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set laser color and type if (calamityGlobalNPC.destroyerLaserColor == -1 && !probeLaunched) { - if (Main.rand.NextBool(masterMode ? OneInXChanceToFireLaser / (phase5 ? 4 : phase4 ? 3 : 2) : OneInXChanceToFireLaser)) + if (Main.rand.NextBool(death ? OneInXChanceToFireLaser / (phase5 ? 4 : phase4 ? 3 : 2) : OneInXChanceToFireLaser)) { int random = phase3 ? 4 : phase2 ? 3 : 2; switch (Main.rand.Next(random)) @@ -473,8 +472,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // 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 shootProjectileTime = death ? (phase5 ? 120f : phase4 ? 150f : 180f) : 450f; + float bodySegmentTime = npc.ai[0] * (death ? 20f : 30f); float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; float laserTimerIncrement = (calamityGlobalNPC.newAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; if (ableToFireLaser) @@ -528,7 +527,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Shoot nothing if probe has been launched if (calamityGlobalNPC.newAI[0] >= shootProjectileGateValue && ableToFireLaser) { - if (!masterMode) + if (!death) { int numProbeSegments = 0; for (int i = 0; i < Main.maxNPCs; i++) @@ -545,7 +544,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - if (masterMode) + if (death) { int numProbeSegments = 0; for (int i = 0; i < Main.maxNPCs; i++) @@ -561,7 +560,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Laser speed - float projectileSpeed = (masterMode ? 4.5f : 3.5f) + Main.rand.NextFloat() * 1.5f; + float projectileSpeed = (death ? 4.5f : 3.5f) + Main.rand.NextFloat() * 1.5f; projectileSpeed += enrageScale; // Set projectile damage and type @@ -589,7 +588,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(projectileType); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -607,14 +606,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; - if (masterMode) + if (death) { calamityGlobalNPC.destroyerLaserColor = -1; npc.SyncDestroyerLaserColor(); } } - if (!masterMode) + if (!death) { calamityGlobalNPC.destroyerLaserColor = -1; npc.SyncDestroyerLaserColor(); @@ -846,7 +845,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!shouldFly) { npc.velocity.Y += 0.15f; - if (masterMode && npc.velocity.Y > 0f && Math.Abs(npc.Center.Y - player.Center.Y) > 360f) + if (death && npc.velocity.Y > 0f && Math.Abs(npc.Center.Y - player.Center.Y) > 360f) npc.velocity.Y += 0.05f; if (npc.velocity.Y > segmentVelocity) @@ -1037,7 +1036,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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.type == NPCID.TheDestroyer && death && !flyAtTarget) { if (npc.Distance(player.Center) > 2000f) npc.velocity += (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? speed : turnSpeed); @@ -1293,7 +1292,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -1742,7 +1741,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedProbeAI(NPC npc, Mod mod) { bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; bool oblivionAlive = npc.ai[1] == 1f; // Get a target @@ -1754,8 +1753,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float velocity = bossRush ? 12f : death ? 8.4f : 7.2f; + float acceleration = bossRush ? 0.1f : death ? 0.07f : 0.06f; float deceleration = 1f - acceleration; if (targetDead) @@ -1785,7 +1784,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < Main.maxNPCs; i++) { - if (masterMode && !bossRush && npc.ai[1] == 0f) + if (death && !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; @@ -1860,7 +1859,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.dontTakeDamage = false; npc.localAI[0] += 1f; - if ((npc.justHit && !masterMode) || targetDead) + if ((npc.justHit && !death) || targetDead) npc.localAI[0] = 0f; float laserGateValue = NPC.IsMechQueenUp ? ProbeLaserGateValue_Mechdusa : bossRush ? ProbeLaserGateValue_BossRush : ProbeLaserGateValue_Rev; @@ -1873,7 +1872,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1883,7 +1882,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - int totalProjectiles = oblivionAlive ? 2 : (CalamityWorld.death || bossRush) ? 3 : 1; + int totalProjectiles = oblivionAlive ? 2 : death ? 3 : 1; Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; if (NPC.IsMechQueenUp) { @@ -2056,7 +2055,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs index 35155e34b6..744526387f 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs @@ -20,12 +20,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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 masterModeSurprise = lifeRatio >= 0.9f && death; + bool phase2 = lifeRatio < (death ? 0.6f : 0.7f); + bool phase3 = lifeRatio < (death ? 0.3f : 0.4f); + bool phase4 = lifeRatio < (death ? 0.1f : 0.2f); bool phase2AI = npc.ai[0] > 4f; bool phase3AI = npc.ai[0] > 9f; bool charging = npc.ai[3] < 10f; @@ -180,7 +179,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (masterMode) + if (death) { idlePhaseTimer -= 6; idlePhaseAcceleration *= 1.2f; @@ -202,7 +201,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || death) ? 1 : 0); npc.netUpdate = true; } @@ -426,7 +425,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = 0f; if (enrage) npc.ai[2] = sharknadoPhaseTimer - 40; - else if (masterMode) + else if (death) npc.ai[2] = sharknadoPhaseTimer - 60; } @@ -805,7 +804,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || death) ? 1 : 0); npc.ai[2] += 1f; if (npc.ai[2] >= sharknadoPhaseTimer) @@ -1024,7 +1023,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // 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 (death && phase4) { if (npc.ai[2] % (bubbleBelchPhaseDivisor * 2) == 0f) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs index b25c05be66..a246c16b25 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Events; +using CalamityMod.Packets; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -20,7 +21,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.EbonstoneUnsafe) enrage = false; - float enrageScale = bossRush ? 0.5f : 0f; + float enrageScale = 0f; if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) { calamityGlobalNPC.CurrentlyEnraged = !bossRush; @@ -69,17 +69,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phases // Cursed Flame phase - bool phase2 = lifeRatio < 0.8f || masterMode; + bool phase2 = lifeRatio < 0.8f || death; // Boost velocity by 20% phase - bool phase3 = lifeRatio < 0.4f || masterMode; + bool phase3 = lifeRatio < 0.4f || death; // Boost velocity by 50% phase - bool phase4 = lifeRatio < (masterMode ? 0.5f : 0.2f); + bool phase4 = lifeRatio < (death ? 0.5f : 0.2f); // Go fucking crazy in Master Mode - bool phase5 = lifeRatio < 0.1f && masterMode; - bool phase6 = lifeRatio < 0.05f && masterMode; + bool phase5 = lifeRatio < 0.1f && death; + bool phase6 = lifeRatio < 0.05f && death; // Fire projectiles if (Main.netMode != NetmodeID.MultiplayerClient) @@ -92,7 +92,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.localAI[1] -= 1f; - int vileSpitGateValue = (int)MathHelper.Lerp(masterMode ? 45f : 90f, 900f, lifeRatio); + int vileSpitGateValue = (int)MathHelper.Lerp(death ? 45f : 90f, 900f, lifeRatio); if (Main.getGoodWorld) vileSpitGateValue = (int)(vileSpitGateValue * 0.5f); @@ -122,7 +122,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase2) { if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - calamityGlobalNPC.newAI[0] += ((npc.justHit && masterMode && calamityGlobalNPC.newAI[0] < 30f) ? 10f : 1f); + calamityGlobalNPC.newAI[0] += ((npc.justHit && death && calamityGlobalNPC.newAI[0] < 30f) ? 10f : 1f); else calamityGlobalNPC.newAI[0] -= 1f; @@ -189,10 +189,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.type == NPCID.EaterofWorldsHead) { // Amount of segments to spawn. - int segmentSpawnAmount = (int)(masterMode ? (totalSegments / TotalMasterModeWorms) : totalSegments); + int segmentSpawnAmount = (int)(death ? (totalSegments / TotalMasterModeWorms) : totalSegments); // Spawn additional worms of reduced length in Master Mode. - if (masterMode) + if (death) { Vector2 additionalWormSpawnLocation = new Vector2(spawnX, spawnY); int randomXLimit = 80; @@ -272,8 +272,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); npc.alpha = 0; } @@ -295,13 +294,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); 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) + if (!npc.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); } @@ -346,12 +344,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + int noFlyZone = death ? (800 - (phase5 ? 400 : 200)) : 900; noFlyZone -= (int)(enrageScale * 200f); - - if (masterMode) - noFlyZone -= phase5 ? 400 : 200; - if (noFlyZone < 100) noFlyZone = 100; @@ -402,7 +396,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses segmentAcceleration += 0.04f * (enrageScale + 1f); } - if (masterMode) + if (death) { segmentVelocity += (npc.justHit ? 8f : 2f); segmentAcceleration += (npc.justHit ? 0.16f : 0.04f); @@ -473,7 +467,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!inTiles) { npc.velocity.Y += death ? 0.1375f : 0.11f; - if (masterMode && npc.velocity.Y > 0f) + if (death && npc.velocity.Y > 0f) npc.velocity.Y += 0.07f; if (npc.velocity.Y > segmentVelocity) @@ -562,13 +556,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[segmentAmt].active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentAmt, 0f, 0f, 0f, 0, 0, 0); segmentAmt = attachedSegments; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } targetPosX = 0f; @@ -759,16 +753,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Manually sync newAI because there is no GlobalNPC.SendExtraAI - if (npc.active && npc.netUpdate && Main.netMode == NetmodeID.Server) + if (npc.active && npc.netUpdate && Main.dedServ) { - 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); + SyncCalamityNPCAIArrayPacket.Send(npc); } return false; @@ -942,7 +929,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.alpha = 0; } - if (!npc.active && Main.netMode == NetmodeID.Server) + if (!npc.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); } @@ -1149,13 +1136,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int num76 = (int)Main.npc[num75].ai[0]; Main.npc[num75].active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num75); num75 = num76; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 38e7b92ae5..778d63ffa4 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -18,7 +18,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Difficulty bools. bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Rotation @@ -30,8 +29,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Percent life remaining. float lifeRatio = npc.life / (float)npc.lifeMax; - float phase2LifeRatio = masterMode ? 0.7f : 0.6f; - float phase3LifeRatio = masterMode ? 0.3f : 0.15f; + float phase2LifeRatio = death ? 0.7f : 0.6f; + float phase3LifeRatio = death ? 0.3f : 0.15f; bool phase2 = npc.AI_120_HallowBoss_IsInPhase2(); bool phase3 = lifeRatio <= phase3LifeRatio; @@ -450,7 +449,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? (masterMode ? 30f : 36f) : (masterMode ? 60f : 72f)) + 30f * lessTimeSpentPerPhaseMultiplier; + extraPhaseTime = (dayTimeEnrage ? (death ? 30f : 36f) : (death ? 60f : 72f)) + 30f * lessTimeSpentPerPhaseMultiplier; if (npc.ai[1] >= 60f + extraPhaseTime) { npc.ai[0] = 1f; @@ -494,7 +493,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] == 0f) SoundEngine.PlaySound(SoundID.Item162, npc.Center); - float lanceGateValue = masterMode ? 75f : 100f; + float lanceGateValue = death ? 75f : 100f; if (npc.ai[1] >= 6f && npc.ai[1] < 54f) { @@ -514,7 +513,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < lanceAmount; i++) { int lanceFrequency = (int)(npc.ai[1] / (dayTimeEnrage ? 2f : 3f)); - lanceRotation += (masterMode ? 5 : 4) * i; + lanceRotation += (death ? 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; @@ -651,7 +650,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Projectile.NewProjectile(npc.GetSource_FromAI(), everlastingRainbowSpawn + spinningpoint.RotatedBy(-MathHelper.PiOver2) * 30f, spinningpoint * (death ? 3f : 2f) * initialVelocity, projectileType2, projectileDamage2, 0f, Main.myPlayer, npc.target, projRotationMultiplier); } } @@ -710,7 +709,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? (masterMode ? 105f : 110f) : (masterMode ? 140f : 150f)) + 30f * lessTimeSpentPerPhaseMultiplier; // 112.5 is too little + extraPhaseTime = (dayTimeEnrage ? (death ? 105f : 110f) : (death ? 140f : 150f)) + 30f * lessTimeSpentPerPhaseMultiplier; // 112.5 is too little if (npc.ai[1] >= totalSunDancePhaseTime + extraPhaseTime) { npc.ai[0] = 1f; @@ -745,8 +744,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { SoundEngine.PlaySound(SoundID.Item162, npc.Center); - float totalProjectiles = masterMode ? 18f : 15f; - float lanceSpacing = masterMode ? 150f : 175f; + float totalProjectiles = death ? 18f : 15f; + float lanceSpacing = death ? 150f : 175f; float lanceWallSize = totalProjectiles * lanceSpacing; Vector2 lanceSpawnOffset = targetData9.Center; @@ -758,7 +757,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lanceWallSizeMult = 1.4f; totalProjectiles += 5f; lanceSpacing += 50f; - lanceWallSize *= (masterMode ? 0.75f : 0.5f); + lanceWallSize *= (death ? 0.75f : 0.5f); float direction = 1f; int randomLanceWallType; @@ -1021,7 +1020,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] == 0f) SoundEngine.PlaySound(SoundID.Item162, npc.Center); - float lanceGateValue2 = masterMode ? 75f : 100f; + float lanceGateValue2 = death ? 75f : 100f; if (npc.ai[1] >= 6f && npc.ai[1] < 54f) { @@ -1145,7 +1144,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Vector2 vector = new Vector2(0f, (death ? -24f : -22f) - (phase3 ? ((death ? 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); @@ -1180,7 +1179,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += 1f; extraPhaseTime = (dayTimeEnrage ? 36f : 72f) + 30f * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= (masterMode ? 105f : 120f) + extraPhaseTime) + if (npc.ai[1] >= (death ? 105f : 120f) + extraPhaseTime) { npc.ai[0] = 1f; npc.ai[1] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs index c9143daddd..a44b972fce 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs @@ -18,19 +18,20 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + Lighting.AddLight(npc.Center, 0.5f, 0.5f, 0.5f); + // 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; + float phase2LifeRatio = death ? 0.75f : 0.6f; + float phase3LifeRatio = death ? 0.4f : 0.3f; + float finalPhaseRevLifeRatio = death ? 0.2f : 0.15f; + float penultimatePhaseDeathLifeRatio = death ? 0.3f : 0.2f; + float finalPhaseDeathLifeRatio = death ? 0.15f : 0.1f; bool phase2 = lifeRatio < phase2LifeRatio; bool phase3 = lifeRatio < phase3LifeRatio; bool finalPhaseRev = lifeRatio < finalPhaseRevLifeRatio; @@ -40,10 +41,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 servantAndProjectileVelocity = death ? 10f : 6f; - float enrageScale = bossRush ? 1f : masterMode ? 0.5f : 0f; - if (Main.IsItDay() || bossRush) + float enrageScale = bossRush ? 2.25f : death ? 0.5f : 0f; + if (Main.IsItDay()) { npc.Calamity().CurrentlyEnraged = !bossRush; enrageScale += 2f; @@ -149,7 +150,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses hoverAcceleration += 0.08f; } - float attackSwitchTimer = (masterMode ? 120f : 180f) - (death ? 180f * (1f - lifeRatio) : 0f); + float attackSwitchTimer = death ? (120f - 180f * (1f - lifeRatio)) : 180f; 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)); @@ -171,7 +172,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.player[npc.target].dead) npc.ai[3] += 1f; - float servantSpawnGateValue = death ? (masterMode ? 10f : 20f) : (masterMode ? 25f : 40f); + float servantSpawnGateValue = death ? 10f : 40f; if (Main.getGoodWorld) servantSpawnGateValue *= 0.8f; @@ -194,7 +195,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && eye < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); } else @@ -231,23 +232,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; npc.ai[1] = 2f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } 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)); + int chargeDelay = death ? (75 - (int)Math.Round(30f * (1f - lifeRatio))) : 95; if (Main.getGoodWorld) chargeDelay -= 30; - float slowDownGateValue = chargeDelay * (death ? (masterMode ? 0.9f : 0.75f) : (masterMode ? 0.8f : 0.65f)); + float slowDownGateValue = chargeDelay * (death ? 0.85f : 0.65f); npc.ai[2] += 1f; if (npc.ai[2] >= slowDownGateValue) @@ -259,7 +255,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (decelerationScalar < 0f) decelerationScalar = 0f; - npc.velocity *= (MathHelper.Lerp(masterMode ? 0.76f : 0.92f, masterMode ? 0.88f : 0.96f, decelerationScalar)); + npc.velocity *= (MathHelper.Lerp(death ? 0.76f : 0.92f, death ? 0.88f : 0.96f, decelerationScalar)); if (Main.getGoodWorld) npc.velocity *= 0.99f; @@ -302,11 +298,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] = 0f; CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } } @@ -338,7 +330,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += phaseChangeRate; if (npc.ai[1] % servantSpawnGateValue == 0f) { - float servantVelocity = masterMode ? 11.3f : 5.65f; + float servantVelocity = death ? 11.3f : 5.65f; Vector2 servantSpawnVelocity = Main.rand.NextVector2CircularEdge(servantVelocity, servantVelocity); if (Main.getGoodWorld) servantSpawnVelocity *= 3f; @@ -347,7 +339,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int spawnType = NPCID.ServantofCthulhu; - if (masterMode) + if (death) { int maxBloodServants = 2; bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType()) < maxBloodServants; @@ -359,7 +351,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[servantSpawn].velocity.X = servantSpawnVelocity.X; Main.npc[servantSpawn].velocity.Y = servantSpawnVelocity.Y; - if (Main.netMode == NetmodeID.Server && servantSpawn < Main.maxNPCs) + if (Main.dedServ && servantSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, servantSpawn); if (CalamityWorld.LegendaryMode) @@ -395,7 +387,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int phase2Gore = 0; phase2Gore < 2; phase2Gore++) { @@ -471,13 +463,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses hoverAcceleration += 0.1f; } - float phaseLimit = (masterMode ? 160f : 200f) - (death ? 150f * (phase2LifeRatio - lifeRatio) : 0f); + float phaseLimit = death ? (160f - 150f * (phase2LifeRatio - lifeRatio)) : 200f; 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); + float projectileGateValue = (lifeRatio < 0.5f && death) ? 40f : (death ? 60f : 80f); if (npc.ai[2] % projectileGateValue == 0f && shootProjectile) { Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * servantAndProjectileVelocity * 2f; @@ -486,8 +478,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int type = ProjectileID.BloodNautilusShot; int damage = npc.GetProjectileDamage(type); - int numProj = masterMode ? Main.rand.Next(4, 6) : 3; - int spread = masterMode ? numProj * 3 : 10; + int numProj = death ? 4 : 3; + int spread = death ? 12 : 10; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { @@ -529,10 +521,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; npc.ai[1] = 2f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } else if (npc.ai[1] == 2f) @@ -540,11 +529,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = setDamage; - int phase2ChargeDelay = masterMode ? 60 : 80; - if (death) - phase2ChargeDelay -= (int)Math.Round(35f * (phase2LifeRatio - lifeRatio)); + int phase2ChargeDelay = death ? (70 - (int)Math.Round(25f * (phase2LifeRatio - lifeRatio))) : 85; - float slowDownGateValue = phase2ChargeDelay * (death ? (masterMode ? 0.95f : 0.85f) : (masterMode ? 0.9f : 0.75f)); + float slowDownGateValue = phase2ChargeDelay * (death ? 0.9f : 0.75f); npc.ai[2] += 1f; if (npc.ai[2] >= slowDownGateValue) @@ -556,7 +543,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (decelerationScalar < 0f) decelerationScalar = 0f; - npc.velocity *= (MathHelper.Lerp(masterMode ? 0.6f : 0.9f, masterMode ? 0.7f : 0.95f, decelerationScalar)); + npc.velocity *= (MathHelper.Lerp(death ? 0.6f : 0.9f, death ? 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) @@ -579,10 +566,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } else npc.ai[1] = 1f; @@ -599,10 +583,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } else if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -619,10 +600,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 (targetVelocity < (death ? 2f : 5f)) + targetVelocity = (death ? 2f : 5f); + if (targetVelocity > (death ? 6f : 15f)) + targetVelocity = (death ? 6f : 15f); if (npc.ai[2] == -1f) { @@ -671,10 +652,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] = 4f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } } @@ -709,10 +687,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lineUpDistNetUpdate = lineUpDistControl + 13f; if (npc.ai[2] >= lineUpDistNetUpdate) { - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -743,7 +718,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float hoverAcceleration = 0.25f + accelerationBoost; bool horizontalCharge = calamityGlobalNPC.newAI[0] == 1f || calamityGlobalNPC.newAI[0] == 3f; - float timeGateValue = horizontalCharge ? (100f - (death ? 80f * (phase3LifeRatio - lifeRatio) : 0f)) : (85f - (death ? 70f * (phase3LifeRatio - lifeRatio) : 0f)); + float timeGateValue = horizontalCharge ? (110f - (death ? 60f * (phase3LifeRatio - lifeRatio) : 0f)) : (95f - (death ? 55f * (phase3LifeRatio - lifeRatio) : 0f)); if (npc.ai[2] > timeGateValue) { float velocityScalar = npc.ai[2] - timeGateValue; @@ -783,7 +758,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int spawnType = NPCID.ServantofCthulhu; bool spawnServant = false; float enrageScaleToPass = enrageScale; - if (masterMode) + if (death) { int maxBloodServants = 2; bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType()) < maxBloodServants; @@ -816,7 +791,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[eye].velocity.X = servantSpawnVelocity.X; Main.npc[eye].velocity.Y = servantSpawnVelocity.Y; - if (Main.netMode == NetmodeID.Server && eye < Main.maxNPCs) + if (Main.dedServ && eye < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); } else if (!CalamityWorld.LegendaryMode) @@ -880,17 +855,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; } - calamityGlobalNPC.newAI[0] += ((masterMode && calamityGlobalNPC.newAI[0] % 2f != 0f) ? Main.rand.Next(2) + 1f : 1f); + calamityGlobalNPC.newAI[0] += ((death && 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; + calamityGlobalNPC.newAI[0] = death ? Main.rand.Next(2) : 0f; npc.SyncExtraAI(); } - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } else if (npc.ai[1] == 6f) @@ -906,10 +878,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; npc.ai[1] = 7f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } } @@ -946,11 +915,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Deal less damage overall while not charging npc.damage = reducedSetDamage; - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); npc.ai[2] = 0f; npc.ai[1] = 0f; @@ -964,6 +929,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // If you think for a fucking second that I'm going to refactor this... public static bool VanillaEyeofCthulhuAI(NPC npc, Mod mod) { + Lighting.AddLight(npc.Center, 0.5f, 0.5f, 0.5f); + bool flag2 = false; if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.2 : 0.12)) flag2 = true; @@ -1161,7 +1128,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && num22 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num22); } @@ -1194,9 +1161,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.X = num24 * num26; npc.velocity.Y = num25 * num26; npc.ai[1] = 2f; - npc.netUpdate = true; - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } else if (npc.ai[1] == 2f) { @@ -1271,10 +1236,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] = 0f; CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.netUpdate = true; - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } return false; @@ -1332,7 +1294,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && num34 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num34); } @@ -1506,9 +1468,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.X = num45 * num47; npc.velocity.Y = num46 * num47; npc.ai[1] = 2f; - npc.netUpdate = true; - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } else if (npc.ai[1] == 2f) { @@ -1563,9 +1523,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] += Main.rand.Next(1, 4); } - npc.netUpdate = true; - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } else npc.ai[1] = 1f; @@ -1581,9 +1539,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } else if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1675,9 +1631,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] = 4f; - npc.netUpdate = true; - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } } else if (npc.ai[1] == 4f) @@ -1708,9 +1662,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float num63 = num62 + 13f; if (npc.ai[2] >= num63) { - npc.netUpdate = true; - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); npc.ai[3] += 1f; npc.ai[2] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index e4c312fd4c..e75fd3ccdd 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -23,7 +23,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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; @@ -33,7 +32,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] = 1f; - int numFists = masterMode ? 2 : 1; + int numFists = death ? 2 : 1; for (int i = 0; i < numFists; i++) { float fistPunchTimeOffset = i * 30f; @@ -108,7 +107,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.tile[j, k].TileType == TileID.Torches) { Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, j, k); } } @@ -231,7 +230,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] > 0f) { - npc.ai[1] += (masterMode ? 2f : 1f); + npc.ai[1] += (death ? 2f : 1f); if (Main.getGoodWorld) npc.ai[1] += 100f; @@ -263,7 +262,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - if (masterMode) + if (death) { float straightUpJumpHeight = 640f; if (npc.ai[3] == 0f) @@ -283,11 +282,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.noTileCollide = true; npc.ai[2] += 1f; - float jumpVelocity = bossRush ? 30f : death ? 26f : 24f; + float jumpVelocity = 26f; if (enrage) jumpVelocity *= 1.25f; if (turboEnrage) - jumpVelocity *= 1.5f; + jumpVelocity *= 1.25f; float minJumpTime = 15f; float maxJumpTime = 45f; @@ -318,7 +317,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) speedMult += distanceBelowTarget * multiplier; - float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; + float speedMultLimit = turboEnrage ? 3.25f : enrage ? 3f : 2.5f; if (speedMult > speedMultLimit) speedMult = speedMultLimit; @@ -368,11 +367,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.noTileCollide = true; npc.ai[2] += 1f; - float jumpVelocity = death ? 23f : 21f; + float jumpVelocity = 21f; if (enrage) jumpVelocity *= 1.25f; if (turboEnrage) - jumpVelocity *= 1.5f; + jumpVelocity *= 1.25f; float minJumpTime = 15f; float maxJumpTime = 45f; @@ -403,7 +402,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) speedMult += distanceBelowTarget * multiplier; - float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; + float speedMultLimit = turboEnrage ? 3.25f : enrage ? 3f : 2.5f; if (speedMult > speedMultLimit) speedMult = speedMultLimit; @@ -420,7 +419,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses void NormalJump() { float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - float velocityX = (masterMode ? 9f : 6f) + velocityBoost; + float velocityX = (death ? 9f : 6f) + velocityBoost; if (enrage) velocityX *= 1.5f; @@ -437,7 +436,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) speedMult += distanceBelowTarget * multiplier; - float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; + float speedMultLimit = turboEnrage ? 3.25f : enrage ? 3f : 2.5f; if (speedMult > speedMultLimit) speedMult = speedMultLimit; @@ -488,7 +487,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Dust dust = Main.dust[fallDust]; dust.velocity *= 0.2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { 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]; @@ -519,9 +518,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.dust[fiery2].velocity.X *= 2f; } - float projectileVelocity = masterMode ? 9f : 7.5f; - if (death) - projectileVelocity *= 1.25f; + float projectileVelocity = death ? 11.25f : 7.5f; if (enrage) projectileVelocity *= 1.5f; if (turboEnrage) @@ -533,7 +530,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses destination.Normalize(); destination *= projectileVelocity; int totalFireballsPerSide = 3; - int totalIterations = (turboEnrage && Main.getGoodWorld) ? 11 : masterMode ? 25 : 35; + int totalIterations = (turboEnrage && Main.getGoodWorld) ? 11 : death ? 25 : 35; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < totalIterations; i++) { @@ -593,8 +590,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; - npc.netSpam = 0; + npc.ForceNetUpdate(); } } else @@ -606,7 +602,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float fallSpeed = (death ? 0.3f : 0.2f) + fallSpeedBoost; if (enrage) fallSpeed *= 2f; @@ -616,14 +612,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { float velocityChangeBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); - float velocityXChange = (masterMode ? 0.3f : 0.2f) + velocityChangeBoost; + float velocityXChange = (death ? 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; + float velocityXCap = (death ? 9f : 6f) + velocityBoost; if (enrage) velocityXCap *= 3f; @@ -647,7 +643,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses void CustomGravity(bool isSlamming) { - float gravity = turboEnrage ? (Main.getGoodWorld ? 1.2f : 0.9f) : enrage ? 0.75f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; + float gravity = turboEnrage ? (Main.getGoodWorld ? 1.15f : 0.85f) : 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) { @@ -704,7 +700,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 @@ -728,7 +723,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + float aggression = turboEnrage ? (Main.getGoodWorld ? 4f : 3f) : enrage ? 2f : death ? 1.7f : 1f; Vector2 fistCenter = golem.Center + golem.velocity + new Vector2(0f, -9f * npc.scale); fistCenter.X += (float)((npc.type == NPCID.GolemFistLeft) ? -84 : 78) * npc.scale; @@ -756,7 +751,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float fistShootSpeed = death ? Main.rand.NextFloat(aggression * 0.5f, aggression * 2f) : aggression; npc.ai[1] += fistShootSpeed; if (npc.life < npc.lifeMax / 2) npc.ai[1] += fistShootSpeed; @@ -764,7 +759,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += fistShootSpeed; } - float fistPunchGateValue = masterMode ? 120f : 40f; + float fistPunchGateValue = death ? 120f : 40f; if (npc.ai[1] >= fistPunchGateValue) { if (canPunch) @@ -776,11 +771,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = 0f; // Net update in Master due to rng - if (masterMode) - { - npc.netUpdate = true; - npc.netSpam = 0; - } + if (death) + npc.ForceNetUpdate(); } } else @@ -863,7 +855,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.tile[j, k].TileType == TileID.Torches) { Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, j, k); } } @@ -900,7 +892,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float maxPunchDistance = 700f; int explosionLimit = 2; - if (masterMode) + if (death) { if (npc.life < npc.lifeMax / 2) { @@ -922,7 +914,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.noTileCollide = true; npc.ai[0] = 0f; - if (masterMode) + if (death) { int type = ProjectileID.InfernoHostileBlast; bool shootExplosion = true; @@ -1028,7 +1020,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Count body parts @@ -1097,7 +1088,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int type = ProjectileID.Fireball; int damage = npc.GetProjectileDamage(type); - int fireballAmount = masterMode ? 2 : 1; + int fireballAmount = death ? 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); @@ -1149,7 +1140,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int type = ProjectileID.Fireball; int damage = npc.GetProjectileDamage(type); - int fireballAmount = masterMode ? 3 : 1; + int fireballAmount = death ? 3 : 1; Vector2 fireballVelocity = new Vector2(fireballFistsDedTargetX, fireballFistsDedTargetY); for (int i = 0; i < fireballAmount; i++) { @@ -1183,7 +1174,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else projectileFirePos.X += 18f * npc.scale; - float laserSpeed = masterMode ? 15f : 12f; + float laserSpeed = death ? 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); @@ -1212,7 +1203,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.localAI[1] == 1f) projectileFirePos.X += 30f * npc.scale; - float extraLaserSpeed = masterMode ? 15f : 12f; + float extraLaserSpeed = death ? 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); @@ -1278,11 +1269,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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; + bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.55f || golemLifeRatio < 0.7f || death; + bool phase4 = lifeRatio < 0.4f || golemLifeRatio < 0.55f || death; // Enrage if the target isn't inside the temple bool enrage = true; @@ -1389,7 +1379,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netSpam = 5; npc.SyncExtraAI(); - npc.netUpdate = true; + npc.ForceNetUpdate(); } npc.ai[3] -= 1f + @@ -1453,7 +1443,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 freeHeadCenter = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); float freeHeadSpeed = turboEnrage ? 24f : enrage ? 18f : 6f; - if (masterMode) + if (death) freeHeadSpeed *= 1.25f; float freeHeadTargetX = Main.player[npc.target].Center.X - freeHeadCenter.X; @@ -1464,7 +1454,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses freeHeadTargetX *= freeHeadTargetDist; freeHeadTargetY *= freeHeadTargetDist; - int projectileType = (phase3 || masterMode) ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; + int projectileType = (phase3 || death) ? 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; @@ -1501,7 +1491,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses freeHeadProjSpawn.X += 14f * npc.scale; float freeHeadProjSpeed = 5f + (death ? 5f * (1f - combinedLifeRatio) : 3f * (1f - combinedLifeRatio)); - if (masterMode) + if (death) { if (i == 0) { @@ -1569,10 +1559,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16D) + { enrageScale *= 2f; - - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && enrageScale > 1f; + npc.Calamity().CurrentlyEnraged = true; + } if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1624,7 +1615,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.tile[j, k].TileType == TileID.Torches) { Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, j, k); } } @@ -1996,7 +1987,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.tile[j, k].TileType == TileID.Torches) { Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, j, k); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index 23fd8d64b1..b2f1f0fd35 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -13,6 +13,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class KingSlimeAI { + public static readonly SoundStyle SpawnCrystalSound = new SoundStyle("CalamityMod/Sounds/Custom/KingSlimeJewelSpawn"); + public static bool BuffedKingSlimeAI(NPC npc, Mod mod) { // Percent life remaining @@ -32,7 +34,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Phases based on life percentage @@ -50,22 +51,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool spawnBlueCrystal = lifeRatio < 0.3f; // Check if the crystals are alive - bool crystalAlive = true; + bool redCrystalAlive = true; bool blueCrystalAlive = false; bool greenCrystalAlive = true; if (spawnGreenCrystal) { - if (masterMode) + if (death) greenCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); } if (phase3) - crystalAlive = NPC.AnyNPCs(ModContent.NPCType()); + redCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); if (spawnBlueCrystal) { - if (masterMode) + if (death) blueCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); } @@ -81,8 +82,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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); - // Master Mode Crystal spawning - if (masterMode) + // Death Mode Crystal spawning + if (death) { if (spawnGreenCrystal && npc.Calamity().newAI[0] == 0f) { @@ -102,10 +103,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - SoundEngine.PlaySound(SoundID.Item38, vector); + SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + { + int jewel = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); + Main.npc[jewel].localAI[2] = npc.whoAmI; + Main.npc[jewel].velocity.Y = -6; + } } if (phase3 && npc.Calamity().newAI[0] == 1f) @@ -126,10 +131,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - SoundEngine.PlaySound(SoundID.Item38, vector); + SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + { + int jewel = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + Main.npc[jewel].localAI[2] = npc.whoAmI; + Main.npc[jewel].velocity.Y = -6; + } } if (spawnBlueCrystal && npc.Calamity().newAI[0] == 2f) @@ -150,10 +159,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - SoundEngine.PlaySound(SoundID.Item38, vector); + SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + { + int jewel = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); + Main.npc[jewel].localAI[2] = npc.whoAmI; + Main.npc[jewel].velocity.Y = -6; + } } } else @@ -177,10 +190,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - SoundEngine.PlaySound(SoundID.Item38, vector); + SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + { + int jewel = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + Main.npc[jewel].localAI[2] = npc.whoAmI; + Main.npc[jewel].velocity.Y = -6; + } } } @@ -203,12 +220,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Despawn - int despawnDistance = 500; - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) + int despawnDistance = 60; + int forceDespawnDistance = 300; + if ((Main.player[npc.target].dead && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > forceDespawnDistance) { CalamityUtils.CalamityTargeting(npc, default); - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) + if ((Main.player[npc.target].dead && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > forceDespawnDistance) { if (npc.timeLeft > 10) npc.timeLeft = 10; @@ -223,7 +241,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Faster fall if (npc.velocity.Y > 0f) { - float fallSpeedBonus = (bossRush ? 0.1f : death ? 0.05f : 0f) + (!crystalAlive ? 0.1f : 0f) + (masterMode ? 0.1f : 0f); + float fallSpeedBonus = (bossRush ? 0.2f : death ? 0.15f : 0f) + (!redCrystalAlive ? 0.1f : 0f); npc.velocity.Y += fallSpeedBonus; } @@ -266,7 +284,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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)) + 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) > (death ? 160f : 320f)) npc.ai[2] += death ? 3f : 2f; else npc.ai[2] += 1f; @@ -281,8 +299,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses teleporting = true; npc.aiAction = 1; - float teleportRate = crystalAlive ? 1f : 2f; - if (masterMode) + float teleportRate = redCrystalAlive ? 1f : 2f; + if (death) teleportRate *= 2f; npc.ai[0] += teleportRate; @@ -294,7 +312,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[0] >= 60f) teleported = true; - if (npc.ai[0] == 60f && Main.netMode != NetmodeID.Server) + if (npc.ai[0] == 60f && !Main.dedServ) 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) @@ -331,8 +349,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses teleporting = true; npc.aiAction = 0; - float teleportRate = crystalAlive ? 1f : 2f; - if (masterMode) + float teleportRate = redCrystalAlive ? 1f : 2f; + if (death) teleportRate *= 2f; if (npc.ai[0] == 0f) @@ -468,7 +486,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y *= 0.6f; } - if (masterMode) + if (death) npc.velocity.X *= 1.4f; if (bossRush) @@ -484,8 +502,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Change jump velocity else if (npc.target < Main.maxPlayers) { - float jumpVelocityLimit = crystalAlive ? 3f : 4.5f; - if (masterMode) + float jumpVelocityLimit = redCrystalAlive ? 3f : 4.5f; + if (death) jumpVelocityLimit += 3f; if (Main.getGoodWorld) jumpVelocityLimit = 8f; @@ -495,13 +513,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (death) npc.velocity.X += 0.3f * npc.direction; } else { npc.velocity.X *= bossRush ? 0.9f : death ? 0.92f : 0.93f; - if (masterMode) + if (death) npc.velocity.X *= 0.9f; } } @@ -525,7 +543,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; // Adjust size based on HP - float maxScale = death ? (Main.getGoodWorld ? 6f : 3f) : (Main.getGoodWorld ? 3f : 1.25f); + float maxScale = death ? (Main.getGoodWorld ? 6f : 2.5f) : (Main.getGoodWorld ? 3f : 1.5f); float minScale = death ? 0.5f : 0.75f; float maxScaledValue = maxScale - minScale; @@ -559,8 +577,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { 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 minTypeChoice = (int)MathHelper.Lerp(minLowerLimit, 5f, 1f - lifeRatio2); + int maxTypeChoice = (int)MathHelper.Lerp(maxLowerLimit, 7f, 1f - lifeRatio2); int npcType; switch (Main.rand.Next(minTypeChoice, maxTypeChoice + 1)) @@ -572,10 +590,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npcType = NPCID.GreenSlime; break; case 1: - npcType = Main.raining ? NPCID.UmbrellaSlime : NPCID.BlueSlime; + npcType = Main.player[npc.target].ZoneJungle ? NPCID.JungleSlime : Main.player[npc.target].ZoneSnow ? NPCID.IceSlime : NPCID.BlueSlime; break; case 2: - npcType = NPCID.IceSlime; + npcType = Main.raining ? NPCID.UmbrellaSlime : NPCID.BlueSlime; break; case 3: npcType = NPCID.RedSlime; @@ -587,21 +605,28 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npcType = NPCID.YellowSlime; break; case 6: - npcType = NPCID.SlimeSpiked; - break; - case 7: - npcType = NPCID.SpikedIceSlime; - break; - case 8: - npcType = NPCID.SpikedJungleSlime; + npcType = Main.player[npc.target].ZoneJungle ? NPCID.SpikedJungleSlime : Main.player[npc.target].ZoneSnow ? NPCID.SpikedIceSlime : NPCID.SlimeSpiked; 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 (death) + { + switch (Main.rand.Next(3)) + { + case 0: + npcType = NPCID.SlimeSpiked; + break; + case 1: + npcType = NPCID.SpikedIceSlime; + break; + case 2: + npcType = NPCID.SpikedJungleSlime; + break; + } + } if (Main.rand.NextBool(100)) npcType = NPCID.Pinky; @@ -620,7 +645,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[slimeSpawns].ai[0] = -1000 * Main.rand.Next(3); Main.npc[slimeSpawns].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawns < Main.maxNPCs) + if (Main.dedServ && slimeSpawns < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawns); } } @@ -982,7 +1007,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && num260 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num260); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs index a00ffc39e3..cd9481844a 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs @@ -522,7 +522,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); NPC.LunarApocalypseIsUp = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.WorldData, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); return false; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index eeae5cb6e0..b228164acb 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -46,10 +45,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float phase2LifeRatio = 0.5f; bool addThornBallsToGatlingAttack = lifeRatio < 0.85f; bool addSporeGasBlastToGatlingAttack = lifeRatio < 0.75f; - bool useNewGatlingAttackVariant = addSporeGasBlastToGatlingAttack && masterMode; + bool useNewGatlingAttackVariant = addSporeGasBlastToGatlingAttack && death; bool phase2 = lifeRatio <= phase2LifeRatio; bool phase3 = lifeRatio < 0.35f; - bool vomitFreeTentacles = lifeRatio < 0.25f && masterMode; + bool vomitFreeTentacles = lifeRatio < 0.25f && death; bool phase4 = lifeRatio < 0.2f; // Contact damage values for phase 2 @@ -63,8 +62,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Check for Jungle bool surface = !bossRush && Main.player[npc.target].position.Y < Main.worldSurface * 16.0; - // Tentacle limites - int maxTentaclesAfterFirstTentaclePhase = death ? (masterMode ? 4 : 3) : (masterMode ? 3 : 2); + // Tentacle limits + int maxTentaclesAfterFirstTentaclePhase = death ? 4 : 2; int maxFreeTentaclesAfterFirstTentaclePhase = maxTentaclesAfterFirstTentaclePhase * 2; float speedUpDistance = 480f; @@ -84,7 +83,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } } @@ -162,14 +161,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { - velocity += velocity * 0.25f * (1f - lifeRatio); - acceleration += acceleration * 0.25f * (1f - lifeRatio); - } - - if (masterMode) - { - velocity += velocity * 0.1f * (1f - lifeRatio); - acceleration += acceleration * 0.1f * (1f - lifeRatio); + velocity += velocity * 0.35f * (1f - lifeRatio); + acceleration += acceleration * 0.35f * (1f - lifeRatio); if (phase2) { float aggressionScale = (phase2LifeRatio - lifeRatio) / phase2LifeRatio; @@ -270,9 +263,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - 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; + float ai2 = projectileType == ProjectileID.ThornBall && (Main.rand.NextBool() || !Main.zenithWorld) ? 1f : 0f; + Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? npc.Center : spawnOffset, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer, 0f, 0f, ai2); } } } @@ -307,7 +299,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (addSporeGasBlastToGatlingAttack) { SoundEngine.PlaySound(SoundID.Item74, npc.Center); - int totalProjectiles = masterMode ? 36 : 30; + int totalProjectiles = death ? 36 : 30; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -317,7 +309,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f; - float randomSpeed = Main.rand.NextFloat(0.8f, masterMode ? 1.5f : 1.2f); + float randomSpeed = Main.rand.NextFloat(0.8f, death ? 1.5f : 1.2f); int dustType = 74; Vector2 dustVelocity = projectileVelocity * randomSpeed; @@ -351,7 +343,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (doneWithTentaclePhase && !charging && !despawn) { float timeToChargeIncrement = phase4 ? 2f : phase3 ? 1.5f : 1f; - if (masterMode) + if (death) timeToChargeIncrement *= 2f; npc.ai[3] += timeToChargeIncrement; @@ -368,7 +360,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses velocity *= MathHelper.Lerp(MovementVelocityMultiplierForSlowAttacks, 1f, (float)Math.Pow(absValueOfTimer / SeedGatlingDuration, 2D)); // Shoot homing pink bulb projectiles that leave behind lingering pink clouds - float shootBulbGateValue = death ? (masterMode ? 150f : 90f) : (masterMode ? 200f : 120f); + float shootBulbGateValue = death ? 150f : 120f; if (addSporeGasBlastToGatlingAttack) shootBulbGateValue *= 0.8f; @@ -408,9 +400,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[3] <= StopChargeGateValue) { bool canChargeAgain = phase4 ? true : phase3 ? Main.rand.NextBool() : false; - bool chargeAgain = canChargeAgain && masterMode && calamityGlobalNPC.newAI[2] == 0f; + bool chargeAgain = canChargeAgain && death && calamityGlobalNPC.newAI[2] == 0f; npc.ai[3] = chargeAgain ? -2f : 0f; - calamityGlobalNPC.newAI[2] = (masterMode && calamityGlobalNPC.newAI[2] == 0f && chargeAgain) ? 1f : 0f; + calamityGlobalNPC.newAI[2] = (death && calamityGlobalNPC.newAI[2] == 0f && chargeAgain) ? 1f : 0f; npc.SyncExtraAI(); if (!vomitFreeTentacles && !secondCharge) @@ -439,12 +431,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = setDamage; - float sporeGasDashGateValue = death ? 4f : 6f; + float sporeGasDashGateValue = death ? 6f : 9f; if (phase3 && npc.ai[3] % sporeGasDashGateValue == 0f) { int projectileType = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(projectileType); - float randomVelocityMultiplier = secondCharge ? 0.05f : masterMode ? 0.3f : 0.2f; + float randomVelocityMultiplier = secondCharge ? 0.05f : death ? 0.3f : 0.2f; Vector2 projectileVelocity = npc.velocity * Main.rand.NextVector2CircularEdge(randomVelocityMultiplier, randomVelocityMultiplier); Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 30f; @@ -505,7 +497,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } float timeToLineUpChargeDecrement = phase4 ? 2f : 1f; - if (masterMode) + if (death) timeToLineUpChargeDecrement *= 2f; npc.ai[3] -= timeToLineUpChargeDecrement; @@ -528,7 +520,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Vomit spread of spore gas - int totalProjectiles = secondCharge ? 6 : masterMode ? 18 : 12; + int totalProjectiles = secondCharge ? 6 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -538,7 +530,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f; - float randomSpeed = Main.rand.NextFloat(0.8f, secondCharge ? 1f : masterMode ? 1.5f : 1.2f); + float randomSpeed = Main.rand.NextFloat(0.8f, secondCharge ? 1f : death ? 1.5f : 1.2f); int dustType = 74; Vector2 dustVelocity2 = projectileVelocity * randomSpeed; @@ -575,9 +567,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase3) maxDistanceFromHooks += 150f; if (death) + { maxDistanceFromHooks += maxDistanceFromHooks * 0.2f * (1f - lifeRatio); - if (masterMode) maxDistanceFromHooks += 200f; + } if (distanceFromTarget >= maxDistanceFromHooks) { @@ -659,7 +652,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.getGoodWorld) npc.localAI[1] += 1f; - float shootProjectileGateValue = death ? (masterMode ? 30f : 40f) : (masterMode ? 45f : 60f); + float shootProjectileGateValue = death ? 30f : 60f; if (npc.localAI[1] >= shootProjectileGateValue) { npc.localAI[1] = 0f; @@ -683,9 +676,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - bool shootPoisonSeed = (CalamityWorld.LegendaryMode || Main.rand.NextBool(masterMode ? 2 : 4)) && !shootThornBall; + bool shootPoisonSeed = (CalamityWorld.LegendaryMode || Main.rand.NextBool(death ? 2 : 4)) && !shootThornBall; int projectileType = shootThornBall ? ProjectileID.ThornBall : shootPoisonSeed ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; - float projectileSpeed = masterMode ? 16f : 14f; + float projectileSpeed = death ? 16f : 14f; int damage = npc.GetProjectileDamage(projectileType); Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; @@ -735,7 +728,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] == 1f) { npc.localAI[0] = 2f; - int totalTentacles = death ? (masterMode ? 12 : 10) : (masterMode ? 10 : 8); + int totalTentacles = death ? 12 : 8; if (Main.getGoodWorld) totalTentacles += 6; if (CalamityWorld.LegendaryMode) @@ -772,7 +765,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool noAttachedTentacles = !NPC.AnyNPCs(NPCID.PlanterasTentacle); bool noFreeTentacles = !NPC.AnyNPCs(ModContent.NPCType()); float tentacleIdleTimerDecrement = (noAttachedTentacles && noFreeTentacles) ? 4f : noAttachedTentacles ? 2f : 1f; - if (masterMode) + if (death) tentacleIdleTimerDecrement *= 2f; npc.ai[2] -= tentacleIdleTimerDecrement; @@ -783,7 +776,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn gore if (npc.localAI[2] == 0f) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height)), npc.velocity, 378, npc.scale); Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height)), npc.velocity, 379, npc.scale); @@ -882,14 +875,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * projectileSpeed, type, damage, 0f, Main.myPlayer); + float ai2 = 0f; if (Main.rand.NextBool() || !Main.zenithWorld) - Main.projectile[proj].tileCollide = false; + ai2 = 1f; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * projectileSpeed, type, damage, 0f, Main.myPlayer, 0f, 0f, ai2); } } } - if (masterMode && Main.netMode != NetmodeID.MultiplayerClient) + if (death && Main.netMode != NetmodeID.MultiplayerClient) { float sporeSpeed = 12f; Vector2 sporeVelocity = projectileVelocity * sporeSpeed; @@ -976,7 +970,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Variables bool enrage = BossRushEvent.BossRushActive; bool despawn = false; - bool masterMode = Main.masterMode || enrage; bool death = CalamityWorld.death || enrage; // Despawn if Plantera is gone @@ -1019,7 +1012,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[0] = 0f; // Timer dictating whether to pick a new location or not - float moveBoost = death ? (masterMode ? 6f : 4f) * (1f - lifeRatio) : (masterMode ? 3f : 2f) * (1f - lifeRatio); + float moveBoost = death ? 6f * (1f - lifeRatio) : 2f * (1f - lifeRatio); npc.localAI[0] -= 1f + moveBoost; if (enrage) npc.localAI[0] -= 6f; @@ -1088,7 +1081,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[0] > 0f && npc.ai[1] > 0f) { // Hook movement velocity - float velocityBoost = death ? (masterMode ? 9f : 6f) * (1f - lifeRatio) : (masterMode ? 5f : 3f) * (1f - lifeRatio); + float velocityBoost = death ? 9f * (1f - lifeRatio) : 3f * (1f - lifeRatio); float velocity = 7f + velocityBoost; if (enrage) velocity *= 2f; @@ -1145,7 +1138,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses dust.fadeIn = 0.7f; } - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (Main.getGoodWorld) @@ -1168,6 +1160,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set Plantera to a variable int plantBoss = NPC.plantBoss; + // Retract to be near Plantera while she's charging + bool planteraIsCharging = Main.npc[plantBoss].ai[3] <= -2f; + // Become free if Plantera gets sick of your shit if (Main.npc[plantBoss].ai[2] == -1f && npc.ai[2] != 1f) { @@ -1177,14 +1172,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - // 3 seconds of resistance and no damage to prevent spawn killing and unfair hits - if (npc.localAI[0] < 90f) + // 3 seconds of extending from Plantera to max length to prevent unfair hits + float extendTime = 180f; + if (planteraIsCharging) { npc.damage = 0; - npc.localAI[0] += 1f; + + if (npc.localAI[0] > 0f) + { + npc.localAI[0] = 0f; + npc.SyncExtraAI(); + } } - else + else if (npc.localAI[0] < extendTime) + { npc.damage = npc.defDamage; + npc.localAI[0] += 1f; + if (npc.localAI[0] >= extendTime) + npc.SyncExtraAI(); + } // Movement variables int maxOffset = 100; @@ -1201,20 +1207,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Velocity and acceleration float tentacleAcceleration = death ? 2.4f : 1.6f; float extendedDistanceFromPlantera = Math.Abs(npc.ai[0] + npc.ai[1]) / maxOffset; - float tentacleVelocity = 100f + (extendedDistanceFromPlantera * 300f); + float tentacleDistance = MathHelper.Lerp(50f, 100f + (extendedDistanceFromPlantera * 300f), npc.localAI[0] / extendTime); float deceleration = (death ? 0.5f : 0.8f) / (1f + extendedDistanceFromPlantera); - if (masterMode) + if (death) { tentacleAcceleration *= 1.2f; extendedDistanceFromPlantera *= 1.1f; - tentacleVelocity *= 1.2f; + tentacleDistance *= 1.2f; deceleration *= 0.75f; } if (Main.getGoodWorld) tentacleAcceleration += 4f; + // Fast retraction + if (planteraIsCharging) + { + tentacleAcceleration *= 2f; + deceleration *= 0.5f; + } + // Despawn if Plantera is gone if (!Main.npc[plantBoss].active) { @@ -1229,7 +1242,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float plantXDist = plantXOffset - planteraCenter.X; float plantYDist = plantYOffset - planteraCenter.Y; float plantTotalDist = (float)Math.Sqrt(plantXDist * plantXDist + plantYDist * plantYDist); - plantTotalDist = tentacleVelocity / plantTotalDist; + plantTotalDist = tentacleDistance / plantTotalDist; plantXDist *= plantTotalDist; plantYDist *= plantTotalDist; @@ -1259,6 +1272,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } float velocityLimit = 12f + 6f * extendedDistanceFromPlantera; + if (planteraIsCharging) + velocityLimit *= 1.5f; if (npc.velocity.X > velocityLimit) npc.velocity.X = velocityLimit; if (npc.velocity.X < -velocityLimit) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index d4a518e626..65dc62059c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -24,7 +24,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; bool enrage = true; @@ -61,7 +60,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Bee spawn limit - int beeLimit = masterMode ? 9 : 15; + int beeLimit = death ? 9 : 15; // Queen Bee Bee count int totalBees = 0; @@ -86,7 +85,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool hornetLimitReached = false; // Only run this when necessary - if (masterMode) + if (death) { // Queen Bee Hornet count int totalHornets = 0; @@ -205,7 +204,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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)); + while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4) || (death && phase6 && phase == 3)); bool charging = phase == 0; @@ -221,13 +220,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = (phase == 5 && phase5) ? (Main.rand.NextBool() ? 1f : -1f) : phase == 5 ? 1f : 0f; // Velocity for the charges - if (masterMode) + if (death) 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) + if (death) 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; @@ -248,7 +247,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeAmt = phase6 ? 1 : phase5 ? 3 : phase4 ? 2 : 1; int masterModeChargeLimit = death ? (phase5 ? 2 : 1) : (phase5 ? 3 : 2); - if (masterMode && chargeAmt > masterModeChargeLimit) + if (death && chargeAmt > masterModeChargeLimit) chargeAmt = masterModeChargeLimit; // Switch to a random phase if chargeAmt has been exceeded @@ -272,11 +271,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Initiate charge float chargeDistanceY = phase6 ? 100f : phase4 ? 50f : 20f; - chargeDistanceY += 100f * enrageScale; + chargeDistanceY += 50f * 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); @@ -316,7 +316,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (death) { chargeVelocityX += 2f; chargeVelocityY += 4f; @@ -356,11 +356,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + npc.ForceNetUpdate(false); } else { @@ -393,7 +389,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses shouldCharge = true; } if (enrageScale > 0f && shouldCharge) - npc.velocity *= MathHelper.Lerp(0.5f, masterMode ? 0.9f : 1f, 1f - enrageScale / maxEnrageScale); + npc.velocity *= MathHelper.Lerp(0.5f, death ? 0.9f : 1f, 1f - enrageScale / maxEnrageScale); // Keep moving if (npc.ai[2] != 1f) @@ -403,7 +399,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.X = velocity * npc.direction; float accelerateGateValue = phase6 ? 30f : phase5 ? 10f : 90f; - if (masterMode) + if (death) accelerateGateValue *= 0.75f; if (enrageScale > 0f) accelerateGateValue *= 0.75f; @@ -414,11 +410,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SyncExtraAI(); float velocityXLimit = velocity * 2f; if (Math.Abs(npc.velocity.X) < velocityXLimit) - npc.velocity.X *= (masterMode ? 1.02f : 1.01f); + npc.velocity.X *= (death ? 1.02f : 1.01f); } // Spawn bees - float beeSpawnGateValue = masterMode ? 16f : 20f; + float beeSpawnGateValue = death ? 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) { @@ -434,7 +430,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else spawnType = NPCID.Hellbat; } - else if (masterMode) + else if (death) { int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12); switch (random) @@ -495,9 +491,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Slow down npc.localAI[0] = 0f; - npc.velocity *= (masterMode ? 0.8f : 0.9f); + npc.velocity *= (death ? 0.8f : 0.9f); - float chargeDeceleration = masterMode ? 0.2f : 0.1f; + float chargeDeceleration = death ? 0.2f : 0.1f; if (phase2) { npc.velocity *= 0.9f; @@ -519,10 +515,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SyncExtraAI(); } - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } } @@ -538,14 +531,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.spriteDirection = npc.direction; // Get target location - float beeAttackAccel = death ? 0.3f : 0.24f; + float beeAttackAccel = death ? 0.6f : 0.24f; float beeAttackSpeed = 12f + enrageScale * 3f; - if (masterMode) - { - beeAttackAccel *= 2f; + if (death) 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; @@ -554,7 +544,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Go to bee spawn phase calamityGlobalNPC.newAI[0] += 1f; - if ((Vector2.Distance(npc.Center, hoverDestination) < 400f && canHitTarget) || calamityGlobalNPC.newAI[0] >= (masterMode ? 90f : 180f)) + if ((Vector2.Distance(npc.Center, hoverDestination) < 400f && canHitTarget) || calamityGlobalNPC.newAI[0] >= (death ? 90f : 180f)) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -577,13 +567,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Get target location and spawn bees from ass float beeAttackHoverSpeed = 16f + enrageScale * 4f; - float beeAttackHoverAccel = death ? 0.4f : 0.3f; + float beeAttackHoverAccel = death ? 0.8f : 0.3f; - if (masterMode) - { - beeAttackHoverAccel *= 2f; + if (death) 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); @@ -633,7 +620,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else spawnType = NPCID.Hellbat; } - else if (masterMode) + else if (death) { int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12); switch (random) @@ -691,7 +678,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.spriteDirection = npc.direction; // Go to a random phase - float numSpawns = phase3 ? (masterMode ? 1f : 2f) : (masterMode ? 3f : 5f); + float numSpawns = phase3 ? (death ? 1f : 2f) : (death ? 3f : 5f); if (npc.ai[2] > numSpawns || (beeLimitReached && hornetLimitReached)) { npc.ai[0] = -1f; @@ -714,11 +701,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Get target location and shoot from ass float stingerAttackSpeed = 16f + enrageScale * 4f; - float stingerAttackAccel = phase6 ? 0.24f : 0.18f; + float stingerAttackAccel = phase6 ? 0.16f : 0.12f; if (enrageScale > 0f) stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.3f : 0.24f, phase6 ? 0.6f : 0.48f, enrageScale / maxEnrageScale); - if (masterMode) + if (death) { stingerAttackSpeed *= 1.1f; stingerAttackAccel *= 1.2f; @@ -742,7 +729,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { float stingerSpeed = (phase3 ? 6f : 5f) + enrageScale; - if (masterMode) + if (death) stingerSpeed += 1f; float stingerTargetX = Main.player[npc.target].Center.X - stingerSpawnLocation.X; @@ -777,7 +764,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Go to a random phase float numStingerShots = phase6 ? 5f : phase2 ? 8f : 15f; - if (masterMode) + if (death) numStingerShots = (float)Math.Round(numStingerShots * 0.5f); if (npc.ai[1] > stingerAttackTimer * numStingerShots) @@ -831,7 +818,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (enrageScale > 0f) stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.9f : 0.7f, phase6 ? 2.4f : 1.8f, enrageScale / maxEnrageScale); - if (masterMode) + if (death) { stingerAttackSpeed *= 1.1f; stingerAttackAccel *= 1.2f; @@ -865,7 +852,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { float stingerSpeed = (phase6 ? 5f : 4f) + enrageScale; - if (masterMode) + if (death) stingerSpeed += 1f; Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * stingerSpeed; @@ -873,7 +860,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int numProj = death ? (phase6 ? 7 : phase5 ? 11 : 15) : (phase6 ? 5 : phase5 ? 9 : 13); int spread = phase6 ? 30 : phase5 ? 50 : 60; - if (masterMode) + if (death) { numProj += (phase6 ? 2 : phase5 ? 4 : 6); spread += (phase6 ? 10 : phase5 ? 15 : 20); @@ -910,7 +897,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.velocity *= 0.8f; - float idleTime = masterMode ? 120f : 180f; + float idleTime = death ? 120f : 180f; if (npc.ai[1] >= phaseLimit + idleTime) { npc.ai[0] = -1f; @@ -923,10 +910,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); } - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - - npc.netSpam = 5; + if (Main.dedServ) + npc.ForceNetUpdate(); return false; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs index 8a18971df1..9e895f7809 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -16,7 +16,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Difficulty bools bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Percent life remaining @@ -25,9 +24,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + bool phase3 = lifeRatio <= (death ? 0.5f : 0.4f); + bool phase4 = lifeRatio <= (death ? 0.5f : 0.2f); + bool phase5 = lifeRatio <= 0.25f && death; // Spawn settings if (npc.localAI[0] == 0f) @@ -60,7 +59,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Teleport - float teleportGateValue = masterMode ? 300f : 600f; + float teleportGateValue = death ? 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 @@ -315,7 +314,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (death) { int numGelProjectiles = 12; if (Main.getGoodWorld) @@ -445,7 +444,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; } - if (masterMode) + if (death) npc.velocity.X *= (death ? 1.4f : 1.2f); npc.noTileCollide = true; @@ -455,16 +454,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.target >= Main.maxPlayers) break; - float jumpVelocity = bossRush ? 9f : death ? (masterMode ? 7f : 5.5f) : (masterMode ? 6f : 4.5f); + float jumpVelocity = bossRush ? 9f : death ? 7f : 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; + npc.velocity.X += (bossRush ? 1f : death ? 0.45f : 0.3f) * npc.direction; else - npc.velocity.X *= bossRush ? 0.8f : death ? (masterMode ? 0.85f : 0.9f) : (masterMode ? 0.88f : 0.91f); + npc.velocity.X *= bossRush ? 0.8f : death ? 0.85f : 0.91f; } if (!Main.player[npc.target].dead) @@ -515,7 +514,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, damage, 0f, Main.myPlayer); // Line of explosions in Master Mode - if (masterMode) + if (death) { float expandDelay = 0f; int maxSmashes = death ? 22 : 16; @@ -537,7 +536,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Eruption of crystals in phase 3 if (npc.ai[0] == 6f && phase3) { - float projectileVelocity = masterMode ? (death ? 18f : 15f) : 12f; + float projectileVelocity = death ? 18f : 12f; type = ProjectileID.QueenSlimeMinionBlueSpike; damage = npc.GetProjectileDamage(type); Vector2 destination = (new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center).SafeNormalize(Vector2.UnitY); @@ -638,7 +637,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int projectileAmt = 2; int type = ProjectileID.QueenSlimeMinionBlueSpike; int damage = npc.GetProjectileDamage(type); - Vector2 velocityIncrease = masterMode ? (Vector2.UnitY * (death ? 4f : 2f)) : Vector2.Zero; + Vector2 velocityIncrease = death ? (Vector2.UnitY * 4f) : Vector2.Zero; for (int i = 0; i < projectileAmt; i++) { int totalProjectiles = 2; @@ -691,7 +690,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { 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); + npc.velocity *= bossRush ? 30f : death ? 27.3f : 24f; } else npc.velocity.Y *= 0.95f; @@ -845,7 +844,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn small slimes // Don't spawn any slimes in final phase - if (npc.life <= 0 || (phase4 && !masterMode)) + if (npc.life <= 0 || (phase4 && !death)) return false; if (Main.netMode == NetmodeID.MultiplayerClient) @@ -862,7 +861,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } float slimeSpawnHealthGateValue = CalamityWorld.LegendaryMode ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f; - if (masterMode) + if (death) slimeSpawnHealthGateValue *= 0.5f; int slimeSpawnThreshold = (int)(npc.lifeMax * slimeSpawnHealthGateValue); @@ -900,7 +899,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && slimeScale2 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeScale2); return false; @@ -1634,7 +1633,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && num33 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num33); } @@ -1645,15 +1644,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Difficulty bools bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode; - bool death = CalamityWorld.death; + bool death = CalamityWorld.death || bossRush; 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; + float flyVelocity = bossRush ? 24f : death ? 21f : 16f; + float flyAcceleration = bossRush ? 0.3f : death ? 0.18f : 0.12f; + float flyDistanceY = death ? 350f : 450f; Vector2 desiredVelocity = npc.Center; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index 499d9ae6a8..d182231f38 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -23,19 +23,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 phase2LifeRatio = death ? 1f : 0.85f; + float phase3LifeRatio = death ? 0.9f : 0.7f; float respawnHandsLifeRatio = 0.5f; - float phase4LifeRatio = masterMode ? 0.4f : 0.3f; - float useSkullSpreadsAfterChargeLifeRatio = masterMode ? 0.3f : 0.2f; - float phase5LifeRatio = masterMode ? 0.2f : 0.1f; + float phase4LifeRatio = death ? 0.4f : 0.3f; + float useSkullSpreadsAfterChargeLifeRatio = death ? 0.3f : 0.2f; + float phase5LifeRatio = death ? 0.2f : 0.1f; // Begin firing spreads of skulls phase bool phase2 = lifeRatio < phase2LifeRatio; @@ -88,13 +87,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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[0] = death ? -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[0] = death ? 1.3f : 1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; Main.npc[skeletronHand].ai[3] = 150f; Main.npc[skeletronHand].Calamity().newAI[2] = 150f; @@ -105,7 +104,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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].ai[0] = -1.3f; Main.npc[skeletronHand].Calamity().newAI[0] = -1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; Main.npc[skeletronHand].ai[3] = respawnHands ? -75f : 0f; @@ -114,7 +113,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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[0] = 1.3f; Main.npc[skeletronHand].Calamity().newAI[0] = -1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; Main.npc[skeletronHand].ai[3] = respawnHands ? 75f : 150f; @@ -157,44 +156,44 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Hand variables bool handsDead = numHandsAlive == 0; int numProj = Main.getGoodWorld ? 22 : death ? 5 : 3; - float spread = MathHelper.ToRadians(Main.getGoodWorld ? 180 : 60); + float spread = Main.getGoodWorld ? 180 : 60; float headSpinVelocityMult = bossRush ? (phase3 ? 18f : 9f) : (phase3 ? 12f : 4.5f); switch (numHandsAlive) { case 0: numProj = Main.getGoodWorld ? 36 : death ? 9 : 7; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 180 : death ? 90 : 82); + spread = Main.getGoodWorld ? 180 : death ? 90 : 82; headSpinVelocityMult = bossRush ? (phase3 ? 18f : 12f) : (phase3 ? 12f : 6f); break; case 1: numProj = Main.getGoodWorld ? 27 : death ? 7 : 5; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 150 : death ? 76 : 68); + spread = Main.getGoodWorld ? 150 : death ? 76 : 68; headSpinVelocityMult = bossRush ? (phase3 ? 15f : 10f) : (phase3 ? 11.5f : 5f); break; case 2: numProj = Main.getGoodWorld ? 18 : death ? 6 : 4; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 140 : death ? 70 : 62); + spread = Main.getGoodWorld ? 140 : death ? 70 : 62; headSpinVelocityMult = bossRush ? (phase3 ? 13.5f : 9f) : (phase3 ? 11f : 4.5f); break; case 3: numProj = Main.getGoodWorld ? 15 : death ? 5 : 3; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 130 : death ? 64 : 56); + spread = Main.getGoodWorld ? 130 : death ? 64 : 56; headSpinVelocityMult = bossRush ? (phase3 ? 12f : 8f) : (phase3 ? 10.5f : 4f); break; case 4: numProj = Main.getGoodWorld ? 12 : death ? 4 : 3; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 120 : 56); + spread = Main.getGoodWorld ? 120 : 56; headSpinVelocityMult = bossRush ? (phase3 ? 10f : 7f) : (phase3 ? 10f : 3.5f); break; } // Reduce the amount of skulls per spread in later phases due to near-constant teleporting - if (!masterMode && numProj > 3) + if (!death && numProj > 3) { if (phase4) numProj--; @@ -241,42 +240,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { 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; + Vector2 baseVel = npc.SafeDirectionTo(Main.player[npc.target].Center) * (death ? 6f : 5f); + Vector2 firingPos = npc.Center + baseVel * 5f; + float centralCount = 0.5f * (numProj - 1f); 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; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-spread * 0.5f, spread * 0.5f, i / (numProj - 1f))); + float velocityMult = MathHelper.Lerp(0.5f, 1.5f, MathF.Abs(centralCount - i) / centralCount); + Projectile shot = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), firingPos, baseVel.RotatedBy(offset) * velocityMult, type, damage, 0f, Main.myPlayer, -2f); + shot.timeLeft = 600; } npc.netUpdate = true; @@ -363,7 +339,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Teleport - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120 && !(npc.ai[1] == 1f && phase3)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120 && (!(npc.ai[1] == 1f && phase3) || death)) { // Teleport dust for (int m = 0; m < 30; m++) @@ -388,9 +364,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Skull shooting - if ((handsDead || masterMode) && npc.ai[1] == 0f && !phase4) + if ((handsDead || death) && npc.ai[1] == 0f && !phase4) { - float skullProjFrequency = bossRush ? 10f : phase2 ? (48f - (death ? 17.5f * (1f - lifeRatio) : 0f)) : 60f; + float skullProjFrequency = bossRush ? 15f : phase2 ? (48f - (death ? 17.5f * (1f - lifeRatio) : 0f)) : 60f; if (Main.getGoodWorld) skullProjFrequency *= 0.8f; skullProjFrequency = (float)Math.Ceiling(skullProjFrequency); @@ -414,7 +390,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos, skullProjDirection, type, damage, 0f, Main.myPlayer, -1f); Main.projectile[skullProjectile].timeLeft = 600; - if (masterMode && handsDead) + if (death && handsDead) { skullProjDirection = new Vector2(skullProjTargetX, skullProjTargetY).SafeNormalize(Vector2.UnitY); skullProjDirection *= skullProjSpeed * 2f; @@ -434,7 +410,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 14f) : phase4 ? (death ? 8f : 6f) : ((death ? 6f : 4f) * ((1f - lifeRatio) / (1f - phase4LifeRatio))); if (!handsDead) chargePhaseChangeRateBoost *= 0.5f; @@ -445,10 +421,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[1] > chargePhaseGateValue) npc.localAI[1] = chargePhaseGateValue; - float forcedMoveAwayTime = death ? 30f : 45f; - if (masterMode) - forcedMoveAwayTime *= 0.5f; - + float forcedMoveAwayTime = death ? 15f : 45f; float canChargeDistance = phase3 ? 480f : 320f; // 20 tile distance, 30 tile distance in phase 3 bool hasMovedForcedDistance = npc.localAI[2] >= forcedMoveAwayTime; bool canCharge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= canChargeDistance; @@ -471,11 +444,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - float headYAcceleration = (Main.getGoodWorld ? 0.07f : masterMode ? 0.06f : 0.04f) + (death ? 0.04f * (1f - lifeRatio) : 0f); + float headYAcceleration = (Main.getGoodWorld ? 0.07f : death ? (0.06f + 0.04f * (1f - lifeRatio)) : 0.04f); float headYTopSpeed = headYAcceleration * 100f; - float headXAcceleration = (Main.getGoodWorld ? 0.21f : masterMode ? 0.16f : 0.08f) + (death ? 0.08f * (1f - lifeRatio) : 0f); + float headXAcceleration = (Main.getGoodWorld ? 0.21f : death ? (0.16f + 0.08f * (1f - lifeRatio)) : 0.08f); float headXTopSpeed = headXAcceleration * 100f; - float deceleration = Main.getGoodWorld ? 0.83f : masterMode ? 0.86f : 0.89f; + float deceleration = Main.getGoodWorld ? 0.83f : death ? 0.86f : 0.89f; if (bossRush) { @@ -587,7 +560,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && headXAcceleration < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); break; @@ -611,7 +584,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && headXAcceleration < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); break; @@ -643,10 +616,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 240f) { - float shadowFlameProjectileSpeed = death ? 5f : 4f; - if (masterMode) - shadowFlameProjectileSpeed *= 1.2f; - + float shadowFlameProjectileSpeed = death ? 6f : 4f; Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * shadowFlameProjectileSpeed; int type = ProjectileID.Shadowflames; int damage = npc.GetProjectileDamage(type); @@ -669,7 +639,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } bool dontGoMach10 = false; - float dashPhaseTime = masterMode ? 210f : 300f; + float dashPhaseTime = death ? 210f : 300f; if (npc.ai[2] >= dashPhaseTime) { if (Main.getGoodWorld) @@ -688,7 +658,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && headXAcceleration < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); break; @@ -714,7 +684,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (death) { 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; @@ -754,12 +724,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses headSpinVelocityMult += velocityBoost; } - float altDashStopDistance = death ? (masterMode ? 320f : 360f) : (masterMode ? 360f : 400f); + float altDashStopDistance = death ? 320f : 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); + float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headSpinTargetDist - headSpeedIncreaseDist) * 0.0015f, 0.05f, death ? 2f : 1.5f); headSpinVelocityMult *= baseDistanceVelocityMult; } @@ -857,7 +827,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -867,7 +836,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float yMultiplier = 1f; if (calamityGlobalNPC.newAI[0] != 0f) yMultiplier = calamityGlobalNPC.newAI[0]; - if (masterMode) + if (death) yMultiplier *= 1.3f; // Inflict 0 damage for 3 seconds after spawning @@ -907,7 +876,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -929,9 +898,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float deceleration = Main.getGoodWorld ? 0.78f : death ? 0.82f : 0.86f; - if (masterMode) + if (death) { velocityMultiplier *= 0.75f; velocityIncrement *= 1.5f; @@ -939,11 +908,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses deceleration *= 0.75f; } - float handSwipeDistance = masterMode ? HandSwipeDistance_Master : HandSwipeDistance; + float handSwipeDistance = death ? HandSwipeDistance_Master : HandSwipeDistance; float handSwipeDuration = handSwipeDistance / handSwipeVelocity; float slapGateValue = HandSlapGateValue; - float slapTimerIncrement = MathHelper.Lerp(masterMode ? 1.5f : 1f, masterMode ? 3f : 2f, 1f - skeletronLifeRatio); + float slapTimerIncrement = MathHelper.Lerp(death ? 1.5f : 1f, death ? 3f : 2f, 1f - skeletronLifeRatio); if (phase3) slapTimerIncrement *= (death ? 2.5f : 2f); else if (phase2) @@ -1117,7 +1086,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 (death && 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) { @@ -1176,7 +1145,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 (death && 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) { @@ -1423,7 +1392,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && num171 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171); break; @@ -1560,7 +1529,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index f0a62255b7..de242d0fac 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -22,7 +22,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -44,7 +43,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Spawn second head in Master Mode // The main head owns the Saw and the Laser in Master Mode - if (masterMode) + if (death) { 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; @@ -99,7 +98,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SyncExtraAI(); } - if (masterMode) + if (death) { if (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { @@ -178,9 +177,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phases bool phase2 = lifeRatio < 0.66f; - bool spawnDestroyer = lifeRatio < 0.75f && masterMode && !bossRush && npc.localAI[2] == 0f; + bool spawnDestroyer = lifeRatio < 0.75f && death && !bossRush && npc.localAI[2] == 0f; bool phase3 = lifeRatio < 0.33f; - bool spawnRetinazer = lifeRatio < 0.5f && masterMode && !bossRush && npc.localAI[2] == 1f; + bool spawnRetinazer = lifeRatio < 0.5f && death && !bossRush && npc.localAI[2] == 1f; // Spawn The Destroyer in Master Mode (just like Oblivion from Avalon) if (spawnDestroyer) @@ -198,14 +197,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[destroyer].localAI[3] = 1f; Main.npc[destroyer].SyncVanillaLocalAI(); string typeName = Main.npc[destroyer].TypeName; - if (Main.netMode == NetmodeID.Server && destroyer < Main.maxNPCs) + if (Main.dedServ && destroyer < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, destroyer); AchievementsHelper.CheckMechaMayhem(); if (Main.netMode == NetmodeID.SinglePlayer) Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), 175, 75); - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[destroyer].GetTypeNetName()), new Color(175, 75, 255)); } } @@ -230,14 +229,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[retinazer].localAI[3] = 1f; Main.npc[retinazer].SyncVanillaLocalAI(); string typeName = Main.npc[retinazer].TypeName; - if (Main.netMode == NetmodeID.Server && retinazer < Main.maxNPCs) + if (Main.dedServ && retinazer < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazer); AchievementsHelper.CheckMechaMayhem(); if (Main.netMode == NetmodeID.SinglePlayer) Main.NewText(Lang.misc[48].Value, 175, 75); - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) ChatHelper.BroadcastChatMessage(Lang.misc[48].ToNetworkText(), new Color(175, 75, 255)); } } @@ -305,16 +304,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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 || masterMode) + if (phase2 || CalamityWorld.LegendaryMode || allArmsDead || death) { // 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)) + if (npc.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || !death || phase3) && (canUseAttackInMaster || !death)) { bool shouldSpinAround = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 320f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f; - bool shouldCharge = masterMode && !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode; + bool shouldCharge = death && !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode; if (shouldCharge) { npc.ai[2] = 0f; @@ -326,7 +325,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (shouldSpinAround) { - npc.localAI[3] = 120f; + npc.localAI[3] = 300f; npc.SyncVanillaLocalAI(); } @@ -342,27 +341,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.rotation = npc.velocity.X / 15f; - float acceleration = (bossRush ? 0.16f : masterMode ? 0.12f : 0.1f) + (death ? 0.05f * (1f - lifeRatio) : 0f); + float acceleration = bossRush ? 0.2f : (death ? (0.12f + 0.05f * (1f - lifeRatio)) : 0.1f); float accelerationMult = 1f; if (!cannonAlive) { - acceleration += 0.01f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!laserAlive) { - acceleration += 0.01f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!viceAlive) - acceleration += 0.01f; + acceleration += 0.0125f; if (!sawAlive) - acceleration += 0.01f; - if (masterMode) + acceleration += 0.0125f; + if (death) acceleration *= accelerationMult; - float topVelocity = acceleration * 90f; - float deceleration = masterMode ? 0.7f : 0.85f; + float topVelocity = acceleration * 100f; + float deceleration = death ? 0.7f : 0.85f; float headDecelerationUpDist = 0f; float headDecelerationDownDist = 0f; @@ -435,13 +434,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.localAI[0] = 0f; - int totalProjectiles = bossRush ? 24 : death ? (masterMode ? 15 : 18) : 12; + int totalProjectiles = bossRush ? 24 : death ? 15 : 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -493,7 +492,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + float speed = bossRush ? 12f : death ? 8f : 6f; if (phase2) speed += 0.5f; if (phase3) @@ -645,13 +644,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.X / 50f; - float skullSpawnDivisor = bossRush ? 9f : death ? 15f - (float)Math.Round((masterMode ? 3f : 5f) * (1f - lifeRatio)) : 15f; + float skullSpawnDivisor = bossRush ? 9f : death ? 15f - (float)Math.Round(3f * (1f - lifeRatio)) : 15f; float totalSkulls = 12f; - int skullSpread = bossRush ? 250 : death ? (masterMode ? 125 : 150) : 100; + int skullSpread = bossRush ? 250 : death ? 125 : 100; // Spin for about 3 seconds // Decreasing this number will INCREASE how fast he moves while spinning - float spinVelocity = 20f; + float spinVelocity = 30f; if (npc.ai[2] == 2f) { // Play angry noise @@ -683,12 +682,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.localAI[0] += 1f; - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 64f) + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 96f) { if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 headCenter = npc.Center; - float enragedHeadSpeed = (masterMode ? 5f : 4f) + (death ? (masterMode ? 1f : 2f) * (1f - lifeRatio) : 0f); + float enragedHeadSpeed = death ? (5f + (1f - lifeRatio)) : 4f; 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); @@ -705,7 +704,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -717,7 +716,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] % 3f == 0f) { - int probeLimit = death ? (masterMode ? 3 : 4) : 2; + int probeLimit = death ? 3 : 2; if (NPC.CountNPCS(NPCID.Probe) < probeLimit) NPC.NewNPC(npc.GetSource_FromAI(), (int)headCenter.X, (int)headCenter.Y + 30, NPCID.Probe); } @@ -756,14 +755,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.X / 15f; - float flightVelocity = bossRush ? 21f : death ? 18f : 15f; - float flightAcceleration = bossRush ? 1f : death ? 0.65f : 0.4f; - - if (masterMode) - { - flightVelocity += 4f; - flightAcceleration += 0.16f; - } + float flightVelocity = bossRush ? 29f : death ? 25f : 18f; + float flightAcceleration = bossRush ? 1.12f : death ? 0.96f : 0.6f; Vector2 destination = new Vector2(Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y - 420f); npc.SimpleFlyMovement((destination - npc.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration); @@ -772,8 +765,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float missileSpawnDivisor = death ? 10f : 12f; + float totalMissiles = death ? 12f : 10f; npc.ai[2] += 1f; if (npc.ai[2] % missileSpawnDivisor == 0f) { @@ -786,7 +779,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -825,7 +818,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 @@ -839,7 +831,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -885,7 +877,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -896,11 +888,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration += 0.025f; if (!sawAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 70f) { @@ -960,7 +952,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!sawAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= (masterMode ? 200f : 800f)) + if (npc.ai[3] >= (death ? 200f : 800f)) { npc.target = Main.npc[(int)npc.ai[1]].target; npc.localAI[0] = 0f; @@ -994,7 +986,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1056,13 +1048,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - int totalProjectiles = bossRush ? 32 : (masterMode ? 24 : 16); + int totalProjectiles = bossRush ? 32 : death ? 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1094,7 +1086,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 @@ -1106,7 +1097,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -1171,7 +1162,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!sawAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= (masterMode ? 200f : 800f)) + if (npc.ai[3] >= (death ? 200f : 800f)) { npc.target = Main.npc[(int)npc.ai[1]].target; npc.localAI[0] = 0f; @@ -1208,7 +1199,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Movement - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!laserAlive) { @@ -1219,11 +1210,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration += 0.025f; if (!sawAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 70f) { @@ -1297,7 +1288,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1344,7 +1335,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1374,7 +1365,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 @@ -1403,7 +1393,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -1439,7 +1429,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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 acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1453,11 +1443,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (!sawAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 20f) { @@ -1521,7 +1511,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!sawAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= (masterMode ? 150f : 600f)) + if (npc.ai[3] >= (death ? 150f : 600f)) { npc.target = Main.npc[(int)npc.ai[1]].target; npc.ai[2] += 1f; @@ -1529,7 +1519,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1543,11 +1533,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (!sawAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 100f) { @@ -1601,7 +1591,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge towards the player if (npc.ai[2] == 1f) { - float deceleration = masterMode ? 0.75f : 0.8f; + float deceleration = death ? 0.75f : 0.8f; if (npc.velocity.Y > 0f) npc.velocity.Y *= deceleration; @@ -1743,7 +1733,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 @@ -1768,7 +1757,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -1806,7 +1795,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] == 99f) { - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1820,11 +1809,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (!viceAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 20f) { @@ -1884,7 +1873,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!viceAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= (masterMode ? 90f : 180f)) + if (npc.ai[3] >= (death ? 90f : 180f)) { npc.target = Main.npc[(int)npc.ai[1]].target; npc.ai[2] += 1f; @@ -1892,7 +1881,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1906,11 +1895,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (!viceAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 100f) { @@ -1968,7 +1957,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float deceleration = death ? 0.875f : 0.9f; npc.velocity.X *= deceleration; npc.velocity.Y -= 0.5f; if (npc.velocity.Y < -12f) @@ -2022,7 +2011,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeVelocity += 1.5f; if (!viceAlive) chargeVelocity += 1.5f; - if (masterMode) + if (death) chargeVelocity *= 1.25f; Vector2 sawArmOtherChargePos = npc.Center; @@ -2033,11 +2022,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float acceleration = bossRush ? 0.3f : death ? 0.125f : 0.08f; + float deceleration = death ? 0.6f : 0.8f; if (npc.velocity.X > sawArmOtherChargeTargetX) { @@ -2385,7 +2371,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); @@ -2542,7 +2528,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2642,7 +2628,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2670,7 +2656,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); @@ -2945,7 +2931,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); @@ -3249,7 +3235,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index 180e9d76c1..9f3d027fee 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -18,7 +18,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -29,7 +28,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : masterMode ? 0.3f : 0f; + float enrageScale = bossRush ? 0.5f : death ? 0.3f : 0f; if (Main.IsItDay() || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -48,41 +47,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Vector2 hoverDestination = new Vector2(npc.Center.X - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2), npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2)); + int direction = (npc.Center.X < Main.player[npc.target].position.X + Main.player[npc.target].width) ? -1 : 1; - float retinazerHoverRotation = (float)Math.Atan2(retinazerHoverYDest, retinazerHoverXDest) + MathHelper.PiOver2; - if (retinazerHoverRotation < 0f) - retinazerHoverRotation += MathHelper.TwoPi; - else if (retinazerHoverRotation > MathHelper.TwoPi) - retinazerHoverRotation -= MathHelper.TwoPi; + float hoverRotation = hoverDestination.ToRotation() + MathHelper.PiOver2; + if (hoverRotation < 0f) + hoverRotation += MathHelper.TwoPi; + else if (hoverRotation > MathHelper.TwoPi) + hoverRotation -= 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; + float rotationRate = 0.15f; + npc.rotation = npc.rotation.AngleTowards(hoverRotation, rotationRate); if (Main.rand.NextBool(5)) { @@ -103,7 +78,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Check for Oblivion in Master Mode bool oblivionAlive = false; - if (masterMode && !bossRush && npc.localAI[3] == 1f) + if (death && !bossRush && npc.localAI[3] == 1f) { for (int i = 0; i < Main.maxNPCs; i++) { @@ -115,26 +90,36 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } + // Foveanator spawn + if (!oblivionAlive && death && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient && !bossRush) + { + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + calamityGlobalNPC.newAI[0] = 1f; + npc.SyncExtraAI(); + } + + bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); + // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : masterMode ? 0.85f : 0.7f; - float finalPhaseLifeRatio = masterMode ? 0.4f : 0.25f; + float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float finalPhaseLifeRatio = death ? 0.4f : 0.25f; // Movement variables - float phase1MaxSpeedIncrease = masterMode ? 2f : 4f; - float phase1MaxAccelerationIncrease = masterMode ? 0.025f : 0.05f; - float phase1MaxChargeSpeedIncrease = masterMode ? 3f : 6f; + float phase1MaxSpeedIncrease = death ? 2f : 4f; + float phase1MaxAccelerationIncrease = death ? 0.025f : 0.05f; + float phase1MaxChargeSpeedIncrease = death ? 3f : 6f; // Phase duration variables - float phase1MaxLaserPhaseDurationDecrease = masterMode ? 120f : 300f; + float phase1MaxLaserPhaseDurationDecrease = death ? 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; + phase1MaxSpeedIncrease = death ? 1f : 2f; + phase1MaxAccelerationIncrease = death ? 0.0125f : 0.025f; + phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - phase1MaxLaserPhaseDurationDecrease = masterMode ? 60f : 150f; + phase1MaxLaserPhaseDurationDecrease = death ? 60f : 150f; } // Phase checks @@ -174,96 +159,54 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Avoid cheap bullshit npc.damage = 0; - float retinazerPhase1MaxSpeed = 8.25f; - float retinazerPhase1Acceleration = 0.115f; - retinazerPhase1MaxSpeed += 4f * enrageScale; - retinazerPhase1Acceleration += 0.05f * enrageScale; + float maxVelocity = 8.25f; + float acceleration = 0.115f; + maxVelocity += 4f * enrageScale; + acceleration += 0.05f * enrageScale; if (death) { - retinazerPhase1MaxSpeed += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - retinazerPhase1Acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); } if (Main.getGoodWorld) { - retinazerPhase1MaxSpeed *= 1.15f; - retinazerPhase1Acceleration *= 1.15f; + maxVelocity *= 1.15f; + acceleration *= 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; + float distanceFromTarget = 300f; + Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction - Vector2.UnitY * distanceFromTarget; + float distanceFromDestination = (destination - npc.Center).Length(); + Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); if (NPC.IsMechQueenUp) { - retinazerPhase1MaxSpeed = 14f; - retinazerTargetX = mechQueenSpacing.X; - retinazerTargetY = mechQueenSpacing.Y; - retinazerTargetX -= retinazerPosition.X; - retinazerTargetY -= retinazerPosition.Y; - } + maxVelocity = 14f; - float retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); - float retinazerTargetDistCopy = retinazerTargetDist; + destination = mechQueenSpacing; + distanceFromDestination = (destination - npc.Center).Length(); + idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitY); - if (NPC.IsMechQueenUp) - { - if (retinazerTargetDist > retinazerPhase1MaxSpeed) - { - retinazerTargetDist = retinazerPhase1MaxSpeed / retinazerTargetDist; - retinazerTargetX *= retinazerTargetDist; - retinazerTargetY *= retinazerTargetDist; - } + if (distanceFromDestination > maxVelocity) + idealVelocity *= maxVelocity / distanceFromDestination; - npc.velocity.X = (npc.velocity.X * 59f + retinazerTargetX) / 60f; - npc.velocity.Y = (npc.velocity.Y * 59f + retinazerTargetY) / 60f; + float inertia = 60f; + npc.velocity = (npc.velocity * (inertia - 1f) + idealVelocity) / inertia; } 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; + npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); + + float phaseGateValue = death ? (300f - phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 450f; + float laserGateValue = oblivionAlive ? 60f : foveanatorAlive ? 45f : 30f; if (NPC.IsMechQueenUp) { phaseGateValue = 900f; laserGateValue = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 60f : 90f); } + + npc.ai[2] += 1f; if (npc.ai[2] >= phaseGateValue) { npc.ai[1] = 1f; @@ -276,8 +219,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - - else if (retinazerTargetDistCopy < (death ? 960f : 800f)) + else if (distanceFromDestination < (death ? 960f : 800f)) { if (!Main.player[npc.target].dead) { @@ -289,19 +231,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + float laserSpeed = 10.5f; + laserSpeed += 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -311,13 +251,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Vector2 laserVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 90f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -328,21 +263,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - npc.rotation = retinazerHoverRotation; - float retinazerChargeSpeed = 15f; - retinazerChargeSpeed += 10f * enrageScale; + npc.rotation = hoverRotation; + + float chargeSpeed = 15f; + chargeSpeed += 10f * enrageScale; if (death) - retinazerChargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) - retinazerChargeSpeed += 2f; + chargeSpeed += 2f; + + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitX * direction) * chargeSpeed; - 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) @@ -351,29 +282,35 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage; npc.ai[2] += 1f; - float decelerateGateValue = (masterMode ? 36f : 32f) + (death ? (masterMode ? 6f : 12f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float decelerateGateValue = (death ? 36f : 32f) + (death ? 6f * ((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); + float decelerationMultiplier = (death ? 0.84f : 0.92f) - (death ? 0.16f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); npc.velocity *= decelerationMultiplier; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + + if (Math.Abs(npc.velocity.X) < 0.1) npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + if (Math.Abs(npc.velocity.Y) < 0.1) npc.velocity.Y = 0f; } else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - float delayBeforeChargingAgain = (masterMode ? 48f : 56f) - (death ? (masterMode ? 3f : 6f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float delayBeforeChargingAgain = (death ? 48f : 56f) - (death ? 3f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); if (npc.ai[2] >= delayBeforeChargingAgain + (oblivionAlive ? 15f : 0f)) { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.rotation = retinazerHoverRotation; + + npc.rotation = hoverRotation; + float totalCharges = death ? 6f : 5f; + if (foveanatorAlive) + totalCharges -= 1f; + if (npc.ai[3] >= totalCharges) { npc.ai[1] = 0f; @@ -428,7 +365,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation += npc.ai[2]; npc.ai[1] += 1f; - if (masterMode && npc.ai[2] >= 0.2f) + if (death && npc.ai[2] >= 0.2f) { if (npc.ai[1] % 10f == 0f) { @@ -436,11 +373,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { bool shootLaser = npc.ai[1] % 20f == 0f; - int type = shootLaser ? ProjectileID.DeathLaser : ModContent.ProjectileType(); + 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -454,7 +391,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int numProj = shootLaser ? 6 : 2; int spread = shootLaser ? 20 : 80; float rotation = MathHelper.ToRadians(spread); - float offset = shootLaser ? 150f : 50f; + float offset = shootLaser ? 90f : 50f; for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); @@ -476,7 +413,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 2; i++) { @@ -496,9 +433,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Math.Abs(npc.velocity.X) < 0.1) npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + if (Math.Abs(npc.velocity.Y) < 0.1) npc.velocity.Y = 0f; } else @@ -526,76 +463,38 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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; + float maxVelocity = 9.5f + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float acceleration = 0.175f + (death ? 0.05f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + maxVelocity += 4.5f * enrageScale; + acceleration += 0.075f * enrageScale; if (Main.getGoodWorld) { - retinazerPhase2MaxSpeed *= 1.15f; - retinazerPhase2Accel *= 1.15f; + maxVelocity *= 1.15f; + acceleration *= 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; + Vector2 destination = Main.player[npc.target].Center - Vector2.UnitY * distanceFromTarget; + float distanceFromDestination = (destination - npc.Center).Length(); + Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); if (NPC.IsMechQueenUp) { - retinazerPhase2MaxSpeed = 14f; - retinazerPhase2TargetX = mechQueenSpacing.X; - retinazerPhase2TargetY = mechQueenSpacing.Y; - retinazerPhase2TargetX -= eyePosition.X; - retinazerPhase2TargetY -= eyePosition.Y; - } + maxVelocity = 14f; - float retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); + destination = mechQueenSpacing; + distanceFromDestination = (destination - npc.Center).Length(); + idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitY); - if (NPC.IsMechQueenUp) - { - if (retinazerPhase2TargetDist > retinazerPhase2MaxSpeed) - { - retinazerPhase2TargetDist = retinazerPhase2MaxSpeed / retinazerPhase2TargetDist; - retinazerPhase2TargetX *= retinazerPhase2TargetDist; - retinazerPhase2TargetY *= retinazerPhase2TargetDist; - } + if (distanceFromDestination > maxVelocity) + idealVelocity *= maxVelocity / distanceFromDestination; - npc.velocity.X = (npc.velocity.X * 4f + retinazerPhase2TargetX) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + retinazerPhase2TargetY) / 5f; + float inertia = 5f; + npc.velocity = (npc.velocity * (inertia - 1f) + idealVelocity) / inertia; } 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.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); npc.ai[2] += spazAlive ? 1f : 1.5f; float phaseGateValue = NPC.IsMechQueenUp ? 900f : 300f - (death ? 120f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); @@ -612,27 +511,24 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + npc.rotation = (Main.player[npc.target].Center - npc.Center).ToRotation() - 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)) + if (npc.localAI[1] >= (spazAlive ? (oblivionAlive ? 76f : foveanatorAlive ? 64f : 52f) : foveanatorAlive ? 39f : 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) + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; - float retinazerPhase2LaserSpeed = 10f; - retinazerPhase2LaserSpeed += enrageScale; + + float laserSpeed = 10f; + laserSpeed += 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -642,22 +538,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; - } + Vector2 laserVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -669,74 +551,41 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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; + float maxVelocity = 9.5f + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float acceleration = 0.25f + (death ? 0.075f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + maxVelocity += 4.5f * enrageScale; + acceleration += 0.15f * enrageScale; if (Main.getGoodWorld) { - retinazerPhase2RapidFireMaxSpeed *= 1.15f; - retinazerPhase2RapidFireAccel *= 1.15f; + maxVelocity *= 1.15f; + acceleration *= 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; + Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; + float distanceFromDestination = (destination - npc.Center).Length(); + Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); + npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); - 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; + npc.rotation = (Main.player[npc.target].Center - npc.Center).ToRotation() - 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)) + if (npc.localAI[1] > (spazAlive ? (oblivionAlive ? 30f : foveanatorAlive ? 25f : 20f) : foveanatorAlive ? 15f : 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) + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; + + float laserSpeed = 9f; + laserSpeed += enrageScale; 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -746,30 +595,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; - } + Vector2 laserVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } npc.ai[2] += spazAlive ? 1f : 1.5f; - if (npc.ai[2] >= (masterMode ? 150f : 180f) - (death ? (masterMode ? 60f : 90f) * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) + if (npc.ai[2] >= (death ? 150f : 180f) - (death ? 60f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) { - npc.ai[1] = (!spazAlive || finalPhase) ? 4f : 0f; + npc.ai[1] = finalPhase ? 4f : 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -788,23 +623,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = setDamage; // Set rotation and velocity - npc.rotation = retinazerHoverRotation; - float retinazerPhase3ChargeSpeed = 22f + (death ? 8f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - retinazerPhase3ChargeSpeed += 10f * enrageScale; + npc.rotation = hoverRotation; + float chargeSpeed = 22f + (death ? 8f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + chargeSpeed += 10f * enrageScale; if (!spazAlive) - retinazerPhase3ChargeSpeed += 2f; - + chargeSpeed += 2f; if (Main.getGoodWorld) - retinazerPhase3ChargeSpeed += 2f; + chargeSpeed += 2f; + + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed; - 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; } @@ -829,34 +658,30 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = 0; npc.velocity *= 0.93f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + + if (Math.Abs(npc.velocity.X) < 0.1) npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + if (Math.Abs(npc.velocity.Y) < 0.1) npc.velocity.Y = 0f; } else { - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; if (npc.ai[3] % 3f == 0f) { - float fireRate = spazAlive ? 13f : 9f; - + float fireRate = spazAlive ? 13f : foveanatorAlive ? 11f : 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(); + float laserDartSpeed = (death ? 9f : 6f) * (spazAlive ? 1f : 1.5f); + 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -866,17 +691,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Vector2 laserDartVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserDartSpeed; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + npc.velocity.SafeNormalize(Vector2.UnitY) * 60f, laserDartVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -890,7 +706,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = 0f; float chargeIncrement = 1f; - if (masterMode && Main.rand.NextBool() && npc.ai[3] < (spazAlive ? 1f : 3f)) + if (death && Main.rand.NextBool() && npc.ai[3] < (spazAlive ? 1f : 3f)) { chargeIncrement = 2f; @@ -898,9 +714,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - npc.ai[3] += chargeIncrement; + npc.rotation = hoverRotation; - npc.rotation = retinazerHoverRotation; + npc.ai[3] += chargeIncrement; float maxChargeAmt = spazAlive ? 2f : 4f; if (npc.ai[3] >= maxChargeAmt) { @@ -922,61 +738,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Avoid cheap bullshit npc.damage = 0; - int chargeLineUpDist = spazAlive ? 600 : 500; + float chargeLineUpDistance = spazAlive ? 600f : 500f; float chargeSpeed = 18f + (death ? 6f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float chargeAccel = 0.45f + (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeAcceleration = 0.45f + (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); chargeSpeed += 6f * enrageScale; - chargeAccel += 0.15f * enrageScale; + chargeAcceleration += 0.15f * enrageScale; if (spazAlive) { chargeSpeed *= 0.75f; - chargeAccel *= 0.75f; + chargeAcceleration *= 0.75f; } if (Main.getGoodWorld) { chargeSpeed *= 1.15f; - chargeAccel *= 1.15f; + chargeAcceleration *= 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; - } + Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * chargeLineUpDistance * direction; + Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction) * chargeSpeed; + npc.SimpleFlyMovement(idealVelocity, chargeAcceleration); // Take 1.25 or 1 second to get in position, then charge npc.ai[2] += 1f; @@ -998,7 +780,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -1009,7 +790,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : masterMode ? 0.3f : 0f; + float enrageScale = bossRush ? 0.5f : death ? 0.3f : 0f; if (Main.IsItDay() || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -1028,45 +809,20 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + Vector2 hoverDestination = new Vector2(npc.Center.X - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2), npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2)); + int direction = (npc.Center.X < Main.player[npc.target].position.X + Main.player[npc.target].width) ? -1 : 1; - 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 hoverRotation = hoverDestination.ToRotation() + MathHelper.PiOver2; + if (hoverRotation < 0f) + hoverRotation += MathHelper.TwoPi; + else if (hoverRotation > MathHelper.TwoPi) + hoverRotation -= MathHelper.TwoPi; - float spazmatismRotateSpeed = 0.15f; + float rotationRate = 0.15f; if (NPC.IsMechQueenUp && npc.ai[0] == 3f && npc.ai[1] == 0f) - spazmatismRotateSpeed *= 0.25f; + rotationRate *= 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; + npc.rotation = npc.rotation.AngleTowards(hoverRotation, rotationRate); // Dust if (Main.rand.NextBool(5)) @@ -1089,7 +845,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Check for Oblivion in Master Mode bool oblivionAlive = false; - if (masterMode && !bossRush && npc.localAI[3] == 1f) + if (death && !bossRush && npc.localAI[3] == 1f) { for (int i = 0; i < Main.maxNPCs; i++) { @@ -1101,28 +857,30 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } + bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); + // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : masterMode ? 0.85f : 0.7f; - float finalPhaseLifeRatio = masterMode ? 0.4f : 0.25f; + float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float finalPhaseLifeRatio = death ? 0.3f : 0.15f; // Movement variables - float phase1MaxSpeedIncrease = masterMode ? 2.25f : 4.5f; - float phase1MaxAccelerationIncrease = masterMode ? 0.075f : 0.15f; - float phase1MaxChargeSpeedIncrease = masterMode ? 3f : 6f; + float phase1MaxSpeedIncrease = death ? 2.25f : 4.5f; + float phase1MaxAccelerationIncrease = death ? 0.075f : 0.15f; + float phase1MaxChargeSpeedIncrease = death ? 3f : 6f; // Phase duration variables - float phase1MaxCursedFlamePhaseDurationDecrease = masterMode ? 80f : 200f; - float phase1MaxChargesDecrease = masterMode ? 2f : 4f; + float phase1MaxCursedFlamePhaseDurationDecrease = death ? 80f : 200f; + float phase1MaxChargesDecrease = death ? 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; + phase1MaxSpeedIncrease = death ? 1.125f : 2.25f; + phase1MaxAccelerationIncrease = death ? 0.0375f : 0.075f; + phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - phase1MaxCursedFlamePhaseDurationDecrease = masterMode ? 40f : 100f; - phase1MaxChargesDecrease = masterMode ? 1f : 2f; + phase1MaxCursedFlamePhaseDurationDecrease = death ? 40f : 100f; + phase1MaxChargesDecrease = death ? 1f : 2f; } // Phase checks @@ -1165,85 +923,44 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = 0; // Velocity - float spazmatismFireballMaxSpeed = 12f; - float spazmatismFireballAccel = 0.4f; - spazmatismFireballMaxSpeed += 6f * enrageScale; - spazmatismFireballAccel += 0.2f * enrageScale; + float maxVelocity = 12f; + float acceleration = 0.4f; + maxVelocity += 6f * enrageScale; + acceleration += 0.2f * enrageScale; if (death) { - spazmatismFireballMaxSpeed += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - spazmatismFireballAccel += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); } if (Main.getGoodWorld) { - spazmatismFireballMaxSpeed *= 1.15f; - spazmatismFireballAccel *= 1.15f; + maxVelocity *= 1.15f; + acceleration *= 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); + Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; + float distanceFromDestination = (destination - npc.Center).Length(); + Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); if (NPC.IsMechQueenUp) { - if (spazmatismFireballTargetDist > spazmatismFireballMaxSpeed) - { - spazmatismFireballTargetDist = spazmatismFireballMaxSpeed / spazmatismFireballTargetDist; - spazmatismFireballTargetX *= spazmatismFireballTargetDist; - spazmatismFireballTargetY *= spazmatismFireballTargetDist; - } + maxVelocity = 14f; - npc.velocity.X = (npc.velocity.X * 4f + spazmatismFireballTargetX) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + spazmatismFireballTargetY) / 5f; + destination = mechQueenSpacing; + distanceFromDestination = (destination - npc.Center).Length(); + idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitY); + + if (distanceFromDestination > maxVelocity) + idealVelocity *= maxVelocity / distanceFromDestination; + + float inertia = 5f; + npc.velocity = (npc.velocity * (inertia - 1f) + idealVelocity) / inertia; } 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; - } - } + npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); // Fire cursed flames for 5 seconds npc.ai[2] += 1f; @@ -1266,12 +983,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] += 0.4f; } - if (npc.ai[3] >= (oblivionAlive ? 60f : 30f)) + if (npc.ai[3] >= (oblivionAlive ? 60f : foveanatorAlive ? 45f : 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; @@ -1280,7 +995,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1290,15 +1005,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Vector2 fireballVelocity = ((Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * cursedFireballSpeed) + new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)) * 0.05f; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + fireballVelocity.SafeNormalize(Vector2.UnitY) * 50f, fireballVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -1311,21 +1019,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage; // Rotation and velocity - npc.rotation = spazmatismRotation; - float spazmatismPhase1ChargeSpeed = 18f; - spazmatismPhase1ChargeSpeed += 8f * enrageScale; + npc.rotation = hoverRotation; + + float chargeSpeed = 18f; + chargeSpeed += 8f * enrageScale; if (death) - spazmatismPhase1ChargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) - spazmatismPhase1ChargeSpeed *= 1.2f; + chargeSpeed *= 1.2f; + + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitX * direction) * chargeSpeed; - 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) @@ -1335,7 +1039,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; - float timeBeforeSlowDown = masterMode ? 30f : 10f; + float timeBeforeSlowDown = death ? 30f : 10f; if (npc.ai[2] >= timeBeforeSlowDown) { // Avoid cheap bullshit @@ -1344,23 +1048,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Slow down npc.velocity *= 0.8f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + if (Math.Abs(npc.velocity.X) < 0.1) npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + if (Math.Abs(npc.velocity.Y) < 0.1) npc.velocity.Y = 0f; } else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; // Charge 8 times - float chargeTime = masterMode ? 45f : 25f; + float chargeTime = death ? 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.rotation = spazmatismRotation; - float totalCharges = 8f; + + npc.rotation = hoverRotation; + + float totalCharges = foveanatorAlive ? 6f : 8f; if (death) totalCharges -= (float)Math.Round(phase1MaxChargesDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))); @@ -1418,7 +1124,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation += npc.ai[2]; npc.ai[1] += 1f; - if (masterMode && npc.ai[2] >= 0.2f) + if (death && npc.ai[2] >= 0.2f) { if (npc.ai[1] % 10f == 0f) { @@ -1428,7 +1134,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1458,7 +1164,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 2; i++) { @@ -1478,9 +1184,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Math.Abs(npc.velocity.X) < 0.1) npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + if (Math.Abs(npc.velocity.Y) < 0.1) npc.velocity.Y = 0f; } @@ -1514,61 +1220,29 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // 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; + float maxVelocity = 6.2f + (death ? 2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float acceleration = 0.1f + (death ? 0.03f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + maxVelocity += 3f * enrageScale; + acceleration += 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); + float distanceFromTarget = 180f; + Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; + float distanceFromDestination = (destination - npc.Center).Length(); + Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); 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 (distanceFromDestination > distanceFromTarget) + maxVelocity += MathHelper.Lerp(0f, oblivionAlive ? 3f : death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { - spazmatismFlamethrowerMaxSpeed *= 1.15f; - spazmatismFlamethrowerAccel *= 1.15f; + maxVelocity *= 1.15f; + acceleration *= 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; - } + npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); } // Fire flamethrower for x seconds @@ -1576,15 +1250,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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[1] = finalPhase ? 5f : 1f; npc.ai[2] = 0f; npc.ai[3] = 0f; 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) + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { // Play flame sound on timer npc.localAI[2] += 1f; @@ -1602,16 +1275,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] += 1f; npc.localAI[1] = 0f; - float spazmatismShadowFireballSpeed = 6f; - spazmatismShadowFireballSpeed += 3f * enrageScale; + float flamethrowerSpeed = foveanatorAlive ? 5f : 6f; + flamethrowerSpeed += 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(); + flamethrowerSpeed = MathHelper.Lerp(0.1f, flamethrowerSpeed, flamethrowerSpeedScalar); + int type = npc.ai[3] % 2f == 0f ? ModContent.ProjectileType() : 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1621,41 +1294,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + Vector2 flamethrowerVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * flamethrowerSpeed + npc.velocity * 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; - } + flamethrowerVelocity = (npc.rotation + MathHelper.PiOver2).ToRotationVector2() * flamethrowerSpeed + npc.velocity * 0.5f; - Vector2 flamethrowerVelocity = new Vector2(spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY); - if (canHit) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); + if (death && npc.ai[3] % 30f == 0f) { - 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; + type = npc.ai[3] % 60f == 0f ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; + damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 50f, flamethrowerVelocity * 2f, type, damage, 0f, Main.myPlayer); } } } @@ -1663,23 +1312,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; - } + maxVelocity = 14f; - npc.velocity.X = (npc.velocity.X * 59f + spazmatismFlamethrowerTargetX) / 60f; - npc.velocity.Y = (npc.velocity.Y * 59f + spazmatismFlamethrowerTargetY) / 60f; + destination = mechQueenSpacing; + distanceFromDestination = (destination - npc.Center).Length(); + idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitY); + + if (distanceFromDestination > maxVelocity) + idealVelocity *= maxVelocity / distanceFromDestination; + + float inertia = 60f; + npc.velocity = (npc.velocity * (inertia - 1f) + idealVelocity) / inertia; } } @@ -1696,15 +1339,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + npc.rotation = hoverRotation; + + float chargeSpeed = 18f + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + chargeSpeed += 16f * enrageScale; if (Main.getGoodWorld) - spazmatismPhase2ChargeSpeed *= 1.2f; + chargeSpeed *= 1.2f; + + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitX * direction) * chargeSpeed; - Vector2 distanceVector = Main.player[npc.target].Center - npc.Center; - npc.velocity = distanceVector.SafeNormalize(Vector2.UnitY) * spazmatismPhase2ChargeSpeed; npc.ai[1] = 2f; + return false; } @@ -1725,26 +1370,31 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + + if (Math.Abs(npc.velocity.X) < 0.1) npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + if (Math.Abs(npc.velocity.Y) < 0.1) npc.velocity.Y = 0f; } else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; // Charges 5 times if (npc.ai[2] >= (chargeTime * 1.6f) + (oblivionAlive ? 15f : 0f)) { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.rotation = spazmatismRotation; - if (npc.ai[3] >= 5f) + + npc.rotation = hoverRotation; + + float totalCharges = foveanatorAlive ? 4f : 5f; + if (npc.ai[3] >= totalCharges) { npc.ai[1] = 0f; npc.ai[3] = 0f; return false; } + npc.ai[1] = 1f; } } @@ -1766,10 +1416,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] == 0f) npc.localAI[1] = -20f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } // Set charging velocity @@ -1788,13 +1435,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 (npc.Distance(Main.player[npc.target].Center) < 100f) { if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) { @@ -1806,20 +1447,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.Center.Y > Main.player[npc.target].Center.Y) absoluteSpazXVel *= -1f; - npc.velocity.X = absoluteSpazYVel; - npc.velocity.Y = absoluteSpazXVel; + npc.velocity = new Vector2(absoluteSpazYVel, absoluteSpazXVel); } } } if (death) { - float velocity = spazmatismPhase3ChargeSpeed * 0.5f; + float projectileSpeed = 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1829,10 +1469,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + Vector2 projectileVelocity = (Main.player[npc.target].Center + ((!retAlive && bossRush) ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; 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))); @@ -1841,10 +1482,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] = 4f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } } @@ -1871,25 +1509,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = reducedSetDamage; npc.velocity *= 0.93f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + if (Math.Abs(npc.velocity.X) < 0.1) npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + if (Math.Abs(npc.velocity.Y) < 0.1) npc.velocity.Y = 0f; } else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + npc.rotation = npc.velocity.ToRotation() - 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.ForceNetUpdate(false); float chargeIncrement = 1f; - if (masterMode && Main.rand.NextBool() && npc.ai[3] < (retAlive ? 2f : 3f)) + if (death && Main.rand.NextBool() && npc.ai[3] < (retAlive ? 2f : 3f)) chargeIncrement = 2f; npc.ai[3] += chargeIncrement; @@ -1904,73 +1539,43 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Avoid cheap bullshit npc.damage = reducedSetDamage; - float chargeLineUpDist = retAlive ? 600f : 500f; + float chargeLineUpDistance = retAlive ? 600f : 500f; float chargeSpeed = 16f + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float chargeAccel = 0.4f + (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeAcceleration = 0.4f + (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); chargeSpeed += 5.333f * enrageScale; - chargeAccel += 0.133f * enrageScale; + chargeAcceleration += 0.133f * enrageScale; if (retAlive) { chargeSpeed *= 0.75f; - chargeAccel *= 0.75f; + chargeAcceleration *= 0.75f; } if (Main.getGoodWorld) { chargeSpeed *= 1.15f; - chargeAccel *= 1.15f; + chargeAcceleration *= 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; - } + Vector2 destination = Main.player[npc.target].Center + Vector2.UnitY * chargeLineUpDistance; + Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction) * chargeSpeed; + npc.SimpleFlyMovement(idealVelocity, chargeAcceleration); npc.ai[2] += 1f; // Fire shadowflames and cursed fireballs - float fireRate = retAlive ? 30f : 20f; + float fireRate = retAlive ? 30f : foveanatorAlive ? 25f : 20f; if (npc.ai[2] % fireRate == 0f) { npc.ai[3] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - float velocity = 16f; + float projectileSpeed = 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1980,7 +1585,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + Vector2 projectileVelocity = (Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 25f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); } } @@ -1993,10 +1598,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] = 0f; } - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.ForceNetUpdate(false); } } } @@ -2224,7 +1826,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2243,7 +1845,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector43 + laserVelocity.SafeNormalize(Vector2.UnitY) * 90f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -2365,7 +1967,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2382,7 +1984,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 90f, perturbedSpeed, type, damage, 0f, Main.myPlayer); Main.projectile[proj].tileCollide = false; } } @@ -2545,7 +2147,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2561,7 +2163,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector45 + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); } return false; @@ -2636,7 +2238,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2652,7 +2254,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector46 + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); } } @@ -2884,7 +2486,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -3022,7 +2624,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -3176,11 +2778,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 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) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -3212,7 +2814,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } Vector2 flamethrowerVelocity = new Vector2(num483, num484); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector51 + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector51 + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 50f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 26f7112402..9b0df45190 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -21,7 +21,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Despawn @@ -69,7 +68,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && impSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, impSpawn); break; @@ -82,7 +81,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += 1f; if (npc.ai[2] == 0f) { - if (masterMode) + if (death) npc.ai[1] += 2f; if (phase2) @@ -113,11 +112,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + int leechVelocity = death ? 12 : 9; Main.npc[leechSpawn].velocity.X = npc.direction * leechVelocity; } - if (phase2 || masterMode) + if (phase2 || death) { // Get target vector Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * npc.velocity.Length(); @@ -128,7 +127,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.projectile[proj].timeLeft = 600; Main.projectile[proj].tileCollide = false; - if (masterMode) + if (death) { float fireballVelocity = npc.velocity.Length() + 3f; projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * fireballVelocity; @@ -250,7 +249,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float halfAverageScreenWidth = 960f; float distanceBeforeSlowingDown = 640f; - float timeBeforeEnrage = (masterMode ? 150f : 600f) - (death ? (masterMode ? 130f : 390f) * (1f - lifeRatio) : 0f); + float timeBeforeEnrage = death ? (150f - 130f * (1f - lifeRatio)) : 600f; float speedMult = 1f; if (bossRush) @@ -272,8 +271,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < 2800f) + SoundEngine.PlaySound(SoundID.NPCDeath10 with { Pitch = SoundID.NPCDeath10.Pitch - 0.25f }, Main.LocalPlayer.Center); } } else if (distanceFromTarget < distanceBeforeSlowingDown) @@ -309,7 +308,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses speedMult += 0.2f; float masterModeVelocityBoost = 0f; - if (masterMode) + if (death) { float velocityBoostStartDistance = distanceBeforeSlowingDown; float velocityBoostMaxDistance = velocityBoostStartDistance * 1.5f; @@ -325,7 +324,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + masterModeVelocityBoost + velocityBoost; velocityX *= speedMult; - if (masterMode) + if (death) velocityX *= 1.2f; if (Main.getGoodWorld) @@ -442,7 +441,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (bossRush) chance /= 4; - else if (masterMode) + else if (death) chance /= 2; if (chance < 2) @@ -450,7 +449,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.rand.NextBool(chance)) { - int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(masterMode ? 2f : 1f, masterMode ? 8f : 4f, npc.life / (float)npc.lifeMax)); + int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(death ? 2f : 1f, death ? 8f : 4f, npc.life / (float)npc.lifeMax)); if (NPC.CountNPCS(NPCID.TheHungry) < maxHungriesBasedOnHP) { int hungryAmt = 0; @@ -466,7 +465,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } int maxValue = 1 + hungryAmt * 2; - if (masterMode) + if (death) maxValue /= 2; if (maxValue < 2) @@ -513,21 +512,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (death) 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) + if (death) Main.npc[eyeSpawn].ai[3] = -1f; mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; - int maxHungries = masterMode ? 16 : 11; - float maxOffset = masterMode ? (0.2f / 3f) : 0.1f; + int maxHungries = death ? 16 : 11; + float maxOffset = death ? (0.2f / 3f) : 0.1f; for (int j = 0; j < maxHungries; j++) { int hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); @@ -549,22 +548,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + CalamityUtils.CalamityTargeting(npc, default); - float acceleration = Main.masterMode ? 0.15f : 0.12f; + float acceleration = death ? 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.damage = death ? 180 : 120; npc.defense = 30; - acceleration += Main.masterMode ? 0.1f : 0.08f; + acceleration += death ? 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.damage = death ? 135 : 90; npc.defense = 20; - acceleration += Main.masterMode ? 0.05f : 0.04f; + acceleration += death ? 0.05f : 0.04f; } if (npc.whoAmI % 4 == 0) @@ -652,7 +654,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (wallLifeRatio < 0.1f) velocityBoost += 0.9f; - velocityBoost *= Main.masterMode ? 1.5f : 1.25f; + velocityBoost *= death ? 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) @@ -701,7 +703,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Avoid cheap bullshit @@ -729,7 +730,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Velocity, direction, and position bool shouldFireLasers = true; float phase2LifeRatio = 0.5f; - bool masterModeDetach = lifeRatio < phase2LifeRatio && masterMode; + bool masterModeDetach = lifeRatio < phase2LifeRatio && death; 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 (!masterModeDetach) { @@ -892,8 +893,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int projectileType = ProjectileID.EyeLaser; int damage = npc.GetProjectileDamage(projectileType); + bool targetTooClose = npc.Distance(Main.player[npc.target].Center) < 160f; + float projectileOffset = targetTooClose ? 60f : 150f; Vector2 projectileVelocity = (lookAt - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 150f; + Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileOffset; int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; @@ -944,7 +947,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + if (Main.dedServ && num355 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num355); break; @@ -1510,16 +1513,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; + num392 = Main.player[npc.target].Center.X - npc.Center.X; + num393 = Main.player[npc.target].Center.Y - npc.Center.Y; num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393); num394 = num397 / num394; num392 *= num394; num393 *= num394; + + bool targetTooClose = npc.Distance(Main.player[npc.target].Center) < 160f; + float projectileOffset = targetTooClose ? 60f : 150f; 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); + Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileOffset; + Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 1f, 0f); } } diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index b7d968484d..12cb14f419 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -577,9 +577,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies { MedusaHeadDustEffect(npc, time); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (!player.dead && player.active && player.FindBuffIndex(BuffID.Stoned) == -1) { if (npc.Distance(player.Center) < medusaEffectDistance) @@ -1346,7 +1346,7 @@ PrepareToShoot: if (npc.ai[3] < (float)aiGateValue && (Main.eclipse || !Main.dayTime || (double)npc.position.Y > Main.worldSurface * 16.0 || (Main.invasionType == InvasionID.GoblinArmy && (npcType == NPCID.Yeti || npcType == NPCID.ElfArcher)) || (Main.invasionType == InvasionID.GoblinArmy && (npcType == NPCID.GoblinPeon || npcType == NPCID.GoblinThief || npcType == NPCID.GoblinWarrior || npcType == NPCID.GoblinArcher || npcType == NPCID.GoblinSummoner)) || (npcType == NPCID.GoblinScout || (Main.invasionType == InvasionID.PirateInvasion && npcType >= 212 && npcType <= 216)) || (Main.invasionType == InvasionID.MartianMadness && (npcType == NPCID.BrainScrambler || npcType == NPCID.RayGunner || npcType == NPCID.MartianOfficer || npcType == NPCID.GrayGrunt || npcType == NPCID.MartianEngineer || npcType == NPCID.GigaZapper || npcType == NPCID.Scutlix || npcType == NPCID.MartianWalker)) || (npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.CorruptBunny || npcType == NPCID.Crab || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy || npcType == NPCID.SkeletonArcher || npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType() || npcType == NPCID.CorruptPenguin || npcType == NPCID.FaceMonster || npcType == NPCID.SnowFlinx || npcType == NPCID.Lihzahrd || npcType == NPCID.LihzahrdCrawler || npcType == NPCID.IcyMerman || npcType == NPCID.CochinealBeetle || npcType == NPCID.CyanBeetle || npcType == NPCID.LacBeetle || npcType == NPCID.SeaSnail || npcType == NPCID.BloodCrawler || npcType == NPCID.IceGolem || npcType == NPCID.ZombieMushroom || npcType == NPCID.ZombieMushroomHat || npcType == NPCID.AnomuraFungus || npcType == NPCID.MushiLadybug || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.CultistArcherBlue || npcType == NPCID.CultistArcherWhite || npcType == NPCID.CrimsonBunny || npcType == NPCID.CrimsonPenguin || npcType == NPCID.NebulaSoldier || (npcType == NPCID.StardustSoldier && (npc.ai[1] >= 180f || npc.ai[1] < 90f))) || (npcType == NPCID.StardustSpiderBig || npcType == NPCID.VortexRifleman || npcType == NPCID.VortexSoldier || npcType == NPCID.VortexHornet || npcType == NPCID.VortexLarva || npcType == NPCID.WalkingAntlion || npcType == NPCID.SolarDrakomire || npcType == NPCID.SolarSolenian || (npcType >= 524 && npcType <= 527)) || npcType == NPCID.DesertLamiaLight || npcType == NPCID.DesertLamiaDark || npcType == NPCID.DesertScorpionWalk || npcType == NPCID.DesertBeast)) { - 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)) + 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 || npcType == ModContent.NPCType()) && Main.rand.NextBool(1000)) { SoundEngine.PlaySound(SoundID.ZombieMoan, npc.Center); } @@ -1947,6 +1947,10 @@ PrepareToShoot: { velocityMax = 1.05f; } + if (npcType == ModContent.NPCType()) + { + velocityMax = 0.85f; + } if (npcType == NPCID.BloodZombie) { float playerDistance = (Main.player[npc.target].Center - npc.Center).Length(); @@ -1965,7 +1969,7 @@ PrepareToShoot: } velocityMax *= 0.8f; } - if (npcType == NPCID.BloodZombie || npcType == NPCID.Zombie || npcType == NPCID.BaldZombie || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.FemaleZombie || npcType == NPCID.ZombieRaincoat || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater) + if (npcType == NPCID.BloodZombie || npcType == NPCID.Zombie || npcType == NPCID.BaldZombie || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.FemaleZombie || npcType == NPCID.ZombieRaincoat || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater || npcType == ModContent.NPCType()) { velocityMax *= 1f + (1f - npc.scale); } @@ -3416,7 +3420,7 @@ PrepareToShoot: if (npcType == NPCID.GoblinPeon) { WorldGen.KillTile(x, y - 1, false, false, false); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)x, (float)(y - 1), 0f, 0, 0, 0); } @@ -3431,7 +3435,7 @@ PrepareToShoot: npc.ai[3] = (float)aiGateValue; npc.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenDoor) + if (Main.dedServ & canOpenDoor) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 0, (float)x, (float)(y - 1), (float)npc.direction, 0, 0, 0); } @@ -3444,7 +3448,7 @@ PrepareToShoot: npc.ai[3] = (float)aiGateValue; npc.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenTallGate) + if (Main.dedServ & canOpenTallGate) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 4, (float)x, (float)(y - 1), 0f, 0, 0, 0); } @@ -4595,7 +4599,7 @@ PrepareToShoot: } } - if (!npc.active && Main.netMode == NetmodeID.Server) + if (!npc.active && Main.dedServ) { NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -5068,13 +5072,13 @@ PrepareToShoot: int differentSegment = (int)Main.npc[q].ai[0]; Main.npc[q].active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, q, 0f, 0f, 0f, 0, 0, 0); } q = differentSegment; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } @@ -6158,16 +6162,17 @@ PrepareToShoot: if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - npc.ai[0] = 0f; - if (npc.type == NPCID.Harpy) { + float featherShootCutOffValue = CalamityWorld.revenge ? 90f : 60f; + if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + npc.ai[0] = featherShootCutOffValue + 1f; + if (npc.ai[0] >= HarpyFeatherGateValue) { npc.ai[0] = 0f; } - else if (npc.ai[0] % 30f == 0f && npc.ai[0] <= (CalamityWorld.revenge ? 90f : 60f)) + else if (npc.ai[0] % 30f == 0f && npc.ai[0] <= featherShootCutOffValue) { npc.ai[0] += 1f; if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) @@ -6191,11 +6196,15 @@ PrepareToShoot: if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon) { + float scytheShootCutOffValue = CalamityWorld.revenge ? 80f : 60f; + if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + npc.ai[0] = scytheShootCutOffValue + 1f; + if (npc.ai[0] >= DemonScytheGateValue) { npc.ai[0] = 0f; } - else if (npc.ai[0] % 20f == 0f && npc.ai[0] <= (CalamityWorld.revenge ? 80f : 60f)) + else if (npc.ai[0] % 20f == 0f && npc.ai[0] <= scytheShootCutOffValue) { npc.ai[0] += 1f; if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) @@ -6219,11 +6228,15 @@ PrepareToShoot: if (npc.type == NPCID.RedDevil) { + float tridentShootCutOffValue = 80f; + if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + npc.ai[0] = tridentShootCutOffValue + 1f; + if (npc.ai[0] >= RedDevilTridentGateValue) { npc.ai[0] = 0f; } - else if (npc.ai[0] % 20f == 0f && npc.ai[0] <= 80f) + else if (npc.ai[0] % 20f == 0f && npc.ai[0] <= tridentShootCutOffValue) { npc.ai[0] += 1f; if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) @@ -7887,6 +7900,7 @@ PrepareToShoot: npc.velocity.Y -= 6f; } } + else if (npc.type == NPCID.Tumbleweed && 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 -= 6f; @@ -7943,7 +7957,11 @@ PrepareToShoot: if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) { - if (npc.type == NPCID.Wolf || npc.type == ModContent.NPCType()) + if (npc.type == ModContent.NPCType()) + { + npc.velocity.X *= 0.99f; + } + if (npc.type == NPCID.Wolf) { if (npc.velocity.X > 0f && npc.direction < 0) { @@ -7958,11 +7976,11 @@ PrepareToShoot: { if (npc.velocity.X > 0f && npc.direction < 0) { - npc.velocity.X *= 0.8f; + npc.velocity.X *= 0.2f; } if (npc.velocity.X < 0f && npc.direction > 0) { - npc.velocity.X *= 0.8f; + npc.velocity.X *= 0.2f; } if (npc.direction > 0 && npc.velocity.X < 3f) { @@ -8640,7 +8658,7 @@ PrepareToShoot: dust.noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int j = 0; j < 4; j++) { diff --git a/NPCs/Yharon/YSky.cs b/NPCs/Yharon/YSky.cs index c033a023ce..216e0d8b3b 100644 --- a/NPCs/Yharon/YSky.cs +++ b/NPCs/Yharon/YSky.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Yharon float x = 0f; if (this.YIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.YIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.YIndex].Center); } return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensity * 0.66f; } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 8b492036f8..e67348f628 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -77,8 +77,8 @@ namespace CalamityMod.NPCs.Yharon public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 7; - NPCID.Sets.TrailingMode[NPC.type] = 1; + Main.npcFrameCount[Type] = 7; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.Yharon NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(10, 0, 0, 0); + NPC.value = Item.buyPrice(2, 50, 0, 0); NPC.boss = true; NPC.DR_NERD(normalDR); @@ -197,8 +197,8 @@ namespace CalamityMod.NPCs.Yharon float lifeRatio = NPC.life / (float)NPC.lifeMax; // Stop rain - if (CalamityConfig.Instance.BossesStopWeather) - CalamityMod.StopRain(); + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); // Variables bool bossRush = BossRushEvent.BossRushActive; @@ -919,9 +919,8 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { 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); + Vector2 teleportLocation = -Vector2.UnitY * bulletHellTeleportLocationDistance * (player.velocity.Y >= 0f).ToDirectionInt(); + Vector2 center = player.Center + teleportLocation; NPC.Center = center; int type = ModContent.ProjectileType(); @@ -936,7 +935,7 @@ namespace CalamityMod.NPCs.Yharon if (NPC.life < 1) NPC.life = 1; - NPC.HealEffect(-damageAmt, true); + NPC.DamageEffect(damageAmt); NPC.netUpdate = true; } } @@ -1290,9 +1289,8 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { 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); + Vector2 teleportLocation = -Vector2.UnitY * bulletHellTeleportLocationDistance * (player.velocity.Y >= 0f).ToDirectionInt(); + Vector2 center = player.Center + teleportLocation; NPC.Center = center; int type = ModContent.ProjectileType(); @@ -1307,7 +1305,7 @@ namespace CalamityMod.NPCs.Yharon if (NPC.life < 1) NPC.life = 1; - NPC.HealEffect(-damageAmt, true); + NPC.DamageEffect(damageAmt); NPC.netUpdate = true; } } @@ -2034,9 +2032,8 @@ namespace CalamityMod.NPCs.Yharon } 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); + Vector2 teleportLocation = -Vector2.UnitY * bulletHellTeleportLocationDistance * (targetData.velocity.Y >= 0f).ToDirectionInt(); + Vector2 center = targetData.Center + teleportLocation; NPC.Center = center; int type = ModContent.ProjectileType(); @@ -2051,7 +2048,7 @@ namespace CalamityMod.NPCs.Yharon if (NPC.life < 1) NPC.life = 1; - NPC.HealEffect(-damageAmt, true); + NPC.DamageEffect(damageAmt); NPC.netUpdate = true; } } @@ -2729,8 +2726,8 @@ namespace CalamityMod.NPCs.Yharon if (NPC.spriteDirection == 1) spriteEffects = ai2 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[Type] / 2); Color color = drawColor; Color invincibleColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); Color lerpEndColor = Color.White; @@ -2773,7 +2770,7 @@ namespace CalamityMod.NPCs.Yharon else color = drawColor; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { @@ -2782,7 +2779,7 @@ namespace CalamityMod.NPCs.Yharon afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -2822,7 +2819,7 @@ namespace CalamityMod.NPCs.Yharon afterimageScale = 20f; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int k = 0; k < additionalAfterimageAmt; k++) { @@ -2831,14 +2828,14 @@ namespace CalamityMod.NPCs.Yharon additionalAfterimageColor = NPC.GetAlpha(additionalAfterimageColor); additionalAfterimageColor *= 1f - additionalAfterimageOpacity; Vector2 additionalAfterimagePos = NPC.Center + (k / (float)additionalAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * additionalAfterimageOpacity - screenPos; - additionalAfterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + additionalAfterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; additionalAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, additionalAfterimagePos, NPC.frame, additionalAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, drawLocation, NPC.frame, invincible ? invincibleColor : NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -2899,7 +2896,7 @@ namespace CalamityMod.NPCs.Yharon blueGlowColor *= teleportGlowColorScaler; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int l = 1; l < afterimageAmt; l += afterimageIncrement) { @@ -2907,7 +2904,7 @@ namespace CalamityMod.NPCs.Yharon orangeAfterimageColor = Color.Lerp(orangeAfterimageColor, lerpEndColor, lerpInterpolateValue); orangeAfterimageColor *= (afterimageAmt - l) / 15f; Vector2 glowmaskAfterimagePos = NPC.oldPos[l] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - glowmaskAfterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + glowmaskAfterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; glowmaskAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, glowmaskAfterimagePos, NPC.frame, orangeAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -2935,7 +2932,7 @@ namespace CalamityMod.NPCs.Yharon additionalOrangeColor = NPC.GetAlpha(additionalOrangeColor); additionalOrangeColor *= 1f - additionalAfterimageOpacity; Vector2 additionalGlowmaskPos = NPC.Center + (m / (float)additionalAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * additionalAfterimageOpacity - screenPos; - additionalGlowmaskPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + additionalGlowmaskPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; additionalGlowmaskPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, additionalGlowmaskPos, NPC.frame, additionalOrangeColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -3040,7 +3037,7 @@ namespace CalamityMod.NPCs.Yharon if (BossRushEvent.BossRushActive) return; - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedYharon); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedYharon); CalamityGlobalNPC.SetNewBossJustDowned(NPC); // If Yharon has not been killed yet, notify players of Auric Ore @@ -3266,7 +3263,7 @@ namespace CalamityMod.NPCs.Yharon // Turn into dust on death. if (NPC.life <= 0) - DeathAshParticle.CreateAshesFromNPC(NPC); + DeathAshParticle.CreateAshesFromNPC(NPC, Vector2.Zero); } } #endregion diff --git a/Packets/CalamityPacket.cs b/Packets/CalamityPacket.cs new file mode 100644 index 0000000000..b21d3795b1 --- /dev/null +++ b/Packets/CalamityPacket.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + public abstract class CalamityPacket + { + public abstract byte MessageType { get; } + public abstract void HandlePacket(in BinaryReader packet, int sender); + + public virtual void OnLoaded() { } + public virtual void OnUnloaded() { } + + internal PropertyInfo _Prop_Static_Instance; + + public void CloneAndBroadcast(in BinaryReader packet, long startIndex, int length, int ignoreClient = -1) + { + if (!Main.dedServ) + return; + + if (startIndex < 0) + return; + + packet.BaseStream.Position = startIndex; + + // Limit stackalloc size to 256 bytes + Span buffer = length <= 256 ? stackalloc byte[length] : new byte[length]; + packet.BaseStream.Read(buffer); + + var newPacket = CreateBasePacket(); + newPacket.Write(buffer); + newPacket.Send(ignoreClient); + } + + public ModPacket CreateBasePacket() + { + var packet = CalamityMod.Instance.GetPacket(); + packet.Write(MessageType); + return packet; + } + } +} diff --git a/Packets/Draedon/CodebreakerSummonStuffPacket.cs b/Packets/Draedon/CodebreakerSummonStuffPacket.cs new file mode 100644 index 0000000000..652eca0e97 --- /dev/null +++ b/Packets/Draedon/CodebreakerSummonStuffPacket.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.World; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class CodebreakerSummonStuffPacket : CalamityPacket + { + public static CodebreakerSummonStuffPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.CodebreakerSummonStuff; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(CalamityWorld.DraedonSummonCountdown); + packet.WriteVector2(CalamityWorld.DraedonSummonPosition); + packet.Write(CalamityWorld.DraedonMechdusa); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + CalamityWorld.DraedonSummonCountdown = packet.ReadInt32(); + CalamityWorld.DraedonSummonPosition = packet.ReadVector2(); + CalamityWorld.DraedonMechdusa = packet.ReadBoolean(); + } + } +} diff --git a/Packets/Draedon/ExoMechSelectionPacket.cs b/Packets/Draedon/ExoMechSelectionPacket.cs new file mode 100644 index 0000000000..c49253b0b4 --- /dev/null +++ b/Packets/Draedon/ExoMechSelectionPacket.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.World; + +namespace CalamityMod.Packets +{ + public sealed class ExoMechSelectionPacket : CalamityPacket + { + public static ExoMechSelectionPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.ExoMechSelection; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write((int)CalamityWorld.DraedonMechToSummon); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + CalamityWorld.DraedonMechToSummon = (ExoMech)packet.ReadInt32(); + } + } +} diff --git a/Packets/Entities/Androomba/SyncAndroombaAIPacket.cs b/Packets/Entities/Androomba/SyncAndroombaAIPacket.cs new file mode 100644 index 0000000000..96ccf4b5be --- /dev/null +++ b/Packets/Entities/Androomba/SyncAndroombaAIPacket.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.DraedonLabThings; +using CalamityMod.NPCs.TownNPCs; +using Microsoft.Build.Execution; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class SyncAndroombaAIPacket : CalamityPacket + { + public static SyncAndroombaAIPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncAndroombaAI; + + public static void Send(AndroombaFriendly roomba, int phase = -1, int toClient = -1, int ignoreClient = -1) + { + if (roomba is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(roomba); + packet.Write(phase != -1 ? phase : (int)roomba.NPC.ai[0]); // Phase + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var roomba = packet.ReadModNPC(); + var phase = packet.ReadInt32(); + + if (roomba is null) + return; + + if (Main.dedServ) + AndroombaFriendly.ChangeAI(roomba.NPC.whoAmI, phase); + } + } +} diff --git a/Packets/Entities/Androomba/SyncAndroombaSolutionPacket.cs b/Packets/Entities/Androomba/SyncAndroombaSolutionPacket.cs new file mode 100644 index 0000000000..e6ac9e69f8 --- /dev/null +++ b/Packets/Entities/Androomba/SyncAndroombaSolutionPacket.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.TownNPCs; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class SyncAndroombaSolutionPacket : CalamityPacket + { + public static SyncAndroombaSolutionPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncAndroombaSolution; + + public static void Send(AndroombaFriendly roomba, int solType = -1, int toClient = -1, int ignoreClient = -1) + { + if (roomba is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(roomba); + packet.Write(solType != -1 ? solType : (int)roomba.NPC.ai[3]); // Solution + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var roomba = packet.ReadModNPC(); + var solution = packet.ReadInt32(); + + if (roomba is null) + return; + + if (Main.dedServ) + AndroombaFriendly.SwapSolution(roomba.NPC.whoAmI, solution); + } + } +} diff --git a/Packets/Entities/DemonSwordImpalesSyncPacket.cs b/Packets/Entities/DemonSwordImpalesSyncPacket.cs new file mode 100644 index 0000000000..78d578c7bc --- /dev/null +++ b/Packets/Entities/DemonSwordImpalesSyncPacket.cs @@ -0,0 +1,33 @@ +using System.IO; +using Terraria; + +namespace CalamityMod.Packets.Entities +{ + public sealed class DemonSwordImpalesSyncPacket : CalamityPacket + { + public static DemonSwordImpalesSyncPacket Instance { get; private set; } + public override byte MessageType => (byte)CalamityModMessageType.SyncNPCDemonSwordImpales; + + public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) + { + if (npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(npc); + packet.Write(npc.Calamity().demonSwordImpales); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var npc = packet.ReadNPC(); + var impales = packet.ReadInt32(); + + if (npc is null) + return; + + npc.Calamity().demonSwordImpales = impales; + } + } +} diff --git a/Packets/Entities/DemonicFlamesSyncPacket.cs b/Packets/Entities/DemonicFlamesSyncPacket.cs new file mode 100644 index 0000000000..95eeef8c51 --- /dev/null +++ b/Packets/Entities/DemonicFlamesSyncPacket.cs @@ -0,0 +1,33 @@ +using System.IO; +using Terraria; + +namespace CalamityMod.Packets.Entities +{ + public sealed class DemonicFlamesSyncPacket : CalamityPacket + { + public static DemonicFlamesSyncPacket Instance { get; private set; } + public override byte MessageType => (byte)CalamityModMessageType.SyncNPCDemonicFlamesDamage; + + public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) + { + if (npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(npc); + packet.Write(npc.Calamity().demonicFlamesBonusDamage); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var npc = packet.ReadNPC(); + var damage = packet.ReadInt32(); + + if (npc is null) + return; + + npc.Calamity().demonicFlamesBonusDamage = damage; + } + } +} diff --git a/Packets/Entities/PlaceAltCritterPacket.cs b/Packets/Entities/PlaceAltCritterPacket.cs new file mode 100644 index 0000000000..fe85f6574e --- /dev/null +++ b/Packets/Entities/PlaceAltCritterPacket.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class PlaceAltCritterPacket : CalamityPacket + { + public static PlaceAltCritterPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.PlaceAltCritter; + + /// + /// Same Method, but uses critterItem.makeNPC and critterItem.type for shorthanded call + /// + public static void Send(Player placer, int x, int y, Item critterItem, int colorType, int toClient = -1, int ignoreClient = -1) + { + if (critterItem is null) + return; + + Send(placer, x, y, critterItem.makeNPC, critterItem.type, colorType, toClient, ignoreClient); + } + + public static void Send(Player placer, int x, int y, int critterNPCType, int itemType, int colorType, int toClient = -1, int ignoreClient = -1) + { + if (placer is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(placer); + packet.Write(x); + packet.Write(y); + packet.Write(critterNPCType); + packet.Write(itemType); + packet.Write(colorType); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var placerplayer = packet.ReadPlayer(); + int posX = packet.ReadInt32(); + int posY = packet.ReadInt32(); + int type = packet.ReadInt32(); + int itemType = packet.ReadInt32(); + float color = packet.ReadInt32(); + if (Main.dedServ && placerplayer is not null) + { + int newNPCIndex = NPC.NewNPC(placerplayer.GetSource_ReleaseEntity(), posX, posY, type, ai1: color); + if (newNPCIndex >= Main.maxNPCs) + return; + + var npc = Main.npc[newNPCIndex]; + npc.catchItem = itemType; + npc.releaseOwner = (short)placerplayer.whoAmI; + CalamityNetcode.SyncNPC(npc); // releaseOwner should be synced in here + } + } + } +} diff --git a/Packets/Entities/Providence/PSCChallengeSyncPacket.cs b/Packets/Entities/Providence/PSCChallengeSyncPacket.cs new file mode 100644 index 0000000000..4aa85f4e3d --- /dev/null +++ b/Packets/Entities/Providence/PSCChallengeSyncPacket.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.Providence; + +namespace CalamityMod.Packets +{ + public sealed class PSCChallengeSyncPacket : CalamityPacket + { + public static PSCChallengeSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.PSCChallengeSync; + + public static void Send(Providence providence, int toClient = -1, int ignoreClient = -1) + { + if (providence is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(providence); + packet.Write(providence.challenge); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var providence = packet.ReadModNPC(); + var challenge = packet.ReadBoolean(); + + if (providence is null) + return; + + providence.challenge = challenge; + } + } +} diff --git a/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs b/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs new file mode 100644 index 0000000000..42134ed1c2 --- /dev/null +++ b/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.Providence; + +namespace CalamityMod.Packets +{ + public sealed class ProvidenceDyeConditionSyncPacket : CalamityPacket + { + public static ProvidenceDyeConditionSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.ProvidenceDyeConditionSync; + + public static void Send(Providence providence, int toClient = -1, int ignoreClient = -1) + { + if (providence is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(providence); + packet.Write(providence.hasBeenGivenFullPower); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var providence = packet.ReadModNPC(); + var hasBeenEnraged = packet.ReadBoolean(); + + if (providence is null) + return; + + providence.hasBeenGivenFullPower = hasBeenEnraged; + } + } +} diff --git a/Packets/Entities/SlabCrab/SyncSlabCrabAIPacket.cs b/Packets/Entities/SlabCrab/SyncSlabCrabAIPacket.cs new file mode 100644 index 0000000000..1c7b9f77d2 --- /dev/null +++ b/Packets/Entities/SlabCrab/SyncSlabCrabAIPacket.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.TownNPCs; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class SyncSlabCrabAIPacket : CalamityPacket + { + public static SyncSlabCrabAIPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncSlabCrabAI; + + public static void Send(SlabCrab crab, int phase = -1, int toClient = -1, int ignoreClient = -1) + { + if (crab is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(crab); + packet.Write(phase != -1 ? phase : (int)crab.NPC.ai[0]); // Phase + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var crab = packet.ReadModNPC(); + var phase = packet.ReadInt32(); + + if (crab is null) + return; + + if (Main.dedServ) + crab.ChangePhase(phase); + } + } +} diff --git a/Packets/Entities/SpawnBossOnPositionPacket.cs b/Packets/Entities/SpawnBossOnPositionPacket.cs new file mode 100644 index 0000000000..33c4ef8f2e --- /dev/null +++ b/Packets/Entities/SpawnBossOnPositionPacket.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; + +namespace CalamityMod.Packets +{ + public sealed class SpawnBossOnPositionPacket : CalamityPacket + { + public static SpawnBossOnPositionPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SpawnBossOnPosition; + + public static void Send(int x, int y, int npcType, Player target = null, int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(x); + packet.Write(y); + packet.Write(npcType); + packet.Write((byte)(target?.whoAmI ?? byte.MaxValue)); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var x = packet.ReadInt32(); + var y = packet.ReadInt32(); + var npcType = packet.ReadInt32(); + var target = packet.ReadPlayer(); + var targetIndex = target?.whoAmI ?? 255; + + if (!Main.dedServ) + return; + + int spawnedNPCIdx = NPC.NewNPC(NPC.GetBossSpawnSource(targetIndex), x, y, npcType, Start: 1); + if (spawnedNPCIdx >= Main.maxNPCs) + return; + + NPC npc = Main.npc[spawnedNPCIdx]; + npc.timeLeft *= 20; + npc.target = targetIndex; + + CalamityUtils.BossAwakenMessage(spawnedNPCIdx); + CalamityNetcode.SyncNPC(npc); + } + } +} diff --git a/Packets/Entities/SpawnNPCOnPlayerPacket.cs b/Packets/Entities/SpawnNPCOnPlayerPacket.cs new file mode 100644 index 0000000000..a256aa4c57 --- /dev/null +++ b/Packets/Entities/SpawnNPCOnPlayerPacket.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class SpawnNPCOnPlayerPacket : CalamityPacket + { + public static SpawnNPCOnPlayerPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SpawnNPCOnPlayer; + + public static void Send(Player player, int x, int y, int npcType, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.Write(x); + packet.Write(y); + packet.Write(npcType); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadPlayer(); + var x = packet.ReadInt32(); + var y = packet.ReadInt32(); + var npcType = packet.ReadInt32(); + + if (player is null) + return; + + if (Main.dedServ) + { + int spawnedNPC = NPC.NewNPC(new EntitySource_WorldEvent(), x, y, npcType, Target: player.whoAmI); + if (spawnedNPC >= Main.maxNPCs) + return; + + CalamityNetcode.SyncNPC(spawnedNPC); + } + } + } +} diff --git a/Packets/Entities/SuperDummy/DeleteAllSuperDummiesPacket.cs b/Packets/Entities/SuperDummy/DeleteAllSuperDummiesPacket.cs new file mode 100644 index 0000000000..3ea889f024 --- /dev/null +++ b/Packets/Entities/SuperDummy/DeleteAllSuperDummiesPacket.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Items; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class DeleteAllSuperDummiesPacket : CalamityPacket + { + public static DeleteAllSuperDummiesPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.DeleteAllSuperDummies; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + // There is nothing in the packet! We only need to call delete method on Server + if (Main.dedServ) + SuperDummy.DeleteDummies(); + } + } +} diff --git a/Packets/Entities/SuperDummy/SpawnSuperDummyPacket.cs b/Packets/Entities/SuperDummy/SpawnSuperDummyPacket.cs new file mode 100644 index 0000000000..9eac863d7e --- /dev/null +++ b/Packets/Entities/SuperDummy/SpawnSuperDummyPacket.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + public sealed class SpawnSuperDummyPacket : CalamityPacket + { + public static SpawnSuperDummyPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SpawnSuperDummy; + + public static void Send(int x, int y, int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(x); + packet.Write(y); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var x = packet.ReadInt32(); + var y = packet.ReadInt32(); + + // Not strictly necessary, but helps prevent unnecessary packetstorm in MP + if (Main.dedServ) + NPC.NewNPC(new EntitySource_WorldEvent(), x, y, ModContent.NPCType()); + } + } +} diff --git a/Packets/Entities/SyncCalamityNPCAIArrayPacket.cs b/Packets/Entities/SyncCalamityNPCAIArrayPacket.cs new file mode 100644 index 0000000000..8603df26ac --- /dev/null +++ b/Packets/Entities/SyncCalamityNPCAIArrayPacket.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class SyncCalamityNPCAIArrayPacket : CalamityPacket + { + // MIGRATED COMMENTS FROM: 'CalamityNetcode.cs' + // - This code has been edited to fail gracefully when trying to provide data for an invalid NPC. + + public static SyncCalamityNPCAIArrayPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncCalamityNPCAIArray; + + public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) + { + if (npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(npc); + + var calNPC = npc.Calamity(); + packet.Write(calNPC.newAI[0]); + packet.Write(calNPC.newAI[1]); + packet.Write(calNPC.newAI[2]); + packet.Write(calNPC.newAI[3]); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var npc = packet.ReadNPC(); + var ai0 = packet.ReadSingle(); + var ai1 = packet.ReadSingle(); + var ai2 = packet.ReadSingle(); + var ai3 = packet.ReadSingle(); + + if (npc is null) + return; + + var calNPC = npc.Calamity(); + calNPC.newAI[0] = ai0; + calNPC.newAI[1] = ai1; + calNPC.newAI[2] = ai2; + calNPC.newAI[3] = ai3; + } + } +} diff --git a/Packets/Entities/SyncNPCMotionDataToServerPacket.cs b/Packets/Entities/SyncNPCMotionDataToServerPacket.cs new file mode 100644 index 0000000000..0b86cd640e --- /dev/null +++ b/Packets/Entities/SyncNPCMotionDataToServerPacket.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Packets +{ + public sealed class SyncNPCMotionDataToServerPacket : CalamityPacket + { + public static SyncNPCMotionDataToServerPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncNPCMotionDataToServer; + + public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) + { + if (npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(npc); + packet.WriteVector2(npc.Center); + packet.WriteVector2(npc.velocity); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var npc = packet.ReadNPC(); + var center = packet.ReadVector2(); + var velocity = packet.ReadVector2(); + if (Main.dedServ && npc is not null) + { + npc.Center = center; + npc.velocity = velocity; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); + } + } + } +} diff --git a/Packets/Entities/SyncNPCPosAndRotOnlyPacket.cs b/Packets/Entities/SyncNPCPosAndRotOnlyPacket.cs new file mode 100644 index 0000000000..403ccef71c --- /dev/null +++ b/Packets/Entities/SyncNPCPosAndRotOnlyPacket.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + public sealed class SyncNPCPosAndRotOnlyPacket : CalamityPacket + { + public static SyncNPCPosAndRotOnlyPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncNPCPosAndRotOnly; + + public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) + { + if (npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(npc); + packet.WriteVector2(npc.position); + packet.Write((Half)npc.rotation); //rotation unit is radian (-π/2 ≤ rotation ≤ π/2) so Half precision should works + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var npc = packet.ReadNPC(); + var position = packet.ReadVector2(); + var rotation = (float)packet.ReadHalf(); + + if (npc is null) + return; + + npc.position = position; + npc.rotation = rotation; + + if (Main.dedServ) + { + Send(npc, ignoreClient: sender); + } + } + } +} diff --git a/Packets/Entities/SyncVanillaNPCLocalAIArrayPacket.cs b/Packets/Entities/SyncVanillaNPCLocalAIArrayPacket.cs new file mode 100644 index 0000000000..25f5ba8f6a --- /dev/null +++ b/Packets/Entities/SyncVanillaNPCLocalAIArrayPacket.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class SyncVanillaNPCLocalAIArrayPacket : CalamityPacket + { + public static SyncVanillaNPCLocalAIArrayPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncVanillaNPCLocalAIArray; + + public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) + { + if (npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(npc); + packet.Write(npc.localAI[0]); + packet.Write(npc.localAI[1]); + packet.Write(npc.localAI[2]); + packet.Write(npc.localAI[3]); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var npc = packet.ReadNPC(); + var ai0 = packet.ReadSingle(); + var ai1 = packet.ReadSingle(); + var ai2 = packet.ReadSingle(); + var ai3 = packet.ReadSingle(); + + if (npc is null) + return; + + npc.localAI[0] = ai0; + npc.localAI[1] = ai1; + npc.localAI[2] = ai2; + npc.localAI[3] = ai3; + } + } +} diff --git a/Packets/Entities/VanillaChanges/SyncDestroyerLaserColorPacket.cs b/Packets/Entities/VanillaChanges/SyncDestroyerLaserColorPacket.cs new file mode 100644 index 0000000000..1758573093 --- /dev/null +++ b/Packets/Entities/VanillaChanges/SyncDestroyerLaserColorPacket.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class SyncDestroyerLaserColorPacket : CalamityPacket + { + public static SyncDestroyerLaserColorPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncDestroyerLaserColor; + + public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) + { + if (npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(npc); + packet.Write(npc.Calamity().destroyerLaserColor); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var npc = packet.ReadNPC(); + var laserColor = packet.ReadInt32(); + + if (npc is null) + return; + + npc.Calamity().destroyerLaserColor = laserColor; + } + } +} diff --git a/Packets/Events/AcidRain/AcidRainOldDukeSummonSyncPacket.cs b/Packets/Events/AcidRain/AcidRainOldDukeSummonSyncPacket.cs new file mode 100644 index 0000000000..e143687386 --- /dev/null +++ b/Packets/Events/AcidRain/AcidRainOldDukeSummonSyncPacket.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Events; + +namespace CalamityMod.Packets +{ + public sealed class AcidRainOldDukeSummonSyncPacket : CalamityPacket + { + public static AcidRainOldDukeSummonSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.AcidRainOldDukeSummonSync; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(AcidRainEvent.HasTriedToSummonOldDuke); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + AcidRainEvent.HasTriedToSummonOldDuke = packet.ReadBoolean(); + } + } +} diff --git a/Packets/Events/AcidRain/AcidRainSyncPacket.cs b/Packets/Events/AcidRain/AcidRainSyncPacket.cs new file mode 100644 index 0000000000..c45dbf3546 --- /dev/null +++ b/Packets/Events/AcidRain/AcidRainSyncPacket.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Events; + +namespace CalamityMod.Packets +{ + public sealed class AcidRainSyncPacket : CalamityPacket + { + public static AcidRainSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.AcidRainSync; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(AcidRainEvent.AcidRainEventIsOngoing); + packet.Write(AcidRainEvent.AccumulatedKillPoints); + packet.Write(AcidRainEvent.TimeSinceLastAcidRainKill); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + AcidRainEvent.AcidRainEventIsOngoing = packet.ReadBoolean(); + AcidRainEvent.AccumulatedKillPoints = packet.ReadInt32(); + AcidRainEvent.TimeSinceLastAcidRainKill = packet.ReadInt32(); + } + } +} diff --git a/Packets/Events/AcidRain/EncounteredOldDukeSyncPacket.cs b/Packets/Events/AcidRain/EncounteredOldDukeSyncPacket.cs new file mode 100644 index 0000000000..3062cf61ef --- /dev/null +++ b/Packets/Events/AcidRain/EncounteredOldDukeSyncPacket.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Events; + +namespace CalamityMod.Packets +{ + public sealed class EncounteredOldDukeSyncPacket : CalamityPacket + { + public static EncounteredOldDukeSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.EncounteredOldDukeSync; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(AcidRainEvent.OldDukeHasBeenEncountered); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + AcidRainEvent.OldDukeHasBeenEncountered = packet.ReadBoolean(); + } + } +} diff --git a/Packets/Events/BossRush/BRHostileProjKillSyncPacket.cs b/Packets/Events/BossRush/BRHostileProjKillSyncPacket.cs new file mode 100644 index 0000000000..d06602c73d --- /dev/null +++ b/Packets/Events/BossRush/BRHostileProjKillSyncPacket.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Events; + +namespace CalamityMod.Packets +{ + public sealed class BRHostileProjKillSyncPacket : CalamityPacket + { + public static BRHostileProjKillSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.BRHostileProjKillSync; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(BossRushEvent.HostileProjectileKillCounter); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + BossRushEvent.HostileProjectileKillCounter = packet.ReadInt32(); + } + } +} diff --git a/Packets/Events/BossRush/BossRushEndTimerPacket.cs b/Packets/Events/BossRush/BossRushEndTimerPacket.cs new file mode 100644 index 0000000000..c39bdff49c --- /dev/null +++ b/Packets/Events/BossRush/BossRushEndTimerPacket.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Events; + +namespace CalamityMod.Packets +{ + public sealed class BossRushEndTimerPacket : CalamityPacket + { + public static BossRushEndTimerPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.BossRushEndTimer; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(BossRushEvent.EndTimer); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + BossRushEvent.EndTimer = packet.ReadInt32(); + } + } +} diff --git a/Packets/Events/BossRush/BossRushStagePacket.cs b/Packets/Events/BossRush/BossRushStagePacket.cs new file mode 100644 index 0000000000..ab0ef459bb --- /dev/null +++ b/Packets/Events/BossRush/BossRushStagePacket.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Events; + +namespace CalamityMod.Packets +{ + public sealed class BossRushStagePacket : CalamityPacket + { + public static BossRushStagePacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.BossRushStage; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(BossRushEvent.BossRushStage); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + BossRushEvent.BossRushStage = packet.ReadInt32(); + } + } +} diff --git a/Packets/Events/BossRush/BossRushStartTimerPacket.cs b/Packets/Events/BossRush/BossRushStartTimerPacket.cs new file mode 100644 index 0000000000..22c1ba7a1f --- /dev/null +++ b/Packets/Events/BossRush/BossRushStartTimerPacket.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Events; + +namespace CalamityMod.Packets +{ + public sealed class BossRushStartTimerPacket : CalamityPacket + { + public static BossRushStartTimerPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.BossRushStartTimer; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(BossRushEvent.StartTimer); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + BossRushEvent.StartTimer = packet.ReadInt32(); + } + } +} diff --git a/Packets/Events/BossRush/EndBossRushPacket.cs b/Packets/Events/BossRush/EndBossRushPacket.cs new file mode 100644 index 0000000000..52e5e9deea --- /dev/null +++ b/Packets/Events/BossRush/EndBossRushPacket.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Events; + +namespace CalamityMod.Packets +{ + public sealed class EndBossRushPacket : CalamityPacket + { + public static EndBossRushPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.EndBossRush; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + BossRushEvent.EndEffects(); + } + } +} diff --git a/Packets/MusicSystems/MusicEventSyncRequestPacket.cs b/Packets/MusicSystems/MusicEventSyncRequestPacket.cs new file mode 100644 index 0000000000..44b5425f09 --- /dev/null +++ b/Packets/MusicSystems/MusicEventSyncRequestPacket.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ModLoader; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Packets +{ + public sealed class MusicEventSyncRequestPacket : CalamityPacket + { + public static MusicEventSyncRequestPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.MusicEventSyncRequest; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + // Only MP Client should send request! + if (Main.netMode != NetmodeID.MultiplayerClient) + return; + + var packet = Instance.CreateBasePacket(); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + // Only fulfill requests as the server host + if (!Main.dedServ) + return; + + MusicEventSyncResponsePacket.Send(toClient: sender); + } + } +} diff --git a/Packets/MusicSystems/MusicEventSyncResponsePacket.cs b/Packets/MusicSystems/MusicEventSyncResponsePacket.cs new file mode 100644 index 0000000000..adf9a3751e --- /dev/null +++ b/Packets/MusicSystems/MusicEventSyncResponsePacket.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + public sealed class MusicEventSyncResponsePacket : CalamityPacket + { + public static MusicEventSyncResponsePacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.MusicEventSyncResponse; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + // Only Server should send Reponse to Clients + if (!Main.dedServ) + return; + + var packet = Instance.CreateBasePacket(); + int trackCount = MusicEventSystem.PlayedEvents.Count; + packet.Write(trackCount); + + for (int i = 0; i < trackCount; i++) + packet.Write(MusicEventSystem.PlayedEvents[i]); + + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + // Only receive info as clients + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Still consume the packet anyways + int c = packet.ReadInt32(); + for (int i = 0; i < c; i++) + _ = packet.ReadString(); + + return; + } + + MusicEventSystem.PlayedEvents.Clear(); + + int trackCount = packet.ReadInt32(); + for (int i = 0; i < trackCount; i++) + MusicEventSystem.PlayedEvents.Add(packet.ReadString()); + } + } +} diff --git a/Packets/Players/AdrenalineSyncPacket.cs b/Packets/Players/AdrenalineSyncPacket.cs new file mode 100644 index 0000000000..9071e81810 --- /dev/null +++ b/Packets/Players/AdrenalineSyncPacket.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class AdrenalineSyncPacket : CalamityPacket + { + public static AdrenalineSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.AdrenalineSync; + + public static void Send(CalamityPlayer playerToSync, int toClient = -1, int ignoreClient = -1) + { + if (playerToSync is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(playerToSync); + packet.Write(playerToSync.adrenaline); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var adrenaline = packet.ReadSingle(); + + if (player is null) + return; + + player.adrenaline = adrenaline; + + if (Main.dedServ) + Send(player, ignoreClient: sender); + } + } +} diff --git a/Packets/Players/CooldownAdditionPacket.cs b/Packets/Players/CooldownAdditionPacket.cs new file mode 100644 index 0000000000..a5906855a9 --- /dev/null +++ b/Packets/Players/CooldownAdditionPacket.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Packets +{ + public sealed class CooldownAdditionPacket : CalamityPacket + { + public static CooldownAdditionPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.CooldownAddition; + + public static void Send(CalamityPlayer player, CooldownInstance cd, int toClient = -1, int ignoreClient = -1) + { + Send(player, cd.netID, cd.duration, cd.timeLeft, toClient, ignoreClient); + } + + public static void Send(CalamityPlayer player, ushort netID, int duration, int timeLeft, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.Write(netID); + packet.Write(duration); + packet.Write(timeLeft); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var netID = packet.ReadUInt16(); + var duration = packet.ReadInt32(); + var timeLeft = packet.ReadInt32(); + + if (player is null) + return; + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + CooldownInstance instance = new CooldownInstance(player.Player, netID, duration, timeLeft); + + // Actually assign this freshly synced cooldown to the appropriate player. + string id = CooldownRegistry.registry[instance.netID].ID; + player.cooldowns[id] = instance; + } + else if (Main.dedServ) + { + // Server should NOT handle cooldown itself! + // Server doesn't have information for cooldown netIDs! + Send(player, netID, duration, timeLeft, ignoreClient: sender); + } + } + } +} diff --git a/Packets/Players/CooldownRemovalPacket.cs b/Packets/Players/CooldownRemovalPacket.cs new file mode 100644 index 0000000000..1bcd2235f6 --- /dev/null +++ b/Packets/Players/CooldownRemovalPacket.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using Terraria.ID; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class CooldownRemovalPacket : CalamityPacket + { + public static CooldownRemovalPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.CooldownRemoval; + + public static void Send(CalamityPlayer player, ushort[] netIDsToRemove, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.Write(netIDsToRemove.Length); + for (int i = 0; i < netIDsToRemove.Length; i++) + { + packet.Write(netIDsToRemove[i]); + } + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var count = packet.ReadInt32(); + var netIDsToRemove = new ushort[count]; + for (int i = 0; i < count; i++) + { + netIDsToRemove[i] = packet.ReadUInt16(); + } + + if (player is null) + return; + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + foreach (var netID in netIDsToRemove) + { + player.cooldowns.Remove(CooldownRegistry.registry[netID].ID); + } + } + else if (Main.dedServ) + { + // Server should NOT handle cooldown itself! + // Server doesn't have information for cooldown netIDs! + Send(player, netIDsToRemove, ignoreClient: sender); + } + } + } +} diff --git a/Packets/Players/DefenseDamageSyncPacket.cs b/Packets/Players/DefenseDamageSyncPacket.cs new file mode 100644 index 0000000000..8dfc63ca20 --- /dev/null +++ b/Packets/Players/DefenseDamageSyncPacket.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + public sealed class DefenseDamageSyncPacket : CalamityPacket + { + public static DefenseDamageSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.DefenseDamageSync; + + public static void Send(CalamityPlayer playerToSync, int toClient = -1, int ignoreClient = -1) + { + if (playerToSync is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(playerToSync); + packet.Write(playerToSync.totalDefenseDamage); + packet.Write(playerToSync.defenseDamageRecoveryFrames); + packet.Write(playerToSync.totalDefenseDamageRecoveryFrames); + packet.Write(playerToSync.defenseDamageDelayFrames); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var totalDefDamage = packet.ReadInt32(); + var defDamageRecoverFrames = packet.ReadInt32(); + var totalDefDamageRecoverFrames = packet.ReadInt32(); + var defDamageDelayFrames = packet.ReadInt32(); + + if (player is null) + return; + + player.totalDefenseDamage = totalDefDamage; + player.defenseDamageRecoveryFrames = defDamageRecoverFrames; + player.totalDefenseDamageRecoveryFrames = totalDefDamageRecoverFrames; + player.defenseDamageDelayFrames = defDamageDelayFrames; + + if (Main.dedServ) + Send(player, ignoreClient: sender); + } + } +} diff --git a/Packets/Players/MousePositionSyncPacket.cs b/Packets/Players/MousePositionSyncPacket.cs new file mode 100644 index 0000000000..3f853c19c2 --- /dev/null +++ b/Packets/Players/MousePositionSyncPacket.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class MousePositionSyncPacket : CalamityPacket + { + public static MousePositionSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.MousePositionSync; + + public static void Send(CalamityPlayer player, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.WriteVector2(player.mouseWorld); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var mouseWorldPos = packet.ReadVector2(); + + if (player is null) + return; + + player.mouseWorld = mouseWorldPos; + + if (Main.dedServ) + Send(player, ignoreClient: sender); + } + } +} diff --git a/Packets/Players/RageSyncPacket.cs b/Packets/Players/RageSyncPacket.cs new file mode 100644 index 0000000000..37e3cd3dd3 --- /dev/null +++ b/Packets/Players/RageSyncPacket.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class RageSyncPacket : CalamityPacket + { + public static RageSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.RageSync; + + public static void Send(CalamityPlayer playerToSync, int toClient = -1, int ignoreClient = -1) + { + if (playerToSync is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(playerToSync); + packet.Write(playerToSync.rage); + packet.Write(playerToSync.rageCombatFrames); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var rage = packet.ReadSingle(); + var rageCombatFrames = packet.ReadInt32(); + + if (player is null) + return; + + player.rage = rage; + player.rageCombatFrames = rageCombatFrames; + + if (Main.dedServ) + Send(player, ignoreClient: sender); + } + } +} diff --git a/Packets/Players/RightClickSyncPacket.cs b/Packets/Players/RightClickSyncPacket.cs new file mode 100644 index 0000000000..a6c206d2a5 --- /dev/null +++ b/Packets/Players/RightClickSyncPacket.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class RightClickSyncPacket : CalamityPacket + { + public static RightClickSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.RightClickSync; + + public static void Send(CalamityPlayer player, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.Write(player.mouseRight); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var rightClick = packet.ReadBoolean(); + + if (player is null) + return; + + player.mouseRight = rightClick; + + if (Main.dedServ) + Send(player, ignoreClient: sender); + } + } +} diff --git a/Packets/Players/SyncCooldownDictionaryPacket.cs b/Packets/Players/SyncCooldownDictionaryPacket.cs new file mode 100644 index 0000000000..ba8cf8b74b --- /dev/null +++ b/Packets/Players/SyncCooldownDictionaryPacket.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using Terraria; +using Terraria.ID; + +using CooldownInfoTuple = (ushort netID, int duration, int timeLeft); + +namespace CalamityMod.Packets +{ + public sealed class SyncCooldownDictionaryPacket : CalamityPacket + { + public static SyncCooldownDictionaryPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncCooldownDictionary; + + public static void Send(CalamityPlayer player, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + var cooldowns = player.cooldowns.Values.Select(cd => (cd.netID, cd.duration, cd.timeLeft)); + Send(player, cooldowns, toClient, ignoreClient); + } + + public static void Send(CalamityPlayer player, IEnumerable cooldowns, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + if (cooldowns is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.Write(player.cooldowns.Count); + foreach (CooldownInfoTuple cd in cooldowns) + { + packet.Write(cd.netID); + packet.Write(cd.duration); + packet.Write(cd.timeLeft); + } + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + int count = packet.ReadInt32(); + + Dictionary receivedCooldowns = new(count); + for (int i = 0; i < count; ++i) + { + var netID = packet.ReadUInt16(); + var duration = packet.ReadInt32(); + var timeLeft = packet.ReadInt32(); + receivedCooldowns[netID] = (netID, duration, timeLeft); + } + + if (player is null) + return; + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + HashSet localIDs = [.. player.cooldowns.Values.Select(cd => cd.netID)]; + HashSet receivedIDs = [.. receivedCooldowns.Keys]; + + HashSet combinedIDSet = []; + combinedIDSet.UnionWith(localIDs); + combinedIDSet.UnionWith(receivedIDs); + + foreach (ushort netID in combinedIDSet) + { + bool existsLocally = localIDs.Contains(netID); + bool existsRemotely = receivedIDs.Contains(netID); + string id = CooldownRegistry.registry[netID].ID; + + // Exists locally but not remotely = cull -- destroy the local copy. + if (existsLocally && !existsRemotely) + { + player.cooldowns.Remove(id); + } + // Exists remotely but not locally = add -- insert into the dictionary. + else if (existsRemotely && !existsLocally) + { + var cdToAdd = receivedCooldowns[netID]; + player.cooldowns[id] = new CooldownInstance(player.Player, cdToAdd.netID, cdToAdd.duration, cdToAdd.timeLeft); + } + // Exists in both places = update -- update timing fields but don't replace the instance. + else if (existsLocally && existsRemotely) + { + CooldownInstance localInstance = player.cooldowns[id]; + localInstance.duration = receivedCooldowns[netID].duration; + localInstance.timeLeft = receivedCooldowns[netID].timeLeft; + } + } + } + else if (Main.dedServ) + { + // Server should NOT handle cooldown itself! + // Server doesn't have information for cooldown netIDs! + Send(player, receivedCooldowns.Values, ignoreClient: sender); + } + } + } +} diff --git a/Packets/Players/SyncPlayerDrawParameterPacket.cs b/Packets/Players/SyncPlayerDrawParameterPacket.cs new file mode 100644 index 0000000000..1f71ec7a78 --- /dev/null +++ b/Packets/Players/SyncPlayerDrawParameterPacket.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class SyncPlayerDrawParameterPacket : CalamityPacket + { + public static SyncPlayerDrawParameterPacket Instance { get; set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncPlayerDrawParameter; + + public static void Send(CalamityPlayer player, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.Write((Half)player.drawingParameters.RoverShieldCharge); // 2b + packet.Write((Half)player.drawingParameters.LunicShieldCharge); // 2b + packet.Write((Half)player.drawingParameters.ProfanedShieldCharge); // 2b + packet.WriteRGB(player.drawingParameters.ProfanedShieldColor); // 3b + packet.Write((Half)player.drawingParameters.SpongeShieldCharge); // 2b + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var roverCharge = (float)packet.ReadHalf(); + var lunicCharge = (float)packet.ReadHalf(); + var profanedCharge = (float)packet.ReadHalf(); + var profanedColor = packet.ReadRGB(); + var spongeCharge = (float)packet.ReadHalf(); + + if (player is null) + return; + + player.drawingParameters.RoverShieldCharge = roverCharge; + player.drawingParameters.LunicShieldCharge = lunicCharge; + player.drawingParameters.ProfanedShieldCharge = profanedCharge; + player.drawingParameters.ProfanedShieldColor = profanedColor; + player.drawingParameters.SpongeShieldCharge = spongeCharge; + + if (Main.dedServ) + Send(player, ignoreClient: sender); + } + } +} diff --git a/Packets/TileEntities/TECanvasPaintingPacket.cs b/Packets/TileEntities/TECanvasPaintingPacket.cs new file mode 100644 index 0000000000..a7d0b36bbf --- /dev/null +++ b/Packets/TileEntities/TECanvasPaintingPacket.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.TileEntities; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class TECanvasPaintingPacket : CalamityPacket + { + public static TECanvasPaintingPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.UpdateCanvasPainting; + + public static void Send(TECanvasPainting painting, float posX, float posY, float scale, int toClient = -1, int ignoreClient = -1) + { + if (painting is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteTileEntityID(painting); + packet.Write(posX); + packet.Write(posY); + packet.Write(scale); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var painting = packet.ReadTileEntity(); + float posX = packet.ReadSingle(); + float posY = packet.ReadSingle(); + float scale = packet.ReadSingle(); + + if (painting is null) + return; + + painting.framePosition = new Microsoft.Xna.Framework.Vector2(posX, posY); + painting.scale = scale; + + // When a server gets this packet, it immediately sends an equivalent packet to all clients. + if (Main.dedServ) + Send(painting, posX, posY, scale); + } + } +} diff --git a/Packets/TileEntities/TEChargingStationItemChangePacket.cs b/Packets/TileEntities/TEChargingStationItemChangePacket.cs new file mode 100644 index 0000000000..4aef46d3f6 --- /dev/null +++ b/Packets/TileEntities/TEChargingStationItemChangePacket.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.TileEntities; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Packets +{ + public sealed class TEChargingStationItemChangePacket : CalamityPacket + { + public static TEChargingStationItemChangePacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.ChargingStationItemChange; + + public static void Send(TEChargingStation chargingStn, Item pluggedItem, int toClient = -1, int ignoreClient = -1) + { + if (chargingStn is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteTileEntityID(chargingStn); + ItemIO.Send(pluggedItem, packet, writeStack: true, writeFavorite: true); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var chargingStn = packet.ReadTileEntity(); + Item thePlug = ItemIO.Receive(packet, readStack: true, readFavorite: true); + + if (chargingStn is null) + return; + + chargingStn.PluggedItem = thePlug; + + // When a server gets this packet, it immediately sends an equivalent packet to all clients. + if (Main.dedServ) + Send(chargingStn, thePlug); + } + } +} diff --git a/Packets/TileEntities/TEChargingStationStandardPacket.cs b/Packets/TileEntities/TEChargingStationStandardPacket.cs new file mode 100644 index 0000000000..02307d9840 --- /dev/null +++ b/Packets/TileEntities/TEChargingStationStandardPacket.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Items; +using CalamityMod.TileEntities; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria; +using System.Runtime.InteropServices; + +namespace CalamityMod.Packets +{ + public sealed class TEChargingStationStandardPacket : CalamityPacket + { + public static TEChargingStationStandardPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.ChargingStationStandard; + + public static void Send(TEChargingStation chargingStn, short timer, short cellStack, float chargeOrNaN, int toClient = -1, int ignoreClient = -1) + { + if (chargingStn is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteTileEntityID(chargingStn); + packet.Write(timer); + packet.Write(cellStack); + packet.Write(chargeOrNaN); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var chargingStn = packet.ReadTileEntity(); + short timer = packet.ReadInt16(); + short cellStack = packet.ReadInt16(); + float chargeOrNaN = packet.ReadSingle(); + + if (chargingStn is null) + return; + + // Only clients update their timer from this packet. When a server receives this packet it ignores the time variable. + if (Main.netMode == NetmodeID.MultiplayerClient) + chargingStn.Internal_ChargingTimer = timer; + chargingStn.Internal_Stack = cellStack; + + // If the charge value sent is not garbage, then try to apply the new charge to the plugged item. + if (!float.IsNaN(chargeOrNaN)) + { + bool itemExists = chargingStn.PluggedItem != null && !chargingStn.PluggedItem.IsAir; + CalamityGlobalItem modItem = itemExists ? chargingStn.PluggedItem.Calamity() : null; + if (modItem != null && modItem.UsesCharge) + { + if (modItem.Charge != chargeOrNaN && Main.netMode == NetmodeID.MultiplayerClient) + chargingStn.ClientChargingDust = true; + modItem.Charge = chargeOrNaN; + } + } + + if (Main.dedServ) + Send(chargingStn, timer, cellStack, chargeOrNaN); + } + } +} diff --git a/Packets/TileEntities/TELabHologramProjectorPacket.cs b/Packets/TileEntities/TELabHologramProjectorPacket.cs new file mode 100644 index 0000000000..d43785f1ba --- /dev/null +++ b/Packets/TileEntities/TELabHologramProjectorPacket.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.TileEntities; +using Terraria.DataStructures; + +namespace CalamityMod.Packets +{ + public sealed class TELabHologramProjectorPacket : CalamityPacket + { + public static TELabHologramProjectorPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.LabHologramProjector; + + public static void Send(TELabHologramProjector projector, bool poppingUp, int toClient = -1, int ignoreClient = -1) + { + if (projector is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteTileEntityID(projector); + packet.Write(poppingUp); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var projector = packet.ReadTileEntity(); + bool pop = packet.ReadBoolean(); + + if (projector is null) + return; + + projector.PoppingUp = pop; + } + } +} diff --git a/Packets/TileEntities/TEPowerCellFactoryPacket.cs b/Packets/TileEntities/TEPowerCellFactoryPacket.cs new file mode 100644 index 0000000000..6b99b14023 --- /dev/null +++ b/Packets/TileEntities/TEPowerCellFactoryPacket.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.TileEntities; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class TEPowerCellFactoryPacket : CalamityPacket + { + public static TEPowerCellFactoryPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.PowerCellFactory; + + public static void Send(TEPowerCellFactory cellFactory, long time, int stack, int toClient = -1, int ignoreClient = -1) + { + if (cellFactory is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteTileEntityID(cellFactory); + packet.Write(time); + packet.Write(stack); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var cellFactory = packet.ReadTileEntity(); + long time = packet.ReadInt64(); + short cellStack = packet.ReadInt16(); + + if (cellFactory is null) + return; + + // Only clients update their timer from this packet. When a server receives this packet it ignores the time variable. + if (Main.netMode == NetmodeID.MultiplayerClient) + cellFactory.Time = time; + cellFactory.Stack_Internal = cellStack; + + // When a server gets this packet, it immediately sends an equivalent packet to all clients. + if (Main.dedServ) + Send(cellFactory, time, cellStack); + } + } +} diff --git a/Packets/TileEntities/TETurretPacket.cs b/Packets/TileEntities/TETurretPacket.cs new file mode 100644 index 0000000000..342d303c6b --- /dev/null +++ b/Packets/TileEntities/TETurretPacket.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection.Metadata; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.TileEntities; +using CalamityMod.Tiles.FurnitureStatigel; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + public sealed class TETurretPacket : CalamityPacket + { + public static TETurretPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.Turret; + + public static void Send(TEBaseTurret turret, int toClient = -1, int ignoreClient = -1) + { + if (turret is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteTileEntityID(turret); + packet.Write(turret.FiringTime); + packet.Write(turret.Angle); + packet.WriteVector2(turret.TargetPos); + turret.WriteExtraTurretData(packet); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var turret = packet.ReadTileEntity(); + int firingTime = packet.ReadInt32(); + float angle = packet.ReadSingle(); + Vector2 targetVec = packet.ReadVector2(); + + if (turret is not null) + { + turret.FiringTime = firingTime; + turret.Angle = angle; + turret.TargetPos = targetVec; + turret.ReadExtraTurretData(packet); + } + else + { + // Otherwise, discard the fixed extra bytes so the message stream doesn't go haywire. + _ = packet.ReadBytes(TEBaseTurret.NumExtraBytes); + } + } + } +} diff --git a/Packets/TileEntities/TEUpdateCodebreakerConstituentsPacket.cs b/Packets/TileEntities/TEUpdateCodebreakerConstituentsPacket.cs new file mode 100644 index 0000000000..8746aa37c9 --- /dev/null +++ b/Packets/TileEntities/TEUpdateCodebreakerConstituentsPacket.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.TileEntities; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; + +namespace CalamityMod.Packets +{ + internal class TEUpdateCodebreakerConstituentsPacket : CalamityPacket + { + public static TEUpdateCodebreakerConstituentsPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.UpdateCodebreakerConstituents; + + public static void Send(TECodebreaker codeBreaker, int toClient = -1, int ignoreClient = -1) + { + if (codeBreaker is null) + return; + + var packet = Instance.CreateBasePacket(); + BitsByte containmentFlagWrapper = new BitsByte(); + containmentFlagWrapper[0] = codeBreaker.ContainsDecryptionComputer; + containmentFlagWrapper[1] = codeBreaker.ContainsSensorArray; + containmentFlagWrapper[2] = codeBreaker.ContainsAdvancedDisplay; + containmentFlagWrapper[3] = codeBreaker.ContainsVoltageRegulationSystem; + containmentFlagWrapper[4] = codeBreaker.ContainsCoolingCell; + + packet.WriteTileEntityID(codeBreaker); + packet.Write(containmentFlagWrapper); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var codeBreaker = packet.ReadTileEntity(); + BitsByte containmentFlagWrapper = packet.ReadByte(); + bool containsDecryptionComputer = containmentFlagWrapper[0]; + bool containsSensorArray = containmentFlagWrapper[1]; + bool containsAdvancedDisplay = containmentFlagWrapper[2]; + bool containsVoltageRegulationSystem = containmentFlagWrapper[3]; + bool containsCoolingCell = containmentFlagWrapper[4]; + + // Verify to ensure that the tile entity is a valid one. + if (codeBreaker is null) + return; + + codeBreaker.ContainsDecryptionComputer = containsDecryptionComputer; + codeBreaker.ContainsSensorArray = containsSensorArray; + codeBreaker.ContainsAdvancedDisplay = containsAdvancedDisplay; + codeBreaker.ContainsVoltageRegulationSystem = containsVoltageRegulationSystem; + codeBreaker.ContainsCoolingCell = containsCoolingCell; + + // Send the packet again to the other clients if this packet was received on the server. + // Since ModPackets go solely to the server when sent by a client this is necesssary + // to ensure that all clients are informed of what happened. + if (Main.dedServ) + Send(codeBreaker, ignoreClient: sender); + } + } +} diff --git a/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs b/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs new file mode 100644 index 0000000000..3ba126974b --- /dev/null +++ b/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.TileEntities; +using Terraria.DataStructures; + +namespace CalamityMod.Packets +{ + public sealed class TEUpdateCodebreakerContainedStuffPacket : CalamityPacket + { + public static TEUpdateCodebreakerContainedStuffPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.UpdateCodebreakerContainedStuff; + + public static void Send(TECodebreaker codeBreaker, int toClient = -1, int ignoreClient = -1) + { + if (codeBreaker is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteTileEntityID(codeBreaker); + packet.Write(codeBreaker.InputtedCellCount); + packet.Write(codeBreaker.InitialCellCountBeforeDecrypting); + packet.Write(codeBreaker.HeldSchematicID); + packet.Write(codeBreaker.ContainsBloodSample); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var codeBreaker = packet.ReadTileEntity(); + int cellCount = packet.ReadInt32(); + int cellCountBeforeDecrypting = packet.ReadInt32(); + int schematicID = packet.ReadInt32(); + bool containsBloodSample = packet.ReadBoolean(); + + // Verify to ensure that the tile entity is a valid one. + if (codeBreaker is null) + return; + + codeBreaker.InputtedCellCount = cellCount; + codeBreaker.InitialCellCountBeforeDecrypting = cellCountBeforeDecrypting; + codeBreaker.HeldSchematicID = schematicID; + codeBreaker.ContainsBloodSample = containsBloodSample; + } + } +} diff --git a/Packets/TileEntities/TEUpdateCodebreakerDecryptCountdownPacket.cs b/Packets/TileEntities/TEUpdateCodebreakerDecryptCountdownPacket.cs new file mode 100644 index 0000000000..933c017352 --- /dev/null +++ b/Packets/TileEntities/TEUpdateCodebreakerDecryptCountdownPacket.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.TileEntities; +using Terraria.DataStructures; + +namespace CalamityMod.Packets +{ + public sealed class TEUpdateCodebreakerDecryptCountdownPacket : CalamityPacket + { + public static TEUpdateCodebreakerDecryptCountdownPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.UpdateCodebreakerDecryptCountdown; + + public static void Send(TECodebreaker codeBreaker, int toClient = -1, int ignoreClient = -1) + { + if (codeBreaker is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteTileEntityID(codeBreaker); + packet.Write(codeBreaker.DecryptionCountdown); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var codeBreaker = packet.ReadTileEntity(); + int countdown = packet.ReadInt32(); + + // Verify to ensure that the tile entity is a valid one. + if (codeBreaker is null) + return; + + codeBreaker.DecryptionCountdown = countdown; + } + } +} diff --git a/Packets/Worlds/BanditStolenMoneySyncPacket.cs b/Packets/Worlds/BanditStolenMoneySyncPacket.cs new file mode 100644 index 0000000000..576f419be8 --- /dev/null +++ b/Packets/Worlds/BanditStolenMoneySyncPacket.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.World; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class BanditStolenMoneySyncPacket : CalamityPacket + { + public static BanditStolenMoneySyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.BanditStolenMoneySync; + + public static void Send(int amountStolenByBandit, int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write7BitEncodedInt(amountStolenByBandit); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var amountStolenByBandit = packet.Read7BitEncodedInt(); + + CalamityWorld.MoneyStolenByBandit += amountStolenByBandit; + CalamityWorld.Reforges++; + + // Broadcast back for tragic event + // WorldSync DO sync the MoneyStolenByBandit and Refores variable, But spamming SyncWorld is not a ideal action + if (Main.dedServ) + Send(amountStolenByBandit, ignoreClient: sender); + } + } +} diff --git a/Packets/Worlds/SyncDifficultiesPacket.cs b/Packets/Worlds/SyncDifficultiesPacket.cs new file mode 100644 index 0000000000..d205f57d8a --- /dev/null +++ b/Packets/Worlds/SyncDifficultiesPacket.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.World; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class SyncDifficultiesPacket : CalamityPacket + { + // MIGRATED COMMENTS FROM: 'CalamityNetcode.cs' + //TODO - Something so that other mods that hijack the difficulty ui can also use the remainder of the reader to have their own shit + + public static SyncDifficultiesPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.SyncDifficulties; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + var difficultyFlags = new BitsByte(); + difficultyFlags[0] = CalamityWorld.revenge; + difficultyFlags[1] = CalamityWorld.death; + packet.Write((byte)difficultyFlags); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var difficultyFlags = (BitsByte)packet.ReadByte(); + CalamityWorld.revenge = difficultyFlags[0]; + CalamityWorld.death = difficultyFlags[1]; + + if (Main.dedServ) + Send(ignoreClient: sender); + } + } +} diff --git a/Packets/Worlds/UnlockAbyssChestsPacket.cs b/Packets/Worlds/UnlockAbyssChestsPacket.cs new file mode 100644 index 0000000000..f134a64e06 --- /dev/null +++ b/Packets/Worlds/UnlockAbyssChestsPacket.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.World; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class UnlockAbyssChestsPacket : CalamityPacket + { + public static UnlockAbyssChestsPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.UnlockAbyssChests; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + Abyss.DoUnlockAllAbyssChests(); + } + } +} diff --git a/Packets/Worlds/WantToRefundReforgesPacket.cs b/Packets/Worlds/WantToRefundReforgesPacket.cs new file mode 100644 index 0000000000..440cd6791b --- /dev/null +++ b/Packets/Worlds/WantToRefundReforgesPacket.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.World; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + public sealed class WantToRefundReforgesPacket : CalamityPacket + { + public static WantToRefundReforgesPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.WantToRefundReforges; + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + // Only Server should handle this action! + if (!Main.dedServ) + return; + + int banditIdx = NPC.FindFirstNPC(ModContent.NPCType()); + if (banditIdx == -1) + return; + + NPC bandit = Main.npc[banditIdx]; + if (bandit == null || !bandit.active) + return; + + Bandit.DoRefund(bandit); + } + } +} diff --git a/Particles/ArchSmear.png b/Particles/ArchSmear.png new file mode 100644 index 0000000000..0fe4f58d96 Binary files /dev/null and b/Particles/ArchSmear.png differ diff --git a/Particles/AresCannonChargeParticleSet.cs b/Particles/AresCannonChargeParticleSet.cs index 5e9b00f425..057d126e6d 100644 --- a/Particles/AresCannonChargeParticleSet.cs +++ b/Particles/AresCannonChargeParticleSet.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Particles public override void Update() { // Don't perform any operations on the server. Doing so would be a waste of space as these sets are entirely based on drawcode. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; if (bloom == null) diff --git a/Particles/BaseParticleSet.cs b/Particles/BaseParticleSet.cs index 16f6432ed3..29e4ad197e 100644 --- a/Particles/BaseParticleSet.cs +++ b/Particles/BaseParticleSet.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Particles public virtual void Update() { // Don't perform any operations on the server. Doing so would be a waste of space as these sets are entirely based on drawcode. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; //Spawn new particles if time remains @@ -74,7 +74,7 @@ namespace CalamityMod.Particles public virtual void DrawSet(Vector2 basePosition) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; IEnumerable orderedParticles = Particles; diff --git a/Particles/BigHeart.png b/Particles/BigHeart.png new file mode 100644 index 0000000000..001abbef07 Binary files /dev/null and b/Particles/BigHeart.png differ diff --git a/Particles/BlastCone.png b/Particles/BlastCone.png new file mode 100644 index 0000000000..eb2027990f Binary files /dev/null and b/Particles/BlastCone.png differ diff --git a/Particles/BloomArrow.png b/Particles/BloomArrow.png new file mode 100644 index 0000000000..dea3f50fd1 Binary files /dev/null and b/Particles/BloomArrow.png differ diff --git a/Particles/BloomLineAngled.png b/Particles/BloomLineAngled.png new file mode 100644 index 0000000000..7fe67e7680 Binary files /dev/null and b/Particles/BloomLineAngled.png differ diff --git a/Particles/BloomLineFade.png b/Particles/BloomLineFade.png new file mode 100644 index 0000000000..31ed1cf6e7 Binary files /dev/null and b/Particles/BloomLineFade.png differ diff --git a/Particles/BloomLineSkinny.png b/Particles/BloomLineSkinny.png new file mode 100644 index 0000000000..d7bf41c6e0 Binary files /dev/null and b/Particles/BloomLineSkinny.png differ diff --git a/Particles/BloomLineSoftEdge.png b/Particles/BloomLineSoftEdge.png new file mode 100644 index 0000000000..dc89fb2a82 Binary files /dev/null and b/Particles/BloomLineSoftEdge.png differ diff --git a/Particles/BloomLineThick.png b/Particles/BloomLineThick.png new file mode 100644 index 0000000000..ed62f32c4e Binary files /dev/null and b/Particles/BloomLineThick.png differ diff --git a/Particles/BloomRingThinLarge.png b/Particles/BloomRingThinLarge.png new file mode 100644 index 0000000000..723240c0c4 Binary files /dev/null and b/Particles/BloomRingThinLarge.png differ diff --git a/Particles/Bolt.png b/Particles/Bolt.png new file mode 100644 index 0000000000..cec6f3d327 Binary files /dev/null and b/Particles/Bolt.png differ diff --git a/Particles/Bolt2.png b/Particles/Bolt2.png new file mode 100644 index 0000000000..b17c8ed67b Binary files /dev/null and b/Particles/Bolt2.png differ diff --git a/Particles/BoltParticle.cs b/Particles/BoltParticle.cs new file mode 100644 index 0000000000..1301d565e4 --- /dev/null +++ b/Particles/BoltParticle.cs @@ -0,0 +1,94 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class BoltParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public bool FadeIn = false; + public float FadeInScale = 0f; + public bool GlowCenter = false; + public Vector2 Stretch = new Vector2(0.5f, 1.6f); + public float ShrinkSpeed = 0; + public bool Fliped = false; + public bool GlowFade = false; + + public override int FrameVariants => 3; + public override string Texture => "CalamityMod/Particles/Bolt2"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public BoltParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool glowCenter = false, bool glowFade = false, bool fadeIn = false, float shrinkSpeed = 0) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + ShrinkSpeed = shrinkSpeed; + GlowCenter = glowCenter; + Variant = Main.rand.Next(3); + Fliped = Main.rand.NextBool(); + + FadeIn = fadeIn; + + if (FadeIn) + Scale = 0f; + + GlowFade = glowFade; + } + + public override void Update() + { + if (!FadeIn) + { + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + + Stretch.X *= (1 - 0.2f * ShrinkSpeed); + Stretch.Y *= (1 + 0.2f * ShrinkSpeed); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = Stretch * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, 3, 0, Variant); + Vector2 origin = frame.Size() * 0.5f; + + Color col = Color; + + spriteBatch.Draw(texture, Position - Main.screenPosition, frame, col, Rotation, origin, scale, Fliped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + if (GlowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, frame, Color.Lerp(col, Color.White, 0.8f) * (GlowFade ? Utils.GetLerpValue(Lifetime, 0, Time, true) : 1), Rotation, origin, scale * 0.8f, Fliped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + } + } +} diff --git a/Particles/ChumBone.cs b/Particles/ChumBone.cs new file mode 100644 index 0000000000..88838070b4 --- /dev/null +++ b/Particles/ChumBone.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class ChumBone : Particle + { + public override string Texture => "CalamityMod/Particles/ChumBone1"; + + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + private bool direction; + private bool variant; + public static string Texture2 => "CalamityMod/Particles/ChumBone2"; + + public ChumBone(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, int lifeTime, bool variant, bool direction) + { + Position = position; + Velocity = velocity; + Scale = scale; + Lifetime = lifeTime; + Rotation = rotation; + Color = color; + } + + public override void Update() + { + // Gravity + Tile below = CalamityUtils.ParanoidTileRetrieval((int)(Position.X / 16), (int)(Position.Y / 16)); + if (!below.HasTile || !below.IsTileSolid() || below.Slope > 0) + { + if (Velocity.Y < 10) + { + Velocity.Y += 1; + } + } + else + { + Velocity.Y = 0; + } + if (Time == Lifetime) + { + for (int i = 0; i < 4; i++) + { + Dust.NewDust(Position, 10, 10, DustID.Bone, Main.rand.NextFloat(-4, 4), Main.rand.NextFloat(-4, 4)); + } + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = variant ? ModContent.Request(Texture2).Value : ModContent.Request(Texture).Value; + SpriteEffects spriteDir = direction ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Lighting.GetColor(Position.ToTileCoordinates()), Rotation, new Vector2(tex.Width / 2, tex.Height), Scale, spriteDir, 0); + } + } +} diff --git a/Particles/ChumBone1.png b/Particles/ChumBone1.png new file mode 100644 index 0000000000..86bff0e329 Binary files /dev/null and b/Particles/ChumBone1.png differ diff --git a/Particles/ChumBone2.png b/Particles/ChumBone2.png new file mode 100644 index 0000000000..58961d2094 Binary files /dev/null and b/Particles/ChumBone2.png differ diff --git a/Particles/CircularSmearFire1.png b/Particles/CircularSmearFire1.png new file mode 100644 index 0000000000..7ef6e9aa75 Binary files /dev/null and b/Particles/CircularSmearFire1.png differ diff --git a/Particles/CircularSmearFire2.png b/Particles/CircularSmearFire2.png new file mode 100644 index 0000000000..a5a6eba215 Binary files /dev/null and b/Particles/CircularSmearFire2.png differ diff --git a/Particles/CircularSmearFire3.png b/Particles/CircularSmearFire3.png new file mode 100644 index 0000000000..aaacdbedd4 Binary files /dev/null and b/Particles/CircularSmearFire3.png differ diff --git a/Particles/CircularSmearVFX.cs b/Particles/CircularSmearVFX.cs index 35c866c06f..ef20086549 100644 --- a/Particles/CircularSmearVFX.cs +++ b/Particles/CircularSmearVFX.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.ExtraTextures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using ReLogic.Content; namespace CalamityMod.Particles { @@ -8,9 +12,11 @@ namespace CalamityMod.Particles public override bool UseAdditiveBlend => true; public override bool SetLifetime => true; - public float opacity; + public override bool UseCustomDraw => true; - public CircularSmearVFX(Vector2 position, Color color, float rotation, float scale) + public Asset LoadedAsset; + + public CircularSmearVFX(Vector2 position, Color color, float rotation, float scale, Asset? texture = null) { Position = position; Velocity = Vector2.Zero; @@ -18,6 +24,15 @@ namespace CalamityMod.Particles Scale = scale; Rotation = rotation; Lifetime = 2; + + LoadedAsset = texture; + if (LoadedAsset is null) + LoadedAsset = ExtraTextureRefs.CircularSmear; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + spriteBatch.Draw(LoadedAsset.Value, Position - Main.screenPosition, null, Color, Rotation, LoadedAsset.Value.Size() * 0.5f, Scale, SpriteEffects.None, 0); } } } diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs index a3072597f7..ee6649cf23 100644 --- a/Particles/CustomPulse.cs +++ b/Particles/CustomPulse.cs @@ -18,11 +18,13 @@ namespace CalamityMod.Particles private string NewTexture; private float OriginalScale; private float FinalScale; + private float BaseOpacity; private float opacity; + private bool FadeOut; 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) + public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true, float baseOpacity = 1f, bool fade = true) { Position = position; Velocity = velocity; @@ -32,6 +34,8 @@ namespace CalamityMod.Particles FinalScale = finalScale; Scale = originalScale; Lifetime = lifeTime; + BaseOpacity = baseOpacity; + FadeOut = fade; Squish = squish; Rotation = rotation; UseAltVisual = UseAdditiveBlend; @@ -42,7 +46,7 @@ namespace CalamityMod.Particles 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); + opacity = (FadeOut ? (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2) : 1f) * BaseOpacity; Color = BaseColor * opacity; Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); diff --git a/Particles/CustomSpark.cs b/Particles/CustomSpark.cs new file mode 100644 index 0000000000..eec7780240 --- /dev/null +++ b/Particles/CustomSpark.cs @@ -0,0 +1,106 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class CustomSpark : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public bool FadeIn = false; + public float FadeInScale = 0f; + public bool GlowCenter = false; + public float GlowCenterScale = 1; + public float GlowOpacity = 1; + public string NewTexture; + public float ExtraRotation; + public Vector2 Stretch = new Vector2(0.5f, 1.6f); + public float ShrinkSpeed = 0; + public bool FlipHorizontal = false; + public bool NoShrink = false; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool AltVisual = true; + public override bool UseAdditiveBlend => AltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false) + { + Position = relativePosition; + Velocity = velocity; + NewTexture = texture; + ExtraRotation = extraRotation; + AffectedByGravity = affectedByGravity; + AffectedByLight = affectedByLight; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + ShrinkSpeed = shrinkSpeed; + + AltVisual = useAddativeBlend; + GlowCenter = glowCenter; + GlowCenterScale = glowCenterScale; + GlowOpacity = glowOpacity; + FlipHorizontal = flipHorizontal; + NoShrink = noShrink; + + FadeIn = fadeIn; + + if (FadeIn) + Scale = 0f; + } + + public override void Update() + { + if (!FadeIn) + { + if (!NoShrink) + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation; + + Stretch.X *= (1 - 0.2f * ShrinkSpeed); + Stretch.Y *= (1 + 0.2f * ShrinkSpeed); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = Stretch * Scale; + Texture2D texture = ModContent.Request(NewTexture).Value; + + Color col = Color; + + if (AffectedByLight) + { + col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + if (GlowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } + } +} diff --git a/Particles/CustomSprite.cs b/Particles/CustomSprite.cs new file mode 100644 index 0000000000..2fee8656b7 --- /dev/null +++ b/Particles/CustomSprite.cs @@ -0,0 +1,93 @@ +using System; +using System.Threading; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class CustomSprite : Particle + { + bool addBlend = false; + bool important = false; + + Texture2D Tex; + int frames = 1; + int currentFrame = 1; + + int Timer = 0; + + float maxGravity = 0f; + float Opacity = 1f; + + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => addBlend; + public override bool Important => important; + public override string Texture => "CalamityMod/Particles/CuteStars"; + public override int FrameVariants => frames; + + public CustomSprite(Vector2 relativePosition, Vector2 velocity, int lifetime, string tex, float scale, Color color, float grav = 0f, bool AddativeBlend = true, bool needed = false, int frameCount = 1, int frame = 0) + { + maxGravity = grav; + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + addBlend = AddativeBlend; + important = needed; + Color = color; + Tex = ModContent.Request(tex).Value; + frames = frameCount; + currentFrame = frame; + } + + // Overload which takes a Texture2D instead of a string for the texture to use + public CustomSprite(Vector2 relativePosition, Vector2 velocity, int lifetime, Texture2D tex, float scale, Color color, float grav = 0f, bool AddativeBlend = true, bool needed = false, int frameCount = 1, int frame = 0) + { + maxGravity = grav; + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + addBlend = AddativeBlend; + important = needed; + Color = color; + Tex = tex; + frames = frameCount; + currentFrame = frame; + } + + public override void Update() + { + Position += Velocity; + + Timer++; + + if (Timer > Lifetime - 20) + { + Scale *= 0.9f; + Opacity *= 0.9f; + } + + Velocity *= 0.85f; + if (maxGravity != 0f) + { + if (Velocity.Length() < maxGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += maxGravity / 10f; + } + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Rectangle fr = Tex.Frame(1, frames, 0, currentFrame); + + Main.EntitySpriteDraw(Tex, Position - Main.screenPosition, fr, Color.Lerp(Color.Transparent, Color, Opacity), Rotation, new Vector2(Tex.Width * 0.5f, Tex.Height / frames * 0.5f), 1f, SpriteEffects.None); + } + } +} diff --git a/Particles/DeathAshParticle.cs b/Particles/DeathAshParticle.cs index 9687520e99..9d7c9e5da7 100644 --- a/Particles/DeathAshParticle.cs +++ b/Particles/DeathAshParticle.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Particles public Color AshColor; public Vector2 Center; public Vector2 Velocity; + public static Vector2 VelOverride; public Vector2 TopLeft => Center - Vector2.One * Scale * 3.5f; public Vector2 TopRight => Center + new Vector2(1f, -1f) * Scale * 3.5f; public Vector2 BottomRight => Center + Vector2.One * Scale * 3.5f; @@ -35,7 +36,7 @@ namespace CalamityMod.Particles { get { - if (Main.netMode != NetmodeID.Server && basicShader is null) + if (!Main.dedServ && basicShader is null) { basicShader = new BasicEffect(Main.instance.GraphicsDevice) { @@ -84,12 +85,13 @@ namespace CalamityMod.Particles Main.instance.GraphicsDevice.SetRenderTarget(null); } - public static void CreateAshesFromNPC(NPC npc) + public static void CreateAshesFromNPC(NPC npc, Vector2 velocityOverride) { // Don't create ashes serverside. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; + VelOverride = velocityOverride; PendingNPCsToDraw[npc] = new(true, ManagedRenderTarget.CreateScreenSizedTarget); } @@ -228,11 +230,19 @@ namespace CalamityMod.Particles float brightness = (AshColor.R + AshColor.G + AshColor.B) / 765f; Time++; + Scale = MathHelper.Clamp(Scale - (brightness < 0.1f ? 0.08f : 0.008f), 0f, 1f); + float dissipationFactor = Utils.GetLerpValue(6f, 16f, Velocity.Length(), true); float velocityInterpolant = Utils.GetLerpValue(25f - dissipationFactor * 10f, 80f - dissipationFactor * 45f, Time, true); Vector2 idealVelocity = new Vector2(Main.windSpeedCurrent * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Center.Y / 50f + ID)) * 20f, (float)Math.Sin(Main.time / 20f + ID * 0.01f) * 3f - 1f); + if (VelOverride != Vector2.Zero) + { + Vector2 useVel = VelOverride.RotateRandom(0.01f * ID); + idealVelocity = new Vector2(useVel.X * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Main.time / 20f + ID)), useVel.Y * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Main.time / 20f + ID))); + } + Velocity = Vector2.Lerp(Velocity, idealVelocity, velocityInterpolant * 0.16f); Center += Velocity; } @@ -240,7 +250,7 @@ namespace CalamityMod.Particles public static void UpdateAll() { // Don't draw ashes serverside. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; foreach (DeathAshParticle ash in Ashes) diff --git a/Particles/DemonSigilParticle.png b/Particles/DemonSigilParticle.png new file mode 100644 index 0000000000..f64d16f548 Binary files /dev/null and b/Particles/DemonSigilParticle.png differ diff --git a/Particles/DrainLine2.png b/Particles/DrainLine2.png new file mode 100644 index 0000000000..309f0f2ef8 Binary files /dev/null and b/Particles/DrainLine2.png differ diff --git a/Particles/DrainLineBloom2.png b/Particles/DrainLineBloom2.png new file mode 100644 index 0000000000..cce5e51799 Binary files /dev/null and b/Particles/DrainLineBloom2.png differ diff --git a/Particles/EmoteExpressionParticle.cs b/Particles/EmoteExpressionParticle.cs new file mode 100644 index 0000000000..4e9de2e4e0 --- /dev/null +++ b/Particles/EmoteExpressionParticle.cs @@ -0,0 +1,57 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class EmoteExpressionParticle : Particle + { + public override string Texture => "CalamityMod/Particles/EmoteExpressions"; + + public override bool UseCustomDraw => true; + + public override bool SetLifetime => true; + + public enum EmoteType + { + Exclamation, + DoubleExclamation, + QuestionExclamation, + Question, + Note, + DoubleNote, + Smile, + BigSmile + } + + private Rectangle Frame; + + public EmoteExpressionParticle(Vector2 position, Vector2 velocity, float scale, Color color, int lifeTime, EmoteType emote) + { + Position = position; + Scale = scale; + Velocity = velocity; + Color = color; + Lifetime = lifeTime; + Frame = ModContent.Request(Texture).Value.Frame(horizontalFrames: 8, verticalFrames: 1, frameX: (int)emote); + Rotation = velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void Update() + { + Velocity *= 0.96f; + Scale *= 0.97f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D emoteTexture = ModContent.Request(Texture).Value; + Vector2 origin = new Vector2(Frame.Width / 2f, Frame.Height); + float opacity = 1 - (float)Math.Pow(LifetimeCompletion, 4f); + + spriteBatch.Draw(emoteTexture, Position - Main.screenPosition, Frame, Color * opacity, Rotation, origin, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/NPCs/NormalNPCs/KingSlimeJewel.png b/Particles/EmoteExpressions.png similarity index 64% rename from NPCs/NormalNPCs/KingSlimeJewel.png rename to Particles/EmoteExpressions.png index 906567e7a7..3c08c3cce8 100644 Binary files a/NPCs/NormalNPCs/KingSlimeJewel.png and b/Particles/EmoteExpressions.png differ diff --git a/Particles/FadeStreak.png b/Particles/FadeStreak.png new file mode 100644 index 0000000000..f55ca99876 Binary files /dev/null and b/Particles/FadeStreak.png differ diff --git a/Particles/FancyStars.cs b/Particles/FancyStars.cs new file mode 100644 index 0000000000..b21fde8d7c --- /dev/null +++ b/Particles/FancyStars.cs @@ -0,0 +1,58 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class FancyStars : Particle + { + public override string Texture => "CalamityMod/Particles/FancyStars"; + + public override bool UseCustomDraw => true; + + public override bool SetLifetime => true; + + public override bool UseAdditiveBlend => true; + + private readonly float _rotationSpeed; + private readonly int _variant; + + public FancyStars( + Vector2 position , + float rotation , + float scale , + Vector2 velocity , + float rotationSpeed , + int lifeTime , + Color color) + { + Position = position; + Rotation = rotation; + Scale = Math.Max(0f , scale); + Velocity = velocity; + _rotationSpeed = rotationSpeed; + Lifetime = lifeTime; + Color = color; + _variant = Main.rand.Next(5); + } + + public override void Update() + { + float interpolator = MathF.Pow(Utils.GetLerpValue(0f, 60f, Lifetime), 0.56f); + Velocity *= interpolator; + Rotation += _rotationSpeed * interpolator; + Scale -= 0.01f * interpolator; + Scale = Math.Max(0f , Scale); + Color *= interpolator; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle starVariant = texture.Frame(horizontalFrames: 5, verticalFrames: 1, frameX: _variant); + spriteBatch.Draw(texture , Position - Main.screenPosition , starVariant , Color , Rotation , starVariant.Size() * 0.5f , Scale , SpriteEffects.None , layerDepth: 0); + } + } +} diff --git a/Particles/FancyStars.png b/Particles/FancyStars.png new file mode 100644 index 0000000000..f296bcb7a4 Binary files /dev/null and b/Particles/FancyStars.png differ diff --git a/Particles/FireTypeParticle.png b/Particles/FireTypeParticle.png new file mode 100644 index 0000000000..fe146693be Binary files /dev/null and b/Particles/FireTypeParticle.png differ diff --git a/Particles/FlameExplosion.cs b/Particles/FlameExplosion.cs new file mode 100644 index 0000000000..6403703253 --- /dev/null +++ b/Particles/FlameExplosion.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 FlameExplosion : Particle + { + public override string Texture => "CalamityMod/Particles/FlameExplosion"; + 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 FlameExplosion(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, float opacity) + { + 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/FlameExplosion2.png b/Particles/FlameExplosion2.png new file mode 100644 index 0000000000..4fcc56314b Binary files /dev/null and b/Particles/FlameExplosion2.png differ diff --git a/Particles/FullStar.png b/Particles/FullStar.png new file mode 100644 index 0000000000..adb797ae73 Binary files /dev/null and b/Particles/FullStar.png differ diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 9f8a4c652f..5edab9f428 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -9,11 +9,12 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Core; +using Terraria.ModLoader.IO; namespace CalamityMod.Particles { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class GeneralParticleHandler + [Autoload(Side = ModSide.Client)] + public sealed class GeneralParticleHandler : ModSystem { private static List particles; private static Queue particlesToSpawnNextFrame; @@ -22,58 +23,55 @@ namespace CalamityMod.Particles //Static list for details concerning every particle type internal static Dictionary particleTypes; internal static Dictionary particleTextures; - private static List particleInstances; //Lists used when drawing particles batched private static List batchedAlphaBlendParticles; private static List batchedNonPremultipliedParticles; private static List batchedAdditiveBlendParticles; - public static void LoadModParticleInstances() + public override void PostSetupContent() { Type baseParticleType = typeof(Particle); - foreach (Mod mod in ModLoader.Mods) + ReflectionHelper.IterateEveryModsTypes(action: type => { - foreach (Type type in AssemblyManager.GetLoadableTypes(mod.Code)) - { - if (type.IsSubclassOf(baseParticleType) && !type.IsAbstract && type != baseParticleType) - { - int ID = particleTypes.Count; //Get the ID of the particle - particleTypes[type] = ID; + int ID = particleTypes.Count; //Get the ID of the particle + particleTypes[type] = ID; - Particle instance = (Particle)FormatterServices.GetUninitializedObject(type); - particleInstances.Add(instance); + // Flow: 2024/09/17 + // 'UnintializedObject' is allowed to use here as it's only read for Texture string Property + // But do NOT EVER use it's instance as they are literally Uninitialized. + // It might cause unintended behaviour if we do that. +#pragma warning disable SYSLIB0050 + Particle instance = (Particle)FormatterServices.GetUninitializedObject(type); +#pragma warning restore SYSLIB0050 - 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; + }); } - internal static void Load() + public override void Load() { - particles = new List(); - particlesToSpawnNextFrame = new Queue(); - particlesToKill = new List(); - particleTypes = new Dictionary(); - particleTextures = new Dictionary(); - particleInstances = new List(); + particles = []; + particlesToSpawnNextFrame = []; + particlesToKill = []; + particleTypes = []; + particleTextures = []; - batchedAlphaBlendParticles = new List(); - batchedNonPremultipliedParticles = new List(); - batchedAdditiveBlendParticles = new List(); + batchedAlphaBlendParticles = []; + batchedNonPremultipliedParticles = []; + batchedAdditiveBlendParticles = []; } - internal static void Unload() + public override void Unload() { particles = null; particlesToSpawnNextFrame = null; particlesToKill = null; particleTypes = null; particleTextures = null; - particleInstances = null; + batchedAlphaBlendParticles = null; batchedNonPremultipliedParticles = null; batchedAdditiveBlendParticles = null; @@ -87,10 +85,10 @@ namespace CalamityMod.Particles // Don't queue particles if the game is paused. // This precedent is established with how Dust instances are created. // Don't spawn particles if on the server either, or if the particles dictionary is somehow null. - if (Main.gamePaused || Main.netMode == NetmodeID.Server || particles == null) + if (Main.gamePaused || Main.dedServ || particles == null) return; - if (particles.Count >= CalamityConfig.Instance.ParticleLimit && !particle.Important) + if (particles.Count >= CalamityClientConfig.Instance.ParticleLimit && !particle.Important) return; particles.Add(particle); @@ -102,7 +100,7 @@ namespace CalamityMod.Particles // Don't queue particles if the game is paused. // This precedent is established with how Dust instances are created. // Don't spawn particles if on the server side, or if the particles dictionary is somehow null. - if (Main.gamePaused || Main.netMode == NetmodeID.Server || particles == null) + if (Main.gamePaused || Main.dedServ || particles == null) return; particlesToSpawnNextFrame.Enqueue(particle); @@ -110,6 +108,9 @@ namespace CalamityMod.Particles public static void Update() { + if (Main.dedServ) + return; + while (particlesToSpawnNextFrame.Count > 0) SpawnParticle(particlesToSpawnNextFrame.Dequeue()); @@ -128,11 +129,17 @@ namespace CalamityMod.Particles public static void RemoveParticle(Particle particle) { + if (Main.dedServ) + return; + particlesToKill.Add(particle); } public static void DrawAllParticles(SpriteBatch sb) { + if (Main.dedServ) + return; + if (particles.Count == 0) return; @@ -239,13 +246,19 @@ namespace CalamityMod.Particles if (Main.dedServ || particles == null) return 0; - return CalamityConfig.Instance.ParticleLimit - particles.Count(); + return CalamityClientConfig.Instance.ParticleLimit - particles.Count(); } /// /// Gives you the texture of the particle type. Useful for custom drawing /// - public static Texture2D GetTexture(int type) => particleTextures[type]; + public static Texture2D GetTexture(int type) + { + if (Main.dedServ) + return null; + + return particleTextures[type]; + } #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"; diff --git a/Particles/GlowBlade.png b/Particles/GlowBlade.png new file mode 100644 index 0000000000..3b0ee2a739 Binary files /dev/null and b/Particles/GlowBlade.png differ diff --git a/Particles/GlowFlakeParticle.png b/Particles/GlowFlakeParticle.png new file mode 100644 index 0000000000..84a0eeca25 Binary files /dev/null and b/Particles/GlowFlakeParticle.png differ diff --git a/Particles/GlowSpark2.png b/Particles/GlowSpark2.png new file mode 100644 index 0000000000..9af5362ab8 Binary files /dev/null and b/Particles/GlowSpark2.png differ diff --git a/Particles/GlowSquareParticle.cs b/Particles/GlowSquareParticle.cs index 971f7f1995..a60872746d 100644 --- a/Particles/GlowSquareParticle.cs +++ b/Particles/GlowSquareParticle.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Particles public Color InitialColor; public bool AffectedByGravity; public float fadeOut = 1; - public bool imporant; public bool glowCenter; public float RotationUse; public override bool SetLifetime => true; diff --git a/Particles/GlowSquareParticleBig.png b/Particles/GlowSquareParticleBig.png new file mode 100644 index 0000000000..0237e9c524 Binary files /dev/null and b/Particles/GlowSquareParticleBig.png differ diff --git a/Particles/HeartParticle.png b/Particles/HeartParticle.png new file mode 100644 index 0000000000..d2693e27e0 Binary files /dev/null and b/Particles/HeartParticle.png differ diff --git a/Particles/HeavySmoke.cs b/Particles/HeavySmoke.cs index a7fa2365ef..f8ea0115eb 100644 --- a/Particles/HeavySmoke.cs +++ b/Particles/HeavySmoke.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Particles if (AffectedByLight) { - col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGBA(col); + col = col.MultiplyRGBA(Lighting.GetColor((Position / 16).ToPoint())); } spriteBatch.Draw(tex, Position - Main.screenPosition, frame, col, Rotation, frame.Size() / 2f, Scale, SpriteEffects.None, 0); diff --git a/Particles/HighResHollowCircleHardEdgeAlt.png b/Particles/HighResHollowCircleHardEdgeAlt.png new file mode 100644 index 0000000000..98559c5458 Binary files /dev/null and b/Particles/HighResHollowCircleHardEdgeAlt.png differ diff --git a/Particles/IceTypeParticle.png b/Particles/IceTypeParticle.png new file mode 100644 index 0000000000..5cf40d79e4 Binary files /dev/null and b/Particles/IceTypeParticle.png differ diff --git a/Particles/KingSlimeEmeraldShards.png b/Particles/KingSlimeEmeraldShards.png new file mode 100644 index 0000000000..f16784085c Binary files /dev/null and b/Particles/KingSlimeEmeraldShards.png differ diff --git a/Particles/KingSlimeRubyShards.png b/Particles/KingSlimeRubyShards.png new file mode 100644 index 0000000000..e25207c646 Binary files /dev/null and b/Particles/KingSlimeRubyShards.png differ diff --git a/Particles/KingSlimeSapphireShards.png b/Particles/KingSlimeSapphireShards.png new file mode 100644 index 0000000000..9145e3d5a8 Binary files /dev/null and b/Particles/KingSlimeSapphireShards.png differ diff --git a/Particles/NanoParticle.cs b/Particles/NanoParticle.cs index f58fe0f7c2..335cd39514 100644 --- a/Particles/NanoParticle.cs +++ b/Particles/NanoParticle.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Particles 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) { diff --git a/Particles/PlayerCenteredPulseRing.cs b/Particles/PlayerCenteredPulseRing.cs index 40631d16a9..770b945729 100644 --- a/Particles/PlayerCenteredPulseRing.cs +++ b/Particles/PlayerCenteredPulseRing.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Particles public override bool SetLifetime => true; public override bool UseCustomDraw => true; - public Player player = Main.player[Main.myPlayer]; + public Player player = Main.LocalPlayer; private float OriginalScale; private float FinalScale; private float opacity; diff --git a/Particles/ProvidenceMarkParticle.png b/Particles/ProvidenceMarkParticle.png new file mode 100644 index 0000000000..13f25406f5 Binary files /dev/null and b/Particles/ProvidenceMarkParticle.png differ diff --git a/Particles/QuarterCircle.png b/Particles/QuarterCircle.png new file mode 100644 index 0000000000..0a2952d35f Binary files /dev/null and b/Particles/QuarterCircle.png differ diff --git a/Particles/SeaPrismParticle.cs b/Particles/SeaPrismParticle.cs new file mode 100644 index 0000000000..9c33915342 --- /dev/null +++ b/Particles/SeaPrismParticle.cs @@ -0,0 +1,109 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class SeaPrismParticle : Particle + { + public override string Texture => "CalamityMod/Particles/SeaPrisms"; + public Color InitialColor; + public bool AffectedByGravity; + public bool FadeIn = false; + public float FadeInScale = 0f; + + public string NewTexture; + public float ActiveRotation; + public float AddedRotation = 0; + public float SpeedReduction = 0.95f; + + public Vector2 Stretch = Vector2.One; + public float ShrinkSpeed = 0; + public bool AltVisual = false; + public override bool UseAdditiveBlend => AltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public override int FrameVariants => 3; + + public SeaPrismParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = false, float activeRotation = 0, float speedReduction = 0.95f, bool fadeIn = false, bool affectedByLight = true, float shrinkSpeed = 0) + { + Position = relativePosition; + Velocity = velocity; + ActiveRotation = activeRotation; + AffectedByGravity = affectedByGravity; + AffectedByLight = affectedByLight; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + ShrinkSpeed = shrinkSpeed; + SpeedReduction = speedReduction; + + AltVisual = useAddativeBlend; + + FadeIn = fadeIn; + + if (FadeIn) + Scale = 0f; + + Variant = Main.rand.Next(3); + } + + public override void Update() + { + if (!FadeIn) + { + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + Velocity *= SpeedReduction; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + + float velRot = ActiveRotation == 0 ? (Velocity.ToRotation() + MathHelper.PiOver2) : ActiveRotation; + Rotation = velRot + AddedRotation; + AddedRotation += ActiveRotation; + ActiveRotation *= 0.975f; + + Stretch.X *= (1 - 0.2f * ShrinkSpeed); + Stretch.Y *= (1 + 0.2f * ShrinkSpeed); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = GeneralParticleHandler.GetTexture(Type); + int frameWidth = 16; + int frameHeight = 32; + int frameSpacing = frameWidth + 2; // If you're using this elsewhere and the sheet is vertical, be sure to swap frameWidth with frameHeight + Rectangle frame = new Rectangle(frameSpacing * Variant, 0, frameWidth, frameHeight); + Vector2 scale = Stretch * Scale; + + Color col = Color; + + if (AffectedByLight) + { + col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, frame, col, Rotation, frame.Size() * 0.5f, scale, 0, 0f); + } + } +} diff --git a/Particles/SeaPrisms.png b/Particles/SeaPrisms.png new file mode 100644 index 0000000000..6996e4a544 Binary files /dev/null and b/Particles/SeaPrisms.png differ diff --git a/Particles/SemiCircularSmearFade.cs b/Particles/SemiCircularSmearFade.cs index f7e3f0a425..f01f292b6e 100644 --- a/Particles/SemiCircularSmearFade.cs +++ b/Particles/SemiCircularSmearFade.cs @@ -13,13 +13,14 @@ namespace CalamityMod.Particles public override bool UseAdditiveBlend => true; public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public Player player = Main.player[Main.myPlayer]; + public Player player = Main.LocalPlayer; public Color InitialColor; public bool PlayerCentered; public bool RotateToVelocity; public Vector2 Squish; public bool ProduceLight; - public SemiCircularSmearFade(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, Vector2 squish, int lifetime, bool playerCentered = false, bool rotateToVelocity = false, bool produceLight = true) + public int Direction = 1; + public SemiCircularSmearFade(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, Vector2 squish, int lifetime, bool playerCentered = false, bool rotateToVelocity = false, bool produceLight = true, int direction = 1) { Position = position; Velocity = velocity; @@ -31,7 +32,7 @@ namespace CalamityMod.Particles PlayerCentered = playerCentered; RotateToVelocity = rotateToVelocity; ProduceLight = produceLight; - + Direction = direction; } public override void Update() { @@ -53,7 +54,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { Texture2D tex = ModContent.Request(Texture).Value; - spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() * 0.5f, Scale * Squish, 0, 0f); + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() * 0.5f, Scale * Squish, Direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); } } } diff --git a/Particles/SemiCircularSmearSwipe.png b/Particles/SemiCircularSmearSwipe.png new file mode 100644 index 0000000000..cf9a7c4edc Binary files /dev/null and b/Particles/SemiCircularSmearSwipe.png differ diff --git a/Particles/SemiCircularSmearVFX.cs b/Particles/SemiCircularSmearVFX.cs index 6fba683ae4..ff073899fc 100644 --- a/Particles/SemiCircularSmearVFX.cs +++ b/Particles/SemiCircularSmearVFX.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Particles public override bool UseAdditiveBlend => true; public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public Player player = Main.player[Main.myPlayer]; + public Player player = Main.LocalPlayer; public bool PlayerCentered; public Vector2 Squish; diff --git a/Particles/SemiCircularSmearVertical2.png b/Particles/SemiCircularSmearVertical2.png new file mode 100644 index 0000000000..75d343938e Binary files /dev/null and b/Particles/SemiCircularSmearVertical2.png differ diff --git a/Particles/SmallBloomRingLayered.png b/Particles/SmallBloomRingLayered.png new file mode 100644 index 0000000000..0fc2fd1feb Binary files /dev/null and b/Particles/SmallBloomRingLayered.png differ diff --git a/Particles/SquareAshParticle.cs b/Particles/SquareAshParticle.cs new file mode 100644 index 0000000000..66ad1f48d5 --- /dev/null +++ b/Particles/SquareAshParticle.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class SquareAshParticle : Particle + { + public Color InitialColor; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => false; + + public override string Texture => "CalamityMod/Particles/Square"; + + public SquareAshParticle(Vector2 relativePosition, Vector2 velocity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + } + + public override void Update() + { + // Shrink to nothing near end of lifetime + if (Time > Lifetime - 60) + { + Scale *= 0.95f; + } + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Rotation += Velocity.X > 0 ? 0.8f : -0.8f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(0.8f, 1.2f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + } + } +} diff --git a/Particles/SquareParticle.cs b/Particles/SquareParticle.cs index 811230e9fb..b3fe433662 100644 --- a/Particles/SquareParticle.cs +++ b/Particles/SquareParticle.cs @@ -42,10 +42,9 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Vector2 scale = new Vector2(0.8f, 1.2f) * 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, 0, 0f); } } } diff --git a/Particles/ThunderBoltVFX.cs b/Particles/ThunderBoltVFX.cs index 83b6461954..46aecc9660 100644 --- a/Particles/ThunderBoltVFX.cs +++ b/Particles/ThunderBoltVFX.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -12,26 +13,75 @@ namespace CalamityMod.Particles public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public Vector2 Squish; - public float ShakePower; - public float Opacity; - public Projectile AttachedProjectile; - public float DisplacementFromProjectile; + /// + /// The function that decides to follow a specific . + /// + public Func FollowFunction; - public ThunderBoltVFX(Vector2 position, Color color, float rotation, float scale, Vector2 squish, float opacity = 1f, float shakePower = 20f, Projectile projectileToFollow = null, float displacementFromProjectile = 0f) + /// + /// The opacity of this particle, can only go from 0 to 1.
+ /// Defaults to 1. + ///
+ public float Opacity + { + get => opacity; + set => opacity = Math.Clamp(value, 0f, 1f); + } + private float opacity = 1f; + + /// + /// The amount of shaking this particle will have.
+ /// Will always be positive.
+ /// Defaults to 0. + ///
+ public float ShakePower + { + get => shakePower; + set => shakePower = Math.Abs(value); + } + private float shakePower; + + /// + /// The squish of this particle, how much is streched, widened, distorted, etc.
+ /// For standard purposes, it defaults to . + ///
+ public Vector2 Squish = Vector2.One; + + /// + /// A constructor that spawns a particle that does not move from where it spawns. + /// + public ThunderBoltVFX(Vector2 position, float rotation, float scale, Color color, int lifeTime, float shakePower, float opacity = 1f, Vector2? squish = null) { Position = position; - Velocity = Vector2.Zero; - Color = color; - Scale = scale; - Squish = squish; Rotation = rotation; + Scale = scale; + Color = color; Opacity = opacity; + Lifetime = lifeTime; ShakePower = shakePower; - if (projectileToFollow != null) - AttachedProjectile = projectileToFollow; - DisplacementFromProjectile = displacementFromProjectile; - Lifetime = 30; + if (squish != null) + Squish = (Vector2)squish; + } + + /// + /// A constructor that spawns a particle that follows a specific .
+ /// For simple one-line positions, you can just write in the argument, for example:
+ ///
+ /// () => Projectile.Center + /// For more complicated logic to decide which it should follow,
+ /// you'd just make your own function which returns a and give it as an argument. + ///
+ public ThunderBoltVFX(Func followFunction, float rotation, float scale, Color color, int lifeTime, float shakePower, float opacity = 1f, Vector2? squish = null) + { + FollowFunction = followFunction; + Rotation = rotation; + Scale = scale; + Color = color; + Opacity = opacity; + Lifetime = lifeTime; + ShakePower = shakePower; + if (squish != null) + Squish = (Vector2)squish; } public override void Update() @@ -40,9 +90,7 @@ namespace CalamityMod.Particles float fadeFactor = 1f - 0.05f * MathHelper.Clamp((Time - 10) / 10f, 0f, 1f); Opacity *= fadeFactor; Squish.X *= fadeFactor; - - if (AttachedProjectile != null && AttachedProjectile.active) - Position = AttachedProjectile.Center + Vector2.UnitY * DisplacementFromProjectile; + if (FollowFunction is not null) Position = FollowFunction.Invoke(); } public override void CustomDraw(SpriteBatch spriteBatch) diff --git a/Particles/VelChangingSpark .cs b/Particles/VelChangingSpark .cs new file mode 100644 index 0000000000..f917530522 --- /dev/null +++ b/Particles/VelChangingSpark .cs @@ -0,0 +1,104 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class VelChangingSpark : Particle + { + public Color InitialColor; + public bool FadeIn = false; + public float FadeInScale = 0f; + public bool GlowCenter = false; + public string NewTexture; + public float ExtraRotation; + public Vector2 Stretch = new Vector2(0.5f, 1.6f); + public float ShrinkSpeed = 0; + public Vector2 EndVelocity; + public float LerpRate = 0.1f; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool AltVisual = true; + public override bool UseAdditiveBlend => AltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public VelChangingSpark(Vector2 relativePosition, Vector2 startVelocity, Vector2 endVelocity, string texture, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, float shrinkSpeed = 0, float lerpRate = 0.1f) + { + Position = relativePosition; + Velocity = startVelocity; + EndVelocity = endVelocity; + NewTexture = texture; + ExtraRotation = extraRotation; + AffectedByLight = false; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + ShrinkSpeed = shrinkSpeed; + + AltVisual = useAddativeBlend; + GlowCenter = glowCenter; + + FadeIn = fadeIn; + + if (FadeIn) + Scale = 0f; + LerpRate = lerpRate; + } + + public override void Update() + { + if (!FadeIn) + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale *= 0.95f; + } + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + if ((float)Time / (float)Lifetime < 0.8f) + { + Velocity *= 0.95f; + EndVelocity *= 0.95f; + } + + Velocity = new Vector2(MathHelper.Lerp(Velocity.X, EndVelocity.X, LerpRate), MathHelper.Lerp(Velocity.Y, EndVelocity.Y, LerpRate)); + + Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation; + + Stretch.X *= (1 - 0.2f * ShrinkSpeed); + Stretch.Y *= (1 + 0.2f * ShrinkSpeed); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = Stretch * Scale; + Texture2D texture = ModContent.Request(NewTexture).Value; + + Color col = Color; + + if (AffectedByLight) + { + col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + if (GlowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f), Rotation, texture.Size() * 0.5f, scale * 0.8f, 0, 0f); + } + } +} diff --git a/Particles/VerticalSmear.png b/Particles/VerticalSmear.png new file mode 100644 index 0000000000..74d237ccaa Binary files /dev/null and b/Particles/VerticalSmear.png differ diff --git a/Particles/VerticalSmearLarge.png b/Particles/VerticalSmearLarge.png new file mode 100644 index 0000000000..ca28d1e321 Binary files /dev/null and b/Particles/VerticalSmearLarge.png differ diff --git a/Particles/VerticalSmearRagged.png b/Particles/VerticalSmearRagged.png new file mode 100644 index 0000000000..3d65f01e4b Binary files /dev/null and b/Particles/VerticalSmearRagged.png differ diff --git a/Particles/VoidBeam.png b/Particles/VoidBeam.png new file mode 100644 index 0000000000..dcbbd1848b Binary files /dev/null and b/Particles/VoidBeam.png differ diff --git a/Particles/VoidBeamGlow.png b/Particles/VoidBeamGlow.png new file mode 100644 index 0000000000..6b7508c213 Binary files /dev/null and b/Particles/VoidBeamGlow.png differ diff --git a/Particles/VoidSparkParticle.cs b/Particles/VoidSparkParticle.cs index 7aa4280992..5b3cdb2b95 100644 --- a/Particles/VoidSparkParticle.cs +++ b/Particles/VoidSparkParticle.cs @@ -12,20 +12,22 @@ namespace CalamityMod.Particles public bool AffectedByGravity; public float Ylength = 1f; public float Xlength = 0.6f; + public float ShrinkSpeed = 1; public override bool SetLifetime => true; public override bool UseCustomDraw => true; public override bool UseAdditiveBlend => false; - public override string Texture => "CalamityMod/Particles/LargeSpark"; + public override string Texture => "CalamityMod/Particles/GlowSpark2"; - public VoidSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color) + public VoidSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, float shrinkSpeed = 1) { Position = relativePosition; Velocity = velocity; AffectedByGravity = affectedByGravity; - Scale = scale; + Scale = scale * 0.357f; Lifetime = lifetime; Color = InitialColor = color; + ShrinkSpeed = shrinkSpeed; } public override void Update() @@ -33,8 +35,9 @@ namespace CalamityMod.Particles Scale *= 0.9f; Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); Velocity *= 0.95f; - Ylength *= 1.25f; - Xlength *= 0.7f; + + Ylength *= (1 + (0.25f * ShrinkSpeed)); + Xlength *= (1 - (0.3f * ShrinkSpeed)); if (Velocity.Length() < 12f && AffectedByGravity) { @@ -48,9 +51,10 @@ namespace CalamityMod.Particles { Vector2 scale = new Vector2(Xlength, Ylength) * Scale; Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/GlowSpark").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); + spriteBatch.Draw(texture2, Position - Main.screenPosition, null, Color with { A = 0 }, 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.75f, 0.9f), 0, 0f); } } } diff --git a/Particles/WulfrumBastionPartsParticle.cs b/Particles/WulfrumBastionPartsParticle.cs index ce2526b388..ea6a9d0ac6 100644 --- a/Particles/WulfrumBastionPartsParticle.cs +++ b/Particles/WulfrumBastionPartsParticle.cs @@ -80,6 +80,7 @@ namespace CalamityMod.Particles { Rotation = MathHelper.Lerp(RotationOffset, 0f, (float)Math.Pow(LifetimeCompletionAdjusted, 0.8f)); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //The gun if (TimeOffset == 0.6f) Rotation = (Owner.Calamity().mouseWorld - Owner.Center).ToRotation() + (Owner.direction < 0 ? MathHelper.Pi : 0f); diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs index bdab30559d..6e413c3fd5 100644 --- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using ReLogic.Content; using Terraria; using Terraria.DataStructures; -using Terraria.GameInput; using Terraria.ID; using Terraria.ModLoader; @@ -18,12 +12,17 @@ namespace CalamityMod.Projectiles.BaseProjectiles { public abstract class BaseCustomUseStyleProjectile : ModProjectile { - + public bool whenSpawned = true; public override void SetDefaults() { + // Width and height are set here so it can destroy cobwebs better lol + Projectile.width = (int)Math.Max(HitboxSize.X, 1); + Projectile.height = (int)Math.Max(HitboxSize.Y, 1); Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = -1; + Projectile.noEnchantmentVisuals = true; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void OnSpawn(IEntitySource source) @@ -70,6 +69,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public bool FlipAsSword = false; + /// + /// If true, the sword will be active reguardless of the player being in an item use state. + /// + public bool IgnoreActiveAnimation = false; + /// /// The offset in radians of the weapon's rotation from its current rotation. /// @@ -148,6 +152,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual void ResetStyle() { } + /// + /// Determines the behavior of the projectile when spawned. (but it is multiplayer synced) + /// + public virtual void WhenSpawned() { } /// /// Determines the behavior of the projectile when the item is in use. /// @@ -166,9 +174,17 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void AI() { + if (whenSpawned) + { + WhenSpawned(); + whenSpawned = false; + Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.netUpdate = true; + } + bool ItemAnimationActive = Owner.ItemAnimationActive; - if (Owner.HeldItem.type != AssignedItemID) + if (Owner.HeldItem.type != AssignedItemID || Owner.dead) { Projectile.Kill(); } @@ -176,7 +192,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Owner.Calamity().mouseWorldListener = true; Owner.Calamity().rightClickListener = true; - if (ItemAnimationActive) + if (ItemAnimationActive || IgnoreActiveAnimation) { Animation++; @@ -252,6 +268,17 @@ namespace CalamityMod.Projectiles.BaseProjectiles hitbox = new Rectangle((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y); + if (false) // Turn this on to show the hitbox, useful for testing if it's working how you want + { + Particle blastRing = new CustomPulse(hitbox.TopLeft(), Vector2.Zero, Color.Red, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(hitbox.TopRight(), Vector2.Zero, Color.Gold, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(hitbox.BottomLeft(), Vector2.Zero, Color.Green, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing3); + Particle blastRing4 = new CustomPulse(hitbox.BottomRight(), Vector2.Zero, Color.Cyan, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing4); + } base.ModifyDamageHitbox(ref hitbox); } diff --git a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs index 48e3be1879..7f3e4dea90 100644 --- a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs @@ -33,6 +33,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.5f; + /// + /// A value from 0 to 1 that defines how fast the weapon turns to the mouse.
+ /// Defaults to 0.2. + ///
+ public virtual float WeaponTurnSpeed => 0.2f; + /// /// How fast returns back to .
/// In consequence, this is how fast the holdout goes back to its position.
@@ -144,6 +150,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.width = Projectile.height = ItemTexture is null ? 1 : ItemTexture.Width(); Projectile.tileCollide = false; Projectile.netImportant = true; + // While having this enabled would be good, it seems to mess with crits on all holdout when applied, so it will stay disabled + //Projectile.ContinuouslyUpdateDamageStats = true; } public override void OnSpawn(IEntitySource source) => OffsetLengthFromArm = MaxOffsetLengthFromArm; @@ -185,6 +193,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles // The center of the player, taking into account if they have a mount or not. Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // The vector between the player and the mouse, used for pointing the holdout. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - armPosition; @@ -200,7 +209,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles 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.velocity = holdoutDirection.AngleTowards(ownerToMouse.ToRotation(), WeaponTurnSpeed).ToRotationVector2(); Projectile.rotation = holdoutDirection; Projectile.spriteDirection = direction; @@ -221,8 +230,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (OffsetLengthFromArm != MaxOffsetLengthFromArm) OffsetLengthFromArm = MathHelper.Lerp(OffsetLengthFromArm, MaxOffsetLengthFromArm, RecoilResolveSpeed); - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } /// diff --git a/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs index 34d117b2e6..a8658220ca 100644 --- a/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs @@ -16,29 +16,17 @@ namespace CalamityMod.Projectiles.BaseProjectiles // The projectile type cannot be directly discerned at load time (Using Activator.CreateInstance will create an associated projectile with an ID of 0) and as // such this property exists as a direct means of retrieving it. Not ideal, but it works. public abstract int IntendedProjectileType { get; } - public static Dictionary ItemProjectileRelationship = new(); + public static Dictionary ItemProjectileRelationship = []; - // TODO -- There is no reason this load hook should need to be called from CalamityMod. - // All subclasses of this should be ILoadable and should load themselves. - public static void LoadAll() + public override void SetStaticDefaults() { - ItemProjectileRelationship = new Dictionary(); + ItemProjectileRelationship[AssociatedItemID] = IntendedProjectileType; + } - // 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. - Type[] types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); - foreach (Type type in types) - { - // Don't load abstract classes; they cannot have instances. - if (type.IsAbstract) - continue; - - if (type.IsSubclassOf(typeof(BaseIdleHoldoutProjectile))) - { - BaseIdleHoldoutProjectile instance = Activator.CreateInstance(type) as BaseIdleHoldoutProjectile; - ItemProjectileRelationship[instance.AssociatedItemID] = instance.IntendedProjectileType; - } - } + public override void Unload() + { + ItemProjectileRelationship?.Clear(); + ItemProjectileRelationship = null; } public static void CheckForEveryHoldout(Player player) diff --git a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs index 2a9b9923a2..d9834046f1 100644 --- a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs @@ -120,9 +120,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles protected internal void DrawBeamWithColor(Color beamColor, float scale, int startFrame = 0, int middleFrame = 0, int endFrame = 0) { - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, startFrame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, middleFrame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, endFrame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, startFrame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, middleFrame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, endFrame); // Start texture drawing. Main.EntitySpriteDraw(LaserBeginTexture, @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles #region Hook Overrides public override void AI() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; Behavior(); ExtraBehavior(); diff --git a/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs index ff5bc54ab3..aef40e7691 100644 --- a/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -210,6 +210,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.ownerHitCheck = true; if (Projectile.owner == Main.myPlayer) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = Owner.MountedCenter.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX * Owner.direction); Owner.ChangeDir((toMouse.X > 0f).ToDirectionInt()); if (!Owner.channel) @@ -217,7 +218,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles CurrentFlailState = FlailState.LaunchingForward; StateTimer = 0f; Projectile.Center = Owner.MountedCenter; - Projectile.velocity = toMouse * launchSpeed + Owner.velocity; + Projectile.velocity = toMouse * launchSpeed; Projectile.netUpdate = true; Projectile.ResetLocalNPCHitImmunity(); Projectile.localNPCHitCooldown = LaunchIFrames * Projectile.MaxUpdates; @@ -327,9 +328,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// /// Reserved for extra AI that is always ran regardless of state. Does nothing by default.
- /// Example cases include shooting projectiles in a similar manner to Flower Pow. + /// Example cases include shooting projectiles in a similar manner to Flower Pow.
+ /// Return false to entirely override base flail behaviour. ///
- public virtual void ExtraBehavior() { } + public virtual bool ExtraBehavior() => true; /// /// Handles simple chain drawing. Can be overridden for cases such as chains with multiple frames/variants. @@ -421,31 +423,32 @@ namespace CalamityMod.Projectiles.BaseProjectiles break; } - ExtraBehavior(); - - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); - - // Non-symmetric rotation (symmetric is just in this if condition here) - if (CurrentFlailState == FlailState.Ricochet || CurrentFlailState == FlailState.Dropping) + if (ExtraBehavior()) { - if (Projectile.velocity.Length() > 1f) - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + Projectile.velocity.X * 0.1f; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); + + // Non-symmetric rotation (symmetric is just in this if condition here) + if (CurrentFlailState == FlailState.Ricochet || CurrentFlailState == FlailState.Dropping) + { + if (Projectile.velocity.Length() > 1f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + Projectile.velocity.X * 0.1f; + else + Projectile.rotation += Projectile.velocity.X * 0.1f; + } else - Projectile.rotation += Projectile.velocity.X * 0.1f; - } - else - { - Vector2 vectorTowardsPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter); - Projectile.rotation = vectorTowardsPlayer.ToRotation() + MathHelper.ToRadians(270f); - } + { + Vector2 vectorTowardsPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter); + Projectile.rotation = vectorTowardsPlayer.ToRotation() + MathHelper.ToRadians(270f); + } - Projectile.timeLeft = 2; - Owner.heldProj = Projectile.whoAmI; - Owner.SetDummyItemTime(2); - Owner.itemRotation = Projectile.DirectionFrom(Owner.MountedCenter).ToRotation(); - if (Projectile.Center.X < Owner.MountedCenter.X) - Owner.itemRotation += MathHelper.Pi; - Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + Projectile.timeLeft = 2; + Owner.heldProj = Projectile.whoAmI; + Owner.SetDummyItemTime(2); + Owner.itemRotation = Projectile.DirectionFrom(Owner.MountedCenter).ToRotation(); + if (Projectile.Center.X < Owner.MountedCenter.X) + Owner.itemRotation += MathHelper.Pi; + Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -544,7 +547,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles // By default, maces have afterimages when launched. // This can still be disabled via config or set individually by the projectile. // (Does not use utils due to set trail length conditions) - if (CurrentFlailState == FlailState.LaunchingForward && CalamityConfig.Instance.Afterimages && AfterimageLength > 0) + if (CurrentFlailState == FlailState.LaunchingForward && CalamityClientConfig.Instance.Afterimages && AfterimageLength > 0) { Texture2D maceTex = TextureAssets.Projectile[Type].Value; Vector2 drawOrigin = new Vector2(maceTex.Width * 0.5f, maceTex.Height * 0.5f); diff --git a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs index 39dfaebd12..5d6e660d58 100644 --- a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs @@ -140,6 +140,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void SetStaticDefaults() { Main.projFrames[Type] = AnimationFrames; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.TrailingMode[Type] = TrailingMode; ProjectileID.Sets.TrailCacheLength[Type] = TrailCacheLength; diff --git a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs index 46700c42b6..99815b550c 100644 --- a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles { if (SpearAiType == SpearType.TypicalSpear) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/BaseWhipProjectile.cs b/Projectiles/BaseProjectiles/BaseWhipProjectile.cs index a35e02a794..d237f39f70 100644 --- a/Projectiles/BaseProjectiles/BaseWhipProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseWhipProjectile.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Behavior(); ExtraBehavior(); } - public Texture2D FlailTexture => Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + public Texture2D FlailTexture => Terraria.GameContent.TextureAssets.Projectile[Type].Value; #region Virtual Values public virtual Color SpecialDrawColor => new Color(255, 200, 0); diff --git a/Projectiles/Boss/AnahitaTelegraph.cs b/Projectiles/Boss/AnahitaTelegraph.cs new file mode 100644 index 0000000000..dae70d053d --- /dev/null +++ b/Projectiles/Boss/AnahitaTelegraph.cs @@ -0,0 +1,143 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AnahitaTelegraph : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private const int Lifetime = 30; + public ref float TeleType => ref Projectile.ai[1]; // 0: Water spear. 1: Frost mist. 2: Treble clef. + public static Asset WaterSpearTex; + public static Asset FrostMistTex; + public static Asset TrebleClefTex; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + WaterSpearTex = ModContent.Request("CalamityMod/Particles/PointParticle"); + FrostMistTex = ModContent.Request("CalamityMod/Particles/BloomCircle"); + TrebleClefTex = ModContent.Request("CalamityMod/Particles/Sparkle"); + } + } + public override void SetDefaults() + { + Projectile.width = Projectile.height = 15; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.alpha = 255; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(Projectile.rotation); + public override void ReceiveExtraAI(BinaryReader reader) => Projectile.rotation = reader.ReadSingle(); + + private Color DetermineColor() + { + Color returnColor = Color.Black; + switch (TeleType) + { + case 0: + returnColor = new Color(55, 70, 240); + break; + case 1: + returnColor = Color.White * 0.9f; + break; + case 2: + returnColor = new Color(199, 90, 67); + break; + } + return returnColor; + } + + public override void AI() + { + Player target = Main.player[(int)Projectile.ai[0]]; + + // Setting water spear and treble clef rotation on spawn + if (Projectile.timeLeft == Lifetime) + { + switch (TeleType) + { + case 0: + Projectile.rotation = (target.Center - Projectile.Center).ToRotation(); + break; + case 2: + Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); + break; + default: + break; + } + } + + // Fade in and fade out + if (Projectile.timeLeft > Math.Ceiling(Lifetime * 0.66f)) + Projectile.alpha -= 25; + if (Projectile.timeLeft <= Math.Ceiling(Lifetime * 0.33f)) + Projectile.alpha += 25; + + // Constantly move with the targeted player + Projectile.Center += target.velocity; + + // Dust + if (Projectile.timeLeft % 3 == 0) + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TintableDustLighted, newColor: DetermineColor(), Scale: 0.75f); + + // Specific behavior for each telegraph + switch (TeleType) + { + // Water spears: Move inward at constant speed + case 0: + Projectile.Center += Vector2.Normalize(target.Center - Projectile.Center) * 8.5f; + break; + // Frost mists: Move inward with accelerating speed + case 1: + int accFactor = Lifetime - Projectile.timeLeft; + Projectile.Center += Vector2.Normalize(target.Center - Projectile.Center) * accFactor * 0.73f; + break; + // Treble clefs: Stay in place and rotate + case 2: + Projectile.rotation += 0.165f; + break; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Asset tex; + Color telegraphColor = DetermineColor(); + + switch (TeleType) + { + case 0: // Draws a pointing particle + tex = WaterSpearTex; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, telegraphColor * Projectile.Opacity, Projectile.rotation + MathHelper.PiOver2, tex.Value.Size() / 2f, new Vector2(0.75f, 1.75f), SpriteEffects.None); + break; + case 1: // Draws a bloom circle + tex = FrostMistTex; + Main.spriteBatch.SetBlendState(BlendState.Additive); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, telegraphColor * Projectile.Opacity * 0.75f, 0f, tex.Value.Size() / 2f, Projectile.scale * 0.7f, SpriteEffects.None); + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + break; + case 2: // Draws two rotating stars + tex = TrebleClefTex; + Main.spriteBatch.SetBlendState(BlendState.Additive); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, telegraphColor * Projectile.Opacity * 0.9f, Projectile.rotation, tex.Value.Size() / 2f, Projectile.scale * 2f, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, telegraphColor * Projectile.Opacity * 0.9f, -Projectile.rotation, tex.Value.Size() / 2f, Projectile.scale * 2f, SpriteEffects.None); + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + break; + } + + return false; + } + } +} diff --git a/Projectiles/Boss/ApolloChargeTelegraph.cs b/Projectiles/Boss/ApolloChargeTelegraph.cs index 143df6a6d3..b038018e4c 100644 --- a/Projectiles/Boss/ApolloChargeTelegraph.cs +++ b/Projectiles/Boss/ApolloChargeTelegraph.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/ApolloFireball.cs b/Projectiles/Boss/ApolloFireball.cs index d86f5eec5a..f89f8ea341 100644 --- a/Projectiles/Boss/ApolloFireball.cs +++ b/Projectiles/Boss/ApolloFireball.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index 01673d9b36..7328a7f6e0 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 5; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -190,14 +190,14 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/ApolloRocketGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); @@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[dust].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs index b08a03cdca..76c213e5bf 100644 --- a/Projectiles/Boss/AresDeathBeamStart.cs +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -38,9 +38,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { // Ares' eight-pointed-star (more on higher difficulties) laser beams - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; - // This is its serious name + Main.projFrames[Type] = 5; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -163,7 +162,7 @@ namespace CalamityMod.Projectiles.Boss // Determine frames. Projectile.frameCounter++; if (Projectile.frameCounter % 5f == 0f) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } public override bool PreDraw(ref Color lightColor) @@ -177,10 +176,10 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.scale < 0.001f) return false; - Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color beamColor = CalamityClientConfig.Instance.Photosensitivity ? Color.CornflowerBlue : LaserOverlayColor; + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); // Start texture drawing. Main.EntitySpriteDraw(LaserBeginTexture, @@ -215,7 +214,7 @@ namespace CalamityMod.Projectiles.Boss 0); incrementalBodyLength += laserOffset; centerOnLaser += Projectile.velocity * laserOffset; - middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Projectile.type]; + middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Type]; if (middleFrameArea.Y + middleFrameArea.Height > LaserMiddleTexture.Height) middleFrameArea.Y = 0; } diff --git a/Projectiles/Boss/AresDeathBeamTelegraph.cs b/Projectiles/Boss/AresDeathBeamTelegraph.cs index d447922d4a..52458b6833 100644 --- a/Projectiles/Boss/AresDeathBeamTelegraph.cs +++ b/Projectiles/Boss/AresDeathBeamTelegraph.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { // Telegraph for Ares' eight-pointed-star laser beams - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index 89aa0ed04a..116e59a084 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -22,9 +22,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 12; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -162,15 +162,15 @@ namespace CalamityMod.Projectiles.Boss Main.EntitySpriteDraw(telegraphBase, drawPosition, null, lightColor, 0, telegraphBase.Size() / 2f, 1480f, 0, 0); Main.spriteBatch.ExitShaderRegion(); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/AresGaussNukeProjectileGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Boss // Nuke explosion sound. SoundEngine.PlaySound(AresGaussNuke.NukeExplosionSound, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Nuke gores Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity, Mod.Find("AresGaussNuke1").Type, 1f); diff --git a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs index a8c411f3be..fabc0a19b7 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs index 2cebb4d08e..dc29973504 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/AresLaserBeamStart.cs b/Projectiles/Boss/AresLaserBeamStart.cs index 79dae329f9..fd96c14180 100644 --- a/Projectiles/Boss/AresLaserBeamStart.cs +++ b/Projectiles/Boss/AresLaserBeamStart.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -150,7 +150,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity == Vector2.Zero) return false; - Texture2D beamStart = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D beamStart = Terraria.GameContent.TextureAssets.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 d291c6718e..adba705b56 100644 --- a/Projectiles/Boss/AresPlasmaBolt.cs +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index 15676d5635..c214b13881 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index 3ccee65e4c..4878f29a10 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -21,10 +21,10 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -236,7 +236,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/ArtemisChargeTelegraph.cs b/Projectiles/Boss/ArtemisChargeTelegraph.cs index 6b3648880b..0ec7ee0a8d 100644 --- a/Projectiles/Boss/ArtemisChargeTelegraph.cs +++ b/Projectiles/Boss/ArtemisChargeTelegraph.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs index 132f4c959f..8baf69fb39 100644 --- a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs +++ b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/ArtemisLaser.cs b/Projectiles/Boss/ArtemisLaser.cs index 8232a47fdc..454670d01a 100644 --- a/Projectiles/Boss/ArtemisLaser.cs +++ b/Projectiles/Boss/ArtemisLaser.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + Main.projFrames[Type] = 4; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -217,7 +217,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); Projectile.Center -= drawOffset; return false; } diff --git a/Projectiles/Boss/ArtemisSpinLaserbeam.cs b/Projectiles/Boss/ArtemisSpinLaserbeam.cs index 45d346d659..08b27e1575 100644 --- a/Projectiles/Boss/ArtemisSpinLaserbeam.cs +++ b/Projectiles/Boss/ArtemisSpinLaserbeam.cs @@ -30,15 +30,15 @@ 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 => Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + public override Texture2D LaserBeginTexture => Terraria.GameContent.TextureAssets.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"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + Main.projFrames[Type] = 5; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; // This is its serious name } @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Boss // Determine frames. Projectile.frameCounter++; if (Projectile.frameCounter % 5f == 0f) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } public float LaserWidthFunction(float _) => Projectile.scale * Projectile.width; diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index 3738d2946f..99629bc81a 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/AstralGodRay.cs b/Projectiles/Boss/AstralGodRay.cs index d84d7ad212..bca3fb8b44 100644 --- a/Projectiles/Boss/AstralGodRay.cs +++ b/Projectiles/Boss/AstralGodRay.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index fbc21c0d28..f81ffeeeac 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index a07a287af0..82f15bd2a2 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index 48ca50b2c9..af1f3b5f90 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Boss public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index 32cd12277f..85a99f9a3f 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Boss public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index 0cf7e9e6ba..bf325251d8 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -20,13 +20,13 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() { - Projectile.width = 80; - Projectile.height = 80; + Projectile.width = 32; + Projectile.height = 32; Projectile.hostile = true; Projectile.alpha = 255; Projectile.penetrate = -1; @@ -76,6 +76,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.Kill(); return; } + if (Projectile.localAI[0] % 4 == 0) + Projectile.frameCounter++; Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * Math.PI / timeBeforeVanish) * 10f * projScale; if (Projectile.scale > projScale) @@ -129,43 +131,47 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { if (Projectile.velocity == Vector2.Zero) - { return false; - } - 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 + + Texture2D middleTex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D endpointTex = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraEndpoints", AssetRequestMode.ImmediateLoad).Value; + + // Used to track the animation of the segments + int middleFrame = Projectile.frameCounter % 12; + int endpointFrame = Projectile.frameCounter % 3; + float auraDrawLength = Projectile.localAI[1]; // Length of the laser Color grayColor = new Color(128, 128, 128, 0); - Vector2 vector = Projectile.Center - Main.screenPosition; - Rectangle? sourceRectangle2 = null; - Main.EntitySpriteDraw(texture2, vector, sourceRectangle2, grayColor, Projectile.rotation, texture2.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - auraDrawLength -= (texture2.Height / 2 + texture3.Height) * Projectile.scale; + + // Draw the bottom endpoint segment + Rectangle? sourceRectangle2 = endpointTex.Frame(1, 3, 0, endpointFrame); + Vector2 endPosition = Projectile.Center - Main.screenPosition - new Vector2(0f, 22f); // Of course it's 22, this stupid fucking accursed number + Main.EntitySpriteDraw(endpointTex, endPosition, sourceRectangle2, grayColor, Projectile.rotation, endpointTex.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + + // Draw the middle segments + auraDrawLength -= (endpointTex.Height / 2 + endpointTex.Height) * Projectile.scale; Vector2 projCenter = Projectile.Center; - projCenter += Projectile.velocity * Projectile.scale * texture2.Height / 2f; - if (auraDrawLength > 0f) + projCenter += Projectile.velocity * Projectile.scale * endpointTex.Height / 2f; + if (auraDrawLength > 0f) // Only draw a middle segment if there's enough height for one { float auraSegment = 0f; - Rectangle drawRectangle = new Rectangle(0, 0, texture.Width, texture.Height); + Rectangle drawRectangle = middleTex.Frame(12, 1, middleFrame, 0); while (auraSegment + 1f < auraDrawLength) { if (auraDrawLength - auraSegment < drawRectangle.Height) { drawRectangle.Height = (int)(auraDrawLength - auraSegment); } - Main.EntitySpriteDraw(texture, projCenter - Main.screenPosition, new Rectangle?(drawRectangle), grayColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(middleTex, projCenter - Main.screenPosition, new Rectangle?(drawRectangle), grayColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); auraSegment += drawRectangle.Height * Projectile.scale; projCenter += Projectile.velocity * drawRectangle.Height * Projectile.scale; - drawRectangle.Y += texture.Height; - if (drawRectangle.Y + drawRectangle.Height > texture.Height) + drawRectangle.Y += middleTex.Height; + if (drawRectangle.Y + drawRectangle.Height > middleTex.Height) { drawRectangle.Y = 0; } } } - Vector2 vector2 = projCenter - Main.screenPosition; - sourceRectangle2 = null; - Main.EntitySpriteDraw(texture3, vector2, sourceRectangle2, grayColor, Projectile.rotation, texture3.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + // There is intentionally no top endpoint segment drawn return false; } diff --git a/Projectiles/Boss/BirbAura.png b/Projectiles/Boss/BirbAura.png index 3515f6998c..0b6f0a7026 100644 Binary files a/Projectiles/Boss/BirbAura.png and b/Projectiles/Boss/BirbAura.png differ diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index c6d458821e..a821b4b885 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 344dee7f5e..b69a56ddd3 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Projectiles.Boss public int time = 0; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Boss } } - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 10 * Projectile.scale, targetHitbox); diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index 42b6e2b860..2fb7384d2e 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D fire = Terraria.GameContent.TextureAssets.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 c30a023c2f..a0abed02ee 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Projectiles.Boss 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; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Boss } } - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index d34e761d03..81d2d736db 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { // Cal Clone bullet hell projectiles accelerate after a certain time has passed - if (Projectile.ai[0] == 2f && Main.expertMode && Projectile.timeLeft < 1260) + if (Projectile.ai[0] == 2f && (Main.expertMode || BossRushEvent.BossRushActive) && Projectile.timeLeft < 1260) { - if (Projectile.velocity.Length() < (BossRushEvent.BossRushActive ? 15f : 10f)) + if (Projectile.velocity.Length() < (BossRushEvent.BossRushActive ? 12.5f : 10f)) Projectile.velocity *= 1.005f; } @@ -75,8 +75,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int drawStart = frameHeight * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index 28eb48be39..c35f3e1f66 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 7ea0d0e4e0..143bd0df9f 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -7,6 +7,7 @@ using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -272,14 +273,20 @@ namespace CalamityMod.Projectiles.Boss 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; + // If this code happens to run when the player is not colliding, don't apply any effects. + // The performance impact of verifying this is marginal, especially since there's only ever one of this projectile. + // == false is necessary since the method is a nullable. + if (Colliding(Projectile.Hitbox, player.Hitbox) == false) + return false; + + // Applies Vulnerability Hex and/or the effects of Supreme Cirrus' HAGE faces. + OnHitPlayer_Internal(player); + // 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); @@ -344,7 +351,7 @@ namespace CalamityMod.Projectiles.Boss for (int l = 0; l < Player.MaxBuffs; l++) { int buffType = target.buffType[l]; - if (target.buffTime[l] > 0 && CalamityLists.amalgamBuffList.Contains(buffType)) + if (target.buffTime[l] > 0 && AmalgamBuffList.Includes(buffType)) { target.DelBuff(l); l--; @@ -365,7 +372,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; lightColor.R = (byte)(255 * Projectile.Opacity); Main.spriteBatch.End(); Effect shieldEffect = Filters.Scene["CalamityMod:HellBall"].GetShader().Shader; diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index 7e18a2f859..860895fc39 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -172,7 +172,7 @@ namespace CalamityMod.Projectiles.Boss { return false; } - Texture2D texture2D19 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2D19 = Terraria.GameContent.TextureAssets.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/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index 8d402eab10..02cfc656a3 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Boss { return false; } - Texture2D texture2D19 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2D19 = Terraria.GameContent.TextureAssets.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 abb32499e3..a524d96893 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -62,10 +62,10 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Projectile.timeLeft < 30) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); + if (Projectile.timeLeft < 60) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 1170) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 1140) / 30f), 0f, 1f); Lighting.AddLight(Projectile.Center, 0.5f * Projectile.Opacity, 0f, 0f); @@ -78,8 +78,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = texture.Height / Main.projFrames[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 3f0496de0d..37c926aaa8 100644 --- a/Projectiles/Boss/CirrusBlast.cs +++ b/Projectiles/Boss/CirrusBlast.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Boss // Determine frames. Projectile.frameCounter++; if (Projectile.frameCounter % 5f == 4f) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; @@ -105,9 +105,9 @@ namespace CalamityMod.Projectiles.Boss return false; Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); // Start texture drawing. Vector2 centerOnLaser = Projectile.Center + Projectile.velocity * Projectile.scale * 116f; diff --git a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs b/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs index 7465dfea8a..9a06af2a88 100644 --- a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs +++ b/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 36; } public override void SetDefaults() @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss Time++; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public void AbsolutelyFuckingAnnihilateTrees(int x, int y) { diff --git a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs b/Projectiles/Boss/CirrusPhotonRipperProjectile.cs index 8e5c509e28..c7363796be 100644 --- a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs +++ b/Projectiles/Boss/CirrusPhotonRipperProjectile.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; diff --git a/Projectiles/Boss/CirrusVolatileVodkaBottle.cs b/Projectiles/Boss/CirrusVolatileVodkaBottle.cs index b4efe39513..753d43bf97 100644 --- a/Projectiles/Boss/CirrusVolatileVodkaBottle.cs +++ b/Projectiles/Boss/CirrusVolatileVodkaBottle.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Items/Potions/Alcohol/FabsolsVodka"; + public override string Texture => "CalamityMod/Items/Potions/Alcohol/CirrusVodka"; public override void SetDefaults() { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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.Boss public override void OnHitPlayer(Player target, Player.HurtInfo info) { Projectile.Kill(); - target.AddBuff(ModContent.BuffType(), 54000); + target.AddBuff(ModContent.BuffType(), 54000); } } } diff --git a/Projectiles/Boss/CrimulanSpike.cs b/Projectiles/Boss/CrimulanSpike.cs new file mode 100644 index 0000000000..17e7b62fd7 --- /dev/null +++ b/Projectiles/Boss/CrimulanSpike.cs @@ -0,0 +1,82 @@ +using System; +using System.IO; +using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.Sounds; +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.Projectiles.Boss +{ + public class CrimulanSpike : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + + private const int TimeLeft = 600; + private const int FadeOutTime = 30; + private float MaxVelocity => Projectile.ai[0]; + private float Acceleration => Projectile.ai[1]; + + public override void SetDefaults() + { + Projectile.Calamity().DealsDefenseDamage = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.timeLeft = TimeLeft; + } + + public override void AI() + { + if (Projectile.velocity.Length() < MaxVelocity) + { + Projectile.velocity *= Acceleration; + if (Projectile.velocity.Length() > MaxVelocity) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= MaxVelocity; + } + } + + if (Projectile.timeLeft < FadeOutTime) + Projectile.Opacity -= 1f / FadeOutTime; + + if (Main.rand.NextBool()) + { + Color dustColor = Color.Crimson; + dustColor.A = 150; + 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; + } + } + + 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(BuffID.Darkness, 180); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Projectile.ai[2] > 0f ? ModContent.Request("CalamityMod/Projectiles/Boss/CrimulanSpike" + ((int)Projectile.ai[2] + 1)).Value : TextureAssets.Projectile[Projectile.type].Value; + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, texture); + return false; + } + } +} diff --git a/Projectiles/Boss/CrimulanSpike.png b/Projectiles/Boss/CrimulanSpike.png new file mode 100644 index 0000000000..d6e65576a9 Binary files /dev/null and b/Projectiles/Boss/CrimulanSpike.png differ diff --git a/Projectiles/Boss/CrimulanSpike2.png b/Projectiles/Boss/CrimulanSpike2.png new file mode 100644 index 0000000000..92b9a54542 Binary files /dev/null and b/Projectiles/Boss/CrimulanSpike2.png differ diff --git a/Projectiles/Boss/CrimulanSpike3.png b/Projectiles/Boss/CrimulanSpike3.png new file mode 100644 index 0000000000..01bcdccfa6 Binary files /dev/null and b/Projectiles/Boss/CrimulanSpike3.png differ diff --git a/Projectiles/Boss/CrimulanSpike4.png b/Projectiles/Boss/CrimulanSpike4.png new file mode 100644 index 0000000000..ffa29a97aa Binary files /dev/null and b/Projectiles/Boss/CrimulanSpike4.png differ diff --git a/Projectiles/Boss/CrimulanSpike5.png b/Projectiles/Boss/CrimulanSpike5.png new file mode 100644 index 0000000000..4b12092bf6 Binary files /dev/null and b/Projectiles/Boss/CrimulanSpike5.png differ diff --git a/Projectiles/Boss/CrimulanSpike6.png b/Projectiles/Boss/CrimulanSpike6.png new file mode 100644 index 0000000000..2804faaebc Binary files /dev/null and b/Projectiles/Boss/CrimulanSpike6.png differ diff --git a/Projectiles/Boss/CrimulanSpike7.png b/Projectiles/Boss/CrimulanSpike7.png new file mode 100644 index 0000000000..e5130f045c Binary files /dev/null and b/Projectiles/Boss/CrimulanSpike7.png differ diff --git a/Projectiles/Boss/CrimulanSpike8.png b/Projectiles/Boss/CrimulanSpike8.png new file mode 100644 index 0000000000..f39dc36563 Binary files /dev/null and b/Projectiles/Boss/CrimulanSpike8.png differ diff --git a/Projectiles/Boss/CrimulanSpike9.png b/Projectiles/Boss/CrimulanSpike9.png new file mode 100644 index 0000000000..56f28636fc Binary files /dev/null and b/Projectiles/Boss/CrimulanSpike9.png differ diff --git a/Projectiles/Boss/CursedFire.cs b/Projectiles/Boss/CursedFire.cs new file mode 100644 index 0000000000..cf1555fc68 --- /dev/null +++ b/Projectiles/Boss/CursedFire.cs @@ -0,0 +1,155 @@ +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.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class CursedFire : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/FireProj"; + + public static int Lifetime => 70; + public static int Fadetime => 60; + public ref float Time => ref Projectile.ai[0]; + public int MistType = -1; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = Lifetime; + CooldownSlot = ImmunityCooldownID.Bosses; + } + + public override void AI() + { + Time++; + if (Time < Fadetime && Main.rand.NextBool(6)) + { + Vector2 cinderPos = Projectile.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(Time, 0f, Lifetime, 0.5f, 1f); + float cinderSize = Utils.GetLerpValue(6f, 12f, Time, true); + Dust cinder = Dust.NewDustDirect(cinderPos, 4, 4, 75, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); + if (Main.rand.NextBool(3)) + { + cinder.scale *= 2f; + cinder.velocity *= 2f; + } + cinder.noGravity = true; + cinder.scale *= cinderSize * 1.2f; + cinder.velocity += Projectile.velocity * Utils.Remap(Time, 0f, Fadetime * 0.75f, 1f, 0.1f) * Utils.Remap(Time, 0f, Fadetime * 0.1f, 0.1f, 1f); + } + + if (MistType == -1) + MistType = Main.rand.Next(3); + + Lighting.AddLight(Projectile.Center, 0.15f, 0.75f, 0.15f); + } + + // Keeping the flames in place when hitting a block + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.velocity = oldVelocity * 0.95f; + Projectile.position -= Projectile.velocity; + Time++; + Projectile.timeLeft--; + return false; + } + + // Expanding hitbox + // A bit more generous than Havoc's Breath fire because enemy projectiles + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + int size = (int)Utils.Remap(Time, 0f, Fadetime, 8f, 32f); + + // Shrinks again after fading + if (Time > Fadetime) + size = (int)Utils.Remap(Time, Fadetime, Lifetime, 32f, 0f); + + hitbox.Inflate(size, size); + } + + // Anti-wall hacking checks + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projHitbox.Intersects(targetHitbox) && Collision.CanHit(Projectile.Center, 0, 0, targetHitbox.Center.ToVector2(), 0, 0) ? null : false; + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + target.AddBuff(BuffID.CursedInferno, 120); + + // Cook you up (still scales with player size in case it's manipulated) + int smokeCount = 4 + (int)MathHelper.Clamp(target.width * 0.1f, 0f, 20f); + for (int i = 0; i < smokeCount; i++) + { + Vector2 smokePos = target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f); + Vector2 smokeVel = Vector2.UnitY * Main.rand.NextFloat(-2.4f, -0.8f) * MathHelper.Clamp(target.height * 0.1f, 1f, 10f); + Particle smoke = new MediumMistParticle(smokePos, smokeVel, new Color(100, 255, 0), Color.DimGray, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; + + // The conga line of colors to sift through + Color color1 = new Color(100, 255, 20, 200); + Color color2 = new Color(100, 128, 10, 70); + Color color3 = new Color(100, 240, 20, 100); + Color color4 = new Color(80, 80, 0, 100); + float length = ((Time > Fadetime - 10f) ? 0.1f : 0.15f); + float vOffset = Math.Min(Time, 20f); + float timeRatio = Utils.GetLerpValue(0f, Lifetime, Time); + float fireSize = Utils.Remap(timeRatio, 0.2f, 0.5f, 0.25f, 1f); + + if (timeRatio >= 1f) + return false; + + for (float j = 1f; j >= 0f; j -= length) + { + // Color + Color fireColor = ((timeRatio < 0.1f) ? Color.Lerp(Color.Transparent, color1, Utils.GetLerpValue(0f, 0.1f, timeRatio)) : + ((timeRatio < 0.2f) ? Color.Lerp(color1, color2, Utils.GetLerpValue(0.1f, 0.2f, timeRatio)) : + ((timeRatio < 0.35f) ? color2 : + ((timeRatio < 0.7f) ? Color.Lerp(color2, color3, Utils.GetLerpValue(0.35f, 0.7f, timeRatio)) : + ((timeRatio < 0.85f) ? Color.Lerp(color3, color4, Utils.GetLerpValue(0.7f, 0.85f, timeRatio)) : + Color.Lerp(color4, Color.Transparent, Utils.GetLerpValue(0.85f, 1f, timeRatio))))))); + fireColor *= (1f - j) * Utils.GetLerpValue(0f, 0.2f, timeRatio, true); + Color innerColor = Color.Lerp(fireColor, Color.Black, 0.3f); + + // Positions and rotations + Vector2 firePos = Projectile.Center - Main.screenPosition - Projectile.velocity * vOffset * j; + float mainRot = -j * MathHelper.PiOver2 - Main.GlobalTimeWrappedHourly * (j + 1f) * 2f / length; + float trailRot = MathHelper.PiOver4 - mainRot; + + // Draw one backtrail + Vector2 trailOffset = Projectile.velocity * vOffset * length * 0.5f; + Main.EntitySpriteDraw(fire, firePos - trailOffset, null, innerColor * 0.25f, trailRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); + + // Draw the main fire + Main.EntitySpriteDraw(fire, firePos, null, innerColor, mainRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); + + // Draw the masking smoke + Main.spriteBatch.SetBlendState(BlendState.Additive); + Rectangle frame = mist.Frame(1, 3, 0, MistType); + Main.EntitySpriteDraw(mist, firePos, frame, Color.Lerp(fireColor, Color.White, 0.3f), mainRot, frame.Size() * 0.5f, fireSize, SpriteEffects.None); + Main.EntitySpriteDraw(mist, firePos, frame, fireColor, mainRot, frame.Size() * 0.5f, fireSize * 3f, SpriteEffects.None); + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + } + + return false; + } + } +} diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index b9e79f2352..ad7fa65911 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = DarkEnergy.FrameCount; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = DarkEnergy.FrameCount; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -70,14 +70,14 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; Main.EntitySpriteDraw(ModContent.Request($"{Texture}Glow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 7ad6d26771..17076168fc 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = DarkEnergy.FrameCount; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = DarkEnergy.FrameCount; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -68,14 +68,14 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; Main.EntitySpriteDraw(ModContent.Request($"{Texture}Glow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs index 3fbd229136..07d6295347 100644 --- a/Projectiles/Boss/DarkOrb.cs +++ b/Projectiles/Boss/DarkOrb.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -557,7 +557,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/DesertScourgeDiveSplash.cs b/Projectiles/Boss/DesertScourgeDiveSplash.cs index 39d9946a5f..42f310eac0 100644 --- a/Projectiles/Boss/DesertScourgeDiveSplash.cs +++ b/Projectiles/Boss/DesertScourgeDiveSplash.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 14; + Main.projFrames[Type] = 14; } public override void SetDefaults() @@ -37,13 +37,13 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.Kill(); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } } diff --git a/Projectiles/Boss/DesertScourgeSpit.cs b/Projectiles/Boss/DesertScourgeSpit.cs index 66d6e6d8e8..a7e4915e0e 100644 --- a/Projectiles/Boss/DesertScourgeSpit.cs +++ b/Projectiles/Boss/DesertScourgeSpit.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; Projectile.tileCollide = Projectile.timeLeft < (Projectile.aiStyle == ProjAIStyleID.Arrow ? 540 : 300); @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/DeusRitualDrama.cs b/Projectiles/Boss/DeusRitualDrama.cs index 0ba41b6cb2..8ff63ebb1e 100644 --- a/Projectiles/Boss/DeusRitualDrama.cs +++ b/Projectiles/Boss/DeusRitualDrama.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Boss public void DrawStars(SpriteBatch spriteBatch, Vector2 offset) { - Texture2D starTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D starTexture = Terraria.GameContent.TextureAssets.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 109c0b94bf..6be31c977f 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index 8b54b531b6..dca2e08b29 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 38f7349271..b1ff1dcefa 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.Opacity = 0f; Projectile.penetrate = -1; - Projectile.timeLeft = 600; + Projectile.timeLeft = 480; CooldownSlot = ImmunityCooldownID.Bosses; } diff --git a/Projectiles/Boss/DoGDeathBoom.cs b/Projectiles/Boss/DoGDeathBoom.cs index 8ffe85d908..7cf01dd3ac 100644 --- a/Projectiles/Boss/DoGDeathBoom.cs +++ b/Projectiles/Boss/DoGDeathBoom.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index cf979d61ab..315a98ac61 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/DoGP1EndPortal.cs b/Projectiles/Boss/DoGP1EndPortal.cs index 0a12f1f6e9..cd920619f3 100644 --- a/Projectiles/Boss/DoGP1EndPortal.cs +++ b/Projectiles/Boss/DoGP1EndPortal.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/DoGTeleportRift.cs b/Projectiles/Boss/DoGTeleportRift.cs index a57fd76e88..bf28c53f02 100644 --- a/Projectiles/Boss/DoGTeleportRift.cs +++ b/Projectiles/Boss/DoGTeleportRift.cs @@ -54,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/DoGWingdings.cs b/Projectiles/Boss/DoGWingdings.cs new file mode 100644 index 0000000000..c30a8365fb --- /dev/null +++ b/Projectiles/Boss/DoGWingdings.cs @@ -0,0 +1,159 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DoGWingdings : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public static DynamicSpriteFont Wingdings = null; + + public string dialogue; + + public override void SetStaticDefaults() + { + if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) + { + Wingdings = CalamityMod.Instance.Assets.Request("Fonts/Wingdings", AssetRequestMode.ImmediateLoad).Value; + } + } + + public override void SetDefaults() + { + Projectile.width = 28; + Projectile.height = 28; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 180; + Projectile.scale = 0; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(dialogue); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + dialogue = reader.ReadString(); + } + + public override void AI() + { + // Replicae CombatText behaviour + float targetScale = 1f; + Projectile.Opacity += (float)Projectile.ai[0] * 0.05f; + if ((double)Projectile.Opacity <= 0.6) + { + Projectile.ai[0] = 1; + } + if (Projectile.Opacity >= 1f) + { + Projectile.Opacity = 1f; + Projectile.ai[0] = -1; + } + Projectile.velocity.Y *= 0.8464f; + + Projectile.velocity.X *= 0.93f; + + if (Projectile.timeLeft <= 60) + { + Projectile.scale -= 0.1f * targetScale; + if ((double)Projectile.scale < 0.1) + { + Projectile.active = false; + } + Projectile.timeLeft = 60; + Projectile.ai[0] = -1; + Projectile.scale += 0.07f * targetScale; + return; + } + if (Projectile.velocity.X < 0f) + { + Projectile.rotation += 0.001f; + } + else + { + Projectile.rotation -= 0.001f; + } + if (Projectile.scale < targetScale) + { + Projectile.scale += 0.1f * targetScale; + } + if (Projectile.scale > targetScale) + { + Projectile.scale = targetScale; + } + } + + public override bool PreDraw(ref Color lightColor) + { + // Do not draw if the font isn't loaded or text is Cyrillic or Chinese + if (Wingdings == null || System.Environment.OSVersion.Platform != PlatformID.Win32NT || GameCulture.FromCultureName(GameCulture.CultureName.Chinese).IsActive || GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive) + return false; + // Otherwise identical drawcode to CombatText + Vector2 stringSize = Wingdings.MeasureString(dialogue); + Vector2 origin = new Vector2(stringSize.X * 0.5f, stringSize.Y * 0.5f); + Color cyan = Color.Cyan; + float scale = Projectile.scale; + float red = (int)cyan.R; + float green = (int)cyan.G; + float blue = (int)cyan.B; + float alpha = (int)cyan.A; + red *= scale * Projectile.Opacity * 0.3f; + blue *= scale * Projectile.Opacity * 0.3f; + green *= scale * Projectile.Opacity * 0.3f; + alpha *= scale * Projectile.Opacity; + Color color = new Color((int)red, (int)green, (int)blue, (int)alpha); + for (int l = 0; l < 5; l++) + { + float xOffset = 0f; + float yOffset = 0f; + switch (l) + { + case 0: + xOffset -= 1f; + break; + case 1: + xOffset += 1f; + break; + case 2: + yOffset -= 1f; + break; + case 3: + yOffset += 1f; + break; + default: + red = (float)(int)cyan.R * scale * Projectile.Opacity; + blue = (float)(int)cyan.B * scale * Projectile.Opacity; + green = (float)(int)cyan.G * scale * Projectile.Opacity; + alpha = (float)(int)cyan.A * scale * Projectile.Opacity; + color = new Color((int)red, (int)green, (int)blue, (int)alpha); + break; + } + if (Main.LocalPlayer.gravDir != 1f) + { + float finalYPos = Projectile.position.Y - Main.screenPosition.Y; + finalYPos = (float)Main.screenHeight - finalYPos; + Main.spriteBatch.DrawString(Wingdings, dialogue.ToUpper(), new Vector2(Projectile.position.X - Main.screenPosition.X + xOffset + origin.X, finalYPos + yOffset + origin.Y), color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); + } + else + { + Main.spriteBatch.DrawString(Wingdings, dialogue.ToUpper(), new Vector2(Projectile.position.X - Main.screenPosition.X + xOffset + origin.X, Projectile.position.Y - Main.screenPosition.Y + yOffset + origin.Y), color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); + } + } + return false; + } + } +} diff --git a/Projectiles/Boss/DraedonSummonLaser.cs b/Projectiles/Boss/DraedonSummonLaser.cs index 173b3f3adf..2326b291de 100644 --- a/Projectiles/Boss/DraedonSummonLaser.cs +++ b/Projectiles/Boss/DraedonSummonLaser.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/DyingSun.cs b/Projectiles/Boss/DyingSun.cs index bf24ecdc3e..ebd8996414 100644 --- a/Projectiles/Boss/DyingSun.cs +++ b/Projectiles/Boss/DyingSun.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index b23f856311..bb0f635a76 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -60,13 +60,5 @@ namespace CalamityMod.Projectiles.Boss } Projectile.Damage(); } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 120); - } } } diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index c187276e6b..5341af3da0 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Boss public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index a77545e689..0d9d4a4d21 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); @@ -104,8 +104,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = texture.Height / Main.projFrames[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); return false; @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 82112ea89f..24a4917bfb 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); @@ -112,8 +112,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = texture.Height / Main.projFrames[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); return false; @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index afb50d3182..a2252c2bca 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); @@ -52,8 +52,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = texture.Height / Main.projFrames[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); return false; @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index f3e4b4c37a..e8e1ce6b58 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; + Main.projFrames[Type] = 12; } public override void SetDefaults() @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -146,8 +146,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = texture.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Boss/FoveanatorEnergyBomb.cs b/Projectiles/Boss/FoveanatorEnergyBomb.cs new file mode 100644 index 0000000000..246e80bfb4 --- /dev/null +++ b/Projectiles/Boss/FoveanatorEnergyBomb.cs @@ -0,0 +1,165 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; +using CalamityMod.NPCs; +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.Projectiles.Boss +{ + public class FoveanatorEnergyBomb : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + + private const int TotalXFrames = 2; + private const int TotalYFrames = 8; + private const int ExplodeFrames = 6; + private const int ExplodeDamageStartFrame = 3; + private const int FrameTimer = 6; + + public int frameX = 0; + public int frameY = 0; + + public int CurrentFrame + { + get => frameX * TotalYFrames + frameY; + set + { + frameX = value / TotalYFrames; + frameY = value % TotalYFrames; + } + } + + private const int TimeLeft = 300; + private const int SlowDownTime = TimeLeft / 2; + private const int ExplosionDuration = FrameTimer * ExplodeFrames; + + private const float ExplodeDistance = 50f; + + public override void SetDefaults() + { + Projectile.width = 133; + Projectile.height = 142; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = TimeLeft; + } + + public override void AI() + { + // If moving, decelerate. + if (Projectile.velocity.Length() > 0f && Projectile.timeLeft <= SlowDownTime) + Projectile.velocity *= 0.95f; + + // Get a target and calculate distance from it. + int target = Player.FindClosest(Projectile.Center, 1, 1); + float distanceFromTarget = Projectile.Distance(Main.player[target].Center); + + // Explode when within a certain distance of the target. + if (distanceFromTarget <= ExplodeDistance && Projectile.timeLeft > ExplosionDuration) + Projectile.timeLeft = ExplosionDuration; + + bool explode = Projectile.timeLeft <= ExplosionDuration; + + // Stop immediately if explosion is triggered. + if (explode && Projectile.velocity.Length() > 0f) + Projectile.velocity = Vector2.Zero; + + // Reset the frame counter and frameY when explosion is triggered. + if (Projectile.timeLeft == ExplosionDuration) + { + Projectile.frameCounter = 0; + frameY = 0; + } + + // Explosion noise when actually exploding. + if (frameY == ExplodeDamageStartFrame && explode && Projectile.localAI[0] == 0f) + { + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(DeusMine.ExplodeSound, Projectile.Center); + } + + Projectile.frameCounter++; + if (Projectile.frameCounter % FrameTimer == 0) + { + CurrentFrame++; + + // Non-explosion uses the left side of the sheet, explosion uses the right side of the sheet. + frameX = explode ? 1 : 0; + + // Kill the projectile when the explosion animation is done. + if (explode && frameY >= ExplodeFrames) + { + if (Projectile.ai[0] > 0f) + { + if (Projectile.owner == Main.myPlayer) + { + float laserSpeed = 2f; + int type = ModContent.ProjectileType(); + int damage = (int)Math.Round(Projectile.damage * 0.85); + Vector2 laserVelocity = (Main.player[target].Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 16f, laserVelocity, type, damage, 0f, Main.myPlayer); + + if (Projectile.ai[0] == 2f) + { + Vector2 projectileVelocity = (Main.player[target].Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * laserSpeed * 0.75f; + int numProj = 2; + int spread = 30; + 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(Projectile.GetSource_FromAI(), Projectile.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 16f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + } + + Projectile.Kill(); + + return; + } + } + + // Explosion has brighter light. + Color lightColor = Color.Lerp(new Color(25, 25, 128), new Color(100, 25, 128), Main.DiscoR / 255f); + float divisor = explode ? 128f : 255f; + Lighting.AddLight(Projectile.Center, lightColor.R / divisor, lightColor.G / divisor, lightColor.B / divisor); + } + + public override bool PreDraw(ref Color lightColor) => false; + + public override void PostDraw(Color lightColor) + { + if (Projectile.frameCounter < 5) + return; + + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + + Texture2D texture = TextureAssets.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); + Main.EntitySpriteDraw(texture, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); + } + + public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= ExplosionDuration && frameY >= ExplodeDamageStartFrame; + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplodeDistance, targetHitbox); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (Projectile.timeLeft <= ExplosionDuration) + target.AddBuff(BuffID.Frostburn, 180); + } + } +} diff --git a/Projectiles/Boss/FoveanatorEnergyBomb.png b/Projectiles/Boss/FoveanatorEnergyBomb.png new file mode 100644 index 0000000000..4e2a8120cb Binary files /dev/null and b/Projectiles/Boss/FoveanatorEnergyBomb.png differ diff --git a/Projectiles/Boss/FoveanatorFlamethrower.cs b/Projectiles/Boss/FoveanatorFlamethrower.cs new file mode 100644 index 0000000000..6583bef428 --- /dev/null +++ b/Projectiles/Boss/FoveanatorFlamethrower.cs @@ -0,0 +1,158 @@ +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.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class FoveanatorFlamethrower : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/FireProj"; + + public static int Lifetime => 180; + public static int Fadetime => 160; + public ref float Time => ref Projectile.ai[0]; + public int MistType = -1; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = Lifetime; + CooldownSlot = ImmunityCooldownID.Bosses; + } + + public override void AI() + { + Time++; + if (Time < Fadetime && Main.rand.NextBool(6)) + { + Vector2 cinderPos = Projectile.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(Time, 0f, Lifetime, 0.5f, 1f); + float cinderSize = Utils.GetLerpValue(6f, 12f, Time, true); + Dust cinder = Dust.NewDustDirect(cinderPos, 4, 4, Main.rand.NextBool() ? (int)CalamityDusts.BlueCosmilite : (int)CalamityDusts.PurpleCosmilite, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); + if (Main.rand.NextBool(3)) + { + cinder.scale *= 2f; + cinder.velocity *= 2f; + } + cinder.noGravity = true; + cinder.scale *= cinderSize * 1.2f; + cinder.velocity += Projectile.velocity * Utils.Remap(Time, 0f, Fadetime * 0.75f, 1f, 0.1f) * Utils.Remap(Time, 0f, Fadetime * 0.1f, 0.1f, 1f); + } + + if (MistType == -1) + MistType = Main.rand.Next(3); + + Color lightColor = Color.Lerp(new Color(50, 50, 255), new Color(200, 50, 255), Main.DiscoR / 255f); + Lighting.AddLight(Projectile.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f); + } + + // Keeping the flames in place when hitting a block + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.velocity = oldVelocity * 0.95f; + Projectile.position -= Projectile.velocity; + Time++; + Projectile.timeLeft--; + return false; + } + + // Cannot hit the player if fading out + public override bool CanHitPlayer(Player target) => Time <= Fadetime; + + // Expanding hitbox + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + int size = (int)Utils.Remap(Time, 0f, Fadetime, 8f, 32f); + + // Shrinks again after fading + if (Time > Fadetime) + size = (int)Utils.Remap(Time, Fadetime, Lifetime, 32f, 0f); + + hitbox.Inflate(size, size); + } + + // Anti-wall hacking checks + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projHitbox.Intersects(targetHitbox) && Collision.CanHit(Projectile.Center, 0, 0, targetHitbox.Center.ToVector2(), 0, 0) ? null : false; + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + target.AddBuff(BuffID.Frostburn, 300); + + // Cook you up (still scales with player size in case it's manipulated) + int smokeCount = 4 + (int)MathHelper.Clamp(target.width * 0.1f, 0f, 20f); + for (int i = 0; i < smokeCount; i++) + { + Vector2 smokePos = target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f); + Vector2 smokeVel = Vector2.UnitY * Main.rand.NextFloat(-2.4f, -0.8f) * MathHelper.Clamp(target.height * 0.1f, 1f, 10f); + Particle smoke = new MediumMistParticle(smokePos, smokeVel, Color.Lerp(new Color(50, 50, 255), new Color(200, 50, 255), Main.DiscoR / 255f), Color.DarkMagenta, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; + + // The conga line of colors to sift through + Color color1 = new Color(50, 50, 255, 200); + Color color2 = new Color(50, 0, 225, 70); + Color color3 = new Color(200, 50, 255, 100); + Color color4 = new Color(150, 15, 85, 100); + float length = ((Time > Fadetime - 10f) ? 0.1f : 0.15f); + float vOffset = Math.Min(Time, 20f); + float timeRatio = Utils.GetLerpValue(0f, Lifetime, Time); + float fireSize = Utils.Remap(timeRatio, 0.2f, 0.5f, 0.25f, 1f); + + if (timeRatio >= 1f) + return false; + + for (float j = 1f; j >= 0f; j -= length) + { + // Color + Color fireColor = ((timeRatio < 0.1f) ? Color.Lerp(Color.Transparent, color1, Utils.GetLerpValue(0f, 0.1f, timeRatio)) : + ((timeRatio < 0.2f) ? Color.Lerp(color1, color2, Utils.GetLerpValue(0.1f, 0.2f, timeRatio)) : + ((timeRatio < 0.35f) ? color2 : + ((timeRatio < 0.7f) ? Color.Lerp(color2, color3, Utils.GetLerpValue(0.35f, 0.7f, timeRatio)) : + ((timeRatio < 0.85f) ? Color.Lerp(color3, color4, Utils.GetLerpValue(0.7f, 0.85f, timeRatio)) : + Color.Lerp(color4, Color.Transparent, Utils.GetLerpValue(0.85f, 1f, timeRatio))))))); + fireColor *= (1f - j) * Utils.GetLerpValue(0f, 0.2f, timeRatio, true); + Color innerColor = Color.Lerp(fireColor, Color.Black, 0.3f); + + // Positions and rotations + Vector2 firePos = Projectile.Center - Main.screenPosition - Projectile.velocity * vOffset * j; + float mainRot = -j * MathHelper.PiOver2 - Main.GlobalTimeWrappedHourly * (j + 1f) * 2f / length; + float trailRot = MathHelper.PiOver4 - mainRot; + + // Draw one backtrail + Vector2 trailOffset = Projectile.velocity * vOffset * length * 0.5f; + Main.EntitySpriteDraw(fire, firePos - trailOffset, null, innerColor * 0.25f, trailRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); + + // Draw the main fire + Main.EntitySpriteDraw(fire, firePos, null, innerColor, mainRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); + + // Draw the masking smoke + Main.spriteBatch.SetBlendState(BlendState.Additive); + Rectangle frame = mist.Frame(1, 3, 0, MistType); + Main.EntitySpriteDraw(mist, firePos, frame, Color.Lerp(fireColor, Color.White, 0.3f), mainRot, frame.Size() * 0.5f, fireSize, SpriteEffects.None); + Main.EntitySpriteDraw(mist, firePos, frame, fireColor, mainRot, frame.Size() * 0.5f, fireSize * 3f, SpriteEffects.None); + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + } + + return false; + } + } +} diff --git a/Projectiles/Boss/FoveanatorLaser.cs b/Projectiles/Boss/FoveanatorLaser.cs new file mode 100644 index 0000000000..fc73073e84 --- /dev/null +++ b/Projectiles/Boss/FoveanatorLaser.cs @@ -0,0 +1,101 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.TownNPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class FoveanatorLaser : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + + private const int FadeOutTime = 30; + + private const float Acceleration = 1.05f; + private const float MaxVelocity = 24f; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.Opacity = 0f; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 3) + Projectile.frame = 0; + + if (Projectile.velocity.Length() < MaxVelocity) + { + Projectile.velocity *= Acceleration; + if (Projectile.velocity.Length() > MaxVelocity) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= MaxVelocity; + } + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Color lightColor = Color.Lerp(new Color(25, 25, 128), new Color(100, 25, 128), Main.DiscoR / 255f); + Lighting.AddLight(Projectile.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f); + + if (Projectile.timeLeft < FadeOutTime) + { + Projectile.Opacity -= 1f / FadeOutTime; + } + else if (Projectile.Opacity < 1f) + { + Projectile.Opacity += 0.25f; + if (Projectile.Opacity > 1f) + Projectile.Opacity = 1f; + } + } + + 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[Type], lightColor, 1); + return false; + } + + public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= FadeOutTime; + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (Projectile.timeLeft >= FadeOutTime) + target.AddBuff(BuffID.Frostburn, 90); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + return true; + } + } +} diff --git a/Projectiles/Boss/FoveanatorLaser.png b/Projectiles/Boss/FoveanatorLaser.png new file mode 100644 index 0000000000..543c692773 Binary files /dev/null and b/Projectiles/Boss/FoveanatorLaser.png differ diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 8cddc3dd3d..dc8229123f 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 8; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; if (Projectile.ai[1] == 0f) @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index 9a6e845e2d..b7fa0c573f 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/HealOrbProv.cs b/Projectiles/Boss/HealOrbProv.cs deleted file mode 100644 index 90da5ae250..0000000000 --- a/Projectiles/Boss/HealOrbProv.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class HealOrbProv : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 3; - } - - public override void AI() - { - int playerTracker = (int)Projectile.ai[0]; - 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)); - if (playerDistance < 50f && Projectile.position.X < Main.player[playerTracker].position.X + (float)Main.player[playerTracker].width && Projectile.position.X + (float)Projectile.width > Main.player[playerTracker].position.X && Projectile.position.Y < Main.player[playerTracker].position.Y + (float)Main.player[playerTracker].height && Projectile.position.Y + (float)Projectile.height > Main.player[playerTracker].position.Y) - { - if (Projectile.owner == Main.myPlayer) - { - int healAmount = (int)Projectile.ai[1]; - Main.player[playerTracker].HealEffect(healAmount, false); - Main.player[playerTracker].statLife += healAmount; - if (Main.player[playerTracker].statLife > Main.player[playerTracker].statLifeMax2) - { - Main.player[playerTracker].statLife = Main.player[playerTracker].statLifeMax2; - } - // TODO -- but why - if (Main.player[playerTracker].statLife < 0) - { - Main.player[playerTracker].KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProvidenceAntiHealing").Format(Main.player[playerTracker].name)), 1000.0, 0, false); - } - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, playerTracker, (float)healAmount, 0f, 0f, 0, 0, 0); - } - Projectile.Kill(); - } - playerDistance = 2.5f / playerDistance; - playerDistX *= playerDistance; - playerDistY *= playerDistance; - Projectile.velocity.X = (Projectile.velocity.X * 15f + playerDistX) / 16f; - Projectile.velocity.Y = (Projectile.velocity.Y * 15f + playerDistY) / 16f; - for (int i = 0; i < 1; i++) - { - 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, 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]; - expr_154F9_cp_0.position.X -= shortXVel; - Dust expr_15518_cp_0 = Main.dust[holyFire]; - expr_15518_cp_0.position.Y -= shortYVel; - } - return; - } - } -} diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 202b85a3e9..0f763d7085 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -48,9 +48,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.frameCounter = 0; } if (Projectile.frame > 3) - { Projectile.frame = 0; - } + if (Math.Abs(Projectile.velocity.X) >= 3f || Math.Abs(Projectile.velocity.Y) >= 3f) { float randDustXVel = 0f; @@ -81,21 +80,22 @@ namespace CalamityMod.Projectiles.Boss 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 = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { Projectile.DrawBackglow(PlaguebringerGoliath.BackglowColor, 4f); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/HiveBombGoliathGlow").Value; - Vector2 textureArea = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); + Vector2 textureArea = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Type] / 2); Vector2 drawArea = Projectile.Center - Main.screenPosition; - drawArea -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) / 2f; + drawArea -= new Vector2(glow.Width, glow.Height / Main.projFrames[Type]) / 2f; drawArea += textureArea + new Vector2(0f, Projectile.gfxOffY); Color whiteColor = Color.White; - int height = glow.Height / Main.projFrames[Projectile.type]; + int height = glow.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Main.spriteBatch.Draw(glow, drawArea, new Rectangle(0, drawStart, glow.Width, height), whiteColor, Projectile.rotation, textureArea, Projectile.scale, SpriteEffects.None, 0); @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[plagued2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index 40c4680ee5..3ceab6d0b0 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -1,5 +1,6 @@ using System; -using CalamityMod.World; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -13,7 +14,7 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -30,13 +31,15 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 210; } + public override void AI() => Projectile.Center = Main.npc[CalamityGlobalNPC.holyBoss].Center; + public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 origin = texture.Size() / 2f; float time = Main.GlobalTimeWrappedHourly % 10f / 10f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - int drawnAmt = 30; + int drawnAmt = 45; float[] posX = new float[drawnAmt]; float[] posY = new float[drawnAmt]; float[] hue = new float[drawnAmt]; @@ -49,15 +52,17 @@ namespace CalamityMod.Projectiles.Boss float sizeScalar = (1f - sizeScale) / drawnAmt; float yPosOffset = 60f; float xPosOffset = 400f; - Vector2 scale = new Vector2(6f, 6f); + Vector2 scale = new Vector2(12f, 12f); + + float amount2 = CalamityUtils.SineBumpEasing((float)Projectile.timeLeft / (float)totalTime, 1); for (int i = 0; i < drawnAmt; i++) { float timeScalar = (float)Math.Sin(time * MathHelper.TwoPi + (float)Math.PI / 2f + i / 2f); - posX[i] = timeScalar * (xPosOffset - i * 3f); + posX[i] = timeScalar * (xPosOffset - i * 3f) * amount2; - posY[i] = (float)Math.Sin(time * MathHelper.TwoPi * 2f + (float)Math.PI / 3f + i) * yPosOffset; + posY[i] = (float)Math.Sin(time * MathHelper.TwoPi * 4f + (float)Math.PI / 3f + i) * yPosOffset * 2; posY[i] -= i * 3f; hue[i] = i / (float)drawnAmt * 2f + time; @@ -66,12 +71,14 @@ namespace CalamityMod.Projectiles.Boss size[i] = sizeScale + (i + 1) * sizeScalar; size[i] *= 0.3f; - Color color = Main.hslToRgb(hue[i] % 1f, 1f, 0.5f) * colorChangeAmt * colorChangeAmt2; + float a = (float)Math.Sin(amount2 / 20) + 1; + + Color color = Color.Lerp(ProvUtils.GetProjectileColor(0, true), ProvUtils.GetProjectileColor(0, false), a); bool underworld = Projectile.ai[0] == 2f; if (!Main.zenithWorld) { - if (Main.IsItDay()) + if (ProvUtils.StandardAI()) { color.R = 255; if (underworld) @@ -79,21 +86,18 @@ namespace CalamityMod.Projectiles.Boss } else { - color.B = 255; + byte blueValue = (byte)(MathHelper.Clamp(MathHelper.Lerp(0, 255, Main.npc[CalamityGlobalNPC.holyBoss].Calamity().newAI[3] / 120f), 0, 255)); + if (blueValue > 255) blueValue = 255; + color.B = blueValue; if (underworld) - color.G = 0; + color.G = (byte)(255 - blueValue); else - color.R = 0; + color.R = (byte)(255 - blueValue); } } - color.A /= 4; - - int fadeTime = 30; - if (Projectile.timeLeft < fadeTime) + color.A = 0; { - float amount2 = Projectile.timeLeft / (float)fadeTime; - if (color.R > 0) color.R = (byte)MathHelper.Lerp(0, color.R, amount2); if (color.G > 0) @@ -104,7 +108,7 @@ namespace CalamityMod.Projectiles.Boss color.A = (byte)MathHelper.Lerp(0, color.A, amount2); } - float rotation = MathHelper.PiOver2 + timeScalar * MathHelper.PiOver4 * -0.3f + (float)Math.PI * i; + float rotation = MathHelper.PiOver2 + timeScalar * MathHelper.PiOver4 * -0.3f; Main.EntitySpriteDraw(texture, drawPosition + new Vector2(posX[i], posY[i]), null, color, rotation, origin, new Vector2(size[i], size[i]) * scale, SpriteEffects.None, 0); } diff --git a/Projectiles/Boss/HolyAura.png b/Projectiles/Boss/HolyAura.png index bec16a6412..549ed95c1d 100644 Binary files a/Projectiles/Boss/HolyAura.png and b/Projectiles/Boss/HolyAura.png differ diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index d6e09c41fd..4b2b1d3666 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -1,12 +1,19 @@ using System; +using System.Collections.Generic; using System.IO; +using System.Linq; +using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -14,13 +21,23 @@ namespace CalamityMod.Projectiles.Boss { public class HolyBlast : ModProjectile, ILocalizedModType { + public bool started = false; + + private const int TimeLeft = 120; + private const int AccelerationTime = 60; + private const float Acceleration = 1.05f; + public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + } + + public override void OnSpawn(IEntitySource source) + { } public override void SetDefaults() @@ -31,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.timeLeft = TimeLeft; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -47,30 +64,16 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 320, 20); + Lighting.AddLight(Projectile.Center, 0.9f, 0.7f, 0f); + if (Projectile.timeLeft > TimeLeft - AccelerationTime && Projectile.ai[2] == 0f) + Projectile.velocity *= Acceleration; + if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) Projectile.tileCollide = true; - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -80,9 +83,19 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; + if (!started) + { + for (int i = 0; i < 13; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-30f, 30f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(3f, 6f), ProvUtils.GetProjectileColor(255, false))); + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-50f, 50f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(2f, 5f), ProvUtils.GetProjectileColor(255, false))); + } + started = true; + } + if (Projectile.localAI[0] == 0f) { - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); for (int i = 0; i < 10; i++) { int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); @@ -101,32 +114,50 @@ namespace CalamityMod.Projectiles.Boss if (Math.Abs(Projectile.velocity.X) > 0.2) Projectile.spriteDirection = -Projectile.direction; + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(50), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, false, 20, Main.rand.NextFloat(1f, 2f), ProvUtils.GetProjectileColor(255))); + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center + new Vector2(40, 0).RotatedBy(Vector2.Zero.AngleTo(-Projectile.velocity)) + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(1f, 3f), 150f)); + if (Projectile.velocity.X < 0f) Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); else Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } - public override Color? GetAlpha(Color lightColor) - { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(lightColor); public override bool PreDraw(ref Color lightColor) { - 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]; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + int framing = texture.Height / Main.projFrames[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); + Vector2 sc = Vector2.One; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, sc, 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), sc, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 30; i++) + { + Particle p = new FlameParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(0.5f, 0.75f), Main.rand.NextFloat(1f, 2.5f), hiColor, loColor); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor, 60, Main.rand.NextFloat(0.75f, 1.75f), 1f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.1f, 15)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.25f, 35)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.175f, 25)); + if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 8 : 6; + int totalProjectiles = !ProvUtils.StandardAI() ? 8 : 6; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) totalProjectiles *= 2; @@ -134,16 +165,19 @@ namespace CalamityMod.Projectiles.Boss int type = ModContent.ProjectileType(); float velocity = 5f; Vector2 spinningPoint = new Vector2(0f, -velocity); + Vector2 additionalVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2.5f; for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2 + Projectile.velocity * 0.25f, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2 + additionalVelocity, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); } } SoundEngine.PlaySound(ImpactSound, Projectile.Center); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.Center); + + int dustType = ProvUtils.GetDustID(); for (int j = 0; j < 4; j++) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); @@ -160,20 +194,13 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 320, 20); + ProvUtils.ApplyDebuffs(target, 320); } } } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 15ff7a1b48..cb0933c919 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -14,10 +15,12 @@ namespace CalamityMod.Projectiles.Boss { public class HolyBomb : ModProjectile, ILocalizedModType { + float SquishAnimation = 1f; + public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -34,53 +37,29 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 160, 20); + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); - /* - * Day mode by default but syncs with the boss - * Uses maxPenetrate because it's kinda pointless for a boss projectile - * and it's convenient to copypaste without having to do adjustments - * If someone really feels like making a proper int for this purpose they can do it themselves - Iris - */ - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + SquishAnimation += 0.06f; + SquishAnimation = MathHelper.Clamp(SquishAnimation, 0f, 1f); Projectile.ai[0] += 1f; if (Projectile.ai[0] % 120f == 0f) { SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + + for (int i = 0; i < 10; i++) + { + Vector2 center = Projectile.Center + new Vector2(0, -15); + + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(center, new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-4f, 2f)), false, 30, Main.rand.NextFloat(1f, 2.5f), ProvUtils.GetProjectileColor(255))); + } + float velocityY = -2f; - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 2; i++) - { - 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(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(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); - Main.dust[holyDust].velocity *= 1.5f; - Main.dust[holyDust].noGravity = true; - } + + SquishAnimation = 0f; if (Projectile.owner == Main.myPlayer) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, velocityY, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); @@ -106,59 +85,51 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { - 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]; + float squish = CalamityUtils.SineBumpEasing(SquishAnimation, 1) * 0.25f; + + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; + int framing = texture.Height / Main.projFrames[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); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, new Vector2(Projectile.scale + squish, Projectile.scale - squish), texture, offset: new Vector2(0, (-22 * (1 - squish)))); + 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) + 22), new Vector2(Projectile.scale + squish, Projectile.scale - squish), SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, 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; - Projectile.height = 100; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 2; i++) - { - 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(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(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[holyDust].velocity *= 2f; - Main.dust[holyDust].noGravity = true; - } - } + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1f; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.Item20.WithPitchOffset(-0.8f), Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 160, 20); + ProvUtils.ApplyDebuffs(target, 160); } } } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index b7bdb2c51b..64c20b7f63 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,13 +1,16 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,11 +18,13 @@ namespace CalamityMod.Projectiles.Boss { public class HolyBurnOrb : ModProjectile, ILocalizedModType { + bool started = false; public new string LocalizationCategory => "Projectiles.Boss"; public override string Texture => "CalamityMod/Projectiles/StarProj"; public override void SetDefaults() { + Projectile.localAI[1] = Main.rand.NextFloat(30f); Projectile.width = Projectile.height = 30; Projectile.hostile = true; Projectile.ignoreWater = true; @@ -33,30 +38,20 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 120, 50); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); if (Projectile.ai[0] == 0f && BossRushEvent.BossRushActive) Projectile.velocity *= 1.25f; + if (!started) + { + Color cl = ProvUtils.GetProjectileColor(255); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, cl, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(4f, 7f), 1.5f), Vector2.Zero.AngleTo(Projectile.velocity), 1f, 0f, 30)); + started = true; + } + if (Projectile.ai[0] < 240f) { Projectile.ai[0] += 1f; @@ -79,21 +74,26 @@ namespace CalamityMod.Projectiles.Boss } else if (Projectile.velocity.Length() < 16f) Projectile.velocity *= 1.01f; + + Projectile.localAI[1] += (Projectile.velocity.Length() / 20); + + Color col = ProvUtils.GetProjectileColor(255); + float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f); + GlowOrbParticle p = new GlowOrbParticle(Projectile.Center, Projectile.velocity + new Vector2(Main.rand.NextFloat(vel * 2), 0).RotatedByRandom(MathHelper.TwoPi), false, 4, 1f, col); + GeneralParticleHandler.SpawnParticle(p); } public override bool PreDraw(ref Color lightColor) { - 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255); - baseColor *= 0.5f; + Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4; + Color baseColor2 = ProvUtils.GetProjectileColor(255); baseColor.A = 0; - Color colorA = baseColor; - Color colorB = baseColor * 0.5f; - colorA *= lerpMult; - colorB *= lerpMult; + baseColor *= lerpMult; + baseColor2 *= lerpMult; Vector2 origin = texture.Size() / 2f; Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult; @@ -101,18 +101,20 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; + Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f); + float upRight = MathHelper.PiOver4; float up = MathHelper.PiOver2; float upLeft = 3f * MathHelper.PiOver4; float left = MathHelper.Pi; - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upLeft, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upRight, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); return false; } @@ -120,46 +122,34 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.ExpandHitboxBy(50); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int d = 0; d < 5; d++) + Color particleColor = ProvUtils.GetProjectileColor(0); + Color smokeColor = Color.Lerp(particleColor, Color.DarkSlateGray, 0.5f); + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.06f, 18); + GeneralParticleHandler.SpawnParticle(pulse); + for (int i = 0; i < 7; i++) { - int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holy].velocity *= 3f; - Main.dust[holy].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[holy].scale = 0.5f; - Main.dust[holy].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Particle smoke = new HeavySmokeParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(7f), smokeColor, 30, Main.rand.NextFloat(0.6f, 1f), 0.5f, Main.rand.NextFloat(-0.03f, 0.03f), true); + GeneralParticleHandler.SpawnParticle(smoke); } - for (int d = 0; d < 8; d++) + for (int i = 0; i < 8; i++) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - Main.dust[fire].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.8f, 10f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1f, 1.8f); + dust.color = particleColor; + dust.noLightEmittence = true; } } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - - Projectile.Kill(); - } + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => Projectile.Kill(); public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 50); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/HolyExplosionBoom.cs b/Projectiles/Boss/HolyExplosionBoom.cs index a543577f17..0a1fde0f20 100644 --- a/Projectiles/Boss/HolyExplosionBoom.cs +++ b/Projectiles/Boss/HolyExplosionBoom.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 0a19097430..3385962d35 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,9 +15,10 @@ namespace CalamityMod.Projectiles.Boss public class HolyFire : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -34,26 +36,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 80, 20); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); if (Projectile.ai[1] == 0f) { @@ -61,7 +46,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - Projectile.alpha -= (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 10 : 5; + Projectile.alpha -= !ProvUtils.StandardAI() ? 10 : 5; if (Projectile.alpha <= 0) Projectile.Kill(); @@ -75,23 +60,34 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame = 0; } - public override Color? GetAlpha(Color lightColor) - { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(lightColor); public override bool PreDraw(ref Color lightColor) { - 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]; + Projectile.scale = 1.5f; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; + int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, new Vector2(Projectile.scale)); 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); return false; } public override void OnKill(int timeLeft) { + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 25; i++) + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.125f * i, 8)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 5)); + if (Main.rand.NextBool()) { if (Projectile.owner == Main.myPlayer) @@ -100,12 +96,12 @@ namespace CalamityMod.Projectiles.Boss if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= Main.rand.NextFloat(1f, 2f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= Main.rand.NextFloat(1f, 2f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); } } else @@ -116,55 +112,26 @@ namespace CalamityMod.Projectiles.Boss if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= Main.rand.NextFloat(1f, 2f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= Main.rand.NextFloat(1f, 2f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); } } - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 40; - Projectile.height = 40; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 5; i++) - { - 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()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 10; j++) - { - int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust2].noGravity = true; - } - } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 80, 20); + ProvUtils.ApplyDebuffs(target, 80); } } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 8e8c50642e..3c191e8a20 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -1,7 +1,9 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,9 +17,10 @@ namespace CalamityMod.Projectiles.Boss public class HolyFire2 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -34,26 +37,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 80, 10); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); Projectile.frameCounter++; if (Projectile.frameCounter > 6) @@ -64,12 +50,14 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Math.Abs(Projectile.velocity.X) < 7f) + float maxVelocity = Projectile.ai[0] == 0f ? 7f : (Main.masterMode || BossRushEvent.BossRushActive) ? 13f : CalamityWorld.death ? 11f : CalamityWorld.revenge ? 10f : Main.expertMode ? 9f : 7f; + if (Math.Abs(Projectile.velocity.X) < maxVelocity) Projectile.velocity.X *= 1.05f; int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); - if (Projectile.ai[1] == 0f) + // Natural damage is removed from GFB + if (Projectile.ai[1] == 0f && !Main.zenithWorld) Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); Projectile.ai[1] += 1f; @@ -79,26 +67,30 @@ namespace CalamityMod.Projectiles.Boss Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; playerDirection.Normalize(); playerDirection *= projVelocityMult; - float inertia = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 20f : 25f; + float inertia = !ProvUtils.StandardAI() ? 20f : 25f; Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia; Projectile.velocity.Normalize(); Projectile.velocity *= projVelocityMult; } - Projectile.rotation = Projectile.velocity.X * 0.025f; + float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); + + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); + + if (Main.rand.NextBool()) + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f)))); + + Projectile.rotation = MathHelper.Lerp(0f, MathHelper.WrapAngle(Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.ToRadians(-90f)), Math.Clamp(vel, 0f, 1f)); } - public override Color? GetAlpha(Color lightColor) - { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(lightColor); public override bool PreDraw(ref Color lightColor) { - 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]; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, 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); return false; } @@ -112,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 40; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); for (int i = 0; i < 5; i++) { int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); @@ -132,20 +124,13 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 80, 10); + ProvUtils.ApplyDebuffs(target, 80); } } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 1208b849ad..d07046f83a 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -34,26 +36,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.35f, 0.275f, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 120, 20); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.35f, 0.275f, 0f); Player player = Main.player[Projectile.owner]; @@ -71,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Y > velocityYCap) Projectile.velocity.Y = velocityYCap; - float velocityX = Projectile.maxPenetrate != (int)Providence.BossMode.Day ? 0.025f : 0.02f; + float velocityX = !ProvUtils.StandardAI() ? 0.025f : 0.02f; if (Projectile.position.X + Projectile.width < player.position.X) { if (Projectile.velocity.X < 0f) @@ -85,71 +70,66 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.X -= velocityX; } - float velocityXCap = Projectile.maxPenetrate != (int)Providence.BossMode.Day ? 10f : 8f; + float velocityXCap = !ProvUtils.StandardAI() ? 10f : 8f; if (Projectile.velocity.X > velocityXCap || Projectile.velocity.X < -velocityXCap) Projectile.velocity.X *= 0.97f; - Projectile.rotation = Projectile.velocity.X * 0.025f; + float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); + + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.5f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); + + if (Main.rand.NextBool()) + { + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f)))); + } + + Projectile.rotation = MathHelper.Lerp(0f, MathHelper.WrapAngle(Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.ToRadians(-90f)), Math.Clamp(vel, 0f, 1f)); } public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { - 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]; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; + int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, 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); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 30; - Projectile.height = 60; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 5; i++) - { - 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()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 10; j++) - { - int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust2].noGravity = true; - } - } + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 20); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 19fb29c30b..0d986b7f27 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -1,8 +1,13 @@ using System; +using CalamityMod.Dusts; +using CalamityMod.Enums; +using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +20,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { + Projectile.localAI[1] = Main.rand.NextFloat(30f); Projectile.width = 20; Projectile.height = 20; Projectile.hostile = true; @@ -25,6 +31,19 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 200; } + public override void OnSpawn(IEntitySource source) + { + if (Projectile.ai[2] == 0) + { + SoundStyle soundStyle = SoundID.DD2_WitherBeastCrystalImpact; + soundStyle.MaxInstances = 10; + SoundEngine.PlaySound(soundStyle, Projectile.Center); + + Color col = new Color(54, 209, 54); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, col, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(4f, 7f), 1.5f), Vector2.Zero.AngleTo(Projectile.velocity), 1f, 0f, 30)); + } + } + public override void AI() { Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); @@ -49,25 +68,28 @@ namespace CalamityMod.Projectiles.Boss if (!player.immune && playerDist < 50f && !player.dead && 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 = (int)Projectile.ai[1]; - player.HealEffect(healAmt, false); - player.statLife += healAmt; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } + player.HealPlayer(healAmt, HealTextType.Local); NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt); Projectile.Kill(); } + + Color col = new Color(54, 209, 54); + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.8f, false, 5, 0.06f, col * 0.85f, new Vector2(1, 0.3f), true, false, 1.5f); + GeneralParticleHandler.SpawnParticle(spark); } public override bool PreDraw(ref Color lightColor) { - Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + float vel = Projectile.velocity.Length() / 8; + Projectile.localAI[1] += vel; + + Texture2D drawTexture = Terraria.GameContent.TextureAssets.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; Color halfBrightGreen = brightGreen * 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; + float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); + Projectile.rotation += MathHelper.ToRadians(timeLeftColorScale * 2f); Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale; Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; brightGreen *= timeLeftColorScale; @@ -79,47 +101,40 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, (float)Math.PI / 2f, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, (float)Math.PI / 2f, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 * 3f, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 * 3f, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 40; - Projectile.height = 40; - 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++) + SoundEngine.PlaySound(SoundID.Item14 with { Pitch = -0.3f, Volume = 0.7f }, Projectile.Center); + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); + SoundEngine.PlaySound(fireHeal with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center); + Color particleColor = new Color(54, 209, 54); + Color smokeColor = Color.Lerp(particleColor, Color.DarkSlateGray, 0.5f); + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.06f, 18); + GeneralParticleHandler.SpawnParticle(pulse); + for (int i = 0; i < 7; i++) { - 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()) - { - Main.dust[holyYellow].scale = 0.5f; - Main.dust[holyYellow].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Particle smoke = new HeavySmokeParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(7f), smokeColor, 30, Main.rand.NextFloat(0.6f, 1f), 0.5f, Main.rand.NextFloat(-0.03f, 0.03f), true); + GeneralParticleHandler.SpawnParticle(smoke); } - for (int j = 0; j < 8; j++) + for (int i = 0; i < 8; i++) { - 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(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[holyYellow2].velocity *= 2f; - Main.dust[holyYellow2].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.8f, 10f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1f, 1.8f); + dust.color = particleColor; + dust.noLightEmittence = true; } } } diff --git a/Projectiles/Boss/HolyProfanedCore.cs b/Projectiles/Boss/HolyProfanedCore.cs new file mode 100644 index 0000000000..db3c46a704 --- /dev/null +++ b/Projectiles/Boss/HolyProfanedCore.cs @@ -0,0 +1,91 @@ +using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HolyProfanedCore : ModProjectile, ILocalizedModType + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(ModContent.ItemType()); + public override string Texture => "CalamityMod/Items/SummonItems/ProfanedCore"; + + public const int Lifetime = 180; + public const int ShakeThreshold = 90; + public ref float Timer => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + } + + public override void AI() + { + var Prov = CalamityGlobalNPC.holyBoss; + // Abort if Provi does not exist + if (Prov == -1) + { + Projectile.active = false; + return; + } + + Timer++; + + // First, briefly flies up + // Then, moves towards the position of Provi's core on her sprite, speed scales based on distance to make it smooth + if (Timer <= 30) + { + Projectile.velocity.Y = -4.5f; + } + else if (Timer > 30 && Timer <= Lifetime) + { + Projectile.velocity = Vector2.Zero; + Vector2 proviCoreLocation = Main.npc[Prov].Center + new Vector2(0f, 40f); + Projectile.Center += (proviCoreLocation - Projectile.Center) * 0.0375f; + + // Awesome particle effects or something + if (Timer > ShakeThreshold) + { + Color flameColor = new Color(255, 223, 112), crystalColor = new Color(190, 141, 184); + + float starScale = MathHelper.Lerp(0f, 6f, (Timer - ShakeThreshold) / (Lifetime - ShakeThreshold)); + CustomSpark attacka = new(proviCoreLocation, Vector2.Zero, "CalamityMod/Particles/FullStar", false, 2, starScale, flameColor, Vector2.One, extraRotation: MathHelper.PiOver4); + GeneralParticleHandler.SpawnParticle(attacka); + CustomSpark attacka2 = new(proviCoreLocation, Vector2.Zero, "CalamityMod/Particles/FullStar", false, 2, starScale * 0.4f, flameColor, Vector2.One); + GeneralParticleHandler.SpawnParticle(attacka2); + + if (Timer % 2 == 0) + { + CustomSpark crystal = new(proviCoreLocation + Main.rand.NextVector2Circular(300, 300), -Vector2.UnitY * 2f, "CalamityMod/Particles/ProvidenceMarkParticle", false, 15, 2f, crystalColor, Vector2.One, fadeIn: true); + GeneralParticleHandler.SpawnParticle(crystal); + } + else + { + Vector2 spawnLocation = proviCoreLocation + Main.rand.NextVector2Circular(250, 250); + CustomSprite rockConverge = new(spawnLocation, (proviCoreLocation - spawnLocation) * 0.08f, 15, "CalamityMod/NPCs/ProfanedGuardians/ProfanedRocks" + Main.rand.Next(1, 6 + 1), 0.3f, Color.White, 0f, false); + rockConverge.Rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(rockConverge); + } + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + float shakeAmt = MathHelper.Clamp(MathHelper.Lerp(0f, 8f, (Timer - ShakeThreshold) / (Lifetime - ShakeThreshold)), 0f, 8f); + Vector2 drawPos = Projectile.Center + Main.rand.NextVector2CircularEdge(shakeAmt, shakeAmt); + + Projectile.DrawProjectileWithBackglow(new Color(255, 255, 25), lightColor, 3.5f, xPos: drawPos.X, yPos: drawPos.Y); + return false; + } + } +} diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 697dfa6c2a..00a92cabf5 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,12 +17,13 @@ namespace CalamityMod.Projectiles.Boss public class HolySpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + Vector2 velocity = Vector2.Zero; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -53,26 +55,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.45f * Projectile.Opacity, 0.35f * Projectile.Opacity, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 120, 20); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.45f * Projectile.Opacity, 0.35f * Projectile.Opacity, 0f); if (Projectile.localAI[0] == 0f) { @@ -84,14 +69,14 @@ namespace CalamityMod.Projectiles.Boss bool commanderSpear = Projectile.ai[0] == -1f; bool enragedCommanderSpear = Projectile.ai[0] == -2f; - float timeGateValue = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 420f : ((commanderSpear || enragedCommanderSpear) ? 360f : 540f); + float timeGateValue = !ProvUtils.StandardAI() ? 420f : ((commanderSpear || enragedCommanderSpear) ? 360f : 540f); if (Projectile.ai[0] <= 0f) { Projectile.ai[1] += 1f; - float slowGateValue = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 60f : ((commanderSpear || enragedCommanderSpear) ? 30f : 90f); + float slowGateValue = !ProvUtils.StandardAI() ? 60f : ((commanderSpear || enragedCommanderSpear) ? 30f : 90f); float fastGateValue = 30f; - float minVelocity = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 4f : (enragedCommanderSpear ? 6f : commanderSpear ? 4.5f : 3f); + float minVelocity = !ProvUtils.StandardAI() ? 4f : (enragedCommanderSpear ? 6f : commanderSpear ? 4.5f : 3f); float maxVelocity = minVelocity * 4f; float extremeVelocity = maxVelocity * 2f; float deceleration = 0.95f; @@ -120,8 +105,8 @@ namespace CalamityMod.Projectiles.Boss } else { - float frequency = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 0.2f : 0.1f; - float amplitude = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 4f : 2f; + float frequency = !ProvUtils.StandardAI() ? 0.2f : 0.1f; + float amplitude = !ProvUtils.StandardAI() ? 4f : 2f; Projectile.ai[1] += frequency; @@ -141,106 +126,105 @@ namespace CalamityMod.Projectiles.Boss Projectile.Opacity = MathHelper.Lerp(240f, 220f, Projectile.timeLeft); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + bool aimedSpear = Projectile.ai[0] > 0f; + + Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to standard yellow + + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + baseColor = new Color(aimedSpear ? 125 : 255, aimedSpear ? 0 : 255, 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + baseColor = new Color(0, 255, aimedSpear ? 0 : 175); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + baseColor = new Color(255, 125, aimedSpear ? 0 : 175); + else // Red + baseColor = new Color(255, aimedSpear ? 0 : 125, aimedSpear ? 0 : 255); + } + else if (!ProvUtils.StandardAI()) + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity, false, 15, Main.rand.NextFloat(0.5f, 1.5f) * MathHelper.Clamp(Projectile.velocity.Length() / 15, 0f, 2f), aimedSpear ? baseColor : ProvUtils.GetProjectileColor(255, false))); } public override bool PreDraw(ref Color lightColor) { - Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; bool aimedSpear = Projectile.ai[0] > 0f; - int red = 255; - int green = 255; - int blue = 0; - switch (Projectile.maxPenetrate) - { - case (int)Providence.BossMode.Red: - red = 255; - green = aimedSpear ? 0 : 125; - blue = aimedSpear ? 0 : 255; - break; - case (int)Providence.BossMode.Orange: - red = 255; - green = 125; - blue = aimedSpear ? 0 : 175; - break; - case (int)Providence.BossMode.Yellow: //Same as day - case (int)Providence.BossMode.Day: - red = 255; - green = aimedSpear ? 255 : 125; - blue = aimedSpear ? 0 : 125; - break; - case (int)Providence.BossMode.Green: - red = 0; - green = 255; - blue = aimedSpear ? 0 : 175; - break; - case (int)Providence.BossMode.Blue: //Same as night - case (int)Providence.BossMode.Night: - red = aimedSpear ? 100 : 175; - green = aimedSpear ? 255 : 175; - blue = 255; - break; - case (int)Providence.BossMode.Violet: - red = aimedSpear ? 125 : 255; - green = aimedSpear ? 0 : 255; - blue = 125; - break; - default: - break; - } - Color baseColor = new Color(red, green, blue, 0); + Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to standard yellow + Color baseColor2 = new Color(15, 35, 50, 0); - Color baseColor2 = baseColor; - Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + baseColor = new Color(aimedSpear ? 125 : 255, aimedSpear ? 0 : 255, 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + baseColor = new Color(0, 255, aimedSpear ? 0 : 175); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + baseColor = new Color(255, 125, aimedSpear ? 0 : 175); + else // Red + baseColor = new Color(255, aimedSpear ? 0 : 125, aimedSpear ? 0 : 255); + } + else if (!ProvUtils.StandardAI()) + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + + if (!aimedSpear) + { + baseColor = ProvUtils.GetProjectileColor(0); + baseColor2 = ProvUtils.GetProjectileColor(0, true); + } + + Vector2 projDirection = Main.screenPosition - new Vector2(0f, Projectile.gfxOffY); Vector2 halfTextureSize = drawTexture.Size() / 2f; 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; - baseColor2 *= timeLeftColorScale; - halfOfHalfBaseColor *= timeLeftColorScale; + + float squish = MathHelper.Clamp(Projectile.velocity.Length() / 20, -0.3f, 0.3f); + + Vector2 sc = new Vector2(1 - squish, 1 + squish); SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = Projectile.oldPos[i] + projDirection; - 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); - - baseColorAlpha = Projectile.GetAlpha(halfOfHalfBaseColor) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, SpriteEffects.None, 0); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(drawTexture, Projectile.oldPos[i] - projDirection + (Projectile.Size / 2), null, Color.Lerp(baseColor, baseColor2, MathHelper.Lerp((float)i / (float)Projectile.oldPos.Length, 1f, 0.5f)), Projectile.rotation, halfTextureSize, sc * MathHelper.Lerp(1, 0, (float)((float)i / Projectile.oldPos.Length)), 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); + for (float i = 0; i < 360; i += 90) + { + Main.EntitySpriteDraw(drawTexture, Projectile.Center + new Vector2(4, 0).RotatedBy(MathHelper.ToRadians(i)) - projDirection, null, Color.Lerp(baseColor, baseColor2, 0.75f), Projectile.rotation, halfTextureSize, sc, spriteEffects, 0); + } + + Main.EntitySpriteDraw(drawTexture, Projectile.Center - projDirection, null, baseColor, Projectile.rotation, halfTextureSize, sc, spriteEffects, 0); return false; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 20); + ProvUtils.ApplyDebuffs(target, 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return ProvUtils.GetProjectileColor(0, false); } } } diff --git a/Projectiles/Boss/HomingGasBulb.cs b/Projectiles/Boss/HomingGasBulb.cs index 790a2bcb87..2c080802a1 100644 --- a/Projectiles/Boss/HomingGasBulb.cs +++ b/Projectiles/Boss/HomingGasBulb.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } diff --git a/Projectiles/Boss/HomingGasBulbSporeGas.cs b/Projectiles/Boss/HomingGasBulbSporeGas.cs index bbe7f1e2c8..d467e3eeb4 100644 --- a/Projectiles/Boss/HomingGasBulbSporeGas.cs +++ b/Projectiles/Boss/HomingGasBulbSporeGas.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { // Changes the texture of the projectile - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; switch ((int)Projectile.ai[0]) { case 0: @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Boss default: break; } - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, texture); return false; } diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/HomingLaserDart.cs similarity index 96% rename from Projectiles/Boss/ScavengerLaser.cs rename to Projectiles/Boss/HomingLaserDart.cs index 418907350e..dc93ed2c2b 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/HomingLaserDart.cs @@ -9,15 +9,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class ScavengerLaser : ModProjectile, ILocalizedModType + public class HomingLaserDart : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 5; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -205,7 +205,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/ScavengerLaser.png b/Projectiles/Boss/HomingLaserDart.png similarity index 100% rename from Projectiles/Boss/ScavengerLaser.png rename to Projectiles/Boss/HomingLaserDart.png diff --git a/Projectiles/Boss/IchorBlob.cs b/Projectiles/Boss/IchorBlob.cs index 8f266377bd..479fb920eb 100644 --- a/Projectiles/Boss/IchorBlob.cs +++ b/Projectiles/Boss/IchorBlob.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -185,7 +185,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index 0f7d9381e2..f1e2338a03 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 0e50df4913..691c909e79 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; + Main.projFrames[Type] = 12; } public override void SetDefaults() @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -148,8 +148,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 74b3d2dcec..c73d5dc424 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; + Main.projFrames[Type] = 12; } public override void SetDefaults() @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -142,8 +142,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 bfc028fc5b..d193737273 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss public const int TornadoHeight = 8800; public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -89,19 +89,21 @@ namespace CalamityMod.Projectiles.Boss PrimitiveRenderer.RenderTrail(drawPoints, new((_) => Projectile.width * 0.5f + 16f, ColorFunction, shader: GameShaders.Misc["CalamityMod:Bordernado"]), 85); Main.spriteBatch.ExitShaderRegion(); - - Texture2D vortexTexture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeVortex").Value; - for (int i = 0; i < 110; i++) + Main.spriteBatch.EnterShaderRegion(); + Texture2D vortexNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Cracks").Value; + GameShaders.Misc["CalamityMod:DoGPortal"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:DoGPortal"].UseColor(Color.Gold); + GameShaders.Misc["CalamityMod:DoGPortal"].UseSecondaryColor(Color.White); + GameShaders.Misc["CalamityMod:DoGPortal"].Apply(); + for (int i = 0; i < 5; i++) { - float angle = MathHelper.TwoPi * i / 50f + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; - Color drawColor = Color.White * 0.04f; + float angle = MathHelper.TwoPi * i / 5f + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; + Color drawColor = Color.White; drawColor.A = 0; - Vector2 drawPosition = bottom + angle.ToRotationVector2() * 4f - Main.screenPosition; - - drawPosition += (angle + Main.GlobalTimeWrappedHourly * i / 16f).ToRotationVector2() * 6f; - Main.EntitySpriteDraw(vortexTexture, drawPosition, null, drawColor, angle + MathHelper.PiOver2, vortexTexture.Size() * 0.5f, 0.9f, SpriteEffects.None, 0); + Vector2 drawPosition = Projectile.Bottom - Main.screenPosition + angle.ToRotationVector2() * 3f; + Main.EntitySpriteDraw(vortexNoise, drawPosition, null, drawColor, angle + MathHelper.PiOver2, vortexNoise.Size() * 0.5f, Projectile.scale * 1.5f, SpriteEffects.None, 0); } - + Main.spriteBatch.ExitShaderRegion(); return false; } diff --git a/Projectiles/Boss/JewelProjectile.cs b/Projectiles/Boss/JewelProjectile.cs index 39e6688a01..d9bbbe769f 100644 --- a/Projectiles/Boss/JewelProjectile.cs +++ b/Projectiles/Boss/JewelProjectile.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index ff64d08ed9..f995b4634f 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/LeviathanSpawner.cs b/Projectiles/Boss/LeviathanSpawner.cs index 13873a7d62..1826c1ba3e 100644 --- a/Projectiles/Boss/LeviathanSpawner.cs +++ b/Projectiles/Boss/LeviathanSpawner.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Boss public static readonly SoundStyle RumbleSound = new("CalamityMod/Sounds/Custom/LeviathanRumble"); public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.timeLeft == 45) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData ripple = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); Vector2 ripplePos = Projectile.Center; @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss public void CreateVisuals() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; WorldUtils.Find((Projectile.Center - Vector2.UnitY * 1200f).ToTileCoordinates(), Searches.Chain(new Searches.Down(150), new CustomConditions.IsWater()), out Point waterTop); diff --git a/Projectiles/Boss/MajesticSparkle.cs b/Projectiles/Boss/MajesticSparkle.cs index aab013ceda..c956aaf35b 100644 --- a/Projectiles/Boss/MajesticSparkle.cs +++ b/Projectiles/Boss/MajesticSparkle.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Boss } public override bool PreDraw(ref Color lightColor) { - Texture2D sparkleTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D sparkleTexture = Terraria.GameContent.TextureAssets.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; diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 18ee564f3b..457affed38 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,10 +16,15 @@ namespace CalamityMod.Projectiles.Boss { public class MoltenBlast : ModProjectile, ILocalizedModType { + private const int TimeLeft = 90; + private const int AccelerationTime = 60; + private const float Acceleration = 1.05f; + public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -29,7 +35,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 90; + Projectile.timeLeft = TimeLeft; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -47,30 +53,16 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 160, 20); + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + if (Projectile.timeLeft > TimeLeft - AccelerationTime && Projectile.ai[2] == 0f) + Projectile.velocity *= Acceleration; + if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) Projectile.tileCollide = true; - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -80,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); if (Projectile.localAI[1] == 0f) { for (int d = 0; d < 10; d++) @@ -94,6 +86,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + Projectile.localAI[1] = 1f; SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); } @@ -105,8 +98,8 @@ namespace CalamityMod.Projectiles.Boss for (int l = 0; l < 12; l++) { Vector2 dustRotate = Vector2.UnitX * -Projectile.width / 2f; - dustRotate += -Vector2.UnitY.RotatedBy(l * 3.14159274f / 6f, default) * new Vector2(8f, 16f); - dustRotate = dustRotate.RotatedBy(Projectile.rotation - 1.57079637f, default); + dustRotate += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f, default) * new Vector2(8f, 16f); + dustRotate = dustRotate.RotatedBy(Projectile.rotation - MathHelper.PiOver2, default); int profaned = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); Main.dust[profaned].scale = 1.1f; Main.dust[profaned].noGravity = true; @@ -117,72 +110,68 @@ namespace CalamityMod.Projectiles.Boss } Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + + float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); + + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.5f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); + + if (Main.rand.NextBool()) + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f)))); } - public override Color? GetAlpha(Color lightColor) - { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(0); public override bool PreDraw(ref Color lightColor) { - 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]; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(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); return false; } public override void OnKill(int timeLeft) { - int blobAmt = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 9 : 6; + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 25; i++) + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.125f * i, 8)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 5)); + + int blobAmt = !ProvUtils.StandardAI() ? 9 : 6; if (Projectile.owner == Main.myPlayer) { + Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X * 0.1f, Projectile.velocity.Y); for (int b = 0; b < blobAmt; b++) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + Projectile.velocity; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + additionalBlobVelocity; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= 2f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); } } - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 4; i++) - { - 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 < 40; j++) - { - int killHolyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); - Main.dust[killHolyDust].noGravity = true; - Main.dust[killHolyDust].velocity *= 3f; - killHolyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[killHolyDust].velocity *= 2f; - Main.dust[killHolyDust].noGravity = true; - } + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18f, targetHitbox); - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 160, 20); + ProvUtils.ApplyDebuffs(target, 160); } } } diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index f0516d1376..9c3698fe8f 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,10 +12,15 @@ namespace CalamityMod.Projectiles.Boss { public class MoltenBlob : ModProjectile, ILocalizedModType { + float Landing = 1f; + bool colliding = false; + + bool inLava = false; + public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -31,43 +37,43 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 80, 10); + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) + Landing += 0.1f; + Landing = MathHelper.Clamp(Landing, 0f, 1f); + + colliding = Projectile.velocity.Y == 0f; + + if (colliding) { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + Landing = 0f; + Projectile.localAI[2] = 5; + + Projectile.velocity.X *= 0.8f; } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; Projectile.velocity.X *= 0.95f; if (Projectile.wet || Projectile.lavaWet) { - Projectile.velocity.Y -= 0.2f; - if (Projectile.velocity.Y < -10f) - Projectile.velocity.Y = -10f; + if (!inLava) + { + Projectile.position.Y -= Projectile.velocity.Y; + Projectile.velocity.Y = 0f; + inLava = true; + } } else { - if (Projectile.velocity.Y < 0f) - Projectile.velocity.Y = 0f; + if (!inLava) + { + if (Projectile.velocity.Y < 0f) + Projectile.velocity.Y = 0f; - Projectile.velocity.Y += 0.1f; - if (Projectile.velocity.Y > 5f) - Projectile.velocity.Y = 5f; + Projectile.velocity.Y += 0.15f; + } } Projectile.frameCounter++; @@ -90,62 +96,54 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetProjectileColor(0); } public override bool PreDraw(ref Color lightColor) { - 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); + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; + int y6 = framing * (1 + Projectile.frame); + float squish = CalamityUtils.SineBumpEasing(Landing, 1) * 0.5f; + Projectile.rotation = 0f; + if (!colliding) + { + y6 = 0; + squish = -MathHelper.Clamp(Projectile.velocity.Length() / 15, 0, 0.5f); + Projectile.rotation = Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.PiOver2; + } + Vector2 vec = new Vector2(0, framing * squish); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.alpha, true), 4f, new Vector2(1 + squish, 1 - squish), texture, offset: vec); + Main.spriteBatch.Draw(texture, Projectile.Center + vec - 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), new Vector2(1 + squish, 1 - squish), SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 10; - Projectile.height = 10; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 3; i++) - { - 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()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 5; j++) - { - int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust2].noGravity = true; - } - } + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(3), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.1f, 0.4f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.002f * i, 0.0125f * i, 8)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.002f, 0.015f, 5)); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 80, 10); + ProvUtils.ApplyDebuffs(target, 80); } } } diff --git a/Projectiles/Boss/MoltenBlob.png b/Projectiles/Boss/MoltenBlob.png index 811a46069d..f2a8116099 100644 Binary files a/Projectiles/Boss/MoltenBlob.png and b/Projectiles/Boss/MoltenBlob.png differ diff --git a/Projectiles/Boss/MoltenBlobNight.png b/Projectiles/Boss/MoltenBlobNight.png index fa915552df..524da76f30 100644 Binary files a/Projectiles/Boss/MoltenBlobNight.png and b/Projectiles/Boss/MoltenBlobNight.png differ diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 13f66d6d3f..3b31f317a9 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -86,8 +86,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); @@ -96,8 +96,8 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index bbc5cadcfe..5645ec3df9 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -13,10 +13,11 @@ namespace CalamityMod.Projectiles.Boss public class MushBombFall : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/Boss/MushBomb"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -89,8 +90,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; @@ -103,8 +104,8 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/MushBombGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Boss/MushBombFall.png b/Projectiles/Boss/MushBombFall.png deleted file mode 100644 index 279f8aa2b9..0000000000 Binary files a/Projectiles/Boss/MushBombFall.png and /dev/null differ diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index fb1110f055..382dc902b0 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/OldDukeSummonDrop.cs b/Projectiles/Boss/OldDukeSummonDrop.cs index 5dff1c3c95..abb9efda0c 100644 --- a/Projectiles/Boss/OldDukeSummonDrop.cs +++ b/Projectiles/Boss/OldDukeSummonDrop.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Boss/OldDukeVortex.cs b/Projectiles/Boss/OldDukeVortex.cs index f2c1fd5171..264a595984 100644 --- a/Projectiles/Boss/OldDukeVortex.cs +++ b/Projectiles/Boss/OldDukeVortex.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -150,7 +150,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs index 53510f205b..57c685ea48 100644 --- a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs +++ b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -91,13 +91,13 @@ namespace CalamityMod.Projectiles.Boss { Vector2 velocity = new Vector2(0f, -18f).RotatedByRandom(0.7f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Top + new Vector2(Main.rand.NextFloat(-80f, 80f), 100f), velocity, - ModContent.ProjectileType(), 65, 2f); + ModContent.ProjectileType(), 0, 0f); } if (Projectile.ai[0] % 35f == 34f) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-3f, 3f), -7f - Main.rand.NextFloat(4f, 12f)).RotatedByRandom(0.5f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Top + new Vector2(Main.rand.NextFloat(-30f, 30f), 100f), velocity, - ModContent.ProjectileType(), 65, 2f); + ModContent.ProjectileType(), 0, 0f); } } @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Boss return; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[] { @@ -181,7 +181,7 @@ namespace CalamityMod.Projectiles.Boss bottomY--; Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f); - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; float yMax = 1600f * Projectile.scale; for (int y = 0; y < yMax; y += 30) { @@ -201,16 +201,6 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override bool CanHitPlayer(Player target) => Projectile.ai[0] >= 90f; - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 240f * Projectile.scale, targetHitbox); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 420); - } + public override bool CanHitPlayer(Player target) => false; } } diff --git a/Projectiles/Boss/PeanutRocket.cs b/Projectiles/Boss/PeanutRocket.cs index e754966886..e0e203d817 100644 --- a/Projectiles/Boss/PeanutRocket.cs +++ b/Projectiles/Boss/PeanutRocket.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 9; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index fb76be00e3..8069efd309 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index 133cb9ef32..32d119dd72 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 80); + target.AddBuff(ModContent.BuffType(), 80); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index 31c1331385..fcadc0e03b 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Length() >= Projectile.ai[0]) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index 3d1d3021cf..0cc7f9eed7 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 80); + target.AddBuff(ModContent.BuffType(), 80); } } } diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index fc59234722..0f064415ea 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -59,16 +59,16 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Projectile.DrawBackglow(PlaguebringerGoliath.BackglowColor, 4f); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } public override void PostDraw(Color lightColor) { Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value; - Vector2 textureArea = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); + Vector2 textureArea = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Type] / 2); Vector2 drawArea = Projectile.Center - Main.screenPosition; - drawArea -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) / 2f; + drawArea -= new Vector2(glow.Width, glow.Height / Main.projFrames[Type]) / 2f; drawArea += textureArea + new Vector2(0f, Projectile.gfxOffY); Color whiteColor = Color.White; Main.spriteBatch.Draw(glow, drawArea, null, whiteColor, Projectile.rotation, textureArea, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index a7615548da..cba5fae545 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -45,16 +45,16 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Projectile.DrawBackglow(PlaguebringerGoliath.BackglowColor, 4f); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } public override void PostDraw(Color lightColor) { Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value; - Vector2 origin = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); + Vector2 origin = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Type] / 2); Vector2 drawPos = Projectile.Center - Main.screenPosition; - drawPos -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) / 2f; + drawPos -= new Vector2(glow.Width, glow.Height / Main.projFrames[Type]) / 2f; drawPos += origin + new Vector2(0f, Projectile.gfxOffY); Color whiteColor = Color.White; Main.spriteBatch.Draw(glow, drawPos, null, whiteColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index f716020d87..174bca5a2c 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -2,9 +2,11 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -15,8 +17,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -35,17 +37,6 @@ namespace CalamityMod.Projectiles.Boss { Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); - if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - if (Projectile.timeLeft < 510) Projectile.tileCollide = true; @@ -70,18 +61,41 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProfanedSpearNight").Value; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProfanedSpearNight").Value; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture); 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(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } + public override void OnKill(int timeLeft) + { + Color hiColor = ProvUtils.GetProjectileColor(255); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); + + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0) diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index bf409a9f5d..b77439580e 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -3,9 +3,11 @@ using System.IO; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,6 +17,8 @@ namespace CalamityMod.Projectiles.Boss { public class ProvidenceCrystal : ModProjectile, ILocalizedModType { + public bool introAnimationDone = false; + public float introAnimationProgress = 0f; public new string LocalizationCategory => "Projectiles.Boss"; public override void SetDefaults() { @@ -38,8 +42,40 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] = reader.ReadSingle(); } + void CrystalExplosion() + { + Player proviTarget = Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target]; + for (int i = 0; i < 7; i++) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, proviTarget.velocity, Color.Violet, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(2.5f, 6f), 3f), Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.5f, 20)); + } + for (int i = 0; i < 4; i++) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, proviTarget.velocity, Color.Violet, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 3f, 0f, 35)); + } + } + public override void AI() { + if (introAnimationProgress == 0f) + { + SoundEngine.PlaySound(SoundID.Item101.WithPitchOffset(-1f), Projectile.Center); + } + + introAnimationProgress += 0.025f; + introAnimationProgress = MathHelper.Clamp(introAnimationProgress, 0f, 1f); + + if (introAnimationProgress == 1f) + { + if (!introAnimationDone) + { + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact.WithPitchOffset(-0.5f), Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact, Projectile.Center); + CrystalExplosion(); + } + introAnimationDone = true; + } + if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) { Projectile.active = false; @@ -55,8 +91,6 @@ namespace CalamityMod.Projectiles.Boss Player proviTarget = Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target]; - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - Projectile.position.X = proviTarget.Center.X - (Projectile.width / 2); Projectile.position.Y = proviTarget.Center.Y - (Projectile.height / 2) + proviTarget.gfxOffY - 360f; if (proviTarget.gravDir == -1f) @@ -71,13 +105,13 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = (int)Projectile.position.Y; Projectile.velocity = Vector2.Zero; - Projectile.alpha -= 5; + Projectile.alpha -= 20; if (Projectile.alpha < 0) Projectile.alpha = 0; if (Projectile.alpha == 0 && Main.rand.NextBool(15)) { - Color BaseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); + Color BaseColor = ProvUtils.GetProjectileColor(0); float Brightness = 0.8f; Color DustColor = Color.Lerp(BaseColor, Color.White, Brightness); Dust crystalDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, DustColor, 1f)]; @@ -93,30 +127,31 @@ namespace CalamityMod.Projectiles.Boss // Increment timer Projectile.localAI[0] += 1f; - // At day, fires every 300 frames but lasts 1500-3600 frames. - // At night, fires every 30 framges but lasts 210 frames. - // In GFB, fires at night rate for the first 210 frames, then at day rate for the next 1500. - bool dayAI = Projectile.maxPenetrate == (int)Providence.BossMode.Day || (Projectile.maxPenetrate >= (int)Providence.BossMode.Red && Projectile.timeLeft < 1500); + // Normally, fires every 300 frames but lasts 1500-3600 frames. + // When enraged, fires every 30 frames but lasts 210 frames. + // In GFB, fires at enraged rate for the first 210 frames, then at standard rate for the next 1500. + bool standardAI = ProvUtils.StandardAI() || (Main.zenithWorld && Projectile.timeLeft < 1500); - if (Projectile.localAI[0] >= (dayAI ? 300f : 30f)) + if (Projectile.localAI[0] >= (standardAI ? 300f : 30f)) { - // Spawn shards every 30 frames at night or at 300 frames during day - if (Projectile.localAI[0] % 30f == 0f || dayAI) + // Spawn shards every 30 frames while enraged or at 300 frames normally + if (Projectile.localAI[0] % 30f == 0f || standardAI) { SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); Projectile.netUpdate = true; if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = dayAI ? 15 : (Projectile.localAI[0] % 60f == 0f ? 15 : 10); - float speedX = dayAI ? -21f : -15f; + int totalProjectiles = standardAI ? 15 : (Projectile.localAI[0] % 60f == 0f ? 15 : 10); + float speedX = standardAI ? -21f : -15f; float speedAdjustment = Math.Abs(speedX * 2f / (totalProjectiles - 1)); float speedY = -3f; for (int i = 0; i < totalProjectiles; i++) { - float x4 = dayAI ? Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X : Main.rgbToHsl(new Color(Main.DiscoR, 200, 255)).X; - float randomSpread = dayAI ? 0f : Main.rand.Next(-150, 151) * 0.01f * (1f - lifeRatio); + float x4 = standardAI ? Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X : Main.rgbToHsl(new Color(Main.DiscoR, 200, 255)).X; + float randomSpread = standardAI ? 0f : Main.rand.Next(-150, 151) * 0.01f * (1f - lifeRatio); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX + speedAdjustment * i + randomSpread, speedY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, x4, Projectile.whoAmI); } + CrystalExplosion(); } // Reset timer @@ -128,22 +163,36 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => false; - public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); + public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha); public override bool PreDraw(ref Color lightColor) { - 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 = 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; - float scaleFactor = (float)Math.Cos(MathHelper.TwoPi * (Projectile.localAI[0] / 60f)) + 3f + 3f; - for (float i = 0f; i < 4f; i += 1f) + if (introAnimationDone) { - double angle = i * MathHelper.PiOver2; - Vector2 center = default; - Main.spriteBatch.Draw(texture2D34, drawArea + Vector2.UnitY.RotatedBy(angle, center) * scaleFactor, new Microsoft.Xna.Framework.Rectangle?(textureRect), colorAlpha * 0.2f, Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); + 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 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle textureRect = texture2D34.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Color colorAlpha = Projectile.GetAlpha(colorArea); + Vector2 halfRect = textureRect.Size() / 2f; + float scaleFactor = (float)Math.Cos(MathHelper.TwoPi * (Projectile.localAI[0] / 60f)) + 3f + 3f; + for (float i = 0f; i < 4f; i += 0.5f) + { + double angle = i * MathHelper.PiOver2; + Vector2 center = default; + Main.spriteBatch.Draw(texture2D34, drawArea + Vector2.UnitY.RotatedBy(angle, center) * scaleFactor, new Microsoft.Xna.Framework.Rectangle?(textureRect), Color.Violet.MultiplyRGBA(new Color(1f, 1f, 1f, 0f)), Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); + } + Main.EntitySpriteDraw(texture2D34, Projectile.Center - Main.screenPosition, texture2D34.Frame(), Color.White, 0f, texture2D34.Frame().Center(), 1f, SpriteEffects.None); + } + else + { + Asset tex = ModContent.Request("CalamityMod/Projectiles/Boss/ProvidenceCrystal_Halves"); + for (int i = 0; i < 2; i++) + { + float dir = i == 0 ? -1 : 1; + float ii = MathHelper.Lerp(60, 0, CalamityUtils.CircInEasing(introAnimationProgress, 1) - CalamityUtils.SineBumpEasing(introAnimationProgress, 1)); + Main.EntitySpriteDraw(tex.Value, Projectile.Center + (new Vector2(dir * ii).RotatedBy(MathHelper.ToRadians(MathHelper.Lerp(0, -90, CalamityUtils.CircInEasing(introAnimationProgress, 1))))) - Main.screenPosition, new Rectangle(i * 50, 0, 50, tex.Height()), Projectile.GetAlpha(lightColor).MultiplyRGBA(new Color(1f, 1f, 1f, 1f)), MathHelper.ToRadians(MathHelper.Lerp(70, 0, introAnimationProgress)), new Vector2(25, tex.Height() / 2), 1f, SpriteEffects.None); + } } return false; } diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index aec440d1d4..a745f81594 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -4,6 +4,8 @@ using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -14,6 +16,13 @@ namespace CalamityMod.Projectiles.Boss public class ProvidenceCrystalShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 3; + } + public override void SetDefaults() { Projectile.Calamity().DealsDefenseDamage = true; @@ -42,23 +51,16 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 0, 10); + bool healerGuardianAlive = true; if (CalamityGlobalNPC.doughnutBossHealer < 0 || !Main.npc[CalamityGlobalNPC.doughnutBossHealer].active) healerGuardianAlive = false; Lighting.AddLight(Projectile.Center, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - - // Night AI or Guardian Healer - if (Projectile.maxPenetrate != (int)Providence.BossMode.Day || healerGuardianAlive) + // Enraged AI or Guardian Healer + if (!ProvUtils.StandardAI() || healerGuardianAlive) Projectile.extraUpdates = 1; if (Projectile.timeLeft < 300) @@ -83,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.velocity.Y *= 1.06f; - float fallSpeed = (CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Day)) ? 3.5f : 3f; + float fallSpeed = (CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Normal)) ? 3.5f : 3f; if (Projectile.velocity.Y > fallSpeed) Projectile.velocity.Y = fallSpeed; } @@ -207,22 +209,21 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) => new Color(255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity, 0); - - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + public override bool PreDraw(ref Color lightColor) { - // In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + Asset texture = ModContent.Request(Texture); + + for (int i = 1; i < Projectile.oldPos.Length; i++) + { + Main.EntitySpriteDraw(texture.Value, Projectile.oldPos[i] + (Projectile.Size / 2) - Main.screenPosition, texture.Frame(), Color.Lerp(Color.Violet, new Color(42, 25, 60), (float)i / (float)Projectile.oldPos.Length).MultiplyRGBA(new Color(1f, 1f, 1f, 0f)), Projectile.oldRot[i], texture.Frame().Center(), Projectile.scale * MathHelper.Lerp(1.3f, 0.4f, (float)i / (float)Projectile.oldPos.Length), SpriteEffects.None); + } + + Projectile.DrawBackglow(Color.Violet.MultiplyRGBA(new Color(1f, 1f, 1f, 0f)), 4f); + Main.EntitySpriteDraw(texture.Value, Projectile.Center - Main.screenPosition, texture.Frame(), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Frame().Center(), Projectile.scale, SpriteEffects.None); + + return false; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) - return; - - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 0, 10); - } + public override Color? GetAlpha(Color lightColor) => new Color(255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity); } } diff --git a/Projectiles/Boss/ProvidenceCrystal_Halves.png b/Projectiles/Boss/ProvidenceCrystal_Halves.png new file mode 100644 index 0000000000..45eca54187 Binary files /dev/null and b/Projectiles/Boss/ProvidenceCrystal_Halves.png differ diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index fff9c36e64..7ca90e54b2 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -3,11 +3,13 @@ using System.IO; using CalamityMod.NPCs; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; @@ -16,10 +18,15 @@ namespace CalamityMod.Projectiles.Boss { public class ProvidenceHolyRay : ModProjectile, ILocalizedModType { + // ExtraWidth is a buffer variable to make this file more readable, which Projectile.ai[2] is then fed into on projectile spawn. + // When spawning the projectile, use Projectile.ai[2] in place of this. + // Also, this value is multiplicative, e.g. ExtraWidth of 1f will make the width the same as the sprite. + // 2f will make it doubly wide without affecting length, etc etc. + float ExtraWidth = 1f; public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -49,26 +56,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + ExtraWidth = Projectile.ai[2]; - bool scissorLasers = CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Day); + bool scissorLasers = CalamityWorld.revenge || !ProvUtils.StandardAI(); Vector2? vector78 = null; if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) @@ -94,6 +84,9 @@ namespace CalamityMod.Projectiles.Boss return; } + if (projScale == 1f) + ProvUtils.ApplyGFBDamage(Projectile, 400, 20); + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * projScale; if (Projectile.scale > projScale) Projectile.scale = projScale; @@ -122,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) rayLength = 2400f; - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], rayLength, 0.5f); // Length of laser, linear interpolation Vector2 dustRotation = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); for (int j = 0; j < 2; j++) @@ -146,6 +139,16 @@ namespace CalamityMod.Projectiles.Boss DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, DelegateMethods.CastLight); + + for (float i = 0; i < Projectile.localAI[1]; i += Main.rand.NextFloat(15, 30)) + { + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(30 * ExtraWidth), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)) + (Projectile.velocity * i), Projectile.velocity * 5, false, 5, Main.rand.NextFloat(0.5f, 1.5f), ProvUtils.GetProjectileColor(255), false)); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) @@ -153,23 +156,35 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity == Vector2.Zero) return false; - bool dayTime = Projectile.maxPenetrate == (int)Providence.BossMode.Day; - Texture2D texture2D19 = dayTime ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : + Vector2 scale = new Vector2(Projectile.scale * ExtraWidth, Projectile.scale); + + bool standardTexture = ProvUtils.StandardAI(); + Texture2D texture2D19 = standardTexture ? 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 = standardTexture ? 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 = standardTexture ? 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 - Color baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0) * 0.9f; + Color baseColor = ProvUtils.GetProjectileColor(lightColor); Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, baseColor, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, baseColor, Projectile.rotation, texture2D19.Size() / 2f, scale, SpriteEffects.None, 0); rayDrawLength -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; Vector2 projCenter = Projectile.Center; projCenter += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; + Texture2D GlowBallTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D GlowRingTexture = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + + Projectile.localAI[2]++; + + Color glowColor = ProvUtils.GetProjectileColor(0); + + Main.EntitySpriteDraw(GlowBallTexture, Projectile.Center - Main.screenPosition, GlowBallTexture.Frame(), glowColor, 0f, GlowBallTexture.Frame().Center(), Projectile.scale / 1.5f * ExtraWidth, SpriteEffects.None); + Main.EntitySpriteDraw(GlowRingTexture, Projectile.Center - Main.screenPosition, GlowRingTexture.Frame(), glowColor, 0f, GlowRingTexture.Frame().Center(), Projectile.scale / MathHelper.Lerp(1.5f, 1f, (float)Math.Sin(Projectile.localAI[2] / 20f) * 0.5f) * ExtraWidth, SpriteEffects.None); + if (rayDrawLength > 0f) { float raySegment = 0f; @@ -179,7 +194,7 @@ namespace CalamityMod.Projectiles.Boss if (rayDrawLength - raySegment < drawRectangle.Height) drawRectangle.Height = (int)(rayDrawLength - raySegment); - Main.spriteBatch.Draw(texture2D20, projCenter - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), baseColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D20, projCenter - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), baseColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), scale, SpriteEffects.None, 0); raySegment += drawRectangle.Height * Projectile.scale; projCenter += Projectile.velocity * drawRectangle.Height * Projectile.scale; drawRectangle.Y += 36; @@ -192,7 +207,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 vector2 = projCenter - Main.screenPosition; sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, baseColor, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, baseColor, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), scale, SpriteEffects.None, 0); return false; } @@ -206,6 +221,9 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { + targetHitbox.Width = (int)((float)targetHitbox.Width * ExtraWidth); + targetHitbox.Height = (int)((float)targetHitbox.Height * ExtraWidth); + if (projHitbox.Intersects(targetHitbox)) return true; @@ -216,20 +234,13 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - // In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 400, 20); + ProvUtils.ApplyDebuffs(target, 400); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/RavagerBlast.cs b/Projectiles/Boss/RavagerBlast.cs index 61b4becedc..81d5963dae 100644 --- a/Projectiles/Boss/RavagerBlast.cs +++ b/Projectiles/Boss/RavagerBlast.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Boss { get { - Color c1 = blue ? Color.MediumTurquoise : Color.Gray; - Color c2 = blue ? Color.Cyan : Color.White; + Color c1 = blue ? Color.MediumTurquoise : (CalamityClientConfig.Instance.Photosensitivity ? new Color(79, 79, 79) : Color.Gray); + Color c2 = blue ? Color.Cyan : (CalamityClientConfig.Instance.Photosensitivity ? new Color(79, 79, 79) : Color.White); Color color = Color.Lerp(c1, c2, Projectile.identity % 5f / 5f) * 1.1f; color.A = 0; return color; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -113,11 +113,11 @@ namespace CalamityMod.Projectiles.Boss // Determine frames. Projectile.frameCounter++; if (Projectile.frameCounter % 5f == 4f) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } // 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 CanHitPlayer(Player target) => (!blue || target.velocity.Length() >= 0.25f) && Projectile.scale >= 0.5f; public override bool PreDraw(ref Color lightColor) { @@ -126,9 +126,9 @@ namespace CalamityMod.Projectiles.Boss return false; Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); // Start texture drawing. Vector2 centerOnLaser = Projectile.Center + Projectile.velocity * Projectile.scale * 116f; diff --git a/Projectiles/Boss/RavagerBlaster.cs b/Projectiles/Boss/RavagerBlaster.cs index a8b5432bab..1c56038a6d 100644 --- a/Projectiles/Boss/RavagerBlaster.cs +++ b/Projectiles/Boss/RavagerBlaster.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 1f, 1f, 1f); + //ai0 = timer, ai1 = laser size if (Projectile.ai[0] < 90f) //Before the laser { @@ -65,5 +67,11 @@ namespace CalamityMod.Projectiles.Boss // Does no contact damage public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawProjectileWithBackglow(Projectile, Color.LightGray, lightColor, 5f); + return false; + } } } diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs index b16281511c..7f2f6405fa 100644 --- a/Projectiles/Boss/RedLightning.cs +++ b/Projectiles/Boss/RedLightning.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index d11b3fe2b4..4941a9ffe3 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, false); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, Terraria.GameContent.TextureAssets.Projectile[Type].Value, false); return false; } diff --git a/Projectiles/Boss/SCalBrimstoneFireblast.cs b/Projectiles/Boss/SCalBrimstoneFireblast.cs index fce044dea7..17595f148b 100644 --- a/Projectiles/Boss/SCalBrimstoneFireblast.cs +++ b/Projectiles/Boss/SCalBrimstoneFireblast.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Boss public bool setLifetime = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -159,8 +159,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int drawStart = frameHeight * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Boss/SCalBrimstoneGigablast.cs b/Projectiles/Boss/SCalBrimstoneGigablast.cs index c0c1fab63b..4ac7522311 100644 --- a/Projectiles/Boss/SCalBrimstoneGigablast.cs +++ b/Projectiles/Boss/SCalBrimstoneGigablast.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Boss public bool setLifetime = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -144,8 +144,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int drawStart = frameHeight * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Boss/SCalRitualDrama.cs b/Projectiles/Boss/SCalRitualDrama.cs index f72cbabdbf..22850fc1e5 100644 --- a/Projectiles/Boss/SCalRitualDrama.cs +++ b/Projectiles/Boss/SCalRitualDrama.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Boss public const int TotalRitualTime = 270; public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index 53a8ae4d8c..9b20386e13 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index f769f853b0..6db2345c81 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 10; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss { Projectile.damage = 0; } - else if (Projectile.frame >= Main.projFrames[Projectile.type]) + else if (Projectile.frame >= Main.projFrames[Type]) { Projectile.Kill(); } @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.cs b/Projectiles/Boss/SandPoisonCloudOldDuke.cs index c79b6a8733..30db17a25a 100644 --- a/Projectiles/Boss/SandPoisonCloudOldDuke.cs +++ b/Projectiles/Boss/SandPoisonCloudOldDuke.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 10; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss { Projectile.damage = 0; } - else if (Projectile.frame >= Main.projFrames[Projectile.type]) + else if (Projectile.frame >= Main.projFrames[Type]) { Projectile.Kill(); } @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs index 2278a12abd..f7d9a0a6f7 100644 --- a/Projectiles/Boss/SandTooth.cs +++ b/Projectiles/Boss/SandTooth.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 082ee5c27a..6406bf212b 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -1,9 +1,12 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; 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.Projectiles.Boss @@ -14,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion"); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -81,6 +84,21 @@ namespace CalamityMod.Projectiles.Boss } } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + { + if (DownedBossSystem.downedProvidence) + { + target.AddBuff(ModContent.BuffType(), 180, true); + } + else + { + target.AddBuff(ModContent.BuffType(), 180, true); + } + } + } + public override void OnKill(int timeLeft) { SoundEngine.PlaySound(ExplosionSound, Projectile.Center); @@ -108,49 +126,48 @@ namespace CalamityMod.Projectiles.Boss Main.dust[nukeDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + Vector2 source = new Vector2(Projectile.Center.X - 24f, Projectile.Center.Y - 24f); + for (int g = 1; g <= 3; g++) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) + float velocityMult = g * 0.33f; + for (int spawn = 0; spawn < 4; spawn++) { - velocityMult = 0.66f; + 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; } - 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 bool PreDraw(ref Color lightColor) + { + int timeToStartWarning = 180; + + Color initialColor = lightColor; + Color finalColor = Color.Lerp(Color.White, Color.Red, (float)Math.Abs(Math.Sin((timeToStartWarning - Projectile.timeLeft) * (MathHelper.Pi * 7f / 180f)))); + Color warningColor; + finalColor.A = (byte)(255 - Projectile.alpha); + + if (Projectile.timeLeft <= timeToStartWarning) + { + float colorTransitionRatio = (timeToStartWarning - Projectile.timeLeft) / (float)timeToStartWarning; + warningColor = Color.Lerp(initialColor, finalColor, colorTransitionRatio); + } + else + warningColor = initialColor; + + float strength = Utils.GetLerpValue(0, timeToStartWarning / 1.5f, timeToStartWarning - Projectile.timeLeft, true); + Rectangle frame = TextureAssets.Projectile[Type].Value.Frame(1, 5, 0, Projectile.frame); + SpriteEffects sp = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Projectile.DrawProjectileWithBackglow(new Color(64, 255, 255) * strength, Projectile.GetAlpha(warningColor), 4.5f, null, frame, sp); + return false; + } } } diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index 9ebf0fb51a..60a4894904 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index 8fd4a72096..9c499a84de 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.ignoreWater = true; Projectile.timeLeft = 300; - Projectile.alpha = 50; + Projectile.alpha = 255; } public override void OnKill(int timeLeft) @@ -32,7 +32,18 @@ namespace CalamityMod.Projectiles.Boss dust.scale = 0.95f; } - public override Color? GetAlpha(Color lightColor) => new Color(100, 255, 100, Projectile.alpha); + public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= 85; + + public override Color? GetAlpha(Color lightColor) + { + if (Projectile.timeLeft < 85) + { + byte b2 = (byte)(Projectile.timeLeft * 3); + byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); + return new Color(b2, b2, b2, a2); + } + return new Color(255, 255, 255, Projectile.alpha); + } public override void OnHitPlayer(Player target, Player.HurtInfo info) { diff --git a/Projectiles/Boss/Shadowflamethrower.cs b/Projectiles/Boss/Shadowflamethrower.cs index 6221002bca..7021df84c2 100644 --- a/Projectiles/Boss/Shadowflamethrower.cs +++ b/Projectiles/Boss/Shadowflamethrower.cs @@ -1,6 +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 Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -8,68 +12,160 @@ namespace CalamityMod.Projectiles.Boss public class Shadowflamethrower : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override string Texture => "CalamityMod/Projectiles/FireProj"; + + public static int Lifetime => 70; + public static int Fadetime => 60; + public ref float Time => ref Projectile.ai[0]; + public int MistType = -1; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; + Projectile.width = Projectile.height = 10; Projectile.hostile = true; - Projectile.alpha = 255; + Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 60; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = Lifetime; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() { - if (Projectile.ai[0] > 7f) + Time++; + if (Time < Fadetime && Main.rand.NextBool(6)) { - int[] dustTypes = new int[] { 27, 27, 112, 173 }; - if (true) + int dustType = Main.rand.Next(4); + switch (dustType) { - int dustType = dustTypes[Main.rand.Next(4)]; - int dustID; - Vector2 corner = Projectile.position - new Vector2(6f, 6f); - int width = 18; - int height = 18; - switch (dustType) - { - case 27: - dustID = Dust.NewDust(corner, width, height, dustType); - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale = Main.rand.NextFloat(1f, 1.2f); - Main.dust[dustID].velocity *= 0.9f; - Main.dust[dustID].velocity += Projectile.velocity * 0.7f; - break; - case 112: - dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].scale = Main.rand.NextFloat(1.4f, 2f); - Main.dust[dustID].velocity *= 2.2f; - Main.dust[dustID].velocity += Projectile.velocity * Main.rand.NextFloat(0.15f, 0.4f); - break; - case 173: - dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale = Main.rand.NextFloat(1.9f, 3f); - Main.dust[dustID].velocity *= 1.5f; - Main.dust[dustID].velocity += Projectile.velocity * Main.rand.NextFloat(0.6f, 1f); - break; - } + default: + case 0: + case 1: + dustType = 27; + break; + + case 2: + dustType = 112; + break; + + case 3: + dustType = 173; + break; } + Vector2 cinderPos = Projectile.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(Time, 0f, Lifetime, 0.5f, 1f); + float cinderSize = Utils.GetLerpValue(6f, 12f, Time, true); + Dust cinder = Dust.NewDustDirect(cinderPos, 4, 4, dustType, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); + if (Main.rand.NextBool(3)) + { + cinder.scale *= 2f; + cinder.velocity *= 2f; + } + cinder.noGravity = true; + cinder.scale *= cinderSize * 1.2f; + cinder.velocity += Projectile.velocity * Utils.Remap(Time, 0f, Fadetime * 0.75f, 1f, 0.1f) * Utils.Remap(Time, 0f, Fadetime * 0.1f, 0.1f, 1f); } - Projectile.ai[0]++; - Projectile.rotation += 0.3f * (float)Projectile.direction; + if (MistType == -1) + MistType = Main.rand.Next(3); + + Lighting.AddLight(Projectile.Center, 0.5f, 0.05f, 0.6f); } + // Keeping the flames in place when hitting a block + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.velocity = oldVelocity * 0.95f; + Projectile.position -= Projectile.velocity; + Time++; + Projectile.timeLeft--; + return false; + } + + // Expanding hitbox + // A bit more generous than Havoc's Breath fire because enemy projectiles + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + int size = (int)Utils.Remap(Time, 0f, Fadetime, 8f, 32f); + + // Shrinks again after fading + if (Time > Fadetime) + size = (int)Utils.Remap(Time, Fadetime, Lifetime, 32f, 0f); + + hitbox.Inflate(size, size); + } + + // Anti-wall hacking checks + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projHitbox.Intersects(targetHitbox) && Collision.CanHit(Projectile.Center, 0, 0, targetHitbox.Center.ToVector2(), 0, 0) ? null : false; + public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 120, true); + target.AddBuff(ModContent.BuffType(), 120); + + // Cook you up (still scales with player size in case it's manipulated) + int smokeCount = 4 + (int)MathHelper.Clamp(target.width * 0.1f, 0f, 20f); + for (int i = 0; i < smokeCount; i++) + { + Vector2 smokePos = target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f); + Vector2 smokeVel = Vector2.UnitY * Main.rand.NextFloat(-2.4f, -0.8f) * MathHelper.Clamp(target.height * 0.1f, 1f, 10f); + Particle smoke = new MediumMistParticle(smokePos, smokeVel, new Color(100, 255, 0), Color.DimGray, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; + + // The conga line of colors to sift through + Color color1 = new Color(200, 10, 255, 200); + Color color2 = new Color(200, 50, 180, 70); + Color color3 = new Color(200, 30, 255, 100); + Color color4 = new Color(80, 0, 100, 100); + float length = ((Time > Fadetime - 10f) ? 0.1f : 0.15f); + float vOffset = Math.Min(Time, 20f); + float timeRatio = Utils.GetLerpValue(0f, Lifetime, Time); + float fireSize = Utils.Remap(timeRatio, 0.2f, 0.5f, 0.25f, 1f); + + if (timeRatio >= 1f) + return false; + + for (float j = 1f; j >= 0f; j -= length) + { + // Color + Color fireColor = ((timeRatio < 0.1f) ? Color.Lerp(Color.Transparent, color1, Utils.GetLerpValue(0f, 0.1f, timeRatio)) : + ((timeRatio < 0.2f) ? Color.Lerp(color1, color2, Utils.GetLerpValue(0.1f, 0.2f, timeRatio)) : + ((timeRatio < 0.35f) ? color2 : + ((timeRatio < 0.7f) ? Color.Lerp(color2, color3, Utils.GetLerpValue(0.35f, 0.7f, timeRatio)) : + ((timeRatio < 0.85f) ? Color.Lerp(color3, color4, Utils.GetLerpValue(0.7f, 0.85f, timeRatio)) : + Color.Lerp(color4, Color.Transparent, Utils.GetLerpValue(0.85f, 1f, timeRatio))))))); + fireColor *= (1f - j) * Utils.GetLerpValue(0f, 0.2f, timeRatio, true); + Color innerColor = Color.Lerp(fireColor, Color.Black, 0.3f); + + // Positions and rotations + Vector2 firePos = Projectile.Center - Main.screenPosition - Projectile.velocity * vOffset * j; + float mainRot = -j * MathHelper.PiOver2 - Main.GlobalTimeWrappedHourly * (j + 1f) * 2f / length; + float trailRot = MathHelper.PiOver4 - mainRot; + + // Draw one backtrail + Vector2 trailOffset = Projectile.velocity * vOffset * length * 0.5f; + Main.EntitySpriteDraw(fire, firePos - trailOffset, null, innerColor * 0.25f, trailRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); + + // Draw the main fire + Main.EntitySpriteDraw(fire, firePos, null, innerColor, mainRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); + + // Draw the masking smoke + Main.spriteBatch.SetBlendState(BlendState.Additive); + Rectangle frame = mist.Frame(1, 3, 0, MistType); + Main.EntitySpriteDraw(mist, firePos, frame, Color.Lerp(fireColor, Color.White, 0.3f), mainRot, frame.Size() * 0.5f, fireSize, SpriteEffects.None); + Main.EntitySpriteDraw(mist, firePos, frame, fireColor, mainRot, frame.Size() * 0.5f, fireSize * 3f, SpriteEffects.None); + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + } + + return false; } } } diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index fba7051dee..7693532568 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -1,4 +1,5 @@ using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; @@ -14,8 +15,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -89,7 +90,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index c119d5920f..8a343083b5 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs index 8a7349e2c2..7e8efe47f6 100644 --- a/Projectiles/Boss/SkyFlare.cs +++ b/Projectiles/Boss/SkyFlare.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Boss public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index 8563018980..7cb58e9c83 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -46,8 +46,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index 3ab5f9af80..f1527b37fd 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -3,6 +3,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,10 +12,18 @@ namespace CalamityMod.Projectiles.Boss public class SporeGasPlantera : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "Terraria/Images/Projectile_" + ProjectileID.SporeGas; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; + + if (!Main.dedServ) + { + Main.instance.LoadProjectile(ProjectileID.SporeGas2); + Main.instance.LoadProjectile(ProjectileID.SporeGas3); + } } public override void SetDefaults() @@ -80,21 +89,21 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { // Changes the texture of the projectile - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; switch ((int)Projectile.ai[0]) { case 0: break; case 1: - texture = ModContent.Request("CalamityMod/Projectiles/Boss/SporeGasPlantera2").Value; + texture = TextureAssets.Projectile[ProjectileID.SporeGas2].Value; break; case 2: - texture = ModContent.Request("CalamityMod/Projectiles/Boss/SporeGasPlantera3").Value; + texture = TextureAssets.Projectile[ProjectileID.SporeGas3].Value; break; default: break; } - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, texture); return false; } diff --git a/Projectiles/Boss/SporeGasPlantera.png b/Projectiles/Boss/SporeGasPlantera.png deleted file mode 100644 index d96df4734e..0000000000 Binary files a/Projectiles/Boss/SporeGasPlantera.png and /dev/null differ diff --git a/Projectiles/Boss/SporeGasPlantera2.png b/Projectiles/Boss/SporeGasPlantera2.png deleted file mode 100644 index 43de36f76c..0000000000 Binary files a/Projectiles/Boss/SporeGasPlantera2.png and /dev/null differ diff --git a/Projectiles/Boss/SporeGasPlantera3.png b/Projectiles/Boss/SporeGasPlantera3.png deleted file mode 100644 index 031824c267..0000000000 Binary files a/Projectiles/Boss/SporeGasPlantera3.png and /dev/null differ diff --git a/Projectiles/Boss/SupremeCataclysmFist.cs b/Projectiles/Boss/SupremeCataclysmFist.cs index c6aa6cdf6c..edb9e872bf 100644 --- a/Projectiles/Boss/SupremeCataclysmFist.cs +++ b/Projectiles/Boss/SupremeCataclysmFist.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Boss // Decide frames. Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; // Fade in and handle visuals. if (Projectile.ai[2] < 3) @@ -269,12 +269,12 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * Projectile.Opacity); SpriteEffects direction = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Projectile.ai[1] == 1f) texture = ModContent.Request("CalamityMod/Projectiles/Boss/SupremeCataclysmFistAlt").Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0); return false; } diff --git a/Projectiles/Boss/SupremeCatastropheSlash.cs b/Projectiles/Boss/SupremeCatastropheSlash.cs index 9048168f99..afa91f3d53 100644 --- a/Projectiles/Boss/SupremeCatastropheSlash.cs +++ b/Projectiles/Boss/SupremeCatastropheSlash.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss // Decide frames. Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 7 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 7 % Main.projFrames[Type]; // Fade in and handle visuals. if (Projectile.ai[2] < 4 && Projectile.ai[2] < 50) @@ -196,13 +196,13 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Projectile.ai[1] == 0f) texture = ModContent.Request("CalamityMod/Projectiles/Boss/SupremeCatastropheSlashAlt").Value; 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); + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Boss/SwirlingFire.cs b/Projectiles/Boss/SwirlingFire.cs index a1d5261879..f5554e4fb8 100644 --- a/Projectiles/Boss/SwirlingFire.cs +++ b/Projectiles/Boss/SwirlingFire.cs @@ -1,4 +1,7 @@ -using CalamityMod.World; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -22,21 +25,24 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 180; CooldownSlot = ImmunityCooldownID.Bosses; + Projectile.ai[0] = MathHelper.ToRadians(Main.rand.NextFloat(-3, 3)); } 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.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.IsItDay()) - fire.color = Color.Lerp(Color.Cyan, Color.BlueViolet, Main.rand.NextFloat()); + Color c = ProvUtils.GetProjectileColor(255); - Dust.CloneDust(fire).velocity = fireVelocity.RotatedBy(-MathHelper.PiOver2); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity / 2f, false, 10, 0.5f * Projectile.ai[2], c)); + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, 0.5f * Projectile.ai[2], 150, Main.rand.NextFloat(-0.01f, 0.01f))); + + Projectile.ai[2] *= 0.98f; + + Projectile.velocity *= 0.97f; + + if (Projectile.ai[2] < 0.2f) + { + Projectile.Kill(); + } Projectile.velocity = Projectile.velocity.RotatedBy(AngularTurnSpeed); Time++; diff --git a/Projectiles/Boss/THanosSideLaser.cs b/Projectiles/Boss/THanosSideLaser.cs index 4e6a1aa74a..89b47ae15d 100644 --- a/Projectiles/Boss/THanosSideLaser.cs +++ b/Projectiles/Boss/THanosSideLaser.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + Main.projFrames[Type] = 4; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); Projectile.Center -= drawOffset; return false; } diff --git a/Projectiles/Boss/ThanatosBeamStart.cs b/Projectiles/Boss/ThanatosBeamStart.cs index 79a3657cbb..1169549444 100644 --- a/Projectiles/Boss/ThanatosBeamStart.cs +++ b/Projectiles/Boss/ThanatosBeamStart.cs @@ -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 => Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + public override Texture2D LaserBeginTexture => Terraria.GameContent.TextureAssets.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; @@ -41,8 +41,8 @@ namespace CalamityMod.Projectiles.Boss { // Thanatos' mouth laser // This is its serious name - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + Main.projFrames[Type] = 5; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Boss // Determine frames. Projectile.frameCounter++; if (Projectile.frameCounter % 5f == 0f) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } public override bool PreDraw(ref Color lightColor) @@ -181,9 +181,9 @@ namespace CalamityMod.Projectiles.Boss return false; Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); // Start texture drawing. Main.EntitySpriteDraw(LaserBeginTexture, @@ -218,7 +218,7 @@ namespace CalamityMod.Projectiles.Boss 0); incrementalBodyLength += laserOffset; centerOnLaser += Projectile.velocity * laserOffset; - middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Projectile.type]; + middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Type]; if (middleFrameArea.Y + middleFrameArea.Height > LaserMiddleTexture.Height) middleFrameArea.Y = 0; } diff --git a/Projectiles/Boss/ThanatosBeamTelegraph.cs b/Projectiles/Boss/ThanatosBeamTelegraph.cs index 9eb50bc6c2..bd2b92755b 100644 --- a/Projectiles/Boss/ThanatosBeamTelegraph.cs +++ b/Projectiles/Boss/ThanatosBeamTelegraph.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss public const float BeamPosOffset = 16f; public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() diff --git a/Projectiles/Boss/ThanatosLaser.cs b/Projectiles/Boss/ThanatosLaser.cs index 24e844b4d6..75739ff077 100644 --- a/Projectiles/Boss/ThanatosLaser.cs +++ b/Projectiles/Boss/ThanatosLaser.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + Main.projFrames[Type] = 4; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -262,7 +262,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); Projectile.Center -= drawOffset; return false; } diff --git a/Projectiles/Boss/ThornBallSpike.cs b/Projectiles/Boss/ThornBallSpike.cs index 86d5b8d957..790a4288bb 100644 --- a/Projectiles/Boss/ThornBallSpike.cs +++ b/Projectiles/Boss/ThornBallSpike.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/ToxicCloud.cs b/Projectiles/Boss/ToxicCloud.cs index 81f4051732..c1c879d50c 100644 --- a/Projectiles/Boss/ToxicCloud.cs +++ b/Projectiles/Boss/ToxicCloud.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 10; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Boss { Projectile.damage = 0; } - else if (Projectile.frame >= Main.projFrames[Projectile.type]) + else if (Projectile.frame >= Main.projFrames[Type]) { Projectile.Kill(); } @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/UnstableCrimulanGlob.cs b/Projectiles/Boss/UnstableCrimulanGlob.cs index 5885c845be..5c2a01564d 100644 --- a/Projectiles/Boss/UnstableCrimulanGlob.cs +++ b/Projectiles/Boss/UnstableCrimulanGlob.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/UnstableEbonianGlob.cs b/Projectiles/Boss/UnstableEbonianGlob.cs index e0f48c3df2..2860149285 100644 --- a/Projectiles/Boss/UnstableEbonianGlob.cs +++ b/Projectiles/Boss/UnstableEbonianGlob.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Boss public class UnstableEbonianGlob : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetDefaults() { Projectile.Calamity().DealsDefenseDamage = true; @@ -28,9 +29,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive)) + if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive || Projectile.ai[0] == 1f)) { float velocityMult = BossRushEvent.BossRushActive ? 1.025f : CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1.005f; + + if (Projectile.ai[0] == 1f) + velocityMult += 0.02f; + Projectile.velocity *= velocityMult; } @@ -65,7 +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.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index 0580bbf1e2..7a461904d6 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/YharonBulletHellVortex.cs b/Projectiles/Boss/YharonBulletHellVortex.cs index f9ef9fa121..4fde90ccdf 100644 --- a/Projectiles/Boss/YharonBulletHellVortex.cs +++ b/Projectiles/Boss/YharonBulletHellVortex.cs @@ -4,6 +4,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -112,22 +113,23 @@ namespace CalamityMod.Projectiles.Boss Projectile.Kill(); } - internal Color ColorFunction(float completionRatio) => Color.Lerp(Color.Yellow, Color.Yellow, completionRatio); - public override bool PreDraw(ref Color lightColor) { - Texture2D vortexTexture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeVortex").Value; - for (int i = 0; i < 110; i++) + Main.spriteBatch.EnterShaderRegion(); + Texture2D vortexNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Cracks").Value; + GameShaders.Misc["CalamityMod:DoGPortal"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:DoGPortal"].UseColor(Color.Gold); + GameShaders.Misc["CalamityMod:DoGPortal"].UseSecondaryColor(Color.White); + GameShaders.Misc["CalamityMod:DoGPortal"].Apply(); + for (int i = 0; i < 10; i++) { - float angle = MathHelper.TwoPi * i / 50f + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; - Color drawColor = Color.White * 0.04f; + float angle = MathHelper.TwoPi * i / 10f + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; + Color drawColor = Color.White; drawColor.A = 0; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; - - drawPosition += (angle + Main.GlobalTimeWrappedHourly * i / 16f).ToRotationVector2() * 6f; - Main.EntitySpriteDraw(vortexTexture, drawPosition, null, drawColor, angle + MathHelper.PiOver2, vortexTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + Vector2 drawPosition = Projectile.Center - Main.screenPosition + angle.ToRotationVector2() * 3f; + Main.EntitySpriteDraw(vortexNoise, drawPosition, null, drawColor, angle + MathHelper.PiOver2, vortexNoise.Size() * 0.5f, Projectile.scale * 1.7f, SpriteEffects.None, 0); } - + Main.spriteBatch.ExitShaderRegion(); return false; } } diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index aa5a68dc69..2f8648e584 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 5; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -68,11 +68,11 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index 52db19e003..df9e249e70 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -22,9 +22,9 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 5; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; if (Projectile.ai[0] < TimeBeforeFalling) @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b0f5b94fb5..00aefb65a5 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,16 +1,19 @@ using System; using System.Collections.Generic; +using System.IO; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.EntitySources; +using CalamityMod.Enums; using CalamityMod.Events; +using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; -using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.Particles; @@ -21,6 +24,12 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Projectiles.VanillaProjectileOverrides; +using CalamityMod.Systems.Collections; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.AstralDesert; +using CalamityMod.Tiles.AstralSnow; +using CalamityMod.Tiles.Crags.Tree; using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.World; @@ -32,6 +41,7 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.Utilities; using Terraria.WorldBuilding; using static Terraria.ModLoader.ModContent; @@ -49,80 +59,152 @@ namespace CalamityMod.Projectiles } } - // Source variables. + /// + /// If true, this projectile was spawned from a dash hit.
+ /// Solely used to prevent the projectile from inflicting Vulnerability Hex when using the Aflame enchantment. + ///
public bool CreatedByPlayerDash = false; + /// + /// If a projectile is spawned from a hostile NPC, this variable is set to the index of the NPC.
+ /// Used for identifying which NPC to apply certain retaliatory effects on from projectiles hitting the player. + ///
+ public int ParentNPCIndex = -1; - // Speed cap for accelerating boss laser projectiles with 2 extraUpdates. + /// Constant variable used as a speed cap for boss laser projectiles with 2 extra updates. public const float AcceleratingBossLaserVelocityCap = 8f; - // Damage Adjusters + /// Constant variable used to determine the percentage a projectile's damage is reduced by pierce resist on each hit. public const float PierceResistHarshness = 0.12f; + /// Constant variable used to determine the maximum percentage a projectile's damage can be reduced by pierce resist. public const float PierceResistCap = 0.8f; - // defDamage was being used for frame1 hacks. this stands in as the replacement for that logic. + /// + /// Used for executing frame one hacks. Things set during this include: + ///
* Reducing projectile damage for Hardmode enemies and in Master Mode. + ///
* Adding armor penetration to rogue projectiles spawned while wearing Filthy Glove or its upgrades. + ///
* Increasing the damage of projectiles from the post-Moon Lord Dungeon, and from the post-DoG Pumpkin Moon, Frost Moon, and Solar Eclipse. + ///
private bool frameOneHacksExecuted = false; - // Enables "supercrits". When crit is over 100%, projectiles with this bool enabled can "supercrit". - // 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. - // 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 + /// + /// Enables "supercrits". When crit is over 100%, projectiles with this bool enabled can "supercrit".
+ /// For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage.
+ /// They then take the remainder 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.
+ /// 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; - // 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. + /// + /// Bonus damage on critical strikes expressed as a ratio.
+ /// 0f = 200% crit damage, vanilla standard.
+ /// 1f = 300% crit damage.

+ /// This applies independently of supercrits and will stack additively with them. + ///
+ public float bonusCritDamage = 0f; + + // 08MAR2025: This remains so that "delayed forced crits" can still be set. This is used for Marksman Ricoshots. + /// Set to true to force a projectile to critically strike. public bool forcedCrit = false; - // The total bonus damage (as a ratio of the projectile's own damage) applied to this projectile as a result of a ricoshot combo. + /// The total bonus damage (as a ratio of the projectile's own damage) applied to this projectile as a result of a ricoshot combo. public float totalRicoshotDamageBonus = 0f; - // If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. + /// 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 + /// + /// If true, this projectile is able to spawn lightning while using Arc Flash Ring.
+ /// This is set to false when lightning is procced, and is reset to true when the cooldown ends. + ///
+ public bool spawnArcFlash = true; + /// Cooldown variable for Arc Flash Ring's lightning. Primarily used for lingering projectiles and minions. + public int arcFlashCooldown = 0; + + /// + /// If true, adds a brimstone trail to the projectile, and makes it inflict Brimstone Flames.
+ /// Used by Animosity. + ///
public bool brimstoneBullets = false; - - // Adds fire to bullets, currently used by Thermocline Blaster + /// + /// If true, adds a fire trail to the projectile, and makes it inflict Hellfire.
+ /// Used by Thermocline Blaster. + ///
public bool fireBullet = false; - - // Adds ice to bullets, currently used by Thermocline Blaster + /// + /// If true, adds an ice trail to the projectile, and makes it inflict Frostbite.
+ /// Used by Thermocline Blaster. + ///
public bool iceBullet = false; - - // Adds shock to bullets, currently used by Arietes 41 + /// + /// If true, adds an electric trail to the projectile, and makes it inflict Electrified and create an explosion on hit.
+ /// 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 + /// + /// If true, adds a white trail to the projectile, and allows it to lifesteal.
+ /// 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 + /// + /// If true, this projectile creates visual impact sparks upon hitting enemies.
+ /// Used by Deepcore GK2. + ///
public bool deepcoreBullet = false; + /// + /// If true, adds a blue and pearly trail to the projectile, and makes it create an explosion on hit.
+ /// Used by Pearl God. + ///
+ public bool pearlBullet1 = false; + /// + /// If true, adds a pink and pearly trail to the projectile, and makes it create an explosion on hit.
+ /// Used by Pearl God. + ///
+ public bool pearlBullet2 = false; + /// + /// If true, adds a khaki and pearly trail to the projectile, and makes it create an explosion on hit.
+ /// Used by Pearl God. + ///
+ public bool pearlBullet3 = false; + /// + /// If true, adds a blue, pink, and khaki helix trail to the projectile, and allows it to lifesteal.
+ /// Used by Pearl God. + ///
+ public bool betterLifeBullet1 = false; + /// + public bool betterLifeBullet2 = false; + /// + /// If set to a value greater than 0, causes this projectile to gain homing with a range equal to the value in pixels.
+ /// Used by Arterial Assault. + ///
+ public float conditionalHomingRange = 0f; - // If true, causes all projectiles fired by this weapon to have homing. Currently used for Arterial Assault. - public bool allProjectilesHome = false; - - // Amount of extra updates that are set in SetDefaults. + /// + /// Variable used for storing the actual amount of extra updates a projectile has.
+ /// This is NOT set automatically, and must be set whenever it is needed. + ///
public int defExtraUpdates = -1; - // How many times this projectile has pierced. + /// + /// How many times this projectile has pierced an enemy which applies pierce resist.
+ /// Used for calculating pierce resist damage reduction. + ///
public int timesPierced = 0; - // Point-blank shot timer and distance check. + /// + /// If this projectile uses point-blank damage, this gets set to , then is decremented every frame.
+ /// If it reaches 0, this projectile can no longer deal point-blank damage. + ///
public int pointBlankShotDuration = 0; + /// + /// If this projectile uses point-blank damage, this value is incremented on every update by the distance the projectile traveled on that update.
+ /// If it exceeds , this projectile can no longer deal point-blank damage. + ///
public float pointBlankShotDistanceTravelled = 0f; + /// Constant variable which stores how many frames a projectile is allowed to deal point-blank damage. public const int DefaultPointBlankDuration = 18; // 18 frames + /// Constant variable which stores the maximum distance a projectile can travel to deal point-blank damage, in pixels. public const float PointBlankShotDistanceLimit = 240f; // 15 tiles // Empress of Light variables @@ -135,66 +217,121 @@ namespace CalamityMod.Projectiles 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 + /// Timer for how long a projectile's damage is reduced by the value in . public int flatDRTimer = 0; - /// - /// The amount of final damage substracted from the projectile's own damage count when hitting the player. Resets to 0 if the flatDRTimer variable drops to 0 - /// + /// A temporary flat amount subtracted from the projectile's damage when hitting the player. Resets to 0 if drops to 0. public int flatDR = 0; - /// - /// Allows hostile Projectiles to deal damage to the player's defense stat, used mostly for hard-hitting bosses. - /// + /// If true, allows hostile projectiles to deal defense damage to the player. Used mostly for hard-hitting bosses. public bool DealsDefenseDamage = false; - // Nihility Quiver + /// + /// Determines how this projectile's damage is affected by the Old Fashioned buff. This does not have an effect unless the player has the buff consumed.
+ /// If true, its damage is buffed. If false, its damage is nerfed. If null, its damage is unchanged. Defaults to null. + ///
+ public bool? buffedByOldFashioned; + /// If true, this projectile has been buffed by Quiver of Nihility's void fields. Used to ensure the buff is only applied once. public bool nihilicArrow = false; // Rogue Stuff + /// If true, this projectile is from a rogue stealth strike. The primary variable responsible for triggering stealth strike effects. public bool stealthStrike = false; + /// + /// Number of times this stealth strike projectile has pierced an enemy.
+ /// Used to limit the number of times a projectile can proc certain effects from rogue accessories. + ///
public int stealthStrikeHitCount = 0; + /// Variable to ensure that Ethereal Extorter's soul projectiles only spawn on projectiles spawning directly from item use. public bool extorterBoost = false; + /// + /// If true, this projectile is a Venerated Locket clone projectile.
+ /// Used to prevent certain rogue weapon and accessory effects. + ///
public bool LocketClone = false; + /// + /// If true, this projectile cannot proc projectile effects from rogue accessories.
+ /// Set this variable for projectiles that are prone to spawning an excessive amount of projectiles. + ///
public bool CannotProc = false; + /// Tracks whether this projectile has already triggered Scuttler's Jewel's projectile effect. public bool JewelSpikeSpawned = false; + /// Cooldown variable used to prevent projectiles from spawning orbs while in The Transformer's aura. + public int TransformerTimer = 0; + // 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. public int lineColor = 0; - // This flag is set to true on summon-classed attacks that are NOT minions, and thus should ALWAYS be able to hit enemies ALL the time. - // There are several enemies/NPCs in Calamity which do not take damage from minions in certain circumstances. + /// + /// There are several NPCs in Calamity which do not take damage from minions in certain circumstances.
+ /// If true, this variable allows a projectile that deals summon damage to bypass this mechanic. + ///
public bool overridesMinionDamagePrevention = false; // Enchantment variables. + /// + /// Variable used as a timer for minions with the Hellbound enchantment.
+ /// When spawned, this value is set to and gets decremented every frame. When it reaches 0, the minion explodes and despawns.
+ /// Also used for spawning smaller explosions and for scaling damage as the timer decreases. + ///
public int ExplosiveEnchantCountdown = 0; + /// Constant variable which stores the duration of minions with the Hellbound enchantment, in frames. public const int ExplosiveEnchantTime = 2400; - // Custom update priority. - // Calamity sorts projectiles by their update priority to fix otherwise absurdly difficult to resolve visual bugs on certain weapons. - // Examples include Mechworm segments detaching or Rancor's laser beam being offset from the magic circle. + /// + /// Custom update priority.
+ /// Calamity sorts projectiles by their update priority to fix otherwise absurdly difficult to resolve visual bugs on certain weapons.
+ /// Examples include Mechworm segments detaching or Rancor's laser beam being offset from the magic circle. + ///
public float UpdatePriority = 0f; #region On Spawn public override void OnSpawn(Projectile projectile, IEntitySource source) { + // TODO -- it would be nice to move frame one hacks here, but this runs in the middle of NewProjectile + // which is way too early, the projectile's own initialization isn't even done yet + CreatedByPlayerDash = source is ProjectileSource_PlayerDashHit; IEntitySource sourceItem = source as EntitySource_ItemUse_WithAmmo; if (sourceItem != null) extorterBoost = true; - // TODO -- it would be nice to move frame one hacks here, but this runs in the middle of NewProjectile - // which is way too early, the projectile's own initialization isn't even done yet + if (source is EntitySource_Parent { Entity: NPC npc }) + { + if (!npc.friendly) + ParentNPCIndex = npc.whoAmI; + } + + // Whenever the player has Daawnlight Spirit Origin, any ranged projectile will have the capacity to infintely supercrit. + if (Main.player[projectile.owner].Calamity().spiritOrigin && projectile.CountsAsClass()) + { + projectile.CritChance += Main.player[projectile.owner].Calamity().spiritOriginCritBoost; + projectile.Calamity().supercritHits = -1; + } } + public override void SendExtraAI(Projectile projectile, BitWriter bitWriter, BinaryWriter binaryWriter) => binaryWriter.Write(ParentNPCIndex); + public override void ReceiveExtraAI(Projectile projectile, BitReader bitReader, BinaryReader binaryReader) => ParentNPCIndex = binaryReader.ReadInt32(); #endregion On Spawn #region Set Defaults + public override void SetStaticDefaults() + { + // Making Rocket Launcher, Grenade Launcher, Proximity Mine Launcher, and Cluster Rocket fragments not damage the player. + for (int type = 0; type < ProjectileID.Count; type++) + { + if ((type >= 133 && type <= 144) || (type >= 776 && type <= 801)) + ProjectileID.Sets.RocketsSkipDamageForPlayers[type] = true; + } + } + public override void SetDefaults(Projectile projectile) { - // OLD 1.3 CODE: Disable Lunatic Cultist's homing resistance globally - // ProjectileID.Sets.CultistIsResistantTo[projectile.type] = false; + // This code is needed to ensure that the code for preventing damage multipliers from triggering more than once works + if (projectile.type == ProjectileID.ZapinatorLaser) + projectile.originalDamage = projectile.damage; // Apply Calamity Global Projectile Tweaks. SetDefaults_ApplyTweaks(projectile); @@ -284,7 +421,6 @@ namespace CalamityMod.Projectiles if (projectile.minion && ExplosiveEnchantCountdown > 0) { ExplosiveEnchantCountdown--; - projectile.damage = (int)(projectile.originalDamage * MathHelper.SmoothStep(1f, 1.6f, 1f - ExplosiveEnchantCountdown / (float)ExplosiveEnchantTime)); // Make fizzle sounds and fire dust to indicate the impending explosion. if (ExplosiveEnchantCountdown <= 300) @@ -390,7 +526,7 @@ namespace CalamityMod.Projectiles homingEndTime += 60f; // 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) + if (Vector2.Distance(projectile.Center, Main.player[num133].Center) < (revSkeletronPrimeHomingSkull ? ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 192f : 120f) : 96f) && projectile.ai[1] < homingEndTime) projectile.ai[1] = homingEndTime; if (projectile.ai[1] < homingEndTime && projectile.ai[1] > homingStartTime) @@ -508,10 +644,15 @@ namespace CalamityMod.Projectiles projectile.spriteDirection = projectile.direction; - if (projectile.direction < 0) - projectile.rotation = (float)Math.Atan2(0f - projectile.velocity.Y, 0f - projectile.velocity.X); + if (revSkeletronAcceleratingSkull) + projectile.rotation += MathHelper.Pi / 90f * projectile.velocity.Length() * projectile.direction; else - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + { + if (projectile.direction < 0) + projectile.rotation = (float)Math.Atan2(0f - projectile.velocity.Y, 0f - projectile.velocity.X); + else + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + } return false; } @@ -628,86 +769,6 @@ 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; @@ -1185,16 +1246,16 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.HallowBossRainbowStreak && projectile.hostile) { - bool revMasterMode = (Main.masterMode && CalamityWorld.revenge) || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool spreadOut = false; bool homeIn = false; float spreadOutCutoffTime = EmpressRainbowStreakSpreadOutCutoff; - float homeInCutoffTime = NPC.ShouldEmpressBeEnraged() ? (revMasterMode ? 55f : 65f) : (revMasterMode ? 70f : 80f); + float homeInCutoffTime = NPC.ShouldEmpressBeEnraged() ? (death ? 55f : 65f) : (death ? 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 minAcceleration = death ? 0.075f : 0.05f; + float maxAcceleration = death ? 0.15f : 0.1f; + float homingVelocity = death ? 36f : 30f; float maxVelocity = homingVelocity * 1.5f; float accelerationToMaxVelocity = 1.01f; @@ -1355,54 +1416,6 @@ namespace CalamityMod.Projectiles } } - else if (projectile.type == ProjectileID.Starfury) - { - if (projectile.timeLeft > 75) - projectile.timeLeft = 75; - - if (projectile.ai[1] == 0f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[1] = 1f; - projectile.netUpdate = true; - } - - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - SoundEngine.PlaySound(SoundID.Item9, projectile.Center); - } - - if (projectile.localAI[0] == 0f) - projectile.localAI[0] = 1f; - - projectile.alpha += (int)(25f * projectile.localAI[0]); - if (projectile.alpha > 200) - { - projectile.alpha = 200; - projectile.localAI[0] = -1f; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 1f; - } - - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; - - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - - if (Main.rand.NextBool(10)) - 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); - } - - return false; - } - // Copy pasted vanilla AI with minor changes to the homing distance and velocity formula else if (projectile.type == ProjectileID.SpiritFlame) { @@ -1515,80 +1528,6 @@ namespace CalamityMod.Projectiles return false; } - 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) @@ -2140,16 +2079,6 @@ 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; @@ -2491,29 +2420,6 @@ namespace CalamityMod.Projectiles 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, 0f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.6f / 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.RocketSkeleton && projectile.ai[1] >= 1f) { bool primeCannonProjectile = projectile.ai[1] == 2f; @@ -2647,8 +2553,9 @@ namespace CalamityMod.Projectiles return false; } - else if (projectile.type == ProjectileID.ThornBall && !projectile.tileCollide) + else if (projectile.type == ProjectileID.ThornBall && projectile.ai[2] != 0) { + projectile.tileCollide = false; if (projectile.alpha > 0) { projectile.alpha -= 30; @@ -2670,7 +2577,7 @@ namespace CalamityMod.Projectiles { int totalProjectiles = masterMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = ProjectileType(); float velocity = 1f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) @@ -3391,18 +3298,13 @@ namespace CalamityMod.Projectiles } else { - if (modPlayer.deadshotBrooch && projectile.CountsAsClass() && player.heldProj != projectile.whoAmI) - { - if (projectile.type != ProjectileType()) - projectile.extraUpdates += 1; - if (projectile.type == ProjectileID.MechanicalPiranha) - { - projectile.localNPCHitCooldown *= 2; - projectile.timeLeft *= 2; - } - } + // 13NOV2024: Ozzatron: Removed Deadshot Brooch extra updates. + // This mechanic was fundamentally unacceptable and was an invisible controlling hand that affected the development of dozens of ranged weapons. + // This has many knock-on effects going forward with many many ranged weapons, and will be a pain to test and correct for. + // I don't care. This effect had to be removed. + // - if (modPlayer.camper && !player.StandingStill()) + if ((projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) && (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0)) projectile.damage = (int)(projectile.damage * 0.1); if (projectile.CountsAsClass() && stealthStrike) @@ -3415,7 +3317,7 @@ namespace CalamityMod.Projectiles if (NPC.downedMoonlord) { - if (CalamityLists.dungeonProjectileBuffList.Contains(projectile.type)) + if (BuffedDungeonProjectilesList.Includes(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] > 0f; @@ -3430,7 +3332,7 @@ namespace CalamityMod.Projectiles if (DownedBossSystem.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) { - if (CalamityLists.eventProjectileBuffList.Contains(projectile.type)) + if (EventProjectileBuffList.Includes(projectile.type)) projectile.damage += 15; } @@ -3513,14 +3415,39 @@ namespace CalamityMod.Projectiles // 0: Spinning. 1: Being thrown. 2: Return after throw. 6: Dropped on ground. 4: Return after being dropped. if (projectile.ai[0] == 1f) { - projectile.ai[2]++; - if (projectile.ai[2] <= 11f) // When ai[1] reaches 14, it starts returning, so this makes it take an extra 11 frames to return - projectile.ai[1]--; + if (projectile.ai[1] > 0f) + { + projectile.ai[2]++; + if (projectile.ai[2] <= 11f) // When ai[1] reaches 14, it starts returning, so this makes it take an extra 11 frames to return + projectile.ai[1]--; + } + else + projectile.velocity *= 1.33f; } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f || projectile.ai[0] == 4f) - projectile.extraUpdates = 1; - else - projectile.extraUpdates = 0; + } + // Similar hacky solution for The Meatball + if (projectile.type == ProjectileID.TheMeatball) + { + if (projectile.ai[0] == 1f) + { + if (projectile.ai[1] > 0f) + { + projectile.ai[2]++; + if (projectile.ai[2] <= 7f) // When ai[1] reaches 14, it starts returning, so this makes it take an extra 7 frames to return + projectile.ai[1]--; + } + } + } + + // Starfury stars never collide with tiles + if (projectile.type == ProjectileID.Starfury) + projectile.tileCollide = false; + + // True Night's Edge projectiles instantly start with max velocity + if (projectile.type == ProjectileID.TrueNightsEdge) + { + if (projectile.localAI[1] < 32f) + projectile.localAI[1] = 32f; } // Random velocities for Bouncy Boulders in GFB @@ -3531,6 +3458,17 @@ namespace CalamityMod.Projectiles projectile.velocity *= Main.rand.NextFloat(0.9f, 1.25f); } + // Prevents them from being affected by gravity + if (projectile.type == ProjectileID.QueenBeeStinger) + projectile.ai[0]--; + + // Acceleration for certain lasers + if ((projectile.type == ProjectileID.EyeLaser || projectile.type == ProjectileID.DeathLaser || projectile.type == ProjectileID.FrostBeam) && projectile.ai[0] == 1f) + { + if (projectile.velocity.Length() < AcceleratingBossLaserVelocityCap) + projectile.velocity *= 1.0025f; + } + // Accelerate for 1.5 seconds to full velocity if (projectile.type == ProjectileID.HallowBossLastingRainbow && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) { @@ -3539,6 +3477,20 @@ namespace CalamityMod.Projectiles projectile.velocity *= ((Main.masterMode || BossRushEvent.BossRushActive) ? 1.017078f : 1.015525f); } + // Zapinator lasers cannot trigger their damage multiplier more than once + if (projectile.type == ProjectileID.ZapinatorLaser && projectile.damage > projectile.originalDamage) + { + if (projectile.ai[0] == 0f) + { + projectile.originalDamage = projectile.damage; + projectile.ai[0] = 1f; + } + else + { + projectile.damage = projectile.originalDamage; + } + } + // Golf Balls go nyoom on touching Auric Ore/Repulsers if (ProjectileID.Sets.IsAGolfBall[projectile.type]) { @@ -3639,7 +3591,7 @@ namespace CalamityMod.Projectiles if (!projectile.npcProj && !projectile.trap && projectile.friendly && projectile.damage > 0) { - if (modPlayer.fungalSymbiote && CalamityLists.MushroomProjectileIDs.Contains(projectile.type)) + if (modPlayer.fungalSymbiote && player.HasBuff(BuffType())) { if (Main.player[projectile.owner].miscCounter % 6 == 0 && projectile.FinalExtraUpdate()) { @@ -3681,7 +3633,6 @@ namespace CalamityMod.Projectiles if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { int damage = (int)player.GetTotalDamage().ApplyTo(60); - damage = player.ApplyArmorAccDamageBonusesTo(damage); Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); } } @@ -3693,7 +3644,6 @@ namespace CalamityMod.Projectiles if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { int damage = (int)player.GetTotalDamage().ApplyTo(42); - damage = player.ApplyArmorAccDamageBonusesTo(damage); int proj = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) @@ -3709,7 +3659,6 @@ namespace CalamityMod.Projectiles if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { int damage = (int)player.GetTotalDamage().ApplyTo(DragonScales.ShitBaseDamage); - damage = player.ApplyArmorAccDamageBonusesTo(damage); int proj = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 1.2f, ProjectileType(), damage, 0f, projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) @@ -3729,7 +3678,6 @@ namespace CalamityMod.Projectiles { // Daedalus Rogue Crystals: 2 x 25%, soft cap starts at 120 base damage int crystalDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30); - crystalDamage = player.ApplyArmorAccDamageBonusesTo(crystalDamage); for (int i = 0; i < 2; i++) { @@ -3810,7 +3758,7 @@ namespace CalamityMod.Projectiles } break; case CalamityGlobalBuff.ModdedFlaskEnchant: - 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); + int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); if (Main.rand.NextBool(4)) { Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(0.6f, 0.9f)); @@ -3830,7 +3778,7 @@ 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); + int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); 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)); @@ -3853,7 +3801,7 @@ namespace CalamityMod.Projectiles } // Adds Elemental Gauntlet dust to melee projectiles to mirror Fire Gauntlet's behavior. - if (modPlayer.eGauntlet && modPlayer.eGauntletVisuals && projectile.CountsAsClass() ) + if (modPlayer.eGauntlet && modPlayer.eGauntletVisuals && projectile.CountsAsClass()) { if (Main.rand.NextBool(3)) { @@ -3876,7 +3824,7 @@ namespace CalamityMod.Projectiles confetti.velocity.X += Main.rand.Next(-50, 51) * 0.05f; confetti.velocity.Y += Main.rand.Next(-50, 51) * 0.05f; } - if (Main.rand.NextBool(40) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(40) && !Main.dedServ) { int Type = Main.rand.Next(276, 283); Gore confetti = Gore.NewGoreDirect(projectile.GetSource_FromAI(), projectile.position, velocity, Type, 1f); @@ -3887,17 +3835,24 @@ namespace CalamityMod.Projectiles confetti.velocity.Y += Main.rand.Next(-50, 51) * 0.05f; } } - - if (allProjectilesHome) + // Support to help things like holdout swords work with Arc Flash Ring + if (!spawnArcFlash && projectile.numHits == 0) + spawnArcFlash = true; + // Cooldown for the arc flash so that long lasting projectiles (like dashing summons) can spawn multiple bolts + if (arcFlashCooldown >= 0) + arcFlashCooldown--; + if (arcFlashCooldown == 0) + spawnArcFlash = true; + if (conditionalHomingRange > 0f) { - CalamityUtils.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); + CalamityUtils.HomeInOnNPC(projectile, !projectile.tileCollide, conditionalHomingRange, 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 dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : DustType(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.5f, 1f); } @@ -4052,6 +4007,10 @@ namespace CalamityMod.Projectiles if (flatDRTimer <= 0) flatDR = 0; } + if (projectile.FinalExtraUpdate() && TransformerTimer > 0) + { + TransformerTimer--; + } // CIT 29JUN2024: Moved from PreAI to PostAI so that it is called every update instead of every frame. // This makes the distance traveled increment more accurately for projectiles with extra updates, as previously projectiles with extra updates @@ -4066,7 +4025,8 @@ namespace CalamityMod.Projectiles || projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.CorruptSpray || projectile.type == ProjectileID.CrimsonSpray - || projectile.type == ProjectileID.HallowSpray; + || projectile.type == ProjectileID.HallowSpray + || projectile.type == ProjectileID.Fertilizer; if (!isConversionProjectile) return; @@ -4077,10 +4037,39 @@ namespace CalamityMod.Projectiles bool isPowder = projectile.type == ProjectileID.PurificationPowder || projectile.type == ProjectileID.VilePowder || projectile.type == ProjectileID.ViciousPowder; + if (!WorldGen.InWorld(x, y, 3)) + return; + for (int i = x - 1; i <= x + 1; i++) { for (int j = y - 1; j <= y + 1; j++) { + if (projectile.type == ProjectileID.Fertilizer) + { + Tile tile = Main.tile[i, j]; + + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + bool isPlayerNear = WorldGen.PlayerLOS(i, j); + bool success = WorldGen.GrowTree(i, j); + if (success && isPlayerNear) + WorldGen.TreeGrowFXCheck(i, j); + } + else if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + bool isPlayerNear = WorldGen.PlayerLOS(i, j); + bool success = WorldGen.GrowPalmTree(i, j); + if (success && isPlayerNear) + WorldGen.TreeGrowFXCheck(i, j); + } + else if (tile.TileType == ModContent.TileType()) + { + bool isPlayerNear = WorldGen.PlayerLOS(i, j); + if (isPlayerNear && Main.tile[i, j + 1].TileType != ModContent.TileType()) + SpineTree.Spawn(i, j, 22, 28, true); + } + } + if (projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.PurificationPowder) { AstralBiome.ConvertFromAstral(i, j, ConvertType.Pure, !isPowder); @@ -4124,112 +4113,32 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - // Old Fashioned damage boost - if (modPlayer.oldFashioned) - { - // Yoyo bullshit - if (player.counterWeight > 0) - { - if (projectile.type >= ProjectileID.BlackCounterweight && projectile.type <= ProjectileID.YellowCounterweight) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } + // Old Fashioned buffs (or debuffs) apply if the player has Old Fashioned + if (modPlayer.oldFashioned && buffedByOldFashioned.HasValue) + modifiers.SourceDamage *= buffedByOldFashioned.Value ? OldFashioned.DamageBoostMultiplier : OldFashioned.DamageReductionMultiplier; - // Honey Balloon, Bee Cloak, Honey Comb, Stinger Necklace, Sweetheart Necklace - if (player.honeyCombItem != null && !player.honeyCombItem.IsAir) - { - if (projectile.type == ProjectileID.Bee) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Star Cloak, Mana Cloak, Star Veil, Bee Cloak - if (player.starCloakItem != null && !player.starCloakItem.IsAir) - { - if (projectile.type == ProjectileID.BeeCloakStar || projectile.type == ProjectileID.ManaCloakStar || projectile.type == ProjectileID.StarCloakStar) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Hive Pack - if (player.strongBees) - { - if (projectile.type == ProjectileID.GiantBee) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Bone Glove - if (player.boneGloveItem != null && !player.boneGloveItem.IsAir) - { - if (projectile.type == ProjectileID.BoneGloveProj) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Bone Helm - if (player.HasItem(ItemID.BoneHelm)) - { - if (projectile.type == ProjectileID.InsanityShadowFriendly) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Volatile Gelatin - if (player.volatileGelatin) - { - if (projectile.type == ProjectileID.VolatileGelatinBall) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Spore Sac - if (player.sporeSac) - { - if (projectile.type == ProjectileID.SporeTrap || projectile.type == ProjectileID.SporeTrap2 || - projectile.type == ProjectileID.SporeGas || projectile.type == ProjectileID.SporeGas2 || - projectile.type == ProjectileID.SporeGas3) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Spectre Mask bonus - if (player.ghostHurt) - { - if (projectile.type == ProjectileID.SpectreWrath) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Orichalcum Armor bonus - if (player.onHitPetal) - { - if (projectile.type == ProjectileID.FlowerPetal) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Titanium Armor bonus - if (player.onHitTitaniumStorm) - { - if (projectile.type == ProjectileID.TitaniumStormShard) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Forbidden Armor bonus - if (player.setForbidden) - { - if (projectile.type == ProjectileID.SandnadoFriendly) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - - // Stardust Armor bonus - if (player.setStardust) - { - if (projectile.type == ProjectileID.StardustGuardianExplosion || projectile.type == ProjectileID.StardustPunch) - modifiers.SourceDamage *= OldFashioned.AccessoryAndSetBonusDamageMultiplier; - } - } - - // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula. - // damageScale = 0.1f + player.velocity.Length() / 7f * 0.9f if (projectile.type == ProjectileID.JoustingLance || projectile.type == ProjectileID.HallowJoustingLance || projectile.type == ProjectileID.ShadowJoustingLance) { + // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula. + float vanillaVelocityDamageMultiplier = 0.1f + player.velocity.Length() / 7f * 0.9f; float baseVelocityDamageMultiplier = 0.01f + player.velocity.Length() * 0.002f; float calamityVelocityDamageMultiplier = 100f * (1f - (1f / (1f + baseVelocityDamageMultiplier))); - modifiers.SourceDamage *= calamityVelocityDamageMultiplier; + modifiers.SourceDamage *= calamityVelocityDamageMultiplier / vanillaVelocityDamageMultiplier; } + // Adamantite Throwing Axe's lightning has damage falloff. + if (projectile.type == ProjectileID.CultistBossLightningOrbArc && projectile.ai[2] == 1f) + { + if (projectile.numHits > 0) + projectile.damage = (int)(projectile.damage * 0.8f); + if (projectile.damage < 1) + projectile.damage = 1; + } + + // Stardust Wings buff the Stardust Guardian's damage. + if (player.wingsLogic == (int)VanillaWingID.WingsStardust && projectile.type == ProjectileID.StardustGuardian) + modifiers.SourceDamage *= 2f; + // If applicable, use ricoshot bonus damage. if (totalRicoshotDamageBonus > 0f) modifiers.ScalingBonusDamage += totalRicoshotDamageBonus; @@ -4244,6 +4153,10 @@ namespace CalamityMod.Projectiles if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj && !projectile.Calamity().CreatedByPlayerDash) target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); + // This can apply to minions or minion shots + if (ExplosiveEnchantCountdown > 0) + modifiers.SourceDamage *= MathHelper.SmoothStep(1f, 1.6f, 1f - ExplosiveEnchantCountdown / (float)ExplosiveEnchantTime); + if (modPlayer.farProximityRewardEnchant) { float proximityDamageInterpolant = Utils.GetLerpValue(250f, 2400f, target.Distance(player.Center), true); @@ -4268,7 +4181,7 @@ namespace CalamityMod.Projectiles // Create sparks on hit to hammer in the defense shredding. if (deepcoreBullet) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 cen = Vector2.Lerp(projectile.Center, target.Center, 0.65f); int numSparks = Main.rand.Next(2, 5); @@ -4287,7 +4200,6 @@ namespace CalamityMod.Projectiles 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; @@ -4388,7 +4300,7 @@ namespace CalamityMod.Projectiles #region Drawing public override Color? GetAlpha(Projectile projectile, Color lightColor) { - if (Main.player[Main.myPlayer].Calamity().trippy) + if (Main.LocalPlayer.Calamity().trippy) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); if (Main.LocalPlayer.Calamity().omniscience && projectile.hostile && projectile.damage > 0 && projectile.alpha < 255) @@ -4400,6 +4312,14 @@ namespace CalamityMod.Projectiles } } + if (projectile.type == ProjectileID.Skull && (projectile.ai[0] == -1f || projectile.ai[0] == -3f)) + { + float homingTime = ((Main.masterMode || BossRushEvent.BossRushActive) ? 120f : CalamityWorld.death ? 105f : 90f); + if (projectile.ai[0] == -3f) + homingTime += 60f; + return projectile.ai[1] >= homingTime ? new Color(184, 140, 255, projectile.alpha) : lightColor; + } + if (projectile.type == ProjectileID.BloodNautilusShot) return new Color(200, 0, 0, projectile.alpha); @@ -4468,6 +4388,10 @@ namespace CalamityMod.Projectiles public override bool PreDraw(Projectile projectile, ref Color lightColor) { + // This is used so that projectiles with specific PreDraws can still have Odd Mushroom clone drawing. + // If Odd Mushroom clone drawing is done manually due to using a different texture, just return false instead of setting this. + bool shouldDrawBool = true; + #region Vanilla Summons Drawing Changes // @@ -4475,8 +4399,10 @@ namespace CalamityMod.Projectiles // if (projectile.type == ProjectileID.Raven) - return RavenMinionAI.DoRavenMinionDrawing(projectile, ref lightColor); - + { + RavenMinionAI.DoRavenMinionDrawing(projectile, ref lightColor); + shouldDrawBool = false; + } #endregion if (projectile.type == ProjectileID.DeerclopsIceSpike && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) @@ -4510,161 +4436,63 @@ namespace CalamityMod.Projectiles Main.EntitySpriteDraw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), value26, alpha5, projectile.rotation, origin12, vector39, spriteEffects); + shouldDrawBool = false; + } + + if (projectile.type == ProjectileID.Skull && projectile.ai[0] == -2f) + { + Main.instance.LoadProjectile(ProjectileID.BoneGloveProj); + Texture2D crossbone = TextureAssets.Projectile[ProjectileID.BoneGloveProj].Value; + + Main.spriteBatch.Draw(crossbone, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, crossbone.Size() / 2f, projectile.scale, projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + if (Main.LocalPlayer.Calamity().trippy) + OddMushroomProjectileDrawing(projectile, crossbone); return false; } if (projectile.type == ProjectileID.DemonSickle) { - if (Main.wofNPCIndex < 0 || !Main.npc[Main.wofNPCIndex].active || Main.npc[Main.wofNPCIndex].life <= 0 || projectile.tileCollide) - return true; + if (!(Main.wofNPCIndex < 0 || !Main.npc[Main.wofNPCIndex].active || Main.npc[Main.wofNPCIndex].life <= 0 || projectile.tileCollide)) + { + Texture2D texture = ExtraTextureRefs.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; - 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; - 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); + if (Main.LocalPlayer.Calamity().trippy) + OddMushroomProjectileDrawing(projectile, texture); + return false; + } + } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), rectangle, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + // Manual drawing to adjust for scale change + if (projectile.type == ProjectileID.Terragrim || projectile.type == ProjectileID.Arkhalis) + { + Texture2D tex = TextureAssets.Projectile[projectile.type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Vector2 origin = frame.Size() / 2f; + SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - return false; + Main.spriteBatch.Draw(tex, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + shouldDrawBool = false; } // Chlorophyte Crystal AI rework. if (projectile.type == ProjectileID.CrystalLeaf) - return ChlorophyteCrystalAI.DoChlorophyteCrystalDrawing(projectile); - - if (Main.player[Main.myPlayer].Calamity().trippy) { - Texture2D texture = TextureAssets.Projectile[projectile.type].Value; - - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - 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 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); - - float smallDistanceMult = 0.48f; - float largeDistanceMult = 1.33f; - bool whatTheFuck = Main.player[Main.myPlayer].Calamity().trippyLevel == 3; - - switch (i) - { - case 0: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; - break; - - case 1: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; - break; - - 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(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); - } + ChlorophyteCrystalAI.DoChlorophyteCrystalDrawing(projectile); + shouldDrawBool = false; } + if (Main.LocalPlayer.Calamity().trippy) + OddMushroomProjectileDrawing(projectile); + if (Main.zenithWorld) { if (NPC.AnyNPCs(NPCType())) @@ -4676,15 +4504,143 @@ namespace CalamityMod.Projectiles } } - return true; + return shouldDrawBool; } + + private static void OddMushroomProjectileDrawing(Projectile projectile, Texture2D? tex = null) + { + Texture2D texture = tex ?? TextureAssets.Projectile[projectile.type].Value; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + 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.LocalPlayer.Calamity().trippyLevel == 3 ? 16 : (Main.LocalPlayer.Calamity().trippyLevel == 2 ? 12 : 4); + for (int i = 0; i < totalAfterimages; i++) + { + Vector2 position = projectile.position; + float distanceFromTargetX = Math.Abs(projectile.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(projectile.Center.Y - Main.LocalPlayer.Center.Y); + + float smallDistanceMult = 0.48f; + float largeDistanceMult = 1.33f; + bool whatTheFuck = Main.LocalPlayer.Calamity().trippyLevel == 3; + + switch (i) + { + case 0: + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; + break; + + case 1: + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; + break; + + case 2: + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; + break; + + case 3: + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; + break; + + case 4: // 1 o'clock position + position.X = Main.LocalPlayer.Center.X + (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.LocalPlayer.Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 5: // 4 o'clock position + position.X = Main.LocalPlayer.Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.LocalPlayer.Center.Y + (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 6: // 7 o'clock position + position.X = Main.LocalPlayer.Center.X - (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.LocalPlayer.Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 7: // 10 o'clock position + position.X = Main.LocalPlayer.Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.LocalPlayer.Center.Y - (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 8: // 11 o'clock position + position.X = Main.LocalPlayer.Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.LocalPlayer.Center.Y - (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 9: // 2 o'clock position + position.X = Main.LocalPlayer.Center.X + (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.LocalPlayer.Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 10: // 5 o'clock position + position.X = Main.LocalPlayer.Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.LocalPlayer.Center.Y + (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 11: // 8 o'clock position + position.X = Main.LocalPlayer.Center.X - (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.LocalPlayer.Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 12: + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY * 0.5f; + break; + + case 13: + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY * 0.5f; + break; + + case 14: + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY * 0.5f; + break; + + case 15: + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.LocalPlayer.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(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); + } + } #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 revQueenBeeBeeHive = projectile.type == ProjectileID.BeeHive && (CalamityWorld.revenge || BossRushEvent.BossRushActive) && (projectile.ai[2] == 1f || CalamityWorld.death); bool revGolemInferno = projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f; if (revQueenBeeBeeHive) @@ -4798,14 +4754,15 @@ namespace CalamityMod.Projectiles { 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 beeAmt = Main.rand.Next(2, 5 + 1); + int totalBeesAlive = NPC.CountNPCS(NPCID.Bee) + NPC.CountNPCS(NPCID.BeeSmall); + int finalBeeAmtToSpawn = NPC.AnyNPCs(NPCID.QueenBee) ? Math.Min(beeAmt, (Main.masterMode ? 9 : 15) - totalBeesAlive) : NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot(beeAmt); + for (int i = 0; i < finalBeeAmtToSpawn; i++) { - int beeType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); + int beeType = Main.rand.NextBool() ? NPCID.Bee : NPCID.BeeSmall; if (Main.zenithWorld) { - beeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); + beeType = Main.rand.NextBool(3) ? NPCType() : NPCType(); } else if (Main.masterMode || BossRushEvent.BossRushActive) { @@ -4887,7 +4844,6 @@ namespace CalamityMod.Projectiles Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); 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; @@ -4900,7 +4856,6 @@ namespace CalamityMod.Projectiles if (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; @@ -4928,10 +4883,10 @@ namespace CalamityMod.Projectiles public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier = 1f) { - if (Main.player[Main.myPlayer].moonLeech) + if (Main.LocalPlayer.moonLeech) return; - Main.player[Main.myPlayer].lifeSteal -= healAmount * cooldownMultiplier; + Main.LocalPlayer.lifeSteal -= healAmount * cooldownMultiplier; float lowestHealthCheck = 0f; int healTarget = projectile.owner; diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index ebbc95683f..3f29fce51a 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles { ProjectileID.Gradient, RebalanceYoyo(-1f, 384f, 36f, 1, 12) }, // original: 12s lifetime | 275px range | 15px/f top speed | 0 extra updates - { ProjectileID.HelFire, RebalanceYoyo(-1f, 368f, 42f, 2, 12) }, + { ProjectileID.HelFire, RebalanceYoyo(-1f, 352f, 42f, 2, 12) }, // original: 11s lifetime | 225px range | 14px/f top speed | 0 extra updates { ProjectileID.HiveFive, RebalanceYoyo(24f, 320f, 20f, 0, 15) }, @@ -115,7 +115,9 @@ namespace CalamityMod.Projectiles #region CATEGORY 2: Weapon/Enemy Balancing { ProjectileID.AdamantiteChainsaw, standardChainsawTweaks }, { ProjectileID.AdamantiteDrill, standardDrillTweaks }, + { ProjectileID.AdamantiteGlaive, Do(TrueMelee, LocalIFrames(7)) }, { ProjectileID.Anchor, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.Arkhalis, Do(TrueMeleeNoSpeed, ScaleExact(1.25f)) }, { ProjectileID.Bee, Do(PiercingExact(2)) }, { ProjectileID.BeeArrow, Do(PointBlank, ExtraUpdatesExact(1)) }, { ProjectileID.BlackCounterweight, counterweightTweaks }, @@ -129,6 +131,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ChlorophyteOrb, Do(NoPiercing) }, { ProjectileID.CobaltChainsaw, standardChainsawTweaks }, { ProjectileID.CobaltDrill, standardDrillTweaks }, + { ProjectileID.CobaltNaginata, Do(TrueMelee, LocalIFrames(9)) }, { ProjectileID.CrystalBullet, standardBulletTweaks }, { ProjectileID.CrystalVileShardHead, Do(LocalIFrames(23)) }, { ProjectileID.CrystalVileShardShaft, Do(LocalIFrames(23)) }, @@ -155,6 +158,7 @@ namespace CalamityMod.Projectiles { ProjectileID.FrostBoltStaff, Do(ExtraUpdatesExact(1)) }, { ProjectileID.FruitcakeChakram, Do(ExtraUpdatesExact(1)) }, { ProjectileID.GiantBee, Do(PiercingExact(2)) }, + { ProjectileID.GladiusStab, Do(TrueMelee, LocalIFrames(-1)) }, { ProjectileID.GoldenBullet, standardBulletTweaks }, { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2)) }, { ProjectileID.GreenCounterweight, counterweightTweaks }, @@ -176,6 +180,7 @@ namespace CalamityMod.Projectiles { ProjectileID.MoonlordBullet, standardBulletTweaks }, // Luminite Bullet { ProjectileID.MythrilChainsaw, standardChainsawTweaks }, { ProjectileID.MythrilDrill, standardDrillTweaks }, + { ProjectileID.MythrilHalberd, Do(TrueMelee, LocalIFrames(8)) }, { ProjectileID.NanoBullet, standardBulletTweaks }, { ProjectileID.NebulaDrill, standardDrillTweaks }, { ProjectileID.NebulaLaser, Do(ExtraUpdatesDelta(-1)) }, @@ -198,9 +203,11 @@ namespace CalamityMod.Projectiles { ProjectileID.Shroomerang, Do(ExtraUpdatesExact(1)) }, { ProjectileID.SolarFlareDrill, standardDrillTweaks }, { ProjectileID.StardustDrill, standardDrillTweaks }, + { ProjectileID.Starfury, Do(TimeLeftExact(75)) }, { ProjectileID.StarWrath, Do(NoPiercing) }, { ProjectileID.Sunfury, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(1)) }, // Beam Sword projectile + { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(2)) }, // Beam Sword projectile + { ProjectileID.Terragrim, Do(TrueMeleeNoSpeed, ScaleExact(1.25f)) }, { ProjectileID.ThunderStaffShot, Do(PiercingExact(3)) }, //Thunder Zapper projectile { ProjectileID.TitaniumChainsaw, standardChainsawTweaks }, { ProjectileID.TitaniumDrill, standardDrillTweaks }, @@ -210,18 +217,14 @@ namespace CalamityMod.Projectiles { ProjectileID.VenomFang, Do(LocalIFrames(10)) }, { ProjectileID.VortexDrill, standardDrillTweaks }, { ProjectileID.Wasp, Do(PiercingExact(2)) }, - { ProjectileID.WeatherPainShot, Do(ExtraUpdatesExact(2), TimeLeftExact(1400)) }, + { ProjectileID.WeatherPainShot, Do(ExtraUpdatesExact(3), TimeLeftExact(1920)) }, { ProjectileID.YellowCounterweight, counterweightTweaks }, #endregion #region CATEGORY 3: True Melee support - { ProjectileID.AdamantiteGlaive, trueMelee }, - { ProjectileID.Arkhalis, trueMeleeNoSpeed }, { ProjectileID.ChlorophyteJackhammer, trueMeleeNoSpeed }, - { ProjectileID.CobaltNaginata, trueMelee }, { ProjectileID.CopperShortswordStab, trueMelee }, { ProjectileID.DarkLance, trueMelee }, - { ProjectileID.GladiusStab, trueMelee }, { ProjectileID.GoldShortswordStab, trueMelee }, { ProjectileID.Gungnir, trueMelee }, { ProjectileID.HallowJoustingLance, trueMelee }, @@ -229,7 +232,6 @@ namespace CalamityMod.Projectiles { ProjectileID.JoustingLance, trueMelee }, { ProjectileID.LeadShortswordStab, trueMelee }, { ProjectileID.MushroomSpear, trueMelee }, - { ProjectileID.MythrilHalberd, trueMelee }, { ProjectileID.NebulaChainsaw, trueMeleeNoSpeed }, { ProjectileID.ObsidianSwordfish, trueMelee }, { ProjectileID.OrichalcumHalberd, trueMelee }, @@ -243,7 +245,6 @@ namespace CalamityMod.Projectiles { ProjectileID.Spear, trueMelee }, { ProjectileID.StardustChainsaw, trueMeleeNoSpeed }, { ProjectileID.Swordfish, trueMelee }, - { ProjectileID.Terragrim, trueMeleeNoSpeed }, { ProjectileID.TheRottedFork, trueMelee }, { ProjectileID.TinShortswordStab, trueMelee }, { ProjectileID.TitaniumTrident, trueMelee }, diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs b/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs deleted file mode 100644 index 80877b95ca..0000000000 --- a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs +++ /dev/null @@ -1,57 +0,0 @@ -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Damageable -{ - public class ArtifactOfResilienceBulwark : DamageableProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public int Reformations = 0; - public const int MaxReformations = 3; - public override int LifeMax => 1; - public override int MaxDamageImmunityFrames => 5; - public override DamageSourceType DamageSources => DamageSourceType.FriendlyProjectiles | DamageSourceType.HostileProjectiles | DamageSourceType.HostileNPCs; - public override SoundStyle HitSound => SoundID.NPCHit3; - public override SoundStyle DeathSound => SoundID.NPCDeath14; - public override void SafeSetDefaults() - { - Projectile.width = Projectile.height = 76; - Projectile.friendly = true; - Projectile.penetrate = 20; - } - - public override void SafeAI() - { - Projectile.rotation += MathHelper.ToRadians(8f); - Vector2 spawnPosition = Projectile.Center + Utils.NextVector2Circular(Main.rand, Projectile.width, Projectile.height) / 2f; - for (int i = 0; i < 8; i++) - { - Dust dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.ProfanedFire); - dust.velocity = Projectile.DirectionFrom(spawnPosition); - dust.scale = Main.rand.NextFloat(1.1f, 1.5f); - dust.noGravity = true; - } - } - public override void DamageKillEffect() - { - Utils.PoofOfSmoke(Projectile.Center); - } - public override void OnKill(int timeLeft) - { - for (int i = 1; i <= 6; i++) - { - if (Main.myPlayer == Projectile.owner) - { - float angle = MathHelper.TwoPi / 6f * (i - 1); - Projectile shard = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, Mod.Find("ArtifactOfResilienceShard" + i.ToString()).Type, Projectile.damage, Projectile.knockBack, Projectile.owner); - shard.ai[0] = angle; - shard.frameCounter = Projectile.frameCounter + 1; // FrameCounter is a stored value for the amount of times the bulwark has reformed. - } - } - } - } -} diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.png b/Projectiles/Damageable/ArtifactOfResilienceBulwark.png deleted file mode 100644 index 97f00c91bd..0000000000 Binary files a/Projectiles/Damageable/ArtifactOfResilienceBulwark.png and /dev/null differ diff --git a/Projectiles/Damageable/DamageableProjectile.cs b/Projectiles/Damageable/DamageableProjectile.cs index 91d14e4f9d..123e64c7a8 100644 --- a/Projectiles/Damageable/DamageableProjectile.cs +++ b/Projectiles/Damageable/DamageableProjectile.cs @@ -311,7 +311,7 @@ namespace CalamityMod.Projectiles.Damageable if (!Main.mouseText) { Rectangle mouseRectangle = new Rectangle((int)(Main.mouseX + Main.screenPosition.X), (int)(Main.mouseY + Main.screenPosition.Y), 1, 1); - if (Main.player[Main.myPlayer].gravDir == -1f) + if (Main.LocalPlayer.gravDir == -1f) { mouseRectangle.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY; } diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs index 7a763570fa..c143c8b02b 100644 --- a/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs @@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Animate the projectile Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Type]; } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; int yPos = texture.Height / Main.projFrames[Type] * Projectile.frame; Main.EntitySpriteDraw(texture, Projectile.position - Main.screenPosition, diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs index f910d2c453..a1b875a79d 100644 --- a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.timeLeft = 12; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Main.projFrames[Projectile.type] = 18; + Main.projFrames[Type] = 18; } public override void AI() @@ -122,9 +122,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal private void DrawPlasmaBeam(Color beamColor, float scale, int startFrame = 0, int middleFrame = 0, int endFrame = 0) { - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, startFrame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, middleFrame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, endFrame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, startFrame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, middleFrame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, endFrame); // Start texture drawing. Main.EntitySpriteDraw(LaserBeginTexture, diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs index c140f94636..4bd40a578c 100644 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs +++ b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs @@ -19,8 +19,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const int Lifetime = 240; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs b/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs index e51c3a9d58..d552e4e2b2 100644 --- a/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs +++ b/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 90; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 90; } public override void SetDefaults() @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 1b90b5bb90..afe5e4399e 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Projectile.frameCounter = 10; Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; } diff --git a/Projectiles/DraedonsArsenal/GaussPistolShot.cs b/Projectiles/DraedonsArsenal/GaussPistolShot.cs index 552d68adc5..8b69e78d76 100644 --- a/Projectiles/DraedonsArsenal/GaussPistolShot.cs +++ b/Projectiles/DraedonsArsenal/GaussPistolShot.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const float ChargeTime = 30f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 12; } public override void SetDefaults() diff --git a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs index ca19c0f2e9..c45efa1f29 100644 --- a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs +++ b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.width = Projectile.height = 40; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; Projectile.timeLeft = 300; } diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index 9a99cf55b4..6ef1364726 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Projectile.frameCounter % 4f == 3f) { Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -79,6 +79,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal modItem.Charge -= HydraulicVoltCrasher.HoldoutChargeUse; float speed = Owner.inventory[Owner.selectedItem].shootSpeed * Projectile.scale; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toPointTo = Main.MouseWorld; if (Owner.gravDir == -1f) { @@ -170,7 +171,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal return false; } } - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), npc.Center, + Projectile.NewProjectile(Projectile.GetSource_FromThis(), npc.Center, Vector2.Zero, attackType, Projectile.damage, @@ -183,8 +184,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs index b0e8e818b4..fe98ee4a84 100644 --- a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs +++ b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 4e1fd3599e..e51fce714d 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs index 996aca33d1..e925397619 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs @@ -28,9 +28,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { Player player = Main.player[Projectile.owner]; - Projectile.Center = player.Center + AngularOffsetRelativeToPlayer.ToRotationVector2() * OffsetDistanceFromPlayer; + Projectile.Center = player.Center + AngularOffsetRelativeToPlayer.ToRotationVector2() * OffsetDistanceFromPlayer + Vector2.UnitY * player.gfxOffY; GrantBuffs(player); NPC potentialTarget = Projectile.Center.MinionHoming(960f, player); diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs index 0246fc0784..1299ef33d0 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerBeam.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.Projectiles.DraedonsArsenal { @@ -12,7 +13,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const int Lifetime = 180; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D bladeTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D bladeTexture = Terraria.GameContent.TextureAssets.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 d11e1de3a4..4594581636 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -63,8 +63,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 13; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 13; } public override void SetDefaults() @@ -132,6 +132,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal bool hasCharge = modItem.Charge > 0f; if (!player.CantUseHoldout() && playerItem.type == ModContent.ItemType() && hasCharge) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, the effect is capped separately // 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); float distRatio = Utils.GetLerpValue(0f, MaximumMouseRange, mouseDistance, true); @@ -144,10 +145,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Also flag for netcode sync if applicable (this is the only way the sword can rotate in multiplayer). float newRotation = Projectile.rotation.AngleLerp(player.AngleTo(Main.MouseWorld), aimResponsiveness); if (Projectile.rotation != newRotation) - { - Projectile.netUpdate = true; - Projectile.netSpam = 0; // You cannot stop Phaseslayer from sending packets. - } + Projectile.ForceNetUpdate(); // You cannot stop Phaseslayer from sending packets. Projectile.rotation = newRotation; } @@ -296,7 +294,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { Texture2D bladeTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBlade").Value; - Texture2D hiltTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D hiltTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (IsSmall) bladeTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBladeSmall").Value; diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs b/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs index f2e91c5f2c..f85af545bb 100644 --- a/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs +++ b/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 61308df0d2..9501d9e619 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -1,7 +1,9 @@ using System; using CalamityMod.Buffs.Summon; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal @@ -23,10 +25,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; } public override void SetDefaults() @@ -173,7 +175,23 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, 1, lightColor, 2); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Color drawColor = Projectile.GetAlpha(lightColor); + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + if (i % 2 == 0) + continue; + + Color trailColor = Color.Lerp(drawColor, Color.Transparent, i / (float)Projectile.oldPos.Length) * 0.67f; + Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.EntitySpriteDraw(tex, trailPos, null, trailColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/DraedonsArsenal/PulsePistolShot.cs b/Projectiles/DraedonsArsenal/PulsePistolShot.cs index 86a4fa01e8..55ad51e8d3 100644 --- a/Projectiles/DraedonsArsenal/PulsePistolShot.cs +++ b/Projectiles/DraedonsArsenal/PulsePistolShot.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public List NPCsAlreadyHit = new List(); public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index 0a839d89b6..9c88cdbd0e 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -1,12 +1,7 @@ -using System; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Ranged; -using Humanizer; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -27,6 +22,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal private NPC lastTarget = null; private float distance; private int timesItCanHit = 3; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 16; @@ -211,16 +208,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Projectile.localAI[0] == createDustVar && notSplit) PulseBurst(4f, 5f); } - - public override bool? CanHitNPC(NPC target) => doDamage ? null : false; + public override bool? CanDamage() => (doDamage ? null : false); public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { bool onKill = (target.life <= 0 && target.realLife == -1); if (notSplit) { - Projectile.Kill(); - for (int i = 0; i <= 9; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 66); @@ -246,13 +240,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.Zero) * (14f - i * 0.7f)) * ((i + 1) * 0.25f), Projectile.type, projectileDamage, Projectile.knockBack, Projectile.owner, 0f, 1f + i); } + Projectile.Kill(); } // Split projectile on hit effects else { - // Set some values to get ready foir it to home again for its next hit + // Set some values to get ready for it to home again for its next hit lastTarget = target; distance = 3000; Projectile.localAI[0] = 60; diff --git a/Projectiles/DraedonsArsenal/PulseTurret.cs b/Projectiles/DraedonsArsenal/PulseTurret.cs index 80ee8dd273..e820312872 100644 --- a/Projectiles/DraedonsArsenal/PulseTurret.cs +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public new string LocalizationCategory => "Projectiles.Misc"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { Texture2D standTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseTurretStand").Value; - Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, + Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.Projectile[Type].Value, Projectile.Center - ((standTexture.Height / 2 + 6f) * Vector2.UnitY) - Main.screenPosition, null, lightColor, diff --git a/Projectiles/DraedonsArsenal/PulseTurretShot.cs b/Projectiles/DraedonsArsenal/PulseTurretShot.cs index 399d27b79d..7bd968780f 100644 --- a/Projectiles/DraedonsArsenal/PulseTurretShot.cs +++ b/Projectiles/DraedonsArsenal/PulseTurretShot.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const int SpiralRings = 6; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs index affaef2451..45174b4fd5 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; // While this projectile doesn't have afterimages, it keeps track of old positions for its primitive drawcode. ProjectileID.Sets.TrailingMode[Type] = 2; @@ -179,7 +180,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 18ad44c4b2..fc95a46d89 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -64,6 +64,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Checks if the minion can still exist given the player's circumstance. CheckMinionExistence(); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // The properties of the minion's pupil, it looks around the target if there's one and to the mouse if there isn't any. EyeAngle = Projectile.SafeDirectionTo((Target is not null) ? Target.Center : Main.MouseWorld).ToRotation(); EyeOutwardness = Utils.Remap(Projectile.Distance((Target is not null) ? Target.Center : Main.MouseWorld), 0f, 300f, 0f, 5f); @@ -240,7 +241,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 d4ac4417e8..5d981f5dc8 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const float Gravity = 0.25f; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127) * Projectile.Opacity, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], new Color(255, 255, 255, 127) * Projectile.Opacity, 2); return false; } } diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index 6de89b202f..526dcb0227 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 12; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -271,8 +271,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(2, Main.projFrames[Projectile.type], ReleasingAcid.ToInt(), Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(2, Main.projFrames[Type], ReleasingAcid.ToInt(), Projectile.frame); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, diff --git a/Projectiles/DraedonsArsenal/SystemBaneLightning.cs b/Projectiles/DraedonsArsenal/SystemBaneLightning.cs index 3abc224117..cc55d1bebf 100644 --- a/Projectiles/DraedonsArsenal/SystemBaneLightning.cs +++ b/Projectiles/DraedonsArsenal/SystemBaneLightning.cs @@ -26,8 +26,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public static readonly Color InnerLightningColor = Color.White; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 60; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 60; } public override void SetDefaults() { @@ -81,8 +82,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Main.rand.NextBool(5)) { Projectile.velocity = Projectile.velocity.RotatedByRandom(0.9f); - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } } @@ -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, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, start, end, new Vector2(OuterLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Utils.DrawLaser(Main.spriteBatch, Terraria.GameContent.TextureAssets.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, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, start, end, new Vector2(InnerLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Utils.DrawLaser(Main.spriteBatch, Terraria.GameContent.TextureAssets.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 51ade30681..ffccae3cda 100644 --- a/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs +++ b/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Time % LightningFireRate == 0f && Main.myPlayer == Projectile.owner) { int lightningDamage = Projectile.damage; - int totalSystemBanes = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; + int totalSystemBanes = Main.player[Projectile.owner].ownedProjectileCounts[Type]; // Make the damage of the lightning have diminishing returns depending on how many systems are present. lightningDamage = (int)Math.Ceiling(lightningDamage / Math.Pow(totalSystemBanes, 1D / 3D)); diff --git a/Projectiles/DraedonsArsenal/TaserHook.cs b/Projectiles/DraedonsArsenal/TaserHook.cs index b729eb0c54..fc876533ee 100644 --- a/Projectiles/DraedonsArsenal/TaserHook.cs +++ b/Projectiles/DraedonsArsenal/TaserHook.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { Player player = Main.player[Projectile.owner]; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 d0a4e1bc1f..4192ec59b2 100644 --- a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs +++ b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal private int arcs = 0; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs index 6ce29dbe3a..7e42868aea 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal get => Projectile.localAI[0]; set => Projectile.localAI[0] = value; } + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 2; diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index 9184114052..5bb2ae7fd9 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -35,8 +35,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, ProjectileID.Sets.TrailCacheLength[Projectile.type]); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, ProjectileID.Sets.TrailCacheLength[Type]); return false; } } diff --git a/Projectiles/Enemy/AstralMeteorProj.cs b/Projectiles/Enemy/AstralMeteorProj.cs index 9048e87fa1..0f43d65bcf 100644 --- a/Projectiles/Enemy/AstralMeteorProj.cs +++ b/Projectiles/Enemy/AstralMeteorProj.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 4; } public override void SetDefaults() @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Enemy } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreCount = 3; Vector2 goreSource = Projectile.Center; diff --git a/Projectiles/Enemy/BelchingCoralSpike.cs b/Projectiles/Enemy/BelchingCoralSpike.cs index 5bb82dcfd8..d9c6fce5e7 100644 --- a/Projectiles/Enemy/BelchingCoralSpike.cs +++ b/Projectiles/Enemy/BelchingCoralSpike.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Enemy/CrabBoulder.cs b/Projectiles/Enemy/CrabBoulder.cs index 4a332d07f3..0043b4923b 100644 --- a/Projectiles/Enemy/CrabBoulder.cs +++ b/Projectiles/Enemy/CrabBoulder.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.cs b/Projectiles/Enemy/CragmawVibeCheckChain.cs index 1b4a1cd930..8bcb308698 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D endTexture = Terraria.GameContent.TextureAssets.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 c44c0e7349..02fc31ab07 100644 --- a/Projectiles/Enemy/CrimsonSpike.cs +++ b/Projectiles/Enemy/CrimsonSpike.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Enemy public class CrimsonSpike : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Enemy"; + public override void SetDefaults() { Projectile.width = 6; @@ -62,9 +63,7 @@ namespace CalamityMod.Projectiles.Enemy Color dustColor = Color.Crimson; dustColor.A = 150; for (int k = 0; k < 5; k++) - { 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); - } } public override bool PreDraw(ref Color lightColor) @@ -72,7 +71,7 @@ namespace CalamityMod.Projectiles.Enemy 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index adb9ae03d4..6d24b0c175 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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; } @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Enemy Main.dust[earthyDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index 4620b5eee9..3ce772af66 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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.Enemy Main.dust[earthyDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Enemy/FlakAcid.cs b/Projectiles/Enemy/FlakAcid.cs index 3edadc017d..bb83aa3073 100644 --- a/Projectiles/Enemy/FlakAcid.cs +++ b/Projectiles/Enemy/FlakAcid.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/GammRayBurst.cs b/Projectiles/Enemy/GammRayBurst.cs index 0c8edea13a..54f9905839 100644 --- a/Projectiles/Enemy/GammRayBurst.cs +++ b/Projectiles/Enemy/GammRayBurst.cs @@ -30,15 +30,15 @@ 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 => Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + public override Texture2D LaserBeginTexture => Terraria.GameContent.TextureAssets.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"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + Main.projFrames[Type] = 5; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Enemy // Determine frames. Projectile.frameCounter++; if (Projectile.frameCounter % 5f == 0f) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } public float LaserWidthFunction(float _) => Projectile.scale * Projectile.width + 180; diff --git a/Projectiles/Enemy/GammaAcid.cs b/Projectiles/Enemy/GammaAcid.cs index f917bb3e8e..b355a8e34d 100644 --- a/Projectiles/Enemy/GammaAcid.cs +++ b/Projectiles/Enemy/GammaAcid.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/HorsPoisonBlast.cs b/Projectiles/Enemy/HorsPoisonBlast.cs new file mode 100644 index 0000000000..c4a1ae5515 --- /dev/null +++ b/Projectiles/Enemy/HorsPoisonBlast.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorsPoisonBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Enemy"; + public override string Texture => "CalamityMod/Projectiles/Magic/VitriolicViperSpit"; + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 6; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.alpha = 15; + Projectile.timeLeft = 60; + } + + public override void AI() + { + if (Projectile.velocity.Length() < 0.08f) + Projectile.alpha += 15; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Main.rand.NextBool(3)) + { + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Venom); + Main.dust[d].noGravity = true; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } + + public override void OnKill(int timeLeft) + { + float totalDusts = 18f; + for (float i = 0f; i < totalDusts; i++) + { + Vector2 ringSpeed = new Vector2((float)Math.Cos(i / totalDusts * MathHelper.TwoPi), (float)Math.Sin(i / totalDusts * MathHelper.TwoPi) * 0.5f).RotatedBy(Projectile.rotation) * 4f * Projectile.scale; + Dust droplets = Dust.NewDustPerfect(Projectile.Center, DustID.Venom, ringSpeed, 100); + droplets.noGravity = true; + } + } + } +} diff --git a/Projectiles/Enemy/IceClasperEnemyProjectile.cs b/Projectiles/Enemy/IceClasperEnemyProjectile.cs index f9c5b9df8e..8217a565d5 100644 --- a/Projectiles/Enemy/IceClasperEnemyProjectile.cs +++ b/Projectiles/Enemy/IceClasperEnemyProjectile.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 4; } public override void SetDefaults() @@ -51,8 +51,8 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - if (CalamityConfig.Instance.Afterimages) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + if (CalamityClientConfig.Instance.Afterimages) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return true; } diff --git a/Projectiles/Enemy/InkBombHostile.cs b/Projectiles/Enemy/InkBombHostile.cs index 5a60fec270..28acf8fd17 100644 --- a/Projectiles/Enemy/InkBombHostile.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -42,10 +42,10 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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]); + Rectangle rectangle = new(0, tex.Height / Main.projFrames[Type] * Projectile.frame, tex.Width, tex.Height / Main.projFrames[Type]); Main.EntitySpriteDraw(tex, vector, rectangle, Color.DarkGray, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Enemy/InkPoisonCloud.cs b/Projectiles/Enemy/InkPoisonCloud.cs index d74d2a8f1e..7fd5c520a6 100644 --- a/Projectiles/Enemy/InkPoisonCloud.cs +++ b/Projectiles/Enemy/InkPoisonCloud.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Enemy { Projectile.damage = 0; } - else if (Projectile.frame >= Main.projFrames[Projectile.type]) + else if (Projectile.frame >= Main.projFrames[Type]) { Projectile.Kill(); } @@ -61,11 +61,11 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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); - Rectangle rectangle = new(0, tex.Height / Main.projFrames[Projectile.type] * Projectile.frame, tex.Width, tex.Height / Main.projFrames[Projectile.type]); + Rectangle rectangle = new(0, tex.Height / Main.projFrames[Type] * Projectile.frame, tex.Width, tex.Height / Main.projFrames[Type]); Main.EntitySpriteDraw(tex, vector, rectangle, Color.White * 0.75f, Projectile.rotation, drawOrigin, Projectile.scale * 1.2f, effects, 0); return true; diff --git a/Projectiles/Enemy/JellyghoulBolt.cs b/Projectiles/Enemy/JellyghoulBolt.cs new file mode 100644 index 0000000000..bf9edbf051 --- /dev/null +++ b/Projectiles/Enemy/JellyghoulBolt.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class JellyghoulBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Progress => 1 - Projectile.timeLeft / (float)300; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + Main.projFrames[Type] = 20; + } + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + } + public override void AI() + { + Lighting.AddLight(Projectile.Center, 1f * Projectile.Opacity, 0.1f * Projectile.Opacity, 0.1f); + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Type]; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Projectile.ai[0]++; + if (Projectile.ai[0] % 5 == 0) + { + Color pulseColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.Red : Color.DarkRed) : (Main.rand.NextBool() ? Color.OrangeRed : Color.IndianRed); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.2f + 0.2f * (1 - Progress), 10); + GeneralParticleHandler.SpawnParticle(pulse); + } + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.CrimsonTorch, Scale: 1.5f); + dust.noGravity = true; + dust.velocity = Vector2.Zero; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 3; i++) + { + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.Brimstone, 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.Brimstone, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/BlobbyNoise")); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseImage2("Images/Extra_189"); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(Color.Red); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(Color.OrangeRed); + + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int projFrame = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; + int y6 = projFrame * Projectile.frame; + + /*Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D ring = ModContent.Request("CalamityMod/Particles/HollowCircleHardEdge").Value; + for (int j = 0; j < 2; j++) + { + for (int i = 2; i < 7; i += 2) + { + Main.spriteBatch.Draw(ring, Projectile.oldPos[i] + Projectile.Size / 2 - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), null, Color.Red * Projectile.Opacity, Projectile.velocity.ToRotation(), ring.Size() / 2, new Vector2(0.5f, 1) * 0.2f * MathHelper.Lerp(1f, 0.5f, (i - 2) / 3f), SpriteEffects.None, 0); + } + } + Main.spriteBatch.ExitShaderRegion();*/ + return false; + } + public float SlashWidthFunction(float _) => 16 * Utils.GetLerpValue(0f, 0.1f, _, true); + + public Color SlashColorFunction(float _) => Color.IndianRed * Projectile.Opacity; + } +} diff --git a/Projectiles/Enemy/LightningCloud.cs b/Projectiles/Enemy/LightningCloud.cs index 8d0e6037df..8dc6e54c65 100644 --- a/Projectiles/Enemy/LightningCloud.cs +++ b/Projectiles/Enemy/LightningCloud.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() diff --git a/Projectiles/Enemy/MantisRing.cs b/Projectiles/Enemy/MantisRing.cs index 5daadcdeef..002314546d 100644 --- a/Projectiles/Enemy/MantisRing.cs +++ b/Projectiles/Enemy/MantisRing.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/MaulerAcidBubble.cs b/Projectiles/Enemy/MaulerAcidBubble.cs index e649011ecf..f67e3b5b38 100644 --- a/Projectiles/Enemy/MaulerAcidBubble.cs +++ b/Projectiles/Enemy/MaulerAcidBubble.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Enemy public override string Texture => "CalamityMod/Projectiles/Enemy/SulphuricAcidBubble"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; + Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Enemy { // Handle frames. Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Type]; // Home in on players after a sufficient amount of time has passed. if (Time > 60f) @@ -55,8 +55,8 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[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); return false; diff --git a/Projectiles/Enemy/NuclearToadGoo.cs b/Projectiles/Enemy/NuclearToadGoo.cs index c38799573f..635f4bcc53 100644 --- a/Projectiles/Enemy/NuclearToadGoo.cs +++ b/Projectiles/Enemy/NuclearToadGoo.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() diff --git a/Projectiles/Enemy/PearlBurst.cs b/Projectiles/Enemy/PearlBurst.cs index 3e35181991..3bc8a1c361 100644 --- a/Projectiles/Enemy/PearlBurst.cs +++ b/Projectiles/Enemy/PearlBurst.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Enemy/PearlRain.cs b/Projectiles/Enemy/PearlRain.cs index 97435f618b..29fde3728f 100644 --- a/Projectiles/Enemy/PearlRain.cs +++ b/Projectiles/Enemy/PearlRain.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Enemy/SharkoonExplosion.cs b/Projectiles/Enemy/SharkoonExplosion.cs new file mode 100644 index 0000000000..ce4efa0722 --- /dev/null +++ b/Projectiles/Enemy/SharkoonExplosion.cs @@ -0,0 +1,26 @@ +using CalamityMod.NPCs.SunkenSea; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class SharkoonExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.hostile = true; + Projectile.width = Projectile.height = Sharkoon.ExplosionRadius * 2; + Projectile.timeLeft = 2; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + => CalamityUtils.CircularHitboxCollision(Projectile.Center, Sharkoon.ExplosionRadius, targetHitbox); + + public override bool? CanHitNPC(NPC target) => target.whoAmI != Projectile.ai[0]; + } +} diff --git a/Projectiles/Enemy/StormMarkHostile.cs b/Projectiles/Enemy/StormMarkHostile.cs index ead43ea48d..8c637f4aeb 100644 --- a/Projectiles/Enemy/StormMarkHostile.cs +++ b/Projectiles/Enemy/StormMarkHostile.cs @@ -137,8 +137,8 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle rectangl = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture2D27 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle rectangl = texture2D27.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Color alphaColor = Projectile.GetAlpha(originalColor); Vector2 halfRect = rectangl.Size() / 2f; Color whiteColor = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); diff --git a/Projectiles/Enemy/SulphuricAcidBubble.cs b/Projectiles/Enemy/SulphuricAcidBubble.cs index 3b0544545e..acfa65b1b3 100644 --- a/Projectiles/Enemy/SulphuricAcidBubble.cs +++ b/Projectiles/Enemy/SulphuricAcidBubble.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; + Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -85,8 +85,8 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); lightColor.G = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index b037e6fabc..f1f5d6b825 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Enemy 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index ae8c8e1392..ed74fd0215 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2D23 = Terraria.GameContent.TextureAssets.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 40254c224a..fa67dcad89 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Enemy { Projectile.damage = 0; } - else if (Projectile.frame >= Main.projFrames[Projectile.type]) + else if (Projectile.frame >= Main.projFrames[Type]) { Projectile.Kill(); } @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Enemy 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } diff --git a/Projectiles/Environment/AcidDrop.cs b/Projectiles/Environment/AcidDrop.cs index e027fa1379..a76420bc98 100644 --- a/Projectiles/Environment/AcidDrop.cs +++ b/Projectiles/Environment/AcidDrop.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Environment public new string LocalizationCategory => "Projectiles.Misc"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Environment public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Environment/HotSteam.cs b/Projectiles/Environment/HotSteam.cs index 861ef86c45..7a9029974e 100644 --- a/Projectiles/Environment/HotSteam.cs +++ b/Projectiles/Environment/HotSteam.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.localAI[0] == 1f) return; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 6bf6a55c07..2137bd3404 100644 --- a/Projectiles/Environment/LavaChunk.cs +++ b/Projectiles/Environment/LavaChunk.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Environment public new string LocalizationCategory => "Projectiles.Misc"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -87,8 +87,8 @@ namespace CalamityMod.Projectiles.Environment public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 27dd0b7e11..74523462b0 100644 --- a/Projectiles/Environment/MurkySteam.cs +++ b/Projectiles/Environment/MurkySteam.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.localAI[0] == 1f) return; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/ThermalSteam.cs b/Projectiles/Environment/ThermalSteam.cs index cff4ecee12..2b4061379c 100644 --- a/Projectiles/Environment/ThermalSteam.cs +++ b/Projectiles/Environment/ThermalSteam.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.localAI[0] == 1f) return; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/WaterAlgae.cs b/Projectiles/Environment/WaterAlgae.cs index d28cbb522b..340942f2d5 100644 --- a/Projectiles/Environment/WaterAlgae.cs +++ b/Projectiles/Environment/WaterAlgae.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Environment public ref float Direction => ref Projectile.ai[0]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.CanDistortWater[Projectile.type] = false; + Main.projFrames[Type] = 3; + ProjectileID.Sets.CanDistortWater[Type] = false; } public override void SetDefaults() @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Environment Projectile.hide = Projectile.Opacity < 0.2f; if (Projectile.localAI[0] == 0f) { - Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); Projectile.localAI[0] = 1f; } diff --git a/Projectiles/Healing/AbsorberAura.cs b/Projectiles/Healing/AbsorberAura.cs index 383d84cc4f..91fb6286d8 100644 --- a/Projectiles/Healing/AbsorberAura.cs +++ b/Projectiles/Healing/AbsorberAura.cs @@ -4,7 +4,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -18,7 +20,7 @@ namespace CalamityMod.Projectiles.Healing { public new string LocalizationCategory => "Projectiles.Healing"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - private int AbDust = ModContent.DustType(); + private int AbDust = ModContent.DustType(); public int ShinkGrow = 0; public int Framecounter = 0; public int CleanseOnce = 1; @@ -36,12 +38,13 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.timeLeft = 1810; + Projectile.timeLeft = TheAbsorber.AuraLifetime + 10; } public override void AI() { Framecounter++; + float sine = Math.Abs((float)Math.Sin((Main.GlobalTimeWrappedHourly * 1.1f) * 5f / MathHelper.Pi)); for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) { Player player = Main.player[playerIndex]; @@ -57,77 +60,71 @@ namespace CalamityMod.Projectiles.Healing CleansingEffect = 1; for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + int buffID = player.buffType[l]; + if (player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) { player.buffTime[l] *= 0; } } for (int i = 0; i < 55; i++) { - int dust = Dust.NewDust(player.Center, player.width + 4, player.height + 4, AbDust, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, Color.DarkSeaGreen, 5.5f); + int dust = Dust.NewDust(player.Center, player.width + 4, player.height + 4, AbDust, 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; + Main.dust[dust].color = Main.rand.NextBool(3) ? Color.PaleGreen : Color.DarkSeaGreen; } SoundEngine.PlaySound(Spawnsound with { Pitch = -0.9f }, Projectile.Center); } } } - if (ShinkGrow == 0) + if (Framecounter >= 10) { - if (PulseOnce == 1) - { - Particle pulse = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.DarkSeaGreen, new Vector2(1f, 1f), 0f, 0f, 0.2925f, 10); - GeneralParticleHandler.SpawnParticle(pulse); - PulseOnce = 0; - } - - if (Framecounter == 10) - { - ShinkGrow = 1; - } - } - if (ShinkGrow == 1) - { - if (PulseOnce2 == 1) - { - Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.DarkSeaGreen, new Vector2(1f, 1f), 0f, 0.2925f, 0.2925f, 1790); - GeneralParticleHandler.SpawnParticle(pulse2); - PulseOnce2 = 0; - } - for (int i = 0; i < 3; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(301.6f, 301.6f), AbDust, null, 0, Color.DarkSeaGreen); + float areaSize = 305f; + Vector2 spawnSpot = Projectile.Center + Main.rand.NextVector2CircularEdge(areaSize, areaSize); + Dust dust = Dust.NewDustPerfect(spawnSpot, AbDust, null, 0); dust.scale = Main.rand.NextFloat(1.2f, 2.3f); dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.PaleGreen : Color.DarkSeaGreen; + dust.velocity = (Utils.DirectionTo(Projectile.Center, spawnSpot) * Main.rand.NextFloat(1.5f, 4.5f) * sine).RotatedByRandom(0.4f); } for (int i = 0; i < 1; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(292.5f, 292.5f), AbDust, null, 0, Color.DarkSeaGreen); + float areaSize = 272.5f + 20 * sine; + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(areaSize, areaSize), AbDust, null, 0); dust.scale = Main.rand.NextFloat(0.3f, 0.9f); dust.noGravity = true; - } - - if (Framecounter == 1800) - { - ShinkGrow = 2; - } - } - if (ShinkGrow == 2) - { - if (PulseOnce3 == 1) - { - Particle pulse3 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.DarkSeaGreen, new Vector2(1f, 1f), 0f, 0.2925f, 0f, 10); - GeneralParticleHandler.SpawnParticle(pulse3); - PulseOnce3 = 0; + dust.color = Main.rand.NextBool(3) ? Color.PaleGreen : Color.DarkSeaGreen; } } + Projectile.rotation += 0.15f * sine; } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request("CalamityMod/Particles/HighResFoggyCircleHardEdge").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/HighResHollowCircleHardEdge").Value; + Color drawColor1 = Color.DarkSeaGreen; + Color drawColor2 = Color.PaleGreen; + float sine = Math.Abs((float)Math.Sin((Main.GlobalTimeWrappedHourly * 1.1f) * 5f / MathHelper.Pi)); + float areaScale = Math.Min(Utils.GetLerpValue(TheAbsorber.AuraLifetime + 10, TheAbsorber.AuraLifetime, Projectile.timeLeft, true), Utils.GetLerpValue(0, 10, Projectile.timeLeft, true)); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawColor1 with { A = 0 } * 0.6f, 0, tex.Size() / 2f, (0.305f - 0.006f * sine) * areaScale, SpriteEffects.None, 0); + for (int i = 1; i <= 8; i++) + { + if (i != 0) + { + float rot = (MathHelper.TwoPi * i / 8f); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * 0.03f, Projectile.rotation + rot, tex2.Size() / 2f, new Vector2((0.2f * sine) + 0.8f, 1) * 0.29f * areaScale, SpriteEffects.None, 0); + } + } + //Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor1 with { A = 0 } * 0.3f, -Projectile.rotation, tex2.Size() / 2f, new Vector2(0.97f, 1) * 0.3f * areaScale, SpriteEffects.None, 0); + + return false; + } public override bool? CanDamage() => false; } } diff --git a/Projectiles/Healing/BlueJellyAura.cs b/Projectiles/Healing/BlueJellyAura.cs index 0d34658e28..1282ea8349 100644 --- a/Projectiles/Healing/BlueJellyAura.cs +++ b/Projectiles/Healing/BlueJellyAura.cs @@ -4,7 +4,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -36,7 +38,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.timeLeft = 1810; + Projectile.timeLeft = CleansingJelly.AuraLifetime + 10; } public override void AI() @@ -55,8 +57,8 @@ namespace CalamityMod.Projectiles.Healing CleansingEffect = 1; for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + int buffID = player.buffType[l]; + if (player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) { player.buffTime[l] *= 0; } @@ -110,7 +112,7 @@ namespace CalamityMod.Projectiles.Healing dust.noGravity = true; } - if (Framecounter == 1800) + if (Framecounter == CleansingJelly.AuraLifetime) { ShinkGrow = 2; } diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index 2b07b2e939..ad272fe761 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Healing public new string LocalizationCategory => "Projectiles.Healing"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Healing/GladiatorHealOrb.cs b/Projectiles/Healing/GladiatorHealOrb.cs index 1fc627f2a4..3659aadfad 100644 --- a/Projectiles/Healing/GladiatorHealOrb.cs +++ b/Projectiles/Healing/GladiatorHealOrb.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Balancing; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -16,11 +17,12 @@ namespace CalamityMod.Projectiles.Healing public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public int target = -1; + public ref float heal => ref Projectile.ai[0]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() @@ -38,6 +40,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { + Projectile.scale = MathHelper.Lerp((heal / 8), 1, 0.65f); float maxDistance = 150f; if (target < 0) { @@ -75,11 +78,7 @@ 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 heal = 10; - player.HealEffect(heal, false); - player.statLife += heal; - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + player.HealPlayer((int)heal, HealTextType.Local); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/OrbHeal", 5) { Volume = 0.15f }, Projectile.Center); @@ -110,8 +109,8 @@ namespace CalamityMod.Projectiles.Healing intensity *= Projectile.timeLeft / 60f; } // Become smaller the futher along the old positions we are. - Vector2 outerScale = new Vector2(1f) * intensity; - Vector2 innerScale = new Vector2(1f) * intensity * 0.7f; + Vector2 outerScale = new Vector2(1f) * Projectile.scale * intensity; + Vector2 innerScale = new Vector2(1f) * Projectile.scale * intensity * 0.7f; outerColor *= intensity; innerColor *= intensity; Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.25f, SpriteEffects.None, 0); diff --git a/Projectiles/Healing/GreenJellyAura.cs b/Projectiles/Healing/GreenJellyAura.cs index 8621e6f659..3b41df93d3 100644 --- a/Projectiles/Healing/GreenJellyAura.cs +++ b/Projectiles/Healing/GreenJellyAura.cs @@ -4,7 +4,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -35,7 +37,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.timeLeft = 1810; + Projectile.timeLeft = GrandGelatin.AuraLifetime + 10; } public override void AI() @@ -57,8 +59,8 @@ namespace CalamityMod.Projectiles.Healing CleansingEffect = 1; for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + int buffID = player.buffType[l]; + if (player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) { player.buffTime[l] *= 0; } @@ -112,7 +114,7 @@ namespace CalamityMod.Projectiles.Healing dust.noGravity = true; } - if (Framecounter == 1800) + if (Framecounter == GrandGelatin.AuraLifetime) { ShinkGrow = 2; } diff --git a/Projectiles/Healing/PhantomicHeart.cs b/Projectiles/Healing/PhantomicHeart.cs index ad93a844e0..ea6c6c6de7 100644 --- a/Projectiles/Healing/PhantomicHeart.cs +++ b/Projectiles/Healing/PhantomicHeart.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Healing public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } diff --git a/Projectiles/Healing/PinkJellyAura.cs b/Projectiles/Healing/PinkJellyAura.cs index 709e391de8..e369e66a30 100644 --- a/Projectiles/Healing/PinkJellyAura.cs +++ b/Projectiles/Healing/PinkJellyAura.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.timeLeft = 1810; + Projectile.timeLeft = LifeJelly.AuraLifetime + 10; } public override void AI() @@ -85,7 +86,7 @@ namespace CalamityMod.Projectiles.Healing dust.noGravity = true; } - if (Framecounter == 1800) + if (Framecounter == LifeJelly.AuraLifetime) { ShinkGrow = 2; } diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index b7027a962e..7a507a57a0 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -1,5 +1,10 @@ -using Microsoft.Xna.Framework; +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; @@ -10,26 +15,41 @@ namespace CalamityMod.Projectiles.Healing public new string LocalizationCategory => "Projectiles.Healing"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 30; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = Projectile.height = 20; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.MaxUpdates = 5; - Projectile.timeLeft = 600; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } - public override void AI() - { - Projectile.HealingProjectile((int)Projectile.ai[1], Projectile.owner, 6f, 15f); + public override void AI() => Projectile.HealingProjectile((int)Projectile.ai[1], Projectile.owner, 6f, 15f); - for (int i = 0; i < 3; i++) + internal Color ColorFunction(float completionRatio) => Color.Lerp(Color.Blue, Color.CornflowerBlue, completionRatio); + internal float WidthFunction(float completionRatio) => 10f * (completionRatio < 0.2f ? MathHelper.Clamp(1f - MathF.Pow(5f * completionRatio - 1f, 2f), 0f, 1f) : Utils.GetLerpValue(1f, 0.2f, completionRatio, true)); + public override bool PreDraw(ref Color lightColor) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/BasicTrail")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + return false; + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 7; i++) { - 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; + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(12f, 20f); + float scale = Main.rand.NextFloat(0.4f, 1.2f); + Particle sparkle = new CritSpark(Projectile.Center, velocity, Color.White, Color.DarkBlue, scale, 24, 0.1f, scale * 2f, Main.rand.NextFloat(0f, 0.01f)); + GeneralParticleHandler.SpawnParticle(sparkle); } } } diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs index 8173932661..740ff708e4 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; + Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -127,8 +127,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/AcidicSaxMist.cs b/Projectiles/Magic/AcidicSaxMist.cs index 4ff3e96349..df7c684ca2 100644 --- a/Projectiles/Magic/AcidicSaxMist.cs +++ b/Projectiles/Magic/AcidicSaxMist.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() diff --git a/Projectiles/Magic/AetherfluxCannonHoldout.cs b/Projectiles/Magic/AetherfluxCannonHoldout.cs index 69891cace5..ae0e2654ae 100644 --- a/Projectiles/Magic/AetherfluxCannonHoldout.cs +++ b/Projectiles/Magic/AetherfluxCannonHoldout.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -7,6 +8,7 @@ using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Systems.LavaRenderingSystem; namespace CalamityMod.Projectiles.Magic { @@ -26,6 +28,8 @@ namespace CalamityMod.Projectiles.Magic private ref float LastShootAttemptTime => ref Projectile.localAI[0]; private ref float LastAnimationTime => ref Projectile.localAI[1]; + public float postShotFade = 0; + public override void SetStaticDefaults() => Main.projFrames[Type] = 8; public override void KillHoldoutLogic() @@ -74,7 +78,12 @@ namespace CalamityMod.Projectiles.Magic if (manaOK) { if (actuallyShoot) - SoundEngine.PlaySound(SoundID.Item91, Projectile.Center); + { + postShotFade = 1; + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.1f, 0.3f) }, Projectile.Center); + } + int projID = ModContent.ProjectileType(); float shootSpeed = HeldItem.shootSpeed; @@ -94,16 +103,17 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustOnlySpread = Main.rand.NextVector2Circular(shootSpeed, shootSpeed); Vector2 dustVelocity = shootVelocity + dustInaccuracy * dustOnlySpread; if (actuallyShoot && Main.myPlayer == Projectile.owner) - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), laserStartPos, shootVelocity, projID, Projectile.damage, Projectile.knockBack, Projectile.owner, i * 0.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserStartPos, shootVelocity, projID, Projectile.damage, Projectile.knockBack, Projectile.owner, i * 0.5f); SpawnFiringDust(GunTipPosition, dustVelocity); } } } + postShotFade *= 0.86f; } private void SpawnFiringDust(Vector2 GunTipPosition, Vector2 laserVelocity) { - int dustID = 133; + int dustID = ModContent.DustType(); int dustRadius = 12; float dustRandomness = 11f; int dustDiameter = 2 * dustRadius; @@ -115,18 +125,30 @@ namespace CalamityMod.Projectiles.Magic d.velocity *= 0.18f; d.noGravity = true; d.scale = 0.6f; + d.color = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, Main.rand.NextFloat()); } } public override bool PreDraw(ref Color lightColor) { Texture2D texture = TextureAssets.Projectile[Type].Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.velocity * 10; + Vector2 drawPosition = (Projectile.Center - Main.screenPosition + vel) + vel * (1 - postShotFade); Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) + MathHelper.PiOver2; Vector2 rotationPoint = frame.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipVertically : SpriteEffects.None; - + Texture2D glowTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + for (int i = 0; i < 5; i++) + { + float glowScale = 0.3f; + Main.EntitySpriteDraw(glowTexture, drawPosition + vel * 1.7f, null, Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, postShotFade) with { A = 0 }, vel.ToRotation(), glowTexture.Size() * 0.5f, new Vector2(1.4f, 0.75f) * (glowScale - i * 0.05f) * postShotFade * 2.5f, SpriteEffects.None, 0); + } + for (int i = 0; i < 15; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 6.5f * postShotFade; + Main.EntitySpriteDraw(texture, drawPosition + drawOffset, frame, Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, postShotFade) with { A = 0 }, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + } Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); return false; diff --git a/Projectiles/Magic/AnahitasArpeggioNote.cs b/Projectiles/Magic/AnahitasArpeggioNote.cs index 6269d9feae..3aa60a7fb8 100644 --- a/Projectiles/Magic/AnahitasArpeggioNote.cs +++ b/Projectiles/Magic/AnahitasArpeggioNote.cs @@ -2,6 +2,7 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using System; +using System.IO; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,17 +16,18 @@ namespace CalamityMod.Projectiles.Magic public ref float Timer => ref Projectile.ai[0]; public ref float AIState => ref Projectile.ai[1]; - public ref float NoteSequence => ref Projectile.localAI[1]; + public ref float NoteSequence => ref Projectile.ai[2]; public int LingeringTime = 300; public int FadeOutTime = 20; public bool HasSetFadeOutVelocity = false; + public float _randomReleaseRotationOffset; public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -42,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic } public override void AI() - { + { Timer++; // Slight size oscillation @@ -67,7 +69,6 @@ namespace CalamityMod.Projectiles.Magic else Lighting.AddLight(Projectile.Center, 0f, 0f, 1.25f); - if (AIState == 0f) // Orbiting the player { // Keeps the projectile alive for as long as the weapon is being channeled @@ -78,12 +79,12 @@ namespace CalamityMod.Projectiles.Magic float rotationSpeed = baseRotationSpeed * (60f / Owner.ActiveItem().useTime); Projectile.Center = Owner.Center + new Vector2(80, 0).RotatedBy(MathHelper.ToRadians(Timer * rotationSpeed)); - // If the player stops using the weapon, switch to fade away mode - if (Owner.releaseUseItem) + // If the player stops using the weapon or does not have enough mana, switch to fade away mode + if (Owner.releaseUseItem || !Owner.CheckMana(Owner.HeldItem.mana)) { - AnahitasArpeggio.MusicNoteAmt = 0; - Owner.Calamity().arpeggioCooldown = 40; + Owner.Calamity().arpeggioCooldown = 45; AIState = 1f; + Projectile.netUpdate = true; } } else if (AIState == 1f) // Brief fade away @@ -107,10 +108,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 255; float degreesAmt = Main.zenithWorld ? 51.428f : 60f; - Vector2 musicNoteRotationOffset = Vector2.UnitY.RotatedBy(MathHelper.ToRadians(degreesAmt * NoteSequence) + Projectile.ai[2]); + Vector2 musicNoteRotationOffset = Vector2.UnitY.RotatedBy(MathHelper.ToRadians(degreesAmt * NoteSequence) + _randomReleaseRotationOffset); - Projectile.Center = Owner.Calamity().mouseWorld + musicNoteRotationOffset * 220f; - playerDirection = Projectile.Center - Owner.Calamity().mouseWorld; + Vector2 mouse = Owner.ClampedMouseWorld(); + Projectile.Center = mouse + musicNoteRotationOffset * 220f; + playerDirection = Projectile.Center - mouse; playerDirection.Normalize(); playerDirection *= -9.2f; Projectile.velocity = playerDirection; @@ -183,7 +185,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -196,5 +198,9 @@ namespace CalamityMod.Projectiles.Magic if (!SoundEngine.TryGetActiveSound(SingularSoundInstanceSystem.SoundSlot, out var activeSound)) SingularSoundInstanceSystem.PlaySingleInstance(AnahitasArpeggio.HitSound, 60, 60, Owner); } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(_randomReleaseRotationOffset); + + public override void ReceiveExtraAI(BinaryReader reader) => _randomReleaseRotationOffset = reader.ReadSingle(); } } diff --git a/Projectiles/Magic/Ancient2.cs b/Projectiles/Magic/Ancient2.cs index abc16039f9..8e71e9d3fb 100644 --- a/Projectiles/Magic/Ancient2.cs +++ b/Projectiles/Magic/Ancient2.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -91,9 +91,9 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameHeight, texture.Width, height); Vector2 origin = new Vector2(texture.Width / 2f, height / 2f); diff --git a/Projectiles/Magic/ApotheosisEnergy.cs b/Projectiles/Magic/ApotheosisEnergy.cs index 9c286d69a2..7aa7bea46c 100644 --- a/Projectiles/Magic/ApotheosisEnergy.cs +++ b/Projectiles/Magic/ApotheosisEnergy.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.extraUpdates = 1; Projectile.timeLeft = 210; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 1; + Projectile.localNPCHitCooldown = 4; } public override void AI() @@ -81,7 +82,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < Projectile.oldPos.Length; i++) { - if (Collision.CheckAABBvAABBCollision(Projectile.oldPos[i], projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + if (Collision.CheckAABBvAABBCollision(Projectile.oldPos[i], projHitbox.Size(), targetHitbox.TopLeft(), targetHitbox.Size())) return true; } return false; diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs index beb25bb0cd..43f9c166df 100644 --- a/Projectiles/Magic/ApotheosisWorm.cs +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -54,7 +54,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 300; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 9; + Projectile.localNPCHitCooldown = 6; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; @@ -134,6 +135,7 @@ namespace CalamityMod.Projectiles.Magic internal void InitializeSegments() { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 directionToMouse = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Owner.direction); Projectile.rotation = directionToMouse.ToRotation() + MathHelper.PiOver2; for (int i = 0; i < Segments.Length; i++) @@ -260,9 +262,9 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - Vector2 headTextureOrigin = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Size() * 0.5f; + Vector2 headTextureOrigin = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Size() * 0.5f; drawPosition -= headTexture.Size() * Projectile.scale * 0.5f; drawPosition += headTextureOrigin * Projectile.scale + new Vector2(0f, 4f + Projectile.gfxOffY); @@ -350,14 +352,15 @@ namespace CalamityMod.Projectiles.Magic // Manual collision detection that incorporates segments. public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (Collision.CheckAABBvAABBCollision(Projectile.position, projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + if (Collision.CheckAABBvAABBCollision(Projectile.position, projHitbox.Size(), targetHitbox.TopLeft(), targetHitbox.Size())) return true; for (int i = 0; i < Segments.Length; i++) { - if (Collision.CheckAABBvAABBCollision(Segments[i].Center - projHitbox.Size() * 0.5f, projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + if (Collision.CheckAABBvAABBCollision(Segments[i].Center - projHitbox.Size() * 0.5f, projHitbox.Size(), targetHitbox.TopLeft(), targetHitbox.Size())) return true; } + return false; } } diff --git a/Projectiles/Magic/AquamarineBolt.cs b/Projectiles/Magic/AquamarineBolt.cs index 84a1716635..2a0aedf884 100644 --- a/Projectiles/Magic/AquamarineBolt.cs +++ b/Projectiles/Magic/AquamarineBolt.cs @@ -1,16 +1,26 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework.Graphics; + namespace CalamityMod.Projectiles.Magic { public class AquamarineBolt : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public Particle bloom = null; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 11; } public override void SetDefaults() @@ -20,31 +30,117 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; + Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 180; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.alpha = 255; } 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, 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)) + // The main bolt simply just homes + if (Projectile.ai[0] == 0) { - 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; + CalamityUtils.HomeInOnNPC(Projectile, false, 600, 10f, 10f); } - Projectile.rotation += 0.3f * (float)Projectile.direction; + // The secondary bolt """"orbits"""" the main one + else + { + Projectile parent = Main.projectile[(int)Projectile.ai[2]]; + if (parent.active && parent.type == Type) + { + Projectile.timeLeft = parent.timeLeft; + Projectile.ai[1] += 0.18f; + float angle = parent.velocity.ToRotation() + MathHelper.PiOver2; + float pulse = (float)Math.Sin(Projectile.ai[1]); + float radius = 20.8f; + Vector2 offset = angle.ToRotationVector2() * pulse * radius; + Projectile.Center = parent.Center - offset; + } + else + { + Projectile.tileCollide = true; + Projectile.penetrate = 1; + Projectile.ai[0] = 0; + } + } + // Bloom particle behind the bolt. If one already exists, update its position and assure it doesn't prematurely die + if (bloom == null) + { + bloom = new GenericBloom(Projectile.Center, Vector2.Zero, Color.LightBlue * 0.5f, 0.5f * Projectile.scale, 600); + GeneralParticleHandler.SpawnParticle(bloom); + } + else + { + bloom.Position = Projectile.position; + bloom.Velocity = Projectile.velocity; + bloom.Time = 300; + } + + // fade out and kill the bloom + if (Projectile.timeLeft < 60) + { + Projectile.alpha += 10; + if (bloom != null) + { + bloom.Kill(); + } + } + // if it's not fading out, make some idle sparkles + else + { + if (Projectile.alpha > 0) + { + Projectile.alpha -= 50; + } + if (Main.rand.NextBool(4) && Projectile.velocity.Length() > 2) + { + Particle sparkle = new SnowflakeSparkle(Projectile.Center, Vector2.Zero, Color.AliceBlue, Color.AliceBlue, Main.rand.NextFloat(0.05f, 0.5f), 20); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + + // lite + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); + Projectile.rotation += 0.3f * Projectile.direction; } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); + public override Color? GetAlpha(Color lightColor) => Color.White; + public float PrimitiveWidthFunction(float completionRatio) + { + return (1 - completionRatio) * 20 * Projectile.scale; + } + + public Color PrimitiveColorFunction(float completionRatio) + { + return Color.Lerp(new Color(86, 176, 240), Color.Azure, (float)Math.Pow(completionRatio, 1.5D)) * 0.6f * Projectile.Opacity; + } + 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 bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + // streakin' + Main.spriteBatch.EnterShaderRegion(); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Vector2.Zero, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 66); + Main.spriteBatch.ExitShaderRegion(); + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.position - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * Projectile.Opacity, Projectile.rotation, Projectile.getRect().Size() * 0.5f, Projectile.scale, 0, 0); + + Main.spriteBatch.ExitShaderRegion(); return false; } + + public override void OnKill(int timeLeft) + { + // kill the bloom when the projectile dies if it hasn't already (aka if it hits a tile or npc) + if (bloom != null) + { + bloom.Kill(); + } + } } } diff --git a/Projectiles/Magic/ArtAttackHoldout.cs b/Projectiles/Magic/ArtAttackHoldout.cs index 1a2f5de061..f6011b65a7 100644 --- a/Projectiles/Magic/ArtAttackHoldout.cs +++ b/Projectiles/Magic/ArtAttackHoldout.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(ArtAttack.UseSound, Owner.Center); Vector2 initialStarVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Main.MouseWorld, initialStarVelocity, attackType, Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), initialStarVelocity, attackType, Projectile.damage, Projectile.knockBack, Projectile.owner); Projectile.ai[0] = -24f; } else @@ -76,10 +76,7 @@ namespace CalamityMod.Projectiles.Magic aimOffset = Vector2.Lerp(aimOffset, Vector2.Normalize(Projectile.velocity), AimResponsiveness).SafeNormalize(Vector2.UnitY) * 30f; if (aimOffset != Projectile.velocity) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); Projectile.velocity = aimOffset; } diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index aea6eae32c..e1da468182 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 180; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 180; } public override void SetDefaults() @@ -109,11 +109,14 @@ namespace CalamityMod.Projectiles.Magic public void DoMouseMovement() { - Projectile.Center = Main.MouseWorld; + // 14NOV2024: Ozzatron: Art Attack is intentionally limited to clamped mouse so larger screens don't give an advantage. + // If this feels too weird on larger screens, this could be reverted. It is a rather unique case. + + // Projectile.Center = Main.MouseWorld; + Projectile.Center = Owner.ClampedMouseWorld(); // Continuously sync since mouse information is local. - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } public void EmitIdleDust() @@ -218,7 +221,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; Vector2 origin = texture.Size() * 0.5f; diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index c109d2a738..f481a41547 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,8 +12,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -57,6 +58,10 @@ namespace CalamityMod.Projectiles.Magic Main.dust[moreGreen].fadeIn = 1f; Main.dust[moreGreen].noGravity = true; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } public override void OnKill(int timeLeft) { @@ -80,7 +85,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[killDust].velocity *= 2f; Main.dust[killDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int k = 0; k < 2; k++) { @@ -114,7 +119,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index 5c16a3b188..593186be24 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[killFire].velocity *= 2f; Main.dust[killFire].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int k = 0; k < 2; k++) { @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { //Changes the texture of the projectile - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; switch ((int)Projectile.ai[0]) { case 0: @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Magic default: break; } - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, texture); return false; } diff --git a/Projectiles/Magic/AstralCrystal.cs b/Projectiles/Magic/AstralCrystal.cs index 366c34f1db..296fb9b03d 100644 --- a/Projectiles/Magic/AstralCrystal.cs +++ b/Projectiles/Magic/AstralCrystal.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index 669f7ca602..075eb98bf5 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -19,8 +19,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -77,7 +78,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[idx].position = Projectile.Center + velocity * 6f; } - if (Main.rand.NextBool(24) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(24) && !Main.dedServ) { int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.1f, 16, 1f); Main.gore[idx].velocity *= 0.66f; @@ -107,7 +108,7 @@ namespace CalamityMod.Projectiles.Magic 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) + if (Main.rand.NextBool(10) && !Main.dedServ) Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.1f, Main.rand.Next(16, 18), 1f); if (Projectile.ai[0] == 1f) @@ -121,7 +122,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Projectile.DrawStarTrail(Color.Coral, Color.White); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -175,7 +176,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) 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 13bf333d7f..cf5ed838f9 100644 --- a/Projectiles/Magic/AstralachneaFang.cs +++ b/Projectiles/Magic/AstralachneaFang.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index 40c0fd051a..6c8a87d6fe 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -1,5 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -9,8 +12,10 @@ namespace CalamityMod.Projectiles.Magic { public new string LocalizationCategory => "Projectiles.Magic"; public bool devourer = DownedBossSystem.downedDoG; - public static int TotalSegments = 16; - public float damageMultiplier = 1f; + private static int TotalSegments = 16; + private float damageMultiplier = 1f; + private int time = 0; + private float fade = 1; public override void SetDefaults() { @@ -24,6 +29,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.extraUpdates = (Main.zenithWorld && devourer) ? 1 : 0; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = (Main.zenithWorld && devourer) ? 2 : 8; + Projectile.appliesImmunityTimeOnSingleHits = true; } public override void AI() @@ -48,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic // Spawn the next segment if (Main.myPlayer == Projectile.owner && Projectile.ai[0] < TotalSegments) { - int nextSegment = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0] + 1f); + int nextSegment = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0] + 1f, 0f, 5f); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, nextSegment); } } @@ -57,21 +63,20 @@ namespace CalamityMod.Projectiles.Magic { int AlphaPerFrame = 12; Projectile.alpha += AlphaPerFrame; - if (Projectile.alpha == AlphaPerFrame * 14) - { - for (int i = 0; i < 8; i++) - { - 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; - } - } if (Projectile.alpha >= 255) Projectile.Kill(); } - if (Main.rand.NextBool(4)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); + if (Main.rand.NextBool(7)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 0.5f, 278, Projectile.velocity.RotatedByRandom(0.8) * Main.rand.NextFloat(0.03f, 0.18f)); + dust.scale = Main.rand.NextFloat(0.3f, 0.5f); + dust.color = Main.rand.NextBool() ? Color.CornflowerBlue : Color.LightBlue; + dust.noGravity = true; + } + time++; + + fade = Utils.GetLerpValue(25, 12, time, true); } // This is essential for Vilethorn-type projectiles, as velocity is a stored parameter and isn't supposed to actually move the projectile @@ -88,9 +93,16 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - for (int k = 0; k < 3; k++) + if (Projectile.ai[2] == 5) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); + for (int k = 0; k < 2; k++) + { + Particle spark = new SparkParticle(Projectile.Center + Projectile.velocity * 0.5f, Projectile.velocity.RotatedByRandom(0.8) * Main.rand.NextFloat(0.1f, 0.6f), false, 23, Main.rand.NextFloat(0.7f, 1.1f), Color.LightBlue * 0.6f); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new PointParticle(Projectile.Center + Projectile.velocity * 0.5f, Projectile.velocity.RotatedByRandom(0.8) * Main.rand.NextFloat(0.1f, 0.6f), false, 23, Main.rand.NextFloat(0.7f, 1.1f), Color.LightBlue * 0.6f); + GeneralParticleHandler.SpawnParticle(spark2); + } + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.3f, Pitch = (Projectile.ai[0] * -0.02f) - 0.1f }, Projectile.Center); } // Prevent recursion: the segments that are being spawned here will deliberately be set higher than total segments @@ -103,8 +115,17 @@ namespace CalamityMod.Projectiles.Magic 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, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, TotalSegments + 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, TotalSegments + 1f, 0, i); } } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + + if (time > 0) + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * fade, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + + return false; + } } } diff --git a/Projectiles/Magic/AuraRain.cs b/Projectiles/Magic/AuraRain.cs deleted file mode 100644 index 3abea1c3f3..0000000000 --- a/Projectiles/Magic/AuraRain.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class AuraRain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.aiStyle = ProjAIStyleID.RainCloud; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = true; - Projectile.timeLeft = 300; - Projectile.alpha = 255; - Projectile.scale = 1.1f; - Projectile.DamageType = DamageClass.Magic; - Projectile.extraUpdates = 1; - AIType = ProjectileID.RainFriendly; - } - - public override void AI() - { - 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; - dust.scale = 0.8f; - dust.noLight = true; - } - - 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; - } - } -} diff --git a/Projectiles/Magic/BeamStar.cs b/Projectiles/Magic/BeamStar.cs index 8896ef18c3..4c0c69d905 100644 --- a/Projectiles/Magic/BeamStar.cs +++ b/Projectiles/Magic/BeamStar.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Projectiles.Magic public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -71,7 +72,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Vector2 drawPosition; - Texture2D starTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D starTexture = Terraria.GameContent.TextureAssets.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; diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index fb30fb008e..4861b6e389 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Projectile.ai[0] == 1f) tex = ModContent.Request("CalamityMod/Projectiles/Magic/BeamingThornBlossom").Value; @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 8; i++) { - Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1), Projectile.knockBack, Projectile.owner, Projectile.ai[0]); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0]); } } SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); diff --git a/Projectiles/Magic/BeamingBolt2.cs b/Projectiles/Magic/BeamingBolt2.cs index 35f28eca62..df78947c31 100644 --- a/Projectiles/Magic/BeamingBolt2.cs +++ b/Projectiles/Magic/BeamingBolt2.cs @@ -2,12 +2,14 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class BeamingBolt2 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 14; @@ -22,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 58223b592f..0c309d3205 100644 --- a/Projectiles/Magic/BeastScythe.cs +++ b/Projectiles/Magic/BeastScythe.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -25,9 +26,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.netImportant = true; - Projectile.penetrate = 1; + Projectile.penetrate = 2; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; Projectile.extraUpdates = 1; Projectile.tileCollide = false; } @@ -172,7 +175,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/BlackAnurianPlankton.cs b/Projectiles/Magic/BlackAnurianPlankton.cs index ca29350bbc..7478e3231e 100644 --- a/Projectiles/Magic/BlackAnurianPlankton.cs +++ b/Projectiles/Magic/BlackAnurianPlankton.cs @@ -1,6 +1,7 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -9,7 +10,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Magic/BlindingLight.cs b/Projectiles/Magic/BlindingLight.cs index b4b206a6da..6728104eec 100644 --- a/Projectiles/Magic/BlindingLight.cs +++ b/Projectiles/Magic/BlindingLight.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic float progress = (float)Math.Sin(Projectile.ai[0] / Lifetime * MathHelper.Pi); if (Projectile.ai[0] > 55f) progress = MathHelper.Lerp(progress, 0f, (Projectile.ai[0] - 55f) / 5f); - if (Main.netMode != NetmodeID.Server && Projectile.ai[0] > 15f) // Otherwise a white flash appears, but it quickly disappears. + if (!Main.dedServ && !CalamityClientConfig.Instance.Photosensitivity && Projectile.ai[0] > 15f) // Otherwise a white flash appears, but it quickly disappears. { if (!Filters.Scene["CalamityMod:LightBurst"].IsActive()) Filters.Scene.Activate("CalamityMod:LightBurst", Projectile.Center).GetShader().UseTargetPosition(Projectile.Center).UseProgress(0f); @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Filters.Scene.Deactivate("CalamityMod:LightBurst"); } diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index 340b745e51..ea18c079db 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.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; @@ -56,5 +57,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation += 0.3f * (float)Projectile.direction; } } + 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/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index 6470675324..e54b7b72f7 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,6 +11,13 @@ namespace CalamityMod.Projectiles.Magic public class BlueBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public Color mainColor; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; + } public override void SetDefaults() { Projectile.width = 10; @@ -47,12 +56,36 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Projectile.timeLeft < 90) + { CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 400f, 8f, 20f); + if (Main.rand.NextBool(10)) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66); + trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); + trailDust.color = Main.rand.NextBool() ? Color.AliceBlue : Color.SkyBlue; + trailDust.noGravity = true; + } + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Magic/BlueBubble").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Color.Lerp(mainColor, Color.White, 0.2f) with { A = 0 }; + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], drawColor, 1, texture, true, true); + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + return false; } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); + Particle Star = new CritSpark(Projectile.Center, Vector2.Zero, Color.SkyBlue, Color.DeepSkyBlue, Main.rand.NextFloat(1f, 1.1f), 30, 0.1f, 3f); + GeneralParticleHandler.SpawnParticle(Star); int num190 = Main.rand.Next(5, 9); for (int i = 0; i < num190; i++) { diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs deleted file mode 100644 index 1afd7066fb..0000000000 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneFireball : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 3; - Projectile.timeLeft = 300; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); - if (Projectile.wet) - { - Projectile.Kill(); - SpawnFireballs(true); - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - 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; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 5f; - if (Projectile.velocity.Y == 0.0 && Projectile.velocity.X != 0.0) - { - Projectile.velocity.X *= 0.97f; - if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y += 0.2f; - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.1f * Projectile.direction; - } - if (Projectile.velocity.Y <= 16f) - return; - Projectile.velocity.Y = 16f; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); - } - else - { - Projectile.ai[0] += 0.1f; - 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.8f; - } - return 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.Item20, Projectile.Center); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - - if (target.HasBuff(BuffID.Wet) || target.Calamity().eutrophication > 0 || target.Calamity().rTide > 0 || target.Calamity().cDepth > 0) - { - SpawnFireballs(false); - } - } - - public void SpawnFireballs(bool isFromLiquidHit) - { - if (Projectile.owner == Main.myPlayer) - { - int homerAmt = 2; - if (!isFromLiquidHit && Projectile.numHits > 0) - homerAmt = 1; - - for (int j = 0; j < homerAmt; j++) - { - Vector2 velocity = new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-100f, -50f)); - while (velocity.X == 0f) - { - velocity.X = (float)Main.rand.Next(-100, 101); - } - velocity.Normalize(); - velocity *= Main.rand.NextFloat(7f, 10f); - float damageMult = isFromLiquidHit ? 1f : 0.25f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), 0f, Projectile.owner, 0f, 0f); - } - } - } - } -} diff --git a/Projectiles/Magic/BrimstoneFireball.png b/Projectiles/Magic/BrimstoneFireball.png deleted file mode 100644 index 62d616a8c1..0000000000 Binary files a/Projectiles/Magic/BrimstoneFireball.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index fa627a0ebc..d19ac4ede9 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs deleted file mode 100644 index a18d3379fd..0000000000 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ /dev/null @@ -1,41 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneHomer : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 180; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - Projectile.rotation += 0.7f * Projectile.direction; - - 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 < 160) - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 240f, 8f, 20f); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Magic/BrimstoneHomer.png b/Projectiles/Magic/BrimstoneHomer.png deleted file mode 100644 index 282b689545..0000000000 Binary files a/Projectiles/Magic/BrimstoneHomer.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs deleted file mode 100644 index d49ed65926..0000000000 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneTentacle : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 40; - Projectile.height = 40; - Projectile.friendly = true; - Projectile.penetrate = 5; - Projectile.MaxUpdates = 3; - Projectile.DamageType = DamageClass.Magic; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 5; - } - - public override void AI() - { - Projectile.localAI[1]++; - if (Projectile.velocity.X != Projectile.velocity.X) - { - if (Math.Abs(Projectile.velocity.X) < 1f) - { - Projectile.velocity.X = -Projectile.velocity.X; - } - else - { - Projectile.Kill(); - } - } - if (Projectile.velocity.Y != Projectile.velocity.Y) - { - if (Math.Abs(Projectile.velocity.Y) < 1f) - { - Projectile.velocity.Y = -Projectile.velocity.Y; - } - else - { - Projectile.Kill(); - } - } - Vector2 center10 = Projectile.Center; - Projectile.scale = 1f - Projectile.localAI[0]; - Projectile.width = (int)(20f * Projectile.scale); - Projectile.height = Projectile.width; - Projectile.position.X = center10.X - (float)(Projectile.width / 2); - Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); - if (Projectile.localAI[0] < 0.1f) - { - Projectile.localAI[0] += 0.01f; - } - else - { - Projectile.localAI[0] += 0.025f; - } - if (Projectile.localAI[0] >= 0.95f) - { - Projectile.Kill(); - } - Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f; - Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f; - if (Projectile.velocity.Length() > 16f) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= 16f; - } - Projectile.ai[0] *= 1.05f; - Projectile.ai[1] *= 1.05f; - if (Projectile.scale < 1f && Projectile.localAI[1] > 5f) - { - int scaleLoopCheck = 0; - while ((float)scaleLoopCheck < Projectile.scale * 10f) - { - 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; - Main.dust[brimDust].velocity -= Projectile.velocity * (1.3f - Projectile.scale); - Main.dust[brimDust].fadeIn = (float)(100 + Projectile.owner); - Main.dust[brimDust].scale += Projectile.scale * 0.75f; - scaleLoopCheck++; - } - } - } - } -} diff --git a/Projectiles/Magic/CauldronProj.cs b/Projectiles/Magic/CauldronProj.cs index 4c6b92ca08..21c716e995 100644 --- a/Projectiles/Magic/CauldronProj.cs +++ b/Projectiles/Magic/CauldronProj.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Magic public static Asset Glow; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; if (!Main.dedServ) { Glow = ModContent.Request(Texture + "Glow"); @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); Vector2 origin = Glow.Value.Size() / 2f; Main.EntitySpriteDraw(Glow.Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Magic/CauldronProjSmall.cs b/Projectiles/Magic/CauldronProjSmall.cs index e3d01d3509..1ae7f52f9a 100644 --- a/Projectiles/Magic/CauldronProjSmall.cs +++ b/Projectiles/Magic/CauldronProjSmall.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Magic public static Asset Glow; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; if (!Main.dedServ) { Glow = ModContent.Request(Texture + "Glow"); @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); Vector2 origin = Glow.Value.Size() / 2f; Main.EntitySpriteDraw(Glow.Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Magic/ChronoIcicleLarge.cs b/Projectiles/Magic/ChronoIcicleLarge.cs index 79fa04c391..72f369e809 100644 --- a/Projectiles/Magic/ChronoIcicleLarge.cs +++ b/Projectiles/Magic/ChronoIcicleLarge.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public static int HomingSpeed = 16; public static int IdleSpeedMax = 7; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 12; @@ -25,6 +26,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.coldDamage = true; Projectile.tileCollide = false; Projectile.timeLeft = 180; + Projectile.alpha = 255; } public override void AI() @@ -39,11 +41,13 @@ namespace CalamityMod.Projectiles.Magic Projectile.velocity *= 0.001f; } bool isCounter = Projectile.ai[2] < 0; + // start further away and then rapidly go inwards + float dist = Math.Abs(Projectile.ai[2]) == 12 ? 160 : MathHelper.Lerp(210, 160, Utils.GetLerpValue(0, 5, Projectile.ai[1], true)); 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; + Projectile.position = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * aivar - MathHelper.PiOver2).ToRotationVector2() * dist - Projectile.Size / 2; } if (Projectile.ai[1] >= (12 - Math.Abs(Projectile.ai[2])) * 5 + 2) { @@ -62,6 +66,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[0] = 1; Projectile.ai[1] = 0; } + // icicles 11 and 12 have barely any time, so they tick down much faster + if (Math.Abs(Projectile.ai[2]) >= 11) + Projectile.alpha -= 150; + else + Projectile.alpha -= 30; break; // jet out case 1: diff --git a/Projectiles/Magic/ChronomancersScytheHoldout.cs b/Projectiles/Magic/ChronomancersScytheHoldout.cs index d5861097b5..ed6c379bfd 100644 --- a/Projectiles/Magic/ChronomancersScytheHoldout.cs +++ b/Projectiles/Magic/ChronomancersScytheHoldout.cs @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Magic { Owner.ChangeDir((int)Projectile.ai[2]); - Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 handleOrigin = Projectile.ai[2] == -1 ? new Vector2(scytheTexture.Width, scytheTexture.Height) : new Vector2(0, scytheTexture.Height); float scytheRotation = Projectile.rotation; diff --git a/Projectiles/Magic/ChronomancersScytheSwing.cs b/Projectiles/Magic/ChronomancersScytheSwing.cs index 5cbd28a35b..0aed3a8905 100644 --- a/Projectiles/Magic/ChronomancersScytheSwing.cs +++ b/Projectiles/Magic/ChronomancersScytheSwing.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic public static int ClockChance = 30; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; Projectile.soundDelay--; @@ -81,6 +81,7 @@ namespace CalamityMod.Projectiles.Magic if (Owner.ActiveItem().shoot == Projectile.type) scaleFactor6 = Owner.ActiveItem().shootSpeed * Projectile.scale; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 slashDirection = Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true); slashDirection.Normalize(); if (slashDirection.HasNaNs()) @@ -102,6 +103,7 @@ namespace CalamityMod.Projectiles.Magic { if (Main.myPlayer == Projectile.owner) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction 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); } diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index 36e9c1e8df..ed88380a08 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); } public override void OnKill(int timeLeft) @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic 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) + if (!Main.dedServ) { for (int k = 0; k < 3; k++) { @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/ClamorNoctusWyvern.cs b/Projectiles/Magic/ClamorNoctusWyvern.cs index db0583c6e5..8196533cc1 100644 --- a/Projectiles/Magic/ClamorNoctusWyvern.cs +++ b/Projectiles/Magic/ClamorNoctusWyvern.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic { 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) + if (!Main.dedServ) { int head = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.8f, Mod.Find("ClamorNoctusHead").Type); Main.gore[head].timeLeft /= 10; @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 8cd668dbf0..0acd9b663f 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index 8ff285b156..2b7085481d 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic public bool firedBeam = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -78,8 +78,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/CoralSpoutHoldout.cs b/Projectiles/Magic/CoralSpoutHoldout.cs index ffee1f9bad..ac08faddd8 100644 --- a/Projectiles/Magic/CoralSpoutHoldout.cs +++ b/Projectiles/Magic/CoralSpoutHoldout.cs @@ -59,6 +59,7 @@ namespace CalamityMod.Projectiles.Magic Owner.heldProj = Projectile.whoAmI; } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float pointingRotation = (Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation(); Projectile.Center = Owner.MountedCenter + pointingRotation.ToRotationVector2() * 40f; diff --git a/Projectiles/Magic/CosmicRainbowFront.cs b/Projectiles/Magic/CosmicRainbowFront.cs new file mode 100644 index 0000000000..3f6a2c3f1a --- /dev/null +++ b/Projectiles/Magic/CosmicRainbowFront.cs @@ -0,0 +1,47 @@ +using System; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class CosmicRainbowFront : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "Terraria/Images/Projectile_251"; + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.timeLeft = 210; + Projectile.scale = 1.25f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + } + + public override bool? CanDamage() => false; + public override void AI() + { + if (Projectile.owner == Main.myPlayer) + { + //Projectile.localAI[0]++; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.001f, Projectile.velocity.Y * 0.001f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + } + + float velocityMult = 39.75f / Projectile.velocity.Length(); + float xVel = Projectile.velocity.X * velocityMult; + float yVel = Projectile.velocity.Y * velocityMult; + Projectile.velocity.X = xVel; + Projectile.velocity.Y = yVel; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + + public override Color? GetAlpha(Color lightColor) => Color.Transparent; + } +} diff --git a/Projectiles/Magic/CosmicRainbowTrail.cs b/Projectiles/Magic/CosmicRainbowTrail.cs new file mode 100644 index 0000000000..ceedd2c90b --- /dev/null +++ b/Projectiles/Magic/CosmicRainbowTrail.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics.PackedVector; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class CosmicRainbowTrail : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "Terraria/Images/Projectile_251"; + public const int Lifetime = 25; + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.alpha = 255; + Projectile.light = 0.3f; + Projectile.tileCollide = false; + Projectile.timeLeft = Lifetime; + Projectile.ignoreWater = true; + Projectile.scale = 1.25f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 6; + } + + public override void AI() + { + if (Projectile.localAI[0] == 0f) + { + Projectile.spriteDirection = (Projectile.velocity.X <= 0f).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.localAI[0] = 1f; + } + + Projectile.velocity *= 0.98f; + if (Projectile.timeLeft < 6) + Projectile.alpha = 255 - (int)(255f * Projectile.timeLeft / 6f); + else if (Projectile.timeLeft > Lifetime - 6) + Projectile.alpha = 255 - (int)(255f * (Lifetime - Projectile.timeLeft) / 6f); + else + Projectile.alpha = 0; + } + + public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); + } +} diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 1993e6f085..feb3ae822f 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -42,6 +43,7 @@ namespace CalamityMod.Projectiles.Magic { Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 vel = ((Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 7).RotatedBy(0.2f * curveDirection); if (curveDirection == 100) @@ -50,15 +52,28 @@ namespace CalamityMod.Projectiles.Magic } if (preDamage) { - if (targetDist < 1400f) + if (targetDist < 1400f && time > 3) { float scaler = Utils.GetLerpValue(-60, 120, time, true); Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.6f * scaler, 0f, 4, false); GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f * scaler, 0f, 4, true); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor * 0.6f, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.48f * scaler, 0f, 4, true); GeneralParticleHandler.SpawnParticle(blastRing2); } Projectile.velocity *= 0.96f; + if (time == 3) + { + for (int i = 0; i < 6; i++) + { + float variance = Main.rand.NextFloat(-0.4f, 0.4f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust2.scale = Main.rand.NextFloat(0.8f, 1.2f) - Math.Abs(variance); + dust2.velocity = Projectile.velocity.RotatedBy(variance) * Main.rand.NextFloat(1.2f, 1.5f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = Color.LightGreen; + } + } } else { @@ -67,18 +82,19 @@ namespace CalamityMod.Projectiles.Magic float curveStrength = Utils.GetLerpValue(scalingTimerMax, 0, scalingTimer, true) * 0.04f; Projectile.velocity = Projectile.velocity.RotatedBy(curveStrength * curveDirection); scaling = Utils.GetLerpValue(0, scalingTimerMax, scalingTimer, true); + float sharpScaling = Utils.GetLerpValue(scalingTimerMax * 0.7f, scalingTimerMax, scalingTimer, true); - if (time % 2 == 0 && targetDist < 1400f) + if (targetDist < 1400f) { - Particle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 12, 3.5f * scaling, Color.Black); + Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark2", false, 12, 0.07f * scaling, Color.Black * 0.85f, new Vector2(1.7f - (1 - sharpScaling), 0.9f + (1 - sharpScaling) * 2), false); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 12, 1.5f * scaling, InnerColor); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 12, 0.035f * scaling, Color.LightGreen * 0.55f, new Vector2(1.7f - (1 - sharpScaling), 0.9f + (1 - sharpScaling) * 2)); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(6)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); - dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 267, -Projectile.velocity); + dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.2f); dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); dust.noGravity = true; dust.color = InnerColor; @@ -89,11 +105,12 @@ namespace CalamityMod.Projectiles.Magic { if (curves > 1) { - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0f, scalingTimerMax / 2, false); + Projectile.Center += Main.rand.NextVector2Circular(100, 100); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.6f, 0f, scalingTimerMax / 2, false); GeneralParticleHandler.SpawnParticle(blastRing); for (int i = 0; i < 2; i++) { - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.26f, 0f, scalingTimerMax / 2, true); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.36f, 0f, scalingTimerMax / 2, true); GeneralParticleHandler.SpawnParticle(blastRing2); } Projectile.velocity = Vector2.Zero; @@ -113,9 +130,9 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i <= 6; i++) { - int dustStyle = Main.rand.NextBool() ? 66 : 263; + int dustStyle = ModContent.DustType(); Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 191 : dustStyle, Projectile.velocity); - dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.scale = Main.rand.NextFloat(0.9f, 1.4f); dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); dust.noGravity = true; dust.color = dust.type == dustStyle ? InnerColor : default; @@ -150,8 +167,21 @@ namespace CalamityMod.Projectiles.Magic } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - SoundStyle fire = new("CalamityMod/Sounds/Item/MeldShoot"); - SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = 0.9f }, Projectile.Center); + if (Projectile.numHits == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = 0.9f }, Projectile.Center); + for (int i = 0; i < 6; i++) + { + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle); + dust2.scale = Main.rand.NextFloat(1.2f, 1.6f) - Math.Abs(variance); + dust2.velocity = (Projectile.velocity * 1.5f).RotatedBy(variance) * Main.rand.NextFloat(1.2f, 1.5f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = Color.LightGreen; + } + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs index 2a0515bc4d..a25787701b 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -14,12 +14,13 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() { - Projectile.width = Projectile.height = 35; + Projectile.width = 40; + Projectile.height = 62; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = 3; @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); @@ -86,9 +87,9 @@ namespace CalamityMod.Projectiles.Magic if ((Projectile.timeLeft > 596 && Projectile.ai[0] == 0f) || (Projectile.timeLeft > 599 && Projectile.ai[0] > 0f)) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameHeight, texture.Width, height); Vector2 origin = new Vector2(texture.Width / 2f, height / 2f); @@ -126,6 +127,8 @@ namespace CalamityMod.Projectiles.Magic } } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 99543487e8..242551db4a 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -58,82 +58,46 @@ namespace CalamityMod.Projectiles.Magic float laserNormalize; Vector2 projDirection = Vector2.Zero; float laserTimer; - float y; + float yOffset; float laserRotationSpeed; float scaleFactor6; - Color color = new Color(1, 1, 1, 127); + Color color = GetBeamColor((int)projectile2.ai[0], (int)Projectile.ai[0]); Projectile.Opacity = 1f; - if (projectile2.ai[0] < 720f) + if (projectile2.ai[0] < 360f) { - laserTimer = projectile2.ai[0] / 1440f; - y = 6f + projectile2.ai[0] / 720f * 7f; - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + ((projectile2.ai[0] - 360f) / 360f * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - - if (projectile2.ai[0] < 480f) + laserTimer = projectile2.ai[0] / 720f; + yOffset = 6f + projectile2.ai[0] / 360f * 7f; + if (projectile2.ai[0] < 240f) laserRotationSpeed = 1.75f; else - laserRotationSpeed = 3f + 5f * ((projectile2.ai[0] - 480f) / 240f); - - scaleFactor6 = -2f - projectile2.ai[0] / 720f * 5f; + laserRotationSpeed = 3f + 5f * ((projectile2.ai[0] - 240f) / 120f); + scaleFactor6 = -2f - projectile2.ai[0] / 360f * 5f; } else { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - colorLimit = 255f; - - switch ((int)Projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); - break; - } - laserTimer = 0.5f; laserRotationSpeed = 10.875f; - y = 13f; + yOffset = 13f; scaleFactor6 = -7f; } float laserDirection = (projectile2.ai[0] + laserPosition * laserRotationSpeed) / (laserRotationSpeed * 6f) * MathHelper.TwoPi; laserNormalize = Vector2.UnitY.RotatedBy(laserDirection).Y * (MathHelper.Pi / 6) * laserTimer * 0.33f; - projDirection = (Vector2.UnitY.RotatedBy(laserDirection) * new Vector2(4f, y)).RotatedBy(projectile2.velocity.ToRotation()); + projDirection = (Vector2.UnitY.RotatedBy(laserDirection) * new Vector2(4f, yOffset)).RotatedBy(projectile2.velocity.ToRotation()); Projectile.position = projectile2.Center + aimDirection * 16f - Projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)Projectile.ai[1]].gfxOffY); Projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; Projectile.position += projDirection; Projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(laserNormalize); Projectile.scale = 1.5f * (1.5f - laserTimer); - // Takes 360 frames to reach normal damage - float amount = projectile2.ai[0] / 1200f; + // Takes 180 frames to reach normal damage + float amount = projectile2.ai[0] / 600f; if (amount > 1f) amount = 1f; Projectile.damage = (int)(projectile2.damage * MathHelper.Lerp(0.25f, 2.2f, amount)); - if (projectile2.ai[0] >= 720f) + if (projectile2.ai[0] >= 360f) chargeUpCenter = new Vector2?(projectile2.Center); if (!Collision.CanHitLine(Main.player[Projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) @@ -197,7 +161,7 @@ namespace CalamityMod.Projectiles.Magic DelegateMethods.v3_1 = color.ToVector3() * 0.3f; Vector2 size = new Vector2(Projectile.velocity.Length() * Projectile.localAI[1], Projectile.width * Projectile.scale); float shaderLength = Projectile.velocity.ToRotation(); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(Projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy(shaderLength), color, size, RippleShape.Square, shaderLength); Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, DelegateMethods.CastLight); @@ -209,58 +173,18 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.velocity == Vector2.Zero) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; float drawArea = Projectile.localAI[1]; Projectile projectile2 = Main.projectile[(int)Projectile.ai[1]]; - Color color = new Color(1, 1, 1, 127); - if (projectile2.ai[0] < 720f) - { - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + ((projectile2.ai[0] - 360f) / 360f * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - } - else - { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - { - colorLimit = 255f; - } - switch ((int)Projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); - break; - } - } + Color color = GetBeamColor((int)projectile2.ai[0], (int)Projectile.ai[0]); - Color value25 = color; + Vector2 drawStart = Projectile.Center.Floor(); drawStart += Projectile.velocity * Projectile.scale * 10.5f; drawArea -= Projectile.scale * 14.5f * Projectile.scale; Vector2 drawScale = new Vector2(Projectile.scale); DelegateMethods.f_1 = 1f; - DelegateMethods.c_1 = value25 * 0.75f * Projectile.Opacity; + DelegateMethods.c_1 = color * 0.75f * Projectile.Opacity; Vector2 projPos = Projectile.oldPos[0]; projPos = new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, drawStart - Main.screenPosition, drawStart + Projectile.velocity * drawArea - Main.screenPosition, drawScale, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); @@ -269,6 +193,46 @@ namespace CalamityMod.Projectiles.Magic return false; } + public Color GetBeamColor(int timer, int type) + { + Color color = Color.Black; + if (timer < 360f) + { + float brightness = MathHelper.Clamp(timer / 180f, 0f, 1f); + color = Color.Lerp(Color.Black, Color.White, brightness); + } + else + { + float hue = 0f; + switch (type) + { + case 1: // 30 (Orange) + hue = 1f / 12f; + break; + case 2: // 60 (Yellow) + hue = 1f / 6f; + break; + case 3: // 120 (Green) + hue = 1f / 3f; + break; + case 4: // 210 (Blue) + hue = 7f / 12f; + break; + case 5: // 270 (Purple) + hue = 3f / 4f; + break; + case 0: // 0 (Red) + default: + hue = 0f; + break; + } + float lightness = 1f - (MathHelper.Clamp((timer - 360f) / 240f, 0f, 1f) * 0.4f); + color = Main.hslToRgb(hue, 1f, lightness); + } + color.A = 127; + return color; + } + public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index e3c0d1a384..a512651328 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Color prismColorArea = 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)); - if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) + if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Type]) { prismColorArea = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); } @@ -169,8 +169,8 @@ namespace CalamityMod.Projectiles.Magic { spriteEffects = SpriteEffects.FlipHorizontally; } - Texture2D texture2D14 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D14 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/DeathValleyDusterProjectile.cs b/Projectiles/Magic/DeathValleyDusterProjectile.cs index 873f582895..d7602bf560 100644 --- a/Projectiles/Magic/DeathValleyDusterProjectile.cs +++ b/Projectiles/Magic/DeathValleyDusterProjectile.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Projectiles.Magic public List buffList = new List(new bool[Main.maxPlayers]); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { if (Projectile.timeLeft > 50) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.4f * Projectile.Opacity, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.4f * Projectile.Opacity, 1); return true; } } diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index 776538b8cb..f1b2dc7525 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -1,8 +1,11 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,66 +14,110 @@ namespace CalamityMod.Projectiles.Magic public class DivineRetributionSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public Player Owner => Main.player[Projectile.owner]; + public ref float VelocityScale => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; + + public static float HomingSpeed => 20f; + public static float HomingTime => 15f; + public static float ReturnTime => 75f; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = Projectile.height = 30; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; - Projectile.extraUpdates = 1; Projectile.penetrate = 1; - Projectile.timeLeft = 420; + Projectile.timeLeft = 210; } public override void AI() { - float aiVelocityMult = 25f * Projectile.ai[1]; //100 - float scaleFactor = 5f * Projectile.ai[1]; //5 - float homingRange = 1000f; + Projectile.rotation = Projectile.velocity.ToRotation(); - if (Projectile.velocity.X < 0f) + Time++; + Projectile.Opacity = Utils.GetLerpValue(0f, 18f, Projectile.timeLeft, true); + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.7f * Projectile.Opacity); + + if (Time % 2f == 1f) { - 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(); + Vector2 dustOffset = (Vector2.UnitY * MathF.Sin(Projectile.timeLeft * MathHelper.Pi * 0.05f) * 16f).RotatedBy(Projectile.velocity.ToRotation()); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustOffset, ModContent.DustType()); + dust.noGravity = true; + dust.noLightEmittence = true; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + dust.scale = Main.rand.NextFloat(0.4f, 0.6f); } - Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f); - if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) + NPC potentialTarget = Projectile.Center.ClosestNPCAt(Time >= ReturnTime ? 480f : 320f); + if (potentialTarget != null && Time >= HomingTime) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingRange) + Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * HomingSpeed * VelocityScale; + Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f); + return; + } + else if (Owner.active && !Owner.dead && Time >= ReturnTime) + { + Vector2 idealVelocity = Projectile.SafeDirectionTo(Owner.MountedCenter) * HomingSpeed * VelocityScale * (1.2f - Utils.GetLerpValue(800f, 160f, Vector2.Distance(Projectile.Center, Owner.MountedCenter), true)); + Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f); + } + if (!Owner.active || Owner.dead || (Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 240f && Time >= ReturnTime)) + { + Projectile.timeLeft--; + if (!Owner.active || Owner.dead || Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 80f) { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (aiVelocityMult - 1f) + moveDirection * scaleFactor) / aiVelocityMult; - return; - } - - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 9f, 20f); - } - else - { - if (Projectile.timeLeft > 30) - { - Projectile.timeLeft = 30; + if (Projectile.timeLeft > 30) + Projectile.timeLeft = 30; } } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Texture2D spear = TextureAssets.Projectile[Type].Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + float cLerp = Utils.GetLerpValue(210, 160, Projectile.timeLeft, true); + Color baseColor = Color.Lerp(Color.Goldenrod, new Color(255, 255, 150), cLerp) * Projectile.Opacity; + Color glowColor = Color.Lerp(Color.OrangeRed, Color.Orange, cLerp) * Projectile.Opacity; + + float squish = MathHelper.Clamp(Projectile.velocity.Length() * 0.04f, 0, 0.2f); + Vector2 scale = new Vector2(1f + squish, 1f - squish); + + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + float completionRatio = i / (float)Projectile.oldPos.Length; + Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + + Color trailColor = Color.Lerp(glowColor, Color.Black, completionRatio) * 0.35f; + Vector2 trailScale = scale * MathHelper.Lerp(1f, 0.15f, completionRatio); + + Main.EntitySpriteDraw(spear, trailPos, null, trailColor, Projectile.oldRot[i], spear.Size() * 0.5f, trailScale, SpriteEffects.None); + } + } + + for (int i = 0; i < 8; i++) + { + Vector2 offset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; + Main.EntitySpriteDraw(spear, drawPos + offset, null, Color.Lerp(baseColor, glowColor, 0.8f) * 0.5f, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None); + } + Main.spriteBatch.ExitShaderRegion(); + + Main.EntitySpriteDraw(spear, drawPos, null, baseColor, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None); return false; } @@ -80,28 +127,20 @@ namespace CalamityMod.Projectiles.Magic 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.ExpandHitboxBy(96); Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - for (int i = 0; i < 6; i++) + for (int i = 0; i < 9; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0); - } - for (int j = 0; j < 10; j++) - { - 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(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0); - Main.dust[divinity].velocity *= 2f; - Main.dust[divinity].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(5f, 5f)); + dust.noGravity = true; + dust.noLightEmittence = true; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); } } } diff --git a/Projectiles/Magic/DivineRetributionSpear.png b/Projectiles/Magic/DivineRetributionSpear.png index 2e733503aa..c8b7e089ab 100644 Binary files a/Projectiles/Magic/DivineRetributionSpear.png and b/Projectiles/Magic/DivineRetributionSpear.png differ diff --git a/Projectiles/Magic/EelDrop.cs b/Projectiles/Magic/EelDrop.cs index e932ba247a..b636db1279 100644 --- a/Projectiles/Magic/EelDrop.cs +++ b/Projectiles/Magic/EelDrop.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Magic/EidolicWailSoundwave.cs b/Projectiles/Magic/EidolicWailSoundwave.cs index 9d5fc819c4..23316f5c74 100644 --- a/Projectiles/Magic/EidolicWailSoundwave.cs +++ b/Projectiles/Magic/EidolicWailSoundwave.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 7; + Projectile.penetrate = 11; Projectile.DamageType = DamageClass.Magic; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; @@ -35,8 +35,8 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.localAI[0] < 1f) { - Projectile.localAI[0] += 0.02f; // 50 frames to reach full size and max power - Projectile.scale += 0.02f; + Projectile.localAI[0] += 0.05f; // 20 frames to reach full size + Projectile.scale += 0.05f; Projectile.width = (int)(36f * Projectile.scale); Projectile.height = (int)(36f * Projectile.scale); } @@ -63,8 +63,6 @@ namespace CalamityMod.Projectiles.Magic public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= Projectile.localAI[0]; - if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.75f); // 25% damage nerf for every enemy hit if (Projectile.damage < 1) @@ -74,7 +72,9 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); + if (Projectile.numHits == 0) + Projectile.velocity *= 0.4f; } public override Color? GetAlpha(Color lightColor) @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index 7720dae937..d41eb0e8df 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -72,6 +72,7 @@ namespace CalamityMod.Projectiles.Magic { if (Main.myPlayer == Projectile.owner) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld) * SubsumingVortex.ReleaseSpeed; Projectile.damage = (int)(Projectile.damage * SubsumingVortex.ReleaseDamageFactor); HasBeenReleased = true; @@ -82,6 +83,7 @@ namespace CalamityMod.Projectiles.Magic { if (Main.myPlayer == Projectile.owner) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld) * SubsumingVortex.ReleaseSpeed; Projectile.damage = (int)(Projectile.damage * (1f + Time * 0.0152f)); HasBeenReleased = true; @@ -163,12 +165,11 @@ namespace CalamityMod.Projectiles.Magic // Smoothly approach a sinusoidal offset as time goes on. float verticalOffset = Utils.Remap(Time, 0f, 90f, -30f, (float)Math.Cos(Projectile.timeLeft / 32f) * 30f); Vector2 hoverDestination = Owner.Top + new Vector2(Owner.direction * Projectile.scale * 30f, verticalOffset); - hoverDestination += (Main.MouseWorld - hoverDestination) * SubsumingVortex.GiantVortexMouseDriftFactor; + hoverDestination += (Owner.ClampedMouseWorld() - hoverDestination) * SubsumingVortex.GiantVortexMouseDriftFactor; Vector2 idealVelocity = Vector2.Zero.MoveTowards(hoverDestination - Projectile.Center, 32f); Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.04f); - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } // Re-determine the hitbox size. @@ -218,6 +219,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 scale = Projectile.Size / worleyNoise.Size() * 2f; float spinRotation = Main.GlobalTimeWrappedHourly * 2.4f; + GameShaders.Misc["CalamityMod:ExoVortex"].UseOpacity(1f); GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); // Draw the vortex. diff --git a/Projectiles/Magic/EternityBook.cs b/Projectiles/Magic/EternityBook.cs index a2b8f21950..07ddff29fc 100644 --- a/Projectiles/Magic/EternityBook.cs +++ b/Projectiles/Magic/EternityBook.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic } public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; } public override void SetDefaults() @@ -49,7 +49,8 @@ namespace CalamityMod.Projectiles.Magic // Summon a bunch of cool things the moment the book is created, assuming an NPC is near the mouse position. if (Main.myPlayer == Projectile.owner && Time == 1f) { - NPC target = Main.MouseWorld.ClosestNPCAt(4400f, true, true); + // 14NOV2024: Ozzatron: Eternity's range is so absurdly high (more than two 1080p screens wide) that it doesn't really matter whether this is capped. + NPC target = player.ClampedMouseWorld().ClosestNPCAt(4400f, true, true); if (target != null) { @@ -60,8 +61,8 @@ namespace CalamityMod.Projectiles.Magic // Switch frames at a linearly increasing rate to make it look like the player is flipping pages quickly. Projectile.localAI[0] += Utils.Remap(Time, 0f, 200f, 1f, 5f); - Projectile.frame = (int)Math.Round(Projectile.localAI[0] / 10f) % Main.projFrames[Projectile.type]; - if (Projectile.localAI[0] >= Main.projFrames[Projectile.type] * 10f) + Projectile.frame = (int)Math.Round(Projectile.localAI[0] / 10f) % Main.projFrames[Type]; + if (Projectile.localAI[0] >= Main.projFrames[Type] * 10f) Projectile.localAI[0] = 0f; AdjustPlayerValues(player); @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic // Update the player's arm directions to make it look as though they're flipping through the book. float frontArmRotation = (MathHelper.PiOver2 - 0.46f) * -player.direction; - float backArmRotation = frontArmRotation + MathHelper.Lerp(0.12f, 1.1f, CalamityUtils.Convert01To010(Projectile.localAI[0] / Main.projFrames[Projectile.type] / 10f)) * -player.direction; + float backArmRotation = frontArmRotation + MathHelper.Lerp(0.12f, 1.1f, CalamityUtils.Convert01To010(Projectile.localAI[0] / Main.projFrames[Type] / 10f)) * -player.direction; player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, backArmRotation); player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, frontArmRotation); } diff --git a/Projectiles/Magic/EternityCrystal.cs b/Projectiles/Magic/EternityCrystal.cs index afaa3fc468..089eb63ded 100644 --- a/Projectiles/Magic/EternityCrystal.cs +++ b/Projectiles/Magic/EternityCrystal.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic public const int InwardCollapseTime = 70; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 2; } public override void SetDefaults() @@ -127,11 +128,9 @@ namespace CalamityMod.Projectiles.Magic } public void ExplosionEffect(NPC target, Player player) { - // Apply damage to the target and register it to the owner's DPS meter. - // TODO -- why does Eternity directly StrikeNPC with its own damage variance instead of using a DirectStrike - int damage = (int)player.GetTotalDamage().ApplyTo(Eternity.ExplosionDamage * Main.rand.NextFloat(0.9f, 1.1f)); - player.addDPS(damage); - target.StrikeNPC(target.CalculateHitInfo(damage, 0, false, 0f)); + // Apply damage to the target. + int damage = (int)player.GetTotalDamage().ApplyTo(Eternity.ExplosionDamage); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Projectile.owner, target.whoAmI); Vector2 randomCirclePointVector = Vector2.UnitY.RotatedBy(Projectile.rotation); @@ -166,8 +165,8 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - Texture2D myTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = myTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D myTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = myTexture.Frame(1, Main.projFrames[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 8443eb4ffb..ce073f8144 100644 --- a/Projectiles/Magic/EternityHex.cs +++ b/Projectiles/Magic/EternityHex.cs @@ -42,8 +42,8 @@ namespace CalamityMod.Projectiles.Magic public const float NormalEnemyLifeMaxDamageMult = 1f / 100f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 63; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 63; } public override void SetDefaults() @@ -77,7 +77,8 @@ namespace CalamityMod.Projectiles.Magic if (!target.active) { - NPC potentialTarget = Main.MouseWorld.ClosestNPCAt(4400f, true, true); + // 14NOV2024: Ozzatron: Eternity's range is so absurdly high (more than two 1080p screens wide) that it doesn't really matter whether this is capped. + NPC potentialTarget = player.ClampedMouseWorld().ClosestNPCAt(4400f, true, true); if (potentialTarget != null) { // If something happens to the original NPC, such as death, attempt to locate a new target and attack to them. @@ -138,7 +139,7 @@ namespace CalamityMod.Projectiles.Magic // Release bursts of homing dark magic bolts periodically. The amount of bolts that can be summoned has a hard limit. // This is where most of the damage comes from. Be careful when messing with this. - if ((int)Time % 30 == 0 && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) < Eternity.MaxHomers) + if ((int)Time % 30 == 0 && CalamityUtils.CountOwnedProjectiles(ModContent.ProjectileType(), Projectile.owner) < Eternity.MaxHomers) { int homerCount = 6; int damage = (int)player.GetTotalDamage().ApplyTo(0.8f * Eternity.BaseDamage); diff --git a/Projectiles/Magic/EternityHoming.cs b/Projectiles/Magic/EternityHoming.cs index ebcf9fca92..1911bad441 100644 --- a/Projectiles/Magic/EternityHoming.cs +++ b/Projectiles/Magic/EternityHoming.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -11,6 +12,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 2; diff --git a/Projectiles/Magic/EventHorizonBlackhole.cs b/Projectiles/Magic/EventHorizonBlackhole.cs index 7bc883ed49..6b19a3af06 100644 --- a/Projectiles/Magic/EventHorizonBlackhole.cs +++ b/Projectiles/Magic/EventHorizonBlackhole.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = 25; } public override bool? CanHitNPC(NPC target) @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index daf819b4d6..3b309decb3 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -16,8 +16,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -25,9 +26,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 40; Projectile.height = 40; Projectile.friendly = true; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 25; Projectile.timeLeft = 300; Projectile.alpha = 180; } @@ -122,18 +125,22 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + if (Projectile.localAI[0] >= 100) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Projectile.Kill(); + } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 db5714d406..dbd85e0838 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 aba7ceed69..ba25da0d47 100644 --- a/Projectiles/Magic/ExoVortex.cs +++ b/Projectiles/Magic/ExoVortex.cs @@ -8,7 +8,6 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Magic { @@ -26,8 +25,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 35; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 35; } public override void SetDefaults() @@ -121,6 +121,7 @@ namespace CalamityMod.Projectiles.Magic PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveTrailColor, PrimitiveOffsetFunction, shader: GameShaders.Misc["CalamityMod:SideStreakTrail"]), 51); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + GameShaders.Misc["CalamityMod:ExoVortex"].UseOpacity(1f); 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 594aac4474..e8e1c97ce0 100644 --- a/Projectiles/Magic/ExoVortex2.cs +++ b/Projectiles/Magic/ExoVortex2.cs @@ -8,7 +8,6 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Magic { @@ -26,8 +25,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 27; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 27; } public override void SetDefaults() @@ -125,6 +125,7 @@ namespace CalamityMod.Projectiles.Magic PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveTrailColor, PrimitiveOffsetFunction, shader: GameShaders.Misc["CalamityMod:SideStreakTrail"]), 51); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + GameShaders.Misc["CalamityMod:ExoVortex"].UseOpacity(1f); 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 e31698e9c6..75521fc686 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -21,8 +21,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 23; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 23; } public override void SetDefaults() diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index a58f5f7bfa..6afbdea101 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 54; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 54; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (Projectile.hostile) - target.AddBuff(ModContent.BuffType(), 54000); + target.AddBuff(ModContent.BuffType(), 54000); } } } diff --git a/Projectiles/Magic/FatesRevealFlame.cs b/Projectiles/Magic/FatesRevealFlame.cs index 28d0743a61..d31fb68c89 100644 --- a/Projectiles/Magic/FatesRevealFlame.cs +++ b/Projectiles/Magic/FatesRevealFlame.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Magic/FireImplosion.cs b/Projectiles/Magic/FireImplosion.cs new file mode 100644 index 0000000000..83de69cf6c --- /dev/null +++ b/Projectiles/Magic/FireImplosion.cs @@ -0,0 +1,190 @@ +using System; +using System.IO; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Build.Construction; +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 FireImplosion : ModProjectile, ILocalizedModType // Used by both Flare bolt and Frigidflash Bolt + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Vector2 pushVelocity; + public float customKnockback = 0; + public int time = 0; + public int boomTime = 0; + public bool frigidFlash => Projectile.ai[2] == 5; + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 55; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.ArmorPenetration = 20; + } + public override void AI() + { + if (customKnockback == 0) // On spawn effects + { + Projectile.scale = 0; + Projectile.alpha = 0; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/OpalChargedFire") with { Volume = 0.35f, Pitch = 0.7f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FireImplosion") with { Volume = 0.45f, Pitch = Main.rand.NextFloat(0.2f, 0.35f) }, Projectile.Center); + customKnockback = Math.Abs(Projectile.knockBack); + Projectile.knockBack = 0; + + for (int i = 0; i < 3; i++) + { + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.1f + i * 0.1f, 18); + GeneralParticleHandler.SpawnParticle(orb1); + } + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 8; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2().RotatedBy(rot) * 13f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 3, velocity * 0.5f, "CalamityMod/Particles/FireTypeParticle", false, 35, 1.5f, Color.OrangeRed, new Vector2(1, 1.3f), true, false, shrinkSpeed: 0.15f); + GeneralParticleHandler.SpawnParticle(trail); + } + } + if (boomTime >= 15) + { + Projectile.scale = 0.95f * Utils.GetLerpValue(42, 0, time, true) * Utils.GetLerpValue(40, 25, time, true); + time++; + } + else // When the vortex is expanding out before it starts shrinking + { + Projectile.scale = 0.95f * Utils.GetLerpValue(0, 15, boomTime, true); + boomTime++; + } + if (Projectile.timeLeft <= 20) // Fizzles out at the end + { + if ((frigidFlash && Projectile.timeLeft % 3 == 0) || !frigidFlash) + { + Particle fx = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 6), "CalamityMod/Particles/FireTypeParticle", false, 22, Main.rand.NextFloat(0.7f, 1.2f), Color.OrangeRed, new Vector2(0.8f, 1f), true, false); + GeneralParticleHandler.SpawnParticle(fx); + } + if (frigidFlash) + { + Particle fx2 = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 6), "CalamityMod/Particles/IceTypeParticle", false, 22, Main.rand.NextFloat(0.7f, 1.2f), Color.DeepSkyBlue, new Vector2(0.8f, 1f), true, false, shrinkSpeed: -0.1f); + GeneralParticleHandler.SpawnParticle(fx2); + } + } + else if (boomTime > 5) + { + for (int i = 0; i < 2; i++) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(7f, 14) * Projectile.scale; + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 3, ModContent.DustType(), vel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.75f, 1.1f); + dust.color = Color.OrangeRed; + dust.noLightEmittence = true; + } + } + Lighting.AddLight(Projectile.Center, Color.Orange.ToVector3() * 2 * Projectile.scale); + Projectile.rotation += 0.4f; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (frigidFlash) + { + target.AddBuff(BuffID.OnFire3, 30); + target.AddBuff(BuffID.Frostburn2, 30); + } + else + target.AddBuff(BuffID.OnFire, 180); + pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback; + float minMult = 0.4f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (frigidFlash ? 0.5f : 1); // Frigidflash explosion are spawned at full power, so their damage is reduced here + + // The vortex sucks in enemies + target.MoveNPC(-pushVelocity, customKnockback, frigidFlash); + } + public override void OnKill(int timeLeft) + { + if (frigidFlash) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash") with { Volume = 1, Pitch = -0.2f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DeerclopsIceAttack with { Volume = 0.85f, Pitch = 0.1f }, Projectile.Center); + + // Create Blast + float blastSize = 160; + float minMultiplier = 0.25f; + int hitsToMinMult = 8; + int debuff1 = BuffID.Frostburn2; + int debuff2 = BuffID.OnFire3; + int debuffTime = 230; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 4f), customKnockback * 2, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[2] = debuff2; + blast.localAI[1] = debuffTime; + blast.DamageType = DamageClass.Magic; + + // BIGGER "Snowflake" visual effect + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 8; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2().RotatedBy(rot) * 14f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 3, velocity * 0.5f, "CalamityMod/Particles/IceTypeParticle", false, 32, 1.3f, Color.Lerp(Color.DeepSkyBlue, Color.White, 0.5f), new Vector2(1.2f, 1.8f), true, false, shrinkSpeed: -0.27f); + GeneralParticleHandler.SpawnParticle(trail); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity.RotatedBy(MathHelper.ToRadians(22.5f)) * 1.2f); + dust.noGravity = true; + dust.scale = 1.75f; + dust.color = Color.OrangeRed; + dust.noLightEmittence = true; + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity * 1.5f); + dust2.noGravity = true; + dust2.scale = 1.4f; + dust2.color = Color.DeepSkyBlue; + dust2.noLightEmittence = true; + } + for (int i = 0; i < 5; i++) + { + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.3f, 1.1f, 25); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DeepSkyBlue, Color.White, i * 0.15f), "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.6f, 0.8f - i * 0.07f, 20); + GeneralParticleHandler.SpawnParticle(orb1); + } + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, (110 * Projectile.scale) + 15, targetHitbox); + } + public override bool PreDraw(ref Color lightColor) + { + if (boomTime < 1) + return false; + float fade = Utils.GetLerpValue(0, 20, Projectile.timeLeft, true); + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + Color useColor = frigidFlash ? Color.Lerp(Color.DeepSkyBlue, Color.OrangeRed, fade) : Color.OrangeRed; + + for (int i = 0; i < 15; i++) + { + Color auraColor = useColor with { A = 0 } * 0.4f; + Vector2 drawOffset = (MathHelper.TwoPi * i / 15f).ToRotationVector2().RotatedBy(Main.GlobalTimeWrappedHourly * 28 - fade * 10) * 7 * fade; + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation + i * 2.5f, texture.Size() * 0.5f, new Vector2(1 * fade, 1 + (1 - fade)) * MathHelper.Clamp((Projectile.scale - (i * 0.02f)), 0, 10), SpriteEffects.None); + } + + return false; + } + } +} diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index d744d9eb4f..e4f2bb2345 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -1,4 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Build.Construction; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -8,98 +13,110 @@ namespace CalamityMod.Projectiles.Magic { public class FlareBoltProjectile : ModProjectile, ILocalizedModType { + public ref float time => ref Projectile.ai[0]; + public int wallBounces = 0; + public float fadeIn = 0; + public bool launch = true; + public Color bColor = Color.OrangeRed; public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - public override void SetDefaults() { Projectile.width = 16; Projectile.height = 16; Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 4; - Projectile.timeLeft = 480; + Projectile.penetrate = -1; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = -1; } - public override void AI() { - if (Projectile.alpha > 0) + Player Owner = Main.player[Projectile.owner]; + Lighting.AddLight(Projectile.Center, bColor.ToVector3()); + Vector2 mouse = Owner.Calamity().mouseWorld; + fadeIn = Utils.GetLerpValue(0, Owner.itemAnimationMax * 0.5f * Projectile.MaxUpdates, time, true); + float velFade = Utils.GetLerpValue(1.5f, 6.5f, Projectile.velocity.Length(), true); + Vector2 velocity = Utils.DirectionTo(Owner.Center, mouse) * Owner.HeldItem.shootSpeed; + Projectile.scale = fadeIn * 1.5f; + if (fadeIn < 1) // Hold the projectile in front of the player while they case the spell { - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.45f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.1f / 255f); - for (int i = 0; i < 2; i++) - { - 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, DustID.InfernoFork, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[fireDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortXVel; - dust.position.Y -= shortYVel; - } - 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, DustID.InfernoFork, 0f, 0f, 100, default, 0.6f); - Main.dust[fireDustSmol].velocity *= 0.25f; - Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; - } - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); + Projectile.Center = Owner.Center + velocity.SafeNormalize(Vector2.UnitX) * 48; } else { - if (Projectile.velocity.X != oldVelocity.X) + if (launch) // On launch, spawns some effects and launch the projectile at the mouse { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - } - return false; - } + Projectile.tileCollide = true; + Vector2 staticSpeed = Utils.DirectionTo(Owner.Center, mouse) * Utils.Distance(Owner.Center, Owner.ClampedMouseWorld()) * 0.0165f; + Projectile.velocity = staticSpeed; + + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HalleysInfernoShoot") with { Volume = 0.45f, Pitch = 0.3f }, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1.5f, 3.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.85f, 1.4f); + dust.color = bColor; + dust.noLightEmittence = true; + if (i % 3 == 0) + { + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + float fxScale = Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance); + Vector2 fxVelocity = Projectile.velocity.RotatedBy(variance) * Main.rand.NextFloat(0.6f, 1f) * (1 - Math.Abs(variance)); + + Particle fx = new CustomSpark(Projectile.Center, fxVelocity * 1.3f, "CalamityMod/Particles/FireTypeParticle", false, 22, fxScale, Color.Lerp(bColor, Color.Red, 0.5f), new Vector2(1.8f, 1f), true, false, shrinkSpeed: 0.2f); + GeneralParticleHandler.SpawnParticle(fx); + } + } + launch = false; + } + + if (Main.rand.NextBool(10) && velFade > 0.1f) + { + Particle fx = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(8, 8), -Projectile.velocity * 0.9f, "CalamityMod/Particles/FireTypeParticle", false, 32, 1.15f, Color.Lerp(bColor, Color.Red, 0.5f), new Vector2(0.8f, 1f), true, false); + GeneralParticleHandler.SpawnParticle(fx); + } + if (Main.rand.NextBool(6)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), ModContent.DustType(), -Projectile.velocity * 0.5f); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.85f, 1.4f); + dust.color = bColor; + dust.noLightEmittence = true; + } + + Particle trail = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 11, 0.3f, bColor * 0.9f, new Vector2(1, 1f), true, false, shrinkSpeed: 0.7f * velFade); + GeneralParticleHandler.SpawnParticle(trail); + } + + if (Projectile.timeLeft < 120) + { + Projectile.velocity *= 0.98f; + } + + Projectile.rotation += 0.3f * Projectile.direction; + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(BuffID.OnFire, 90); + float minMult = 0.1f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override bool PreDraw(ref Color lightColor) { - target.AddBuff(BuffID.OnFire, 180); + Projectile.DrawProjectileWithBackglow(bColor with { A = 0 }, Color.White, 2f * fadeIn); + return false; } } } diff --git a/Projectiles/Magic/ForbiddenAxeBlade.cs b/Projectiles/Magic/ForbiddenAxeBlade.cs index d4a3f84892..d320fcfb4c 100644 --- a/Projectiles/Magic/ForbiddenAxeBlade.cs +++ b/Projectiles/Magic/ForbiddenAxeBlade.cs @@ -10,8 +10,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -61,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/ForbiddenSunProjectile.cs b/Projectiles/Magic/ForbiddenSunProjectile.cs index 5fb8696413..0472da95c3 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -1,4 +1,5 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -28,15 +29,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation(); - if (Projectile.frameCounter++ % 4 == 0) - { - Projectile.frame++; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Type]; + Lighting.AddLight(Projectile.Center, 0.25f, 0.2f, 0.01f); if (Projectile.wet && !Projectile.lavaWet) { Projectile.Kill(); @@ -48,17 +43,18 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(4)) { - int forbid = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); - Main.dust[forbid].noGravity = true; - Main.dust[forbid].velocity *= 0f; + Dust fire = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174); + fire.noGravity = true; + fire.velocity *= 0f; } } public override void OnKill(int timeLeft) { + SoundEngine.PlaySound(SoundID.Item20, 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); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index 03785ec273..a14becc6ca 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -1,7 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -35,11 +33,6 @@ namespace CalamityMod.Projectiles.Magic { Projectile.Kill(); } - if (Projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.localAI[0] += 1f; - } float projTimer = 25f; if (Projectile.ai[0] > 180f) { @@ -52,31 +45,24 @@ namespace CalamityMod.Projectiles.Magic } projTimer *= 0.7f; Projectile.ai[0] += 4f; - int timerCounter = 0; - while ((float)timerCounter < projTimer) + float timerCounter = 0; + while (timerCounter < projTimer) { - float rando1 = (float)Main.rand.Next(-25, 26); - float rando2 = (float)Main.rand.Next(-25, 26); - float rando3 = (float)Main.rand.Next(9, 24); - float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjuster = rando3 / randoAdjuster; - rando1 *= randoAdjuster; - rando2 *= randoAdjuster; - int orngDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 2.5f); - Dust dust = Main.dust[orngDust]; + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, Alpha: 100, Scale: 2.5f); 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; + dust.position = Projectile.Center + Main.rand.NextVector2Circular(10f, 10f); + dust.velocity = Main.rand.NextVector2Circular(25f, 25f); timerCounter++; } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire3, 300); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.HitDirectionOverride = (Projectile.Center.X < target.Center.X).ToDirectionInt(); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } } diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 3011c145e7..119fbf7c03 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -1,5 +1,11 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Build.Construction; using Microsoft.Xna.Framework; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -10,119 +16,255 @@ namespace CalamityMod.Projectiles.Magic public class FrigidflashBoltProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - + public ref float time => ref Projectile.ai[0]; + public bool bigMagic => Projectile.ai[1] == 5; + public int wallBounces = 0; + public float fadeIn = 0; + public bool launch = true; + public Color fireColor = Color.OrangeRed; + public Color iceColor = Color.DeepSkyBlue; + public SlotId chargeSound; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.alpha = 255; Projectile.penetrate = 5; Projectile.timeLeft = 480; + Projectile.extraUpdates = 2; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; } - public override void AI() { - if (Projectile.alpha > 0) + Player Owner = Main.player[Projectile.owner]; + Color lightColor = Color.Lerp(fireColor, iceColor, Utils.GetLerpValue(300, 0, Projectile.timeLeft, true)); + Lighting.AddLight(Projectile.Center, lightColor.ToVector3()); + Vector2 mouse = Owner.Calamity().mouseWorld; + fadeIn = launch ? Utils.GetLerpValue(0, Owner.itemAnimationMax * 0.5f * Projectile.MaxUpdates, time, true) : 1; + Vector2 velocity = Utils.DirectionTo(Owner.Center, mouse) * Owner.HeldItem.shootSpeed; + Projectile.scale = fadeIn * (bigMagic ? 1.3f : 1); + if (fadeIn < 1) // Hold the projectile in front of the player while they case the spell { - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - for (int i = 0; i < 2; i++) - { - 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, DustID.InfernoFork, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[fireDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortXVel; - dust.position.Y -= shortYVel; - } - 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, DustID.InfernoFork, 0f, 0f, 100, default, 0.6f); - Main.dust[fireDustSmol].velocity *= 0.25f; - Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; - } - for (int j = 0; j < 2; j++) - { - 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, DustID.Frost, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[frostDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortyX; - dust.position.Y -= shortyY; - } - 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, DustID.Frost, 0f, 0f, 100, default, 0.6f); - Main.dust[frostDustSmol].velocity *= 0.25f; - Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; - } - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); + Projectile.Center = Owner.Center + velocity.SafeNormalize(Vector2.UnitX) * 48; + if (bigMagic && time % 7 == 0) + { + if (time == 0) + { + chargeSound = SoundEngine.PlaySound(FrigidflashBolt.ChargeSound with { Volume = 0.6f, Pitch = 0.75f }, Projectile.Center); + } + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 3f) * fadeIn; + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 3, ModContent.DustType(), vel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.75f, 1.1f) * fadeIn; + dust.color = Main.rand.NextBool() ? iceColor : fireColor; + dust.noLightEmittence = true; + } + if (SoundEngine.TryGetActiveSound(chargeSound, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; } else { - if (Projectile.velocity.X != oldVelocity.X) + if (launch) // On launch, spawns some effects and launch the projectile at the mouse { - Projectile.velocity.X = -oldVelocity.X; + Projectile.tileCollide = true; + Vector2 staticSpeed = Utils.DirectionTo(Owner.Center, mouse) * Utils.Distance(Owner.Center, Owner.ClampedMouseWorld()) * 0.01f; + Projectile.velocity = (bigMagic ? staticSpeed : velocity); + + SoundEngine.PlaySound(FrigidflashBolt.UseSound with { Volume = 1f, Pitch = (bigMagic ? -0.15f : 0.15f) }, Projectile.Center); + if (bigMagic) + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HalleysInfernoShoot") with { Volume = 0.65f, Pitch = 0.45f }, Projectile.Center); + for (int i = 0; i < (bigMagic ? 14 : 8); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1.1f, 1.9f) * (bigMagic ? 2 : 1)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 1f) * (bigMagic ? 1.5f : 1); + dust.color = Main.rand.NextBool() ? fireColor : iceColor; + dust.noLightEmittence = true; + + if (i % 2 == 0) + { + bool type = Main.rand.NextBool(); + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + float fxScale = (Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance)) * 0.4f; + Vector2 fxVelocity = (Projectile.velocity * 2).RotatedBy(variance) * Main.rand.NextFloat(0.6f, 1f) * (1 - Math.Abs(variance)) * (bigMagic ? 2 : 1); + + Particle fx = new VelChangingSpark(Projectile.Center, fxVelocity * 1.3f, fxVelocity.RotatedBy(variance * 1.3f), "CalamityMod/Particles/FullStar", 22, fxScale, type ? fireColor : iceColor, new Vector2(2f, 1f), true, false, shrinkSpeed: 0.3f, lerpRate: 0.2f); + GeneralParticleHandler.SpawnParticle(fx); + } + } + launch = false; } - if (Projectile.velocity.Y != oldVelocity.Y) + + if (Main.rand.NextBool(8)) { - Projectile.velocity.Y = -oldVelocity.Y; + bool type = Main.rand.NextBool(); + Particle fx = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(12, 12), -Projectile.velocity * 0.3f, type ? "CalamityMod/Particles/FireTypeParticle" : "CalamityMod/Particles/IceTypeParticle", false, 32, 0.9f, type ? fireColor : iceColor, new Vector2(0.8f, 1f), true, false, shrinkSpeed: type ? 0.2f : 0); + GeneralParticleHandler.SpawnParticle(fx); } - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + float velFade = Utils.GetLerpValue(1.5f, 6.5f, Projectile.velocity.Length(), true); + Particle iceTrail = new CustomSpark(Projectile.Center + (Vector2.One * 3 * Projectile.scale).RotatedBy(Projectile.rotation), -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 7, 0.2f, iceColor * 0.9f, new Vector2(1, 1f), true, false, shrinkSpeed: 0.8f * velFade); + GeneralParticleHandler.SpawnParticle(iceTrail); + Particle fireTrail = new CustomSpark(Projectile.Center - (Vector2.One * 3 * Projectile.scale).RotatedBy(Projectile.rotation), -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 7, 0.2f, fireColor * 0.9f, new Vector2(1, 1f), true, false, shrinkSpeed: 0.8f * velFade); + GeneralParticleHandler.SpawnParticle(fireTrail); } + if (bigMagic) + { + if (Projectile.timeLeft < 145) + { + Projectile.velocity *= 0.98f; + } + } + else + { + // Gain gravity after a while + // This makes it more useful on the surface where you otherwise have less tiles to work with + if (Projectile.timeLeft < 260) + { + Projectile.velocity.X *= 0.9711f; + if (Projectile.velocity.Y < 15) + Projectile.velocity.Y += 0.19f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.977f; + wallBounces = 2; // Will always expire on the next tile collide + } + else if (wallBounces > 1) // If you only have one bounce before death, reduce lifetime to start falling faster + Projectile.timeLeft--; + } + + Projectile.rotation += (0.7f * Projectile.direction / Projectile.MaxUpdates) * Projectile.scale; + time++; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (bigMagic) + { + Projectile.Kill(); + return false; + } + + // Allow bounced bolts to hit enemies already hit before the bounce + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + 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.Center); + + smallMagicExplosion(); + + if (wallBounces >= 2) + { + Projectile.Kill(); + } + wallBounces++; + return false; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(BuffID.OnFire3, 60); + target.AddBuff(BuffID.Frostburn2, 60); + float minMult = 0.2f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(FrigidflashBolt.ProjDeathSound, Projectile.Center); - for (int k = 0; k < 3; k++) + if (bigMagic) // Collapsing explosion for the big attack { - 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); + // This explosion gets full damage because it spawns another itself, it actually only deals a portion of the projectile damage + Projectile bigBlast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack, Projectile.owner, 0, 0, 5); + bigBlast.ArmorPenetration = 20; // Hits rapidly enough that it needs some + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 6; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot - MathHelper.ToRadians(90)) * 8f; + Particle trail = new VelChangingSpark(Projectile.Center + velocity * 20, -velocity * 0.2f, -velocity * 5f, "CalamityMod/Particles/IceTypeParticle", 55, 1.8f, Color.Lerp(iceColor, Color.White, 0.5f), new Vector2(1.1f, 1f), true, false, shrinkSpeed: 0.15f, lerpRate: 0.01f); + GeneralParticleHandler.SpawnParticle(trail); + } + for (int n = 0; n < 15; n++) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 15); + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 14, ModContent.DustType(), -vel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.2f, 1.7f); + dust.color = iceColor; + dust.noLightEmittence = true; + } + } + else + { + if (wallBounces < 2) + { + smallMagicExplosion(); + } + SoundEngine.PlaySound(FrigidflashBolt.ProjDeathSound, Projectile.Center); } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public void smallMagicExplosion() { - target.AddBuff(BuffID.OnFire3, 180); - target.AddBuff(BuffID.Frostburn2, 180); + // Create Blast + float blastSize = 80; + float minMultiplier = 0.25f; + int hitsToMinMult = 4; + int debuff1 = BuffID.Frostburn2; + int debuff2 = BuffID.OnFire3; + int debuffTime = 90; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[2] = debuff2; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Magic; + + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = -0.3f, MaxInstances = -1 }, Projectile.Center); + + // "Snowflake" visual effect, but now with fire too + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 6; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot) * 6f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 3, velocity * 0.5f, "CalamityMod/Particles/IceTypeParticle", false, 25, 1.3f, iceColor, new Vector2(1, 1.8f), true, false, shrinkSpeed: -0.45f); + GeneralParticleHandler.SpawnParticle(trail); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity * 1.5f); + dust.noGravity = true; + dust.scale = 1.45f; + dust.color = fireColor; + dust.noLightEmittence = true; + } + for (int i = 0; i < 6; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot - MathHelper.ToRadians(90)) * 6f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 6, velocity * 0.5f, "CalamityMod/Particles/FireTypeParticle", false, 25, 1.5f, fireColor, new Vector2(1.8f, 1f), true, false, shrinkSpeed: 0.25f); + GeneralParticleHandler.SpawnParticle(trail); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity * 2f); + dust.noGravity = true; + dust.scale = 1.25f; + dust.color = iceColor; + dust.noLightEmittence = true; + } + + } + public override bool PreDraw(ref Color lightColor) + { + Color drawColor = Color.Lerp(fireColor, iceColor, Utils.GetLerpValue(300, 0, Projectile.timeLeft, true)); + Projectile.DrawProjectileWithBackglow(drawColor with { A = 0 }, Color.White, 3f * fadeIn); + return false; } } } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index 06cadcc66d..dae2d9f8c1 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -1,4 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -8,99 +13,146 @@ namespace CalamityMod.Projectiles.Magic { public class FrostBoltProjectile : ModProjectile, ILocalizedModType { + public ref float time => ref Projectile.ai[0]; + public int wallBounces = 0; + public float fadeIn = 0; + public bool launch = true; + public Color bColor = Color.DeepSkyBlue; public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - public override void SetDefaults() { Projectile.width = 16; Projectile.height = 16; Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 2; + Projectile.penetrate = 3; Projectile.timeLeft = 480; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.coldDamage = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } - public override void AI() { - if (Projectile.alpha > 0) + Player Owner = Main.player[Projectile.owner]; + Lighting.AddLight(Projectile.Center, bColor.ToVector3()); + fadeIn = Utils.GetLerpValue(0, Owner.itemAnimationMax * 0.5f * Projectile.MaxUpdates, time, true); + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * Owner.HeldItem.shootSpeed; + Projectile.scale = fadeIn; + if (fadeIn < 1) // Hold the projectile in front of the player while they case the spell { - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.45f / 255f); - for (int i = 0; i < 2; i++) - { - 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, DustID.Frost, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[frostDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortXVel; - dust.position.Y -= shortYVel; - } - 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, DustID.Frost, 0f, 0f, 100, default, 0.6f); - Main.dust[frostDustSmol].velocity *= 0.25f; - Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; - } - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); + Projectile.Center = Owner.Center + velocity.SafeNormalize(Vector2.UnitX) * 48; } else { - if (Projectile.velocity.X != oldVelocity.X) + if (launch) // On launch, spawns some effects and launch the projectile at the mouse { - Projectile.velocity.X = -oldVelocity.X; + Projectile.tileCollide = true; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCHit/CryogenHit", 3) with { Volume = 0.45f, Pitch = 0.3f }, Projectile.Center); + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 1f); + dust.color = bColor; + dust.noLightEmittence = true; + } + Projectile.velocity = velocity; + launch = false; } - if (Projectile.velocity.Y != oldVelocity.Y) + + if (Main.rand.NextBool(15)) { - Projectile.velocity.Y = -oldVelocity.Y; + Particle fx = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(8, 8), -Projectile.velocity * 0.3f, "CalamityMod/Particles/IceTypeParticle", false, 32, 0.9f, Color.Lerp(bColor, Color.White, 0.5f), new Vector2(0.8f, 1f), true, false); + GeneralParticleHandler.SpawnParticle(fx); } - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + Particle trail = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 7, 0.2f, bColor * 0.9f, new Vector2(1, 1f), true, false, shrinkSpeed: 0.8f); + GeneralParticleHandler.SpawnParticle(trail); } + // Gain gravity after a while + // This makes it more useful on the surface where you otherwise have less tiles to work with + if (Projectile.timeLeft < 260) + { + Projectile.velocity.X *= 0.9711f; + if (Projectile.velocity.Y < 15) + Projectile.velocity.Y += 0.19f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.977f; + wallBounces = 2; // Will always expire on the next tile collide + } + else if (wallBounces > 1) // If you only have one bounce before death, reduce lifetime to start falling faster + Projectile.timeLeft--; + Projectile.rotation += 0.3f * Projectile.direction; + time++; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + // Allow bounced bolts to hit enemies already hit before the bounce + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + 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.Center); + + // Create Blast + float blastSize = 80; + float minMultiplier = 0.25f; + int hitsToMinMult = 4; + int debuff = BuffID.Frostburn; + int debuffTime = 120; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Magic; + + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = -0.3f, MaxInstances = -1 }, Projectile.Center); + + // "Snowflake" visual effect + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 6; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot) * 6f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 3, velocity * 0.5f, "CalamityMod/Particles/IceTypeParticle", false, 25, 1.3f, Color.Lerp(bColor, Color.White, 0.5f), new Vector2(1, 1.8f), true, false, shrinkSpeed: -0.45f); + GeneralParticleHandler.SpawnParticle(trail); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity * 1.5f); + dust.noGravity = true; + dust.scale = 1.3f; + dust.color = bColor; + dust.noLightEmittence = true; + } + + if (wallBounces >= 2) + { + Projectile.Kill(); + } + wallBounces++; + return false; } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Frost, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn, 60); + // Since this reduces the damage of the projectile directly, the damage of its explosions is also decreased + // This is intedned for Frost Bolt, but is not kept for the upgrades + // Feel free to change this to use the same pierce reduction as its upgrades if this doesn't work out + if (Projectile.damage > 1) + Projectile.damage = (int)(Projectile.damage * 0.85f); + } + public override bool PreDraw(ref Color lightColor) + { + Projectile.DrawProjectileWithBackglow(bColor with { A = 0 }, Color.White, 2f * fadeIn); + return false; } } } diff --git a/Projectiles/Magic/GammaLaser.cs b/Projectiles/Magic/GammaLaser.cs index 85f8aa17ec..0030bf2cdc 100644 --- a/Projectiles/Magic/GammaLaser.cs +++ b/Projectiles/Magic/GammaLaser.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/GenesisBeam.cs b/Projectiles/Magic/GenesisBeam.cs index 1290158ebd..f93e9798bc 100644 --- a/Projectiles/Magic/GenesisBeam.cs +++ b/Projectiles/Magic/GenesisBeam.cs @@ -104,8 +104,7 @@ namespace CalamityMod.Projectiles.Magic } } - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } public void OnHitEffects() diff --git a/Projectiles/Magic/GenesisHoldout.cs b/Projectiles/Magic/GenesisHoldout.cs index d0d83c08e1..a5dc0753e8 100644 --- a/Projectiles/Magic/GenesisHoldout.cs +++ b/Projectiles/Magic/GenesisHoldout.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = 1f, PitchVariance = 0.15f }, Projectile.Center); if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3, ModContent.ProjectileType(), Projectile.damage * 9, Projectile.knockBack, Projectile.owner, 0, 0); + Projectile.NewProjectile(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, EffectsColor, new Vector2(1.7f, 0.8f), true); GeneralParticleHandler.SpawnParticle(pulse3); @@ -117,14 +117,14 @@ namespace CalamityMod.Projectiles.Magic firingVelocity3 = (shootDirection * 10).RotatedBy((0.05f * (i + 1)) * Utils.GetLerpValue(0, 55, Windup, true)); if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1); + Projectile.NewProjectile(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)); if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1); + Projectile.NewProjectile(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, EffectsColor, new Vector2(1.7f, 0.8f), true); diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index 20c61f0dab..f6201dcd9a 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -16,8 +16,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -232,7 +233,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index e5cffcf043..36b23f3e45 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -8,6 +9,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/Magic/GhastlyVisageProj.cs b/Projectiles/Magic/GhastlyVisageProj.cs index 1946027091..42cd6b630f 100644 --- a/Projectiles/Magic/GhastlyVisageProj.cs +++ b/Projectiles/Magic/GhastlyVisageProj.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -203,8 +203,8 @@ namespace CalamityMod.Projectiles.Magic public override void PostDraw(Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 1443b9062c..8fdd57539f 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -1,4 +1,5 @@ using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -44,17 +45,12 @@ namespace CalamityMod.Projectiles.Magic }); Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, 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; - double deltaAngle = spread / 8f; - double offsetAngle; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; 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(), (int)(Projectile.damage * 0.75), 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(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); diff --git a/Projectiles/Magic/GleamingBolt2.cs b/Projectiles/Magic/GleamingBolt2.cs index a00c158bd9..818de0b618 100644 --- a/Projectiles/Magic/GleamingBolt2.cs +++ b/Projectiles/Magic/GleamingBolt2.cs @@ -1,12 +1,15 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class GleamingBolt2 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 14; diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs deleted file mode 100644 index 3cdddd4d79..0000000000 --- a/Projectiles/Magic/GraniteEnergy.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GraniteEnergy : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.DamageType = DamageClass.Magic; - Projectile.timeLeft = 90; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 60 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.ToRadians(90); - if (Main.rand.NextBool()) - 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/GraniteEnergy.png b/Projectiles/Magic/GraniteEnergy.png deleted file mode 100644 index f49fec4516..0000000000 Binary files a/Projectiles/Magic/GraniteEnergy.png and /dev/null differ diff --git a/Projectiles/Magic/GranitePulse.cs b/Projectiles/Magic/GranitePulse.cs deleted file mode 100644 index 1cee67b0f7..0000000000 --- a/Projectiles/Magic/GranitePulse.cs +++ /dev/null @@ -1,157 +0,0 @@ -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.Magic -{ - public class GranitePulse : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public bool initialized = false; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 6; - } - - public override void SetDefaults() - { - Projectile.width = 40; - Projectile.height = 46; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = -1; - Projectile.timeLeft = 1200; - } - - public override void AI() - { - Projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(MathHelper.TwoPi * Projectile.ai[0] / 300f)) * 0.5f); - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= 300f) - { - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; - } - - Projectile.frameCounter++; - if (Projectile.frameCounter > 4) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 7200f) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - Projectile.Kill(); - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 10f) - { - Projectile.localAI[0] = 0f; - int projCount = 0; - int index = 0; - float findOldest = 0f; - int projType = Projectile.type; - foreach (Projectile proj in Main.ActiveProjectiles) - { - if (proj.owner == Projectile.owner && proj.type == projType && proj.ai[1] < 3600f) - { - projCount++; - if (proj.ai[1] > findOldest) - { - index = proj.whoAmI; - findOldest = proj.ai[1]; - } - } - } - if (projCount > 1) - { - Main.projectile[index].netUpdate = true; - Main.projectile[index].ai[1] = 36000f; - return; - } - } - if (!initialized) - { - SoundEngine.PlaySound(SoundID.NPCHit53, Projectile.Center); - Projectile.ExpandHitboxBy(20); - for (int d = 0; d < 5; d++) - { - 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()) - { - Main.dust[ecto].scale = 0.5f; - Main.dust[ecto].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int d = 0; d < 10; d++) - { - 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, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 0.5f); - Main.dust[ecto].velocity *= 2f; - } - initialized = true; - } - if (Projectile.timeLeft % 50 == 1 && Projectile.alpha <= 0) - { - SoundEngine.PlaySound(SoundID.NPCHit53, Projectile.Center); - Projectile.ExpandHitboxBy(20); - for (int d = 0; d < 5; d++) - { - 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()) - { - Main.dust[ecto].scale = 0.5f; - Main.dust[ecto].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int d = 0; d < 10; d++) - { - 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, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 0.5f); - Main.dust[ecto].velocity *= 2f; - } - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 8; i++) - { - Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 3f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - 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); - return false; - } - - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/Magic/GranitePulse.png b/Projectiles/Magic/GranitePulse.png deleted file mode 100644 index f6b69d417b..0000000000 Binary files a/Projectiles/Magic/GranitePulse.png and /dev/null differ diff --git a/Projectiles/Magic/HadalUrnIsopod.cs b/Projectiles/Magic/HadalUrnIsopod.cs index 1ac62e58f1..08c64edc11 100644 --- a/Projectiles/Magic/HadalUrnIsopod.cs +++ b/Projectiles/Magic/HadalUrnIsopod.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Magic/HadalUrnJellyfish.cs b/Projectiles/Magic/HadalUrnJellyfish.cs index dc57cb8008..e85edb4ef0 100644 --- a/Projectiles/Magic/HadalUrnJellyfish.cs +++ b/Projectiles/Magic/HadalUrnJellyfish.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -14,7 +15,8 @@ namespace CalamityMod.Projectiles.Magic bool neartarget = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -42,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -130,8 +132,8 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int textureheight = tex.Height / Main.projFrames[Projectile.type]; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int textureheight = tex.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Magic/HadalUrnLamprey.cs b/Projectiles/Magic/HadalUrnLamprey.cs index 972180a9d2..a8b5030619 100644 --- a/Projectiles/Magic/HadalUrnLamprey.cs +++ b/Projectiles/Magic/HadalUrnLamprey.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic int invistimer = 0; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; } public override void SetDefaults() @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic //AI exclusive to when it isn't sticking if (Projectile.ai[0] == 0) { - if (Projectile.frame >= Main.projFrames[Projectile.type] / 2) + if (Projectile.frame >= Main.projFrames[Type] / 2) { Projectile.frame = 0; } @@ -79,9 +79,9 @@ namespace CalamityMod.Projectiles.Magic //If it IS sticking else { - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { - Projectile.frame = Main.projFrames[Projectile.type] / 2; + Projectile.frame = Main.projFrames[Type] / 2; } } } @@ -99,8 +99,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int textureheight = tex.Height / Main.projFrames[Projectile.type]; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int textureheight = tex.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Magic/HadalUrnStarfish.cs b/Projectiles/Magic/HadalUrnStarfish.cs index d2043be509..b69111abb1 100644 --- a/Projectiles/Magic/HadalUrnStarfish.cs +++ b/Projectiles/Magic/HadalUrnStarfish.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; Shards(); diff --git a/Projectiles/Magic/HadalUrnStarfishShard.cs b/Projectiles/Magic/HadalUrnStarfishShard.cs index 920f9a1dd1..97fcc18156 100644 --- a/Projectiles/Magic/HadalUrnStarfishShard.cs +++ b/Projectiles/Magic/HadalUrnStarfishShard.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic public class HadalUrnStarfishShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; diff --git a/Projectiles/Magic/HeliumFlashBlast.cs b/Projectiles/Magic/HeliumFlashBlast.cs index 5e8cf54258..67b98a66f5 100644 --- a/Projectiles/Magic/HeliumFlashBlast.cs +++ b/Projectiles/Magic/HeliumFlashBlast.cs @@ -1,4 +1,4 @@ -using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -12,9 +12,19 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - private static int Lifetime = 40; - private static float ExplosionRadius = 210.0f; - private static float StartDustQuantity = 36f; + private static float ExplosionRadius = 500.0f; + private static float ParticleRadius = 210.0f; + private Player Owner => Main.player[Projectile.owner]; + public int frameX = 0; + public int frameY = 0; + private const int horizontalFrames = 5; + private const int verticalFrames = 4; + public int time = 0; + public int currentFrame = 0; + private const int frameLength = 2; + public bool damageFrame = false; + public float starAngle = 0; + public override void SetDefaults() { @@ -26,64 +36,109 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = Lifetime; - + Projectile.timeLeft = 20; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = -1; } - // localAI[0] = frame counter - // localAI[1] = dust quantity public override void AI() { - // Play sound on frame 1 and initialize dust quantity - if (Projectile.localAI[0] == 0f) + if (currentFrame == 19) + damageFrame = true; + else + damageFrame = false; + if (currentFrame == 0) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); - Projectile.localAI[1] = StartDustQuantity; + for (int i = 0; i < 6; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f, 1f, 35, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.5f, 0.5f, 35, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + Particle p = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orange * 0.5f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-5, 5), 5.5f, 0f, 20); + GeneralParticleHandler.SpawnParticle(p); } - - // Pure dust projectile - DrawProjectile(); - - // Increment frame counter - Projectile.localAI[0] += 1f; - } - - private void DrawProjectile() - { - // Taper down the dust amount for the last bit of the projectile's life - if (Projectile.localAI[0] >= Lifetime - 15) - Projectile.localAI[1] -= 1f; - - int dustCount = (int)Projectile.localAI[1]; - for (int i = 0; i < dustCount; ++i) + if (currentFrame == 5) { - int dustType = Main.rand.NextBool(3) ? 262 : 87; - float scale = Main.rand.NextFloat(2.0f, 2.5f); - float randX = Main.rand.NextFloat(-30f, 30f); - float randY = Main.rand.NextFloat(-30f, 30f); - float randVelocity = Main.rand.NextFloat(5f, 24f); - float speed = (float)Math.Sqrt((double)(randX * randX + randY * randY)); - speed = randVelocity / speed; - randX *= speed; - randY *= speed; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - Main.dust[idx].position.X = Projectile.Center.X + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].position.Y = Projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].velocity.X = randX; - Main.dust[idx].velocity.Y = randY; - Main.dust[idx].scale = scale; - Main.dust[idx].noGravity = true; + Particle p = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orange * 0.5f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-5, 5), 4.5f, 0f, 15); + GeneralParticleHandler.SpawnParticle(p); } + if (currentFrame == 10) + { + starAngle = Main.rand.NextFloat(-0.9f, 0.9f); + for (int i = 0; i < 4; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 8f; + + Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 6, 0.12f, Color.Orange, new Vector2(1.5f, 0.9f), true, true, 2); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + if (currentFrame == 19) + { + Owner.Calamity().GeneralScreenShakePower = 8f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HeliumFlashExplodeNoMetal") { Volume = 1f }, Projectile.Center); + for (int i = 0; i < 12; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Orange, Utils.GetLerpValue(0, 12, i, true)), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0006f + 0.08f + 0.04f * i, (int)(30 - i * 1.3f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 3; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.OrangeRed, Utils.GetLerpValue(0, 3, i, true)), "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0006f + 0.093f + 0.04f * i * 4, (int)(30 - i * 2f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 5f, 35, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 2f, 35, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + for (int i = 0; i < 4; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 8f; + + Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 10, 0.22f, Color.Orange, new Vector2(1.5f, 0.9f), true, true, 1); + GeneralParticleHandler.SpawnParticle(pulse); + } + for (int i = 0; i < 35; i++) + { + Vector2 randVel = new Vector2(50, 50).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.SlateGray, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.8f, 1.3f), 0.5f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 60; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 2f); + chargefull.scale = Main.rand.NextFloat(0.65f, 1.25f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + } + currentFrame++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Daybreak, 300); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.85f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + public override bool? CanDamage() => damageFrame ? null : false; } } + + diff --git a/Projectiles/Magic/HeliumFlashEmpty.png b/Projectiles/Magic/HeliumFlashEmpty.png new file mode 100644 index 0000000000..0c1fa38df7 Binary files /dev/null and b/Projectiles/Magic/HeliumFlashEmpty.png differ diff --git a/Projectiles/Magic/HeliumFlashHoldout.cs b/Projectiles/Magic/HeliumFlashHoldout.cs new file mode 100644 index 0000000000..c26c976f60 --- /dev/null +++ b/Projectiles/Magic/HeliumFlashHoldout.cs @@ -0,0 +1,266 @@ +using CalamityMod.Items.Weapons.Magic; +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.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + internal class HeliumFlashHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 60f; + public override float BaseOffsetY => 0f; + public override float RecoilResolveSpeed => 0.4f; + public override string Texture => "CalamityMod/Projectiles/Magic/HeliumFlashEmpty"; + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * 26; + + private ref float CurrentChargingFrames => ref Projectile.ai[0]; + private bool FullyCharged => CurrentChargingFrames >= HeliumFlash.FullChargeFrames; + public SlotId HeliumChargeSlot; + public static float BulletSpeed = 15f; + public int time = 0; + public int starcoreFrameCounter = 0; + public int starcoreFrame = 0; + + public override void KillHoldoutLogic() + { + if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + if (SoundEngine.TryGetActiveSound(HeliumChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; + + // Starcore animation + starcoreFrameCounter++; + if (starcoreFrameCounter > (FullyCharged ? 0 : 1)) + { + starcoreFrame++; + starcoreFrameCounter = 0; + } + if (starcoreFrame >= 6) + starcoreFrame = 0; + + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if (Owner.CantUseHoldout()) + { + KeepRefreshingLifetime = false; + + if (Projectile.ai[1] != 1f) + { + Projectile.timeLeft = (FullyCharged ? HeliumFlash.AftershotCooldownFrames * 3 : (int)(HeliumFlash.AftershotCooldownFrames * 1.5f)); + + ChargeSound?.Stop(); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; + if (FullyCharged) + { + Projectile.ai[2] = 1f; + OffsetLengthFromArm -= 25; + SoundEngine.PlaySound(HeliumFlash.ChargeFire, Projectile.Center); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0); + + Particle pulse = new CustomPulse(GunTipPosition, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.05f, 14); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new CustomPulse(GunTipPosition, Vector2.Zero, Color.Red, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.08f, 14); + GeneralParticleHandler.SpawnParticle(pulse2); + + for (int i = 0; i < 17; i++) + { + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(5, 25); + chargefull.scale = Main.rand.NextFloat(0.65f, 0.95f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f, Color.OrangeRed, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + for (int i = 0; i <= 18; i++) + { + Vector2 sparkVelocity = shootVelocity / 2f; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(GunTipPosition, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? Color.Red : Color.DarkRed); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); + Particle spark2 = new LineParticle(GunTipPosition, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashDudFire"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0.3f }, Projectile.Center); + for (int i = 0; i < 12; i++) + { + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 3.5f)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.9f); + dust2.noGravity = false; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + } + Projectile.ai[1] = 1f; + } + } + else + { + if (Projectile.ai[1] != 1f) + CurrentChargingFrames++; + + // Sounds + if (FullyCharged) + { + if ((CurrentChargingFrames - HeliumFlash.FullChargeFrames) % HeliumFlash.ChargeLoopSoundFrames == 0) + HeliumChargeSlot = SoundEngine.PlaySound(HeliumFlash.ChargeLoop, Projectile.Center); + + if (Main.rand.NextBool()) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 5); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + dustVel, 278, dustVel * 0.15f); + dust2.scale = Main.rand.NextFloat(0.35f, 0.7f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + } + else if (CurrentChargingFrames == 10) + HeliumChargeSlot = SoundEngine.PlaySound(HeliumFlash.Charge, Projectile.Center); + + // Charge-up visuals + if (CurrentChargingFrames >= 10) + { + if (!FullyCharged) + { + Particle streak = new ManaDrainStreak(Owner, Main.rand.NextFloat(0.06f + (CurrentChargingFrames / 180), 0.08f + (CurrentChargingFrames / 180)), Main.rand.NextVector2CircularEdge(2.5f, 2.5f) * Main.rand.NextFloat(0.3f * CurrentChargingFrames, 0.3f * CurrentChargingFrames), 0f, Color.Red, Color.Orange, 7, GunTipPosition); + GeneralParticleHandler.SpawnParticle(streak); + } + } + + // Full charge effects + if (CurrentChargingFrames == HeliumFlash.FullChargeFrames) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashReadyAlt"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0f }, Projectile.Center); + for (int i = 0; i < 18; i++) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1, 5); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + dustVel, 278, dustVel * 0.7f); + dust2.scale = Main.rand.NextFloat(0.45f, 0.9f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + } + } + if (Projectile.ai[1] == 1f) + { + if (Projectile.ai[2] == 1 && Projectile.timeLeft == (int)(HeliumFlash.AftershotCooldownFrames * 1.4f)) + { + OffsetLengthFromArm += 8; + } + if (Projectile.ai[2] == 1 && Projectile.timeLeft == (int)(HeliumFlash.AftershotCooldownFrames * 1.1f)) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashSteamRelease"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = 0f }, Projectile.Center); + for (int b = 0; b < 12; b++) + { + Vector2 smokeVel1 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(84)) * 14; // Middle + Vector2 smokeVel2 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(48f)) * 14; // Front + Vector2 smokeVel3 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(125f)) * 14; // Back + for (int i = 0; i < 2; i++) + { + Particle smoke1 = new HeavySmokeParticle(GunTipPosition + smokeVel1 * 2, smokeVel1 * Main.rand.NextFloat(0.2f, 0.7f), Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)), Main.rand.Next(15, 35 + 1), Main.rand.NextFloat(0.08f, 0.45f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke1); + Particle smoke2 = new HeavySmokeParticle(GunTipPosition + smokeVel2 * 2, smokeVel2 * Main.rand.NextFloat(0.2f, 0.7f), Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)), Main.rand.Next(15, 35 + 1), Main.rand.NextFloat(0.08f, 0.45f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke2); + Particle smoke3 = new HeavySmokeParticle(GunTipPosition + smokeVel3 * 2, smokeVel3 * Main.rand.NextFloat(0.2f, 0.7f), Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)), Main.rand.Next(15, 35 + 1), Main.rand.NextFloat(0.08f, 0.45f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke3); + + Dust dust1 = Dust.NewDustPerfect(GunTipPosition + smokeVel1 * 2, 303, smokeVel1.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.03f, 0.3f), 180, default, Main.rand.NextFloat(0.3f, 1.1f)); + dust1.noGravity = false; + dust1.color = Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + smokeVel2 * 2, 303, smokeVel2.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.03f, 0.3f), 180, default, Main.rand.NextFloat(0.3f, 1.1f)); + dust2.noGravity = false; + dust2.color = Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)); + Dust dust3 = Dust.NewDustPerfect(GunTipPosition + smokeVel3 * 2, 303, smokeVel3.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.03f, 0.3f), 180, default, Main.rand.NextFloat(0.3f, 1.1f)); + dust3.noGravity = false; + dust3.color = Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)); + + if (i == 0) + { + smokeVel1 *= -1; + smokeVel2 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(-125f)) * 14; + smokeVel3 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(-48f)) * 14; + } + } + } + } + + CurrentChargingFrames *= FullyCharged ? 0 : 0.9f; + } + + Lighting.AddLight(GunTipPosition, Color.OrangeRed.ToVector3() * 1.5f * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true)); + + time++; + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(HeliumChargeSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + 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() && !FullyCharged) + { + float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, HeliumFlash.FullChargeFrames); + drawPosition += Main.rand.NextVector2Circular(rumble / 25f, rumble / 25f); + } + + Texture2D orbTexture = ModContent.Request("CalamityMod/Projectiles/Magic/VolatileStarcore").Value; + Rectangle frame = orbTexture.Frame(1, 6, 0, starcoreFrame); + Vector2 origin = frame.Size() * 0.5f; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + float bonusScale = 1; + if (CurrentChargingFrames >= HeliumFlash.FullChargeFrames) + { + bonusScale = MathHelper.Clamp(2 * Utils.GetLerpValue(HeliumFlash.FullChargeFrames * 1.2f, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true), 1, 3); + } + + // Glow Orb + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.OrangeRed with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.5f * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true) * randSize * bonusScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.White with { A = 0 } * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true) * 0.75f, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true) * randSize * bonusScale, SpriteEffects.None, 0); + + // Main staff + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation + (MathHelper.ToRadians(45f * (Projectile.spriteDirection))), rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + // Starcore + Main.EntitySpriteDraw(orbTexture, GunTipPosition - Main.screenPosition, frame, Color.White, 0, origin, Projectile.scale * 0.5f * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true), SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Projectiles/Magic/HellwingBat.cs b/Projectiles/Magic/HellwingBat.cs index 735877902a..f07139620d 100644 --- a/Projectiles/Magic/HellwingBat.cs +++ b/Projectiles/Magic/HellwingBat.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 12; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/HeresyProj.cs b/Projectiles/Magic/HeresyProj.cs index 0c48a337cb..d3da71c8c8 100644 --- a/Projectiles/Magic/HeresyProj.cs +++ b/Projectiles/Magic/HeresyProj.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Magic public ref float AttackTimer => ref Projectile.ai[1]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; } public override void SetDefaults() @@ -48,8 +48,8 @@ namespace CalamityMod.Projectiles.Magic // Switch frames at a linearly increasing rate to make it look like the player is flipping pages quickly. Projectile.localAI[0] += Utils.Remap(Time, 0f, 180f, 1f, 5f); - Projectile.frame = (int)Math.Round(Projectile.localAI[0] / 10f) % Main.projFrames[Projectile.type]; - if (Projectile.localAI[0] >= Main.projFrames[Projectile.type] * 10f) + Projectile.frame = (int)Math.Round(Projectile.localAI[0] / 10f) % Main.projFrames[Type]; + if (Projectile.localAI[0] >= Main.projFrames[Type] * 10f) Projectile.localAI[0] = 0f; AdjustPlayerValues(); @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Magic // Update the player's arm directions to make it look as though they're flipping through the book. float frontArmRotation = (MathHelper.PiOver2 - 0.46f) * -Owner.direction; - float backArmRotation = frontArmRotation + MathHelper.Lerp(0.23f, 0.97f, CalamityUtils.Convert01To010(Projectile.localAI[0] / Main.projFrames[Projectile.type] / 10f)) * -Owner.direction; + float backArmRotation = frontArmRotation + MathHelper.Lerp(0.23f, 0.97f, CalamityUtils.Convert01To010(Projectile.localAI[0] / Main.projFrames[Type] / 10f)) * -Owner.direction; Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, backArmRotation); Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, frontArmRotation); } @@ -112,8 +112,8 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = bookTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D bookTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = bookTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 drawPosition; Vector2 origin = frame.Size() * 0.5f; Color glowColor = Color.Lerp(Color.Pink, Color.Red, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 5f) * 0.5f + 0.5f); diff --git a/Projectiles/Magic/HolyFlame.cs b/Projectiles/Magic/HolyFlame.cs index 0d58ed03c6..caea82db64 100644 --- a/Projectiles/Magic/HolyFlame.cs +++ b/Projectiles/Magic/HolyFlame.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index d804f3c477..bb111a2960 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -1,62 +1,133 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using Terraria; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Magic { - public class HolyLaser : ModProjectile, ILocalizedModType + public class HolyLaser : BaseLaserbeamProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public override float Lifetime => isBigLaser ? 60 : 30; + + public override float MaxScale => isBigLaser ? 1.5f : 0.8f; + + public override float MaxLaserLength => 1500f; + + private const string LaserTexturePath = "CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRay"; + public override Texture2D LaserBeginTexture => Request(LaserTexturePath + "Start").Value; + public override Texture2D LaserMiddleTexture => Request(LaserTexturePath + "Mid").Value; + public override Texture2D LaserEndTexture => Request(LaserTexturePath + "End").Value; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override Color LaserOverlayColor => Color.White with { A = 0 }; + public override Color LightCastColor => Color.Transparent; + private Projectile Holdout => Main.projectile[(int)Projectile.ai[1]]; + + private bool isBigLaser => Projectile.ai[2] == 1f; + public Color color1 = Color.Goldenrod; + public Color color2 = Color.Orange; + public float extraRot = 0; + public Vector2 displace = Vector2.Zero; + + private Player Owner { get; set; } + + private SlotId BigBeamSoundSlot; + public int time = 0; public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.penetrate = -1; + Projectile.tileCollide = false; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 2; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 180; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; + Projectile.localNPCHitCooldown = -1; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), (isBigLaser ? 180 : 90)); + + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * (isBigLaser ? 0.55f : 0.6f)); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, isBigLaser ? 50f : 20f, ref _); } - public override void AI() + public override void UpdateLaserMotion() { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) + float dir = Projectile.ai[0]; + if (time == 0) { - int dustType = Main.rand.Next(2); - if (dustType == 0) + if (!isBigLaser) { - dustType = 244; + extraRot = dir; + Projectile.ai[0] = 0; + } + else + extraRot = 1.2f * dir; + } + Projectile.velocity = Holdout.velocity.RotatedBy(extraRot); + if (!isBigLaser) + { + Projectile.rotation = Holdout.velocity.ToRotation() - MathHelper.PiOver2 + extraRot; + extraRot *= 0.85f; + } + else + { + Projectile.rotation = (Holdout.velocity.ToRotation() - MathHelper.PiOver2) + extraRot; + extraRot -= 0.05f * dir; + } + } + + public override void AttachToSomething() + { + if (Owner == null || !Owner.active || Owner.dead || Owner.CCed || Owner.noItems || Owner.ownedProjectileCounts[ProjectileType()] == 0) return; + Projectile.Center = Holdout.ModProjectile().GunTipPosition; + } + + public override void ExtraBehavior() + { + Owner ??= Main.player[Projectile.owner]; + + Vector2 effectsPosition = Vector2.Lerp(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, Main.rand.NextFloat()); + Vector2 randomLineEffectPosition = effectsPosition + Main.rand.NextVector2Circular(7f * (isBigLaser ? 1.2f : 0.8f), 7f * (isBigLaser ? 1.2f : 0.8f)); + + if (Main.rand.NextBool() || isBigLaser) + { + Dust laserDust = Dust.NewDustPerfect(randomLineEffectPosition, 278, Projectile.velocity * Main.rand.NextFloat(5f, 40f), Scale: Main.rand.NextFloat(0.8f, 1.1f)); + laserDust.noGravity = true; + laserDust.color = Main.rand.NextBool(3) ? color2 : color1; + } + + for (int i = 0; i < (isBigLaser ? 4 : 2); i++) + { + effectsPosition = Vector2.Lerp(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, Main.rand.NextFloat()); + randomLineEffectPosition = effectsPosition + Main.rand.NextVector2Circular(7f, 7f); + if (i % 2 == 0) + { + Dust laserDust2 = Dust.NewDustPerfect(randomLineEffectPosition, ModContent.DustType(), Projectile.velocity * Main.rand.NextFloat(5f, 40f), Scale: Main.rand.NextFloat(0.8f, 1.1f) * (isBigLaser ? 2 : 1)); + laserDust2.noGravity = true; + laserDust2.color = Main.rand.NextBool(3) ? color2 : color1; + laserDust2.noLightEmittence = true; } else { - dustType = 246; + Particle spark2 = new CustomSpark(randomLineEffectPosition, Projectile.velocity * Main.rand.NextFloat(1f, 10f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.3f), Color.Lerp(color1, color2, Main.rand.NextFloat()), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark2); } - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int holyDust = Dust.NewDust(projPos, 1, 1, dustType, 0f, 0f, 0, default, 0.25f); - Main.dust[holyDust].position = projPos; - Main.dust[holyDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[holyDust].velocity *= 0.1f; } - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - - if (Projectile.owner == Main.myPlayer) - { - int proj = 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); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Magic; - } + time++; } } } diff --git a/Projectiles/Magic/IceBarrageMain.cs b/Projectiles/Magic/IceBarrageMain.cs index a4b5c68f74..7abf042476 100644 --- a/Projectiles/Magic/IceBarrageMain.cs +++ b/Projectiles/Magic/IceBarrageMain.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +12,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - private int pwidth = 58; - private int pheight = 58; + private const int pwidth = 58; + private const int pheight = 58; + private ref float Timer => ref Projectile.ai[0]; public override void SetDefaults() { Projectile.width = pwidth; @@ -30,130 +32,99 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - NPC closestTarget = Projectile.Center.ClosestNPCAt(500f, true, true); + NPC closestTarget = Projectile.Center.ClosestNPCAt(5000f, true, true); if (closestTarget != null) - { Projectile.Center = closestTarget.Center; - } - Projectile.ai[0]++; - Projectile.ai[1]++; + Timer++; for (int j = 0; j < 3; j++) { - int dustType = Main.rand.NextBool() ? 68 : 67; - if (Main.rand.NextBool(4)) + int dustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod; + if (Timer < 140f) { - dustType = 80; - } - if (Projectile.ai[0] < 140f) - { - Vector2 direction = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, direction.X, direction.Y, 50, default, 1.3f); - Main.dust[dust].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, Main.rand.NextVector2Circular(-4f, 4f), 50, default, 1.3f); + dust.noGravity = true; } else { int direct = Main.rand.NextBool() ? 1 : -1; - Vector2 dir1 = new Vector2(0f, 10f) * direct; - int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, dir1.X, dir1.Y, 50, default, 1.3f); - Main.dust[dust1].noGravity = true; - Main.dust[dust1].velocity = dir1; - int direct2 = Main.rand.NextBool() ? 1 : -1; - Vector2 dir2 = new Vector2(10f, 0f) * direct2; - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, dir2.X, dir2.Y, 50, default, 1.3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity = dir2; + Vector2 dustSpawn = Projectile.position + new Vector2(Main.rand.Next(Projectile.width), Main.rand.Next(Projectile.height)); + + Dust dust1 = Dust.NewDustPerfect(dustSpawn, dustType, Vector2.UnitY * 10f * direct, 50, default, 1.3f); + dust1.noGravity = true; + direct = Main.rand.NextBool() ? 1 : -1; + Dust dust2 = Dust.NewDustPerfect(dustSpawn, dustType, Vector2.UnitX * 10f * direct, 50, default, 1.3f); + dust2.noGravity = true; } } - if (Projectile.ai[0] < 55) + + if (Timer < 55) { - for (int i = 0; i < 10; i++) + for (int i = 0; i < 9; i++) { - int dtype1 = Main.rand.NextBool() ? 68 : 67; - if (Main.rand.NextBool(4)) - { - dtype1 = 80; - } - 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 *= 0.5f; - float Dscale = Main.rand.NextFloat(1.5f, 2f); - int d1 = Dust.NewDust(Dpos, 1, 1, dtype1, Dspeed.X, Dspeed.Y, 0, default, Dscale); - Main.dust[d1].velocity = Dspeed; - Main.dust[d1].noGravity = true; + int auraDustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod; + Vector2 auraDustPos = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(250f, 270f); + Vector2 auraDustSpeed = Vector2.Normalize(Projectile.Center - auraDustPos) * 0.5f; + + Dust auraDust = Dust.NewDustPerfect(auraDustPos, auraDustType, auraDustSpeed, Scale: Main.rand.NextFloat(1.5f, 2f)); + auraDust.noGravity = true; } } - else if (Projectile.ai[0] == 55f) + else if (Timer == 55f) { - for (int i = 0; i < 270; i++) + for (int i = 0; i < 210; i++) { - int dtype2 = Main.rand.NextBool() ? 68 : 67; - if (Main.rand.NextBool(4)) - { - dtype2 = 80; - } - 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); - 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; - Main.dust[d1].noGravity = true; + int inwardDustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod; + Vector2 inwardDustPos = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(250f, 270f); + Vector2 inwardDustSpeed = Vector2.Normalize(Projectile.Center - inwardDustPos) * Main.rand.NextFloat(8f, 34f); + + Dust inwardDust = Dust.NewDustPerfect(inwardDustPos, inwardDustType, inwardDustSpeed, Scale: Main.rand.NextFloat(1.5f, 2f)); + inwardDust.noGravity = true; } } - else if (Projectile.ai[0] == 140f) + else if (Timer == 140f) { Vector2 projcenter = Projectile.Center; Projectile.width = 200; Projectile.height = 200; Projectile.Center = projcenter; Projectile.Damage(); - for (int i = 0; i < 180; i++) + + for (int i = 0; i < 150; i++) { - int dtype3 = Main.rand.NextBool() ? 68 : 67; - if (Main.rand.NextBool(4)) - { - dtype3 = 80; - } - Vector2 explosiondir = new Vector2(Main.rand.NextFloat(-18f, 18f), Main.rand.NextFloat(-18f, 18f)); - int d2 = Dust.NewDust(Projectile.Center, 1, 1, dtype3, explosiondir.X, explosiondir.Y, 50, default, 1.5f); - Main.dust[d2].noGravity = true; - } - for (int k = 0; k < 45; k++) - { - Vector2 projspeed = new Vector2(Main.rand.NextFloat(-8f, 8f), Main.rand.NextFloat(-8f, 8f)); - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, (float)Main.rand.Next(3)); - Main.projectile[ice].timeLeft = 600; - Main.projectile[ice].DamageType = DamageClass.Magic; + int outwardDustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod; + Dust outwardDust = Dust.NewDustPerfect(Projectile.Center, outwardDustType, Main.rand.NextVector2Circular(-18f, 18f), 50, default, 1.5f); + outwardDust.noGravity = true; } Projectile.width = pwidth; Projectile.height = pheight; Projectile.Center = projcenter; - Vector2 pos1 = new Vector2(Projectile.Center.X, Projectile.Center.Y - (Projectile.height * 0.5f) - 44f); - int block1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos1, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 0f, 0f); - Main.projectile[block1].Center = pos1; - Vector2 pos2 = new Vector2(Projectile.Center.X + (Projectile.width * 0.5f) + 48f, Projectile.Center.Y); - int block2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos2, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 1f, 0f); - Main.projectile[block2].Center = pos2; - Vector2 pos3 = new Vector2(Projectile.Center.X, Projectile.Center.Y + (Projectile.height * 0.5f) + 44f); - int block3 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos3, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 2f, 0f); - Main.projectile[block3].Center = pos3; - Vector2 pos4 = new Vector2(Projectile.Center.X - (Projectile.width * 0.5f) - 49f, Projectile.Center.Y); - int block4 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos4, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 3f, 0f); - Main.projectile[block4].Center = pos4; + + // Bottom + Vector2 pos1 = new Vector2(Projectile.Center.X, Projectile.Center.Y + (Projectile.height * 0.5f) + 20f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos1, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 0f); + // Left + Vector2 pos2 = new Vector2(Projectile.Center.X - (Projectile.width * 0.5f) - 20f, Projectile.Center.Y); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos2, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 1f); + // Top + Vector2 pos3 = new Vector2(Projectile.Center.X, Projectile.Center.Y - (Projectile.height * 0.5f) - 20f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos3, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 2f); + // Right + Vector2 pos4 = new Vector2(Projectile.Center.X + (Projectile.width * 0.5f) + 20f, Projectile.Center.Y); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos4, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 3f); } - if (Projectile.ai[0] > 90) + + if (Timer > 90) { + Projectile.ai[1]++; if (Projectile.ai[1] >= 5f) { - Vector2 projspeed = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, (float)Main.rand.Next(3)); + Vector2 spawnPos = Projectile.Center + new Vector2(Main.rand.NextFloat(-200f, 200f), -400f); + int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, Vector2.UnitY * 6f, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, Main.rand.Next(3)); if (ice.WithinBounds(Main.maxProjectiles)) { - Main.projectile[ice].timeLeft = 600; + Main.projectile[ice].tileCollide = false; Main.projectile[ice].DamageType = DamageClass.Magic; } Projectile.ai[1] = 0f; @@ -161,16 +132,7 @@ namespace CalamityMod.Projectiles.Magic } } - public override bool? CanDamage() - { - if (Projectile.ai[0] == 140f) - return null; - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 60); - } + public override bool? CanDamage() => Timer == 140f ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); } } diff --git a/Projectiles/Magic/IceBlock.cs b/Projectiles/Magic/IceBlock.cs index 228677e7de..25cf1f7c0a 100644 --- a/Projectiles/Magic/IceBlock.cs +++ b/Projectiles/Magic/IceBlock.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic public class IceBlock : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 58; @@ -21,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 60; + Projectile.localNPCHitCooldown = 30; Projectile.coldDamage = true; } @@ -30,32 +32,29 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.alpha > 20) { Projectile.alpha -= 12; + if (Projectile.alpha < 20) + Projectile.alpha = 20; } - if (Projectile.alpha < 20) - { - Projectile.alpha = 20; - } + foreach (Projectile proj in Main.ActiveProjectiles) { if (proj.type == ModContent.ProjectileType() && proj.owner == Main.myPlayer) { - Vector2 pos1 = new Vector2(proj.Center.X, proj.Center.Y - (proj.height * 0.5f) - 44f); - Vector2 pos2 = new Vector2(proj.Center.X + (proj.width * 0.5f) + 48f, proj.Center.Y); - Vector2 pos3 = new Vector2(proj.Center.X, proj.Center.Y + (proj.height * 0.5f) + 44f); - Vector2 pos4 = new Vector2(proj.Center.X - (proj.width * 0.5f) - 49f, proj.Center.Y); + // 0 = Bottom, 1 = Left, 2 = Top, 3 = Right + // Why is 0 Bottom instead of Top? Hitbox alignment. switch (Projectile.ai[0]) { case 0: - Projectile.Center = pos1; + Projectile.Center = new Vector2(proj.Center.X, proj.Center.Y + (proj.height * 0.5f) + 20f); break; case 1: - Projectile.Center = pos2; + Projectile.Center = new Vector2(proj.Center.X - (proj.width * 0.5f) - 20f, proj.Center.Y); break; case 2: - Projectile.Center = pos3; + Projectile.Center = new Vector2(proj.Center.X, proj.Center.Y - (proj.height * 0.5f) - 20f); break; case 3: - Projectile.Center = pos4; + Projectile.Center = new Vector2(proj.Center.X + (proj.width * 0.5f) + 20f, proj.Center.Y); break; default: break; } @@ -64,13 +63,13 @@ namespace CalamityMod.Projectiles.Magic switch (Projectile.ai[0]) { case 1: - Projectile.rotation = (MathHelper.Pi * 0.5f); + Projectile.rotation = MathHelper.PiOver2; break; case 2: Projectile.rotation = MathHelper.Pi; break; case 3: - Projectile.rotation = (MathHelper.Pi * 1.5f); + Projectile.rotation = MathHelper.Pi * 1.5f; break; default: break; } diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index c5a292e024..40d362af69 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/IncineratingFireball.cs b/Projectiles/Magic/IncineratingFireball.cs new file mode 100644 index 0000000000..46cac4412a --- /dev/null +++ b/Projectiles/Magic/IncineratingFireball.cs @@ -0,0 +1,193 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class IncineratingFireball : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public Player Owner => Main.player[Projectile.owner]; + public bool Released = false; + public bool TriggeredBurnOut = false; + public const float StartScale = 0.0004f; + public const float EndScale = 10.25f; + + public ref float Timer => ref Projectile.ai[0]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = 60000; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + Projectile.hide = true; + } + + public override void AI() + { + Timer++; + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * (Projectile.scale * 0.5f)); + + // This CalamityPlayer variable causes the weapon to be unusable while it's greater than 0. + // Yes, it's getting set every frame as soon as the fireball starts despawning. That's intentional. + // It's the delay for after the fireball despawns, and the burnout visual effects should appear immediately. + if (TriggeredBurnOut) + Owner.Calamity().burningSeaBurnOut = BurningSea.BurnOutReuseDelay; + + bool canUseMana = Owner.CheckMana(Owner.ActiveItem()); + // Use different behavior depending on if the player is channeling or not. + if (Owner.CantUseHoldout() || !canUseMana || Projectile.timeLeft <= 40) + { + Released = true; + + // Time spent fizzling out scales with how long the fireball was charged up. + if (Projectile.timeLeft > BurningSea.FizzleOutTime) + Projectile.timeLeft = (int)MathHelper.Clamp(MathHelper.Lerp(0f, BurningSea.FizzleOutTime, Timer / BurningSea.ChargeTime), 0f, BurningSea.FizzleOutTime); + + // Lose velocity sharply. + Projectile.velocity *= 0.965f; + + // Fizzle out. Once it's small enough, it dies. + Projectile.scale = Utils.Remap(Projectile.timeLeft, 0f, BurningSea.FizzleOutTime, StartScale, EndScale); + Projectile.ExpandHitboxBy((int)(Projectile.scale * 50f)); + } + else if (!Released) + { + // Follow the player's position. + if (Main.myPlayer == Projectile.owner) + { + Vector2 projLocation = Owner.Center; + Vector2 mouse = Owner.ClampedMouseWorld(); + float mouseDist = Vector2.Distance(mouse, projLocation); + Vector2 mouseDiff = mouse - projLocation; + if (mouseDist > 128f) + { + mouseDiff.Normalize(); + mouseDiff *= 128f; + } + projLocation += mouseDiff; + + Vector2 orbAttemptedVelocity = Vector2.Zero.MoveTowards(projLocation - Projectile.Center, 25f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, orbAttemptedVelocity, 0.08f); + + Projectile.netUpdate = true; + } + + // Slowly increase in size as the fireball is charged up. + Projectile.scale = Utils.Remap(Timer, 0f, BurningSea.ChargeTime, StartScale, EndScale); + Projectile.ExpandHitboxBy((int)(Projectile.scale * 50f)); + + // Consume mana periodically. + if (Timer % 15 == 0f) + Owner.CheckMana(Owner.ActiveItem(), -1, true); + + // If channeled for a while, turns red (handled in PreDraw) and starts emitting smoke as a warning. + // The smoke only starts once the fireball is completely red. + if (Timer > BurningSea.BurnOutTime - 60f) + { + for (int s = 0; s < 2; s++) + { + Vector2 smokeLocation = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 237f; + Vector2 smokeVel = smokeLocation - Projectile.Center; + smokeVel.Normalize(); + smokeVel *= 5f; + HeavySmokeParticle burningUp = new(smokeLocation, smokeVel, new Color(192, 192, 192), 10, 1f, 0.6f); + GeneralParticleHandler.SpawnParticle(burningUp); + } + } + // Holding it to this point triggers its burn-out mechanic. This has several effects: + // Spawn text, play a sound, immediately cause the fizzle out, inflict Brimstone Flames on the player, and set a long delay to the weapon. + if (Timer > BurningSea.BurnOutTime) + { + Projectile.timeLeft = (int)BurningSea.FizzleOutTime; + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/WeaponEnchant"), Owner.Center); + CombatText.NewText(Owner.Hitbox, new Color(192, 0, 0), CalamityUtils.GetTextValue("Misc.BurningSeaBurn"), true); + + Owner.AddBuff(ModContent.BuffType(), (int)BurningSea.FizzleOutTime); + TriggeredBurnOut = true; + } + } + + AdjustPlayerValues(); + } + + public void AdjustPlayerValues() + { + Projectile.spriteDirection = Projectile.direction = Owner.direction; + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + } + + // Can only deal damage while not fizzling out. + public override bool? CanDamage() => !Released; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundStyle Burn = new SoundStyle("CalamityMod/Sounds/Item/WeldingBurn") with { Volume = 0.25f }; + SoundEngine.PlaySound(Burn, target.Center); + target.AddBuff(ModContent.BuffType(), 180); + + // Whoa buddy no smoking allowed + for (int i = 0; i < 4; i++) + { + Vector2 smokeVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(2.5f, 5f); + HeavySmokeParticle smoke = new(target.Center, smokeVel, Color.Gray, 36, 0.7f, 0.625f, 0f, true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + // We don't want this massive thing obstructing nearby projectiles. + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindProjectiles.Add(index); + } + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D TheodoreJNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/MeltyNoise").Value; + Vector2 drawScale = Projectile.Size / TheodoreJNoise.Size() * 1.25f; + float rotation = Main.GlobalTimeWrappedHourly * 4.2f; + + GameShaders.Misc["CalamityMod:ExoVortex"].UseOpacity(0.6f); + GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); + + // Big fucking fireball + for (int i = 0; i < 6; i++) + { + float direction = (i % 2f == 0f).ToDirectionInt(); + Color fireballColor = Color.Lerp(new Color(255, 200, 200), new Color(255, 30, 30), MathHelper.Clamp(Timer / BurningSea.ChargeTime, 0f, 1f)); + if (Timer > BurningSea.BurnOutTime - 120f) + fireballColor = Color.Lerp(new Color(255, 30, 30), Color.Red, MathHelper.Clamp((Timer - BurningSea.BurnOutTime + 120f) / 60f, 0f, 1f)); + + Main.spriteBatch.Draw(TheodoreJNoise, Projectile.Center - Main.screenPosition, null, fireballColor, direction * rotation, TheodoreJNoise.Size() / 2f, drawScale, SpriteEffects.None, 0f); + } + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index 46ab217618..2dd9e9497f 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic bool intersectingSomething = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; + Main.projFrames[Type] = 12; } public override void SetDefaults() @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -144,8 +144,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index 4d960c272a..98a4418dea 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D3 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; @@ -90,11 +90,11 @@ namespace CalamityMod.Projectiles.Magic { Color alphaColor = colorArea; alphaColor = Projectile.GetAlpha(alphaColor); - alphaColor *= (float)(3 - i) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + alphaColor *= (float)(3 - i) / ((float)ProjectileID.Sets.TrailCacheLength[Type] * 1.5f); Vector2 oldPosition = Projectile.oldPos[i]; float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) + if (ProjectileID.Sets.TrailingMode[Type] == 2) { projRotation = Projectile.oldRot[i]; effects = (Projectile.oldSpriteDirection[i] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 55094dd6c6..8a2bc0d826 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D3 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; @@ -97,11 +97,11 @@ namespace CalamityMod.Projectiles.Magic { Color alphaColor = colorArea; alphaColor = Projectile.GetAlpha(alphaColor); - alphaColor *= (float)(3 - j) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + alphaColor *= (float)(3 - j) / ((float)ProjectileID.Sets.TrailCacheLength[Type] * 1.5f); Vector2 oldPosition = Projectile.oldPos[j]; float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) + if (ProjectileID.Sets.TrailingMode[Type] == 2) { projRotation = Projectile.oldRot[j]; effects = (Projectile.oldSpriteDirection[j] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index 16f2ce592a..972d4d5541 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -12,14 +12,13 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = Projectile.height = 14; Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = 1; @@ -31,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.velocity *= 1.015f; if (Projectile.alpha > 0) { @@ -85,7 +84,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/IonBlast.png b/Projectiles/Magic/IonBlast.png index 8cb57f5357..5d5433ccbf 100644 Binary files a/Projectiles/Magic/IonBlast.png and b/Projectiles/Magic/IonBlast.png differ diff --git a/Projectiles/Magic/KeelhaulGeyserBottom.cs b/Projectiles/Magic/KeelhaulGeyserBottom.cs index 97cc0ab147..632c9c9e08 100644 --- a/Projectiles/Magic/KeelhaulGeyserBottom.cs +++ b/Projectiles/Magic/KeelhaulGeyserBottom.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Magic/KeelhaulGeyserTop.cs b/Projectiles/Magic/KeelhaulGeyserTop.cs index 70fa1eabeb..69aeb8f78b 100644 --- a/Projectiles/Magic/KeelhaulGeyserTop.cs +++ b/Projectiles/Magic/KeelhaulGeyserTop.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Magic/LightBead.cs b/Projectiles/Magic/LightBead.cs index 42c4ece225..48ffbccde1 100644 --- a/Projectiles/Magic/LightBead.cs +++ b/Projectiles/Magic/LightBead.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic public class LightBead : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/Magic/LightBlade.cs b/Projectiles/Magic/LightBlade.cs index c53a8b7705..b67da9d6d7 100644 --- a/Projectiles/Magic/LightBlade.cs +++ b/Projectiles/Magic/LightBlade.cs @@ -23,8 +23,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = NumAfterimages; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = NumAfterimages; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -151,7 +152,7 @@ namespace CalamityMod.Projectiles.Magic Point projTile = Projectile.Center.ToTileCoordinates(); Color localLight = Lighting.GetColor(projTile.X, projTile.Y); - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 8fd23fa151..441739fc9c 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index fbf6ce611f..cf4d6601f1 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D3 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; @@ -96,11 +96,11 @@ namespace CalamityMod.Projectiles.Magic { Color alphaColor = colorArea; alphaColor = Projectile.GetAlpha(alphaColor); - alphaColor *= (float)(3 - i) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + alphaColor *= (float)(3 - i) / ((float)ProjectileID.Sets.TrailCacheLength[Type] * 1.5f); Vector2 oldPosition = Projectile.oldPos[i]; float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) + if (ProjectileID.Sets.TrailingMode[Type] == 2) { projRotation = Projectile.oldRot[i]; effects = (Projectile.oldSpriteDirection[i] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index 21876dd11d..94ab1d3557 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D3 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; @@ -97,11 +97,11 @@ namespace CalamityMod.Projectiles.Magic { Color alphaColor = colorArea; alphaColor = Projectile.GetAlpha(alphaColor); - alphaColor *= (float)(3 - j) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + alphaColor *= (float)(3 - j) / ((float)ProjectileID.Sets.TrailCacheLength[Type] * 1.5f); Vector2 oldPosition = Projectile.oldPos[j]; float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) + if (ProjectileID.Sets.TrailingMode[Type] == 2) { projRotation = Projectile.oldRot[j]; effects = (Projectile.oldSpriteDirection[j] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Magic/LuxorsGiftMagic.cs b/Projectiles/Magic/LuxorsGiftMagic.cs index 01915b5d3e..ada0659e91 100644 --- a/Projectiles/Magic/LuxorsGiftMagic.cs +++ b/Projectiles/Magic/LuxorsGiftMagic.cs @@ -1,5 +1,8 @@ using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,72 +14,90 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } - + public float velLerp => Utils.GetLerpValue(1, 8, Projectile.velocity.Length(), true); public override void SetDefaults() { Projectile.width = 18; - Projectile.height = 18; + Projectile.height = 36; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = 2; - Projectile.alpha = 255; - Projectile.timeLeft = 240; + Projectile.timeLeft = 360; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; } - public override void AI() { + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.35f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.localAI[0] == 0f) + if (Projectile.timeLeft == 360) + Projectile.velocity *= 0.1f; + if (Projectile.velocity.Length() < 8) + Projectile.velocity *= 1.01f; + /* + Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); + dust.noGravity = !Main.rand.NextBool(3); + dust.scale = Main.rand.NextFloat(0.45f, 0.6f); + dust.color = Color.Gold; + dust.noLightEmittence = true; + */ + if (Projectile.timeLeft > 30) { - Projectile.scale -= 0.01f; - Projectile.alpha += 15; - if (Projectile.alpha >= 250) + for (int i = 0; i < 2; i++) { - 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; - } - } - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 3f) - { - for (int l = 0; l < 12; l++) - { - 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, 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; - Main.dust[dusty].velocity = Projectile.velocity * 0.1f; - Main.dust[dusty].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[dusty].position) * 1.25f; + Vector2 offset = (MathHelper.TwoPi * i / 2f).ToRotationVector2().RotatedBy(Projectile.timeLeft * 0.1f) * 35 * velLerp; + Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.1f) * Main.rand.NextFloat(5.5f, 6.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 278, dustVel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.5f); + dust.color = Color.Gold; + dust.noLightEmittence = true; } } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - Projectile.velocity *= 0.25f; + float minMult = 0.5f; + int hitsToMinMult = 3; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + for (int g = 0; g < 4; g++) + { + for (int i = 0; i < 2; i++) + { + Vector2 offset = (MathHelper.TwoPi * i / 2f).ToRotationVector2().RotatedBy(Projectile.timeLeft * 0.1f) * 35 * velLerp; + Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType(), dustVel.RotatedByRandom(0.3f) * Main.rand.NextFloat(5.5f, 9.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.2f, 1.5f); + dust.color = Color.Gold; + dust.noLightEmittence = true; + } + } } - + public override bool OnTileCollide(Vector2 oldVelocity) + { + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 10 + 65 * velLerp, targetHitbox); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Asset tex = ModContent.Request(Texture); + Color drawColor = Color.Gold; + float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); + + for (int i = 0; i < 2; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 2f).ToRotationVector2().RotatedBy(Projectile.timeLeft * 0.1f) * 45 * velLerp; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.6f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, new Vector2(1 - 0.3f * velLerp, 1 + 0.8f * velLerp) * Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Magic/LuxorsGiftMagic.png b/Projectiles/Magic/LuxorsGiftMagic.png index e3e09a3ae8..90f9061be1 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 ea0c2e3dde..4bc6077cae 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs index a1a816d07b..1e5b83411e 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs index 6114267a51..749b9ed2e1 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs index 3fc98ecb6c..222346e501 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/MadAlchemistsCocktailRed.cs b/Projectiles/Magic/MadAlchemistsCocktailRed.cs index 9a7fb721b2..d449802240 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailRed.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailRed.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs index 36b15d16a3..711386b479 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/Magic/MagneticBeam.cs b/Projectiles/Magic/MagneticBeam.cs index 0b46e5390d..9662ab8b21 100644 --- a/Projectiles/Magic/MagneticBeam.cs +++ b/Projectiles/Magic/MagneticBeam.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index 8a6e384e68..e5b9faf445 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -81,8 +81,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 de520ad65e..aeb777d2c8 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -1,4 +1,5 @@ using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -37,17 +38,13 @@ namespace CalamityMod.Projectiles.Magic 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; - double deltaAngle = spread / 8f; - double offsetAngle; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; 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(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); - 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); + Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; + int type = (i < 3 ? ModContent.ProjectileType() : ModContent.ProjectileType()); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, type, (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index 9b8c894790..18c9f3b18b 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic public class ManaBoltSmall : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; diff --git a/Projectiles/Magic/ManaChargedCoral.cs b/Projectiles/Magic/ManaChargedCoral.cs index 9fd20d08f4..2a0c915a13 100644 --- a/Projectiles/Magic/ManaChargedCoral.cs +++ b/Projectiles/Magic/ManaChargedCoral.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -239,7 +239,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 c8c85b203f..13c05a348d 100644 --- a/Projectiles/Magic/ManaMonster.cs +++ b/Projectiles/Magic/ManaMonster.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Magic public const int PlayerAttackRedirectTime = 45; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/MelterAmp.cs b/Projectiles/Magic/MelterAmp.cs index 12729568a3..3d959df991 100644 --- a/Projectiles/Magic/MelterAmp.cs +++ b/Projectiles/Magic/MelterAmp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() diff --git a/Projectiles/Magic/MeteorStar.cs b/Projectiles/Magic/MeteorStar.cs index ac9a45264c..4640f39b2c 100644 --- a/Projectiles/Magic/MeteorStar.cs +++ b/Projectiles/Magic/MeteorStar.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Type]; Color LightYellow = new Color(255, 255, 76); Lighting.AddLight(Projectile.Center, LightYellow.ToVector3() * Projectile.Opacity * 0.5f); @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(4) || explodingSoon) SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } - if ((Main.rand.NextBool(12) || (explodingSoon && Main.rand.NextBool(3))) && Main.netMode != NetmodeID.Server) + if ((Main.rand.NextBool(12) || (explodingSoon && Main.rand.NextBool(3))) && !Main.dedServ) { Gore star = Gore.NewGoreDirect(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.2f, Main.rand.Next(16, 18), 1f); star.velocity *= 0.66f; @@ -73,14 +73,14 @@ namespace CalamityMod.Projectiles.Magic Projectile.Center = Owner.Bottom; Projectile.ai[2] = 1f; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } if (Owner.channel) { Owner.mount?.Dismount(Owner); Owner.RemoveAllGrapplingHooks(); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld) * 14f; Owner.velocity = Projectile.velocity; Owner.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1); @@ -112,10 +112,10 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); // Draw the main texture in fullbright - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Magic smoke.fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 5; i++) { diff --git a/Projectiles/Magic/MeteorStarExplosion.cs b/Projectiles/Magic/MeteorStarExplosion.cs index aa7a66e539..200e4d1f14 100644 --- a/Projectiles/Magic/MeteorStarExplosion.cs +++ b/Projectiles/Magic/MeteorStarExplosion.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; + Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; - Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.timeLeft = Main.projFrames[Type] * 5; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 35; Projectile.tileCollide = false; diff --git a/Projectiles/Magic/MiasmaGas.cs b/Projectiles/Magic/MiasmaGas.cs index d7df7b79ea..2bece586d9 100644 --- a/Projectiles/Magic/MiasmaGas.cs +++ b/Projectiles/Magic/MiasmaGas.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/NanoPurgeHoldout.cs b/Projectiles/Magic/NanoPurgeHoldout.cs index 4127860c0a..6e580453fd 100644 --- a/Projectiles/Magic/NanoPurgeHoldout.cs +++ b/Projectiles/Magic/NanoPurgeHoldout.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -31,6 +32,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() => Main.projFrames[Type] = 4; + public float postShotFade = 0; + public override void KillHoldoutLogic() { base.KillHoldoutLogic(); @@ -63,11 +66,12 @@ namespace CalamityMod.Projectiles.Magic ChargeTowardsNextShot -= itemUseTime; // Update the animation. - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; bool manaCostPaid = Owner.CheckMana(Owner.ActiveItem(), -1, true, false); if (manaCostPaid) { + postShotFade = 1; SoundEngine.PlaySound(SoundID.Item91, Projectile.Center); int projID = ModContent.ProjectileType(); @@ -89,11 +93,12 @@ namespace CalamityMod.Projectiles.Magic } ExtraBackArmRotation = Utils.Remap(Vector2.Dot(-Vector2.UnitY, Projectile.velocity.SafeNormalize(-Vector2.UnitY)), 0f, 1f, MathHelper.PiOver4, 0f); + postShotFade *= 0.86f; } private void SpawnFiringDust(Vector2 GunTipPosition, Vector2 laserVelocity) { - int dustID = 107; + int dustID = ModContent.DustType(); int dustRadius = 5; int dustDiameter = 2 * dustRadius; Vector2 dustCorner = GunTipPosition - Vector2.One * dustRadius; @@ -103,7 +108,8 @@ namespace CalamityMod.Projectiles.Magic Dust d = Dust.NewDustDirect(dustCorner, dustDiameter, dustDiameter, dustID, dustVel.X, dustVel.Y); d.velocity *= 0.125f; d.noGravity = true; - d.scale = 1.4f; + d.scale = 0.9f; + d.color = Color.Lime; } } @@ -116,7 +122,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Texture2D texture = TextureAssets.Projectile[Type].Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.velocity * 10; + Vector2 drawPosition = (Projectile.Center - Main.screenPosition) - vel * postShotFade; Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) + MathHelper.PiOver2; Vector2 rotationPoint = frame.Size() * 0.5f; diff --git a/Projectiles/Magic/NanoPurgeLaser.cs b/Projectiles/Magic/NanoPurgeLaser.cs index 8924318d2f..9f074f7308 100644 --- a/Projectiles/Magic/NanoPurgeLaser.cs +++ b/Projectiles/Magic/NanoPurgeLaser.cs @@ -1,5 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -9,9 +12,11 @@ namespace CalamityMod.Projectiles.Magic private const float LaserLength = 40f; private const float LaserLengthChangeRate = 1.5f; public bool HasBounced = false; + public int bounceTimer = 0; public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 5; @@ -52,10 +57,36 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.localAI[0] <= 0f) Projectile.Kill(); } + + if (Projectile.timeLeft % 2 == 0) + { + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 4, 0.02f, Color.Lime, new Vector2(0.6f, 1.4f), true, false, shrinkSpeed: 0.95f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (bounceTimer > 0) + bounceTimer--; } public override bool OnTileCollide(Vector2 oldVelocity) { + bounceTimer = 10; + for (int i = 0; i < 2; i++) + { + Color color = i == 0 ? Color.White : Color.Lime; + Particle orb2 = new CustomSpark(Projectile.Center, oldVelocity * 0.1f, "CalamityMod/Particles/BloomCircle", false, 15, Main.rand.NextFloat(0.15f, 0.25f) * (i == 0 ? 2 : 3), color, new Vector2(0.7f, 1.1f), true, false); + GeneralParticleHandler.SpawnParticle(orb2); + } + for (int i = 0; i < 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 2.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.45f, 1.1f); + dust.color = Color.Lime; + dust.noLightEmittence = true; + } + + Player owner = Main.player[Projectile.owner]; + if (!HasBounced) { HasBounced = true; @@ -67,7 +98,7 @@ namespace CalamityMod.Projectiles.Magic if (!n.CanBeChasedBy(Projectile)) continue; - float currentNPCDist = Vector2.Distance(n.Center, Main.MouseWorld); + float currentNPCDist = Vector2.Distance(n.Center, owner.ClampedMouseWorld()); if (currentNPCDist < npcDistCheck) { npcDistCheck = currentNPCDist; @@ -77,7 +108,7 @@ namespace CalamityMod.Projectiles.Magic // If the index is not default, smart bounce in the direction of that enemy. if (index != -1) { - Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], Main.player[Projectile.owner].ActiveItem().shootSpeed, 3); + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], owner.ActiveItem().shootSpeed, 3); } else // Otherwise, use standard bouncing behavior. { @@ -101,18 +132,24 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) => new Color(96, 255, 96, 0); - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(LaserLength, 2f, lightColor); + public override bool PreDraw(ref Color lightColor) + { + if (bounceTimer == 0) + Projectile.DrawBeam(LaserLength, 2f, lightColor); + return false; + } public override void OnKill(int timeLeft) { - int dustID = 107; - int dustAmt = Main.rand.Next(3, 7); - Vector2 dustPos = Projectile.Center - Projectile.velocity / 2f; - for (int i = 0; i < dustAmt; ++i) + Particle spark2 = new CustomSpark(Projectile.Center, Projectile.velocity * 0.3f, "CalamityMod/Particles/GlowSpark", false, 14, 0.018f, Color.Lime, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.65f); + GeneralParticleHandler.SpawnParticle(spark2); + for (int i = 0; i < 3; i++) { - Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 0.8f); - d.velocity *= 1.15f; - d.noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.4f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.45f, 1.1f); + dust.color = Color.Lime; + dust.noLightEmittence = true; } } } diff --git a/Projectiles/Magic/NebulaCloud.cs b/Projectiles/Magic/NebulaCloud.cs index 89797b1b20..d2cafeea2e 100644 --- a/Projectiles/Magic/NebulaCloud.cs +++ b/Projectiles/Magic/NebulaCloud.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Magic/NebulaCloudCore.cs b/Projectiles/Magic/NebulaCloudCore.cs index 4543a55adc..d48efbeab7 100644 --- a/Projectiles/Magic/NebulaCloudCore.cs +++ b/Projectiles/Magic/NebulaCloudCore.cs @@ -16,9 +16,10 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -47,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; // Decide what state the projectile is in. @@ -260,14 +261,14 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D coreTexture = Terraria.GameContent.TextureAssets.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; + Vector2 coreOrigin = coreTexture.Size() / new Vector2(0, Main.projFrames[Type]) * 0.5f; Vector2 cloudOrigin = nebulaCloudTexture.Size() * 0.5f; Main.EntitySpriteDraw(nebulaCloudTexture, position, null, cloudColor, 0f - Projectile.rotation + 0.35f, cloudOrigin, cloudScale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(nebulaCloudTexture, position, null, fuckYou, 0f - Projectile.rotation, cloudOrigin, Projectile.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); - Main.EntitySpriteDraw(coreTexture, position, new Rectangle?(new Rectangle(0, Main.projFrames[Projectile.type] * Projectile.frame, coreTexture.Width, Main.projFrames[Projectile.type])), coreColor, (0f - Projectile.rotation) * 0.7f, coreOrigin, Projectile.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); + Main.EntitySpriteDraw(coreTexture, position, new Rectangle?(new Rectangle(0, Main.projFrames[Type] * Projectile.frame, coreTexture.Width, Main.projFrames[Type])), coreColor, (0f - Projectile.rotation) * 0.7f, coreOrigin, Projectile.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(nebulaCloudTexture, position, null, fuckYou * 0.8f, Projectile.rotation * 0.5f, cloudOrigin, Projectile.scale * 0.9f, spriteEffects, 0); fuckYou.A = 0; diff --git a/Projectiles/Magic/NebulaNova.cs b/Projectiles/Magic/NebulaNova.cs index 141a2e4745..84830b3f48 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 1e137421ee..d29dbbe09e 100644 --- a/Projectiles/Magic/NebulousCataclysm_Held.cs +++ b/Projectiles/Magic/NebulousCataclysm_Held.cs @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.frameCounter < 5) return; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 6029ca4ce6..87e17e8810 100644 --- a/Projectiles/Magic/NettleRight.cs +++ b/Projectiles/Magic/NettleRight.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Magic // Draw the tip for the final thorn public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 887a8c6869..6825f540e2 100644 --- a/Projectiles/Magic/NightBolt.cs +++ b/Projectiles/Magic/NightBolt.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 6c38dbd006..24e443b373 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -147,7 +148,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/OmicronBeam.cs b/Projectiles/Magic/OmicronBeam.cs index 2c12781212..f11253d597 100644 --- a/Projectiles/Magic/OmicronBeam.cs +++ b/Projectiles/Magic/OmicronBeam.cs @@ -40,8 +40,7 @@ namespace CalamityMod.Projectiles.Magic { if (isSplit == 0) { - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); splitShot = true; } @@ -70,10 +69,7 @@ namespace CalamityMod.Projectiles.Magic time++; if (Projectile.numUpdates == 1) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Magic/OmicronHoldout.cs b/Projectiles/Magic/OmicronHoldout.cs index 9d3aef3fb7..a476798def 100644 --- a/Projectiles/Magic/OmicronHoldout.cs +++ b/Projectiles/Magic/OmicronHoldout.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Magic } Owner.Calamity().GeneralScreenShakePower = 6.5f; - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3, ModContent.ProjectileType(), Projectile.damage * 32, Projectile.knockBack, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3, ModContent.ProjectileType(), Projectile.damage * 32, Projectile.knockBack, Projectile.owner, 0, 0); for (int i = 0; i < 8; i++) { @@ -123,12 +123,12 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 5; i++) { firingVelocity3 = (shootDirection * 10).RotatedBy((0.035f * (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); + Projectile.NewProjectile(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.035f * (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); + Projectile.NewProjectile(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, EffectsColor, new Vector2(1.7f, 0.8f), true); diff --git a/Projectiles/Magic/OmicronWingman.cs b/Projectiles/Magic/OmicronWingman.cs index 9b830bea2a..6fd83a0954 100644 --- a/Projectiles/Magic/OmicronWingman.cs +++ b/Projectiles/Magic/OmicronWingman.cs @@ -127,8 +127,7 @@ namespace CalamityMod.Projectiles.Magic time++; Projectile.soundDelay--; - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } private void ManagePlayerProjectileMembers(Vector2 ownerToMouse) @@ -155,6 +154,7 @@ namespace CalamityMod.Projectiles.Magic private void Shoot(bool isGrenade) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 shootDirection = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); // The position of the tip of the gun. @@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Magic { 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); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, firingVelocity * 1.2f, ModContent.ProjectileType(), Projectile.damage * 14, Projectile.knockBack * 5, Projectile.owner, 0, 2); } } else @@ -179,9 +179,9 @@ namespace CalamityMod.Projectiles.Magic if (Main.myPlayer == Projectile.owner) { - 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); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, firingVelocity.RotatedBy(-0.05) * 0.85f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, firingVelocity.RotatedBy(0.05) * 0.85f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); } } @@ -258,7 +258,7 @@ namespace CalamityMod.Projectiles.Magic 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[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; diff --git a/Projectiles/Magic/PartySparkle.cs b/Projectiles/Magic/PartySparkle.cs index f9d953761f..f2a5df1a09 100644 --- a/Projectiles/Magic/PartySparkle.cs +++ b/Projectiles/Magic/PartySparkle.cs @@ -10,6 +10,9 @@ namespace CalamityMod.Projectiles.Magic public class PartySparkle : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + + public override string Texture => "CalamityMod/Projectiles/StarProj"; + public float Time { get => Projectile.ai[0]; @@ -60,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - Texture2D sparkleTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D sparkleTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Color sparkleColor = CalamityUtils.MulticolorLerp(ColorSpectrumHue, RainbowPartyCannon.ColorSet) * Projectile.Opacity * 0.5f; sparkleColor.A = 0; diff --git a/Projectiles/Magic/PartySparkle.png b/Projectiles/Magic/PartySparkle.png deleted file mode 100644 index 0968156e79..0000000000 Binary files a/Projectiles/Magic/PartySparkle.png and /dev/null differ diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 806fdadff5..8eb1c426c2 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -1,7 +1,6 @@ using System; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -9,11 +8,15 @@ namespace CalamityMod.Projectiles.Magic public class PhantasmalFuryProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public int time = 0; + public float dustRotation = 0; + public bool launched = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -22,67 +25,106 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 900; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16 * Projectile.MaxUpdates; + Projectile.ArmorPenetration = 15; } public override void AI() { + Player Owner = Main.player[Projectile.owner]; Projectile.frameCounter++; if (Projectile.frameCounter > 4) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; - if (Projectile.timeLeft % 10 == 0) - { - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - if (Projectile.timeLeft < 100) - { - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 10f, 20f); - } + dustRotation += 0.12f; + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.5f); - Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0.25f); - - for (int i = 0; i < 3; i++) - { - 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; - } + // 175, 100 ALPHA Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + + if (time >= 500) + { + if (time == 500) + { + Projectile.penetrate = 1; + launched = true; + } + + NPC target = Projectile.Center.ClosestNPCAt(700); + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.15f, 6, 0.98f, accelerate: true); + + if (time < 550 && target == null) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + if (Projectile.velocity.Length() < 6) + Projectile.velocity += (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; + else + Projectile.velocity *= 0.9f; + } + } + else if (time > 15) + { + Vector2 circle = Owner.Center + new Vector2(0, -30).RotatedBy(time * 0.05f); + Vector2 moveToEnemy = (circle - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 8) + Projectile.velocity += moveToEnemy * Main.rand.NextFloat(0.2f, 0.4f); + else + Projectile.velocity *= 0.85f; + } + + if (time > 5) + { + Vector2 dustPos = Projectile.Center + (MathHelper.Pi + dustRotation + MathHelper.PiOver2).ToRotationVector2() * 10f * Projectile.scale; + Dust dust = Dust.NewDustPerfect(dustPos, 175, (MathHelper.Pi + dustRotation * Math.Sign(Projectile.velocity.Length())).ToRotationVector2() * 2); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.75f, 1.2f); + dust.alpha = Main.rand.Next(100, 170 + 1); + dust.velocity = dust.velocity.RotatedByRandom(0f); + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= (launched ? 1f : 0.4f); + + Player Owner = Main.player[Projectile.owner]; + + Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 1); + target.MoveNPC(launchVel, 10 * (launched ? 0.5f : 1), true); } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); - for (int j = 0; j <= 10; j++) + for (int i = 0; i <= 3; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); - } - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 8; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 3f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } + Dust dust = Dust.NewDustPerfect(Projectile.Center, 175, (Projectile.velocity * 6).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(1.2f, 1.8f)); + dust.noGravity = true; + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 278 : 267); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(1f, 4); + chargefull.scale = Main.rand.NextFloat(0.5f, 0.9f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Color.Aqua, 0.3f); } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1); + return false; } } diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 16f456274e..34b9525e3e 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,31 +9,113 @@ namespace CalamityMod.Projectiles.Magic public class Phantom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public float sizeVariance = 2; + public int time = 0; + public int spinDir = 100; + public int waveOften = 40; + public float scaleVariance = 1; + + public bool launched = false; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; Projectile.height = 8; Projectile.friendly = true; - Projectile.extraUpdates = 1; - Projectile.penetrate = 2; + Projectile.extraUpdates = 5; + Projectile.penetrate = -1; Projectile.ignoreWater = true; - Projectile.timeLeft = 120; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16 * Projectile.MaxUpdates; + Projectile.ArmorPenetration = 30; } public override void AI() { - Projectile.rotation += 0.01f; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); + Projectile.rotation += Main.rand.NextFloat(0.02f, 0.09f); - for (int i = 0; i < 2; i++) + if (spinDir == 100) { - int spectre = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); - Main.dust[spectre].noGravity = true; + spinDir = Main.rand.NextBool() ? 1 : -1; + waveOften = Main.rand.Next(10, 40 + 1); + Projectile.scale = Main.rand.NextFloat(0.95f, 1.1f); } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.3f); + + if (time % 2 == 0 && time > 3 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-1, 1), -Projectile.velocity * 0.3f, false, 4, 0.025f, Color.Lerp(Color.White, Color.Aqua, 0.3f) * 0.6f, new Vector2(1, 0.3f), true, false, 2); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (time >= 500) + { + Vector2 mouse = Owner.ClampedMouseWorld(); + if (time == 500) + { + Projectile.penetrate = 1; + Projectile.velocity = (mouse - Projectile.Center).SafeNormalize(Vector2.UnitX) * 6; + launched = true; + } + + float badDist = Vector2.Distance(mouse, Projectile.Center); + if (badDist < 30) + { + time = 600; + } + + NPC target = Projectile.Center.ClosestNPCAt(550); + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.15f, 6, 0.98f, accelerate: true); + + if (time < 550 && target == null) + { + if (Projectile.velocity.Length() < 6) + Projectile.velocity += (mouse - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; + else + Projectile.velocity *= 0.9f; + } + + if (time % waveOften == 0) + spinDir *= -1; + + Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.01f, 0.02f) * spinDir); + } + else if (time > 15) + { + Vector2 circle = Owner.Center + new Vector2(0, -30).RotatedBy(time * 0.05f); + Vector2 moveToEnemy = (circle - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 8) + Projectile.velocity += moveToEnemy * Main.rand.NextFloat(0.2f, 0.4f); + else + Projectile.velocity *= 0.85f; + } + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= (launched ? 1f : 0.4f); + + Player Owner = Main.player[Projectile.owner]; + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center); + target.MoveNPC(launchVel, 10 * (launched ? 0.5f : 1), true); + + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 175, (Projectile.velocity * 3).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.3f)); + dust.noGravity = true; + } } } } diff --git a/Projectiles/Magic/PhasedGodRay.cs b/Projectiles/Magic/PhasedGodRay.cs index 633e74c335..a175116a5a 100644 --- a/Projectiles/Magic/PhasedGodRay.cs +++ b/Projectiles/Magic/PhasedGodRay.cs @@ -1,7 +1,11 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -23,19 +27,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 5; - Projectile.height = 5; + Projectile.width = 20; + Projectile.height = 20; Projectile.friendly = true; Projectile.alpha = 255; - Projectile.penetrate = 2; + Projectile.penetrate = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = -1; Projectile.MaxUpdates = 3; Projectile.timeLeft = 280; Projectile.DamageType = DamageClass.Magic; @@ -99,28 +103,70 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.localAI[0] <= 0f) Projectile.Kill(); } + + float fadeInLerp = Utils.GetLerpValue(280, 265, Projectile.timeLeft, true); + Color beamColor = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, fadeInLerp); + Color subColor = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, Main.rand.NextFloat()); + + Particle beamBody = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/BloomCircle", false, 7, 0.65f - 0.3f * fadeInLerp, beamColor * 0.8f, new Vector2(1.1f - 0.4f * fadeInLerp, 0.8f + 0.6f * fadeInLerp), true, false, shrinkSpeed: 0.6f); + GeneralParticleHandler.SpawnParticle(beamBody); + + Particle beamCore = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/BloomCircle", false, 5, 0.35f - 0.15f * fadeInLerp, Color.Lerp(beamColor, Color.White, 0.6f), new Vector2(0.7f, 1.4f), true, false, shrinkSpeed: 0.6f); + GeneralParticleHandler.SpawnParticle(beamCore); + + if (Projectile.timeLeft == 280) + { + for (int i = 0; i < 3; i++) + { + subColor = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, Main.rand.NextFloat()); + Particle spark = new CustomSpark(Projectile.Center - Projectile.velocity * 2, (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.5f, 0.7f), "CalamityMod/Particles/SemiCircularSmearVerticalBlank", false, 10, 0.45f, subColor, new Vector2(0.8f, 1.2f), true, false, shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust2.scale = Main.rand.NextFloat(0.6f, 1.4f); + dust2.noGravity = true; + dust2.velocity = (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.3f, 0.8f); + dust2.color = subColor; + } + } } - 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); + for (int i = 0; i< 2; i++) + { + Color color = AetherfluxCannon.accentColor; + Particle orb2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 20, Main.rand.NextFloat(0.15f, 0.25f) * 3, color, new Vector2(1f, 1f), true, false); + GeneralParticleHandler.SpawnParticle(orb2); + } + Projectile.timeLeft = 280; + SoundStyle hitSound = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(hitSound with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) }, Projectile.Center); + if (Projectile.damage > 1) + Projectile.damage = (int)(Projectile.damage * 0.865f); + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override Color? GetAlpha(Color lightColor) => new Color(222, 166, 44, 0); - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true); + public override bool PreDraw(ref Color lightColor) + { + //Projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true); + return false; + } public override void OnKill(int timeLeft) { - int dustID = 269; - int dustAmt = 4; - Vector2 dustPos = Projectile.Center - Projectile.velocity / 2f; - Vector2 dustVel = Projectile.velocity / 4f; - for (int i = 0; i < dustAmt; ++i) + for (int i = 0; i < 4; i++) { - Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 2.5f); - d.velocity += dustVel; - d.velocity *= Main.rand.NextFloat(0.4f, 1f); - d.noGravity = true; + Color subColor = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, Main.rand.NextFloat()); + float rot = Main.rand.NextFloat(-0.1f, 0.1f); + Vector2 startVel = (Projectile.velocity * 0.1f).RotatedBy(rot); + Vector2 endVel = startVel.RotatedBy(rot * 5) * 20; + Particle orb2 = new VelChangingSpark(Projectile.Center, startVel, endVel, "CalamityMod/Particles/BloomCircle", Main.rand.Next(15, 20 + 1), Main.rand.NextFloat(0.015f, 0.025f) * 15, subColor, new Vector2(1.1f, 1f), true, false, lerpRate: 0.015f, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(orb2); } } } diff --git a/Projectiles/Magic/PhotosyntheticShard.cs b/Projectiles/Magic/PhotosyntheticShard.cs index 750b53b166..e5d82f73e6 100644 --- a/Projectiles/Magic/PhotosyntheticShard.cs +++ b/Projectiles/Magic/PhotosyntheticShard.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 20; diff --git a/Projectiles/Magic/PlasmaBolt.cs b/Projectiles/Magic/PlasmaBolt.cs deleted file mode 100644 index a7db8784ad..0000000000 --- a/Projectiles/Magic/PlasmaBolt.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class PlasmaBolt : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 200; - Projectile.MaxUpdates = 10; - } - - public override void AI() - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 6f) - { - for (int d = 0; d < 5; d++) - { - 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; - dust.scale = 0.65f; - dust.noLight = true; - } - } - } - } -} diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index b0c6fe4ce1..76a251b329 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -53,19 +53,13 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - float random = Main.rand.Next(30, 90); - float spread = random * 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++) + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 8; 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(), (int)(Projectile.damage * 1.75), 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(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - offset).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner); } } Projectile.penetrate--; diff --git a/Projectiles/Magic/PlasmaRifleExplosion.cs b/Projectiles/Magic/PlasmaRifleExplosion.cs new file mode 100644 index 0000000000..358b53ed41 --- /dev/null +++ b/Projectiles/Magic/PlasmaRifleExplosion.cs @@ -0,0 +1,39 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class PlasmaRifleExplosion : BaseMassiveExplosionProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override int Lifetime => 40; + public override bool UsesScreenshake => true; + public override float GetScreenshakePower(float pulseCompletionRatio) => CalamityUtils.Convert01To010(pulseCompletionRatio) * 3f; + public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Chartreuse; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = Lifetime; + Projectile.DamageType = DamageClass.Magic; + } + + public override void PostAI() => Lighting.AddLight(Projectile.Center, Color.Chartreuse.ToVector3() * Projectile.Opacity * 0.7f); + + 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; + } + } +} diff --git a/Projectiles/Magic/PlasmaRifleShot.cs b/Projectiles/Magic/PlasmaRifleShot.cs new file mode 100644 index 0000000000..e3f148857f --- /dev/null +++ b/Projectiles/Magic/PlasmaRifleShot.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class PlasmaRifleShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + // Due to how far/fast this thing moves, it'd require way too many points for a smooth long trail using oldPos + public List TrailPos = new List(); + + // Meanwhile, this is for the shorter trail at the head + public override void SetStaticDefaults() + { + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 5000; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.MaxUpdates = 10; + Projectile.timeLeft = 30 * Projectile.MaxUpdates; + Projectile.penetrate = -1; // Effectively no pierce -- this is just to prevent sudden trail cutting + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Projectile.numHits > 0) + { + Projectile.scale -= 0.02f; + Projectile.Opacity -= 0.02f; + if (Projectile.Opacity <= 0f) + Projectile.Kill(); + } + else + { + if (Projectile.FinalExtraUpdate() || TrailPos.Count < 15) + TrailPos.Add(Projectile.Center); + + if (Projectile.timeLeft < 50) // Starts exploding and fading by itself if it never hits anything + Explode(); + } + } + + public override bool? CanDamage() => Projectile.numHits == 0 ? null : false; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits == 0) + Explode(); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.numHits == 0) + Explode(); + return false; + } + + public void Explode() + { + Projectile.numHits++; // Ensure this can only happen once + Projectile.timeLeft = 50; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; + TrailPos.Add(Projectile.Center); // Final position update + + // Right click can not explode + if (Projectile.ai[0] > 0f) + return; + + SoundEngine.PlaySound(AnomalysNanogunMPFBBoom.MPFBExplosion, Projectile.Center); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, ai1: 160f); + + for (int k = 0; k < 30; k++) + { + float intensity = Main.rand.NextFloat(0.1f, 1f); + Color BaseCol = Color.Lerp(Color.Lime, Color.Yellow, intensity); + Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(24f, 25f) - 20f * intensity); + MediumMistParticle cloud = new MediumMistParticle(Projectile.Center, velocity, BaseCol, Color.Chartreuse, Main.rand.NextFloat(1f, 1.6f) + 2f * intensity, 210f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(cloud); + } + } + + internal float HeadWidthFunction(float completionRatio) => Projectile.scale * (Projectile.ai[0] > 0f ? 2f : 4f) * Utils.GetLerpValue(0.5f, 0.25f, MathF.Abs(0.5f - completionRatio), true); + internal Color HeadColorFunction(float completionRatio) => Color.LightSlateGray * Projectile.Opacity; + internal float TrailWidthFunction(float completionRatio) => Projectile.scale * (Projectile.ai[0] > 0f ? 2f : 4f); + internal Color TrailColorFunction(float completionRatio) => Color.Lerp(Color.Chartreuse, Color.SlateGray, Utils.Remap(Projectile.Opacity, 0.5f, 1f, 0f, 0.8f)) * Projectile.Opacity * 0.3f; + + public override bool PreDraw(ref Color lightColor) + { + if (TrailPos == null) + return false; + + PrimitiveRenderer.RenderTrail(TrailPos, new(TrailWidthFunction, TrailColorFunction), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(HeadWidthFunction, HeadColorFunction, (_) => Projectile.Size * 0.5f), 12); + return false; + } + } +} diff --git a/Projectiles/Magic/PlasmaShot.cs b/Projectiles/Magic/PlasmaShot.cs deleted file mode 100644 index 6107767870..0000000000 --- a/Projectiles/Magic/PlasmaShot.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class PlasmaShot : 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.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 600; - Projectile.MaxUpdates = 10; - } - - public override void AI() - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 6f) - { - for (int d = 0; d < 10; d++) - { - 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; - dust.noLight = true; - } - } - } - - public override void OnKill(int timeLeft) - { - 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), (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, 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 b53fafad64..e9b2f197a4 100644 --- a/Projectiles/Magic/PoseidonTyphoon.cs +++ b/Projectiles/Magic/PoseidonTyphoon.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Magic public class PoseidonTyphoon : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 30; @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[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, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/PrimordialAncientProjectile.cs b/Projectiles/Magic/PrimordialAncientProjectile.cs index 7d83787b70..42821ea279 100644 --- a/Projectiles/Magic/PrimordialAncientProjectile.cs +++ b/Projectiles/Magic/PrimordialAncientProjectile.cs @@ -1,18 +1,14 @@ using System; using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.DataStructures; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Steamworks; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.Projectiles.Magic { public class PrimordialAncientProjectile : ModProjectile, ILocalizedModType @@ -28,11 +24,10 @@ namespace CalamityMod.Projectiles.Magic public List buffList = new List(new bool[Main.maxPlayers]); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } - public override void SetDefaults() { Projectile.width = 140; @@ -47,7 +42,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 40 * Projectile.extraUpdates; } - public override void AI() { if (time == 0) @@ -63,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic curve = MathHelper.Lerp(curve, 0f, 0.035f); Projectile.velocity *= Main.rand.NextFloat(0.985f, 0.995f); if (Projectile.ai[1] != 1) - Projectile.velocity = Projectile.velocity.RotatedBy(curve * rotDirection); + Projectile.velocity = Projectile.velocity.RotatedBy(curve * Projectile.localAI[0]); } if (Projectile.ai[2] == 1) @@ -108,7 +102,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -159,12 +153,12 @@ namespace CalamityMod.Projectiles.Magic SoundStyle explo = new("CalamityMod/Sounds/Item/MagicRockImpact"); SoundEngine.PlaySound(explo with { Volume = 0.75f, Pitch = 0.35f }, Projectile.Center); - mousePos = Main.MouseWorld; + mousePos = Main.player[Projectile.owner].ClampedMouseWorld(); goToCursor = true; } if (goToCursor) { - mousePos = Main.MouseWorld; + mousePos = Main.player[Projectile.owner].ClampedMouseWorld(); if (time == 355) { CenterX = Projectile.Center.X; @@ -203,7 +197,7 @@ namespace CalamityMod.Projectiles.Magic dust2.alpha = 100; } - Projectile.rotation += Main.rand.NextFloat(0.1f * Utils.GetLerpValue(-100, 360, time)) * (float)Projectile.direction * rotDirection; + Projectile.rotation += Main.rand.NextFloat(0.1f * Utils.GetLerpValue(-100, 360, time)) * (float)Projectile.direction * Projectile.localAI[0]; time++; } @@ -276,7 +270,7 @@ namespace CalamityMod.Projectiles.Magic public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.7f, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.7f, 1); Texture2D rTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; float randSize = Main.rand.NextFloat(0.8f, 1.2f); diff --git a/Projectiles/Magic/PrimordialEarthProjectile.cs b/Projectiles/Magic/PrimordialEarthProjectile.cs index 80592b03cc..e7d99309b2 100644 --- a/Projectiles/Magic/PrimordialEarthProjectile.cs +++ b/Projectiles/Magic/PrimordialEarthProjectile.cs @@ -22,9 +22,9 @@ namespace CalamityMod.Projectiles.Magic public List buffList = new List(new bool[Main.maxPlayers]); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -192,7 +192,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { if (Projectile.timeLeft > 50) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.4f, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.4f, 1); return true; } } diff --git a/Projectiles/Magic/PrinceFlameLarge.cs b/Projectiles/Magic/PrinceFlameLarge.cs index d29aae3dde..30781ae284 100644 --- a/Projectiles/Magic/PrinceFlameLarge.cs +++ b/Projectiles/Magic/PrinceFlameLarge.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -15,12 +16,14 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public ref float Time => ref Projectile.ai[0]; public const int Lifetime = 60; - public const int FadeoutTime = 25; + public const int FadeoutTime = 24; + public static Color FlameColor => new Color(255, 180, 80); + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + Main.projFrames[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 4; } public override void SetDefaults() @@ -38,7 +41,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // Create rose petals. - if (Projectile.localAI[0] == 0f) + if (Time == 0f) { for (int i = 0; i < 10; i++) { @@ -49,7 +52,6 @@ namespace CalamityMod.Projectiles.Magic rose.scale = Main.rand.NextFloat(1.2f, 1.7f); rose.noGravity = Main.rand.NextBool(); } - Projectile.localAI[0] = 1f; } // Explode before dissipating. @@ -58,40 +60,43 @@ namespace CalamityMod.Projectiles.Magic bool dissipating = Projectile.timeLeft < FadeoutTime; - for (int i = 0; i < (dissipating ? 2 : 1); i++) - { - Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire); - fire.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 6f); - fire.scale *= Main.rand.NextFloat(1.15f, 1.7f); - fire.noGravity = Main.rand.NextBool(); - } - // Dissipate at the end of the projectile's lifetime. if (dissipating) { Projectile.frame = (int)Math.Round(MathHelper.Lerp(4f, 7f, Utils.GetLerpValue(FadeoutTime, 0f, Projectile.timeLeft, true))); Projectile.velocity *= 0.95f; + + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4f, 4f), ModContent.DustType(), (-Projectile.velocity).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.2f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1f); + dust.color = FlameColor * 0.8f; + + Particle mist = new MediumMistParticle(Projectile.Center, Projectile.velocity * 0.5f, FlameColor, Color.DarkSlateGray, Main.rand.NextFloat(0.4f, 0.6f), 140, Main.rand.NextFloat(-0.1f, 0.1f)); + GeneralParticleHandler.SpawnParticle(mist); + } + + Particle dyingSmoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Color.Lerp(FlameColor, Color.DarkSlateGray, 0.3f), 12, Main.rand.NextFloat(0.3f, 0.4f), 0.6f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(dyingSmoke); return; } - // Create bursts of fire dust. - if (Time % 8f == 7f) + // Create bursts of fire dust + if (Time % 2f == 1f && Time > 5f) { - for (int i = 0; i < 12; i++) - { - Vector2 dustSpawnOffset = Vector2.UnitX * -Projectile.width / 2f; - dustSpawnOffset += -Vector2.UnitY.RotatedBy(i * MathHelper.TwoPi / 12f) * new Vector2(8f, 16f); - dustSpawnOffset = dustSpawnOffset.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(16f, 16f), ModContent.DustType(), (-Projectile.velocity).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.color = FlameColor; - Dust holyFire = Dust.NewDustDirect(Projectile.Center, 0, 0, (int)CalamityDusts.ProfanedFire, 0f, 0f, 160, default, 1f); - holyFire.scale = 1.1f; - holyFire.noGravity = true; - holyFire.position = Projectile.Center + dustSpawnOffset; - holyFire.velocity = Projectile.velocity * 0.1f; - holyFire.velocity = (Projectile.Center - Projectile.velocity * 3f - holyFire.position).SafeNormalize(Vector2.Zero) * 1.25f; - } + Particle mist = new MediumMistParticle(Projectile.Center, Projectile.velocity * 0.5f, FlameColor, Color.DarkSlateGray, Main.rand.NextFloat(1f, 1.5f), 180, Main.rand.NextFloat(-0.1f, 0.1f)); + GeneralParticleHandler.SpawnParticle(mist); } + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, FlameColor, 24, Main.rand.NextFloat(0.6f, 1f), 0.6f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(smoke); + Time++; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.frameCounter++; @@ -109,6 +114,13 @@ namespace CalamityMod.Projectiles.Magic int damage = (int)(Projectile.damage * 0.66f); float kb = Projectile.knockBack * 0.4f; float offsetAngle = Main.rand.NextFloatDirection() * 0.31f; + for (float i = 0f; i < MathHelper.TwoPi; i += 0.05f) + { + Vector2 velocity = (i + offsetAngle + MathHelper.ToRadians(45f)).ToRotationVector2() * (0.5f + (MathF.Sin(6f * i) + 1f) * 8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity); + dust.noGravity = true; + dust.color = Main.hslToRgb(Main.rand.NextFloat(0.05f, 0.15f), 1f, 0.66f); + } for (int i = 0; i < ThePrince.FlameSplitCount; i++) { Vector2 shootVelocity = (MathHelper.TwoPi * i / ThePrince.FlameSplitCount + offsetAngle).ToRotationVector2() * 8f; @@ -121,7 +133,7 @@ namespace CalamityMod.Projectiles.Magic { lightColor = Color.Lerp(lightColor, Color.White, 0.8f); lightColor.A /= 4; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -129,15 +141,6 @@ namespace CalamityMod.Projectiles.Magic { if (timeLeft > FadeoutTime) ExplodeIntoFireballs(); - - for (int i = 0; i < 30; i++) - { - Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire); - fire.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(3f, 8f); - fire.position += fire.velocity.RotatedBy(MathHelper.PiOver2) * 2f; - fire.scale *= Main.rand.NextFloat(1.15f, 1.7f); - fire.noGravity = true; - } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Magic/PrinceFlameSmall.cs b/Projectiles/Magic/PrinceFlameSmall.cs index 1e87c99216..f3b2845002 100644 --- a/Projectiles/Magic/PrinceFlameSmall.cs +++ b/Projectiles/Magic/PrinceFlameSmall.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,9 +15,10 @@ namespace CalamityMod.Projectiles.Magic public const int AttackDelay = 12; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 3; } public override void SetDefaults() @@ -23,29 +26,39 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 240; - Projectile.penetrate = 1; Projectile.DamageType = DamageClass.Magic; - Projectile.extraUpdates = 2; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 80 * Projectile.MaxUpdates; } public override void AI() { Time++; Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Projectile.timeLeft, true); + if (Main.rand.NextBool(3)) + { + Particle mist = new MediumMistParticle(Projectile.Center, Projectile.velocity * 0.5f, PrinceFlameLarge.FlameColor * Projectile.Opacity, Color.DarkSlateGray * Projectile.Opacity, Main.rand.NextFloat(0.4f, 0.6f), 140, Main.rand.NextFloat(-0.1f, 0.1f)); + GeneralParticleHandler.SpawnParticle(mist); + } + if (Time > AttackDelay) + { CalamityUtils.HomeInOnNPC(Projectile, false, 600f, 14f, 32f); + + Particle fire = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(6f, 6f), (-Projectile.velocity).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.4f), false, 9, Main.rand.NextFloat(0.4f, 1f), PrinceFlameLarge.FlameColor); + GeneralParticleHandler.SpawnParticle(fire); + } } public override bool PreDraw(ref Color lightColor) { lightColor = Color.Lerp(lightColor, Color.White, 0.8f); - lightColor.A /= 3; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + lightColor.A /= 2; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -56,9 +69,18 @@ namespace CalamityMod.Projectiles.Magic return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); + + public override void OnKill(int timeLeft) { - target.AddBuff(ModContent.BuffType(), 60); + for (int i = 0; i < 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(2f, 12f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.color = Main.hslToRgb(Main.rand.NextFloat(0.033f, 0.167f), 1f, 0.66f); + dust.noLightEmittence = true; + } } } } diff --git a/Projectiles/Magic/PurgeGuzzlerHoldout.cs b/Projectiles/Magic/PurgeGuzzlerHoldout.cs new file mode 100644 index 0000000000..45f863f630 --- /dev/null +++ b/Projectiles/Magic/PurgeGuzzlerHoldout.cs @@ -0,0 +1,153 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + internal class PurgeGuzzlerHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 35f; + public override float OffsetYUpwards => base.OffsetYUpwards; + public override float OffsetXUpwards => base.OffsetXUpwards; + public override float OffsetXDownwards => base.OffsetXDownwards; + public override float OffsetYDownwards => base.OffsetYDownwards; + + public override float BaseOffsetY => -5f; + public override float RecoilResolveSpeed => 0.4f; + public override float WeaponTurnSpeed => cooldownTimer > 0 ? 0.02f : 0.06f; + public override string Texture => "CalamityMod/Items/Weapons/Magic/PurgeGuzzler"; + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * 10 + Vector2.UnitY * 3; + public ref float revFrames => ref Projectile.ai[0]; + public ref float cooldownTimer => ref Projectile.ai[1]; + public ref float shootingTimer => ref Projectile.ai[2]; // Dual functions for rapid fire shooting cooldown and recoil + public bool isOnCooldown => cooldownTimer > 0; + public float revSpeed = 1; + public int shotsFired = 0; + + public Color color1 = Color.Goldenrod; + public Color color2 = Color.Orange; + public override void KillHoldoutLogic() + { + if (!isOnCooldown && (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type)) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + if (!isOnCooldown && (Owner.CantUseHoldout() || HeldItem.type != Owner.ActiveItem().type)) + cooldownTimer = (int)(Utils.Remap(revFrames, 0, 350, 40, 120, true)); + if (isOnCooldown) + { + PostFiringCooldown(); + return; + } + + revSpeed = Utils.Remap(revFrames, 0, 150, 1, 3, true); + if (shootingTimer >= 10 && revFrames < 150) + { + SoundStyle shot = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(shot with { Pitch = Utils.Remap(revFrames, 0, 150, 0.2f, 0.8f, true), Volume = 0.2f, MaxInstances = -1 }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + float spread = 0.045f * Utils.GetLerpValue(0, 300, revFrames, true); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(spread), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, revSpeed * (shotsFired % 2 == 0 ? -1f : 1f) * Utils.Remap(revFrames, 120, 150, 0.1f, 0.45f, true), Projectile.whoAmI); + + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(2f, 5f) * revSpeed, 0, default, Main.rand.NextFloat(0.3f, 0.7f) * revSpeed); + dust.noGravity = true; + dust.color = Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)); + } + + OffsetLengthFromArm -= 7f; + shootingTimer = 0; + shotsFired++; + } + + shootingTimer += revSpeed; + revFrames++; + + if (revFrames >= 150 && !isOnCooldown) + { + revSpeed = 4; + Owner.Calamity().GeneralScreenShakePower = 3.5f; + OffsetLengthFromArm -= 35f; + cooldownTimer = 60; + SoundStyle bigShot = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRay"); + SoundEngine.PlaySound(bigShot with { Pitch = 0.2f, Volume = 0.7f }, Projectile.Center); + SoundStyle bigShot2 = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyRay"); + SoundEngine.PlaySound(bigShot2 with { Pitch = 0.4f, Volume = 0.8f }, Projectile.Center); + + int bigBeamDamage = (int)(Projectile.damage * 6.5f); + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), bigBeamDamage, Projectile.knockBack * 3, Projectile.owner, 1, Projectile.whoAmI, 1); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), bigBeamDamage, Projectile.knockBack * 3, Projectile.owner, -1, Projectile.whoAmI, 1); + + for (int i = 0; i <= 25; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(5f, 30f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); + dust.noGravity = true; + dust.color = Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)); + } + } + } + private void PostFiringCooldown() + { + Owner.channel = true; + + if (cooldownTimer <= 1) + { + Projectile.Kill(); + } + + cooldownTimer--; + } + + public override bool PreDraw(ref Color lightColor) + { + if (revFrames < 2) + return false; + 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.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && shotsFired > 0) + { + float fade = Utils.GetLerpValue(1, 4, revSpeed); + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 5 * fade; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, Color.Orchid with { A = 0 } * fade, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite, 0f); + } + } + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && shotsFired > 0) + { + float fade = Utils.GetLerpValue(1, 4, revSpeed); + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/LargeBloom").Value; + float rot = Main.GlobalTimeWrappedHourly * 25; + + float sine = MathHelper.Clamp(Math.Abs((float)Math.Sin(rot * 2.275f / MathHelper.Pi)), 0.9f, 1f); + + // Glow Orb + for (int i = 0; i < 6; i++) + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, (Color.Lerp(Color.Orange, Color.Lerp(Color.Orchid, Color.Khaki, i * 0.1f), fade + 0.3f)) with { A = 0 } * 0.35f, rot * (i * 0.3f), rechargeTexture.Size() * 0.5f, (0.03f + i * 0.007f) * MathHelper.Clamp(revSpeed, 1f, 3.3f) * sine, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Projectiles/Magic/RainbowComet.cs b/Projectiles/Magic/RainbowComet.cs index b6fa5e20be..3bd0b240f3 100644 --- a/Projectiles/Magic/RainbowComet.cs +++ b/Projectiles/Magic/RainbowComet.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Projectiles.Magic public const float FadeinTime = 40f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; - Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -42,14 +42,14 @@ namespace CalamityMod.Projectiles.Magic Projectile.frameCounter++; if (Projectile.frameCounter % 4 == 3) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } public override bool PreDraw(ref Color lightColor) { - Texture2D cometTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D cometTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(cometTexture, Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition, - cometTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), + cometTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), Color.White * Projectile.Opacity, Projectile.rotation, cometTexture.Size() * 0.5f, diff --git a/Projectiles/Magic/RainbowPartyCannonProjectile.cs b/Projectiles/Magic/RainbowPartyCannonProjectile.cs index 4472644d00..a5a9de1063 100644 --- a/Projectiles/Magic/RainbowPartyCannonProjectile.cs +++ b/Projectiles/Magic/RainbowPartyCannonProjectile.cs @@ -85,6 +85,7 @@ namespace CalamityMod.Projectiles.Magic // Place the cannon directly into the player's hand at all times. Projectile.Center = center; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // Set the direction of the cannon if it hasn't been set yet. if (Projectile.velocity == Vector2.Zero || Projectile.velocity.Length() != 1f) Projectile.velocity = (Main.MouseWorld - center).SafeNormalize(Vector2.UnitX * Projectile.direction); diff --git a/Projectiles/Magic/RainbowRocket.cs b/Projectiles/Magic/RainbowRocket.cs index e67fd17d8a..8d93e5a912 100644 --- a/Projectiles/Magic/RainbowRocket.cs +++ b/Projectiles/Magic/RainbowRocket.cs @@ -37,9 +37,10 @@ namespace CalamityMod.Projectiles.Magic public const float HomingAcceleration = 0.4f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 3; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -63,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frameCounter++; if (Projectile.frameCounter % 4 == 3) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; NPC potentialTarget = Projectile.Center.ClosestNPCAt(2300f, true, true); if (Time < SwerveTime) @@ -138,10 +139,10 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D rocketTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(rocketTexture, Projectile.Center - Main.screenPosition, - rocketTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), + rocketTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), GetRocketColor(), Projectile.rotation, rocketTexture.Size() * 0.5f, diff --git a/Projectiles/Magic/RancorArm.cs b/Projectiles/Magic/RancorArm.cs index e9247e6092..e2ad741f5e 100644 --- a/Projectiles/Magic/RancorArm.cs +++ b/Projectiles/Magic/RancorArm.cs @@ -1,9 +1,10 @@ -using System; -using System.Collections.Generic; -using System.IO; +using CalamityMod.Buffs.DamageOverTime; 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.Audio; using Terraria.ID; @@ -21,14 +22,13 @@ namespace CalamityMod.Projectiles.Magic public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() { Projectile.width = Projectile.height = 4; Projectile.friendly = true; - Projectile.hostile = true; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; @@ -58,11 +58,11 @@ namespace CalamityMod.Projectiles.Magic // Decide a frame to use and adjust the hitbox based on it. if (Projectile.localAI[0] == 0f) { - // Play a wraith death sound by default, play a generic flame sound when spawned by gfb Orthoceras + // Play a wraith death sound by default, play a generic flame sound when spawned by GFB Orthoceras SoundStyle sound = Time == 0 ? SoundID.NPCDeath52 : SoundID.Item20; SoundEngine.PlaySound(sound, Projectile.Center); - Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); Vector2 newSize; switch (Projectile.frame) @@ -135,21 +135,10 @@ namespace CalamityMod.Projectiles.Magic behindNPCsAndTiles.Add(index); } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - if (Projectile.friendly) - { - modifiers.SourceDamage *= 0f; - if (Main.masterMode) modifiers.SourceDamage.Flat += 450f; - else if (Main.expertMode) modifiers.SourceDamage.Flat += 375f; - else modifiers.SourceDamage.Flat += 300f; - } - } - public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.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; Color light = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16); diff --git a/Projectiles/Magic/RancorFog.cs b/Projectiles/Magic/RancorFog.cs index cc971a645e..af5e72d30e 100644 --- a/Projectiles/Magic/RancorFog.cs +++ b/Projectiles/Magic/RancorFog.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic // Decide scale and initial rotation on the first frame this projectile exists. if (Projectile.localAI[0] == 0f) { - Projectile.scale = Main.rand.NextFloat(1f, 1.7f); + Projectile.scale = Main.rand.NextFloat(1f, 1.7f) * Projectile.ai[1]; Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); Projectile.localAI[0] = 1f; } @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.velocity *= 0.985f; // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/RancorHoldout.cs b/Projectiles/Magic/RancorHoldout.cs index e0edf03517..e845a63e6c 100644 --- a/Projectiles/Magic/RancorHoldout.cs +++ b/Projectiles/Magic/RancorHoldout.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Magic public const int ManaConsumeRate = 12; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 16; + Main.projFrames[Type] = 16; } public override void SetDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frameCounter++; if (Projectile.frameCounter >= 4) { - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; Projectile.frameCounter = 0; } diff --git a/Projectiles/Magic/RancorLargeCinder.cs b/Projectiles/Magic/RancorLargeCinder.cs index 45e9a59036..a27ef75db1 100644 --- a/Projectiles/Magic/RancorLargeCinder.cs +++ b/Projectiles/Magic/RancorLargeCinder.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.friendly = true; - Projectile.hostile = true; Projectile.timeLeft = 300; Projectile.ignoreWater = true; } @@ -49,12 +48,6 @@ namespace CalamityMod.Projectiles.Magic Time++; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += Main.rand.Next(80, 90); - } - public override Color? GetAlpha(Color lightColor) => Color.White * Projectile.Opacity; } } diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index b2d907be0d..b857ad36cf 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -100,10 +100,7 @@ namespace CalamityMod.Projectiles.Magic // Sync if the direction is different from the old one. // Spam caps are ignored due to the frequency of this happening. if (newAimDirection != Projectile.velocity) - { - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } + Projectile.ForceNetUpdate(); Projectile.velocity = newAimDirection; } @@ -129,7 +126,7 @@ namespace CalamityMod.Projectiles.Magic public void CreateTileHitEffects() { Vector2 endOfLaser = Projectile.Center + Projectile.velocity * (LaserLength - Main.rand.NextFloat(12f, 72f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Projectile.owner, 0f, 1f); if (Main.rand.NextBool()) { @@ -182,10 +179,7 @@ namespace CalamityMod.Projectiles.Magic overWiresUI.Add(index); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 150); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.Calamity().ashesOnDeath = 10; public override bool ShouldUpdatePosition() => false; } diff --git a/Projectiles/Magic/RancorMagicCircle.cs b/Projectiles/Magic/RancorMagicCircle.cs index f048530309..0552119b08 100644 --- a/Projectiles/Magic/RancorMagicCircle.cs +++ b/Projectiles/Magic/RancorMagicCircle.cs @@ -101,20 +101,18 @@ namespace CalamityMod.Projectiles.Magic public void UpdateAim() { - // Only execute the aiming code for the owner since Main.MouseWorld is a client-side variable. + // Only execute the aiming code for the owner since mouse position is a client-side variable. if (Main.myPlayer != Projectile.owner) return; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 idealDirection = Owner.SafeDirectionTo(Main.MouseWorld, Vector2.UnitX * Owner.direction); Vector2 newAimDirection = Projectile.velocity.MoveTowards(idealDirection, 0.05f); // Sync if the direction is different from the old one. // Spam caps are ignored due to the frequency of this happening. if (newAimDirection != Projectile.velocity) - { - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } + Projectile.ForceNetUpdate(); Projectile.velocity = newAimDirection; Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); @@ -191,7 +189,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D outerCircleTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D outerCircleTexture = Terraria.GameContent.TextureAssets.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/RancorSmallCinder.cs b/Projectiles/Magic/RancorSmallCinder.cs index 01e6135270..30b36d11b1 100644 --- a/Projectiles/Magic/RancorSmallCinder.cs +++ b/Projectiles/Magic/RancorSmallCinder.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Magic public ref float Lifetime => ref Projectile.ai[1]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic // Decide a frame to use on the first frame this projectile exists. if (Projectile.localAI[0] == 0f) { - Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); Projectile.localAI[0] = 1f; } diff --git a/Projectiles/Magic/RedirectingFire.cs b/Projectiles/Magic/RedirectingFire.cs index 8b9b9fb929..65892c59e0 100644 --- a/Projectiles/Magic/RedirectingFire.cs +++ b/Projectiles/Magic/RedirectingFire.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Projectiles.Magic public ref float Time => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 18; diff --git a/Projectiles/Magic/RedirectingGildedSoul.cs b/Projectiles/Magic/RedirectingGildedSoul.cs index c2ce615eb3..f49200a9d7 100644 --- a/Projectiles/Magic/RedirectingGildedSoul.cs +++ b/Projectiles/Magic/RedirectingGildedSoul.cs @@ -15,9 +15,10 @@ namespace CalamityMod.Projectiles.Magic public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -43,8 +44,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[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 979cc77c90..c4bae2a019 100644 --- a/Projectiles/Magic/RedirectingLostSoul.cs +++ b/Projectiles/Magic/RedirectingLostSoul.cs @@ -15,9 +15,10 @@ namespace CalamityMod.Projectiles.Magic public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -43,8 +44,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[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 88f6a69fbb..550b223e20 100644 --- a/Projectiles/Magic/RedirectingVengefulSoul.cs +++ b/Projectiles/Magic/RedirectingVengefulSoul.cs @@ -15,9 +15,10 @@ namespace CalamityMod.Projectiles.Magic public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -79,8 +80,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { for (int j = 0; j < Projectile.oldPos.Length / 2; j++) diff --git a/Projectiles/Magic/RougeSlashLarge.cs b/Projectiles/Magic/RougeSlashLarge.cs index 008c535d98..309880636c 100644 --- a/Projectiles/Magic/RougeSlashLarge.cs +++ b/Projectiles/Magic/RougeSlashLarge.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/RougeSlashMedium.cs b/Projectiles/Magic/RougeSlashMedium.cs index 69ac3a213d..332bd32555 100644 --- a/Projectiles/Magic/RougeSlashMedium.cs +++ b/Projectiles/Magic/RougeSlashMedium.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/RougeSlashSmall.cs b/Projectiles/Magic/RougeSlashSmall.cs index 558ea6a65d..a542522e7a 100644 --- a/Projectiles/Magic/RougeSlashSmall.cs +++ b/Projectiles/Magic/RougeSlashSmall.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index edbdac9ab9..5713663db6 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -23,49 +24,131 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 24; Projectile.friendly = true; Projectile.alpha = 255; - Projectile.penetrate = 1; + Projectile.scale = 0.4f; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Magic; } + // This is reused for all SHPC projectiles + #region General SHPC Projectile Functions + public enum SoulType + { + Light, // Larger explosion + Night, // Explosion lasts longer + Flight, // Restores flight time on direct hits + Might, // Launches enemies + Sight, // Weakly homes + Fright // Deals extra flat damage + } + + public static SoulType GetSoulEffects(int projai) + { + switch (projai) + { + case 0: + return SoulType.Light; + case 1: + return SoulType.Night; + case 2: + return SoulType.Flight; + case 3: + return SoulType.Might; + case 4: + return SoulType.Sight; + case 5: + return SoulType.Fright; + + default: + return SoulType.Light; + } + } + + public static Color FindColorForSoul(int projai) + { + switch (projai) + { + case 0: + return new(240, 29, 196); + case 1: + return new(123, 29, 220); + case 2: + return new(106, 240, 250); + case 3: + return new(4, 51, 222); + case 4: + return new(79, 255, 124); + case 5: + return new(255, 128, 20); + + default: + return new(0, 0, 0); + } + } + #endregion General SHPC Projectile Functions + public override void AI() { + // Light and fade in float lights = (float)Main.rand.Next(90, 111) * 0.01f; lights *= Main.essScale; Lighting.AddLight(Projectile.Center, 1f * lights, 0.2f * lights, 0.75f * lights); Projectile.alpha -= 2; + + // Animation Projectile.frameCounter++; if (Projectile.frameCounter > 4) { - Projectile.frame++; Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 3) + Projectile.frame = 0; } - if (Projectile.frame > 3) - { - Projectile.frame = 0; - } - Projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; - Projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; + + // Size pulsing + bool lightSoul = GetSoulEffects((int)Projectile.ai[0]) == SoulType.Light; + if (Projectile.localAI[0] == 0f) { Projectile.scale += 0.05f; - if ((double)Projectile.scale > 1.2) - { + if (Projectile.scale > 1.9f * (lightSoul ? SHPC.LightExplosionSizeMult : 1f)) Projectile.localAI[0] = 1f; - } } else { Projectile.scale -= 0.05f; - if ((double)Projectile.scale < 0.8) - { + if (Projectile.scale < 1.5f * (lightSoul ? SHPC.LightExplosionSizeMult : 1f)) Projectile.localAI[0] = 0f; - } } - Projectile.velocity.X *= 0.985f; - Projectile.velocity.Y *= 0.985f; - float projX = Projectile.Center.X; - float projY = Projectile.Center.Y; + + // Sight has weak homing + if (GetSoulEffects((int)Projectile.ai[0]) == SoulType.Sight) + { + float npcDistCheck = SHPC.SightHomingRange; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCheck) + { + npcDistCheck = currentNPCDist; + index = n.whoAmI; + } + } + + if (index != -1) + { + float speed = Projectile.velocity.Length(); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.npc[index].Center).ToRotation(), 0.1f).ToRotationVector2() * speed; + } + else // Slow down over time if not homing + Projectile.velocity *= 0.9875f; + } + else if (!(GetSoulEffects((int)Projectile.ai[0]) == SoulType.Flight))// Always slow down if not Flight + Projectile.velocity *= 0.9875f; + float explodeRange = 250f; bool canExplode = false; foreach (NPC n in Main.ActiveNPCs) @@ -86,33 +169,66 @@ namespace CalamityMod.Projectiles.Magic { explosionTimer--; if (explosionTimer <= 0) - { Projectile.Kill(); - } } } - public override Color? GetAlpha(Color lightColor) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - return new Color(255, Main.DiscoG, 155, Projectile.alpha); + Player owner = Main.player[Projectile.owner]; + // Flight restores flight time on direct hit + if (GetSoulEffects((int)Projectile.ai[0]) == SoulType.Flight) + { + if (owner.wingTime < owner.wingTimeMax) + owner.wingTime += SHPC.FlightDirectHitFlightBoost; + + if (owner.wingTime > owner.wingTimeMax) + owner.wingTime = owner.wingTimeMax; + } + + // Might launches enemies + if (GetSoulEffects((int)Projectile.ai[0]) == SoulType.Might && target.CanBeMoved(false)) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 launchVel = (owner.Calamity().mouseWorld - owner.Center).SafeNormalize(Vector2.UnitY) * SHPC.MightKnockbackStrength - new Vector2(0, 3); + target.MoveNPC(launchVel, SHPC.MightKnockbackStrength, false); + } } - public override bool PreDraw(ref Color lightColor) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - 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; + // Fright deals extra flat damage + if (GetSoulEffects((int)Projectile.ai[0]) == SoulType.Fright) + modifiers.SourceDamage.Flat += SHPC.FrightFlatDamage; } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); + float screenshake = GetSoulEffects((int)Projectile.ai[0]) == SoulType.Light ? 5f : 3.5f; + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenshake) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenshake; + 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); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); + + for (int i = 0; i < 5; i++) + { + Vector2 soulVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(6f, 9f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, soulVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33f), 0f, Projectile.owner, Main.rand.Next(6)); + } } } + + public override Color? GetAlpha(Color lightColor) => FindColorForSoul((int)Projectile.ai[0]); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } } } diff --git a/Projectiles/Magic/SHPB.png b/Projectiles/Magic/SHPB.png index e0b4f68f54..35c0478ad8 100644 Binary files a/Projectiles/Magic/SHPB.png and b/Projectiles/Magic/SHPB.png differ diff --git a/Projectiles/Magic/SHPExplosion.cs b/Projectiles/Magic/SHPExplosion.cs index 10f9bacce6..7b64dbe4e0 100644 --- a/Projectiles/Magic/SHPExplosion.cs +++ b/Projectiles/Magic/SHPExplosion.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -8,6 +10,8 @@ namespace CalamityMod.Projectiles.Magic { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public const int Lifetime = 20; + public ref float Timer => ref Projectile.ai[2]; public override void SetDefaults() { @@ -18,63 +22,74 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; - Projectile.timeLeft = 60; + Projectile.timeLeft = Lifetime; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - float lights = (float)Main.rand.Next(90, 111) * 0.01f; + float lights = Main.rand.NextFloat(0.9f, 1.1f); lights *= Main.essScale; Lighting.AddLight(Projectile.Center, 5f * lights, 1f * lights, 4f * lights); - float projTimer = 25f; - if (Projectile.ai[0] > 180f) + bool lightSoul = SHPB.GetSoulEffects((int)Projectile.ai[0]) == SHPB.SoulType.Light; + bool nightSoul = SHPB.GetSoulEffects((int)Projectile.ai[0]) == SHPB.SoulType.Night; + + // Increase explosion size with time + int explosionSize = 200 + (int)MathHelper.Clamp(Timer, 0, Lifetime) * (int)Math.Ceiling(15 * (lightSoul ? SHPC.LightExplosionSizeMult : 1f)); + Projectile.ExpandHitboxBy(explosionSize); + + if (Projectile.ai[1] == 0f) { - projTimer -= (Projectile.ai[0] - 180f) / 2f; + Color particleColor = SHPB.FindColorForSoul((int)Projectile.ai[0]); + // Light makes the explosion larger + float sizeScalar = lightSoul ? SHPC.LightExplosionSizeMult : 1f; + + CustomPulse inner = new(Projectile.Center, Vector2.Zero, particleColor, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.4f, 1.5f * sizeScalar, Lifetime); + CustomPulse outer = new(Projectile.Center, Vector2.Zero, particleColor, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0.4f, 2.5f * sizeScalar, Lifetime); + CustomPulse explode = new(Projectile.Center, Vector2.Zero, particleColor, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.026f, 0.26f * sizeScalar, Lifetime); + + GeneralParticleHandler.SpawnParticle(inner); + GeneralParticleHandler.SpawnParticle(outer); + GeneralParticleHandler.SpawnParticle(explode); + + // Night makes the explosion last longer + if (nightSoul) + { + Projectile.timeLeft = (int)(Lifetime * SHPC.NightExplosionTimeMult); + + CustomPulse nightInner = new(Projectile.Center, Vector2.Zero, particleColor, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.4f, 1.5f, (int)(Lifetime * SHPC.NightExplosionTimeMult)); + CustomPulse nightOuter = new(Projectile.Center, Vector2.Zero, particleColor, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0.4f, 2.5f, (int)(Lifetime * SHPC.NightExplosionTimeMult)); + CustomPulse nightExplode = new(Projectile.Center, Vector2.Zero, particleColor, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.026f, 0.26f, (int)(Lifetime * SHPC.NightExplosionTimeMult)); + + GeneralParticleHandler.SpawnParticle(nightInner); + GeneralParticleHandler.SpawnParticle(nightOuter); + GeneralParticleHandler.SpawnParticle(nightExplode); + } + Projectile.ai[1] = 1f; } - if (projTimer <= 0f) + + Timer++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Might launches enemies + if (SHPB.GetSoulEffects((int)Projectile.ai[0]) == SHPB.SoulType.Might && target.CanBeMoved(false)) { - projTimer = 0f; - Projectile.Kill(); - } - projTimer *= 0.7f; - Projectile.ai[0] += 4f; - int timerCounter = 0; - while ((float)timerCounter < projTimer) - { - float rando1 = (float)Main.rand.Next(-40, 41); - float rando2 = (float)Main.rand.Next(-40, 41); - float rando3 = (float)Main.rand.Next(12, 36); - float randoAdjust = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjust = rando3 / randoAdjust; - rando1 *= randoAdjust; - rando2 *= randoAdjust; - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 246; - } - else if (randomDust == 1) - { - randomDust = 73; - } - else - { - randomDust = 187; - } - 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; - Dust expr_149DF_cp_0 = Main.dust[EXPLODE]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[EXPLODE]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[EXPLODE].velocity.X = rando1; - Main.dust[EXPLODE].velocity.Y = rando2; - timerCounter++; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Player owner = Main.player[Projectile.owner]; + Vector2 launchVel = (owner.Calamity().mouseWorld - owner.Center).SafeNormalize(Vector2.UnitY) * SHPC.MightKnockbackStrength - new Vector2(0, 3); + + target.MoveNPC(launchVel, SHPC.MightKnockbackStrength, false); } } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // Fright deals extra flat damage + if (SHPB.GetSoulEffects((int)Projectile.ai[0]) == SHPB.SoulType.Fright) + modifiers.SourceDamage.Flat += SHPC.FrightFlatDamage; + } } } diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index 38f612c3a0..fcc39b155d 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -13,8 +15,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 5; Projectile.height = 5; Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; Projectile.extraUpdates = 3; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Magic; @@ -22,54 +22,21 @@ namespace CalamityMod.Projectiles.Magic 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, 0.5f, 0.2f, 0.5f); float timerIncr = 3f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += timerIncr; - if (Projectile.localAI[0] > 100f) - { - Projectile.localAI[0] = 100f; - } - } - else - { - Projectile.localAI[0] -= timerIncr; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - return; - } - } + Projectile.localAI[0] += timerIncr; + if (Projectile.localAI[0] > 100f) + Projectile.localAI[0] = 100f; } - public override Color? GetAlpha(Color lightColor) => new Color(255, Main.DiscoG, 155, Projectile.alpha); + public override Color? GetAlpha(Color lightColor) => SHPB.FindColorForSoul((int)Projectile.ai[0]); public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); public override void OnKill(int timeLeft) { - int dustAmt = Main.rand.Next(3, 7); - for (int d = 0; d < dustAmt; d++) - { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 246, - 73, - 187 - }); - int idx = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, dustType, 0f, 0f, 100, default, 2.1f); - Main.dust[idx].velocity *= 2f; - Main.dust[idx].noGravity = true; - } + AltLineParticle line = new(Projectile.Center, -Projectile.velocity.RotatedByRandom(MathHelper.Pi / 6f), false, 20, 1f, SHPB.FindColorForSoul((int)Projectile.ai[0])); + GeneralParticleHandler.SpawnParticle(line); } } } diff --git a/Projectiles/Magic/SHPS.cs b/Projectiles/Magic/SHPS.cs new file mode 100644 index 0000000000..13fbc454d3 --- /dev/null +++ b/Projectiles/Magic/SHPS.cs @@ -0,0 +1,95 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SHPS : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float Timer => ref Projectile.ai[1]; + public ref float State => ref Projectile.ai[2]; // 0 = Idle; 1 = Homing to enemy + public const float HomingRange = 560f; + + public NPC Target; + public float RandomAnglingStrength = 0f; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 180; + } + + // Can only deal damage after it starts homing + public override bool? CanDamage() => Timer >= 25f; + + public override void AI() + { + Timer++; + + // Randomly changes the strength of idle turning + if (Timer % 30 == 1f) + RandomAnglingStrength = Main.rand.NextFloat(-0.16f, 0.16f); + + // Determine behavior + if (Timer < 25) // Don't try to home at the start + State = 0f; + else + { + float npcDistCheck = HomingRange; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCheck) + { + npcDistCheck = currentNPCDist; + index = n.whoAmI; + } + } + + if (index == -1) + State = 0f; + else + { + Target = Main.npc[index]; + State = 1f; + } + } + + // Actual behavior + if (State == 0f) + { + Projectile.extraUpdates = 0; + Projectile.velocity = Projectile.velocity.RotatedBy(RandomAnglingStrength); + } + else if (State == 1f) + { + Projectile.extraUpdates = 1; + float speed = Projectile.velocity.Length(); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Target.Center).ToRotation(), 0.15f).ToRotationVector2() * speed; + } + + // Appearance + if (Timer % 1 == 0f) + { + SquareParticle trail = new(Projectile.Center, Vector2.Zero, false, 25, 3f, SHPB.FindColorForSoul((int)Projectile.ai[0])); + GeneralParticleHandler.SpawnParticle(trail); + } + SquareParticle mainSpot = new(Projectile.Center, Vector2.Zero, false, 2, 1.4f, Color.White); + GeneralParticleHandler.SpawnParticle(mainSpot); + } + } +} diff --git a/Projectiles/Magic/Sandstream.cs b/Projectiles/Magic/Sandstream.cs index 3333fb74ac..2b79fe2656 100644 --- a/Projectiles/Magic/Sandstream.cs +++ b/Projectiles/Magic/Sandstream.cs @@ -53,8 +53,18 @@ namespace CalamityMod.Projectiles.Magic dust2.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.5f); dust2.scale = Main.rand.NextFloat(0.3f, 1.3f); Projectile.penetrate = 1; - Projectile.velocity.Y += 0.1f; - Projectile.velocity.X *= 0.97f; + + //Projectile.velocity.Y += 0.1f; + //Projectile.velocity.X *= 0.97f; + + int falloffTime = 13 + 2; + if (Time > falloffTime) + Projectile.velocity.X *= 0.9711f; + if (Projectile.velocity.Y < 15 && Time > falloffTime) + Projectile.velocity.Y += 0.16f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.98f; + Projectile.extraUpdates = 3; } else @@ -86,6 +96,8 @@ namespace CalamityMod.Projectiles.Magic } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (PostHit == false) + Time = 2; PostHit = true; Projectile.timeLeft = 300; float numberOfDusts = 6f; @@ -95,7 +107,7 @@ namespace CalamityMod.Projectiles.Magic float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(Main.rand.NextFloat(0.5f, 1.5f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); Vector2 velOffset = new Vector2(Main.rand.NextFloat(0.5f, 1.5f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); - Dust dust = Dust.NewDustPerfect(target.Center + offset, Main.rand.NextBool(3) ? 288 : 207, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(target.Center + offset, Main.rand.NextBool(3) ? 288 : 121, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = false; dust.velocity = velOffset; dust.scale = Main.rand.NextFloat(0.5f, 0.8f); @@ -113,7 +125,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 velOffset = new Vector2(Main.rand.NextFloat(1.5f, 5.5f), 0).RotatedBy(rot * Main.rand.NextFloat(3.1f, 9.1f)); MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center + offset, velOffset * Main.rand.NextFloat(1.5f, 3f), Color.Peru, Color.PeachPuff, Main.rand.NextFloat(0.9f, 1.2f), 160f, Main.rand.NextFloat(0.03f, -0.03f)); GeneralParticleHandler.SpawnParticle(SandCloud); - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool() ? 288 : 207, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool() ? 288 : 121, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = false; dust.velocity = velOffset; dust.scale = Main.rand.NextFloat(1.2f, 1.6f); diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 33b8185b8d..4926c62ddd 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Magic if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs index 098ba4593b..fb896cbdec 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -16,9 +16,10 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -35,13 +36,15 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + // Play a sound upon spawning if (Projectile.ai[0] == 0f) { SoundEngine.PlaySound(BrimstoneElemental.DartSound, Projectile.Center); Projectile.ai[0] = 1f; } - if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < (Projectile.ai[1] == 1f ? 12f : 16f)) + // Accelerate over time + if ((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 16f) && Projectile.ai[1] != 1f) { Projectile.velocity *= 1.01f; } @@ -57,6 +60,30 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame = 0; } Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); + + // Seething Discharge darts have weak homing capabilities + if (Projectile.ai[1] == 1f && Projectile.timeLeft < 585) + { + float npcDistCompare = 480f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile, false)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCompare) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + if (index != -1) + { + float homingStrength = Main.rand.NextFloat(0.075f, 0.085f); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.npc[index].Center).ToRotation(), homingStrength).ToRotationVector2() * 12f; + } + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); @@ -70,7 +97,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index f43a8400cc..4810a27147 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -30,11 +30,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.penetrate = 4; + Projectile.penetrate = 3; Projectile.timeLeft = 255; Projectile.alpha = 0; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 20; } public override void AI() @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SerpentineBody.cs b/Projectiles/Magic/SerpentineBody.cs index c3586ae240..50d23ed6d7 100644 --- a/Projectiles/Magic/SerpentineBody.cs +++ b/Projectiles/Magic/SerpentineBody.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; - Projectile.ArmorPenetration = 15; } public override void AI() diff --git a/Projectiles/Magic/SerpentineHead.cs b/Projectiles/Magic/SerpentineHead.cs index b49cdfa57a..2e1135b05b 100644 --- a/Projectiles/Magic/SerpentineHead.cs +++ b/Projectiles/Magic/SerpentineHead.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; - Projectile.ArmorPenetration = 15; } public override void AI() diff --git a/Projectiles/Magic/SerpentineTail.cs b/Projectiles/Magic/SerpentineTail.cs index 0d147b0b30..02b8a2c3a0 100644 --- a/Projectiles/Magic/SerpentineTail.cs +++ b/Projectiles/Magic/SerpentineTail.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; - Projectile.ArmorPenetration = 15; } public override void AI() diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs deleted file mode 100644 index 9bf3b72a10..0000000000 --- a/Projectiles/Magic/ShadeNimbus.cs +++ /dev/null @@ -1,92 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ShadeNimbus : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/Boss/ShadeNimbusHostile"; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 6; - } - - public override void SetDefaults() - { - Projectile.width = 54; - Projectile.height = 24; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter > 8) - { - Projectile.frameCounter = 0; - Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - } - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 7200f) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - Projectile.Kill(); - } - } - else - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 8f) - { - Projectile.ai[0] = 0f; - if (Projectile.owner == Main.myPlayer) - { - int rainX = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); - int rainY = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)rainX, (float)rainY, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); - } - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 10f) - { - Projectile.localAI[0] = 0f; - int projCount = 0; - int oldestCloud = 0; - float cloudAge = 0f; - int projType = Projectile.type; - for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) - { - Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[1] < 3600f) - { - projCount++; - if (proj.ai[1] > cloudAge) - { - oldestCloud = projIndex; - cloudAge = proj.ai[1]; - } - } - } - if (projCount > 2) - { - Main.projectile[oldestCloud].netUpdate = true; - Main.projectile[oldestCloud].ai[1] = 36000f; - return; - } - } - } - } -} diff --git a/Projectiles/Magic/ShadeNimbusCloud.cs b/Projectiles/Magic/ShadeNimbusCloud.cs index a94a50d56c..29a58b8da6 100644 --- a/Projectiles/Magic/ShadeNimbusCloud.cs +++ b/Projectiles/Magic/ShadeNimbusCloud.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic // 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]; + Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Type]; // If the projectile is about to die or it collides with a tile, start fading. // Depending on how strong the fade-out speed is, it'll adapt by the amount of time left for it do die. diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index 2284b4a2da..27b15744f2 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -104,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index da5645ebb2..b4dc9c2450 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Projectiles.Magic public class Shaderain : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/Magic/AuraRain"; public override void SetDefaults() { diff --git a/Projectiles/Magic/AuraRain.png b/Projectiles/Magic/Shaderain.png similarity index 100% rename from Projectiles/Magic/AuraRain.png rename to Projectiles/Magic/Shaderain.png diff --git a/Projectiles/Magic/ShadowPlatform.png b/Projectiles/Magic/ShadowPlatform.png new file mode 100644 index 0000000000..1cf9fd563a Binary files /dev/null and b/Projectiles/Magic/ShadowPlatform.png differ diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index 333ed9a895..adb118628d 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -1,7 +1,13 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using rail; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; +using ReLogic.Content; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -9,65 +15,234 @@ namespace CalamityMod.Projectiles.Magic { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - + public int time = 0; + public float platFade = 0; + public float platRot = 0; + public bool spawnPlat = false; + public bool hasSetPlatSpawn = false; + public bool hasReboundOffPlat = false; + public bool reflecting = false; + public int reflectionTimer = 50; + public Vector2 platPosCenter; + public Vector2 platPosWall; + public NPC chosenTarget; + public Vector2 targetCenter; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 30; + Projectile.height = 30; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; - Projectile.penetrate = 6; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 2400; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } - - public override bool OnTileCollide(Vector2 oldVelocity) + public override void AI() { - Projectile.damage = (int)(Projectile.damage * 1.15); - Projectile.penetrate--; - if (Projectile.penetrate <= 0) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + + if (!spawnPlat && !hasReboundOffPlat && targetCenter != Vector2.Zero) + platFade = MathHelper.Lerp(platFade, 1, 0.008f); + if (hasReboundOffPlat) { - Projectile.Kill(); + platFade -= 0.0007f; + } + + BeamMainVisuals(Owner, targetDist); + + if (reflecting) + { + if (reflectionTimer > 15) + platPosCenter += (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * -2.7f * Utils.GetLerpValue(15, 40, reflectionTimer, true); + else + platPosCenter += (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * 9f * Utils.GetLerpValue(10, 0, reflectionTimer, true); + + Projectile.extraUpdates = 0; + Projectile.velocity = Vector2.Zero; + Projectile.Center = platPosWall; + reflectionTimer--; + if (reflectionTimer <= 0) + { + SoundStyle bounce = new("CalamityMod/Sounds/Item/ShadowboltReflect"); + SoundEngine.PlaySound(bounce with { Volume = 0.6f, Pitch = 0f }, platPosWall); + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.velocity = (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * 5; + reflecting = false; + hasReboundOffPlat = true; + time = 10; + Projectile.extraUpdates = 100; + } + } + + if (spawnPlat && hasSetPlatSpawn) + { + chosenTarget = Projectile.Center.ClosestNPCAt(2000); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + if (chosenTarget == null) + targetCenter = Owner.Calamity().mouseWorld; + else + targetCenter = chosenTarget.Center; + + platPosCenter = Projectile.Center + Projectile.velocity * Main.rand.Next(70, 120 + 1); + platRot = (Projectile.Center - platPosCenter).SafeNormalize(Vector2.UnitX).ToRotation(); + platPosWall = platPosCenter + new Vector2(0, 8).RotatedBy(platRot); + spawnPlat = false; + } + if (!spawnPlat && reflecting && targetCenter != Vector2.Zero) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + if (chosenTarget == null) + targetCenter = Owner.Calamity().mouseWorld; + else + targetCenter = chosenTarget.Center; + + platRot = platRot.AngleLerp((targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX).ToRotation(), 0.1f); + platPosWall = platPosCenter + new Vector2(0, -30).RotatedBy(platRot + MathHelper.ToRadians(90f)); + } + if (!spawnPlat && !hasReboundOffPlat && targetCenter != Vector2.Zero) + { + float beamDist = Vector2.Distance(platPosWall, Projectile.Center); + if (beamDist <= 25 && !reflecting) + { + Particle blastRing = new CustomPulse(platPosWall, Vector2.Zero, Color.Purple, "CalamityMod/Particles/SmallBloomRing", Vector2.One, Main.rand.NextFloat(-10, 10), 0.1f, 1.55f, 20, true); + GeneralParticleHandler.SpawnParticle(blastRing); + + SoundStyle wall = new("CalamityMod/Sounds/Item/ShadowboltWallHit"); + SoundEngine.PlaySound(wall with { Volume = 0.5f, Pitch = 0f }, platPosWall); + reflecting = true; + Projectile.extraUpdates = 0; + } + } + + if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn && (Collision.SolidCollision(Projectile.Center, 20, 20) || time > 90)) + { + hasSetPlatSpawn = true; + spawnPlat = true; + } + time++; + } + private void BeamMainVisuals(Player Owner, float targetDist) + { + if (reflecting) + { + for (int i = 0; i < 2; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 267); + chargefull.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.8f); + chargefull.scale = Main.rand.NextFloat(0.35f, 0.8f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Indigo : Color.Purple, 0.7f); + } } else { - if (Projectile.velocity.X != oldVelocity.X) + if (time == 14) { - Projectile.velocity.X = -oldVelocity.X; + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.3f, 0.75f, 12, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.55f, 12, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + for (int i = 0; i < 6; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(0.6f, 2f); + chargefull.scale = Main.rand.NextFloat(0.65f, 0.9f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Indigo : Color.Purple, 0.7f); + } } - if (Projectile.velocity.Y != oldVelocity.Y) + if (targetDist < 1400) { - Projectile.velocity.Y = -oldVelocity.Y; + if (time > 30 && Main.rand.NextBool(15)) + { + Particle spark = new LineParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(-1, 1), false, 50, 1.9f, Color.Lerp(Color.Indigo, Color.Purple, Main.rand.NextFloat(0, 1))); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 22 && time % 3 == 0) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * 0.1f, false, 18, 0.05f * (hasReboundOffPlat ? 1.1f : 0.5f), Color.Lerp(Color.Indigo, Color.Orchid, 0.25f), new Vector2(0.7f, 1f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 30 && Main.rand.NextBool(12)) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 267); + chargefull.velocity = Projectile.velocity * Main.rand.NextFloat(-2, 2); + chargefull.scale = Main.rand.NextFloat(0.95f, 1.4f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Indigo : Color.Purple, 0.7f); + } } } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.25f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= (hasReboundOffPlat ? 2.5f : 1) * damageMult; + + if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn) + { + spawnPlat = true; + hasSetPlatSpawn = true; + } + //if (!hasReboundOffPlat) + //Projectile.extraUpdates = 10; + } + public override bool? CanDamage() => reflecting ? false : null; + public override bool PreDraw(ref Color lightColor) + { + if (targetCenter != Vector2.Zero && platFade > 0) + { + Texture2D pTexture = ModContent.Request("CalamityMod/Projectiles/Magic/ShadowPlatform").Value; + + for (int i = 0; i < 5; i++) + { + Color auraColor = Color.Lerp(Color.Indigo, Color.Purple, Utils.GetLerpValue(0, 5, i)) with { A = 0 } * 0.55f * platFade; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 30f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f + 0.5f); + Main.EntitySpriteDraw(pTexture, platPosCenter - Main.screenPosition + rotationalDrawOffset, null, auraColor, platRot + MathHelper.ToRadians(90f), pTexture.Size() * 0.5f, new Vector2(1, 0.7f), SpriteEffects.None); + } + + for (int i = 0; i < 4; i++) + Main.EntitySpriteDraw(pTexture, platPosCenter - Main.screenPosition, null, Color.Purple with { A = 0 } * platFade, platRot + MathHelper.ToRadians(90f), pTexture.Size() * 0.5f, new Vector2(1, 0.7f), SpriteEffects.None); + Main.EntitySpriteDraw(pTexture, platPosCenter - Main.screenPosition, null, Color.White with { A = 0 } * platFade * 0.6f, platRot + MathHelper.ToRadians(90f), pTexture.Size() * 0.5f, new Vector2(1, 0.7f) * 0.93f, SpriteEffects.None); + } + + if (!reflecting && time >= 22 && !hasReboundOffPlat) + { + Asset tex = ModContent.Request("CalamityMod/Particles/GlowSpark"); + for (int i = 0; i < 5; i++) + { + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15, null, Color.White with { A = 0 } * 0.7f, Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f), tex.Size() * 0.5f, new Vector2(0.4f, 1f) * (i * 0.3f) * 0.05f * (hasReboundOffPlat ? 1.1f : 0.5f), SpriteEffects.None); + } + } + + if (reflecting) + { + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, platPosWall - Main.screenPosition, null, Color.Purple with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.65f * Utils.GetLerpValue(-25, 20, reflectionTimer, true) * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, platPosWall - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.45f * Utils.GetLerpValue(-25, 20, reflectionTimer, true) * randSize, SpriteEffects.None, 0); + } return false; } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 1.15); - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) - { - for (int i = 0; i < 4; i++) - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * ((float)i * 0.25f); - Projectile.alpha = 255; - 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 509fa87d59..f231dfd265 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SlitheringEelProjectile.cs b/Projectiles/Magic/SlitheringEelProjectile.cs index 21beaa4a6d..307379600d 100644 --- a/Projectiles/Magic/SlitheringEelProjectile.cs +++ b/Projectiles/Magic/SlitheringEelProjectile.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -58,9 +58,10 @@ namespace CalamityMod.Projectiles.Magic else Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.1f, 0f, 1f); - if (Projectile.timeLeft % 80f < 35f && Projectile.Distance(Main.MouseWorld) > 70f) + Vector2 mouse = Main.player[Projectile.owner].ClampedMouseWorld(); + if (Projectile.timeLeft % 80f < 35f && Projectile.Distance(mouse) > 70f) { - float angleToTarget = Projectile.AngleTo(Main.MouseWorld); + float angleToTarget = Projectile.AngleTo(mouse); float angleDifference = MathHelper.WrapAngle(angleToTarget - Projectile.velocity.ToRotation()); Projectile.velocity = Projectile.velocity.RotatedBy(angleDifference / 9f); } diff --git a/Projectiles/Magic/SmallSpirit.cs b/Projectiles/Magic/SmallSpirit.cs index ef1d961c19..d220c36ccd 100644 --- a/Projectiles/Magic/SmallSpirit.cs +++ b/Projectiles/Magic/SmallSpirit.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic // Handle frames. Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; float maxOpacity = 1f; @@ -61,12 +61,8 @@ namespace CalamityMod.Projectiles.Magic float flySpeed = 8f; float flyInertia = 54f; - Projectile.hostile = true; - Projectile.friendly = false; if (ProjectileOwner != null && (ProjectileOwner.ModProjectile().CurrentPower > 0.97f || Projectile.timeLeft < 95)) { - Projectile.hostile = false; - radius += 36f; target = ProjectileOwner; diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 85f625591f..f024feb401 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -166,7 +167,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SnowflakeIceStar.cs b/Projectiles/Magic/SnowflakeIceStar.cs index 8c7f685a45..4984b0cd42 100644 --- a/Projectiles/Magic/SnowflakeIceStar.cs +++ b/Projectiles/Magic/SnowflakeIceStar.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -60,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SparklingEmpressHoldout.cs b/Projectiles/Magic/SparklingEmpressHoldout.cs new file mode 100644 index 0000000000..8e544c347a --- /dev/null +++ b/Projectiles/Magic/SparklingEmpressHoldout.cs @@ -0,0 +1,212 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Fishing.SunkenSeaCatches; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +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.Projectiles.Magic +{ + public class SparklingEmpressHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * -3; + public override float MaxOffsetLengthFromArm => 40f; + public override float OffsetXUpwards => 0f; + public override float BaseOffsetY => 0f; + public override float OffsetYDownwards => 0f; + public override float RecoilResolveSpeed => 0.5f; + public override float WeaponTurnSpeed => 0.05f; + + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float completion => ref Projectile.ai[1]; + public Color EffectsColor = Color.Cyan; + public bool hasLetGo = false; + public int time = 0; + public int postFireTimer = 0; + public bool deservesMana = false; + + public float GfbMult = 1; + public int cooldownTime => 20 * (deservesMana ? 2 : 1); + + public override void KillHoldoutLogic() + { + if (HeldItem.type != Owner.ActiveItem().type || Owner.dead) + Projectile.Kill(); + if (Owner.CantUseHoldout() && !hasLetGo) + postFireTimer = cooldownTime; + } + + public override void HoldoutAI() + { + if (Main.zenithWorld) + GfbMult = MathHelper.Clamp((int)(time / 60), 1, 7); + if (!hasLetGo) + { + if (shootingTimer >= (deservesMana && !Main.zenithWorld ? 6 : 3)) + { + if (Owner.CheckMana(HeldItem, (int)(HeldItem.mana * GfbMult), true, false)) + { + Shoot(); + shootingTimer = 0f; + } + else + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + postFireTimer = cooldownTime; + } + } + + shootingTimer++; + + if (time >= 120) + deservesMana = true; + if (time == 120) + { + SoundStyle f = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(f with { Volume = 0.5f, Pitch = 0.95f }, Projectile.Center); + for (int k = 0; k < 14; k++) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.1f, 8.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), vel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(EffectsColor, Color.White, 0.5f) : EffectsColor; + } + } + } + time++; + + if (Main.zenithWorld) + { + if (!hasLetGo) + { + if (time % 60 == 0 && time > 120 && time <= 420) + { + SoundStyle f = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(f with { Volume = 0.5f, Pitch = 0.95f }, Projectile.Center); + } + if (time == 420) + { + SoundStyle warnSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGNukeWarning"); + SoundEngine.PlaySound(warnSound with { Volume = 0.7f, Pitch = 0.8f }, Projectile.Center); + } + // gfb texts + if (time == 1) + CombatText.NewText(Projectile.Hitbox, Color.SkyBlue, CalamityUtils.GetTextValue("Misc.Empress1")); + if (time == 300) + CombatText.NewText(Projectile.Hitbox, Color.DeepSkyBlue, CalamityUtils.GetTextValue("Misc.Empress2")); + if (time == 510) + CombatText.NewText(Projectile.Hitbox, Color.DodgerBlue, CalamityUtils.GetTextValue("Misc.Empress3")); + Owner.velocity += -Projectile.velocity * MathHelper.Lerp(GfbMult, 1, 0.6f) * 0.1f; + } + + if (time >= 540) + { + if (time < 600) + { + if (time % 10 == 0) + { + Particle boom = new CustomPulse(Projectile.Center, -Projectile.velocity * 0.3f, Color.DodgerBlue, "CalamityMod/Particles/BloomRing", new Vector2(1, 1f), 0, 0, 4, 10); + GeneralParticleHandler.SpawnParticle(boom); + SoundStyle f = new("CalamityMod/Sounds/Item/MeldExplosion"); + SoundEngine.PlaySound(f with { Volume = 0.5f, Pitch = 0.95f }, Projectile.Center); + for (int k = 0; k < 18; k++) + { + Projectile explode = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Vector2.One * 5).RotatedByRandom(100), ModContent.ProjectileType(), Projectile.damage * 5, Projectile.knockBack, Projectile.owner, 0, 0); + explode.hostile = true; + explode.extraUpdates = 3; + explode.tileCollide = false; + } + } + if (time % 3 == 0) + CombatText.NewText(Projectile.Hitbox, Color.Cyan, CalamityUtils.GetTextValue("Misc.Empress4")); + } + if (postFireTimer == 0) + postFireTimer = (cooldownTime * 5); + deservesMana = false; + } + } + + if (postFireTimer > 0) + PostFireEffect(); + } + public void PostFireEffect() + { + hasLetGo = true; + + if (deservesMana && postFireTimer % 8 == 0) + { + int manaGained = 24; + Owner.statMana += manaGained; + if (Main.myPlayer == Owner.whoAmI) + Owner.ManaEffect(manaGained); + + if (Owner.statMana > Owner.statManaMax2) + Owner.statMana = Owner.statManaMax2; + + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(GunTipPosition, (-Vector2.UnitY * Main.rand.NextFloat(3f, 5f)).RotatedByRandom(0.6f), "CalamityMod/Particles/HeartParticle", false, 45, Main.rand.NextFloat(0.9f, 1.2f), Color.Lerp(Color.Aqua, Color.DodgerBlue, i * 0.5f), Vector2.One, true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + OffsetLengthFromArm -= 9f; + + SoundStyle s = new("CalamityMod/Sounds/Custom/PistolShrimpBubbleBurst"); + SoundEngine.PlaySound(s with { Volume = 0.35f, Pitch = -postFireTimer * 0.01f, MaxInstances = -1 }, Projectile.Center); + } + if (deservesMana && (postFireTimer + 2) % 8 == 0) + { + Owner.HealPlayer(1); + } + if (postFireTimer == 1) + Projectile.Kill(); + postFireTimer--; + } + public void Shoot() + { + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + Vector2 firingVelocity = (shootDirection * 4); + for (int k = 0; k < (int)(GfbMult); k++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition + firingVelocity * 5, firingVelocity.RotatedByRandom(Main.zenithWorld ? GfbMult * 0.08f : 0), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0); + + for (int k = 0; k < 4; k++) + { + Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), shootVel); + dust2.scale = Main.rand.NextFloat(0.75f, 0.9f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(EffectsColor, Color.White, 0.5f) : EffectsColor; + } + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + 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; + Texture2D shineTex = ModContent.Request("CalamityMod/Particles/FullStar").Value; + + Vector2 vibration = (hasLetGo ? Vector2.Zero : (Main.rand.NextVector2Circular(2, 2) * (time >= 840 && Main.zenithWorld ? 4 : 1))); + + Main.EntitySpriteDraw(texture, drawPosition + vibration, null, Projectile.GetAlpha(lightColor), drawRotation + (MathHelper.ToRadians(45f * (Projectile.spriteDirection))), rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + if (deservesMana && !hasLetGo) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(shineTex, GunTipPosition - Main.screenPosition, null, Color.DodgerBlue with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(45 * (i == 0 ? -1 : 1)), shineTex.Size() * 0.5f, new Vector2(0.9f, 2.5f) * Main.rand.NextFloat(0.7f, 1.1f) * MathHelper.Lerp(GfbMult, 1, 0.6f), SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Projectiles/Magic/SparklingLaser.cs b/Projectiles/Magic/SparklingLaser.cs index 1adfe56d9c..4a6cbb038c 100644 --- a/Projectiles/Magic/SparklingLaser.cs +++ b/Projectiles/Magic/SparklingLaser.cs @@ -1,237 +1,85 @@ -using System; -using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; 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; namespace CalamityMod.Projectiles.Magic { - public class SparklingLaser : BaseLaserbeamProjectile, ILocalizedModType + public class SparklingLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public bool playedSound = false; - public const int ChargeupTime = 50; - - public Player Owner => Main.player[Projectile.owner]; - public override Color LightCastColor => new Color(204, 204, 255); //#CCCCFF - public override float Lifetime => 18000f; - public override float MaxScale => 1f; - public override float MaxLaserLength => 1600f; //100 tiles - public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SparklingLaserBegin", AssetRequestMode.ImmediateLoad).Value; - public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SparklingLaserMid", AssetRequestMode.ImmediateLoad).Value; - public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SparklingLaserEnd", AssetRequestMode.ImmediateLoad).Value; - private const float AimResponsiveness = 0.8f; // Last Prism is 0.92f. Lower makes the laser turn faster. - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 5; - } - + public ref float time => ref Projectile.ai[0]; + public bool isSplit => Projectile.ai[1] == 5; + public ref NPC targeted => ref Main.npc[(int)Projectile.ai[2]]; + public Color mainColor = Color.Cyan; public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 25; + Projectile.height = 25; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.hide = true; - Projectile.timeLeft = 18000; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 20; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.timeLeft = 300; + Projectile.ArmorPenetration = 20; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 3; } - - public override void DetermineScale() + public override void AI() { - Projectile.scale = Time < ChargeupTime ? 0f : MaxScale; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (time == 0) + { + mainColor = Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue; + } + if (targetDist < 1400) + { + float beamSize = (isSplit ? 0.4f : 1f); + Particle beamBody = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 65, Projectile.velocity * 0.05f, "CalamityMod/Particles/Crack", false, (int)(7 * (isSplit ? 2 : 1)), 0.15f * beamSize, mainColor * 0.7f, new Vector2(0.7f, 1.4f), true, true, extraRotation: MathHelper.ToRadians(180), shrinkSpeed: (isSplit ? 0.4f : 1.1f), glowCenterScale: 0.7f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(beamBody); + } + if (isSplit) + { + Projectile.velocity *= 0.98f; + } + else if (Projectile.velocity.Length() < 9) + { + Projectile.velocity *= 1.01f; + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.035f); + } + time++; } - - public override float DetermineLaserLength() + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - return DetermineLaserLength_CollideWithTiles(5); - } - - 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) + if (!isSplit) { - Vector2 rrp = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - UpdateAim(rrp); - Projectile.direction = Main.MouseWorld.X > Owner.Center.X ? 1 : -1; - Projectile.netUpdate = true; - } - - int dir = Projectile.direction; - 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; - } - - if (Time < ChargeupTime) - { - // Crate charge-up dust. - int dustCount = (int)(Time / 20f); - Vector2 spawnPos = Projectile.Center; - for (int k = 0; k < dustCount + 1; k++) + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7; + Projectile splitProj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (shootDirection).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0, 5, target.whoAmI); + splitProj.timeLeft = 120; + splitProj.penetrate = -1; + splitProj.extraUpdates = 2; + for (int k = 0; k < 3; k++) { - 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); - dust.noGravity = true; - } - Time++; - return false; - } + Vector2 shootVel = (shootDirection).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.8f); - // Play a cool sound when fully charged. - if (!playedSound) - { - SoundEngine.PlaySound(SoundID.Item68, Projectile.Center); - playedSound = true; - } - return true; - } - - public override void PostAI() - { - // Determine frames. - Projectile.frameCounter++; - if (Projectile.frameCounter % 5f == 4f) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; - } - - // 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; - - public override bool? CanDamage() => Time >= ChargeupTime; - - // 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 (target.life <= 0 && target.lifeMax > 5 && Projectile.owner == Main.myPlayer) - { - int shardDamage = Projectile.damage / 5; - int shardAmt = Main.rand.Next(2, 4); - for (int s = 0; s < shardAmt; s++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, velocity, ModContent.ProjectileType(), shardDamage, 0f, Projectile.owner); - if (shard.WithinBounds(Main.maxProjectiles)) - Main.projectile[shard].DamageType = DamageClass.Magic; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), shootVel); + dust2.scale = Main.rand.NextFloat(0.9f, 1.15f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Cyan; } } + target.AddBuff(ModContent.BuffType(), (isSplit ? 60 : 120)); + + float minMult = 0.25f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } - - public override bool PreDraw(ref Color lightColor) - { - // This should never happen, but just in case- - if (Projectile.velocity == Vector2.Zero || Time < ChargeupTime) - return false; - - Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - - // Start texture drawing. - // This is a lot more scuffed than other lasers... for some reason I'll try not to think about right now. - Vector2 laserBeginCenter = Projectile.Center - Main.screenPosition + Projectile.velocity * Projectile.scale * 50f; - Main.EntitySpriteDraw(LaserBeginTexture, - laserBeginCenter, - startFrameArea, - beamColor, - Projectile.rotation, - LaserBeginTexture.Size() / 2f, - Projectile.scale, - SpriteEffects.None, - 0); - - // Prepare things for body drawing. - float laserBodyLength = LaserLength; - laserBodyLength -= (startFrameArea.Height / 2 + endFrameArea.Height) * Projectile.scale; - Vector2 centerOnLaser = Projectile.Center - Main.screenPosition; - centerOnLaser += Projectile.velocity * Projectile.scale * 10.5f; - - // Body drawing. - if (laserBodyLength > 0f) - { - float laserOffset = middleFrameArea.Height * Projectile.scale; - float incrementalBodyLength = 0f; - while (incrementalBodyLength + 1f < laserBodyLength) - { - centerOnLaser += Projectile.velocity * laserOffset; - incrementalBodyLength += laserOffset; - Main.EntitySpriteDraw(LaserMiddleTexture, - centerOnLaser, - middleFrameArea, - beamColor, - Projectile.rotation, - LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, - Projectile.scale, - SpriteEffects.None, - 0); - } - } - - // End texture drawing. - if (Math.Abs(LaserLength - DetermineLaserLength()) < 30f) - { - Main.EntitySpriteDraw(LaserEndTexture, - centerOnLaser, - endFrameArea, - beamColor, - Projectile.rotation, - LaserEndTexture.Frame(1, 1, 0, 0).Top(), - Projectile.scale, - SpriteEffects.None, - 0); - } - return false; - } + public override bool? CanHitNPC(NPC target) => (target == targeted && isSplit) ? false : null; } } diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index 71f1e234be..ba7385356e 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -45,8 +45,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; } public override void SetDefaults() @@ -102,7 +103,8 @@ namespace CalamityMod.Projectiles.Magic Vector2 previousVelocity = Projectile.velocity; // If not sufficiently close to the mouse, move towards it. - if (!Projectile.WithinRange(Main.MouseWorld, 80f)) + Vector2 mouse = Owner.ClampedMouseWorld(); + if (!Projectile.WithinRange(mouse, 80f)) MoveTowardsMouse(); // Otherwise slow down to a point. @@ -111,10 +113,7 @@ namespace CalamityMod.Projectiles.Magic // Sync velocity if it changed from what it was before. if (previousVelocity != Projectile.velocity) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); } Projectile.rotation = Projectile.velocity.ToRotation(); @@ -140,11 +139,6 @@ namespace CalamityMod.Projectiles.Magic HoverOffset = Vector2.Zero; } - // Previously, Gruesome Eminence stopped being able to hurt you when fully charged. - // This has been changed so that its threat is everpresent. - Projectile.hostile = Time > 75f; - // Projectile.hostile = !tame && Time > 75f; - // Explode into a burst of spirit dust and gas clouds when a bigger face appears. if (!WasStrongBefore && CurrentPower > LargeMouthPowerLowerBound) { @@ -199,7 +193,7 @@ namespace CalamityMod.Projectiles.Magic // Make inertia become more significant the more power the congregation has, due to growing size. float inertia = MathHelper.Lerp(18f, 40f, CurrentPower); - Vector2 directionToMouseOffset = Projectile.SafeDirectionTo(Main.MouseWorld + HoverOffset); + Vector2 directionToMouseOffset = Projectile.SafeDirectionTo(Owner.ClampedMouseWorld() + HoverOffset); Vector2 directionToOwner = Projectile.SafeDirectionTo(Owner.Center); Vector2 idealVelocity = Vector2.Lerp(directionToMouseOffset, directionToOwner, 0.25f) * MovementSpeed; @@ -273,7 +267,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (CurrentPower > LargeMouthPowerLowerBound) texture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationBig").Value; @@ -304,22 +298,6 @@ namespace CalamityMod.Projectiles.Magic DrawHead(backTexture, 1.04f); } - // Damage scales up over time as it grows. - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - float damageFactor = 0.25f + 0.75f * CurrentPower; - int fullPowerDamage; - if (Main.masterMode) - fullPowerDamage = 540; - else if (Main.expertMode) - fullPowerDamage = 450; - else - fullPowerDamage = 360; - - modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += (int)(damageFactor * fullPowerDamage); - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { for (int i = 0; i < Projectile.oldPos.Length; i++) diff --git a/Projectiles/Magic/Starblast.cs b/Projectiles/Magic/Starblast.cs index f590783b6c..b267683a8d 100644 --- a/Projectiles/Magic/Starblast.cs +++ b/Projectiles/Magic/Starblast.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index 233d5383dd..96822f36ce 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/TacticiansTrumpCardProj.cs b/Projectiles/Magic/TacticiansTrumpCardProj.cs index 8d57cb81ef..a186aa8245 100644 --- a/Projectiles/Magic/TacticiansTrumpCardProj.cs +++ b/Projectiles/Magic/TacticiansTrumpCardProj.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.timeLeft > 295) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/TearsofHeavenProjectile.cs b/Projectiles/Magic/TearsofHeavenProjectile.cs index 55f39a937c..c3c2809d12 100644 --- a/Projectiles/Magic/TearsofHeavenProjectile.cs +++ b/Projectiles/Magic/TearsofHeavenProjectile.cs @@ -11,8 +11,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs index ba7bb2f167..c01869a4b3 100644 --- a/Projectiles/Magic/Teslabeam.cs +++ b/Projectiles/Magic/Teslabeam.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 1; + Main.projFrames[Type] = 1; } public override void SetDefaults() @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Magic public override void SendExtraAI(BinaryWriter writer) { writer.Write(damageMultiplier); - writer.Write(damageShouldDecay); writer.Write(decayGracePeriod); + writer.Write(damageShouldDecay); } public override void ReceiveExtraAI(BinaryReader reader) @@ -191,9 +191,11 @@ namespace CalamityMod.Projectiles.Magic Main.spriteBatch.ExitShaderRegion(); return false; } + // Gently adjusts the aim vector of the laser to point towards the mouse. private void UpdateAim(Vector2 source) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; diff --git a/Projectiles/Magic/ThunderboltOrb.cs b/Projectiles/Magic/ThunderboltOrb.cs new file mode 100644 index 0000000000..d87f7d9bca --- /dev/null +++ b/Projectiles/Magic/ThunderboltOrb.cs @@ -0,0 +1,158 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Magic +{ + public class VolterionOrb : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/VolterionOrbShot") { Volume = 0.6f }; + public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeImpact") { Volume = 0.5f }; + + // Explosion + public static float ExplosionTime = 150f; // Time taken to explode + public static float ExplosionLifetime = 18f; + public static float MaxScale = 7.5f; + + // Lightning + public static float AttackRate = 60f; + public static float AttackRange = 800f; + public static float LightningDamageMult = 0.25f; + + public ref float OrbType => ref Projectile.ai[0]; + public ref float AttackTimer => ref Projectile.ai[1]; + public ref float ExplosionTimer => ref Projectile.ai[2]; + + public Player Owner => Main.player[Projectile.owner]; + + public static Asset Bloom; + public static Asset Explosion; + public override void Load() + { + Bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Explosion = ModContent.Request("CalamityMod/Particles/PlasmaExplosion"); + } + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 5; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 38; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Type]; + + Projectile.velocity *= 0.8f; + Projectile.rotation += 0.01f; + Lighting.AddLight(Projectile.Center, GetColor(OrbType).ToVector3()); + + // Each orb fires at a slightly different timing from the previous + AttackTimer++; + float offset = 9f * OrbType; + if (AttackTimer > AttackRate * 2f) + { + // Explode + if (AttackTimer > ExplosionTime) + { + if (ExplosionTimer == 0f) + SoundEngine.PlaySound(ExplosionSound, Projectile.Center); + + float scaleLevel = PiecewiseAnimation(ExplosionTimer / ExplosionLifetime, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Projectile.scale = MathHelper.Lerp(1f, MaxScale, scaleLevel); + Projectile.Opacity = MathF.Sin(MathHelper.PiOver2 + MathHelper.PiOver2 * ExplosionTimer / ExplosionLifetime); + + if (ExplosionTimer++ > ExplosionLifetime) + Projectile.Kill(); + } + // Builds up dust readying up to explode + else if (AttackTimer > MathHelper.Lerp(AttackRate * 2f, ExplosionTime, 0.8f) || AttackTimer % 3 == 2) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); + Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); + spark.noLight = true; + spark.noGravity = Main.rand.NextBool(); + spark.color = GetColor(OrbType); + } + } + else if (AttackTimer % AttackRate == (AttackRate - offset - 1f)) + { + // Orbs should be extremely slow by the time they fire already but make sure it's not moving to keep the visuals right + Projectile.velocity *= 0f; + + NPC target = Projectile.Center.ClosestNPCAt(AttackRange); + if (target != null) + { + SoundEngine.PlaySound(FireSound, Projectile.Center); + + Vector2 velocity = Projectile.SafeDirectionTo(target.Center) * 16f; + Projectile shot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * LightningDamageMult), Projectile.knockBack * LightningDamageMult, Projectile.owner, OrbType + 1f); + shot.tileCollide = false; + + // Create a lightning bolt-like particle in the direction of the shot and 3 random hue-shifted ones by the side + Particle bolt = new CrackParticle(Projectile.Center, velocity * 0.5f, GetColor(OrbType), Vector2.One, 0, 0, Main.rand.NextFloat(0.8f, 1f), 12); + GeneralParticleHandler.SpawnParticle(bolt); + + for (int i = 1; i < 4; i++) + { + Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, GetColor(4f - OrbType) * 0.6f, Vector2.One, 0, 0, Main.rand.NextFloat(0.5f, 0.6f), 12); + GeneralParticleHandler.SpawnParticle(bolt2); + } + } + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Electrified, 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Electrified, 120); + + public static Color GetColor(float type) => Color.Lerp(new Color(51, 197, 255), new Color(143, 51, 255), 0.2f + 0.15f * type + 0.2f * MathF.Sin(Main.GlobalTimeWrappedHourly * 10f)); + + public override Color? GetAlpha(Color lightColor) => GetColor(OrbType); + + public override bool PreDraw(ref Color lightColor) + { + Vector2 drawPos = Projectile.Center - Main.screenPosition; + Color color = Projectile.GetAlpha(lightColor); + + if (ExplosionTimer > 0f) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D explosionTex = Explosion.Value; + Main.EntitySpriteDraw(explosionTex, drawPos, null, color * Projectile.Opacity, Projectile.rotation, explosionTex.Size() * 0.5f, 0.02f * Projectile.scale, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); + return false; + } + + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D bloomTex = Bloom.Value; + Main.EntitySpriteDraw(bloomTex, drawPos, null, color * 0.5f, 0, bloomTex.Size() * 0.5f, 0.42f, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); + return true; + } + + public override bool? CanDamage() => ExplosionTimer > 0f ? base.CanDamage() : false; + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CircularHitboxCollision(Projectile.Center, 20 * Projectile.scale, targetHitbox); + } +} diff --git a/Projectiles/Magic/ThunderboltShot.cs b/Projectiles/Magic/ThunderboltShot.cs new file mode 100644 index 0000000000..986c67b904 --- /dev/null +++ b/Projectiles/Magic/ThunderboltShot.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VolterionShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + // Due to how far/fast this thing moves, it'd require way too many points for a smooth long trail using oldPos + public List TrailPos = new List(); + public const int TrailLength = 50; + + public ref float OrbType => ref Projectile.ai[0]; + + public override void SetStaticDefaults() => ProjectileID.Sets.DrawScreenCheckFluff[Type] = 5000; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.MaxUpdates = 15; + Projectile.timeLeft = 24 * Projectile.MaxUpdates; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + + if (Projectile.numHits > 0) + { + Projectile.scale -= 0.005f; + Projectile.Opacity -= 0.005f; + if (Projectile.Opacity <= 0f) + Projectile.Kill(); + } + else + { + // Update a bit more frequently than the update count for better point distribution + if (Projectile.FinalExtraUpdate() || Projectile.numUpdates % 3 == 2 || TrailPos == null) + { + // Initialize 15 points immediately + if (TrailPos == null) + { + TrailPos = new List(15); + for (int i = 0; i < 15; ++i) + TrailPos.Add(Projectile.Center); + } + + // Add some random value for the natural lightning look + Vector2 randOffset = (Vector2.UnitY * Main.rand.NextFloat(-24f, 24f)).RotatedBy(Projectile.rotation); + TrailPos.Insert(0, Projectile.Center + randOffset); + + while (TrailPos.Count > TrailLength) + TrailPos.RemoveAt(TrailPos.Count - 1); + } + + // Randomly spawn glowing bolts outwards + if (Main.rand.NextBool(6)) + { + BoltParticle bolt = new BoltParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(36f)), false, 10, 0.3f, TrailColorFunction(0f), Vector2.One, true); + GeneralParticleHandler.SpawnParticle(bolt); + } + + if (Projectile.timeLeft < 50) // Starts exploding and fading by itself if it never hits anything + Decay(); + } + } + + public override bool? CanDamage() => Projectile.numHits == 0 ? null : false; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 60); + if (Projectile.numHits == 0) + Decay(); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.numHits == 0) + Decay(); + return false; + } + + public void Decay() + { + Projectile.numHits++; // Ensure this can only happen once + Projectile.timeLeft = 200; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; + + // Final position update + TrailPos.Insert(0, Projectile.Center); + + while (TrailPos.Count > TrailLength) + TrailPos.RemoveAt(TrailPos.Count - 1); + + bool secondary = OrbType > 0f; + if (Projectile.owner == Main.myPlayer && !secondary) + { + float rotOffset = Main.rand.NextFloat(0f, MathHelper.TwoPi); + for (int i = 0; i < 5; i++) + { + Vector2 velocity = Vector2.UnitX.RotatedBy(rotOffset + MathHelper.TwoPi * 0.2f * (i + Main.rand.NextFloat(-0.4f, 0.4f))) * (Main.rand.NextFloat(40f, 45f)); + Projectile orb = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, i); + orb.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + } + } + + int boltCount = secondary ? 6 : 10; + for (int i = 0; i < boltCount; i++) + { + Color color = OrbType > 0f ? VolterionOrb.GetColor(OrbType - 1f) : (Main.rand.NextBool() ? Color.Cyan : Color.Orchid); + Vector2 velocity = Vector2.UnitX.RotatedBy(MathHelper.TwoPi * 0.2f * (i + Main.rand.NextFloat(-0.4f, 0.4f))) * (Main.rand.NextFloat(12f, 15f)); + BoltParticle bolt = new BoltParticle(Projectile.Center, velocity, false, 18, Main.rand.NextFloat(0.4f, 0.6f), color, new Vector2(0.6f, 1f), true); + GeneralParticleHandler.SpawnParticle(bolt); + } + for (int k = 0; k < 7; k++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 14f)); + Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); + spark.noLight = true; + spark.color = Main.rand.NextBool() ? Color.Cyan : Color.Orchid; + } + } + + internal float TrailWidthFunction(float completionRatio) => Projectile.scale * 15f * Utils.GetLerpValue(0.5f, 0.4f, MathF.Abs(0.5f - completionRatio), true); + internal Color TrailColorFunction(float completionRatio) => OrbType > 0f ? VolterionOrb.GetColor(OrbType - 1f) : Color.Lerp(new Color(51, 197, 255), new Color(143, 51, 255), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 20f)) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + if (TrailPos == null) + return false; + + GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].UseImage1("Images/Misc/Perlin"); + GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].Apply(); + PrimitiveRenderer.RenderTrail(TrailPos, new(TrailWidthFunction, TrailColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"]), TrailLength); + return false; + } + } +} diff --git a/Projectiles/Magic/ThunderstormShot.cs b/Projectiles/Magic/ThunderstormShot.cs deleted file mode 100644 index b5b06e5ebd..0000000000 --- a/Projectiles/Magic/ThunderstormShot.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ThunderstormShot : 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.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 600; - Projectile.MaxUpdates = 30; - } - - public override void AI() - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 9f) - { - for (int i = 0; i < 5; i++) - { - 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, 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; - lightningDust.noLight = true; - } - } - } - - public override void OnKill(int timeLeft) - { - var source = Projectile.GetSource_FromThis(); - SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); - for (int n = 0; n < 5; n++) - { - CalamityUtils.ProjectileRain(source, Projectile.Center, 200f, 100f, 1500f, 1500f, 29f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - Projectile.ExpandHitboxBy(36); - int dustAmt = 36; - for (int j = 0; j < dustAmt; j++) - { - 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, 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; - } - for (int j = 0; j < dustAmt; j++) - { - 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, 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; - } - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - } - } -} diff --git a/Projectiles/Magic/ThunderstormShotSplit.cs b/Projectiles/Magic/ThunderstormShotSplit.cs deleted file mode 100644 index bb8fd4fc86..0000000000 --- a/Projectiles/Magic/ThunderstormShotSplit.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ThunderstormShotSplit : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 600; - Projectile.MaxUpdates = 20; - } - - public override void AI() - { - if (Projectile.timeLeft < 420) - { - Projectile.tileCollide = true; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 6f) - { - for (int i = 0; i < 5; i++) - { - 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, 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; - dust2.noLight = true; - } - } - } - - public override void OnKill(int timeLeft) - { - 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); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int dustAmt = 36; - for (int j = 0; j < dustAmt; j++) - { - 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, 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; - } - for (int j = 0; j < dustAmt; j++) - { - 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, 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; - } - Projectile.Damage(); - } - } -} diff --git a/Projectiles/Magic/TradewindsProjectile.cs b/Projectiles/Magic/TradewindsProjectile.cs index 3963edfbe5..ba0a63c9e0 100644 --- a/Projectiles/Magic/TradewindsProjectile.cs +++ b/Projectiles/Magic/TradewindsProjectile.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index 2e77928b40..3bd8f7fb9c 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -3,11 +3,14 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Particles; +using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Magic { public class UberBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public Color EffectsColor; public override void SetDefaults() { Projectile.width = 10; @@ -40,11 +43,30 @@ namespace CalamityMod.Projectiles.Magic rotationClamp -= -MathHelper.TwoPi; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (Projectile.timeLeft == 26) // Firing effects, we set them on this frame so it comes out of the tip + { + for (int i = 0; i <= 10; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? DustID.HallowSpray : DustID.GemAmethyst, Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.3f, 0.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.4f); + } + for (int i = 0; i <= 2; i++) + { + SquishyLightParticle energy = new(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 0.4f), Main.rand.NextFloat(0.2f, 0.4f), Color.Purple, Main.rand.Next(0, 40 + 1), 0.25f, 2f); + GeneralParticleHandler.SpawnParticle(energy); + } + } } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item96, Projectile.Center); + Particle Star = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.Purple, Color.PeachPuff, Main.rand.NextFloat(0.5f, 0.6f), 30, 0.1f, 3f); + GeneralParticleHandler.SpawnParticle(Star); + Star = new GenericSparkle(Projectile.Center + Projectile.velocity, Vector2.Zero, Color.MediumPurple, Color.LightPink, Main.rand.NextFloat(0.5f, 0.6f), 20, 0.1f, 3f); + GeneralParticleHandler.SpawnParticle(Star); + int randDustAmt = Main.rand.Next(4, 6); for (int i = 0; i < randDustAmt; i++) { diff --git a/Projectiles/Magic/UndinesRetributionSpear.cs b/Projectiles/Magic/UndinesRetributionSpear.cs index 26aa156310..4b973c8524 100644 --- a/Projectiles/Magic/UndinesRetributionSpear.cs +++ b/Projectiles/Magic/UndinesRetributionSpear.cs @@ -13,9 +13,10 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/ValkyrieRayBeam.cs b/Projectiles/Magic/ValkyrieRayBeam.cs index f1ab86759c..d1f2164ad8 100644 --- a/Projectiles/Magic/ValkyrieRayBeam.cs +++ b/Projectiles/Magic/ValkyrieRayBeam.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Magic ProduceBeamDust(beamColor); // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); // A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds. @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Magic if (beamVector == Vector2.Zero || Projectile.velocity != Vector2.Zero) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 439fb9d839..0fa15fb048 100644 --- a/Projectiles/Magic/ValkyrieRayStaff.cs +++ b/Projectiles/Magic/ValkyrieRayStaff.cs @@ -95,6 +95,7 @@ namespace CalamityMod.Projectiles.Magic // Adjusts the aim vector of the staff to point towards the mouse. This is Last Prism code. private void UpdateAim(Vector2 source, float speed) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; diff --git a/Projectiles/Magic/VeeringWindAirWave.cs b/Projectiles/Magic/VeeringWindAirWave.cs index debc0d10d9..654b6a8349 100644 --- a/Projectiles/Magic/VeeringWindAirWave.cs +++ b/Projectiles/Magic/VeeringWindAirWave.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) // Photoviscerator ball drawcode, slightly edited. { - Texture2D lightTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D lightTexture = Terraria.GameContent.TextureAssets.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 c5d52e0493..4716b8c50c 100644 --- a/Projectiles/Magic/VeeringWindFrostWave.cs +++ b/Projectiles/Magic/VeeringWindFrostWave.cs @@ -12,11 +12,12 @@ namespace CalamityMod.Projectiles.Magic public class VeeringWindFrostWave : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "Terraria/Images/Projectile_348"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; } public override void SetDefaults() @@ -47,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) // Photoviscerator ball drawcode, slightly edited. { - Texture2D lightTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D lightTexture = Terraria.GameContent.TextureAssets.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/VeeringWindFrostWave.png b/Projectiles/Magic/VeeringWindFrostWave.png deleted file mode 100644 index 8246150f12..0000000000 Binary files a/Projectiles/Magic/VeeringWindFrostWave.png and /dev/null differ diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/VehemenceBolt.cs similarity index 94% rename from Projectiles/Magic/Vehemence.cs rename to Projectiles/Magic/VehemenceBolt.cs index 1cafa7da21..ea3f439cc1 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/VehemenceBolt.cs @@ -10,15 +10,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class Vehemence : ModProjectile, ILocalizedModType + public class VehemenceBolt : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public ref float Time => ref Projectile.ai[0]; public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/Vehemence.png b/Projectiles/Magic/VehemenceBolt.png similarity index 100% rename from Projectiles/Magic/Vehemence.png rename to Projectiles/Magic/VehemenceBolt.png diff --git a/Projectiles/Magic/VehemenceHoldout.cs b/Projectiles/Magic/VehemenceHoldout.cs index 54063d974c..6fc8bd8129 100644 --- a/Projectiles/Magic/VehemenceHoldout.cs +++ b/Projectiles/Magic/VehemenceHoldout.cs @@ -46,6 +46,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.rotation = Projectile.AngleTo(Main.MouseWorld); Projectile.velocity = Projectile.rotation.ToRotationVector2(); @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic Item heldItem = Owner.ActiveItem(); Vector2 shootVelocity = Projectile.velocity * heldItem.shootSpeed; int damage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), damage, heldItem.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), damage, heldItem.knockBack, Projectile.owner); } private void CreateChargeDust() diff --git a/Projectiles/Magic/VehemenceSkull.cs b/Projectiles/Magic/VehemenceSkull.cs index 514291573a..2a4cf2e042 100644 --- a/Projectiles/Magic/VehemenceSkull.cs +++ b/Projectiles/Magic/VehemenceSkull.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Magic public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.frame >= 4) Projectile.frame = 0; } - else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Projectile.type]) + else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Type]) Projectile.Kill(); // Produce some light. diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 55c7c4f354..4c5d14a937 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -12,41 +13,65 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } - + public int time = 0; + public bool explode = true; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 7; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Magic; } public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45); Lighting.AddLight(Projectile.Center, 0.25f, 0.2f, 0f); - if (Projectile.wet && !Projectile.lavaWet) - { - Projectile.Kill(); - } + + if (Projectile.timeLeft == 1) + explode = false; if (Projectile.localAI[0] == 0f) { SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); Projectile.localAI[0] += 1f; } - for (int i = 0; i < 3; i++) + if (time == 5) { - 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; + for (int i = 0; i < 12; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(0.1f, 1); + chargefull.scale = Main.rand.NextFloat(0.45f, 0.8f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.Coral, 0.7f); + } } + if (targetDist < 1400) + { + if (time > 8 && time % 3 == 0) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 35, 0.8f, Color.Lerp(Color.OrangeRed, Color.Coral, Main.rand.NextFloat(0, 1))); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 6 && time % 2 == 0) + { + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.08f * (i == 0 ? 0.5f : 1), Color.Lerp(Color.Orange, Color.Coral, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -56,16 +81,33 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - if (Projectile.owner == Main.myPlayer) + Player Owner = Main.player[Projectile.owner]; + if (Projectile.owner == Main.myPlayer && explode) { - int explosionDamage = Projectile.damage; + Owner.Calamity().GeneralScreenShakePower = 3.5f; + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 1f, Pitch = -0.5f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item74 with { Volume = 0.7f, Pitch = 1f }, Projectile.Center); + for (int i = 0; i < 6; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Coral, Utils.GetLerpValue(-2, 6, i, true)), i == 5 ? "CalamityMod/Particles/FlameExplosion" : "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.1f + 0.03f * i, (int)(30 - i * 1.3f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 3f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 1.5f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + int explosionDamage = Projectile.damage / 4; float explosionKB = 6f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, explosionKB, Projectile.owner); - int cinderDamage = (int)(Projectile.damage * 0.20); + int cinderDamage = (int)(Projectile.damage * 0.02); float cinderKB = 0f; - Vector2 cinderPos = Projectile.oldPosition + 0.5f * Projectile.Size; - int numCinders = Main.rand.Next(7, 10); + Vector2 cinderPos = Projectile.Center; + int numCinders = 10; for (int i = 0; i < numCinders; i++) { Vector2 cinderVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); @@ -75,15 +117,24 @@ namespace CalamityMod.Projectiles.Magic } cinderVel.Normalize(); cinderVel *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), cinderPos, cinderVel, ModContent.ProjectileType(), cinderDamage, cinderKB, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), cinderPos, cinderVel + new Vector2(0, -3), ModContent.ProjectileType(), cinderDamage, cinderKB, Projectile.owner); + } + + for (int i = 0; i < 20; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 2f); + chargefull.scale = Main.rand.NextFloat(0.65f, 1.25f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.Coral, 0.7f); } } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1); + return true; } } } diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index 199f6ca856..6fdb7c87b8 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -14,65 +14,34 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - Projectile.width = 250; - Projectile.height = 250; + Projectile.width = 400; + Projectile.height = 400; Projectile.friendly = true; Projectile.ignoreWater = false; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 120; + Projectile.timeLeft = 2; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 17; + Projectile.localNPCHitCooldown = -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); - if (Projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - Projectile.localAI[0] += 1f; - } - 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; - while ((float)timerCounter < projTimer) - { - float rando1 = (float)Main.rand.Next(-30, 31); - float rando2 = (float)Main.rand.Next(-30, 31); - float rando3 = (float)Main.rand.Next(9, 27); - float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjuster = rando3 / randoAdjuster; - rando1 *= randoAdjuster; - rando2 *= randoAdjuster; - 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; - 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; - timerCounter++; - } - return; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Daybreak, 300); } + 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.width * 0.5f * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index a30274e76a..6d87b5c89c 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -23,10 +23,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 14; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 3; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 120; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } public override void AI() @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Magic if (!initialized) { initialized = true; - Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); } Projectile.frameCounter++; if (Projectile.frameCounter > 4) @@ -54,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -105,7 +106,7 @@ namespace CalamityMod.Projectiles.Magic } //Dust - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(6)) { int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[venusDust]; @@ -114,16 +115,18 @@ namespace CalamityMod.Projectiles.Magic dust.scale += (float)Main.rand.Next(50) * 0.01f; dust.noGravity = true; dust.velocity.Y -= 2f; + dust.velocity += Projectile.velocity * 0.5f; } - if (Main.rand.NextBool(10)) + if (Main.rand.NextBool(14)) { - int venusDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1f); + int venusDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 278, 0f, 0f, 0, default, Main.rand.NextFloat(0.3f, 0.5f)); Dust dust2 = Main.dust[venusDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; - dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; dust2.noGravity = true; dust2.velocity *= 0.1f; + dust2.velocity += Projectile.velocity * 0.5f; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.Coral, 0.7f); } } @@ -140,7 +143,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index 6352e6ca85..b0194dba22 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Magic if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Magic/VitriolicViperFang.cs b/Projectiles/Magic/VitriolicViperFang.cs index 692d1cc032..74432eebd5 100644 --- a/Projectiles/Magic/VitriolicViperFang.cs +++ b/Projectiles/Magic/VitriolicViperFang.cs @@ -1,6 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,56 +15,61 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } - public override void SetDefaults() { Projectile.width = 16; Projectile.height = 34; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 4; - Projectile.timeLeft = 300; + Projectile.penetrate = 3; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 90; + Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; } public override void AI() { + Projectile.velocity *= 0.96f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.penetrate == 0) + Projectile.alpha = (int)(255 * Utils.GetLerpValue(70, 0, Projectile.timeLeft, true)); + if (Main.rand.NextBool(3) && Projectile.timeLeft <= 70) { - Projectile.alpha += 4; - if (Projectile.alpha >= 255) - { - Projectile.Kill(); - } + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), Main.rand.NextBool(6) ? 215 : (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f) * Utils.GetLerpValue(255, 0, Projectile.alpha); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); } } public override void OnKill(int timeLeft) { - for (int i = 0; i < 10; i++) - { - Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, (int)CalamityDusts.SulphurousSeaAcid); - dust.noGravity = true; - } + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; + Asset tex = ModContent.Request(Texture); + + for (int i = 0; i < 3; i++) + { + Color auraColor = Color.Lerp(Color.Chartreuse, Color.Lime, Utils.GetLerpValue(0, 3, i)) * 0.5f; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 27f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 15f) * 0.5f + 0.5f); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor with { A = 0 } * Utils.GetLerpValue(255, 0, Projectile.alpha), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.5f, 2); + return 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); - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 35, targetHitbox); } } diff --git a/Projectiles/Magic/VitriolicViperHoldout.cs b/Projectiles/Magic/VitriolicViperHoldout.cs new file mode 100644 index 0000000000..e969041603 --- /dev/null +++ b/Projectiles/Magic/VitriolicViperHoldout.cs @@ -0,0 +1,237 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +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.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + internal class VitriolicViperHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 40f; + public override float BaseOffsetY => 0f; + public override float RecoilResolveSpeed => 0.4f; + public override string Texture => "CalamityMod/Items/Weapons/Magic/VitriolicViper"; + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * -20; + + private ref float CurrentChargingFrames => ref Projectile.ai[0]; + private ref float CurrentOverchargeFrames => ref Projectile.ai[2]; + public int FirstChargeFrames = 30; + public int FullyChargedFrames = 30; + private bool FirstCharge => CurrentChargingFrames >= FirstChargeFrames; + private bool FullCharge => CurrentOverchargeFrames >= FullyChargedFrames; + public SlotId ChargeSlot; + public static float BulletSpeed = 15f; + public int time = 0; + public float chargePower = 0; + public float overchargePower = 0; + public Color bColor = Color.Chartreuse; // Base color + + public float vortexRotation = 0; + + public override void KillHoldoutLogic() + { + if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; + + chargePower = Utils.GetLerpValue(0, FirstChargeFrames, CurrentChargingFrames, true) * (FullCharge ? 1.3f : 1); + if (CurrentOverchargeFrames < FullyChargedFrames) + overchargePower = MathHelper.Clamp(Utils.GetLerpValue(FullyChargedFrames * 2, 0, CurrentOverchargeFrames, true), 0.5f, 1); + else + overchargePower = MathHelper.Lerp(overchargePower, 1, 0.09f); + + vortexRotation += 0.4f * chargePower; + + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if (Owner.CantUseHoldout()) + { + KeepRefreshingLifetime = false; + + if (Projectile.ai[1] != 1f) + { + Projectile.timeLeft = 30; + + ChargeSound?.Stop(); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; + if (FullCharge) + { + OffsetLengthFromArm -= 25; + SoundStyle fire = new("CalamityMod/Sounds/Item/ViperSpit"); + SoundEngine.PlaySound(fire with { Pitch = -0.3f + Main.rand.NextFloat(-0.1f, 0.1f) + (FirstCharge ? 0.2f : 0) }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(fire2 with { Pitch = -0.3f, Volume = 0.5f }, Projectile.Center); + + // Vipers can apparently have 33 teeth or something like that + Owner.Calamity().GeneralScreenShakePower = 4f; + for (int i = 0; i < 33; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (shootVelocity * 2).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), Projectile.damage / 10, Projectile.knockBack, Projectile.owner, 0); + } + + Particle pulse = new CustomPulse(GunTipPosition, Vector2.Zero, bColor, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.05f, 14); + GeneralParticleHandler.SpawnParticle(pulse); + + for (int i = 0; i < 17; i++) + { + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(5, 25); + chargefull.scale = Main.rand.NextFloat(0.45f, 0.75f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : bColor, 0.7f); + } + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + for (int i = 0; i <= 18; i++) + { + Vector2 sparkVelocity = shootVelocity / 2f; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(GunTipPosition, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); + Particle spark2 = new LineParticle(GunTipPosition, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + else + { + OffsetLengthFromArm -= 15; + SoundStyle fire = new("CalamityMod/Sounds/Item/ViperSpit"); + SoundEngine.PlaySound(fire with { Pitch = (chargePower * 0.3f) + Main.rand.NextFloat(-0.1f, 0.1f), Volume = 0.5f }, Projectile.Center); + + Projectile hiss = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * MathHelper.Clamp(chargePower, 0.3f, 1), ModContent.ProjectileType(), (int)(Projectile.damage * MathHelper.Clamp(chargePower, 0.3f, 1)), Projectile.knockBack, Projectile.owner, 0, 0, chargePower); + hiss.extraUpdates = (int)(Utils.Remap(chargePower, 0, 1, 2, 13, true)); + for (int i = 0; i < 17; i++) + { + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(5, 25); + chargefull.scale = Main.rand.NextFloat(0.55f, 0.75f) * chargePower + 0.1f; + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : bColor, 0.7f); + } + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f * chargePower, bColor, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + } + Projectile.ai[1] = 1f; + } + } + else + { + if (Projectile.ai[1] != 1f) + { + if (!FirstCharge) + CurrentChargingFrames++; + else + CurrentOverchargeFrames++; + } + + // Charge-up visuals + if (CurrentChargingFrames >= 10) + { + if (FirstCharge) + { + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = GunTipPosition + (i * MathHelper.Pi + vortexRotation * 0.35f + MathHelper.PiOver2).ToRotationVector2() * 20f * chargePower * overchargePower; + Dust dust = Dust.NewDustPerfect(dustPos, (int)CalamityDusts.SulphurousSeaAcid, (i * MathHelper.Pi + vortexRotation * 0.35f * Math.Sign(Projectile.velocity.Length())).ToRotationVector2() * 4); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 0.9f); + } + } + else + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, (int)CalamityDusts.SulphurousSeaAcid, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f) * chargePower * overchargePower); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.6f, 0.7f); + } + } + + // Full charge effects + if (CurrentChargingFrames == FirstChargeFrames && CurrentOverchargeFrames == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/NuclearTerrorHit"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); + for (int i = 0; i < 18; i++) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1, 5); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + dustVel, 278, dustVel * 0.7f); + dust2.scale = Main.rand.NextFloat(0.45f, 0.9f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? bColor : Color.Green, 0.7f); + } + } + if (CurrentOverchargeFrames == FullyChargedFrames) + { + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/NuclearTerrorHit"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0.2f }, Projectile.Center); + for (int i = 0; i < 12; i++) + { + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(2f, 5.5f)); + dust2.scale = Main.rand.NextFloat(0.75f, 1.1f); + dust2.noGravity = false; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : bColor, 0.7f); + } + } + } + if (Projectile.ai[1] == 1f) + { + CurrentChargingFrames = 0; + CurrentOverchargeFrames = 0; + } + + Lighting.AddLight(GunTipPosition, bColor.ToVector3() * 1.5f * chargePower); + + time++; + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + 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; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleVortex").Value; + + // Glow Orb + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.Chartreuse with { A = 0 } * 0.4f, vortexRotation * (i * 0.3f), rechargeTexture.Size() * 0.5f, (0.5f * 0.14f + i * 0.015f) * chargePower * overchargePower, SpriteEffects.None, 0); + + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.White with { A = 0 } * chargePower, vortexRotation, rechargeTexture.Size() * 0.5f, 0.25f * chargePower * 0.14f * overchargePower, SpriteEffects.None, 0); + + // Main staff + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation + (MathHelper.ToRadians(45f * (Projectile.spriteDirection))), rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + return false; + } + } +} diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index 5006073273..c1f057a06d 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -1,6 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -9,37 +14,75 @@ namespace CalamityMod.Projectiles.Magic public class VitriolicViperSpit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public int direction = 0; public override void SetDefaults() { Projectile.width = 16; Projectile.height = 26; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 13; + Projectile.usesLocalNPCImmunity = true; + Projectile.timeLeft = 300 * Projectile.MaxUpdates; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - } - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 14; i++) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 4.5f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f); + + if (time == 0) { - Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, DustID.Shadowflame); - dust.noGravity = true; + direction = Main.rand.NextBool() ? 1 : -1; } - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 60); - } + if (time > 3) + Projectile.Center += offset * direction; - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 60); + if (time > 3 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.3f, false, (int)(15 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)), 0.07f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), Color.Chartreuse, new Vector2(1, 0.7f), false, true); + GeneralParticleHandler.SpawnParticle(spark); + + if (Main.rand.NextBool((int)(MathHelper.Clamp((1 - Projectile.ai[2]) * 5, 1, 15)))) + { + int area = (int)(25 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(area, area), (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.velocity = Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.7f); + } + } + time++; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 230); + + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/NuclearTerrorHit"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = 0.7f }, Projectile.Center); + + for (int i = 0; i < (MathHelper.Clamp(6 - Projectile.numHits * 2, 1, 10)); i++) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(target.Center, Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 1), Main.rand.NextBool() ? Color.Chartreuse : Color.GreenYellow, new Vector2(1f, 1), 0, Main.rand.NextFloat(0.28f, 0.44f) * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f), 0f, 50); + GeneralParticleHandler.SpawnParticle(pulse); + } + + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.9f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 60 * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), targetHitbox); } } diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs index 028a3a5681..79df19ea9c 100644 --- a/Projectiles/Magic/VividBeam.cs +++ b/Projectiles/Magic/VividBeam.cs @@ -125,15 +125,11 @@ namespace CalamityMod.Projectiles.Magic break; case 2f: - float spread = 30f * 0.01f * MathHelper.PiOver2; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(source, Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(source, Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - offset).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } break; } diff --git a/Projectiles/Magic/VividBolt.cs b/Projectiles/Magic/VividBolt.cs index 0d9ec716f5..7ed8a2f07d 100644 --- a/Projectiles/Magic/VividBolt.cs +++ b/Projectiles/Magic/VividBolt.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; diff --git a/Projectiles/Magic/VividExplosion.cs b/Projectiles/Magic/VividExplosion.cs index 141dd92601..2ab46185d6 100644 --- a/Projectiles/Magic/VividExplosion.cs +++ b/Projectiles/Magic/VividExplosion.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; + Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs index 8b7fbb544b..72b1a5329b 100644 --- a/Projectiles/Magic/VividLaser2.cs +++ b/Projectiles/Magic/VividLaser2.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index e855c2f25c..c0a5cfbf3f 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -23,9 +23,9 @@ namespace CalamityMod.Projectiles.Magic 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; + Main.projFrames[Type] = 5; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -191,13 +191,13 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 * (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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.3f, 1, texture2D13); return false; } diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index 075df64777..8a061d7cf4 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -1,6 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,36 +13,38 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; private static int Lifetime = 240; private static int NumAnimationFrames = 6; - private static int AnimationFrameTime = 2; + private static int AnimationFrameTime = 1; + public bool explode = true; + public int time = 0; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = NumAnimationFrames; + Main.projFrames[Type] = NumAnimationFrames; } public override void SetDefaults() { - Projectile.width = 26; - Projectile.height = 26; + // Actual hitbox is different + Projectile.width = 1; + Projectile.height = 1; Projectile.DamageType = DamageClass.Magic; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 6; Projectile.timeLeft = Lifetime; - Projectile.alpha = 48; } public override void AI() { - // Draw offsets - DrawOffsetX = -10; - DrawOriginOffsetY = -10; - DrawOriginOffsetX = 0; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - // Play sound and set rotation on frame 1 + if (Projectile.timeLeft == 1) // if it doesnt hit a tile or enemy, then don't explode + explode = false; + + // Set rotation on frame 1 if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.NPCDeath56, Projectile.Center); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; } @@ -51,7 +54,6 @@ namespace CalamityMod.Projectiles.Magic // Lighting and spin Lighting.AddLight(Projectile.Center, 1.8f, 1.6f, 0.5f); - Projectile.rotation += 0.11f; // Increment frame counter Projectile.localAI[0] += 1f; @@ -65,31 +67,35 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.frame >= NumAnimationFrames) Projectile.frame = 0; + if (targetDist < 1400) + { + if (time > 8 && time % 2 == 0) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 35, 0.9f, Color.Lerp(Color.Orange, Color.OrangeRed, Main.rand.NextFloat(0, 1))); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 6 && time % 2 == 0) + { + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.13f * (i == 0 ? 0.5f : 1), Color.Lerp(Color.Red, Color.OrangeRed, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + time++; } - private void SpawnDust() { - int coreDustCount = 2; //3 - int coreDustType = 262; - for (int i = 0; i < coreDustCount; ++i) + int trailDustCount = 3; + int trailDustType = 303; + for (int i = 0; i < trailDustCount; i++) { - float scale = Main.rand.NextFloat(1.0f, 1.4f); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, coreDustType); - Main.dust[idx].velocity *= 0.7f; - Main.dust[idx].velocity += Projectile.velocity * 1.4f; - Main.dust[idx].scale = scale; - Main.dust[idx].noGravity = true; - } - - int trailDustCount = 4; //5 - int trailDustType = 264; - for (int i = 0; i < trailDustCount; ++i) - { - float scale = Main.rand.NextFloat(1.0f, 1.4f); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, trailDustType, 0f, 0f); - Main.dust[idx].velocity = Projectile.velocity * 0.8f; - Main.dust[idx].scale = scale; - Main.dust[idx].noGravity = true; + float scale = Main.rand.NextFloat(0.7f, 1.1f); + Dust b = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(25, 25), trailDustType, Vector2.Zero, 120); + b.velocity = -Projectile.velocity * Main.rand.NextFloat(0.4f, 0.8f); + b.scale = scale; + b.noGravity = true; } } @@ -112,7 +118,32 @@ namespace CalamityMod.Projectiles.Magic int type = ModContent.ProjectileType(); int damage = (int)(HeliumFlash.ExplosionDamageMultiplier * Projectile.damage); float kb = 9.5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, type, damage, kb, Projectile.owner, 0f, 0f); + if (explode) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, type, damage, kb, Projectile.owner, 0f, 0f); + } } + public override bool PreDraw(ref Color lightColor) + { + Texture2D orbTexture = ModContent.Request("CalamityMod/Projectiles/Magic/VolatileStarcore").Value; + Rectangle frame = orbTexture.Frame(1, NumAnimationFrames, 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + // Glow Orb + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, Color.OrangeRed with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.6f * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * 0.75f, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.35f * randSize, SpriteEffects.None, 0); + + + + // Starcore + Main.EntitySpriteDraw(orbTexture, Projectile.Center - Main.screenPosition, frame, Color.White, 0, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 40, targetHitbox); } } diff --git a/Projectiles/Magic/VolterionHoldout.cs b/Projectiles/Magic/VolterionHoldout.cs new file mode 100644 index 0000000000..9fae60413e --- /dev/null +++ b/Projectiles/Magic/VolterionHoldout.cs @@ -0,0 +1,161 @@ +using CalamityMod.Items.Weapons.Magic; +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; + +namespace CalamityMod.Projectiles.Magic +{ + public class VolterionHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public int Time = 0; + public override float MaxOffsetLengthFromArm => 64f; + public override float BaseOffsetY => -16f; + public override float OffsetXUpwards => -16f; + public override float OffsetXDownwards => 12f; + public override float OffsetYUpwards => 6f; + public override float OffsetYDownwards => 20f; + public override Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.3f; + public override string Texture => "CalamityMod/Projectiles/Magic/VolterionHoldout"; + + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/VolterionFire") { Volume = 0.35f }; + + public ref float FlashTimer => ref Projectile.ai[0]; + + public static Asset MuzzleFlash; + public override void Load() => MuzzleFlash = ModContent.Request("CalamityMod/Projectiles/Magic/VolterionHoldoutFlash"); + + public override void SetStaticDefaults() => Main.projFrames[Type] = 15; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void KillHoldoutLogic() + { + // Only times out if at the final frame (post-firing resting time) + bool noMana = !Owner.CheckMana(Owner.ActiveItem()) && Projectile.frame == 14; + if (HeldItem.type != Owner.ActiveItem().type || noMana) + { + Projectile.Kill(); + Projectile.netUpdate = true; + } + } + + public override void HoldoutAI() + { + Time++; + + // Update damage based on curent magic damage stat (so Mana Sickness affects it) + Projectile.damage = HeldItem is null ? 0 : Owner.GetWeaponDamage(HeldItem); + + // Update muzzle flash time and frames (4 animation frames ran over 8 frames) + if (FlashTimer > 0f) + FlashTimer -= 0.5f; + + // Time between firing (as the player continues to hold) + if (Projectile.frame == 14) + { + Projectile.frameCounter++; + + // Subtract a flat 42 from the use time because the firing animation consists of 14 frames at 20 FPS + if (Projectile.frameCounter >= MathHelper.Clamp(Owner.ActiveItem().useAnimation - 42, 0f, Owner.ActiveItem().useAnimation)) + { + if (Owner.CantUseHoldout()) + Projectile.Kill(); + + Projectile.frame = 0; + Projectile.frameCounter = 0; + } + } + // Firing -- this is the initial state the spawned projectile starts in + else if (Projectile.frame == 0) + { + // Does not fire on frame one due to position updating fuckery + if (Projectile.frameCounter != 1) + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + return; + } + + Projectile.frameCounter++; + if (Owner.CheckMana(Owner.ActiveItem(), -1, true)) + { + FlashTimer = 4f; + SoundEngine.PlaySound(FireSound, GunTipPosition); + + // Start from slightly behind the tip + Vector2 offsetPos = GunTipPosition - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 18f; + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * HeldItem.shootSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), offsetPos, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + + for (int i = 0; i < 8; i++) + { + float scale = Main.rand.NextFloat(0.6f, 1.25f); + Vector2 randVelocity = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(8f, 12f); + Particle point = new PointParticle(offsetPos, randVelocity, false, 15, scale, new Color(51, 197, 255)); + GeneralParticleHandler.SpawnParticle(point); + } + } + } + // The firing animation + else if (Projectile.frame > 0) + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + } + } + + // Muzzle flash can deal damage + public override bool? CanDamage() => FlashTimer > 0f; + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(GunTipPosition + Vector2.UnitX.RotatedBy(Projectile.rotation) * MuzzleFlash.Width() * 0.4f, 64f, targetHitbox); + + public override bool PreDraw(ref Color lightColor) + { + if (Time < 2) + { + return false; + } + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float scale = Projectile.scale * Owner.gravDir; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), drawRotation, frame.Size() * 0.5f, scale, flipSprite); + + if (FlashTimer > 0f) + { + Texture2D flashTex = MuzzleFlash.Value; + Vector2 flashPos = GunTipPosition + Vector2.UnitX.RotatedBy(Projectile.rotation) * MuzzleFlash.Width() * 0.5f - Main.screenPosition; + Rectangle flashFrame = flashTex.Frame(verticalFrames: 4, frameY: (int)(4f - FlashTimer)); + Main.EntitySpriteDraw(flashTex, flashPos, flashFrame, Color.White, drawRotation, flashFrame.Size() * 0.5f, scale, flipSprite); + } + return false; + } + } +} diff --git a/Projectiles/Magic/VolterionHoldout.png b/Projectiles/Magic/VolterionHoldout.png new file mode 100644 index 0000000000..ade1fd2fec Binary files /dev/null and b/Projectiles/Magic/VolterionHoldout.png differ diff --git a/Projectiles/Magic/VolterionHoldoutFlash.png b/Projectiles/Magic/VolterionHoldoutFlash.png new file mode 100644 index 0000000000..a9b2d9d697 Binary files /dev/null and b/Projectiles/Magic/VolterionHoldoutFlash.png differ diff --git a/Projectiles/Magic/VolterionOrb.png b/Projectiles/Magic/VolterionOrb.png new file mode 100644 index 0000000000..9c0162b0ca Binary files /dev/null and b/Projectiles/Magic/VolterionOrb.png differ diff --git a/Projectiles/Magic/VortexElementalBeam.cs b/Projectiles/Magic/VortexElementalBeam.cs index 588e6a436f..d1ee143217 100644 --- a/Projectiles/Magic/VortexElementalBeam.cs +++ b/Projectiles/Magic/VortexElementalBeam.cs @@ -23,9 +23,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 30; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 30; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Magic #region Drawing public override bool PreDraw(ref Color lightColor) { - Texture2D lightningSegmentTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D lightningSegmentTexture = Terraria.GameContent.TextureAssets.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 6345b2e1f5..cc1d8ddeb6 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -70,8 +70,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; @@ -85,8 +85,8 @@ namespace CalamityMod.Projectiles.Magic public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Magic/WaywasherProj.cs b/Projectiles/Magic/WaywasherProj.cs index 83e2a7f9b6..cec445d21b 100644 --- a/Projectiles/Magic/WaywasherProj.cs +++ b/Projectiles/Magic/WaywasherProj.cs @@ -1,64 +1,139 @@ -using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class WaywasherProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float time => ref Projectile.ai[0]; + public int dir = 0; + public bool returning = false; public override void SetDefaults() { - Projectile.width = 16; - Projectile.height = 16; + Projectile.width = 55; + Projectile.height = 55; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.alpha = 0; - Projectile.penetrate = 2; - Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 225; Projectile.DamageType = DamageClass.Magic; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 2; } - public override void AI() { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f * (float)Projectile.direction; - Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); - for (int i = 0; i < 2; i++) + if (time == 0) + dir = (int)Projectile.ai[1]; + if (time == 4) { - 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, DustID.Water, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); - Dust dust = Main.dust[waterDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortXVel; - dust.position.Y -= shortYVel; + Particle fadeInfx = new CustomSpark(Projectile.Center, Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 13, 0.75f, Color.White, new Vector2(1, 1f), true, false, shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(fadeInfx); + for (int i = 0; i < 3; i++) + { + Particle fadeInfx2 = new CustomSpark(Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f), "CalamityMod/Particles/WaterFoam", true, 13, 0.45f, Color.DeepSkyBlue, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(fadeInfx2); + } + } + Lighting.AddLight(Projectile.Center, Color.RoyalBlue.ToVector3() * 0.7f); + + // Slows down and decays if it's inside tiles + if (Collision.SolidCollision(Projectile.Center, 20, 20)) + { + Projectile.velocity *= 0.95f; + Projectile.timeLeft = (int)(Projectile.timeLeft * 0.9f); + } + + // I hate this but it's the only way to make it move in the very specific way it needs to + int timeValue = (int)(time / 12); + float turnMult = timeValue switch + { + 0 => 0.05f, + 1 => 0.1f, + 2 => 0.2f, + 3 => -0.2f, + 4 => -0.3f, + 5 => -0.4f, + 6 => -0.6f, + 7 => -0.9f, + 8 => -1.13f, + _ => -1.7f, + }; + if (timeValue == 9) + { + returning = true; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.numHits = 0; + } + Projectile.velocity = Projectile.velocity.RotatedBy(0.2f * turnMult * dir); + + // Making things look convincingly "watery" takes a lot of visual work... + Visuals(); + + time += returning ? -1 : 1; + } + public void Visuals() + { + if (Main.rand.NextBool()) + { + // If you're looking at this to use the water effects, this is the main one I recommend you take + Particle waterfx = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.7f, "CalamityMod/Particles/WaterFoam", false, 9, 0.45f, Color.DeepSkyBlue, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1), shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(waterfx); + } + + Particle projBody = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25, -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 6, 0.3f, Color.RoyalBlue, new Vector2(1, 1f), true, false, shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(projBody); + + Vector2 tip = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 35; + Particle seafoam = new CustomSpark(tip, Projectile.velocity * Main.rand.NextFloat(0.7f, 0.9f), "CalamityMod/Particles/BloomCircle", false, 2, Main.rand.NextFloat(0.35f, 0.45f), Color.White, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-0.4f, 0.4f)); + GeneralParticleHandler.SpawnParticle(seafoam); + if (Main.rand.NextBool(10)) + { + for (int i = 0; i < 2; i++) + { + Particle smallSeafoam = new CustomSpark(tip, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 1.4f), "CalamityMod/Particles/BloomCircle", true, 15, Main.rand.NextFloat(0.12f, 0.18f), Color.White * 0.7f, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1)); + GeneralParticleHandler.SpawnParticle(smallSeafoam); + + Dust dust = Dust.NewDustPerfect(tip + Main.rand.NextVector2Circular(8, 8), ModContent.DustType(), -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 1.4f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 0.8f); + dust.color = Color.White; + dust.noLightEmittence = true; + } } 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, 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; - } - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411); + bubble.timeLeft = 12 + Main.rand.Next(8); + bubble.scale = Main.rand.NextFloat(0.5f, 0.9f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; } } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 120); + float minMult = 0.1f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - for (int k = 0; k < 10; k++) + Particle fadeOutfx = new CustomSpark(Projectile.Center, Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 13, 0.75f, Color.White, new Vector2(1, 1f), true, false, shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(fadeOutfx); + for (int i = 0; i < 3; i++) { - 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); + Particle fadeOutfx2 = new CustomSpark(Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f), "CalamityMod/Particles/WaterFoam", true, 13, 0.45f, Color.DeepSkyBlue, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(fadeOutfx2); } } } diff --git a/Projectiles/Magic/WaywasherProj.png b/Projectiles/Magic/WaywasherProj.png deleted file mode 100644 index 115a36bf88..0000000000 Binary files a/Projectiles/Magic/WaywasherProj.png and /dev/null differ diff --git a/Projectiles/Magic/WingmanGrenade.cs b/Projectiles/Magic/WingmanGrenade.cs index d25fad5311..ed92403696 100644 --- a/Projectiles/Magic/WingmanGrenade.cs +++ b/Projectiles/Magic/WingmanGrenade.cs @@ -110,8 +110,7 @@ namespace CalamityMod.Projectiles.Magic } } - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Magic/WingmanHoldout.cs b/Projectiles/Magic/WingmanHoldout.cs index c0a303c917..76512e79f1 100644 --- a/Projectiles/Magic/WingmanHoldout.cs +++ b/Projectiles/Magic/WingmanHoldout.cs @@ -126,6 +126,7 @@ namespace CalamityMod.Projectiles.Magic // The center of the player, taking into account if they have a mount or not. Vector2 ownerPosition = Owner.MountedCenter; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // The vector between the player and the mouse. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; @@ -141,8 +142,7 @@ namespace CalamityMod.Projectiles.Magic time++; Projectile.soundDelay--; - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } private void ManageHoldout(Vector2 ownerToMouse) @@ -181,6 +181,7 @@ namespace CalamityMod.Projectiles.Magic private void Shoot(bool isGrenade) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 shootDirection = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); // The position of the tip of the gun. @@ -191,13 +192,13 @@ namespace CalamityMod.Projectiles.Magic { 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 * 1.3f) * Utils.GetLerpValue(60, 10, FiringTime, true), ModContent.ProjectileType(), (int)(Projectile.damage * 6), Projectile.knockBack * 5, Projectile.owner, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, (firingVelocity * 1.3f) * 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); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, firingVelocity * Utils.GetLerpValue(80, 10, FiringTime, true), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0); } // Inside here go all the things that dedicated servers shouldn't spend resources on. @@ -270,7 +271,7 @@ namespace CalamityMod.Projectiles.Magic 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[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; diff --git a/Projectiles/Magic/WingmanShot.cs b/Projectiles/Magic/WingmanShot.cs index d964fb366e..4a291ae93a 100644 --- a/Projectiles/Magic/WingmanShot.cs +++ b/Projectiles/Magic/WingmanShot.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Magic public int time = 0; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 14; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Magic 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); + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[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; diff --git a/Projectiles/Magic/WulfrumBolt.cs b/Projectiles/Magic/WulfrumBolt.cs index 3565948b51..591346ae76 100644 --- a/Projectiles/Magic/WulfrumBolt.cs +++ b/Projectiles/Magic/WulfrumBolt.cs @@ -45,9 +45,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Magic/WulfrumManaDrain.cs b/Projectiles/Magic/WulfrumManaDrain.cs index 04ede744a2..fcd775b8c4 100644 --- a/Projectiles/Magic/WulfrumManaDrain.cs +++ b/Projectiles/Magic/WulfrumManaDrain.cs @@ -56,9 +56,9 @@ namespace CalamityMod.Projectiles.Magic idleSoundOut.Volume = Math.Clamp((Timer / 30f) + 0.001f, 0f, 1f) * 100f; } - Projectile.timeLeft = 2; Projectile.Center = Owner.MountedCenter; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.One); if (Main.rand.NextBool(6)) diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index 77753bde0f..74c6d6ee5f 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/WyvernFeatherPink.cs b/Projectiles/Magic/WyvernFeatherPink.cs index 0603088547..c336051740 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index 11dab5c10b..fbc4db8a6d 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/WyvernProjectile.cs b/Projectiles/Magic/WyvernProjectile.cs index 97a304fa72..e1e5c9c80a 100644 --- a/Projectiles/Magic/WyvernProjectile.cs +++ b/Projectiles/Magic/WyvernProjectile.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic { 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) + if (!Main.dedServ) { int head = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.8f, Mod.Find("WyvernHead").Type); Main.gore[head].timeLeft /= 10; @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 9f3bf8f341..105a0a852e 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -174,7 +174,7 @@ namespace CalamityMod.Projectiles.Magic ProduceBeamDust(beamColor); // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); // A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds. @@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.velocity == Vector2.Zero) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; float beamLength = Projectile.localAI[1]; Vector2 centerFloored = Projectile.Center.Floor() + Projectile.velocity * Projectile.scale * BeamRenderTileOffset; Vector2 scaleVec = new Vector2(Projectile.scale); diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index d1b1673700..e6138298dc 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -19,10 +19,14 @@ namespace CalamityMod.Projectiles.Magic private const float MaxManaConsumptionDelay = 15f; private const float MinManaConsumptionDelay = 5f; + public ref float FrameCounter => ref Projectile.ai[0]; + public ref float ManaConsumptionFrame => ref Projectile.ai[1]; + public ref float ManaConsumptionDelay => ref Projectile.localAI[0]; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -35,9 +39,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; } - // TODO -- Make property wrappers for these variables instead of needing to explain them. - // ai[0] is a frame counter. ai[1] is the next frame mana will be consumed. - // localAI[0] is the number of frames between mana consumptions. public override void AI() { Player player = Main.player[Projectile.owner]; @@ -46,13 +47,12 @@ namespace CalamityMod.Projectiles.Magic // Update damage based on curent magic damage stat (so Mana Sickness affects it) Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); - // ai[0] is the overall frame counter. - Projectile.ai[0] += 1f; - float chargeRatio = MathHelper.Clamp(Projectile.ai[0] / MaxCharge, 0f, 1f); + FrameCounter += 1f; + float chargeRatio = MathHelper.Clamp(FrameCounter / MaxCharge, 0f, 1f); // Update the crystal's animation, with the animation accelerating as the crystal charges Projectile.frameCounter++; - int framesPerAnimationUpdate = Projectile.ai[0] >= MaxCharge ? 2 : Projectile.ai[0] >= (MaxCharge * 0.66f) ? 3 : 4; + int framesPerAnimationUpdate = FrameCounter >= MaxCharge ? 2 : FrameCounter >= (MaxCharge * 0.66f) ? 3 : 4; if (Projectile.frameCounter >= framesPerAnimationUpdate) { Projectile.frameCounter = 0; @@ -65,12 +65,12 @@ namespace CalamityMod.Projectiles.Magic { Projectile.soundDelay = SoundInterval; // Don't play the continuous beam sound the first time around - if (Projectile.ai[0] > 1f) + if (FrameCounter > 1f) SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); } // Once the crystal reaches a certain charge, start producing dust. More charge = more dust. - if (Projectile.ai[0] > DustStart && Main.rand.NextFloat() < chargeRatio) + if (FrameCounter > DustStart && Main.rand.NextFloat() < chargeRatio) SpawnEjectionDust(chargeRatio); UpdatePlayerVisuals(player, rrp); @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Magic bool crystalStillInUse = !player.CantUseHoldout() && allowContinuedUse; // The beams are only projected once (on frame 1). - if (crystalStillInUse && Projectile.ai[0] == 1f) + if (crystalStillInUse && FrameCounter == 1f) { Vector2 beamVelocity = Vector2.Normalize(Projectile.velocity); if (beamVelocity.HasNaNs()) @@ -110,16 +110,16 @@ namespace CalamityMod.Projectiles.Magic private bool ShouldConsumeMana() { // If the mana consumption timer hasn't been initialized yet, initialize it and consume mana on frame 1. - if (Projectile.localAI[0] == 0f) + if (ManaConsumptionDelay == 0f) { - Projectile.ai[1] = Projectile.localAI[0] = MaxManaConsumptionDelay; + ManaConsumptionFrame = ManaConsumptionDelay = MaxManaConsumptionDelay; return true; } - bool consume = Projectile.ai[0] == Projectile.ai[1]; + bool consume = FrameCounter == ManaConsumptionFrame; if (consume) { - Projectile.localAI[0] = MathHelper.Clamp(Projectile.localAI[0] - 1f, MinManaConsumptionDelay, MaxManaConsumptionDelay); - Projectile.ai[1] += Projectile.localAI[0]; + ManaConsumptionDelay = MathHelper.Clamp(ManaConsumptionDelay - 1f, MinManaConsumptionDelay, MaxManaConsumptionDelay); + ManaConsumptionFrame += ManaConsumptionDelay; } return consume; } @@ -127,6 +127,7 @@ namespace CalamityMod.Projectiles.Magic // Gently adjusts the aim vector of the crystal to point towards the mouse. private void UpdateAim(Vector2 source, float speed) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; @@ -176,8 +177,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { SpriteEffects eff = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 index 37e8ba9665..1ea0f6191b 100644 --- a/Projectiles/Melee/AbyssBladeProjectile.cs +++ b/Projectiles/Melee/AbyssBladeProjectile.cs @@ -6,6 +6,8 @@ using CalamityMod.Projectiles.Ranged; using Humanizer; using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -20,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Items/Weapons/Melee/AbyssBlade"; - public int Time = 0; + public int Time = 9000; public int ChargeupTime = 25; public int Lifetime = 300; public int startDamage; @@ -38,8 +40,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -112,7 +114,9 @@ namespace CalamityMod.Projectiles.Melee { Projectile.netUpdate = true; SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); - Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.Center = Owner.MountedCenter + (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 12; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 20; startDamage = Projectile.damage; Projectile.spriteDirection = Projectile.direction; @@ -136,12 +140,6 @@ namespace CalamityMod.Projectiles.Melee 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; @@ -166,20 +164,19 @@ namespace CalamityMod.Projectiles.Melee Time = 0; bool foundTarget = false; - for (int i = 0; i < Main.maxNPCs; i++) + NPC target = Owner.ClampedMouseWorld().ClosestNPCAt(1000); + if (target != null) { - 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; + NPCDestination = target.Center + target.velocity * 5f; + foundTarget = true; } + else + foundTarget = false; if (!foundTarget) { - Projectile.velocity = (-Projectile.velocity).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; } else { @@ -245,5 +242,17 @@ namespace CalamityMod.Projectiles.Melee dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * dustMulti; } } + public override bool PreDraw(ref Color lightColor) + { + Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey"); + Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + if (spinMode && Time < 9000) + { + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, Color.Blue with { A = 0 } * 0.55f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.1f * Main.rand.NextFloat(0.8f, 1.15f), SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.DodgerBlue with { A = 0 } * 0.75f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 0.85f, SpriteEffects.None); + } + return true; + } } } diff --git a/Projectiles/Melee/AbyssBladeSplitProjectile.cs b/Projectiles/Melee/AbyssBladeSplitProjectile.cs index bd533f5fbe..664e1c1d3c 100644 --- a/Projectiles/Melee/AbyssBladeSplitProjectile.cs +++ b/Projectiles/Melee/AbyssBladeSplitProjectile.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Melee public int randTimer; public int dustType1 = 104; public int dustType2 = 29; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; @@ -50,20 +52,20 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y += 0.4f; Projectile.velocity.X *= 0.97f; } - if (Time % 2 == 0) + if (Time % 3 == 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); + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.6f, 0.8f), 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++) + for (int i = 0; i < 2; 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); + dust.velocity = Projectile.velocity + new Vector2(0.5f, 0.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.1f); } } diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index bcaf24ed46..a381b0710a 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -12,8 +13,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -68,7 +70,6 @@ namespace CalamityMod.Projectiles.Melee } else if (homeTracker == 1) { - int inc; Projectile.rotation -= MathHelper.Pi / 30f; Vector2 projCenter = Projectile.Center; float homingRange = 150f; @@ -139,7 +140,8 @@ namespace CalamityMod.Projectiles.Melee { return new Color(30, 255, 253); } - + 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 OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); diff --git a/Projectiles/Melee/AncientBeam.cs b/Projectiles/Melee/AncientBeam.cs index 5ae73dd099..f0d35c5aed 100644 --- a/Projectiles/Melee/AncientBeam.cs +++ b/Projectiles/Melee/AncientBeam.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } const float MaxTime = 40; @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 35) return false; - DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/AncientStar.cs b/Projectiles/Melee/AncientStar.cs index 8da00d49e2..d798f5435c 100644 --- a/Projectiles/Melee/AncientStar.cs +++ b/Projectiles/Melee/AncientStar.cs @@ -19,8 +19,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -72,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee } } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int starGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[starGore].velocity *= 0.66f; @@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); if (Shine == 1f) { @@ -130,7 +131,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(spark); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Melee/AquaStream.cs b/Projectiles/Melee/AquaStream.cs deleted file mode 100644 index b2befe5390..0000000000 --- a/Projectiles/Melee/AquaStream.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class AquaStream : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 6; - Projectile.scale = 1f; - Projectile.friendly = true; - Projectile.alpha = 150; - Projectile.penetrate = 2; - Projectile.timeLeft = 90; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - } - - public override void AI() - { - //projectile.ai[0] is the X increment while projectile.ai[1] is the Y increment - Projectile.velocity.X += Projectile.ai[0]; - Projectile.velocity.Y += Projectile.ai[1]; - - 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; - dust = Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 1.5f); - dust.noGravity = true; - } - } -} diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index af6256b14a..cb5eb85d89 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -92,52 +92,19 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation Projectile.Center = Owner.Center + DistanceFromPlayer; Projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160f * MathHelper.Pi) * 0.6f); //SWAGGER - if (Timer > ParryTime) - return; - - if (AlreadyParried == 0) - { - float collisionPoint = 0f; - float bladeLength = 80f * Projectile.scale; - - for (int k = 0; k < Main.maxProjectiles; k++) - { - Projectile proj = Main.projectile[k]; - - if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles - proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly - proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint)) - { - GeneralParryEffects(); - - //Reduce the projectile's damage by 50 for a second. - if (proj.Calamity().flatDR < 50) - proj.Calamity().flatDR = 50; - if (proj.Calamity().flatDRTimer < 60) - proj.Calamity().flatDRTimer = 60; - - //Bounce off the player if they are in the air - if (Owner.velocity.Y != 0) - Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2; - break; - } - } - } - //Make the owner look like theyre holding the sword bla bla Owner.heldProj = Projectile.whoAmI; Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); diff --git a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs index 9e78cc627b..0ff5bfb35c 100644 --- a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -80,8 +80,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = direction.ToRotation(); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation @@ -131,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee 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]) + if (CalamityClientConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Type]) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs index e2b1ac7c17..d043ba2deb 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs @@ -17,25 +17,12 @@ namespace CalamityMod.Projectiles.Melee public class ArkoftheCosmosBlast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; //Umm actually the rending scissors are for aote mr programmer what the hel.. it gets changed in predraw anywyas + public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; //Yes this is AotE sprite, but it gets changed in predraw anyways private bool initialized = false; public ref float Charge => ref Projectile.ai[0]; - public bool Dashing - { - get - { - return Projectile.ai[1] == 1; - } - - set - { - Projectile.ai[1] = value ? 1f : 0f; - } - } - - const int maxStitches = 8; + const int maxStitches = 10; public int CurrentStitches => (int)Math.Ceiling((1 - (float)Math.Sqrt(1f - (float)Math.Pow(MathHelper.Clamp(StitchProgress * 3f, 0f, 1f), 2f))) * maxStitches); public float[] StitchRotations = new float[maxStitches]; public float[] StitchLifetimes = new float[maxStitches]; @@ -74,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = (int)MaxTime + 2; + Projectile.localNPCHitCooldown = -1; } public override bool? CanDamage() @@ -106,8 +93,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation @@ -118,14 +104,12 @@ namespace CalamityMod.Projectiles.Melee //Spawn particles when the line appears if (HoldTimer == 1) { - //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) - { - // 17APR2024: Ozzatron: Dash iframes are not boosted by Cross Necklace at all and are fixed. - Owner.GiveUniversalIFrames(ArkoftheCosmos.DashIframes); - Dashing = true; - } + // Feel the power + SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound, Projectile.Center); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 7.5f) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 7.5f; + // Feel the particles for (int i = 0; i < 20; i++) { float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, Main.rand.NextFloat(0f, 1f)); @@ -152,33 +136,18 @@ namespace CalamityMod.Projectiles.Melee break; } } - } - - Owner.Calamity().LungingDown = false; - - if (Dashing) - { - Owner.Calamity().LungingDown = true; - Owner.fallStart = (int)(Owner.position.Y / 16f); - Owner.velocity = Owner.SafeDirectionTo(scissorPosition, Vector2.Zero) * 60f; - - if (Owner.Distance(scissorPosition) < 60f) + // Feel the extra stars + if (Owner.whoAmI == Main.myPlayer) { - Dashing = false; - Owner.velocity *= 0.1f; //Abrupt stop - SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound, Projectile.Center); - - if (Owner.whoAmI == Main.myPlayer) + int starAmt = 5; + for (int s = 1; s <= starAmt; s++) { - for (int i = 0; i < 5; i++) - { - var source = Projectile.GetSource_FromThis(); - Projectile blast = Projectile.NewProjectileDirect(source, Owner.Center, Main.rand.NextVector2CircularEdge(28, 28), ProjectileType(), (int)(ArkoftheCosmos.SlashBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f); - { - blast.timeLeft = 100; - } - } + float lerpRatio = s / (float)starAmt; + float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, lerpRatio); + Vector2 starPosition = Projectile.Center + Projectile.velocity * positionAlongLine; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), starPosition, Main.rand.NextVector2CircularEdge(28, 28), ProjectileType(), (int)(ArkoftheCosmos.BlastBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f); + blast.timeLeft = 100; } } } @@ -217,6 +186,17 @@ namespace CalamityMod.Projectiles.Melee } StitchLifetimes[i]++; } + + if (StitchProgress > 0) + { + for (int m = 0; m < 2; m++) + { + float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, Main.rand.NextFloat()); + Vector2 smokePosition = Projectile.Center + Projectile.velocity * positionAlongLine; + HeavySmokeParticle smoke = new(smokePosition, Main.rand.NextVector2CircularEdge(4f, 4f), new Color(117, 36, 32), 12, 0.8f, 0.6f, 0f, true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -233,22 +213,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - //Add some damage falloff - modifiers.SourceDamage *= (float)Math.Pow(1 - ArkoftheCosmos.blastFalloffStrenght, Projectile.numHits * ArkoftheCosmos.blastFalloffSpeed); - } - - public override void OnKill(int timeLeft) - { - if (Dashing) - { - Owner.velocity *= 0.1f; //Abrupt stop if the player was still dashing - } - - Owner.Calamity().LungingDown = false; - } - //Animation keys public CurveSegment anticipation = new CurveSegment(EasingType.SineBump, 0f, 0.2f, -0.1f); public CurveSegment thrust = new CurveSegment(EasingType.PolyOut, 0.3f, 0.2f, 3f, 3); @@ -302,7 +266,7 @@ namespace CalamityMod.Projectiles.Melee float raise = (float)Math.Sin(HoldProgress * MathHelper.PiOver2); Vector2 origin = new Vector2(lineTex.Width / 2f, lineTex.Height); - float ripWidth = StitchProgress < 0.75f ? 0.2f : (1 - (StitchProgress - 0.75f) * 4f) * 0.2f; + float ripWidth = StitchProgress < 0.75f ? 0.4f : (1 - (StitchProgress - 0.75f) * 4f) * 0.2f; Vector2 scale = new Vector2(ripWidth, (ThrustDisplaceRatio() * 242f) / lineTex.Height); float lineOpacity = StitchProgress < 0.75f ? 1f : 1 - (StitchProgress - 0.75f) * 4f; @@ -313,6 +277,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < CurrentStitches; i++) { + float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine; diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index 3e652c4683..c9e6cc4e7a 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; private bool initialized = false; - const float MaxTime = 340; + internal const float MaxTime = 340; static float ParryTime = 15; public Vector2 DistanceFromPlayer => Projectile.velocity * 10 + Projectile.velocity * 10 * ThrustDisplaceRatio(); public float Timer => MaxTime - Projectile.timeLeft; @@ -109,13 +109,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; SoundEngine.PlaySound(SoundID.Item84 with { Volume = SoundID.Item84.Volume * 0.3f }, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index 5b3bb7fb7e..65c5cce750 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -75,8 +75,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -153,8 +153,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = (int)(Projectile.localNPCHitCooldown / 4f); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } if (!Thrown) @@ -184,9 +183,7 @@ namespace CalamityMod.Projectiles.Melee 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; - } + blast.timeLeft = 100; } } @@ -210,8 +207,9 @@ namespace CalamityMod.Projectiles.Melee } //Rotate the blade towards the cursor - Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Calamity().mouseWorld, 0.025f * ThrowRatio()); - Projectile.Center = Projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 20f * ThrowRatio()); + Vector2 mouse = Owner.ClampedMouseWorld(); + Projectile.Center = Vector2.Lerp(Projectile.Center, mouse, 0.025f * ThrowRatio()); + Projectile.Center = Projectile.Center.MoveTowards(mouse, 20f * ThrowRatio()); if ((Projectile.Center - Owner.Center).Length() > ArkoftheCosmos.MaxThrowReach) Projectile.Center = Owner.Center + Owner.DirectionTo(Projectile.Center) * ArkoftheCosmos.MaxThrowReach; @@ -244,9 +242,7 @@ namespace CalamityMod.Projectiles.Melee { var source = Projectile.GetSource_FromThis(); Projectile blast = Projectile.NewProjectileDirect(source, Projectile.Center + (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 30f, (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SnapBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); - { - blast.timeLeft = 100; - } + blast.timeLeft = 100; } //Reset local immunity so that the snap can do damage @@ -417,7 +413,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Combo == 3f) - modifiers.SourceDamage *= ArkoftheElements.snapDamageMultiplier; + modifiers.SourceDamage *= ArkoftheCosmos.SnapDamageMultiplier; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -489,7 +485,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(flipped ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type] && Combo == 0f) + if (CalamityClientConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Type] && Combo == 0f) { for (int i = 1; i < Projectile.oldRot.Length; ++i) { @@ -544,7 +540,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + (drawAngle.ToRotationVector2() * 56f + (drawAngle - MathHelper.PiOver2).ToRotationVector2() * 11 * Owner.direction) * Projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) + if (CalamityClientConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Type]) { Texture2D afterimage = Request("CalamityMod/Projectiles/Melee/SunderingScissorsGlow").Value; diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index d2d6ff0273..6c3de2de20 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -109,13 +109,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; SoundEngine.PlaySound(SoundID.Item84 with { Volume = SoundID.Item84.Volume * 0.3f }, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation diff --git a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs deleted file mode 100644 index 97ca32cb42..0000000000 --- a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs +++ /dev/null @@ -1,273 +0,0 @@ -using System; -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 CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; - - -namespace CalamityMod.Projectiles.Melee -{ - public class ArkoftheElementsSnapBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; - - private bool initialized = false; - - const int maxStitches = 8; - public int CurrentStitches => (int)Math.Ceiling((1 - (float)Math.Sqrt(1f - (float)Math.Pow(MathHelper.Clamp(StitchProgress * 3f, 0f, 1f), 2f))) * maxStitches); - public float[] StitchRotations = new float[maxStitches]; - public float[] StitchLifetimes = new float[maxStitches]; - - const float MaxTime = 70; - const float SnapTime = 25f; - const float HoldTime = 15f; - - public float SnapTimer => MaxTime - Projectile.timeLeft; - public float HoldTimer => MaxTime - Projectile.timeLeft - SnapTime; - public float StitchTimer => MaxTime - Projectile.timeLeft - SnapTime - (HoldTime / 2f); - - public float SnapProgress => MathHelper.Clamp(SnapTimer / SnapTime, 0, 1); - public float HoldProgress => MathHelper.Clamp(HoldTimer / HoldTime, 0, 1); - public float StitchProgress => MathHelper.Clamp(StitchTimer / (MaxTime - (SnapTime + (HoldTime / 2f))), 0, 1); - - public int CurrentAnimation => (MaxTime - Projectile.timeLeft) <= SnapTime ? 0 : (MaxTime - Projectile.timeLeft) <= SnapTime + HoldTime ? 1 : 2; - - public Player Owner => Main.player[Projectile.owner]; - - public override void SetStaticDefaults() - { - } - public override void SetDefaults() - { - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.width = Projectile.height = 300; - Projectile.width = Projectile.height = 300; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.penetrate = -1; - - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = (int)MaxTime + 2; - } - - public override bool? CanDamage() - { - return HoldProgress > 0; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (HoldProgress == 0) - return false; - - //The hitbox is simplified into a line collision. - float collisionPoint = 0f; - float bladeLength = ThrustDisplaceRatio() * 242f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLength), 30, ref collisionPoint); - } - - public override bool ShouldUpdatePosition() => false; - - public override void AI() - { - if (!initialized) //Initialization - { - Projectile.timeLeft = (int)MaxTime; - SoundEngine.PlaySound(SoundID.Item84 with { Volume = SoundID.Item84.Volume * 0.3f }, Projectile.Center); - - Projectile.velocity.Normalize(); - Projectile.rotation = Projectile.velocity.ToRotation(); - - - initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } - - //Manage position and rotation - Projectile.scale = 1.4f; - - //Update stitches - for (int i = 0; i < CurrentStitches; i++) - { - if (StitchRotations[i] == 0) - { - StitchRotations[i] = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4) + MathHelper.PiOver2; - - SoundStyle sewSound = i % 3 == 0 ? SoundID.Item63 : i % 3 == 1 ? SoundID.Item64 : SoundID.Item65; - SoundEngine.PlaySound(sewSound with { Volume = sewSound.Volume * 0.5f }, Owner.Center); - - float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); - Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; - - - Particle spark = new CritSpark(stitchCenter, Vector2.Zero, Color.White, Color.Cyan, 3f, 8, 0.1f, 3); - GeneralParticleHandler.SpawnParticle(spark); - } - StitchLifetimes[i]++; - } - - //Spawn particles when the line appears - if (HoldTimer == 1) - { - for (int i = 0; i < 20; i++) - { - float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, Main.rand.NextFloat(0f, 1f)); - Vector2 particlePosition = Projectile.Center + Projectile.velocity * positionAlongLine + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; - Color particleColor = Main.rand.NextBool() ? Color.OrangeRed : Main.rand.NextBool() ? Color.White : Color.Orange; - float particleScale = Main.rand.NextFloat(0.05f, 0.4f) * (0.4f + 0.6f * (float)Math.Sin(positionAlongLine / (ThrustDisplaceRatio() * 242f) * MathHelper.Pi)); - - int particleType = Main.rand.Next(3); - Particle particle; - - switch (particleType) - { - case 0: - particle = new StrongBloom(particlePosition, Vector2.UnitY * Main.rand.NextFloat(-4f, -1f), particleColor, particleScale, Main.rand.Next(20) + 10); - GeneralParticleHandler.SpawnParticle(particle); - break; - case 1: - particle = new GenericBloom(particlePosition, Vector2.UnitY * Main.rand.NextFloat(-4f, -1f), particleColor, particleScale, Main.rand.Next(20) + 10); - GeneralParticleHandler.SpawnParticle(particle); - break; - case 2: - particle = new CritSpark(particlePosition, Vector2.UnitY * Main.rand.NextFloat(-10f, -1f), Color.White, particleColor, particleScale * 7f, Main.rand.Next(20) + 10, 0.1f, 3); - GeneralParticleHandler.SpawnParticle(particle); - break; - } - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Color pulseColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.Orange : Color.Coral) : (Main.rand.NextBool() ? Color.OrangeRed : Color.Gold); - Particle pulse = new PulseRing(target.Center, Vector2.Zero, pulseColor, 0.05f, 0.2f + Main.rand.NextFloat(0f, 1f), 30); - GeneralParticleHandler.SpawnParticle(pulse); - - for (int i = 0; i < 10; i++) - { - Vector2 particleSpeed = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); - Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Red, 60, 1, 1.5f, hueShift: 0.002f); - GeneralParticleHandler.SpawnParticle(energyLeak); - } - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - //Add some damage falloff - modifiers.SourceDamage *= (float)Math.Pow(1 - ArkoftheElements.blastFalloffStrenght, Projectile.numHits * ArkoftheElements.blastFalloffSpeed); - } - - //Animation keys - public CurveSegment anticipation = new CurveSegment(EasingType.SineBump, 0f, 0.2f, -0.1f); - public CurveSegment thrust = new CurveSegment(EasingType.PolyOut, 0.3f, 0.2f, 3f, 3); - internal float ThrustDisplaceRatio() => PiecewiseAnimation(SnapProgress, new CurveSegment[] { anticipation, thrust }); - - - public CurveSegment openMore = new CurveSegment(EasingType.SineBump, 0f, 0f, -0.15f); - public CurveSegment close = new CurveSegment(EasingType.PolyIn, 0.35f, 0f, 1f, 4); - public CurveSegment stayClosed = new CurveSegment(EasingType.Linear, 0.5f, 1f, 0f); - internal float RotationRatio() => PiecewiseAnimation(SnapProgress, new CurveSegment[] { openMore, close, stayClosed }); - - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - Texture2D sliceTex = Request("CalamityMod/Particles/BloomLine").Value; - 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); - Main.EntitySpriteDraw(sliceTex, Projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0); - - //Draw the scissors - if (HoldProgress <= 0.4f) - { - Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value; - Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value; - - float snippingRotation = Projectile.rotation + MathHelper.PiOver4; - float snippingRotationBack = Projectile.rotation + MathHelper.PiOver4 * 1.75f; - - float nitpickAngleCorrection = MathHelper.ToRadians(6f); //ITS IMPORTANT MOM! - float drawRotation = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio()) + nitpickAngleCorrection; - float drawRotationBack = MathHelper.Lerp(snippingRotationBack - MathHelper.PiOver4, snippingRotationBack, RotationRatio()) + nitpickAngleCorrection; - - Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole - Vector2 drawOriginBack = new Vector2(22, 109); //Right on the hole - Vector2 drawPosition = Projectile.Center + ThrustDisplaceRatio() * Projectile.velocity * 200f - Main.screenPosition; - - float opacity = (0.4f - HoldProgress) / 0.4f; - Color drawColor = Color.Orange * opacity * 0.9f; - Color drawColorBack = Color.HotPink * opacity * 0.9f; - - Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0); - Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - } - - //Draw the rip - if (HoldProgress > 0) - { - Texture2D lineTex = Request("CalamityMod/Particles/ThinEndedLine").Value; - - Vector2 Shake = HoldProgress > 0.2f ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1 - HoldProgress * 5f) * 0.5f; - float raise = (float)Math.Sin(HoldProgress * MathHelper.PiOver2); - - Vector2 origin = new Vector2(lineTex.Width / 2f, lineTex.Height); - float ripWidth = StitchProgress < 0.75f ? 0.2f : (1 - (StitchProgress - 0.75f) * 4f) * 0.2f; - Vector2 scale = new Vector2(ripWidth, (ThrustDisplaceRatio() * 242f) / lineTex.Height); - float lineOpacity = StitchProgress < 0.75f ? 1f : 1 - (StitchProgress - 0.75f) * 4f; - - Main.EntitySpriteDraw(lineTex, Projectile.Center - Main.screenPosition + Shake + nitpickShiftCorrection, null, Color.Lerp(Color.White, Color.OrangeRed * 0.7f, raise) * lineOpacity, rot, origin, scale, SpriteEffects.None, 0); - - - //Draw the stitches - if (StitchProgress > 0) - { - for (int i = 0; i < CurrentStitches; i++) - { - float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); - Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine + nitpickShiftCorrection; - - rot = Projectile.rotation + MathHelper.PiOver2 + StitchRotations[i]; - origin = new Vector2(lineTex.Width / 2f, lineTex.Height / 2f); - - float stitchLength = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f; - float stitchScale = (1f + (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.Pi) * 0.3f) * 0.85f; - if (CurrentStitches == maxStitches) - { - stitchScale *= 1 - ((StitchTimer - (MaxTime - SnapTime - HoldTime * 0.5f) * 0.3f) / (MaxTime - SnapTime - HoldTime * 0.5f) * 0.7f) * 0.8f; - } - scale = new Vector2(0.2f, stitchLength) * stitchScale; - - Color stitchColor = Color.Lerp(Color.White, Color.CornflowerBlue * 0.7f, (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.PiOver2)); - - Main.EntitySpriteDraw(lineTex, stitchCenter - Main.screenPosition + Shake, null, stitchColor, rot, origin, scale, SpriteEffects.None, 0); - } - } - } - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - return false; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(initialized); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - initialized = reader.ReadBoolean(); - } - } -} diff --git a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs index 6ad36b293e..244c91ea80 100644 --- a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs @@ -74,8 +74,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -143,12 +143,12 @@ namespace CalamityMod.Projectiles.Melee direction.Normalize(); Projectile.rotation = direction.ToRotation(); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, the result is capped separately if (Thrown) ThrowReach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), ThrowReachMin, ThrowReachMax); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } if (!Thrown) @@ -308,7 +308,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(Combo == 1 ? sword.Width / 2f : flipped ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) + if (CalamityClientConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Type]) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { @@ -362,7 +362,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + functionalDrawAngle.ToRotationVector2() * 70f * Projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade float backScissorRotation = drawRotation + (Combo == 1 ? (!flipped ? MathHelper.PiOver4 * 0.75f : MathHelper.PiOver4 * -0.75f) : 0f); - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) + if (CalamityClientConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Type]) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs index 279ffadd27..796b9d43b2 100644 --- a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs +++ b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs @@ -20,13 +20,14 @@ namespace CalamityMod.Projectiles.Melee public List Particles; Vector2 AnchorStart => Owner.Center; - Vector2 AnchorEnd => Owner.Calamity().mouseWorld; + // 14NOV2024: Ozzatron: I have no idea what this does so I clamped it + Vector2 AnchorEnd => Owner.ClampedMouseWorld(); public Vector2 SizeVector => Utils.SafeNormalize(AnchorEnd - AnchorStart, Vector2.Zero) * MathHelper.Clamp((AnchorEnd - AnchorStart).Length(), 0, ArkoftheCosmos.MaxThrowReach); public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 1; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 1; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { diff --git a/Projectiles/Melee/AstralScytheProjectile.cs b/Projectiles/Melee/AstralScytheProjectile.cs index f57ef7acea..a821a14477 100644 --- a/Projectiles/Melee/AstralScytheProjectile.cs +++ b/Projectiles/Melee/AstralScytheProjectile.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/AtaraxiaMain.cs b/Projectiles/Melee/AtaraxiaMain.cs index b359302337..ca674586b8 100644 --- a/Projectiles/Melee/AtaraxiaMain.cs +++ b/Projectiles/Melee/AtaraxiaMain.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = NumAnimationFrames; + Main.projFrames[Type] = NumAnimationFrames; } public override void SetDefaults() diff --git a/Projectiles/Melee/AtaraxiaSide.cs b/Projectiles/Melee/AtaraxiaSide.cs index 9af813ba37..9b4779611c 100644 --- a/Projectiles/Melee/AtaraxiaSide.cs +++ b/Projectiles/Melee/AtaraxiaSide.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = NumAnimationFrames; + Main.projFrames[Type] = NumAnimationFrames; } public override void SetDefaults() diff --git a/Projectiles/Melee/BalefulHarvesterHoldout.cs b/Projectiles/Melee/BalefulHarvesterHoldout.cs new file mode 100644 index 0000000000..3363445afd --- /dev/null +++ b/Projectiles/Melee/BalefulHarvesterHoldout.cs @@ -0,0 +1,250 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Melee; +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.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BalefulHarvesterHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/BalefulHarvester"; + public override float HitboxOutset => 90; + public override Vector2 HitboxSize => new Vector2(140, 140); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override Vector2 SpriteOrigin => new(0, 96); + + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = false; + public bool postSwing = false; + public float fadeIn = 0f; + public int useAnim; + public bool FirstIFrameReset = false; + public bool SecondIFrameReset = false; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + + public override void WhenSpawned() + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = -1; + + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X < 0 ? true : false; + } + + public override void UseStyle() + { + AnimationProgress = Animation % useAnim; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65f; + CanHit = false; + FirstIFrameReset = false; + SecondIFrameReset = false; + if (mousePos.X < Owner.Center.X) + Owner.direction = -1; + else + Owner.direction = 1; + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0; + doSwing = true; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) - MathHelper.ToRadians(45f * Owner.direction), 0.1f); + + if (AnimationProgress < (useAnim * 0.4f)) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + } + RotationOffset = RotationOffset.AngleLerp(MathHelper.ToRadians(45f * Projectile.ai[1] * Owner.direction), 0.2f); + } + else + { + FlipAsSword = Owner.direction < 0; + + float time = AnimationProgress - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time % (int)(timeMax * 0.33f) == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/TerratomereSwing"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.75f, 0.85f) }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(fire2 with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.25f, 0.35f) }, Projectile.Center); + } + + CanHit = time < (int)(timeMax * 0.85f); + + if (time > (int)(timeMax * 0.66f)) + { + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(-45f * Projectile.ai[1] * Owner.direction, 1125f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time * 3f / timeMax, 1))), 0.125f); + if (!SecondIFrameReset) + { + SecondIFrameReset = true; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + } + } + else if (time > (int)(timeMax * 0.33f)) + { + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(-45f * Projectile.ai[1] * Owner.direction, 765f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time * 3f / timeMax, 1))), 0.125f); + if (!FirstIFrameReset) + { + FirstIFrameReset = true; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + } + } + else + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(-45f * Projectile.ai[1] * Owner.direction, 405f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time * 3f / timeMax, 1))), 0.125f); + + + if (time >= (int)(timeMax * 0.98f)) + doSwing = false; + if (time < (int)(timeMax * 0.85f)) + postSwing = true; + } + + if (CanHit) + { + Vector2 sparkVel = Vector2.UnitY.RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * (3.5f * Owner.direction); + Vector2 sparkPos = Owner.Center + Vector2.UnitX.RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * Main.rand.Next(80, 140); + CustomSprite critSpark = new(sparkPos, sparkVel, 15, "CalamityMod/Particles/CritSpark", 1f, Color.Orange, frameCount: 4, frame: Main.rand.Next(4)); + GeneralParticleHandler.SpawnParticle(critSpark); + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + // Whoa on-hit effects !!! + for (int i = 0; i < 4; i++) + { + Vector2 sparkVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(4.5f, 6.5f); + CustomSprite critSpark = new(target.Center, sparkVel, 40, "CalamityMod/Particles/CritSpark", 1f, new Color(255, 85, 0), frameCount: 4, frame: Main.rand.Next(4)); + GeneralParticleHandler.SpawnParticle(critSpark); + } + DesertProwlerSkullParticle skullEffect = new(target.Center, Vector2.Zero, Color.OrangeRed, Color.Black, 1f, 180f); + GeneralParticleHandler.SpawnParticle(skullEffect); + + // Debuff and actually spawning the projectiles + target.AddBuff(BuffID.OnFire3, 300); + CalamityPlayer.HorsemansBladeOnHit(Owner, target.whoAmI, Projectile.damage, Projectile.knockBack * 0.5f, 0, ModContent.ProjectileType()); + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + + public override bool PreDraw(ref Color lightColor) + { + // Draw the actual sword + if (useAnim > 0 && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, lightColor, FinalRotation + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + // Draw a swing smear and sparkle while swinging + Main.spriteBatch.SetBlendState(BlendState.Additive); + float time = AnimationProgress - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + if (time > (int)(timeMax * 0.1f) && doSwing) + { + Asset vanillaSmear = TextureAssets.Projectile[997]; + Rectangle vanillaSmearFrame = vanillaSmear.Frame(1, 4, 0, 0); + Asset smear = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + float smearOpacity = CalamityUtils.Convert01To010(time / timeMax); + Main.EntitySpriteDraw(vanillaSmear.Value, Projectile.Center - Main.screenPosition, vanillaSmearFrame, new Color(193, 83, 43) * smearOpacity * 0.75f, FinalRotation - MathHelper.PiOver2, vanillaSmearFrame.Size() / 2f, 1.25f, SpriteEffects.None); + Main.EntitySpriteDraw(smear.Value, Projectile.Center - Main.screenPosition, null, new Color(247, 115, 0) * smearOpacity, FinalRotation, smear.Size() / 2f, 1.8f, SpriteEffects.None); + + if (smearOpacity > 0.65f) + { + Vector2 sparklePos = Projectile.Center - Main.screenPosition - (Vector2.UnitY.RotatedBy(FinalRotation + MathHelper.PiOver4 * Owner.direction) * 120f); + Asset bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Main.EntitySpriteDraw(bloom.Value, sparklePos, null, Color.White * 0.75f, 0f, bloom.Size() / 2f, 0.2f, SpriteEffects.None); + Asset sparkle = ModContent.Request("CalamityMod/Particles/FullStar"); + Main.EntitySpriteDraw(sparkle.Value, sparklePos, null, Color.Orange, 0f, sparkle.Size() / 2f, 2f, SpriteEffects.None); + } + } + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + return false; + } + + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index f2e5c9157d..f5d68cea54 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -91,13 +92,10 @@ namespace CalamityMod.Projectiles.Melee for (int j = 0; j < 2; j++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X + 4f, Projectile.position.Y + 4f), Projectile.width - 8, Projectile.height - 8, Main.rand.NextBool() ? 5 : 6, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 2f); - Main.dust[dust].position -= Projectile.velocity * 2f; - Main.dust[dust].noGravity = true; - Dust expr_7A4A_cp_0_cp_0 = Main.dust[dust]; - expr_7A4A_cp_0_cp_0.velocity.X *= 0.3f; - Dust expr_7A65_cp_0_cp_0 = Main.dust[dust]; - expr_7A65_cp_0_cp_0.velocity.Y *= 0.3f; + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X + 4f, Projectile.position.Y + 4f), Projectile.width - 8, Projectile.height - 8, Main.rand.NextBool() ? 5 : 6, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 2f); + dust.position -= Projectile.velocity * 2f; + dust.noGravity = true; + dust.velocity *= 0.3f; } return; @@ -106,23 +104,20 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, Main.rand.Next(0, 128)); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Main.rand.Next(0, 128)); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - for (int j = 0; j < 5; j++) + for (int j = 0; j < 3; j++) { - int deathDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 2f); + int deathDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.25f); Main.dust[deathDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -130,12 +125,12 @@ namespace CalamityMod.Projectiles.Melee Main.dust[deathDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int k = 0; k < 10; k++) + for (int k = 0; k < 5; k++) { - int deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); + int deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2.5f); Main.dust[deathDust2].noGravity = true; Main.dust[deathDust2].velocity *= 5f; - deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); + deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1.5f); Main.dust[deathDust2].velocity *= 2f; } } diff --git a/Projectiles/Melee/BasherHoldout.cs b/Projectiles/Melee/BasherHoldout.cs new file mode 100644 index 0000000000..defc0b40a2 --- /dev/null +++ b/Projectiles/Melee/BasherHoldout.cs @@ -0,0 +1,251 @@ +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +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.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BasherHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/Basher"; + public override float HitboxOutset => 60; + + public override Vector2 HitboxSize => new Vector2(80, 80); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(-7, 65); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public bool finalFlip = false; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void WhenSpawned() + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = 1; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + AnimationProgress = Animation % useAnim; + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit && Owner.Calamity().mouseRight) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + swingCount++; + finalFlip = false; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); + + if (AnimationProgress < (useAnim / 3)) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + } + else + { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0 ? true : false; + } + + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time == (int)(timeMax * 0.4f)) + { + SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.35f, -0.55f) }, Projectile.Center); + } + if ( time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.85f)) + { + CanHit = true; + + Vector2 particleVel = new Vector2(0, 7 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(10, 90), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + + Dust dust = Dust.NewDustPerfect(particlePos, 79); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.3f); + dust.velocity = -particleVel.RotatedByRandom(0.2f); + } + else + CanHit = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.7f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < (Owner.Calamity().mouseRight ? 3 : 2); i++) + { + Vector2 dustPos = Owner.Center + (new Vector2(90, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + Dust dust2 = Dust.NewDustPerfect(dustPos, i == 2 ? 278 : DustID.JungleTorch, Utils.DirectionTo(Owner.Center, dustPos) * Main.rand.NextFloat(1.2f, 2.5f)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f) * (Owner.Calamity().mouseRight ? 1.3f : 1); + dust2.noGravity = i == 2 ? false : true; + dust2.color = i == 2 ? Color.Chartreuse : default; + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + SoundEngine.PlaySound(fire with { Volume = 0.65f, Pitch = -0.2f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DrumTomHigh with { Volume = 0.45f, Pitch = -0.9f }, Projectile.Center); + + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffID.Poisoned, 90); + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 7.5f * (Owner.Calamity().mouseRight ? 2.5f : 1), true); + + if (Owner.Calamity().mouseRight) + { + Owner.Calamity().GeneralScreenShakePower = 1.2f; + + SoundStyle fire3 = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion"); + SoundEngine.PlaySound(fire3 with { Volume = 0.35f, Pitch = 0.7f }, Projectile.Center); + for (int i = 0; i < MathHelper.Clamp(15 - Projectile.numHits * 3, 2, 15); i++) + { + bool dType = i % 4 == 0; + Dust dust2 = Dust.NewDustPerfect(target.Center, dType ? 278 : DustID.JungleTorch, launchVel.RotatedByRandom(0.5f) * Main.rand.NextFloat(3.5f, 7f) * (dType ? 2 : 1)); + dust2.scale = Main.rand.NextFloat(0.65f, 1.35f) * (dType ? 0.7f : 1f); + dust2.noGravity = true; + dust2.color = dType ? Color.Chartreuse : default; + } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 playerLaunchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * 10; + Owner.velocity = playerLaunchVel; + } + + for (int i = 0; i < MathHelper.Clamp(6 - Projectile.numHits * 2, 2, 6); i++) + { + Dust dust2 = Dust.NewDustPerfect(target.Center, Main.rand.NextBool(5) ? DustID.JungleTorch : 79, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.1f, 0.7f)); + dust2.scale = Main.rand.NextFloat(0.75f, 1.25f); + dust2.noGravity = true; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + + for (int i = 0; i < 8; i++) + { + Color auraColor = Color.Chartreuse with { A = 0 } * 0.35f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 8 * fadeIn; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/BiomeBladeHoldout.cs b/Projectiles/Melee/BiomeBladeHoldout.cs index c87f35d666..39dc41139c 100644 --- a/Projectiles/Melee/BiomeBladeHoldout.cs +++ b/Projectiles/Melee/BiomeBladeHoldout.cs @@ -2,6 +2,7 @@ using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -117,34 +118,26 @@ namespace CalamityMod.Projectiles.Melee public void Attune(TrueBiomeBlade item) { - bool jungle = Owner.ZoneJungle; - bool snow = Owner.ZoneSnow; - bool evil = Owner.ZoneCorrupt || Owner.ZoneCrimson; - bool desert = Owner.ZoneDesert; - bool hell = Owner.ZoneUnderworldHeight; - bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur; - bool hallow = Owner.ZoneHallow; - bool astral = Owner.Calamity().ZoneAstral; - bool marine = Owner.Calamity().ZoneAbyss || Owner.Calamity().ZoneSunkenSea; + bool jungleAttune = Owner.ZoneJungle; + bool coldAttune = Owner.ZoneSnow || Owner.ZoneSkyHeight; + bool evilAttune = Owner.ZoneCorrupt || Owner.ZoneCrimson; + bool hotAttune = Owner.ZoneDesert || Owner.ZoneUnderworldHeight; + bool heavenlyAttune = Owner.ZoneHallow || Owner.Calamity().ZoneAstral; - Attunement attunement = Attunement.attunementArray[(int)AttunementID.TrueDefault]; + Attunement attunement = AttunementSystem.FindOrNull(AttunementID.TrueDefault); - if (desert || hell) - attunement = Attunement.attunementArray[(int)AttunementID.TrueHot]; - if (snow) - attunement = Attunement.attunementArray[(int)AttunementID.TrueCold]; - if (jungle || ocean) - attunement = Attunement.attunementArray[(int)AttunementID.TrueTropical]; - if (evil) - attunement = Attunement.attunementArray[(int)AttunementID.TrueEvil]; - if (hallow) - attunement = Attunement.attunementArray[(int)AttunementID.Holy]; - if (astral) - attunement = Attunement.attunementArray[(int)AttunementID.Astral]; - if (marine) - attunement = Attunement.attunementArray[(int)AttunementID.Marine]; + if (hotAttune) + attunement = AttunementSystem.FindOrNull(AttunementID.TrueHot); + if (coldAttune) + attunement = AttunementSystem.FindOrNull(AttunementID.TrueCold); + if (jungleAttune) + attunement = AttunementSystem.FindOrNull(AttunementID.TrueTropical); + if (evilAttune) + attunement = AttunementSystem.FindOrNull(AttunementID.TrueEvil); + if (heavenlyAttune) + attunement = AttunementSystem.FindOrNull(AttunementID.Holy); - //If the owner already had the attunement , break out of it (And unswap) + //If the owner already had the attunement, break out of it (And unswap) if (item.secondaryAttunement == attunement) { SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, Projectile.Center); @@ -178,7 +171,7 @@ namespace CalamityMod.Projectiles.Melee else if (ChanneledState == 1f) { - Texture2D tex = TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = TextureAssets.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 deleted file mode 100644 index a7d2d28243..0000000000 --- a/Projectiles/Melee/BladecrestOathswordProj.cs +++ /dev/null @@ -1,227 +0,0 @@ -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; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BladecrestOathswordProj : BaseIdleHoldoutProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public enum SwingState - { - Default, - Swinging - } - - public int Direction = 1; - public SwingState CurrentState; - public ref float SwingDirection => ref Projectile.ai[0]; - public ref float BladeHorizontalFactor => ref Projectile.ai[1]; - public ref float PostSwingRepositionDelay => ref Projectile.localAI[0]; - public ref float ChargePower => ref Projectile.localAI[1]; - - public override string Texture => "CalamityMod/Items/Weapons/Melee/BladecrestOathsword"; - public override int AssociatedItemID => ModContent.ItemType(); - public override int IntendedProjectileType => ModContent.ProjectileType(); - public override bool? CanDamage() => CurrentState != 0; //Could also disable the damage during the channel state, - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 56; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 90000; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; - Projectile.noEnchantmentVisuals = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Direction); - writer.Write(PostSwingRepositionDelay); - writer.Write((int)CurrentState); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Direction = reader.ReadInt32(); - PostSwingRepositionDelay = reader.ReadSingle(); - CurrentState = (SwingState)reader.ReadInt32(); - } - - public override void SafeAI() - { - // Initialize the animation max time if necessary. - if (Owner.itemAnimationMax == 0) - Owner.itemAnimationMax = (int)(Owner.ActiveItem().useAnimation * Owner.GetAttackSpeed()); - - // Decide the current phase state of the blade. - DecideCurrentState(); - - Direction = Owner.direction; - - //Set the owner's arm to rotate with the blade - if (Owner.itemAnimation > 0) - { - float armPointingDirection = Projectile.rotation + MathHelper.ToRadians(240); - Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armPointingDirection); - } - - // Glue the sword to its owner. - Projectile.Opacity = 1f; - Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size * 0.5f + Vector2.UnitY * Owner.gfxOffY; - - float swingSpeedInterpolant = 0.27f; - float swingCompletion = 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax; - float unchangedSwingCompletion = swingCompletion; - if (SwingDirection == -1f) - swingCompletion = 1f - swingCompletion; - - // Calculate the direction of the blade. - Vector3 aimDirection3D = Vector3.Transform(Vector3.UnitX, Matrix.CreateRotationZ(MathHelper.PiOver2 * -Direction)); - - if ((swingCompletion > 0f && swingCompletion < 1f) || PostSwingRepositionDelay > 0f) - { - swingSpeedInterpolant = MathHelper.Lerp(swingSpeedInterpolant, 1f, Utils.GetLerpValue(0f, 0.2f, swingCompletion, true)); - - float horizontalAngle = MathHelper.Lerp(-1.2f, 2.6f, (float)Math.Pow(MathHelper.SmoothStep(0f, 1f, swingCompletion), 3D)) * Direction; - Matrix offsetLinearTransformation = Matrix.CreateRotationZ(horizontalAngle); - - aimDirection3D = Vector3.Transform(Vector3.UnitX, offsetLinearTransformation); - } - - // Disable the holdout effect. This was decided after indeciciveness with what would be best. - else - Projectile.Opacity = 0f; - - // Determine the horizontal stretch offset of the blade. This is used in matrix math below to create 2.5D visuals. - BladeHorizontalFactor = MathHelper.Lerp(1f, 1.25f, (aimDirection3D.X * 0.5f + 0.5f) * Utils.GetLerpValue(1f, 0.8f, unchangedSwingCompletion, true)); - - float baseRotation = new Vector2(aimDirection3D.X, aimDirection3D.Y).ToRotation(); - - // Hold the blade upwards if not firing. - if (CurrentState == SwingState.Swinging) - PostSwingRepositionDelay = 10f; - else if (PostSwingRepositionDelay > 0f) - PostSwingRepositionDelay--; - - float idealRotation = baseRotation; - - Owner.itemRotation = 0f; - Owner.heldProj = Projectile.whoAmI; - - idealRotation += MathHelper.PiOver4; - if (Direction == -1) - idealRotation += MathHelper.Pi; - - // Define rotation. - Projectile.rotation = Projectile.rotation.AngleTowards(idealRotation, swingSpeedInterpolant * 0.45f).AngleLerp(idealRotation, swingSpeedInterpolant * 0.2f); - - // 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; - Projectile.position += bladeOffset; - - // Create demon magic dust along the blade when swinging, as well as demon blood scythes. - if (PostSwingRepositionDelay >= 10f && CurrentState == SwingState.Swinging) - { - for (int i = 0; i < 2; i++) - { - Dust shadowflame = Dust.NewDustPerfect(Projectile.Center + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.width * Main.rand.NextFloat(0.4f), 27); - shadowflame.velocity = (Projectile.oldRot[0] - Projectile.oldRot[1]).ToRotationVector2() * Main.rand.NextFloat(4f, 10f); - shadowflame.velocity += (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 7.5f; - shadowflame.scale = Main.rand.NextFloat(1f, 1.5f); - shadowflame.fadeIn = 0.5f; - shadowflame.noGravity = true; - } - - if (Main.myPlayer == Projectile.owner && Owner.itemAnimation % 5 == 3 && Owner.itemAnimation < Owner.itemAnimationMax - 3) - { - Vector2 bloodScytheShootVelocity = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2(); - bloodScytheShootVelocity.Y *= 0.04f; - bloodScytheShootVelocity = bloodScytheShootVelocity.SafeNormalize(Vector2.UnitY) * 50f; - Vector2 bloodScytheSpawnPosition = Projectile.Center + bloodScytheShootVelocity.SafeNormalize(Vector2.UnitY) * 35f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), bloodScytheSpawnPosition, bloodScytheShootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.4f, Projectile.owner); - } - } - } - - public void DecideCurrentState() - { - // Switch to the swing state as necessary. - if (CurrentState == 0f && Owner.itemAnimation > 0 && PostSwingRepositionDelay <= 0f) - { - if (SwingDirection == 0f) - SwingDirection = 1f; - else - SwingDirection *= -1f; - - CurrentState = SwingState.Swinging; - } - - // Reset the state of the weapon if the player stops using it. - else if (Owner.itemAnimation <= 0) - { - Owner.itemAnimation = 0; - Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; - - CurrentState = SwingState.Default; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.EnterShaderRegion(); - - CalamityUtils.CalculatePerspectiveMatricies(out Matrix viewMatrix, out Matrix projectionMatrix); - - GameShaders.Misc["CalamityMod:LinearTransformation"].UseColor(Main.hslToRgb(0.95f, 0.85f, 0.5f)); - GameShaders.Misc["CalamityMod:LinearTransformation"].UseOpacity(0f); - GameShaders.Misc["CalamityMod:LinearTransformation"].Shader.Parameters["uWorldViewProjection"].SetValue(viewMatrix * projectionMatrix); - GameShaders.Misc["CalamityMod:LinearTransformation"].Shader.Parameters["localMatrix"].SetValue(new Matrix() - { - M11 = BladeHorizontalFactor, - M12 = 0f, - M21 = 0f, - M22 = 1f, - }); - 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; - } - - 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); - } - } -} diff --git a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs new file mode 100644 index 0000000000..377e46ab08 --- /dev/null +++ b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs @@ -0,0 +1,415 @@ +using System; +using System.IO; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class BladecrestOathswordThrownBlade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/BladecrestOathsword"; + + public int ChargeupTime => (int)MathHelper.Clamp(Owner.HeldItem.useTime / 2.8f, 1, 100); + public static int Lifetime = 100; + 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]; + + // Real variables here + public ref float time => ref Projectile.ai[0]; + public ref float stabOrder => ref Projectile.ai[1]; + public ref NPC stabbedTarget => ref Main.npc[(int)Projectile.ai[2]]; + + [Flags] + public enum State : byte + { + None = 0, + HasSpawned = 1, + Thrown = 2, + HitTarget = 4, + StuckInTarget = 8, + LeftTarget = 16, + StuckInGround = 32, + } + + public State CurrentState; + + public static int fadeOutTime = 60; + public int stuckTimer = 0; + public Vector2 impalePos; + public int bounces = 0; + public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime); + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.noEnchantmentVisuals = true; + } + + public override bool ShouldUpdatePosition() => ChargeProgress >= 1 && (CurrentState & (State.StuckInTarget | State.StuckInGround)) == 0; + + //Swing animation keys + public CurveSegment pullback = new(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, [pullback, throwout]); + + public override void AI() + { + if ((CurrentState & State.HasSpawned) == 0) + { + Projectile.timeLeft = Lifetime + ChargeupTime; + CurrentState |= State.HasSpawned; + } + + if ((CurrentState & State.HitTarget) != 0) + { + foreach (var target in Main.ActiveNPCs) + { + if ((CurrentState & State.LeftTarget) == 0 && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1), target.getRect())) + { + SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); + SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 3 }, Projectile.Center); + + Projectile.ai[2] = target.whoAmI; + + if (target.Calamity().demonSwordImpales < 0) + target.Calamity().demonSwordImpales = 0; + if (target.Calamity().demonSwordImpales >= 3) + { + float bladeValue = -1; + Projectile ejectedBlade = null; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.owner == Projectile.owner && projectile.type == Projectile.type && Projectile.localAI[0] != 5 && projectile.ai[2] == Projectile.ai[2] && projectile.timeLeft > (Lifetime - fadeOutTime) && (bladeValue == -1 || bladeValue > stabOrder)) + { + bladeValue = projectile.ai[1]; + ejectedBlade = projectile; + } + } + ejectedBlade.localAI[0] = 5; + ejectedBlade.ai[1] += 1000; + ejectedBlade.velocity = Projectile.velocity.RotatedByRandom(0.2f); + ejectedBlade.netUpdate = true; + ejectedBlade.netSpam = 0; + + for (int i = 0; i < 8; i++) + { + Particle spark2 = new SparkParticle(target.Center, Projectile.velocity.RotatedByRandom(0.6) * Main.rand.NextFloat(0.2f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.Red : Color.Crimson); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.4) * Main.rand.NextFloat(0.3f, 0.8f), 0, default, Main.rand.NextFloat(1.3f, 1.6f)); + dust.noGravity = true; + dust.noLight = true; + dust.color = Main.rand.NextBool(3) ? Color.Red : Color.Crimson; + } + } + target.Calamity().demonSwordImpales++; + + CurrentState |= State.StuckInTarget; + impalePos = Projectile.Center - stabbedTarget.Center; + stuckTimer = 3600; + break; + } + } + + CurrentState &= ~State.HitTarget; + } + + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = Color.Firebrick.ToVector3(); + Lighting.AddLight(Projectile.Center, Light * 0.5f); + + if (Projectile.timeLeft == Lifetime) + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.velocity = toMouse * 14; + Projectile.Center = Owner.MountedCenter + toMouse * 12f; + Projectile.spriteDirection = Projectile.direction; + CurrentState |= State.Thrown; + time = 0; + Projectile.extraUpdates = 1; + Projectile.tileCollide = true; + } + + if (Projectile.velocity.X > 0) + Projectile.direction = 1; + else + Projectile.direction = -1; + + if ((CurrentState & State.Thrown) != 0) + { + Projectile.spriteDirection = Projectile.direction; + if ((CurrentState & State.StuckInGround) == 0 && (CurrentState & State.LeftTarget) != 0) + Projectile.rotation += 0.35f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f) * Main.rand.NextFloat(0.7f, 1f) * Projectile.direction * Projectile.Opacity; + else + Projectile.rotation = (Projectile.velocity.ToRotation() + MathHelper.PiOver4 * (Projectile.direction == 1 ? 1 : 3)); + + if (time > fadeOutTime * 0.7f) + Projectile.velocity *= 0.93f; + + if ((CurrentState & State.StuckInTarget) != 0) + { + Projectile.tileCollide = false; + time--; + Projectile.timeLeft++; + if (stuckTimer > 0) + stuckTimer--; + else + { + Projectile.velocity *= 0.01f; + stabbedTarget.Calamity().demonSwordImpales--; + CurrentState &= ~State.StuckInTarget; + fadeOutEffect(); + } + + Projectile.Center = stabbedTarget.Center + impalePos; + if ((stabbedTarget.life <= 0) || stabbedTarget == null || Projectile.localAI[0] == 5 || !stabbedTarget.active) + { + Projectile.timeLeft = Lifetime; + stabbedTarget.Calamity().demonSwordImpales--; + CurrentState &= ~State.StuckInTarget; + CurrentState |= State.LeftTarget; + Projectile.tileCollide = true; + Projectile.rotation += Main.rand.NextFloat(-1.5f, 1.5f); + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.numHits = 0; + SoundStyle unstuck = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + SoundEngine.PlaySound(unstuck with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.3f, 0.4f), MaxInstances = 3 }, Projectile.Center); + } + } + + if ((CurrentState & State.LeftTarget) != 0 && (CurrentState & State.StuckInGround) == 0) + { + if (Projectile.velocity.Y < 14) + Projectile.velocity.Y += 0.1f * (bounces > 0 ? 4 : 1); + } + + if (fadingOut) + fadeOutEffect(); + } + + if (!fadingOut && (CurrentState & State.StuckInTarget) == 0 && (CurrentState & State.StuckInGround) == 0 && ChargeProgress >= 1) + { + for (int i = 0; i < 2; i++) + { + Vector2 safeVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + Vector2 dustVel = (CurrentState & State.LeftTarget) != 0 ? Vector2.One.RotatedByRandom(MathHelper.Pi) : safeVel.RotatedBy(MathHelper.ToRadians(105 * (i == 0 ? 1 : -1))).RotatedByRandom(0.1f) * Main.rand.NextFloat(3, 4); + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect( + Projectile.Center + safeVel.RotatedBy((CurrentState & State.LeftTarget) != 0 ? Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45) : 0) * ((CurrentState & State.LeftTarget) != 0 ? 45 : 60), + ModContent.DustType(), + dustVel, + 0, + default, + ((CurrentState & State.LeftTarget) != 0 ? 1.5f : 1) * Main.rand.NextFloat(0.8f, 0.9f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Red : Color.Crimson; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 100; + } + } + if (Main.rand.NextBool(5)) + { + Particle spark2 = new CustomSpark( + relativePosition: Projectile.Center, + velocity: -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), + texture: "CalamityMod/Particles/DemonSigilParticle", + affectedByGravity: false, + lifetime: 17, + scale: Main.rand.NextFloat(0.2f, 0.3f), + color: Color.Lerp(Color.Crimson, Color.Red, Main.rand.NextFloat(0, 0.7f)) * 0.6f, + stretch: new Vector2(1f, 1f), + extraRotation: Main.rand.NextFloat(-1f, 1f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + //Anticipation animation. Make the player look like they're holding the item + if (ChargeProgress < 1) + { + throwAnimation(); + if (ChargeProgress >= 0.6f && time == 0) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); + SoundEngine.PlaySound(swing with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + time++; + } + return; + } + else + time++; + } + + public void fadeOutEffect() + { + Projectile.tileCollide = false; + if (Projectile.timeLeft > Lifetime - fadeOutTime) + Projectile.timeLeft = Lifetime - fadeOutTime; + Projectile.Opacity = Utils.GetLerpValue(0, Lifetime - fadeOutTime, Projectile.timeLeft, true); + + Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Red : Color.Crimson; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 100; + dust.velocity += Projectile.velocity; + } + } + + public void throwAnimation() + { + Owner.ChangeDir(MathF.Sign(Owner.Calamity().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) * -45f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + CurrentState |= State.HitTarget; + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.4f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * ((CurrentState & State.LeftTarget) != 0 ? 1.15f : 1f); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if ((CurrentState & State.LeftTarget) != 0) + { + if (bounces >= 1) + { + impaleGround(oldVelocity); + } + 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.velocity.Length() < 8) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8; + Projectile.velocity.Y *= 0.85f; + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/CeramicImpact", 2) { Volume = 0.35f, Pitch = Main.rand.NextFloat(-0.4f, -0.5f) }, Projectile.Center); + bounces++; + Projectile.timeLeft = Lifetime; + } + } + else + { + impaleGround(oldVelocity); + } + + return false; + } + + public void impaleGround(Vector2 oldVelocity) + { + Projectile.velocity = oldVelocity; + CurrentState |= State.StuckInGround; + Projectile.timeLeft = (int)(Lifetime - fadeOutTime * 0.3f); + Projectile.tileCollide = false; + SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); + SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.2f, 0.3f), MaxInstances = 3 }, Projectile.Center); + } + + public override bool? CanDamage() + { + if (ChargeProgress < 1 || fadingOut || (CurrentState & State.StuckInGround) != 0 || (CurrentState & State.StuckInTarget) != 0 || (Projectile.numHits > 0 && (CurrentState & State.LeftTarget) == 0)) + return false; + + return base.CanDamage(); + } + + // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + => (Projectile.numHits <= 0 || (CurrentState & State.LeftTarget) != 0) && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1), targetHitbox); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/BladecrestOathsword").Value; + + float fadeScale = 1f - Projectile.Opacity; + for (int i = 0; i < 16; i++) + { + Color auraColor = Color.Crimson with { A = 0 } * 0.4f * fadeScale * Projectile.Opacity; + Vector2 drawOffset = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * 9f * fadeScale; + Main.EntitySpriteDraw( + centerTexture, + Projectile.Center - Main.screenPosition + drawOffset, + null, + auraColor, + Projectile.rotation, + centerTexture.Size() * 0.5f, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + + Main.EntitySpriteDraw(centerTexture, + Projectile.Center - Main.screenPosition, + null, + Color.Lerp(Color.Red with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, + Projectile.rotation, + centerTexture.Size() * 0.5f, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + return false; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write((byte)CurrentState); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + CurrentState = (State)reader.ReadByte(); + } + } +} diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 98223ec271..a4cc2fb971 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -25,10 +25,11 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.NoMeleeSpeedVelocityScaling[Projectile.type] = true; - Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.NoMeleeSpeedVelocityScaling[Type] = true; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -158,7 +159,7 @@ namespace CalamityMod.Projectiles.Melee bool hyperBlade = fullyVisibleDuration == DefiledGreatsword.ProjectileFullyVisibleDuration + DefiledGreatsword.ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile; bool sunlightBlade = fullyVisibleDuration == DefiledGreatsword.ProjectileFullyVisibleDuration + DefiledGreatsword.ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile * 2f; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Microsoft.Xna.Framework.Rectangle rectangle = asset.Frame(1, 4); Vector2 origin = rectangle.Size() / 2f; float num = Projectile.scale * 1.1f; diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index c0791c05b1..d87e1880b7 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; @@ -47,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; 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 ee996f3ebe..d7a37f148f 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; diff --git a/Projectiles/Melee/BloodScythe.cs b/Projectiles/Melee/BloodScythe.cs deleted file mode 100644 index 4d993b0a31..0000000000 --- a/Projectiles/Melee/BloodScythe.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BloodScythe : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 28; - Projectile.height = 28; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.075f / 255f); - - Projectile.velocity *= 0.935f; - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.1f; - Projectile.Opacity = Utils.GetLerpValue(1f, 6f, Projectile.velocity.Length(), true); - if (Projectile.Opacity <= 0f) - Projectile.Kill(); - - // Weakly home in on enemies. - NPC potentialTarget = Projectile.Center.ClosestNPCAt(540f); - if (potentialTarget != null && Projectile.timeLeft >= 480) - { - float flySpeed = Projectile.velocity.Length(); - if (flySpeed < 10f) - flySpeed = 10f; - - Projectile.Center = Projectile.Center.MoveTowards(potentialTarget.Center, 1.75f); - Projectile.velocity = (Projectile.velocity * 14f + Projectile.SafeDirectionTo(potentialTarget.Center) * flySpeed) / 15f; - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * flySpeed; - } - - if (Main.rand.NextBool(5)) - 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 = 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.AddBuff(BuffID.OnFire, 180); - } - } -} diff --git a/Projectiles/Melee/BloodScythe.png b/Projectiles/Melee/BloodScythe.png deleted file mode 100644 index 92f9025e5d..0000000000 Binary files a/Projectiles/Melee/BloodScythe.png and /dev/null differ diff --git a/Projectiles/Melee/BonebreakerFragment1.cs b/Projectiles/Melee/BonebreakerFragment1.cs index 87dd2545b2..06eaea7551 100644 --- a/Projectiles/Melee/BonebreakerFragment1.cs +++ b/Projectiles/Melee/BonebreakerFragment1.cs @@ -42,14 +42,21 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Venom, 60); - target.AddBuff(ModContent.BuffType(), 60); + //These projectiles are used for Fishbone Boomerang, and therefore should only inflict debuffs if they're from Bonebreaker + if (Projectile.DamageType == DamageClass.Melee) + { + target.AddBuff(BuffID.Venom, 60); + target.AddBuff(ModContent.BuffType(), 60); + } } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.Venom, 60); - target.AddBuff(ModContent.BuffType(), 60); + if (Projectile.DamageType == DamageClass.Melee) + { + target.AddBuff(BuffID.Venom, 60); + target.AddBuff(ModContent.BuffType(), 60); + } } } } diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 817f36b1d3..765c4831b3 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -60,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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; } @@ -89,14 +90,14 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.BoneJavelin, 180); + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Venom, 90); target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.BoneJavelin, 180); + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Venom, 90); target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Melee/BotanicSpear.cs b/Projectiles/Melee/BotanicSpear.cs index 94de7a4f18..f42ce6103b 100644 --- a/Projectiles/Melee/BotanicSpear.cs +++ b/Projectiles/Melee/BotanicSpear.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index aab7079a2a..8451bb0894 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -54,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 115) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/BrimlashProj.cs b/Projectiles/Melee/BrimlashProj.cs index ce54bdae0b..52d339417e 100644 --- a/Projectiles/Melee/BrimlashProj.cs +++ b/Projectiles/Melee/BrimlashProj.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 295) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/BrimstoneSwordProj.cs b/Projectiles/Melee/BrimstoneSwordProj.cs index 4a38898b22..c1b453c184 100644 --- a/Projectiles/Melee/BrimstoneSwordProj.cs +++ b/Projectiles/Melee/BrimstoneSwordProj.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 8d243f41f0..9f3f068b51 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -117,8 +117,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/Melee/BrinySpout.png b/Projectiles/Melee/BrinySpout.png index c2a07fcfb6..d404b3db93 100644 Binary files a/Projectiles/Melee/BrinySpout.png and b/Projectiles/Melee/BrinySpout.png differ diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index ad9261f9bd..3fbd52fcf1 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -10,9 +10,11 @@ namespace CalamityMod.Projectiles.Melee public class BrinyTyphoonBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "Terraria/Images/Projectile_385"; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() diff --git a/Projectiles/Melee/BrinyTyphoonBubble.png b/Projectiles/Melee/BrinyTyphoonBubble.png deleted file mode 100644 index 90a422dbd8..0000000000 Binary files a/Projectiles/Melee/BrinyTyphoonBubble.png and /dev/null differ diff --git a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs index 08f7b76c91..f8c734e346 100644 --- a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs +++ b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs @@ -2,6 +2,7 @@ using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -119,30 +120,23 @@ namespace CalamityMod.Projectiles.Melee public void Attune(BrokenBiomeBlade item) { - bool jungle = Owner.ZoneJungle; - bool snow = Owner.ZoneSnow; - bool evil = Owner.ZoneCorrupt || Owner.ZoneCrimson; - bool desert = Owner.ZoneDesert; - bool hell = Owner.ZoneUnderworldHeight; - bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur; + bool coldAttune = Owner.ZoneSnow || Owner.ZoneSkyHeight; + bool evilAttune = Owner.ZoneCorrupt || Owner.ZoneCrimson; + bool hotAttune = Owner.ZoneDesert || Owner.ZoneUnderworldHeight; - Attunement attunement = Attunement.attunementArray[(int)AttunementID.Default]; + Attunement attunement = AttunementSystem.FindOrNull(AttunementID.Default); - if (desert || hell) + if (hotAttune) { - attunement = Attunement.attunementArray[(int)AttunementID.Hot]; + attunement = AttunementSystem.FindOrNull(AttunementID.Hot); } - if (snow) + if (coldAttune) { - attunement = Attunement.attunementArray[(int)AttunementID.Cold]; + attunement = AttunementSystem.FindOrNull(AttunementID.Cold); } - if (jungle || ocean) + if (evilAttune) { - attunement = Attunement.attunementArray[(int)AttunementID.Tropical]; - } - if (evil) - { - attunement = Attunement.attunementArray[(int)AttunementID.Evil]; + attunement = AttunementSystem.FindOrNull(AttunementID.Evil); } //If the owner already had the attunement , break out of it (And unswap) @@ -182,7 +176,7 @@ namespace CalamityMod.Projectiles.Melee else if (ChanneledState == 1f) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 52e1b475a3..4164215be3 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs @@ -41,10 +41,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = BrokenBiomeBlade.HotAttunement_LocalIFrames; } - public override bool? CanDamage() - { - return Projectile.timeLeft <= 2; //Prevent spam click abuse - } + public override bool? CanDamage() => Projectile.timeLeft <= 2; // Prevent spam click abuse public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -59,9 +56,9 @@ namespace CalamityMod.Projectiles.Melee { if (CanPogo && Main.myPlayer == Owner.whoAmI) { - Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * pogoStrenght; //Bounce + Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * pogoStrenght; Owner.fallStart = (int)(Owner.position.Y / 16f); - PogoCooldown = 30; //Cooldown + PogoCooldown = 30; SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.position); Vector2 hitPosition = Owner.Center + (direction * 84 * Projectile.scale); @@ -92,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao + if (!initialized) // Play a sound on initialization { SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; @@ -111,25 +108,23 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); - //Manage position and rotation + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); Projectile.Center = Owner.Center + (direction * 60); - //Scaling based on shred - Projectile.localNPCHitCooldown = BrokenBiomeBlade.HotAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, BrokenBiomeBlade.HotAttunement_LocalIFrames - BrokenBiomeBlade.HotAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency - Projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER - + // Size scales based on shred + Projectile.scale = 1.33f + (ShredRatio * 1f); if (Collision.SolidCollision(Owner.Center + (direction * 84 * Projectile.scale) - Vector2.One * 5f, 10, 10)) { Pogo(); - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } - //Make the owner look like theyre holding the sword bla bla + // Make the owner look like they're holding the sword bla bla Owner.heldProj = Projectile.whoAmI; Owner.ChangeDir(Math.Sign(direction.X)); Owner.itemRotation = direction.ToRotation(); @@ -147,27 +142,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 2; } - //Since the iframes vary, adjust the damage to be consistent no matter the iframes. The true scaling happens between the BaseDamage and the FulLChargeDamage - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - float maxMultiplier = BrokenBiomeBlade.HotAttunement_FullChargeDamage / (float)BrokenBiomeBlade.HotAttunement_BaseDamage; - float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes - float damageReduction = Projectile.localNPCHitCooldown / (float)BrokenBiomeBlade.HotAttunement_LocalIFrames; - - modifiers.SourceDamage *= damageMultiplier * damageReduction; - } - - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - float maxMultiplier = BrokenBiomeBlade.HotAttunement_FullChargeDamage / (float)BrokenBiomeBlade.HotAttunement_BaseDamage; - float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes - float damageReduction = Projectile.localNPCHitCooldown / (float)BrokenBiomeBlade.HotAttunement_LocalIFrames; - - modifiers.SourceDamage *= damageMultiplier * damageReduction; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => ShredTarget(); public override void OnHitPlayer(Player target, Player.HurtInfo info) => ShredTarget(); @@ -175,17 +149,17 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer != Owner.whoAmI) return; - // get lifted up + // Get lifted up if (PogoCooldown <= 0) { - SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); //Sizzle - Shred += 62; //Augment the shredspeed + SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); // Sizzle + Shred += 62; // Augment the shred speed if (Owner.velocity.Y > 0) - Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly + Owner.velocity.Y = -2f; // Get "stuck" into the enemy partly // 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); + Owner.GiveUniversalIFrames(BrokenBiomeBlade.HotAttunement_ShredPlayerIFrames); PogoCooldown = 20; } @@ -211,17 +185,17 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - //Turn on additive blending + // Turn on additive blending Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - //Update the parameters + // Update the parameters drawOrigin = new Vector2(0f, blade.Height); drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 32f * Projectile.scale) - Main.screenPosition; Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - for (int i = 0; i < bladeAmount; i++) //Draw extra copies + for (int i = 0; i < bladeAmount; i++) // Draw extra copies { blade = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeurExtra").Value; @@ -233,13 +207,13 @@ namespace CalamityMod.Projectiles.Melee drawOrigin = new Vector2(0f, blade.Height); - Vector2 drawOffsetStraight = Owner.Center + direction * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 7) * 10 - Main.screenPosition; //How far from the player - Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly + Vector2 drawOffsetStraight = Owner.Center + direction * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 7) * 10 - Main.screenPosition; // How far from the player + Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); // How far perpendicularly Main.EntitySpriteDraw(blade, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); } - //Back to normal + // Back to normal 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/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index 89c1276071..e36d1e29dd 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -59,10 +59,8 @@ namespace CalamityMod.Projectiles.Melee public Player Owner => Main.player[Projectile.owner]; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 6; //The true trolling is that we only really use this for the third swing. - } + public override void SetStaticDefaults() => Main.projFrames[Type] = 6; //The true trolling is that we only really use this for the third swing. + public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -83,13 +81,13 @@ namespace CalamityMod.Projectiles.Melee switch (SwingMode) { case 0: - bladeLength = 90f * Projectile.scale; + bladeLength = 95f * Projectile.scale; break; case 1: - bladeLength = 110f * Projectile.scale; + bladeLength = 120f * Projectile.scale; break; case 2: - bladeLength = Projectile.frame <= 2 ? 85f : 150f; //Only use the extended hitbox after the blade actually extends. For realism. + bladeLength = Projectile.frame <= 2 ? 85f : 180f; //Only use the extended hitbox after the blade actually extends. For realism. bladeLength *= Projectile.scale; displace = direction * ThrustDisplaceRatio() * 60f; break; @@ -127,14 +125,14 @@ namespace CalamityMod.Projectiles.Melee break; } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Take the direction the sword is swung. FUCK not controlling the swing direction more than just left/right :| direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation @@ -153,23 +151,33 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Owner.Center + (direction * ThrustDisplaceRatio() * 60); Projectile.frameCounter++; - if (Projectile.frameCounter % 5 == 0 && Projectile.frame + 1 < Main.projFrames[Projectile.type]) + if (Projectile.frameCounter % 5 == 0 && Projectile.frame + 1 < Main.projFrames[Type]) Projectile.frame++; if (Main.rand.NextBool()) { - Particle mist = new MediumMistParticle(Owner.Center + direction * 40 + Main.rand.NextVector2Circular(30f, 30f), Vector2.Zero, new Color(172, 238, 255), new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f); + Color initialColor = Color.Lerp(new Color(172, 238, 255), new Color(230, 172, 255), Main.rand.NextFloat(1f));; + Particle mist = new MediumMistParticle(Owner.Center + direction * 40 + Main.rand.NextVector2Circular(30f, 30f), Vector2.Zero, initialColor, new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f); mist.Velocity = (mist.Position - Owner.Center) * 0.2f + Owner.velocity; GeneralParticleHandler.SpawnParticle(mist); } } - else if (Main.rand.NextFloat(0f, 1f) > 0.75f) + else if (Main.rand.NextFloat(0f, 1f) > 0.6f) { Vector2 particlePosition = Owner.Center + (rotation.ToRotationVector2() * 100f * Projectile.scale); - Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); - GeneralParticleHandler.SpawnParticle(snowflake); + if (Main.rand.NextBool()) + { + Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + else + { + float scale = Main.rand.NextFloat(0.5f, 1.8f); + Particle star = new CritSpark(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, Color.Indigo, scale, 30, 0.5f, scale * 2f); + GeneralParticleHandler.SpawnParticle(star); + } } //Make the owner look like theyre holding the sword bla bla diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index 805df34b78..0022918305 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -54,6 +54,7 @@ namespace CalamityMod.Projectiles.Melee { CanBounce = 1f; Projectile.timeLeft = (int)MaxTime; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); @@ -61,8 +62,7 @@ namespace CalamityMod.Projectiles.Melee Lunge(); SoundEngine.PlaySound(SoundID.Item103, Projectile.Center); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation @@ -94,22 +94,18 @@ namespace CalamityMod.Projectiles.Melee private void OnHitEffects(bool cannotLifesteal) { - Projectile.netUpdate = true; - Projectile.netSpam = 0; - + Projectile.ForceNetUpdate(); if (Main.myPlayer != Owner.whoAmI || CanBounce == 0f) return; - if (!cannotLifesteal) //trolled { - Owner.statLife += BrokenBiomeBlade.EvilAttunement_Lifesteal; - Owner.HealEffect(BrokenBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck + Owner.HealPlayer(BrokenBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck } // Bounce off - float bounceStrength = Math.Max((LungeSpeed / 2f), Owner.velocity.Length()); + float bounceStrength = LungeSpeed / 2f; 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; diff --git a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs deleted file mode 100644 index ce446cb580..0000000000 --- a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs +++ /dev/null @@ -1,263 +0,0 @@ -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 Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - - -namespace CalamityMod.Projectiles.Melee -{ - public class GrovetendersTouch : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchBlade"; - private bool initialized = false; - public Player Owner => Main.player[Projectile.owner]; - public float Timer => MaxTime - Projectile.timeLeft; - public ref float HasSnapped => ref Projectile.ai[0]; - public ref float SnapCoyoteTime => ref Projectile.ai[1]; - public ref float Reach => ref Projectile.localAI[0]; - - const float MaxTime = 90; - const int coyoteTimeFrames = 15; //How many frames does the whip stay extended - const int MaxReach = 400; - const int MinReach = 300; - const float SnappingPoint = 0.7f; //When does the snap occur. - const float ReelBackStrenght = 14f; - - public BezierCurve curve; - private Vector2 controlPoint1; - private Vector2 controlPoint2; - internal bool ReelingBack => Timer / MaxTime > SnappingPoint; - - public override void SetStaticDefaults() - { - } - public override void SetDefaults() - { - Projectile.DamageType = DamageClass.Melee; - Projectile.width = Projectile.height = 36; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.extraUpdates = 2; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = BrokenBiomeBlade.TropicalAttunement_LocalIFrames; - } - - public override bool? CanCutTiles() => false; //Itd be quite counterproductive to make the whip cut the tiles it just grew - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - BezierCurve curve = new BezierCurve(new Vector2[] { Owner.MountedCenter, controlPoint1, controlPoint2, Projectile.Center }); - - int numPoints = 32; - Vector2[] chainPositions = curve.GetPoints(numPoints).ToArray(); - float collisionPoint = 0; - for (int i = 1; i < numPoints; i++) - { - Vector2 position = chainPositions[i]; - Vector2 previousPosition = chainPositions[i - 1]; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), position, previousPosition, 6, ref collisionPoint)) - return true; - } - return base.Colliding(projHitbox, targetHitbox); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - base.ModifyHitNPC(target, ref modifiers); - Vector2 projectileHalfLength = (Projectile.Size / 2f) * Projectile.rotation.ToRotationVector2(); - float collisionPoint = 0; - //If you hit the enemy during the coyote time with the blade of the whip, guarantee a crit & get some bonus damage - if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLength, Projectile.Center + projectileHalfLength, 32, ref collisionPoint)) - { - if (SnapCoyoteTime > 0f) - { - modifiers.SourceDamage *= BrokenBiomeBlade.TropicalAttunement_SweetSpotDamageMultiplier; - modifiers.SetCrit(); - for (int i = 0; i < 3; i++) - { - Vector2 sparkSpeed = Owner.DirectionTo(target.Center).RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * 9f; - Particle Spark = new CritSpark(target.Center, sparkSpeed, Color.White, Color.LimeGreen, 1f + Main.rand.NextFloat(0, 1f), 30, 0.4f, 0.6f); - GeneralParticleHandler.SpawnParticle(Spark); - } - } - } - else - modifiers.SourceDamage *= BrokenBiomeBlade.TropicalAttunement_ChainDamageReduction; //If the enemy is hit with the chain of the whip, the damage gets reduced - } - - public override void AI() - { - if (!initialized) //Initialization. create control points & shit) - { - Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach); - SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); - controlPoint1 = Projectile.Center; - controlPoint2 = Projectile.Center; - Projectile.timeLeft = (int)MaxTime; - initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } - - if (ReelingBack && HasSnapped == 0f) //Snap & also small coyote time for the hook - { - SoundEngine.PlaySound(SoundID.Item41, Projectile.Center); //Snap - HasSnapped = 1f; - SnapCoyoteTime = coyoteTimeFrames; - } - - if (SnapCoyoteTime > 0) //keep checking for the tile hook - { - Lighting.AddLight(Projectile.Center, 0.8f, 1f, 0.35f); - HookToTile(); - SnapCoyoteTime--; - } - - Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); - Projectile.rotation = Projectile.AngleFrom(Owner.Center); //Point away from playah - - float ratio = GetSwingRatio(); - Projectile.Center = Owner.MountedCenter + SwingPosition(ratio); - Projectile.direction = Projectile.spriteDirection = -Owner.direction; - - Owner.itemRotation = MathHelper.WrapAngle(Owner.AngleTo(Owner.Calamity().mouseWorld) - (Owner.direction < 0 ? MathHelper.Pi : 0)); - } - public void HookToTile() - { - if (Main.myPlayer == Owner.whoAmI) - { - //Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground) - if (Collision.SolidCollision(Projectile.position, 32, 32) && (Owner.velocity.Y != 0 || Projectile.position.Y < Owner.position.Y)) - { - Owner.velocity = Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero) * ReelBackStrenght; - SnapCoyoteTime = 0f; - } - SoundEngine.PlaySound(SoundID.Item65, Projectile.position); - } - } - - internal float EaseInFunction(float progress) => progress == 0 ? 0f : (float)Math.Pow(2, 10 * progress - 10); //Potion seller i need your strongest easeIns - - private float GetSwingRatio() - { - float ratio = (Timer - SnappingPoint * MaxTime) / (MaxTime * (1 - SnappingPoint)); //The ratio for the last section of the snap is a new curve. - if (!ReelingBack) - ratio = EaseInFunction(Timer / (MaxTime * SnappingPoint)); //Watch this ratio get eased - if (SnapCoyoteTime > 0) - ratio = 0f; - return ratio; - } - - private Vector2 SwingPosition(float progress) - { - //Whip windup and snap part - if (!ReelingBack) - { - float distance = Reach * MathHelper.Lerp((float)Math.Sin(progress * MathHelper.PiOver2), 1, 0.04f); //half arc - distance = Math.Max(distance, 65); //Dont be too close to player - - float angleDeviation = MathHelper.Pi / 1.2f; - float angleOffset = Owner.direction * MathHelper.Lerp(-angleDeviation, 0, progress); //Go from very angled to straight at the zenith of the attack - return Projectile.velocity.RotatedBy(angleOffset) * distance; - } - else - { - float distance = MathHelper.Lerp(Reach, 0f, progress); //Quickly zip back to the player . No angles or minimum distance from player. - return Projectile.velocity * distance; - } - } - - public override bool PreDraw(ref Color lightColor) - { - if (Timer == 0) - return false; - Texture2D handle = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchBlade").Value; - Texture2D blade = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchGlow").Value; - - Vector2 projBottom = Projectile.Center + new Vector2(-handle.Width / 2, handle.Height / 2).RotatedBy(Projectile.rotation + MathHelper.PiOver4) * 0.75f; - DrawChain(projBottom, out Vector2[] chainPositions); - - float drawRotation = (projBottom - chainPositions[^2]).ToRotation() + MathHelper.PiOver4; //Face away from the last point of the bezier curve - drawRotation += SnapCoyoteTime > 0 ? MathHelper.Pi : 0; //During coyote time the blade flips for some reason. Prevent that from happening - drawRotation += Projectile.spriteDirection < 0 ? 0f : 0f; - - Vector2 drawOrigin = new Vector2(0f, handle.Height); - SpriteEffects flip = (Projectile.spriteDirection < 0) ? SpriteEffects.None : SpriteEffects.None; - lightColor = Lighting.GetColor((int)(Projectile.Center.X / 16f), (int)(Projectile.Center.Y / 16f)); - - Main.EntitySpriteDraw(handle, projBottom - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0); - - //Turn on additive blending - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - //Only update the origin for once - drawOrigin = new Vector2(0f, blade.Height); - Main.EntitySpriteDraw(blade, projBottom - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, flip, 0); - //Back to normal - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - return false; - } - - private void DrawChain(Vector2 projBottom, out Vector2[] chainPositions) - { - Texture2D chainTex = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchChain").Value; - - float ratio = GetSwingRatio(); - - if (!ReelingBack) //Make the curve be formed from points slightly ahead of the projectile, but clamped to the max rotation (straight line ahead) - { - controlPoint1 = Owner.MountedCenter + SwingPosition(MathHelper.Clamp(ratio + 0.5f, 0f, 1f)) * 0.2f; - controlPoint2 = Owner.MountedCenter + SwingPosition(MathHelper.Clamp(ratio + 0.2f, 0f, 1f)) * 0.5f; - } - else //After the whip snaps, make the curve be a wave - { - Vector2 perpendicular = SwingPosition(ratio).SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2); - controlPoint1 = Owner.MountedCenter + SwingPosition(MathHelper.Lerp(ratio, 1f, ratio)) + perpendicular * MathHelper.SmoothStep(0f, 1f, ratio) * -155f; - controlPoint2 = Owner.MountedCenter + SwingPosition(MathHelper.Lerp(ratio, 1f, ratio / 2)) + perpendicular * MathHelper.SmoothStep(0f, 1f, ratio) * 100f; - } - - BezierCurve curve = new BezierCurve(new Vector2[] { Owner.MountedCenter, controlPoint1, controlPoint2, projBottom }); - int numPoints = 30; //"Should make dynamic based on curve length, but I'm not sure how to smoothly do that while using a bezier curve" -Graydee, from the code i referenced. I do agree. - chainPositions = curve.GetPoints(numPoints).ToArray(); - - //Draw each chain segment bar the very first one - for (int i = 1; i < numPoints; i++) - { - Vector2 position = chainPositions[i]; - float rotation = (chainPositions[i] - chainPositions[i - 1]).ToRotation() - MathHelper.PiOver2; //Calculate rotation based on direction from last point - float yScale = Vector2.Distance(chainPositions[i], chainPositions[i - 1]) / chainTex.Height; //Calculate how much to squash/stretch for smooth chain based on distance between points - Vector2 scale = new Vector2(1, yScale); - Color chainLightColor = Lighting.GetColor((int)position.X / 16, (int)position.Y / 16); //Lighting of the position of the chain segment - if (ReelingBack) - chainLightColor *= 1 - EaseInFunction(ratio); //Make the chain fade when reeling it back - Vector2 origin = new Vector2(chainTex.Width / 2, chainTex.Height); //Draw from center bottom of texture - Main.EntitySpriteDraw(chainTex, position - Main.screenPosition, null, chainLightColor, rotation, origin, scale, SpriteEffects.None, 0); - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(initialized); - writer.Write(Reach); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - initialized = reader.ReadBoolean(); - Reach = reader.ReadSingle(); - } - } -} diff --git a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs new file mode 100644 index 0000000000..2f5da2023e --- /dev/null +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -0,0 +1,146 @@ +using CalamityMod.Items.Weapons.Melee; +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; + +namespace CalamityMod.Projectiles.Melee +{ + public class PureClarity : BaseCustomUseStyleProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override int AssignedItemID => ModContent.ItemType(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/BrokenBiomeBlade"; + public override float HitboxOutset => 50f; + public override Vector2 HitboxSize => new Vector2(48, 48); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override Vector2 SpriteOrigin => new(-5, 40); + + public ref float SwingDir => ref Projectile.ai[1]; + public Vector2 mousePos; + public Vector2 aimPos; + public bool doSwing = true; + public bool postSwing = false; + public int useAnimation; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.scale = 1.25f; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void WhenSpawned() + { + SwingDir = 1f; + mousePos = Owner.Calamity().mouseWorld; + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnimation = Owner.itemAnimationMax; + + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + if (CanHit || postSwing) + mousePos = Owner.Center - aimPos; + else + mousePos = Owner.Calamity().mouseWorld; + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + mousePos = Owner.Calamity().mouseWorld; + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + } + else + { + if (!CanHit && !postSwing) + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + else + Owner.direction = ((Owner.Center - aimPos).X < Owner.Center.X) ? -1 : 1; + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + + if (AnimationProgress < (useAnimation / 3)) + { + // Swing wind-up. Should not deal damage. + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + SwingDir = -SwingDir; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * SwingDir * Owner.direction), 0.2f); + } + else + { + float swingTime = AnimationProgress - (useAnimation / 3); + float swingTimeMax = useAnimation - (useAnimation / 3); + + if (swingTime > (int)(swingTimeMax * 0.2f) && swingTime < (int)(swingTimeMax * 0.85f)) + { + CanHit = true; + + // Particle effects on swing. + Vector2 particleVel = new Vector2(0, 10 * -SwingDir * Owner.direction).RotatedBy(FinalRotation - MathHelper.PiOver4); + Vector2 particlePos = Owner.Center + new Vector2(Main.rand.Next(0, 80), 0).RotatedBy(FinalRotation - MathHelper.PiOver4); + Color particleColor = (Owner.HeldItem.ModItem as BrokenBiomeBlade).mainAttunement.tooltipColor; + if (Main.rand.NextBool()) + { + GenericBloom bloom = new(particlePos, particleVel, particleColor, 0.08f, 20); + GeneralParticleHandler.SpawnParticle(bloom); + } + else + { + GenericSparkle sparkle = new(particlePos, particleVel, particleColor, particleColor, 0.55f, 20); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + else + CanHit = false; + + // Fire projectiles. + if (swingTime == (int)(swingTimeMax * 0.4f)) + { + SoundEngine.PlaySound(SoundID.Item43 with { Volume = 0.65f }, Projectile.Center); + Vector2 projVel = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX) * 14.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, projVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI); + } + + RotationOffset = MathHelper.Lerp(RotationOffset, + MathHelper.ToRadians(MathHelper.Lerp(150f * SwingDir * Owner.direction, 120f * -SwingDir * Owner.direction, CalamityUtils.ExpInOutEasing(swingTime / swingTimeMax, 1))), + 0.2f); + + if (swingTime >= swingTimeMax) + doSwing = false; + if (swingTime < (int)(swingTimeMax * 0.7f)) + postSwing = true; + } + } + + // Make the player's arms rotate. + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs index cf1ff9c56c..5c924c1b88 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs @@ -10,15 +10,15 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class PurityProjection : ModProjectile, ILocalizedModType //The boring plain one + public class PurityProjection : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_PurityProjection"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 40; + Projectile.timeLeft = 45; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; } @@ -50,13 +50,12 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 35) return false; - DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int i = 0; i <= 15; i++) { Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; @@ -66,10 +65,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int debuffTime = 90; - target.AddBuff(BuffType(), debuffTime); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffType(), 90); } } diff --git a/Projectiles/Melee/BurningHolyBlast.cs b/Projectiles/Melee/BurningHolyBlast.cs new file mode 100644 index 0000000000..bf2e0d5981 --- /dev/null +++ b/Projectiles/Melee/BurningHolyBlast.cs @@ -0,0 +1,40 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BurningHolyBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private float ExplosionRadius = 170f; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 200; + Projectile.height = 200; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 240); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.97f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius * Projectile.ai[0], targetHitbox); + } +} diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 9602d219c3..61dafb5b13 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 175) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/CatastropheClaymoreSparkle.cs b/Projectiles/Melee/CatastropheClaymoreSparkle.cs deleted file mode 100644 index 01a6f6e2b0..0000000000 --- a/Projectiles/Melee/CatastropheClaymoreSparkle.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CatastropheClaymoreSparkle : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public ref float ProjectileType => ref Projectile.ai[0]; - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 80; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - int dustType = (ProjectileType == 2f ? 57 : ProjectileType == 1f ? 56 : 73); // Frostbite, Ichor, Hellfire respectively - for (int i = 0; i < 3; i++) - { - Dust trail = Dust.NewDustPerfect(Projectile.Center, dustType); - trail.noGravity = true; - trail.scale = 1.35f; - trail.velocity = Projectile.velocity * 0.5f; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - switch (ProjectileType) - { - case 1f: - target.AddBuff(BuffID.Frostburn2, 90); - break; - case 2f: - target.AddBuff(BuffID.Ichor, 60); - break; - default: - target.AddBuff(BuffID.OnFire3, 120); - break; - } - } - - public override void OnKill(int timeLeft) - { - int dustType = (ProjectileType == 2f ? 57 : ProjectileType == 1f ? 56 : 73); // Frostbite, Ichor, Hellfire respectively - float effectiveVelocity = Projectile.velocity.Length() * Projectile.MaxUpdates; - for (int i = 0; i < 60; i++) - { - Dust boom = Dust.NewDustPerfect(Projectile.Center, dustType); - boom.noGravity = true; - boom.scale = Main.rand.NextFloat(0.8f, 1.7f); - boom.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 6f) * Main.rand.NextFloat(-2.4f, -1.2f) * effectiveVelocity; - } - } - } -} diff --git a/Projectiles/Melee/CausticEdgeProjectile.cs b/Projectiles/Melee/CausticEdgeProjectile.cs index 82ae873f32..bbf1077d4e 100644 --- a/Projectiles/Melee/CausticEdgeProjectile.cs +++ b/Projectiles/Melee/CausticEdgeProjectile.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/CometQuasherGhost.png b/Projectiles/Melee/CometQuasherGhost.png new file mode 100644 index 0000000000..0c274c615a Binary files /dev/null and b/Projectiles/Melee/CometQuasherGhost.png differ diff --git a/Projectiles/Melee/CometQuasherHoldout.cs b/Projectiles/Melee/CometQuasherHoldout.cs new file mode 100644 index 0000000000..ab6c6ec2b2 --- /dev/null +++ b/Projectiles/Melee/CometQuasherHoldout.cs @@ -0,0 +1,262 @@ +using System; +using CalamityMod.Items.Weapons.Melee; +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.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CometQuasherHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/CometQuasher"; + public override float HitboxOutset => 90; + + public override Vector2 HitboxSize => new Vector2(110, 110); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(-5, 96); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public bool spawnBoom = true; + public bool finalFlip = false; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void WhenSpawned() + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = -1; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Comet Quasher's projectile spawning + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X < 0 ? true : false; + } + + public override void UseStyle() + { + AnimationProgress = Animation % useAnim; + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; + doSwing = true; + swingCount++; + spawnBoom = true; + finalFlip = false; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians((Owner.direction == -1 ? 0 : 120)), 0.1f); + + if (AnimationProgress < (useAnim / 3)) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + //Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = RotationOffset.AngleLerp(MathHelper.ToRadians(-45f * Projectile.ai[1] * Owner.direction), 0.2f); + } + else + { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0 ? true : false; + } + + float time = (AnimationProgress) - (useAnim / 8); + float timeMax = useAnim - (useAnim / 8); + + if (time == (int)(timeMax * 0.3f)) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/TerratomereSwing"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.75f, 0.85f) }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(fire2 with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.25f, 0.35f) }, Projectile.Center); + } + if ( time > (int)(timeMax * 0.25f) && time < (int)(timeMax * 0.85f)) + { + CanHit = true; + } + else + CanHit = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(-45f * Projectile.ai[1] * Owner.direction, 405f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.85f)) + postSwing = true; + } + if (CanHit) + { + for (int i = 0; i < 4; i++) + { + Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos2 = Owner.Center + (new Vector2(Main.rand.Next(80, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + if (i % 2 == 0) + { + Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f), 0.2f, 23); + GeneralParticleHandler.SpawnParticle(orb); + } + else + { + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos2, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 23, Main.rand.NextFloat(0.3f, 0.7f), 0.75f, 0, true)); + } + } + + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(120, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? Color.AliceBlue : Color.DodgerBlue; + } + else if (Main.rand.NextBool(3)) + { + Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f), 0.2f, 23); + GeneralParticleHandler.SpawnParticle(orb); + + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(75, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? Color.AliceBlue : Color.DodgerBlue; + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + SoundStyle fire = new("CalamityMod/Sounds/Item/CursedDaggerThrow"); + SoundEngine.PlaySound(fire with { Volume = 0.65f, Pitch = 0.8f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(fire2 with { Volume = 0.55f, Pitch = 0.7f }, Projectile.Center); + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 7, true); + + for (int i = 0; i < MathHelper.Clamp(6 - Projectile.numHits * 2, 2, 6); i++) + { + Particle spark2 = new CustomSpark(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -24).RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/Sparkle", false, 35, Main.rand.NextFloat(0.3f, 1f), Color.DodgerBlue, new Vector2(0.6f, 1.5f)); + GeneralParticleHandler.SpawnParticle(spark2); + if (Main.rand.NextBool(3)) + { + Particle spark3 = new CustomSpark(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -24).RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/Sparkle", false, 35, Main.rand.NextFloat(0.3f, 1f), Color.AliceBlue, new Vector2(0.6f, 1.5f)); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + + if (spawnBoom) + { + Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0, Projectile.owner, 0, 0, 4); + spawnBoom = false; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/CometQuasherGlow"); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + + for (int i = 0; i < 25; i++) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherGhost").Value; + Color auraColor = Color.DodgerBlue with { A = 0 } * 0.15f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 5 * fadeIn; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index a4649464c0..f9ab862f37 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -1,7 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; +using Terraria.Graphics.Renderers; using Terraria.ID; using Terraria.ModLoader; @@ -10,95 +14,126 @@ namespace CalamityMod.Projectiles.Melee public class CometQuasherMeteor : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - + public ref float time => ref Projectile.ai[0]; + public Color mainColor = Color.DodgerBlue; + public int fallTime = 60; + public NPC chosenTarget; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } - public override void SetDefaults() { Projectile.width = 24; Projectile.height = 24; - Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; - Projectile.extraUpdates = 2; - AIType = ProjectileID.Meteor1; + Projectile.timeLeft = 800; + Projectile.penetrate = 1; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Projectile.Center.Y > Projectile.ai[2]) - Projectile.tileCollide = true; - else - Projectile.tileCollide = false; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (time % 5 == 0 && Projectile.extraUpdates < 12) + Projectile.extraUpdates++; + if (time == 0) + { + chosenTarget = Owner.ClampedMouseWorld().ClosestNPCAt(700); + if (chosenTarget != null) + Projectile.velocity = (chosenTarget.Center - Projectile.Center + chosenTarget.velocity * 8).SafeNormalize(Vector2.UnitX) * 3; + else + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 3; + } + } + if (Projectile.numHits < 1) + { + if (chosenTarget == null || chosenTarget.life <= 0) + chosenTarget = Owner.ClampedMouseWorld().ClosestNPCAt(700); + CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 0.08f, 5, 0.99f, accelerate: true); + } + + if (targetDist < 1400f) + { + if (time % 11 == 0) + { + GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * 2, false, 11, 0.03f, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); + GeneralParticleHandler.SpawnParticle(orb); + } + if (time % 4 == 0) + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 6, Main.rand.NextFloat(0.4f, 0.9f), 0.65f, 0, true)); + } + if (Main.rand.NextBool(13)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), 278, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 3)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? Color.AliceBlue : Color.DodgerBlue; + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + time++; } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Projectile.Calamity().lineColor == 1) tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor2").Value; if (Projectile.Calamity().lineColor == 2) tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor3").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, tex); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1, tex); return false; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.2f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + Projectile.netUpdate = true; + } public override void OnKill(int timeLeft) { + Projectile.netUpdate = true; + Player Owner = Main.player[Projectile.owner]; SoundEngine.PlaySound(SoundID.Item89, Projectile.position); - Projectile.ExpandHitboxBy((int)(128f * Projectile.scale)); - - for (int i = 0; i < 8; ++i) - 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) + if (Projectile.ai[2] > 0) { - 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(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) - { - int fieryDust = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position + new Vector2((float)(Projectile.width * Main.rand.Next(100)) / 100f, (float)(Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[fieryDust]; - gore.velocity *= 0.3f; - gore.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; - gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; - } + Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); } if (Projectile.owner == Main.myPlayer) { - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.localAI[1] = -1f; - Projectile.maxPenetrate = 0; + Projectile.damage = (int)(Projectile.damage * 0.7f); + Projectile.ExpandHitboxBy((int)(128f * Projectile.scale)); + Projectile.penetrate = -1; Projectile.Damage(); } - - for (int j = 0; j < 5; ++j) + for (int i = 0; i < 13; i++) { - 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; - dust1.scale += Main.rand.NextFloat(); + Particle spark3 = new GlowOrbParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 9), false, 20, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(5) ? Color.AliceBlue : Color.DodgerBlue, true, false, false); + GeneralParticleHandler.SpawnParticle(spark3); } + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.3f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); } + public override bool? CanCutTiles() => false; } } diff --git a/Projectiles/Melee/CosmicBolt.cs b/Projectiles/Melee/CosmicBolt.cs index 7aadbb2336..d0f6300fad 100644 --- a/Projectiles/Melee/CosmicBolt.cs +++ b/Projectiles/Melee/CosmicBolt.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index 8e0c8da37d..df46b60a8a 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Color colorAtCenter = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); - if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) + if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Type]) { colorAtCenter = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); } @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Player player = Main.player[Projectile.owner]; - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 60); if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 56788a64b3..997501b309 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[1] += 0.01f; Projectile.scale = Projectile.ai[1]; Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= (float)(3 * Main.projFrames[Projectile.type])) + if (Projectile.ai[0] >= (3 * Main.projFrames[Type])) { Projectile.Kill(); return; @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee if (++Projectile.frameCounter >= 3) { Projectile.frameCounter = 0; - if (++Projectile.frame >= Main.projFrames[Projectile.type]) + if (++Projectile.frame >= Main.projFrames[Type]) { Projectile.hide = true; } @@ -100,13 +100,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - 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)); - if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) + Color colorArea = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5f) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5f) / 16)); + if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Type]) { colorArea = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); } - Texture2D texture2D33 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle rectangl = texture2D33.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture2D33 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle rectangl = texture2D33.Frame(1, Main.projFrames[Type], 0, Projectile.frame); return true; } @@ -115,16 +115,18 @@ namespace CalamityMod.Projectiles.Melee return new Color(150, Main.DiscoG, 255, 127); }*/ + // Only inflict Voidfrost if not spawned from Icebreaker public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 420); + if (Projectile.ai[2] != 1f) + target.AddBuff(ModContent.BuffType(), 420); Projectile.direction = Main.player[Projectile.owner].direction; } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(ModContent.BuffType(), 420); + if (Projectile.ai[2] != 1f) + target.AddBuff(ModContent.BuffType(), 420); Projectile.direction = Main.player[Projectile.owner].direction; } } diff --git a/Projectiles/Melee/CosmicOrb.cs b/Projectiles/Melee/CosmicOrb.cs index 857eb8bb36..74cf39e096 100644 --- a/Projectiles/Melee/CosmicOrb.cs +++ b/Projectiles/Melee/CosmicOrb.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -49,8 +53,41 @@ namespace CalamityMod.Projectiles.Melee } } - if (Main.rand.NextBool(2)) - CalamityUtils.MagnetSphereHitscan(Projectile, 500f, 6f, 8f, 5, ModContent.ProjectileType()); + //if (Main.rand.NextBool(2)) + //CalamityUtils.MagnetSphereHitscan(Projectile, 500f, 6f, 8f, 5, ModContent.ProjectileType()); + int chance = 24 * Projectile.MaxUpdates; + if (Main.rand.NextBool(chance)) + { + int MaxLaserCountPerShot = 5; + int targetCount = 0; + List targets = Main.npc.Where(npc => + { + return npc.active && Projectile.Distance(npc.Center) < 500 && npc.CanBeChasedBy(); + }).ToList(); + foreach (var target in targets) + { + if (targetCount >= MaxLaserCountPerShot) + break; + Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, + Vector2.Zero, + ModContent.ProjectileType(), + (int)(Projectile.damage * 0.8f), + Projectile.knockBack, + Projectile.owner, + target.whoAmI); + laser.ArmorPenetration = 100; + + Vector2 start = Projectile.Center; + Vector2 end = target.Center; + Color color = Main.rand.NextBool() ? Color.Magenta : Color.HotPink; + + Vector2 lerpVel = Vector2.Lerp(start, end, 0.5f); + float scale = 0.015f; + Particle spark = new CustomSpark(lerpVel, Projectile.SafeDirectionTo(target.Center), "CalamityMod/Particles/BloomLineThick", false, 14, scale, color * 0.75f, new Vector2(1, (Utils.Distance(start, end) * 0.034f)), true, false, shrinkSpeed: 0.25f, glowOpacity: 0.65f); + GeneralParticleHandler.SpawnParticle(spark); + targetCount++; + } + } } public override void OnKill(int timeLeft) @@ -77,10 +114,11 @@ namespace CalamityMod.Projectiles.Melee dust.scale = 0.7f; } } - - public override Color? GetAlpha(Color lightColor) + public override bool PreDraw(ref Color lightColor) { - return new Color(200 - Projectile.alpha, 200 - Projectile.alpha, 200 - Projectile.alpha, 200 - Projectile.alpha); + Color drawColor = Color.HotPink; + Projectile.DrawProjectileWithBackglow(drawColor with { A = 0 }, Color.White, 2.5f * Main.rand.NextFloat(0.8f, 1.3f)); + return false; } } } diff --git a/Projectiles/Melee/CosmicShivBlade.cs b/Projectiles/Melee/CosmicShivBlade.cs index 5ae1c83de6..074d2769c8 100644 --- a/Projectiles/Melee/CosmicShivBlade.cs +++ b/Projectiles/Melee/CosmicShivBlade.cs @@ -17,8 +17,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Melee/CosmicShivTrail.cs b/Projectiles/Melee/CosmicShivTrail.cs index df703c0e46..daf2e988d4 100644 --- a/Projectiles/Melee/CosmicShivTrail.cs +++ b/Projectiles/Melee/CosmicShivTrail.cs @@ -1,20 +1,12 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; using Terraria; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using System.Collections.Generic; -using System.Security.Cryptography.X509Certificates; -using System.Reflection.Metadata; -using Microsoft.Xna.Framework.Graphics; -using System.Diagnostics.Contracts; -using Terraria.GameContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -38,6 +30,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailCacheLength[Type] = 15; ProjectileID.Sets.TrailingMode[Type] = 2; } @@ -136,11 +129,8 @@ namespace CalamityMod.Projectiles.Melee if (dist <= radius) { int damage = (int)(Projectile.damage * ExplosionDamageMultiplier); - bool crit = Main.rand.Next(100) <= owner.GetCritChance() + 4; - target.StrikeNPC(target.CalculateHitInfo(damage, 0, crit, 0)); - - if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, target.whoAmI, damage, 0f, 0f, crit ? 1 : 0, 0, 0); + Projectile something = Projectile.NewProjectileDirect(owner.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, owner.whoAmI, target.whoAmI); + something.DamageType = DamageClass.Melee; } } } diff --git a/Projectiles/Melee/CosmicSpiritBomb.cs b/Projectiles/Melee/CosmicSpiritBomb.cs new file mode 100644 index 0000000000..486c45d924 --- /dev/null +++ b/Projectiles/Melee/CosmicSpiritBomb.cs @@ -0,0 +1,105 @@ +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 CosmicSpiritBomb : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetDefaults() + { + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 150; + Projectile.DamageType = DamageClass.Melee; + } + + public override void AI() + { + float scaleModd = (float)Main.mouseTextColor / 200f - 0.35f; + scaleModd *= 0.2f; + Projectile.scale = scaleModd + 0.95f; + + float projDistance = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; + if (projDistance <= 2f) + projDistance = 1f; + else + projDistance *= 1.33f; + + Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * projDistance; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int buffType = -1; + switch (Projectile.ai[0]) + { + case 0: + buffType = BuffID.Frostburn2; + break; + case 1: + buffType = BuffID.OnFire3; + break; + case 2: + buffType = BuffID.Ichor; + break; + } + target.AddBuff(buffType, 120); + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.ExpandHitboxBy(200); + + int dustType = -1; + switch (Projectile.ai[0]) + { + case 0: + dustType = DustID.MagicMirror; + break; + case 1: + dustType = DustID.PinkFairy; + break; + case 2: + dustType = DustID.CopperCoin; + break; + } + for (int k = 0; k < 10; k++) + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); + } + } + + public override bool PreDraw(ref Color lightColor) + { + string textureName = ""; + switch (Projectile.ai[0]) + { + case 0: + textureName = Texture; + break; + case 1: + textureName = "CalamityMod/Projectiles/Melee/CosmicSpiritBomb2"; + break; + case 2: + textureName = "CalamityMod/Projectiles/Melee/CosmicSpiritBomb3"; + break; + } + Texture2D realTexture = ModContent.Request(textureName).Value; + Main.EntitySpriteDraw(realTexture, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, realTexture.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } + } +} diff --git a/Projectiles/Melee/CosmicSpiritBomb1.png b/Projectiles/Melee/CosmicSpiritBomb.png similarity index 100% rename from Projectiles/Melee/CosmicSpiritBomb1.png rename to Projectiles/Melee/CosmicSpiritBomb.png diff --git a/Projectiles/Melee/CosmicSpiritBomb1.cs b/Projectiles/Melee/CosmicSpiritBomb1.cs deleted file mode 100644 index cc4f4d99c0..0000000000 --- a/Projectiles/Melee/CosmicSpiritBomb1.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicSpiritBomb1 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 24; - Projectile.height = 24; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 150; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - float scaleModd = (float)Main.mouseTextColor / 200f - 0.35f; - scaleModd *= 0.2f; - Projectile.scale = scaleModd + 0.95f; - - float projDistance = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (projDistance <= 2f) - { - projDistance = 1f; - } - else - { - if (projDistance > 8f) - { - projDistance = 12f; - } - else if (projDistance > 6f) - { - projDistance = 9f; - } - else if (projDistance > 5f) - { - projDistance = 7f; - } - else if (projDistance > 4f) - { - projDistance = 5f; - } - else if (projDistance > 3f) - { - projDistance = 4f; - } - else if (projDistance > 2.5f) - { - projDistance = 3f; - } - else - { - projDistance = 2f; - } - } - Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * projDistance; - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, Projectile.alpha); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Frostburn2, 120); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 200; - Projectile.height = 200; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - 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, DustID.MagicMirror, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); - } - } - } -} diff --git a/Projectiles/Melee/CosmicSpiritBomb2.cs b/Projectiles/Melee/CosmicSpiritBomb2.cs deleted file mode 100644 index e17aa1fdeb..0000000000 --- a/Projectiles/Melee/CosmicSpiritBomb2.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicSpiritBomb2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 24; - Projectile.height = 24; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 150; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - float scaleModd = (float)Main.mouseTextColor / 200f - 0.35f; - scaleModd *= 0.2f; - Projectile.scale = scaleModd + 0.95f; - - float projDistance = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (projDistance <= 2f) - { - projDistance = 1f; - } - else - { - if (projDistance > 8f) - { - projDistance = 12f; - } - else if (projDistance > 6f) - { - projDistance = 9f; - } - else if (projDistance > 5f) - { - projDistance = 7f; - } - else if (projDistance > 4f) - { - projDistance = 5f; - } - else if (projDistance > 3f) - { - projDistance = 4f; - } - else if (projDistance > 2.5f) - { - projDistance = 3f; - } - else - { - projDistance = 2f; - } - } - Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * projDistance; - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, Projectile.alpha); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire3, 120); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 200; - Projectile.height = 200; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - 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, DustID.PinkFairy, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); - } - } - } -} diff --git a/Projectiles/Melee/CosmicSpiritBomb3.cs b/Projectiles/Melee/CosmicSpiritBomb3.cs deleted file mode 100644 index 4ec38d83a4..0000000000 --- a/Projectiles/Melee/CosmicSpiritBomb3.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicSpiritBomb3 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 24; - Projectile.height = 24; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 150; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - float scaleModd = (float)Main.mouseTextColor / 200f - 0.35f; - scaleModd *= 0.2f; - Projectile.scale = scaleModd + 0.95f; - - float projDistance = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (projDistance <= 2f) - { - projDistance = 1f; - } - else - { - if (projDistance > 8f) - { - projDistance = 12f; - } - else if (projDistance > 6f) - { - projDistance = 9f; - } - else if (projDistance > 5f) - { - projDistance = 7f; - } - else if (projDistance > 4f) - { - projDistance = 5f; - } - else if (projDistance > 3f) - { - projDistance = 4f; - } - else if (projDistance > 2.5f) - { - projDistance = 3f; - } - else - { - projDistance = 2f; - } - } - Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * projDistance; - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, Projectile.alpha); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Ichor, 60); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 200; - Projectile.height = 200; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - 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, 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 125511774e..842105dfaf 100644 --- a/Projectiles/Melee/CrescentMoonFlail.cs +++ b/Projectiles/Melee/CrescentMoonFlail.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); Projectile.localAI[1] = 4f; } } diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index 907fa657ae..1d705276ba 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -51,13 +52,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index 6fe3b3ff24..fd9454da63 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -60,12 +60,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { + Player owner = Main.player[Projectile.owner]; // We start drawing the laser if we have charged up if (IsAtMaxCharge) { - Vector2 maxLength = Main.MouseWorld - Main.player[Projectile.owner].Center; + Vector2 maxLength = owner.ClampedMouseWorld() - owner.Center; - DrawLaser(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Main.player[Projectile.owner].Center, + DrawLaser(Terraria.GameContent.TextureAssets.Projectile[Type].Value, owner.Center, Projectile.velocity, 15f, Projectile.damage, -MathHelper.PiOver2, Projectile.scale, maxLength.Length(), new Color(Main.DiscoR, 0, 255), (int)MOVE_DISTANCE); } return false; @@ -149,7 +150,7 @@ namespace CalamityMod.Projectiles.Melee */ private void SetLaserPosition(Player player) { - Distance = MathHelper.Max(Main.player[Projectile.owner].Distance(Main.MouseWorld) - 20f, MOVE_DISTANCE + 5f); + Distance = MathHelper.Max(player.Distance(player.ClampedMouseWorld()) - 20f, MOVE_DISTANCE + 5f); } private void ChargeLaser(Player player) @@ -204,6 +205,7 @@ namespace CalamityMod.Projectiles.Melee // Multiplayer support here, only run this code if the client running it is the owner of the projectile if (Projectile.owner == Main.myPlayer) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 diff = Main.MouseWorld - player.Center; diff.Normalize(); Projectile.velocity = diff; diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 0a14bde12d..449613f3d8 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Melee public int dustvortex = 0; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index a3305715ba..671209f27b 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 18; - Projectile.height = 54; + Projectile.width = 22; + Projectile.height = 72; Projectile.friendly = true; Projectile.alpha = 255; Projectile.tileCollide = false; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee // This is essential for Vilethorn-type projectiles, as velocity is a stored parameter and isn't supposed to actually move the projectile public override bool ShouldUpdatePosition() => false; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public override void OnKill(int timeLeft) { diff --git a/Projectiles/Melee/DNA.png b/Projectiles/Melee/DNA.png index c983a54f5a..67167a046b 100644 Binary files a/Projectiles/Melee/DNA.png and b/Projectiles/Melee/DNA.png differ diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index 892b90beb5..b4e4995aaa 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/DarkMasterBeam.cs b/Projectiles/Melee/DarkMasterBeam.cs index 65cd9deac0..7a8fa76ef3 100644 --- a/Projectiles/Melee/DarkMasterBeam.cs +++ b/Projectiles/Melee/DarkMasterBeam.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/DarkMasterClone.cs b/Projectiles/Melee/DarkMasterClone.cs index be519e6b44..f85ba9c18a 100644 --- a/Projectiles/Melee/DarkMasterClone.cs +++ b/Projectiles/Melee/DarkMasterClone.cs @@ -72,6 +72,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[1] > 0) { Projectile.ai[1] = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 direction = Projectile.Center.DirectionTo(Main.MouseWorld); Projectile.direction = Math.Sign(direction.X); if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/DarklightGreatswordSlash.cs b/Projectiles/Melee/DarklightGreatswordSlash.cs index f745eabf07..c3fb36562c 100644 --- a/Projectiles/Melee/DarklightGreatswordSlash.cs +++ b/Projectiles/Melee/DarklightGreatswordSlash.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 512; - Projectile.height = 24; + Projectile.width = 24; + Projectile.height = 512; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public override bool ShouldUpdatePosition() => true; diff --git a/Projectiles/Melee/DeathsAscensionProjectile.cs b/Projectiles/Melee/DeathsAscensionProjectile.cs index ab1f7ba83d..9492d93041 100644 --- a/Projectiles/Melee/DeathsAscensionProjectile.cs +++ b/Projectiles/Melee/DeathsAscensionProjectile.cs @@ -1,10 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Healing; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class DeathsAscensionProjectile : ModProjectile, ILocalizedModType @@ -12,15 +11,16 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { Projectile.width = 102; Projectile.height = 82; - Projectile.aiStyle = ProjAIStyleID.Sickle; + Projectile.aiStyle = -1; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 30; - AIType = ProjectileID.DeathSickle; } public override void AI() @@ -42,18 +41,41 @@ namespace CalamityMod.Projectiles.Melee 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); + int startLife = Projectile.ai[2] > 0 ? DeathsAscension.RiftLifeTime : 180; + // Player scythes just home + if (Projectile.ai[2] <= 0) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 18f, 20f); + Projectile.velocity *= 0.96f; + } + // Rift scythes have orbital motion + else + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(0.1f) * 20; + } + // Smoothly disappear + if (Projectile.timeLeft < 60) + { + Projectile.alpha += 3; + } + // Rotation direction stuff from the vanilla Death Sickle + if (Projectile.velocity.X < 0f) + { + Projectile.spriteDirection = -1; + } + Projectile.rotation += (float)Projectile.direction * 0.05f; + Projectile.rotation += (float)Projectile.direction * 0.5f * ((float)Projectile.timeLeft / startLife); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * Projectile.Opacity, 2); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(150, 0, 200, 0); + return new Color(150, 0, 200, 0) * Projectile.Opacity; } } } diff --git a/Projectiles/Melee/DeathsAscensionRift.cs b/Projectiles/Melee/DeathsAscensionRift.cs new file mode 100644 index 0000000000..fc66e3383a --- /dev/null +++ b/Projectiles/Melee/DeathsAscensionRift.cs @@ -0,0 +1,105 @@ +using CalamityMod.Graphics.Metaballs; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DeathsAscensionRift : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = DeathsAscension.RiftLifeTime; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + // Metaball visuals + int ballAmt = 20; + for (int i = 0; i < ballAmt; i++) + { + // How far balls are between each other + float offset = i * 5; + // Allows the rift to be rotated + Vector2 rotationOffset = Vector2.UnitY.RotatedBy(Projectile.rotation) * i; + // How random the sizing can get. Randomness is decreased as the balls get smaller + float sizeRandomness = MathHelper.Lerp(10, 0, (float)(i / (float)ballAmt)); + // How random the positioning can get + float positionRandomness = 20; + // Size decreases with each iteration as the balls are spawned further out. They also have some slight bubbly randomness and will scale in while the rift is spawning + float scale = (MathHelper.Lerp(90, 10, (float)(i / (float)ballAmt)) + Main.rand.NextFloat(-sizeRandomness, sizeRandomness)) * Utils.GetLerpValue(DeathsAscension.RiftLifeTime, DeathsAscension.RiftLifeTime - 10, Projectile.timeLeft, true); + // Spawn the metaballs. The first moves downwards while the other moves upwards + StreamGougeMetaball.SpawnParticle(Projectile.Center + Vector2.UnitY * (offset + Main.rand.NextFloat(-positionRandomness, positionRandomness)) + rotationOffset , Vector2.Zero, scale); + StreamGougeMetaball.SpawnParticle(Projectile.Center + Vector2.UnitY * -(offset + Main.rand.NextFloat(-positionRandomness, positionRandomness)) - rotationOffset, Vector2.Zero, scale); + } + + // Spawn orbital scythes on spawn. These last until the rift dies. + if (Projectile.ai[2] == 0) + { + int scytheAmt = DeathsAscension.RiftOrbitalAmount; + float speed = 30; + for (int i = 0; i < scytheAmt; i++) + { + Vector2 scytheVelocity = Vector2.UnitY.RotatedBy(MathHelper.Lerp(0, 3 * MathHelper.PiOver2, (float)(i / (float)(scytheAmt - 1))) + Projectile.ai[1]) * speed; + if (Projectile.owner == Main.myPlayer) + { + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, scytheVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * DeathsAscension.OrbitalScytheDamageMult), Projectile.knockBack, Projectile.owner, ai2: 1); + + Main.projectile[p].penetrate = -1; + Main.projectile[p].timeLeft = DeathsAscension.RiftLifeTime; + } + } + Projectile.ai[2] = 1; + } + + // When the weapon is swung fire scythes from the rift + if (Projectile.ai[0] == 10) + { + SoundEngine.PlaySound(SoundID.Item104 with { Pitch = 0.4f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item71 with { Pitch = -0.4f }, Projectile.Center); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 direction = Projectile.Center.DirectionTo(Main.MouseWorld) * 12; + int spreadfactor = 9; + for (int index = 0; index < DeathsAscension.ScytheShotAmount; ++index) + { + float SpeedX = direction.X + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); + float SpeedY = direction.Y + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); + if (Projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(Projectile.damage * DeathsAscension.RiftScytheDamageMult), Projectile.knockBack, Projectile.owner); + } + } + } + + // Controls the rotational offset of orbital scythes + Projectile.ai[1] += 0.1f; + + // Decrement scythe cooldown timer + if (Projectile.ai[0] > 0) + { + Projectile.ai[0]--; + } + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(CalPlayer.CalamityPlayer.DrownSound, Projectile.Center); + } + } +} diff --git a/Projectiles/Melee/DeathsAscensionSwing.cs b/Projectiles/Melee/DeathsAscensionSwing.cs index 46aa29cd7f..2a229ebcaf 100644 --- a/Projectiles/Melee/DeathsAscensionSwing.cs +++ b/Projectiles/Melee/DeathsAscensionSwing.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -26,6 +27,16 @@ namespace CalamityMod.Projectiles.Melee } public Player Owner => Main.player[Projectile.owner]; + public static Asset glowTexture = null; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + glowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + public override void SetDefaults() { Projectile.width = 159; @@ -36,8 +47,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Projectile.ownerHitCheck = true; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 8; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; Projectile.frameCounter = 0; } @@ -45,16 +56,17 @@ namespace CalamityMod.Projectiles.Melee { //Frames and crap Projectile.frameCounter++; - if (Projectile.frameCounter % 3 == 0) + if (Projectile.frameCounter > 2) { CurrentFrame++; if (frameX >= 2) CurrentFrame = 0; - } - if (frameX == 0 && frameY == 3 && Projectile.frameCounter % 3 == 0) - { - SoundEngine.PlaySound(SoundID.Item71, Projectile.position); + if (frameX == 0 && frameY == 3) + { + SoundEngine.PlaySound(SoundID.Item71, Projectile.position); + } + Projectile.frameCounter = 0; } if ((frameX == 0 && frameY >= 3) || (frameX == 1 && frameY <= 1)) @@ -91,11 +103,38 @@ namespace CalamityMod.Projectiles.Melee // Prevents the projectile from dying Projectile.timeLeft = 2; + // Move the player's arm accordingly + bool ownerFacingRight = Owner.direction == 1; + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, GetArmRotation() * (ownerFacingRight ? 1 : -1) - MathHelper.PiOver2 + (ownerFacingRight ? 0 : MathHelper.Pi)); + // Player item-based field manipulation. Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; + + Projectile.ai[2]--; + } + + // This hurt my soul to do, but because the swing is done with a sprite animation, tracking specific visual rotation of the weapon is nigh impossible + public float GetArmRotation() + { + return (frameX, frameY) switch + { + (0, 0) => -2.12f, + (0, 1) => -2.59f, + (0, 2) => -2.29f, + (0, 3) => -0.97f, + (0, 4) => 0.75f, + (0, 5) => 1.07f, + (1, 0) => 1.4f, + (1, 1) => 1.14f, + (1, 2) => 0.85f, + (1, 3) => 0.4f, + (1, 4) => -0.28f, + (1, 5) => -1.8f, + _ => 0 + }; } public void HandleChannelMovement(Vector2 playerRotatedPoint) @@ -111,20 +150,35 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.frameCounter <= 1) - return false; - 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)); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 position = Projectile.Center - Main.screenPosition + (Projectile.spriteDirection == -1 ? new Vector2(60, 0) : new Vector2(-60, 0)) - Projectile.velocity; Vector2 origin = texture.Size() / new Vector2(2f, 6f) * 0.5f; Rectangle frame = texture.Frame(2, 6, frameX, frameY); SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(texture, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Color playerPos = Lighting.GetColor(Main.LocalPlayer.position.ToTileCoordinates()); + Main.EntitySpriteDraw(texture, position, frame, playerPos, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(glowTexture.Value, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); return false; } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 170); // Deal damage only once it starts swinging down and then going back up - public override bool? CanDamage() => ((frameX == 0 && frameY >= 3) || frameX == 1) && Projectile.frameCounter > 6; + public override bool? CanDamage() => ((frameX == 0 && frameY >= 3) || frameX == 1); + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int maxRifts = 1; + if (Projectile.ai[2] <= 0 && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < maxRifts) + { + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center + Main.rand.NextVector2Circular(28, 28), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, ai1: Main.rand.NextFloat(0, 3f)); + Main.projectile[p].rotation = Main.rand.NextFloat(-MathHelper.TwoPi, MathHelper.TwoPi); + SoundEngine.PlaySound(SoundID.Item165 with { Pitch = -1 }, Projectile.Center); + Projectile.ai[2] = 40; + float screenShakePower = 3 * Utils.GetLerpValue(1300f, 0f, target.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } + } } } diff --git a/Projectiles/Melee/DeathsAscensionSwingGlow.png b/Projectiles/Melee/DeathsAscensionSwingGlow.png new file mode 100644 index 0000000000..a07e528be7 Binary files /dev/null and b/Projectiles/Melee/DeathsAscensionSwingGlow.png differ diff --git a/Projectiles/Melee/DemonBlast.cs b/Projectiles/Melee/DemonBlast.cs deleted file mode 100644 index 6e8e7402e0..0000000000 --- a/Projectiles/Melee/DemonBlast.cs +++ /dev/null @@ -1,114 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DemonBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 5; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - Projectile.alpha = 180; - Projectile.timeLeft = 300; - } - - public override void AI() - { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 173, - (int)CalamityDusts.Brimstone, - 172 - }); - - if (Projectile.position.HasNaNs()) - { - Projectile.Kill(); - return; - } - - bool tileCheck = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f)]; - dust.position = Projectile.Center; - dust.velocity = Vector2.Zero; - dust.noGravity = true; - - if (tileCheck) - dust.noLight = true; - - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - bool tileCheck = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 173, - (int)CalamityDusts.Brimstone, - 172 - }); - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.5f); - } - for (int n = 0; n < 4; n++) - { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 173, - (int)CalamityDusts.Brimstone, - 172 - }); - int dustInt = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); - Main.dust[dustInt].noGravity = true; - Main.dust[dustInt].velocity *= 3f; - if (tileCheck) - { - Main.dust[dustInt].noLight = true; - } - dustInt = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.5f); - Main.dust[dustInt].velocity *= 2f; - Main.dust[dustInt].noGravity = true; - if (tileCheck) - { - Main.dust[dustInt].noLight = true; - } - } - } - - //glowmask effect - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); - - 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.ShadowFlame, 90); - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Melee/DemonBlast.png b/Projectiles/Melee/DemonFork.png similarity index 100% rename from Projectiles/Melee/DemonBlast.png rename to Projectiles/Melee/DemonFork.png diff --git a/Projectiles/Melee/DepthCrusherProjectile.cs b/Projectiles/Melee/DepthCrusherProjectile.cs index d0b0e7f55d..7ef793f9d0 100644 --- a/Projectiles/Melee/DepthCrusherProjectile.cs +++ b/Projectiles/Melee/DepthCrusherProjectile.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -98,7 +98,8 @@ namespace CalamityMod.Projectiles.Melee { Projectile.netUpdate = true; SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); - Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.Center = Owner.MountedCenter + (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 12; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; startDamage = Projectile.damage; Projectile.spriteDirection = Projectile.direction; diff --git a/Projectiles/Melee/DepthCrusherSplitProjectile.cs b/Projectiles/Melee/DepthCrusherSplitProjectile.cs index 4da528c2f8..4cbdba0560 100644 --- a/Projectiles/Melee/DepthCrusherSplitProjectile.cs +++ b/Projectiles/Melee/DepthCrusherSplitProjectile.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Melee public int randTimer; public int dustType1 = 104; public int dustType2 = 96; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs deleted file mode 100644 index f8ae7bc5d0..0000000000 --- a/Projectiles/Melee/DepthOrb.cs +++ /dev/null @@ -1,89 +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.Melee -{ - public class DepthOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.Beam; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.ignoreWater = true; - Projectile.penetrate = 3; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 75; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f); - 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; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 70) - return false; - - 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 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.Center = Projectile.position; - 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 randoAdjust = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjust = rando3 / randoAdjust; - rando1 *= randoAdjust; - rando2 *= randoAdjust; - 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; - 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 /= 2; - Projectile.Damage(); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Melee/DepthOrb.png b/Projectiles/Melee/DepthOrb.png deleted file mode 100644 index f56704ee79..0000000000 Binary files a/Projectiles/Melee/DepthOrb.png and /dev/null differ diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs deleted file mode 100644 index 1e55362d76..0000000000 --- a/Projectiles/Melee/DepthOrb2.cs +++ /dev/null @@ -1,94 +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.Melee -{ - public class DepthOrb2 : 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 = 120; - Projectile.ignoreWater = true; - Projectile.extraUpdates = 1; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f); - - 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; - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 115) - return false; - - 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 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 randoAdjust = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjust = rando3 / randoAdjust; - rando1 *= randoAdjust; - rando2 *= randoAdjust; - 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; - 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/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs new file mode 100644 index 0000000000..6f506700ea --- /dev/null +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -0,0 +1,434 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Packets.Entities; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DevilsDevastationHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/DevilsDevastation"; + public float hitboxMult = 1.3f; + public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f); + public SlotId SoundSlot; + public override float HitboxOutset => 335; + + public override Vector2 HitboxSize => new Vector2(395, 395) * hitboxMult; + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(-3, 118); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public bool finalFlip = false; + public bool playSwingSound = true; + public bool holding = true; + public int postSwingCooldown = 0; + public bool willDie = false; + public bool hasLaunchedBlades = false; + public bool swooshFade = false; + + public NPC lastHitTarget = null; + public int postSwingCooldownMax => (int)(useAnim * 0.65f); + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void WhenSpawned() + { + IgnoreActiveAnimation = true; + DrawUnconditionally = true; + CanHit = false; + Projectile.knockBack = 0; + Projectile.scale = 1.15f; + Projectile.ai[1] = -1; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = (int)(Owner.HeldItem.useAnimation / Owner.GetTotalAttackSpeed()); + postSwingCooldown = postSwingCooldownMax / 2; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + public override void OnKill(int timeLeft) + { + Owner.Calamity().demonSwordKillMode = false; + if (lastHitTarget != null && lastHitTarget.life > 0 && lastHitTarget.active && Owner.HeldItem.type == AssignedItemID && Main.myPlayer == Projectile.owner) + { + Owner.Calamity().GeneralScreenShakePower = 12.5f; + Particle blastRing = new CustomPulse(lastHitTarget.Center, Vector2.Zero, clr, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f, 0.6f, 20, true); + GeneralParticleHandler.SpawnParticle(blastRing); + for (int i = 0; i < 4; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 2; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, vel.RotatedBy(MathHelper.ToRadians(45)), ModContent.ProjectileType(), 0, 0f, Owner.whoAmI, 1, 0); + } + Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2.5f), 0f, Owner.whoAmI, lastHitTarget.whoAmI, 0); + SoundStyle dieSound = new("CalamityMod/Sounds/Item/LanceofDestinyStrong"); + SoundEngine.PlaySound(dieSound with { Volume = 0.9f, Pitch = 0.3f }, lastHitTarget.Center); + + int bonusDamage = 4500; + if (lastHitTarget.Calamity().demonicFlamesBonusDamage <= bonusDamage) + { + lastHitTarget.Calamity().demonicFlamesBonusDamage = bonusDamage; + lastHitTarget.AddBuff(ModContent.BuffType(), 210); + // I'm like 95% confident this shouldn't need a sync since OnKill is called on all clients + } + } + } + public override void UseStyle() + { + bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); + + if (SoundEngine.TryGetActiveSound(SoundSlot, out var Sound) && Sound.IsPlaying && lastHitTarget != null) + Sound.Position = lastHitTarget.Center; + + if ((Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0) + { + Animation = (int)(useAnim * 0.7f); + holding = false; + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1; + swingCount++; + } + if (postSwingCooldown > 0) + postSwingCooldown--; + else if (willDie) + { + if (hasKillMode) + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + DrawUnconditionally = false; + Projectile.Kill(); + Owner.Calamity().demonSwordKillMode = false; + return; + } + if (killModeCD.timeLeft < KillMode.cooldownMax) + { + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + } + + if (holding) + { + Animation--; + } + + AnimationProgress = Animation % useAnim; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit && !swooshFade) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.5f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.2f); + + if (!doSwing) + { + Projectile.ai[1] = -Projectile.ai[1]; + holding = true; + + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + finalFlip = false; + playSwingSound = true; + hasLaunchedBlades = false; + if (!Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0) + { + willDie = true; + if (lastHitTarget != null) + { + useAnim = 115; + SoundStyle dieSound = new("CalamityMod/Sounds/Item/DemonSwordFinalStrike"); + SoundSlot = SoundEngine.PlaySound(dieSound with { Volume = 1f, Pitch = 0 }, lastHitTarget.Center); + } + } + + postSwingCooldown = postSwingCooldownMax; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); + + for (int i = 0; i < 4; i++) + { + float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1; + float randRot = Main.rand.NextFloat(-30, 30); + Vector2 dustVel = -Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)).RotatedByRandom(0.3f) * Main.rand.NextFloat(7, 17) - Owner.velocity * 0.8f; + Vector2 placement = Owner.Center + (new Vector2(Main.rand.NextFloat(70, 500) * deathFade, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * 10, (Main.rand.NextBool() ? Color.MediumOrchid : clr) * deathFade, new Vector2(0.9f, 1), shrinkSpeed: 0.95f)); + } + if (lastHitTarget != null && lastHitTarget.life > 0 && lastHitTarget.active) + { + float growth = (1 - (willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1)) * 15; + for (int i = 0; i < 2; i++) + { + GeneralParticleHandler.SpawnParticle(new CustomSpark(lastHitTarget.Center, Vector2.One.RotatedBy(i == 0 ? MathHelper.ToRadians(90) : 0) * Main.rand.NextFloat(-3 - growth, 3 + growth), "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * (10 + growth), Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(0.7f, 1), shrinkSpeed: 0.8f)); + } + } + if (holding) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.7f, useAnim, Animation, true)) * 0.35f)), 0.2f); + } + else if (!willDie) + { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0 ? true : false; + } + + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time >= (int)(timeMax * 0.4f) && playSwingSound) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); + SoundEngine.PlaySound(swing with { Volume = 0.85f, Pitch = Main.rand.NextFloat(-0.4f, -0.5f) }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/HeavySwing"); + SoundEngine.PlaySound(swing2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center); + playSwingSound = false; + Owner.Calamity().demonSwordKillMode = false; + } + if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.9f)) + CanHit = true; + else + CanHit = false; + if (time > (int)(timeMax * 0.7f)) + swooshFade = true; + else + swooshFade = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax * 0.9f, 1))), + 0.2f); + + if (time >= timeMax * 0.9f) + { + doSwing = false; + } + if (time < (int)(timeMax * 0.75f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 8; i++) + { + float randRot = Main.rand.NextFloat(-20, -100); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(MathHelper.ToRadians(randRot))), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.9f, 0, default, Main.rand.NextFloat(1.45f, 2.4f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; + } + for (int i = 0; i < 4; i++) + { + float randRot = Main.rand.NextFloat(-20, -100); + Vector2 dustVel = (new Vector2(0, 11 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Vector2 placement = Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 33, Main.rand.NextFloat(0.43f, 0.56f), Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(1, 1), shrinkSpeed: 0.1f)); + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + if (target != null && target.life > 0 && target.active) + lastHitTarget = target; + + bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); + + int bonusDamage = 4500; + if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage) + { + target.Calamity().demonicFlamesBonusDamage = bonusDamage; + target.AddBuff(ModContent.BuffType(), 180); + // Demonic Flames damage must be synced, because OnHitNPC is only run for the client that hit the NPC + if (Main.netMode != NetmodeID.SinglePlayer) + DemonicFlamesSyncPacket.Send(target); + } + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + CalamityUtils.MoveNPC(target, launchVel, 40, true); + + if (target.Calamity().demonSwordImpales != 0 || Projectile.numHits == 0) + { + int dustNum = (int)MathHelper.Clamp(12 - Projectile.numHits * 3, 3, 12); + for (int i = 0; i < dustNum; i++) + { + float variance = Main.rand.NextFloat(-0.5f, 0.5f); + Vector2 vel = (launchVel * 55).RotatedBy(variance) * Main.rand.NextFloat(0.2f, 1f) * (1 - Math.Abs(variance)); + int dustStyle = 278; + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle, Projectile.velocity); + dust2.scale = Main.rand.NextFloat(1.2f, 1.4f) - Math.Abs(variance); + dust2.velocity = vel; + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + + Particle spark = new SparkParticle(Projectile.Center, vel, true, 55, 1.25f, Main.rand.NextBool() ? clr : Color.MediumOrchid); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.BlueViolet, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f * (i + 1), 1.3f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f * (i + 1), 0.8f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + } + + if (!hasLaunchedBlades) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[2] == target.whoAmI && projectile.localAI[0] != 5) + { + projectile.owner = Owner.whoAmI; + projectile.localAI[0] = 5; + projectile.velocity = (launchVel * 16.5f).RotatedByRandom(0.25f); + Owner.Calamity().demonSwordKillMode = true; + if (hasKillMode) + killModeCD.timeLeft = KillMode.cooldownMax + KillMode.buffMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax + KillMode.buffMax; + hasLaunchedBlades = true; + } + } + } + + if (Projectile.numHits == 0) + { + Owner.Calamity().GeneralScreenShakePower = 12f; + for (int i = 0; i < 5; i++) + GeneralParticleHandler.SpawnParticle(new CustomSpark(target.Center + launchVel * 15, launchVel.RotatedBy((0.15f - 0.05f * i) * (i % 2 == 0 ? -1 : 1)) * (10 + 10 * i), "CalamityMod/Particles/DemonSigilParticle", false, 11, 0.7f - 0.15f * i, Main.rand.NextBool() ? clr : Color.MediumOrchid, new Vector2(1.5f, 1), extraRotation: MathHelper.ToRadians(i % 2 == 0 ? 90 : 0), shrinkSpeed: (i % 2 == 0 ? -0.8f : 0.8f))); + + for (int i = 0; i < 20; i++) + { + float distPow = Main.rand.NextFloat(0, 15); + Vector2 sparkVel = launchVel.RotatedByRandom(distPow * 0.01f) * Main.rand.NextFloat(5, 35 + distPow); + Particle sparks = new CustomSpark(target.Center + (Vector2.One * distPow).RotatedByRandom(MathHelper.Pi), sparkVel, "CalamityMod/Particles/GlowSpark", false, Main.rand.Next(13, 20 + 1) * 2, (Main.rand.NextFloat(0.5f, 0.85f) - distPow * 0.12f) * 0.2f, (Main.rand.NextBool() ? clr : Color.BlueViolet) * 0.75f, new Vector2(1.3f, 0.4f), true, false, 0, false, shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(sparks); + } + + + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordInsaneImpact"); + SoundEngine.PlaySound(swing with { Volume = 0.8f, Pitch = MathHelper.Clamp(swingCount * 0.05f, -0.25f, 0.5f) }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/HellkiteBigHit1"); + SoundEngine.PlaySound(swing2 with { Volume = 0.8f, Pitch = MathHelper.Clamp(swingCount * 0.025f, 0.4f, 0.65f) }, Projectile.Center); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.35f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + Asset tex = ModContent.Request(Texture); + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + Asset swoosh2 = ModContent.Request("CalamityMod/Particles/CircularTrail"); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1; + if (true) + { + Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomLineAngled"); + int draws = 30; + for (int i = 0; i < draws; i++) + { + Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); + + Color auraColor = Color.Lerp(Color.MediumOrchid, clr, Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * (willDie ? deathFade : 1); + Vector2 drawOffset = -offsetDir * 10 * deathFade * i; + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(18, 18), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, tex2.Size() * 0.5f, Vector2.One * (1f - i * 0.02f) * 0.06f, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + } + for (int i = 0; i < 20; i++) + { + Color auraColor = Color.MediumOrchid with { A = 0 } * 0.18f * (willDie ? deathFade : 1); + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 7 * (willDie ? (1 - deathFade) * 3 : 2); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(7, 7), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + if ((useAnim > 0 || DrawUnconditionally)) + { + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.75f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.9f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, clr with { A = 0 } * fadeIn * 0.85f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.2f * hitboxMult, SpriteEffects.None); + + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/DevilsDevastationThrownBlade.cs b/Projectiles/Melee/DevilsDevastationThrownBlade.cs new file mode 100644 index 0000000000..4fc376974d --- /dev/null +++ b/Projectiles/Melee/DevilsDevastationThrownBlade.cs @@ -0,0 +1,388 @@ +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Packets.Entities; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class DevilsDevastationThrownBlade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/DevilsDevastation"; + + public int ChargeupTime => (int)Projectile.localAI[2]; + public int Lifetime = 180; + 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]; + + // Real variables here + public ref float time => ref Projectile.ai[0]; + public ref float stabOrder => ref Projectile.ai[1]; + public ref NPC stabbedTarget => ref Main.npc[(int)Projectile.ai[2]]; + + public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f); + public Color usedColor = Color.White; + public bool thrown = false; + public int fadeOutTime = 120; + public bool stuckInTarget = false; + public int stuckTimer = 0; + public bool exitedTarget = false; + public bool stuckInGround = false; + public Vector2 impalePos; + public int bounces = 0; + public Vector2 tipPosition = Vector2.Zero; + public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime); + public override void SetDefaults() + { + Projectile.width = 35; + Projectile.height = 35; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.noEnchantmentVisuals = true; + } + + public override bool ShouldUpdatePosition() + { + return (ChargeProgress >= 1 && !stuckInGround && !stuckInTarget); + } + + //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() + { + float rate = (Main.GlobalTimeWrappedHourly + time * 3) * 2; + List eColors = new List() + { + clr, + Color.BlueViolet + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = Color.MediumOrchid.ToVector3(); + Lighting.AddLight(Projectile.Center, Light * 0.85f); + + if (Projectile.timeLeft == Lifetime) + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.velocity = toMouse * 14; + Projectile.Center = Owner.MountedCenter + toMouse * 30f; + Projectile.spriteDirection = Projectile.direction; + thrown = true; + time = 0; + Projectile.extraUpdates = 3; + Projectile.netUpdate = true; + } + + if (Projectile.velocity.X > 0) + Projectile.direction = 1; + else + Projectile.direction = -1; + + if (thrown) + { + Projectile.spriteDirection = Projectile.direction; + + if (!stuckInGround && exitedTarget) + Projectile.rotation += (0.15f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f)) * Main.rand.NextFloat(0.7f, 1f) * Projectile.direction * Projectile.Opacity; + else + Projectile.rotation = (Projectile.velocity.ToRotation() + MathHelper.PiOver4 * (Projectile.direction == 1 ? 1 : 3)); + + if (time > fadeOutTime * 0.7f && !exitedTarget) + Projectile.velocity *= 0.93f; + + if (stuckInTarget) + { + Projectile.tileCollide = false; + time--; + Projectile.timeLeft++; + if (stuckTimer > 0) + stuckTimer--; + else + { + Projectile.velocity *= 0.01f; + stabbedTarget.Calamity().demonSwordImpales--; + stuckInTarget = false; + fadeOutEffect(); + } + + Projectile.Center = stabbedTarget.Center + impalePos; + if ((stabbedTarget.life <= 0) || stabbedTarget == null || Projectile.localAI[0] == 5 || !stabbedTarget.active) + { + Projectile.timeLeft = Lifetime; + stabbedTarget.Calamity().demonSwordImpales--; + stuckInTarget = false; + exitedTarget = true; + + Projectile.rotation += Main.rand.NextFloat(-1.2f, 1.2f); + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.numHits = 0; + SoundStyle unstuck = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + SoundEngine.PlaySound(unstuck with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.3f, 0.4f), MaxInstances = 3 }, Projectile.Center); + } + } + if (exitedTarget && !stuckInGround) + { + Projectile.extraUpdates = 5; + Projectile.velocity *= 0.987f; + } + + if (fadingOut) + fadeOutEffect(); + } + if (!fadingOut && !stuckInTarget && !stuckInGround && ChargeProgress >= 1) + { + for (int i = 0; i < 2; i++) + { + Vector2 safeVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(70 * (i == 0 ? 1 : -1))) * 6; + if (!exitedTarget) + { + Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 5, 0.2f, (clr) * 0.95f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + GeneralParticleHandler.SpawnParticle(spark); + + Particle spark2 = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 10, 0.2f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + GeneralParticleHandler.SpawnParticle(spark2); + } + float rot = Projectile.rotation + (MathHelper.TwoPi * i); + Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * Projectile.direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); + if (exitedTarget && i == 0) + { + //Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 60, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f)); + //dust.noGravity = true; + //dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; + + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust2.noGravity = (dust2.type == 278 ? false : true); + dust2.scale = dust2.type == 278 ? 0.75f : 0.9f; + dust2.color = Main.rand.NextBool() ? Color.BlueViolet : clr; + dust2.velocity = (vel * 2).RotatedByRandom(0.4f); + } + } + + if (Main.rand.NextBool(4)) + { + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + //Anticipation animation. Make the player look like they're holding the item + if (ChargeProgress < 1) + { + throwAnimation(); + if (ChargeProgress >= 0.6f && time == 0) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); + SoundEngine.PlaySound(swing with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + time++; + } + return; + } + else + time++; + } + public void fadeOutEffect() + { + Projectile.tileCollide = false; + if (Projectile.timeLeft > Lifetime - fadeOutTime) + Projectile.timeLeft = Lifetime - fadeOutTime; + Projectile.Opacity = Utils.GetLerpValue(0, Lifetime - fadeOutTime, Projectile.timeLeft, true); + + Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : clr; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 100; + dust.velocity += Projectile.velocity; + } + } + public void throwAnimation() + { + 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) * -80f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int bonusDamage = 1000; + if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage) + { + target.Calamity().demonicFlamesBonusDamage = bonusDamage; + target.AddBuff(ModContent.BuffType(), 120); + // Demonic Flames damage must be synced, because OnHitNPC is only run for the client that hit the NPC + if (Main.netMode != NetmodeID.SinglePlayer) + DemonicFlamesSyncPacket.Send(target); + } + + if (!exitedTarget) + { + SoundStyle stuck = new("CalamityMod/Sounds/Item/HellkiteSmallHit", 3); + SoundEngine.PlaySound(stuck with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f), MaxInstances = 3 }, Projectile.Center); + SoundStyle stuck2 = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); + SoundEngine.PlaySound(stuck2 with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.3f, -0.2f), MaxInstances = 3 }, Projectile.Center); + + Projectile.ai[2] = target.whoAmI; + + if (target.Calamity().demonSwordImpales < 0) + target.Calamity().demonSwordImpales = 0; + if (target.Calamity().demonSwordImpales >= 5) + { + float bladeValue = -1; + Projectile ejectedBlade = null; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.owner == Projectile.owner && projectile.type == Projectile.type && Projectile.localAI[0] != 5 && projectile.ai[2] == Projectile.ai[2] && projectile.timeLeft > (Lifetime - fadeOutTime) && (bladeValue == -1 || bladeValue > projectile.ai[1])) + { + bladeValue = projectile.ai[1]; + ejectedBlade = projectile; + } + } + ejectedBlade.localAI[0] = 5; + ejectedBlade.ai[1] += 1000; + ejectedBlade.velocity = Projectile.velocity; + + for (int i = 0; i < 12; i++) + { + Particle spark2 = new SparkParticle(target.Center, Projectile.velocity.RotatedByRandom(0.45) * Main.rand.NextFloat(2.5f, 4.5f), false, 50, Main.rand.NextFloat(0.2f, 1.3f), Main.rand.NextBool() ? clr : Color.BlueViolet); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.35) * Main.rand.NextFloat(2f, 4f), 0, default, Main.rand.NextFloat(1.3f, 1.6f)); + dust.noGravity = true; + dust.noLight = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : clr; + } + } + else + { + for (int i = 0; i < 8; i++) + { + Particle spark2 = new SparkParticle(target.Center, Projectile.velocity.RotatedByRandom(0.3) * Main.rand.NextFloat(0.4f, 2.5f), false, 50, Main.rand.NextFloat(0.2f, 1.3f), Main.rand.NextBool() ? Color.MediumOrchid : clr); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.2) * Main.rand.NextFloat(0.5f, 2f), 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + dust.noGravity = false; + dust.noLight = true; + dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; + } + } + Projectile crack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2).RotatedByRandom(0.3f), ModContent.ProjectileType(), 0, 0f, Projectile.owner, 0.8f, 1); + crack.timeLeft = 200; + target.Calamity().demonSwordImpales++; + + stuckInTarget = true; + impalePos = Projectile.Center - stabbedTarget.Center; + stuckTimer = 3600; + } + Projectile.netUpdate = true; + if (Main.netMode != NetmodeID.SinglePlayer) + DemonSwordImpalesSyncPacket.Send(target); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.45f; + int hitsToMinMult = 9; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (exitedTarget ? 1.15f : 1f); + } + public override bool? CanDamage() + { + if (ChargeProgress < 1 || fadingOut || stuckInGround || stuckInTarget || (Projectile.numHits > 0 && !exitedTarget)) + return false; + + return base.CanDamage(); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.3f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool PreDraw(ref Color lightColor) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/DevilsDevastation").Value; + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.35f); + float fadeScale = (1 - Projectile.Opacity) + (stuckInTarget ? 0.55f : 0); + for (int i = 0; i < 16; i++) + { + Color auraColor = usedColor with { A = 0 } * 0.4f * fadeScale * Projectile.Opacity; + Vector2 drawOffset = ((MathHelper.TwoPi * i / 16f).ToRotationVector2() * 9 * fadeScale) + Main.rand.NextVector2Circular(3, 3); + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + if (exitedTarget && !stuckInGround) + { + Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearFire3"); + Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, clr with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.4f * Main.rand.NextFloat(0.8f, 1.15f), Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.75f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 1.25f, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + } + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + return false; + } + /* + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.timeLeft); + writer.Write(Projectile.rotation); + writer.Write(Projectile.localAI[2]); + writer.Write(Projectile.localAI[0]); + + writer.WriteFlags(stuckInTarget, thrown); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.timeLeft = reader.Read(); + Projectile.rotation = reader.ReadSingle(); + Projectile.localAI[2] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + + reader.ReadFlags(out stuckInTarget, out thrown); + } + */ + } +} diff --git a/Projectiles/Melee/DevilsStrike.cs b/Projectiles/Melee/DevilsStrike.cs new file mode 100644 index 0000000000..47d45183f0 --- /dev/null +++ b/Projectiles/Melee/DevilsStrike.cs @@ -0,0 +1,92 @@ +using System; +using System.Runtime.ConstrainedExecution; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DevilsStrike : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int time = 0; + public float fade = 0; + public int angleTimer = 20; + public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f); + public int curveDir = 1; + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.extraUpdates = 80; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; + Projectile.timeLeft = 400; + Projectile.tileCollide = false; + } + + public override void AI() + { + float deathLerp = Utils.Remap(Projectile.timeLeft, 300, 0, 40, 5); + + if (time == 0) + { + if (Projectile.ai[0] == 0) + Projectile.ai[0] = 0.75f; + angleTimer += Main.rand.Next(60, 80 + 1); + curveDir = Main.rand.NextBool() ? 1 : -1; + } + time++; + if (angleTimer > 0) + { + angleTimer--; + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.01f); + } + else + { + angleTimer = Main.rand.Next(60, 80 + 1); + Projectile.velocity = Projectile.velocity.RotatedBy((0.9f * Utils.GetLerpValue(0, 300, Projectile.timeLeft, true) * curveDir) * Main.rand.NextFloat(0.85f, 1.15f) * Projectile.ai[0]); + curveDir *= -1; + } + if (time % 6 == 0) + { + GeneralParticleHandler.SpawnParticle(new CustomSpark(Projectile.Center, Projectile.velocity * 0.1f, "CalamityMod/Particles/BloomCircle", false, 20, Main.rand.NextFloat(0.05f, 0.055f) * deathLerp * Projectile.ai[0], (Main.rand.NextBool() ? Color.MediumOrchid : clr) * (CalamityClientConfig.Instance.Photosensitivity ? 0.25f : 0.7f), new Vector2(0.8f, 1), shrinkSpeed: 0.2f)); + } + if (angleTimer % 60 == 0 && Projectile.ai[0] > 0.7f) + { + if (Projectile.ai[1] > 0) + Projectile.ai[0] -= 0.08f; + if (Main.myPlayer == Projectile.owner) + { + Projectile crack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity * 0.8f).RotatedBy(Main.rand.NextBool() ? -0.6f : 0.6f), ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, Projectile.ai[0] * 0.7f, 0); + crack.timeLeft = 250; + } + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => false; + } +} diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index 8c04e8c38f..959f4b8f4d 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -1,6 +1,7 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -10,220 +11,181 @@ namespace CalamityMod.Projectiles.Melee { public class DevilsSunriseCyclone : ModProjectile, ILocalizedModType { + public static readonly SoundStyle HitSound = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe", 2) with { Pitch = 1.25f, PitchVariance = 0.15f }; public new string LocalizationCategory => "Projectiles.Melee"; - private int red = 0; - private int greenAndBlue = 100; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } + public ref float State => ref Projectile.ai[0]; + public ref float Timer => ref Projectile.ai[1]; + private int greenAndBlue = 100; + private const int MaxHits = 10; + private float ReturnVel = 5f; + private const float MaxReturnVel = 30f; + private NPC targetToSlice; + private Vector2 sliceOffset; public override void SetDefaults() { + // These shouldn't matter because it's a circle Projectile.width = 30; Projectile.height = 30; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.scale = 1.75f; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; + Projectile.localNPCHitCooldown = 7; } public override void AI() { Player Owner = Main.player[Projectile.owner]; - if (Projectile.ai[1] < 480f && Projectile.ai[1] != -1f) - Projectile.ai[1]++; + Timer++; + Projectile.rotation += 0.5f; - if (Main.myPlayer == Projectile.owner) - { - if (!Owner.channel) - Projectile.ai[1] = -1f; - } - - Projectile.damage = (int)(Owner.GetTotalDamage(Projectile.DamageType).ApplyTo(Projectile.originalDamage) * (1f + Utils.GetLerpValue(0f, 300f, Projectile.ai[1], true))); - - red = 30 + (int)(Projectile.ai[1] * 0.75f); - if (red > 255) - red = 255; - - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + Lighting.AddLight(Projectile.Center, 0.51f, 0.2f, 0.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(255, greenAndBlue, greenAndBlue)); Main.dust[dust].velocity *= 0.3f; Main.dust[dust].noGravity = true; - 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; - if (distanceFromOwner > 300f) - speed -= (distanceFromOwner - 300f) * 0.5f; // 350 units is about the max distance before traveling back or stopping - if (speed < 2f) - speed = 2f; - - if (speed <= 2f || Projectile.ai[1] >= 480f || Projectile.ai[1] == -1f) + // What is each State? + // 0: Initial launch. Only AI needed here is just slowing down, as initial velocity is handled when the projectile is spawned. + // 1: Returning to the player. Effectively functions like your run-of-the-mill boomerang return AI. + // 2: Lodged in an enemy. This sticks the projectile near the enemy constantly, complete with visual sparks. + switch (State) { - float returnSpeedMax = 30f; - float returnSpeed = 6f; - distanceFromOwner = returnSpeedMax / distanceFromOwner; - x *= distanceFromOwner; - y *= distanceFromOwner; + case 0: + Projectile.velocity *= 0.965f; + if (Projectile.velocity.Length() < 0.05f) + Projectile.velocity = Vector2.Zero; - if (Projectile.velocity.X < x) - { - Projectile.velocity.X = Projectile.velocity.X + returnSpeed; - if (Projectile.velocity.X < 0f && x > 0f) - Projectile.velocity.X = Projectile.velocity.X + returnSpeed; - } - else if (Projectile.velocity.X > x) - { - Projectile.velocity.X = Projectile.velocity.X - returnSpeed; - if (Projectile.velocity.X > 0f && x < 0f) - Projectile.velocity.X = Projectile.velocity.X - returnSpeed; - } - if (Projectile.velocity.Y < y) - { - Projectile.velocity.Y = Projectile.velocity.Y + returnSpeed; - if (Projectile.velocity.Y < 0f && y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y + returnSpeed; - } - else if (Projectile.velocity.Y > y) - { - Projectile.velocity.Y = Projectile.velocity.Y - returnSpeed; - if (Projectile.velocity.Y > 0f && y < 0f) - Projectile.velocity.Y = Projectile.velocity.Y - returnSpeed; - } - - 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)Owner.position.X, (int)Owner.position.Y, Owner.width, Owner.height); - if (rectangle.Intersects(playerPos)) + // After 1 second, start returning + if (Timer == 60f) + { + State = 1f; + Projectile.velocity = Vector2.Normalize(Owner.Center - Projectile.Center) * ReturnVel; + } + break; + case 1: + // Return velocity accelerates over time; the magnitude of acceleration and deceleration are equal + ReturnVel *= 1.035f; + if (ReturnVel > MaxReturnVel) + ReturnVel = MaxReturnVel; + Vector2 ownerDist = Owner.Center - Projectile.Center; + if (ownerDist.Length() > 3000f) Projectile.Kill(); - } + ownerDist = Vector2.Normalize(ownerDist) * ReturnVel; + + // Return to me, my devilish sword + if (Projectile.velocity.X < ownerDist.X) + Projectile.velocity.X = ownerDist.X; + else if (Projectile.velocity.X > ownerDist.X) + Projectile.velocity.X = ownerDist.X; + + if (Projectile.velocity.Y < ownerDist.Y) + Projectile.velocity.Y = ownerDist.Y; + else if (Projectile.velocity.Y > ownerDist.Y) + Projectile.velocity.Y = ownerDist.Y; + + // Die once you reach the player + if (Main.myPlayer == Projectile.owner) + { + if (Projectile.Hitbox.Intersects(Owner.Hitbox)) + Projectile.Kill(); + } + break; + case 2: + Projectile.velocity = Vector2.Zero; + Projectile.Center = targetToSlice.Center + sliceOffset + targetToSlice.velocity; + + if (Timer % 2 == 0) + { + if (Timer % 4 == 0) + { + float angle = (Projectile.Center - targetToSlice.Center).ToRotation() + MathHelper.PiOver2; + CustomSpark impact = new(targetToSlice.Center, Vector2.Zero, "CalamityMod/Particles/ThinEndedLine", false, 10, Main.rand.NextFloat(0.6f, 0.8f), Color.Red, new Vector2(0.5f, 1f), extraRotation: angle); + GeneralParticleHandler.SpawnParticle(impact); + } + else + { + for (int i = 0; i < 2; i++) + { + Vector2 sparkVel = Vector2.Normalize(Projectile.Center - targetToSlice.Center).RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(14f, 18f); + AltLineParticle spark = new(targetToSlice.Center, sparkVel, false, 12, 0.75f, Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + if (!targetToSlice.CanBeChasedBy(Projectile)) + { + State = 1f; + Projectile.velocity = Vector2.Normalize(Owner.Center - Projectile.Center) * ReturnVel; + } + break; + default: + break; } - else if (Main.myPlayer == Projectile.owner && Projectile.ai[0] <= 0f) - { - if (Owner.channel) - { - 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 (Owner.gravDir == -1f) - mouseDestY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projTravel.Y; - - if (Projectile.ai[0] < 0f) - Projectile.ai[0] += 1f; - - float mouseDistance = (float)Math.Sqrt((double)(mouseDestX * mouseDestX + mouseDestY * mouseDestY)); - mouseDistance = (float)Math.Sqrt((double)(mouseDestX * mouseDestX + mouseDestY * mouseDestY)); - if (mouseDistance > speed) - { - mouseDistance = speed / mouseDistance; - mouseDestX *= mouseDistance; - mouseDestY *= mouseDistance; - int projMouseSpeedX = (int)(mouseDestX * 1000f); - int projMouseSpeedXVel = (int)(Projectile.velocity.X * 1000f); - int projMouseSpeedY = (int)(mouseDestY * 1000f); - int projMouseSpeedYVel = (int)(Projectile.velocity.Y * 1000f); - - if (projMouseSpeedX != projMouseSpeedXVel || projMouseSpeedY != projMouseSpeedYVel) - Projectile.netUpdate = true; - - Projectile.velocity.X = mouseDestX; - Projectile.velocity.Y = mouseDestY; - } - else - { - int projMouseSpeedyX = (int)(mouseDestX * 1000f); - int projMouseSpeedyXVel = (int)(Projectile.velocity.X * 1000f); - int projMouseSpeedyY = (int)(mouseDestY * 1000f); - int projMouseSpeedyYVel = (int)(Projectile.velocity.Y * 1000f); - - if (projMouseSpeedyX != projMouseSpeedyXVel || projMouseSpeedyY != projMouseSpeedyYVel) - Projectile.netUpdate = true; - - Projectile.velocity.X = mouseDestX; - Projectile.velocity.Y = mouseDestY; - } - } - else if (Projectile.ai[0] <= 0f) - { - Projectile.netUpdate = true; - 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 (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(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)); - } - - miceDistancing = speed / miceDistancing; - miceX *= miceDistancing; - miceY *= miceDistancing; - Projectile.velocity.X = miceX; - Projectile.velocity.Y = miceY; - - if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) - Projectile.Kill(); - - Projectile.ai[0] = 1f; - } - } - - Lighting.AddLight(Projectile.Center, (float)((double)red * 0.001), 0.1f, 0.1f); - - Projectile.rotation += 0.5f; } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) => null; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return new Color(red, greenAndBlue, greenAndBlue, Projectile.alpha); + float radius = State == 2f ? 60f : 45f; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + } + public override bool? CanHitNPC(NPC target) => Projectile.numHits >= MaxHits ? false : null; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundEngine.PlaySound(HitSound, target.Center); + target.AddBuff(ModContent.BuffType(), 180); + // Heals on each hit + Player own = Main.player[Projectile.owner]; + if (!own.moonLeech) + own.HealPlayer(1); + + // Start slicing the hit enemy if not doing so already + if (State != 2f) + { + State = 2f; + targetToSlice = target; + sliceOffset = Projectile.Center - target.Center; + } + // Return if you've reached the max hits + if (Projectile.numHits >= MaxHits - 1) + { + State = 1f; + Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * ReturnVel; + } + } + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item88, Projectile.position); + int dustAmt = 24; + for (int i = 0; i < dustAmt; i++) + { + Vector2 dustVel = Vector2.UnitX.RotatedBy(i * MathHelper.TwoPi / dustAmt) * Main.rand.NextFloat(8f, 12f); + Dust cycloneDust = Dust.NewDustPerfect(Projectile.Center, DustID.RainbowTorch, dustVel, 100, new Color(255, greenAndBlue, greenAndBlue)); + cycloneDust.noGravity = true; + cycloneDust.noLight = true; + } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Texture2D cyclone = ModContent.Request(Texture).Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + SpriteEffects sp = SpriteEffects.None; + + Main.EntitySpriteDraw(cyclone, drawPos, null, new Color(255, 50, 50), Projectile.rotation, cyclone.Size() / 2f, Projectile.scale, sp); + Main.EntitySpriteDraw(cyclone, drawPos, null, new Color(255, 75, 75) * 0.7f, -Projectile.rotation, cyclone.Size() / 2f, Projectile.scale * 1.5f, sp); + Main.EntitySpriteDraw(cyclone, drawPos, null, new Color(255, greenAndBlue, greenAndBlue) * 0.4f, Projectile.rotation * 0.75f, cyclone.Size() / 2f, Projectile.scale * 2f, sp); + + // Extra slash effect that flickers around everywhere + Texture2D flashySlash = ModContent.Request("CalamityMod/Particles/SlashSmear").Value; + Main.spriteBatch.SetBlendState(BlendState.Additive); + Main.EntitySpriteDraw(flashySlash, drawPos + Main.rand.NextVector2Circular(30f, 30f), null, new Color(255, greenAndBlue, greenAndBlue), Main.rand.NextFloat(MathHelper.TwoPi), flashySlash.Size() / 2f, 0.275f, sp); + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); return false; } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item88, 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); - 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 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; - } - Projectile.Damage(); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } } } diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 186640c5ad..5a440b6883 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -1,7 +1,8 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,85 +13,105 @@ namespace CalamityMod.Projectiles.Melee { public class DevilsSunriseProj : ModProjectile { + public static readonly SoundStyle HitSound = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe", 2) with { Pitch = 0.8f }; + public static readonly SoundStyle FullChargeSound = new SoundStyle("CalamityMod/Sounds/Item/HellbornImpact"); + public static readonly SoundStyle ThrowSound = new SoundStyle("CalamityMod/Sounds/Item/SwingMid") with { Pitch = 1.2f }; public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + + public ref float Timer => ref Projectile.ai[1]; private int red; private const int greenAndBlue = 100; + private const float TimerMax = 450f; + private bool reachedMaxCharge = false; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 28; - } - + public override void SetStaticDefaults() => Main.projFrames[Type] = 28; public override void SetDefaults() { + // These shouldn't matter because the projectile uses custom collision Projectile.width = 148; Projectile.height = 68; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ownerHitCheck = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 5; + Projectile.localNPCHitCooldown = 10; } public override void AI() { Player Owner = Main.player[Projectile.owner]; - if (Projectile.ai[1] < 300f) - Projectile.ai[1]++; + Timer++; + if (Timer > TimerMax) + { + Timer = TimerMax; + if (!reachedMaxCharge) + { + for (int i = 0; i < 35; i++) + { + Vector2 dustVel = Vector2.UnitX.RotatedBy(i * MathHelper.TwoPi / 35f) * Main.rand.NextFloat(10f, 12.5f); + Dust fullCh = Dust.NewDustPerfect(Owner.Center, ModContent.DustType(), dustVel, Scale: 2.25f); + fullCh.noGravity = true; + } + SoundEngine.PlaySound(FullChargeSound, Owner.Center); + reachedMaxCharge = true; + } + } - Projectile.damage = (int)(Owner.GetTotalDamage(Projectile.DamageType).ApplyTo(Projectile.originalDamage) * (1f + Utils.GetLerpValue(0f, 300f, Projectile.ai[1], true))); - - red = 30 + (int)(Projectile.ai[1] * 0.75f); + red = 30 + (int)(Timer * 0.5f); if (red > 255) red = 255; - - if (++Projectile.frame >= Main.projFrames[Projectile.type]) + if (++Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; + // Play swoosh sounds, and spawn dust Projectile.soundDelay--; if (Projectile.soundDelay <= 0) { SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); Projectile.soundDelay = 24; } + Vector2 dustSpawn = Projectile.Center + Projectile.velocity * 3f; + Lighting.AddLight(dustSpawn, red * 0.001f, 0.1f, 0.1f); + if (Main.rand.NextBool(Timer >= TimerMax ? 2 : 4)) + { + Dust dust = Dust.NewDustDirect(dustSpawn - Projectile.Size * 0.5f, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + dust.noGravity = true; + dust.position -= Projectile.velocity; + } if (Main.myPlayer == Projectile.owner) { - if (!Owner.CantUseHoldout()) + if (Owner.CantUseHoldout()) + Projectile.Kill(); + else { - float scaleFactor6 = 1f; - + float velocityScale = 1f; if (Owner.ActiveItem().shoot == Projectile.type) - scaleFactor6 = Owner.ActiveItem().shootSpeed * Projectile.scale; + velocityScale = Owner.ActiveItem().shootSpeed * Projectile.scale; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 slashDirection = Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true); - slashDirection.Normalize(); - if (slashDirection.HasNaNs()) - slashDirection = Vector2.UnitX * (float)Owner.direction; - - slashDirection *= scaleFactor6; + slashDirection = slashDirection.SafeNormalize(Vector2.UnitX * Owner.direction) * velocityScale; if (slashDirection.X != Projectile.velocity.X || slashDirection.Y != Projectile.velocity.Y) Projectile.netUpdate = true; Projectile.velocity = slashDirection; + + // Spawn the cyclone if you right-click + if (Owner.Calamity().mouseRight && Timer >= TimerMax) + { + // 0.00175 is a carefully chosen constant value so that the deceleration of the cyclone makes it reach about the position of the cursor + Vector2 cycloneVel = Projectile.velocity * ((Owner.Calamity().mouseWorld - Owner.Center).Length() * 0.00175f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, cycloneVel, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); + SoundEngine.PlaySound(ThrowSound, Owner.Center); + Projectile.Kill(); + } } - else - Projectile.Kill(); } - Vector2 dustSpawn = Projectile.Center + Projectile.velocity * 3f; - Lighting.AddLight(dustSpawn, red * 0.001f, 0.1f, 0.1f); - - if (Main.rand.NextBool(3)) - { - 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 = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size * 0.5f; + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true); Projectile.rotation = Projectile.velocity.ToRotation(); if (Projectile.spriteDirection == -1) Projectile.rotation += MathHelper.Pi; @@ -103,14 +124,42 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) => new Color(red, greenAndBlue, greenAndBlue, Projectile.alpha); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return new Color(red, greenAndBlue, greenAndBlue, Projectile.alpha); + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Main.player[Projectile.owner].Center - Projectile.velocity, Projectile.Center + Projectile.velocity * 5.5f, Projectile.height * Projectile.scale * 1.8f, ref _); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + SoundEngine.PlaySound(HitSound, target.Center); target.AddBuff(ModContent.BuffType(), 180); + // Accelerate the timer on hits + Timer += 15; + } + + public override bool PreDraw(ref Color lightColor) + { + Player Owner = Main.player[Projectile.owner]; + // Draws 3 slash textures, each one a different size from the previous + // The larger ones are also drawn slightly away from the player to look less awkward + Texture2D slashTex = ModContent.Request(Texture).Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + Vector2 mouseDir = Vector2.Normalize(Owner.Calamity().mouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true)); + SpriteEffects sp = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + // Second and third slashes have animation offsets from the first slash + Rectangle frame1 = slashTex.Frame(1, 28, 0, Projectile.frame); + Rectangle frame2 = slashTex.Frame(1, 28, 0, (Projectile.frame + 9) % 28); + Rectangle frame3 = slashTex.Frame(1, 28, 0, (Projectile.frame + 18) % 28); + + // Slashes are given a random rotation offset to make it look like they're slashing at the cursor with reckless abandon + float randRotOffset = Main.rand.NextFloat(-0.25f, 0.25f); + Main.EntitySpriteDraw(slashTex, drawPos, frame1, Projectile.GetAlpha(lightColor), Projectile.rotation + randRotOffset, frame1.Size() / 2f, Projectile.scale * 1.15f, sp); + randRotOffset = Main.rand.NextFloat(-0.25f, 0.25f); + Main.EntitySpriteDraw(slashTex, drawPos + mouseDir.RotatedBy(randRotOffset) * 15f, frame2, Projectile.GetAlpha(lightColor), Projectile.rotation + randRotOffset, frame2.Size() / 2f, Projectile.scale * 1.75f, sp); + randRotOffset = Main.rand.NextFloat(-0.25f, 0.25f); + Main.EntitySpriteDraw(slashTex, drawPos + mouseDir.RotatedBy(randRotOffset) * 22.5f, frame3, Projectile.GetAlpha(lightColor), Projectile.rotation + randRotOffset, frame3.Size() / 2f, new Vector2(Projectile.scale * 2f, Projectile.scale * 2.7f), sp); + return false; } } } diff --git a/Projectiles/Melee/DivineHatchetBoomerang.cs b/Projectiles/Melee/DivineHatchetBoomerang.cs deleted file mode 100644 index 7399a76afb..0000000000 --- a/Projectiles/Melee/DivineHatchetBoomerang.cs +++ /dev/null @@ -1,221 +0,0 @@ -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; - -namespace CalamityMod.Projectiles.Melee -{ - public class DivineHatchetBoomerang : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Items/Weapons/Melee/SeekingScorcher"; - - private bool hasHitEnemy = false; - private static int Lifetime = 300; - private static int ReboundTime = 100; - private int targetNPC = -1; - private List previousNPCs = new List() { -1 }; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 60; - Projectile.height = 60; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.penetrate = 3; - Projectile.timeLeft = Lifetime; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - //holy dust - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - - // Boomerang rotation - Projectile.rotation += 0.4f * (float)Projectile.direction; - - // Boomerang sound - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); - } - - // Returns after some number of frames in the air - if (Projectile.timeLeft < Lifetime - ReboundTime) - Projectile.ai[0] = 1f; - - if (Projectile.ai[0] != 0f) - { - float returnSpeed = 26f; - float acceleration = 1.4f; - - Player owner = Main.player[Projectile.owner]; - - // Delete the projectile if it's excessively far away. - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - Projectile.Center.X; - float yDist = playerCenter.Y - Projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - Projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (Projectile.velocity.X < xDist) - { - Projectile.velocity.X += acceleration; - if (Projectile.velocity.X < 0f && xDist > 0f) - Projectile.velocity.X += acceleration; - } - else if (Projectile.velocity.X > xDist) - { - Projectile.velocity.X -= acceleration; - if (Projectile.velocity.X > 0f && xDist < 0f) - Projectile.velocity.X -= acceleration; - } - if (Projectile.velocity.Y < yDist) - { - Projectile.velocity.Y += acceleration; - if (Projectile.velocity.Y < 0f && yDist > 0f) - Projectile.velocity.Y += acceleration; - } - else if (Projectile.velocity.Y > yDist) - { - Projectile.velocity.Y -= acceleration; - if (Projectile.velocity.Y > 0f && yDist < 0f) - Projectile.velocity.Y -= acceleration; - } - - // Delete the projectile if it touches its owner. - if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(owner.Hitbox)) - Projectile.Kill(); - - //home in on nearby NPCs if not returning to player - if (Projectile.penetrate != -1) - { - if (!hasHitEnemy) - { - float range = 999f; - for (int a = 0; a < Main.npc.Length; a++) - { - if (Main.npc[a].CanBeChasedBy(Projectile, false)) - { - if (Vector2.Distance(Main.npc[a].Center, Projectile.Center) < range) - { - Vector2 newVelocity = Main.npc[a].Center - Projectile.Center; - newVelocity.Normalize(); - newVelocity *= 15f; - Projectile.velocity = newVelocity; - } - } - } - } - else - { - if (targetNPC >= 0) - { - Vector2 newVelocity = Main.npc[targetNPC].Center - Projectile.Center; - newVelocity.Normalize(); - newVelocity *= 15f; - Projectile.velocity = newVelocity; - } - } - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - //glowmask effect - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - //inflict Holy Flames for 6 seconds - target.AddBuff(ModContent.BuffType(), 180); - - if (Projectile.penetrate != -1) - { - //find a nearby NPC to track - float minDist = 999f; - int index = 0; - foreach (NPC npc in Main.ActiveNPCs) - { - bool hasHitNPC = false; - for (int j = 0; j < previousNPCs.Count; j++) - { - if (previousNPCs[j] == npc.whoAmI) - { - hasHitNPC = true; - } - } - - if (npc == target) - { - previousNPCs.Add(npc.whoAmI); - } - if (npc.CanBeChasedBy(Projectile, false) && npc != target && !hasHitNPC) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - - Vector2 velocityNew; - if (minDist < 999f) - { - hasHitEnemy = true; - targetNPC = index; - velocityNew = Main.npc[index].Center - Projectile.Center; - velocityNew.Normalize(); - velocityNew *= 15f; - Projectile.velocity = velocityNew; - } - else - { - Projectile.penetrate = -1; - Projectile.ai[0] = 1f; - targetNPC = -1; - } - } - - // After its last hit, starts returning instead of vanishing. Can pierce infinitely on the way back. - if (Projectile.penetrate == 1) - { - Projectile.penetrate = -1; - Projectile.ai[0] = 1f; - targetNPC = -1; - } - } - } -} diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index a213272e50..414c822892 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 14; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } @@ -57,18 +58,12 @@ namespace CalamityMod.Projectiles.Melee { 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++) + for (int i = 0; i < 8; 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); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Melee/DracoBeam2.cs b/Projectiles/Melee/DracoBeam2.cs index 359ea9af86..e389a628c6 100644 --- a/Projectiles/Melee/DracoBeam2.cs +++ b/Projectiles/Melee/DracoBeam2.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/DraconicSpark.cs b/Projectiles/Melee/DraconicSpark.cs index 1e6b3591df..94db48ae6e 100644 --- a/Projectiles/Melee/DraconicSpark.cs +++ b/Projectiles/Melee/DraconicSpark.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Melee public static float MaxHomingRange = 600f; public static float HomingVelocity = 20f; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 6; diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs index 643bddf962..40ea618ffa 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Melee private int lifeTime = 420; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -45,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -65,8 +66,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D projectileTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D projectileTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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; @@ -95,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 79c116440d..01ec734e1f 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -59,6 +59,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0] += 1f; Projectile.rotation += MathHelper.TwoPi * 2f / spinCycleTime * (float)direction; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction int expectedDirection = (player.SafeDirectionTo(Main.MouseWorld).X > 0f).ToDirectionInt(); if (Projectile.ai[0] % spinCycleTime > spinCycleTime * 0.5f && expectedDirection != Projectile.velocity.X) { @@ -251,7 +252,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/DragoonBigBolt.cs b/Projectiles/Melee/DragoonBigBolt.cs new file mode 100644 index 0000000000..5ed32691a3 --- /dev/null +++ b/Projectiles/Melee/DragoonBigBolt.cs @@ -0,0 +1,137 @@ +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DragoonBigBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float colorValue = 0; + public float sizeMult = 1; + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.extraUpdates = 75; + Projectile.timeLeft = 200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + colorValue = MathHelper.Lerp(colorValue, 50, 0.025f); + Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)); + + if (time == 0) + { + colorValue += 30; + sizeMult = Projectile.ai[1]; + } + + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (targetDist < 1400f && Projectile.timeLeft > 5) + { + Vector2 pos = Projectile.Center; + if (Projectile.timeLeft % 4 == 0) + { + if (time < 120) + { + float velMult = (Projectile.ai[1] == 0.5f ? 0.2f : 3 * sizeMult); + Particle spark3 = new CustomSpark(pos, Projectile.velocity * 1.2f * velMult, "CalamityMod/Particles/GlowSpark", false, 11, 0.15f * sizeMult, usedColor, new Vector2(2f, 0.8f), true, true, shrinkSpeed: 1f); + GeneralParticleHandler.SpawnParticle(spark3); + sizeMult *= 0.97f; + } + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(35)) + { + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(10)) + { + Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult, usedColor, new Vector2(1, 4), true, true); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % 5 == 0) + { + Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.45f, 0.6f)); + dust.noGravity = true; + dust.color = usedColor; + } + } + if (Projectile.ai[1] == 0.5f && Projectile.timeLeft == 1) + { + for (int i = 0; i < 3; i++) + { + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 1.48f, 15); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.925f, 15); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.15f; + int hitsToMinMult = 3; // Damage falls off very fast, so small bolts are better multitarget + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 300); + if (Projectile.ai[1] != 0.5f) + { + Player Owner = Main.player[Projectile.owner]; + if (Projectile.numHits == 0) + { + Projectile.timeLeft = 5; + Projectile.velocity = Vector2.Zero; + float fxScale = 3; + Vector2 pos = target.Center; + for (int i = 0; i < (int)(7 * fxScale); i++) + { + Particle spark2 = new BoltParticle(pos, (new Vector2(4, 4) * fxScale).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.9f), true, 13, Main.rand.NextFloat(0.1f, 0.15f) * fxScale, Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid, new Vector2(1.8f, 0.8f), true, true, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), (new Vector2(5, 5) * fxScale).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.4f, 0.55f) * fxScale); + dust.noGravity = !Main.rand.NextBool(3); + dust.color = Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid; + } + Particle pulse2 = new CustomPulse(pos, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/HighResFoggyCircleHardEdge", new Vector2(1, 1), 0, 0f, 0.0815f * fxScale, 10); + GeneralParticleHandler.SpawnParticle(pulse2); + for (int i = 0; i < 2; i++) + { + Particle orb = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.38f * fxScale, 0.5f * fxScale, 14); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(pos, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.925f * fxScale, 0.2f * fxScale, 14); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); + target.MoveNPC(launchVel, 20, true); + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1), targetHitbox); + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Melee/DragoonSmallBolt.cs b/Projectiles/Melee/DragoonSmallBolt.cs new file mode 100644 index 0000000000..50f9cd897e --- /dev/null +++ b/Projectiles/Melee/DragoonSmallBolt.cs @@ -0,0 +1,83 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DragoonSmallBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float colorValue = 0; // The color fade from the first to second color + public override void SetDefaults() + { + Projectile.width = 15; + Projectile.height = 15; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + colorValue = MathHelper.Lerp(colorValue, 50, 0.025f); + Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)) * 0.7f; + + Projectile.velocity = Projectile.velocity.RotatedBy(Projectile.ai[1] * 0.022f); // Add some outward arc to the movement + + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (targetDist < 1400f) + { + Vector2 pos = Projectile.Center; + if (Projectile.timeLeft % 3 == 0) + { + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 15, 0.4f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.5f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(35)) + { + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % 5 == 0) + { + Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.45f, 0.6f)); + dust.noGravity = true; + dust.color = usedColor; + } + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.5f; + int hitsToMinMult = 2; // Can only hit thrice + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 180); + for (int i = 0; i < 4; i++) + { + Particle spark2 = new BoltParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 13, Main.rand.NextFloat(0.3f, 0.35f), Main.rand.NextBool() ? Color.Orchid : Color.Cyan, new Vector2(1.8f, 0.8f), true, true, false, 0.9f); + GeneralParticleHandler.SpawnParticle(spark2); + } + + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 25, targetHitbox); + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Melee/EarthGhost.png b/Projectiles/Melee/EarthGhost.png index 91f90058a9..0aa75cdfc4 100644 Binary files a/Projectiles/Melee/EarthGhost.png and b/Projectiles/Melee/EarthGhost.png differ diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index 394182dcc3..32426601ca 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -1,4 +1,7 @@ using System; +using System.Collections.Generic; +using System.Runtime.ConstrainedExecution; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -20,11 +23,10 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/Earth"; public override float HitboxOutset => 135; - - public override Vector2 HitboxSize => new Vector2(255, 255); + public override Vector2 HitboxSize => new Vector2(288, 288) * (1 + bladeFade * 1.2f); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 165.5f); + public override Vector2 SpriteOrigin => new(0, 186f); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -34,6 +36,11 @@ namespace CalamityMod.Projectiles.Melee public int swingCount; public bool spawnBoom = true; public Color mainColor = Color.OrangeRed; + public bool finalFlip = false; + public int pause = 0; + public bool playSwingSound = true; + public bool allowSecondHit = true; + public float bladeFade = 0; public override void SetDefaults() { base.SetDefaults(); @@ -41,15 +48,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; - Projectile.ai[1] = -1; - base.OnSpawn(source); + Projectile.ai[1] = 1; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Earth's projectile spawning mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; - useAnim = Owner.itemAnimationMax; + useAnim = Owner.itemAnimationMax * 2; if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; @@ -59,8 +67,29 @@ namespace CalamityMod.Projectiles.Melee public override void UseStyle() { + if (pause > 0) + { + pause--; + Animation--; + return; + } + + AnimationProgress = Animation % useAnim; DrawUnconditionally = false; + float rate = Main.GlobalTimeWrappedHourly * 12; + List earthColors = new List() + { + Color.OrangeRed, + Color.MediumTurquoise, + Color.LimeGreen + }; + + int colorIndex = (int)(rate / 2 % earthColors.Count); + Color currentColor = earthColors[colorIndex]; + Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count]; + mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + if (CanHit || postSwing) mousePos = Owner.Center - aimVel; else @@ -69,16 +98,22 @@ namespace CalamityMod.Projectiles.Melee } if (CanHit) - fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.2f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.28f); + if (Projectile.ai[1] == -1) + bladeFade = MathHelper.Lerp(bladeFade, 1, 0.15f); + else + bladeFade = MathHelper.Lerp(bladeFade, 0, 0.045f); if (!doSwing) { for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; + allowSecondHit = true; + playSwingSound = true; spawnBoom = true; Projectile.numHits = 0; mousePos = Owner.Calamity().mouseWorld; @@ -87,9 +122,17 @@ namespace CalamityMod.Projectiles.Melee if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; FlipAsSword = Owner.direction == -1 ? true : false; + if (swingCount % 2 == 0) + { + useAnim = Owner.itemAnimationMax * 2; + } + else + { + useAnim = Owner.itemAnimationMax; + } doSwing = true; - swingCount++; + finalFlip = false; } else { @@ -105,86 +148,98 @@ namespace CalamityMod.Projectiles.Melee } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); - - if (AnimationProgress < (useAnim / 3)) + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); + if (AnimationProgress < (useAnim / (swingCount % 2 == 0 ? 1.3f : 7))) { aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; if (AnimationProgress == 0) { + Animation = 0; doSwing = false; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.35f, useAnim * 0.6f, Animation, true)) * 0.25f)), 0.2f); } else { - float time = (AnimationProgress) - (useAnim / 3); - float timeMax = useAnim - (useAnim / 3); - - if (time == (int)(timeMax * 0.4f)) + if (!finalFlip) { - SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); - SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = (Projectile.ai[1] == 1 ? 0.6f : 0.9f) }, Projectile.Center); + FlipAsSword = Owner.direction < 0 ? true : false; } - if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.9f)) + + float time = (AnimationProgress) - (useAnim / 2.5f); + float timeMax = useAnim - (useAnim / 2.5f); + + if (time >= (int)(timeMax * 0.4f) && playSwingSound) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(swing with { Volume = 0.8f, Pitch = (Projectile.ai[1] == 1 ? -0.4f : -0.1f) }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/HellkiteSwing", 2); + SoundEngine.PlaySound(swing2 with { Volume = 0.8f, Pitch = (Projectile.ai[1] == 1 ? 0.4f : 0.7f) }, Projectile.Center); + swingCount++; + playSwingSound = false; + } + if ((int)(time) % 2 == 0 && Projectile.ai[1] == 1 && !Main.dedServ) + { + SoundStyle swoosh = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(swoosh with { Volume = 1f, Pitch = -0.4f, MaxInstances = -1 }, Projectile.Center); + } + if (time > (int)(timeMax * 0.45f) && time < (int)(timeMax * 0.9f)) { CanHit = true; for (int i = 0; i < 2; i++) { - mainColor = Main.rand.Next(3) switch - { - 0 => Color.OrangeRed, - 1 => Color.MediumTurquoise, - _ => Color.LawnGreen, - }; Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, false, 12, Main.rand.NextFloat(0.03f, 0.01f), mainColor, new Vector2 (0.3f, 1f))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(170 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.75f, 0.9f), false, 14, Main.rand.NextFloat(0.06f, 0.03f), mainColor, new Vector2(1.3f, 0.2f), true, false, 0.55f)); } for (int i = 0; i < 6; i++) { - mainColor = Main.rand.Next(3) switch - { - 0 => Color.OrangeRed, - 1 => Color.MediumTurquoise, - _ => Color.LawnGreen, - }; Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 240), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, mainColor, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, 0, true)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(270 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + if (Main.rand.NextBool(3)) + { + Particle sparker = new CustomSpark(particlePos + Main.rand.NextVector2Circular(15, 15), -particleVel * Main.rand.NextFloat(0.4f, 0.8f), "CalamityMod/Particles/Sparkle", false, 30, Main.rand.NextFloat(1.2f, 2.2f), mainColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); + GeneralParticleHandler.SpawnParticle(sparker); + } + else + { + GeneralParticleHandler.SpawnParticle(new CustomSpark(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f), mainColor * 0.65f, new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); + //GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, mainColor, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, Main.rand.NextFloat(-0.1f, 0.1f), true)); + } } } else CanHit = false; - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), - 0.2f); - + float start = swingCount % 2 != 0 ? (150 * Projectile.ai[1] * Owner.direction) : (150f * Projectile.ai[1] * Owner.direction); + float end = swingCount % 2 != 0 ? ((270) * -Projectile.ai[1] * Owner.direction) : (120f * -Projectile.ai[1] * Owner.direction); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(start, end, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), 0.2f); + if (time > timeMax * 0.8f) + { + RotationOffset = Utils.AngleLerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(start, end, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), 0.2f); + } if (time >= timeMax) doSwing = false; if (time < (int)(timeMax * 0.7f)) + { postSwing = true; - + } if (CanHit) { for (int i = 0; i < 3; i++) { - mainColor = Main.rand.Next(3) switch - { - 0 => Color.OrangeRed, - 1 => Color.MediumTurquoise, - _ => Color.LawnGreen, - }; - bool color = Main.rand.NextBool(); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(240, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = (new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(240, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); - dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, dustVel); + dust2.scale = Main.rand.NextFloat(0.65f, 1.05f); dust2.noGravity = true; dust2.color = Color.Lerp(Color.White, mainColor, 0.5f); } @@ -194,45 +249,58 @@ namespace CalamityMod.Projectiles.Melee ArmRotationOffset = MathHelper.ToRadians(-140f); ArmRotationOffsetBack = MathHelper.ToRadians(-140f); - - mainColor = Main.rand.Next(3) switch - { - 0 => Color.OrangeRed, - 1 => Color.MediumTurquoise, - _ => Color.LawnGreen, - }; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 600); if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) Projectile.numHits -= 1; - if (target.CanBeMoved(true)) - { - // Launch - Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -17; - target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); - } + Vector2 launchVel = (Projectile.ai[1] != 1 ? Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) : Utils.DirectionTo(Owner.Center, target.Center)); + target.MoveNPC(launchVel, 37, true); - if (Projectile.ai[1] == -1 && spawnBoom) + if (spawnBoom) { - Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0, 0, 2); + // This was used to give some "Hitstop" on hit, but it looks a bit strange so it's on hold + //pause = 6; + for (int i = 0; i < 5; i++) + { + Particle spark = new GlowSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-25), false, 12, 0.12f - i * 0.025f, mainColor, new Vector2(3.75f, 0.9f), true, false, 1.15f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 15; i++) + { + float power = Main.rand.NextFloat(0, 0.6f); + Particle sparker = new CustomSpark(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY).RotatedByRandom(power) * (-Main.rand.NextFloat(18.5f, 50) * (1 - power)), "CalamityMod/Particles/Sparkle", false, 38, Main.rand.NextFloat(2.2f, 4.8f), mainColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); + GeneralParticleHandler.SpawnParticle(sparker); + } + SoundStyle hit2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(hit2 with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center); + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); + SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = 0.2f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); + SoundEngine.PlaySound(fire2 with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, Projectile.Center); + + if (Projectile.ai[1] == -1) + { + NPC chosenTarget = Owner.ClampedMouseWorld().ClosestNPCAt(1000); + Vector2 spawnSpot; + if (chosenTarget == null || !chosenTarget.active || chosenTarget.life <= 0) + spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); + else + spawnSpot = chosenTarget.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0, chosenTarget == null ? 0 : chosenTarget.whoAmI, 2); + } + spawnBoom = false; } - SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); - SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = 0.2f }, Projectile.Center); - SoundStyle fire2 = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); - SoundEngine.PlaySound(fire2 with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, Projectile.Center); - - int heal = (int)(MathHelper.Clamp(80 - Projectile.numHits * 40, 1, 80)); - if (Projectile.numHits < 30) + int healPower = (Projectile.ai[1] == -1 ? 100 : 85); + int heal = (int)(MathHelper.Clamp(healPower - Projectile.numHits * 75, 1, healPower)); + if (Projectile.numHits < 10) { - Owner.statLife += heal; - Owner.HealEffect(heal); - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); } if (Projectile.numHits <= 2) @@ -259,16 +327,8 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) { - mainColor = Main.rand.Next(3) switch - { - 0 => Color.OrangeRed, - 1 => Color.MediumTurquoise, - _ => Color.LawnGreen, - }; - Particle mini = new CustomPulse(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.1f, 1f), mainColor, "CalamityMod/Particles/HealingPlus", Vector2.One, Main.rand.NextFloat(-10, 10), Main.rand.NextFloat(0.8f, 1.4f) * scaleFactor, 0.2f * scaleFactor, 35, true); - GeneralParticleHandler.SpawnParticle(mini); - - Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.7f)); + float power = Main.rand.NextFloat(0.2f, 0.8f); + Dust dust2 = Dust.NewDustPerfect(target.Center, 278, (Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld)).RotatedByRandom(power) * (Main.rand.NextFloat(10f, 35f) * ( 1 - power))); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f) * scaleFactor; dust2.noGravity = true; dust2.color = Color.Lerp(Color.White, mainColor, 0.5f); @@ -285,6 +345,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + float spriteMult = 1.13f; if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) { Asset tex = ModContent.Request(Texture); @@ -292,13 +353,39 @@ namespace CalamityMod.Projectiles.Melee float r = (FlipAsSword ? MathHelper.ToRadians(90) : 0f); - for (int i = 0; i < 5; i++) + for (int i = 0; i < 20; i++) { - Color auraColor = mainColor * 0.5f * fadeIn; Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/EarthGhost").Value; - Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); - rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); - Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Color auraColor = mainColor with { A = 0 } * 0.15f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 6 * fadeIn; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + if (swingCount > 0) + { + if (swingCount % 2 != 0) + { + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f / 4, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f / 4, SpriteEffects.FlipVertically); + } + else + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -85 : 85) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f * 1.6f / 4, SpriteEffects.None); + } + + Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle"); + int draws = 24; + + for (int i = 0; i < draws; i++) + { + bool swordTip = i > draws * 0.73f; + float swordTipScale = swordTip ? Utils.Remap(i, (int)(draws * 0.73f), draws, 0.9f, 0.35f) : 1; + Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); + + Color bladeColor = Color.Lerp(Color.MediumTurquoise, Color.Lerp(Color.LimeGreen, Color.OrangeRed, (i * 0.8f) / draws), i / (draws * 0.6f)); + Color auraColor = Color.Lerp(bladeColor, Color.White, 0.2f) with { A = 0 } * 0.4f * bladeFade; + Vector2 drawOffset = -offsetDir * 9 * i * bladeFade; + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, RotationOffset + Projectile.rotation + MathHelper.ToRadians(45), tex2.Size() * 0.5f, new Vector2(0.7f * swordTipScale, 1f) * (0.75f * swordTipScale) * 0.7f * bladeFade * spriteMult, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/EarthMeteor.cs b/Projectiles/Melee/EarthMeteor.cs index 3c714d0ef4..aa2b3f192d 100644 --- a/Projectiles/Melee/EarthMeteor.cs +++ b/Projectiles/Melee/EarthMeteor.cs @@ -10,6 +10,9 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Particles; +using Terraria.Graphics.Renderers; +using CalamityMod.Dusts; +using ReLogic.Content; namespace CalamityMod.Projectiles.Melee { @@ -24,6 +27,7 @@ namespace CalamityMod.Projectiles.Melee public int colorTimer = 0; public int fallTime = 180; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 36; @@ -43,6 +47,8 @@ namespace CalamityMod.Projectiles.Melee { Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + NPC targeted = Projectile.ai[1] == 0 ? Owner.ClampedMouseWorld().ClosestNPCAt(1000) : Main.npc[(int)Projectile.ai[1]]; + Projectile.scale = 1.2f; randomColor = Main.rand.Next(3) switch { @@ -82,31 +88,49 @@ namespace CalamityMod.Projectiles.Melee } if (time == (int)(fallTime * 0.2f) && Projectile.ai[2] > 0) { - Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + Vector2 spawnSpot; + if (targeted == null || !targeted.active || targeted.life <= 0) + spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); + else + spawnSpot = targeted.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1], Projectile.ai[2] - 1); } if (time == fallTime) { - Projectile.extraUpdates = 15; + for (int i = 0; i < 2; i++) + { + Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), 0, 0.8f, 0f, 27); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), 0, 0.65f, 0f, 27); + GeneralParticleHandler.SpawnParticle(bloom3); - NPC target = Projectile.Center.ClosestNPCAt(2000); + Projectile.extraUpdates = 30; + + Vector2 mouse = Owner.ClampedMouseWorld(); + NPC target = mouse.ClosestNPCAt(1000); if (target != null) Projectile.velocity = (target.Center - Projectile.Center + target.velocity * 8).SafeNormalize(Vector2.UnitX) * 8; else + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 8; + } } if (time >= fallTime) { + float fadeIn = Utils.GetLerpValue(fallTime * 1.7f, fallTime, time, true); // Spawn in a helix-style pattern - float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + float sine = (float)Math.Sin(Projectile.timeLeft * 0.475f / MathHelper.Pi); - Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f; + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (16f + 34 * fadeIn); if (targetDist < 1400f && time % 2 == 0) { - GlowSparkParticle orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, false, 10, 0.03f, mainColor, new Vector2(0.5f, 1f), false, false); + CustomSpark orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, 0.3f + (0.4f * fadeIn), mainColor, new Vector2(0.5f, 1f), true, false); GeneralParticleHandler.SpawnParticle(orb); - GlowSparkParticle orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, false, 10, 0.03f, mainColor, new Vector2(0.5f, 1f), false, false); + CustomSpark orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, 0.3f + (0.4f * fadeIn), mainColor, new Vector2(0.5f, 1f), true, false); GeneralParticleHandler.SpawnParticle(orb2); } } @@ -115,10 +139,10 @@ namespace CalamityMod.Projectiles.Melee float randSize = Main.rand.NextFloat(0.8f, 1.2f); for (int i = 0; i < 2; i++) { - Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * Utils.Remap(time, 0, fallTime, 0, 0.65f), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 3), Utils.Remap(time, fallTime * 0.7f, fallTime, 1, 2)), 0, 0.8f * randSize, 0f, 3); + Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.8f * randSize, 0f, 3); GeneralParticleHandler.SpawnParticle(bloom); } - Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * Utils.Remap(time, 0, fallTime, 0f, 0.65f), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 3), Utils.Remap(time, fallTime * 0.7f, fallTime, 1, 2)), 0, 0.65f * randSize, 0f, 3); + Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.65f * randSize, 0f, 3); GeneralParticleHandler.SpawnParticle(bloom3); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -126,20 +150,15 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(ref Color lightColor) { + Asset tex = ModContent.Request("CalamityMod/Particles/VerticalSmearRagged"); if (time <= fallTime) return false; - Color auraColor = mainColor; - for (int i = 0; i < 7; i++) + for (int i = 0; i < 10; i++) { - Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/EarthMeteor").Value; - Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 20f).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); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * (i - 110), null, mainColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale * new Vector2(0.4f - i * 0.05f, 1.3f + i * 0.1f) * 0.4f, i % 2 == 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); } - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(Color.White, randomColor, 0.3f), 1); return false; } public override void OnKill(int timeLeft) @@ -149,12 +168,13 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 300); if (Projectile.numHits <= 0) { Player Owner = Main.player[Projectile.owner]; - Owner.Calamity().GeneralScreenShakePower = 4f; - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); - for (int i = 0; i < 20; i++) + Owner.Calamity().GeneralScreenShakePower = 4.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + for (int i = 0; i < 15; i++) { randomColor = Main.rand.Next(3) switch { @@ -166,26 +186,36 @@ namespace CalamityMod.Projectiles.Melee dust2.scale = Main.rand.NextFloat(0.85f, 1.15f); dust2.noGravity = false; dust2.color = Color.Lerp(Color.White, randomColor, 0.5f); + + Particle sparker = new CustomSpark(target.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20), "CalamityMod/Particles/Sparkle", false, 38, Main.rand.NextFloat(2.2f, 4.8f), randomColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); + GeneralParticleHandler.SpawnParticle(sparker); } + + for (int i = 0; i < 3; i++) + { + string tex = "CalamityMod/Particles/ShatteredExplosion"; + Particle bolt1 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 12, 0.5f - i * 0.08f, Color.OrangeRed * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt1); + Particle bolt2 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 10, 0.4f - i * 0.08f, Color.MediumTurquoise * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt2); + Particle bolt3 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 8, 0.35f - i * 0.08f, Color.LawnGreen * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt3); - Particle bolt2 = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.5f, 19); - GeneralParticleHandler.SpawnParticle(bolt2); - Particle bolt3 = new CustomPulse(target.Center, Vector2.Zero, Color.MediumTurquoise, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.35f, 17); - GeneralParticleHandler.SpawnParticle(bolt3); - Particle bolt4 = new CustomPulse(target.Center, Vector2.Zero, Color.LawnGreen, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.2f, 15); - GeneralParticleHandler.SpawnParticle(bolt4); - + } SoundStyle fire2 = new("CalamityMod/Sounds/Item/EarthMeteor"); SoundEngine.PlaySound(fire2 with { Volume = 0.9f }, target.Center); - Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f, 3f, 18, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f, 2f, 18, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - + if (!CalamityClientConfig.Instance.Photosensitivity) + { + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f, 3f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f, 2f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } } } public override bool? CanDamage() => time < fallTime ? false : null; + public override bool? CanCutTiles() => false; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 80, targetHitbox); } } diff --git a/Projectiles/Melee/ElementBall.cs b/Projectiles/Melee/ElementBall.cs deleted file mode 100644 index 1999237276..0000000000 --- a/Projectiles/Melee/ElementBall.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class ElementBall : 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.extraUpdates = 2; - Projectile.tileCollide = false; - Projectile.timeLeft = 150; - } - - public override void AI() - { - 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; - - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); - } - } -} diff --git a/Projectiles/Melee/ElementalGlassStar.cs b/Projectiles/Melee/ElementalGlassStar.cs index 27445e7ef2..940d229889 100644 --- a/Projectiles/Melee/ElementalGlassStar.cs +++ b/Projectiles/Melee/ElementalGlassStar.cs @@ -18,8 +18,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -75,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee } } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int starGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[starGore].velocity *= 0.66f; @@ -95,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -131,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(spark); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index f34ef00167..26ee16b06f 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -14,8 +14,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -95,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -103,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/EntropicFlechette.cs b/Projectiles/Melee/EntropicFlechette.cs index a1ae925afa..e0151b3c6e 100644 --- a/Projectiles/Melee/EntropicFlechette.cs +++ b/Projectiles/Melee/EntropicFlechette.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Potions; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,11 +14,13 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public float sizeVariance = 2; + public float sizeVariance = 1; public int time = 60; public int spinDir = 100; public int waveOften = 40; - public float scaleVariance = 1; + NPC target; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 50; @@ -30,9 +31,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 450; + Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 15; } public override void AI() @@ -43,51 +45,56 @@ namespace CalamityMod.Projectiles.Melee { spinDir = Main.rand.NextBool() ? 1 : -1; waveOften = Main.rand.Next(10, 40 + 1); - scaleVariance = Main.rand.NextFloat(0.65f, 1f); + Projectile.scale = Main.rand.NextFloat(0.8f, 1.5f); } - if (time % 18 == 0) - sizeVariance = Main.rand.NextFloat(1.5f, 2.5f) * scaleVariance; - Projectile.scale = MathHelper.Lerp(Projectile.scale, sizeVariance, 0.09f); - if (time % 2 == 0 && time > 5) + if (Projectile.numHits > 0) + Projectile.extraUpdates = 2; + else + Projectile.extraUpdates = 1; + + sizeVariance = Utils.GetLerpValue(-5, 60, Projectile.timeLeft, true); + + if (time > 65) { - Particle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.3f, false, 6, 0.7f, Color.Black); - GeneralParticleHandler.SpawnParticle(spark); + if (Main.myPlayer == Projectile.owner) + { + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.4f, "CalamityMod/Particles/GlowSpark2", false, (int)MathHelper.Clamp(9 * sizeVariance, 3, 9), MathHelper.Clamp(0.03f * sizeVariance, 0.01f, 0.03f), Color.Black * 0.6f, new Vector2(1.2f, 0.5f), false, shrinkSpeed: 1.1f); + GeneralParticleHandler.SpawnParticle(spark2); + } + + if (Main.rand.NextBool(8)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.scale = Main.rand.NextFloat(0.6f, 1.1f); + dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); + dust.noGravity = true; + dust.color = Color.LightGreen; + dust.noLightEmittence = true; + } } - if (Main.rand.NextBool(8)) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); - dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); - dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); - dust.noGravity = true; - dust.color = Color.LightGreen; - } - if (time >= 5) + if (time >= 35) { if (Projectile.numHits < 1) { - NPC target = Projectile.Center.ClosestNPCAt(320); + target = Projectile.Center.ClosestNPCAt(320); if (target == null) { - Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + Vector2 moveToMouse = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); if (Projectile.velocity.Length() < 14) - Projectile.velocity += moveToMouse * 0.3f; + Projectile.velocity += moveToMouse * 0.15f; else - Projectile.velocity *= 0.8f; + Projectile.velocity *= 0.95f; if (time % waveOften == 0) spinDir *= -1; - Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.05f, 0.15f) * spinDir * Utils.GetLerpValue(60, 180, time, true)); + //Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.05f, 0.15f) * spinDir * Utils.GetLerpValue(60, 180, time, true)); } else { - Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 14) - Projectile.velocity += moveToEnemy * 0.8f; - else - Projectile.velocity *= 0.7f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.5f, 13, 0.98f); } } else @@ -95,17 +102,17 @@ namespace CalamityMod.Projectiles.Melee if (time % waveOften == 0) spinDir *= -1; - Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.05f, 0.15f) * spinDir * Utils.GetLerpValue(60, 180, time, true)); + Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.03f, 0.07f) * spinDir * Utils.GetLerpValue(60, 180, time, true)); } } - if (Projectile.numHits > 0) - Projectile.extraUpdates = 2; + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (Projectile.numHits == 0) { + Projectile.netUpdate = true; SoundStyle sound = new("CalamityMod/Sounds/Item/MeldBurn"); SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); } @@ -126,11 +133,23 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Asset tex = ModContent.Request("CalamityMod/Particles/WaterFlavored"); + Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle"); Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.Black, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, 1) * Projectile.scale, SpriteEffects.None); - Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, 1) * Projectile.scale * 0.7f, SpriteEffects.None); - Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, 1) * Projectile.scale * 0.5f, SpriteEffects.None); + float minSpeed = 6; + float maxSpeed = 14; + float totalScale = Projectile.scale * sizeVariance; + for (int i = 0; i < 8; i++) + { + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * Utils.Remap(Projectile.velocity.Length(), minSpeed, maxSpeed, 30, 7, true) * totalScale; + Vector2 aimDir = Utils.DirectionTo(Projectile.Center + rotationalDrawOffset, Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 92); + Main.EntitySpriteDraw(tex.Value, generalDrawPos + rotationalDrawOffset, null, Color.Black * 0.8f, aimDir.ToRotation() + MathHelper.ToRadians(-90), tex.Size() * 0.5f, new Vector2(0.3f, 1) * totalScale, SpriteEffects.None); + } + for (int i = 0; i < 3; i++) + { + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 3f).ToRotationVector2() * 3; + Main.EntitySpriteDraw(tex2.Value, generalDrawPos + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex2.Size() * 0.5f, new Vector2(Utils.Remap(Projectile.velocity.Length(), minSpeed, maxSpeed, 0.7f, 0.25f, true), Utils.Remap(Projectile.velocity.Length(), minSpeed, maxSpeed, 0.7f, 1.7f, true)) * totalScale * 0.2f, SpriteEffects.None); + } return false; } } diff --git a/Projectiles/Melee/EonBolt.cs b/Projectiles/Melee/EonBolt.cs index ff20bd185c..e6988ef0c0 100644 --- a/Projectiles/Melee/EonBolt.cs +++ b/Projectiles/Melee/EonBolt.cs @@ -8,7 +8,6 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Melee { @@ -28,8 +27,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Melee/EssenceFlame2.cs b/Projectiles/Melee/EssenceFlame2.cs index 1b4a23fa60..e48ffa2e5b 100644 --- a/Projectiles/Melee/EssenceFlame2.cs +++ b/Projectiles/Melee/EssenceFlame2.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 2fedb0d73e..f487a0cd93 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -48,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, 1f, spriteEffects, 0); + Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, 1f, spriteEffects, 0); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/EutrophicScimitarProj.cs b/Projectiles/Melee/EutrophicScimitarProj.cs deleted file mode 100644 index a5564d719a..0000000000 --- a/Projectiles/Melee/EutrophicScimitarProj.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EutrophicScimitarProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 3; - } - - public override void SetDefaults() - { - Projectile.width = 18; - Projectile.height = 18; - 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); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 60); - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); - Projectile.frameCounter++; - if (Projectile.frameCounter > 2) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 2) - { - Projectile.frame = 0; - } - if (Projectile.velocity.X < 0f) - { - Projectile.rotation = Projectile.velocity.ToRotation(); - } - else - { - Projectile.rotation = Projectile.velocity.ToRotation(); - } - if (Main.rand.NextBool()) - { - 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 = Projectile.velocity.ToRotation(); - } - - public override void OnKill(int timeLeft) - { - for (int i = 0; i <= 10; i++) - { - Dust dust; - Vector2 position = new Vector2(Projectile.position.X - 4, Projectile.position.Y - 4); - 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/EutrophicScimitarProj.png b/Projectiles/Melee/EutrophicScimitarProj.png deleted file mode 100644 index 7c03384584..0000000000 Binary files a/Projectiles/Melee/EutrophicScimitarProj.png and /dev/null differ diff --git a/Projectiles/Melee/ExaltedOathbladeHoldout.cs b/Projectiles/Melee/ExaltedOathbladeHoldout.cs new file mode 100644 index 0000000000..3512cfa0cd --- /dev/null +++ b/Projectiles/Melee/ExaltedOathbladeHoldout.cs @@ -0,0 +1,350 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Packets.Entities; +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.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ExaltedOathbladeHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/ExaltedOathblade"; + public float hitboxMult = 1.3f; + public override float HitboxOutset => 70; + + public override Vector2 HitboxSize => new Vector2(155, 155) * hitboxMult; + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(-3, 88); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public bool finalFlip = false; + public bool playSwingSound = true; + public bool holding = true; + public int postSwingCooldown = 0; + public bool willDie = false; + public bool hasLaunchedBlades = false; + public bool swooshFade = false; + public int postSwingCooldownMax => (int)(useAnim * 0.65f); + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void WhenSpawned() + { + IgnoreActiveAnimation = true; + DrawUnconditionally = true; + CanHit = false; + Projectile.knockBack = 0; + Projectile.scale = 1.15f; + Projectile.ai[1] = -1; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = (int)(Owner.HeldItem.useAnimation / Owner.GetTotalAttackSpeed()); + postSwingCooldown = postSwingCooldownMax / 2; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + public override void OnKill(int timeLeft) + { + Owner.Calamity().demonSwordKillMode = false; + } + public override void UseStyle() + { + bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); + + if ((Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0) + { + Animation = (int)(useAnim * 0.7f); + holding = false; + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1; + swingCount++; + } + if (postSwingCooldown > 0) + postSwingCooldown--; + else if (willDie) + { + if (hasKillMode) + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + DrawUnconditionally = false; + Projectile.Kill(); + Owner.Calamity().demonSwordKillMode = false; + return; + } + if (killModeCD.timeLeft < KillMode.cooldownMax) + { + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + } + + if (holding) + { + Animation--; + } + + AnimationProgress = Animation % useAnim; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit && !swooshFade) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.5f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.23f); + + if (!doSwing) + { + Projectile.ai[1] = -Projectile.ai[1]; + holding = true; + + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + finalFlip = false; + playSwingSound = true; + hasLaunchedBlades = false; + if (!Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0) + { + willDie = true; + } + + postSwingCooldown = postSwingCooldownMax; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); + + if (holding) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.7f, useAnim, Animation, true)) * 0.35f)), 0.2f); + } + else if (!willDie) + { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0 ? true : false; + } + + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time >= (int)(timeMax * 0.4f) && playSwingSound) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); + SoundEngine.PlaySound(swing with { Volume = 0.85f, Pitch = Main.rand.NextFloat(-0.4f, -0.5f) }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/HeavySwing"); + SoundEngine.PlaySound(swing2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, Projectile.Center); + playSwingSound = false; + Owner.Calamity().demonSwordKillMode = false; + } + if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.9f)) + CanHit = true; + else + CanHit = false; + if (time > (int)(timeMax * 0.7f)) + swooshFade = true; + else + swooshFade = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax * 0.9f, 1))), + 0.2f); + + if (time >= timeMax * 0.9f) + { + doSwing = false; + } + if (time < (int)(timeMax * 0.75f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(143, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + } + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Vector2 placement = Owner.Center + (new Vector2(143, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); + + int bonusDamage = 300; + if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage) + { + target.Calamity().demonicFlamesBonusDamage = bonusDamage; + target.AddBuff(ModContent.BuffType(), 180); + // Demonic Flames damage must be synced, because OnHitNPC is only run for the client that hit the NPC + if (Main.netMode != NetmodeID.SinglePlayer) + DemonicFlamesSyncPacket.Send(target); + } + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + CalamityUtils.MoveNPC(target, launchVel, 23, true); + + int dustNum = (int)MathHelper.Clamp(12 - Projectile.numHits * 3, 3, 12); + for (int i = 0; i < dustNum; i++) + { + float variance = Main.rand.NextFloat(-0.5f, 0.5f); + int dustStyle = 278; + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle, Projectile.velocity); + dust2.scale = Main.rand.NextFloat(1.2f, 1.4f) - Math.Abs(variance); + dust2.velocity = (launchVel * 55).RotatedBy(variance) * Main.rand.NextFloat(0.2f, 1f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + } + + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.BlueViolet, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f * (i + 1), 1.3f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f * (i + 1), 0.8f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + if (!hasLaunchedBlades) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[2] == target.whoAmI && projectile.localAI[0] != 5) + { + projectile.owner = Owner.whoAmI; + projectile.localAI[0] = 5; + projectile.velocity = (launchVel * 16.5f).RotatedByRandom(0.25f); + Owner.Calamity().demonSwordKillMode = true; + if (hasKillMode) + killModeCD.timeLeft = KillMode.cooldownMax + KillMode.buffMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax + KillMode.buffMax; + hasLaunchedBlades = true; + } + } + } + + if (Projectile.numHits == 0) + { + Owner.Calamity().GeneralScreenShakePower = 7f; + for (int i = 0; i < 4; i++) + GeneralParticleHandler.SpawnParticle(new CustomSpark(target.Center + launchVel * 15, launchVel.RotatedBy((0.15f - 0.05f * i) * (i % 2 == 0 ? -1 : 1)) * (10 + 10 * i), "CalamityMod/Particles/DemonSigilParticle", false, 11, 0.7f - 0.15f * i, Color.MediumOrchid, new Vector2(1.5f, 1), extraRotation: MathHelper.ToRadians(i % 2 == 0 ? 90 : 0), shrinkSpeed: (i % 2 == 0 ? -0.8f : 0.8f))); + + for (int i = 0; i < 20; i++) + { + float distPow = Main.rand.NextFloat(0, 15); + Vector2 sparkVel = launchVel.RotatedByRandom(distPow * 0.01f) * Main.rand.NextFloat(5, 35 + distPow); + Particle sparks = new CustomSpark(target.Center + (Vector2.One * distPow).RotatedByRandom(MathHelper.Pi), sparkVel, "CalamityMod/Particles/GlowSpark", false, Main.rand.Next(13, 20 + 1) * 2, (Main.rand.NextFloat(0.5f, 0.85f) - distPow * 0.12f) * 0.12f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.75f, new Vector2(1.3f, 0.4f), true, false, 0, false, shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(sparks); + } + + + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordInsaneImpact"); + SoundEngine.PlaySound(swing with { Volume = 0.8f, Pitch = MathHelper.Clamp(swingCount * 0.05f, -0.25f, 0.5f) }, Projectile.Center); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.35f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally)) + { + Asset tex = ModContent.Request(Texture); + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1; + + for (int i = 0; i < 20; i++) + { + Color auraColor = Color.MediumOrchid with { A = 0 } * 0.18f * (willDie ? deathFade : fadeIn); + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 6 * (willDie ? (1 - deathFade) * 2 : fadeIn); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.35f * hitboxMult, SpriteEffects.None); + + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs new file mode 100644 index 0000000000..17b17ede5c --- /dev/null +++ b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs @@ -0,0 +1,390 @@ +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Packets.Entities; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class ExaltedOathbladeThrownBlade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/ExaltedOathblade"; + + public int ChargeupTime => (int)Projectile.localAI[2]; + public int Lifetime = 150; + 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]; + + // Real variables here + public ref float time => ref Projectile.ai[0]; + public ref float stabOrder => ref Projectile.ai[1]; + public ref NPC stabbedTarget => ref Main.npc[(int)Projectile.ai[2]]; + + public bool thrown = false; + public int fadeOutTime = 120; + public bool stuckInTarget = false; + public int stuckTimer = 0; + public bool exitedTarget = false; + public bool stuckInGround = false; + public Vector2 impalePos; + public int bounces = 0; + public Vector2 tipPosition = Vector2.Zero; + public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime); + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.noEnchantmentVisuals = true; + } + + public override bool ShouldUpdatePosition() + { + return (ChargeProgress >= 1 && !stuckInGround && !stuckInTarget); + } + + //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() + { + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = Color.MediumOrchid.ToVector3(); + Lighting.AddLight(Projectile.Center, Light * 0.85f); + + if (Projectile.timeLeft == Lifetime) + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.velocity = toMouse * 14; + Projectile.Center = Owner.MountedCenter + toMouse * 12f; + Projectile.spriteDirection = Projectile.direction; + thrown = true; + time = 0; + Projectile.extraUpdates = 2; + Projectile.tileCollide = true; + Projectile.netUpdate = true; + } + + if (Projectile.velocity.X > 0) + Projectile.direction = 1; + else + Projectile.direction = -1; + + if (thrown) + { + Projectile.spriteDirection = Projectile.direction; + + if (!stuckInGround && exitedTarget) + Projectile.rotation += (0.35f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f)) * Main.rand.NextFloat(0.7f, 1f) * Projectile.direction * Projectile.Opacity; + else + Projectile.rotation = (Projectile.velocity.ToRotation() + MathHelper.PiOver4 * (Projectile.direction == 1 ? 1 : 3)); + + if (time > fadeOutTime * 0.7f && !exitedTarget) + Projectile.velocity *= 0.93f; + + if (stuckInTarget) + { + Projectile.tileCollide = false; + time--; + Projectile.timeLeft++; + if (stuckTimer > 0) + stuckTimer--; + else + { + Projectile.velocity *= 0.01f; + stabbedTarget.Calamity().demonSwordImpales--; + stuckInTarget = false; + fadeOutEffect(); + } + + Projectile.Center = stabbedTarget.Center + impalePos; + if ((stabbedTarget.life <= 0) || stabbedTarget == null || Projectile.localAI[0] == 5 || !stabbedTarget.active) + { + Projectile.timeLeft = Lifetime; + stabbedTarget.Calamity().demonSwordImpales--; + stuckInTarget = false; + exitedTarget = true; + Projectile.tileCollide = true; + Projectile.rotation += Main.rand.NextFloat(-1.5f, 1.5f); + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.numHits = 0; + SoundStyle unstuck = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + SoundEngine.PlaySound(unstuck with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.3f, 0.4f), MaxInstances = 3 }, Projectile.Center); + } + } + if (exitedTarget && !stuckInGround) + { + Projectile.extraUpdates = 2; + if (Projectile.velocity.Y < 14 && Projectile.timeLeft < (bounces > 0 ? Lifetime : Lifetime - 50)) + Projectile.velocity.Y += 0.35f; + } + + if (fadingOut) + fadeOutEffect(); + } + if (!fadingOut && !stuckInTarget && !stuckInGround && ChargeProgress >= 1) + { + for (int i = 0; i < 2; i++) + { + Vector2 safeVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(70 * (i == 0 ? 1 : -1))) * 6; + if (!exitedTarget) + { + Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 75, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 9, 0.2f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1, 1f), true, false, 0, false, 1.0f, 0.2f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (exitedTarget && i == 0 && Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + } + } + + if (Main.rand.NextBool(4)) + { + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + //Anticipation animation. Make the player look like they're holding the item + if (ChargeProgress < 1) + { + throwAnimation(); + if (ChargeProgress >= 0.6f && time == 0) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); + SoundEngine.PlaySound(swing with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + time++; + } + return; + } + else + time++; + } + public void fadeOutEffect() + { + Projectile.tileCollide = false; + if (Projectile.timeLeft > Lifetime - fadeOutTime) + Projectile.timeLeft = Lifetime - fadeOutTime; + Projectile.Opacity = Utils.GetLerpValue(0, Lifetime - fadeOutTime, Projectile.timeLeft, true); + + Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 100; + dust.velocity += Projectile.velocity; + } + } + public void throwAnimation() + { + 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) * -65f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int bonusDamage = 120; + if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage) + { + target.Calamity().demonicFlamesBonusDamage = bonusDamage; + target.AddBuff(ModContent.BuffType(), 120); + // Demonic Flames damage must be synced, because OnHitNPC is only run for the client that hit the NPC + if (Main.netMode != NetmodeID.SinglePlayer) + DemonicFlamesSyncPacket.Send(target); + } + + if (!exitedTarget) + { + SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); + SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 3 }, Projectile.Center); + + Projectile.ai[2] = target.whoAmI; + + if (target.Calamity().demonSwordImpales < 0) + target.Calamity().demonSwordImpales = 0; + if (target.Calamity().demonSwordImpales >= 4) + { + float bladeValue = -1; + Projectile ejectedBlade = null; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.owner == Projectile.owner && projectile.type == Projectile.type && Projectile.localAI[0] != 5 && projectile.ai[2] == Projectile.ai[2] && projectile.timeLeft > (Lifetime - fadeOutTime) && (bladeValue == -1 || bladeValue > projectile.ai[1])) + { + bladeValue = projectile.ai[1]; + ejectedBlade = projectile; + } + } + ejectedBlade.localAI[0] = 5; + ejectedBlade.ai[1] += 1000; + ejectedBlade.velocity = Projectile.velocity.RotatedByRandom(0.12f); + + for (int i = 0; i < 12; i++) + { + Particle spark2 = new SparkParticle(target.Center, Projectile.velocity.RotatedByRandom(0.4) * Main.rand.NextFloat(0.4f, 2.5f), false, 50, Main.rand.NextFloat(0.2f, 1.3f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.3) * Main.rand.NextFloat(0.5f, 2f), 0, default, Main.rand.NextFloat(1.3f, 1.6f)); + dust.noGravity = true; + dust.noLight = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + } + } + target.Calamity().demonSwordImpales++; + + stuckInTarget = true; + impalePos = Projectile.Center - stabbedTarget.Center; + stuckTimer = 3600; + } + Projectile.netUpdate = true; + if (Main.netMode != NetmodeID.SinglePlayer) + DemonSwordImpalesSyncPacket.Send(target); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.45f; + int hitsToMinMult = 9; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (exitedTarget ? 1.15f : 1f); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (exitedTarget) + { + if (bounces >= 2) + { + impaleGround(oldVelocity); + } + 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.velocity.Length() < 8) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8; + Projectile.velocity.Y *= 0.85f; + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.2f); + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/CeramicImpact", 2) { Volume = 0.35f, Pitch = Main.rand.NextFloat(-0.4f, -0.5f) }, Projectile.Center); + bounces++; + Projectile.timeLeft = Lifetime; + } + } + else + { + impaleGround(oldVelocity); + } + Projectile.netUpdate = true; + return false; + } + public void impaleGround(Vector2 oldVelocity) + { + Projectile.velocity = oldVelocity; + stuckInGround = true; + Projectile.timeLeft = (int)(Lifetime - fadeOutTime * 0.3f); + Projectile.tileCollide = false; + SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); + SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.2f, 0.3f), MaxInstances = 3 }, Projectile.Center); + } + public override bool? CanDamage() + { + if (ChargeProgress < 1 || fadingOut || stuckInGround || stuckInTarget || (Projectile.numHits > 0 && !exitedTarget)) + return false; + + return base.CanDamage(); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.25f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool PreDraw(ref Color lightColor) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/ExaltedOathblade").Value; + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + + float fadeScale = (1 - Projectile.Opacity); + for (int i = 0; i < 16; i++) + { + Color auraColor = Color.MediumOrchid with { A = 0 } * 0.4f * fadeScale * Projectile.Opacity; + Vector2 drawOffset = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * 9 * fadeScale; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + if (exitedTarget && !stuckInGround) + { + Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey"); + Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, Color.BlueViolet with { A = 0 } * 0.45f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.2f * Main.rand.NextFloat(0.8f, 1.15f), SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 0.95f, SpriteEffects.None); + + } + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + return false; + } + /* + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.timeLeft); + writer.Write(Projectile.rotation); + writer.Write(Projectile.localAI[2]); + writer.Write(Projectile.localAI[0]); + + writer.WriteFlags(stuckInTarget, thrown); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.timeLeft = reader.Read(); + Projectile.rotation = reader.ReadSingle(); + Projectile.localAI[2] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + + reader.ReadFlags(out stuckInTarget, out thrown); + } + */ + } +} diff --git a/Projectiles/Melee/ExcelsusBlue.cs b/Projectiles/Melee/ExcelsusBlue.cs index df52f54cfd..2ae98ca2fc 100644 --- a/Projectiles/Melee/ExcelsusBlue.cs +++ b/Projectiles/Melee/ExcelsusBlue.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 55d116045f..4b86ba15d7 100644 --- a/Projectiles/Melee/ExcelsusMain.cs +++ b/Projectiles/Melee/ExcelsusMain.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 d260c54745..5bf63ee24e 100644 --- a/Projectiles/Melee/ExcelsusPink.cs +++ b/Projectiles/Melee/ExcelsusPink.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 96b0c2a0b9..553cb5793c 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -29,8 +29,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 30; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 30; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -141,7 +142,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; float bladeScale = Utils.GetLerpValue(3f, 13f, Projectile.velocity.Length(), true) * 1.2f; //Draw the blade. diff --git a/Projectiles/Melee/ExobeamSlash.cs b/Projectiles/Melee/ExobeamSlash.cs index c93a8ee983..731a9e3e59 100644 --- a/Projectiles/Melee/ExobeamSlash.cs +++ b/Projectiles/Melee/ExobeamSlash.cs @@ -41,10 +41,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - return Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index c754b6d14e..884824bdbe 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -172,8 +172,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 120; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 120; } public override void SetDefaults() @@ -229,6 +229,7 @@ namespace CalamityMod.Projectiles.Melee public void InitializationEffects(bool startInitialization) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //recalcualte the direction of the swing Projectile.velocity = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld); //Give the sword slash a random squouish @@ -256,8 +257,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)SwingTime; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } public override void AI() @@ -361,6 +361,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft == 1 + (int)(SwingTime * (Exoblade.PercentageOfAnimationSpentLunging))) SoundEngine.PlaySound(Exoblade.DashSound, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld); Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; @@ -374,6 +375,8 @@ namespace CalamityMod.Projectiles.Melee { float rotationStrenght = MathHelper.PiOver4 * 0.05f * (float)Math.Pow(LungeProgression, 3); float currentRotation = Projectile.velocity.ToRotation(); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float idealRotation = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld).ToRotation(); Projectile.velocity = currentRotation.AngleTowards(idealRotation, rotationStrenght).ToRotationVector2(); @@ -514,7 +517,7 @@ namespace CalamityMod.Projectiles.Melee public void DrawBlade() { - var texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + var texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; SpriteEffects direction = Direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; if (State == SwingState.Swinging) diff --git a/Projectiles/Melee/FallenBlast.cs b/Projectiles/Melee/FallenBlast.cs index 7f92c854bd..9061a94f24 100644 --- a/Projectiles/Melee/FallenBlast.cs +++ b/Projectiles/Melee/FallenBlast.cs @@ -1,12 +1,6 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; 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.Projectiles.Melee @@ -38,14 +32,26 @@ namespace CalamityMod.Projectiles.Melee Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; if (Projectile.frame >= 8) Projectile.Kill(); + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2 * 1.5f; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 60); + float minMult = 0.15f; + int hitsToMinMult = 12; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + // If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + { + Projectile.numHits -= 1; + } } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } } diff --git a/Projectiles/Melee/FallenExplosionSmall.cs b/Projectiles/Melee/FallenExplosionSmall.cs new file mode 100644 index 0000000000..0f7bc1bd9e --- /dev/null +++ b/Projectiles/Melee/FallenExplosionSmall.cs @@ -0,0 +1,39 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class FallenExplosionSmall : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float ExplosionRadius = 75f; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 75; + Projectile.height = 75; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + 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.85f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + } +} diff --git a/Projectiles/Melee/FallenPaladinsHammerEcho.cs b/Projectiles/Melee/FallenPaladinsHammerEcho.cs index 9105b741dd..875dca52b7 100644 --- a/Projectiles/Melee/FallenPaladinsHammerEcho.cs +++ b/Projectiles/Melee/FallenPaladinsHammerEcho.cs @@ -1,5 +1,4 @@ -using System; -using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -15,15 +14,17 @@ namespace CalamityMod.Projectiles.Melee public static readonly SoundStyle SlamHamSound = new("CalamityMod/Sounds/Item/FallenPaladinsHammerBigImpact") { Volume = 0.6f }; public static readonly SoundStyle Kunk = new("CalamityMod/Sounds/Item/TF2PanHit") { Volume = 1.1f }; public float speed = 0f; + public NPC targeted; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { - Projectile.width = 40; - Projectile.height = 40; + Projectile.width = 62; + Projectile.height = 62; Projectile.aiStyle = 0; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; @@ -31,41 +32,44 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 48, 48, 56); - } - public override void AI() { Projectile.ai[0] += 1f; if (Projectile.ai[0] < 42f) { Projectile.velocity *= 0.95f; - Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0]; + Projectile.rotation += (1f * Utils.GetLerpValue(30, 0, Projectile.ai[0]) * Projectile.direction); } - else if (Projectile.ai[0] > 42f) + else if (Projectile.ai[0] >= 42f) { - Projectile.extraUpdates = 1; - if (Projectile.ai[1] < 0f) - { - CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 2000f, speed, 12f); - if (Projectile.ai[0] > 80f) - Projectile.Kill(); - return; - } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 * 0.5f; + Projectile.extraUpdates = 4; - NPC target = Main.npc[(int)Projectile.ai[1]]; - if (!target.CanBeChasedBy(Projectile, false) || !target.active) - Projectile.Kill(); - else + if (Projectile.ai[1] != -5) + targeted = Main.npc[(int)Projectile.ai[1]]; + if (targeted == null || !targeted.CanBeChasedBy(Projectile, false) || !targeted.active) { - float velConst = 7f; - velConst--; - Projectile.velocity = new Vector2((target.Center.X - Projectile.Center.X) / velConst, (target.Center.Y - Projectile.Center.Y) / velConst); - Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0]; + Projectile.ai[1] = -5; + targeted = Projectile.Center.ClosestNPCAt(2000); + } + if (targeted != null) + { + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.7f, 25, 0.98f); + } + else + Projectile.Kill(); + } + if (Projectile.ai[0] == 42f && targeted != null) + { + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, ((targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX) * 15).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.2f); + dust.color = Main.rand.NextBool() ? Color.IndianRed : Color.Red; } } @@ -73,19 +77,16 @@ 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(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; - } - - if (Main.rand.NextBool(6)) - { - Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); - Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - 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 dust = Dust.NewDustPerfect(Projectile.Center + offset, 267, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 0, new Color(255, 245, 198), 1f); dust.noGravity = true; + dust.color = Color.DarkRed; } } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (targeted != null && target != targeted) + modifiers.SourceDamage *= 0.3f; + } public override bool? CanHitNPC(NPC target) { if (Projectile.ai[0] <= 42f) @@ -97,7 +98,9 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.localAI[0] = target.whoAmI; + target.AddBuff(ModContent.BuffType(), 180); + if (target == targeted) + Projectile.Kill(); } public override bool PreKill(int timeLeft) @@ -111,27 +114,17 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SlamHamSound, Projectile.Center); Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 5; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.001f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); return false; } public override bool PreDraw(ref Color lightColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); - Vector2 origin = sourceRectangle.Size() / 2f; + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/FallenPaladinsHammer").Value; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.DarkRed with { A = 0 } * 0.5f, 1, texture, true, true); - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - float rot = MathHelper.ToRadians(22.5f) * Math.Sign(Projectile.velocity.X); - Vector2 drawPos = Projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, Projectile.gfxOffY); - Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - Main.EntitySpriteDraw(texture, drawPos, new Rectangle?(), color, Projectile.rotation - i * rot, origin, Projectile.scale, spriteEffects, 0); - } + Projectile.DrawProjectileWithBackglow(Color.Red with { A = 0 }, Color.Lerp(Color.Red, Color.White, 0.5f), 5f, texture); return false; } } diff --git a/Projectiles/Melee/FallenPaladinsHammerProj.cs b/Projectiles/Melee/FallenPaladinsHammerProj.cs index fc5331c3a0..fae1893ed4 100644 --- a/Projectiles/Melee/FallenPaladinsHammerProj.cs +++ b/Projectiles/Melee/FallenPaladinsHammerProj.cs @@ -1,8 +1,7 @@ using System; -using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -20,11 +19,12 @@ namespace CalamityMod.Projectiles.Melee 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 int returnhammer = 0; + public int time = 0; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 7; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -49,8 +49,13 @@ namespace CalamityMod.Projectiles.Melee if (returnhammer == 0) { - Projectile.velocity.X *= 0.9711f; - Projectile.velocity.Y += 0.426f; + int falloffTime = 15; + if (time > falloffTime) + Projectile.velocity.X *= 0.967f; + if (Projectile.velocity.Y < 15 && time > falloffTime) + Projectile.velocity.Y += 0.426f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.98f; } if (returnhammer == 1) @@ -64,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee if (returnhammer == 2) { - float returnSpeed = FallenPaladinsHammer.Speed; + float returnSpeed = FallenPaladinsHammer.Speed * 0.7f; float acceleration = 1.1f; Player owner = Main.player[Projectile.owner]; Vector2 playerCenter = owner.Center; @@ -108,15 +113,15 @@ namespace CalamityMod.Projectiles.Melee if (EmpoweredHammer == 3) { SoundEngine.PlaySound(RedHamSound, Projectile.Center); - for (int i = 0; i < 30; i++) + for (int i = 0; i < 20; i++) { - Dust fire = Dust.NewDustPerfect(Projectile.Center, 218); + Dust fire = Dust.NewDustPerfect(Projectile.Center, 90); 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.scale = Main.rand.NextFloat(0.7f, 1.2f) + EmpoweredHammer * 0.4f; fire = Dust.CloneDust(fire); fire.velocity = Main.rand.NextVector2Circular(3f, 3f); @@ -131,15 +136,15 @@ namespace CalamityMod.Projectiles.Melee else { SoundEngine.PlaySound(SoundID.DD2_BetsysWrathShot with { Volume = 0.4f }, Projectile.Center); - for (int i = 0; i < 30; i++) + for (int i = 0; i < 20; i++) { - Dust fire = Dust.NewDustPerfect(Projectile.Center, 218); + Dust fire = Dust.NewDustPerfect(Projectile.Center, 90); 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.scale = Main.rand.NextFloat(0.7f, 1.2f) + EmpoweredHammer * 0.4f; fire = Dust.CloneDust(fire); fire.velocity = Main.rand.NextVector2Circular(3f, 3f); @@ -157,17 +162,11 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(205, 38, 38), 2f); - dust.noGravity = true; - } - - if (Main.rand.NextBool(6)) - { - Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); - Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(205, 38, 38), 2f); + Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 267, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 0, default, 0.7f); dust.noGravity = true; + dust.color = Color.DarkRed; } + time++; } // On hit play GONG and spawn dust. public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -175,6 +174,8 @@ namespace CalamityMod.Projectiles.Melee Player player = Main.player[Projectile.owner]; if (returnhammer == 0) { + Projectile.ai[1] = target.whoAmI; + if (Main.zenithWorld) SoundEngine.PlaySound(UseSoundFunny with { Pitch = EmpoweredHammer * 0.2f - 0.4f }, Projectile.Center); @@ -183,33 +184,37 @@ namespace CalamityMod.Projectiles.Melee returnhammer = 1; } - float numberOfDusts = 35f; + float numberOfDusts = 30f; 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 dust = Dust.NewDustPerfect(Projectile.Center + offset, (Projectile.numHits == 0 ? (Main.rand.NextBool() ? 90 : ModContent.DustType()) : 90), new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; - dust.velocity = velOffset; - dust.scale = Main.rand.NextFloat(1.5f, 3.2f); + dust.velocity = velOffset * (Projectile.numHits == 0 ? ( i % 3 == 0 ? 3 : 1.5f) : 1); + dust.scale = Main.rand.NextFloat(1.3f, 2.2f); + if (Projectile.numHits == 0) + dust.color = Color.Red; + } + if (Projectile.numHits == 0) + { + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack, Projectile.owner, 0f); } - - 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; + target.AddBuff(ModContent.BuffType(), 90); + float minMult = 0.7f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } - public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/Flarefrost.cs b/Projectiles/Melee/Flarefrost.cs index 29509bde38..b29d9dba38 100644 --- a/Projectiles/Melee/Flarefrost.cs +++ b/Projectiles/Melee/Flarefrost.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs new file mode 100644 index 0000000000..edbf65fe72 --- /dev/null +++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs @@ -0,0 +1,339 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Packets.Entities; +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.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ForbiddenOathbladeHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/ForbiddenOathblade"; + public float hitboxMult = 1.3f; + public override float HitboxOutset => 60; + + public override Vector2 HitboxSize => new Vector2(120, 120) * hitboxMult; + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(-3, 74); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public bool finalFlip = false; + public bool playSwingSound = true; + public bool holding = true; + public int postSwingCooldown = 0; + public bool willDie = false; + public bool hasLaunchedBlades = false; + public bool swooshFade = false; + public int postSwingCooldownMax => (int)(useAnim * 0.65f); + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void WhenSpawned() + { + IgnoreActiveAnimation = true; + DrawUnconditionally = true; + CanHit = false; + Projectile.knockBack = 0; + Projectile.scale = 1.15f; + Projectile.ai[1] = -1; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = (int)(Owner.HeldItem.useAnimation / Owner.GetTotalAttackSpeed()); + postSwingCooldown = postSwingCooldownMax / 2; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + public override void OnKill(int timeLeft) + { + Owner.Calamity().demonSwordKillMode = false; + } + public override void UseStyle() + { + bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); + + if ((Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0) + { + Animation = (int)(useAnim * 0.7f); + holding = false; + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1; + swingCount++; + } + if (postSwingCooldown > 0) + postSwingCooldown--; + else if (willDie) + { + if (hasKillMode) + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + DrawUnconditionally = false; + Projectile.Kill(); + Owner.Calamity().demonSwordKillMode = false; + return; + } + if (killModeCD.timeLeft < KillMode.cooldownMax) + { + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + } + + if (holding) + Animation--; + + AnimationProgress = Animation % useAnim; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit && !swooshFade) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.5f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.23f); + + if (!doSwing) + { + Projectile.ai[1] = -Projectile.ai[1]; + holding = true; + + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + finalFlip = false; + playSwingSound = true; + hasLaunchedBlades = false; + if (!Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0) + { + willDie = true; + } + + postSwingCooldown = postSwingCooldownMax; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); + + if (holding) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.7f, useAnim, Animation, true)) * 0.35f)), 0.2f); + } + else if (!willDie) + { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0 ? true : false; + } + + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time >= (int)(timeMax * 0.4f) && playSwingSound) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); + SoundEngine.PlaySound(swing with { Volume = 0.85f, Pitch = Main.rand.NextFloat(-0.4f, -0.5f) }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/HeavySwing"); + SoundEngine.PlaySound(swing2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, Projectile.Center); + playSwingSound = false; + Owner.Calamity().demonSwordKillMode = false; + } + if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.9f)) + CanHit = true; + else + CanHit = false; + if (time > (int)(timeMax * 0.7f)) + swooshFade = true; + else + swooshFade = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax * 0.9f, 1))), + 0.2f); + + if (time >= timeMax * 0.9f) + { + doSwing = false; + } + if (time < (int)(timeMax * 0.75f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + } + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Vector2 placement = Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); + + int bonusDamage = 120; + if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage) + { + target.Calamity().demonicFlamesBonusDamage = bonusDamage; + target.AddBuff(ModContent.BuffType(), 180); + // Demonic Flames damage must be synced, because OnHitNPC is only run for the client that hit the NPC + if (Main.netMode != NetmodeID.SinglePlayer) + DemonicFlamesSyncPacket.Send(target); + } + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + CalamityUtils.MoveNPC(target, launchVel, 17, true); + + int dustNum = (int)MathHelper.Clamp(12 - Projectile.numHits * 3, 3, 12); + for (int i = 0; i < dustNum; i++) + { + float variance = Main.rand.NextFloat(-0.5f, 0.5f); + int dustStyle = 278; + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle, Projectile.velocity); + dust2.scale = Main.rand.NextFloat(1.2f, 1.4f) - Math.Abs(variance); + dust2.velocity = (launchVel * 25).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + } + + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.BlueViolet, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f * (i + 1), 1f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f * (i + 1), 0.5f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + if (!hasLaunchedBlades) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[2] == target.whoAmI && projectile.localAI[0] != 5) + { + projectile.owner = Owner.whoAmI; + projectile.localAI[0] = 5; + projectile.velocity = (launchVel * 16.5f).RotatedByRandom(0.25f); + Owner.Calamity().demonSwordKillMode = true; + if (hasKillMode) + killModeCD.timeLeft = KillMode.cooldownMax + KillMode.buffMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax + KillMode.buffMax; + hasLaunchedBlades = true; + } + } + } + + if (Projectile.numHits == 0) + { + Owner.Calamity().GeneralScreenShakePower = 5.5f; + for (int i = 0; i < 4; i++) + GeneralParticleHandler.SpawnParticle(new CustomSpark(target.Center + launchVel * 15, launchVel.RotatedBy((0.15f - 0.05f * i) * (i % 2 == 0 ? -1 : 1)) * (10 + 10 * i), "CalamityMod/Particles/DemonSigilParticle", false, 11, 0.7f - 0.15f * i, Color.MediumOrchid, new Vector2(1.5f, 1), extraRotation: MathHelper.ToRadians(i % 2 == 0 ? 90 : 0), shrinkSpeed: (i % 2 == 0 ? -0.8f : 0.8f))); + + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordStrongImpact"); + SoundEngine.PlaySound(swing with { Volume = 1f, Pitch = MathHelper.Clamp(swingCount * 0.05f, -0.1f, 0.65f) }, Projectile.Center); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally)) + { + Asset tex = ModContent.Request(Texture); + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1; + + for (int i = 0; i < 20; i++) + { + Color auraColor = Color.MediumOrchid with { A = 0 } * 0.18f * (willDie ? deathFade : fadeIn); + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 6 * (willDie ? (1 - deathFade) * 2 : fadeIn); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.29f * hitboxMult, SpriteEffects.None); + + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs deleted file mode 100644 index 3af5f732c7..0000000000 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ /dev/null @@ -1,91 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -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; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 46; - Projectile.height = 46; - Projectile.alpha = Alpha; - Projectile.timeLeft = TimeLeft; - Projectile.ignoreWater = true; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.MaxUpdates = 2; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; - } - - public override void AI() - { - float alphaLightScale = Projectile.alpha / (float)Alpha; - Lighting.AddLight(Projectile.Center, 0.5f * alphaLightScale, 0f, 0.5f * alphaLightScale); - - 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) - { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.ShadowFlame, 90); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - } -} diff --git a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs new file mode 100644 index 0000000000..979189d83c --- /dev/null +++ b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs @@ -0,0 +1,383 @@ +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Packets.Entities; +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.ModLoader.IO; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class ForbiddenOathbladeThrownBlade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/ForbiddenOathblade"; + + public int ChargeupTime => (int)Projectile.localAI[2]; + public int Lifetime = 120; + 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]; + + // Real variables here + public ref float time => ref Projectile.ai[0]; + public ref float stabOrder => ref Projectile.ai[1]; + public ref NPC stabbedTarget => ref Main.npc[(int)Projectile.ai[2]]; + + public bool thrown = false; + public int fadeOutTime = 80; + public bool stuckInTarget = false; + public int stuckTimer = 0; + public bool exitedTarget = false; + public bool stuckInGround = false; + public Vector2 impalePos; + public int bounces = 0; + public Vector2 tipPosition = Vector2.Zero; + public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime); + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.noEnchantmentVisuals = true; + } + + public override bool ShouldUpdatePosition() + { + return (ChargeProgress >= 1 && !stuckInGround && !stuckInTarget); + } + + //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() + { + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = Color.MediumOrchid.ToVector3(); + Lighting.AddLight(Projectile.Center, Light * 0.5f); + + if (Projectile.timeLeft == Lifetime) + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.velocity = toMouse * 14; + Projectile.Center = Owner.MountedCenter + toMouse * 12f; + Projectile.spriteDirection = Projectile.direction; + thrown = true; + time = 0; + Projectile.extraUpdates = 1; + Projectile.tileCollide = true; + Projectile.netUpdate = true; + } + + if (Projectile.velocity.X > 0) + Projectile.direction = 1; + else + Projectile.direction = -1; + + if (thrown) + { + Projectile.spriteDirection = Projectile.direction; + + if (!stuckInGround && exitedTarget) + Projectile.rotation += (0.35f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f)) * Main.rand.NextFloat(0.7f, 1f) * Projectile.direction * Projectile.Opacity; + else + Projectile.rotation = (Projectile.velocity.ToRotation() + MathHelper.PiOver4 * (Projectile.direction == 1 ? 1 : 3)); + + if (time > fadeOutTime * 0.7f) + Projectile.velocity *= 0.93f; + + if (stuckInTarget) + { + Projectile.tileCollide = false; + time--; + Projectile.timeLeft++; + if (stuckTimer > 0) + stuckTimer--; + else + { + Projectile.velocity *= 0.01f; + stabbedTarget.Calamity().demonSwordImpales--; + stuckInTarget = false; + fadeOutEffect(); + } + + Projectile.Center = stabbedTarget.Center + impalePos; + if ((stabbedTarget.life <= 0) || stabbedTarget == null || Projectile.localAI[0] == 5 || !stabbedTarget.active) + { + Projectile.timeLeft = Lifetime; + stabbedTarget.Calamity().demonSwordImpales--; + stuckInTarget = false; + exitedTarget = true; + Projectile.tileCollide = true; + Projectile.rotation += Main.rand.NextFloat(-1.5f, 1.5f); + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.numHits = 0; + SoundStyle unstuck = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + SoundEngine.PlaySound(unstuck with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.3f, 0.4f), MaxInstances = 3 }, Projectile.Center); + } + } + if (exitedTarget && !stuckInGround) + { + if (Projectile.velocity.Y < 14 && Projectile.timeLeft < (bounces == 1 ? Lifetime - 20 : Lifetime)) + Projectile.velocity.Y += 0.1f * (bounces * 3); + } + + if (fadingOut) + fadeOutEffect(); + } + if (!fadingOut && !stuckInTarget && !stuckInGround && ChargeProgress >= 1) + { + for (int i = 0; i < 2; i++) + { + Vector2 safeVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(90 * (i == 0 ? 1 : -1))).RotatedByRandom(0.1f) * Main.rand.NextFloat(3, 4); + if (!exitedTarget && Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel * 60, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.1f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 50; + } + if (exitedTarget && i == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45, 278, dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + } + } + + if (Main.rand.NextBool(4)) + { + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + //Anticipation animation. Make the player look like they're holding the item + if (ChargeProgress < 1) + { + throwAnimation(); + if (ChargeProgress >= 0.6f && time == 0) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); + SoundEngine.PlaySound(swing with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + time++; + } + return; + } + else + time++; + } + public void fadeOutEffect() + { + Projectile.tileCollide = false; + if (Projectile.timeLeft > Lifetime - fadeOutTime) + Projectile.timeLeft = Lifetime - fadeOutTime; + Projectile.Opacity = Utils.GetLerpValue(0, Lifetime - fadeOutTime, Projectile.timeLeft, true); + + Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 100; + dust.velocity += Projectile.velocity; + } + } + public void throwAnimation() + { + 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); + + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int bonusDamage = 60; + if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage) + { + target.Calamity().demonicFlamesBonusDamage = bonusDamage; + target.AddBuff(ModContent.BuffType(), 120); + // Demonic Flames damage must be synced, because OnHitNPC is only run for the client that hit the NPC + if (Main.netMode != NetmodeID.SinglePlayer) + DemonicFlamesSyncPacket.Send(target); + } + + if (!exitedTarget) + { + SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); + SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 3 }, Projectile.Center); + + Projectile.ai[2] = target.whoAmI; + + if (target.Calamity().demonSwordImpales < 0) + target.Calamity().demonSwordImpales = 0; + if (target.Calamity().demonSwordImpales >= 3) + { + float bladeValue = -1; + Projectile ejectedBlade = null; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.owner == Projectile.owner && projectile.type == Projectile.type && Projectile.localAI[0] != 5 && projectile.ai[2] == Projectile.ai[2] && projectile.timeLeft > (Lifetime - fadeOutTime) && (bladeValue == -1 || bladeValue > projectile.ai[1])) + { + bladeValue = projectile.ai[1]; + ejectedBlade = projectile; + } + } + ejectedBlade.localAI[0] = 5; + ejectedBlade.ai[1] += 1000; + ejectedBlade.velocity = Projectile.velocity.RotatedByRandom(0.12f); + + for (int i = 0; i < 10; i++) + { + Particle spark2 = new SparkParticle(target.Center, Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 1.5f), false, 45, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.3f, 1f), 0, default, Main.rand.NextFloat(1.3f, 1.6f)); + dust.noGravity = true; + dust.noLight = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + } + } + target.Calamity().demonSwordImpales++; + + stuckInTarget = true; + impalePos = Projectile.Center - stabbedTarget.Center; + stuckTimer = 3600; + } + Projectile.netUpdate = true; + if (Main.netMode != NetmodeID.SinglePlayer) + DemonSwordImpalesSyncPacket.Send(target); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.4f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (exitedTarget ? 1.15f : 1f); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (exitedTarget) + { + if (bounces >= 2) + { + impaleGround(oldVelocity); + } + 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.velocity.Length() < 8) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8; + Projectile.velocity.Y *= 0.85f; + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/CeramicImpact", 2) { Volume = 0.35f, Pitch = Main.rand.NextFloat(-0.4f, -0.5f) }, Projectile.Center); + bounces++; + Projectile.timeLeft = Lifetime; + } + } + else + { + impaleGround(oldVelocity); + } + Projectile.netUpdate = true; + return false; + } + public void impaleGround(Vector2 oldVelocity) + { + Projectile.velocity = oldVelocity; + stuckInGround = true; + Projectile.timeLeft = (int)(Lifetime - fadeOutTime * 0.3f); + Projectile.tileCollide = false; + SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); + SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.2f, 0.3f), MaxInstances = 3 }, Projectile.Center); + } + public override bool? CanDamage() + { + if (ChargeProgress < 1 || fadingOut || stuckInGround || stuckInTarget || (Projectile.numHits > 0 && !exitedTarget)) + return false; + + return base.CanDamage(); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.5f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool PreDraw(ref Color lightColor) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/ForbiddenOathblade").Value; + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + + float fadeScale = (1 - Projectile.Opacity); + for (int i = 0; i < 16; i++) + { + Color auraColor = Color.MediumOrchid with { A = 0 } * 0.4f * fadeScale * Projectile.Opacity; + Vector2 drawOffset = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * 9 * fadeScale; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + return false; + } + /* + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.timeLeft); + writer.Write(Projectile.rotation); + writer.Write(Projectile.localAI[2]); + writer.Write(Projectile.localAI[0]); + + writer.WriteFlags(stuckInTarget, thrown); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.timeLeft = reader.Read(); + Projectile.rotation = reader.ReadSingle(); + Projectile.localAI[2] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + + reader.ReadFlags(out stuckInTarget, out thrown); + } + */ + } +} diff --git a/Projectiles/Melee/GaelSkull.cs b/Projectiles/Melee/GaelSkull.cs index cc8938bb6d..173ff6754d 100644 --- a/Projectiles/Melee/GaelSkull.cs +++ b/Projectiles/Melee/GaelSkull.cs @@ -13,9 +13,10 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -96,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.frame++; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GaelSkull2.cs b/Projectiles/Melee/GaelSkull2.cs index 5e09a998e6..43b3fc5cc5 100644 --- a/Projectiles/Melee/GaelSkull2.cs +++ b/Projectiles/Melee/GaelSkull2.cs @@ -13,9 +13,10 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -93,7 +94,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.frame++; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -108,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GalacticaComet.cs b/Projectiles/Melee/GalacticaComet.cs index fedde06c1d..1d273db9e9 100644 --- a/Projectiles/Melee/GalacticaComet.cs +++ b/Projectiles/Melee/GalacticaComet.cs @@ -1,5 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Steamworks; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -10,140 +14,104 @@ namespace CalamityMod.Projectiles.Melee public class GalacticaComet : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - private int noTileHitCounter = 90; - + public int time = 0; + public int cometType = 0; + public Color useColor = Color.White; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } - public override void SetDefaults() { - Projectile.width = 34; - Projectile.height = 34; - Projectile.alpha = 100; + Projectile.width = 102; + Projectile.height = 102; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; + Projectile.penetrate = -1; + Projectile.extraUpdates = 2; Projectile.timeLeft = 600; Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - noTileHitCounter -= 1; - if (noTileHitCounter == 0) - 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.localAI[0] += 1f; - if (Projectile.localAI[0] == 18f) - { - Projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 dustRotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - dustRotate += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); - dustRotate = dustRotate.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); - int galactic = Dust.NewDust(Projectile.Center, 0, 0, Main.rand.NextBool() ? 164 : 229, 0f, 0f, 160, default, 1f); - Main.dust[galactic].noGravity = true; - Main.dust[galactic].position = Projectile.Center + dustRotate; - Main.dust[galactic].velocity = Projectile.velocity * 0.1f; - Main.dust[galactic].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[galactic].position) * 1.25f; - } - } - - Projectile.alpha -= 15; - int alphaControl = 150; - if (Projectile.Center.Y >= Projectile.ai[1]) - alphaControl = 0; - if (Projectile.alpha < alphaControl) - Projectile.alpha = alphaControl; - + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - - if (Main.rand.NextBool(16)) + if (time == 0) { - Vector2 rotation = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - 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; + Projectile.scale = Main.rand.NextFloat(0.6f, 0.8f); + cometType = Main.rand.Next(1, 3 + 1); + useColor = cometType switch + { + 1 => Color.Cyan, + 2 => Color.Gold, + _ => Color.HotPink, + }; } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (targetDist < 1400) { - int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[gored].velocity *= 0.66f; - Main.gore[gored].velocity += Projectile.velocity * 0.3f; + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 7, 0.1f, useColor * 0.45f, new Vector2(1, 0.3f), true, false, 1f); + GeneralParticleHandler.SpawnParticle(spark); } - if (Projectile.ai[1] == 1f) - { - Projectile.light = 0.5f; - if (Main.rand.NextBool(10)) - 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); - } + time++; + Projectile.velocity *= 1.01f; } - - 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(Main.DiscoR, 100, 255, Projectile.alpha); - } - public override void OnKill(int timeLeft) { - if (Projectile.ai[0] == 1f) - return; - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 68; - 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 < 4; i++) - { - 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(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(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 50, default, 1.5f); - Main.dust[galaxyDust].velocity *= 2f; - Main.dust[galaxyDust].noGravity = true; - } - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); + + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.9f); // 10% damage nerf for every enemy hit + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.DamageType != DamageClass.Ranged) - target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.numHits == 0) + { + for (int i = 0; i <= 12; i++) + { + if (i < 8) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.One * 9).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + dust.noGravity = true; + dust.color = useColor; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, (Vector2.One * 9).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(0.8f, 1.3f)); + dust.noGravity = false; + dust.color = Color.Lerp(useColor, Color.White, 0.5f); + } + } + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact with { Volume = 0.7f, PitchVariance = 0.3f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with { Volume = 1f, PitchVariance = 0.3f }, Projectile.Center); + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + if (cometType == 1) + tex = ModContent.Request("CalamityMod/Projectiles/Melee/GalacticaComet").Value; + if (cometType == 2) + tex = ModContent.Request("CalamityMod/Projectiles/Melee/GalacticaComet2").Value; + if (cometType == 3) + tex = ModContent.Request("CalamityMod/Projectiles/Melee/GalacticaComet3").Value; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White, 2, tex); + return false; } } } diff --git a/Projectiles/Melee/GalacticaComet.png b/Projectiles/Melee/GalacticaComet.png index a48c0a7b7a..35fbcc775e 100644 Binary files a/Projectiles/Melee/GalacticaComet.png and b/Projectiles/Melee/GalacticaComet.png differ diff --git a/Projectiles/Melee/GalacticaComet2.png b/Projectiles/Melee/GalacticaComet2.png new file mode 100644 index 0000000000..720e83734a Binary files /dev/null and b/Projectiles/Melee/GalacticaComet2.png differ diff --git a/Projectiles/Melee/GalacticaComet3.png b/Projectiles/Melee/GalacticaComet3.png new file mode 100644 index 0000000000..716ecda257 Binary files /dev/null and b/Projectiles/Melee/GalacticaComet3.png differ diff --git a/Projectiles/Melee/GalaxiaBolt.cs b/Projectiles/Melee/GalaxiaBolt.cs index 1e9c160c2b..23478acb09 100644 --- a/Projectiles/Melee/GalaxiaBolt.cs +++ b/Projectiles/Melee/GalaxiaBolt.cs @@ -15,14 +15,17 @@ namespace CalamityMod.Projectiles.Melee public Player Owner => Main.player[Projectile.owner]; public ref float Hue => ref Projectile.ai[0]; - public ref float HomingStrenght => ref Projectile.ai[1]; + public ref float HomingStrength => ref Projectile.ai[1]; + public ref float ShouldDelayHoming => ref Projectile.ai[2]; + public bool StrongerHoming = false; Particle Head; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -55,10 +58,10 @@ namespace CalamityMod.Projectiles.Melee if (target == null) target = Projectile.Center.ClosestNPCAt(812f, true); - else if (CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < MathHelper.PiOver2) //Home in + else if ((CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < MathHelper.PiOver2 || StrongerHoming) && (ShouldDelayHoming != 1f || Projectile.timeLeft < 60)) //Home in { float idealDirection = Projectile.AngleTo(target.Center); - float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, HomingStrenght); + float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, HomingStrength); Projectile.velocity = updatedDirection.ToRotationVector2() * Projectile.velocity.Length() * 0.995f; } @@ -80,7 +83,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/GalaxiaHoldout.cs b/Projectiles/Melee/GalaxiaHoldout.cs index 14426ffbcf..03485e975a 100644 --- a/Projectiles/Melee/GalaxiaHoldout.cs +++ b/Projectiles/Melee/GalaxiaHoldout.cs @@ -3,6 +3,7 @@ using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Sounds; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -87,41 +88,31 @@ namespace CalamityMod.Projectiles.Melee if (CycleDirection == -1) //Cycles goes Phoenix => Aries => Polaris => Andromeda { - switch (item.mainAttunement.id) + attunement = item.mainAttunement.id switch { - case AttunementID.Phoenix: //Switching to the aries attunement. - attunement = Attunement.attunementArray[(int)AttunementID.Aries]; - break; - case AttunementID.Aries: //Switching to the polaris attunement. - attunement = Attunement.attunementArray[(int)AttunementID.Polaris]; - break; - case AttunementID.Polaris: //Switching to the andromeda attunement. - attunement = Attunement.attunementArray[(int)AttunementID.Andromeda]; - break; - case AttunementID.Andromeda: //Switching to the phoenix attunement. - default: - attunement = Attunement.attunementArray[(int)AttunementID.Phoenix]; - break; - } + //Switching to the aries attunement. + AttunementID.Phoenix => AttunementSystem.FindOrNull(AttunementID.Aries), + //Switching to the polaris attunement. + AttunementID.Aries => AttunementSystem.FindOrNull(AttunementID.Polaris), + //Switching to the andromeda attunement. + AttunementID.Polaris => AttunementSystem.FindOrNull(AttunementID.Andromeda), + //Switching to the phoenix attunement. + _ => AttunementSystem.FindOrNull(AttunementID.Phoenix), + }; } else //Cycles goes Phoenix <= Aries <= Polaris <= Andromeda { - switch (item.mainAttunement.id) + attunement = item.mainAttunement.id switch { - case AttunementID.Phoenix: //Switching to the andromeda attunement. - attunement = Attunement.attunementArray[(int)AttunementID.Andromeda]; - break; - case AttunementID.Andromeda: //Switching to the polaris attunement. - attunement = Attunement.attunementArray[(int)AttunementID.Polaris]; - break; - case AttunementID.Polaris: //Switching to the aries attunement. - attunement = Attunement.attunementArray[(int)AttunementID.Aries]; - break; - case AttunementID.Aries: //Switching to the phoenix attunement. - default: - attunement = Attunement.attunementArray[(int)AttunementID.Phoenix]; - break; - } + //Switching to the andromeda attunement. + AttunementID.Phoenix => AttunementSystem.FindOrNull(AttunementID.Andromeda), + //Switching to the polaris attunement. + AttunementID.Andromeda => AttunementSystem.FindOrNull(AttunementID.Polaris), + //Switching to the aries attunement. + AttunementID.Polaris => AttunementSystem.FindOrNull(AttunementID.Aries), + //Switching to the phoenix attunement. + _ => AttunementSystem.FindOrNull(AttunementID.Phoenix), + }; } switch (attunement.id) diff --git a/Projectiles/Melee/GalaxiaTropicRing.cs b/Projectiles/Melee/GalaxiaTropicRing.cs deleted file mode 100644 index c0fb8cc795..0000000000 --- a/Projectiles/Melee/GalaxiaTropicRing.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalaxiaTropicRing : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public Player Owner => Main.player[Projectile.owner]; - public ref float Mode => ref Projectile.ai[0]; - public ref float Fade => ref Projectile.ai[1]; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 300; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (Mode == 0f && Main.rand.NextFloat() < FourSeasonsGalaxia.CancerPassiveLifeStealProc) - { - Owner.statLife += FourSeasonsGalaxia.CancerPassiveLifeSteal; - Owner.HealEffect(FourSeasonsGalaxia.CancerPassiveLifeSteal); - } - else - { - target.AddBuff(BuffType(), FourSeasonsGalaxia.CapricornPassiveDebuffTime); - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * 95 * Projectile.scale, Vector2.One * 190 * Projectile.scale); - } - - public override void AI() - { - Projectile.velocity *= 0.95f; - - if (Mode == 0f) - Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Center, 0.4f * MathHelper.Clamp((Projectile.timeLeft - 150) / 150f, 0, 1)); - else - Projectile.velocity = Utils.SafeNormalize(Projectile.Center - Owner.Center, Vector2.Zero) * MathHelper.Clamp((Projectile.timeLeft - 150) / 150f, 0, 1) * 3f * (5f - MathHelper.Clamp((Projectile.Center - Owner.Center).Length() / 150f, 0, 4f)); - - Fade = Projectile.timeLeft > 250 ? (float)Math.Sin((300 - Projectile.timeLeft) / 50f * MathHelper.PiOver2) * 0.6f + 0.4f : Projectile.timeLeft > 50 ? 1f : (float)Math.Sin((Projectile.timeLeft) / 50f * MathHelper.PiOver2); - Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - - } - - public Vector2 starPosition(int MaxStars, int StarIndex, float diameter) - { - float starHeight = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3 + StarIndex * MathHelper.TwoPi / (float)MaxStars); - float starWidth = (float)Math.Cos(Main.GlobalTimeWrappedHourly * 3 + StarIndex * MathHelper.TwoPi / (float)MaxStars); - - return Projectile.Center + Projectile.rotation.ToRotationVector2() * starWidth * (Projectile.scale * diameter * 0.4f) + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * starHeight * (Projectile.scale * diameter * 0.4f); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D sigil = Request(Mode == 0 ? "CalamityMod/Projectiles/Melee/GalaxiaCancer" : "CalamityMod/Projectiles/Melee/GalaxiaCapricorn").Value; //OMG Karkat and Gamzee from homestuck i am a big fan - Texture2D ring = Request("CalamityMod/Particles/BloomRing").Value; - Texture2D starTexture = Request("CalamityMod/Particles/Sparkle").Value; - Texture2D lineTexture = Request("CalamityMod/Particles/BloomLine").Value; - Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; - - Color ringColor = Mode == 0 ? new Color(255, 0, 0) * Fade : new Color(66, 0, 176) * Fade; - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - Main.EntitySpriteDraw(bloomTexture, Projectile.Center - Main.screenPosition, null, ringColor * 0.5f, 0, bloomTexture.Size() / 2f, 2.5f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(ring, Projectile.Center - Main.screenPosition, null, ringColor * 0.8f, 0f, ring.Size() / 2f, Projectile.scale, 0f, 0); - - Main.EntitySpriteDraw(sigil, Projectile.Center - Main.screenPosition, null, ringColor * MathHelper.Lerp(0.7f, 0f, ((Main.GlobalTimeWrappedHourly * 5f) % 10) / 10f), 0f, sigil.Size() / 2f, Projectile.scale + ((Main.GlobalTimeWrappedHourly * 5f) % 10) / 10f * 2f, 0f, 0); - Main.EntitySpriteDraw(sigil, Projectile.Center - Main.screenPosition, null, Color.White * Fade, 0f, sigil.Size() / 2f, Projectile.scale, 0f, 0); - - for (int i = 0; i < 5; i++) - { - - Vector2 starPos = starPosition(5, i, ring.Width); - - Vector2 LineVector = starPosition(5, i + 1, ring.Width) - starPos; - float rot = LineVector.ToRotation() + MathHelper.PiOver2; - Vector2 origin = new Vector2(lineTexture.Width / 2f, lineTexture.Height); - Vector2 scale = new Vector2(0.3f, LineVector.Length() / lineTexture.Height); - - Main.EntitySpriteDraw(lineTexture, starPos - Main.screenPosition, null, Color.White * Fade * 0.7f, rot, origin, scale, SpriteEffects.None, 0); - - Main.EntitySpriteDraw(bloomTexture, starPos - Main.screenPosition, null, ringColor * 0.5f, 0, bloomTexture.Size() / 2f, 0.1f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(starTexture, starPos - Main.screenPosition, null, ringColor * 0.5f, Main.GlobalTimeWrappedHourly * 5 + MathHelper.PiOver4 * i, starTexture.Size() / 2f, 1f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(starTexture, starPos - Main.screenPosition, null, Color.White * Fade, Main.GlobalTimeWrappedHourly * 5, starTexture.Size() / 2f, 1.4f, SpriteEffects.None, 0); - } - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - return false; - } - } -} diff --git a/Projectiles/Melee/Galaxia_AndromedasStride.cs b/Projectiles/Melee/Galaxia_AndromedasStride.cs index 63dde30024..0fc0b0e1bc 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStride.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStride.cs @@ -44,10 +44,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 16; } - public override bool? CanDamage() - { - return (State == 1); - } + public override bool? CanDamage() => State == 1f ? (bool?)null : false; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -87,20 +84,25 @@ namespace CalamityMod.Projectiles.Melee } else { - SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center); + float screenshakeLevel = 4f + CurrentIndicator * 2f; + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenshakeLevel) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenshakeLevel; + CustomPulse shatter = new(Owner.Center, Vector2.Zero, Color.HotPink, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.0075f * CurrentIndicator, 0.075f * CurrentIndicator, 30); + GeneralParticleHandler.SpawnParticle(shatter); + State = 1f; - Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death + Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; // Keep that even, if it's an odd number it'll fuck off and won't reset the player's velocity on death dashDuration = Projectile.timeLeft; lastDisplacement = Projectile.Center - Owner.Center; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } } } if (State == 0f) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); @@ -110,13 +112,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 2; if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f) && Owner.whoAmI == Main.myPlayer) { - //WOahhh do a ring of projectiles!! woahhh + // Spawn a ring of stars for (int i = 0; i < 5; i++) { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); - { - blast.timeLeft = 30; - } + Vector2 velocity = direction.RotatedByRandom(MathHelper.PiOver4) * 10f; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, velocity, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_ChargeupBoltDamageMultiplier), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f, 1f); } SoundEngine.PlaySound(SoundID.Item79, Projectile.Center); @@ -144,13 +144,11 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) { - //Projectiles!!! wah!!! + // Spawn more stars for (int i = 0; i < 9; i++) { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 9f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); - { - blast.timeLeft = 50; - } + Vector2 velocity = direction.RotatedByRandom(MathHelper.PiOver4) * 10f; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, velocity, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_ChargeupBoltDamageMultiplier), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f, 1f); } OverCharge = 20f; @@ -167,14 +165,14 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().LungingDown = true; + // Immediately cancel the lunge if you hit a tile + // Unlike its downgrades, there are NO effects from hitting tiles - it's too impractical at this stage, why would there be? if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10)) { - SlamDown(); Projectile.timeLeft = 0; Owner.Calamity().LungingDown = false; Projectile.active = false; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } Owner.velocity = direction * 30f; @@ -206,69 +204,22 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } - public void SlamDown() - { - if (Owner.whoAmI != Main.myPlayer) - return; - - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15; - - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction * 16f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); - proj.scale = 3f; - proj.timeLeft = 50; - - SideSprouts(1, 150f, 1f * Charge / MaxCharge); - SideSprouts(-1, 150f, 1f * Charge / MaxCharge); - - SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = SoundID.DD2_MonkStaffGroundImpact.Volume * 1.5f }, Projectile.Center); - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) - { - Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } - } - - if (validPositionFound) - { - Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is AndromedasStrideBoltSpawner spawner) - { - spawner.WaitTimer = (1 - projSize) * 34f; - spawner.OriginDirection = direction; - spawner.Facing = facing; - } - } - - return validPositionFound; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { // 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); + + // ai[0] is NPC index to stay locked onto it, ai[1] is charge level to determine how many stars are rained + if (!CalamityUtils.AnyProjectiles(ProjectileType())) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_StarDamageMultiplier), Projectile.knockBack, Owner.whoAmI, target.whoAmI, CurrentIndicator); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= 1f + FourSeasonsGalaxia.AndromedaAttunement_FullChargeBoost * (float)Math.Pow(Charge / MaxCharge, 2); + // Lunge always critically strikes + modifiers.SetCrit(); + modifiers.SourceDamage *= (FourSeasonsGalaxia.AndromedaAttunement_FullChargeMult * (float)Math.Pow(Charge / MaxCharge, 2)); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs index 1e34f170f6..00b06171b7 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs @@ -15,15 +15,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public Player Owner => Main.player[Projectile.owner]; - public ref float Size => ref Projectile.ai[1]; //Yes + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + public ref float ChargeLevel => ref Projectile.ai[1]; - public float WaitTimer; //How long until the monoliths appears - public Vector2 OriginDirection; //The direction of the original strike - public float Facing; //The direction of the original strike - - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -31,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.timeLeft = 30; + Projectile.timeLeft = 60; Projectile.hide = true; } @@ -39,31 +33,29 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.velocity != Vector2.Zero) + // Set time left based on charge level + if (Projectile.localAI[0] == 0f) { - SurfaceUp(); - Projectile.rotation = Projectile.velocity.ToRotation(); - Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = 15 * (int)ChargeLevel; + Projectile.localAI[0] = 1f; } - if (WaitTimer > 0) + // Constantly follow its target + // Die if the target is no longer active + if (!Target.active) { - Projectile.timeLeft = 30; - WaitTimer--; + Projectile.Kill(); + return; } + else + Projectile.Center = Target.Center; - if (Projectile.timeLeft == 29) - { - if (Size * 0.8 > 0.4 && Facing != 0) - SideSprouts(Facing, 150f, Size * 0.8f); - } - - if (Projectile.timeLeft < 29) + // Spawn smoke + if (Projectile.timeLeft < 59) { 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); + Vector2 flyDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 8f) * Main.rand.NextFloat(15f, 35f); 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); @@ -77,98 +69,36 @@ namespace CalamityMod.Projectiles.Melee } } - if (Projectile.timeLeft == 2) + // Rain stars from the sky + if (Projectile.timeLeft % 15 == 5) { - //New bolt - if (Owner.whoAmI == Main.myPlayer) + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Projectile.Center); + for (int i = 0; i < 2; i++) { - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.position, Projectile.rotation.ToRotationVector2() * 18f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); - proj.scale = Size * 3f; - proj.timeLeft = 50; + if (Owner.whoAmI == Main.myPlayer) + { + Vector2 starPos = new Vector2(Projectile.Center.X + Main.rand.NextFloat(-250f, 250f), Projectile.Center.Y - Main.rand.NextFloat(650f, 750f)); + Vector2 starVel = (Projectile.Center - starPos).SafeNormalize(Vector2.UnitY) * 27f; + Projectile star = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), starPos, starVel, ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI, 0.75f, MathHelper.Pi / 20f); + star.scale = 2f; + } } - Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Projectile.Center); - - for (int i = 0; i < 8; i++) + for (int i = 0; i < 4; i++) { - Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(0f, 10f); - Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(5f, 15f); + Vector2 hitPositionDisplace = -Vector2.UnitY * Main.rand.NextFloat(10f); + Vector2 flyDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(5f, 15f); - 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); + Particle smoke = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(1f, 1.6f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); 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); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Red, 20, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale, 0.8f, 0, true, 0.005f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } } } - - //Go up to the "surface" so you're not stuck in the middle of the ground like a complete moron. - public void SurfaceUp() - { - for (float i = 0; i < 40; i += 0.5f) - { - Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i; - if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - { - Projectile.Center = Projectile.Center + Projectile.velocity * i; - return; - } - } - Projectile.Center = Projectile.Center + Projectile.velocity * 40f; - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) - { - Vector2 positionToCheck = Projectile.Center + OriginDirection.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } - } - - if (validPositionFound) - { - Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is AndromedasStrideBoltSpawner spawner) - { - spawner.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f; - spawner.OriginDirection = OriginDirection; - spawner.Facing = facing; - } - } - - return validPositionFound; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(WaitTimer); - writer.Write(Facing); - writer.WriteVector2(OriginDirection); - - } - public override void ReceiveExtraAI(BinaryReader reader) - { - WaitTimer = reader.ReadSingle(); - Facing = reader.ReadSingle(); - OriginDirection = reader.ReadVector2(); - } } } diff --git a/Projectiles/Melee/Galaxia_AriesWrath.cs b/Projectiles/Melee/Galaxia_AriesWrath.cs index fbfac04194..71e94c3a56 100644 --- a/Projectiles/Melee/Galaxia_AriesWrath.cs +++ b/Projectiles/Melee/Galaxia_AriesWrath.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Melee { if (Owner.CantUseHoldout() || Owner.HeldItem.type != ItemType()) { - //Kill the projectile if too far away from the player or close enough to get "re-absorbed) + // 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) Projectile.Kill(); @@ -154,8 +154,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1f + ScaleEquation(); Projectile.timeLeft = 2; - Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Calamity().mouseWorld, 0.05f * ThrowDisplace()); - Projectile.Center = Projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 40f * ThrowDisplace()); + Vector2 mouse = Owner.ClampedMouseWorld(); + Projectile.Center = Vector2.Lerp(Projectile.Center, mouse, 0.05f * ThrowDisplace()); + Projectile.Center = Projectile.Center.MoveTowards(mouse, 40f * ThrowDisplace()); if ((Projectile.Center - Owner.Center).Length() > FourSeasonsGalaxia.AriesAttunement_Reach) Projectile.Center = Owner.Center + Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero) * FourSeasonsGalaxia.AriesAttunement_Reach; diff --git a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs index 12ed46f183..f28406a3ee 100644 --- a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs +++ b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs @@ -23,13 +23,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 PreviousEnd = Vector2.Zero; Vector2 AnchorStart => Owner.Center; - Vector2 AnchorEnd => Owner.Calamity().mouseWorld; + // 14NOV2024: Ozzatron: I have no idea what this does so I clamped it + Vector2 AnchorEnd => Owner.ClampedMouseWorld(); public Vector2 SizeVector => Utils.SafeNormalize(AnchorEnd - AnchorStart, Vector2.Zero) * MathHelper.Clamp((AnchorEnd - AnchorStart).Length(), 0, FourSeasonsGalaxia.AriesAttunement_Reach); public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 1; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 1; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee { Particles.Clear(); - PreviousEnd = Owner.Calamity().mouseWorld - Owner.Center; + PreviousEnd = Owner.ClampedMouseWorld() - Owner.Center; Projectile.ai[0] = 1; Vector2 previousStar = Projectile.Center; Vector2 offset; @@ -134,7 +135,7 @@ namespace CalamityMod.Projectiles.Melee Timer++; //Reset the constellation if the mouse goes too far - if ((Owner.Calamity().mouseWorld - Owner.Center - PreviousEnd).Length() > 120) + if ((Owner.ClampedMouseWorld() - Owner.Center - PreviousEnd).Length() > 120) Timer = ConstellationSwapTime; } diff --git a/Projectiles/Melee/Galaxia_PhoenixsPride.cs b/Projectiles/Melee/Galaxia_PhoenixsPride.cs index dea78a8c39..c473cb8de7 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPride.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPride.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -79,6 +79,7 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); Projectile.velocity = Vector2.Zero; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); initialized = true; @@ -102,8 +103,9 @@ namespace CalamityMod.Projectiles.Melee Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES + // PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); @@ -112,7 +114,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(Sparkle); } - //Actually do projectiles now + // Actually do projectiles now if (Owner.whoAmI == Main.myPlayer) { for (int i = 0; i <= 5; i++) @@ -154,23 +156,14 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(2)) { - - float Opacity = MathHelper.Clamp((Empowerment / maxEmpowerment - 0.5f) * 3f, 0, 1) * 0.75f; + float Opacity = MathHelper.Clamp((Empowerment / maxEmpowerment - 0.5f) * 3f, 0, 1) * 0.5f; float scaleFactor = MathHelper.Clamp((Empowerment / maxEmpowerment - 0.5f) * 3f, 0, 1); - for (float i = 0f; i <= 1; i += 0.5f) + for (float i = 0f; i < 2; i++) { - Vector2 smokepos = Projectile.Center + (direction * (60 + 40 * i) * Projectile.scale) + direction.RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); - - + Vector2 smokepos = Projectile.Center + (direction * (60 + 20 * i) * Projectile.scale) + direction.RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); 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.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); - } } } @@ -201,6 +194,7 @@ namespace CalamityMod.Projectiles.Melee } float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation()) + MathHelper.Pi; float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted)); @@ -208,9 +202,12 @@ namespace CalamityMod.Projectiles.Melee { if (Owner.whoAmI == Main.myPlayer) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); } CanDirectFire = false; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction AngleReset = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation(); } @@ -261,6 +258,16 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (CurrentState == 1f && Main.myPlayer == Projectile.owner && !AnyProjectiles(ProjectileType())) + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), Projectile.damage, 0f, Projectile.owner, target.whoAmI); + if (proj.ModProjectile is PhoenixsPrideFirewall fire) + fire.Scale = MathHelper.Clamp(target.width / 100f, 0.3f, 1.25f); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (CurrentState == 1f) @@ -269,11 +276,7 @@ namespace CalamityMod.Projectiles.Melee modifiers.SourceDamage *= FourSeasonsGalaxia.PhoenixAttunement_BaseDamageReduction + (FourSeasonsGalaxia.PhoenixAttunement_FullChargeDamageBoost * Empowerment / maxEmpowerment); } - public override void OnKill(int timeLeft) - { - if (smear != null) - smear.Kill(); - } + public override void OnKill(int timeLeft) => smear?.Kill(); public override bool PreDraw(ref Color lightColor) { @@ -286,7 +289,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOffset = Projectile.Center - Main.screenPosition; //Afterimages - if (CalamityConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) + if (CalamityClientConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs b/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs new file mode 100644 index 0000000000..2f4a52d81d --- /dev/null +++ b/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs @@ -0,0 +1,107 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PhoenixsPrideFirewall : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public const int TornadoHeight = 480; + + public float Scale; // Size of the firewall, scales with NPC width + public float fadeOut = 0f; // Used to control the firewall fading in and out at the start and end of its lifespan + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + public override void SetStaticDefaults() => ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + + public override void SetDefaults() + { + Projectile.width = 408; + Projectile.height = 102; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.scale = Scale; + Projectile.timeLeft = 150; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PhoenixAttunement_FlamePillarLocalIFrames; + } + + public override void AI() + { + // Constantly follow its target + // Die if the target is no longer active + if (!Target.active) + { + Projectile.Kill(); + return; + } + else + Projectile.Center = Target.Center + Target.velocity; + + // Fade in and out at the start and end of its lifespan + if (Projectile.timeLeft > 145) + fadeOut += 0.15f; + if (Projectile.timeLeft < 15) + fadeOut -= 0.05f; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), + targetHitbox.Size(), + Projectile.Bottom, + Projectile.Bottom - Vector2.UnitY * TornadoHeight, + 72, + ref _); + } + + public float WidthFunction(float completionRatio) => 50f * Scale * (completionRatio > 0.4f ? 1f : completionRatio * 2.5f); + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(); + + GameShaders.Misc["CalamityMod:Bordernado"].UseSaturation(-0.2f); + GameShaders.Misc["CalamityMod:Bordernado"].UseOpacity(fadeOut); + GameShaders.Misc["CalamityMod:Bordernado"].SetShaderTexture(ModContent.Request("Terraria/Images/Misc/Perlin")); + Vector2[] drawPoints = new Vector2[5]; + Vector2 upwardAscent = Vector2.UnitY * TornadoHeight; + + Vector2 bottom = Projectile.Center; + Vector2 top = bottom - upwardAscent; + for (int i = 0; i < drawPoints.Length - 1; i++) + drawPoints[i] = Vector2.Lerp(top, bottom, i / (float)(drawPoints.Length - 1)); + + drawPoints[drawPoints.Length - 1] = bottom; + PrimitiveRenderer.RenderTrail(drawPoints, new(WidthFunction, (_) => Color.Orange, shader: GameShaders.Misc["CalamityMod:Bordernado"]), 80); + + Main.spriteBatch.ExitShaderRegion(); + + Texture2D vortexTexture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeVortex").Value; + for (int i = 0; i < 90; i++) + { + float angle = MathHelper.TwoPi * i / (25f * Scale) + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; + Color drawColor = Color.White * 0.04f; + drawColor.A = 0; + Vector2 drawPosition = bottom + angle.ToRotationVector2() * 4f - Main.screenPosition; + + drawPosition += (angle + Main.GlobalTimeWrappedHourly * i / 16f).ToRotationVector2() * 6f; + Main.EntitySpriteDraw(vortexTexture, drawPosition, null, drawColor * fadeOut, angle + MathHelper.PiOver2, vortexTexture.Size() * 0.5f, 0.2f * Scale, SpriteEffects.None, 0); + } + + return false; + } + } +} diff --git a/Projectiles/Melee/Galaxia_PolarisGaze.cs b/Projectiles/Melee/Galaxia_PolarisGaze.cs index fc1201ae05..e7e4fa40cc 100644 --- a/Projectiles/Melee/Galaxia_PolarisGaze.cs +++ b/Projectiles/Melee/Galaxia_PolarisGaze.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Projectiles.Melee Vector2 direction = Vector2.Zero; public ref float Shred => ref Projectile.ai[0]; //Charge, basically public ref float HitChargeCooldown => ref Projectile.ai[1]; - public ref float ChargeSoundCooldown => ref Projectile.localAI[0]; 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]; @@ -72,12 +71,6 @@ namespace CalamityMod.Projectiles.Melee { if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) { - if (CalamityUtils.AngleBetween(Owner.Center - Main.MouseWorld, Owner.Center - proj.Center) > MathHelper.PiOver4) - { - proj.Kill(); - break; - } - Wheel = proj; Dashing = true; DashStart = Owner.Center; @@ -121,26 +114,27 @@ namespace CalamityMod.Projectiles.Melee if (PolarStar == null) { - PolarStar = new GenericSparkle(Owner.Center + direction, Vector2.Zero, Color.White, Color.CornflowerBlue, Projectile.scale, 2, 0.05f, 5f, true); + PolarStar = new GenericSparkle(Owner.Center + direction, Vector2.Zero, Color.White, Color.DodgerBlue, Projectile.scale, 2, 0.05f, 5f, true); GeneralParticleHandler.SpawnParticle(PolarStar); } else { PolarStar.Time = 0; PolarStar.Position = Owner.Center + direction * 46 * Projectile.scale; - PolarStar.Rotation += (1 + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 4f)) * 0.02f; + PolarStar.Color = ShredRatio > 0.75 ? Color.Lerp(Color.White, Color.CornflowerBlue, Utils.Remap(ShredRatio, 0.75f, 0.85f, 0f, 1f)) : Color.White; + PolarStar.Rotation += (1 + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 4f)) * (ShredRatio > 0.85 ? 0.03f : 0.02f); PolarStar.Scale = Projectile.scale * 2f; } if (Main.rand.NextBool()) { Vector2 smokeSpeed = direction.RotatedByRandom(MathHelper.PiOver4 * 0.3f) * Main.rand.NextFloat(10f, 30f) * (ShredRatio * 0.5f + 1f); - 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); + 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.5f, 1f) * (ShredRatio * 0.5f + 1f), 0.6f, 0, false, 0); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(3) && ShredRatio > 0.85) { - 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); + 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.6f, 0, true, 0.01f); GeneralParticleHandler.SpawnParticle(smokeGlow); } } @@ -151,6 +145,7 @@ namespace CalamityMod.Projectiles.Melee if (Shred < 0) Shred = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); @@ -159,7 +154,7 @@ namespace CalamityMod.Projectiles.Melee //Scaling based on shred Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PolarisAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, FourSeasonsGalaxia.PolarisAttunement_LocalIFrames - FourSeasonsGalaxia.PolarisAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency - Projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER + Projectile.scale = 1f + (ShredRatio * 1.5f); //SWAGGER if ((Wheel == null || !Wheel.active) && Dashing) @@ -170,16 +165,6 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer) { - int blastDamage = Owner.CalcIntDamage(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage); - for (int i = 0; i < 5; i++) - { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Main.rand.NextVector2CircularEdge(15, 15), ProjectileType(), blastDamage, 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.02f); - { - blast.timeLeft = 100; - } - } - - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_SlashDamageBoost), 0, Owner.whoAmI); if (proj.ModProjectile is PolarisGazeDash dash) { @@ -214,21 +199,6 @@ namespace CalamityMod.Projectiles.Melee Owner.itemTime = 2; Owner.itemAnimation = 2; - //Play a sound when the blade throw is available - if (ShredRatio > 0.85 && Owner.whoAmI == Main.myPlayer) - { - if (ChargeSoundCooldown <= 0) - { - SoundEngine.PlaySound(SoundID.DD2_BookStaffCast with { Volume = SoundID.DD2_BookStaffCast.Volume * 2.5f }); - ChargeSoundCooldown = 20; - } - } - else - { - ChargeSoundCooldown--; - } - - Shred += FourSeasonsGalaxia.PolarisAttunement_ShredChargeupGain; HitChargeCooldown--; Projectile.timeLeft = 2; @@ -239,7 +209,7 @@ namespace CalamityMod.Projectiles.Melee { float maxMultiplier = FourSeasonsGalaxia.PolarisAttunement_FullChargeDamage / (float)FourSeasonsGalaxia.PolarisAttunement_BaseDamage; float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes + // Adjust the damage to make it constant based on the local iframes float damageReduction = Projectile.localNPCHitCooldown / (float)FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; modifiers.SourceDamage *= damageMultiplier * damageReduction; @@ -249,14 +219,12 @@ namespace CalamityMod.Projectiles.Melee { float maxMultiplier = FourSeasonsGalaxia.PolarisAttunement_FullChargeDamage / (float)FourSeasonsGalaxia.PolarisAttunement_BaseDamage; float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes + // Adjust the damage to make it constant based on the local iframes float damageReduction = Projectile.localNPCHitCooldown / (float)FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; modifiers.SourceDamage *= damageMultiplier * damageReduction; } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => ShredTarget(); public override void OnHitPlayer(Player target, Player.HurtInfo info) => ShredTarget(); @@ -269,10 +237,8 @@ namespace CalamityMod.Projectiles.Melee // get lifted up if (HitChargeCooldown <= 0) { - SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); //Sizzle - Shred += 80; //Augment the shredspeed - if (Owner.velocity.Y > 0) - Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly + SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); // Sizzle + Shred += 80; // Augment the shredspeed // 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. @@ -287,7 +253,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); if (ShredRatio > 0.85 && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, direction * 36f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); } if (Dashing) { diff --git a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs index 93dde5a6cc..8d25d0320a 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs @@ -19,9 +19,6 @@ namespace CalamityMod.Projectiles.Melee public Vector2 DashStart; public Vector2 DashEnd; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -52,23 +49,10 @@ namespace CalamityMod.Projectiles.Melee Particle Spark = new CritSpark(target.Center, sparkSpeed, Color.White, Color.CornflowerBlue, 1f + Main.rand.NextFloat(0, 1f), 30, 0.4f, 0.6f); GeneralParticleHandler.SpawnParticle(Spark); } - - //Explode into cosmic bolts - int blastDamage = Owner.CalcIntDamage(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage); - for (int i = 0; i < 3; i++) - { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType(), blastDamage, 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f); - { - blast.timeLeft = 100; - } - } } - - - public override bool PreDraw(ref Color lightColor) //OMw to reuse way too much code from the entangling vines + public override bool PreDraw(ref Color lightColor) // omw to reuse way too much code from the entangling vines { - Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -86,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D sparkTexture = Request("CalamityMod/Particles/ThinSparkle").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)sparkTexture.Width / (float)bloomTexture.Height; @@ -95,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(bloomTexture, DashEnd - Main.screenPosition, null, Color.CornflowerBlue * bump * 0.5f, 0, bloomTexture.Size() / 2f, bump * 6f * properBloomSize, SpriteEffects.None, 0); Main.EntitySpriteDraw(sparkTexture, DashEnd - Main.screenPosition, frame, Color.Lerp(Color.White, Color.CornflowerBlue, raise) * bump, raise * MathHelper.TwoPi, frame.Size() / 2f, bump * 3f, SpriteEffects.None, 0); - //Back to normal + // Back to normal Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; diff --git a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs index b3b897d19e..5ff1873c7e 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs @@ -21,34 +21,24 @@ namespace CalamityMod.Projectiles.Melee public Player Owner => Main.player[Projectile.owner]; public float Timer => MaxTime - Projectile.timeLeft; + public const int MaxTime = 120; - public const float MaxTime = 120; + public Particle PolarStar; // Using a particle on top of it since the smoke particles would otherwise go over it - public Particle PolarStar; //Using a particle ontop of it since the smoke particles would otherwise go over it - - - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; Projectile.width = Projectile.height = 45; - Projectile.tileCollide = true; + Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 3; - + Projectile.MaxUpdates = 4; + Projectile.timeLeft = MaxTime; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 60; + Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.velocity *= 0.95f; - return false; - } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; @@ -65,26 +55,21 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); - - Projectile.timeLeft = (int)MaxTime; - Projectile.velocity = direction * 16f; - Projectile.scale = 1f + ShredRatio; //SWAGGER Projectile.netUpdate = true; - } - Projectile.velocity *= 0.96f; - Projectile.position += Projectile.velocity; - - if (PolarStar == null) { PolarStar = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Color.CornflowerBlue, Projectile.scale * 2f, 2, 0.1f, 5f, true); GeneralParticleHandler.SpawnParticle(PolarStar); + + CustomPulse poof = new(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.1f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(poof); } else { @@ -93,7 +78,6 @@ namespace CalamityMod.Projectiles.Melee PolarStar.Scale = Projectile.scale * 2f; } - Vector2 smokeSpeed = Main.rand.NextVector2Circular(10f, 10f); 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); @@ -104,6 +88,13 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(smokeGlow); } + if (Timer % (MaxTime / 6) == 0 && Main.myPlayer == Projectile.owner) + { + Vector2 starVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * 25f; + Projectile star = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, starVel, ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f, MathHelper.Pi / 20f); + if (star.ModProjectile is GalaxiaBolt bolt) + bolt.StrongerHoming = true; + } } public override bool PreDraw(ref Color lightColor) @@ -144,6 +135,5 @@ namespace CalamityMod.Projectiles.Melee } } } - } } diff --git a/Projectiles/Melee/GalaxyBlast.cs b/Projectiles/Melee/GalaxyBlast.cs deleted file mode 100644 index 53de74b650..0000000000 --- a/Projectiles/Melee/GalaxyBlast.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalaxyBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.penetrate = -1; - Projectile.extraUpdates = 5; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - } - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - } - - public override void AI() - { - if (Projectile.ai[1] != -1f && Projectile.position.Y > Projectile.ai[1]) - { - Projectile.tileCollide = true; - } - if (Projectile.position.HasNaNs()) - { - Projectile.Kill(); - return; - } - bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - 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; - if (isInTile) - { - blastDust.noLight = true; - } - if (Projectile.ai[1] == -1f) - { - Projectile.ai[0] += 1f; - Projectile.velocity = Vector2.Zero; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 140; - Projectile.Center = Projectile.position; - Projectile.alpha -= 10; - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - if (++Projectile.frameCounter >= Projectile.MaxUpdates * 3) - { - Projectile.frameCounter = 0; - Projectile.frame++; - } - if (Projectile.ai[0] >= (float)(Main.projFrames[Projectile.type] * Projectile.MaxUpdates * 3)) - { - Projectile.Kill(); - } - return; - } - Projectile.alpha = 255; - if (Projectile.numUpdates == 0) - { - int npcTracker = -1; - float homingRange = 60f; - foreach (NPC nPC in Main.ActiveNPCs) - { - if (nPC.CanBeChasedBy(Projectile, false)) - { - float npcDistance = Projectile.Distance(nPC.Center); - if (npcDistance < homingRange && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - homingRange = npcDistance; - npcTracker = nPC.whoAmI; - } - } - } - if (npcTracker != -1) - { - Projectile.ai[0] = 0f; - Projectile.ai[1] = -1f; - Projectile.netUpdate = true; - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - 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(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(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(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) - { - Main.dust[killingPeople].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire3, 180); - Projectile.Kill(); - } - } -} diff --git a/Projectiles/Melee/GalaxyBlastType2.cs b/Projectiles/Melee/GalaxyBlastType2.cs deleted file mode 100644 index 3620edaacb..0000000000 --- a/Projectiles/Melee/GalaxyBlastType2.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalaxyBlastType2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.penetrate = 1; - Projectile.extraUpdates = 5; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - } - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - } - - public override void AI() - { - if (Projectile.ai[1] != -1f && Projectile.position.Y > Projectile.ai[1]) - { - Projectile.tileCollide = true; - } - if (Projectile.position.HasNaNs()) - { - Projectile.Kill(); - return; - } - bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - 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; - if (isInTile) - { - blastDust.noLight = true; - } - if (Projectile.ai[1] == -1f) - { - Projectile.ai[0] += 1f; - Projectile.velocity = Vector2.Zero; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 140; - Projectile.Center = Projectile.position; - Projectile.alpha -= 10; - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - if (++Projectile.frameCounter >= Projectile.MaxUpdates * 3) - { - Projectile.frameCounter = 0; - Projectile.frame++; - } - if (Projectile.ai[0] >= (float)(Main.projFrames[Projectile.type] * Projectile.MaxUpdates * 3)) - { - Projectile.Kill(); - } - return; - } - Projectile.alpha = 255; - if (Projectile.numUpdates == 0) - { - int npcTracker = -1; - float homingRange = 60f; - foreach (NPC nPC in Main.ActiveNPCs) - { - if (nPC.CanBeChasedBy(Projectile, false)) - { - float npcDistance = Projectile.Distance(nPC.Center); - if (npcDistance < homingRange && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - homingRange = npcDistance; - npcTracker = nPC.whoAmI; - } - } - } - if (npcTracker != -1) - { - Projectile.ai[0] = 0f; - Projectile.ai[1] = -1f; - Projectile.netUpdate = true; - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - 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(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(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(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) - { - Main.dust[killingPeople].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Frostburn2, 120); - Projectile.Kill(); - } - } -} diff --git a/Projectiles/Melee/GalaxyBlastType3.cs b/Projectiles/Melee/GalaxyBlastType3.cs deleted file mode 100644 index 6ee3f57b3a..0000000000 --- a/Projectiles/Melee/GalaxyBlastType3.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalaxyBlastType3 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.penetrate = 1; - Projectile.extraUpdates = 5; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - } - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - } - - public override void AI() - { - if (Projectile.ai[1] != -1f && Projectile.position.Y > Projectile.ai[1]) - { - Projectile.tileCollide = true; - } - if (Projectile.position.HasNaNs()) - { - Projectile.Kill(); - return; - } - bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - 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; - if (isInTile) - { - blastDust.noLight = true; - } - if (Projectile.ai[1] == -1f) - { - Projectile.ai[0] += 1f; - Projectile.velocity = Vector2.Zero; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 140; - Projectile.Center = Projectile.position; - Projectile.alpha -= 10; - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - if (++Projectile.frameCounter >= Projectile.MaxUpdates * 3) - { - Projectile.frameCounter = 0; - Projectile.frame++; - } - if (Projectile.ai[0] >= (float)(Main.projFrames[Projectile.type] * Projectile.MaxUpdates * 3)) - { - Projectile.Kill(); - } - return; - } - Projectile.alpha = 255; - if (Projectile.numUpdates == 0) - { - int npcTracker = -1; - float homingRange = 60f; - foreach (NPC nPC in Main.ActiveNPCs) - { - if (nPC.CanBeChasedBy(Projectile, false)) - { - float npcDistance = Projectile.Distance(nPC.Center); - if (npcDistance < homingRange && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - homingRange = npcDistance; - npcTracker = nPC.whoAmI; - } - } - } - if (npcTracker != -1) - { - Projectile.ai[0] = 0f; - Projectile.ai[1] = -1f; - Projectile.netUpdate = true; - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - 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(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(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(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) - { - Main.dust[killingPeople].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Ichor, 60); - Projectile.Kill(); - } - } -} diff --git a/Projectiles/Melee/GalaxySmasherBlast.cs b/Projectiles/Melee/GalaxySmasherBlast.cs index 6150711d81..83330693a5 100644 --- a/Projectiles/Melee/GalaxySmasherBlast.cs +++ b/Projectiles/Melee/GalaxySmasherBlast.cs @@ -1,9 +1,7 @@ -using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Metaballs; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -13,23 +11,55 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public Player Owner => Main.player[Projectile.owner]; - private static float ExplosionRadius = 568f; + private static float ExplosionRadius = 868f; public override void SetDefaults() { //These shouldn't matter because its circular - Projectile.width = 568; - Projectile.height = 568; + Projectile.width = 868; + Projectile.height = 868; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 2; + Projectile.timeLeft = 18; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } + public override void AI() + { + // Pureley visual stuff + float fade = Utils.GetLerpValue(-2, 18, Projectile.timeLeft); + float numberOfDusts = 8f; + for (int i = 0; i < numberOfDusts; i++) + { + Vector2 velOffset = new Vector2(42, 42).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f); + GalaxyMetaball.SpawnParticle(Projectile.Center, velOffset * fade, 300f * Main.rand.NextFloat(0.8f, 1f) * fade); + if (i % 2 == 0) + { + Vector2 velOffset2 = new Vector2(92, 92).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f); + GalaxyMetaball.SpawnParticle(Projectile.Center, velOffset2 * fade, 120f * Main.rand.NextFloat(0.7f, 1f) * fade); + } + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 180); + float minMult = 0.15f; + int hitsToMinMult = 12; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + { + Projectile.numHits -= 1; + } + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } } diff --git a/Projectiles/Melee/GalaxySmasherEcho.cs b/Projectiles/Melee/GalaxySmasherEcho.cs index 2e13294fb6..c9eba67b70 100644 --- a/Projectiles/Melee/GalaxySmasherEcho.cs +++ b/Projectiles/Melee/GalaxySmasherEcho.cs @@ -1,140 +1,142 @@ -using System; -using System.IO; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Particles; -using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Humanizer.In; namespace CalamityMod.Projectiles.Melee { public class GalaxySmasherEcho : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public static readonly SoundStyle SlamHamSound = new("CalamityMod/Sounds/Item/GalaxySmasherSmash") { Volume = 0.6f }; + public override string Texture => "CalamityMod/Items/Weapons/Melee/GalaxySmasher"; + public static readonly SoundStyle SlamHamSound = new("CalamityMod/Sounds/Item/GalaxySmasherSmash") { Volume = 0.7f }; public static readonly SoundStyle Kunk = new("CalamityMod/Sounds/Item/TF2PanHit") { Volume = 1.1f }; - public float rotatehammer = 35f; + public float rotatehammer = 15f; public float speed = 0f; + public NPC targeted; + public Color usedColor = Color.Aqua; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } - //This is all copied straight from PwnagehammerEcho with some minor edits. public override void SetDefaults() { - Projectile.width = 78; - Projectile.height = 78; + Projectile.width = 86; + Projectile.height = 72; Projectile.aiStyle = 0; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } - - public override void AI() { - Projectile.scale = 2.78f; - rotatehammer *= 1.2f; + List eColors = new List() + { + Color.Aqua, + Color.Magenta, + }; + float rate = (Main.GlobalTimeWrappedHourly * 43); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + rotatehammer += 2f; Projectile.rotation += MathHelper.ToRadians(rotatehammer) * Projectile.direction; - Projectile.ai[0] += 1f; - if (Projectile.ai[0] < 42f) + if (true) { - Projectile.velocity *= 0.95f; - Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0]; - } - else if (Projectile.ai[0] > 42f) - { - Projectile.extraUpdates = 1; - if (Projectile.ai[1] < 0f) + if (Projectile.timeLeft % 2 == 0) { - CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 2000f, speed, 12f); - if (Projectile.ai[0] > 80f) - Projectile.Kill(); + Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/SmallBloom", false, 13, 0.5f, usedColor, new Vector2(0.6f, 1f), true, false, 0, false, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark); } - NPC target = Main.npc[(int)Projectile.ai[1]]; - if (!target.CanBeChasedBy(Projectile, false) || !target.active) - Projectile.Kill(); + Projectile.extraUpdates = 7; + + if (Projectile.ai[1] != -5) + targeted = Main.npc[(int)Projectile.ai[1]]; + if (targeted == null || !targeted.CanBeChasedBy(Projectile, false) || !targeted.active) + { + targeted = Projectile.Center.ClosestNPCAt(2000); + Projectile.ai[1] = -5; + } + if (targeted != null) + { + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.6f, 25, 0.98f); + } else - { - float velConst = 5f; - velConst--; - Projectile.velocity = new Vector2((target.Center.X - Projectile.Center.X) / velConst, (target.Center.Y - Projectile.Center.Y) / velConst); - Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0]; - } + Projectile.Kill(); } - if (Main.rand.NextBool()) + Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 278, (-Projectile.velocity + velOffset) * Main.rand.NextFloat(0.3f, 1f), 0, default, Main.rand.NextFloat(0.35f, 0.75f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Magenta : Color.Aqua; + + for (int i = 0; i < 2; i++) { - Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); - Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 272, new Vector2(Projectile.velocity.X * 0.4f + velOffset.X, Projectile.velocity.Y * 0.4f + velOffset.Y), 100, default, 0.9f); - dust.noGravity = true; + GalaxyMetaball.SpawnParticle(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 1f), 195f * Main.rand.NextFloat(0.9f, 1f)); } - - if (Main.rand.NextBool(6)) - { - Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); - Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 226, new Vector2(Projectile.velocity.X * 0.5f + velOffset.X, Projectile.velocity.Y * 0.5f + velOffset.Y), 100, default, 0.9f); - dust.noGravity = true; - } - } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (targeted != null && target != targeted) + modifiers.SourceDamage *= 0.3f; + } public override bool? CanHitNPC(NPC target) { - if (Projectile.ai[0] <= 42f) - return false; return null; } - - public override bool CanHitPvp(Player target) => Projectile.ai[0] > 42f; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.localAI[0] = target.whoAmI; - float damageInterpolant = Utils.GetLerpValue(950f, 2000f, hit.Damage, true); - float impactAngularVelocity = MathHelper.Lerp(0.08f, 0.2f, damageInterpolant); - impactAngularVelocity *= Main.rand.NextBool().ToDirectionInt() * Main.rand.NextFloat(0.75f, 1.25f); - Vector2 splatterDirection = Projectile.velocity; - for (int i = 0; i < 20; i++) - { - int sparkLifetime = Main.rand.Next(55, 70); - float sparkScale = Main.rand.NextFloat(0.7f, Main.rand.NextFloat(3.3f, 5.5f)) + damageInterpolant * 0.85f; - Color sparkColor = Color.Lerp(Color.Fuchsia, Color.Aqua, Main.rand.NextFloat(0.7f)); - sparkColor = Color.Lerp(sparkColor, Color.Fuchsia, Main.rand.NextFloat()); - - Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.7f) * Main.rand.NextFloat(1f, 1.2f); - sparkVelocity.Y -= 7f; - SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); - GeneralParticleHandler.SpawnParticle(spark); - } + target.AddBuff(ModContent.BuffType(), 420); + if (target == targeted) + Projectile.Kill(); } public override bool PreKill(int timeLeft) { Player player = Main.player[Projectile.owner]; //This is what we call fucking IMPACT (3). - Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 12; + Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 15; if (Main.zenithWorld) SoundEngine.PlaySound(Kunk, Projectile.Center); - else SoundEngine.PlaySound(SlamHamSound, Projectile.Center); + for (int i = 0; i < 8; i++) + { + float rot = MathHelper.PiOver4 * i; + Particle pulse1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua * 0.4f, "CalamityMod/Particles/HighResHollowCircleHardEdge", new Vector2(1.4f, 0.6f), rot, 0, 1f, 40); + GeneralParticleHandler.SpawnParticle(pulse1); + } - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Violet, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.2f, 4f, 12); - GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 1.5f, 11); - GeneralParticleHandler.SpawnParticle(pulse2); + float numberOfDusts = 40f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); + Vector2 velOffset = new Vector2(42.5f, 0).RotatedBy(rot) * (i % 2 == 0 ? 0.8f : i % 3 == 0 ? 0.6f : 1f); + + Particle spark = new CustomSpark(Projectile.Center + offset * 6, velOffset, "CalamityMod/Particles/SmallBloom", false, 35, 1f, Color.Magenta * 0.75f, new Vector2(1.2f, 1f), true, false, 0, false, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + GalaxyMetaball.SpawnParticle(Projectile.Center, Vector2.Zero, 275f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); @@ -143,20 +145,16 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - 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; + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/GalaxySmasher").Value; + Asset p2 = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey"); - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - float rot = MathHelper.ToRadians(22.5f) * Math.Sign(Projectile.velocity.X); - Vector2 drawPos = Projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, Projectile.gfxOffY); - Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - Main.EntitySpriteDraw(texture, drawPos, new Rectangle?(), color, Projectile.rotation - i * rot, origin, Projectile.scale, spriteEffects, 0); - } + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.5f, 3, texture, true, true); + + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + + Projectile.DrawProjectileWithBackglow(usedColor with { A = 0 }, Color.White, 9.5f, texture, null, Projectile.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, usedColor with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.4f, 1.45f), p2.Size() * 0.5f, 1.2f * Main.rand.NextFloat(0.9f, 1.1f), SpriteEffects.None); return false; } } diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index 53e5614b03..d36e49c644 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -1,9 +1,13 @@ using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -25,17 +29,19 @@ namespace CalamityMod.Projectiles.Melee public float EchoHammerPrep = 0f; public float WaitTimer = 0f; public int InPulse = 0; + public int time = 0; + public Color usedColor = Color.Aqua; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 62; - Projectile.height = 62; + Projectile.width = 86; + Projectile.height = 72; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.tileCollide = false; @@ -50,156 +56,202 @@ namespace CalamityMod.Projectiles.Melee { //returnhammer determines if the hammer is slowing down after hitting an enemy, or homing in on the player. Player player = Main.player[Projectile.owner]; - Projectile.direction = Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1; - Projectile.rotation += MathHelper.ToRadians(rotatehammer) * Projectile.direction; + float targetDist = Vector2.Distance(player.Center, Projectile.Center); + Projectile.rotation += MathHelper.ToRadians(rotatehammer * 2) * Projectile.direction; + + List eColors = new List() + { + Color.Aqua, + Color.Magenta, + }; + float rate = (Main.GlobalTimeWrappedHourly * 12); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); if (EmpoweredHammer >= 8) EmpoweredHammer = 0; if (returnhammer == 0) { - Projectile.velocity.X *= 0.988f; - Projectile.velocity.Y += 0.326f; + int falloffTime = 18; + if (time > falloffTime) + Projectile.velocity.X *= 0.96f; + if (Projectile.velocity.Y < 25 && time > falloffTime) + Projectile.velocity.Y += 0.54f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.973f; } if (returnhammer == 1) //Hammer slows after the inital hit { - if (EmpoweredHammer == 7) - { - ++WaitTimer; - if (WaitTimer == 20f) - { - Projectile.velocity *= 0f; - EmpoweredHammer = 0; - returnhammer = 3; - } - } - else - { - 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; - } + 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) // Projectile returns to player { - ++PulseCooldown; - Projectile.extraUpdates = 2; - float returnSpeed = StellarContempt.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 (WaitTimer == 0) + { + Projectile.extraUpdates = 2; + float returnSpeed = StellarContempt.Speed * 0.7f; + 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; + 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)) + if (Projectile.Hitbox.Intersects(player.Hitbox) || WaitTimer > 0) { - EmpoweredHammer++; - SoundEngine.PlaySound(SoundID.DD2_BetsysWrathShot with { Volume = 0.4f }, Projectile.Center); - for (int i = 0; i < 30; i++) + if (EmpoweredHammer >= 7) { - Dust fire = Dust.NewDustPerfect(Projectile.Center, 181); - 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.04f); + Projectile.extraUpdates = 1; + if (WaitTimer == 0) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 20; + WaitTimer++; + Projectile.velocity *= 0.97f; + if (WaitTimer == 20f) + { + EmpoweredHammer = 0; + returnhammer = 3; + } + } + else + { + EmpoweredHammer++; + SoundEngine.PlaySound(SoundID.DD2_BetsysWrathShot with { Volume = 0.4f }, Projectile.Center); + for (int i = 0; i < 30; i++) + { + Dust fire = Dust.NewDustPerfect(Projectile.Center, 181); + 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.04f); - fire.noGravity = true; - fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer; + fire.noGravity = true; + fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer; - fire = Dust.CloneDust(fire); - fire.velocity = Main.rand.NextVector2Circular(3f, 3f); - fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f); + fire = Dust.CloneDust(fire); + fire.velocity = Main.rand.NextVector2Circular(3f, 3f); + fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f); + } + Projectile.Kill(); } - Projectile.Kill(); } } } - if (returnhammer == 3) //Hammer prepares to spawn echo hammer, VibroIntensity + if (returnhammer == 3) //Hammer prepares to spawn echo hammer { if (InPulse == 0) { SoundEngine.PlaySound(RedHamSound, Projectile.Center); - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(1f, 1f), Main.rand.NextFloat(12f, 25f), 0.1f, 1.95f, 120); - GeneralParticleHandler.SpawnParticle(pulse); InPulse = 1; } - rotatehammer -= 0.25f; - if (EchoHammerPrep >= 17f) + rotatehammer -= 0.09f; + Projectile.velocity *= 0.96f; + if (EchoHammerPrep >= 5f && InPulse < 2) { - if (InPulse == 1) + if (time % 20 == 0) { - Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.Orchid, new Vector2(1f, 1f), 0f, 4.9f, 0f, 25); + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, usedColor * 0.35f, "CalamityMod/Particles/HighResHollowCircleHardEdge", new Vector2(1f, 1f * Utils.GetLerpValue(40, 20, EchoHammerPrep)), 0f, 2f, 0f, (int)(40 * Utils.GetLerpValue(50, 0, EchoHammerPrep, true))); GeneralParticleHandler.SpawnParticle(pulse2); - InPulse = 2; } } - - if (EchoHammerPrep <= 24f) + if (EchoHammerPrep >= 32) { - EchoHammerPrep += 0.2f; - Projectile.scale += 0.017f; - Particle streak = new ManaDrainStreak(player, Main.rand.NextFloat(0.7f, 0.9f), Main.rand.NextVector2CircularEdge(2f, 2f) * Main.rand.NextFloat(135f, 335f), Main.rand.NextFloat(20f, 20f), Color.Aqua, Color.Fuchsia, Main.rand.Next(10, 20), Projectile.Center); - GeneralParticleHandler.SpawnParticle(streak); + InPulse = 2; } - else + if (EchoHammerPrep <= 30f) + { + float fade = Utils.GetLerpValue(40, 0, EchoHammerPrep, true); + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f); + velOffset *= Main.rand.NextFloat(45, 65) * fade; + Particle energy = new SparkParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, 14, Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, usedColor); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, 278, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = usedColor; + GalaxyMetaball.SpawnParticle(Projectile.Center + velOffset * 1.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 50f * Main.rand.NextFloat(0.9f, 1.3f) * fade); + } + } + if (EchoHammerPrep > 40) { int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 10, Projectile.knockBack * 2.5f, Projectile.owner, 0f, Projectile.ai[1]); Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); Main.projectile[hammer].netUpdate = true; Projectile.Kill(); } + else + EchoHammerPrep += 0.2f; } - //Spawn dust as the hammer travels. - if (Main.rand.NextBool()) + if (targetDist < 1400) { - Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); - Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 272, new Vector2(Projectile.velocity.X * 0.4f + velOffset.X, Projectile.velocity.Y * 0.4f + velOffset.Y), 100, default, 0.7f); - dust.noGravity = true; - } + if (Main.rand.NextBool(3) && returnhammer < 3) + { + Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 278, -Projectile.velocity * 0.2f + velOffset, 100, default, 0.7f); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Magenta : Color.Aqua; + } - if (Main.rand.NextBool(6)) - { - Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); - Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 226, new Vector2(Projectile.velocity.X * 0.5f + velOffset.X, Projectile.velocity.Y * 0.5f + velOffset.Y), 100, default, 0.7f); - dust.noGravity = true; + Vector2 offset2 = new Vector2(0, -30).RotatedBy(-MathHelper.PiOver4 * 0.5f).RotatedBy(Projectile.rotation); + Vector2 velOffset2 = new Vector2(0, -5).RotatedBy(-MathHelper.PiOver4).RotatedBy(Projectile.rotation).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.8f, 1.5f); + Vector2 spawnPosition2 = Projectile.Center + offset2 + Main.rand.NextVector2Circular(6, 6); + Particle spark = new CustomSpark(spawnPosition2, velOffset2 * (InPulse > 0 ? 3 : 1), "CalamityMod/Particles/BloomRing", false, Main.rand.Next(7, 16), Main.rand.NextFloat(0.25f, 0.5f) * (InPulse > 0 ? 1.5f : 1), usedColor * 0.35f, new Vector2(1f, 1f), true, false, Main.rand.NextFloat(-10, 10)); + GeneralParticleHandler.SpawnParticle(spark); + + for (int i = 0; i < (InPulse > 0 ? 3 : 2); i++) + { + Vector2 offset = new Vector2(0, -30).RotatedBy(-MathHelper.PiOver4 * 0.5f).RotatedBy(Projectile.rotation); + Vector2 velOffset = new Vector2(0, -5).RotatedBy(-MathHelper.PiOver4).RotatedBy(Projectile.rotation) * Main.rand.NextFloat(0.4f, 1f); + Vector2 spawnPosition = Projectile.Center + offset + Main.rand.NextVector2Circular(6, 6); + GalaxyMetaball.SpawnParticle(spawnPosition, velOffset * (InPulse > 0 ? 3 : 0.2f), 40f * Main.rand.NextFloat(0.9f, 1.3f) * (InPulse > 0 ? 2 : 1)); + } } + time++; } // On hit play GONG and spawn dust. public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -207,6 +259,8 @@ namespace CalamityMod.Projectiles.Melee Player player = Main.player[Projectile.owner]; if (returnhammer == 0) { + Projectile.ai[1] = target.whoAmI; + if (Main.zenithWorld) SoundEngine.PlaySound(UseSoundFunny with { Pitch = EmpoweredHammer * 0.05f - 0.05f }, Projectile.Center); @@ -215,53 +269,82 @@ namespace CalamityMod.Projectiles.Melee int FunSizeHamID = ModContent.ProjectileType(); int FunSizeHamDamage = (int)(0.1f * Projectile.damage); - float FunSizeHamKB = 0.2f; - int NumOfFunSizeHams = EmpoweredHammer + 1; - for (int i = 0; i < NumOfFunSizeHams; ++i) + float FunSizeHamKB = 0.2f * Projectile.knockBack; + if (Projectile.owner == Main.myPlayer) { - float startDist = Main.rand.NextFloat(160f, 190f); - Vector2 startDir = Main.rand.NextVector2Unit(); - Vector2 startPoint = Projectile.Center + startDir * startDist; - - float FunSizeHamSpeed = Main.rand.NextFloat(10f, 14f); - Vector2 velocity = startDir * -FunSizeHamSpeed; - - if (Projectile.owner == Main.myPlayer) + float numberOfProj = EmpoweredHammer + 1; + float rotFactor2 = 360f / numberOfProj; + float randRot = Main.rand.NextFloat(-6, 6); + for (int i = 1; i < numberOfProj + 1; i++) { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPoint, velocity, FunSizeHamID, FunSizeHamDamage, FunSizeHamKB, Projectile.owner); - if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 30; - Main.projectile[proj].extraUpdates = 2; - } + float rot = MathHelper.ToRadians(i * rotFactor2); + Vector2 offset = new Vector2(5f, 0).RotatedBy(rot).RotatedBy(randRot); + Vector2 velOffset = new Vector2(1f, 0).RotatedBy(rot).RotatedBy(randRot); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, velOffset, FunSizeHamID, FunSizeHamDamage, FunSizeHamKB, Projectile.owner, EmpoweredHammer, (EmpoweredHammer % 2 == 0 ? -1 : 1), target.whoAmI); } } returnhammer = 1; } - if (PulseCooldown >= 15) + float numberOfDusts = MathHelper.Clamp(30 - Projectile.numHits * 3, 6, 30); + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) { - 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; + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(4.8f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f)); + Vector2 velOffset = new Vector2(7f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f)); + + if (i % 3 == 0) + { + GalaxyMetaball.SpawnParticle(Projectile.Center + offset, velOffset * Main.rand.NextFloat(1f, 1.2f), 60f * Main.rand.NextFloat(0.9f, 1.3f)); + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType()); + dust.noGravity = true; + dust.velocity = velOffset * Main.rand.NextFloat(0.45f, 1); + dust.scale = Main.rand.NextFloat(0.8f, 1.7f); + dust.color = Main.rand.NextBool(3) ? Color.Aqua : Color.Magenta; + } } - 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; + target.AddBuff(ModContent.BuffType(), 120); + float minMult = 0.7f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/GalaxySmasher").Value; + Asset p = ModContent.Request("CalamityMod/Particles/FlameExplosion2"); + Asset p2 = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey"); + Asset p3 = ModContent.Request("CalamityMod/Particles/SmallBloom"); + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.5f, 3, texture, true, true); + + float shrinkLerp = (Utils.GetLerpValue(40, 35, EchoHammerPrep, true)); + float growLerp = (Utils.GetLerpValue(0, 35, EchoHammerPrep, true)); + float bonusScale = (returnhammer == 3 ? (EchoHammerPrep < 35 ? (growLerp * 3) : (shrinkLerp * 3)) : 1); + + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + float fade = (returnhammer == 3 ? 1 : Utils.GetLerpValue(2, 15, Projectile.velocity.Length(), true)); + Main.EntitySpriteDraw(p3.Value, generalDrawPos, null, Color.Black * fade, Projectile.rotation, p3.Size() * 0.5f, 0.6f * bonusScale, SpriteEffects.None); + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.Indigo * 0.95f * fade, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f) + i * 0.2f, p.Size() * 0.5f, (0.05f + i * 0.004f) * bonusScale, SpriteEffects.None); + + Main.EntitySpriteDraw(texture, generalDrawPos, null, lightColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, Projectile.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + if (returnhammer < 3) + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, usedColor with { A = 0 } * 0.45f * fade, Projectile.rotation * Main.rand.NextFloat(1.4f, 1.45f), p2.Size() * 0.5f, 0.9f * Main.rand.NextFloat(0.9f, 1.1f), SpriteEffects.None); + else + { + Projectile.DrawProjectileWithBackglow(usedColor with { A = 0 }, Color.White, 6.5f * growLerp, texture, null, Projectile.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } return false; } } diff --git a/Projectiles/Melee/GalaxySmasherMini.cs b/Projectiles/Melee/GalaxySmasherMini.cs index b6da381e62..1a9afe5795 100644 --- a/Projectiles/Melee/GalaxySmasherMini.cs +++ b/Projectiles/Melee/GalaxySmasherMini.cs @@ -1,8 +1,10 @@ -using CalamityMod.Particles; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Metaballs; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -10,57 +12,86 @@ namespace CalamityMod.Projectiles.Melee public class GalaxySmasherMini : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/GalaxySmasherMini"; - public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2") { Volume = 0.5f, PitchVariance = 0.7f }; - public float rotatehammer = 20f; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float radius = 50f; + public int time = 0; + public bool homing = false; + public NPC targeted; public override void SetDefaults() { - Projectile.width = 86; - Projectile.height = 72; + Projectile.width = 90; + Projectile.height = 90; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.alpha = 80; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; - Projectile.timeLeft = 30; - Projectile.scale = 0.7f; + Projectile.timeLeft = 500; + Projectile.extraUpdates = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 60; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Projectile.direction = Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1; - Projectile.rotation += MathHelper.ToRadians(rotatehammer) * Projectile.direction; + List eColors = new List() + { + Color.Aqua, + Color.Magenta, + }; + float rate = (Main.GlobalTimeWrappedHourly * 20); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (time % 2 == 0) + { + Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/SmallBloom", false, 6, 0.2f, usedColor, new Vector2(Utils.Remap(Projectile.velocity.Length(), 0, 5, 1, 0.6f, true), 1f), true, false, 0, false, false, Utils.Remap(Projectile.velocity.Length(), 0, 5, 0, 0.9f, true)); + GeneralParticleHandler.SpawnParticle(spark); + } + GalaxyMetaball.SpawnParticle(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(0.2f, 0.7f), 30f * Main.rand.NextFloat(0.9f, 1f)); + + if (time > 45 || homing) + { + homing = true; + if (Projectile.ai[2] != -5) + targeted = Main.npc[(int)Projectile.ai[2]]; + if (targeted == null || !targeted.CanBeChasedBy(Projectile, false) || !targeted.active) + { + targeted = Projectile.Center.ClosestNPCAt(1000); + Projectile.ai[2] = -5; + } + + if (targeted != null) + { + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.18f, 25, 0.99f, accelerate: true); + Projectile.extraUpdates = 3; + } + } + else + { + Projectile.velocity += Projectile.velocity.RotatedBy(0.24f * Projectile.ai[1]) * 0.04f; + Projectile.extraUpdates = 2; + } + + time += (homing ? -1 : 1); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - SoundEngine.PlaySound(HitSound, Projectile.Center); - float damageInterpolant = Utils.GetLerpValue(950f, 2000f, hit.Damage, true); - float impactAngularVelocity = MathHelper.Lerp(0.08f, 0.2f, damageInterpolant); - float impactParticleScale = MathHelper.Lerp(0.6f, 1f, damageInterpolant); - impactAngularVelocity *= Main.rand.NextBool().ToDirectionInt() * Main.rand.NextFloat(0.75f, 1.25f); - - Color impactColor = Color.Lerp(Color.Fuchsia, Color.Aqua, Main.rand.NextFloat(0.5f)); - Vector2 impactPoint = Vector2.Lerp(Projectile.Center, target.Center, 0.65f); - Vector2 bloodSpawnPosition = target.Center + Main.rand.NextVector2Circular(target.width, target.height) * 0.04f; - Vector2 splatterDirection = (Projectile.Center - bloodSpawnPosition).SafeNormalize(Vector2.UnitY); - for (int i = 0; i < 3; i++) + target.AddBuff(ModContent.BuffType(), 60); + for (int i = 0; i < 4; i++) { - int sparkLifetime = Main.rand.Next(9, 12); - float sparkScale = Main.rand.NextFloat(0.8f, 1f) + damageInterpolant * 0.85f; - Color sparkColor = Color.Lerp(Color.Fuchsia, Color.Aqua, Main.rand.NextFloat(0.7f)); - sparkColor = Color.Lerp(sparkColor, Color.Fuchsia, Main.rand.NextFloat()); - Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 25f); - sparkVelocity.Y -= 6f; - SparkParticle spark = new SparkParticle(impactPoint, sparkVelocity, true, sparkLifetime, sparkScale, sparkColor); - GeneralParticleHandler.SpawnParticle(spark); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Projectile.velocity * 3) * Main.rand.NextFloat(0.3f, 1f), 0, default, Main.rand.NextFloat(0.65f, 1f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Magenta : Color.Aqua; } - //Create an impact point particle. - ImpactParticle impactParticle = new ImpactParticle(impactPoint, impactAngularVelocity, 20, impactParticleScale, impactColor); - GeneralParticleHandler.SpawnParticle(impactParticle); + + if (target == targeted) + Projectile.Kill(); } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => homing ? CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox) : false; } } diff --git a/Projectiles/Melee/GalileosMoon.cs b/Projectiles/Melee/GalileosMoon.cs index f330f94964..6a8bc39a8a 100644 --- a/Projectiles/Melee/GalileosMoon.cs +++ b/Projectiles/Melee/GalileosMoon.cs @@ -14,8 +14,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -51,13 +52,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index a51dceec4b..5a1b7ac0d9 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; @@ -177,7 +177,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); diff --git a/Projectiles/Melee/GayBeam.cs b/Projectiles/Melee/GayBeam.cs index 243cf93949..5d016effdc 100644 --- a/Projectiles/Melee/GayBeam.cs +++ b/Projectiles/Melee/GayBeam.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = TrailLength; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = TrailLength; } public override void SetDefaults() @@ -332,15 +332,15 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.ExitShaderRegion(); - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[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) + if (CalamityClientConfig.Instance.Afterimages) { Vector2 centerOffset = Projectile.Size / 2f; int totalAfterimages = TotalAfterimages; diff --git a/Projectiles/Melee/GelWave.cs b/Projectiles/Melee/GelWave.cs index 81ae99eb2c..de43a94052 100644 --- a/Projectiles/Melee/GelWave.cs +++ b/Projectiles/Melee/GelWave.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { - Projectile.width = 164; - Projectile.height = 164; + Projectile.width = 42; + Projectile.height = 84; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; } Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3()); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation(); if (Main.rand.NextBool(10)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); @@ -62,11 +62,13 @@ namespace CalamityMod.Projectiles.Melee } } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); + public override bool? CanDamage() => (Projectile.alpha == 0 ? null : false); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/GelWave.png b/Projectiles/Melee/GelWave.png index 861756b15d..b41c0d4722 100644 Binary files a/Projectiles/Melee/GelWave.png and b/Projectiles/Melee/GelWave.png differ diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 0a148d3a19..0aad553929 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -20,15 +20,15 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = Projectile.height = 32; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -47,14 +47,7 @@ namespace CalamityMod.Projectiles.Melee HomingBuff -= 0.01f; Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - Projectile.frame = 0; - + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) @@ -93,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GhastlySoulLarge.png b/Projectiles/Melee/GhastlySoulLarge.png index 417c094b01..af33deded8 100644 Binary files a/Projectiles/Melee/GhastlySoulLarge.png and b/Projectiles/Melee/GhastlySoulLarge.png differ diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 41e5e9bb77..c168ae37db 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -20,15 +20,15 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = Projectile.height = 32; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -47,14 +47,7 @@ namespace CalamityMod.Projectiles.Melee HomingBuff -= 0.01f; Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - Projectile.frame = 0; - + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) @@ -93,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GhastlySoulMedium.png b/Projectiles/Melee/GhastlySoulMedium.png index f9a5111949..6e84788360 100644 Binary files a/Projectiles/Melee/GhastlySoulMedium.png and b/Projectiles/Melee/GhastlySoulMedium.png differ diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index 932c6060de..1458537533 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -21,15 +21,15 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = Projectile.height = 32; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -48,14 +48,7 @@ namespace CalamityMod.Projectiles.Melee HomingBuff -= 0.01f; Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - Projectile.frame = 0; - + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) @@ -94,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GhastlySoulSmall.png b/Projectiles/Melee/GhastlySoulSmall.png index 96f62a52d5..d4c94bce06 100644 Binary files a/Projectiles/Melee/GhastlySoulSmall.png and b/Projectiles/Melee/GhastlySoulSmall.png differ diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 146d323354..da3aea142e 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -1,17 +1,17 @@ -using System; -using CalamityMod.CalPlayer; +using System.Data; +using System.IO; +using System.Runtime.CompilerServices; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.CodeAnalysis.CSharp.Syntax; 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; @@ -36,6 +36,11 @@ namespace CalamityMod.Projectiles.Melee public float fadeIn = 0; public int useAnim; public int swingCount; + public bool finalFlip = false; + public bool swingSound = true; + + private NPC target => Main.npc[(int)Projectile.ai[0]]; + public override void SetDefaults() { base.SetDefaults(); @@ -43,12 +48,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + + public override void WhenSpawned() { + Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; Projectile.knockBack = 0; Projectile.scale = 1; - Projectile.ai[1] = 1; - base.OnSpawn(source); + Projectile.ai[1] = -1; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Dad has no projectiles mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -56,11 +64,12 @@ namespace CalamityMod.Projectiles.Melee if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; - FlipAsSword = Owner.direction == -1 ? true : false; + FlipAsSword = Owner.direction == -1; } public override void UseStyle() { + AnimationProgress = Animation % useAnim; DrawUnconditionally = false; if (CanHit || postSwing) @@ -71,9 +80,9 @@ namespace CalamityMod.Projectiles.Melee } if (CanHit) - fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.3f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.35f); if (!doSwing) @@ -87,10 +96,12 @@ namespace CalamityMod.Projectiles.Melee CanHit = false; if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; - FlipAsSword = Owner.direction == -1 ? true : false; + FlipAsSword = Owner.direction == -1; doSwing = true; swingCount++; + finalFlip = false; + swingSound = true; } else { @@ -104,11 +115,11 @@ namespace CalamityMod.Projectiles.Melee if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; } - - - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); - if (AnimationProgress < (useAnim / 3)) + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); + + if (AnimationProgress < (useAnim / 1.5f)) { aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; @@ -118,19 +129,25 @@ namespace CalamityMod.Projectiles.Melee doSwing = false; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.8f, useAnim, Animation, true)) * 0.35f)), 0.2f); } else { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0; + } + float time = (AnimationProgress) - (useAnim / 3); float timeMax = useAnim - (useAnim / 3); - if (time == (int)(timeMax * 0.4f)) + if (time >= (int)(timeMax * 0.4f) && swingSound) { SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.32f) }, Projectile.Center); + swingSound = false; } - if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) + if (time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) { CanHit = true; @@ -157,27 +174,38 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 6; i++) { - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.Zero, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + dust.noGravity = true; + dust.color = Color.DodgerBlue; GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 23, Main.rand.NextFloat(0.5f, 1f), Color.Black, false, false, false)); + } else + { + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.Zero, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + dust.noGravity = true; + dust.color = Color.Blue; GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 23, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue)); + } } for (int i = 0; i < 3; i++) { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(185, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, dustVel * Main.rand.NextFloat(0.1f, 0.5f)); - dust2.scale = Main.rand.NextFloat(0.45f, 0.95f); + dust2.scale = Main.rand.NextFloat(0.55f, 1.05f); dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? Color.Goldenrod : Color.Gold; } - } + } } } ArmRotationOffset = MathHelper.ToRadians(-140f); ArmRotationOffsetBack = MathHelper.ToRadians(-140f); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) @@ -197,22 +225,19 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().GeneralScreenShakePower = 6.5f; } - int heal = (int)(MathHelper.Clamp(12 - Projectile.numHits * 5, 1, 12)); - if (Projectile.numHits < 12) + int heal = (int)(MathHelper.Clamp(20 - Projectile.numHits * 12, 1, 20)); + if (Projectile.numHits < 10) { - Owner.statLife += heal; - Owner.HealEffect(heal); - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); } if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) { if (target.type == ModContent.NPCType()) { - CombatText.NewText(target.Hitbox, Color.Aqua, "boop!"); + CombatText.NewText(target.Hitbox, Color.Aqua, CalamityUtils.GetTextValue("Misc.HecBoop")); SoundStyle boop = new("CalamityMod/Sounds/Item/SnootBooped"); - SoundEngine.PlaySound(boop with {Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center); + SoundEngine.PlaySound(boop with { Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center); } bool rightClicked = Owner.Calamity().mouseRight; @@ -221,28 +246,33 @@ namespace CalamityMod.Projectiles.Melee target.noTileCollide = false; // Launch the suckers - Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (Main.zenithWorld ? -50 : -30) * (rightClicked ? 2 : 1); - target.velocity = launchVel * 0.5f; + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float launchPower = (Main.zenithWorld ? 50 : 30) * (rightClicked ? 2 : 1); + target.MoveNPC(launchVel, launchPower * 0.5f, true); // Remove knockback resist, just like it used to target.knockBackResist = 1; // Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone) - target.FlungNPC().ApplyCollisionDamage(target, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel, 5f, true); + target.FlungNPC().ApplyCollisionDamage(target, Owner, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel * launchPower, 5f, true); } - Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35, false, 13, 0.5f, Color.DodgerBlue); - GeneralParticleHandler.SpawnParticle(spark); + + if (Projectile.numHits < 3) + { + Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-45 + Projectile.numHits * 5), false, (int)(16 - Projectile.numHits * 3), 0.6f - Projectile.numHits * 0.15f, Color.DodgerBlue, 0.45f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) { - Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), true, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue); + Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue); GeneralParticleHandler.SpawnParticle(spark2); - if (Main.rand.NextBool(3)) - { - Particle spark3 = new AltSparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), true, 55, Main.rand.NextFloat(0.4f, 1.5f), Color.Black); - GeneralParticleHandler.SpawnParticle(spark3); - } + Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType(), ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(1.55f, 2.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue; } } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Owner.Calamity().mouseRight) @@ -250,11 +280,12 @@ namespace CalamityMod.Projectiles.Melee else { float minMult = 0.5f; - int hitsToMinMult = 7; + int hitsToMinMult = 15; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= damageMult; } } + public override bool PreDraw(ref Color lightColor) { // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. @@ -265,13 +296,16 @@ namespace CalamityMod.Projectiles.Melee float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; - for (int i = 0; i < 6; i++) + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + if (Animation > useAnim * 0.2f) + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.DodgerBlue with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -90 : 90) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.6f, SpriteEffects.None); + + for (int i = 0; i < 25; i++) { - Color auraColor = Color.Lerp(Color.Goldenrod, Color.Gold, Utils.GetLerpValue(0, 5, i)) * 0.5f * fadeIn; Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/GrandDadGhost").Value; - Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); - rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); - Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Color auraColor = Color.Gold with { A = 0 } * 0.15f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 6 * fadeIn; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); @@ -280,8 +314,5 @@ namespace CalamityMod.Projectiles.Melee } return false; } - public override void ResetStyle() - { - } } } diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 08b75853bb..41156a4121 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandGuardian"; - public override float HitboxOutset => 105; + public override float HitboxOutset => 112; - public override Vector2 HitboxSize => new Vector2(175, 175); + public override Vector2 HitboxSize => new Vector2(180, 180); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 124); + public override Vector2 SpriteOrigin => new(-3, 130); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -37,6 +37,8 @@ namespace CalamityMod.Projectiles.Melee public int useAnim; public int swingCount; public bool spawnBoom = true; + public bool finalFlip = false; + public bool playSwingSound = true; public override void SetDefaults() { base.SetDefaults(); @@ -44,12 +46,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Guardian has no projectiles mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -62,6 +65,7 @@ namespace CalamityMod.Projectiles.Melee public override void UseStyle() { + AnimationProgress = Animation % useAnim; DrawUnconditionally = false; if (CanHit || postSwing) @@ -72,9 +76,9 @@ namespace CalamityMod.Projectiles.Melee } if (CanHit) - fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.3f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.25f); if (!doSwing) @@ -82,6 +86,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; + playSwingSound = true; spawnBoom = true; Projectile.numHits = 0; mousePos = Owner.Calamity().mouseWorld; @@ -92,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee FlipAsSword = Owner.direction == -1 ? true : false; doSwing = true; - swingCount++; + finalFlip = false; } else { @@ -108,31 +113,39 @@ namespace CalamityMod.Projectiles.Melee } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); - if (AnimationProgress < (useAnim / 3)) + if (AnimationProgress < (useAnim / 1.2f)) { aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; if (AnimationProgress == 0) { + Animation = 0; doSwing = false; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.1f, useAnim * 0.25f, Animation, true)) * 0.35f)), 0.2f); } else { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0 ? true : false; + } + float time = (AnimationProgress) - (useAnim / 3); float timeMax = useAnim - (useAnim / 3); - if (time == (int)(timeMax * 0.3f)) + if (time >= (int)(timeMax * 0.3f) && playSwingSound) { SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); SoundEngine.PlaySound(SoundID.DD2_GhastlyGlaivePierce with { Volume = 1f, Pitch = -0.5f }, Projectile.Center); + swingCount++; + playSwingSound = false; } - if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.9f)) + if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax)) { CanHit = true; @@ -159,7 +172,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { bool color = Main.rand.NextBool(); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(198, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); @@ -179,16 +192,12 @@ namespace CalamityMod.Projectiles.Melee if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) Projectile.numHits -= 1; - if (target.CanBeMoved(false)) - { - // Launch - Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -8; - target.velocity = launchVel; - } + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 8, true); if (spawnBoom) { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.5f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.5f, Projectile.owner); spawnBoom = false; } @@ -197,13 +206,10 @@ namespace CalamityMod.Projectiles.Melee SoundStyle fire2 = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); SoundEngine.PlaySound(fire2 with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, Projectile.Center); - int heal = (int)(MathHelper.Clamp(3 - Projectile.numHits, 1, 3)); - if (Projectile.numHits < 3) + int heal = (int)(MathHelper.Clamp(5 - Projectile.numHits * 3, 1, 5)); + if (Projectile.numHits < 5) { - Owner.statLife += heal; - Owner.HealEffect(heal); - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); } int points = 4; @@ -219,14 +225,6 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) { - //Particle spark2 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 45, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue); - //GeneralParticleHandler.SpawnParticle(spark2); - if (Main.rand.NextBool(3)) - { - //Particle spark3 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 45, Main.rand.NextFloat(0.3f, 1f), Color.Lavender); - //GeneralParticleHandler.SpawnParticle(spark3); - } - Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.7f)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; @@ -247,17 +245,19 @@ namespace CalamityMod.Projectiles.Melee { Asset tex = ModContent.Request(Texture); Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow"); + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 25; i++) { - Color auraColor = Color.Lerp(Color.DodgerBlue, Color.Cyan, Utils.GetLerpValue(0, 5, i)) * 0.5f * fadeIn; Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/GrandGuardianGhost").Value; - Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); - rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); - Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Color auraColor = Color.Cyan with { A = 0 } * 0.15f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 6 * fadeIn; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } + if (swingCount > 0) + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.DarkOrchid with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 2.55f / 4, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index ed9b0cd04e..831386263b 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -12,84 +14,132 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; private const int TimeLeft = 300; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } + public Vector2 storedVel; public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 40; + Projectile.height = 40; Projectile.friendly = true; + Projectile.alpha = 255; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = 1; + Projectile.extraUpdates = 2; Projectile.timeLeft = TimeLeft; Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Projectile.ai[1] == 0f) + Player Owner = Main.player[Projectile.owner]; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + if (Projectile.ai[0] == 0) { - if (Projectile.Center.Y > Projectile.ai[2]) - Projectile.tileCollide = true; + Projectile.ArmorPenetration = 40; + if (Projectile.timeLeft == TimeLeft) + { + storedVel = Projectile.velocity; + Projectile.velocity = -Projectile.velocity; + } + if (Projectile.timeLeft > TimeLeft - 60) + { + Projectile.velocity *= 0.95f; + Projectile.rotation = storedVel.ToRotation() + MathHelper.PiOver4; + } else - Projectile.tileCollide = false; + { + if (Projectile.timeLeft == TimeLeft - 60) + Projectile.velocity = storedVel; + + NPC target = Owner.Calamity().mouseWorld.ClosestNPCAt(500); + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, false, 0.3f, 10, 0.98f); + + if (Main.rand.NextBool(5)) + { + Particle spark = new GlowOrbParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.6f), true, 13, Main.rand.NextFloat(0.55f, 0.8f), Color.DarkRed * 0.8f, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + else if (Projectile.ai[0] == 1) + { + NPC target = Projectile.Center.ClosestNPCAt(155); + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, false, 0.15f, 9, 0.98f, accelerate: true); } else { - if (Projectile.Center.Y < Projectile.ai[2]) - Projectile.tileCollide = true; - else - Projectile.tileCollide = false; + Projectile.scale = 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 * 8f; + + float fade = Utils.GetLerpValue(255, 0, Projectile.alpha); + SparkParticle orb = new(Projectile.Center + offset, -Projectile.velocity * 0.05f, false, 7, 0.7f, Color.Aqua * 0.6f * fade); + GeneralParticleHandler.SpawnParticle(orb); + + SparkParticle orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.05f, false, 7, 0.7f, Color.Aqua * 0.6f * fade); + GeneralParticleHandler.SpawnParticle(orb2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 102, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 180, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + dust.alpha = (int)MathHelper.Clamp(Projectile.alpha, 0, 180); + + if (Projectile.timeLeft > 130) + { + Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 150, 130, 255, 0)); + } } - Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); - - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - - if (Projectile.localAI[0] == 0f) + if (Main.rand.NextBool()) { - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); - Projectile.localAI[0] += 1f; + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + dust.alpha = (int)MathHelper.Clamp(Projectile.alpha, 0, 100); } - - 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 > 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.NPCDeath12, Projectile.Center); - - for (int i = 4; i < 31; i++) + if (Projectile.timeLeft <= 60) { - 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, 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, DustID.Blood, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[killDust]; - dust.velocity *= 0.05f; + Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0)); + } + if (Projectile.timeLeft > TimeLeft - 20) + { + Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, TimeLeft, TimeLeft - 20, 255, 0)); } } - - 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) + { + if (Projectile.ai[0] == 2) // Water tooth + { + target.AddBuff(BuffID.Wet, 300); + target.AddBuff(ModContent.BuffType(), 300); + } + if (Projectile.ai[0] == 0) // "Jaw" teeth + { + target.AddBuff(ModContent.BuffType(), 180); + } + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, (Projectile.velocity * 2.5f).RotatedByRandom(0.7) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.9f, 1.8f)); + dust.noGravity = false; + } + for (int i = 0; i <= 2; i++) + { + Particle spark = new AltSparkParticle(Projectile.Center, (Projectile.velocity * 4.5f).RotatedByRandom(0.7) * Main.rand.NextFloat(0.1f, 0.8f) + new Vector2(0, -2), true, 20, 0.5f, Color.DarkRed * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.25f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } } } diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index a847d50f03..7955c988a0 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index 01666d03fd..f9fc98014c 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override Vector2 HitboxSize => new Vector2(185, 185) * Projectile.scale; public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 125); + public override Vector2 SpriteOrigin => new(-3, 124); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = false; @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee public float fadeIn = 0; // Used to make particle effects and outer glow on the sword fade in and out public int useAnim; // Used as your use time stat since checking the held item use time gets jank if your attack speed changes mid swing public int storedUseAnim; // Used to check your use time when you began using the item and to reset use time when needed - public int swingCount = -1; // Runs counting code first, so it has to be one below + public int swingCount = 0; public float GFBMulti = 1; // GFB infinite charge particle and damage multiplier public int GFBCharge = 0; // GFB charge counter public bool GFBFlashWarning = false; @@ -42,6 +42,7 @@ namespace CalamityMod.Projectiles.Melee public bool chargedSwing = false; // True if you have a charged swing fully charged public int chargeTimer = 0; // Timer for charging the blade with right click public int chargeTimerMax = 240; // This is set to be base don use time on spawn + public bool playSwingSound = true; public SlotId AudSlot; public override void SetDefaults() @@ -51,12 +52,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { + CanHit = false; Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Hellkite has no projectiles mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -69,12 +72,15 @@ namespace CalamityMod.Projectiles.Melee FlipAsSword = Owner.direction == -1 ? true : false; } - public override void UseStyle() { AnimationProgress = Animation % (chargedSwing ? (int)(storedUseAnim * 0.7f) : storedUseAnim); + if (Owner.Calamity().mouseRight) + Projectile.ai[2] = 5; + DrawUnconditionally = false; + bool cantUse = (Owner == null || !Owner.active || Owner.dead || (Projectile.ai[2] == 0 && !Owner.channel) || (Projectile.ai[2] == 5 && !Owner.Calamity().mouseRight) || Owner.CCed || Owner.noItems); if (CanHit || postSwing) mousePos = Owner.Center - aimVel; @@ -84,18 +90,27 @@ namespace CalamityMod.Projectiles.Melee } if (CanHit) - fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + fadeIn = MathHelper.Lerp(fadeIn, 1, (chargedSwing ? 1.5f : 1) * 0.23f * Owner.GetAttackSpeed()); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.3f); if (chargeTimer > 0) fadeIn = Utils.Remap(chargeTimer, 0, chargeTimerMax, 0, 1f); // If you are no longer holding the charge, then stop charge counter so you can swing - if (!Owner.Calamity().mouseRight) + if (cantUse) + { chargeTimer = 0; + if (Projectile.ai[2] == 5) + { + Owner.itemAnimation = Owner.itemAnimationMax; + Projectile.timeLeft = Owner.itemAnimation; + } + Projectile.ai[2] = 0; + } if (!doSwing) { + playSwingSound = true; mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; @@ -106,13 +121,16 @@ namespace CalamityMod.Projectiles.Melee Vector2 bladePos = new Vector2(60, 0); Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - if (Owner.Calamity().mouseRight) + if (Projectile.ai[2] == 5) { RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.05f); - float rotationValue = 65f + (25 * Utils.GetLerpValue(0, chargeTimerMax, chargeTimer, true)) * (FlipAsSword ? 1 : -1) * -Projectile.ai[1]; + float rotationValue = 45f + (25 * Utils.GetLerpValue(0, chargeTimerMax, chargeTimer, true)) * (FlipAsSword ? 1 : -1) * -Projectile.ai[1]; Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(rotationValue), 0.3f); Animation = 0; + Owner.itemAnimation++; + Projectile.timeLeft++; + if (chargeTimer < chargeTimerMax && !chargedSwing) chargeTimer++; if (Main.zenithWorld) @@ -148,6 +166,7 @@ namespace CalamityMod.Projectiles.Melee chargedSwing = true; useAnim = storedUseAnim / 3; chargeTimer++; + if (Main.zenithWorld) { if (chargeTimerMax - (GFBMulti * GFBMulti * 2) <= 12 && !GFBFlashWarning) @@ -199,11 +218,11 @@ namespace CalamityMod.Projectiles.Melee else Owner.direction = 1; } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); - if (AnimationProgress < (useAnim / 3)) + if (AnimationProgress < (useAnim / 1.5f)) { - if (Owner.Calamity().mouseRight && !chargedSwing) + if (Projectile.ai[2] == 5 && !chargedSwing) doSwing = false; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -218,18 +237,19 @@ namespace CalamityMod.Projectiles.Melee doSwing = false; chargeTimer = 0; chargedSwing = false; - swingCount++; useAnim = storedUseAnim; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.35f, useAnim * 0.6f, Animation, true)) * 0.5f)), 0.2f); + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; } else { float time = (AnimationProgress) - (useAnim / 3); float timeMax = useAnim - (useAnim / 3); - if (time == (int)(timeMax * (chargedSwing ? 0.2f : 0.4f))) + if (time >= (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)) && playSwingSound) { if (!chargedSwing) { @@ -240,8 +260,10 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(Hellkite.SwingSound with { Volume = 0.9f, Pitch = 0.2f }, Projectile.Center); SoundEngine.PlaySound(Hellkite.SwingSoundBig with { Volume = 1f, Pitch = 0f }, Projectile.Center); } + swingCount++; + playSwingSound = false; } - if ( time > (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)) && time < (int)(timeMax * (chargedSwing ? 0.9f : 0.7f))) + if (time > (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)) && time < (int)(timeMax * (chargedSwing ? 0.9f : 0.7f))) { CanHit = true; @@ -272,10 +294,10 @@ namespace CalamityMod.Projectiles.Melee RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), 0.2f); - //if (time >= timeMax) - //doSwing = false; if (time < (int)(timeMax * 0.9f)) + { postSwing = true; + } if (CanHit) { @@ -353,18 +375,22 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(Hellkite.HitSoundBig with { Volume = 1f }, Projectile.Center); Owner.Calamity().GeneralScreenShakePower = 8.5f * GFBMulti; + bool photos = CalamityClientConfig.Instance.Photosensitivity; - for (int i = 0; i < 3; i++) + if (!photos) { - Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * (i + 1) * GFBMulti, 1f, GFBFlashWarning ? (int)(18 * GFBMulti) : 18, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * (i + 1) * GFBMulti, 0.5f, GFBFlashWarning ? (int)(18 * GFBMulti) : 18, true); - GeneralParticleHandler.SpawnParticle(blastRing2); + for (int i = 0; i < 3; i++) + { + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * (i + 1) * GFBMulti, 1f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * (i + 1) * GFBMulti, 0.5f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } } for (int i = 0; i < 2; i++) { - Particle spark = new GlowSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -25 * (i == 0 ? -1 : 1), false, 12, 0.08f * GFBMulti, Color.OrangeRed, new Vector2(3, 0.8f), true); + Particle spark = new GlowSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -25 * (i == 0 ? -1 : 1), false, 12, 0.08f * (photos ? 1f : GFBMulti), Color.OrangeRed, new Vector2(3, 0.8f), true); GeneralParticleHandler.SpawnParticle(spark); } for (int i = 0; i < 15; i++) @@ -384,49 +410,51 @@ namespace CalamityMod.Projectiles.Melee } } - if (target.CanBeMoved(true)) - { - // Custom knockback - Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (chargedSwing ? -24 : -19); - target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); - } + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, (chargedSwing ? 24 : 19), true); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + if (chargedSwing) + modifiers.SetCrit(); + float minMult = 0.25f; - int hitsToMinMult = 4; + int hitsToMinMult = 10; float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= (chargedSwing ? 4f * (GFBMulti) : 1) * damageMult; + modifiers.SourceDamage *= (chargedSwing ? 3f * (GFBMulti) : 1) * damageMult; } public override bool PreDraw(ref Color lightColor) { // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. - if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + if ((useAnim > 0 || DrawUnconditionally) && (Owner.ItemAnimationActive || Owner.Calamity().mouseRight)) { Asset tex = ModContent.Request(Texture); Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/HellkiteGlow"); Asset shineTex = ModContent.Request("CalamityMod/Particles/Sparkle"); + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearRagged"); float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; Vector2 generalDrawPos = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); SpriteEffects sEffects = spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - for (int i = 0; i < 5; i++) + for (int i = 0; i < 25; i++) { - Color auraColor = Color.Lerp(Color.OrangeRed, Color.Orange, Utils.GetLerpValue(0, 5, i)) * 0.2f * fadeIn; Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/HellkiteGhost").Value; - Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); - rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f - 0.5f); - Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects); + Color auraColor = Color.OrangeRed with { A = 0 } * 0.15f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * (chargeTimer > 0 ? 4 : 7) * fadeIn; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } + if (swingCount > 0 && Projectile.ai[2] != 5 && !playSwingSound) + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Lerp(Color.DarkRed, Color.OrangeRed, 0.25f) with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 2.35f / 4, swingCount % 2 == 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, generalDrawPos, tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects); if (chargeTimer > 0) { for (int i = 0; i < 5; i++) { - Color auraColor = Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 5, i)) * 0.4f * fadeIn; + Color auraColor = (Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 5, i)) * 0.4f * fadeIn) with { A = 0 }; Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 13f) * 0.5f); Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), glowTex.Value.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects); diff --git a/Projectiles/Melee/HolyColliderGhost.png b/Projectiles/Melee/HolyColliderGhost.png new file mode 100644 index 0000000000..80f5b69bae Binary files /dev/null and b/Projectiles/Melee/HolyColliderGhost.png differ diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs new file mode 100644 index 0000000000..d342eee4c5 --- /dev/null +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -0,0 +1,462 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class HolyColliderHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/HolyCollider"; + public override float HitboxOutset => 100; + + public override Vector2 HitboxSize => new Vector2(200, 200) * Projectile.scale; + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(0, 146); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = false; + public bool postSwing = false; + public float fadeIn = 0; // Used to make particle effects and outer glow on the sword fade in and out + public int useAnim; // Used as your use time stat since checking the held item use time gets jank if your attack speed changes mid swing + public int storedUseAnim; // Used to check your use time when you began using the item and to reset use time when needed + public int swingCount = -1; // Runs counting code first, so it has to be one below + + public int pierceReduction = 0; // Used to reduce damage when striking many enemies with a single swing + + public bool chargedSwing = false; // True if you have a charged swing fully charged + public int chargeTimer = 0; // Timer for charging the blade + public int chargeTimerMax = 240; // This is set to be base don use time on spawn + + public Color mainColor1 = Color.Goldenrod; + public Color mainColor2 = Color.OrangeRed; + public bool playSwingSound = true; + + public SlotId AudSlot; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void WhenSpawned() + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = -1; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Holy Collider's projectile spawning + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + storedUseAnim = useAnim; + + chargeTimerMax = (int)(useAnim * 1.1f); // Max charge time is set here + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + public override void UseStyle() + { + AnimationProgress = Animation % (chargedSwing ? (int)(storedUseAnim * 1.2f) : storedUseAnim); + + DrawUnconditionally = false; + bool cantUse = (Owner.Calamity().mouseRight || Owner == null || !Owner.active || Owner.dead || Main.mouseLeftRelease || Owner.CCed || Owner.noItems); + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + if (chargeTimer > 0) + fadeIn = Utils.Remap(chargeTimer, 0, chargeTimerMax, 0, 1f); + + // If you are no longer holding the charge, then stop charge counter so you can swing + if (cantUse) + { + chargeTimer = 0; + if (Projectile.ai[2] == 5) + { + Owner.itemAnimation = Owner.itemAnimationMax; + Projectile.timeLeft = Owner.itemAnimation; + } + Projectile.ai[2] = 0; + } + else + Projectile.ai[2] = 5; + + if (!doSwing) + { + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + + Vector2 bladePos = new Vector2(76, 0); + Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45) - 0.1f * (FlipAsSword ? 1 : -1) * -Projectile.ai[1]); + + if (Projectile.ai[2] == 5) + { + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.05f); + + float rotationValue = 45f + (25 * Utils.GetLerpValue(0, chargeTimerMax, chargeTimer, true)) * (FlipAsSword ? 1 : -1) * -Projectile.ai[1]; + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(rotationValue), 0.3f); + Animation = 0; + Owner.itemAnimation++; + Projectile.timeLeft++; + + if (chargeTimer < chargeTimerMax && !chargedSwing) + chargeTimer++; + + Vector2 particleVel = (Owner.Center - particlePos).SafeNormalize(Vector2.UnitX) * -9; + + Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), particleVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 1)); + dust2.scale = Main.rand.NextFloat(0.95f, 1.45f) * fadeIn; + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + + Particle spark3 = new LineParticle(particlePos, particleVel.RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.9f), false, 18, Main.rand.NextFloat(0.5f, 0.8f) * fadeIn, Main.rand.NextBool(3) ? mainColor2 : mainColor1); + GeneralParticleHandler.SpawnParticle(spark3); + + if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound) && ChargeSound.IsPlaying) + { + ChargeSound.Position = Projectile.Center; + ChargeSound.Pitch = Utils.Remap(chargeTimer, 0, chargeTimerMax, -0.4f, 0f); + ChargeSound.Volume = Utils.Remap(chargeTimer, 0, chargeTimerMax, 0f, 0.5f) * 100; + } + else if (!chargedSwing) + { + SoundStyle burn = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurnLoop"); + AudSlot = SoundEngine.PlaySound(burn with { Volume = 0.01f, Pitch = 0, IsLooped = true }, Projectile.Center); + } + } + if (chargeTimer == chargeTimerMax) + { + particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + + SoundStyle fullCharge = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn"); + SoundEngine.PlaySound(fullCharge with { Volume = 0.7f, Pitch = 0.5f }, Projectile.Center); + + chargedSwing = true; + useAnim = storedUseAnim / 2; + chargeTimer++; + + for (int i = 0; i < 20; i++) + { + Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(3) ? mainColor2 : mainColor1); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + if (chargeTimer == 0) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + pierceReduction = 0; + doSwing = true; + } + } + else if (chargeTimer == 0) + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound)) + ChargeSound?.Stop(); + + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); + + if (AnimationProgress < (useAnim / 1.6f)) + { + if (Projectile.ai[2] == 5 && !chargedSwing) + doSwing = false; + + playSwingSound = true; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + Projectile.scale = 1; + Animation = 0; + doSwing = false; + chargeTimer = 0; + chargedSwing = false; + swingCount++; + useAnim = storedUseAnim; + Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.15f, useAnim * 0.35f, Animation, true)) * 0.35f)), 0.2f); + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; + } + else + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time >= (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)) && playSwingSound) + { + if (!chargedSwing) + { + SoundStyle swing = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + SoundEngine.PlaySound(swing with { Volume = 0.7f, Pitch = 0.35f }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(swing2 with { Volume = 0.55f, Pitch = -0.15f }, Projectile.Center); + } + else + { + SoundStyle swing = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(swing with { Volume = 0.8f, Pitch = -0.35f }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(swing2 with { Volume = 0.9f, Pitch = -0.55f }, Projectile.Center); + } + playSwingSound = false; + } + if ( time > (int)(timeMax * (chargedSwing ? 0.1f : 0.3f)) && time < (int)(timeMax * (chargedSwing ? 0.95f : 0.85f))) + { + CanHit = true; + + Vector2 particleVel = new Vector2(0, 2 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + if (!chargedSwing) + { + for (int i = 0; i < 3; i++) + { + particleVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction) * Main.rand.NextFloat(0.3f, 1f)).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + if (i < 2) + { + Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), -particleVel.RotatedByRandom(0.3f)); + dust2.scale = Main.rand.NextFloat(0.95f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + } + else + { + Particle spark = new CustomSpark(particlePos, (-particleVel * 0.2f).RotatedByRandom(0.3f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(0.9f, 1.1f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + } + else + { + CanHit = false; + } + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time < (int)(timeMax * 0.9f)) + { + postSwing = true; + } + + if (CanHit) + { + if (chargedSwing) + { + for (int i = 0; i < 6; i++) + { + float randRot = Main.rand.NextFloat(-10, -45); + Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f), (Main.rand.NextBool(4) ? Color.DarkGoldenrod : Color.Goldenrod), new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); + if (i % 3 == 0) + { + Particle spark = new CustomSpark(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } + for (int i = 0; i < 6; i++) + { + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = (new Vector2(0, 35 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.3f, 0.9f)); + dust2.scale = Main.rand.NextFloat(0.95f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + } + } + else + { + for (int i = 0; i < 8; i++) + { + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = -(new Vector2(0, 25 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.15f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.5f)); + dust2.scale = Main.rand.NextFloat(0.75f, 0.9f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + } + } + + if (chargedSwing) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType()) + { + projectile.ai[2] = 5; + projectile.owner = Owner.whoAmI; + } + } + } + else + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10) + { + Vector2 launch = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f; + projectile.velocity += launch; + projectile.timeLeft = 300; + projectile.owner = Owner.whoAmI; + Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f, 11); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 90); + + // If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits (which uses Projectile.numHits) + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && pierceReduction > 0) + { + pierceReduction -= 1; + } + + if (!chargedSwing) + { + if (Projectile.numHits == 0) + { + SoundStyle hitSound = new("CalamityMod/Sounds/Item/HolyColliderSmallHit"); + SoundEngine.PlaySound(hitSound with { Volume = 0.85f, PitchVariance = 0.25f }, Projectile.Center); + + for (int i = 0; i < 8; i++) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile fadedFire = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -11).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.05), Projectile.knockBack, Projectile.owner, 10, target.whoAmI); + fadedFire.timeLeft = Main.rand.Next(40, 55 + 1); + } + } + } + else + { + if (Projectile.numHits == 0) + { + SoundStyle hitSound = new("CalamityMod/Sounds/Item/HolyColliderBigHit"); + SoundEngine.PlaySound(hitSound with { Volume = 1f, PitchVariance = 0.15f }, Projectile.Center); + + float starAngle = MathHelper.ToRadians(45f); + for (int i = 0; i < 4; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 4f; + + Particle pulse = new CustomSpark(target.Center, vel, "CalamityMod/Particles/BloomCircle", false, 12, 1.2f, Color.Orange, new Vector2(3.2f, 0.9f), true, true, shrinkSpeed: 0.95f); + GeneralParticleHandler.SpawnParticle(pulse); + } + for (int i = 0; i < 4; i++) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, (new Vector2(0, -35).RotatedBy(MathHelper.ToRadians(45f))).RotatedBy(MathHelper.ToRadians(90f) * i), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack, Projectile.owner, 0, target.whoAmI); + } + } + } + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, (chargedSwing ? 35 : 23), true); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.25f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= (chargedSwing ? 1f : 0.5f) * damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && (Owner.ItemAnimationActive)) + { + Asset tex = ModContent.Request(Texture); + Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/HolyColliderGlow"); + Asset shineTex = ModContent.Request("CalamityMod/Particles/Sparkle"); + bool flipAsSword = (swingCount % 2 == 0 ? !FlipAsSword : FlipAsSword); + float r = flipAsSword ? MathHelper.ToRadians(90) : 0f; + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); + SpriteEffects sEffects = spriteEffects != SpriteEffects.None ? spriteEffects : (flipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + for (int i = 0; i < 25; i++) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/HolyColliderGhost").Value; + Color auraColor = mainColor1 with { A = 0 } * 0.15f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 6 * fadeIn; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, flipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (flipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, generalDrawPos, tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, flipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects); + Main.EntitySpriteDraw(glowTex.Value, generalDrawPos, glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, flipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects); + } + else + { + chargeTimer = 0; + chargedSwing = false; + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index 381642a43f..fd51d02d91 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -1,4 +1,6 @@ -using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,29 +14,126 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire2"; + public bool isLaunched = false; + public bool setStats = true; + public static int statMax = 8; + public int setStatTimer = statMax; + public int time = 0; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() { - Projectile.width = 26; - Projectile.height = 26; + Projectile.width = 1; + Projectile.height = 1; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.timeLeft = 90; + Projectile.timeLeft = 180; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 75 && target.CanBeChasedBy(Projectile); + public override bool? CanDamage() => ((time > 10 && !isLaunched) || (isLaunched && !setStats)) ? null : false; public override void AI() { + Player Owner = Main.player[Projectile.owner]; + if (Projectile.ai[2] == 5 && time > 10 && Projectile.ai[0] != 10) + isLaunched = true; + else + Projectile.ai[2] = 0; + + Projectile.scale = Utils.GetLerpValue(0, 40, Projectile.timeLeft, true); + + if (isLaunched) + { + Projectile.rotation = Projectile.velocity.ToRotation(); + if (setStats) + { + if (setStatTimer == statMax) + { + Projectile.timeLeft = 300; + for (int i = 0; i < 2; i++) + { + SoundStyle sound5 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); + SoundEngine.PlaySound(sound5 with { Volume = 0.55f, Pitch = 0.6f, MaxInstances = 2 }, Projectile.Center); + } + float starAngle = Main.rand.NextFloat(-0.9f, 0.9f); + for (int i = 0; i < 4; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 8f; + + Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 10, 0.08f, Color.Orange, new Vector2(3.2f, 0.9f), true, true, 0.9f); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + if (setStatTimer == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0.4f }, Projectile.Center); + + Projectile.extraUpdates = 5; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 vel = (Projectile.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * -12; + Projectile.velocity = vel; + Projectile.penetrate = 1; + // This has reduced damage on spawn so this isn't as high as it seems + Projectile.damage *= 15; + time = 0; + setStats = false; + } + else + setStatTimer -= 2; + } + else + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(80, 80), ModContent.DustType(), (Projectile.velocity * 2) * Main.rand.NextFloat(0.1f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.85f, 2.45f); + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Goldenrod; + dust.noLightEmittence = true; + } + if (Main.rand.NextBool()) + { + Particle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), false, 11, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + } + } + else + { + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (new Vector2(0, -7)).RotatedByRandom(0.2) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.45f) * Projectile.scale; + dust.color = Color.Goldenrod; + dust.noLightEmittence = true; + } + + if (Projectile.velocity.Length() > 8) + Projectile.velocity *= 0.88f; + else + Projectile.velocity *= 0.965f; + } + Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (Projectile.frameCounter > 4) { Projectile.frame++; Projectile.frameCounter = 0; @@ -42,51 +141,69 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.frame > 3) Projectile.frame = 0; - if (Math.Abs(Projectile.velocity.X) < 7f) - Projectile.velocity.X *= 1.05f; - - if (Projectile.timeLeft < 75) - CalamityUtils.HomeInOnNPC(Projectile, true, 450f, 12f, 20f); + time++; } - - public override Color? GetAlpha(Color lightColor) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, isLaunched ? 100 : 20, targetHitbox); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - return new Color(250, 150, 0, Projectile.alpha); + target.AddBuff(ModContent.BuffType(), 180); } - - public override bool PreDraw(ref Color lightColor) - { - 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 OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 150; - Projectile.height = 150; - 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++) + // boom + Player Owner = Main.player[Projectile.owner]; + if (isLaunched && Projectile.scale > 0.2f) { - int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool()) + Owner.Calamity().GeneralScreenShakePower = 9f; + + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); + SoundEngine.PlaySound(sound with { Volume = 1f }, Projectile.Center); + + for (int g = 0; g < 3; g++) { - Main.dust[holy].scale = 0.5f; - Main.dust[holy].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.8f * (g + 1), 1.7f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.2f * (g + 1), 1.3f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); } + for (int i = 0; i < 5; i++) + { + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.OrangeRed, Color.Orange, i * 0.2f), i == 4 ? "CalamityMod/Particles/ShatteredExplosion" : "CalamityMod/Particles/FlameExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.11f + i * 0.05f, 18); + GeneralParticleHandler.SpawnParticle(orb1); + } + for (int i = 0; i < 25; i++) + { + Particle spark = new SparkParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 55, 0.85f, Main.rand.NextBool() ? Color.Goldenrod : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark); + } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.47), Projectile.knockBack, Projectile.owner, 1.8f); } - for (int j = 0; j < 10; j++) - { - 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(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Texture2D smallTexture = ModContent.Request("CalamityMod/Projectiles/Melee/HolyColliderHolyFire").Value; + Texture2D bigTexture = ModContent.Request("CalamityMod/Projectiles/Melee/HolyColliderHolyFire2").Value; + + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + // The back glow + float power = !setStats ? 2.4f : 0.6f; + float randSize = Main.rand.NextFloat(0.8f, 1.1f); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Goldenrod with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.65f * randSize * power * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.45f * randSize * power * Projectile.scale, SpriteEffects.None, 0); + + Texture2D usedTex = (!setStats ? bigTexture : smallTexture); + Rectangle frame = usedTex.Frame(1, 4, 0, Projectile.frame); + Vector2 rotationPoint = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation; + + if (setStatTimer == statMax || !setStats) + Main.EntitySpriteDraw(usedTex, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + return false; } } } diff --git a/Projectiles/Melee/HolyColliderHolyFire2.png b/Projectiles/Melee/HolyColliderHolyFire2.png new file mode 100644 index 0000000000..d83b5f5d2b Binary files /dev/null and b/Projectiles/Melee/HolyColliderHolyFire2.png differ diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index 90414812a7..5bd09ba952 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -13,6 +14,8 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/Boss/IceBomb"; + public ref float Timer => ref Projectile.ai[0]; + public const float FormTime = 60f; public override void SetDefaults() { @@ -22,16 +25,28 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; - Projectile.timeLeft = 180; + Projectile.timeLeft = 120; Projectile.tileCollide = false; } - public override bool? CanDamage() => Projectile.ai[0] >= 120f; + public override bool? CanDamage() => false; public override void AI() { - Projectile.velocity *= 0.98f; + NPC npc = Main.npc[(int)Projectile.ai[1]]; + // Rotate around the hit enemy + if (!npc.active) + Projectile.Kill(); + else + { + Vector2 centerOffset = new Vector2((npc.height < npc.width ? npc.height : npc.width) * 0.7f, 0f); + // Enforce a minimum offset so that it doesn't look weird on small enemies + centerOffset.X = MathHelper.Max(centerOffset.X, 45f); + Projectile.Center = npc.Center + centerOffset.RotatedBy((MathHelper.Pi / 30f * Timer) + (MathHelper.PiOver2 * Projectile.ai[2])); + } + + // Constantly pulse in size and transparency if (Projectile.localAI[0] == 0f) { Projectile.scale += 0.01f; @@ -53,67 +68,48 @@ namespace CalamityMod.Projectiles.Melee } } - if (Projectile.ai[0] < 120f) + // Once out for long enough, materialize + Timer++; + if (Timer == FormTime) { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] == 120f) + for (int i = 0; i < 8; i++) { - for (int i = 0; i < 8; i++) + Dust icyDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f); + icyDust.velocity *= 3f; + if (Main.rand.NextBool()) { - 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()) - { - Main.dust[icyDust].scale = 0.5f; - Main.dust[icyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + icyDust.scale = 0.5f; + icyDust.fadeIn = 1f + Main.rand.Next(10) * 0.1f; } - for (int j = 0; j < 14; j++) - { - 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(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f); - Main.dust[icyDust2].velocity *= 2f; - } - - Projectile.scale = 1f; - Projectile.ExpandHitboxBy((int)(30f * Projectile.scale)); - SoundEngine.PlaySound(SoundID.Item30, Projectile.Center); } + for (int j = 0; j < 14; j++) + { + Dust icyDust2 = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 3f); + icyDust2.noGravity = true; + icyDust2.velocity *= 5f; + icyDust2 = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f); + icyDust2.velocity *= 2f; + } + + Projectile.scale = 1f; + Projectile.ExpandHitboxBy((int)(30f * Projectile.scale)); + SoundEngine.PlaySound(SoundID.Item30, Projectile.Center); } } - public override Color? GetAlpha(Color lightColor) - { - return Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item27, Projectile.position); - float spread = 90f * 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 < 2; i++) + for (int i = 0; i < 4; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); - if (projectile1.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[projectile1].DamageType = DamageClass.Melee; - Main.projectile[projectile1].penetrate = 2; - } - int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); - if (projectile2.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[projectile2].DamageType = DamageClass.Melee; - Main.projectile[projectile2].penetrate = 2; - } + Vector2 shardVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(2.25f, 4.5f); + int iceShard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); + if (iceShard.WithinBounds(Main.maxProjectiles)) + Main.projectile[iceShard].DamageType = DamageClass.Melee; } } @@ -121,9 +117,13 @@ namespace CalamityMod.Projectiles.Melee 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) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 30); + + public override bool PreDraw(ref Color lightColor) { - target.AddBuff(ModContent.BuffType(), 30); + Texture2D tex = ModContent.Request(Texture).Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; } } } diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 3ae2bab4d8..9f9b9c19d9 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -14,8 +14,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -78,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); @@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); @@ -100,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index dc2c3c4ba3..19356cd8b4 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -1,6 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -13,127 +18,169 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public int time = 0; + public float fade = 0; + + public int strongTimeMax = 60; + public int strongTimer = 0; + + public bool isPowered = false; + public bool canBePowered = false; + public Vector2 storedVel = Vector2.Zero; + public NPC targetedNPC; + public bool hasHitTarget = false; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 11; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 66; + Projectile.height = 70; Projectile.friendly = true; - Projectile.penetrate = 8; - Projectile.alpha = 255; + Projectile.penetrate = -1; Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.scale = 1.3f; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20 * Projectile.extraUpdates; - Projectile.tileCollide = true; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; + Projectile.timeLeft = 600; + Projectile.alpha = 255; + Projectile.tileCollide = false; } public override void AI() { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) + Projectile.rotation = storedVel.ToRotation() + MathHelper.ToRadians(45f); + + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (time > 2) { + if (!canBePowered) + canBePowered = true; Projectile.alpha = 0; + if (fade < 1) + fade += 0.008f; } - 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; + if (canBePowered && !isPowered) + { + Projectile.velocity *= 0.975f; + strongTimer++; + if (strongTimer >= strongTimeMax) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/ImpalerLaunch"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center); + + targetedNPC = Projectile.Center.ClosestNPCAt(1200); + if (targetedNPC != null) + storedVel = (Projectile.Center - targetedNPC.Center).SafeNormalize(Vector2.UnitX) * -30; + Projectile.velocity = storedVel * 1.15f; + Particle pulse2 = new CustomPulse(Projectile.Center - storedVel * 3, -storedVel * 0.1f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), storedVel.ToRotation(), 0f, 0.13f, 25); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle pulse = new CustomPulse(Projectile.Center - storedVel * 3, -storedVel * 0.2f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1f), storedVel.ToRotation(), 0f, 0.25f, 25); + GeneralParticleHandler.SpawnParticle(pulse); + Projectile.extraUpdates = 3; + strongTimer = 0; + isPowered = true; } } - - int dustType = 171; - if (Main.rand.NextBool(3)) + if (isPowered) { - dustType = 46; - } - if (Main.rand.NextBool(9)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - if (Projectile.ai[0] == 0f) - { - 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); - } - //Sticky Behaviour - Projectile.StickyProjAI(15); - if (Projectile.ai[0] == 2f) - { - Projectile.velocity *= 0f; - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(20); - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.ai[0] = 2f; - Projectile.timeLeft = 300; - return false; - } - - public override void OnKill(int timeLeft) - { - int dustType = 171; - if (Main.rand.NextBool(3)) - { - dustType = 46; - } - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.Damage(); - for (int i = 0; i < 15; i++) - { - 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()) + if (targetDist < 1400) { - Main.dust[deathDust].scale = 0.5f; - Main.dust[deathDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + if (Main.rand.NextBool(7)) + { + Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 60, Main.rand.NextFloat(0.8f, 1.3f), Color.Chartreuse); + GeneralParticleHandler.SpawnParticle(trail); + } + if (time % 10 == 0) + { + Particle pulse2 = new CustomPulse(Projectile.Center - Projectile.velocity, Projectile.velocity * 0.1f, Color.Chartreuse, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.1f), Projectile.velocity.ToRotation(), 0f, 0.075f, 14); + GeneralParticleHandler.SpawnParticle(pulse2); + } + + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 6, 0.07f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.65f, new Vector2(1, 0.3f), true, false, 1); + GeneralParticleHandler.SpawnParticle(spark); + } + + targetedNPC = hasHitTarget ? null : Projectile.Center.ClosestNPCAt(600); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, 0.6f, 23, 0.97f, accelerate: true); + } + else if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(13, 13), Main.rand.NextBool(7) ? 28 : 215); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); + } + if (strongTimer == 0) + { + storedVel = Projectile.velocity; + } + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(13, 13), (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); + } + time++; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits < 1) + { + canBePowered = true; + strongTimer = 1; + Particle pulse3 = new GlowSparkParticle(Projectile.Center, storedVel * 1.5f, false, 7, 0.057f, Color.Chartreuse, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + for (int i = 0; i <= 15; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid, storedVel.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + dust.noGravity = true; + } + if (!isPowered) + { + Projectile.velocity *= -1f; + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/NuclearTerrorHit"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = 0.7f }, Projectile.Center); + SoundStyle fir2e = new("CalamityMod/Sounds/NPCHit/PerfMediumHit2"); + SoundEngine.PlaySound(fir2e with { Volume = 0.65f, Pitch = -0.6f }, Projectile.Center); } } - for (int j = 0; j < 30; j++) - { - 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(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); - Main.dust[deathDust2].velocity *= 2f; - } - } + target.AddBuff(ModContent.BuffType(), 180); + modifiers.SourceDamage *= isPowered ? 1.2f : 1f; + if (targetedNPC != null && target == targetedNPC) + hasHitTarget = true; + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } + if (time < 7) + return false; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Venom, 60); + Asset tex = ModContent.Request(Texture); + + if (isPowered || canBePowered) + { + for (int i = 0; i < 3; i++) + { + Color auraColor = Color.Lerp(Color.Chartreuse, Color.Lime, Utils.GetLerpValue(0, 3, i)) * 0.7f * fade; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 27f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 15f) * 0.5f + (isPowered ? 1.5f : 4.5f * Utils.GetLerpValue(0, strongTimeMax, strongTimer))); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor with { A = 0 }, storedVel.ToRotation() + MathHelper.ToRadians(45f), tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + + if (!isPowered) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); + return true; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 40, targetHitbox); } } diff --git a/Projectiles/Melee/IridescentExcaliburSlash.cs b/Projectiles/Melee/IridescentExcaliburSlash.cs index 623ef18e98..a91263e002 100644 --- a/Projectiles/Melee/IridescentExcaliburSlash.cs +++ b/Projectiles/Melee/IridescentExcaliburSlash.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 vector = Projectile.Center - Main.screenPosition; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Rectangle rectangle = asset.Frame(1, 4); Vector2 origin = rectangle.Size() / 2f; float num = Projectile.scale * 1.1f; @@ -230,7 +230,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); @@ -245,7 +245,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); diff --git a/Projectiles/Melee/IridescentExcaliburSlash2.cs b/Projectiles/Melee/IridescentExcaliburSlash2.cs index fcdacfc7d9..54728381f9 100644 --- a/Projectiles/Melee/IridescentExcaliburSlash2.cs +++ b/Projectiles/Melee/IridescentExcaliburSlash2.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 vector = Projectile.Center - Main.screenPosition; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Rectangle rectangle = asset.Frame(1, 4); Vector2 origin = rectangle.Size() / 2f; float num = Projectile.scale * 1.1f; diff --git a/Projectiles/Melee/IridescentExcaliburSlash3.cs b/Projectiles/Melee/IridescentExcaliburSlash3.cs index 73ac9b7231..b370bdf8b5 100644 --- a/Projectiles/Melee/IridescentExcaliburSlash3.cs +++ b/Projectiles/Melee/IridescentExcaliburSlash3.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 vector = Projectile.Center - Main.screenPosition; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Rectangle rectangle = asset.Frame(1, 4); Vector2 origin = rectangle.Size() / 2f; float num = Projectile.scale * 1.1f; diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index 0137b32032..583ad48e1e 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -1,75 +1,119 @@ -using System; +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.Melee { public class JudgementProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - int whiteLightTimer = 15; - + public override string Texture => "CalamityMod/Projectiles/Melee/JudgementProj"; + public ref float time => ref Projectile.ai[0]; + public float hitboxSize = 10; + public Color mainColor; + public float fade = 1; + public float fadeOut = 1; public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 336; + Projectile.height = 274; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.timeLeft = 90; + Projectile.tileCollide = false; + Projectile.timeLeft = 450; Projectile.DamageType = DamageClass.Melee; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.extraUpdates = 9; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - whiteLightTimer--; - if (whiteLightTimer == 0) + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 137; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 137; + + if (time == 0) { - float spread = 180f * 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) + Projectile.scale = 0.0875f; + Projectile.velocity *= 0.9f; + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (time < 200) + { + Projectile.scale += 0.0026f; + hitboxSize += 0.4525f; + Projectile.velocity *= 0.995f; + // Spawn 3 + if (time % 50 == 0 && time > 10) { - for (i = 0; i < 1; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), 3f, Projectile.owner, 0f); + } + } + else + { + Projectile.velocity *= 0.975f; + } + if (time > 300 && fade > 0) + fade -= 0.0065f; + + if (time < 250 && time > 20) + { + if (time < 200) + { + if (Projectile.timeLeft % 4 == 0) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); - int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); - Main.projectile[projectile1].velocity.X *= 0.1f; - Main.projectile[projectile1].velocity.Y *= 0.1f; - Main.projectile[projectile2].velocity.X *= 0.1f; - Main.projectile[projectile2].velocity.Y *= 0.1f; + SparkParticle spark = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(185f)), false, 15, 1f, mainColor * 0.25f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.timeLeft % 4 == 0) + { + SparkParticle spark = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-185f)), false, 15, 1f, mainColor * 0.25f); + GeneralParticleHandler.SpawnParticle(spark); } } - whiteLightTimer = 15; + + if (Main.rand.NextBool(3)) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66); + trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); + trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + trailDust.noGravity = true; + } + + if (Main.rand.NextBool(12)) + { + GlowOrbParticle orb = new GlowOrbParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true); + GeneralParticleHandler.SpawnParticle(orb); + GlowOrbParticle orb2 = new GlowOrbParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true); + GeneralParticleHandler.SpawnParticle(orb2); + } } - - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); - - for (int i = 0; i < 2; i++) - { - 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; - } - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f); + fadeOut = Utils.GetLerpValue(0, 180, Projectile.timeLeft, true); + time++; } - - public override void OnKill(int timeLeft) + public override bool PreDraw(ref Color lightColor) { - SoundEngine.PlaySound(SoundID.Item122, Projectile.position); - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Texture2D tex = ModContent.Request(Texture).Value; + float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade), 1 + (0.45f * waveFade)) * Projectile.scale, SpriteEffects.None, 0); + return false; } + + 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) + { + 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, hitboxSize, targetHitbox); } } diff --git a/Projectiles/Melee/JudgementProj.png b/Projectiles/Melee/JudgementProj.png new file mode 100644 index 0000000000..983f63e892 Binary files /dev/null and b/Projectiles/Melee/JudgementProj.png differ diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index 369ffaea81..ac2bb88855 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index cfe7c32b91..b955bf6f86 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/LuxorsGiftMelee.cs b/Projectiles/Melee/LuxorsGiftMelee.cs index 6e7647375e..0535c4ff7f 100644 --- a/Projectiles/Melee/LuxorsGiftMelee.cs +++ b/Projectiles/Melee/LuxorsGiftMelee.cs @@ -1,5 +1,9 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,103 +16,84 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } - public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 30; + Projectile.height = 38; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.alpha = 255; - Projectile.timeLeft = 300; + Projectile.penetrate = -1; // Works like 2 + Projectile.timeLeft = 180; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; } - public override void AI() { - 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; - } - } - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 3f) - { - for (int l = 0; l < 12; l++) - { - 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 spawnDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); - Main.dust[spawnDust].scale = 1.1f; - Main.dust[spawnDust].noGravity = true; - Main.dust[spawnDust].position = Projectile.Center + dustRotate; - Main.dust[spawnDust].velocity = Projectile.velocity * 0.1f; - Main.dust[spawnDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[spawnDust].position) * 1.25f; - } - } - } + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 0.35f); + Projectile.scale = (Projectile.ai[0] == 5 ? 0.5f : 0.75f); + Projectile.velocity *= 0.973f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - public override Color? GetAlpha(Color lightColor) + if (Projectile.ai[0] == 5) + { + if (Projectile.timeLeft % 9 == 0 && Projectile.timeLeft > 30) + { + Vector2 dustVel = -(Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.45f, 0.6f); + dust.color = Color.Red; + dust.alpha = 120; + dust.noLightEmittence = true; + } + } + else if (Projectile.timeLeft % 4 == 0 && Projectile.timeLeft > 30) + { + Vector2 dustVel = -(Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); + dust.noGravity = !Main.rand.NextBool(3); + dust.scale = Main.rand.NextFloat(0.45f, 0.6f); + dust.color = Color.Red; + dust.noLightEmittence = true; + } + if (Projectile.timeLeft > 90 && Projectile.timeLeft < 177 && Projectile.timeLeft % 2 == 0 && Projectile.ai[0] == 0) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2, false, 14, 0.02f, Color.Red * 0.45f, new Vector2(1.4f, 1f), true, false, 0.6f); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Collision.SolidCollision(Projectile.Center, 9, 9)) + Projectile.velocity *= 0.91f; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - 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); + float minMult = 0.5f; + int hitsToMinMult = 3; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + if (Projectile.numHits >= 1 && Projectile.timeLeft > 70) + Projectile.timeLeft = 70; } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int l = 0; l < 12; l++) - { - 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 spawnDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); - Main.dust[spawnDust].scale = 1.1f; - Main.dust[spawnDust].noGravity = true; - Main.dust[spawnDust].position = Projectile.Center + dustRotate; - Main.dust[spawnDust].velocity = Projectile.velocity * 0.1f; - Main.dust[spawnDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[spawnDust].position) * 1.25f; - } - 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) => (Projectile.ai[0] == 5 || Projectile.numHits >= 2) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, 20, targetHitbox); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Asset tex = ModContent.Request(Texture); + Color drawColor = Color.Red; + float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); + + + for (int i = 0; i < 8; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/LuxorsGiftMelee.png b/Projectiles/Melee/LuxorsGiftMelee.png index 7fc8375ae3..d773032b82 100644 Binary files a/Projectiles/Melee/LuxorsGiftMelee.png and b/Projectiles/Melee/LuxorsGiftMelee.png differ diff --git a/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs index 5941aa2188..d1da4b4c20 100644 --- a/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs +++ b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails base.SetDefaults(); } - public override void ExtraBehavior() + public override bool ExtraBehavior() { // Randomly play grass sounds idly if it is moving/spinning if ((CurrentFlailState == FlailState.Spinning || Projectile.velocity.Length() > 2f) && Projectile.soundDelay <= 0) @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails AuraScale = MathHelper.Clamp(AuraScale + 1f / MaxAuraTime, 0f, 1f); if (AuraScale < 0.15f) - return; + return true; // The dust machine for (int i = 0; i < (int)(10 * AuraScale); i++) @@ -78,6 +78,8 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails } else AuraScale = MathHelper.Clamp(AuraScale - 3f / MaxAuraTime, 0f, 1f); + + return true; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/UrchinMaceProjectile.cs b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs similarity index 55% rename from Projectiles/Melee/UrchinMaceProjectile.cs rename to Projectiles/Melee/MaceFlails/UrchinMaceProj.cs index 57a93c8b70..17eb3bd5ad 100644 --- a/Projectiles/Melee/UrchinMaceProjectile.cs +++ b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs @@ -1,64 +1,73 @@ using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; 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.Projectiles.Melee +namespace CalamityMod.Projectiles.Melee.MaceFlails { - public class UrchinMaceProjectile : ModProjectile, ILocalizedModType + public class UrchinMaceProj : BaseMaceFlailProjectile { - public new string LocalizationCategory => "Projectiles.Melee"; - public Player Owner => Main.player[Projectile.owner]; + // The entire chain is on the mace sprite, in which the player swings public override string Texture => "CalamityMod/Items/Weapons/Melee/UrchinMace"; + public override string ChainTexturePath => string.Empty; - public static float MaxWindup = 110; - public ref float Windup => ref Projectile.ai[0]; - public float WindupProgress => MathHelper.Clamp(Windup, 0, MaxWindup) / MaxWindup; - public static float whirlpoolDamageMultiplier = 2f; + // This flail only runs through one state (spin), thereby making most parameters unnecessary to fill out + public override int AssociatedItemID => ModContent.ItemType(); + public override int SpinIFrames => 15; + public override float SpinHitboxRadius => 64f; + public override float SpinVerticalFactor => 1f; // This flail moves circular + public override float LaunchSpeed => 22f; + + public static float MaxWindup = 45f; public override void SetDefaults() { - Projectile.width = 60; - Projectile.height = 60; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 60; + base.SetDefaults(); + Projectile.localNPCHitCooldown = SpinIFrames * Projectile.MaxUpdates; 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) + public override void SpinAI(float launchSpeed) { - //Prevent spam click abuse - if (Windup < Projectile.localNPCHitCooldown) - return false; + float WindupProgress = MathHelper.Clamp(StateTimer, 0, MaxWindup) / MaxWindup; + if (Projectile.owner == Main.myPlayer) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 toMouse = Owner.MountedCenter.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX * Owner.direction); + Owner.ChangeDir((toMouse.X > 0f).ToDirectionInt()); + if (!Owner.channel && WindupProgress >= 1f) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, toMouse * launchSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * LaunchDamage), Projectile.knockBack, Projectile.owner); + SoundEngine.PlaySound(SoundID.Item7, Owner.MountedCenter); + Projectile.Kill(); + return; + } - float collisionPoint = 0f; - float bladeLength = 70 * Projectile.scale; - float bladeWidth = 30 * 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(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); + if (StateTimer == MaxWindup) + { + for (int i = 0; i < 25; i++) + { + Vector2 dustPos = Owner.position + Main.rand.NextVector2FromRectangle(Owner.Hitbox); + Dust dust = Dust.NewDustPerfect(dustPos, 176, Vector2.UnitY * -5f * Main.rand.NextFloat(1f, 2f) + Owner.velocity, Scale: Main.rand.NextFloat(1f, 2f)); + dust.noGravity = true; + } + } + } Projectile.velocity = Vector2.Zero; - Projectile.rotation += (WindupProgress * MathHelper.PiOver4 / 1.5f) * Owner.direction; - - if (Owner.channel) - { - Projectile.timeLeft = 2; - UpdateOwnerVars(); - } + Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; if (WindupProgress > 0.5f) { @@ -73,31 +82,17 @@ namespace CalamityMod.Projectiles.Melee } } - Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; + StateTimer++; + } + public override bool ExtraBehavior() + { if (Projectile.soundDelay <= 0) { SoundEngine.PlaySound(SoundID.DD2_GhastlyGlaivePierce, Owner.MountedCenter); Projectile.soundDelay = 28; } - if (Windup == MaxWindup && Owner.whoAmI == Main.myPlayer) - { - SoundEngine.PlaySound(SoundID.Item43, Owner.MountedCenter); - - for (int i = 0; i < 25; i++) - { - Vector2 dustPos = Owner.position + Main.rand.NextVector2FromRectangle(Owner.Hitbox); - Dust dust = Dust.NewDustPerfect(dustPos, 176, Vector2.UnitY * -5f * Main.rand.NextFloat(1f, 2f) + Owner.velocity, Scale: Main.rand.NextFloat(1f, 2f)); - dust.noGravity = true; - } - } - - Windup++; - } - - public void UpdateOwnerVars() - { float armPointingDirection = ((Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation()); //"crop" the rotation so the player only points their arm in a smaller range. (The back arm points in the throw direction) @@ -111,12 +106,13 @@ namespace CalamityMod.Projectiles.Melee armPointingDirection = -MathHelper.Pi + MathHelper.PiOver4 * 1.5f * Utils.GetLerpValue(-MathHelper.Pi, -MathHelper.PiOver4, armPointingDirection, true); } - Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2); + + Projectile.timeLeft = 2; Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; + Owner.SetDummyItemTime(2); + return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -130,26 +126,15 @@ namespace CalamityMod.Projectiles.Melee } } - //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(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); - - Texture2D maceTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Texture2D whirlpoolTexture = ModContent.Request("CalamityMod/Projectiles/Melee/RedtideWhirlpool").Value; + Texture2D maceTexture = TextureAssets.Projectile[Type].Value; + Texture2D whirlpoolTexture = TextureAssets.Projectile[ModContent.ProjectileType()].Value; + float WindupProgress = MathHelper.Clamp(StateTimer, 0, MaxWindup) / MaxWindup; float whirlpoolScale = MathHelper.Clamp(WindupProgress * 3f - 0.4f, 0f, 1f) * 2f; - float whirlpoolOpacity = WindupProgress * 0.2f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f; - float whirlpoolRotation = Windup * 0.34f * Owner.direction; + float whirlpoolOpacity = WindupProgress * 0.2f + MathF.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f; + float whirlpoolRotation = StateTimer * 0.34f * Owner.direction; SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(whirlpoolTexture, Owner.MountedCenter - Main.screenPosition, null, Lighting.GetColor((int)Owner.MountedCenter.X / 16, (int)Owner.MountedCenter.Y / 16) * whirlpoolOpacity * 0.3f, whirlpoolRotation * 1.2f, whirlpoolTexture.Size() / 2f, whirlpoolScale, flip, 0); @@ -158,19 +143,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 handleOrigin = new Vector2(0, maceTexture.Height); float maceRotation = Projectile.rotation + MathHelper.PiOver4; Main.EntitySpriteDraw(maceTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), maceRotation, handleOrigin, Projectile.scale, SpriteEffects.None, 0); - return false; } - - public override void OnKill(int timeLeft) - { - //Spawn a whirlpool typhoon after sending it out - if (WindupProgress >= 1f && Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Main.MouseWorld - Owner.position).SafeNormalize(Vector2.One) * 25f, ModContent.ProjectileType(), (int)(Projectile.damage * whirlpoolDamageMultiplier), Projectile.knockBack, Projectile.owner, 0, 0f); - } - - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); - } } } diff --git a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs index 3b78e442ef..1073486d6b 100644 --- a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs +++ b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails base.SetDefaults(); } - public override void ExtraBehavior() + public override bool ExtraBehavior() { if (Main.rand.NextBool(3)) { @@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails spore.noGravity = true; spore.scale = 1.5f; } + return true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 180); diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index 31ca65eac1..0e1d75a86c 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -32,6 +32,8 @@ namespace CalamityMod.Projectiles.Melee public float fadeIn = 0; public int useAnim; public int swingCount; + public bool finalFlip = false; + public bool playSwingSound = true; public override void SetDefaults() { base.SetDefaults(); @@ -39,12 +41,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Majestic Guard has no projectiles mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -57,6 +60,7 @@ namespace CalamityMod.Projectiles.Melee public override void UseStyle() { + AnimationProgress = Animation % useAnim; DrawUnconditionally = false; if (CanHit || postSwing) @@ -67,9 +71,9 @@ namespace CalamityMod.Projectiles.Melee } if (CanHit) - fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.15f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.25f); if (!doSwing) @@ -77,6 +81,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; + playSwingSound = true; Projectile.numHits = 0; mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -86,7 +91,7 @@ namespace CalamityMod.Projectiles.Melee FlipAsSword = Owner.direction == -1 ? true : false; doSwing = true; - swingCount++; + finalFlip = false; } else { @@ -102,31 +107,40 @@ namespace CalamityMod.Projectiles.Melee } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); - if (AnimationProgress < (useAnim / 3)) + if (AnimationProgress < (useAnim / 1.6f)) { aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; if (AnimationProgress == 0) { + Animation = 0; doSwing = false; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.35f, useAnim * 0.65f, Animation, true)) * 0.45f)), 0.2f); + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; } else { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0 ? true : false; + } + float time = (AnimationProgress) - (useAnim / 3); float timeMax = useAnim - (useAnim / 3); - if (time == (int)(timeMax * 0.4f)) + if (time >= (int)(timeMax * 0.4f) && playSwingSound) { SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.35f, 0.55f) }, Projectile.Center); + swingCount++; + playSwingSound = false; } - if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) + if ( time > (int)(timeMax * 0.5f) && time < (int)(timeMax * 0.7f)) { CanHit = true; @@ -171,21 +185,14 @@ namespace CalamityMod.Projectiles.Melee SoundStyle fire2 = new("CalamityMod/Sounds/Custom/DefenseDamage"); SoundEngine.PlaySound(fire2 with { Volume = 0.55f, Pitch = 0.4f }, Projectile.Center); - int heal = (int)(MathHelper.Clamp(5 - Projectile.numHits * 3, 1, 5)); + int heal = (int)(MathHelper.Clamp(7 - Projectile.numHits * 5, 1, 7)); if (Projectile.numHits < 5) { - Owner.statLife += heal; - Owner.HealEffect(heal); - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); } - if (target.CanBeMoved(true)) - { - // Launch - Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -15; - target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); - } + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 15, true); for (int i = 0; i < MathHelper.Clamp(6 - Projectile.numHits * 2, 2, 6); i++) { @@ -215,14 +222,17 @@ namespace CalamityMod.Projectiles.Melee float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 25; i++) { - Color auraColor = Color.Lerp(Color.Silver, Color.White, Utils.GetLerpValue(0, 5, i)) * 0.4f * fadeIn; Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/MajesticGuardGhost").Value; - Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); - rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); - Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Color auraColor = Color.Silver with { A = 0 } * 0.15f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 5 * fadeIn; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + if (swingCount > 0 && !playSwingSound) + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Silver with { A = 0 } * fadeIn * 0.4f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -55 : 55) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.9f / 4, swingCount % 2 != 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/MantisClawHoldout.cs b/Projectiles/Melee/MantisClawHoldout.cs index f73be31680..190f752a77 100644 --- a/Projectiles/Melee/MantisClawHoldout.cs +++ b/Projectiles/Melee/MantisClawHoldout.cs @@ -69,7 +69,8 @@ namespace CalamityMod.Projectiles.Melee { Owner.Calamity().mouseWorldListener = true; - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(20, 0).RotatedBy(Projectile.rotation), + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(20, 0).RotatedBy(Projectile.rotation), Owner.DirectionTo(Owner.Calamity().mouseWorld) * 30, ModContent.ProjectileType(), (int)(Projectile.damage * JetDamageMultiplier), 7, Owner.whoAmI); for (int i = 0; i < 9; i++) @@ -117,9 +118,9 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().mouseWorldListener = true; { - if (SlashTimer % SlashSpeed == 0) + if (SlashTimer % (int)(SlashSpeed / Owner.GetAttackSpeed()) == 0) { - SoundStyle SlashStyle = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe" + (Main.rand.Next(2) + 1).ToString()); + SoundStyle SlashStyle = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe", 2); SlashStyle.PitchVariance = 0.3f; SlashStyle.Volume = 0.7f; @@ -127,7 +128,9 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().mouseWorldListener = true; - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType(), Projectile.damage, 4f, Owner.whoAmI).rotation = Owner.AngleTo(Owner.Calamity().mouseWorld) + MathHelper.ToRadians(Main.rand.NextFloat(-25, 25)); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile slash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType(), Projectile.damage, 4f, Owner.whoAmI); + slash.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld) + MathHelper.ToRadians(Main.rand.NextFloat(-25, 25)); } SlashTimer++; @@ -267,6 +270,6 @@ namespace CalamityMod.Projectiles.Melee // The holdout cannot deal damage. public override bool? CanDamage() => false; - public override void OnSpawn(IEntitySource source) => Projectile.scale = 0f; + public override void WhenSpawned() => Projectile.scale = 0f; } } diff --git a/Projectiles/Melee/MantisClawJet.cs b/Projectiles/Melee/MantisClawJet.cs index d2142f8676..87821016d3 100644 --- a/Projectiles/Melee/MantisClawJet.cs +++ b/Projectiles/Melee/MantisClawJet.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 40; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -50,18 +50,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[1] = 40; } - int dir = 1; - public override void OnSpawn(IEntitySource source) { Projectile.ai[1] = 40; } - public override void ModifyDamageHitbox(ref Rectangle hitbox) - { - - } - public override void AI() { Projectile.velocity *= 0.97f; diff --git a/Projectiles/Melee/MantisClawSlash.cs b/Projectiles/Melee/MantisClawSlash.cs index db79a3a927..bdf5b9b823 100644 --- a/Projectiles/Melee/MantisClawSlash.cs +++ b/Projectiles/Melee/MantisClawSlash.cs @@ -16,6 +16,7 @@ using Terraria.DataStructures; using System.Collections.Generic; using CalamityMod.Graphics.Primitives; using Terraria.Graphics.Shaders; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -91,6 +92,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], MathHelper.TwoPi * dir, 0.15f); } + 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() { diff --git a/Projectiles/Melee/MarniteDeconstructorProj.cs b/Projectiles/Melee/MarniteDeconstructorProj.cs index 31c639c24e..1d006e1ea9 100644 --- a/Projectiles/Melee/MarniteDeconstructorProj.cs +++ b/Projectiles/Melee/MarniteDeconstructorProj.cs @@ -71,6 +71,7 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, result is clamped later Vector2 newVelocity = Owner.Calamity().mouseWorld - Owner.MountedCenter; if (Main.tile[Player.tileTargetX, Player.tileTargetY].WallType != 0) @@ -167,7 +168,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 normalizedVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero); //Draw the holdout. - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index d3f9272e13..d110a46fa3 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -73,6 +73,7 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, result is clamped later Vector2 newVelocity = Owner.Calamity().mouseWorld - Owner.MountedCenter; if (Main.tile[Player.tileTargetX, Player.tileTargetY].HasTile) @@ -179,7 +180,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 9aeed727b0..61081c70fd 100644 --- a/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs +++ b/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -13,10 +14,8 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Particles/MediumMist"; public Player Owner => Main.player[Projectile.owner]; public Color mistColor; - public int variant = -1; - public override void SetStaticDefaults() - { - } + public int variant = 0; + public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -32,20 +31,31 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { Vector2 size = Projectile.Size * Projectile.scale; - return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - size / 2f, size); } + public override void OnSpawn(IEntitySource source) + { + mistColor = Main.hslToRgb(Main.rand.NextFloat(0.5f, 0.8f), 1f, 0.8f); + variant = Main.rand.Next(3); + } + public override void AI() { - if (variant == -1) - variant = Main.rand.Next(3); - - if (Main.rand.NextBool(15)&& 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); - GeneralParticleHandler.SpawnParticle(snowflake); + if (Main.rand.NextBool()) + { + Particle snowflake = new SnowflakeSparkle(particlePosition, Vector2.Zero, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + else + { + float scale = Main.rand.NextFloat(0.5f, 1.8f); + Particle star = new CritSpark(particlePosition, Vector2.Zero, Color.White, Color.Indigo, scale, 30, 0.5f, scale * 2f); + GeneralParticleHandler.SpawnParticle(star); + } } Projectile.velocity *= 0.85f; @@ -64,11 +74,8 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.alpha >= 170) Projectile.Kill(); - - mistColor = Color.Lerp(new Color(172, 238, 255), new Color(145, 170, 188), MathHelper.Clamp((float)(Projectile.alpha - 100) / 80, 0f, 1f)) * (255 - Projectile.alpha / 255f); } - public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.EnterShaderRegion(BlendState.Additive); diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs deleted file mode 100644 index 54251e3ace..0000000000 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs +++ /dev/null @@ -1,313 +0,0 @@ -using System; -using System.IO; -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 -{ - public class ExtantAbhorrence : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence"; - private bool initialized = false; - Vector2 direction = Vector2.Zero; - public Player Owner => Main.player[Projectile.owner]; - public ref float Charge => ref Projectile.ai[0]; //Charge - public ref float State => ref Projectile.ai[1]; //State 0 is "charging", State 1 is "thrusting" - public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on. - public ref float OverCharge => ref Projectile.localAI[1]; - - const float MaxCharge = 500; - - public Vector2 lastDisplacement; - public float dashDuration; - - public override void SetDefaults() - { - Projectile.DamageType = DamageClass.Melee; - Projectile.width = Projectile.height = 70; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 16; - } - - public override bool? CanDamage() - { - return (State == 1); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float collisionPoint = 0f; - float bladeLength = 120 * Projectile.scale; - float bladeWidth = 20 * Projectile.scale; - - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); - } - - public CurveSegment QuickOut = new CurveSegment(EasingType.PolyIn, 0f, 0f, 0.2f, 3); - public CurveSegment Bump = new CurveSegment(EasingType.SineBump, 0.06f, 0.2f, 0.1f); - public CurveSegment QuickDraw = new CurveSegment(EasingType.Linear, 0.25f, 0.2f, -0.45f); - public CurveSegment SlowDrawOut = new CurveSegment(EasingType.PolyIn, 0.50f, -0.25f, -0.2f, 3); - public CurveSegment OverShoot = new CurveSegment(EasingType.SineBump, 0.93f, -0.45f, -0.1f); - - internal float ChargeDisplacement() => PiecewiseAnimation(Charge / MaxCharge, new CurveSegment[] { QuickOut, Bump, QuickDraw, SlowDrawOut, OverShoot }); - - public override void AI() - { - if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao - { - Projectile.velocity = Vector2.Zero; - SoundEngine.PlaySound(SoundID.Item101, Projectile.Center); - initialized = true; - } - - if (Owner.CantUseHoldout()) - { - if (State == 0f) - { - if (Charge / MaxCharge < 0.25f) - { - SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); - Projectile.Kill(); - return; - } - else - { - - SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center); - State = 1f; - Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death - dashDuration = Projectile.timeLeft; - lastDisplacement = Projectile.Center - Owner.Center; - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } - } - } - - if (State == 0f) - { - direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - direction.Normalize(); - Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); - - Charge++; - OverCharge--; - Projectile.timeLeft = 2; - - if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f)) - { - SoundEngine.PlaySound(DeusRitualDrama.PulseSound with { Pitch = DeusRitualDrama.PulseSound.Pitch - 0.2f + 0.1f * CurrentIndicator }, Projectile.Center); - CurrentIndicator++; - OverCharge = 20f; - } - - if (Charge >= MaxCharge) - { - Charge = MaxCharge; - if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) - { - OverCharge = 20f; - SoundEngine.PlaySound(AstralBeacon.UseSound, Projectile.Center); - CurrentIndicator++; - } - } - } - - if (State == 1f) - { - Projectile.Center = Owner.Center + Vector2.Lerp(lastDisplacement, direction * 40f, MathHelper.Clamp(((dashDuration - Projectile.timeLeft) / dashDuration) * 2f, 0f, 1f)); - Owner.fallStart = (int)(Owner.position.Y / 16f); - - Owner.Calamity().LungingDown = true; - - if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10)) - { - SlamDown(); - Projectile.timeLeft = 0; - Owner.Calamity().LungingDown = false; - Projectile.active = false; - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } - - Owner.velocity = direction * 30f; - - float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); - float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity - direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); - GeneralParticleHandler.SpawnParticle(Sparkle); - } - - Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * Charge / MaxCharge); - - //Manage position and rotation - Projectile.rotation = direction.ToRotation(); - - //Scaling based on charge - Projectile.scale = 1f + (Charge / MaxCharge * 0.3f); - - Owner.ChangeDir(Math.Sign(direction.X)); - Owner.itemRotation = direction.ToRotation(); - - if (Owner.direction != 1) - { - Owner.itemRotation -= MathHelper.Pi; - } - - Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); - Owner.itemTime = 2; - Owner.itemAnimation = 2; - } - - public void SlamDown() - { - var slamSound = SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = SoundID.DD2_MonkStaffGroundImpact.Volume * 1.5f }, Projectile.Center); - - if (Owner.whoAmI != Main.myPlayer || Owner.velocity.Y == 0f) - return; - - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 5) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 5; - - //Only create the central monolith if over half charge - if (Charge / MaxCharge < 0.5f) - return; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); - - //Only create the side monoliths if over 3/4th charge - if (Charge / MaxCharge < 0.75f) - return; - - if (SideSprouts(1, 150f, 0.8f) && Charge >= MaxCharge) - SideSprouts(1, 250f, 0.5f); - - if (SideSprouts(-1, 150f, 0.8f) && Charge >= MaxCharge) - SideSprouts(-1, 250f, 0.5f); - - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) - { - Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } - } - - if (validPositionFound) - { - Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is ExtantAbhorrenceMonolith monolith) - monolith.WaitTimer = (1 - projSize) * 34f; - } - - return validPositionFound; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // 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) - { - modifiers.SourceDamage *= 1f + TrueBiomeBlade.AstralAttunement_FullChargeBoost * (float)Math.Pow(Charge / MaxCharge, 2); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D handle = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade").Value; - Texture2D blade = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence").Value; - - float drawAngle = direction.ToRotation(); - float drawRotation = drawAngle + MathHelper.PiOver4; - - Vector2 drawOrigin = new Vector2(0f, handle.Height); - Vector2 drawOffset = Projectile.Center - Main.screenPosition; - - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - - //Turn on additive blending - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - //Just in case - if (OverCharge < 0) - OverCharge = 0f; - //When the blink is - GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(OverCharge / 20f); - GameShaders.Misc["CalamityMod:BasicTint"].UseColor(new Color(154, 244, 240)); - GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - - //Update the parameters - drawOrigin = new Vector2(0f, blade.Height); - - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - - //Back to normal - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - return false; - } - - public override void OnKill(int timeLeft) - { - //Cut the velocity short if dashing - if (State == 1f) - Owner.velocity *= 0.33f; - - Owner.Calamity().LungingDown = false; - - Projectile.active = false; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(initialized); - writer.WriteVector2(direction); - writer.Write(CurrentIndicator); - writer.WriteVector2(lastDisplacement); - writer.Write(dashDuration); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - initialized = reader.ReadBoolean(); - direction = reader.ReadVector2(); - CurrentIndicator = reader.ReadSingle(); - lastDisplacement = reader.ReadVector2(); - dashDuration = reader.ReadSingle(); - } - } -} diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.png b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.png deleted file mode 100644 index 4ec0fdebc3..0000000000 Binary files a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.png and /dev/null differ diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs deleted file mode 100644 index 1f8259d861..0000000000 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs +++ /dev/null @@ -1,78 +0,0 @@ -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 static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Projectiles.Melee -{ - public class GestureForTheDrowned : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Items/Weapons/Melee/TrueBiomeBlade"; - Vector2 direction = Vector2.Zero; - public Player Owner => Main.player[Projectile.owner]; - public float Timer => 40 - Projectile.timeLeft; - public float HalfTimer => (Timer % 20); - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 32; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 40; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - } - - public override bool? CanDamage() => false; - - public override void AI() - { - if (Math.Abs(HalfTimer / 20f) == 0.5f) - { - SoundEngine.PlaySound(SoundID.Splash with { PitchVariance = 2f }, Projectile.Center); - - if (Owner.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, direction * 0.1f + Owner.velocity, ProjectileType(), Projectile.damage, 0, Owner.whoAmI); - } - - Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.CornflowerBlue : Color.DodgerBlue, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); - GeneralParticleHandler.SpawnParticle(Sparkle); - - } - - - direction = Vector2.UnitY.RotatedBy((MathHelper.PiOver4 + Utils.AngleLerp(0f, MathHelper.PiOver4 * 1.5f, HalfTimer / 20f)) * Math.Sign(Timer - 1 - 20f)) * (float)Math.Sin(HalfTimer / 20f * MathHelper.Pi) * 30; - Owner.ChangeDir(Math.Sign(direction.X)); - Owner.itemRotation = direction.ToRotation(); - if (Owner.direction != 1) - { - Owner.itemRotation -= MathHelper.Pi; - } - - Projectile.Center = Owner.Center + direction; - Projectile.rotation = direction.ToRotation() + MathHelper.PiOver2; - Projectile.spriteDirection = Math.Sign(Timer - 20f); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D blade = Request("CalamityMod/Items/Weapons/Melee/TrueBiomeBlade").Value; - - float drawAngle = direction.ToRotation(); - float drawRotation = drawAngle + MathHelper.PiOver4; - Vector2 drawOrigin = new Vector2(0f, blade.Height); - Vector2 drawOffset = Projectile.Center - Main.screenPosition; - - Main.EntitySpriteDraw(blade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - return false; - } - - } -} diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.png b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.png deleted file mode 100644 index 0454d6961e..0000000000 Binary files a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.png and /dev/null differ diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave.png b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave.png deleted file mode 100644 index 30a5b3e99e..0000000000 Binary files a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave.png and /dev/null differ diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs deleted file mode 100644 index fee1077dee..0000000000 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs +++ /dev/null @@ -1,302 +0,0 @@ -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; - -namespace CalamityMod.Projectiles.Melee -{ - public class GestureForTheDrownedOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned"; - public Player Owner => Main.player[Projectile.owner]; - public ref float HasLanded => ref Projectile.ai[0]; //Is the orb in the air or is it on the ground? - public ref float TimeSinceLanding => ref Projectile.ai[1]; //How long has it been on the ground for - public float Timer => MaxTime - Projectile.timeLeft; - public const float MaxTime = 160f; - public float groundOffset; - public bool BounceX => Projectile.oldPosition.X == Projectile.position.X; - - public bool WaterMode = false; - - public float scaleX => 1 + 0.2f * (1f + -(float)Math.Sin((TimeSinceLanding - 10f) * 0.1f)) * 0.5f; - public float scaleY => (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); - - public override void SetStaticDefaults() - { - - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - Main.projFrames[Projectile.type] = 3; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 26; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.timeLeft = (int)MaxTime; - Projectile.DamageType = DamageClass.Melee; - Projectile.alpha = 90; - Projectile.ignoreWater = true; - Projectile.hide = true; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (WaterMode) - { - return true; - } - HasLanded = 1f; - Projectile.velocity.Y = -4f; - return false; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (TimeSinceLanding < 10 && !WaterMode) - return base.Colliding(projHitbox, targetHitbox); - float collisionPoint = 0f; - if (!WaterMode) - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Bottom, Projectile.Bottom - (Vector2.UnitY * scaleY * 110), scaleX * 40, ref collisionPoint); - - float halfLength = 66f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLength, Projectile.Center - Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLength, 40f, ref collisionPoint); - } - - public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) - { - behindNPCsAndTiles.Add(index); - } - - public override void AI() - { - if (Collision.WetCollision(Projectile.position, Projectile.width, Projectile.height)) - { - WaterMode = true; - Projectile.velocity.Y *= 0.33f; - } - else if (WaterMode) - { - Projectile.Kill(); - } - - if (WaterMode) - { - Projectile.velocity *= 1.02f; - Projectile.scale *= 1.01f; - Projectile.timeLeft--; - - for (int i = 0; i <= 4; i++) - { - 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, 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()) - { - float angle = Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2); - float distance = 10f + 50 * Math.Abs(angle) / MathHelper.PiOver2 * Projectile.scale; - Vector2 sparkSpeed = -Projectile.velocity; - Particle Spark = new CritSpark(Projectile.Center + Vector2.Normalize(Projectile.velocity.RotatedBy(angle)) * distance, sparkSpeed, Color.SkyBlue, Color.CornflowerBlue, 1f + Main.rand.NextFloat(0, 1f), 30, 0.4f, 0.6f); - GeneralParticleHandler.SpawnParticle(Spark); - } - return; - } - - if (HasLanded == 1f) - { - TimeSinceLanding++; - - groundOffset = -1; - //Check 7 tiles under the projectile for solid ground - for (float i = 0; i < 7; i += 0.5f) - { - Vector2 positionToCheck = Projectile.position; - if (Main.tile[(int)(positionToCheck.X / 16), (int)((positionToCheck.Y / 16) + 1 * i)].IsTileSolidGround() && groundOffset == -1) - { - groundOffset = i * 16; - break; - } - } - //If no ground has been found, go back to the airborne state - if (groundOffset == -1) - { - HasLanded = 0f; - TimeSinceLanding = 0f; - } - - if (TimeSinceLanding > 10) - { - //Trailing water!! Dust spam!!! - 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, 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, 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, DustID.Cloud, 2.7f * Math.Sign(Projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; - foamDust.noGravity = true; - - //Foam - float height = scaleY * 100f; - Vector2 origin = Projectile.Top + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(Projectile.width / 4f, Projectile.height / 4f) - (Vector2.UnitY * height); - 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.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); - } - } - } - - else - { - Particle foamSmall = new FakeGlowDust(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width / 2f, Projectile.height / 2f), Projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(0.2f, 2f), 25, 0.1f, gravity: (-Projectile.velocity + Vector2.UnitY) * 0.1f); - GeneralParticleHandler.SpawnParticle(foamSmall); - - if (Main.rand.NextBool()) - { - Particle blob = new WaterGlobParticle(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width / 2f, Projectile.height / 2f), Projectile.velocity / 2f, Main.rand.NextFloat(0.2f, 2f), 0.1f); - GeneralParticleHandler.SpawnParticle(blob); - } - - } - - Projectile.rotation += 0.1f * ((Projectile.velocity.X > 0) ? 1f : -1f); - - - if (Projectile.velocity.Y < 15f) - { - Projectile.velocity.Y += 0.3f; - } - - if (Math.Abs(Projectile.velocity.X) < 8) - { - Projectile.velocity.X += 0.3f * ((Projectile.velocity.X > 0) ? 1f : -1f); - } - else - { - Projectile.velocity.X = Math.Sign(Projectile.velocity.X) * 8; - } - - if (BounceX) - { - //Die lmao - Projectile.Kill(); - } - - Projectile.frameCounter++; - if (Projectile.frameCounter % 6 == 0) - Projectile.frame = (Projectile.frame + 1) % 3; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Splash with { PitchVariance = 2f }, Projectile.Center); - - for (int i = 0; i < 4; i++) - { - Particle foamLarge = new MediumMistParticle(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width, Projectile.height), Projectile.oldVelocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); - GeneralParticleHandler.SpawnParticle(foamLarge); - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (WaterMode) - modifiers.SourceDamage *= TrueBiomeBlade.MarineAttunement_InWaterDamageMultiplier; - } - - public override bool PreDraw(ref Color lightColor) - { - if (BounceX) - return false; - - if (WaterMode) - { - Texture2D wave = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave").Value; - float drawRotation = Projectile.velocity.ToRotation() + MathHelper.Pi; - Vector2 drawOrigin = new Vector2(wave.Width / 2f, wave.Height / 2f); - Vector2 drawOffset = Projectile.Center - Main.screenPosition; - - Main.EntitySpriteDraw(wave, drawOffset - Projectile.velocity, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.2f, drawRotation, drawOrigin, Projectile.scale - 0.2f, 0f, 0); - Main.EntitySpriteDraw(wave, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.5f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - return false; - } - - - if (HasLanded == 1f && TimeSinceLanding > 10f) - { - Texture2D wave = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave").Value; - Rectangle frame = new Rectangle(0, 0 + 110 * Projectile.frame, 40, 110); - - float drawRotation = 0f; - Vector2 drawOrigin = new Vector2(0f, frame.Height); - - - Vector2 drawOffset; - - //Wobble - Vector2 Scale; - - SpriteEffects flip = Projectile.velocity.X > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - for (int i = 2; i >= 0; i--) - { - drawOffset = Projectile.position + Vector2.UnitY * groundOffset + Vector2.UnitY / 2f - Main.screenPosition; - drawOffset -= Vector2.UnitX * 10f * i * Math.Sign(Projectile.velocity.X); - float ScaleYAlter = (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f + 0.2 * i)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); - Scale = new Vector2(scaleX, ScaleYAlter - 0.05f * i); - float slightfade = 1f - 0.24f * i; - Color darkenedColor = Color.Lerp(lightColor, Color.Black, i * 0.15f); - - Main.EntitySpriteDraw(wave, drawOffset, frame, darkenedColor * MathHelper.Clamp(TimeSinceLanding / 30f, 0f, 1f) * slightfade, drawRotation, drawOrigin, Scale, flip, 0); - } - - - - return false; - } - - else - { - Texture2D ball = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned").Value; - float drawRotation = Projectile.rotation; - Vector2 drawOrigin = Projectile.Size / 2f; - Vector2 drawOffset = Projectile.Center - Main.screenPosition; - - Main.EntitySpriteDraw(ball, drawOffset, null, lightColor * MathHelper.Clamp(1 - TimeSinceLanding / 10f, 0f, 1f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); - - return false; - } - - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(WaterMode); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - WaterMode = reader.ReadBoolean(); - } - - } -} diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png deleted file mode 100644 index db336bf69b..0000000000 Binary files a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png and /dev/null differ diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index 10dbf2ddde..7a7fc8cb16 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -2,6 +2,8 @@ using System.IO; 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; @@ -41,8 +43,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -72,10 +74,11 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao + if (!initialized) //Initialization. { SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); Projectile.velocity = Vector2.Zero; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); oldDirection = direction; @@ -97,8 +100,9 @@ namespace CalamityMod.Projectiles.Melee { CurrentState = 1f; SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES + //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); @@ -120,12 +124,6 @@ namespace CalamityMod.Projectiles.Melee { if (Owner.whoAmI == Main.myPlayer) { - if (hasMadeChargeSound == 0f && Empowerment / maxEmpowerment >= 0.5) - { - hasMadeChargeSound = 1f; - SoundEngine.PlaySound(SoundID.Item76); - } - float rotation = direction.ToRotation(); if (rotation > -MathHelper.PiOver2 - MathHelper.PiOver4 && rotation < -MathHelper.PiOver2 + MathHelper.PiOver4 && hasMadeSound == 1f) hasMadeSound = 0f; @@ -137,6 +135,22 @@ namespace CalamityMod.Projectiles.Melee } } + if (Empowerment / maxEmpowerment >= 0.5f && hasMadeChargeSound == 0f) + { + SoundEngine.PlaySound(DeusRitualDrama.PulseSound with { Pitch = -0.05f }, Projectile.Center); + hasMadeChargeSound++; + } + + if (Empowerment >= maxEmpowerment) + { + Empowerment = Empowerment; + if (Owner.whoAmI == Main.myPlayer && hasMadeChargeSound < 2f) + { + SoundEngine.PlaySound(AstralBeacon.UseSound, Projectile.Center); + hasMadeChargeSound++; + } + } + if (Empowerment / maxEmpowerment >= 0.75) { if (smear == null) @@ -151,7 +165,7 @@ namespace CalamityMod.Projectiles.Melee smear.Time = 0; smear.Position = Owner.Center; smear.Scale = Projectile.scale * 1.5f; - smear.Color = Color.Lerp(Color.HotPink, Color.Cyan, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); + smear.Color = Color.Lerp(Color.HotPink, Color.Purple, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); } } @@ -160,7 +174,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; oldDirection = direction; - direction = direction.RotatedBy(MathHelper.Clamp(Empowerment / maxEmpowerment, 0.4f, 1f) * MathHelper.PiOver4 * 0.20f); + direction = direction.RotatedBy(MathHelper.Clamp(Empowerment * 1.1f / maxEmpowerment, 0.45f, 1f) * MathHelper.PiOver4 * 0.20f); direction.Normalize(); Projectile.rotation = direction.ToRotation(); Projectile.Center = Owner.Center + (direction * Projectile.scale * 10); @@ -189,12 +203,25 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Spawn a monolith on max power sword throws + if (!(CurrentState == 1f && !CalamityUtils.AnyProjectiles(ProjectileType()))) + return; + + if (Empowerment >= maxEmpowerment) + { + float monolithScale = MathHelper.Clamp(target.width / 100f, 0.3f, 1.25f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 10f), ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.HolyAttunement_MonolithDamage), 10f, Owner.whoAmI, Main.rand.Next(4), monolithScale, target.whoAmI); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (CurrentState == 1f) modifiers.SourceDamage *= MathHelper.Lerp(1f, TrueBiomeBlade.HolyAttunement_ThrowDamageBoost, Empowerment / maxEmpowerment); else - modifiers.SourceDamage *= TrueBiomeBlade.HolyAttunement_BaseDamageReduction + (TrueBiomeBlade.HolyAttunement_FullChargeDamageBoost * Empowerment / maxEmpowerment); + modifiers.SourceDamage *= MathHelper.Lerp(TrueBiomeBlade.HolyAttunement_BaseSwingDamageMult, TrueBiomeBlade.HolyAttunement_FullSwingDamageMult, Empowerment / maxEmpowerment); } public override void OnKill(int timeLeft) @@ -215,7 +242,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOffset = Projectile.Center - Main.screenPosition; //Afterimages - if (CalamityConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) + if (CalamityClientConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { @@ -224,7 +251,7 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.Draw(handle, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp(Empowerment / maxEmpowerment - 0.4f / 0.1f, 0f, 1f)), afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), 0f, 0f); } - Main.spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes + Main.spriteBatch.End(); //Yippee spritebatch resetting wahoo Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); Vector2 afterimageDrawOrigin = new Vector2(0f, blade.Height); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs similarity index 52% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs rename to Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs index 6d758d21ed..d2ada56839 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; @@ -14,17 +13,15 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class MercurialTidesMonolith : ModProjectile, ILocalizedModType + public class HeavensMonolith : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith"; + public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith"; public Player Owner => Main.player[Projectile.owner]; + public NPC Target => Main.npc[(int)Projectile.ai[2]]; public float Timer => (100f - Projectile.timeLeft) / 100f; - public ref float Variant => ref Projectile.ai[0]; //Yes - public ref float Size => ref Projectile.ai[1]; //Yes - public float WaitTimer; //How long until the monoliths appears - public Vector2 OriginDirection; //The direction of the original strike - public float Facing; //The direction of the original strike + public ref float Variant => ref Projectile.ai[0]; + public ref float Scale => ref Projectile.ai[1]; public const float BaseWidth = 90f; public const float BaseHeight = 420f; @@ -33,17 +30,14 @@ namespace CalamityMod.Projectiles.Melee public CurveSegment GoNormal = new CurveSegment(EasingType.CircIn, 0.4f, 1.2f, -0.2f); public CurveSegment StayNormal = new CurveSegment(EasingType.Linear, 0.5f, 1f, 0f); - internal float Width() => PiecewiseAnimation(Timer, new CurveSegment[] { StaySmall, GoBig, GoNormal, StayNormal }) * BaseWidth * Size; + internal float Width() => PiecewiseAnimation(Timer, new CurveSegment[] { StaySmall, GoBig, GoNormal, StayNormal }) * BaseWidth; public CurveSegment Anticipate = new CurveSegment(EasingType.CircIn, 0f, 0f, 0.15f); public CurveSegment Overextend = new CurveSegment(EasingType.SineOut, 0.2f, 0.15f, 1f); public CurveSegment Unextend = new CurveSegment(EasingType.CircIn, 0.25f, 1.15f, -0.15f); public CurveSegment Hold = new CurveSegment(EasingType.ExpOut, 0.70f, 1f, -0.1f); - internal float Height() => PiecewiseAnimation(Timer, new CurveSegment[] { Anticipate, Overextend, Unextend, Hold }) * BaseHeight * Size; + internal float Height() => PiecewiseAnimation(Timer, new CurveSegment[] { Anticipate, Overextend, Unextend, Hold }) * BaseHeight; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -52,11 +46,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 102; + Projectile.scale = Scale; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; Projectile.hide = true; } - public override bool? CanDamage() => WaitTimer <= 0; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; @@ -70,37 +65,28 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.velocity != Vector2.Zero) - { - SurfaceUp(); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.velocity = Vector2.Zero; - } - - if (WaitTimer > 0) - { - Projectile.timeLeft = 102; - WaitTimer--; - } - if (Projectile.timeLeft == 100) { - if (Size >= 1) //Big monoliths create sparkles even before sprouting up - { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = Vector2.Zero; - for (int i = 0; i < 20; i++) - { - Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); - GeneralParticleHandler.SpawnParticle(Sparkle); - } - } - - if (Size * 0.8 > 0.4 && Facing != 0) + for (int i = 0; i < 20; i++) { - SideSprouts(Facing, 150f, Size * 0.8f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + GeneralParticleHandler.SpawnParticle(Sparkle); } } + // Constantly follow its target + // Die if its target is no longer active + if (!Target.active) + { + Projectile.Kill(); + return; + } + else + Projectile.Center = Target.Center; + if (Projectile.timeLeft == 80) { Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); @@ -110,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(0f, 10f); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(5f, 15f); - Particle smoke = new SmallSmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.DarkOrange, Color.MediumTurquoise, Main.rand.NextFloat()), new Color(130, 130, 130), Main.rand.NextFloat(2.8f, 3.6f) * Size, 165 - Main.rand.Next(30), 0.1f); + Particle smoke = new SmallSmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.DarkOrange, Color.MediumTurquoise, Main.rand.NextFloat()), new Color(130, 130, 130), Main.rand.NextFloat(2.8f, 3.6f), 165 - Main.rand.Next(30), 0.1f); GeneralParticleHandler.SpawnParticle(smoke); } for (int i = 0; i < 6; i++) @@ -118,104 +104,37 @@ namespace CalamityMod.Projectiles.Melee Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(10f, 30f); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4)); - Particle Rock = new StoneDebrisParticle(Projectile.Center + hitPositionDisplace * 3, flyDirection * Main.rand.NextFloat(3f, 6f), Color.Lerp(Color.DarkSlateBlue, Color.LightSlateGray, Main.rand.NextFloat()), (1f + Main.rand.NextFloat(0f, 2.4f)) * Size, 30 + Main.rand.Next(50), 0.1f); + Particle Rock = new StoneDebrisParticle(Projectile.Center + hitPositionDisplace * 3, flyDirection * Main.rand.NextFloat(3f, 6f), Color.Lerp(Color.DarkSlateBlue, Color.LightSlateGray, Main.rand.NextFloat()), (1f + Main.rand.NextFloat(0f, 2.4f)), 30 + Main.rand.Next(50), 0.1f); GeneralParticleHandler.SpawnParticle(Rock); } } } - //Go up to the "surface" so you're not stuck in the middle of the ground like a complete moron. - public void SurfaceUp() - { - for (float i = 0; i < 40; i += 0.5f) - { - Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i; - if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - { - Projectile.Center = Projectile.Center + Projectile.velocity * i; - return; - } - } - Projectile.Center = Projectile.Center + Projectile.velocity * 40f; - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) - { - Vector2 positionToCheck = Projectile.Center + OriginDirection.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } - } - - if (validPositionFound) - { - Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is MercurialTidesMonolith monolith) - { - monolith.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f; - monolith.OriginDirection = OriginDirection; - monolith.Facing = facing; - } - } - - return validPositionFound; - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_MonolithProc) - sword.OnHitProc = true; - - if (Projectile.numHits > 0) - modifiers.SourceDamage *= OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageFalloff; - } - public override bool PreDraw(ref Color lightColor) { - if (WaitTimer > 0) - return false; - - Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith").Value; - - Vector2 Shake = Projectile.timeLeft < 70 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (70 - Projectile.timeLeft / 30f) * 0.05f; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith").Value; float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); - Main.EntitySpriteDraw(tex, drawPosition + Shake, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); + Main.EntitySpriteDraw(tex, drawPosition, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); return false; } public override void PostDraw(Color lightColor) { - if (WaitTimer > 0) - return; - - Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow").Value; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith_Glow").Value; float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); @@ -223,19 +142,5 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(WaitTimer); - writer.Write(Facing); - writer.WriteVector2(OriginDirection); - - } - public override void ReceiveExtraAI(BinaryReader reader) - { - WaitTimer = reader.ReadSingle(); - Facing = reader.ReadSingle(); - OriginDirection = reader.ReadVector2(); - } } } diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.png b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.png similarity index 100% rename from Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.png rename to Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.png diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow.png b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith_Glow.png similarity index 100% rename from Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow.png rename to Projectiles/Melee/MendedBiomeBlade_HeavensMonolith_Glow.png diff --git a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs index 7fd0b3059e..cbd57293bb 100644 --- a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs +++ b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -17,8 +18,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -41,9 +42,13 @@ namespace CalamityMod.Projectiles.Melee Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity *= 0.5f; - if (target.active) + if (target.CanBeChasedBy(Projectile)) { Projectile.Center = target.Center; + + // TBB sigil marks the enemy with Armor Crunch + if (Projectile.ai[1] == 1f) + target.AddBuff(ModContent.BuffType(), 5); } else Projectile.active = false; @@ -53,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer != Projectile.owner) // don't show for other players return false; - DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs index f5e092058f..75f363454a 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs @@ -45,15 +45,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = TrueBiomeBlade.HotAttunement_LocalIFrames; } - public override bool? CanDamage() - { - return Projectile.timeLeft <= 2; //Prevent spam click abuse - } + public override bool? CanDamage() => Projectile.timeLeft <= 2; //Prevent spam click abuse public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLength = 120 * Projectile.scale; + float bladeLength = 115 * Projectile.scale; float bladeWidth = 76 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); @@ -65,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee { Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * pogoStrenght; //Bounce Owner.fallStart = (int)(Owner.position.Y / 16f); - PogoCooldown = 30; //Cooldown + PogoCooldown = 30; SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.position); Vector2 hitPosition = Owner.Center + (direction * 100 * Projectile.scale); @@ -116,6 +113,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); @@ -123,15 +121,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Owner.Center + (direction * 60); //Scaling based on shred - Projectile.localNPCHitCooldown = TrueBiomeBlade.HotAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, TrueBiomeBlade.HotAttunement_LocalIFrames - TrueBiomeBlade.HotAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency - Projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER - + Projectile.scale = 1.33f + (ShredRatio * 1f); if (Collision.SolidCollision(Owner.Center + (direction * 100 * Projectile.scale) - Vector2.One * 5f, 10, 10)) { Pogo(); - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Make the owner look like theyre holding the sword bla bla @@ -167,27 +162,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 2; } - //Since the iframes vary, adjust the damage to be consistent no matter the iframes. The true scaling happens between the BaseDamage and the FulLChargeDamage - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - float maxMultiplier = TrueBiomeBlade.HotAttunement_FullChargeDamage / (float)TrueBiomeBlade.HotAttunement_BaseDamage; - float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes - float damageReduction = Projectile.localNPCHitCooldown / (float)TrueBiomeBlade.HotAttunement_LocalIFrames; - - modifiers.SourceDamage *= damageMultiplier * damageReduction; - } - - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - float maxMultiplier = TrueBiomeBlade.HotAttunement_FullChargeDamage / (float)TrueBiomeBlade.HotAttunement_BaseDamage; - float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes - float damageReduction = Projectile.localNPCHitCooldown / (float)TrueBiomeBlade.HotAttunement_LocalIFrames; - - modifiers.SourceDamage *= damageMultiplier * damageReduction; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => ShredTarget(); public override void OnHitPlayer(Player target, Player.HurtInfo info) => ShredTarget(); @@ -195,17 +169,15 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer != Owner.whoAmI) return; - // get lifted up + // Get lifted up if (PogoCooldown <= 0) { SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); //Sizzle - Shred += 62; //Augment the shredspeed - if (Owner.velocity.Y > 0) - Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly + Shred += 62; //Augment the shred speed // 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); + Owner.GiveUniversalIFrames(TrueBiomeBlade.HotAttunement_PlayerShredIFrames); PogoCooldown = 20; } } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs index 30ed91b977..eadb3192c7 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)(30f + ShredRatio * 30f); initialized = true; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs index 17f21ef9ae..5b12d990e1 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs @@ -82,11 +82,10 @@ namespace CalamityMod.Projectiles.Melee { case 0: case 1: - bladeLength = 150 * Projectile.scale; + bladeLength = 160f * Projectile.scale; break; case 2: - bladeLength = 225f; //In awe e - bladeLength *= Projectile.scale; + bladeLength = 225f * Projectile.scale; displace = direction * ThrustDisplaceRatio() * 60f; break; @@ -124,13 +123,13 @@ namespace CalamityMod.Projectiles.Melee break; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation @@ -149,10 +148,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Owner.Center + (direction * ThrustDisplaceRatio() * 60); Projectile.frameCounter++; - if (Projectile.frameCounter % 5 == 0 && Projectile.frame + 1 < Main.projFrames[Projectile.type]) + if (Projectile.frameCounter % 5 == 0 && Projectile.frame + 1 < Main.projFrames[Type]) Projectile.frame++; - if (Main.rand.NextBool() && Owner.whoAmI == Main.myPlayer) + if (Timer % 2 == 0 && Owner.whoAmI == Main.myPlayer) { Projectile mist = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + direction * 40 + Main.rand.NextVector2Circular(30f, 30f), Vector2.Zero, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); mist.velocity = (mist.Center - Owner.Center) * 0.2f + Owner.velocity; @@ -162,13 +161,22 @@ namespace CalamityMod.Projectiles.Melee else { - if (Main.rand.NextFloat(0f, 1f) > 0.75f && Owner.whoAmI == Main.myPlayer) + if (Timer % 2 == 0 && Owner.whoAmI == Main.myPlayer) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + direction * 40, rotation.ToRotationVector2() * 5, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); Vector2 particlePosition = Owner.Center + (rotation.ToRotationVector2() * 100f * Projectile.scale); - Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); - GeneralParticleHandler.SpawnParticle(snowflake); + if (Main.rand.NextBool()) + { + Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + else + { + float scale = Main.rand.NextFloat(0.5f, 1.8f); + Particle star = new CritSpark(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, Color.Indigo, scale, 30, 0.5f, scale * 2f); + GeneralParticleHandler.SpawnParticle(star); + } } } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index 43accf8d45..1ae29e68d9 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -59,6 +59,7 @@ namespace CalamityMod.Projectiles.Melee { CanBounce = 1f; Projectile.timeLeft = (int)MaxTime; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); @@ -66,8 +67,7 @@ namespace CalamityMod.Projectiles.Melee Lunge(); SoundEngine.PlaySound(SoundID.Item103, Projectile.Center); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } if (ChargedUp && dashTimer == 0f) @@ -146,20 +146,18 @@ namespace CalamityMod.Projectiles.Melee if (ChargedUp) return; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); if (Main.myPlayer != Owner.whoAmI || CanBounce == 0f) return; if (!cannotLifesteal) //trolled { - Owner.statLife += TrueBiomeBlade.EvilAttunement_Lifesteal; - Owner.HealEffect(TrueBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck + Owner.HealPlayer(TrueBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck } // Bounce off - float bounceStrength = Math.Max((LungeSpeed / 2f), Owner.velocity.Length()); + float bounceStrength = LungeSpeed / 2f; 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; diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs index c689dd82ff..0b85545c00 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs @@ -30,10 +30,9 @@ namespace CalamityMod.Projectiles.Melee const float MaxTime = 90; const int coyoteTimeFrames = 15; //How many frames does the whip stay extended - const int MaxReach = 400; - const int MinReach = 300; + const int MaxReach = 600; + const int MinReach = 250; const float SnappingPoint = 0.55f; //When does the snap occur. - const float ReelBackStrenght = 14f; const float MaxTangleReach = 400f; //How long can tangling vines from crits be @@ -153,6 +152,7 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. create control points & shit) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, result is clamped Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach); SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); @@ -160,8 +160,7 @@ namespace CalamityMod.Projectiles.Melee controlPoint2 = Projectile.Center; Projectile.timeLeft = (int)MaxTime; initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } if (ReelingBack && HasSnapped == 0f) //Snap & also small coyote time for the hook @@ -171,10 +170,9 @@ namespace CalamityMod.Projectiles.Melee SnapCoyoteTime = coyoteTimeFrames; } - if (SnapCoyoteTime > 0) //keep checking for the tile hook + if (SnapCoyoteTime > 0) { Lighting.AddLight(Projectile.Center, 0.8f, 1f, 0.35f); - HookToTile(); SnapCoyoteTime--; } @@ -189,19 +187,6 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = MathHelper.WrapAngle(Owner.AngleTo(Owner.Calamity().mouseWorld) - (Owner.direction < 0 ? MathHelper.Pi : 0)); } - public void HookToTile() - { - if (Main.myPlayer == Owner.whoAmI) - { - //Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground) - if (Collision.SolidCollision(Projectile.position, 32, 32) && (Owner.velocity.Y != 0 || Projectile.position.Y < Owner.position.Y)) - { - Owner.velocity = Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero) * ReelBackStrenght; - SnapCoyoteTime = 0f; - } - SoundEngine.PlaySound(SoundID.Item65, Projectile.position); - } - } internal static float EaseInFunction(float progress) => progress == 0 ? 0f : (float)Math.Pow(2, 10 * progress - 10); //Potion seller i need your strongest easeIns diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs new file mode 100644 index 0000000000..644d52dd2e --- /dev/null +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -0,0 +1,293 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +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; + +namespace CalamityMod.Projectiles.Melee +{ + public class TruePureClarity : BaseCustomUseStyleProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override int AssignedItemID => ModContent.ItemType(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/TrueBiomeBlade"; + + public override float HitboxOutset => 65f; + public override Vector2 HitboxSize => new Vector2(100, 100); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override Vector2 SpriteOrigin => new(-2, 70); + + public ref float State => ref Projectile.ai[0]; // 0 - Swinging. 1 - Thrusting. + public ref float SwingDir => ref Projectile.ai[1]; + public Vector2 mousePos; + public Vector2 aimPos; + public bool doSwing = true; + public bool postSwing = false; + public int useAnimation; + public static readonly SoundStyle FullChargeSound = new("CalamityMod/Sounds/Item/MagicRockSound"); + + public Color outlineColorGreen => (Main.player[Projectile.owner].HeldItem.ModItem as TrueBiomeBlade).mainAttunement.tooltipColor; + public Color outlineColorBlue => new Color(110, 216, 255); + public const int dashTime = 30; + public float dashRotation; + public Vector2 lastDisplacement; + public Vector2 dashDirection = Vector2.Zero; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.scale = 1.25f; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void WhenSpawned() + { + SwingDir = 1f; + mousePos = Owner.Calamity().mouseWorld; + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnimation = Owner.itemAnimationMax; + + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + // If the player stops using the weapon after hitting with it three times, switch to lunge. + if (Owner.CantUseHoldout()) + { + if (State == 0f && Projectile.numHits > 2) + { + State = 1f; + SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center); + + AnimationProgress = 0; + Projectile.rotation = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX).ToRotation(); + Projectile.timeLeft = dashTime; + lastDisplacement = Projectile.Center - Owner.Center; + Projectile.ForceNetUpdate(); + } + } + + // Normal swing behavior. + if (State == 0f) + { + dashDirection = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero).SafeNormalize(Vector2.UnitX); + + if (CanHit || postSwing) + mousePos = Owner.Center - aimPos; + else + mousePos = Owner.Calamity().mouseWorld; + + // Reset before a new swing. + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + mousePos = Owner.Calamity().mouseWorld; + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + } + else + { + if (!CanHit && !postSwing) + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + else + Owner.direction = ((Owner.Center - aimPos).X < Owner.Center.X) ? -1 : 1; + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + + if (AnimationProgress < (useAnimation / 3)) + { + // Swing wind-up. Should not deal damage. + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + SwingDir = -SwingDir; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * SwingDir * Owner.direction), 0.2f); + } + else + { + float swingTime = AnimationProgress - (useAnimation / 3); + float swingTimeMax = useAnimation - (useAnimation / 3); + + if (swingTime > (int)(swingTimeMax * 0.2f) && swingTime < (int)(swingTimeMax * 0.85f)) + { + CanHit = true; + + // Particle effects on swing. + Vector2 particleVel = new Vector2(0, 10 * -SwingDir * Owner.direction).RotatedBy(FinalRotation - MathHelper.PiOver4); + Vector2 particlePos = Owner.Center + new Vector2(Main.rand.Next(0, 80), 0).RotatedBy(FinalRotation - MathHelper.PiOver4); + Color particleColor = Main.rand.NextBool() ? outlineColorBlue : outlineColorGreen; + bool empowered = Projectile.numHits > 2; + if (Main.rand.NextBool()) + { + GenericBloom bloom = new(particlePos, particleVel, particleColor, empowered ? 0.12f : 0.08f, 20); + GeneralParticleHandler.SpawnParticle(bloom); + } + else + { + GenericSparkle sparkle = new(particlePos, particleVel, particleColor, particleColor, empowered ? 0.78f : 0.55f, 20); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + else + CanHit = false; + + // Fire projectiles. + if (swingTime == (int)(swingTimeMax * 0.4f)) + { + SoundEngine.PlaySound(SoundID.Item43 with { Volume = 0.65f }, Projectile.Center); + Vector2 projVel = -aimPos.SafeNormalize(Vector2.UnitX) * 12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, projVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI); + } + + RotationOffset = MathHelper.Lerp(RotationOffset, + MathHelper.ToRadians(MathHelper.Lerp(150f * SwingDir * Owner.direction, 120f * -SwingDir * Owner.direction, CalamityUtils.ExpInOutEasing(swingTime / swingTimeMax, 1))), + 0.2f); + + // Extra swing control. + if (swingTime >= swingTimeMax) + doSwing = false; + if (swingTime < (int)(swingTimeMax * 0.7f)) + postSwing = true; + } + } + + // Make the player's arms rotate. + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + else + { + // These are set to ensure the lunge looks and works properly. + CanHit = true; + Owner.direction = Owner.velocity.X > 0f ? 1 : -1; + FlipAsSword = Owner.direction == -1 ? true : false; + RotationOffset = MathHelper.PiOver4 * Owner.direction; + Owner.itemAnimation = 2; + Owner.fallStart = (int)(Owner.position.Y / 16f); + Owner.Calamity().LungingDown = true; + + // Fancy particle dash effects. + Vector2 waterVel = Owner.velocity.RotatedBy(MathHelper.PiOver2 * (Main.rand.NextBool() ? 1 : -1)).RotatedByRandom(MathHelper.Pi / 16f).SafeNormalize(Vector2.UnitX) * 5f; + WaterFoamParticle water = new(Owner.Center, waterVel, 20, 0.45f, outlineColorBlue); + GeneralParticleHandler.SpawnParticle(water); + + // Immediately cancel if the lunge hits a tile. + Vector2 collisionCheckPos = Owner.Center + (dashDirection * 120 * Projectile.scale) - Vector2.One * 5f; + if (Collision.SolidCollision(collisionCheckPos, 10, 10)) + { + Projectile.timeLeft = 0; + Owner.itemAnimation = 0; + Owner.Calamity().LungingDown = false; + Projectile.active = false; + Projectile.ForceNetUpdate(); + } + + Owner.velocity = dashDirection * 30f; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Burst of particles to signify that the lunge is ready. + // Due to how numHits works, this has to be 1 less than our target. + if (Projectile.numHits == 2) + { + SoundEngine.PlaySound(FullChargeSound, Owner.Center); + + for (int i = 0; i < 10; i++) + { + Vector2 particleVel = Vector2.UnitX.RotatedBy(MathHelper.TwoPi * (i / 10f)) * Main.rand.NextFloat(3.5f, 4f); + MediumMistParticle readySmoke = new(Owner.Center, particleVel, outlineColorGreen, Color.Brown, 1f, 192f); + GeneralParticleHandler.SpawnParticle(readySmoke); + } + } + + if (State == 1f) + { + // Biome Blade's Pure Clarity 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.DefaultAttunement_LungeIFrames); + + foreach (Projectile proj in Main.projectile) + { + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Owner.whoAmI) + { + // Reset the time left on the sigil and set the new target. + proj.ai[0] = target.whoAmI; + proj.timeLeft = TrueBiomeBlade.DefaultAttunement_SigilTime; + return; + } + } + // If no sigil exists, spawn one. + var source = Owner.GetSource_ItemUse(Owner.HeldItem); + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Owner.whoAmI, target.whoAmI); + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (State == 1f) + modifiers.SourceDamage *= TrueBiomeBlade.DefaultAttunement_LungeDamageMult; + } + + public override void OnKill(int timeLeft) + { + // Cut the velocity short if dashing. + if (State == 1f) + Owner.velocity *= 0.33f; + + Owner.itemAnimation = 0; + Owner.Calamity().LungingDown = false; + + Projectile.active = false; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Owner.itemAnimation > 0) + { + Texture2D tex = ModContent.Request(Texture).Value; + float r = FlipAsSword ? (State == 1f ? MathHelper.Pi : MathHelper.PiOver2) : 0f; + + // Draw extra outline sprites if you've hit once, to signify that you can lunge. + if (Projectile.numHits > 0) + { + for (int i = 0; i < 5; i++) + { + Color outlineColor = Color.Lerp(outlineColorGreen, outlineColorBlue, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.5f)) * MathHelper.Clamp(Projectile.numHits / 3f, 0f, 1f); + Texture2D outline = ModContent.Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost").Value; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3.25f, 6f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); + Main.EntitySpriteDraw(outline, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), null, outlineColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + } + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + return false; + } + + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost.png b/Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost.png new file mode 100644 index 0000000000..e30e2c1b14 Binary files /dev/null and b/Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost.png differ diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs index 1545f4d734..56f513e75c 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs @@ -10,7 +10,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class TruePurityProjection : ModProjectile, ILocalizedModType //The boring plain one. With cool homing now + public class TruePurityProjection : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public NPC target; @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -74,13 +74,12 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TrueBiomeBlade.DefaultAttunement_BeamTime - 5f) return false; - DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int i = 0; i <= 15; i++) { Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; @@ -90,10 +89,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int debuffTime = 90; - target.AddBuff(BuffType(), debuffTime); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffType(), 90); } } diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 5b768e9693..bcf7c10932 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 295) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MonstrousKnife.cs b/Projectiles/Melee/MonstrousKnife.cs index 729f668ea6..41b96a3f76 100644 --- a/Projectiles/Melee/MonstrousKnife.cs +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; 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 b709078298..a6dd1f7b10 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/MourningstarFlail.cs b/Projectiles/Melee/MourningstarFlail.cs index f19edc709f..147a4d209c 100644 --- a/Projectiles/Melee/MourningstarFlail.cs +++ b/Projectiles/Melee/MourningstarFlail.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,22 +20,21 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; + Projectile.localNPCHitCooldown = 7; Projectile.extraUpdates = 1; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Daybreak, 180); - // Note: This is being left as the solar explosion projectile for now, since the weapon is in a good balancing position right now. - // If it is to be rebalanced, consider replacing it with the FuckYou projectile (which does not mess with I-frames) if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ProjectileID.SolarWhipSwordExplosion, Projectile.damage, hit.Knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 4; + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, hit.Knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].usesLocalNPCImmunity = false; + Main.projectile[proj].usesIDStaticNPCImmunity = true; + Main.projectile[proj].idStaticNPCHitCooldown = 60; } - Projectile.localAI[1] = 4f; + Projectile.localAI[1] = 16f; } } } diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index c6b615e264..8cf521594d 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee public int time = 0; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 14; + Main.projFrames[Type] = 14; } public bool Slashing = false; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.frameCounter <= 1) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; @@ -158,6 +158,7 @@ namespace CalamityMod.Projectiles.Melee { speed = player.ActiveItem().shootSpeed * Projectile.scale; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; // Sync if a velocity component changes. diff --git a/Projectiles/Melee/NeptunesBountyProjectile.cs b/Projectiles/Melee/NeptunesBountyProjectile.cs index 726be61311..5c9268ace4 100644 --- a/Projectiles/Melee/NeptunesBountyProjectile.cs +++ b/Projectiles/Melee/NeptunesBountyProjectile.cs @@ -5,11 +5,13 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using static System.Net.Mime.MediaTypeNames; using static CalamityMod.CalamityUtils; namespace CalamityMod.Projectiles.Melee @@ -38,8 +40,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -112,7 +114,8 @@ namespace CalamityMod.Projectiles.Melee { Projectile.netUpdate = true; SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); - Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.Center = Owner.MountedCenter + (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 12; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 28; startDamage = Projectile.damage; Projectile.spriteDirection = Projectile.direction; @@ -142,20 +145,19 @@ namespace CalamityMod.Projectiles.Melee Time = 0; bool foundTarget = false; - for (int i = 0; i < Main.maxNPCs; i++) + NPC target = Owner.ClampedMouseWorld().ClosestNPCAt(1000); + if (target != null) { - 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; + NPCDestination = target.Center + target.velocity * 5f; + foundTarget = true; } + else + foundTarget = false; if (!foundTarget) { - Projectile.velocity = (-Projectile.velocity).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; } else { @@ -165,6 +167,7 @@ namespace CalamityMod.Projectiles.Melee SpinSound?.Stop(); spinMode2 = true; + Projectile.numHits = 0; } if (spinMode) @@ -177,19 +180,12 @@ namespace CalamityMod.Projectiles.Melee 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); + Particle spark = new CustomSpark(linePos, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2().RotatedByRandom(0.4f) * Main.rand.NextFloat(5f, 22f), "CalamityMod/Particles/WaterFoam", false, Main.rand.Next(7, 16), Main.rand.NextFloat(0.4f, 0.7f), Color.DodgerBlue * 0.45f, new Vector2(1f, 1f), true, false, Main.rand.NextFloat(-10, 10)); GeneralParticleHandler.SpawnParticle(spark); } } @@ -221,6 +217,13 @@ namespace CalamityMod.Projectiles.Melee } Projectile.NewProjectile(Projectile.GetSource_FromThis(), location, velocity, ModContent.ProjectileType(), startDamage / 6, Projectile.knockBack / 4, Projectile.owner); + for (int i = 0; i < 6; i++) + { + Dust dust = Dust.NewDustPerfect(location, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.5f, 1.8f); + dust.velocity = velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.1f, 0.5f); + } } } @@ -229,47 +232,39 @@ namespace CalamityMod.Projectiles.Melee 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); + Particle spark = new CustomSpark(linePos, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2().RotatedByRandom(0.25f) * Main.rand.NextFloat(5f, 22f) - Projectile.velocity * 2f, "CalamityMod/Particles/SmallBloom", false, Main.rand.Next(10, 13), Main.rand.NextFloat(0.2f, 0.55f), Color.DodgerBlue * 0.3f, new Vector2(1f, 1f), true, false, Main.rand.NextFloat(-10, 10)); GeneralParticleHandler.SpawnParticle(spark); } + if (Main.rand.NextBool(3)) + { + Particle spark2 = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(60, 60), -Projectile.velocity * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/Sparkle", false, Main.rand.Next(24, 36), Main.rand.NextFloat(1.7f, 1.85f), Color.DodgerBlue, new Vector2(0.4f, 1f)); + GeneralParticleHandler.SpawnParticle(spark2); + } } } Projectile.spriteDirection = Projectile.direction; - Projectile.rotation += (0.9f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f)) * Projectile.direction; + Projectile.rotation += (0.6f * (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); + target.AddBuff(ModContent.BuffType(), 300); - SoundStyle HitSound = new("CalamityMod/Sounds/Item/SarosDiskThrow", 3) { Volume = 0.55f, Pitch = -0.8f }; - if (spinMode2) + if (spinMode2 && Projectile.numHits == 0) { - 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); - } + Particle spark768 = new GlowSparkParticle(target.Center, -Projectile.velocity * 0.05f, false, 15, 0.13f, Color.DodgerBlue, new Vector2(1.5f, 1), true, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark768); + Particle spark763 = new GlowSparkParticle(target.Center, -Projectile.velocity * 0.05f, false, 15, 0.1f, Color.Aqua, new Vector2(1.5f, 1), true, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark763); + 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)); @@ -277,8 +272,10 @@ namespace CalamityMod.Projectiles.Melee 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); + SoundStyle HitSound2 = new("CalamityMod/Sounds/Item/HellkiteSmallHit", 3) { Volume = 0.45f, Pitch = 0.2f }; + + SoundEngine.PlaySound(HitSound2, Projectile.Center); + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.65f, Pitch = -0.3f }, Projectile.Center); } } @@ -301,7 +298,15 @@ namespace CalamityMod.Projectiles.Melee { if (spinMode2) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Aqua * 0.6f, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Aqua with { A = 0 } * 0.6f, 1); + } + Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey"); + Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + if (spinMode) + { + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, (spinMode2 ? Color.Aqua : Color.DeepSkyBlue) with { A = 0 } * 0.55f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, (spinMode2 ? 1.6f : 1.4f) * Main.rand.NextFloat(0.8f, 1.15f), SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, (spinMode2 ? Color.Aqua : Color.DeepSkyBlue) with { A = 0 } * 0.75f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, spinMode2 ? 1.4f : 1.2f, SpriteEffects.None); } return true; } diff --git a/Projectiles/Melee/NeptunesBountySplitProjectile.cs b/Projectiles/Melee/NeptunesBountySplitProjectile.cs index 38ca92cfbe..439bf42e1c 100644 --- a/Projectiles/Melee/NeptunesBountySplitProjectile.cs +++ b/Projectiles/Melee/NeptunesBountySplitProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; using CalamityMod.Projectiles.Healing; @@ -18,11 +19,13 @@ namespace CalamityMod.Projectiles.Melee public int Time = 0; public int randTimer; - public int dustType1 = 80; - public int dustType2 = 172; + public int dustType1 = 278; + public int dustType2 = 267; public int spreadDust = 0; public Color WaterColor = Main.rand.NextBool() ? Color.DodgerBlue : Color.DeepSkyBlue; public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; @@ -47,24 +50,26 @@ namespace CalamityMod.Projectiles.Melee 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); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.1f, 0.5f), "CalamityMod/Particles/WaterFoam", false, Main.rand.Next(4, 7), Main.rand.NextFloat(0.15f, 0.2f), Color.DodgerBlue * 0.75f, new Vector2(1f, 1f), true, false, Main.rand.NextFloat(-10, 10)); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3 + spreadDust, 3 + spreadDust), !Main.rand.NextBool(5) ? dustType1 : dustType2, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.35f), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = !Main.rand.NextBool(5) ? WaterColor : Color.Aqua; + if (dust.type == dustType1) + dust.scale *= 0.7f; } - - 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); + WaterFlavoredParticle spark = new WaterFlavoredParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 25, 0.85f + Time * 0.013f, WaterColor * 0.15f); 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); + Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/WaterFlavored", false, 2, 0.85f + Time * 0.013f, WaterColor * (1f - Time * 0.01f), new Vector2(0.2f + Time * 0.01f, 1), true); GeneralParticleHandler.SpawnParticle(spark); } if (Projectile.timeLeft < 20) @@ -76,9 +81,7 @@ namespace CalamityMod.Projectiles.Melee 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); + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs deleted file mode 100644 index 5be1f636f3..0000000000 --- a/Projectiles/Melee/Oathblade.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Oathblade : 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 = 58; - Projectile.height = 58; - Projectile.aiStyle = ProjAIStyleID.Sickle; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = true; - Projectile.penetrate = 1; - AIType = ProjectileID.DemonScythe; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.35f); - - if (Main.rand.NextBool(3)) - 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) - { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.ShadowFlame, 90); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - } -} diff --git a/Projectiles/Melee/Oathblade.png b/Projectiles/Melee/Oathblade.png deleted file mode 100644 index 2fc599ea4b..0000000000 Binary files a/Projectiles/Melee/Oathblade.png and /dev/null differ diff --git a/Projectiles/Melee/OathswordFlame.cs b/Projectiles/Melee/OathswordFlame.cs deleted file mode 100644 index edbcd60800..0000000000 --- a/Projectiles/Melee/OathswordFlame.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OathswordFlame : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = true; - Projectile.timeLeft = 240; - Projectile.Opacity = 0f; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.08f, 0f, 1f); - CalamityUtils.HomeInOnNPC(Projectile, false, 700f, 15f, 10f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, Projectile.alpha) * Projectile.Opacity; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire, 180); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - - Projectile.ExpandHitboxBy(100); - for (int k = 0; k < 10; k++) - 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/OathswordFlame.png b/Projectiles/Melee/OathswordFlame.png deleted file mode 100644 index 53c0486b31..0000000000 Binary files a/Projectiles/Melee/OathswordFlame.png and /dev/null differ diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs new file mode 100644 index 0000000000..d2b6619595 --- /dev/null +++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs @@ -0,0 +1,263 @@ +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +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.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class OldLordClaymoreHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/OldLordClaymore"; + public float hitboxMult = 1.3f; + public override float HitboxOutset => 60; + + public override Vector2 HitboxSize => new Vector2(105, 105) * hitboxMult; + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(-3, 70); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public bool finalFlip = false; + public bool playSwingSound = true; + public bool swooshFade = false; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void WhenSpawned() + { + CanHit = false; + Projectile.knockBack = 0; + Projectile.scale = 1.15f; // Needs to be slightly bigger for viablility + Projectile.ai[1] = -1; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + AnimationProgress = Animation % useAnim; + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit && !swooshFade) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.5f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.35f); + + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + swingCount++; + finalFlip = false; + playSwingSound = true; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); + + if (AnimationProgress < (useAnim / 1.5f)) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.7f, useAnim, Animation, true)) * 0.35f)), 0.2f); + } + else + { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0 ? true : false; + } + + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time >= (int)(timeMax * 0.4f) && playSwingSound) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); + SoundEngine.PlaySound(swing with { Volume = 0.85f, Pitch = Main.rand.NextFloat(-0.4f, -0.5f) }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/HeavySwing"); + SoundEngine.PlaySound(swing2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, Projectile.Center); + playSwingSound = false; + } + if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.8f)) + CanHit = true; + else + CanHit = false; + if (time > (int)(timeMax * 0.7f)) + swooshFade = true; + else + swooshFade = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.7f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Orange :Color.OrangeRed; + } + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), dustVel, false, 23, Main.rand.NextFloat(0.4f, 0.8f), Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed)); + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + target.AddBuff(BuffID.OnFire3, 180); + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + CalamityUtils.MoveNPC(target, launchVel, 12, true); + + int dustNum = (int)MathHelper.Clamp(12 - Projectile.numHits * 3, 3, 12); + for (int i = 0; i < dustNum; i++) + { + float variance = Main.rand.NextFloat(-0.5f, 0.5f); + int dustStyle = 278; + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle, Projectile.velocity); + dust2.scale = Main.rand.NextFloat(1.2f, 1.4f) - Math.Abs(variance); + dust2.velocity = (launchVel * 25).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Orange : Color.OrangeRed; + } + + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.type == ModContent.ProjectileType() && projectile.ai[2] == target.whoAmI && projectile.localAI[0] != 5) + { + projectile.owner = Owner.whoAmI; + projectile.localAI[0] = 5; + projectile.velocity = (Vector2.Lerp(projectile.velocity, launchVel * 14, 0.7f) * 1.2f).RotatedByRandom(0.1f); + } + } + + if (Projectile.numHits == 0) + { + Owner.Calamity().GeneralScreenShakePower = 5f; + + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordStrongImpact"); + SoundEngine.PlaySound(swing with { Volume = 0.95f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + + for (int i = 0; i < 20; i++) + { + Color auraColor = Color.OrangeRed with { A = 0 } * 0.18f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 4 * fadeIn; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + //Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Orange with { A = 0 } * (float)Math.Pow(fadeIn, 20) * 0.2f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(-Projectile.ai[1] * 95 * fadeIn) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.33f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.OrangeRed with { A = 0 } * fadeIn * 0.5f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.25f * hitboxMult, SpriteEffects.None); + + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/OldLordClaymoreProj.cs b/Projectiles/Melee/OldLordClaymoreProj.cs deleted file mode 100644 index e28a4fe8d1..0000000000 --- a/Projectiles/Melee/OldLordClaymoreProj.cs +++ /dev/null @@ -1,335 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OldLordClaymoreProj : BaseIdleHoldoutProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public enum SwingState - { - Default, - Swinging, - Channeling, - Spinning - } - - public int Direction = 1; - public SwingState CurrentState; - public ref float ChargeTime => ref Projectile.ai[0]; - public ref float GeneralTime => ref Projectile.ai[1]; - public ref float PostSwingRepositionDelay => ref Projectile.localAI[0]; - public ref bool RMBChannel => ref (Owner.HeldItem.ModItem as OldLordClaymore).RMBchannel; - public bool LMBUse => Owner.altFunctionUse != 2 && !RMBChannel && Owner.itemAnimation > 0; - public ref float ChargePower => ref Projectile.localAI[1]; - - public const int MaxChargeTime = 90; - public override string Texture => "CalamityMod/Items/Weapons/Melee/OldLordClaymore"; - public override int AssociatedItemID => ModContent.ItemType(); - public override int IntendedProjectileType => ModContent.ProjectileType(); - public override bool? CanDamage() => (CurrentState == SwingState.Default || CurrentState == SwingState.Channeling) ? false : base.CanDamage(); - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 70; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 90000; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; - Projectile.noEnchantmentVisuals = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Direction); - writer.Write(PostSwingRepositionDelay); - writer.Write(ChargePower); - writer.Write((int)CurrentState); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Direction = reader.ReadInt32(); - PostSwingRepositionDelay = reader.ReadSingle(); - ChargePower = reader.ReadSingle(); - CurrentState = (SwingState)reader.ReadInt32(); - } - - public override void SafeAI() - { - // Handle right click behaviors. - if (Main.myPlayer == Projectile.owner) - Owner.Calamity().rightClickListener = true; - - if (!Owner.Calamity().mouseRight) - RMBChannel = false; - else - RMBChannel = true; - - // Initialize the animation max time if necessary. - if (Owner.itemAnimationMax == 0) - Owner.itemAnimationMax = (int)(Owner.ActiveItem().useAnimation * Owner.GetAttackSpeed()); - - // Decide the current phase state of the blade. - DecideCurrentState(); - - // Glue the sword to its owner. - Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size / 2f; - - // Use the direction of the owner when not spinning. - if (CurrentState != SwingState.Spinning) - Direction = Owner.direction; - - float swingCompletion = Owner.itemAnimation / (float)Owner.itemAnimationMax; - float swingSpeedInterpolant = Utils.GetLerpValue(1f, 0.8f, swingCompletion, true) * Utils.GetLerpValue(-0.11f, 0.12f, swingCompletion, true); - float swingInterpolant = (float)Math.Sin(Math.Pow(swingCompletion, 1.15) * MathHelper.TwoPi); - if (swingInterpolant < 0f) - { - swingInterpolant = -(float)Math.Pow(-swingInterpolant, 0.9); - swingInterpolant = MathHelper.Lerp(swingInterpolant, -1f, 0.7f); - } - else - { - swingInterpolant = (float)Math.Pow(swingInterpolant, 0.9); - swingInterpolant = MathHelper.Lerp(swingInterpolant, 1f, 0.7f); - } - - float baseRotation = swingInterpolant * Direction * 0.96f; - - // Reset the owner's rotation. - Owner.fullRotation = 0f; - - // Do a spin dash if a swing is done with full power. - if (CurrentState == SwingState.Spinning) - { - swingSpeedInterpolant = 1f; - baseRotation = MathHelper.WrapAngle(swingCompletion * Direction * MathHelper.Pi * -3f); - Owner.fullRotation = baseRotation; - Owner.fullRotationOrigin = Owner.Center - Owner.position; - - // Emit fire dust. - for (int i = 0; i < 4; i++) - { - Vector2 dustSpawnPosition = Projectile.Center + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Main.rand.NextFloat(Projectile.width) + Main.rand.NextVector2Circular(6f, 6f); - Vector2 dustVelocity = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Main.rand.NextFloat(6f) + Main.rand.NextVector2Circular(2.4f, 2.4f); - - Dust fire = Dust.NewDustPerfect(dustSpawnPosition, 6, dustVelocity); - fire.scale = 1.7f; - fire.noGravity = true; - } - - // Release flames. - if (Main.myPlayer == Projectile.owner && GeneralTime % 6f == 5f) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2CircularEdge(8f, 8f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); - - if (Main.myPlayer == Projectile.owner) - { - Owner.velocity = Vector2.Lerp(Owner.velocity, Owner.SafeDirectionTo(Main.MouseWorld) * 16f, 0.125f); - NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, Main.myPlayer); - } - - // Stop charging once the item animation has completed. - if (Owner.itemAnimation <= 1) - { - ChargePower = 0f; - CurrentState = 0f; - } - } - - // Hold the blade upwards if not firing. - if (CurrentState == SwingState.Default) - { - Projectile.Opacity = 0f; - - if (PostSwingRepositionDelay > 0f) - PostSwingRepositionDelay--; - else - baseRotation = (MathHelper.PiOver2 + 0.36f) * -Direction; - - // Disable afterimages. - Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; - } - else - { - PostSwingRepositionDelay = PostSwingRepositionDelay == -1f ? 0f : 12f; - - // See the Bladecrest Oathsword Projectile code. - Projectile.Opacity = 1f; - } - - // Raise the blade and do charge effects upwards if channeling. - float horizontalBladeOffset = -4f; - float chargeInterpolant = Utils.GetLerpValue(0f, 65f, ChargeTime, true); - if (CurrentState == SwingState.Channeling) - { - baseRotation = MathHelper.PiOver2 * -Direction; - horizontalBladeOffset = MathHelper.Lerp(horizontalBladeOffset, 6f, (float)Math.Pow(chargeInterpolant, 0.3)); - if (Owner.itemAnimation < 2) - Owner.itemAnimation = 2; - PostSwingRepositionDelay = -1f; - - ChargePower = MathHelper.Clamp(ChargePower + 1f, 0f, MaxChargeTime); - - // Disable afterimages. - Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; - - ChargeTime++; - } - else - ChargeTime = 0f; - - float idealRotation = baseRotation; - Owner.itemRotation = idealRotation; - - idealRotation += MathHelper.PiOver4; - if (Direction == -1) - idealRotation += MathHelper.Pi; - - // Define rotation. - Projectile.rotation = Projectile.rotation.AngleTowards(idealRotation, swingSpeedInterpolant * 0.45f).AngleLerp(idealRotation, swingSpeedInterpolant * 0.2f); - - // Decide how far out the blade should go. - float bladeOffsetFactor = 0.5f + chargeInterpolant * 0.3f; - if (chargeInterpolant <= 0f) - bladeOffsetFactor += Utils.GetLerpValue(0.5f, 0.7f, swingCompletion, true) * Utils.GetLerpValue(1f, 0.7f, swingCompletion, true) * 0.45f; - - // Offset the blade so that the handle is attached to the owner's hand. - Vector2 bladeOffset = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.width * bladeOffsetFactor; - if (Owner.itemAnimation <= 0 || chargeInterpolant > 0f) - bladeOffset += new Vector2(Direction * horizontalBladeOffset, 8f).RotatedBy(Owner.fullRotation) * (1f - PostSwingRepositionDelay / 12f); - Projectile.position += bladeOffset; - - // Create charge dust. - if (CurrentState == SwingState.Channeling) - { - int chargeDustCount = (int)Math.Round(MathHelper.Lerp(1f, 3f, ChargePower / MaxChargeTime)); - if (ChargePower >= MaxChargeTime) - chargeDustCount = 0; - - for (int i = 0; i < chargeDustCount; i++) - { - Vector2 dustSpawnPosition = Projectile.Center + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Main.rand.NextFloat(Projectile.width) + Main.rand.NextVector2Circular(6f, 6f); - Vector2 dustVelocity = bladeOffset.SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(6f) + Main.rand.NextVector2Circular(2.4f, 2.4f); - - Dust dust = Dust.NewDustPerfect(dustSpawnPosition, 267, dustVelocity); - dust.color = Main.rand.NextBool(4) ? Color.Purple : Color.Red; - dust.scale = Main.rand.NextFloat(0.85f, 1.2f); - dust.noGravity = true; - } - - // Create a burst of charge dust before becoming fully charged. - if (ChargePower == MaxChargeTime - 1f) - { - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - for (int i = 0; i < 30; i++) - { - Vector2 dustSpawnPosition = Projectile.Center; - Vector2 dustVelocity = (MathHelper.TwoPi * i / 30f).ToRotationVector2() * 5f; - Dust dust = Dust.NewDustPerfect(dustSpawnPosition, 267, dustVelocity); - dust.color = Color.Violet; - dust.scale = 1.4f; - dust.noGravity = true; - } - } - } - - GeneralTime++; - } - - public void DecideCurrentState() - { - // Reset the state of the weapon if the player stops using it. This cannot reset a dash. - if ((Owner.itemAnimation <= 0 || (!RMBChannel && CurrentState == SwingState.Channeling)) && CurrentState != SwingState.Spinning) - { - Owner.itemAnimation = 0; - CurrentState = SwingState.Default; - } - - // Switch to the swing state as necessary. This cannot happen while channeling or spinning. - if (CurrentState == 0f && !RMBChannel && Owner.itemAnimation > 0 && ChargePower < MaxChargeTime) - CurrentState = SwingState.Swinging; - - // Switch to the channel state as necessary. This cannot happen while swinging or spinning. - if ((CurrentState == SwingState.Default || CurrentState == SwingState.Swinging) && RMBChannel) - CurrentState = SwingState.Channeling; - - // Switch to the spinning charge state. This can only be done while in the default state. - if (CurrentState == 0f && Owner.itemAnimation > 0 && ChargePower >= MaxChargeTime) - { - Owner.fallStart = (int)(Owner.position.Y / 16f); - - if (CurrentState != SwingState.Spinning) - { - SoundEngine.PlaySound(SoundID.DD2_BookStaffCast, Owner.Center); - CurrentState = SwingState.Spinning; - Projectile.netUpdate = true; - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.Opacity <= 0f) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, 2, lightColor); - - Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(0.95f, 0.85f, 0.5f)); - GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(0f); - if (ChargePower >= MaxChargeTime) - GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(0.7f - ((Main.GlobalTimeWrappedHourly * (int)(MaxChargeTime * 0.5f)) % (MaxChargeTime * 0.5f) / MaxChargeTime)); - GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - - var texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordClaymore").Value; - - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, Projectile.Size / 2f, Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - Main.spriteBatch.ExitShaderRegion(); - - 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 396202ab0b..d7bb4b4043 100644 --- a/Projectiles/Melee/OmnibladeSwing.cs +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -14,14 +14,13 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() { - Projectile.width = 246; + Projectile.width = 308; Projectile.height = 184; - Projectile.scale = 1.15f; Projectile.friendly = true; Projectile.penetrate = -1; @@ -36,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 3; - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.Kill(); Vector2 playerRotatedPoint = Owner.RotatedRelativePoint(Owner.MountedCenter, true); @@ -49,16 +48,17 @@ namespace CalamityMod.Projectiles.Melee } // Rotation and directioning. + Projectile.rotation = Owner.gravDir == -1f ? MathHelper.Pi : 0f; Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); // Sprite and player directioning. - Projectile.spriteDirection = -Projectile.direction; + Projectile.spriteDirection = Projectile.direction * (int)(Owner.gravDir); if (Projectile.direction == 1) Projectile.Left = Owner.MountedCenter; else Projectile.Right = Owner.MountedCenter; - Projectile.position.X += Projectile.spriteDirection == -1 ? -116f : 88f; - Projectile.position.Y -= Projectile.scale * 66f; + Projectile.position.X += (Projectile.spriteDirection == 1 ? -92f : 96f) * Owner.gravDir; + Projectile.position.Y -= 80f * Owner.gravDir; Owner.ChangeDir(Projectile.direction); // Prevents the projectile from dying diff --git a/Projectiles/Melee/OmnibladeSwing.png b/Projectiles/Melee/OmnibladeSwing.png index bb0103db68..6fc79d67b1 100644 Binary files a/Projectiles/Melee/OmnibladeSwing.png and b/Projectiles/Melee/OmnibladeSwing.png differ diff --git a/Projectiles/Melee/Orbacle.cs b/Projectiles/Melee/Orbacle.cs index 6f4f88e0e0..1dc8a2244f 100644 --- a/Projectiles/Melee/Orbacle.cs +++ b/Projectiles/Melee/Orbacle.cs @@ -30,15 +30,15 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Main.spriteBatch.SetBlendState(BlendState.Additive); - - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; Color color = Color.Goldenrod; Main.EntitySpriteDraw(texture, drawPosition, null, Color.Gold * 0.2f, Projectile.rotation, origin, Projectile.scale * 1.6f, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture, drawPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.ExitShaderRegion(); return false; } diff --git a/Projectiles/Melee/OrderbringerAura.cs b/Projectiles/Melee/OrderbringerAura.cs deleted file mode 100644 index bdc5e8c106..0000000000 --- a/Projectiles/Melee/OrderbringerAura.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OrderbringerAura : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 100; - Projectile.height = 2; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 1200; - } - - public override void AI() - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 7200f) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - Projectile.Kill(); - } - } - else - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 12f) - { - Projectile.ai[0] = 0f; - if (Projectile.owner == Main.myPlayer) - { - int randOrbXOffset = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); - int randOrbYOffset = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)randOrbXOffset, (float)randOrbYOffset, 0f, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); - } - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 10f) - { - Projectile.localAI[0] = 0f; - int projTimer = 0; - int incTracker = 0; - float aiTracker = 0f; - int theProjectile = Projectile.type; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.owner == Projectile.owner && p.type == theProjectile && p.ai[1] < 3600f) - { - projTimer++; - if (p.ai[1] > aiTracker) - { - incTracker = p.whoAmI; - aiTracker = p.ai[1]; - } - } - } - if (projTimer > 1) - { - Main.projectile[incTracker].netUpdate = true; - Main.projectile[incTracker].ai[1] = 36000f; - } - } - } - } -} diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index 72feafc6e6..ea5a3dc017 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -10,121 +12,61 @@ namespace CalamityMod.Projectiles.Melee public class OrderbringerBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - private int whiteLightTimer = 5; + public override string Texture => "CalamityMod/Projectiles/Melee/OrderbringerBeam"; + public int time = 0; + public Color mainColor = Color.White; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; - Projectile.extraUpdates = 3; + Projectile.width = 100; + Projectile.height = 100; + Projectile.tileCollide = false; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.penetrate = -1; + Projectile.extraUpdates = 6; + Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { + if (time == 0) + { + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Projectile.ai[1] == 0f) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.timeLeft % 3 == 0 && targetDist < 1400f) { - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item60, Projectile.position); + Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 3, -Projectile.velocity * 0.05f, false, 17, 1.5f, mainColor * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); } - - if (Projectile.localAI[0] == 0f) - { - Projectile.scale -= 0.02f; - Projectile.alpha += 30; - if (Projectile.alpha >= 250) - { - Projectile.alpha = 255; - Projectile.localAI[0] = 1f; - } - } - else if (Projectile.localAI[0] == 1f) - { - Projectile.scale += 0.02f; - Projectile.alpha -= 30; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[0] = 0f; - } - } - - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); - - whiteLightTimer--; - if (whiteLightTimer == 0) - { - float spread = 180f * 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 < 1; 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) * 0.6f), (float)(Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 0.6f), (float)(-Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - } - whiteLightTimer = 5; - } - - 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; - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f); + time++; } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha); - } - public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 115) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Lerp(mainColor, Color.White, 0.3f) with { A = 0 }, 1, null, true, true); return false; } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); - for (int i = 0; i < 2; i++) + target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.numHits < 1) { - 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(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(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; - } - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Particle orb = new GlowSparkParticle(target.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY), false, 12, 0.07f, mainColor, new Vector2(1.5f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(orb); } } } diff --git a/Projectiles/Melee/OrderbringerBeam.png b/Projectiles/Melee/OrderbringerBeam.png index 615ff62268..48b2f67cde 100644 Binary files a/Projectiles/Melee/OrderbringerBeam.png and b/Projectiles/Melee/OrderbringerBeam.png differ diff --git a/Projectiles/Melee/OrderbringerRain.cs b/Projectiles/Melee/OrderbringerRain.cs deleted file mode 100644 index 690b46cd4b..0000000000 --- a/Projectiles/Melee/OrderbringerRain.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OrderbringerRain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.extraUpdates = 2; - Projectile.penetrate = 2; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.timeLeft = 180; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); - } - - 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(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; - } - - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); - } - } -} diff --git a/Projectiles/Melee/OrderbringerWaveProj.cs b/Projectiles/Melee/OrderbringerWaveProj.cs new file mode 100644 index 0000000000..d38407612a --- /dev/null +++ b/Projectiles/Melee/OrderbringerWaveProj.cs @@ -0,0 +1,121 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using CalamityMod.Particles; +using Terraria.ModLoader; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework.Graphics; +using System.ComponentModel; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Melee +{ + public class OrderbringerWaveProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Melee/JudgementProj"; + public ref float time => ref Projectile.ai[0]; + public float hitboxSize = 10; + public Color mainColor; + public float fade = 1; + public float damageMult = 1; + public float fadeOut = 1; + public override void SetDefaults() + { + Projectile.width = 336; + Projectile.height = 274; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 450; + Projectile.DamageType = DamageClass.Melee; + Projectile.extraUpdates = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 157; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 157; + + if (time == 0) + { + Projectile.scale = 0.0875f; + Projectile.velocity *= 0.9f; + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (time < 200) + { + Projectile.scale += 0.0026f; + hitboxSize += 0.4525f; + Projectile.velocity *= 0.995f; + } + else + { + Projectile.velocity *= 0.975f; + } + if (time > 300 && fade > 0) + fade -= 0.0065f; + + if (time < 250 && time > 20) + { + if (Main.rand.NextBool(3)) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66); + trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); + trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + trailDust.noGravity = true; + } + + if (time % 9 == 0) + { + Particle orb = new GlowSparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new GlowSparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(orb2); + } + if (Main.rand.NextBool(12)) + { + Particle orb3 = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + GeneralParticleHandler.SpawnParticle(orb3); + Particle orb4 = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + GeneralParticleHandler.SpawnParticle(orb4); + } + } + + fadeOut = Utils.GetLerpValue(0, 180, Projectile.timeLeft, true); + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + + float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); + for (int i = 1; i < 6; i++) // Weird for loop because of squash code + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (i * 0.2f * waveFade), 1 + (i * 0.35f * waveFade)) * Projectile.scale * 1.1f, SpriteEffects.None, 0); + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + if (damageMult < 1.3f && damageDone > 2) + damageMult += 0.325f; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // Deal more damage on pierce + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } +} diff --git a/Projectiles/Melee/OrderbringerWhiteOrb.cs b/Projectiles/Melee/OrderbringerWhiteOrb.cs deleted file mode 100644 index 10f687be16..0000000000 --- a/Projectiles/Melee/OrderbringerWhiteOrb.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OrderbringerWhiteOrb : 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.extraUpdates = 2; - Projectile.penetrate = 1; - Projectile.ignoreWater = true; - Projectile.timeLeft = 60; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - 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(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 2c02f06d22..e9385e48e5 100644 --- a/Projectiles/Melee/PhosphorescentGauntletPunches.cs +++ b/Projectiles/Melee/PhosphorescentGauntletPunches.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee public const float LungeSpeed = 19f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 14; + Main.projFrames[Type] = 14; } public override void SetDefaults() @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.frame++; // Die at the end of the final punch. - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.Kill(); } } @@ -158,8 +158,8 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = punchTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D punchTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = punchTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; SpriteEffects directionEffect = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Main.EntitySpriteDraw(punchTexture, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, Projectile.scale, directionEffect, 0); diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index f083ed9117..d587a822c6 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -41,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; @@ -153,6 +155,7 @@ namespace CalamityMod.Projectiles.Melee public void HandleChannelMovement(Vector2 playerRotatedPosition) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 idealAimDirection = (Main.MouseWorld - playerRotatedPosition).SafeNormalize(Vector2.UnitX * Owner.direction); float angularAimVelocity = 0.15f; @@ -194,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee Dust rainbowSpark = Dust.NewDustPerfect(spawnPosition, 261); rainbowSpark.velocity = Projectile.velocity * 3f + Main.rand.NextVector2CircularEdge(1.5f, 1.5f); rainbowSpark.noGravity = true; - rainbowSpark.color = Main.hslToRgb((Time / 40f + Main.rand.NextFloat(-0.1f, 0.1f)) % 1f, 0.95f, 0.6f); + rainbowSpark.color = Main.hslToRgb((Time / 40f + Main.rand.NextFloat(-0.1f, 0.1f)) % 1f, 0.95f, 0.8f); rainbowSpark.scale = Main.rand.NextFloat(0.9f, 1.25f); } } @@ -214,6 +217,7 @@ namespace CalamityMod.Projectiles.Melee // This means that projectile speed boosts will improve the range of the chainsaw. shootReach *= Owner.ActiveItem().shootSpeed; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, the result is separately capped float distanceFromMouse = Owner.Distance(Main.MouseWorld); // If the distance to the mouse is less than the base reach, reach only to mouse. @@ -241,5 +245,21 @@ namespace CalamityMod.Projectiles.Melee Vector2 end = Projectile.Center + Projectile.velocity * 70f; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, width, ref _); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 500); + SoundStyle fire = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit", 2); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = -0.1f }, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(0.55) * Main.rand.NextFloat(0.3f, 1f), false, 20, Main.rand.NextFloat(0.3f, 1.2f), Main.hslToRgb((Time / 40f + Main.rand.NextFloat(-0.1f, 0.1f)) % 1f, 0.95f, 0.8f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int i = 0; i < 3; i++) + { + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Main.hslToRgb((Time / 40f + Main.rand.NextFloat(-0.1f, 0.1f)) % 1f, 0.95f, 0.8f), "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.9f * Main.rand.NextFloat(0.9f, 1.1f), 12, true); + GeneralParticleHandler.SpawnParticle(blastRing); + } + } } } diff --git a/Projectiles/Melee/PlagueSeeker.cs b/Projectiles/Melee/PlagueSeeker.cs index 11487d15cc..842c7102ee 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; @@ -28,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee { int cap = 3; float capDamageFactor = 0.05f; - int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type] - cap; + int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap; modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f); } diff --git a/Projectiles/Melee/PrismRay.cs b/Projectiles/Melee/PrismRay.cs index 82014e4644..e1638f5750 100644 --- a/Projectiles/Melee/PrismRay.cs +++ b/Projectiles/Melee/PrismRay.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -107,8 +107,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 baseDrawPosition = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() / 2f; Color fadedRayColor = Projectile.GetAlpha(lightColor); Color fullbrightRayColor = HueDownscaledRayColor.MultiplyRGBA(new Color(255, 255, 255, 0)); diff --git a/Projectiles/Melee/PrismTooth.cs b/Projectiles/Melee/PrismTooth.cs index 27b738b95c..6f9361c6a7 100644 --- a/Projectiles/Melee/PrismTooth.cs +++ b/Projectiles/Melee/PrismTooth.cs @@ -2,7 +2,9 @@ using System.Linq; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.Achievements; @@ -22,8 +24,8 @@ namespace CalamityMod.Projectiles.Melee public ref float CanBreakTrees => ref Projectile.ai[2]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 90; + ProjectileID.Sets.TrailingMode[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 90; } public override void SetDefaults() @@ -52,6 +54,11 @@ namespace CalamityMod.Projectiles.Melee } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi * Time / Lifetime; + if (Main.rand.NextBool(6) && (Time < 35 || Time > 45)) + { + Particle spark2 = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(12, 12), Projectile.velocity * Main.rand.NextFloat(0.6f, 0.9f), false, 22, Main.rand.NextFloat(0.3f, 0.9f), Main.hslToRgb((Time / 40f + Main.rand.NextFloat(-0.1f, 0.1f)) % 1f, 0.95f, 0.8f)); + GeneralParticleHandler.SpawnParticle(spark2); + } Vector2 baseDirection = (MathHelper.TwoPi * Time / Lifetime - MathHelper.PiOver2).ToRotationVector2(); baseDirection.X *= 0.25f; @@ -90,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee Time++; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public void AbsolutelyFuckingAnnihilateTrees(int x, int y) { @@ -115,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) => Color.White; - internal float WidthFunction(float completionRatio) => Projectile.scale * 24f * (1f - Utils.GetLerpValue(0.7f, 1f, completionRatio, true)) + 1f; + internal float WidthFunction(float completionRatio) => (Projectile.scale * 24f * (1f - Utils.GetLerpValue(0.7f, 1f, completionRatio, true)) + 1f); internal Color ColorFunction(float completionRatio) { @@ -133,14 +140,14 @@ namespace CalamityMod.Projectiles.Melee // these crystals go, it's probably not something to worry too much about. Vector2 generalOffset = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2) * 15f; generalOffset += Projectile.rotation.ToRotationVector2() * -5f * (float)Math.Sin(Projectile.rotation); - + generalOffset *= Vector2.Zero; Main.spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:PrismaticStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); // Photon Ripper tracks 90 positions in oldPos. - // Provide 60 points for smoothing, but only render 12 - int numPointsRendered = 12; - int numPointsProvided = 60; + // Provide 80 points for smoothing, but only render 22 + int numPointsRendered = 22; + int numPointsProvided = 80; var positionsToUse = Projectile.oldPos.Take(numPointsProvided).ToArray(); PrimitiveRenderer.RenderTrail(positionsToUse, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + generalOffset, shader: GameShaders.Misc["CalamityMod:PrismaticStreak"], smoothen: false), numPointsRendered); Main.spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs index 34a62917e7..0917e7db63 100644 --- a/Projectiles/Melee/PrismaticBeam.cs +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -138,6 +138,7 @@ namespace CalamityMod.Projectiles.Melee // Gently adjusts the aim vector of the laser to point towards the mouse. private void UpdateAim(Vector2 source) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; diff --git a/Projectiles/Melee/PrismaticBreakerHoldout.cs b/Projectiles/Melee/PrismaticBreakerHoldout.cs new file mode 100644 index 0000000000..7b0dc48d71 --- /dev/null +++ b/Projectiles/Melee/PrismaticBreakerHoldout.cs @@ -0,0 +1,100 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Tools; +using CalamityMod.Projectiles.BaseProjectiles; +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.Projectiles.Melee +{ + public class PrismaticBreakerHoldout : BaseGunHoldoutProjectile, ILocalizedModType + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 40f; + + public ref float Timer => ref Projectile.ai[0]; + public const float LaserChargeTime = 300f; + public const float LaserAimLag = 0.94f; // Last Prism-esque aim lag. Higher = Slower. Last Prism is 0.92f. + public const float LaserDamageMult = 2f; + public const float LaserLifetime = 360f; + + public float StarTimer = 0f; + public float StarFrequency = 47f; + + public override void HoldoutAI() + { + if (Owner.CantUseHoldout()) + { + if (!CalamityUtils.AnyProjectiles(ModContent.ProjectileType())) + Projectile.Kill(); + } + if (Timer > LaserChargeTime + LaserLifetime) + Projectile.Kill(); + + Timer++; + if (Timer <= LaserChargeTime) + { + StarTimer++; + if (StarTimer >= StarFrequency && Main.myPlayer == Projectile.owner) + { + StarTimer = 0f; + SoundEngine.PlaySound(SoundID.Item43 with { Volume = 0.6f }, Projectile.Center); + for (int i = 0; i < 4; i++) + { + float clampedChargeTime = MathHelper.Clamp(Timer / LaserChargeTime, 0f, 1f); + float starOffset = MathHelper.Lerp(MathHelper.Pi / 6f, 0f, clampedChargeTime); + Vector2 velocity = Vector2.Normalize(Projectile.velocity).RotatedByRandom(starOffset) * 17f; + + Projectile star = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, Main.rand.Next(12)); + star.scale = MathHelper.Lerp(0.75f, 1f, clampedChargeTime); + } + StarFrequency -= 4f; + } + } + + if (Timer == LaserChargeTime - 100f) + SoundEngine.PlaySound(CrystylCrusher.ChargeSound, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()); + if (Timer == LaserChargeTime && Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * LaserDamageMult), Projectile.knockBack, Projectile.owner); + } + } + + public override void ManageHoldout() + { + Vector2 storedVelocity = Projectile.velocity; + base.ManageHoldout(); + + if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 aimVector = (Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true)).SafeNormalize(Vector2.UnitY); + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(storedVelocity), LaserAimLag)); + + if (aimVector != storedVelocity) + Projectile.netUpdate = true; + Projectile.velocity = aimVector; + + Projectile.rotation = Projectile.velocity.ToRotation(); + } + } + + // We need to rotate the drawing by 45 degrees since the sword sprite points up-right + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (MathHelper.PiOver4 * Projectile.spriteDirection) + (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; + } + } +} diff --git a/Projectiles/Melee/PrismaticMagicCircle.cs b/Projectiles/Melee/PrismaticMagicCircle.cs new file mode 100644 index 0000000000..760f51b0de --- /dev/null +++ b/Projectiles/Melee/PrismaticMagicCircle.cs @@ -0,0 +1,86 @@ +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; + +namespace CalamityMod.Projectiles.Melee +{ + public class PrismaticMagicCircle : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float Timer => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public int Lifetime = 360; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 512; + Projectile.friendly = true; + Projectile.DamageType = MeleeRangedHybridDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.timeLeft = Lifetime; + } + + public override bool? CanDamage() => false; + public override bool ShouldUpdatePosition() => false; + + public override void AI() + { + Timer++; + if (Owner.CantUseHoldout()) + { + if (Projectile.timeLeft > 30) + Projectile.timeLeft = 30; + } + if (Owner.active && !Owner.dead) + Projectile.Center = Owner.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 60f; + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 aimVector = (Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true)).SafeNormalize(Vector2.UnitY); + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(Projectile.velocity), PrismaticBreakerHoldout.LaserAimLag)); + + if (aimVector != Projectile.velocity) + Projectile.netUpdate = true; + Projectile.velocity = aimVector; + + Projectile.rotation = Projectile.velocity.ToRotation(); + + if (Timer < 30f) + Projectile.scale = MathHelper.Lerp(0f, 1f, Timer / 30f); + else + Projectile.scale = Utils.GetLerpValue(0f, 30f, Projectile.timeLeft, true); + + if (Timer == 1f && Main.myPlayer == Projectile.owner) + { + SoundEngine.PlaySound(SoundID.Item67, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item68, Projectile.Center); + SoundEngine.PlaySound(Items.Weapons.DraedonsArsenal.TeslaCannon.FireSound with { Pitch = 1f }); + Vector2 spawnPos = Vector2.Lerp(Projectile.Center, Owner.Center, 0.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + } + + public override bool PreDraw(ref Color lightColor) + { + // Draw the awesome and cool magic circle to hide the fact that the laser gets cut off horribly + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D howNoisy = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/MeltyNoise").Value; + Vector2 squishScale = new Vector2(Projectile.width / howNoisy.Width * 0.55f, Projectile.height / howNoisy.Height * 2f) * Projectile.scale * 0.36f; + + GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); + for (int i = 0; i < 6; i++) + { + Color portalColor = Color.Lerp(Main.DiscoColor, Color.White, (float)Math.Abs(Math.Sin(Main.GlobalTimeWrappedHourly * 2f))); + Main.spriteBatch.Draw(howNoisy, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, howNoisy.Size() / 2f, squishScale, SpriteEffects.None, 0f); + } + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Melee/PrismaticRay.cs b/Projectiles/Melee/PrismaticRay.cs new file mode 100644 index 0000000000..c10c472e13 --- /dev/null +++ b/Projectiles/Melee/PrismaticRay.cs @@ -0,0 +1,135 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Steamworks; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PrismaticRay : BaseLaserbeamProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Melee/PrismaticRayStart"; + public Player Owner => Main.player[Projectile.owner]; + + public override Texture2D LaserBeginTexture => Terraria.GameContent.TextureAssets.Projectile[Type].Value; + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/PrismaticRayMid", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/PrismaticRayEnd", AssetRequestMode.ImmediateLoad).Value; + public override float MaxScale => 5f; + public override float MaxLaserLength => 2400f; + public override float Lifetime => 360f; + public override Color LaserOverlayColor => Main.DiscoColor; + + public static readonly SoundStyle HitSound = new SoundStyle("CalamityMod/Sounds/Item/ExobladeDashImpact") with { Volume = 0.8f }; + public int HitSoundCooldown = 0; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 5000; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 36; + Projectile.friendly = true; + Projectile.DamageType = MeleeRangedHybridDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 360; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.hide = true; + } + + public override void AttachToSomething() + { + if (Owner.CantUseHoldout()) + { + if (Projectile.timeLeft > 30) + Projectile.timeLeft = 30; + } + if (Owner.active && !Owner.dead) + Projectile.Center = Owner.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 20f; + } + + public override void UpdateLaserMotion() + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 aimVector = (Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true)).SafeNormalize(Vector2.UnitY); + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(Projectile.velocity), PrismaticBreakerHoldout.LaserAimLag)); + + if (aimVector != Projectile.velocity) + Projectile.netUpdate = true; + Projectile.velocity = aimVector; + } + + public override void DetermineScale() + { + if (Time < 30f) + Projectile.scale = MathHelper.Lerp(0f, 1f, Time / 30f) * MaxScale; + else + Projectile.scale = Utils.GetLerpValue(0f, 30f, Projectile.timeLeft, true) * MaxScale; + } + + public override void ExtraBehavior() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + + if (Owner.Calamity().GeneralScreenShakePower < 3f) + Owner.Calamity().GeneralScreenShakePower = 3f; + + if (HitSoundCooldown > 0) + HitSoundCooldown--; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + + if (HitSoundCooldown == 0) + { + SoundEngine.PlaySound(HitSound, target.Center); + HitSoundCooldown = 10; + } + } + + + public float LaserWidthFunction(float _) => Projectile.scale * Projectile.width; + public Color LaserColorFunction(float completionRatio) => Main.DiscoColor; + public override bool PreDraw(ref Color lightColor) + { + // This should never happen, but just in case... + if (Projectile.velocity == Vector2.Zero) + return false; + + // Draw the actual laser + Main.spriteBatch.EnterShaderRegion(); + Vector2 laserEnd = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitY) * LaserLength; + Vector2[] drawPoints = new Vector2[10]; + for (int i = 0; i < drawPoints.Length; i++) + drawPoints[i] = Vector2.Lerp(Projectile.Center, laserEnd, i / (float)(drawPoints.Length - 1f)); + + GameShaders.Misc["CalamityMod:ArtemisLaser"].UseColor(Main.DiscoColor); + GameShaders.Misc["CalamityMod:ArtemisLaser"].UseImage1(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/MeltyNoise")); + GameShaders.Misc["CalamityMod:ArtemisLaser"].UseImage2(ModContent.Request("CalamityMod/Projectiles/Boss/LeviathanBomb")); + + PrimitiveRenderer.RenderTrail(drawPoints, new(LaserWidthFunction, LaserColorFunction, shader: GameShaders.Misc["CalamityMod:ArtemisLaser"]), 60); + Main.spriteBatch.ExitShaderRegion(); + 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/Melee/PrismaticRayStart.png b/Projectiles/Melee/PrismaticRayStart.png new file mode 100644 index 0000000000..9bb157441c Binary files /dev/null and b/Projectiles/Melee/PrismaticRayStart.png differ diff --git a/Projectiles/Melee/PrismaticWave.cs b/Projectiles/Melee/PrismaticWave.cs index 532d89d457..98dec241ce 100644 --- a/Projectiles/Melee/PrismaticWave.cs +++ b/Projectiles/Melee/PrismaticWave.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,8 +11,8 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; private int alpha = 50; - public Color[] colors = new Color[] - { + public Color[] colors = + [ new Color(255, 0, 0, 50), //Red new Color(255, 128, 0, 50), //Orange new Color(255, 255, 0, 50), //Yellow @@ -27,21 +25,15 @@ namespace CalamityMod.Projectiles.Melee new Color(128, 0, 255, 50), //Purple new Color(255, 0, 255, 50), //Fuschia new Color(255, 0, 128, 50) //Hot Pink - }; - List colorSet = new List() - { - new Color(255, 0, 0, 50), //Red - new Color(255, 255, 0, 50), //Yellow - new Color(0, 255, 0, 50), //Green - new Color(0, 255, 255, 50), //Cyan - new Color(0, 0, 255, 50), //Blue - new Color(255, 0, 255, 50), //Fuschia - }; + ]; + public ref float Timer => ref Projectile.ai[0]; + public Particle starEffect; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -51,92 +43,64 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = MeleeRangedHybridDamageClass.Instance; - Projectile.penetrate = 2; + Projectile.alpha = 255; Projectile.timeLeft = 360; Projectile.tileCollide = false; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - } - - 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() { - if (Projectile.localAI[0] == 0f) - { - Projectile.scale -= 0.02f; - Projectile.alpha += 30; - if (Projectile.alpha >= 250) - { - Projectile.alpha = 255; - Projectile.localAI[0] = 1f; - } - } - else if (Projectile.localAI[0] == 1f) - { - Projectile.scale += 0.02f; - Projectile.alpha -= 30; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[0] = 0f; - } - } + Timer++; + Projectile.alpha -= 16; + if (Projectile.alpha < 64) + Projectile.alpha = 64; Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Projectile.rotation = Projectile.velocity.ToRotation(); if (Main.rand.NextBool()) { 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; } + + // Determine random star rotation + if (Projectile.localAI[0] == 0f) + Projectile.localAI[0] = Main.rand.NextFloat(MathHelper.Pi / 60f, MathHelper.Pi / 12f) * Main.rand.NextBool().ToDirectionInt(); + + // Draw the star + if (starEffect == null) + { + Color projColor = Color.Lerp(Color.White, colors[(int)Projectile.ai[1]], 0.4f); + starEffect = new GenericSparkle(Projectile.Center + Projectile.velocity * 1.5f, Vector2.Zero, projColor, colors[(int)Projectile.ai[1]], Projectile.scale * 2.5f, 2, Timer * Projectile.localAI[0]); + GeneralParticleHandler.SpawnParticle(starEffect); + } + else + { + starEffect.Time = 0; + starEffect.Position = Projectile.Center + Projectile.velocity * 1.5f; + } + + // Home in if it's from Cosmic Rainbow + if (Projectile.ai[2] == 1f) + CalamityUtils.HomeInOnNPC(Projectile, true, 400f, 18f, 20f); } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 355) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } - public override Color? GetAlpha(Color lightColor) - { - int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % colorSet.Count); - Color currentColor = colorSet[colorIndex]; - Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; - return Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f); - } + public override Color? GetAlpha(Color lightColor) => colors[(int)Projectile.ai[1]]; public override void OnKill(int timeLeft) { + GeneralParticleHandler.RemoveParticle(starEffect); for (int k = 0; k < 3; k++) { 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; } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 150); - target.AddBuff(BuffID.Daybreak, 150); - Projectile.velocity *= 0.75f; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 150); - target.AddBuff(BuffID.Daybreak, 150); - Projectile.velocity *= 0.75f; - } } } diff --git a/Projectiles/Melee/PwnagehammerEcho.cs b/Projectiles/Melee/PwnagehammerEcho.cs index d35c179c89..437b8aa195 100644 --- a/Projectiles/Melee/PwnagehammerEcho.cs +++ b/Projectiles/Melee/PwnagehammerEcho.cs @@ -1,6 +1,4 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -16,10 +14,12 @@ namespace CalamityMod.Projectiles.Melee public static readonly SoundStyle Kunk = new("CalamityMod/Sounds/Item/TF2PanHit") { Volume = 1.1f }; public int Explodamage = 0; public float speed = 0f; + public NPC targeted; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 7; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -29,55 +29,53 @@ namespace CalamityMod.Projectiles.Melee Projectile.aiStyle = 0; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 248, 124, 255); + return new Color(255, 248, 124, 255) with { A = 0 }; } public override void AI() { speed = Projectile.velocity.Length(); Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 55f) - { - CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 2000f, speed, 12f); - } if (Projectile.ai[0] < 42f) { Projectile.velocity.Y *= 0.9575f; - Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0]; + Projectile.velocity.X *= 0.98f; + Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0] * Projectile.direction; } - else if (Projectile.ai[0] < 44f) + else if (Projectile.ai[0] >= 42f) { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 * 0.5f; Projectile.extraUpdates = 2; - if (Projectile.ai[1] < 0f) - { - Projectile.Kill(); - return; - } - NPC target = Main.npc[(int)Projectile.ai[1]]; - if (!target.CanBeChasedBy(Projectile, false) || !target.active) - Projectile.Kill(); - else + if (Projectile.ai[1] != -5) + targeted = Main.npc[(int)Projectile.ai[1]]; + if (targeted == null || !targeted.CanBeChasedBy(Projectile, false) || !targeted.active) { - float velConst = 24f; - Projectile.velocity = new Vector2((target.Center.X - Projectile.Center.X) / velConst, (target.Center.Y - Projectile.Center.Y) / velConst); - Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0]; + Projectile.ai[1] = -5; + targeted = Projectile.Center.ClosestNPCAt(2000); } + if (targeted != null) + { + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.6f, 25, 0.98f); + } + else + Projectile.Kill(); } if (Main.rand.NextBool()) { Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - 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 dust = Dust.NewDustPerfect(Projectile.Center + 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,40 +83,42 @@ 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(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 dust = Dust.NewDustPerfect(Projectile.Center + 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; } } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (targeted != null && target != targeted) + modifiers.SourceDamage *= 0.3f; + } public override bool? CanHitNPC(NPC target) { if (Projectile.ai[0] <= 42f) return false; return null; } - - public override bool CanHitPvp(Player target) => Projectile.ai[0] > 42f; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.localAI[0] = target.whoAmI; + if (target == targeted) + Projectile.Kill(); } public override bool PreKill(int timeLeft) { Player player = Main.player[Projectile.owner]; - float numberOfDusts = 32f; + float numberOfDusts = 45f; float rotFactor = 360f / numberOfDusts; for (int i = 0; i < numberOfDusts; i++) { 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, DustID.Sandnado, velOffset.X, velOffset.Y); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity = velOffset; - Main.dust[dust].scale = 3f; + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, DustID.Sandnado, velOffset); + dust.noGravity = true; + dust.velocity = velOffset * (i % 2 == 0 ? 0.9f : i % 3 == 0 ? 0.8f : 1f); + dust.scale = 3f; } if (Main.zenithWorld) @@ -134,20 +134,9 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); - Vector2 origin = sourceRectangle.Size() / 2f; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Gold with { A = 0 } * 0.5f, 1, texture, true, true); - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - float rot = MathHelper.ToRadians(22.5f) * Math.Sign(Projectile.velocity.X); - Vector2 drawPos = Projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, Projectile.gfxOffY); - Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - Main.EntitySpriteDraw(texture, drawPos, new Rectangle?(), color, Projectile.rotation - i * rot, origin, Projectile.scale, spriteEffects, 0); - } return false; } } diff --git a/Projectiles/Melee/PwnagehammerExplosionBig.cs b/Projectiles/Melee/PwnagehammerExplosionBig.cs index ed55e005f2..e31a3d8e10 100644 --- a/Projectiles/Melee/PwnagehammerExplosionBig.cs +++ b/Projectiles/Melee/PwnagehammerExplosionBig.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -31,5 +32,20 @@ namespace CalamityMod.Projectiles.Melee } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.15f; + int hitsToMinMult = 12; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + { + Projectile.numHits -= 1; + } + } } } diff --git a/Projectiles/Melee/PwnagehammerExplosionSmall.cs b/Projectiles/Melee/PwnagehammerExplosionSmall.cs index 04e984ab38..8f69a02068 100644 --- a/Projectiles/Melee/PwnagehammerExplosionSmall.cs +++ b/Projectiles/Melee/PwnagehammerExplosionSmall.cs @@ -1,9 +1,5 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -29,7 +25,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.85f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } } diff --git a/Projectiles/Melee/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs index 241777b227..3f656010c7 100644 --- a/Projectiles/Melee/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -15,22 +14,24 @@ namespace CalamityMod.Projectiles.Melee 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 int HighBong = 0; - public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().StellarHammer; + public int time = 0; + public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().Holyhammer; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 7; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { - Projectile.width = Projectile.height = 40; + Projectile.width = Projectile.height = 66; Projectile.friendly = true; Projectile.timeLeft = 3600; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; } public override void AI() @@ -40,25 +41,22 @@ namespace CalamityMod.Projectiles.Melee if (EmpoweredHammer >= 5) EmpoweredHammer = 0; - Projectile.velocity.X *= 0.9511f; - Projectile.velocity.Y += 0.502f; + int falloffTime = 10; + if (time > falloffTime) + Projectile.velocity.X *= 0.9711f; + if (Projectile.velocity.Y < 15 && time > falloffTime) + Projectile.velocity.Y += 0.426f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.98f; - if (Main.rand.NextBool()) + if (Main.rand.NextBool(3)) { Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.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(new Vector2(Projectile.Center.X, Projectile.Center.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), 1.5f); dust.noGravity = true; } - - if (Main.rand.NextBool(6)) - { - Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); - Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.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.noGravity = true; - } - + time++; } public override bool PreKill(int timeLeft) @@ -71,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(9f, 0).RotatedBy(rot); Vector2 velOffset = new Vector2(6f, 0).RotatedBy(rot); - Dust dust = Dust.NewDustPerfect(Projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 269, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; dust.velocity = velOffset; dust.scale = 2.5f; @@ -104,12 +102,11 @@ namespace CalamityMod.Projectiles.Melee if (EmpoweredHammer >= 3) { Projectile.ai[1] = target.whoAmI; - int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack * 1.5f, Projectile.owner, 0f, Projectile.ai[1]); + int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Projectile.velocity.SafeNormalize(Vector2.UnitX).X * 5, -15f), ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack * 1.5f, Projectile.owner, 0f, Projectile.ai[1]); Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); Main.projectile[hammer].netUpdate = true; EmpoweredHammer = 0; HighBong = 1; - } else { @@ -120,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/RSSolarFlare.cs b/Projectiles/Melee/RSSolarFlare.cs index c0d7da5f0f..e3515eca78 100644 --- a/Projectiles/Melee/RSSolarFlare.cs +++ b/Projectiles/Melee/RSSolarFlare.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -73,8 +73,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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; @@ -82,18 +82,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4f; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 1; 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); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } SoundEngine.PlaySound(SoundID.Item14, Projectile.position); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index afd0ea82a5..cd3a626853 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -72,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/RedtideWhirlpool.cs b/Projectiles/Melee/RedtideWhirlpool.cs index 319032448d..0b983a87b8 100644 --- a/Projectiles/Melee/RedtideWhirlpool.cs +++ b/Projectiles/Melee/RedtideWhirlpool.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -41,11 +42,21 @@ namespace CalamityMod.Projectiles.Melee Dust dust = Dust.NewDustPerfect(dustPos, 176, (angle - MathHelper.PiOver2 * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 8f + Projectile.velocity, Scale: Main.rand.NextFloat(1.6f, 3f)); dust.noGravity = true; } + + Vector2 trailOffset = Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(40f, 48f); + Dust trail = Dust.NewDustPerfect(Projectile.Center + trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f)); + trail.noGravity = true; + trail.scale = Main.rand.NextFloat(0.8f, 3f); + trail.alpha = Main.rand.Next(120, 180 + 1); + trail = Dust.NewDustPerfect(Projectile.Center - trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f)); + trail.noGravity = true; + trail.scale = Main.rand.NextFloat(0.8f, 3f); + trail.alpha = Main.rand.Next(120, 180 + 1); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; SpriteEffects flip = Math.Sign(Projectile.velocity.X) < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; @@ -54,7 +65,8 @@ namespace CalamityMod.Projectiles.Melee return 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); public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position); diff --git a/Projectiles/Melee/RemsRevengeExplosion.cs b/Projectiles/Melee/RemsRevengeExplosion.cs index 3d1c9452c0..2a44122aa2 100644 --- a/Projectiles/Melee/RemsRevengeExplosion.cs +++ b/Projectiles/Melee/RemsRevengeExplosion.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Projectiles.Melee { @@ -12,6 +13,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public override void SetDefaults() { Projectile.width = Projectile.height = 80; @@ -19,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 5; + Projectile.timeLeft = 20; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -27,21 +31,42 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.ai[1] > 0f) - return; - - // Makeshift metal-blood explosion sound that is good enough ig - SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2) { Pitch = -0.75f, PitchVariance = 0.5f }, Projectile.Center); - for (int p = 0; p < 10; p++) + if (Time == 0f) { - Vector2 velocity = (-Vector2.UnitY).RotatedByRandom(MathHelper.ToRadians(75f)) * Main.rand.NextFloat(4f, 6f); - float scale = Main.rand.NextFloat(0.6f, 2f); - Particle blood = new BloodParticle(Projectile.Center, velocity, 30, scale, Color.DarkRed); - GeneralParticleHandler.SpawnParticle(blood); + // Makeshift metal-blood explosion sound that is good enough ig + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2) { Pitch = -0.75f, PitchVariance = 0.5f }, Projectile.Center); + + for (int i = 0; i < 5; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 5, i, true)), "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.5f + 0.03f * i, (int)(20 - i * 1.5f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 3; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 3, i, true)), "CalamityMod/Projectiles/FireProj", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 2f + 0.22f * i, (int)(20 - i * 2f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + + Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.RosyBrown, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.1f, 2f, 24, true); + GeneralParticleHandler.SpawnParticle(outerGlow); + + for (int p = 0; p < 16; p++) + { + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(8f, 12f); + float scale = Main.rand.NextFloat(0.6f, 2f); + Particle blood = new BloodParticle(Projectile.Center, velocity, 30, scale, Color.DarkRed); + GeneralParticleHandler.SpawnParticle(blood); + } } - Projectile.ai[1]++; + + Projectile.scale = MathHelper.Lerp(0f, 1f, PiecewiseAnimation(Time / 20f, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) })); + Time++; } 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) => modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/RendingNeedle.cs b/Projectiles/Melee/RendingNeedle.cs index 6d609a9ec7..6c4ad50df0 100644 --- a/Projectiles/Melee/RendingNeedle.cs +++ b/Projectiles/Melee/RendingNeedle.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } const float MaxTime = 30; diff --git a/Projectiles/Melee/RespiteblockBlood.cs b/Projectiles/Melee/RespiteblockBlood.cs index 2a3e81ca9b..5cee5c6c73 100644 --- a/Projectiles/Melee/RespiteblockBlood.cs +++ b/Projectiles/Melee/RespiteblockBlood.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45, targetHitbox); } diff --git a/Projectiles/Melee/RespiteblockHoldout.cs b/Projectiles/Melee/RespiteblockHoldout.cs index c166e097d7..5e691dfb7b 100644 --- a/Projectiles/Melee/RespiteblockHoldout.cs +++ b/Projectiles/Melee/RespiteblockHoldout.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Enums; using CalamityMod.Particles; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee } if (Time % 4 == 0) { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (Projectile.velocity.RotatedBy(MathHelper.ToRadians(45f * Projectile.direction)) * 10) + Main.rand.NextVector2Circular(13, 13) + Projectile.velocity * Main.rand.Next(10, 20 + 1), Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.01f, -0.25f) * Projectile.direction) * 4, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), Projectile.knockBack, Projectile.owner, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + (Projectile.velocity.RotatedBy(MathHelper.ToRadians(45f * Projectile.direction)) * 10) + Main.rand.NextVector2Circular(13, 13) + Projectile.velocity * Main.rand.Next(10, 20 + 1), Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.01f, -0.25f) * Projectile.direction) * 4, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), Projectile.knockBack, Projectile.owner, 0); } DetermineVisuals(playerRotatedPosition); @@ -93,7 +94,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 500); + target.AddBuff(ModContent.BuffType(), 500); Player player = Main.player[Projectile.owner]; Vector2 spawnPos = Projectile.Center + (Projectile.velocity.RotatedBy(MathHelper.ToRadians(45f * Projectile.direction)) * 10) + Main.rand.NextVector2Circular(13, 13); @@ -116,10 +117,7 @@ namespace CalamityMod.Projectiles.Melee int heal = Main.rand.NextBool(4) ? 2 : 1; player.lifeSteal -= heal; - player.statLife += heal; - player.HealEffect(heal); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + player.HealPlayer(heal); } public void PlayChainsawSounds() @@ -164,6 +162,7 @@ namespace CalamityMod.Projectiles.Melee public void HandleChannelMovement(Vector2 playerRotatedPosition) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 idealAimDirection = (Main.MouseWorld - playerRotatedPosition).SafeNormalize(Vector2.UnitX * Owner.direction); float angularAimVelocity = 0.15f; diff --git a/Projectiles/Melee/RiptideWave.cs b/Projectiles/Melee/RiptideWave.cs new file mode 100644 index 0000000000..6c7f6f9f13 --- /dev/null +++ b/Projectiles/Melee/RiptideWave.cs @@ -0,0 +1,66 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class RiptideWave : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public const int Lifetime = 30; + public const int MaxSize = 176; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + // Constantly stay on top of the yoyo. + if (Main.projectile[(int)Projectile.ai[0]].active) + Projectile.Center = Main.projectile[(int)Projectile.ai[0]].Center + Main.projectile[(int)Projectile.ai[0]].velocity; + + // Expand the hitbox as lifespan goes on. + int waveSize = (int)MathHelper.Lerp(MaxSize, 16, Projectile.timeLeft / (float)Lifetime); + Projectile.ExpandHitboxBy(waveSize); + + // Fade out. + if (Projectile.timeLeft <= 20) + Projectile.alpha += 12; + } + + // Ensure knockback is always applied away from the player. + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Main.player[Projectile.owner].Center.X).ToDirectionInt(); + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.SetBlendState(BlendState.Additive); + + Texture2D waveTex = ModContent.Request("CalamityMod/Particles/SeaFoam").Value; + Rectangle frame = waveTex.Frame(1, 3, 0, (int)Projectile.ai[2]); + Color waveColor = new Color(61, 119, 148) * Projectile.Opacity; + float waveScale = Projectile.width / (float)waveTex.Width; + Main.EntitySpriteDraw(waveTex, Projectile.Center - Main.screenPosition, frame, waveColor, Projectile.ai[1], frame.Size() / 2f, waveScale, SpriteEffects.None); + + Texture2D ringTex = ModContent.Request("CalamityMod/Particles/HollowCircleSoftEdge").Value; + float ringScale = Projectile.width / (float)ringTex.Width; + Main.EntitySpriteDraw(ringTex, Projectile.Center - Main.screenPosition, null, waveColor, 0f, ringTex.Size() / 2f, ringScale, SpriteEffects.None); + + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + return false; + } + } +} diff --git a/Projectiles/Melee/RoxcaliburProj.cs b/Projectiles/Melee/RoxcaliburProj.cs index e970f4b362..3b9034c5f4 100644 --- a/Projectiles/Melee/RoxcaliburProj.cs +++ b/Projectiles/Melee/RoxcaliburProj.cs @@ -99,6 +99,7 @@ namespace CalamityMod.Projectiles.Melee } else if (Animation == Charging) //first frame of release { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary; it is a binary above/below player Animation = Main.MouseWorld.Y > player.Center.Y ? Plunging : Swinging; float chargeModifier = ChargeLevel * 2.5f; //modify this to balance damage bonus from charging @@ -268,7 +269,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/SaharaSlicersBlade.png b/Projectiles/Melee/SaharaSlicersBlade.png index abf539a5d6..d3667f574b 100644 Binary files a/Projectiles/Melee/SaharaSlicersBlade.png and b/Projectiles/Melee/SaharaSlicersBlade.png differ diff --git a/Projectiles/Melee/SaharaSlicersBladeAlt.png b/Projectiles/Melee/SaharaSlicersBladeAlt.png index 989f6b5acf..69a74d3ac1 100644 Binary files a/Projectiles/Melee/SaharaSlicersBladeAlt.png and b/Projectiles/Melee/SaharaSlicersBladeAlt.png differ diff --git a/Projectiles/Melee/SaharaSlicersBolt.cs b/Projectiles/Melee/SaharaSlicersBolt.cs index 0150b4757a..3304c67806 100644 --- a/Projectiles/Melee/SaharaSlicersBolt.cs +++ b/Projectiles/Melee/SaharaSlicersBolt.cs @@ -13,14 +13,15 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 9; + ProjectileID.Sets.TrailingMode[Type] = 0; } public ref int Bolts => ref Main.player[Projectile.owner].Calamity().saharaSlicersBolts; public override void SetDefaults() { Projectile.width = 18; Projectile.height = 18; + Projectile.timeLeft = 300; Projectile.friendly = true; Projectile.penetrate = 2; Projectile.tileCollide = true; @@ -42,12 +43,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 6; if (Main.rand.NextBool(2)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), Main.rand.NextBool() ? 288 : 207); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), Main.rand.NextBool() ? 288 : 121); dust.scale = Main.rand.NextFloat(0.2f, 0.45f); dust.noGravity = true; dust.velocity = -Projectile.velocity * 0.5f; } - if (Projectile.timeLeft % 2 == 0 && playerDist < 1400f) + if (Projectile.timeLeft % 2 == 0 && playerDist < 1400f && Projectile.timeLeft < 295) { SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 3f, -Projectile.velocity * 0.05f, false, 10, 1f, Color.White * 0.135f); GeneralParticleHandler.SpawnParticle(spark); @@ -73,10 +74,10 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i <= 8; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 288 : 207, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.9f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 288 : 121, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.9f)); dust.noGravity = false; dust.scale = Main.rand.NextFloat(0.6f, 0.9f); - Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 288 : 207, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.05f, 0.9f)); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 288 : 121, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.05f, 0.9f)); dust2.noGravity = false; dust2.scale = Main.rand.NextFloat(0.6f, 0.9f); } @@ -88,10 +89,10 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int i = 0; i <= 5; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 216 : 207, -Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 216 : 121, -Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(1.1f, 1.8f); - Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 216 : 207, -Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.05f, 0.4f)); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 216 : 121, -Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.05f, 0.4f)); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(1.1f, 1.8f); } @@ -100,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { if (Projectile.ai[0] == 1) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return true; } public override bool? CanDamage() => Projectile.ai[0] == 1 ? true : false; diff --git a/Projectiles/Melee/SaharaSlicersBolt.png b/Projectiles/Melee/SaharaSlicersBolt.png index 9c954972d8..7bcc8d6378 100644 Binary files a/Projectiles/Melee/SaharaSlicersBolt.png and b/Projectiles/Melee/SaharaSlicersBolt.png differ diff --git a/Projectiles/Melee/SandBlade.cs b/Projectiles/Melee/SandBlade.cs index daf43041df..1ff0f70ab3 100644 --- a/Projectiles/Melee/SandBlade.cs +++ b/Projectiles/Melee/SandBlade.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/SandFire.cs b/Projectiles/Melee/SandFire.cs index 25bcb47663..479a3fa16c 100644 --- a/Projectiles/Melee/SandFire.cs +++ b/Projectiles/Melee/SandFire.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 6; diff --git a/Projectiles/Melee/ScorcherExplosion.cs b/Projectiles/Melee/ScorcherExplosion.cs new file mode 100644 index 0000000000..025bd83cdc --- /dev/null +++ b/Projectiles/Melee/ScorcherExplosion.cs @@ -0,0 +1,43 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ScorcherExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 400; + Projectile.height = 400; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -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); + } + 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.width * 0.5f * Projectile.scale, targetHitbox); + } +} + diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index 3660315b2e..9e1fff2b3e 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.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.Melee @@ -13,7 +14,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -147,8 +149,8 @@ namespace CalamityMod.Projectiles.Melee public override void PostDraw(Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 bb5bb91e57..813b2ed575 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosProj.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -33,25 +33,19 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.alpha <= 200) { - int inc; - for (int i = 0; i < 2; i = inc + 1) + for (int i = 0; i < 2; i++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - float shortXVel = Projectile.velocity.X / 4f * i; - float shortYVel = Projectile.velocity.Y / 4f * i; - int scourgeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Main.dust[scourgeDust].position.X = Projectile.Center.X - shortXVel; - Main.dust[scourgeDust].position.Y = Projectile.Center.Y - shortYVel; - Dust dust = Main.dust[scourgeDust]; - dust.velocity *= 0f; - Main.dust[scourgeDust].scale = 0.7f; - inc = i; + Dust scourgeDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + scourgeDust.position = Projectile.Center - Projectile.velocity * i * 0.25f; + scourgeDust.velocity *= 0f; + scourgeDust.scale = 0.7f; } } Projectile.alpha -= 50; if (Projectile.alpha < 0) Projectile.alpha = 0; - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 180f) { @@ -64,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -82,18 +76,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = -oldVelocity.Y; if (Projectile.owner == Main.myPlayer) { - int minisAmt = 1; - if (Main.rand.NextBool(10)) - minisAmt++; - int inc; - for (int j = 0; j < minisAmt; j = inc + 1) + int minisAmt = Main.rand.Next(1, 2 + 1); + for (int j = 0; j < minisAmt; j++) { - float randXDirect = Main.rand.Next(-35, 36) * 0.02f; - float randYDirect = Main.rand.Next(-35, 36) * 0.02f; - randXDirect *= 10f; - randYDirect *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randXDirect, randYDirect, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.35f, Main.myPlayer); - inc = j; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.35f, Projectile.owner); } } } @@ -103,40 +89,27 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCHit4, Projectile.position); - int inc; - for (int i = 0; i < 10; i = inc + 1) + for (int i = 0; i < 10; i++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int killedDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[killedDust]; + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); dust.scale *= 1.1f; - Main.dust[killedDust].noGravity = true; - inc = i; + dust.noGravity = true; } - for (int j = 0; j < 15; j = inc + 1) + for (int j = 0; j < 15; j++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int killedDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[killedDust2]; + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); dust.velocity *= 2.5f; - dust = Main.dust[killedDust2]; dust.scale *= 0.8f; - Main.dust[killedDust2].noGravity = true; - inc = j; + dust.noGravity = true; } if (Projectile.owner == Main.myPlayer) { - int minisAmt = 3; - if (Main.rand.NextBool(10)) - minisAmt++; - for (int j = 0; j < minisAmt; j = inc + 1) + int minisAmt = Main.rand.Next(3, 4 + 1); + for (int j = 0; j < minisAmt; j++) { - float randXDirect = Main.rand.Next(-35, 36) * 0.02f; - float randYDirect = Main.rand.Next(-35, 36) * 0.02f; - randXDirect *= 10f; - randYDirect *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randXDirect, randYDirect, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); - inc = j; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.35f, Projectile.owner); } } } diff --git a/Projectiles/Melee/SeashineSwordProj.cs b/Projectiles/Melee/SeashineSwordProj.cs deleted file mode 100644 index 91b63de8bb..0000000000 --- a/Projectiles/Melee/SeashineSwordProj.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -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 = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = TimeLeft; - Projectile.alpha = MaxAlpha; - } - - public override void AI() - { - 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) - { - 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.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 = 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/SeekingScorcherProj.cs b/Projectiles/Melee/SeekingScorcherProj.cs new file mode 100644 index 0000000000..3ade299e4f --- /dev/null +++ b/Projectiles/Melee/SeekingScorcherProj.cs @@ -0,0 +1,389 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +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 CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class SeekingScorcherProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/SeekingScorcher"; + + public static int WindupSwingTime = 24; + public static int MaxAirtime = 60; + public static int CrystalTransformationTime = 30; + public static int Fadetime = 30; + public static int Lifetime = 600; + public static float ExplosionDamageMult = 3f; + public static float CrystalBounceDamageMult = 2f; // Exponential scaling for multiple bounces but capped at max bounces + public static float CrystalBounceSpeedMult = 1.25f; + public static int MaxBounces = 3; + public const float MaxNPCHomingRange = 1200f; // 75 tiles + public const float MaxAxeHomingRange = 800f; // 50 tiles + + private List PreviousNPCs = new List() { -1 }; + public Player Owner => Main.player[Projectile.owner]; + + public ref float WindupSwingProgress => ref Projectile.ai[0]; + public ref float PhaseTime => ref Projectile.ai[1]; + public ref float CrystalTimer => ref Projectile.ai[2]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 94; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = Lifetime + WindupSwingTime; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override bool ShouldUpdatePosition() => WindupSwingProgress > 1f; + + // Can deal damage if already thrown and not crystal + public override bool? CanDamage() => WindupSwingProgress <= 1f || CrystalTimer >= CrystalTransformationTime ? false : 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(WindupSwingProgress, new CurveSegment[] { pullback, throwout }); + + public override void AI() + { + // Wind-up swing animation + if (WindupSwingProgress <= 1f) + { + // Initialize the actual original projectile damage. This is used for the crystal boost later + if (PhaseTime == 0f) + Projectile.originalDamage = Projectile.damage; + + WindupSwingProgress = Utils.GetLerpValue(0f, WindupSwingTime, PhaseTime, true); + PhaseTime++; + + // Recalibrate and perform the throw when ready + if (WindupSwingProgress == 1f) + { + WindupSwingProgress = 2f; + PhaseTime = 0f; + Projectile.Center = Owner.MountedCenter + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 72f; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * Projectile.velocity.Length(); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X >= 0f).ToDirectionInt(); + Projectile.netUpdate = true; + SoundEngine.PlaySound(SeekingScorcher.ThrowSound, Projectile.Center); + return; + } + + // Hold and swing + float armRotation = ArmAnticipationMovement() * Owner.direction; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -72f * Owner.gravDir; + Projectile.rotation = ((Owner.direction == 1 ? 0f : -MathHelper.PiOver2) - MathHelper.PiOver4 + armRotation) * Owner.gravDir; + Projectile.spriteDirection = Projectile.direction = Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + return; + } + // Crystal transformation and collision explosion + if (CrystalTimer > 0f) + { + if (CrystalTimer >= CrystalTransformationTime) + { + Projectile.velocity = Vector2.Zero; + + foreach (Projectile proj in Main.ActiveProjectiles) + { + // Only allow other axes to hit the crystal axe + if (proj.type != Type) + continue; + + // Check for if the axe is thrown and not turning crystal + if (proj.ai[0] > 1f && proj.ai[2] <= 0f && Projectile.Hitbox.Intersects(proj.Hitbox)) + { + Explode(); + + // Cause the axe that just hit to be empowered and counts as a bounce + proj.damage = Math.Clamp((int)(proj.damage * CrystalBounceDamageMult), 0, (int)(proj.originalDamage * MathF.Pow(CrystalBounceDamageMult, MaxBounces))); + proj.velocity = proj.velocity.RotatedBy(Main.rand.NextBool() ? MathHelper.ToRadians(Main.rand.NextFloat(108f, 162f)) : MathHelper.ToRadians(Main.rand.NextFloat(-162f, -108f))) * CrystalBounceSpeedMult; + proj.ai[1] -= 30f; + proj.ai[2] = -1f; + proj.netUpdate = true; + } + } + } + else + { + Projectile.velocity *= 0.85f; + Projectile.rotation += Projectile.direction * MathHelper.ToRadians(24f) * Utils.GetLerpValue(CrystalTransformationTime, 0f, CrystalTimer, true); + CrystalTimer++; + } + + Projectile.Opacity = Utils.GetLerpValue(0f, Fadetime, Projectile.timeLeft, true); + + if (Projectile.timeLeft <= Fadetime || Main.rand.NextBool(20)) + { + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(14f, 22f); + float scale = Main.rand.NextFloat(0.6f, 1.2f); + Particle spark = new CritSpark(Projectile.Center, velocity, Color.MistyRose, Color.Pink, scale, 30, 0.1f, 3f, Main.rand.NextFloat(0f, 0.01f)); + GeneralParticleHandler.SpawnParticle(spark); + } + return; + } + + // Mid-throw AI and stuff + // Stored value from hitting crystal axes which performs the bounce + if (CrystalTimer == -1f) + { + SharpBounce(); + Projectile.numHits++; + CrystalTimer--; + } + + PhaseTime++; + Projectile.rotation += Projectile.direction * MathHelper.ToRadians(24f); + + // Begin transformation + if (PhaseTime >= MaxAirtime) + { + // Empowered axes return instead + if (Projectile.numHits >= MaxBounces || CrystalTimer < 0f) + ReturnToOwner(); + else + CrystalTimer++; + } + + // Trails + if (Main.rand.NextBool()) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if (CrystalTimer < 0f) + { + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Color.MistyRose, 24, Main.rand.NextFloat(1.6f, 2f), 0.25f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + // Glowmask + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + + // Disallow the NPC to be targeted again + PreviousNPCs.Add(target.whoAmI); + SharpBounce(); + Projectile.netUpdate = true; + + SoundEngine.PlaySound(SeekingScorcher.HitSound, Projectile.Center); + + Particle boom = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.6f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.1f, 24, true); + GeneralParticleHandler.SpawnParticle(boom); + + for (int i = 0; i < 10; i++) + { + Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(6f, 8f); + float sparkScale = Main.rand.NextFloat(1f, 1.4f); + SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, 24, sparkScale, Main.rand.NextBool() ? Color.Gold : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark); + + Vector2 smokeVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(3f, 6f); + float smokeScale = Main.rand.NextFloat(1.6f, 2f); + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVelocity, Color.MistyRose, 24, smokeScale, 0.25f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(smoke); + } + + // Empowered axe hits + if (CrystalTimer < 0f) + { + for (int i = 0; i < 7; i++) + { + Vector2 maxScale = new Vector2(Main.rand.NextFloat(1.5f, 4f), Main.rand.NextFloat(0.6f, 1.5f)); + CustomPulse crystal = new CustomPulse(Projectile.Center, Vector2.One, Color.MistyRose, "CalamityMod/Particles/BlastCone", maxScale, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.5f, 18); + GeneralParticleHandler.SpawnParticle(crystal); + } + + for (int i = 0; i < 8; i++) + { + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(16f, 28f); + float scale = Main.rand.NextFloat(0.6f, 1.6f); + Particle spark = new CritSpark(Projectile.Center, velocity, Color.MistyRose, Color.Pink, scale, 30, 0.1f, 3f, Main.rand.NextFloat(0f, 0.01f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + + public override void OnKill(int timeLeft) + { + if (CrystalTimer >= CrystalTransformationTime && PhaseTime > 0f) + { + SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, Projectile.Center); + for (int i = 0; i < 9; i++) + { + Vector2 maxScale = new Vector2(Main.rand.NextFloat(2f, 4.5f), Main.rand.NextFloat(1.4f, 2f)); + CustomPulse crystal = new CustomPulse(Projectile.Center, Vector2.One, Color.MistyRose, "CalamityMod/Particles/BlastCone", maxScale, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.5f, 18); + GeneralParticleHandler.SpawnParticle(crystal); + } + + for (int i = 0; i < 15; i++) + { + Vector2 smokeVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(3f, 8f); + float smokeScale = Main.rand.NextFloat(1.6f, 2f); + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVelocity, Color.MistyRose, 24, smokeScale, 0.25f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + } + + public void SharpBounce() + { + // Return if exceeding max number of bounces + if (Projectile.numHits >= MaxBounces) + { + PhaseTime = MaxAirtime; + ReturnToOwner(); + return; + } + + float range = MaxNPCHomingRange; + int targetNPC = -1; + foreach (NPC target in Main.ActiveNPCs) + { + if (!target.CanBeChasedBy(Projectile) || PreviousNPCs.Contains(target.whoAmI)) + continue; + + float distance = Vector2.Distance(target.Center, Projectile.Center); + if (distance < range) + { + range = distance; + targetNPC = target.whoAmI; + } + } + + if (targetNPC != -1) + { + // Will only try to bounce towards nearby axes if there are nearby enemies as to not waste axe hits + // The last usable pierce will never be spent on an axe since it would then just return to the player + float range2 = MaxAxeHomingRange; + int targetAxe = -1; + foreach (Projectile proj in Main.ActiveProjectiles) + { + if (proj.type != Type) + continue; + + // Avoid crystal axes that are fading out + float distance = Vector2.Distance(proj.Center, Projectile.Center); + if (distance < range2 && proj.ai[2] >= CrystalTransformationTime && proj.timeLeft > Fadetime) + { + range2 = distance; + targetAxe = proj.whoAmI; + } + } + + // Partially restore airtime + PhaseTime = -12f; + if (targetAxe != -1 && Projectile.numHits < MaxBounces - 1) + Projectile.velocity = Projectile.SafeDirectionTo(Main.projectile[targetAxe].Center) * Projectile.velocity.Length(); + else + Projectile.velocity = Projectile.SafeDirectionTo(Main.npc[targetNPC].Center) * Projectile.velocity.Length(); + } + // If no enemies left, empowered axes just return immediately + // This also applies to the final bounce since that counts as exhausting all bounces + // Otherwise, they will simply retain their original velocity + else if (CrystalTimer < 0f || Projectile.numHits == MaxBounces - 1) + { + PhaseTime = MaxAirtime; + ReturnToOwner(); + } + } + + public void ReturnToOwner() + { + // Swiftly move back towards the player; also make it avoid naturally despawning + Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * Projectile.velocity.Length(); + Projectile.timeLeft = 2; + + // 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) + Projectile.Kill(); + } + + public void Explode() + { + PhaseTime = 0f; + Projectile.Kill(); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * ExplosionDamageMult), Projectile.knockBack, Projectile.owner); + + SoundEngine.PlaySound(SeekingScorcher.HitSound, Projectile.Center); + SoundEngine.PlaySound(SeekingScorcher.ShatterSound, Projectile.Center); + + Particle explosion = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.LightPink, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.65f + 0.1f, 25); + GeneralParticleHandler.SpawnParticle(explosion); + Particle explosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.2f, 30); + GeneralParticleHandler.SpawnParticle(explosion2); + Particle explosion3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.2f, 30); + GeneralParticleHandler.SpawnParticle(explosion3); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 6f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0, 0.2f, 25, true, 0.9f); + GeneralParticleHandler.SpawnParticle(blastRing2); + + for (int i = 0; i < 24; i++) + { + CritSpark spark2 = new CritSpark(Projectile.Center, new Vector2(40, 40).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f), Color.White, Color.Orchid, 0.9f, 35, 2f, 2.2f); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int i = 0; i < 2; i++) + { + Particle blast = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.3f, 1.5f, 25, true); + GeneralParticleHandler.SpawnParticle(blast); + } + for (int i = 0; i < 2; i++) + { + Particle blast2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.2f, 1.1f, 25, true); + GeneralParticleHandler.SpawnParticle(blast2); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor) * Projectile.Opacity; + 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; + + //Gain a glow based on how high the charge timer is + if (CrystalTimer != 0f) + { + float fade = Projectile.Opacity * CrystalTimer > 0f ? Utils.GetLerpValue(0, CrystalTransformationTime, CrystalTimer, true) : 1f; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 5 * fade; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, Color.MistyRose with { A = 0 } * fade, drawRotation, rotationPoint, Projectile.scale, flipSprite, 0f); + } + } + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + return false; + } + } +} diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs index bf94ea1dc1..2843ec3b4a 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs @@ -63,13 +63,13 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); SpawnMeteor(Main.player[Projectile.owner]); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); SpawnMeteor(Main.player[Projectile.owner]); } diff --git a/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs b/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs index 21b5e40527..9c6ded3e47 100644 --- a/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs +++ b/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs @@ -35,8 +35,8 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override void SetVisualOffsets() { - const int HalfSpriteWidth = 32 / 2; - const int HalfSpriteHeight = 32 / 2; + const int HalfSpriteWidth = 40 / 2; + const int HalfSpriteHeight = 40 / 2; int HalfProjWidth = Projectile.width / 2; int HalfProjHeight = Projectile.height / 2; @@ -56,6 +56,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords dust.velocity = -Projectile.velocity * 0.5f; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float armPointingDirection = ((Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation()); Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); Owner.heldProj = Projectile.whoAmI; @@ -66,14 +67,13 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { // Add to bolt counter, spawn 2 quiver bolts, and on hit visual - if (Bolts < 10) + for (int i = 0; i < 2; i++) { - Bolts++; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Bolts); if (Bolts < 10) { Bolts++; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Bolts); + Projectile quiverBolt = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Bolts); + quiverBolt.tileCollide = false; } } float numberOfDusts = 5f; @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(Main.rand.NextFloat(0.5f, 2.5f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); Vector2 velOffset = new Vector2(Main.rand.NextFloat(0.5f, 2.5f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); - Dust dust = Dust.NewDustPerfect(target.Center + offset, Main.rand.NextBool() ? 288 : 207, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(target.Center + offset, Main.rand.NextBool() ? 288 : 121, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = false; dust.velocity = velOffset; dust.scale = Main.rand.NextFloat(1.5f, 1.2f); diff --git a/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs b/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs index 2b361ba73d..d6fd3f55d1 100644 --- a/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs +++ b/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override void SetVisualOffsets() { - const int HalfSpriteWidth = 32 / 2; - const int HalfSpriteHeight = 32 / 2; + const int HalfSpriteWidth = 40 / 2; + const int HalfSpriteHeight = 40 / 2; int HalfProjWidth = Projectile.width / 2; int HalfProjHeight = Projectile.height / 2; @@ -58,6 +58,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords dust.velocity = -Projectile.velocity * 0.5f; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float armPointingDirection = (Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation(); Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, 0); @@ -69,14 +70,13 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { // Add to bolt counter, spawn 2 quiver bolts, and on hit visual - if (Bolts < 10) + for (int i = 0; i < 2; i++) { - Bolts++; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Bolts); if (Bolts < 10) { Bolts++; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Bolts); + Projectile quiverBolt = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Bolts); + quiverBolt.tileCollide = false; } } float numberOfDusts = 5f; @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(Main.rand.NextFloat(0.5f, 2.5f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); Vector2 velOffset = new Vector2(Main.rand.NextFloat(0.5f, 2.5f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); - Dust dust = Dust.NewDustPerfect(target.Center + offset, Main.rand.NextBool() ? 288 : 207, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(target.Center + offset, Main.rand.NextBool() ? 288 : 121, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = false; dust.velocity = velOffset; dust.scale = Main.rand.NextFloat(1.5f, 1.2f); diff --git a/Projectiles/Melee/Shortswords/StarburstShivProj.cs b/Projectiles/Melee/Shortswords/StarburstShivProj.cs index 52e9409cfd..8293e62d06 100644 --- a/Projectiles/Melee/Shortswords/StarburstShivProj.cs +++ b/Projectiles/Melee/Shortswords/StarburstShivProj.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override void SetDefaults() { - Projectile.Size = new Vector2(22); + Projectile.width = Projectile.height = 44; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -39,15 +39,15 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override void SetVisualOffsets() { - const int HalfSpriteWidth = 44 / 2; - const int HalfSpriteHeight = 44 / 2; + const int HalfSpriteWidth = 37; + const int HalfSpriteHeight = 47; int HalfProjWidth = Projectile.width / 2; - int HalfProjHeight = Projectile.height / 2; + int QuarterProjHeight = Projectile.height / 4; DrawOriginOffsetX = 0; DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); - DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); + DrawOriginOffsetY = -(HalfSpriteHeight - QuarterProjHeight); } public override void ExtraBehavior() diff --git a/Projectiles/Melee/SkytideDragoonGhost.png b/Projectiles/Melee/SkytideDragoonGhost.png new file mode 100644 index 0000000000..9f133fe4f0 Binary files /dev/null and b/Projectiles/Melee/SkytideDragoonGhost.png differ diff --git a/Projectiles/Melee/SkytideDragoonGlow.png b/Projectiles/Melee/SkytideDragoonGlow.png new file mode 100644 index 0000000000..a80503e9ce Binary files /dev/null and b/Projectiles/Melee/SkytideDragoonGlow.png differ diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs new file mode 100644 index 0000000000..bda0458693 --- /dev/null +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -0,0 +1,361 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +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.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SkytideDragoonHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/SkytideDragoon"; + public override float HitboxOutset => 245; + + public override Vector2 HitboxSize => new Vector2(40, 40); // long thin hitbox for a spear is done in collision, the X here determines hitbox width + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(0, 135); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public float colorFadeIn = 0; + public int useAnim; + public int swingCount = 0; + public float spearOutset = 0; + public bool fireProj = true; + public bool fancySwing => swingCount % 7 == 0; + public bool redirected = false; + public int attackPower = 0; // How many swings you have left before you have to call another bolt + public float attackMult = 0; // A multiplier based on attack power that changes smoothly + public Vector2 tipOutset; + + public Color color1 = Color.Orchid; + public Color color2 = Color.Cyan; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Melee; + } + public override void WhenSpawned() + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = 1; + + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + Projectile.rotation = Vector2.UnitY.ToRotation() + MathHelper.ToRadians(-135); + useAnim = fancySwing ? (int)(Owner.itemAnimationMax * 2f) : Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + tipOutset = Vector2.One.RotatedBy(Projectile.rotation + MathHelper.ToRadians(90)) * spearOutset * 12; + AbsolutePosition = Owner.MountedCenter + tipOutset; + AnimationProgress = Animation % useAnim; + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + { + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.15f); + } + else + { + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.12f); + } + colorFadeIn = MathHelper.Lerp(colorFadeIn, 0, 0.07f); + + attackMult = MathHelper.Lerp(attackMult, attackPower, 0.15f); + + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + fireProj = true; + + doSwing = true; + + swingCount++; + + if (swingCount == 1 && Owner.Calamity().mouseRight) + redirected = true; + else + redirected = false; + + useAnim = (fancySwing || redirected) ? (int)(Owner.itemAnimationMax * 2f) : Owner.itemAnimationMax; + AnimationProgress = Animation % useAnim; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + if (fancySwing) + { + Projectile.rotation = Projectile.rotation.AngleLerp(Vector2.UnitY.ToRotation() + MathHelper.ToRadians(-135), (redirected ? 0.1f : 0.22f)); + } + else if (redirected) + { + float lerp = Utils.GetLerpValue(0, useAnim / 2f, AnimationProgress); + CanHit = true; + if (AnimationProgress < (useAnim / 2f)) + { + Projectile.rotation += 0.81f * Owner.direction * (1 - lerp); + Projectile.rotation = MathHelper.WrapAngle(Projectile.rotation); + for (int i = 0; i < 2; i++) + { + Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); + Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.4f) * Main.rand.NextFloat(2f, 8f); + Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), vel, 0, default, Main.rand.NextFloat(1.85f, 2.2f)); + dust.noGravity = true; + dust.color = color; + + Particle spark2 = new BoltParticle(pos, -vel.RotatedBy(Owner.direction == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(-135)) * Main.rand.NextFloat(1.5f, 1.8f), false, 13, Main.rand.NextFloat(0.2f, 0.35f), color * 0.8f, new Vector2(1.2f, 1f), true, true, false, 0.25f); + GeneralParticleHandler.SpawnParticle(spark2); + + if (i % 2 == 0) + { + Particle orb = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f, color * 0.75f, new Vector2(1f, 1)); + GeneralParticleHandler.SpawnParticle(orb); + } + } + } + else + { + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.15f); + } + } + else + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.25f); + + if (AnimationProgress < (useAnim / 2)) + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + + if (redirected) + CanHit = true; + else + CanHit = false; + + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + } + spearOutset = MathHelper.Lerp(spearOutset, MathHelper.ToRadians(120f), 0.2f); + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; + } + else + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + spearOutset = MathHelper.Lerp(spearOutset, MathHelper.ToRadians(120f), 0.2f); + + if (time == (int)(timeMax * 0.4f)) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/SkytideSwing"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) - (fancySwing ? 0.3f : 0) }, Projectile.Center); + } + if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = true; + } + else + { + if (fireProj && time >= (int)(timeMax * 0.7f)) + { + if (fancySwing) // Call down the bolt + { + Owner.Calamity().GeneralScreenShakePower = 3f; + SoundStyle sound = new("CalamityMod/Sounds/Item/SkytiedBolt"); + SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 5), Projectile.knockBack, Projectile.owner, 0, 0.5f); + proj.timeLeft = 45; + swingCount = 0; + attackPower = 6; + } + else if (redirected) // Redirect the bolt + { + Owner.Calamity().GeneralScreenShakePower = 4.5f; + SoundStyle fire = new("CalamityMod/Sounds/Item/SkytiedBolt"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/AuricBulletHit"); + SoundEngine.PlaySound(fire2 with { Volume = 0.5f, Pitch = 0.2f }, Projectile.Center); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), (int)(Projectile.damage * 9), Projectile.knockBack, Projectile.owner, 0, 1f); + swingCount = -1; + attackPower = 0; + } + else // Five projectile scattershot + { + for (int i = -2; i < 3; i++) + { + float rot = (0.1f * attackPower * i / 6f); + Vector2 vel = rot.ToRotationVector2().RotatedBy(aimVel.ToRotation()) * -7; + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0, rot); + } + attackPower--; + } + colorFadeIn = 1; + fireProj = false; + } + } + if (time >= (int)(timeMax * 0.85f)) + CanHit = false; + + spearOutset = MathHelper.Lerp(spearOutset, MathHelper.ToRadians(MathHelper.Lerp(450f, 0f, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.7f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 2; i++) + { + Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); + float bonus = (1 - (7 / (attackPower + 1))) * 0.3f; + Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.05f)); + Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.ToRadians(-45)).RotatedByRandom(0.5f) * Main.rand.NextFloat(6f, 10f); + Dust dust = Dust.NewDustPerfect(pos, Main.rand.NextBool(3) ? 278 : ModContent.DustType(), vel * (1 + bonus), 0, default, Main.rand.NextFloat(1.05f, 1.4f)); + dust.noGravity = !(dust.type == 278); + dust.color = color; + dust.scale += bonus; + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) // Custom collision since it's a spear + { + // Perform an AABB line collision check to check the whole spear. + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (Projectile.rotation - MathHelper.ToRadians(45)).ToRotationVector2() * HitboxOutset + tipOutset, HitboxSize.X * Projectile.scale, ref _); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + SoundStyle fire = new("CalamityMod/Sounds/Item/AuricBulletHit"); + SoundEngine.PlaySound(fire with { Volume = 0.55f, Pitch = 0.8f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Custom/DefenseDamage"); + SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = 0.4f }, Projectile.Center); + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 23, true); + + target.AddBuff(BuffID.Electrified, 230); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request("CalamityMod/Projectiles/Melee/SkytideDragoonHoldout"); + Asset glowTex = ModContent.Request("CalamityMod/Projectiles/Melee/SkytideDragoonGlow"); + float fxRot = Projectile.rotation + MathHelper.ToRadians(45); + float fxPosRot = Projectile.rotation - MathHelper.ToRadians(45); + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + Vector2 drawPos = (Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY)) + Projectile.velocity.SafeNormalize(Vector2.UnitX); + + Color glowColor = Color.Lerp(color1, color2, colorFadeIn) with { A = 0 }; + Color auraColor = Color.Lerp(color2, color1, colorFadeIn) with { A = 0 } * 0.15f * fadeIn; + for (int i = 0; i < 25; i++) + { + // Outline effect + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/SkytideDragoonGhost").Value; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 7.2f * fadeIn; + Main.EntitySpriteDraw(centerTexture, drawPos + drawOffset, centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, drawPos, tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(glowTex.Value, drawPos, glowTex.Frame(1, FrameCount, 0, Frame), glowColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + + Asset tex2 = ModContent.Request("CalamityMod/Particles/ArchSmear"); + Asset orb = ModContent.Request("CalamityMod/Particles/BloomCircle"); + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 55.5f / MathHelper.Pi); + for (int i = 0; i < 6; i++) + { + // While not super visible here, this hitbox extention effect looks great and I'll use it on stuff like Terra Lance later + Color tipColor = Color.Lerp(color2, color1, (i + 4) / 6) with { A = 0 } * 0.3f * fadeIn; + Vector2 scale = new Vector2(0.25f - i * 0.04f, (1.5f + i * 0.15f) * colorFadeIn) * (0.75f * colorFadeIn * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f); + Main.EntitySpriteDraw(tex2.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 130, null, tipColor, fxRot, tex2.Size() * 0.5f, scale, SpriteEffects.None); + } + for (int i = 0; i < 6; i++) + { + // the electric orb at the tip + Color orbColor = Color.Lerp(Color.Lerp(color2, color1, (i + 2) / 6), Color.White, i / 6) with { A = 0 } * 0.5f; + Vector2 scale = new Vector2(Math.Abs(sine * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 2; + Main.EntitySpriteDraw(orb.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 180 + tipOutset, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); + } + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/SkytideDragoonHoldout.png b/Projectiles/Melee/SkytideDragoonHoldout.png new file mode 100644 index 0000000000..56b38df685 Binary files /dev/null and b/Projectiles/Melee/SkytideDragoonHoldout.png differ diff --git a/Projectiles/Melee/SolarNeedle.cs b/Projectiles/Melee/SolarNeedle.cs index a2cb9c4f29..73ff5cf5ef 100644 --- a/Projectiles/Melee/SolarNeedle.cs +++ b/Projectiles/Melee/SolarNeedle.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } const float MaxTime = 30; @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Melee } - DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/SolsticeBeam.cs b/Projectiles/Melee/SolsticeBeam.cs index 909c591cff..c51f791152 100644 --- a/Projectiles/Melee/SolsticeBeam.cs +++ b/Projectiles/Melee/SolsticeBeam.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 8e22c60646..0f4dd0e19c 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index 8d06a0e6d5..db4bd66be8 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index bcf1a5c36b..fcdd40ad08 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index db84085d23..2b5f59aa0d 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/SpatialSpear4.cs b/Projectiles/Melee/SpatialSpear4.cs index 85754074fa..f7932ebf8d 100644 --- a/Projectiles/Melee/SpatialSpear4.cs +++ b/Projectiles/Melee/SpatialSpear4.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index f93eefbdd9..cb3b1f3b6b 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -92,7 +92,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 : Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Melee/Spears/BansheeHookAlt").Value : Terraria.GameContent.TextureAssets.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, diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs deleted file mode 100644 index 6446641068..0000000000 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.BaseProjectiles; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee.Spears -{ - public class DiseasedPikeSpear : BaseSpearProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override void SetDefaults() - { - Projectile.width = Projectile.height = 40; - Projectile.DamageType = TrueMeleeDamageClass.Instance; - 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 = 8; - } - - public override float InitialSpeed => 3f; - public override float ReelbackSpeed => 2.4f; - 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, DustID.TerraBlade, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 4; i++) - { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); - Main.projectile[proj].extraUpdates += i; - } - } - } - } -} diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.png b/Projectiles/Melee/Spears/DiseasedPikeSpear.png deleted file mode 100644 index c80a3e6ec5..0000000000 Binary files a/Projectiles/Melee/Spears/DiseasedPikeSpear.png and /dev/null differ diff --git a/Projectiles/Melee/Spears/EarthenPikeSpear.cs b/Projectiles/Melee/Spears/EarthenPikeSpear.cs index 54416b823f..7101466f9a 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = Projectile.height = 40; - Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. + Projectile.DamageType = DamageClass.Melee; Projectile.timeLeft = 90; Projectile.friendly = true; Projectile.hostile = false; @@ -39,11 +39,9 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.localAI[0] = 0f; if (Main.myPlayer == Projectile.owner) { - float velocityY = Projectile.velocity.Y * 1.25f; - if (velocityY < 0.1f) - velocityY = 0.1f; - 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); + float randomVelocity = Main.rand.NextFloat(1.085f, 1.115f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * randomVelocity, + ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.2f, Projectile.owner, 0f, 1f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].DamageType = DamageClass.Melee; } diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 30691c8d7c..76bbf419ed 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee.Spears if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; 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 1b25770648..3dbc16e3d9 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -29,18 +31,21 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1.1f; public override float ForwardSpeed => 0.4f; + public override Action EffectBeforeReelback => (proj) => + { + if (Main.myPlayer == Projectile.owner) + { + for (int i = 0; i < 3; i++) + { + Vector2 featherVel = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 40f) * Main.rand.NextFloat(1.55f, 1.85f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, featherVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); + } + } + }; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) 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] >= 7f) - { - Projectile.localAI[0] = 0f; - if (Main.myPlayer == Projectile.owner) - 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/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 51c1f30f62..672789f03f 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -70,5 +71,6 @@ namespace CalamityMod.Projectiles.Melee.Spears Main.dust[idx].velocity = Vector2.Zero; } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs deleted file mode 100644 index 88dfe7f223..0000000000 --- a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs +++ /dev/null @@ -1,334 +0,0 @@ -using System; -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Utilities; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using static CalamityMod.CalamityUtils; - -namespace CalamityMod.Projectiles.Melee.Spears -{ - public class RedtideSpearProjectile : ModProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public Player Owner => Main.player[Projectile.owner]; - public static int Lifetime = 28; - public int Timer => Lifetime - Projectile.timeLeft; - - private SlotId ChargeWindSoundSlot; - - - public int ChargeDirection => Math.Sign(Projectile.velocity.X); - - #region Thrust - //Basic animation variables. - public float ThrustProgress => Timer / (float)Lifetime; - public float BaseRotation => Projectile.velocity.ToRotation(); - public float ThrustRotation => BaseRotation + Owner.direction * RotationShift; - - //Thrust animation keys - public CurveSegment thrust = new CurveSegment(EasingType.PolyIn, 0f, 0.15f, 0.85f, 3); - public CurveSegment hold = new CurveSegment(EasingType.SineBump, 0.3f, 1f, 0.2f); - public CurveSegment retract = new CurveSegment(EasingType.PolyOut, 0.7f, 1f, -1f, 2); - public CurveSegment correct = new CurveSegment(EasingType.PolyIn, 0.85f, 0f, 0.17f); - internal float Displacement => PiecewiseAnimation(ThrustProgress, new CurveSegment[] { thrust, hold, retract, correct }); - - internal const float startRotation = MathHelper.PiOver4 * 0.1f; - internal const float downwardsRotation = MathHelper.PiOver4 * 0.15f; - internal const float upwardsRotation = MathHelper.PiOver4 * -0.44f; - internal const float loweredTime = 0.25f; - - public CurveSegment downwards = new CurveSegment(EasingType.SineOut, 0f, startRotation, downwardsRotation, 2); - public CurveSegment raiseback = new CurveSegment(EasingType.SineIn, loweredTime, startRotation + downwardsRotation, upwardsRotation); - public CurveSegment stayUp = new CurveSegment(EasingType.Linear, 0.8f, startRotation + downwardsRotation + upwardsRotation, 0f); - internal float RotationShift => PiecewiseAnimation(ThrustProgress, new CurveSegment[] { downwards, raiseback, stayUp }); - public int InitializationTime => (int)(loweredTime * Lifetime); - #endregion - - #region Drag along the ground - - - public static int MaxRunTime = 300; - //Player can only do the run attack while moving fast horizontally in the direction of the thrust, but remaining on the ground - public bool CanRunAttack => Owner.velocity.Y >= -0.8f && Owner.velocity.Y <= 7f && Math.Abs(Owner.velocity.X) >= Owner.maxRunSpeed * 0.7f && Math.Sign(Owner.velocity.X) == ChargeDirection && Owner.channel && !RunBroken; - //You can only start a run attack if you meet the other conditions, but ALSO you can't do it if you are aiming too much upwards or downwards - public bool CanStartRunAttack => CanRunAttack && Math.Abs(Owner.Calamity().mouseWorld.Y - Owner.MountedCenter.Y) <= 300; - public ref float RunTimer => ref Projectile.ai[0]; - //The window of time during which the run hasn't fully started, and is indentical to the regular thrust's start. This tells us when we can no longer do this switch. - public bool FullyRunning => RunTimer > InitializationTime; - - //Basically tracks if the run has been broken, either because the player did not try to run at all, stopped running, or ran for too long. - public bool RunBroken - { - get => Projectile.ai[1] > 0f; - set { Projectile.ai[1] = value ? 1f : 0f; } - } - - public static int UpThrustLifetime = 20; - public int UpThrustTimer => UpThrustLifetime - Projectile.timeLeft; - public float UpThrustProgress => UpThrustTimer / (float)UpThrustLifetime; - - //Gets the ideal rotation for the spear while running. Basically, slightly angled downwards towards the ground, to the left or right of the player depending on the direction - public float IdealSpearRotationForRun - { - get - { - float rotation = MathHelper.PiOver4 * 0.12f; - - if (ChargeDirection > 0) - return rotation; - - //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 - { - if (ChargeDirection < 0 && Projectile.rotation > 0) - return Projectile.rotation - MathHelper.TwoPi; - - return Projectile.rotation; - } - } - - public CurveSegment transitionSegment => new CurveSegment(EasingType.PolyInOut, 0f, ProjectileRotationButWrappedForTransition, IdealSpearRotationForRun - ProjectileRotationButWrappedForTransition, 2); - internal float RunAttackRotation => PiecewiseAnimation(Math.Clamp(RunTimer / 30f, 0f, 1f), new CurveSegment[] { transitionSegment }); - - - public CurveSegment anticipationDown => new CurveSegment(EasingType.SineIn, 0f, IdealSpearRotationForRun, ChargeDirection * MathHelper.PiOver4 * 0.1f, 2); - public CurveSegment upthrust => new CurveSegment(EasingType.SineOut, 0.4f, IdealSpearRotationForRun + ChargeDirection * MathHelper.PiOver4 * 0.1f, ChargeDirection * MathHelper.PiOver2 * -0.75f); - public CurveSegment holdup => new CurveSegment(EasingType.Linear, 0.8f, IdealSpearRotationForRun + ChargeDirection * MathHelper.PiOver2 * -0.7f, -0.14f); - internal float UpThrustRotation => PiecewiseAnimation(UpThrustProgress, new CurveSegment[] { anticipationDown, upthrust, holdup }); - - - public CurveSegment goback = new CurveSegment(EasingType.SineOut, 0f, 0.68f, -0.2f); - public CurveSegment goforwardfast = new CurveSegment(EasingType.PolyIn, 0.33f, 0.58f, 0.7f, 3); - public CurveSegment gobounce = new CurveSegment(EasingType.Linear, 0.6f, 1.28f, 0f); - public CurveSegment gobackagain = new CurveSegment(EasingType.SineOut, 0.86f, 1.28f, -0.2f); - internal float UpThrustDisplacement => PiecewiseAnimation(UpThrustProgress, new CurveSegment[] { goback, goforwardfast, gobounce, gobackagain }); - - #endregion - - #region General calculations - public enum AttackState { ForwardThrust, RunAttack, UpwardsThrust }; - public AttackState CurrentAttackState => (RunBroken && !FullyRunning) ? AttackState.ForwardThrust : (RunBroken || RunTimer > MaxRunTime) ? AttackState.UpwardsThrust : AttackState.RunAttack; - - //Gets the proper rotation based on the current state of the spear - public float AppropriateRotation - { - get - { - //If the player isn't fully running yet, we just don't care about the actual attack, and have them have the default thrust rotation - if (!FullyRunning) - return ThrustRotation; - - if (CurrentAttackState == AttackState.RunAttack) - return RunAttackRotation; - - if (CurrentAttackState == AttackState.UpwardsThrust) - return UpThrustRotation; - - return ThrustRotation; - } - } - - //Gets the proper displacement based on the state of the spear - public float AppropriateDisplacement - { - get - { - //If the player isn't fully running yet, we just don't care about the actual attack, and have them have the default thrust rotation - if (!FullyRunning) - return Displacement; - - //If the player is running, make them keep the lance a bit behind as they run - if (CurrentAttackState == AttackState.RunAttack) - return MathHelper.Lerp(0.93f, 0.68f, Math.Clamp(RunTimer / 30f, 0f, 1f)); - - if (CurrentAttackState == AttackState.UpwardsThrust) - return UpThrustDisplacement; - - return Displacement; - } - } - #endregion - - public override void SetDefaults() - { - Projectile.width = 56; - Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. - Projectile.timeLeft = Lifetime; - Projectile.height = 56; - Projectile.friendly = true; - Projectile.hostile = false; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.ownerHitCheck = true; - } - - public override bool ShouldUpdatePosition() - { - return false; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float collisionPoint = 0f; - float bladeLength = 85 * Projectile.scale; - float bladeWidth = 20 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + AppropriateRotation.ToRotationVector2() * bladeLength * -0.5f, Projectile.Center + ThrustRotation.ToRotationVector2() * bladeLength * 0.5f, bladeWidth, ref collisionPoint); - } - - public override void AI() - { - UpThrustLifetime = 20; - - - //If the player starts the attack without being able to do a run attack, mark the run as "broken" from the start. - if (Projectile.timeLeft == Lifetime && RunTimer == 0 && !CanStartRunAttack) - { - RunBroken = true; - } - - if (CurrentAttackState == AttackState.RunAttack) - { - Owner.GetModPlayer().ChargingKnockbackResist = true; - - //Keep the projectile alive during the run attack. - //The fullyRunning check is important, because the animation timer relies on the projectiles time left for the startup animation. - if (FullyRunning) - Projectile.timeLeft++; - - else - //We never actually use Projectile.rotation to draw or do any collision calculations. - //Instead, we use it to keep track of the final rotation of the spear BEFORE it was fully running - //We proceed to use this value to smooth the transition between the start of the thrust animation with the run animation. - Projectile.rotation = AppropriateRotation; - - //If at any point of the run attack, something happens to interrupt it, break the run and transition back into a forward or upwards thrust, depending on how long the player ran. - if (!CanRunAttack) - { - RunBroken = true; - //If the player was running for long enough, allow them to do a thrust attack. For this, we change the animation timer. - if (FullyRunning) - { - Projectile.timeLeft = UpThrustLifetime; - } - } - - ActiveSound soundOut; - if (!SoundEngine.TryGetActiveSound(ChargeWindSoundSlot, out soundOut) || !soundOut.IsPlaying) - ChargeWindSoundSlot = SoundEngine.PlaySound(SoundID.DD2_BookStaffTwisterLoop with { IsLooped = true, Volume = SoundID.DD2_BookStaffTwisterLoop.Volume * 0.7f }, Projectile.Center); - - else - { - soundOut.Volume = MathHelper.Lerp(0f, SoundID.DD2_BookStaffTwisterLoop.Volume * 0.7f, Math.Clamp(RunTimer / 120f, 0f, 1f)); - soundOut.Position = Projectile.Center; - } - - RunTimer++; - - if (Main.rand.NextBool()) - { - int dustOpacity = Main.rand.Next(80); - float dustScale = Main.rand.NextFloat(1f, 1.4f); - Vector2 dustVelocity = (AppropriateRotation + MathHelper.Pi).ToRotationVector2().RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(0.5f, 5f); - Dust dust = Dust.NewDustPerfect(Projectile.Center + AppropriateRotation.ToRotationVector2() * 40f, 16, dustVelocity, Alpha: dustOpacity, Scale: dustScale); - } - } - - //Basic spear attack - else if (CurrentAttackState == AttackState.ForwardThrust) - { - if (ThrustProgress == 0.5f) - SoundEngine.PlaySound(SoundID.DD2_JavelinThrowersAttack, Projectile.Center); - } - - else if (CurrentAttackState == AttackState.UpwardsThrust) - { - ActiveSound soundOut; - - - if (SoundEngine.TryGetActiveSound(ChargeWindSoundSlot, out soundOut)) - { - soundOut.Volume *= 0.7f; - soundOut.Position = Projectile.Center; - if (soundOut.Volume < 0.2f) - soundOut.Stop(); - } - - if (ThrustProgress == 0.5f) - SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing, Projectile.Center); - } - - UpdateOwnerVars(); - Vector2 thrust = AppropriateRotation.ToRotationVector2() * (AppropriateDisplacement * 40f + 5f); - - //During the run anim, make the spear bob up and down. - if (CurrentAttackState == AttackState.RunAttack) - thrust -= Vector2.UnitY * 2f * MathHelper.Clamp(0.5f + 0.8f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f), 0f, 1f); - - Projectile.Center = Owner.MountedCenter + thrust; - } - - public void UpdateOwnerVars() - { - Owner.ChangeDir(Math.Sign(BaseRotation.ToRotationVector2().X)); - Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, AppropriateRotation - MathHelper.PiOver2); - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; - - //Add more latency after an upwards thrust, for impact purposes - if (CurrentAttackState == AttackState.UpwardsThrust) - { - Owner.itemTime = 20; - Owner.itemAnimation = 20; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - //Send the enemy flying up if hit by the upwards thrust. - if (CurrentAttackState == AttackState.UpwardsThrust) - { - target.velocity.Y -= 12 * (float)Math.Sqrt(target.knockBackResist); - target.FlungNPC().ApplyCollisionDamage(target, 50, Vector2.Zero, 5f); - } - - target.AddBuff(BuffID.Poisoned, 180); - - if (CurrentAttackState == AttackState.RunAttack) - { - // 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) - { - //Boost the knockback during the run attack - if (CurrentAttackState == AttackState.RunAttack) - modifiers.Knockback *= 1.35f; - } - - public override bool PreDraw(ref Color lightColor) - { - 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/RedtideSpearProjectile.png b/Projectiles/Melee/Spears/RedtideSpearProjectile.png deleted file mode 100644 index b72059c817..0000000000 Binary files a/Projectiles/Melee/Spears/RedtideSpearProjectile.png and /dev/null differ diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index 49a36ff07b..ddefad369a 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -81,8 +81,9 @@ namespace CalamityMod.Projectiles.Melee.Spears // Create portals near the mouse once charged. if (Main.myPlayer == Projectile.owner && Time >= StreamGouge.SpinTime + StreamGouge.SpearFireTime && Time % 9f == 8f) { - Vector2 portalSpawnPosition = Main.MouseWorld + Main.rand.NextVector2Unit() * Main.rand.NextFloat(50f, 140f); - Vector2 spearVelocity = (Main.MouseWorld - portalSpawnPosition).SafeNormalize(Vector2.UnitY); + Vector2 mouse = Owner.ClampedMouseWorld(); + Vector2 portalSpawnPosition = mouse + Main.rand.NextVector2Unit() * Main.rand.NextFloat(50f, 140f); + Vector2 spearVelocity = (mouse - portalSpawnPosition).SafeNormalize(Vector2.UnitY); Projectile.NewProjectile(Projectile.GetSource_FromThis(), portalSpawnPosition, spearVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } @@ -146,7 +147,7 @@ namespace CalamityMod.Projectiles.Melee.Spears bool portalIsInteractable = portalOpacity >= 1f; Vector2 portalDrawPosition = Owner.Center + InitialDirection.ToRotationVector2() * 130f - Main.screenPosition; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (portalIsInteractable) { Main.spriteBatch.EnterShaderRegion(); diff --git a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs b/Projectiles/Melee/Spears/VanishingPointProjectile.cs similarity index 95% rename from Projectiles/Melee/Spears/ElementalLanceProjectile.cs rename to Projectiles/Melee/Spears/VanishingPointProjectile.cs index ddba5e6980..5b3b1b253b 100644 --- a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs +++ b/Projectiles/Melee/Spears/VanishingPointProjectile.cs @@ -10,9 +10,9 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { - public class ElementalLanceProjectile : BaseSpearProjectile + public class VanishingPointProjectile : BaseSpearProjectile { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override void SetDefaults() { diff --git a/Projectiles/Melee/Spears/ElementalLanceProjectile.png b/Projectiles/Melee/Spears/VanishingPointProjectile.png similarity index 100% rename from Projectiles/Melee/Spears/ElementalLanceProjectile.png rename to Projectiles/Melee/Spears/VanishingPointProjectile.png diff --git a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs index 014132bc87..b2348aa66c 100644 --- a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs +++ b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 127, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); Vector2 goreVec = Projectile.Center + Projectile.velocity; - if (Main.rand.NextBool(8) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(8) && !Main.dedServ) { int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), goreVec, default, Main.rand.Next(375, 378), 1f); Main.gore[smoke].behindTiles = true; diff --git a/Projectiles/Melee/StarburstBeam.cs b/Projectiles/Melee/StarburstBeam.cs index 33eb2304d6..788aa3c149 100644 --- a/Projectiles/Melee/StarburstBeam.cs +++ b/Projectiles/Melee/StarburstBeam.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Melee public class StarburstBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; diff --git a/Projectiles/Melee/StarburstSHIV.cs b/Projectiles/Melee/StarburstSHIV.cs index 47059fd832..6bdbcae1a7 100644 --- a/Projectiles/Melee/StarburstSHIV.cs +++ b/Projectiles/Melee/StarburstSHIV.cs @@ -9,8 +9,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 85) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index 305f72a60a..69151c2493 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/StarofJudgement.cs b/Projectiles/Melee/StarofJudgement.cs new file mode 100644 index 0000000000..7d8e9fb74c --- /dev/null +++ b/Projectiles/Melee/StarofJudgement.cs @@ -0,0 +1,125 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using CalamityMod.Particles; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using System; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Melee +{ + public class StarofJudgement : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Melee/StarofJudgement"; + public ref float time => ref Projectile.ai[0]; + public Color mainColor; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 44; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + if (time == 0) + { + Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + if (Projectile.ai[2] == 1) + { + Projectile.localNPCHitCooldown = 7; + Projectile.penetrate = 4; + } + } + Projectile.rotation += (Projectile.velocity.X + MathF.Abs(Projectile.velocity.Y) * Projectile.direction) * 0.01f; + + if (Projectile.ai[2] == 1) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30)); + if (Main.rand.NextBool(4) && Projectile.numHits < 1) + { + Particle spark = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(7, 7) - Projectile.velocity, -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f), false, 13, 1f, mainColor * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + else if (time > 15) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 700f * (Projectile.numHits > 1 ? 2 : 1), 20, 20f * (Projectile.numHits > 1 ? 5 : 1)); + if (Main.rand.NextBool(3)) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66); + trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); + trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + trailDust.noGravity = true; + } + } + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/StarofJudgement").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Color.Lerp(mainColor, Color.White, 0.2f) with { A = 0 }; + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], drawColor * 0.5f, 1, texture, true, true); + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int buffType = Projectile.ai[2] == 1f ? ModContent.BuffType() : ModContent.BuffType(); + target.AddBuff(buffType, 60); + + if (Projectile.ai[2] == 0) + { + Projectile.timeLeft = 180; + time = 0; + Projectile.velocity *= 1.2f; + } + } + public override void OnKill(int timeLeft) + { + if (Projectile.ai[2] == 1) + { + int points = 5; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f).RotatedByRandom(100)); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Particle spark = new PointParticle((Projectile.Center + velocity * 7.5f), velocity * 5.5f, false, 9, 1.2f, mainColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + else + { + for (int k = 0; k < 3; k++) + { + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(4, 4).RotatedByRandom(100f) * Main.rand.NextFloat(0.3f, 0.8f), false, 15, Main.rand.NextFloat(0.6f, 0.95f), mainColor); + GeneralParticleHandler.SpawnParticle(orb); + } + } + } + } +} diff --git a/Projectiles/Melee/StarofJudgement.png b/Projectiles/Melee/StarofJudgement.png new file mode 100644 index 0000000000..d11469686b Binary files /dev/null and b/Projectiles/Melee/StarofJudgement.png differ diff --git a/Projectiles/Melee/StellarContemptBlast.cs b/Projectiles/Melee/StellarContemptBlast.cs index 819d4aaaf6..7533d37dca 100644 --- a/Projectiles/Melee/StellarContemptBlast.cs +++ b/Projectiles/Melee/StellarContemptBlast.cs @@ -1,9 +1,6 @@ -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.Melee @@ -29,7 +26,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 240); + float minMult = 0.15f; + int hitsToMinMult = 12; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + { + Projectile.numHits -= 1; + } + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } } diff --git a/Projectiles/Melee/StellarContemptEcho.cs b/Projectiles/Melee/StellarContemptEcho.cs index 8532df4598..f13e8eb5ca 100644 --- a/Projectiles/Melee/StellarContemptEcho.cs +++ b/Projectiles/Melee/StellarContemptEcho.cs @@ -1,5 +1,6 @@ -using System; -using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -17,14 +18,15 @@ namespace CalamityMod.Projectiles.Melee public float rotatehammer = 35f; public int ColorAlpha = 225; public float speed = 0f; + public NPC targeted; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 0; } - // This is all copied straight from PwnagehammerEcho with some minor edits. public override void SetDefaults() { Projectile.width = 74; @@ -32,21 +34,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.aiStyle = 0; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(64, 224, 208, ColorAlpha); - } - public override void AI() { - Projectile.scale = 1.8f; - ColorAlpha -= 4; rotatehammer--; Projectile.rotation += MathHelper.ToRadians(rotatehammer) * Projectile.direction; @@ -56,51 +51,59 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= 0.95f; Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0]; } - else if (Projectile.ai[0] > 42f) + else if (Projectile.ai[0] >= 42f) { - Projectile.extraUpdates = 1; - if (Projectile.ai[1] < 0f) + Projectile.extraUpdates = 5; + if (Projectile.ai[1] != -5) + targeted = Main.npc[(int)Projectile.ai[1]]; + if (targeted == null || !targeted.CanBeChasedBy(Projectile, false) || !targeted.active) { - CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 2000f, speed, 12f); - if (Projectile.ai[0] > 80f) - Projectile.Kill(); - return; + Projectile.ai[1] = -5; + targeted = Projectile.Center.ClosestNPCAt(2000); } - - NPC target = Main.npc[(int)Projectile.ai[1]]; - if (!target.CanBeChasedBy(Projectile, false) || !target.active) + if (targeted != null) { - Projectile.Kill(); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.65f, 25, 0.98f); } else + Projectile.Kill(); + + if (Main.rand.NextBool(6)) { - float velConst = 7f; - velConst--; - Projectile.velocity = new Vector2((target.Center.X - Projectile.Center.X) / velConst, (target.Center.Y - Projectile.Center.Y) / velConst); - Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0]; + 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.Center.X, Projectile.Center.Y) + offset, ModContent.DustType(), new Vector2(Projectile.velocity.X * 0.5f + velOffset.X, Projectile.velocity.Y * 0.5f + velOffset.Y)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.5f, 1.9f); + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; + } + } + if (Projectile.ai[0] == 42f && targeted != null) + { + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, ((targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX) * 25).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.9f); + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; } } - - if (Main.rand.NextBool()) + for (int i = 0; i < 2; i++) { - 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.Center.X, Projectile.Center.Y) + offset, DustID.Terragrim, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100); + Vector2 offset = new Vector2(0, -30).RotatedBy(-MathHelper.PiOver4 * 0.5f).RotatedBy(Projectile.rotation); + Vector2 velOffset = new Vector2(0, -5).RotatedBy(-MathHelper.PiOver4).RotatedBy(Projectile.rotation) * Main.rand.NextFloat(0.5f, 1f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset + Main.rand.NextVector2Circular(6, 6), Main.rand.NextBool(3) ? 278 : ModContent.DustType(), velOffset); dust.noGravity = true; - dust.scale = Main.rand.NextFloat(2.2f, 3.6f); - } - - if (Main.rand.NextBool(6)) - { - 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.Center.X, Projectile.Center.Y) + offset, DustID.Vortex, new Vector2(Projectile.velocity.X * 0.5f + velOffset.X, Projectile.velocity.Y * 0.5f + velOffset.Y), 100); - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(2.2f, 3.6f); + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; } } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (targeted != null && target != targeted) + modifiers.SourceDamage *= 0.3f; + } public override bool? CanHitNPC(NPC target) { if (Projectile.ai[0] <= 42f) @@ -108,12 +111,11 @@ namespace CalamityMod.Projectiles.Melee return null; } - - public override bool CanHitPvp(Player target) => Projectile.ai[0] > 42f; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.localAI[0] = target.whoAmI; + target.AddBuff(ModContent.BuffType(), 180); + if (target == targeted) + Projectile.Kill(); } public override bool PreKill(int timeLeft) @@ -133,48 +135,52 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < numberOfDusts; i++) { float rot = MathHelper.ToRadians(i * rotFactor); + float intensity = Main.rand.NextFloat(0.2f, 1f); 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, DustID.Vortex, velOffset.X, velOffset.Y); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity = velOffset; - Main.dust[dust].scale = 3.8f; + Vector2 velOffset = new Vector2(40.8f, 10.5f).RotatedBy(rot); + if (i % 2 == 0) + { + Particle orb = new CustomSpark(Projectile.Center + offset, velOffset * intensity * 0.7f, "CalamityMod/Particles/Sparkle", false, (int)(40 * intensity), intensity, Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise, new Vector2(1f, 2f), true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType(), velOffset); + dust.noGravity = true; + dust.velocity = velOffset * intensity; + dust.scale = Main.rand.NextFloat(2.1f, 2.8f) * intensity; + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; + } } - for (int i = 0; i < 88; ++i) + for (int i = 0; i < 40; ++i) { - // Pick a random type of dust. - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - dustID = 229; - break; - case 1: - case 2: - dustID = 156; - break; - default: - dustID = 156; - break; - } - + int dustID = ModContent.DustType(); // Choose a random speed and angle for the dust. - float dustSpeed = Main.rand.NextFloat(6.0f, 29.0f); - float angleRandom = 0.09f; + float dustSpeed = 45; + float intensity = Main.rand.NextFloat(0.5f, 1.5f); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + dustVel = dustVel.RotatedByRandom((1.5f - intensity) * 0.4f) * intensity; + // Pick a size for the dust particle. - float scale = Main.rand.NextFloat(2.2f, 4.8f); + float scale = Main.rand.NextFloat(2.8f, 3.5f) - intensity; // Actually spawn the dust. - int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = Projectile.Center; + Dust idx = Dust.NewDustPerfect(Projectile.Center, dustID, dustVel, 0, default, scale); + idx.noGravity = true; + idx.position = Projectile.Center; + idx.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; } + Particle pulse3 = new GlowSparkParticle(Projectile.Center + Projectile.velocity, Projectile.velocity * 2, false, 12, 0.17f, Color.Turquoise, new Vector2(2.5f, 0.7f), true, true, 0.85f); + GeneralParticleHandler.SpawnParticle(pulse3); + + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Turquoise, "CalamityMod/Particles/BloomRing", new Vector2(0.7f, 1), Projectile.velocity.ToRotation(), 0f, 3f, 25); + GeneralParticleHandler.SpawnParticle(bolt2); + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.PaleTurquoise, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1), Projectile.velocity.ToRotation(), 0f, 4f, 25); + GeneralParticleHandler.SpawnParticle(bolt3); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); return false; @@ -182,23 +188,11 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Turquoise with { A = 0 } * 0.5f, 1, texture, true, true); - 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; - - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - float rot = MathHelper.ToRadians(22.5f) * Math.Sign(Projectile.velocity.X); - Vector2 drawPos = Projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, Projectile.gfxOffY); - Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - Main.EntitySpriteDraw(texture, drawPos, new Rectangle?(), color, Projectile.rotation - i * rot, origin, Projectile.scale, spriteEffects, 0); - } - - return false; + Projectile.DrawProjectileWithBackglow(Color.Turquoise with { A = 0 }, Color.White, 12f * Utils.GetLerpValue(0, 42, Projectile.ai[0], true) , texture); + return true; } } } diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs index a75123933b..c46e2eb20a 100644 --- a/Projectiles/Melee/StellarContemptHammer.cs +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -18,22 +19,21 @@ namespace CalamityMod.Projectiles.Melee 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 ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().StellarHammer; public int returnhammer = 0; public int DustOnce = 1; - public float rotatehammer = 8f; - + public float rotatehammer = 15f; + public int time = 0; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 11; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 11; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { - Projectile.width = 62; - Projectile.height = 62; + Projectile.width = 74; + Projectile.height = 74; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.tileCollide = false; @@ -56,53 +56,19 @@ namespace CalamityMod.Projectiles.Melee if (returnhammer == 0) { - Projectile.velocity.X *= 0.981f; - Projectile.velocity.Y += 0.226f; + int falloffTime = 15; + if (time > falloffTime) + Projectile.velocity.X *= 0.967f; + if (Projectile.velocity.Y < 15 && time > falloffTime) + Projectile.velocity.Y += 0.426f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.98f; } if (returnhammer == 1) { if (EmpoweredHammer == 4) { - if (DustOnce == 1) - { - for (int i = 0; i < 20; ++i) - { - // Pick a random type of dust. - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - dustID = 229; - break; - case 1: - case 2: - dustID = 156; - break; - default: - dustID = 156; - break; - } - - // Choose a random speed and angle for the dust. - float dustSpeed = Main.rand.NextFloat(3.0f, 19.0f); - float angleRandom = 0.09f; - Vector2 dustVel = new Vector2(0.0f, dustSpeed * -1f); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the dust particle. - float scale = Main.rand.NextFloat(1.7f, 3.8f); - - // Actually spawn the dust. - int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = Projectile.Center; - } - - DustOnce = 0; - } - Projectile.velocity.X *= 0.281f; Projectile.velocity.Y -= 0.8f; rotatehammer++; @@ -125,7 +91,7 @@ namespace CalamityMod.Projectiles.Melee if (returnhammer == 2) { Projectile.extraUpdates = 2; - float returnSpeed = StellarContempt.Speed; + float returnSpeed = StellarContempt.Speed * 0.7f; float acceleration = 1.1f; Player owner = Main.player[Projectile.owner]; Vector2 playerCenter = owner.Center; @@ -172,10 +138,11 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 30; i++) { - Dust fire = Dust.NewDustPerfect(Projectile.Center, 156); + Dust fire = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); 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.04f); + fire.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; fire.noGravity = true; fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer; @@ -183,6 +150,7 @@ namespace CalamityMod.Projectiles.Melee fire = Dust.CloneDust(fire); fire.velocity = Main.rand.NextVector2Circular(3f, 3f); fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f); + fire.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; } Projectile.Kill(); @@ -193,10 +161,23 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.velocity.Y < 0f) { - Particle streak = new ManaDrainStreak(player, Main.rand.NextFloat(0.9f, 1.5f), Main.rand.NextVector2CircularEdge(2f, 2f) * Main.rand.NextFloat(85f, 335f), Main.rand.NextFloat(30f, 44f), Color.PaleTurquoise, Color.Turquoise, Main.rand.Next(15, 30), Projectile.Center); - GeneralParticleHandler.SpawnParticle(streak); + float fade = Utils.GetLerpValue(3, -10, Projectile.velocity.Y, true); + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f); + velOffset *= Main.rand.NextFloat(25, 45) * fade; + Particle energy = new SparkParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, 14, Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, Color.Turquoise); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, 278, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = Color.Turquoise; + dust.velocity += Projectile.velocity; + } + Projectile.velocity.Y += 0.6f; - Projectile.scale += 0.03f; } else { @@ -211,21 +192,15 @@ namespace CalamityMod.Projectiles.Melee } // Spawn dust as the hammer travels. - if (Main.rand.NextBool()) + if (Main.rand.NextBool(3)) { Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.UltraBrightTorch, new Vector2(Projectile.velocity.X * 0.3f + velOffset.X, Projectile.velocity.Y * 0.3f + velOffset.Y), 100); - dust.noGravity = true; - } - - if (Main.rand.NextBool(6)) - { - Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); - Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.UltraBrightTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100); + Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, ModContent.DustType(), new Vector2(Projectile.velocity.X * 0.3f + velOffset.X, Projectile.velocity.Y * 0.3f + velOffset.Y)); dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; } + time++; } // On hit play GONG and spawn dust. @@ -234,6 +209,8 @@ namespace CalamityMod.Projectiles.Melee Player player = Main.player[Projectile.owner]; if (returnhammer == 0) { + Projectile.ai[1] = target.whoAmI; + if (Main.zenithWorld) SoundEngine.PlaySound(UseSoundFunny with { Pitch = EmpoweredHammer * 0.1f - 0.1f }, Projectile.Center); else @@ -250,29 +227,37 @@ namespace CalamityMod.Projectiles.Melee returnhammer = 1; } - float numberOfDusts = 40f; + float numberOfDusts = MathHelper.Clamp(40 - Projectile.numHits * 5, 6, 40); float rotFactor = 360f / numberOfDusts; for (int i = 0; i < numberOfDusts; i++) { float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(4.8f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f)); Vector2 velOffset = new Vector2(4f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f)); - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 229, 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; + if (i % 3 == 0) + { + Particle orb = new CustomSpark(Projectile.Center + offset, velOffset * Main.rand.NextFloat(1f, 1.5f), "CalamityMod/Particles/Sparkle", false, 25, Main.rand.NextFloat(0.55f, 0.75f), Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise, new Vector2(1f, 2f), true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType(), new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset * Main.rand.NextFloat(0.75f, 1); + dust.scale = Main.rand.NextFloat(0.9f, 1.6f); + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; + } + } } 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; + target.AddBuff(ModContent.BuffType(), 90); + float minMult = 0.7f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } private void SpawnFlares(Vector2 targetPos, int width, int height) @@ -315,14 +300,17 @@ namespace CalamityMod.Projectiles.Melee { int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); if (proj.WithinBounds(Main.maxProjectiles)) + { Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; + Main.projectile[proj].tileCollide = false; + } } } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 3); return false; } } diff --git a/Projectiles/Melee/StellarStrikerGhost.png b/Projectiles/Melee/StellarStrikerGhost.png new file mode 100644 index 0000000000..62be8f6068 Binary files /dev/null and b/Projectiles/Melee/StellarStrikerGhost.png differ diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs new file mode 100644 index 0000000000..6b1346c954 --- /dev/null +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -0,0 +1,259 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; +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.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class StellarStrikerHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/StellarStriker"; + public override float HitboxOutset => 90; + + public override Vector2 HitboxSize => new Vector2(130, 130); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(0, 118); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public bool spawnBoom = true; + public bool finalFlip = false; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void WhenSpawned() + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = -1; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Stellar Striker's projectile spawning + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; + } + + public override void UseStyle() + { + AnimationProgress = Animation % useAnim; + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; + doSwing = true; + swingCount++; + spawnBoom = true; + finalFlip = false; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians((Owner.direction == -1 ? 0 : 120)), 0.1f); + + if (AnimationProgress < (useAnim / 3)) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + //Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = RotationOffset.AngleLerp(MathHelper.ToRadians(-45f * Projectile.ai[1] * Owner.direction), 0.2f); + } + else + { + if (!finalFlip) + { + FlipAsSword = Owner.direction < 0 ? true : false; + } + + float time = (AnimationProgress) - (useAnim / 8); + float timeMax = useAnim - (useAnim / 8); + + if (time == (int)(timeMax * 0.3f)) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/TerratomereSwing"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.65f, 0.75f) }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(fire2 with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.05f, 0.12f) }, Projectile.Center); + } + if ( time > (int)(timeMax * 0.25f) && time < (int)(timeMax * 0.85f)) + { + CanHit = true; + } + else + CanHit = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(-45f * Projectile.ai[1] * Owner.direction, 405f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.85f)) + postSwing = true; + } + if (CanHit) + { + for (int i = 0; i < 3; i++) + { + Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Particle orb = new CustomPulse(particlePos, -particleVel * Main.rand.NextFloat(1.1f, 3.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/Sparkle", new Vector2(2f, 1f), particleVel.ToRotation(), Main.rand.NextFloat(0.4f, 1.1f), 0.2f, 23); + GeneralParticleHandler.SpawnParticle(orb); + } + for (int i = 0; i < 4; i++) + { + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Particle spark2 = new GlowSparkParticle(Owner.Center + (new Vector2(140, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.4f)), -dustVel, false, 20, Main.rand.NextFloat(0.007f, 0.012f), Color.Turquoise, new Vector2(1.3f, 0.5f), true, false, Main.rand.NextFloat(0.5f, 0.7f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + else if (Main.rand.NextBool(3)) + { + Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + + Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f), 0.2f, 23); + GeneralParticleHandler.SpawnParticle(orb); + + //GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 23, Main.rand.NextFloat(0.2f, 0.6f), 0.65f, 0, true)); + } + Lighting.AddLight(Projectile.Center, Color.Turquoise.ToVector3() * fadeIn); + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + { + Projectile.numHits -= 1; + } + + SoundStyle fire = new("CalamityMod/Sounds/Item/CursedDaggerThrow"); + SoundEngine.PlaySound(fire with { Volume = 0.65f, Pitch = 0.7f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(fire2 with { Volume = 0.55f, Pitch = 0.6f }, Projectile.Center); + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 17, true); + + for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) + { + Dust dust2 = Dust.NewDustPerfect(target.Center, 278, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.4) * Main.rand.NextFloat(0.2f, 1f)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.95f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; + if (Main.rand.NextBool(4)) + { + Particle spark3 = new CustomSpark(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -24).RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/Sparkle", false, 35, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise, new Vector2(0.6f, 1.5f)); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + + if (spawnBoom) + { + Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2.25f), Projectile.knockBack, Projectile.owner, 0, 0, 7); + spawnBoom = false; + } + + target.AddBuff(ModContent.BuffType(), 500); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + + for (int i = 0; i < 25; i++) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/StellarStrikerGhost").Value; + Color auraColor = Color.Turquoise with { A = 0 } * 0.15f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 6 * fadeIn; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/StellarStrikerMeteor.cs b/Projectiles/Melee/StellarStrikerMeteor.cs new file mode 100644 index 0000000000..5b47d38907 --- /dev/null +++ b/Projectiles/Melee/StellarStrikerMeteor.cs @@ -0,0 +1,159 @@ +using System; +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.Melee +{ + public class StellarStrikerMeteor : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public ref float time => ref Projectile.ai[0]; + public Color mainColor = Color.Turquoise; + public int fallTime = 60; + public bool spawnMet = true; + public int direction = 1; + public float wavePower = 7; + public NPC chosenTarget; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + public override void SetDefaults() + { + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.timeLeft = 800; + Projectile.penetrate = 1; + 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); + + if (time % 5 == 0 && Projectile.extraUpdates < 12) + Projectile.extraUpdates ++; + if (time == 0) + { + chosenTarget = Owner.ClampedMouseWorld().ClosestNPCAt(700); + if (chosenTarget != null) + Projectile.velocity = (chosenTarget.Center - Projectile.Center + chosenTarget.velocity * 8).SafeNormalize(Vector2.UnitX) * 3; + else + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 3; + } + } + if (Projectile.numHits < 1) + { + if (chosenTarget == null || chosenTarget.life <= 0) + chosenTarget = Owner.ClampedMouseWorld().ClosestNPCAt(700); + CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 0.09f, 5, 0.99f, accelerate: true); + } + + if (targetDist < 1400f) + { + if (time % 11 == 0) + { + GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * 2, false, 11, 0.03f, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); + GeneralParticleHandler.SpawnParticle(orb); + } + if (time % 4 == 0) + { + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 6, Main.rand.NextFloat(0.3f, 0.7f), 0.65f, 0, true)); + } + } + if (time % 2 == 0) + { + // 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 * wavePower; + + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset * direction, 267, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.3f)); + dust.scale = Main.rand.NextFloat(0.85f, 0.95f); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + time++; + + if (time == 20 && spawnMet && Projectile.ai[2] > 0) + { + spawnMet = false; + Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1, tex); + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.2f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnKill(int timeLeft) + { + Player Owner = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + + if (Projectile.ai[2] > 0 && spawnMet) + { + Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + } + + if (Projectile.owner == Main.myPlayer) + { + Projectile.damage = (int)(Projectile.damage * 0.3f); + Projectile.ExpandHitboxBy((int)(285f * Projectile.scale)); + Projectile.penetrate = -1; + Projectile.Damage(); + } + for (int i = 0; i < 6; i++) + { + Particle spark3 = new SparkParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 14), false, 20, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(5) ? Color.PaleTurquoise : Color.Turquoise); + GeneralParticleHandler.SpawnParticle(spark3); + } + for (int i = 0; i < 18; i++) + { + Dust c = Dust.NewDustPerfect(Projectile.Center, 267); + c.velocity = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 10f + Owner.velocity * 0.5f; + c.scale = Main.rand.NextFloat(0.8f, 0.9f); + c.noGravity = true; + c.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; + } + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.3f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Melee/StellarStrikerMeteor.png b/Projectiles/Melee/StellarStrikerMeteor.png new file mode 100644 index 0000000000..85ede611fc Binary files /dev/null and b/Projectiles/Melee/StellarStrikerMeteor.png differ diff --git a/Projectiles/Melee/StormBeam.cs b/Projectiles/Melee/StormBeam.cs index 5ec35d486f..0d8723c6a6 100644 --- a/Projectiles/Melee/StormBeam.cs +++ b/Projectiles/Melee/StormBeam.cs @@ -10,8 +10,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -45,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/StormMark.cs b/Projectiles/Melee/StormMark.cs index c2ce3af1f8..23dbddc32c 100644 --- a/Projectiles/Melee/StormMark.cs +++ b/Projectiles/Melee/StormMark.cs @@ -138,8 +138,8 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle rectangl = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture2D27 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle rectangl = texture2D27.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Color alphaColor = Projectile.GetAlpha(originalColor); Vector2 halfRect = rectangl.Size() / 2f; Color whiteColor = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); diff --git a/Projectiles/Melee/StormRulerProj.cs b/Projectiles/Melee/StormRulerProj.cs index 307aca13a6..337f994549 100644 --- a/Projectiles/Melee/StormRulerProj.cs +++ b/Projectiles/Melee/StormRulerProj.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/StreamGougePortal.cs b/Projectiles/Melee/StreamGougePortal.cs index 12c3f98945..f2eb585a16 100644 --- a/Projectiles/Melee/StreamGougePortal.cs +++ b/Projectiles/Melee/StreamGougePortal.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 300); SoundEngine.PlaySound(SoundID.Item74, target.Center); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Color impactColor = Color.Lerp(Color.Cyan, Color.White, Main.rand.NextFloat(0.3f, 0.64f)); diff --git a/Projectiles/Melee/StygianShieldAttack.cs b/Projectiles/Melee/StygianShieldAttack.cs index 2293e3eb0e..ed2b80decf 100644 --- a/Projectiles/Melee/StygianShieldAttack.cs +++ b/Projectiles/Melee/StygianShieldAttack.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -110,6 +110,7 @@ namespace CalamityMod.Projectiles.Melee // Perform the dash if able to if (Charge >= MinChargeTime && !Owner.noItems && !Owner.CCed) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // Set the destination in which the dash is supposed to be Vector2 intendedDestination = Projectile.Center + Projectile.SafeDirectionTo(Owner.Calamity().mouseWorld) * MaxChargeDistance * Charge / MaxChargeTime; @@ -189,7 +190,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { // Textures and general use stuff - Texture2D mainTex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D mainTex = Terraria.GameContent.TextureAssets.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; @@ -269,6 +270,7 @@ namespace CalamityMod.Projectiles.Melee // Charge sight line if (Charge >= MinChargeTime) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // Where the dash is supposed to take you, taken from above Vector2 dashLength = Projectile.SafeDirectionTo(Owner.Calamity().mouseWorld) * MaxChargeDistance * Charge / MaxChargeTime; Vector2 intendedDestination = Projectile.Center + dashLength; diff --git a/Projectiles/Melee/StygianShieldThrown.cs b/Projectiles/Melee/StygianShieldThrown.cs index 3ee45d065b..c786c5a669 100644 --- a/Projectiles/Melee/StygianShieldThrown.cs +++ b/Projectiles/Melee/StygianShieldThrown.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = (int)TotalTrailLength; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = (int)TotalTrailLength; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Melee/SwordsplosionBlue.cs b/Projectiles/Melee/SwordsplosionBlue.cs index a914389a7b..b7678895ef 100644 --- a/Projectiles/Melee/SwordsplosionBlue.cs +++ b/Projectiles/Melee/SwordsplosionBlue.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 195) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/SwordsplosionGreen.cs b/Projectiles/Melee/SwordsplosionGreen.cs index c92125967f..3ca4b3ffff 100644 --- a/Projectiles/Melee/SwordsplosionGreen.cs +++ b/Projectiles/Melee/SwordsplosionGreen.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 295) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/SwordsplosionPurple.cs b/Projectiles/Melee/SwordsplosionPurple.cs index 3763256b22..bb39cca1c7 100644 --- a/Projectiles/Melee/SwordsplosionPurple.cs +++ b/Projectiles/Melee/SwordsplosionPurple.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 295) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/SwordsplosionRed.cs b/Projectiles/Melee/SwordsplosionRed.cs index 1b5a77cb25..dac1a1a59e 100644 --- a/Projectiles/Melee/SwordsplosionRed.cs +++ b/Projectiles/Melee/SwordsplosionRed.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 195) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index 4bc31dba95..c17cd585cf 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -106,8 +106,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 70; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 70; } public override void SetDefaults() @@ -120,6 +120,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 90000; Projectile.usesLocalNPCImmunity = true; Projectile.noEnchantmentVisuals = true; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(VerticalOffset); diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs index e9f30041da..2d717a89c9 100644 --- a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.timeLeft == 300) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/TenebreusTidesWaterSpear.cs b/Projectiles/Melee/TenebreusTidesWaterSpear.cs index da2fbddebb..97a536f5f8 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSpear.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSpear.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -205,8 +205,8 @@ namespace CalamityMod.Projectiles.Melee { if (dontDraw) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Melee/TenebreusTidesWaterSword.cs b/Projectiles/Melee/TenebreusTidesWaterSword.cs index 8eeca5bc8d..272ea31e28 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSword.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSword.cs @@ -187,7 +187,7 @@ namespace CalamityMod.Projectiles.Melee { if (dontDraw) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/TerratomereExplosion.cs b/Projectiles/Melee/TerratomereExplosion.cs index 6082d67ae7..09d1b72d13 100644 --- a/Projectiles/Melee/TerratomereExplosion.cs +++ b/Projectiles/Melee/TerratomereExplosion.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee public void AdditiveDraw(SpriteBatch spriteBatch) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 95ff843ca5..4be39fcdda 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -160,6 +160,7 @@ namespace CalamityMod.Projectiles.Melee bool createBeams = Time == (int)(Terratomere.SwingTime * RecoveryCompletionRatio) + 5f; if (Main.myPlayer == Projectile.owner && Time == (int)(Terratomere.SwingTime * (SwingCompletionRatio + 0.34f))) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 bigSlashVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Owner.ActiveItem().shootSpeed / 2f; if (bigSlashVelocity.AngleBetween(InitialRotation.ToRotationVector2()) > 1.456f) bigSlashVelocity = InitialRotation.ToRotationVector2() * bigSlashVelocity.Length(); @@ -254,7 +255,7 @@ namespace CalamityMod.Projectiles.Melee public void DrawBlade(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * Vector2.UnitY; if (Projectile.spriteDirection == -1) @@ -283,7 +284,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); diff --git a/Projectiles/Melee/TerratomereMeleeSlash.cs b/Projectiles/Melee/TerratomereMeleeSlash.cs index 1f95774c5f..3445abe5ee 100644 --- a/Projectiles/Melee/TerratomereMeleeSlash.cs +++ b/Projectiles/Melee/TerratomereMeleeSlash.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.Opacity = Utils.GetLerpValue(0f, 26f, Projectile.timeLeft, true); Projectile.velocity *= 0.91f; Projectile.scale *= 1.01f; @@ -61,6 +62,6 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); } } diff --git a/Projectiles/Melee/TerratomereSlash.cs b/Projectiles/Melee/TerratomereSlash.cs index 56677a094d..fa00458626 100644 --- a/Projectiles/Melee/TerratomereSlash.cs +++ b/Projectiles/Melee/TerratomereSlash.cs @@ -42,10 +42,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - return Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public override bool ShouldUpdatePosition() => true; diff --git a/Projectiles/Melee/TerratomereSwordBeam.cs b/Projectiles/Melee/TerratomereSwordBeam.cs index 1343fe2c9f..ae999701c0 100644 --- a/Projectiles/Melee/TerratomereSwordBeam.cs +++ b/Projectiles/Melee/TerratomereSwordBeam.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = Terratomere.SlashLifetime + 1; } diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index 3dadc5c1ea..1f00829413 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/ThornBase.cs b/Projectiles/Melee/ThornBase.cs index 637585167f..3c82181917 100644 --- a/Projectiles/Melee/ThornBase.cs +++ b/Projectiles/Melee/ThornBase.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee // Draw the tip for the final thorn public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Projectile.ai[0] == TotalSegments) texture = ModContent.Request("CalamityMod/Projectiles/Melee/ThornTip").Value; diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index 325ec784cf..09b459f960 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Melee public class TinyFlare : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 6; @@ -25,9 +26,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 2; i++) { - int fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 100, default, Main.rand.NextFloat(1.5f, 2.5f)); + int fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 100, default, Main.rand.NextFloat(1f, 1.5f)); Main.dust[fiery].noGravity = true; Main.dust[fiery].velocity *= 0f; } @@ -36,9 +37,6 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 10f, 20f); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire3, 90); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire3, 90); } } diff --git a/Projectiles/Melee/Tornado.cs b/Projectiles/Melee/Tornado.cs index e1c3021502..cd8fb99aaf 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -172,7 +172,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2D23 = Terraria.GameContent.TextureAssets.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/TriactisHammerEcho.png b/Projectiles/Melee/TriactisHammerEcho.png new file mode 100644 index 0000000000..82b8f21a72 Binary files /dev/null and b/Projectiles/Melee/TriactisHammerEcho.png differ diff --git a/Projectiles/Melee/TriactisHammerExplosion.cs b/Projectiles/Melee/TriactisHammerExplosion.cs new file mode 100644 index 0000000000..af160569b0 --- /dev/null +++ b/Projectiles/Melee/TriactisHammerExplosion.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +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; + +namespace CalamityMod.Projectiles.Melee +{ + public class TriactisHammerExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float Timer => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + + public List> crackTrails = new List>(); + public static int crackCount = 15; + public static int totalPoints = 12; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Timer == 0f) + { + float rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + Particle blastR = new CustomPulse(Projectile.Center, Vector2.Zero, TriactisHammerFlare.GetColor(1f) * 0.7f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, rotation, 0f, 0.8f, 30); + GeneralParticleHandler.SpawnParticle(blastR); + Particle blastG = new CustomPulse(Projectile.Center, Vector2.Zero, TriactisHammerFlare.GetColor(2f) * 0.7f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, rotation + MathHelper.ToRadians(120f), 0f, 0.6f, 27); + GeneralParticleHandler.SpawnParticle(blastG); + Particle blastB = new CustomPulse(Projectile.Center, Vector2.Zero, TriactisHammerFlare.GetColor(3f) * 0.7f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, rotation + MathHelper.ToRadians(240f), 0f, 0.4f, 24); + GeneralParticleHandler.SpawnParticle(blastB); + Owner.Calamity().GeneralScreenShakePower = 40; + } + + if (Timer % 4f == 0f) + { + crackTrails.Clear(); + for (int i = 0; i < crackCount; i++) + { + List points = new List(); + for (int j = 0; j < totalPoints; j++) + { + float radians = MathHelper.TwoPi / crackCount; + if (j == 0) + points.Add(Projectile.Center + Main.rand.NextVector2Circular(30, 30)); + else + { + Vector2 newPoint = new Vector2(); + Vector2 jtolookfor = j > 1 ? points[j - 2] : Projectile.Center; + float baseDist = j == totalPoints - 1 ? 20 : Main.rand.Next(60, 120) * (1 + (20 - Projectile.timeLeft) / 15); + newPoint = points[j - 1] + (jtolookfor.DirectionTo(points[j - 1]) * baseDist).RotatedByRandom(MathHelper.PiOver2); + points.Add(newPoint); + } + } + crackTrails.Add(points); + } + } + Timer++; + + for (int l = 0; l < 3; l++) + { + Particle spark = new GlowSparkParticle(Projectile.Center, Vector2.One.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(18f, 60f), true, 15, Main.rand.NextFloat(0.02f, 0.05f), TriactisHammerFlare.GetColor(1f + Main.rand.Next(3)), new Vector2(3f, 1f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 640f, targetHitbox); + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + + internal float WidthFunction(float completionRatio) => MathHelper.Clamp(CalamityUtils.Convert01To010(completionRatio * 2), 0.2f, 1f) * 4f; + internal Color ColorFunction(float completionRatio) => Color.White; + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 2f; + internal Color BackgroundColorFunction(float completionRatio) => ColorFunction(completionRatio) * 0.5f; + + public override bool PreDraw(ref Color lightColor) + { + if (crackTrails.Count <= 0) + return false; + + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + GameShaders.Misc["CalamityMod:TeslaTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); + foreach (List points in crackTrails) + { + PrimitiveRenderer.RenderTrail(points, new(WidthFunction, ColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:TeslaTrail"]), 60); + PrimitiveRenderer.RenderTrail(points, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:TeslaTrail"]), 60); + } + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Melee/TriactisHammerFlare.cs b/Projectiles/Melee/TriactisHammerFlare.cs new file mode 100644 index 0000000000..e12aebdd45 --- /dev/null +++ b/Projectiles/Melee/TriactisHammerFlare.cs @@ -0,0 +1,153 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TriactisHammerFlare : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/ExtraTextures/TinyGreyscaleCircle"; + + public ref float FlareType => ref Projectile.ai[0]; + public ref float Target => ref Projectile.ai[1]; + public ref float OrbitRadius => ref Projectile.ai[2]; // Repurposed for target once transformed + public Player Owner => Main.player[Projectile.owner]; + + public static Asset Sparkle; + public static Asset Bloom; + public override void Load() + { + Sparkle = ModContent.Request("CalamityMod/Particles/Sparkle"); + Bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); + } + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 16; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + } + + public override void AI() + { + if (Owner.dead || !Owner.active) + { + Projectile.Kill(); + return; + } + + Projectile.timeLeft = 2; + float rotation = Main.GlobalTimeWrappedHourly * 2f + MathHelper.ToRadians(120f) * FlareType; + + // Transform into smashy hammers + if (Target == -2f) + { + Projectile hammer = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, FlareType, OrbitRadius); + hammer.scale = 0f; + Projectile.Kill(); + return; + } + // Orbit around the player + else if (!Main.npc.IndexInRange((int)Target)) + Projectile.Center = Owner.MountedCenter + Vector2.UnitX.RotatedBy(rotation) * 96f; + // Orbit around the enemies + else + { + NPC enemy = Main.npc[(int)Target]; + // Relocate to the player and spawn teleporting particles if said target cannot be stuck on + if (enemy is null || enemy.life <= 0 || !enemy.active || enemy.dontTakeDamage || enemy.immortal) + { + Target = -1f; + Projectile.netUpdate = true; + for (int i = 0; i < 5; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(6f, 10f); + Particle sparkle = new CritSpark(Projectile.Center, velocity, Color.White, GetColor(FlareType), 1f, 24, 0.1f, 2.4f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + return; + } + + OrbitRadius = MathHelper.Clamp(MathF.Max(enemy.width, enemy.height) + 64f, 64f, 400f); + Projectile.Center = enemy.Center + Vector2.UnitX.RotatedBy(rotation) * OrbitRadius; + } + + // Dust trail + if (Main.rand.NextBool(3)) + { + Dust trail = Dust.QuickDust(Projectile.Center, GetColor(FlareType)); + trail.position += Main.rand.NextVector2Unit() * Main.rand.NextFloat(0f, 8f); + } + } + + // Hue-shifted version of the base colours + public static Color GetColor(float type) + { + if (type == 3f) + { + Vector3 blue = Main.rgbToHsl(new Color(117, 170, 239)); + return Main.hslToRgb(blue.X + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), blue.Y, blue.Z); + } + if (type == 2f) + { + Vector3 green = Main.rgbToHsl(new Color(132, 225, 26)); + return Main.hslToRgb(green.X + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), green.Y, green.Z); + } + Vector3 red = Main.rgbToHsl(Color.Red); + return Main.hslToRgb(red.X + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), red.Y, red.Z); + } + + public override Color? GetAlpha(Color lightColor) => GetColor(FlareType); + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + + Texture2D sparkleTex = Sparkle.Value; + Texture2D bloomTex = Bloom.Value; + float bloomScale = (float)sparkleTex.Height / (float)bloomTex.Height; + float sparkleScale = 0.7f + CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly % 2f) / 2f) * 0.2f; + + Color color = Projectile.GetAlpha(lightColor); + float rotation = Main.GlobalTimeWrappedHourly * 8f; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + Main.EntitySpriteDraw(bloomTex, drawPos, null, color * 0.5f, 0, bloomTex.Size() * 0.5f, 5f * bloomScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, Color.Lerp(color, Color.White, 0.7f), rotation, sparkleTex.Size() * 0.5f, 2.2f * sparkleScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, color, rotation + MathHelper.PiOver4, sparkleTex.Size() * 0.5f, 1.6f * sparkleScale, SpriteEffects.None); + + Texture2D texture = TextureAssets.Projectile[Type].Value; + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + float completionRatio = i / (float)Projectile.oldPos.Length; + Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + + // The further the smaller + Color trailColor = Color.Lerp(color, Color.Black, completionRatio); + float trailScale = MathHelper.Lerp(0.15f, 1f, 1f - completionRatio); + Main.EntitySpriteDraw(texture, trailPos, null, trailColor, 0f, texture.Size() * 0.5f, Projectile.scale * trailScale, SpriteEffects.None); + } + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs index 37c79c6c07..1c22309d4c 100644 --- a/Projectiles/Melee/TriactisHammerProj.cs +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -1,6 +1,9 @@ -using System; -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,153 +14,306 @@ namespace CalamityMod.Projectiles.Melee public class TriactisHammerProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight"; + + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.6f }; + public static readonly SoundStyle HitSoundGFB = new("CalamityMod/Sounds/Item/CalamityBell"); + public static readonly SoundStyle WindUpSound = new("CalamityMod/Sounds/Item/GalaxySmasherClone") { Volume = 0.9f }; + public static readonly SoundStyle SmashSound = new("CalamityMod/Sounds/Item/GalaxySmasherSmash") { Volume = 0.7f }; + public static readonly SoundStyle SmashSoundGFB = new("CalamityMod/Sounds/Item/TF2PanHit"); + + public static float ExplosionDamageKBMult = 2f; + public static float SuperHammerDamageMult = 3f; + public static float SmashHomingRange = 800f; // 50 tiles + public static float WindUpTime = 216f; // 1.2 seconds + public static float ConvergeTime = 18f; // 0.1 seconds + + public ref float AirTime => ref Projectile.ai[0]; + public ref float HammerState => ref Projectile.ai[1]; // R, G, B, Center + public ref float SmashTarget => ref Projectile.ai[2]; + public Player Owner => Main.player[Projectile.owner]; + public float OrbitRadius; + + public static Asset EchoHammer; + public override void Load() => EchoHammer = ModContent.Request("CalamityMod/Projectiles/Melee/TriactisHammerEcho"); public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { - Projectile.width = 160; - Projectile.height = 160; + Projectile.width = Projectile.height = 168; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.extraUpdates = 3; + Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0.75f); - if (Projectile.soundDelay == 0) + // Smashing hammers + if (HammerState > 0f) { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); - } - if (Projectile.ai[0] == 0f) - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 30f) + // Central spot (invisible) + if (HammerState == 4f) { - Projectile.ai[0] = 1f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; + // Target should already be set -- if not, retarget + NPC target = Main.npc[(int)SmashTarget]; + if (target is null || target.life <= 0 || !target.active || target.dontTakeDamage || target.immortal) + { + target = Projectile.Center.ClosestNPCAt(SmashHomingRange, bossPriority: true); + if (target != null) + SmashTarget = target.whoAmI; + } + + // Strongly locks onto the target center + // If there is no target, it would just rest there + if (target != null) + Projectile.Center = target.Center; + + // Explode when told to + if (AirTime == -1f) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * ExplosionDamageKBMult), Projectile.knockBack * ExplosionDamageKBMult, Projectile.owner); + SoundEngine.PlaySound(Main.zenithWorld ? SmashSoundGFB : SmashSound, Projectile.Center); + Projectile.Kill(); + return; + } + } + // Orbital RGB hammers + else + { + // Need the central spot to exist or they explode immediately + float rotation = Main.GlobalTimeWrappedHourly * 2f + MathHelper.ToRadians(120f) * HammerState; + Color currentColor = TriactisHammerFlare.GetColor(HammerState); + Projectile target = Main.projectile[(int)SmashTarget]; + if (target is null || !target.active) + { + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, currentColor, Vector2.One, 0f, 0.2f, 4f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + Projectile.Kill(); + return; + } + + // Initialize orbit radius + if (AirTime == 0f) + OrbitRadius = MathHelper.Clamp(Vector2.Distance(Projectile.Center, target.Center), 64f, 400f); + + // Move outwards for a bit + AirTime++; + if (AirTime < WindUpTime) + { + OrbitRadius = MathHelper.Lerp(OrbitRadius, 800f, 0.04f); + Projectile.Center = target.Center + Vector2.UnitX.RotatedBy(rotation) * OrbitRadius; + Projectile.rotation = Projectile.AngleFrom(target.Center) + MathHelper.PiOver4; + // Scales up to full size after a short portion of the animation time + Projectile.scale = Utils.GetLerpValue(0f, WindUpTime * 0.1f, AirTime, true); + + if (AirTime == 1f) + { + for (int i = 0; i < 6; i++) + { + Vector2 velocity = Vector2.UnitX.RotatedBy(rotation).RotatedByRandom(MathHelper.ToRadians(36f)) * Main.rand.NextFloat(10f, 30f); + float scale = Main.rand.NextFloat(0.8f, 1.5f); + Particle sparkle = new CritSpark(Projectile.Center, velocity, Color.White, currentColor, 1f * scale, 24, 0.1f, 2.5f * scale); + GeneralParticleHandler.SpawnParticle(sparkle); + } + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, currentColor, Vector2.One, 0f, 0.1f, 0.8f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + } + + if (OrbitRadius > 792f) + { + Particle streak = new ManaDrainStreak(Owner, Main.rand.NextFloat(0.6f, 1f), Main.rand.NextVector2Unit() * Main.rand.NextFloat(160f, 320f), 0f, currentColor, Projectile.GetAlpha(Color.White), Main.rand.Next(10, 20), Projectile.Center); + GeneralParticleHandler.SpawnParticle(streak); + if (AirTime % 18f == 0f) + { + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.GetAlpha(Color.White), Vector2.One, 0f, 0.2f, 2.5f, 12); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + } + // Then converge at the middle where the central spot is + else + { + OrbitRadius = MathHelper.Lerp(800f, 0f, (AirTime - WindUpTime) / ConvergeTime); + Projectile.Center = target.Center + Vector2.UnitX.RotatedBy(rotation) * OrbitRadius; + Projectile.rotation = Projectile.AngleTo(target.Center) + MathHelper.PiOver4; + + // Trigger the central spot to explode which then causes these hammers to explode too + if (Projectile.Hitbox.Intersects(target.Hitbox) || AirTime > WindUpTime + ConvergeTime) + target.ai[0] = -1f; + } } } + // Normal hammers + else if (HammerState == 0f) + { + AirTime++; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4 + Projectile.direction * MathHelper.ToRadians(2f) * AirTime; + Projectile.velocity.X *= 0.99f; + + if (Projectile.velocity.Y < 20f) + Projectile.velocity.Y += 0.2f; + + // Dust trail + Dust trail = Dust.NewDustPerfect(Projectile.Center, DustID.GoldFlame, Projectile.velocity * 0.3f); + trail.position += Main.rand.NextVector2Unit() * Main.rand.NextFloat(0f, 64f); + trail.noGravity = true; + + // Prevent the projectile from wreacking too much havoc off-screen + if (Vector2.Distance(Projectile.Center, Owner.MountedCenter) >= 2000f) + Projectile.Kill(); + } + // Returning hammers else { - Projectile.tileCollide = false; - float projVelModifier = 5f; - Vector2 projDirection = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); - float projXDist = Main.player[Projectile.owner].position.X + Main.player[Projectile.owner].width / 2 - projDirection.X; - float projYDist = Main.player[Projectile.owner].position.Y + Main.player[Projectile.owner].height / 2 - projDirection.Y; - float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); - if (projDistance > 3000f) - Projectile.Kill(); - projDistance = 20f / projDistance; - projXDist *= projDistance; - projYDist *= projDistance; - if (Projectile.velocity.X < projXDist) + // Slows down a little + if (AirTime < 30f) { - Projectile.velocity.X = Projectile.velocity.X + projVelModifier; - if (Projectile.velocity.X < 0f && projXDist > 0f) - Projectile.velocity.X = Projectile.velocity.X + projVelModifier; + AirTime++; + Projectile.velocity *= 0.9f; + float idealRotation = Projectile.AngleTo(Owner.MountedCenter) + MathHelper.PiOver4; + Projectile.rotation = MathHelper.Lerp(Projectile.rotation, idealRotation, AirTime / 30f); } - else if (Projectile.velocity.X > projXDist) + // Then return to the player + else { - Projectile.velocity.X = Projectile.velocity.X - projVelModifier; - if (Projectile.velocity.X > 0f && projXDist < 0f) - Projectile.velocity.X = Projectile.velocity.X - projVelModifier; - } - if (Projectile.velocity.Y < projYDist) - { - Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier; - if (Projectile.velocity.Y < 0f && projYDist > 0f) - Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier; - } - else if (Projectile.velocity.Y > projYDist) - { - Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier; - if (Projectile.velocity.Y > 0f && projYDist < 0f) - Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier; - } - if (Main.myPlayer == Projectile.owner) - { - Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); - Rectangle playerArea = 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); - if (rectangle.Intersects(playerArea)) + Projectile.rotation = Projectile.AngleTo(Owner.MountedCenter) + MathHelper.PiOver4; + Projectile.velocity = Projectile.SafeDirectionTo(Owner.MountedCenter) * 25f; + if (Projectile.Hitbox.Intersects(Owner.Hitbox) || Vector2.Distance(Projectile.Center, Owner.MountedCenter) >= 2000f) Projectile.Kill(); } + + // (Slightly less) dust trail + if (!Main.rand.NextBool(4)) + { + Dust trail = Dust.NewDustPerfect(Projectile.Center, DustID.GoldFlame, Projectile.velocity * 0.2f); + trail.position += Main.rand.NextVector2Unit() * Main.rand.NextFloat(0f, 64f); + trail.noGravity = true; + } } - Projectile.rotation += 0.5f; } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 250, 250, 50); + switch (HammerState) + { + case 1f: + return Color.Red; + case 2f: + return new Color(132, 225, 26); + case 3f: + return new Color(117, 170, 239); + } + return Color.White; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 40; i++) - { - 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()) - { - Main.dust[triactisDust].scale = 0.5f; - Main.dust[triactisDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 70; j++) - { - 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(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[triactisDust2].velocity *= 2f; - } - } + if (Projectile.numHits > 0 || HammerState > 0f) + return; - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 40; i++) + int FlareCount = Owner.ownedProjectileCounts[ModContent.ProjectileType()] + 1; + + if (Main.zenithWorld) + SoundEngine.PlaySound(HitSoundGFB with { Pitch = FlareCount * 0.15f - 0.15f }, Projectile.Center); + else + SoundEngine.PlaySound(HitSound with { Pitch = FlareCount * 0.15f - 0.15f }, Projectile.Center); + + // Simple on-hit dust ring on all normal hits + for (int i = 0; i < 32; i++) { - 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()) + Vector2 velocity = Vector2.UnitX.RotatedBy(MathHelper.TwoPi * i / 32f) * (8f + 2f * FlareCount) * (i % 2 == 0 ? 1.2f : 1f); + Dust ring = Dust.NewDustPerfect(Projectile.Center, DustID.GoldFlame, velocity); + ring.noGravity = true; + ring.noLight = true; + ring.scale = (i % 2 == 0 ? 1.6f : 2.4f) * (0.7f + 0.3f * FlareCount); + } + + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && p.owner == Owner.whoAmI) { - Main.dust[triactisDust].scale = 0.5f; - Main.dust[triactisDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + // Update target of orbit to the most recently hit one + // Create telporting particles if this happens to be a different target + if (p.ai[1] != target.whoAmI) + { + p.ai[1] = target.whoAmI; + for (int i = 0; i < 5; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(6f, 10f); + Particle sparkle = new CritSpark(p.Center, velocity, Color.White, TriactisHammerFlare.GetColor(p.ai[0]), 1f, 24, 0.1f, 2.4f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + + // Set the flares up to transform themselves if ready + if (FlareCount > 3) + { + p.ai[1] = -2f; + p.ai[2] = Projectile.whoAmI; + } + p.netUpdate = true; } } - for (int j = 0; j < 70; j++) + + // Change state and turn invisible + if (FlareCount > 3) { - 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(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[triactisDust2].velocity *= 2f; + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Gold, Color.White, 0.5f), Vector2.One, 0f, 0.2f, 2.5f, 24); + GeneralParticleHandler.SpawnParticle(pulse); + SoundEngine.PlaySound(WindUpSound, Projectile.Center); + HammerState = 4f; + SmashTarget = target.whoAmI; + Projectile.velocity = Vector2.Zero; + Projectile.ExpandHitboxBy(4); + Projectile.netUpdate = true; + } + else + { + // Spawn flares and set to return to player + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * SuperHammerDamageMult), 0f, Projectile.owner, FlareCount, target.whoAmI); + HammerState = -1f; + Projectile.netUpdate = true; } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + if (HammerState == 4f) + return false; + + if (HammerState > 0f) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D echoTex = EchoHammer.Value; + Main.EntitySpriteDraw(echoTex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, echoTex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); + return false; + } + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } + + // Echo Hammers can only hit when they converge + public override bool? CanDamage() + { + if (HammerState == 4f) + return false; + + if (HammerState > 0f && AirTime < WindUpTime) + return false; + return base.CanDamage(); + } } } diff --git a/Projectiles/Melee/TrueAncientBeam.cs b/Projectiles/Melee/TrueAncientBeam.cs index ac70351edc..1aa7a7af72 100644 --- a/Projectiles/Melee/TrueAncientBeam.cs +++ b/Projectiles/Melee/TrueAncientBeam.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } const float MaxTime = 75; @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 70) return false; - DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/TrueAncientBlast.cs b/Projectiles/Melee/TrueAncientBlast.cs deleted file mode 100644 index d5e29ed281..0000000000 --- a/Projectiles/Melee/TrueAncientBlast.cs +++ /dev/null @@ -1,128 +0,0 @@ -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; -using static Terraria.ModLoader.ModContent; - - -namespace CalamityMod.Projectiles.Melee -{ - public class TrueAncientBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - } - - const float MaxTime = 20; - public float Timer => MaxTime - Projectile.timeLeft; - - public Player Owner => Main.player[Projectile.owner]; - - public override void SetDefaults() - { - Projectile.DamageType = DamageClass.Melee; - Projectile.width = Projectile.height = 8; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; - Projectile.timeLeft = 20; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float collisionPoint = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 20f, ref collisionPoint); - } - - public override bool ShouldUpdatePosition() => false; - - public override void AI() - { - if (Timer == 0) - { - Particle Star = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Color.HotPink, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f); - GeneralParticleHandler.SpawnParticle(Star); - - Star = new GenericSparkle(Projectile.Center + Projectile.velocity, Vector2.Zero, Color.White, Color.PaleGoldenrod, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f); - GeneralParticleHandler.SpawnParticle(Star); - - SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Color pulseColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.CornflowerBlue : Color.Coral) : (Main.rand.NextBool() ? Color.GreenYellow : Color.Gold); - Particle pulse = new PulseRing(target.Center, Vector2.Zero, pulseColor, 0.05f, 0.2f + Main.rand.NextFloat(0f, 1f), 30); - GeneralParticleHandler.SpawnParticle(pulse); - - for (int i = 0; i < 10; i++) - { - Vector2 particleSpeed = Utils.SafeNormalize(Projectile.velocity, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); - Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); - GeneralParticleHandler.SpawnParticle(energyLeak); - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - //Add some damage falloff - modifiers.SourceDamage *= (float)Math.Pow(1 - TrueArkoftheAncients.blastFalloffStrenght, Projectile.numHits * TrueArkoftheAncients.blastFalloffSpeed); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients").Value; - Texture2D glowmask = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncientsGlow").Value; - - float displace = 10 * (1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.8f)); - - float angle = Projectile.velocity.ToRotation(); - - float drawRotation = angle + MathHelper.PiOver4; - Vector2 drawOrigin = new Vector2(0f, sword.Height); - Vector2 drawOffset = Owner.Center + angle.ToRotationVector2() * displace - Main.screenPosition; - - float swordSize = 1.4f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); - - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, swordSize, 0f, 0); - Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, swordSize, 0f, 0); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - //Draw the laser - Texture2D tex = Request("CalamityMod/Particles/BloomLine").Value; - float rot = angle + MathHelper.PiOver2; - Vector2 origin = new Vector2(tex.Width / 2f, tex.Height); - float size = Timer / MaxTime > 0.5f ? (float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.2f + 0.8f : (float)Math.Sin(Timer / MaxTime * MathHelper.Pi); - size *= 3; - Vector2 scale = new Vector2(size, Projectile.velocity.Length() / tex.Height); - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0); - - //Cap the lines - Texture2D cap = Request("CalamityMod/Particles/BloomLineCap").Value; - scale = new Vector2(size, size); - origin = new Vector2(cap.Width / 2f, cap.Height); - Main.EntitySpriteDraw(cap, Projectile.Center - Main.screenPosition, null, Color.LightPink, rot + MathHelper.Pi, origin, scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(cap, Projectile.Center + Projectile.velocity - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0); - - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - return false; - } - } -} diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 1bd5336742..172fff2d28 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -52,8 +52,10 @@ namespace CalamityMod.Projectiles.Melee TrueArkoftheAncients sword = (Owner.HeldItem.ModItem as TrueArkoftheAncients); if (sword != null) sword.Charge = 10f; + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); SoundEngine.PlaySound(SoundID.Item67); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), CalamityUtils.GetTextValue("Misc.ArkParry"), true); AlreadyParried = 1f; } @@ -92,13 +94,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, Projectile.Center); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation @@ -134,7 +136,6 @@ namespace CalamityMod.Projectiles.Melee if (Owner.velocity.Y != 0) Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2; - break; } } diff --git a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs index e3b784cf55..68dda29ff5 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -81,8 +81,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = direction.ToRotation(); initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Manage position and rotation @@ -133,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee 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]) + if (CalamityClientConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Type]) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/TrueBiomeBladeHoldout.cs b/Projectiles/Melee/TrueBiomeBladeHoldout.cs index 672b2c4a28..675b93172a 100644 --- a/Projectiles/Melee/TrueBiomeBladeHoldout.cs +++ b/Projectiles/Melee/TrueBiomeBladeHoldout.cs @@ -3,6 +3,7 @@ using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Sounds; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -128,29 +129,19 @@ namespace CalamityMod.Projectiles.Melee public void Attune(OmegaBiomeBlade item) { - bool jungle = Owner.ZoneJungle; - bool snow = Owner.ZoneSnow; - bool evil = Owner.ZoneCorrupt || Owner.ZoneCrimson; - bool desert = Owner.ZoneDesert; - bool hell = Owner.ZoneUnderworldHeight; - bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur; - bool hallow = Owner.ZoneHallow; - bool astral = Owner.Calamity().ZoneAstral; - bool marine = Owner.Calamity().ZoneAbyss || Owner.Calamity().ZoneSunkenSea; + bool flailAttune = Owner.ZoneJungle || Owner.ZoneSnow || Owner.ZoneSkyHeight; + bool pogoAttune = Owner.ZoneDesert || Owner.ZoneUnderworldHeight || Owner.ZoneCorrupt || Owner.ZoneCrimson; + bool whirlAttune = Owner.ZoneHallow || Owner.Calamity().ZoneAstral; - Attunement attunement = Attunement.attunementArray[(int)AttunementID.Whirlwind]; - if (desert || hell) - attunement = Attunement.attunementArray[(int)AttunementID.SuperPogo]; - if (jungle || ocean || snow) //Check put after the desert check so ocean doesnt get overriden as desert - attunement = Attunement.attunementArray[(int)AttunementID.FlailBlade]; - if (evil) //Evil check separated so that it overrides corrupted beach & snow biomes - attunement = Attunement.attunementArray[(int)AttunementID.SuperPogo]; - if (astral || marine) - attunement = Attunement.attunementArray[(int)AttunementID.Shockwave]; - if (hallow) - attunement = Attunement.attunementArray[(int)AttunementID.Whirlwind]; //Putting holy check at the end so it may override hallowed variants of biomes + Attunement attunement = AttunementSystem.FindOrNull(AttunementID.Shockwave); + if (flailAttune) //Check put after the desert check so ocean doesnt get overriden as desert + attunement = AttunementSystem.FindOrNull(AttunementID.FlailBlade); + if (pogoAttune) //Evil check separated so that it overrides corrupted beach & snow biomes + attunement = AttunementSystem.FindOrNull(AttunementID.SuperPogo); + if (whirlAttune) + attunement = AttunementSystem.FindOrNull(AttunementID.Whirlwind); //Putting holy check at the end so it may override hallowed variants of biomes - //If the owner already had the attunement , break out of it (And unswap) + //If the owner already had the attunement, break out of it (And unswap) if (item.secondaryAttunement == attunement) { SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, Projectile.Center); @@ -161,7 +152,13 @@ namespace CalamityMod.Projectiles.Melee //Chunger var Sound = SoundEngine.PlaySound(CommonCalamitySounds.LightningSound with { Volume = CommonCalamitySounds.LightningSound.Volume * 0.4f }, Projectile.Center); - Particle thunder = new ThunderBoltVFX(Projectile.Center + Vector2.UnitY * 20f, Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, 0f, 1.5f, Vector2.One, 1f, 15f, Projectile, 20f); + Particle thunder = new ThunderBoltVFX( + () => Projectile.Center + Vector2.UnitY * 20f, + 0f, + 1.5f, + Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, + 30, + 15f); GeneralParticleHandler.SpawnParticle(thunder); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 5) @@ -190,7 +187,7 @@ namespace CalamityMod.Projectiles.Melee if (ChanneledState == 0f && ChannelTimer > 10f) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2, 1, 0, 0); return false; @@ -198,7 +195,7 @@ namespace CalamityMod.Projectiles.Melee } else if (ChanneledState == 1f) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 c8b196c76c..70f8077503 100644 --- a/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs +++ b/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs @@ -66,6 +66,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.timeLeft == MaxTwirlTime) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); for (int i = 0; i < 4; i++) @@ -109,12 +110,7 @@ namespace CalamityMod.Projectiles.Melee } } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int debuffTime = 100; - target.AddBuff(BuffType(), debuffTime); - } - + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffType(), 100); public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs similarity index 65% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs rename to Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs index a0183dbc9b..dc3cb85d90 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs @@ -2,8 +2,6 @@ using System.IO; 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; @@ -16,10 +14,10 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class MercurialTides : ModProjectile, ILocalizedModType + public class EarthenTides : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTides"; + public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTides"; private bool initialized = false; Vector2 direction = Vector2.Zero; public Player Owner => Main.player[Projectile.owner]; @@ -28,11 +26,14 @@ 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]; - const float MaxCharge = 500; + const float MaxCharge = 420; public Vector2 lastDisplacement; public float dashDuration; + public static readonly SoundStyle FullChargeSound = new("CalamityMod/Sounds/Item/MagicRockSound"); + public static readonly SoundStyle GroundImpact = new("CalamityMod/Sounds/Item/MagicRockImpact"); + public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -45,10 +46,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 16; } - public override bool? CanDamage() - { - return (State == 1); - } + // Only deal damage while charging + public override bool? CanDamage() => State == 1f; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -69,17 +68,19 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao + if (!initialized) //Initialization. Here it's literally just playing a sound { Projectile.velocity = Vector2.Zero; SoundEngine.PlaySound(SoundID.Item101, Projectile.Center); initialized = true; } + // Attempt a charge if the player stops channeling the sword if (Owner.CantUseHoldout()) { if (State == 0f) { + // You need at least 25% charge duration to do a charge if (Charge / MaxCharge < 0.25f) { SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); @@ -88,20 +89,19 @@ namespace CalamityMod.Projectiles.Melee } else { - SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center); State = 1f; Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death dashDuration = Projectile.timeLeft; lastDisplacement = Projectile.Center - Owner.Center; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } } } if (State == 0f) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); @@ -111,8 +111,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 2; if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f) && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); - SoundEngine.PlaySound(DeusRitualDrama.PulseSound with { Pitch = DeusRitualDrama.PulseSound.Pitch - 0.2f + 0.1f * CurrentIndicator }, Projectile.Center); + for (int s = 0; s < 2; s++) + { + Vector2 swordVel = (Vector2.UnitX.RotatedBy(Projectile.rotation) * 10f).RotatedByRandom(MathHelper.Pi / 8); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, swordVel, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BeamDamageMult), 10f, Owner.whoAmI); + } + + SoundEngine.PlaySound(SoundID.Item69 with { Pitch = -0.2f + 0.1f * CurrentIndicator }, Projectile.Center); CurrentIndicator++; OverCharge = 20f; @@ -123,11 +128,24 @@ namespace CalamityMod.Projectiles.Melee Charge = MaxCharge; if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); + for (int s = 0; s < 5; s++) + { + Vector2 swordVel = (Vector2.UnitX.RotatedBy(Projectile.rotation) * 10f).RotatedByRandom(MathHelper.Pi / 8); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, swordVel, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BeamDamageMult), 10f, Owner.whoAmI); + } OverCharge = 20f; - SoundEngine.PlaySound(AstralBeacon.UseSound, Projectile.Center); + SoundEngine.PlaySound(FullChargeSound, Projectile.Center); CurrentIndicator++; } + + if (Main.rand.NextBool()) + { + Vector2 sparkPos = Projectile.Center + direction * Main.rand.NextFloat(50f, 100f); + Vector2 sparkVel = direction.RotatedByRandom(MathHelper.Pi / 15f) * Main.rand.NextFloat(9f, 18f) + (Owner.velocity * 0.5f); + Color sparkColor = Color.Lerp(new Color(71, 191, 71), new Color(122, 213, 233), Main.rand.NextFloat()); + CustomSprite critSpark = new(sparkPos, sparkVel, 16, "CalamityMod/Particles/CritSpark", 1.4f, sparkColor, frameCount: 4, frame: Main.rand.Next(4)); + GeneralParticleHandler.SpawnParticle(critSpark); + } } } @@ -138,14 +156,14 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().LungingDown = true; - if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10)) + Vector2 collisionCheckPos = Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f; + if (Collision.SolidCollision(collisionCheckPos, 10, 10)) { - SlamDown(); + SlamDown(collisionCheckPos); Projectile.timeLeft = 0; Owner.Calamity().LungingDown = false; Projectile.active = false; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } Owner.velocity = direction * 30f; @@ -177,59 +195,34 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } - public void SlamDown() + public void SlamDown(Vector2 collisionSpot) { - SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = SoundID.DD2_MonkStaffGroundImpact.Volume * 1.5f }, Projectile.Center); - - if (Owner.whoAmI != Main.myPlayer || Owner.velocity.Y == 0f) return; + // Sound and screenshake + SoundEngine.PlaySound(GroundImpact, Projectile.Center); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15; - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); - proj.timeLeft = 81; + // Dust and particles from the impact + for (int d = 0; d < 13; d++) + Dust.NewDustPerfect(collisionSpot, Main.rand.NextBool() ? DustID.Clay : DustID.Dirt, Main.rand.NextVector2CircularEdge(6f, 6f), Scale: 1.2f); - - SideSprouts(1, 150f, 1f * Charge / MaxCharge); - SideSprouts(-1, 150f, 1f * Charge / MaxCharge); - - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) + CustomPulse shatter = new(collisionSpot, Vector2.Zero, Color.SandyBrown, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.03f, 0.275f, 30); + GeneralParticleHandler.SpawnParticle(shatter); + for (int i = 0; i < 10; i++) { - Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } + Vector2 rockVel = -(Owner.velocity * 0.55f).RotatedByRandom(MathHelper.Pi / 2.5f); + StoneDebrisParticle rock = new(collisionSpot, rockVel, Color.White, 1f, 35); + GeneralParticleHandler.SpawnParticle(rock); } - if (validPositionFound) - { - Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is MercurialTidesMonolith monolith) - { - monolith.WaitTimer = (1 - projSize) * 34f; - monolith.OriginDirection = direction; - monolith.Facing = facing; - } - } + // Spawn the blast spawner + // Its duration scales with the current charge level + int duration = 12 + (int)CurrentIndicator * 12; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 0f, Owner.whoAmI, duration); - return validPositionFound; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -237,20 +230,36 @@ namespace CalamityMod.Projectiles.Melee // 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); + + if (!CalamityUtils.AnyProjectiles(ProjectileType())) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * 0.75f), 0f, Owner.whoAmI, 1f); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= 1f + OmegaBiomeBlade.ShockwaveAttunement_FullChargeBoost * (float)Math.Pow(Charge / MaxCharge, 2); + modifiers.SourceDamage *= (OmegaBiomeBlade.ShockwaveAttunement_FullChargeMult * (float)Math.Pow(Charge / MaxCharge, 2)); if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_SwordProc) sword.OnHitProc = true; + + foreach (Projectile proj in Main.projectile) + { + if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) + { + //Reset the timeLeft on the sigil & set its new target (or same target, doesn't matter) + proj.ai[0] = target.whoAmI; + proj.timeLeft = OmegaBiomeBlade.ShockwaveAttunement_SigilTime; + return; + } + } + Projectile sigil = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), 0, 0, Owner.whoAmI, target.whoAmI, 1f); + sigil.timeLeft = OmegaBiomeBlade.ShockwaveAttunement_SigilTime; } public override bool PreDraw(ref Color lightColor) { Texture2D handle = Request("CalamityMod/Items/Weapons/Melee/OmegaBiomeBlade").Value; - Texture2D blade = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTides").Value; + Texture2D blade = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTides").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.png similarity index 100% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTides.png rename to Projectiles/Melee/TrueBiomeBlade_EarthenTides.png diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs similarity index 62% rename from Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs index 68efc899ff..57bdc0163c 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs @@ -1,6 +1,8 @@ using System; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,17 +14,17 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class SwordsmithsPrideBeam : ModProjectile, ILocalizedModType + public class EarthenTidesBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public NPC target; public Player Owner => Main.player[Projectile.owner]; - public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam"; + public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -32,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 80; + Projectile.timeLeft = 150; Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; @@ -40,26 +42,47 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - - if (target == null) + // Sword beams home + if (Projectile.timeLeft < 130) { + int index = -1; + // Prioritize an enemy that is marked foreach (Projectile proj in Main.projectile) { if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) { - target = Main.npc[(int)proj.ai[0]]; - break; + if (Vector2.Distance(Main.npc[(int)proj.ai[0]].Center, Projectile.Center) < 560f) + { + index = (int)proj.ai[0]; + break; + } } } - } - else if ((Projectile.Center - target.Center).Length() >= (Projectile.Center + Projectile.velocity - target.Center).Length() && CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < MathHelper.PiOver4) //Home in - { - Projectile.timeLeft = 70; //Remain alive - float angularTurnSpeed = MathHelper.ToRadians(MathHelper.Lerp(15, 2.5f, MathHelper.Clamp(Projectile.Distance(target.Center) / 10f, 0f, 1f))); - float idealDirection = Projectile.AngleTo(target.Center); - float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, angularTurnSpeed); - Projectile.velocity = updatedDirection.ToRotationVector2() * Projectile.velocity.Length(); + // If nothing is marked, just find the closest target + if (index == -1) + { + float npcDistCompare = 240f; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile, false)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if ((currentNPCDist < npcDistCompare) && Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1)) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + } + + // If we found an enemy, curve towards them + if (index != -1) + { + float homingTurnSpeed = 0.05f; + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.npc[index].Center).ToRotation(), homingTurnSpeed).ToRotationVector2() * 10f; + } } Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); @@ -71,15 +94,15 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 75) + if (Projectile.timeLeft > 145) return false; - DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - Main.spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes + Main.spriteBatch.End(); //Yippee wahoo spritebatch restarting! Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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); @@ -101,17 +124,12 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int debuffTime = 90; - target.AddBuff(BuffType(), debuffTime); - } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_SwordBeamProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_SwordBeamProc) sword.OnHitProc = true; } - public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.DeepSkyBlue, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 4f)); } } diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.png similarity index 100% rename from Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.png rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.png diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs new file mode 100644 index 0000000000..843cd4effd --- /dev/null +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs @@ -0,0 +1,68 @@ +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EarthenTidesBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Magic/PrimordialAncientProjectile"; + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 6; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 140; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 72; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; + Projectile.scale = 0.05f; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, 0.9f, 0.45f, 0.05f); + Projectile.rotation = Projectile.ai[0]; + if (Projectile.timeLeft > 12) + { + if (Projectile.scale < Projectile.ai[1]) + Projectile.scale += (Projectile.ai[1] - 0.05f) / 12f; + } + else + Projectile.scale -= (Projectile.ai[1] - 0.05f) / 12f; + + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_BlastProc) + sword.OnHitProc = true; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } + } +} diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlastSpawner.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlastSpawner.cs new file mode 100644 index 0000000000..18d4b79564 --- /dev/null +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlastSpawner.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EarthenTidesBlastSpawner : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 50; + } + + public override void AI() + { + // Set how long the spawner will exist + // 30-40-50-60 for 25%-50%-75%-100% + if (Projectile.ai[1] == 0f) + { + Projectile.timeLeft = (int)Projectile.ai[0]; + Projectile.ai[1]++; + } + + // Constantly stay on top of the owner + Projectile.Center = Main.player[Projectile.owner].Center; + + // Spawn dust blasts + if (Projectile.timeLeft % 6 == 3) + { + for (int i = 0; i < 2; i++) + { + float randomX = Main.rand.NextFloat(-200f, 200f); + float randomY = Main.rand.NextFloat(-200f, 200f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(Projectile.Center.X + randomX, Projectile.Center.Y + randomY), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, Main.rand.NextFloat(-MathHelper.Pi, MathHelper.Pi), Main.rand.NextFloat(0.96f, 1.04f)); + } + } + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesMonolith.png similarity index 100% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.png rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesMonolith.png diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs similarity index 66% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs index cafa9fde02..8731a26b33 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -11,20 +12,16 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class MercurialTidesBlast : ModProjectile, ILocalizedModType + public class EarthenTidesShockwave : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave"; + public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave"; public Player Owner => Main.player[Projectile.owner]; public float Timer => (60f - Projectile.timeLeft) / 100f; - public ref float Variant => ref Projectile.ai[0]; //Yes - public ref float Size => ref Projectile.ai[0]; //Yes + public ref float Size => ref Projectile.ai[0]; public Particle BloomRing; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -33,14 +30,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } - public override bool? CanDamage() => Projectile.timeLeft < 40; - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - (projHitbox.Size() * Projectile.scale * 0.5f), projHitbox.Size() * Projectile.scale); - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - (projHitbox.Size() * Projectile.scale * 0.5f), projHitbox.Size() * Projectile.scale); public override void AI() { @@ -49,33 +43,26 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft == 60) { - SoundEngine.PlaySound(SoundID.Item79, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, Projectile.Center); Particle Sparkle = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, Projectile.scale, 20, 0.2f, 2); GeneralParticleHandler.SpawnParticle(Sparkle); - } - - - if (Projectile.timeLeft == 40) - { - SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, Projectile.Center); - - BloomRing = new BloomRing(Projectile.Center, Vector2.Zero, Color.Aqua, Projectile.scale, 40); + BloomRing = new BloomRing(Projectile.Center, Vector2.Zero, Color.Aqua, Projectile.scale, 50); GeneralParticleHandler.SpawnParticle(BloomRing); Particle Bloom = new StrongBloom(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.Aqua * 0.6f : Color.SpringGreen * 0.6f, Projectile.scale * (1f + Main.rand.NextFloat(0f, 1.5f)), 20); GeneralParticleHandler.SpawnParticle(Bloom); for (int i = 0; i < 10; i++) { - Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.DarkSlateBlue : Color.Chocolate, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); - GeneralParticleHandler.SpawnParticle(Sparkle); + Particle crit = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.DarkSlateBlue : Color.Chocolate, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + GeneralParticleHandler.SpawnParticle(crit); } for (float i = 0f; i < 1; i += 0.05f) { float rotation = i * MathHelper.TwoPi; - Particle Sparkle = new CritSpark(Projectile.Center + rotation.ToRotationVector2() * 65f * Projectile.scale, rotation.ToRotationVector2() * 10f, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); - GeneralParticleHandler.SpawnParticle(Sparkle); + Particle crit = new CritSpark(Projectile.Center + rotation.ToRotationVector2() * 65f * Projectile.scale, rotation.ToRotationVector2() * 10f, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + GeneralParticleHandler.SpawnParticle(crit); } } @@ -87,13 +74,13 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_BlastProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_ShockwaveProc) sword.OnHitProc = true; } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave").Value; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave").Value; float drawAngle = Projectile.rotation; int animFrame = 6 - (int)Math.Ceiling(Projectile.timeLeft / 10f); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.png similarity index 100% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.png rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.png diff --git a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs index 38a4346f7e..1db4fff2ff 100644 --- a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs +++ b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs @@ -163,6 +163,7 @@ namespace CalamityMod.Projectiles.Melee return; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); @@ -336,24 +337,24 @@ namespace CalamityMod.Projectiles.Melee if (ChainSwapTimer % 6 == 0 || whip1.Y == 0) { - whip1.X = Projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.PiOver4 / 16f, -MathHelper.PiOver4 / 16f)).ToRotation(); //X is the orientation - whip1.Y = Main.rand.NextFloat(0.2f, 100f);//Y is the "seed" + whip1.X = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 64f).ToRotation(); //X is the orientation + whip1.Y = Main.rand.NextFloat(0.2f, 50f);//Y is the "seed" ChainSwapTimer++; } if ((ChainSwapTimer - 2) % 6 == 0 || whip2.Y == 0) { - whip2.X = Projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.Pi / 16f, -MathHelper.Pi / 16f)).ToRotation(); //X is the orientation - whip2.Y = Main.rand.NextFloat(0.2f, 100f);//Y is the "seed" + whip2.X = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 32f).ToRotation(); //X is the orientation + whip2.Y = Main.rand.NextFloat(0.2f, 50f);//Y is the "seed" ChainSwapTimer++; } if ((ChainSwapTimer - 4) % 6 == 0 || whip3.Y == 0) { - whip3.X = Projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.Pi / 16f, -MathHelper.Pi / 16f)).ToRotation(); //X is the orientation - whip3.Y = Main.rand.NextFloat(0.2f, 100f);//Y is the "seed" + whip3.X = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 24f).ToRotation(); //X is the orientation + whip3.Y = Main.rand.NextFloat(0.2f, 50f);//Y is the "seed" ChainSwapTimer++; } diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs index e7b182dc10..efdf0451fa 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs @@ -48,10 +48,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; } - public override bool? CanDamage() - { - return Projectile.timeLeft <= 2; //Prevent spam click abuse - } + public override bool? CanDamage() => Projectile.timeLeft <= 2; //Prevent spam click abuse public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -106,6 +103,7 @@ namespace CalamityMod.Projectiles.Melee { if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction if (CalamityUtils.AngleBetween(Owner.Center - Owner.Calamity().mouseWorld, Owner.Center - proj.Center) > MathHelper.PiOver4) { proj.Kill(); @@ -119,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee // 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); + Owner.GiveUniversalIFrames(OmegaBiomeBlade.SuperPogoAttunement_PlayerSliceIFrames); break; } @@ -139,6 +137,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); @@ -146,8 +145,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Owner.Center + (direction * 60); //Scaling based on shred - Projectile.localNPCHitCooldown = OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames - OmegaBiomeBlade.SuperPogoAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency - Projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER + Projectile.scale = 1.25f + (ShredRatio * 1f); //SWAGGER if ((Wheel == null || !Wheel.active) && Dashing) @@ -158,7 +156,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound, Projectile.Center); if (Owner.whoAmI == Main.myPlayer) { - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_SlashDamageBoost), 0, Owner.whoAmI); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_SliceDamageMult), 0, Owner.whoAmI); if (proj.ModProjectile is SanguineFuryDash dash) { dash.DashStart = DashStart; @@ -183,8 +181,7 @@ namespace CalamityMod.Projectiles.Melee if (Collision.SolidCollision(Owner.Center + (direction * 100 * Projectile.scale) - Vector2.One * 5f, 10, 10) && !Dashing) { Pogo(); - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } //Make the owner look like theyre holding the sword bla bla @@ -220,27 +217,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 2; } - //Since the iframes vary, adjust the damage to be consistent no matter the iframes. The true scaling happens between the BaseDamage and the FulLChargeDamage - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - float maxMultiplier = OmegaBiomeBlade.SuperPogoAttunement_FullChargeDamage / (float)OmegaBiomeBlade.SuperPogoAttunement_BaseDamage; - float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes - float damageReduction = Projectile.localNPCHitCooldown / (float)OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; - - modifiers.SourceDamage *= damageMultiplier * damageReduction; - } - - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - float maxMultiplier = OmegaBiomeBlade.SuperPogoAttunement_FullChargeDamage / (float)OmegaBiomeBlade.SuperPogoAttunement_BaseDamage; - float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes - float damageReduction = Projectile.localNPCHitCooldown / (float)OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; - - modifiers.SourceDamage *= damageMultiplier * damageReduction; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => ShredTarget(); public override void OnHitPlayer(Player target, Player.HurtInfo info) => ShredTarget(); @@ -253,17 +229,14 @@ namespace CalamityMod.Projectiles.Melee sword.OnHitProc = true; Owner.fallStart = (int)(Owner.position.Y / 16f); - // get lifted up if (PogoCooldown <= 0) { SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); //Sizzle Shred += 62; //Augment the shredspeed - if (Owner.velocity.Y > 0) - Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly // 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); + Owner.GiveUniversalIFrames(OmegaBiomeBlade.SuperPogoAttunement_PlayerShredIFrames); PogoCooldown = 20; } @@ -274,7 +247,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); if (ShredRatio > 0.8 && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, direction * 16f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, direction * 16f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_ShotDamageMult), Projectile.knockBack, Owner.whoAmI, Shred); } if (Dashing) { diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs index 0d2290995c..47863bc102 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -19,9 +20,6 @@ namespace CalamityMod.Projectiles.Melee public Vector2 DashStart; public Vector2 DashEnd; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -43,8 +41,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_DashProc) - sword.OnHitProc = true; + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword) + { + if (Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_DashProc) + sword.OnHitProc = true; + } Particle bloom = new StrongBloom(target.Center, target.velocity, Color.Crimson * 0.5f, 1f, 30); GeneralParticleHandler.SpawnParticle(bloom); @@ -59,8 +60,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.moonLeech) return; - Owner.statLife += OmegaBiomeBlade.SuperPogoAttunementSlashLifesteal; - Owner.HealEffect(OmegaBiomeBlade.SuperPogoAttunementSlashLifesteal); + Owner.HealPlayer(OmegaBiomeBlade.SuperPogoAttunementSliceLifesteal); } public override bool PreDraw(ref Color lightColor) //OMw to reuse way too much code from the entangling vines diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs index 034fc7c9a3..0c02adb129 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -24,11 +25,6 @@ namespace CalamityMod.Projectiles.Melee public const float MaxTime = 120; - - - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -65,6 +61,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); @@ -84,8 +81,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_WheelProc) - sword.OnHitProc = true; + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword) + { + if (Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_WheelProc) + sword.OnHitProc = true; + } } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs index 8c8351f8f7..95223e7aa4 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs @@ -2,6 +2,8 @@ using System.IO; 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; @@ -22,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 direction = Vector2.Zero; public ref float CurrentState => ref Projectile.ai[0]; public Player Owner => Main.player[Projectile.owner]; - public const float throwOutTime = 90f; + public const float throwOutTime = 60f; public const float throwOutDistance = 440f; public static float snapPoint = 0.45f; @@ -39,15 +41,12 @@ namespace CalamityMod.Projectiles.Melee public float AngleReset = 0f; - public bool CanDirectFire = true; public Particle smear; - public Particle sightLine; - public NPC lastTarget; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -77,10 +76,11 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao + if (!initialized) //Initialization. { SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); Projectile.velocity = Vector2.Zero; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); initialized = true; @@ -101,8 +101,10 @@ namespace CalamityMod.Projectiles.Melee { CurrentState = 1f; SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES + //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); @@ -122,40 +124,37 @@ namespace CalamityMod.Projectiles.Melee if (CurrentState == 0f) { - - if (hasMadeChargeSound == 0f && Empowerment / maxEmpowerment >= 0.5) - { - hasMadeChargeSound = 1f; - SoundEngine.PlaySound(SoundID.Item76, Projectile.Center); - } - float rotation = direction.ToRotation(); if (rotation > -MathHelper.PiOver2 - MathHelper.PiOver4 && rotation < -MathHelper.PiOver2 + MathHelper.PiOver4 && hasMadeSound == 1f) hasMadeSound = 0f; else if (rotation > MathHelper.PiOver2 - MathHelper.PiOver4 && rotation < MathHelper.PiOver2 + MathHelper.PiOver4 && hasMadeSound == 0f) { - CanDirectFire = true; hasMadeSound = 1f; SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); } + if ((hasMadeChargeSound == 0f && Empowerment / maxEmpowerment >= 0.5) || (hasMadeChargeSound == 1f && Empowerment / maxEmpowerment >= 0.75)) + { + hasMadeChargeSound++; + SoundEngine.PlaySound(DeusRitualDrama.PulseSound with { Pitch = -0.1f + hasMadeChargeSound * 0.1f }, Projectile.Center); + } + if (hasMadeChargeSound == 2f && Empowerment >= maxEmpowerment) + { + hasMadeChargeSound++; + SoundEngine.PlaySound(AstralBeacon.UseSound, Projectile.Center); + } if (Empowerment / maxEmpowerment >= 0.5 && (Empowerment + OverEmpowerment) % 30 == 29 && Owner.whoAmI == Main.myPlayer) { - Vector2 shotDirection = Main.rand.NextVector2CircularEdge(15f, 15f); - if (lastTarget != null && lastTarget.active) //If you've got an actual target, angle your shots towards them - { - shotDirection = (shotDirection.ToRotation().AngleTowards(Owner.AngleTo(lastTarget.Center), MathHelper.PiOver2)).ToRotationVector2() * 15f; - } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); + Vector2 shotDirection = Main.rand.NextVector2CircularEdge(10f, 10f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_EnergyDamageMult), 0f, Owner.whoAmI); } - if (Empowerment / maxEmpowerment >= 0.75) { - Color currentColor = Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); + Color currentColor = Color.Lerp(Color.HotPink, Color.DarkViolet, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); if (smear == null) { smear = new CircularSmearVFX(Owner.Center, Color.HotPink, direction.ToRotation(), Projectile.scale * 1.5f); @@ -171,38 +170,6 @@ namespace CalamityMod.Projectiles.Melee smear.Color = currentColor; } - if (sightLine == null) - { - sightLine = new LineVFX(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One), 0.2f, Color.HotPink, false); - GeneralParticleHandler.SpawnParticle(sightLine); - } - else - { - sightLine.Position = Owner.Center + Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * Projectile.scale * 1.88f * 40; - (sightLine as LineVFX).LineVector = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * Projectile.scale * 1.88f * 38f; - sightLine.Scale = 0.2f; - sightLine.Time = 0; - sightLine.Color = currentColor * 0.7f; - } - - float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; - float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation()) + MathHelper.Pi; - float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted)); - - if (CanDirectFire && deltaAngleShoot < 0.1f) - { - Particle Blink = new GenericSparkle(Owner.Center + Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * Projectile.scale * 1.88f * 78f, Owner.velocity, Color.White, currentColor, 1.5f, 10, 0.1f, 3f); - GeneralParticleHandler.SpawnParticle(Blink); - - if (Owner.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); - } - CanDirectFire = false; - AngleReset = Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation(); - } - - if (Main.rand.NextBool()) { float maxDistance = Projectile.scale * 1.9f * 78f; @@ -217,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee //Manage position and rotation Projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; - direction = direction.RotatedBy(MathHelper.Clamp(Empowerment / maxEmpowerment, 0.4f, 1f) * MathHelper.PiOver4 * 0.20f); + direction = direction.RotatedBy(MathHelper.Clamp(Empowerment * 1.1f / maxEmpowerment, 0.45f, 1f) * MathHelper.PiOver4 * 0.20f); direction.Normalize(); Projectile.rotation = direction.ToRotation(); Projectile.Center = Owner.Center + (direction * Projectile.scale * 10); @@ -249,13 +216,29 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (CurrentState == 1f && !CalamityUtils.AnyProjectiles(ProjectileType())) + { + float monolithScale = MathHelper.Clamp(target.width / 100f, 0.3f, 1.25f); + Vector2 monolithDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 10f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, monolithDirection, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_MonolithDamageMult), Projectile.knockBack, Owner.whoAmI, Main.rand.Next(4), 1f, hasMadeChargeSound); + if (proj.ModProjectile is SwordsmithsPrideMonolith monolith) + { + monolith.Scale = monolithScale; + monolith.OriginDirection = monolithDirection; + monolith.Facing = 0f; + monolith.Target = target; + } + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (CurrentState == 1f) modifiers.SourceDamage *= MathHelper.Lerp(1f, OmegaBiomeBlade.WhirlwindAttunement_ThrowDamageBoost, Empowerment / maxEmpowerment); else - modifiers.SourceDamage *= OmegaBiomeBlade.WhirlwindAttunement_BaseDamageReduction + (OmegaBiomeBlade.WhirlwindAttunement_FullChargeDamageBoost * Empowerment / maxEmpowerment); + modifiers.SourceDamage *= MathHelper.Lerp(OmegaBiomeBlade.WhirlwindAttunement_BaseSwingDamageMult, OmegaBiomeBlade.WhirlwindAttunement_FullSwingDamageMult, Empowerment / maxEmpowerment); if (CurrentState != 1) { @@ -266,28 +249,12 @@ namespace CalamityMod.Projectiles.Melee if (Owner.HeldItem.ModItem is OmegaBiomeBlade blade && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_SwordThrowProc) blade.OnHitProc = true; - - lastTarget = target; - foreach (Projectile proj in Main.projectile) - { - if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) - { - //Reset the timeleft on the sigil & give it its new target (or the same, it doesnt matter really. - proj.ai[0] = target.whoAmI; - proj.timeLeft = OmegaBiomeBlade.WhirlwindAttunement_SigilTime; - return; - } - } - Projectile sigil = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), 0, 0, Owner.whoAmI, target.whoAmI); - sigil.timeLeft = OmegaBiomeBlade.WhirlwindAttunement_SigilTime; } public override void OnKill(int timeLeft) { if (smear != null) smear.Kill(); - if (sightLine != null) - sightLine.Kill(); } public override bool PreDraw(ref Color lightColor) @@ -310,7 +277,7 @@ namespace CalamityMod.Projectiles.Melee drawOrigin = new Vector2(0f, blade.Height); //Afterimages - if (CalamityConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) + if (CalamityClientConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralBomber.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralBomber.cs new file mode 100644 index 0000000000..595e5117e2 --- /dev/null +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralBomber.cs @@ -0,0 +1,122 @@ +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.Melee +{ + public class SwordsmithsPrideAstralBomber : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Summon/AureusBomber"; + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 60; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 240; + Projectile.tileCollide = false; + } + + public override void AI() + { + // Animation and visuals. + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame >= 3) + Projectile.frame = 0; + } + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.Orange, Color.Cyan, (float)Math.Sin(Main.GlobalTimeWrappedHourly)).ToVector3()); + if (Projectile.timeLeft % 10 == 0) + { + Vector2 sparklePos = new Vector2(Projectile.position.X + Main.rand.Next(Projectile.width), Projectile.position.Y + Main.rand.Next(Projectile.height)); + GenericSparkle sparkle = new(sparklePos, Vector2.Zero, Main.rand.NextBool() ? Color.Orange : Color.Cyan, Color.White, 0.9f, 30, 0f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + + // Find the closest target. + Vector2 destination = Projectile.Center; + bool foundTarget = false; + float npcDistCompare = 400f; + int index = -1; + + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile, false)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCompare) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + if (index != -1) + { + destination = Main.npc[index].Center; + foundTarget = true; + } + + // Homing and facing direction. + if (foundTarget) + { + Vector2 homeDirection = (destination - Projectile.Center).SafeNormalize(Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + homeDirection * 15f) / 21f; + if ((destination - Projectile.Center).X > 0f) + Projectile.spriteDirection = Projectile.direction = -1; + else + Projectile.spriteDirection = Projectile.direction = 1; + } + else + { + if (Projectile.velocity.X > 0f) + Projectile.spriteDirection = Projectile.direction = -1; + else if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = Projectile.direction = 1; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 90); + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 9; i++) + { + Vector2 veloc = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(3.5f, 6f); + LineParticle sparks = new(Projectile.Center, veloc, false, 16, 0.8f, Main.rand.NextBool() ? Color.Orange : Color.Cyan); + GeneralParticleHandler.SpawnParticle(sparks); + } + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override void PostDraw(Color lightColor) + { + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Summon/AureusBomberGlow").Value; + Rectangle frame = glow.Frame(1, 3, 0, Projectile.frame); + Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, frame, Color.White, 0f, frame.Size() / 2f, 1f, SpriteEffects.None); + } + } +} diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralEnergy.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralEnergy.cs new file mode 100644 index 0000000000..f2e88c452b --- /dev/null +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralEnergy.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SwordsmithsPrideAstralEnergy : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float Timer => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + } + + public override void AI() + { + Timer++; + + if (Timer >= 40f) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 480f, 13f, 20f); + } + + Projectile.ai[1] += 0.18f; + float angle = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + float pulse = (float)Math.Sin(Projectile.ai[1]); + float radius = 9f; + Vector2 offset = angle.ToRotationVector2() * pulse * radius; + Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType(), Vector2.Zero, Scale: 0.75f); + Dust.NewDustPerfect(Projectile.Center - offset, ModContent.DustType(), Vector2.Zero, Scale: 0.75f); + + Color partColor = Color.Lerp(Color.Orange, Color.Blue, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3.5f)); + GlowOrbParticle obligatory = new(Projectile.Center, Vector2.Zero, false, 2, 0.8f, partColor); + GeneralParticleHandler.SpawnParticle(obligatory); + } + } +} diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs similarity index 71% rename from Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs rename to Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs index 03e90f0a94..1c50fbb05c 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs @@ -1,5 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -13,15 +15,18 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class ExtantAbhorrenceMonolith : ModProjectile, ILocalizedModType + public class SwordsmithsPrideMonolith : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith"; + public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith"; public Player Owner => Main.player[Projectile.owner]; public float Timer => (100f - Projectile.timeLeft) / 100f; - public ref float Variant => ref Projectile.ai[0]; //Yes - public ref float Size => ref Projectile.ai[1]; //Yes - public float WaitTimer; //How long till it appears fr. GOtta remember to sync that one + public ref float Variant => ref Projectile.ai[0]; + public ref float Size => ref Projectile.ai[1]; + public float Scale; // The scale multiplier based on the target's size + public Vector2 OriginDirection; // The direction of the original strike + public float Facing; // The direction of the original strike + public NPC Target; // The NPC to stick on top of public const float BaseWidth = 90f; public const float BaseHeight = 420f; @@ -38,9 +43,6 @@ namespace CalamityMod.Projectiles.Melee public CurveSegment Hold = new CurveSegment(EasingType.ExpOut, 0.70f, 1f, -0.1f); internal float Height() => PiecewiseAnimation(Timer, new CurveSegment[] { Anticipate, Overextend, Unextend, Hold }) * BaseHeight * Size; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -49,11 +51,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 102; + Projectile.scale = Scale; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; Projectile.hide = true; } - public override bool? CanDamage() => WaitTimer <= 0; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; @@ -67,18 +70,22 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (WaitTimer > 0) + if (Projectile.velocity != Vector2.Zero) { - Projectile.timeLeft = 102; - WaitTimer--; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = Vector2.Zero; } + if (!Target.active) + { + Projectile.Kill(); + return; + } + else + Projectile.Center = Target.Center; + if (Projectile.timeLeft == 100) { - SurfaceUp(); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.velocity = Vector2.Zero; - if (Size >= 1) //Big monoliths create sparkles even before sprouting up { @@ -88,6 +95,20 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(Sparkle); } } + + if (Projectile.ai[2] > 1f) + { + if (Facing == 0) + { + SideSprouts(-1f, Size * 0.8f); + SideSprouts(1f, Size * 0.8f); + } + else + { + SideSprouts(Facing, Size * 0.8f); + } + } + } if (Projectile.timeLeft == 80) @@ -113,59 +134,53 @@ namespace CalamityMod.Projectiles.Melee } } - //Go up to the "surface" so you're not stuck in the middle of the ground like a complete moron. - public void SurfaceUp() + public void SideSprouts(float facing, float projSize) { - for (float i = 0; i < 40; i += 0.5f) + Vector2 monolithRotation = OriginDirection.RotatedBy(MathHelper.Pi / 9.5f * facing); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize, Projectile.ai[2] - 1f); + if (proj.ModProjectile is SwordsmithsPrideMonolith monolith) { - Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i; - if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - { - Projectile.Center = Projectile.Center + Projectile.velocity * i; - return; - } + monolith.Scale = Scale; + monolith.OriginDirection = monolithRotation; + monolith.Facing = facing; + monolith.Target = Target; } - Projectile.Center = Projectile.Center + Projectile.velocity * 40f; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - modifiers.SourceDamage *= TrueBiomeBlade.AstralAttunement_MonolithDamageFalloff; + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_MonolithProc) + sword.OnHitProc = true; } public override bool PreDraw(ref Color lightColor) { - if (WaitTimer > 0) - return false; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith").Value; - Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith").Value; + Vector2 Shake = Projectile.timeLeft < 70 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (70 - Projectile.timeLeft / 30f) * 0.05f; float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); - Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; + Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f * Scale; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); - Main.EntitySpriteDraw(tex, drawPosition, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); + Main.EntitySpriteDraw(tex, drawPosition + Shake, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); return false; } public override void PostDraw(Color lightColor) { - if (WaitTimer > 0) - return; - - Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow").Value; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith_Glow").Value; float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); - Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; + Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f * Scale; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); @@ -173,15 +188,16 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); } - public override void SendExtraAI(BinaryWriter writer) { - writer.Write(WaitTimer); + writer.Write(Facing); + writer.WriteVector2(OriginDirection); + } public override void ReceiveExtraAI(BinaryReader reader) { - WaitTimer = reader.ReadSingle(); + Facing = reader.ReadSingle(); + OriginDirection = reader.ReadVector2(); } - } } diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.png b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.png new file mode 100644 index 0000000000..9d931f1918 Binary files /dev/null and b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.png differ diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index 06fc319d0c..b62d82e9dd 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -75,8 +76,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs index 7d99b67136..72e9ceb558 100644 --- a/Projectiles/Melee/UltimusCleaverDust.cs +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 6; diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 667a5789f9..3938a7e9cc 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -46,6 +46,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = (Projectile.velocity * 20f + idealVelocity) / 21f; Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); } + + if (Main.rand.NextBool(8)) + { + Dust offTrail = Dust.NewDustPerfect(Projectile.Center, 171, Main.rand.NextVector2Circular(0.2f, 0.2f)); + offTrail.noGravity = true; + offTrail.scale = Main.rand.NextFloat(0.6f, 1.2f); + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 120); diff --git a/Projectiles/Melee/ViolenceSlashProjectile.cs b/Projectiles/Melee/ViolenceSlashProjectile.cs index 7d888bd361..c24ce18a99 100644 --- a/Projectiles/Melee/ViolenceSlashProjectile.cs +++ b/Projectiles/Melee/ViolenceSlashProjectile.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/Violence"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 36; } public override void SetDefaults() @@ -65,11 +65,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter) + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.45f; Projectile.rotation = SwingSine * MathHelper.ToRadians(87f); - if (Main.myPlayer == Projectile.owner && !Projectile.WithinRange(Main.MouseWorld, Projectile.height + 15f)) + Vector2 mouse = Owner.ClampedMouseWorld(); + if (Main.myPlayer == Projectile.owner && !Projectile.WithinRange(mouse, Projectile.height + 15f)) { - Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld); - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.velocity = Projectile.SafeDirectionTo(mouse); + Projectile.ForceNetUpdate(); } Projectile.rotation += Projectile.velocity.ToRotation() + MathHelper.PiOver4; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee { GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SwordSlashTexture")); - Texture2D spearProjectile = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D spearProjectile = Terraria.GameContent.TextureAssets.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 393fc828d1..2da1fa70aa 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/Violence"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 36; } public override void SetDefaults() @@ -70,12 +70,12 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer != Projectile.owner) return; - if (Projectile.WithinRange(Main.MouseWorld, Projectile.velocity.Length() * 0.7f)) - Projectile.Center = Main.MouseWorld; + Vector2 mouse = Owner.ClampedMouseWorld(); + if (Projectile.WithinRange(mouse, Projectile.velocity.Length() * 0.7f)) + Projectile.Center = mouse; else - Projectile.velocity = (Projectile.velocity * 3f + Projectile.DirectionTo(Main.MouseWorld) * 19f) / 4f; - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.velocity = (Projectile.velocity * 3f + Projectile.DirectionTo(mouse) * 19f) / 4f; + Projectile.ForceNetUpdate(); } internal void ReturnToOwner() @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Play a splatter and impact sound. SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact, Projectile.Center); @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Melee { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - Texture2D spearProjectile = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D spearProjectile = Terraria.GameContent.TextureAssets.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 deleted file mode 100644 index a10ab8d612..0000000000 --- a/Projectiles/Melee/VirulentBeeWave.cs +++ /dev/null @@ -1,131 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class VirulentBeeWave : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/VirulentWave"; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 70; - Projectile.height = 70; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 150; - Projectile.alpha = 100; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 8; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - Projectile.ai[1]++; - Lighting.AddLight(Projectile.Center, 0.05f, 0.4f, 0f); - if (Projectile.ai[1] < 60f) - { - if (Projectile.ai[0] > 7f) - { - float scalar = 1f; - if (Projectile.ai[0] == 8f) - { - scalar = 0.25f; - } - else if (Projectile.ai[0] == 9f) - { - scalar = 0.5f; - } - else if (Projectile.ai[0] == 10f) - { - scalar = 0.75f; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] % 2f == 0f) - { - int spawnX = (int)(Projectile.width / 2); - int spawnY = (int)(Projectile.width / 2); - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), Projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), Projectile.velocity.X, Projectile.velocity.Y, player.beeType(), player.beeDamage(Projectile.damage / 3), player.beeKB(0f), Projectile.owner); - if (bee.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[bee].DamageType = DamageClass.Melee; - Main.projectile[bee].penetrate = 1; - } - } - //Dust - int dustType = 89; - int plague = 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[plague]; - if (Main.rand.NextBool(3)) - { - dust.noGravity = true; - dust.scale *= 1.8f; - dust.velocity.X *= 2f; - dust.velocity.Y *= 2f; - } - else - { - dust.scale *= 1.3f; - } - dust.velocity.X *= 1.2f; - dust.velocity.Y *= 1.2f; - dust.scale *= scalar; - } - else - { - Projectile.ai[0] += 1f; - } - } - else - { - Projectile.damage = (int)(Projectile.damage * 0.6); - Projectile.velocity *= 0.85f; - //Fade out - if (Projectile.alpha < 255) - Projectile.alpha += 5; - if (Projectile.alpha >= 255) - Projectile.Kill(); - } - - //Rotation - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > 8) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - { - Projectile.frame = 0; - } - } - - 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], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Melee/VirulentWave.cs b/Projectiles/Melee/VirulentWave.cs index 4f8ce857f1..5f713dd71e 100644 --- a/Projectiles/Melee/VirulentWave.cs +++ b/Projectiles/Melee/VirulentWave.cs @@ -10,9 +10,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/VoidEssence.cs b/Projectiles/Melee/VoidEssence.cs index 692aea191f..047bad504b 100644 --- a/Projectiles/Melee/VoidEssence.cs +++ b/Projectiles/Melee/VoidEssence.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -17,9 +18,10 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = NumAnimationFrames; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = NumAnimationFrames; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -125,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -151,6 +153,8 @@ namespace CalamityMod.Projectiles.Melee float scale = Main.rand.NextFloat(1.0f, 1.8f); Main.dust[idx].scale = scale; } + + target.AddBuff(ModContent.BuffType(), 180); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Melee/VolcanicFireball.cs b/Projectiles/Melee/VolcanicFireball.cs index 6386cef05d..16215da6ae 100644 --- a/Projectiles/Melee/VolcanicFireball.cs +++ b/Projectiles/Melee/VolcanicFireball.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Melee/VolcanicFireballLarge.cs b/Projectiles/Melee/VolcanicFireballLarge.cs index c031cf1664..690b93fada 100644 --- a/Projectiles/Melee/VolcanicFireballLarge.cs +++ b/Projectiles/Melee/VolcanicFireballLarge.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs deleted file mode 100644 index f6778cd633..0000000000 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class WhiteBoltAura : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 100; - Projectile.height = 2; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 7200f) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - Projectile.Kill(); - } - } - else - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 12f) - { - Projectile.ai[0] = 0f; - if (Projectile.owner == Main.myPlayer) - { - int randOrbXOffset = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); - int randOrbYOffset = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)randOrbXOffset, (float)randOrbYOffset, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); - } - } - } - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 20f) - { - Projectile.localAI[0] = 0f; - int projTimer = 0; - int incTracker = 0; - float aiTracker = 0f; - int theProjectile = Projectile.type; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.owner == Projectile.owner && p.type == theProjectile && p.ai[1] < 3600f) - { - projTimer++; - if (p.ai[1] > aiTracker) - { - incTracker = p.whoAmI; - aiTracker = p.ai[1]; - } - } - } - if (projTimer > 1) - { - Main.projectile[incTracker].netUpdate = true; - Main.projectile[incTracker].ai[1] = 36000f; - } - } - } - - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/Melee/WhiteOrb.cs b/Projectiles/Melee/WhiteOrb.cs deleted file mode 100644 index 75df233253..0000000000 --- a/Projectiles/Melee/WhiteOrb.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class WhiteOrb : 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.extraUpdates = 1; - Projectile.penetrate = 1; - Projectile.ignoreWater = true; - Projectile.timeLeft = 60; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); - - 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 deleted file mode 100644 index 0bf0617dfa..0000000000 --- a/Projectiles/Melee/Whiterain.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class Whiterain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.extraUpdates = 1; - Projectile.penetrate = 2; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.timeLeft = 120; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item125 with { Volume = 0.7f }, Projectile.Center); - } - - Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); - - for (int i = 0; i < 2; i++) - { - int shiny = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemDiamond, 0f, 0f, 100, default, 1.25f); - Main.dust[shiny].noGravity = true; - Main.dust[shiny].velocity *= 0.5f; - Main.dust[shiny].velocity += Projectile.velocity * 0.1f; - } - - CalamityUtils.HomeInOnNPC(Projectile, true, 320f, 14f, 20f); - } - } -} diff --git a/Projectiles/Melee/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs index 263a358bd3..2a245b5267 100644 --- a/Projectiles/Melee/WulfrumScrew.cs +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 60; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 60; + ProjectileID.Sets.TrailingMode[Type] = 0; } public static int Lifetime = 950; @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Melee } } - if (!screwRegained && Main.netMode != NetmodeID.Server) + if (!screwRegained && !Main.dedServ) { Gore screwGore = Gore.NewGorePerfect(Projectile.GetSource_Death(), Projectile.position, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(4f, 6f) + Projectile.velocity * 0.7f, Mod.Find("WulfrumScrewGore").Type); screwGore.timeLeft = 20; @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(CommonCalamitySounds.WulfrumNPCDeathSound, Projectile.Center); SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore screwGore = Gore.NewGorePerfect(Projectile.GetSource_Death(), Projectile.position, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(1f, 3f) + Projectile.velocity * 0.7f, Mod.Find("WulfrumScrewGore").Type); screwGore.timeLeft = 20; @@ -151,8 +151,9 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float distanceFromAim = Projectile.Center.ShortestDistanceToLine(Owner.MountedCenter, Main.MouseWorld); float distanceFromPlayerAcrossSightLine = (Owner.MountedCenter - Projectile.Center.ClosestPointOnLine(Owner.MountedCenter, Main.MouseWorld)).Length(); diff --git a/Projectiles/Melee/WulfrumScrewdriverProj.cs b/Projectiles/Melee/WulfrumScrewdriverProj.cs index e5b86eea6a..9c05c2c756 100644 --- a/Projectiles/Melee/WulfrumScrewdriverProj.cs +++ b/Projectiles/Melee/WulfrumScrewdriverProj.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.width = 14; Projectile.height = 50; Projectile.tileCollide = false; @@ -70,6 +70,7 @@ namespace CalamityMod.Projectiles.Melee if (EndLag == 0) //Initialization { EndLag = (float)Math.Max(Owner.ActiveItem().useTime - MaxTime, 1); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction TrueDirection = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.Zero).ToRotation(); //Store this for the screw hit Projectile.velocity = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.15f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -212,7 +213,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (SmearTex == null) SmearTex = ModContent.Request("CalamityMod/Particles/MediumLongThrust"); diff --git a/Projectiles/Melee/YinYoDark.cs b/Projectiles/Melee/YinYoDark.cs index f4a3ad684b..51cdfe150d 100644 --- a/Projectiles/Melee/YinYoDark.cs +++ b/Projectiles/Melee/YinYoDark.cs @@ -8,11 +8,12 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; private const int speedTimerMax = 30; private int speedTimer = speedTimerMax; + public override string Texture => "Terraria/Images/Item_527"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/YinYoDark.png b/Projectiles/Melee/YinYoDark.png deleted file mode 100644 index 7f62b3dfe7..0000000000 Binary files a/Projectiles/Melee/YinYoDark.png and /dev/null differ diff --git a/Projectiles/Melee/YinYoLight.cs b/Projectiles/Melee/YinYoLight.cs index 13a31524b7..57610ed4d3 100644 --- a/Projectiles/Melee/YinYoLight.cs +++ b/Projectiles/Melee/YinYoLight.cs @@ -8,11 +8,12 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; private const int speedTimerMax = 30; private int speedTimer = 0; + public override string Texture => "Terraria/Images/Item_528"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/YinYoLight.png b/Projectiles/Melee/YinYoLight.png deleted file mode 100644 index 90c73a1903..0000000000 Binary files a/Projectiles/Melee/YinYoLight.png and /dev/null differ diff --git a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs index f43f41c800..bbb24c6f3f 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 30f * MaxUpdates; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 330f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 32f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = AirSpinner.Duration * MaxUpdates; + ProjectileID.Sets.YoyosMaximumRange[Type] = AirSpinner.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = AirSpinner.Speed / MaxUpdates; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AortaYoyo.cs b/Projectiles/Melee/Yoyos/AortaYoyo.cs index 64dd6c5d35..c6c4d32224 100644 --- a/Projectiles/Melee/Yoyos/AortaYoyo.cs +++ b/Projectiles/Melee/Yoyos/AortaYoyo.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 24f * MaxUpdates; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 330f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 25f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = Aorta.Duration * MaxUpdates; + ProjectileID.Sets.YoyosMaximumRange[Type] = Aorta.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Aorta.Speed / MaxUpdates; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.cs b/Projectiles/Melee/Yoyos/AzathothYoyo.cs index 2f99f79c09..029bdbc52e 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -14,12 +15,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 880f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 60f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = Azathoth.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Azathoth.Speed / MaxUpdates; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -41,13 +42,22 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Projectile.owner == Main.myPlayer) 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 (Main.rand.NextBool((int)(MaxUpdates / 2))) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 1f), 0, default, Main.rand.NextFloat(1.85f, 2.2f)); + dust.color = Main.rand.NextBool() ? Color.Magenta : Color.HotPink; + bool b = !Main.rand.NextBool(3); + dust.scale -= b ? 0.8f : 0; + dust.velocity *= b ? 0.4f : 1; + dust.noGravity = !b; + } if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs index c1b176f8e6..71c49e4116 100644 --- a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs +++ b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs @@ -1,8 +1,13 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; 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; @@ -13,52 +18,229 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 3; + public int timer = 0; + public bool canDamage = true; + public bool firing = false; + public NPC targeted; + public float fade = 0; + public int hitCooldown = 0; + + public ref float yoyoPower => ref Projectile.ai[2]; + public int yoyoPowerMax = 1000; + + public bool cloneYoyo = false; + public bool setCloneDamage = false; public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 560f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 54f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = BurningRevelation.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = BurningRevelation.Speed / MaxUpdates; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { Projectile.aiStyle = ProjAIStyleID.Yoyo; - Projectile.width = Projectile.height = 16; + Projectile.width = 30; + Projectile.height = 32; Projectile.friendly = true; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = MaxUpdates; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6 * MaxUpdates; + Projectile.localNPCHitCooldown = 18 * MaxUpdates; } public override void AI() { - if (Main.rand.NextBool(5)) - 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 + // Determine if the yoyo is a yoyo bag/yoyo glove clone + if (!cloneYoyo) + { + int MainYoyo = -1; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.type == Type && proj.owner == Projectile.owner) + { + MainYoyo = x; + break; + } + } + + if (Projectile.whoAmI != MainYoyo) + cloneYoyo = true; + } + if (!setCloneDamage && cloneYoyo) + { + // Since the effects of the yoyo itself are nerfed if it's a clone, it gets a small damage bonus to compensate a bit + Projectile.damage = (int)(Projectile.damage * 1.1f); + setCloneDamage = true; + } + Player Owner = Main.player[Projectile.owner]; + + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.9f); + + // Fading in and out for various visuals + fade = MathHelper.Lerp(fade, (firing ? 1 : 0), 0.03f); + + if (firing) + { + if (targeted == null || targeted.life <= 0) + targeted = Projectile.Center.ClosestNPCAt(600); + + if (timer % (cloneYoyo ? 20 : 10) == 0) // Fire Holy Stars + { + int stardamage = (int)(Projectile.damage * 0.12f); + + Vector2 vel = new Vector2(0, 10).RotatedBy(timer * 0.025f * (cloneYoyo ? -1 : 1)); + Projectile damageStar = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType(), stardamage, Projectile.knockBack, Projectile.owner, 0, 5, (targeted == null ? -1 : targeted.whoAmI)); + damageStar.extraUpdates = 1; + damageStar.scale = 0.6f; + Projectile damageStar2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, -vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 0, 5, (targeted == null ? -1 : targeted.whoAmI)); + damageStar2.extraUpdates = 1; + damageStar2.scale = 0.6f; + + SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, PitchVariance = 0.2f }, Projectile.Center); + } + + // Technically scrapped because the weapon is complex enough, but we might want to use this in the future + /* + if (timer % 60 == 0) // Fire Heal Stars at player (slightly predictive) + { + Vector2 vel = ((Projectile.Center - Owner.Center) - Owner.velocity * 8).SafeNormalize(Vector2.UnitX) * -10; + Projectile healStar = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0, cloneYoyo ? 3 : 10, 5); + healStar.extraUpdates = 2; + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(fireHeal with { Volume = 0.9f, Pitch = 0.3f }, Projectile.Center); + } + */ + + if (timer <= 0) + { + firing = false; + canDamage = true; + yoyoPower = 0; + } + else + timer--; + } + else + { + if (yoyoPower >= yoyoPowerMax) + { + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRay"); + SoundEngine.PlaySound(fireHeal with { Volume = 0.9f, Pitch = 0.3f }, Projectile.Center); + canDamage = false; + firing = true; + timer = 240; + } + if (Main.rand.NextBool(7)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), ((new Vector2(4, 4)).RotatedByRandom(100) + Projectile.velocity) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.15f); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + dust.noLightEmittence = true; + } + yoyoPower++; + } + + if (hitCooldown > 0) + hitCooldown--; + + if ((Projectile.Center - Main.player[Projectile.owner].Center).Length() > 3200f && !firing) // 200 blocks Projectile.Kill(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); - if (Projectile.owner == Main.myPlayer) + if (hitCooldown == 0) { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; + hitCooldown = Projectile.localNPCHitCooldown; + + targeted = target; + yoyoPower += 15; + + // Create Explosion + if (Projectile.owner == Main.myPlayer) + { + float power = Utils.GetLerpValue(-100, yoyoPowerMax, yoyoPower, true); + + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, power); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; + + for (int i = 0; i < (int)(30 * power); i++) + { + if (Main.rand.NextBool()) + { + Particle spark = new CustomSpark(Projectile.Center, ((new Vector2(19, 19) * power).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + bool isSpark = Main.rand.NextBool(5); + Dust dust = Dust.NewDustPerfect(Projectile.Center, isSpark ? 278 : ModContent.DustType(), ((new Vector2(15, 15) * power).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.85f, 2.15f) * power * (isSpark ? 0.5f : 1); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + if (isSpark) + dust.noGravity = false; + else + dust.noLightEmittence = true; + } + } + + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.14f * power, 15); + GeneralParticleHandler.SpawnParticle(orb1); + + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Khaki, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 2.1f * power, 15); + GeneralParticleHandler.SpawnParticle(orb2); + + SoundStyle explode = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); + SoundEngine.PlaySound(explode with { Volume = 0.5f, Pitch = 0.3f * power }, Projectile.Center); + SoundStyle explode2 = new("CalamityMod/Sounds/Item/HeliumFlashReadyAlt"); + SoundEngine.PlaySound(explode2 with { Volume = 0.7f, Pitch = 0.6f * power }, Projectile.Center); + } } + + target.AddBuff(ModContent.BuffType(), 480); } + public override bool? CanDamage() => canDamage ? null : false; + public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D shineTexture = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + // The back glow + float power = Utils.GetLerpValue(-100, yoyoPowerMax, yoyoPower, true); + float randSize = Main.rand.NextFloat(0.9f, 1.1f); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Goldenrod with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.65f * randSize * (1 - fade) * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.45f * randSize * (1 - fade) * power, SpriteEffects.None, 0); + + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Texture2D texture = TextureAssets.Projectile[Type].Value; + + Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * fade, lightColor, 4f * fade, texture); + + // The shine effect + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Goldenrod with { A = 0 }, 0, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 4.25f * randSize * fade, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, 0, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 4.05f * randSize * fade, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Goldenrod with { A = 0 }, MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 4.25f * randSize * fade, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 4.05f * randSize * fade, SpriteEffects.None, 0); + return false; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 50, targetHitbox); } } diff --git a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.png b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.png index f36d305459..af005458c1 100644 Binary files a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.png and b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.png differ diff --git a/Projectiles/Melee/Yoyos/FaultLineYoyo.cs b/Projectiles/Melee/Yoyos/FaultLineYoyo.cs index 2a8f012961..360c7a783f 100644 --- a/Projectiles/Melee/Yoyos/FaultLineYoyo.cs +++ b/Projectiles/Melee/Yoyos/FaultLineYoyo.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 480f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 40f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = FaultLine.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = FaultLine.Speed / MaxUpdates; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Main.rand.NextBool(5)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 127, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - if (Main.rand.NextBool(8) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(8) && !Main.dedServ) { int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, default, Main.rand.Next(375, 378), 0.5f); Main.gore[smoke].behindTiles = true; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs index 986d085580..5946f08042 100644 --- a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs +++ b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 400f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 32f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = TheGodsGambit.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = TheGodsGambit.Speed / MaxUpdates; } public override void SetDefaults() @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 16bcd345fd..43b61fd17b 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 640f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 48f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = Lacerator.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Lacerator.Speed / MaxUpdates; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index d77d1ab63c..183a1b9d1a 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; @@ -24,12 +25,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 512f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 54f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = TheMicrowave.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = TheMicrowave.Speed / MaxUpdates; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -49,24 +50,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void AI() { - // Sound is done manually, so that it can loop correctly. - ActiveSound MMMMMMMMMMMMMMM; - - bool mmmIsThere = SoundEngine.TryGetActiveSound(mmmmmm, out MMMMMMMMMMMMMMM); - - if (!mmmIsThere) - { - mmmmmm = SoundEngine.PlaySound(TheMicrowave.MMMSound, Projectile.Center); - } - - else if (mmmIsThere) - { - if (MMMMMMMMMMMMMMM.IsPlaying) - MMMMMMMMMMMMMMM.Position = Projectile.Center; - - else - MMMMMMMMMMMMMMM.Resume(); - } + SingularSoundInstanceSystem.PlaySingleInstance(TheMicrowave.MMMSound, 6, 6, Projectile); // Spawn invisible but damaging aura projectile if (Projectile.owner == Main.myPlayer && !spawnedAura) @@ -104,19 +88,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.Kill(); } - public override void OnKill(int timeLeft) - { - ActiveSound MMMMMMMMMMMMMMM; - if (SoundEngine.TryGetActiveSound(mmmmmm, out MMMMMMMMMMMMMMM)) - { - MMMMMMMMMMMMMMM.Stop(); - //No more dispose function? - } - } - public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index 4676977462..95d5798836 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 720f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 54f / UpdatesPerFrame; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = TheObliterator.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = TheObliterator.Speed / UpdatesPerFrame; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Yoyos/OblivionYoyo.cs b/Projectiles/Melee/Yoyos/OblivionYoyo.cs index ded14484d2..257a5f2c41 100644 --- a/Projectiles/Melee/Yoyos/OblivionYoyo.cs +++ b/Projectiles/Melee/Yoyos/OblivionYoyo.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 512f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 36f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = Oblivion.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Oblivion.Speed / MaxUpdates; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index db442ce25f..f3faadcc66 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 800f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 60f / UpdatesPerFrame; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = TheOracle.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = TheOracle.Speed / UpdatesPerFrame; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SendExtraAI(BinaryWriter writer) @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos cloneOffset = cloneOffset.RotatedBy(counter * 0.06f); if (Owner.controlUseItem) { - Projectile.Center = Main.MouseWorld + cloneOffset; + Projectile.Center = Main.player[Projectile.owner].ClampedMouseWorld() + cloneOffset; Projectile.velocity = Vector2.Zero; } } @@ -210,7 +210,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Yoyos/PandemicYoyo.cs b/Projectiles/Melee/Yoyos/PandemicYoyo.cs index bb0ac459d2..7c0eba0a05 100644 --- a/Projectiles/Melee/Yoyos/PandemicYoyo.cs +++ b/Projectiles/Melee/Yoyos/PandemicYoyo.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public const int MaxUpdates = 2; public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 480f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 40f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = Pandemic.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Pandemic.Speed / MaxUpdates; } public override void SetDefaults() @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 281c95a226..0f165f509e 100644 --- a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 480f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 36f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = Quagmire.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Quagmire.Speed / MaxUpdates; } public override void SetDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 464e265922..1f151bb14f 100644 --- a/Projectiles/Melee/Yoyos/RiptideYoyo.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 18f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 288f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 25f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = Riptide.Duration; + ProjectileID.Sets.YoyosMaximumRange[Type] = Riptide.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Riptide.Speed; } public override void SetDefaults() { Projectile.aiStyle = ProjAIStyleID.Yoyo; - Projectile.width = Projectile.height = 16; + Projectile.width = Projectile.height = 22; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 150; @@ -48,70 +48,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.Kill(); Projectile.localAI[1]++; - if (Projectile.localAI[1] % 15f == 0f) + if (Projectile.localAI[1] % 32f == 0f) { - float xVelocity = 0f; - float yVelocity = -10f; - float xIncrement = 1.2f; - float yIncrement = 0.2f; - switch (Projectile.localAI[1] / 15f) - { - case 1: - break; - - case 2: - xVelocity = 5f; - yVelocity = -5f; - xIncrement = 0.7f; - yIncrement = 0.7f; - break; - - case 3: - xVelocity = 10f; - yVelocity = 0f; - xIncrement = 0.2f; - yIncrement = 1.2f; - break; - - case 4: - xVelocity = 5f; - yVelocity = 5f; - xIncrement = -0.7f; - yIncrement = 0.7f; - break; - - case 5: - xVelocity = 0f; - yVelocity = 10f; - xIncrement = -1.2f; - yIncrement = -0.2f; - break; - - case 6: - xVelocity = -5f; - yVelocity = 5f; - xIncrement = -0.7f; - yIncrement = -0.7f; - break; - - case 7: - xVelocity = -10f; - yVelocity = 0f; - xIncrement = -0.2f; - yIncrement = -1.2f; - break; - - case 8: - Projectile.localAI[1] = 0f; - xVelocity = -10f; - yVelocity = -10f; - xIncrement = 0.7f; - yIncrement = -0.7f; - break; - } - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(xVelocity, yVelocity), ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, xIncrement, yIncrement); + + // ai[0] is the yoyo's index, ai[1] is the rotation, ai[2] is the texture + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 10f, Projectile.owner, Projectile.whoAmI, Main.rand.NextFloat(MathHelper.TwoPi), Main.rand.Next(3)); } } } diff --git a/Projectiles/Melee/Yoyos/RiptideYoyo.png b/Projectiles/Melee/Yoyos/RiptideYoyo.png index 97b8560044..af91b0fa08 100644 Binary files a/Projectiles/Melee/Yoyos/RiptideYoyo.png and b/Projectiles/Melee/Yoyos/RiptideYoyo.png differ diff --git a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs index df7f2d90c3..aafd77a7a4 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 448f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 36f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = Shimmerspark.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Shimmerspark.Speed / MaxUpdates; } public override void SetDefaults() @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 11fbb9e90f..6b0f95fda7 100644 --- a/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs +++ b/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 21f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 320f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 20f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = SmokingComet.Duration; + ProjectileID.Sets.YoyosMaximumRange[Type] = SmokingComet.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = SmokingComet.Speed; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -180,7 +180,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Main.spriteBatch.Draw(stringTexture, new Vector2(vector.X - Main.screenPosition.X + (float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width() * 0.5f, vector.Y - Main.screenPosition.Y + (float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Height() * 0.5f) - new Vector2(6f, 0f), new Rectangle(0, 0, ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width(), (int)chainWidth), Color.White, stringHelper, new Vector2((float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width() * 0.5f, 0f), 1f, SpriteEffects.None, 0f); } - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs index d47df05a8d..e91a946d9f 100644 --- a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs +++ b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 400f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 16f; // 32 effective, 48 bubbled + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = SulphurousGrabber.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = SulphurousGrabber.Speed / 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -97,12 +97,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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) { tex = ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, tex); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, tex); } return false; } diff --git a/Projectiles/Melee/Yoyos/YinYoyo.cs b/Projectiles/Melee/Yoyos/YinYoyo.cs index 0dae90d883..167cfbd4c7 100644 --- a/Projectiles/Melee/Yoyos/YinYoyo.cs +++ b/Projectiles/Melee/Yoyos/YinYoyo.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 400f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 32f / MaxUpdates; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Type] = YinYo.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = YinYo.Speed / MaxUpdates; } public override void SetDefaults() @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/YinYoyo.png b/Projectiles/Melee/Yoyos/YinYoyo.png index 50643ceb0a..a3314eaaad 100644 Binary files a/Projectiles/Melee/Yoyos/YinYoyo.png and b/Projectiles/Melee/Yoyos/YinYoyo.png differ diff --git a/Projectiles/Pets/Akato.cs b/Projectiles/Pets/Akato.cs index a7e6431f73..7f422f60b0 100644 --- a/Projectiles/Pets/Akato.cs +++ b/Projectiles/Pets/Akato.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 6; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Type], 6) .WithOffset(-38f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/Astrophage.cs b/Projectiles/Pets/Astrophage.cs index b44752567f..081821e8f7 100644 --- a/Projectiles/Pets/Astrophage.cs +++ b/Projectiles/Pets/Astrophage.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 5; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Type], 6) .WithOffset(-10f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/BabyGhostBell.cs b/Projectiles/Pets/BabyGhostBell.cs index 9af28bf336..ec696d2407 100644 --- a/Projectiles/Pets/BabyGhostBell.cs +++ b/Projectiles/Pets/BabyGhostBell.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.LightPet[Projectile.type] = true; + Main.projFrames[Type] = 4; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Pets/Bear.cs b/Projectiles/Pets/Bear.cs index b07928bc79..1219fbbc89 100644 --- a/Projectiles/Pets/Bear.cs +++ b/Projectiles/Pets/Bear.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 22; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 22; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 13, 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 13, 6) .WithOffset(-20f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/BendyPet.cs b/Projectiles/Pets/BendyPet.cs index 5d5d505804..75c302d373 100644 --- a/Projectiles/Pets/BendyPet.cs +++ b/Projectiles/Pets/BendyPet.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.LightPet[Projectile.type] = true; + Main.projFrames[Type] = 5; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; } public override void SetDefaults() @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Pets Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -223,8 +223,8 @@ namespace CalamityMod.Projectiles.Pets public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) @@ -236,7 +236,7 @@ namespace CalamityMod.Projectiles.Pets public override void PostDraw(Color lightColor) { Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Pets/BendyPetGlow").Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Pets/BrimlingPet.cs b/Projectiles/Pets/BrimlingPet.cs index fd95edd8ed..8b7e5d7d9c 100644 --- a/Projectiles/Pets/BrimlingPet.cs +++ b/Projectiles/Pets/BrimlingPet.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 8; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 4, 5) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 4, 5) .WithOffset(-25f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 9954324dac..4d38d44c8c 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 11; //same as black cat - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 11; //same as black cat + Main.projPet[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Type], 6) .WithOffset(-7f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } @@ -53,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; @@ -75,14 +75,14 @@ IL_6899: { trailColorChange = (float)(1 - counter); } - colorAlpha *= trailColorChange / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + colorAlpha *= trailColorChange / ((float)ProjectileID.Sets.TrailCacheLength[Type] * 1.5f); Vector2 oldDrawPos = Projectile.oldPos[counter]; float projRotate = Projectile.rotation; SpriteEffects effects = spriteEffects; 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(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); + Main.spriteBatch.Draw(Terraria.GameContent.TextureAssets.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; } @@ -175,7 +175,7 @@ IL_6899: //companion cube lighting check and stab // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Color color; diff --git a/Projectiles/Pets/ChibiiDoggoFly.cs b/Projectiles/Pets/ChibiiDoggoFly.cs index b726b1f09f..2775e51300 100644 --- a/Projectiles/Pets/ChibiiDoggoFly.cs +++ b/Projectiles/Pets/ChibiiDoggoFly.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projPet[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 origin2 = rectangle.Size() / 2f; @@ -58,14 +58,14 @@ IL_6899: { trailColorChange = (float)(1 - counter); } - colorAlpha *= trailColorChange / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + colorAlpha *= trailColorChange / ((float)ProjectileID.Sets.TrailCacheLength[Type] * 1.5f); Vector2 oldDrawPos = Projectile.oldPos[counter]; float projRotate = Projectile.rotation; SpriteEffects effects = spriteEffects; 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(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); + Main.spriteBatch.Draw(Terraria.GameContent.TextureAssets.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/ChibiiDoggoFly.png b/Projectiles/Pets/ChibiiDoggoFly.png index 04ac5eb788..da5e4805c0 100644 Binary files a/Projectiles/Pets/ChibiiDoggoFly.png and b/Projectiles/Pets/ChibiiDoggoFly.png differ diff --git a/Projectiles/Pets/ChibiiDoggoFlyMonochrome.png b/Projectiles/Pets/ChibiiDoggoFlyMonochrome.png index 01fd2cd453..6feebe1cde 100644 Binary files a/Projectiles/Pets/ChibiiDoggoFlyMonochrome.png and b/Projectiles/Pets/ChibiiDoggoFlyMonochrome.png differ diff --git a/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs b/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs index a07e9ce4fc..c43192e054 100644 --- a/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs +++ b/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs @@ -1,6 +1,10 @@ -using CalamityMod.Buffs.Pets; +using System; +using CalamityMod.Buffs.Pets; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Pets @@ -8,79 +12,173 @@ namespace CalamityMod.Projectiles.Pets public class DaawnlightSpiritOriginMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Pets"; - public Player Owner => Main.player[Projectile.owner]; - public override void SetStaticDefaults() + + private Player Owner => Main.player[Projectile.owner]; + + public enum AnimationState { Idle, Pointing } + + public AnimationState CurrentAnimation { - Main.projFrames[Projectile.type] = 12; + get => (AnimationState)Projectile.ai[0]; + set + { + Projectile.ai[0] = (float)value; + + switch (value) + { + case AnimationState.Idle: + { + _animationFrames = 5; + _delayPerAnimationFrame = 9; + Projectile.frame = 0; + Projectile.frameCounter = 0; + break; + } + + case AnimationState.Pointing: + { + _animationFrames = 9; + _delayPerAnimationFrame = 5; + Projectile.frame = 0; + Projectile.frameCounter = 0; + break; + } + } + + Projectile.netUpdate = true; + } } + private int _animationFrames = 5; + + private int _delayPerAnimationFrame = 9; + + private Vector2 _smoothedBobble; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 9; + public override void SetDefaults() { - Projectile.width = 146; - Projectile.height = 164; - Projectile.netImportant = true; + Projectile.width = 138; + Projectile.height = 218; Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 18000; Projectile.tileCollide = false; + Projectile.netImportant = true; } + public override void OnSpawn(IEntitySource source) => _smoothedBobble = Projectile.Center - Main.screenPosition; + public override void AI() { + ShouldPetExist(); + DoMovement(); + DoAnimation(); + } + + /// + /// A method that is checked every frame to see if the pet should be exist at any given moment. + /// + private void ShouldPetExist() + { + // If the owner just disappeared, the pet should vanish. + // For example if in a multiplayer game, the player disconnected. if (!Owner.active) { Projectile.active = false; return; } - HandlePetStuff(); - DoMovement(); - HandleFrames(); - } - public void HandlePetStuff() - { + // If the owner just died, or doesn't have DSO equipped, or decided to turn off the vanity, + // the pet should not appear. if (Owner.dead || !Owner.Calamity().spiritOrigin && !Owner.Calamity().spiritOriginVanity) Owner.Calamity().spiritOriginPet = false; + + // If the pet is not supposed to appear, if there's one, should die immediately. if (Owner.Calamity().spiritOriginPet) Projectile.timeLeft = 2; } - public void DoMovement() + /// + /// A method that contains how the pet is supposed to move around. + /// + private void DoMovement() { - if (Projectile.WithinRange(Owner.Center, 100f)) + if (Projectile.WithinRange(Owner.Center , 100f)) Projectile.velocity *= 0.975f; else { float flySpeed = MathHelper.Clamp(11f + Projectile.Distance(Owner.Center) * 0.015f, 11f, 25f); - Projectile.velocity = Projectile.velocity.MoveTowards(Projectile.SafeDirectionTo(Owner.Center) * flySpeed, flySpeed * 0.02f); - if (!Projectile.WithinRange(Owner.Center, 2200f)) + Projectile.velocity = Projectile.velocity.MoveTowards(Projectile.SafeDirectionTo(Owner.Center) * flySpeed , flySpeed * 0.02f); + if (!Projectile.WithinRange(Owner.Center , 2200f)) { Projectile.Center = Owner.Center; Projectile.velocity = -Vector2.UnitY * 4f; - Projectile.netUpdate = true; } } - if (MathHelper.Distance(Projectile.Center.X, Owner.Center.X) > 80f) + if (MathHelper.Distance(Projectile.Center.X , Owner.Center.X) > 80f) Projectile.spriteDirection = (Projectile.Center.X > Owner.Center.X).ToDirectionInt(); } - public void HandleFrames() + /// + /// A method that contains how this pet should be animated. + /// + public void DoAnimation() { - if (Owner.Calamity().spiritOriginBullseyeShootCountdown > 0) - Projectile.frame = (int)MathHelper.Lerp(5f, Main.projFrames[Projectile.type] - 0.1f, 1f - Owner.Calamity().spiritOriginBullseyeShootCountdown / 45f); - else + if (CurrentAnimation == AnimationState.Idle) { Projectile.frameCounter++; - if (Projectile.frameCounter % 7 == 6) - Projectile.frame = (Projectile.frame + 1) % 5; + if (Projectile.frameCounter == _delayPerAnimationFrame) + { + Projectile.frame = (Projectile.frame + 1) % _animationFrames; + Projectile.frameCounter = 0; + } + } + else + { + if (Projectile.frame == 6 && Projectile.frameCounter != 8) + { + Projectile.frameCounter++; + return; + } + + if (Owner.miscCounter % (Projectile.frame > 5 ? 8 : 4) == 0) + Projectile.frame = Math.Min(Projectile.frame + 1 , _animationFrames - 1); + + if (Projectile.frame == _animationFrames - 1) + CurrentAnimation = AnimationState.Idle; } } + // This pet cannot damage anything and cannot interact with the enviroment (Breaking pots, vines, etc). + public override bool? CanDamage() => false; + public override void OnKill(int timeLeft) { if (Owner.FindBuffIndex(ModContent.BuffType()) != -1) Owner.ClearBuff(ModContent.BuffType()); } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(horizontalFrames: 2, verticalFrames: 9, frameX: (int)CurrentAnimation, frameY: Projectile.frame); + + drawPosition += Vector2.UnitY * CalamityUtils.Convert01To010(Utils.GetLerpValue(0 , _animationFrames - 1 , Projectile.frame , clamped: true)) * 12f; + _smoothedBobble = Vector2.Lerp(_smoothedBobble , drawPosition , 0.05f); + + Main.EntitySpriteDraw( + texture , + _smoothedBobble , + frame , + Projectile.GetAlpha(lightColor) , + Projectile.rotation , + frame.Size() * 0.5f , + Projectile.scale , + Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + return false; + } } } diff --git a/Projectiles/Pets/DaawnlightSpiritOriginMinion.png b/Projectiles/Pets/DaawnlightSpiritOriginMinion.png index 427e48ad54..3870c1f5e9 100644 Binary files a/Projectiles/Pets/DaawnlightSpiritOriginMinion.png and b/Projectiles/Pets/DaawnlightSpiritOriginMinion.png differ diff --git a/Projectiles/Pets/DannyDevitoPet.cs b/Projectiles/Pets/DannyDevitoPet.cs index 43b6b5f3f1..a57bd3e2d5 100644 --- a/Projectiles/Pets/DannyDevitoPet.cs +++ b/Projectiles/Pets/DannyDevitoPet.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 8; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(2, 5, 5) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(2, 5, 5) .WithOffset(-12f, 2f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/EidolonSnail.cs b/Projectiles/Pets/EidolonSnail.cs index 5e1e05f16b..7e8f2c8910 100644 --- a/Projectiles/Pets/EidolonSnail.cs +++ b/Projectiles/Pets/EidolonSnail.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 12; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 4, 5) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 4, 5) .WithOffset(-18f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0); } @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Pets { Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Pets/EidolonSnail").Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Pets { Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Pets/EidolonSnailGlow").Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Pets/FlakPet.cs b/Projectiles/Pets/FlakPet.cs index 2f60ed8740..afdace01c1 100644 --- a/Projectiles/Pets/FlakPet.cs +++ b/Projectiles/Pets/FlakPet.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 7; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(2, 4, 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(2, 4, 6) .WithOffset(-7f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/FoxPet.cs b/Projectiles/Pets/FoxPet.cs index 3dafc5d4bd..148b6862f5 100644 --- a/Projectiles/Pets/FoxPet.cs +++ b/Projectiles/Pets/FoxPet.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 11; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 11; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 7, 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 7, 6) .WithOffset(-35f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/GoldiePet.cs b/Projectiles/Pets/GoldiePet.cs index 1479dff3f8..3fc1a3d6ee 100644 --- a/Projectiles/Pets/GoldiePet.cs +++ b/Projectiles/Pets/GoldiePet.cs @@ -20,9 +20,9 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.LightPet[Projectile.type] = true; + Main.projFrames[Type] = 5; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; } public override void SetDefaults() @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Pets return; Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Lighting.AddLight(Projectile.Center, GoldColor.ToVector3() * (0.9f + 0.45f * SparkleTimer / MaxSparkleTime)); if (SparkleTimer < MaxBloomTime) diff --git a/Projectiles/Pets/KendraPet.cs b/Projectiles/Pets/KendraPet.cs index c05c9a6eeb..417fb901bf 100644 --- a/Projectiles/Pets/KendraPet.cs +++ b/Projectiles/Pets/KendraPet.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 31; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 31; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 13, 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 13, 6) .WithOffset(-30f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } @@ -354,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 ca68ec4c9c..128d560148 100644 --- a/Projectiles/Pets/LadShark.cs +++ b/Projectiles/Pets/LadShark.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projPet[Projectile.type] = true; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 0, 1) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 0, 1) .WithOffset(-12f, -12f).WithSpriteDirection(-1); } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Pets { if (Projectile.owner == Main.myPlayer) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int heartCount = Main.rand.Next(20, 31); for (int i = 0; i < heartCount; i++) diff --git a/Projectiles/Pets/LeviPet.cs b/Projectiles/Pets/LeviPet.cs index d7505a1750..dcf9d60e09 100644 --- a/Projectiles/Pets/LeviPet.cs +++ b/Projectiles/Pets/LeviPet.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 5; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Type], 6) .WithOffset(-18f, -12f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/LittleLightProj.cs b/Projectiles/Pets/LittleLightProj.cs index 670adb081a..c9988efd4c 100644 --- a/Projectiles/Pets/LittleLightProj.cs +++ b/Projectiles/Pets/LittleLightProj.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Pets public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 9; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.LightPet[Projectile.type] = true; + Main.projFrames[Type] = 9; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; } public override void SetDefaults() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Pets public void HandleFrames() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; } public void DoSpinEffect() diff --git a/Projectiles/Pets/LordePet.cs b/Projectiles/Pets/LordePet.cs index d44b91473b..96843ca749 100644 --- a/Projectiles/Pets/LordePet.cs +++ b/Projectiles/Pets/LordePet.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Pets public override string Texture => "CalamityMod/NPCs/Other/THELORDE"; public override void SetStaticDefaults() { - Main.projPet[Projectile.type] = true; + Main.projPet[Type] = true; } public override void SetDefaults() @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Pets SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 46508b2fe8..8c593910ba 100644 --- a/Projectiles/Pets/MiniHiveMind.cs +++ b/Projectiles/Pets/MiniHiveMind.cs @@ -17,12 +17,12 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 16; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 16; + Main.projPet[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Type], 6) .WithOffset(-12f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Pets { Projectile.frame++; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Pets/OceanSpirit.cs b/Projectiles/Pets/OceanSpirit.cs index 64e4cb27e1..233fb80d29 100644 --- a/Projectiles/Pets/OceanSpirit.cs +++ b/Projectiles/Pets/OceanSpirit.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 17; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.LightPet[Projectile.type] = true; + Main.projFrames[Type] = 17; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Pets/PerforaMini.cs b/Projectiles/Pets/PerforaMini.cs index 64659ece26..d11e8856f5 100644 --- a/Projectiles/Pets/PerforaMini.cs +++ b/Projectiles/Pets/PerforaMini.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 8; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Type], 6) .WithOffset(-8f, -20f).WithSpriteDirection(1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/PineapplePetProj.cs b/Projectiles/Pets/PineapplePetProj.cs index 4ab4afddce..c7a8323e1e 100644 --- a/Projectiles/Pets/PineapplePetProj.cs +++ b/Projectiles/Pets/PineapplePetProj.cs @@ -11,10 +11,10 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 5; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Type], 6) .WithOffset(-2f, -20f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Pets Projectile.frameCounter++; if (Projectile.frameCounter > 6) { - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; Projectile.frameCounter = 0; } diff --git a/Projectiles/Pets/PlaguebringerBab.cs b/Projectiles/Pets/PlaguebringerBab.cs index 5bcc934fc0..60bff4d0a0 100644 --- a/Projectiles/Pets/PlaguebringerBab.cs +++ b/Projectiles/Pets/PlaguebringerBab.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 6; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 4, 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 4, 6) .WithOffset(-25f, -20f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/PrimroseKeepsakeDisplay.cs b/Projectiles/Pets/PrimroseKeepsakeDisplay.cs index 6fca15e509..5f4baf9ecf 100644 --- a/Projectiles/Pets/PrimroseKeepsakeDisplay.cs +++ b/Projectiles/Pets/PrimroseKeepsakeDisplay.cs @@ -10,9 +10,9 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projPet[Projectile.type] = true; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 0, 1) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 0, 1) .WithOffset(-22f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/RadiatorPet.cs b/Projectiles/Pets/RadiatorPet.cs index 701e26229d..406c8e749d 100644 --- a/Projectiles/Pets/RadiatorPet.cs +++ b/Projectiles/Pets/RadiatorPet.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.LightPet[Projectile.type] = true; + Main.projFrames[Type] = 4; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Pets/RotomPet.cs b/Projectiles/Pets/RotomPet.cs index b58699ab21..f9920c8963 100644 --- a/Projectiles/Pets/RotomPet.cs +++ b/Projectiles/Pets/RotomPet.cs @@ -26,10 +26,10 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 4; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Type], 6) .WithOffset(-10f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0); } @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Pets public override bool PreDraw(ref Color lightColor) { Drawing(lightColor, - Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, + Terraria.GameContent.TextureAssets.Projectile[Type].Value, ModContent.Request("CalamityMod/Projectiles/Pets/RotomDex").Value, ModContent.Request("CalamityMod/Projectiles/Pets/RotomWash").Value, ModContent.Request("CalamityMod/Projectiles/Pets/RotomHeat").Value, @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Pets break; } - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Pets/SCalPet.cs b/Projectiles/Pets/SCalPet.cs index 9ae7ed1612..e36dffffe6 100644 --- a/Projectiles/Pets/SCalPet.cs +++ b/Projectiles/Pets/SCalPet.cs @@ -11,10 +11,10 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 6; + Main.projPet[Type] = true; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Type], 6) .WithOffset(-12f, -18).WithSpriteDirection(-1).WhenNotSelected(0, 0); } @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Pets Projectile.frameCounter++; if (Projectile.frameCounter > 6) { - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; Projectile.frameCounter = 0; } } diff --git a/Projectiles/Pets/Sparks.cs b/Projectiles/Pets/Sparks.cs index 036204101e..e7918942b7 100644 --- a/Projectiles/Pets/Sparks.cs +++ b/Projectiles/Pets/Sparks.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.LightPet[Projectile.type] = true; + Main.projFrames[Type] = 4; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; } public override void SetDefaults() @@ -76,15 +76,7 @@ namespace CalamityMod.Projectiles.Pets { continue; //Main.PlaySound(7, (int)player.position.X, (int)player.position.Y, 1); - //player.statLife += 20; - //if (Main.myPlayer == player.whoAmI) - //{ - // player.HealEffect(20, true); - //} - //if (player.statLife > player.statLifeMax2) - //{ - // player.statLife = player.statLifeMax2; - //} + //player.HealPlayer(20); //Main.item[itemIndex] = new Item(); //if (Main.netMode == 1) //{ @@ -461,12 +453,12 @@ namespace CalamityMod.Projectiles.Pets public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (color == 1) texture = ModContent.Request("CalamityMod/Projectiles/Pets/SparksBlue").Value; if (color == 2) texture = ModContent.Request("CalamityMod/Projectiles/Pets/SparksGreen").Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Pets/ThirdSage.cs b/Projectiles/Pets/ThirdSage.cs index 8aa69533f3..1191d75421 100644 --- a/Projectiles/Pets/ThirdSage.cs +++ b/Projectiles/Pets/ThirdSage.cs @@ -11,10 +11,10 @@ namespace CalamityMod.Projectiles.Pets public new string LocalizationCategory => "Projectiles.Pets"; public override void SetStaticDefaults() { - Main.projPet[Projectile.type] = true; - Main.projFrames[Projectile.type] = 7; + Main.projPet[Type] = true; + Main.projFrames[Type] = 7; - ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 4, 6) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 4, 6) .WithOffset(-15f, -5f).WithSpriteDirection(1).WhenNotSelected(0, 0); } diff --git a/Projectiles/Pets/YharonSonPet.cs b/Projectiles/Pets/YharonSonPet.cs index 0992ce81da..32a8114fb5 100644 --- a/Projectiles/Pets/YharonSonPet.cs +++ b/Projectiles/Pets/YharonSonPet.cs @@ -29,11 +29,11 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - Main.projPet[Projectile.type] = true; + Main.projPet[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) + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(1, 1, int.MaxValue) .WithOffset(-55f, 2f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Pets { if (Projectile.frameCounter <= 1) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/AcidRocket.cs b/Projectiles/Ranged/AcidRocket.cs new file mode 100644 index 0000000000..982bd2cb2c --- /dev/null +++ b/Projectiles/Ranged/AcidRocket.cs @@ -0,0 +1,217 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class AcidRocket : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public NPC chosenTarget; + public bool stuckInTarget = false; + public bool stuckInGround = false; + public int stuckTimer = 200; + public bool canDamage = true; + public bool canStick = true; + public Vector2 vibrate = Vector2.Zero; + public Vector2 placementCenter; + float placementDistance; + public Vector2 storedVelocity; + Vector2 placementVelocity; + + public ref float RocketID => ref Projectile.ai[0]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } + + public override void SetDefaults() + { + Projectile.width = 36; + Projectile.height = 36; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 11; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + float power = 3; + vibrate = Main.rand.NextVector2Circular(power, power); + // Home in on enemies if not sticking to anything. + if (!stuckInTarget) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 720f, 16f, Projectile.MaxUpdates * 20f); + // Trailing effects, only applied when homing + if (!Main.dedServ && Projectile.FinalExtraUpdate() && Projectile.velocity.Length() > 3f) + { + Color color = new Color(136, 211, 113, 127); + Color fadeColor = new Color(165, 165, 86); + Vector2 gasSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); + Vector2 gasVelocity = Projectile.velocity * 1.2f + Projectile.velocity.RotatedBy(0.75f) * 0.3f; + gasVelocity *= Main.rand.NextFloat(0.24f, 0.6f); + + Particle gas = new MediumMistParticle(gasSpawnPosition, gasVelocity, color, fadeColor, Main.rand.NextFloat(0.5f, 1f), 205 - Main.rand.Next(50), 0.02f); + GeneralParticleHandler.SpawnParticle(gas); + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.13f * (i == 0 ? 0.2f : 0.5f), Color.Lerp(Color.SeaGreen, Color.PaleGreen, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 2; i++) + { + Color bubbleColor = Main.rand.NextBool() ? Color.SeaGreen : Color.YellowGreen; + Vector2 bubbleSpawnPos = Projectile.Center + Main.rand.NextVector2Circular(50, 50); + Vector2 bubbleVelocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f); + Particle bubble = new DirectionalPulseRing(bubbleSpawnPos, bubbleVelocity, bubbleColor, new Vector2(0.8f, 1), 0, 0.1f, 0f, 75); + GeneralParticleHandler.SpawnParticle(bubble); + } + } + } + else if (stuckInTarget) + { + placementCenter = chosenTarget.Center + placementVelocity * placementDistance + storedVelocity; + + Projectile.Center = placementCenter; + Projectile.rotation = (storedVelocity).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2; + stuckTimer--; + if (chosenTarget.life <= 0 || chosenTarget == null) + stuckTimer = 0; + if (stuckTimer == 0) + { + Projectile.Kill(); + } + if (stuckTimer == 40) + { + SoundStyle Primed = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort"); + SoundEngine.PlaySound(Primed with { Volume = 0.5f }, Projectile.Center); + } + } + Projectile.Opacity = 1f; + } + public override bool? CanDamage() => canDamage ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (target == chosenTarget) + target.AddBuff(ModContent.BuffType(), 180); + if (!stuckInTarget && canStick) + { + canDamage = false; + Projectile.rotation = (Projectile.velocity).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2; + placementDistance = -Vector2.Distance(target.Center, Projectile.Center); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + placementCenter = placementVelocity * (placementDistance * 0.01f); + chosenTarget = target; + stuckInTarget = true; + storedVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8; + Projectile.velocity = Vector2.Zero; + } + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnSpawn(IEntitySource source) + { + float rotation = Projectile.velocity.ToRotation(); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Projectile.velocity / 2, Color.Gray, new Vector2(1f, 3f), rotation, 0.08f, 0.2f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + } + + public override void OnKill(int timeLeft) + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); + 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, + }; + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + SoundEngine.PlaySound(fire with { Volume = 0.9f, Pitch = -0.3f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); + if (Projectile.owner == Main.myPlayer) + { + //The explosion has a different damage scaling depending on which rocket type you have. Left is Cluster Rocket, right is Non-Cluster. + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 1.5f : 2)), Projectile.knockBack, Projectile.owner); + if (isClusterRocket) + { + for (int k = 0; k < 3; k++) + { + Vector2 acidVelocity = (Vector2.UnitY * (-12f + Main.rand.NextFloat(-3f, 4f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity + acidVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), Projectile.knockBack, Projectile.owner, RocketID); + } + } + } + // Circular spread of clouds and bubbles for impact + for (int i = 0; i < 35; i++) + { + Vector2 smokeVel = Main.rand.NextVector2Unit() * Main.rand.NextVector2Circular(32f, 32f); + Color smokeColor = Main.rand.NextBool() ? Color.SeaGreen : Color.PaleGreen; + Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(1.4f, 4f), (200 - Main.rand.Next(60)), 0.08f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 8; i++) + { + Vector2 bubbleVel = Main.rand.NextVector2Circular(26f, 26f); + Color bubbleColor = Main.rand.NextBool() ? Color.OliveDrab : Color.SeaGreen; + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center, bubbleVel, bubbleColor, new Vector2(0.8f, 1), 0, 0.21f, 0f, 50); + GeneralParticleHandler.SpawnParticle(pulse); + } + //Explosion effect + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.SeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + public override bool PreDraw(ref Color lightColor) + { + float glowOutwardness = MathHelper.SmoothStep(3f, 0f, Utils.GetLerpValue(90f, 270f, stuckTimer, true)); + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition; + Vector2 origin = frame.Size() * 0.5f; + Color glowColor = Color.Lerp(Color.YellowGreen, Color.Lime, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 5f) * 0.5f + 0.5f); + glowColor.A = 0; + + if (stuckInTarget) + { + for (int i = 0; i < 8; i++) + { + drawPosition = Projectile.Center + (MathHelper.TwoPi * i / 8f + Main.GlobalTimeWrappedHourly * 4f).ToRotationVector2() * glowOutwardness - Main.screenPosition; + Main.EntitySpriteDraw(Texture, drawPosition, frame, Projectile.GetAlpha(glowColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + } + } + drawPosition = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(Texture, drawPosition + vibrate, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Projectiles/Ranged/AcidRocket.png b/Projectiles/Ranged/AcidRocket.png new file mode 100644 index 0000000000..4887726b1b Binary files /dev/null and b/Projectiles/Ranged/AcidRocket.png differ diff --git a/Projectiles/Ranged/AdamAcceleratorBeam.cs b/Projectiles/Ranged/AdamAcceleratorBeam.cs index bd50ea7155..84159ca526 100644 --- a/Projectiles/Ranged/AdamAcceleratorBeam.cs +++ b/Projectiles/Ranged/AdamAcceleratorBeam.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Ranged Color beamColor = GetBeamColor(polarity); ProduceBeamDust(beamColor); // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); // A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds. @@ -181,7 +181,7 @@ namespace CalamityMod.Projectiles.Ranged if (beamVector == Vector2.Zero || Projectile.velocity != Vector2.Zero) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/AngelicBeam.cs b/Projectiles/Ranged/AngelicBeam.cs index a63d849af3..6748cc971a 100644 --- a/Projectiles/Ranged/AngelicBeam.cs +++ b/Projectiles/Ranged/AngelicBeam.cs @@ -1,6 +1,15 @@ -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 Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class AngelicBeam : ModProjectile, ILocalizedModType @@ -8,57 +17,105 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + // Due to how far/fast this thing moves, it'd require way too many points for a smooth long trail using oldPos + public List TrailPos = new List(); + public static int Lifetime = 300; + public static int Fadetime = 30; + + public override void SetStaticDefaults() => ProjectileID.Sets.DrawScreenCheckFluff[Type] = 2000; + public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = Projectile.height = 32; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; - Projectile.alpha = 255; - // Hitscan laser with a long range - Projectile.timeLeft = 200; - Projectile.extraUpdates = 200; + // Effectively hitscan + Projectile.timeLeft = Lifetime; + Projectile.MaxUpdates = Lifetime; Projectile.penetrate = -1; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 20; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - // Actual laser dust - for (int i = 0; i < 7; ++i) + // Begin fading once the laser is fully spawned in + if (Projectile.ai[0] > 0f) { - int dustType = 262; // Main.rand.NextBool() ? 244 : 246; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - - Main.dust[idx].noGravity = true; - Main.dust[idx].position -= i * 0.1666f * Projectile.velocity; - Main.dust[idx].velocity *= 1f; - float scale = Main.rand.NextFloat(0.8f, 1.4f); - Main.dust[idx].scale = scale; + Projectile.Opacity = Utils.GetLerpValue(0f, Fadetime, Projectile.timeLeft, true); + return; + } + else if (Projectile.timeLeft == 1) + { + Projectile.ai[0] = 1f; + Projectile.MaxUpdates = 1; + Projectile.timeLeft = Fadetime; } - // Sparkles "burning off" of the laser beam + if (Projectile.FinalExtraUpdate() || Projectile.numUpdates % 30 == 29 || TrailPos == null) + { + // Initialize 10 points immediately + if (TrailPos == null) + { + TrailPos = new List(10); + for (int i = 0; i < 10; ++i) + TrailPos.Add(Projectile.Center); + } + + TrailPos.Insert(0, Projectile.Center); + + while (TrailPos.Count > 10) + TrailPos.RemoveAt(TrailPos.Count - 1); + } + + // Trail sparks in the laser's path if (Main.rand.NextBool()) { - int dustType = Main.rand.NextBool() ? 244 : 246; - int idx = Dust.NewDust(Projectile.position, 1, 1, dustType); + Particle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(10f * Projectile.scale, 10f * Projectile.scale), Projectile.velocity, false, 15, Main.rand.NextFloat(1f, 1.2f) * Projectile.scale, Color.White); + GeneralParticleHandler.SpawnParticle(spark); + } - Main.dust[idx].noGravity = true; - float ySpeed = Main.rand.NextFloat(3.0f, 5.6f); - Main.dust[idx].velocity.Y -= ySpeed; - float scale = Main.rand.NextFloat(0.4f, 0.8f); - Main.dust[idx].scale = scale; + if (Main.rand.NextBool(4)) + { + Color fireColor = Main.hslToRgb(Main.rand.NextFloat(0.08f, 0.13f) + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.7f); + Particle fire = new GlowOrbParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * (Main.rand.NextFloat(1f, 3f) + 3f * Projectile.scale), false, 9, Main.rand.NextFloat(1f, 1.2f) * Projectile.scale, fireColor); + GeneralParticleHandler.SpawnParticle(fire); } } + // Hitbox size does not normally scale with Projectile.scale for some reason so this is done manually + public override void ModifyDamageHitbox(ref Rectangle hitbox) => hitbox.Inflate((int)(Projectile.width * (Projectile.scale - 1f)), (int)(Projectile.height * (Projectile.scale - 1f))); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); + + for (int i = 0; i < 6; i++) + { + Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(2f, 12f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1f, 2.4f) * Projectile.scale; + dust.color = Main.hslToRgb(Main.rand.NextFloat(0.033f, 0.167f), 1f, 0.7f); + dust.noLightEmittence = true; + } + } + + public Color LaserColor(float completionRatio) => Main.hslToRgb(0.08f + 0.05f * completionRatio + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.7f) * 0.8f * Projectile.Opacity; + public float LaserWidth(float completionRatio) => 30f * Projectile.Opacity * Projectile.scale; + + public override bool PreDraw(ref Color lightColor) + { + if (TrailPos == null) + return false; + + GameShaders.Misc["CalamityMod:Flame"].UseImage1("Images/Misc/Perlin"); + GameShaders.Misc["CalamityMod:Flame"].UseSaturation(0.5f); + PrimitiveRenderer.RenderTrail(TrailPos, new(LaserWidth, LaserColor, shader: GameShaders.Misc["CalamityMod:Flame"]), 10); + return false; } } } diff --git a/Projectiles/Ranged/AnimosityBullet.cs b/Projectiles/Ranged/AnimosityBullet.cs index 427d0ab0a4..546f2b7cf2 100644 --- a/Projectiles/Ranged/AnimosityBullet.cs +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -19,8 +19,8 @@ namespace CalamityMod.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; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged dust2.scale = Main.rand.NextFloat(0.5f, 1.1f); } } - public override void Kill(int timeLeft) + public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath55 with { Pitch = -0.7f }, Projectile.Center); //DesertProwelerSkullParticle was a placeholder, but honestly it fits too well @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Crimson * 0.45f, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Crimson * 0.45f, 1); return true; } } diff --git a/Projectiles/Ranged/AquaBlast.cs b/Projectiles/Ranged/AquaBlast.cs index 0397ad3904..4a0a100b61 100644 --- a/Projectiles/Ranged/AquaBlast.cs +++ b/Projectiles/Ranged/AquaBlast.cs @@ -1,5 +1,13 @@ -using Microsoft.Xna.Framework; +using System.Diagnostics.Contracts; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -8,21 +16,24 @@ namespace CalamityMod.Projectiles.Ranged public class AquaBlast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 20; } + public int spreadDust = 0; + public static int Lifetime = 600; public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 36; + Projectile.height = 26; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.timeLeft = Lifetime; + Projectile.extraUpdates = 2; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } @@ -30,37 +41,94 @@ namespace CalamityMod.Projectiles.Ranged { //Animation Projectile.frameCounter++; - if (Projectile.frameCounter > 5) + if (Projectile.frameCounter > 21) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) + if (Projectile.frame > 19) { Projectile.frame = 0; } + Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Type]; //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; - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); - for (int i = 0; i < 2; i++) + Lighting.AddLight(Projectile.Center, Color.AliceBlue.ToVector3() * 0.5f); + //Trailing effects + if (Projectile.timeLeft <= Lifetime - 7) { - Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); - 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; + for (int i = 0; i < 2; i++) + { + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity / 0.18f, Projectile.velocity * 0.01f, false, 5, 1.9f, Color.SeaGreen, true); + GeneralParticleHandler.SpawnParticle(spark); + } + } + if (Main.rand.NextBool(2)) + { + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411); + bubble.timeLeft = 6 + Main.rand.Next(7); + bubble.scale = Main.rand.NextFloat(0.6f, 0.8f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; + } + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(6 + spreadDust, 6 + spreadDust), !Main.rand.NextBool(5) ? 278 : 267, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.35f), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = !Main.rand.NextBool(5) ? Color.Aquamarine : Color.Aqua; + if (dust.type == 278) + dust.scale *= 0.7f; } } + 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(), 60); + } + public override void OnSpawn(IEntitySource source) + { + Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5; + int smokeAmount = Main.rand.Next(8, 12 + 1); + for (int i = 0; i < smokeAmount; i++) + { + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } public override void OnKill(int timeLeft) { - for (int lol = 0; lol < 10; lol++) + SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.35f }, Projectile.Center); + for (int i = 0; i < 5; ++i) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1f); + int bloodLifetime = Main.rand.Next(22, 25); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.SkyBlue, Color.Aquamarine, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); } + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aquamarine * 0.8f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.05f, 22); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua * 0.8f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.04f, 22); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DeepSkyBlue, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 22); + GeneralParticleHandler.SpawnParticle(blastRing3); + Particle orb2 = new GenericBloom(Projectile.Center, Vector2.Zero, Color.SkyBlue, 0.6f, 11, false, true); + GeneralParticleHandler.SpawnParticle(orb2); } } } diff --git a/Projectiles/Ranged/AquaBlast.png b/Projectiles/Ranged/AquaBlast.png index 91449ac4c5..3d5a42c1ee 100644 Binary files a/Projectiles/Ranged/AquaBlast.png and b/Projectiles/Ranged/AquaBlast.png differ diff --git a/Projectiles/Ranged/AquaBlastToxic.cs b/Projectiles/Ranged/AquaBlastToxic.cs deleted file mode 100644 index 963152fa75..0000000000 --- a/Projectiles/Ranged/AquaBlastToxic.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class AquaBlastToxic : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > 5) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - { - 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; - - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.4f / 255f); - for (int i = 0; i < 2; i++) - { - Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); - 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; - } - } - - public override void OnKill(int timeLeft) - { - for (int lol = 0; lol < 10; lol++) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 1f); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Venom, 120); - } - } -} diff --git a/Projectiles/Ranged/AquaBlastToxic.png b/Projectiles/Ranged/AquaBlastToxic.png deleted file mode 100644 index db383de083..0000000000 Binary files a/Projectiles/Ranged/AquaBlastToxic.png and /dev/null differ diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index 0fc3c0e6eb..a9555374d0 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/Ranged/Aquashard"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; diff --git a/Projectiles/Ranged/ArcherfishRing.cs b/Projectiles/Ranged/ArcherfishRing.cs index 5db6f1dd27..afbe1a3107 100644 --- a/Projectiles/Ranged/ArcherfishRing.cs +++ b/Projectiles/Ranged/ArcherfishRing.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size(), scale: Projectile.scale); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public override void AI() { @@ -63,13 +63,11 @@ namespace CalamityMod.Projectiles.Ranged { //Audio feedback for hitting the ring SoundEngine.PlaySound(PopSound, Projectile.Center); - - target.AddBuff(BuffID.Wet, 240); } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 7b82e11a0f..918ebc8a95 100644 --- a/Projectiles/Ranged/ArcherfishShot.cs +++ b/Projectiles/Ranged/ArcherfishShot.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -59,6 +60,15 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Wet, 240); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Wet, 120); + target.AddBuff(ModContent.BuffType(), 120); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(BuffID.Wet, 120); + target.AddBuff(ModContent.BuffType(), 120); + } } } diff --git a/Projectiles/Ranged/AstralCannonProjectile.cs b/Projectiles/Ranged/AstralCannonProjectile.cs index 2be0ef7466..e07b194773 100644 --- a/Projectiles/Ranged/AstralCannonProjectile.cs +++ b/Projectiles/Ranged/AstralCannonProjectile.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 6844252aed..834728bd1c 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Projectiles.Ranged private float speed = 0f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -73,7 +74,6 @@ namespace CalamityMod.Projectiles.Ranged CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, speed, 12f); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Ranged/AstrealArrow.cs b/Projectiles/Ranged/AstrealArrow.cs index 0fe493e714..4d72d5c9f0 100644 --- a/Projectiles/Ranged/AstrealArrow.cs +++ b/Projectiles/Ranged/AstrealArrow.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/AstrealFlame.cs b/Projectiles/Ranged/AstrealFlame.cs index 6f2f999565..06d379b47a 100644 --- a/Projectiles/Ranged/AstrealFlame.cs +++ b/Projectiles/Ranged/AstrealFlame.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Ranged/AuricBullet.cs b/Projectiles/Ranged/AuricBullet.cs index 8077c6dad4..9a2f524c55 100644 --- a/Projectiles/Ranged/AuricBullet.cs +++ b/Projectiles/Ranged/AuricBullet.cs @@ -18,8 +18,9 @@ namespace CalamityMod.Projectiles.Ranged public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/AuricBulletHit") { Volume = 0.7f }; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 9; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index a404c8b5a2..42d6af0c6d 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Time, true) * Utils.GetLerpValue(450f, 360f, Time, true); // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D fog = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D fog = Terraria.GameContent.TextureAssets.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 1f11dc004b..d9a48ebcd8 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; @@ -12,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -40,6 +41,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); } @@ -58,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/BarinadeArrow.cs b/Projectiles/Ranged/BarinadeArrow.cs index 3b663a244f..8e5a2ad405 100644 --- a/Projectiles/Ranged/BarinadeArrow.cs +++ b/Projectiles/Ranged/BarinadeArrow.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i <= 5; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 216 : 207, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.6f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 216 : 121, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.6f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); dust.noGravity = true; } } @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 2, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 2, 1); return true; } } diff --git a/Projectiles/Ranged/BarinadeArrow.png b/Projectiles/Ranged/BarinadeArrow.png index d4720a0d0e..6e8c0c4a87 100644 Binary files a/Projectiles/Ranged/BarinadeArrow.png and b/Projectiles/Ranged/BarinadeArrow.png differ diff --git a/Projectiles/Ranged/BigCoral.cs b/Projectiles/Ranged/BigCoral.cs deleted file mode 100644 index 0971849fd6..0000000000 --- a/Projectiles/Ranged/BigCoral.cs +++ /dev/null @@ -1,60 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BigCoral : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetDefaults() - { - Projectile.width = 18; - Projectile.height = 34; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.velocity.X *= 0.999f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.025f; - Projectile.rotation = Projectile.velocity.ToRotation(); - if (Projectile.direction == -1) - Projectile.rotation += MathHelper.Pi; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 32; - Projectile.height = 32; - 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(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; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 30); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 30); - } - } -} diff --git a/Projectiles/Ranged/BigCoral.png b/Projectiles/Ranged/BigCoral.png deleted file mode 100644 index e5d11b6e6a..0000000000 Binary files a/Projectiles/Ranged/BigCoral.png and /dev/null differ diff --git a/Projectiles/Ranged/BlightFlames.cs b/Projectiles/Ranged/BlightFlames.cs index d56935e430..a66ebc3f36 100644 --- a/Projectiles/Ranged/BlightFlames.cs +++ b/Projectiles/Ranged/BlightFlames.cs @@ -22,8 +22,12 @@ namespace CalamityMod.Projectiles.Ranged public int Time = 0; public bool postTileHit = false; public bool postEnemyHit = false; + public NPC targeted; + public Vector2 savedDist; public Color FogColor = new Color(30, 255, 30); + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 14; @@ -88,22 +92,21 @@ namespace CalamityMod.Projectiles.Ranged } // Add some degree of variation to the fog with rotation/color - if (Main.rand.NextBool(3)) - FogColor.G = (byte)Main.rand.Next(160, 230 + 1); ScaleFactor += 0.0061f; - ScaleFactor = MathHelper.Clamp(ScaleFactor, 0f, Projectile.scale); + ScaleFactor = MathHelper.Clamp(ScaleFactor, 0f, Projectile.scale * 0.8f); Lighting.AddLight(Projectile.Center, new Vector3(1f, 1f, 0.25f) * ScaleFactor); Projectile.velocity *= 0.99f; Projectile.Opacity = Utils.GetLerpValue(30f, 50f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 130f, Projectile.timeLeft, true); - if (postEnemyHit && !postTileHit) + if (postEnemyHit && !postTileHit && targeted != null && targeted.life > 0 && targeted.active) { - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 25f, 35f); + Projectile.Center = targeted.Center + savedDist; + savedDist *= 0.99f; } // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. @@ -114,8 +117,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!postTileHit) - Projectile.Center = Projectile.Center + Main.rand.NextVector2Circular(20, 20); + //if (!postTileHit) + //Projectile.Center = Projectile.Center + Main.rand.NextVector2Circular(20, 20); target.AddBuff(ModContent.BuffType(), 420); for (int i = 0; i <= 3; i++) @@ -129,8 +132,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity = Vector2.Zero; Projectile.timeLeft = 300; postEnemyHit = true; + targeted = target; + savedDist = Projectile.Center - target.Center; } - } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { @@ -144,7 +148,7 @@ namespace CalamityMod.Projectiles.Ranged if (!postEnemyHit) { Projectile.velocity = oldVelocity * 0.95f; - Projectile.position -= Projectile.velocity; + Projectile.Center -= Projectile.velocity; if (!postTileHit) { Projectile.timeLeft = 800; @@ -162,15 +166,15 @@ namespace CalamityMod.Projectiles.Ranged } public override bool PreDraw(ref Color lightColor) { - Main.spriteBatch.SetBlendState(BlendState.Additive); - - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D splatTex = ModContent.Request("CalamityMod/Particles/WaterFoam").Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; - Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, Projectile.rotation, texture.Size() * 0.5f, ScaleFactor, SpriteEffects.None); + float opacity = Projectile.Opacity * 0.3f; + Color drawColor = (FogColor with { A = 0 }) * opacity; + + Main.EntitySpriteDraw(texture, drawPosition + Main.rand.NextVector2Circular(19, 19), null, drawColor * 0.55f, Projectile.rotation, texture.Size() * 0.5f, ScaleFactor * 1.2f, SpriteEffects.None); - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, -Projectile.rotation * 0.9f, texture.Size() * 0.5f, ScaleFactor, SpriteEffects.None); return false; } } diff --git a/Projectiles/Ranged/BlightFlames.png b/Projectiles/Ranged/BlightFlames.png index 5bdf23b09a..2b03c9c3a6 100644 Binary files a/Projectiles/Ranged/BlightFlames.png and b/Projectiles/Ranged/BlightFlames.png differ diff --git a/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs b/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs deleted file mode 100644 index c153a7acbc..0000000000 --- a/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class BlissfulBombardierDustProjectile : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 46; - Projectile.height = 46; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 15; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f); - 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] > 60f) - { - projTimer -= (Projectile.ai[0] - 60f) / 2f; - } - if (projTimer <= 0f) - { - projTimer = 0f; - Projectile.Kill(); - } - Projectile.ai[0] += (2f + Projectile.ai[1]); // Explosions spawned on hit last shorter - int timerCounter = 0; - while ((float)timerCounter < projTimer) - { - float rand1 = (float)Main.rand.Next(-8, 9); - float rand2 = (float)Main.rand.Next(-8, 9); - float rand3 = (float)Main.rand.Next(2, 7); - float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); - randAdjust = rand3 / randAdjust; - rand1 *= randAdjust; - rand2 *= randAdjust; - 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; - 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 = rand1; - dust.velocity.Y = rand2; - timerCounter++; - } - } - - 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/Ranged/BlissfulBombardierHoldout.cs b/Projectiles/Ranged/BlissfulBombardierHoldout.cs new file mode 100644 index 0000000000..8304e5168a --- /dev/null +++ b/Projectiles/Ranged/BlissfulBombardierHoldout.cs @@ -0,0 +1,242 @@ +using System; +using CalamityMod.Dusts; +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.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BlissfulBombardierHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override float RecoilResolveSpeed => 0.07f; + public override float MaxOffsetLengthFromArm => 60f; + public override float OffsetXUpwards => -18f; + public override float BaseOffsetY => -5f; + public override float OffsetYUpwards => 23f; + + // 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 { get; set; } = Color.Khaki; + + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float PostFireCooldown => ref Projectile.ai[1]; + public bool hasFired = false; + public override void KillHoldoutLogic() + { + + } + public override 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 a relative point in the sky slightly based on mouse position, used for pointing the holdout. + Vector2 ownerToSky = new Vector2(MathHelper.Lerp(Owner.ClampedMouseWorld().X, Owner.Center.X, 0.55f), Owner.Center.Y) + new Vector2(0, -500) - Owner.Center; + + // 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(ownerToSky.SafeNormalize(Vector2.Zero), -Vector2.UnitY * Owner.gravDir); + + int direction = MathF.Sign(ownerToSky.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(ownerToSky.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); + + Projectile.ForceNetUpdate(); + } + public override void HoldoutAI() + { + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + if (Owner.CantUseHoldout() && PostFireCooldown <= 0 && shootingTimer < (int)(Owner.itemAnimationMax * 0.8f)) + { + Projectile.Kill(); + } + + if (!hasFired) + shootingTimer++; + + if (shootingTimer == (int)(Owner.itemAnimationMax) && HeldItem.type == AssociatedItemID && !hasFired) + { + ShootRocket(); + + for (int i = 0; i <= 25; i++) + { + if (i % 2 == 0) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), (Projectile.velocity * 12).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.4f, 1.7f), 0, default, Main.rand.NextFloat(1.8f, 2.3f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Orange : effectsColor; + dust.noLightEmittence = true; + } + else + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 278, (Projectile.velocity * 12).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.4f, 1.7f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = false; + dust.color = Main.rand.NextBool(3) ? Color.Orange : staticEffectsColor; + } + } + + hasFired = true; + } + + if (PostFireCooldown > 0) + PostFiringCooldown(); + } + + public void ShootRocket() + { + // We use the velocity of this projectile as its direction vector. + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + float velocityMultiplier = 0.9f; + + // 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 = 87; + effectsColor = Color.Goldenrod; + break; + } + + // Spawns the projectile. + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType(), damage, knockback, Projectile.owner, rocketType); + PostFireCooldown = Owner.itemAnimationMax; + Owner.Calamity().GeneralScreenShakePower = 5f; + + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + SoundStyle fire = new("CalamityMod/Sounds/Item/LauncherHeavyShot"); + SoundEngine.PlaySound(fire with { Volume = 0.9f, PitchVariance = 0.1f }, Projectile.Center); + + 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 -= 25f; + } + + public void PostFiringCooldown() + { + Owner.channel = true; + if (PostFireCooldown > 1) + { + 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 + { + PostFireCooldown--; + hasFired = false; + shootingTimer = 0; + } + } + + public override void OnSpawn(IEntitySource source) + { + base.OnSpawn(source); + FrontArmStretch = Player.CompositeArmStretchAmount.Quarter; + ExtraBackArmRotation = MathHelper.ToRadians(15f); + } + + public override bool PreDraw(ref Color lightColor) + { + if (shootingTimer <= 1) + return false; + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Items/Weapons/Ranged/BlissfulBombardierGlow").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 (hasFired) + { + float rumble = Utils.GetLerpValue(0f, Owner.itemAnimationMax, PostFireCooldown, true) * 8f; + drawPosition += Main.rand.NextVector2Circular(rumble, rumble); + } + + if (!hasFired) + { + float fade = Utils.GetLerpValue(0, Owner.itemAnimationMax, shootingTimer, true); + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 5 * fade; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, staticEffectsColor with { A = 0 } * fade, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite, 0f); + } + } + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(texture2, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/BlissfulBombardierSplitProjectile.cs b/Projectiles/Ranged/BlissfulBombardierSplitProjectile.cs new file mode 100644 index 0000000000..14adc0efa3 --- /dev/null +++ b/Projectiles/Ranged/BlissfulBombardierSplitProjectile.cs @@ -0,0 +1,114 @@ +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; +using static CalamityMod.Projectiles.Ranged.BlissfulBombardierHoldout; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BlissfulBombardierSplitProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + private ref float RocketID => ref Projectile.ai[0]; + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.extraUpdates = 4; + Projectile.timeLeft = 400; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.Center.Y > Owner.ClampedMouseWorld().Y) + Projectile.tileCollide = true; + + //Animation + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Projectile.velocity *= 1.005f; + + if (Projectile.timeLeft % 2 == 0 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 5, 0.06f, effectsColor * 0.65f, new Vector2(1, 0.3f), true, false, 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Projectile.velocity * -4).RotatedByRandom(0.2) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.35f, 0.55f); + dust.color = Main.rand.NextBool(3) ? Color.Orange : Color.Goldenrod; + dust.noLightEmittence = true; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + + public override void OnKill(int timeLeft) + { + // Only do rocket effects for the owner client side + if (Projectile.owner != Main.myPlayer) + return; + + 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, + }; + + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, PitchVariance = 0.2f }, Projectile.Center); + + int blastRadius = (int)(MathHelper.Clamp(Projectile.RocketBehavior(info), 3, 100) * 0.5f); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.damage = (int)(Projectile.damage * 0.5f); + Projectile.penetrate = -1; + Projectile.Damage(); + + Particle orb5 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orange, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.025f * blastRadius, 13); + GeneralParticleHandler.SpawnParticle(orb5); + + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, staticEffectsColor, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.22f * blastRadius, 10, true); + GeneralParticleHandler.SpawnParticle(orb3); + + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (new Vector2(5, 5) * blastRadius).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.85f, 2.45f) * blastRadius * 0.08f; + dust.color = Color.Goldenrod; + dust.noLightEmittence = true; + } + for (int i = 0; i < 4; i++) + { + Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(10, 10), (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 15, Main.rand.NextFloat(1.35f, 1.6f), Main.rand.NextBool(4) ? Color.Khaki : effectsColor, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.45f, 0.55f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/BlissfulBombardierSplitProjectile").Value; + + Projectile.DrawProjectileWithBackglow(staticEffectsColor with { A = 0 }, lightColor, 3f, texture); + return false; + } + } +} diff --git a/Projectiles/Ranged/BlissfulBombardierSplitProjectile.png b/Projectiles/Ranged/BlissfulBombardierSplitProjectile.png new file mode 100644 index 0000000000..e61db33ec9 Binary files /dev/null and b/Projectiles/Ranged/BlissfulBombardierSplitProjectile.png differ diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index 67fbe2e7d7..af3ed087d8 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -44,6 +44,7 @@ namespace CalamityMod.Projectiles.Ranged particleSize += 0.5f; else particleSize -= 1f; + particleSize = MathHelper.Clamp(particleSize, 0, 1000); Time++; @@ -61,8 +62,18 @@ namespace CalamityMod.Projectiles.Ranged 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); - BloodBoilerMetaball.SpawnParticle(Projectile.Center, particleSize * 1.7f); + //BloodBoilerMetaball2.SpawnParticle(Projectile.Center, particleSize * 2.3f); + //BloodBoilerMetaball.SpawnParticle(Projectile.Center, particleSize * 1.7f); + + Particle beam3 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.1f, "CalamityMod/Particles/PearlParticleGlow", false, 10, 0.05f * particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam3); + + if (Main.rand.NextBool(8)) + { + Particle beam4 = new CustomSpark(Projectile.Center, Projectile.velocity * 0.1f, "CalamityMod/Particles/WaterFoam", false, 5, 0.01f * particleSize, Color.Red, new Vector2(1f, 1), true, false, Main.rand.NextFloat(-10, 10), false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam4); + } + if (Main.rand.NextBool(6) && Projectile.ai[1] == 0f) { @@ -189,17 +200,14 @@ namespace CalamityMod.Projectiles.Ranged int bonusHeal = Main.rand.NextBool(3) ? 5 : 3; int heal = improvedHeal ? bonusHeal : 2; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) + if (Main.LocalPlayer.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; + Main.LocalPlayer.lifeSteal -= heal; + player.HealPlayer(heal); } Projectile.Kill(); diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index 1d96edd43d..a72db98d46 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 69a3118522..985287bd5b 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs index e45df960a2..cdf8888264 100644 --- a/Projectiles/Ranged/BloodfireBulletProj.cs +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Ranged/BloodflareSoul.cs b/Projectiles/Ranged/BloodflareSoul.cs index 14cabced7a..e124ee2a71 100644 --- a/Projectiles/Ranged/BloodflareSoul.cs +++ b/Projectiles/Ranged/BloodflareSoul.cs @@ -12,9 +12,10 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs deleted file mode 100644 index e45cd19672..0000000000 --- a/Projectiles/Ranged/Bolt.cs +++ /dev/null @@ -1,96 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Bolt : 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 = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.alpha = 255; - Projectile.penetrate = 4; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Projectile.velocity *= 1.015f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.timeLeft % 30 == 0) - { - for (int l = 0; l < 12; l++) - { - 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, 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; - Main.dust[blueDust].velocity = Projectile.velocity * 0.1f; - Main.dust[blueDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[blueDust].position) * 1.25f; - } - } - } - - 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 void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Electrified, 90); - } - 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) - { - 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); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - 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, DustID.IceTorch, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 2f; - Main.dust[dust].noGravity = true; - } - } - } -} diff --git a/Projectiles/Ranged/Bolt.png b/Projectiles/Ranged/Bolt.png deleted file mode 100644 index c9fe916dbf..0000000000 Binary files a/Projectiles/Ranged/Bolt.png and /dev/null differ diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index e419809b56..75f421c5e6 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D fire = Terraria.GameContent.TextureAssets.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 5c9a9c260d..d591810015 100644 --- a/Projectiles/Ranged/BubonicRoundProj.cs +++ b/Projectiles/Ranged/BubonicRoundProj.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Ranged/BuzzkillHoldout.cs b/Projectiles/Ranged/BuzzkillHoldout.cs index a0e818b0f7..04c8fdb96e 100644 --- a/Projectiles/Ranged/BuzzkillHoldout.cs +++ b/Projectiles/Ranged/BuzzkillHoldout.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.7f }, GunTipPosition); int SawLevel = (Time / ChargeupTime >= 1f).ToInt() + (Time / ChargeupTime >= 0.25f).ToInt(); @@ -239,7 +239,7 @@ namespace CalamityMod.Projectiles.Ranged if (Time / ChargeupTime >= 0.25f) Main.EntitySpriteDraw(smallSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor, Time * MathHelper.ToRadians(42f), smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None); - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return false; // Special afterimage drawing for the slashes only diff --git a/Projectiles/Ranged/BuzzkillSaw.cs b/Projectiles/Ranged/BuzzkillSaw.cs index c4ef59e32b..a9d383fd87 100644 --- a/Projectiles/Ranged/BuzzkillSaw.cs +++ b/Projectiles/Ranged/BuzzkillSaw.cs @@ -25,9 +25,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 150); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") with { Pitch = 0.15f * Projectile.numHits }, Projectile.Center); int bloodCount = 6 + 10 * (int)SawLevel; @@ -189,11 +189,11 @@ namespace CalamityMod.Projectiles.Ranged } } - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return true; // Special afterimage drawing to include the slashes - Texture2D buzzsawTexture = TextureAssets.Projectile[Projectile.type].Value; + Texture2D buzzsawTexture = TextureAssets.Projectile[Type].Value; Rectangle frame = buzzsawTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); for (int i = 1; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index 91aaec67ac..34900bde02 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CardClubSplit.cs b/Projectiles/Ranged/CardClubSplit.cs index 928c15967d..3a5b856b38 100644 --- a/Projectiles/Ranged/CardClubSplit.cs +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -11,8 +11,9 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index 8bb7a7706c..e6f934e331 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[paper].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index da83907400..2d02ef5959 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs index 4e9861bb9d..b0addec51c 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index 30a3a8ef6f..6f0cbfa965 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public Vector2 baseVel; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged } baseVel = Projectile.velocity; if (Svant) - Projectile.ArmorPenetration = 100; + Projectile.ArmorPenetration = 200; if (Infinity) Projectile.ArmorPenetration = 25; } @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < projectiles; k++) - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, -baseVel.RotatedByRandom(0.9f) * Main.rand.NextFloat(0.6f, 0.7f), ModContent.ProjectileType(), (int)(Projectile.damage * (Projectile.ai[2] > 0 ? 0.3f : 0.5f)), Projectile.knockBack * 0.8f, Main.myPlayer, 0, 0, Projectile.ai[2]); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -baseVel.RotatedByRandom(0.9f) * Main.rand.NextFloat(0.6f, 0.7f), ModContent.ProjectileType(), (int)(Projectile.damage * (Projectile.ai[2] > 0 ? 0.3f : 0.5f)), Projectile.knockBack * 0.8f, Main.myPlayer, 0, 0, Projectile.ai[2]); } for (int k = 0; k < 3; k++) { @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Ranged if (baseColor == Color.White) return false; Texture2D texture = ModContent.Request("CalamityMod/Particles/DrainLineBloom").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], (baseColor * 0.7f) with { A = 0 }, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], (baseColor * 0.7f) with { A = 0 }, 1, texture); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, baseColor with { A = 0 }, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Ranged/ChargedBlastSplit.cs b/Projectiles/Ranged/ChargedBlastSplit.cs index fb72db7217..9251ff639d 100644 --- a/Projectiles/Ranged/ChargedBlastSplit.cs +++ b/Projectiles/Ranged/ChargedBlastSplit.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Ranged public float homeSpeed; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -76,10 +76,11 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.timeLeft <= 500 && Svant && goToMouse && Projectile.timeLeft % Projectile.extraUpdates == 0) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 mouseSpot = (player.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * homeSpeed; Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, mouseSpot.X, 0.085f); Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, mouseSpot.Y, 0.085f); - if (Vector2.Distance(Projectile.Center, player.Calamity().mouseWorld) < 80) + if (Vector2.Distance(Projectile.Center, player.ClampedMouseWorld()) < 80) { Projectile.timeLeft = 300; Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * homeSpeed / 2; @@ -116,7 +117,7 @@ namespace CalamityMod.Projectiles.Ranged if (baseColor == Color.White) return false; Texture2D texture = ModContent.Request("CalamityMod/Particles/DrainLineBloom").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], (baseColor * 0.7f) with { A = 0 }, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], (baseColor * 0.7f) with { A = 0 }, 1, texture); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, baseColor with { A = 0 }, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Ranged/ChickenCannonHeld.cs b/Projectiles/Ranged/ChickenCannonHeld.cs index f1e2ebb30e..acaafa0d12 100644 --- a/Projectiles/Ranged/ChickenCannonHeld.cs +++ b/Projectiles/Ranged/ChickenCannonHeld.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index 0db0ed946a..bfbffc0be1 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.dedServ) return; - for (int i = 0; i < 70; i++) + for (int i = 0; i < 50; i++) { // The exponent being greater than 1 gives the randomness a bias towards 0. This means that more dust will spawn // closer to the center than the edge. diff --git a/Projectiles/Ranged/ChickenRocket.cs b/Projectiles/Ranged/ChickenRocket.cs index 60ac94fae2..dcf3ba3218 100644 --- a/Projectiles/Ranged/ChickenRocket.cs +++ b/Projectiles/Ranged/ChickenRocket.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; // Slight gravity, equivalent to Plasma Grenade. - Projectile.velocity.Y += 0.09f; + Projectile.velocity.Y += 0.075f; } // Instead of dying instantly on collision, fly straight up for a moment. @@ -85,33 +85,10 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 1040; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); if (Projectile.owner == Main.myPlayer) - { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int i = 0; i < 40; i++) - { - 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()) - { - Main.dust[d].scale = 0.5f; - Main.dust[d].fadeIn = 1f + Main.rand.NextFloat(); - } - } - for (int i = 0; i < 70; i++) - { - 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(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[d].velocity *= 2f; - } } } } diff --git a/Projectiles/Ranged/ChromaticEruptionHoldout.cs b/Projectiles/Ranged/ChromaticEruptionHoldout.cs index e737a8ba0a..13c0e5205e 100644 --- a/Projectiles/Ranged/ChromaticEruptionHoldout.cs +++ b/Projectiles/Ranged/ChromaticEruptionHoldout.cs @@ -13,10 +13,11 @@ namespace CalamityMod.Projectiles.Ranged public class ChromaticEruptionHoldout : BaseGunHoldoutProjectile { public override int AssociatedItemID => ModContent.ItemType(); - public override float MaxOffsetLengthFromArm => 15f; + public override float MaxOffsetLengthFromArm => 40f; public override float OffsetXUpwards => -10f; - public override float BaseOffsetY => -5f; + public override float BaseOffsetY => -12f; public override float OffsetYDownwards => 10f; + public override Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.45f; public ref float ShotCooldown => ref Projectile.ai[0]; public ref float ShotsFired => ref Projectile.ai[1]; diff --git a/Projectiles/Ranged/ChromaticFlare.cs b/Projectiles/Ranged/ChromaticFlare.cs index ae0517b920..4c9cb7dd55 100644 --- a/Projectiles/Ranged/ChromaticFlare.cs +++ b/Projectiles/Ranged/ChromaticFlare.cs @@ -36,8 +36,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 18; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 18; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -127,7 +128,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D lightTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D lightTexture = Terraria.GameContent.TextureAssets.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/CinderArrowProj.cs b/Projectiles/Ranged/CinderArrowProj.cs index cfd82c1257..aa7d906b6b 100644 --- a/Projectiles/Ranged/CinderArrowProj.cs +++ b/Projectiles/Ranged/CinderArrowProj.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -20,8 +21,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -51,14 +52,15 @@ namespace CalamityMod.Projectiles.Ranged if (splitShot) { + Projectile.scale = 0.01f; Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 0.15f); - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(9)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, 90, -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.55f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.55f)); dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.65f, 0.85f); - dust.noLight = true; + dust.scale = Main.rand.NextFloat(0.35f, 0.85f); dust.noLightEmittence = true; + dust.color = Color.Lerp(Color.Red, Color.Crimson, Main.rand.NextFloat(0.3f, 0.8f)); } } else @@ -66,17 +68,17 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 0.3f); if (Time > 4f && 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); + float velMulti = Main.rand.NextFloat(0.05f, 0.35f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, ModContent.DustType(), -Projectile.velocity.RotatedBy(0.45) * velMulti); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.45f, 0.75f); - dust.noLight = true; + dust.color = Color.Crimson; dust.noLightEmittence = true; - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, 90, -Projectile.velocity.RotatedBy(-0.45) * velMulti); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, ModContent.DustType(), -Projectile.velocity.RotatedBy(-0.45) * velMulti); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(0.45f, 0.75f); - dust2.noLight = true; dust2.noLightEmittence = true; + dust2.color = Color.Crimson; } } } @@ -91,7 +93,7 @@ namespace CalamityMod.Projectiles.Ranged 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); + 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(-0.3f, 0.3f), true); GeneralParticleHandler.SpawnParticle(smoke); } SoundEngine.PlaySound(SoundID.Item69 with { Volume = 0.35f, Pitch = 1f, PitchVariance = 0.15f }, Projectile.Center); @@ -101,7 +103,7 @@ namespace CalamityMod.Projectiles.Ranged for (int b = 0; b < 3; b++) { - Vector2 velocity = Vector2.UnitY.RotatedByRandom(0.8f) * Main.rand.NextFloat(-3.5f, -3f); + Vector2 velocity = Vector2.UnitY.RotatedByRandom(0.8f) * Main.rand.NextFloat(-5.5f, -4.5f); Projectile shrapnel = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.06f), 0f, Projectile.owner, ai2: 1f); shrapnel.timeLeft = 300; shrapnel.arrow = false; @@ -116,24 +118,21 @@ namespace CalamityMod.Projectiles.Ranged } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (splitShot) - { - target.AddBuff(ModContent.BuffType(), 180); - } + target.AddBuff(ModContent.BuffType(), splitShot ? 180 : 90); } public override bool PreDraw(ref Color lightColor) { if (splitShot) { - Texture2D texture = ModContent.Request("CalamityMod/Particles/DrainLine").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Crimson * 0.3f, 1, texture); + Texture2D texture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Crimson with { A = 0 } * 0.6f, 1, texture, true, true); return false; } else { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/BloodfireBulletProj").Value; + Texture2D texture = ModContent.Request("CalamityMod/Particles/DrainLineBloom").Value; if (Time > 6f) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White * 0.3f, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Crimson with { A = 0 } * 0.4f, 1, texture, true, true); return true; } } diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index c3c7a5ef6c..ce6bb0907b 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Ranged public class ClamorRifleProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 16; diff --git a/Projectiles/Ranged/ClamorRifleProjSplit.cs b/Projectiles/Ranged/ClamorRifleProjSplit.cs index c4809556b2..3b01b45cc6 100644 --- a/Projectiles/Ranged/ClamorRifleProjSplit.cs +++ b/Projectiles/Ranged/ClamorRifleProjSplit.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/Ranged/ClamorRifleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 16; diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index 3c9c5699d9..d37c4265a0 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ClockworkBowHoldout.cs b/Projectiles/Ranged/ClockworkBowHoldout.cs index 3e4f123dde..dd09e1efaa 100644 --- a/Projectiles/Ranged/ClockworkBowHoldout.cs +++ b/Projectiles/Ranged/ClockworkBowHoldout.cs @@ -152,14 +152,13 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { - float interpolant = Utils.GetLerpValue(5f, 25f, Owner.Distance(Main.MouseWorld), true); + float interpolant = Utils.GetLerpValue(5f, 25f, Owner.Distance(Owner.ClampedMouseWorld()), true); Vector2 oldVelocity = Projectile.velocity; + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Vector2.Lerp(Projectile.velocity, Owner.SafeDirectionTo(Main.MouseWorld), interpolant); if (Projectile.velocity != oldVelocity) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); } Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.Zero) * 35f; diff --git a/Projectiles/Ranged/CondemnationArrow.cs b/Projectiles/Ranged/CondemnationArrow.cs index 1807a79a2b..a3f208088d 100644 --- a/Projectiles/Ranged/CondemnationArrow.cs +++ b/Projectiles/Ranged/CondemnationArrow.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 9; } public override void SetDefaults() @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 2; Projectile.timeLeft = 300; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } @@ -91,6 +91,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); } } diff --git a/Projectiles/Ranged/CondemnationArrowHoming.cs b/Projectiles/Ranged/CondemnationArrowHoming.cs index 85dfd6b539..23d7c8f793 100644 --- a/Projectiles/Ranged/CondemnationArrowHoming.cs +++ b/Projectiles/Ranged/CondemnationArrowHoming.cs @@ -13,20 +13,21 @@ namespace CalamityMod.Projectiles.Ranged public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 9; } public override void SetDefaults() { - Projectile.width = 14; - Projectile.height = 45; + Projectile.width = 26; + Projectile.height = 90; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = true; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 2; Projectile.timeLeft = 300; } @@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } @@ -71,6 +72,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); } } diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index adb6c6d397..a2756431ff 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -46,6 +46,10 @@ namespace CalamityMod.Projectiles.Ranged public override void HoldoutAI() { + // Does not run if the player stops channeling + if (Owner.CantUseHoldout()) + return; + // Frame 1 effects: Record how fast the Condemnation item being used is, to determine how fast to load arrows. if (FramesToLoadNextArrow == 0f) { @@ -77,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged SpawnArrowLoadedDust(); CurrentChargingFrames = 0f; ++ArrowsLoaded; - --FramesToLoadNextArrow; + FramesToLoadNextArrow = MathHelper.Clamp(FramesToLoadNextArrow--, 1f, HeldItem.useAnimation); // Play a sound for additional notification that an arrow has been loaded. var loadSound = SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.3f }); diff --git a/Projectiles/Ranged/ContagionArrow.cs b/Projectiles/Ranged/ContagionArrow.cs index 04e8f7b438..067c7820e3 100644 --- a/Projectiles/Ranged/ContagionArrow.cs +++ b/Projectiles/Ranged/ContagionArrow.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs index b77d4e0bec..a097576c82 100644 --- a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs +++ b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 05f7be8b12..c4b5d2e4e5 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -1,10 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -19,55 +22,59 @@ namespace CalamityMod.Projectiles.Ranged public Color InnerColor = Color.LightGreen; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; + Projectile.tileCollide = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.MaxUpdates = 10; - Projectile.timeLeft = 27 * Projectile.MaxUpdates; + Projectile.MaxUpdates = 13; + Projectile.timeLeft = 45 * Projectile.MaxUpdates; } public override void AI() { Time++; + Lighting.AddLight(Projectile.Center, InnerColor.ToVector3() * 0.2f); Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); //used for some drawing prevention for when it's offscreen since it makes a fuck load of particles - if (Projectile.timeLeft % 3 == 0 && Time > 12f && targetDist < 1400f) + + if (Main.rand.NextBool(5) && Time > 12f && targetDist < 1400f) { - AltSparkParticle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 17, 2.3f, Color.Black); - GeneralParticleHandler.SpawnParticle(spark); - } - if (Main.rand.NextBool(3) && Time > 12f && targetDist < 1400f) - { - 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); + Particle orb = new GenericBloom(Projectile.Center + Main.rand.NextVector2CircularEdge(5, 5), Projectile.velocity * Main.rand.NextFloat(0.05f, 0.5f), Color.Black, Main.rand.NextFloat(0.2f, 0.4f), Main.rand.Next(9, 12), true, false); GeneralParticleHandler.SpawnParticle(orb); + + int dustStyle = ModContent.DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10), dustStyle); + dust.scale = Main.rand.NextFloat(0.6f, 1.2f); + dust.velocity = new Vector2(0, Main.rand.NextFloat(0.1f, 5)); + dust.noGravity = false; + dust.color = Color.LightGreen; } - if (Projectile.timeLeft % 3 == 0 && Time > 12f && targetDist < 1400f) + if (Projectile.timeLeft % 2 == 0 && Time > 12f && targetDist < 1400f) { - LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 17, 1.7f, InnerColor); + Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark2", false, 17, 0.052f, Color.Black, new Vector2(0.6f, 1.3f), false); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 17, 0.027f, Color.LightGreen, new Vector2(0.6f, 1.3f), true, false); GeneralParticleHandler.SpawnParticle(spark2); } - if (Main.rand.NextBool(3) && Time > 12f && targetDist < 1400f) - { - 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) + if (Time == 9f) { - for (int i = 0; i <= 18; i++) + for (int i = 0; i <= 10; i++) { - int dustStyle = Main.rand.NextBool() ? 66 : 263; - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 191 : dustStyle, Projectile.velocity); - dust.scale = Main.rand.NextFloat(1.5f, 2.3f); - dust.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 2.1f); - dust.noGravity = true; - dust.color = dust.type == dustStyle ? InnerColor : default; + float variance = Main.rand.NextFloat(-0.7f, 0.7f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust2.scale = Main.rand.NextFloat(1.7f, 1.9f) - Math.Abs(variance); + dust2.velocity = (Projectile.velocity * 2).RotatedBy(variance) * Main.rand.NextFloat(0.35f, 1f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = InnerColor; } } if (BounceHits > 0f) @@ -78,7 +85,7 @@ namespace CalamityMod.Projectiles.Ranged dust.noGravity = true; dust.color = InnerColor; - CalamityUtils.HomeInOnNPC(Projectile, false, 600f, 12f, 15f); + CalamityUtils.HomeInOnNPC(Projectile, false, 600f, 7f, 20f); } } @@ -94,34 +101,39 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Projectile.timeLeft = 27 * Projectile.MaxUpdates; + Projectile.timeLeft = 45 * Projectile.MaxUpdates; for (int i = 0; i < 2; i++) { - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.3f, 0.6f, 25, false); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f, 0.4f, 38, false); + GeneralParticleHandler.SpawnParticle(blastRing); + } + for (int i = 0; i < 5; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.48f, 0.52f, 38); GeneralParticleHandler.SpawnParticle(blastRing); } - float numberOfDusts = 12; - float rotFactor = 360f / numberOfDusts; + float numberOfDusts = 10; for (int i = 0; i < numberOfDusts; i++) { - float rot = MathHelper.ToRadians(i * rotFactor); - Vector2 offset = new Vector2(Main.rand.NextFloat(1, 3.1f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); - Vector2 velOffset = new Vector2(Main.rand.NextFloat(1, 3.1f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 66, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); dust.noGravity = true; - dust.velocity = velOffset; + dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f); dust.scale = Main.rand.NextFloat(1.6f, 2.2f); dust.color = InnerColor; } - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, InnerColor, new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0.1f, 0.9f - (BounceHits * 0.25f), 25); - GeneralParticleHandler.SpawnParticle(pulse); + //Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0f, 0.1f, 15); + //GeneralParticleHandler.SpawnParticle(pulse); if (BounceHits == 0f) SoundEngine.PlaySound(DeadSunsWind.Ricochet, Projectile.Center); BounceHits++; + + if (BounceHits >= 4f) + Projectile.Kill(); + if (Projectile.velocity.X != oldVelocity.X) { Projectile.velocity.X = -oldVelocity.X; @@ -130,8 +142,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.velocity.Y = -oldVelocity.Y; } - if (BounceHits >= 4f) - Projectile.Kill(); + return false; } } diff --git a/Projectiles/Ranged/DaemonsFlameBow.cs b/Projectiles/Ranged/DaemonsFlameBow.cs index 907806df64..6653ea2313 100644 --- a/Projectiles/Ranged/DaemonsFlameBow.cs +++ b/Projectiles/Ranged/DaemonsFlameBow.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Ranged public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -156,8 +156,8 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 b970fa388b..bd6d20582e 100644 --- a/Projectiles/Ranged/DeadSunExplosion.cs +++ b/Projectiles/Ranged/DeadSunExplosion.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -39,10 +40,13 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(explosion2); Particle explosion3 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0030f + 0.1f, Main.rand.Next(15, 22), false); GeneralParticleHandler.SpawnParticle(explosion3); - Particle orb = new GenericBloom(Projectile.Center, Projectile.velocity, color1, ExplosionRadius * 0.0085f + 0.05f, 10, true); - GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new GenericBloom(Projectile.Center, Projectile.velocity, color2, ExplosionRadius * 0.006f + 0.05f, 10, true, true); - GeneralParticleHandler.SpawnParticle(orb2); + + for (int i = 0; i < 4; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, color1, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0, ExplosionRadius * 0.005f + 0.05f, 25); + GeneralParticleHandler.SpawnParticle(blastRing); + } + float numberOfDusts = ExplosionRadius * 0.1f + 10; float rotFactor = 360f / numberOfDusts; for (int i = 0; i < numberOfDusts; i++) @@ -50,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged float rot = MathHelper.ToRadians(i * rotFactor); 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 dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool(4) ? ModContent.DustType() : Projectile.ai[1] == 5 ? 278 : ModContent.DustType(), velOffset); dust.noGravity = dust.type == 278 ? false : true; dust.color = color1; dust.velocity = velOffset; diff --git a/Projectiles/Ranged/DragonsBreathBurst.cs b/Projectiles/Ranged/DragonsBreathBurst.cs new file mode 100644 index 0000000000..5370887732 --- /dev/null +++ b/Projectiles/Ranged/DragonsBreathBurst.cs @@ -0,0 +1,48 @@ +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 +{ + public class DragonsBreathBurst : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 300; + Projectile.height = 300; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 15; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 420); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.95f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override void AI() + { + + } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 300, targetHitbox); + } +} diff --git a/Projectiles/Ranged/DragonsBreathFlames.cs b/Projectiles/Ranged/DragonsBreathFlames.cs index 134da61522..d6a65bac8e 100644 --- a/Projectiles/Ranged/DragonsBreathFlames.cs +++ b/Projectiles/Ranged/DragonsBreathFlames.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; @@ -40,22 +41,22 @@ namespace CalamityMod.Projectiles.Ranged { Vector3 Light = Projectile.ai[0] == 1 ? new Vector3(0.255f, 0.080f, 0.080f) : new Vector3(0.255f, 0.060f, 0.000f); Lighting.AddLight(Projectile.Center, Light * (Projectile.ai[0] == 1 ? 5 : 3)); - + if (Time == 0) + { + bbbBONUSbeamSizeWOAHH += Projectile.ai[2]; + beamWidth = Projectile.ai[1]; + if (Projectile.ai[0] == 1) + Projectile.penetrate = 1; + } Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); //used for some drawing prevention for when it's offscreen - if (beamWidth <= 0.9f) - { - beamsize = true; - } - if (beamWidth >= 1.1f) - { - beamsize = false; - } - beamWidth += (beamsize ? 0.02f : -0.02f); - Time++; + float sine = MathHelper.Clamp(Math.Abs((float)Math.Sin((Time + Projectile.ai[1]) * 0.575f / MathHelper.Pi)), 0.6f + Time * 0.0015f, 1); + beamWidth = sine; + //Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 22.5f; + if (Projectile.ai[0] == 0) //Fireball Mode { - if (Time == 20) + if (Time == 0) { for (int i = 0; i <= 7; i++) { @@ -82,25 +83,32 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(smoke); } } - if (Time % 5 == 0 && Time > 35f && targetDist < 1400f) + if (Time % 9 == 0 && Time > 14f && targetDist < 1400f) { - SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(1 + (Time * 0.3f), 1 + (Time * 0.3f)), -Projectile.velocity * 0.5f, false, 15, Main.rand.NextFloat(0.4f, 0.7f), Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(1 + (Time * 0.15f), 1 + (Time * 0.15f)), -Projectile.velocity * 0.5f, false, 15, Main.rand.NextFloat(0.4f, 0.7f), Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark); } if (targetDist < 1400f) { - ModContent.GetInstance().SpawnParticle(Projectile.Center, Time * 0.9f); - ModContent.GetInstance().SpawnParticle(Projectile.Center + Projectile.velocity, Time * 0.85f); + //ModContent.GetInstance().SpawnParticle(Projectile.Center, Time * 0.9f); + //ModContent.GetInstance().SpawnParticle(Projectile.Center + Projectile.velocity, Time * 0.85f); + + Particle beam3 = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/SmallBloom", false, 10, 0.1f + Time * 0.0015f, Color.OrangeRed * 0.5f, new Vector2(1f, 1), true, false, 0, false, false, 0.5f); + GeneralParticleHandler.SpawnParticle(beam3); + Particle beam33 = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/SmallBloom", false, 10, 0.04f + Time * 0.0015f, Color.Lerp(Color.Orange, Color.White, 0.25f) * 0.5f, new Vector2(1f, 1), true, false, 0, false, false, 0.5f); + GeneralParticleHandler.SpawnParticle(beam33); } - Projectile.velocity *= 1.01f; + if (Time < 120) + Projectile.velocity *= 1.01f; } if (Projectile.ai[0] == 1) //Welding Mode { if (bbbBONUSbeamSizeWOAHH > 0) bbbBONUSbeamSizeWOAHH -= 0.65f; - Projectile.extraUpdates = 170; - if (Time > 13) + Projectile.extraUpdates = 20; + + if (Time > 0) { Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), Main.rand.NextBool(3) ? 162 : 259); dust2.scale = Main.rand.NextFloat(0.3f, 0.5f); @@ -111,28 +119,34 @@ namespace CalamityMod.Projectiles.Ranged } if (targetDist < 1400f) { - ModContent.GetInstance().SpawnParticle(Projectile.Center, beamWidth * 46 + bbbBONUSbeamSizeWOAHH); - ModContent.GetInstance().SpawnParticle(Projectile.Center, beamWidth * 45 + bbbBONUSbeamSizeWOAHH); + //ModContent.GetInstance().SpawnParticle(Projectile.Center, beamWidth * 46 + bbbBONUSbeamSizeWOAHH); + //ModContent.GetInstance().SpawnParticle(Projectile.Center, beamWidth * 45 + bbbBONUSbeamSizeWOAHH); + + Particle beam3 = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/SmallBloom", false, 8, (0.2f + bbbBONUSbeamSizeWOAHH * 0.0015f) * beamWidth, Color.OrangeRed, new Vector2(1f, 1), true, false, 0, false, false, 0.6f); + GeneralParticleHandler.SpawnParticle(beam3); + Particle beam33 = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/SmallBloom", false, 8, (0.1f + bbbBONUSbeamSizeWOAHH * 0.0015f) * beamWidth, Color.Lerp(Color.Orange, Color.White, 0.3f), new Vector2(1f, 1), true, false, 0, false, false, 0.6f); + GeneralParticleHandler.SpawnParticle(beam33); } } - if (Time == 13) + if (Time == 0) { - for (int i = 0; i <= 4; i++) + for (int i = 0; i <= 3; i++) { - Vector2 sparkVelocity = Projectile.velocity * 6; + Vector2 sparkVelocity = Projectile.velocity * 3; - 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); + float sparkScale1 = Main.rand.NextFloat(0.006f, 0.008f) * 2; + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.85f) * Main.rand.NextFloat(0.4f, 0.95f); + Particle spark1 = new GlowSparkParticle(Projectile.Center, sparkvelocity1, false, 8, sparkScale1, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed, new Vector2(2, 1), true, false, 1.3f); 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); + float sparkScale2 = Main.rand.NextFloat(0.01f, 0.017f) * 2; + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.1f, 3.1f); + Particle spark2 = new GlowSparkParticle(Projectile.Center, sparkvelocity2, false, 8, sparkScale2, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed, new Vector2(2, 1), true, false, 1.3f); GeneralParticleHandler.SpawnParticle(spark2); } } } + Time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -145,14 +159,20 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(DragonsBreath.WeldingBurn, Projectile.Center); audioCooldown = 12; } - float OrbSize = Main.rand.NextFloat(0.5f, 0.8f) - beamWeldBloomReduction * 0.14f; - Particle orb = new GenericBloom(target.Center, Vector2.Zero, Color.OrangeRed, OrbSize + 0.6f, 8, true); - GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new GenericBloom(target.Center, Vector2.Zero, Color.White, OrbSize + 0.2f, 8, true); - GeneralParticleHandler.SpawnParticle(orb2); + //float OrbSize = Main.rand.NextFloat(0.5f, 0.8f) - beamWeldBloomReduction * 0.14f; + //Particle orb = new GenericBloom(target.Center, Vector2.Zero, Color.OrangeRed, OrbSize + 0.6f, 8, true); + //GeneralParticleHandler.SpawnParticle(orb); + //Particle orb2 = new GenericBloom(target.Center, Vector2.Zero, Color.White, OrbSize + 0.2f, 8, true); + //GeneralParticleHandler.SpawnParticle(orb2); + + Particle blast = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/SmallBloom", false, 7, Main.rand.NextFloat(0.6f, 0.7f), Color.OrangeRed, Vector2.One, true, false); + GeneralParticleHandler.SpawnParticle(blast); + Particle blast2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/SmallBloom", false, 7, Main.rand.NextFloat(0.4f, 0.5f), Color.OrangeRed, Vector2.One, true, true); + GeneralParticleHandler.SpawnParticle(blast2); + if (!postHit) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 2; i++) { Vector2 SpawnPosition = target.Center + Main.rand.NextVector2Circular(target.width, target.height) * 0.04f; Vector2 splatterDirection = (Projectile.Center - SpawnPosition).SafeNormalize(Vector2.UnitY); @@ -163,21 +183,47 @@ namespace CalamityMod.Projectiles.Ranged SparkParticle spark = new SparkParticle(target.Center, sparkVelocity, true, sparkLifetime, sparkScale, sparkColor); GeneralParticleHandler.SpawnParticle(spark); } + for (int i = 0; i <= 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 0.5f, 278, Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(2.5f, 8.5f), 0, default, Main.rand.NextFloat(0.5f, 1.1f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.OrangeRed; + } + for (int i = 0; i <= 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 0.5f, Main.rand.NextBool(3) ? 293 : 174, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.5f, 3.5f), 0, default, Main.rand.NextFloat(1.6f, 2.3f)); + dust.noGravity = true; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 0.5f, Main.rand.NextBool(3) ? 293 : 174, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.8f, 5.8f), 0, default, Main.rand.NextFloat(1.6f, 2.3f)); + dust2.noGravity = true; + } postHit = true; } beamWeldBloomReduction++; } + + float sine = MathHelper.Clamp(Math.Abs((float)Math.Sin((Time + Projectile.ai[1]) * 0.575f / MathHelper.Pi)), 0.2f + Time * 0.0022f, 1); + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.Lerp(Color.Orange, Color.OrangeRed, sine) * 0.7f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10, 10), Main.rand.NextFloat(0.2f, 1.2f), 2.5f * Main.rand.NextFloat(0.9f, 1.2f), 15, true); + GeneralParticleHandler.SpawnParticle(blastRing); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + target.AddBuff(ModContent.BuffType(), 420); } else if (!postHit) { - for (int i = 0; i <= 6; i++) + for (int i = 0; i <= 5; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.position - Projectile.velocity * 0.5f, Main.rand.NextBool(3) ? 293 : 174, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.5f, 3.5f), 0, default, Main.rand.NextFloat(1.6f, 2.3f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 0.5f, Main.rand.NextBool(3) ? 293 : 174, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.5f, 3.5f), 0, default, Main.rand.NextFloat(1.6f, 2.3f)); dust.noGravity = true; - Dust dust2 = Dust.NewDustPerfect(Projectile.position - Projectile.velocity * 0.5f, Main.rand.NextBool(3) ? 293 : 174, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.8f, 5.8f), 0, default, Main.rand.NextFloat(1.6f, 2.3f)); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 0.5f, Main.rand.NextBool(3) ? 293 : 174, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.8f, 5.8f), 0, default, Main.rand.NextFloat(1.6f, 2.3f)); dust2.noGravity = true; } + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 0.5f, 278, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.5f, 3.5f), 0, default, Main.rand.NextFloat(0.8f, 1.5f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.OrangeRed; + } postHit = true; } target.AddBuff(ModContent.BuffType(), 240); diff --git a/Projectiles/Ranged/DragonsBreathHoldout.cs b/Projectiles/Ranged/DragonsBreathHoldout.cs new file mode 100644 index 0000000000..8ebff3977e --- /dev/null +++ b/Projectiles/Ranged/DragonsBreathHoldout.cs @@ -0,0 +1,133 @@ +using System.Diagnostics.Metrics; +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 Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class DragonsBreathHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 60f; + public override float OffsetXUpwards => -10f; + public override float BaseOffsetY => -10f; + public override float OffsetYDownwards => 5f; + public override Vector2 GunTipPosition => base.GunTipPosition - Projectile.velocity.RotatedBy(0.6f * Projectile.direction) * 10; + + public ref float Time => ref Projectile.ai[0]; + public ref float fireTimer => ref Projectile.ai[1]; + public int fireSpeed = 1; + public bool firingBeam = false; + public int weldingTimer = 0; + public SlotId WeldSoundSlot; + public bool hasLaunchedMag = false; + public float fade = 0; + + public override void HoldoutAI() + { + fade = MathHelper.Lerp(fade, 0, 0.25f); + if (Time == 0) + { + weldingTimer = Owner.itemAnimationMax * 6; + } + if (firingBeam) + { + if (weldingTimer > 0) + { + if (SoundEngine.TryGetActiveSound(WeldSoundSlot, out var WeldSound) && WeldSound.IsPlaying) + WeldSound.Position = Projectile.Center; + if (Owner.Calamity().DragonsBreathAudioCooldown2 == 0) + { + Owner.Calamity().DragonsBreathAudioCooldown2 = 30; + WeldSoundSlot = SoundEngine.PlaySound(DragonsBreath.WeldingShoot, Projectile.Center); + } + + if (weldingTimer % 2 == 0) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 1, weldingTimer, (Time % 15 < 10 ? 18 : 0)); + + weldingTimer--; + if (Time % 3 == 0) + { + OffsetLengthFromArm = 54f; + } + } + else + { + Time = -1; + firingBeam = false; + fireSpeed = 1; + SoundStyle bigShot = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(bigShot with { PitchVariance = 0.15f, Volume = 0.75f }, Projectile.Center); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6).RotatedBy(-2.3f * Projectile.direction), ModContent.ProjectileType(), Main.zenithWorld ? 250000 : 1, Projectile.knockBack, Projectile.owner, 1); + hasLaunchedMag = true; + } + } + else + { + // If the time reaches Item.useTime, it'll shoot the projectile, fire and reset the timer. + if (fireTimer >= Owner.itemTimeMax && Main.myPlayer == Projectile.owner) + { + Owner.PickAmmo(Owner.ActiveItem(), out _, out float shootSpeed, out int damage, out float knockback, out _, !Main.rand.NextBool(5)); + + for (int i = 0; i < 3; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.15f * i * 0.5f) * shootSpeed * (i == 0 ? 0.5f : i == 1 ? 0.7f : 1) * Main.rand.NextFloat(0.8f, 1f), ModContent.ProjectileType(), damage, knockback, Projectile.owner); + + SoundEngine.PlaySound(DragonsBreath.FireballSound, Projectile.Center); + hasLaunchedMag = false; + fade = 1; + + OffsetLengthFromArm = 52f; + fireSpeed++; + fireTimer = 0; + if (fireSpeed == 20) + { + OffsetLengthFromArm = 32f; + firingBeam = true; + SoundEngine.PlaySound(DragonsBreath.WeldingStart, Projectile.Center); + } + } + + fireTimer += 1 + (fireSpeed * 0.15f); + } + Time++; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Time < 2) + return false; + + Texture2D texture = Terraria.GameContent.TextureAssets.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 * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (firingBeam) + { + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(texture, position + Main.rand.NextVector2Circular(10, 10), null, Color.Orange with { A = 0 } * 0.6f, rotation, origin, Projectile.scale * Owner.gravDir, effects); + } + Main.EntitySpriteDraw(texture, position, null, Projectile.GetAlpha(lightColor), rotation + (hasLaunchedMag ? (-0.5f * Utils.GetLerpValue(Owner.itemAnimationMax * 0.2f, 0, fireTimer, true) * Projectile.direction) : 0), origin, Projectile.scale * Owner.gravDir, effects); + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Vector2 drawPosition = GunTipPosition - Main.screenPosition + Projectile.velocity * 3; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + // Glow Orb + Main.EntitySpriteDraw(rechargeTexture, drawPosition, null, Color.OrangeRed with { A = 0 } * fade, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.4f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, drawPosition, null, Color.Orange with { A = 0 } * 0.75f * fade, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f, SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/Ranged/DragonsBreathMag.cs b/Projectiles/Ranged/DragonsBreathMag.cs index 0908d58da1..89bafd2447 100644 --- a/Projectiles/Ranged/DragonsBreathMag.cs +++ b/Projectiles/Ranged/DragonsBreathMag.cs @@ -34,12 +34,12 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { // Unsure if it will look good with these - //ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - //ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + //ProjectileID.Sets.TrailCacheLength[Type] = 8; + //ProjectileID.Sets.TrailingMode[Type] = 0; } public override bool PreDraw(ref Color lightColor) { - //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DragonsBreathMag").Value); + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DragonsBreathMag").Value); return true; } public override void AI() diff --git a/Projectiles/Ranged/DrataliornusFlame.cs b/Projectiles/Ranged/DrataliornusFlame.cs index eb614b0583..2b7c2cf2d0 100644 --- a/Projectiles/Ranged/DrataliornusFlame.cs +++ b/Projectiles/Ranged/DrataliornusFlame.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.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; } diff --git a/Projectiles/Ranged/DrizzlefishFire.cs b/Projectiles/Ranged/DrizzlefishFire.cs index 7d1dd34af7..a1384538d8 100644 --- a/Projectiles/Ranged/DrizzlefishFire.cs +++ b/Projectiles/Ranged/DrizzlefishFire.cs @@ -28,19 +28,19 @@ namespace CalamityMod.Projectiles.Ranged } public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override bool PreDraw(ref Color lightColor) { if (Time < 7) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value); else { if (Projectile.ai[1] == 1f) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire2").Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire2").Value); else - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire").Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire").Value); } //Changes the texture of the projectile if (Projectile.ai[1] == 1f) diff --git a/Projectiles/Ranged/DrizzlefishFireSplit.cs b/Projectiles/Ranged/DrizzlefishFireSplit.cs index 8ab731eafa..29155befd3 100644 --- a/Projectiles/Ranged/DrizzlefishFireSplit.cs +++ b/Projectiles/Ranged/DrizzlefishFireSplit.cs @@ -28,15 +28,15 @@ namespace CalamityMod.Projectiles.Ranged } public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override bool PreDraw(ref Color lightColor) { if (Projectile.ai[1] == 1f) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire2").Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire2").Value); else - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire").Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire").Value); //Changes the texture of the projectile if (Projectile.ai[1] == 1f) { diff --git a/Projectiles/Ranged/DrizzlefishFireball.cs b/Projectiles/Ranged/DrizzlefishFireball.cs index 864bcdaa33..d6de88439b 100644 --- a/Projectiles/Ranged/DrizzlefishFireball.cs +++ b/Projectiles/Ranged/DrizzlefishFireball.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Ranged } public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void AI() { @@ -117,13 +117,13 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { if (Time < 7) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value); else { if (Projectile.ai[1] == 1f) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire2").Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire2").Value); else - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire").Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire").Value); } //Changes the texture of the projectile if (Projectile.ai[1] == 1f) diff --git a/Projectiles/Ranged/DryadsTearMain.cs b/Projectiles/Ranged/DryadsTearMain.cs index 2002b27fe6..81766cb87a 100644 --- a/Projectiles/Ranged/DryadsTearMain.cs +++ b/Projectiles/Ranged/DryadsTearMain.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Ranged/DryadsTearSplit.cs b/Projectiles/Ranged/DryadsTearSplit.cs index 6b712b70a2..dc63930a32 100644 --- a/Projectiles/Ranged/DryadsTearSplit.cs +++ b/Projectiles/Ranged/DryadsTearSplit.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Ranged private float speed = 0f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 57b5a81cfd..0e457db337 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged 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) + if (!Main.dedServ) { for (int k = 0; k < 7; k++) { diff --git a/Projectiles/Ranged/ElysianArrowRain.cs b/Projectiles/Ranged/ElysianArrowRain.cs index 3053e14814..2963288945 100644 --- a/Projectiles/Ranged/ElysianArrowRain.cs +++ b/Projectiles/Ranged/ElysianArrowRain.cs @@ -24,9 +24,10 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; // 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; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 21; } public override void SetDefaults() diff --git a/Projectiles/Ranged/EmesisGore.cs b/Projectiles/Ranged/EmesisGore.cs index 05d52851f7..f66c31aa8f 100644 --- a/Projectiles/Ranged/EmesisGore.cs +++ b/Projectiles/Ranged/EmesisGore.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -43,18 +44,21 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation += 0.01f * rotDirection * Utils.GetLerpValue(0, 800, Projectile.timeLeft); Projectile.velocity *= 0.9975f; if (Projectile.ai[0] < 20 && Projectile.timeLeft > 695 && Projectile.timeLeft < 785) - Projectile.velocity = Projectile.velocity.RotatedBy(0.0017f * Projectile.ai[0]); + Projectile.velocity = Projectile.velocity.RotatedBy(0.0017f * Projectile.ai[0] * Projectile.ai[2]); Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 70, 0, 0, 255, true)); if (targetDist < 1400f && Projectile.timeLeft > 70 && Projectile.timeLeft < 790) { - if (Projectile.timeLeft % 6 == 0) + if (Projectile.timeLeft % 5 == 0) { - Particle spark = new LineParticle(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.8f), false, Main.rand.Next(9, 20 + 1), Main.rand.NextFloat(0.8f, 1.2f), Color.Chartreuse * Main.rand.NextFloat(0.15f, 0.5f)); + //Particle spark = new LineParticle(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.8f), false, Main.rand.Next(9, 20 + 1), Main.rand.NextFloat(0.8f, 1.2f), Color.Chartreuse * Main.rand.NextFloat(0.15f, 0.5f)); + //GeneralParticleHandler.SpawnParticle(spark); + + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 6, 0.07f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.5f, new Vector2(1, 0.3f), true, false, 1); GeneralParticleHandler.SpawnParticle(spark); } - if (Main.rand.NextBool(6)) + if (Main.rand.NextBool(5)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), 75, -Projectile.velocity.RotatedByRandom(0.1) * Main.rand.NextFloat(0.1f, 0.3f), 0, default, Main.rand.NextFloat(0.5f, 1.2f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), Main.rand.NextBool(4) ? 215 : (int)CalamityDusts.SulphurousSeaAcid, -Projectile.velocity.RotatedByRandom(0.1) * Main.rand.NextFloat(0.1f, 0.3f), 0, default, Main.rand.NextFloat(0.5f, 1.2f)); dust.noGravity = true; } } @@ -62,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 420); - for (int k = 0; k < 15; k++) + for (int k = 0; k < 7; k++) { Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 28 : 215, new Vector2(11, 11).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); dust2.scale = Main.rand.NextFloat(0.75f, 1.25f); diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index 9c475b2799..18d29ded2c 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Ranged } public override bool PreDraw(ref Color lightColor) { - Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; // The conga line of colors to sift through @@ -138,11 +138,9 @@ namespace CalamityMod.Projectiles.Ranged // Draw the masking smoke if (MistType > 2 || MistType < 0) return false; - Main.spriteBatch.SetBlendState(BlendState.Additive); Rectangle frame = mist.Frame(1, 3, 0, MistType); - Main.EntitySpriteDraw(mist, firePos, frame, Color.Lerp(fireColor, Color.White, 0.3f), mainRot, frame.Size() * 0.5f, fireSize, SpriteEffects.None); - Main.EntitySpriteDraw(mist, firePos, frame, fireColor, mainRot, frame.Size() * 0.5f, fireSize * 3f, SpriteEffects.None); - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + Main.EntitySpriteDraw(mist, firePos, frame, Color.Lerp(fireColor, Color.White, 0.3f) with { A = 0 }, mainRot, frame.Size() * 0.5f, fireSize, SpriteEffects.None); + Main.EntitySpriteDraw(mist, firePos, frame, fireColor with { A = 0 }, mainRot, frame.Size() * 0.5f, fireSize * 3f, SpriteEffects.None); } return false; } diff --git a/Projectiles/Ranged/ExoCrystalArrow.cs b/Projectiles/Ranged/ExoCrystalArrow.cs index d8c08be6b7..e51f5150fe 100644 --- a/Projectiles/Ranged/ExoCrystalArrow.cs +++ b/Projectiles/Ranged/ExoCrystalArrow.cs @@ -24,8 +24,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; } public override void SetDefaults() @@ -36,6 +37,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 300; Projectile.arrow = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; @@ -92,7 +94,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 bee146a793..323da18020 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Ranged; @@ -39,25 +40,44 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - sparkColor = Main.rand.Next(4) switch + Player Owner = Main.player[Projectile.owner]; + bool photosens = CalamityClientConfig.Instance.Photosensitivity; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + List eColors = new List() { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, + Color.OrangeRed, + photosens ? Color.DodgerBlue : Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen }; + float rate = Main.GlobalTimeWrappedHourly * (photosens ? 2 : 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + if (photosens) + sparkColor.A = 64; + Time++; Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.2f); - Player Owner = Main.player[Projectile.owner]; - float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); //used for some drawing prevention for when it's offscreen since it makes a fuck load of particles + if (targetDist < 1400f) { - if (PhotoTimer == 0) - PhotoMetaball3.SpawnParticle(Projectile.Center + Owner.velocity, 42 - Time * 0.165f); - if (PhotoTimer == 1) - PhotoMetaball3.SpawnParticle(Projectile.Center + Owner.velocity, (37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)); ; + //if (PhotoTimer == 0) + //PhotoMetaball3.SpawnParticle(Projectile.Center + Owner.velocity, 42 - Time * 0.165f); + //if (PhotoTimer == 1) + //PhotoMetaball3.SpawnParticle(Projectile.Center + Owner.velocity, (37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)); ; - PhotoMetaball4.SpawnParticle(Projectile.Center + Owner.velocity, (37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)); + //PhotoMetaball4.SpawnParticle(Projectile.Center + Owner.velocity, (37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)); + + // I hate metaballs >:( + Particle beam3 = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.5f, 4f), "CalamityMod/Particles/SmallBloom", false, 4, ((37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)) * 0.005f, sparkColor, new Vector2(1f, 1 + Time * 0.1f), true, false); + GeneralParticleHandler.SpawnParticle(beam3); + if (!photosens) + { + Particle beam32 = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.5f, 4f), "CalamityMod/Particles/SmallBloom", false, 4, ((37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)) * 0.003f, Color.Lerp(Color.Blue, sparkColor, 0.5f), new Vector2(1f, 1 + Time * 0.1f), true, false); + GeneralParticleHandler.SpawnParticle(beam32); + } } if (Main.rand.NextBool(35) && targetDist < 1400f && Time > 5) { diff --git a/Projectiles/Ranged/ExoFlareCluster.cs b/Projectiles/Ranged/ExoFlareCluster.cs index ec64d7a017..f8fd95b5d8 100644 --- a/Projectiles/Ranged/ExoFlareCluster.cs +++ b/Projectiles/Ranged/ExoFlareCluster.cs @@ -1,10 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -20,6 +23,7 @@ namespace CalamityMod.Projectiles.Ranged public bool PostTileHit = false; public ref int audioCooldown => ref Main.player[Projectile.owner].Calamity().PhotoAudioCooldown; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 50; @@ -36,22 +40,43 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); Time++; - sparkColor = Main.rand.Next(4) switch + List eColors = new List() { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, + Color.OrangeRed, + Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen }; - PhotoMetaball.SpawnParticle(Projectile.Center, 90); - PhotoMetaball2.SpawnParticle(Projectile.Center, 85); + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (targetDist < 1400) + { + Particle beam3 = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.01f, 0.1f), "CalamityMod/Particles/SmallBloom", false, 3, 0.4f, sparkColor, new Vector2(1f, 1), true, true); + GeneralParticleHandler.SpawnParticle(beam3); + + float sine = MathHelper.Clamp((float)Math.Sin(Projectile.timeLeft * 0.875f / MathHelper.Pi), -0.7f, 0.7f); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 22.5f; + + Particle beam33 = new CustomSpark(Projectile.Center + offset, (-offset.RotatedBy(MathHelper.PiOver2) * 0.3f) * Main.rand.NextFloat(0.01f, 0.1f), "CalamityMod/Particles/SmallBloom", false, 23, 0.3f, sparkColor, new Vector2(1f, 1), true, true, 0, false, false, 0.1f); + GeneralParticleHandler.SpawnParticle(beam33); + } + CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 12f, 20f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 600); + Projectile.tileCollide = false; + float numberOflines = 5; float rotFactorlines = 360f / numberOflines; for (int i = 0; i < numberOflines; i++) @@ -59,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged float rot = MathHelper.ToRadians(i * 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(3.5f, 6.5f), true, 95, Main.rand.NextFloat(0.3f, 0.8f), Color.White); + Particle spark = new GlowSparkParticle(Projectile.Center + offset, velOffset * Main.rand.NextFloat(5.5f, 8.5f), true, 75, Main.rand.NextFloat(0.03f, 0.05f), sparkColor, new Vector2(0.3f, 1f)); GeneralParticleHandler.SpawnParticle(spark); float rot2 = MathHelper.ToRadians(i * rotFactorlines); @@ -69,6 +94,10 @@ namespace CalamityMod.Projectiles.Ranged SquishyLightParticle exoEnergy = new(Projectile.Center + offset2, velOffset2 * Main.rand.NextFloat(0.5f, 2.5f), 0.5f, sparkColor, 35); GeneralParticleHandler.SpawnParticle(exoEnergy); } + + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, sparkColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.2f, 1.8f * Main.rand.NextFloat(0.9f, 1.1f), 12, true); + GeneralParticleHandler.SpawnParticle(blastRing); + if (audioCooldown == 0) { SoundEngine.PlaySound(Photoviscerator.HitSound, target.Center); diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs index d9b146600d..7e169f185c 100644 --- a/Projectiles/Ranged/ExoLight.cs +++ b/Projectiles/Ranged/ExoLight.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; @@ -25,10 +26,11 @@ namespace CalamityMod.Projectiles.Ranged public ref float YDirection => ref Projectile.ai[0]; public ref float Time => ref Projectile.ai[1]; public Color sparkColor; + public Vector2 oldPos = Vector2.Zero; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 36; } public override void SetDefaults() @@ -56,25 +58,43 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - PhotoMetaball.SpawnParticle(Projectile.Center, 54); - PhotoMetaball2.SpawnParticle(Projectile.Center, 50); - - sparkColor = Main.rand.Next(4) switch + List eColors = new List() { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, + Color.OrangeRed, + Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen }; + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (oldPos != Vector2.Zero) + { + Particle beam3 = new CustomSpark(Projectile.Center, (oldPos - Projectile.Center).SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/SmallBloom", false, 13, 0.2f, sparkColor, new Vector2(1f, 1), true, true, 0, false, false, 0.3f); + GeneralParticleHandler.SpawnParticle(beam3); + } + oldPos = Projectile.Center; 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) { + float currentDist = 25000f; foreach (NPC n in Main.ActiveNPCs) { if (n.CanBeChasedBy(Projectile.GetSource_FromThis(), false)) - NPCDestination = n.Center + n.velocity * 5f; + { + Vector2 potentialDest = n.Center + n.velocity * 5f; + float newDist = potentialDest.Distance(Projectile.Center); + if (newDist < currentDist) + { + currentDist = newDist; + NPCDestination = potentialDest; + } + } } InitialCenter = Projectile.Center; Projectile.localAI[0] = 1f; diff --git a/Projectiles/Ranged/ExoLightningBolt.cs b/Projectiles/Ranged/ExoLightningBolt.cs index 1a3338f0af..24b74afde4 100644 --- a/Projectiles/Ranged/ExoLightningBolt.cs +++ b/Projectiles/Ranged/ExoLightningBolt.cs @@ -35,8 +35,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 50; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 50; } public override void SetDefaults() @@ -86,10 +86,6 @@ 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) { @@ -173,6 +169,10 @@ namespace CalamityMod.Projectiles.Ranged return false; } + // This projectile is forced to critically strike. + // This technically is a nerf, as it makes DSO's crits deal less damage. + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SetCrit(); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); diff --git a/Projectiles/Ranged/FeatherLarge.cs b/Projectiles/Ranged/FeatherLarge.cs index f516e7080f..db3737de73 100644 --- a/Projectiles/Ranged/FeatherLarge.cs +++ b/Projectiles/Ranged/FeatherLarge.cs @@ -10,10 +10,11 @@ namespace CalamityMod.Projectiles.Ranged public class FeatherLarge : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "Terraria/Images/Item_1516"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/FeatherLarge.png b/Projectiles/Ranged/FeatherLarge.png deleted file mode 100644 index add436a025..0000000000 Binary files a/Projectiles/Ranged/FeatherLarge.png and /dev/null differ diff --git a/Projectiles/Ranged/FetidEmesisHoldout.cs b/Projectiles/Ranged/FetidEmesisHoldout.cs index 86819620eb..36081c683c 100644 --- a/Projectiles/Ranged/FetidEmesisHoldout.cs +++ b/Projectiles/Ranged/FetidEmesisHoldout.cs @@ -10,6 +10,8 @@ using Terraria.Audio; using Terraria.GameContent; using Terraria.ModLoader; using Terraria.ID; +using System; +using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Ranged { @@ -26,6 +28,12 @@ namespace CalamityMod.Projectiles.Ranged public ref float shootingTimer => ref Projectile.ai[2]; // Dual functions for rapid fire shooting cooldown and recoil public bool isTired => cooldownTimer > 0; public float revSpeed = 1; + public bool isHoldingIn = false; + public bool holdingInBonus = false; + public bool secondShot = true; + public int maxFrames = 420; + public int initialFireTime = 45; + public float shineScale = 0; public override void KillHoldoutLogic() { @@ -35,6 +43,8 @@ namespace CalamityMod.Projectiles.Ranged public override void HoldoutAI() { + isHoldingIn = Owner.Calamity().mouseRight; + if (!isTired && (Owner.CantUseHoldout() || HeldItem.type != Owner.ActiveItem().type)) cooldownTimer = (int)(Utils.Remap(revFrames, 0, 350, 40, 180, true)); if (isTired) @@ -43,73 +53,133 @@ namespace CalamityMod.Projectiles.Ranged return; } - revSpeed = Utils.Remap(revFrames, 0, 200, 1, 20, true); - if (shootingTimer >= 60) + revSpeed = Utils.Remap(revFrames, 0, maxFrames - 120, 1, 20, true); + if (shootingTimer >= initialFireTime && revFrames < maxFrames && secondShot) { Owner.PickAmmo(Owner.ActiveItem(), out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _, !Main.rand.NextBool(4)); SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmallAlt"); - SoundEngine.PlaySound(fire with { Volume = 0.7f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = -0.1f + revSpeed * 0.01f }, Projectile.Center); Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; - float spread = 0.045f * Utils.GetLerpValue(0, 300, revFrames, true); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(spread), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); + + float spread = 0.045f * Utils.GetLerpValue(0, maxFrames, revFrames, true); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (shootVelocity).RotatedByRandom(spread), bulletAMMO, Projectile.damage / 2, Projectile.knockBack, Projectile.owner); for (int i = 0; i <= 3; i++) { Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 5, Main.rand.NextBool(5) ? 28 : 215, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); dust.noGravity = true; } - GenericSparkle sparker = new GenericSparkle(GunTipPosition, Vector2.Zero, Color.DarkGoldenrod, Color.Gold, Main.rand.NextFloat(1.1f, 1.8f), 2, Main.rand.NextFloat(-0.01f, 0.01f), 2.68f); - GeneralParticleHandler.SpawnParticle(sparker); + //GenericSparkle sparker = new GenericSparkle(GunTipPosition, Vector2.Zero, Color.DarkGoldenrod, Color.Gold, Main.rand.NextFloat(1.1f, 1.8f), 2, Main.rand.NextFloat(-0.01f, 0.01f), 2.68f); + //GeneralParticleHandler.SpawnParticle(sparker); OffsetLengthFromArm -= 5f; - shootingTimer = 0; + secondShot = false; + shineScale = 1; } - + if (shootingTimer >= 60 && revFrames < maxFrames) + { + Owner.PickAmmo(Owner.ActiveItem(), out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _, !Main.rand.NextBool(4)); + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + float spread = 0.045f * Utils.GetLerpValue(0, maxFrames, revFrames, true); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (shootVelocity).RotatedByRandom(spread).RotatedByRandom(0.04f), bulletAMMO, Projectile.damage / 2, Projectile.knockBack, Projectile.owner); + shootingTimer = 0; + secondShot = true; + } + shootingTimer += revSpeed; revFrames++; - if (revFrames >= 300 && !isTired) - { - Owner.Calamity().GeneralScreenShakePower = 6.5f; - OffsetLengthFromArm -= 35f; - cooldownTimer = 180; - SoundStyle bigShot = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveIchorShoot"); - SoundStyle bigShotGun = new("CalamityMod/Sounds/Item/FlakKrakenShoot"); - SoundEngine.PlaySound(bigShot with { Pitch = -0.2f, Volume = 0.6f }, Projectile.Center); - SoundEngine.PlaySound(bigShotGun with { Volume = 0.6f }, Projectile.Center); + shineScale *= 0.77f; - int chunkDamage = (int)(Projectile.damage * 2.5f); - Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 13; - for (int i = 0; i <= 5; i++) + if (revFrames >= maxFrames && !isTired) + { + if (isHoldingIn) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(-0.03f * i) * (1 - i * 0.08f), ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, -i); - } - for (int j = 0; j <= 5; j++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(0.03f * j) * (1 - j * 0.08f), ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, j); - } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, 20); - - for (int i = 0; i <= 18; i++) - { - Dust dust = Dust.NewDustPerfect(GunTipPosition, 66, shootVelocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); + if (revFrames == maxFrames + 120) + { + holdingInBonus = true; + SoundEngine.PlaySound(SoundID.NPCHit14 with { Volume = 1f, Pitch = 0.3f }, Projectile.Center); + for (int i = 0; i < 25; i++) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4, 8); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + dustVel, 278, dustVel * 0.7f); + dust2.scale = Main.rand.NextFloat(0.45f, 0.9f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Chartreuse : Color.Green, 0.7f); + } + Particle pulse = new CustomPulse(GunTipPosition, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.05f, 14); + GeneralParticleHandler.SpawnParticle(pulse); + } + + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(5) ? 28 : 215, (Projectile.velocity * 2).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); dust.noGravity = true; - dust.color = Color.Chartreuse; + if (revFrames % 20 == 0) + { + SoundStyle tired = new("CalamityMod/Sounds/Custom/OldDukeHuff"); + SoundEngine.PlaySound(tired with { Volume = 0.3f, Pitch = 0.3f }, Projectile.Center); + for (int i = 0; i <= 3; i++) + { + Dust dust5 = Dust.NewDustPerfect(GunTipPosition, 267, (Projectile.velocity * 5f).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust5.noGravity = true; + dust5.color = Color.Chartreuse; + } + } + } + else + { + Owner.Calamity().GeneralScreenShakePower = 6.5f; + OffsetLengthFromArm -= 35f; + cooldownTimer = holdingInBonus ? 230 : 180; + SoundStyle bigShot = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveIchorShoot"); + SoundStyle bigShotGun = new("CalamityMod/Sounds/Item/FlakKrakenShoot"); + SoundEngine.PlaySound(bigShot with { Pitch = -0.2f, Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(bigShotGun with { Volume = 0.6f }, Projectile.Center); + + int chunkDamage = (int)(Projectile.damage * (2f + (holdingInBonus ? 1 : 0))); + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 13; + if (holdingInBonus) + { + Particle pulse2 = new CustomPulse(GunTipPosition, Projectile.velocity * 14.5f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.13f, 0, 34); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle pulse = new CustomPulse(GunTipPosition, Projectile.velocity * 9f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.25f, 0, 34); + GeneralParticleHandler.SpawnParticle(pulse); + } + for (int y = 0; y < (holdingInBonus ? 3 : 1); y++) + { + float velBonus = 1 - y * 0.2f; + for (int i = 0; i <= 5; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(-0.03f * i * velBonus) * (1 - i * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, -i, 0, velBonus); + } + for (int j = 0; j <= 5; j++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(0.03f * j * velBonus) * (1 - j * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, j, 0, velBonus); + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, 20, 0, velBonus); + + for (int i = 0; i <= 18; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 66, shootVelocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); + dust.noGravity = true; + dust.color = Color.Chartreuse; + } + Particle pulse = new GlowSparkParticle(GunTipPosition - shootVelocity, shootVelocity * velBonus, false, 12, 0.035f, Color.Chartreuse, new Vector2(2.5f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse); + } } - Particle pulse = new GlowSparkParticle(GunTipPosition - shootVelocity, shootVelocity, false, 12, 0.035f, Color.Chartreuse, new Vector2(2.5f, 0.9f), true); - GeneralParticleHandler.SpawnParticle(pulse); } } private void PostFiringCooldown() { Owner.channel = true; - + if (revFrames > 3) + revFrames *= 0.7f; if (cooldownTimer > 1) { Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5; - if (cooldownTimer % 40 == 0) + if (cooldownTimer % 29 == 0) { SoundStyle tired = new("CalamityMod/Sounds/Custom/OldDukeHuff"); SoundEngine.PlaySound(tired with { Pitch = -0.2f }, Projectile.Center); @@ -144,7 +214,30 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + for (int i = 1; i <= 24; i++) + { + float attackLerp = (float)Math.Pow((double)(Utils.GetLerpValue(60, 200, revFrames, true)), (double)(8)); + float mult = MathHelper.Max(Utils.GetLerpValue(7, 0, i), Utils.GetLerpValue(17, 24, i)); + float outspace = 6 * attackLerp; + Vector2 drawOffset = (((MathHelper.TwoPi * i / 24f).ToRotationVector2().RotatedBy(Projectile.rotation) * outspace) + Main.rand.NextVector2Circular(2, 2)); + Color auraColor = Color.Chartreuse with { A = 0 } * mult * (0.4f) * Utils.GetLerpValue(90, 135, revFrames, true); + float aimAngle = drawRotation; + Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, auraColor, aimAngle, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + } + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/FullStar").Value; + float rot = Main.GlobalTimeWrappedHourly * 4; + + if (!isTired && (revFrames < maxFrames) && revFrames > 20) + { + for (int i = -2; i <= 2; i++) // 5 times + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.Chartreuse with { A = 0 } * 0.35f, Projectile.rotation + (shineScale + rot), rechargeTexture.Size() * 0.5f, new Vector2(1 - i * 0.2f, 1 + i * 0.2f) * shineScale * 3, SpriteEffects.None, 0); + for (int i = -2; i <= 2; i++) // 5 times + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.Chartreuse with { A = 0 } * 0.35f, Projectile.rotation - (shineScale + rot), rechargeTexture.Size() * 0.5f, new Vector2(1 - i * 0.2f, 1 + i * 0.2f) * shineScale * 3, SpriteEffects.None, 0); + } + return false; } } diff --git a/Projectiles/Ranged/FishronRPG.cs b/Projectiles/Ranged/FishronRPG.cs index 257becbc69..2283da203f 100644 --- a/Projectiles/Ranged/FishronRPG.cs +++ b/Projectiles/Ranged/FishronRPG.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Ranged public class FishronRPG : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 14; diff --git a/Projectiles/Ranged/FlakKrakenHoldout.cs b/Projectiles/Ranged/FlakKrakenHoldout.cs index 362c7e66a2..71f1228313 100644 --- a/Projectiles/Ranged/FlakKrakenHoldout.cs +++ b/Projectiles/Ranged/FlakKrakenHoldout.cs @@ -33,6 +33,14 @@ namespace CalamityMod.Projectiles.Ranged public override void HoldoutAI() { + // 15NOV2024: Ozzatron: applying clamped mouse position here is difficult. + // Rockets need to explode "at the cursor", but they do so by storing range to explode. + // Allowing rockets to explode at an unclamped cursor enables higher-resolution screens to have a precision DPS advantage. + // However, clamping the cursor causes the projectiles to explode at incorrect times and places. + // The solution is to use an unclamped cursor, but separately and manually clamp the explosion distance. + // Technically speaking this allows for applying precision DPS at a further vertical distance than intended, + // but the alternative is way too hard to program and will just piss people off. + // // The vector between the player and the mouse. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - Owner.MountedCenter; @@ -72,8 +80,11 @@ namespace CalamityMod.Projectiles.Ranged break; } + // 15NOV2024: Ozzatron: manually clamp flak explosion distance + float flakDist = MathHelper.Clamp(ownerToMouse.Length(), 0f, 960f); + // Spawns the projectile. - Projectile.NewProjectileDirect( + Projectile.NewProjectile( Projectile.GetSource_FromThis(), GunTipPosition, direction * itemShootSpeed, @@ -82,7 +93,7 @@ namespace CalamityMod.Projectiles.Ranged itemKnockback, Projectile.owner, rocketTypeShot, - ownerToMouse.Length()); + flakDist); // Applies the knockback to the player. Owner.velocity += ownerToMouse.SafeNormalize(Vector2.UnitY) * -OwnerKnockbackStrength; diff --git a/Projectiles/Ranged/FlakKrakenProj.png b/Projectiles/Ranged/FlakKrakenProj.png deleted file mode 100644 index ebffc498ad..0000000000 Binary files a/Projectiles/Ranged/FlakKrakenProj.png and /dev/null differ diff --git a/Projectiles/Ranged/FlakKrakenProjectile.cs b/Projectiles/Ranged/FlakKrakenProjectile.cs index 98db63bb3b..7eee3c9790 100644 --- a/Projectiles/Ranged/FlakKrakenProjectile.cs +++ b/Projectiles/Ranged/FlakKrakenProjectile.cs @@ -250,7 +250,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; diff --git a/Projectiles/Ranged/FlakToxicannonHoldout.cs b/Projectiles/Ranged/FlakToxicannonHoldout.cs index 1bf6ce82a7..c257dcc7a0 100644 --- a/Projectiles/Ranged/FlakToxicannonHoldout.cs +++ b/Projectiles/Ranged/FlakToxicannonHoldout.cs @@ -34,6 +34,14 @@ namespace CalamityMod.Projectiles.Ranged // The center of the player, taking into account if they have a mount or not. Vector2 mountedCenter = Owner.MountedCenter; + // 15NOV2024: Ozzatron: applying clamped mouse position here is difficult. + // Rockets need to explode "at the cursor", but they do so by storing range to explode. + // Allowing rockets to explode at an unclamped cursor enables higher-resolution screens to have a precision DPS advantage. + // However, clamping the cursor causes the projectiles to explode at incorrect times and places. + // The solution is to use an unclamped cursor, but separately and manually clamp the explosion distance. + // Technically speaking this allows for applying precision DPS at a further vertical distance than intended, + // but the alternative is way too hard to program and will just piss people off. + // // The vector between the player and the mouse. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - mountedCenter; @@ -69,8 +77,11 @@ namespace CalamityMod.Projectiles.Ranged break; } + // 15NOV2024: Ozzatron: manually clamp flak explosion distance + float flakDist = MathHelper.Clamp(ownerToMouse.Length(), 0f, 960f); + // Spawns the projectile. - Projectile.NewProjectileDirect( + Projectile.NewProjectile( Projectile.GetSource_FromThis(), GunTipPosition, direction * itemShootSpeed, @@ -79,7 +90,7 @@ namespace CalamityMod.Projectiles.Ranged itemKnockback, Projectile.owner, rocketTypeShot, - ownerToMouse.Length()); + flakDist); // Applies the knockback to the player. Owner.velocity += ownerToMouse.SafeNormalize(Vector2.UnitY) * -OwnerKnockbackStrength; diff --git a/Projectiles/Ranged/FlakToxicannonProjectile.cs b/Projectiles/Ranged/FlakToxicannonProjectile.cs index a01cdd3535..d8ab7107d2 100644 --- a/Projectiles/Ranged/FlakToxicannonProjectile.cs +++ b/Projectiles/Ranged/FlakToxicannonProjectile.cs @@ -252,10 +252,10 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = IsShrapnel ? Request("CalamityMod/Projectiles/Environment/AcidDrop").Value : Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = IsShrapnel ? Request("CalamityMod/Projectiles/Environment/AcidDrop").Value : Terraria.GameContent.TextureAssets.Projectile[Type].Value; Color drawColor = Projectile.GetAlpha(lightColor); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], drawColor * 0.35f, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], drawColor * 0.35f, 1, texture); return false; } diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index 9912900d23..eec96dfc86 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -10,7 +10,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Ranged/FlashRoundProj.cs b/Projectiles/Ranged/FlashRoundProj.cs index 9d44f9e9f9..6eb86ba08f 100644 --- a/Projectiles/Ranged/FlashRoundProj.cs +++ b/Projectiles/Ranged/FlashRoundProj.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public float ExplosionPower = 1.5f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Ranged/FlurrystormCannonShooting.cs b/Projectiles/Ranged/FlurrystormCannonShooting.cs index 3e0da96543..52bee35333 100644 --- a/Projectiles/Ranged/FlurrystormCannonShooting.cs +++ b/Projectiles/Ranged/FlurrystormCannonShooting.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Ranged public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index 8f03888039..04c56abf8c 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -21,10 +21,14 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Projectile.velocity.Y <= 0f) - Projectile.velocity.Y = 0.1f; + if (Projectile.ai[1] != 1f) + { + if (Projectile.velocity.Y <= 0f) + Projectile.velocity.Y = 0.1f; + Projectile.velocity.Y *= 1.05f; + } + Projectile.rotation += Projectile.velocity.Y; - Projectile.velocity.Y *= 1.05f; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Ranged/FreedomStarBeam.cs b/Projectiles/Ranged/FreedomStarBeam.cs index 859e5d49d5..ed2c586152 100644 --- a/Projectiles/Ranged/FreedomStarBeam.cs +++ b/Projectiles/Ranged/FreedomStarBeam.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Ranged ProduceBeamDust(beamColor); // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); @@ -203,7 +203,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.velocity == Vector2.Zero) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index d98d3f1271..8769ef68f7 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/Ranged/FungiOrb"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 12; diff --git a/Projectiles/Ranged/GemTechGreenFlechette.cs b/Projectiles/Ranged/GemTechGreenFlechette.cs index 2f2410091a..981761315d 100644 --- a/Projectiles/Ranged/GemTechGreenFlechette.cs +++ b/Projectiles/Ranged/GemTechGreenFlechette.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; } public override void SetDefaults() @@ -69,8 +69,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - int afterimageCount = ProjectileID.Sets.TrailCacheLength[Projectile.type]; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int afterimageCount = ProjectileID.Sets.TrailCacheLength[Type]; + Texture2D texture = Terraria.GameContent.TextureAssets.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 cc839fb9b4..45dd067be9 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -28,10 +28,10 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) TextureBlue = Mod.Assets.Request("Projectiles/Ranged/GodSlayerSlugBlue", AssetRequestMode.ImmediateLoad).Value; } @@ -119,6 +119,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.netUpdate = true; Projectile.tileCollide = false; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // Step 1 of the warp: Place the bullet behind the player, opposite the mouse cursor. Vector2 playerToMouseVec = CalamityUtils.SafeDirectionTo(Main.LocalPlayer, Main.MouseWorld, -Vector2.UnitY); float warpDist = Main.rand.NextFloat(70f, 96f); @@ -135,7 +137,7 @@ namespace CalamityMod.Projectiles.Ranged // Set all old positions to the bullet's warp position so that there aren't weird afterimages. // If an old position is uninitialized (0,0 aka never used), then don't change it. - for (int i = 0; i < ProjectileID.Sets.TrailCacheLength[Projectile.type]; ++i) + for (int i = 0; i < ProjectileID.Sets.TrailCacheLength[Type]; ++i) { Vector2 oldPosElem = Projectile.oldPos[i]; if (!(oldPosElem == Vector2.Zero)) diff --git a/Projectiles/Ranged/HailstormBulletProj.cs b/Projectiles/Ranged/HailstormBulletProj.cs index ac240f4e5d..17620c79fa 100644 --- a/Projectiles/Ranged/HailstormBulletProj.cs +++ b/Projectiles/Ranged/HailstormBulletProj.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -17,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public Vector2 startVelocity; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 18; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 18; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -43,6 +44,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.localAI[0] == 0f) { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10.5f; startVelocity = Projectile.velocity; rotDirection = Main.rand.NextBool(); Projectile.velocity *= Main.rand.NextFloat(0.97f, 1.03f); @@ -89,16 +91,18 @@ namespace CalamityMod.Projectiles.Ranged 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); + Particle ice = new CustomSpark(Projectile.Center + velocity * 4.5f + addedPlacement, velocity * 7, "CalamityMod/Particles/GlowBlade", false, 6, 0.025f, Color.SkyBlue * 0.9f, new Vector2(1.5f, 0.6f), true, true, shrinkSpeed: 0.9f, glowCenterScale: 0.8f, glowOpacity: 0.3f); + GeneralParticleHandler.SpawnParticle(ice); } - int onHitDamage = (int)(Projectile.damage * 0.5f); - Owner.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + // This is about equivalent to the previous direct strike extra damage but can't also crit itself obviously + // Also it's not as impacted by defense, which is why it's a bit weaker, rather than being a full 1f + modifiers.CritDamage += 0.85f; + if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.5f); if (Projectile.damage < 1) diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index 55536073df..be4ba1de28 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 450); + target.AddBuff(ModContent.BuffType(), 450); SoundEngine.PlaySound(HalleysInferno.Hit, Projectile.Center); // Dust emission on hit diff --git a/Projectiles/Ranged/HallowPointRoundProj.cs b/Projectiles/Ranged/HallowPointRoundProj.cs index 38bc347b06..8d8ec76fec 100644 --- a/Projectiles/Ranged/HallowPointRoundProj.cs +++ b/Projectiles/Ranged/HallowPointRoundProj.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -59,14 +59,15 @@ namespace CalamityMod.Projectiles.Ranged return false; } - // 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 + // This bullet increases the base damage of its hits by 6. + // While this is a "flat" addition of a fixed value, it is NOT SourceDamage.Flat, so it is not actually "flat bonus damage". + // - The bonus base damage is pre-mitigation + // - Damage boosts and multipliers apply to the bonus base damage. THIS INCLUDES PLAYER STATS. + // -> THIS IS INTENTIONAL because ammo item base damage scales with ranged damage anyway. // - 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) { - modifiers.SourceDamage.Flat += HallowPointRound.BonusDamageOnHit; + modifiers.SourceDamage.Base += HallowPointRound.BonusDamageOnHit; } // On impact, make impact sparkle and play a sound. diff --git a/Projectiles/Ranged/HeavenlyGaleProj.cs b/Projectiles/Ranged/HeavenlyGaleProj.cs index 09e5b1616b..a3bd608917 100644 --- a/Projectiles/Ranged/HeavenlyGaleProj.cs +++ b/Projectiles/Ranged/HeavenlyGaleProj.cs @@ -160,14 +160,13 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Heavenly Gale bow + float aimInterpolant = Utils.GetLerpValue(10f, 40f, Projectile.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), aimInterpolant); if (Projectile.velocity != oldVelocity) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); } Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.UnitY) * 44f; @@ -196,7 +195,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/HellbornHoldout.cs b/Projectiles/Ranged/HellbornHoldout.cs new file mode 100644 index 0000000000..c37eb1104c --- /dev/null +++ b/Projectiles/Ranged/HellbornHoldout.cs @@ -0,0 +1,230 @@ +using System; +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.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HellbornHoldout : BaseGunHoldoutProjectile + { + 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 override float RecoilResolveSpeed => 0.5f; + + public ref float time => ref Projectile.ai[0]; + public float cooldownTimer = 0; + public bool onCooldown => cooldownTimer > 0; + public SlotId SoundSlot; + + public bool Spinning => Projectile.ai[2] == 0; + public bool failedShot = false; + public float drawRot = 0; + public bool hasPlayedSound = false; + public bool hasPlayedReloadSound = false; + public float fade = 0; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 62; + Projectile.height = 34; + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.tileCollide = false; + Projectile.ArmorPenetration = 25; + } + public override void HoldoutAI() + { + fade = Utils.GetLerpValue(0, 40, time, true); + if (SoundEngine.TryGetActiveSound(SoundSlot, out var sSound) && sSound.IsPlaying) + { + sSound.Volume = fade * 100 * 0.5f; + sSound.Position = Projectile.Center; + } + + if (onCooldown) + { + PostFiringCooldown(); + if (!Spinning) + return; + } + if (Spinning) + { + float armRot = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float spinArmRot = (((Projectile.Center + new Vector2(0, -3).RotatedBy(drawRot * 0.6f)) - Owner.Center).SafeNormalize(Vector2.UnitX) * 5).ToRotation(); + Owner.SetCompositeArmBack(true, FrontArmStretch, armRot + 0.6f * Projectile.direction); + Owner.SetCompositeArmFront(true, BackArmStretch, spinArmRot + MathHelper.ToRadians(-90f)); + } + if (time > 3) + { + if (Spinning) + { + if (Owner.CantUseHoldout()) + { + Projectile.Kill(); + sSound?.Stop(); + } + else + { + OffsetLengthFromArm = MathHelper.Lerp(OffsetLengthFromArm, 9, 0.5f); + drawRot += 0.75f * Projectile.direction * MathHelper.Clamp(fade, 0.3f, 1f); + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.OrangeRed, Color.White, 0.6f).ToVector3() * fade * 0.7f); + if (!hasPlayedSound && Main.myPlayer == Projectile.owner) + { + SoundStyle spin = new("CalamityMod/Sounds/Item/SpinningWoosh"); + SoundSlot = SoundEngine.PlaySound(spin with { Volume = 0.01f, Pitch = -0.1f, IsLooped = true }, Projectile.Center); + hasPlayedSound = true; + } + + Particle Smear = new CircularSmearVFX(Projectile.Center, Color.Red * Main.rand.NextFloat(0.45f, 0.6f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(1.13f, 1.25f) * fade); + GeneralParticleHandler.SpawnParticle(Smear); + + Particle Smear2 = new CircularSmearVFX(Projectile.Center, Color.OrangeRed * Main.rand.NextFloat(0.45f, 0.6f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(0.65f, 0.72f) * fade); + GeneralParticleHandler.SpawnParticle(Smear2); + + if (Main.rand.NextBool() && fade > 0.2f) + { + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + drawRot * 0.25f + MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * 35f * fade; + Dust dust = Dust.NewDustPerfect(dustPos, 278, (i * MathHelper.Pi + (drawRot * Projectile.direction) * 0.25f * Math.Sign(Projectile.velocity.X)).ToRotationVector2().RotatedBy(MathHelper.ToRadians(180f) * (Projectile.direction == 1 ? 0 : 1)) * -3f * Main.rand.NextFloat(0.5f, 1f) * fade); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.42f, 0.62f); + dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + + } + } + else if (fade > 0.2f) + { + for (int i = 0; i < 3; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + drawRot * 0.5f + MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * 87f * fade; + Dust dust = Dust.NewDustPerfect(dustPos, 267, (i * MathHelper.Pi + (drawRot * Projectile.direction) * 0.5f * Math.Sign(Projectile.velocity.X)).ToRotationVector2().RotatedBy(MathHelper.ToRadians(180f) * (Projectile.direction == 1 ? 0 : 1)) * -7f * Main.rand.NextFloat(0.5f, 1f) * fade); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.62f, 0.82f); + dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + } + } + } + } + else if (!onCooldown) + { + if (Owner.Calamity().hellbornShots > 0) + { + Owner.Calamity().GeneralScreenShakePower = 5f; + OffsetLengthFromArm -= 35f; + cooldownTimer = Owner.itemAnimationMax * 2; + Owner.Calamity().hellbornShots--; + SoundStyle bigShot = new("CalamityMod/Sounds/Item/HellbornShoot"); + SoundEngine.PlaySound(bigShot with { PitchVariance = 0.15f, Volume = 0.9f }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7; + + Owner.velocity += shootVelocity * -0.68f; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shootVelocity.RotatedBy(0.75f * Projectile.direction) * 1f, ModContent.ProjectileType(), 0, 0, Projectile.owner); + + for (int i = 0; i <= 13; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 1.5f), 80, default, Main.rand.NextFloat(0.4f, 1.3f)); + dust.noGravity = false; + dust.color = Color.White; + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.52f, 0.72f); + dust2.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + } + for (int i = 0; i < 14; i++) + { + Particle smoke = new HeavySmokeParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1.5f), Color.White, 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); + } + } + else + { + OffsetLengthFromArm -= 8f; + failedShot = true; + SoundStyle bigShot = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(bigShot with { PitchVariance = 0.15f, Volume = 0.75f }, Projectile.Center); + cooldownTimer = Owner.itemAnimationMax; + } + } + } + + time++; + } + private void PostFiringCooldown() + { + Owner.channel = true; + cooldownTimer -= (Spinning ? 1 : 2f); + + if (cooldownTimer > 1) + { + if (!Owner.Calamity().mouseRight && cooldownTimer < Owner.itemAnimationMax * 1.7f && !failedShot && !Main.mouseLeftRelease) + Projectile.ai[2] = 0; + if (cooldownTimer <= 18 && !hasPlayedReloadSound) + { + if (!failedShot) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HellbornReload"); + SoundEngine.PlaySound(fire with { Volume = 0.8f }, Projectile.Center); + } + hasPlayedReloadSound = true; + } + } + else if (!Spinning) + { + if (SoundEngine.TryGetActiveSound(SoundSlot, out var sSound) && sSound.IsPlaying) + sSound?.Stop(); + Projectile.Kill(); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= 0.1f; + if (Owner.Calamity().hellbornShots < 8) + { + Owner.Calamity().hellbornShots++; + } + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/Hellborn").Value; + Texture2D spinTexture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/Hellborn").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 + (Spinning ? new Vector2(0, -8).RotatedBy(drawRot * 0.6f) : Vector2.Zero), null, Projectile.GetAlpha(lightColor), drawRotation + drawRot, rotationPoint, Projectile.scale, flipSprite); + return false; + } + public override bool? CanDamage() => Spinning && time > 5 ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 100, targetHitbox); + public override void KillHoldoutLogic() + { + } + } +} diff --git a/Projectiles/Ranged/HellbornProj.cs b/Projectiles/Ranged/HellbornProj.cs new file mode 100644 index 0000000000..357bbad717 --- /dev/null +++ b/Projectiles/Ranged/HellbornProj.cs @@ -0,0 +1,133 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HellbornProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 6; + } + + public override void SetDefaults() + { + Projectile.width = 38; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 2; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + //Animation + if (Projectile.frame == 0 || Projectile.frame == 3) + Projectile.frameCounter++; + else + Projectile.frameCounter += 2; + if (Projectile.frameCounter > 20) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 5) + { + Projectile.frame = 0; + } + if (Projectile.velocity.Length() < 18) + Projectile.velocity *= 1.035f; + + //Rotation + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + + Lighting.AddLight(Projectile.Center, Color.Orange.ToVector3()); + + if (targetDist < 1400f) + { + // 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; + if (Main.rand.NextBool(2)) + { + Particle orb = new GlowOrbParticle(Projectile.Center + offset, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(orb); + } + if (Main.rand.NextBool(2)) + { + Particle orb2 = new GlowOrbParticle(Projectile.Center - offset, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + Vector2 dustPos = Projectile.Center + Main.rand.NextVector2Circular(30, 30); + Dust dust = Dust.NewDustPerfect(dustPos, 267, -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.72f, 1.12f); + dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player Owner = Main.player[Projectile.owner]; + + // Launch + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); + target.MoveNPC(launchVel, 6, true); + } + public override void OnKill(int timeLeft) + { + for (int l = 0; l < 17; l++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.62f, 0.82f); + dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + } + + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.2f, 1.7f, 16, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f, 0.9f, 16, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + + SoundStyle bigShot = new("CalamityMod/Sounds/Item/HellbornImpact"); + SoundEngine.PlaySound(bigShot with { PitchVariance = 0.15f, Volume = 0.8f }, Projectile.Center); + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/HellbornProj").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + + Rectangle frame = texture.Frame(1, 6, 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + // Glow Orb + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, Color.OrangeRed with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.5f * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * 0.75f, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.35f * randSize, SpriteEffects.None, 0); + + for (int i = 0; i < 1; i++) + Main.EntitySpriteDraw(texture, drawPosition, frame, Color.White, 0, origin, Projectile.scale * (i == 0 ? 1.15f : 1), SpriteEffects.None, 0); + + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 35, targetHitbox); + } +} diff --git a/Projectiles/Ranged/HellbornProj.png b/Projectiles/Ranged/HellbornProj.png new file mode 100644 index 0000000000..f99f640dfa Binary files /dev/null and b/Projectiles/Ranged/HellbornProj.png differ diff --git a/Projectiles/Ranged/HellbornShell.cs b/Projectiles/Ranged/HellbornShell.cs new file mode 100644 index 0000000000..7647aaf586 --- /dev/null +++ b/Projectiles/Ranged/HellbornShell.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HellbornShell : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/HellbornShell"; + public int Time = 0; + public bool TouchedGrass = false; + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Projectile.scale = 0.8f; + Projectile.extraUpdates = 1; + Time++; + Player Owner = Main.player[Projectile.owner]; + if (!TouchedGrass) + { + if (Projectile.timeLeft <= 240) + Projectile.rotation += 0.04f * Projectile.direction; + else + Projectile.rotation = (new Vector2(0, -5 * Projectile.direction) + Projectile.velocity * -1.2f).ToRotation(); + + Projectile.velocity.Y += 0.087f; + Projectile.velocity.X *= 0.99f; + + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity, 303, -Projectile.velocity.RotatedByRandom(0.1f) * Main.rand.NextFloat(0.2f, 1f), 180, default, Main.rand.NextFloat(0.4f, 1.3f)); + dust.noGravity = false; + dust.color = Color.White; + } + } + else + { + Projectile.velocity = Vector2.Zero; + } + Projectile.alpha = (int)(255 * Utils.GetLerpValue(60, 0, Projectile.timeLeft, true)); + if (Collision.SolidCollision(Projectile.Center - Projectile.velocity * 1.5f, 2, 2)) + Projectile.tileCollide = true; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.damage = 0; + TouchedGrass = true; + Projectile.velocity = Vector2.Zero; + return false; + } + } +} diff --git a/Projectiles/Ranged/HellbornShell.png b/Projectiles/Ranged/HellbornShell.png new file mode 100644 index 0000000000..03dd40086a Binary files /dev/null and b/Projectiles/Ranged/HellbornShell.png differ diff --git a/Projectiles/Ranged/HighExplosivePeanutShell.cs b/Projectiles/Ranged/HighExplosivePeanutShell.cs index 10fdaa11e0..cefe2998ce 100644 --- a/Projectiles/Ranged/HighExplosivePeanutShell.cs +++ b/Projectiles/Ranged/HighExplosivePeanutShell.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 9; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 21fba14125..a660154ee0 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged // 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) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) { HasHit = true; Projectile.Kill(); @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/HiveNuke.cs b/Projectiles/Ranged/HiveNuke.cs index 95c48cb8dc..cbf2793e2f 100644 --- a/Projectiles/Ranged/HiveNuke.cs +++ b/Projectiles/Ranged/HiveNuke.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Ranged private Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Ranged // 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) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) Projectile.Kill(); Time++; @@ -153,8 +153,8 @@ namespace CalamityMod.Projectiles.Ranged 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; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], EffectsColor * 0.4f, 1, texture); + Texture2D tex = Terraria.GameContent.TextureAssets.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/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index 501562259e..1a126bde6b 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Ranged/HydraHead.cs b/Projectiles/Ranged/HydraHead.cs index f4a93d2ee6..f6439a1330 100644 --- a/Projectiles/Ranged/HydraHead.cs +++ b/Projectiles/Ranged/HydraHead.cs @@ -73,6 +73,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 1f; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimDestination = Owner.Calamity().mouseWorld; float idealRotation = Projectile.AngleTo(aimDestination); if (Time < 0f) @@ -89,7 +90,7 @@ namespace CalamityMod.Projectiles.Ranged public void PerformInitializationEffects() { - int totalHeads = Owner.ownedProjectileCounts[Projectile.type]; + int totalHeads = Owner.ownedProjectileCounts[Type]; CurrentPositionOffset = IdealPositionOffset = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); Projectile.netUpdate = true; } @@ -103,7 +104,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity = (Projectile.velocity * 9f + Projectile.SafeDirectionTo(returnPosition) * flySpeed) / 10f; } - int totalHeads = Owner.ownedProjectileCounts[Projectile.type]; + int totalHeads = Owner.ownedProjectileCounts[Type]; int moveRate = 40 + totalHeads * 4; // Reset the ideal offset from time to time. @@ -229,7 +230,7 @@ namespace CalamityMod.Projectiles.Ranged } bool shouldFlip = Math.Abs(Projectile.rotation) > MathHelper.PiOver2; - Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(headTexture, Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, null, diff --git a/Projectiles/Ranged/HydraHeadLaunch.cs b/Projectiles/Ranged/HydraHeadLaunch.cs index 96026b9f59..db6d8fc4aa 100644 --- a/Projectiles/Ranged/HydraHeadLaunch.cs +++ b/Projectiles/Ranged/HydraHeadLaunch.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged } //Normal hitbox size for explosion, rotated otherwise - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.ai[1] < 1f ? Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()) : null); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.ai[1] < 1f ? Projectile.RotatingHitboxCollision(targetHitbox) : null); public override void AI() { diff --git a/Projectiles/Ranged/HydrasBlood.cs b/Projectiles/Ranged/HydrasBlood.cs index 0ba74cfb66..ee78b8b6ae 100644 --- a/Projectiles/Ranged/HydrasBlood.cs +++ b/Projectiles/Ranged/HydrasBlood.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public override void AI() { diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 0399e05bd4..5bf58ceb15 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -1,7 +1,9 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -14,11 +16,12 @@ namespace CalamityMod.Projectiles.Ranged public float dustAngle = 0f; public bool growing = false; public bool dustWave = false; - public float variance; + public float variance = 0.8f; + public Vector2 lastPos; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -41,12 +44,13 @@ namespace CalamityMod.Projectiles.Ranged 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) { + variance = Main.rand.NextFloat(0.7f, 1f); dustWave = Main.rand.NextBool(); Projectile.scale = 1.5f; Projectile.velocity *= 0.3f; + lastPos = Projectile.velocity; switch (Main.rand.Next(0, 4 +1)) { case 4: // Yellow shot @@ -77,14 +81,22 @@ namespace CalamityMod.Projectiles.Ranged dustAngle += (growing ? 0.07f * variance : -0.07f * variance); Projectile.localAI[0] += 1f; + Vector2 orbPos = Projectile.Center + (Projectile.velocity.RotatedBy((dustWave ? 1 : -1) * dustAngle) * 4.5f - Projectile.velocity * 5); 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); + CustomSpark orb = new CustomSpark(orbPos, Utils.DirectionTo(lastPos, orbPos), "CalamityMod/Particles/BloomCircle", false, 5, (0.55f + MathF.Abs(dustAngle * 0.65f)) * 0.2f, currentColor, new Vector2(1 + MathF.Abs(dustAngle * 0.6f), 1), true, true, 0, false, false, 0.8f - MathF.Abs(dustAngle * 0.7f), 0.7f, 0.8f); GeneralParticleHandler.SpawnParticle(orb); - PointParticle spark = new PointParticle(Projectile.Center + Projectile.velocity * 3.5f, Projectile.velocity, false, 2, 0.6f, currentColor); - GeneralParticleHandler.SpawnParticle(spark); + if (Main.rand.NextBool(7)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.8f, 1.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.color = currentColor; + dust.noLightEmittence = true; + } } + lastPos = orbPos; } // This projectile is always fullbright. @@ -108,7 +120,8 @@ namespace CalamityMod.Projectiles.Ranged { 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.1), 0f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + Vector2 vel = (-oldVelocity.SafeNormalize(Vector2.UnitX) * 5); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel.RotatedByRandom(0.5f) * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); } } return true; @@ -129,7 +142,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int b = 0; b < 3; b++) { - Vector2 velocity = Projectile.velocity.RotatedByRandom(0.5f); + Vector2 velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5).RotatedByRandom(0.5f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack * 2f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); } } @@ -137,13 +150,14 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ShadowboltWallHit") with { Volume = 0.25f, Pitch = Main.rand.NextFloat(0.6f, 1f), MaxInstances = -1 }, Projectile.Center); for (int b = 0; b < 4; b++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), 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; + dust.noLightEmittence = true; } } } diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index 8bff3cfed8..a6605021e9 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged private bool rotPhase2 = false; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0]++; if (currentColor == Color.Black) { - Projectile.scale = 0.025f; + Projectile.scale = 0.015f; Projectile.alpha = 255; rotDirection = Main.rand.NextBool() ? 1 : -1; rotIntensity = Main.rand.NextFloat(0.5f, 1.5f); @@ -87,13 +87,6 @@ namespace CalamityMod.Projectiles.Ranged { for (int b = 0; b < 2; b++) { - /* - 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); } @@ -101,12 +94,9 @@ namespace CalamityMod.Projectiles.Ranged 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; + Texture2D texture = ModContent.Request("CalamityMod/Particles/GlowSpark").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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Lerp(currentColor, Color.White, 0.15f) with { A = 0 }, 1, texture, true, true); return false; } public override bool? CanDamage() => Projectile.localAI[0] < 20 ? false : null; diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index 8e49752c80..c67551d894 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -75,8 +75,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ExpandHitboxBy(50); setFallingStats = true; } - if (Projectile.Calamity().allProjectilesHome) - Projectile.Calamity().allProjectilesHome = false; // Prevent the icicle effect from breaking with Arterial Assault + if (Projectile.Calamity().conditionalHomingRange > 0f) + Projectile.Calamity().conditionalHomingRange = 0f; // Prevent the icicle effect from breaking with Arterial Assault if (targetDist < 1400f) { @@ -101,8 +101,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn2, 180); - if (Projectile.Calamity().allProjectilesHome) - Projectile.Calamity().allProjectilesHome = false; // Prevent the icicle effect from breaking with Arterial Assault + if (Projectile.Calamity().conditionalHomingRange > 0f) + Projectile.Calamity().conditionalHomingRange = 0f; // Prevent the icicle effect from breaking with Arterial Assault if (!falling) { Projectile.localAI[0] = 100; diff --git a/Projectiles/Ranged/ImpactRound.cs b/Projectiles/Ranged/ImpactRound.cs index ca6d4982e1..9dae2a8086 100644 --- a/Projectiles/Ranged/ImpactRound.cs +++ b/Projectiles/Ranged/ImpactRound.cs @@ -1,4 +1,5 @@ -using CalamityMod.Sounds; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,6 +14,7 @@ namespace CalamityMod.Projectiles.Ranged public override string Texture => "CalamityMod/Projectiles/Ranged/AMRShot"; private bool initialized = false; + public static int Lifetime = 600; public override void SetDefaults() { Projectile.width = 4; @@ -26,11 +28,10 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; - Projectile.penetrate = -1; - Projectile.timeLeft = 600; - Projectile.tileCollide = false; + Projectile.penetrate = 5; + Projectile.timeLeft = Lifetime; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } @@ -40,16 +41,69 @@ namespace CalamityMod.Projectiles.Ranged { initialized = true; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound with { Volume = CommonCalamitySounds.LargeWeaponFireSound.Volume * 0.45f }, Projectile.Center); } } + if (Projectile.timeLeft == Lifetime - 4) + { + for (int i = 0; i <= 4; i++) //Dragon's Breath shot particles my beloved + { + Vector2 sparkVelocity = Projectile.velocity * 0.5f; + + 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); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + if (Projectile.timeLeft < Lifetime - 3 && Projectile.timeLeft > Lifetime - 150) + { + AltSparkParticle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 15, 1f, Color.OrangeRed * 0.1f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + 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 OnKill(int timeLeft) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.OrangeRed, Utils.GetLerpValue(0, 3, 1, true)), "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.05f, 10); + GeneralParticleHandler.SpawnParticle(explosion); + for (int i = 0; i <= 6; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 90 : 183, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f)); + dust.noGravity = true; + dust.fadeIn = 0.5f; + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { modifiers.CritDamage += 0.25f; + for (int i = 0; i <= 2; i++) + { + LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Red : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark); + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Red : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark2); + } + + for (int i = 0; i <= 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 90 : 183, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f)); + dust.noGravity = true; + dust.fadeIn = 0.5f; + } } public override bool PreDraw(ref Color lightColor) => Projectile.timeLeft < 600; diff --git a/Projectiles/Ranged/KingsbaneHoldout.cs b/Projectiles/Ranged/KingsbaneHoldout.cs index 09d7d84584..9dd0bb0edc 100644 --- a/Projectiles/Ranged/KingsbaneHoldout.cs +++ b/Projectiles/Ranged/KingsbaneHoldout.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged } public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void AI() { @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.frame++; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 2; } @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition + Projectile.velocity * 5 + Main.rand.NextVector2Circular(7, 7), shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), ModContent.ProjectileType(), (int)(Projectile.damage * 0.9f), Projectile.knockBack, Projectile.owner); SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmall"); if (fullRevShots % 2 == 0) - SoundEngine.PlaySound(fire with { Volume = 0.8f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.7f }, Projectile.Center); //SoundEngine.PlaySound(SoundID.Item40 with { PitchVariance = 0.4f }, Projectile.Center); Owner.channel = true; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotMid"); - SoundEngine.PlaySound(fire with { Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.4f }, Projectile.Center); framesBetweenShots = 3; } if (framesBetweenShots > 0) @@ -149,14 +149,13 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Kingsbane itself + float interpolant = Utils.GetLerpValue(0f, 55f, Owner.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), 0.185f).SafeNormalize(Vector2.UnitY); if (Projectile.velocity != oldVelocity) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); } 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); diff --git a/Projectiles/Ranged/LeafArrow.cs b/Projectiles/Ranged/LeafArrow.cs index 495a5168e8..e5fb34f26e 100644 --- a/Projectiles/Ranged/LeafArrow.cs +++ b/Projectiles/Ranged/LeafArrow.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Ranged/LeviatitanAberration.cs b/Projectiles/Ranged/LeviatitanAberration.cs new file mode 100644 index 0000000000..2d8f5fdeef --- /dev/null +++ b/Projectiles/Ranged/LeviatitanAberration.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class LeviatitanAberration : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Summon/GastricBelcher"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + AIType = ProjectileID.Bullet; + } + + public override void AI() + { + CalamityUtils.HomeInOnNPC(Projectile, true, 500f, 16f, 8f); + + //Rotation + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(360) * Projectile.direction; + + //Update frames + if (Projectile.frameCounter++ % 6 == 0) + { + Projectile.frame++; + } + if (Projectile.frame >= Main.projFrames[Type]) + { + Projectile.frame = 0; + } + for (int i = 0; i < 3; i++) + { + int bloodDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height / 2, DustID.Blood, 0f, 0f, 100, default, 1f); + Main.dust[bloodDust].noGravity = true; + Main.dust[bloodDust].velocity *= 0.5f; + Main.dust[bloodDust].velocity += Projectile.velocity * 0.1f; + } + } + public override void OnSpawn(IEntitySource source) + { + for (int i = 0; i < 36; i++) + { + Dust minion = Dust.NewDustPerfect(Projectile.Center, DustID.MoonBoulder); + minion.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 9f; + minion.scale = Main.rand.NextFloat(1.4f, 1.6f); + minion.noGravity = true; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + SoundEngine.PlaySound(SoundID.NPCDeath1 with { Volume = SoundID.NPCDeath1.Volume * 0.5f }, Projectile.Center); + } + 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/Ranged/LeviatitanExplosion.cs b/Projectiles/Ranged/LeviatitanExplosion.cs new file mode 100644 index 0000000000..fd318a87ec --- /dev/null +++ b/Projectiles/Ranged/LeviatitanExplosion.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class LeviatitanExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float ExplosionRadius = 112f; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 112; + Projectile.height = 112; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + } +} diff --git a/Projectiles/Ranged/LeviatitanMeteor.cs b/Projectiles/Ranged/LeviatitanMeteor.cs new file mode 100644 index 0000000000..76d7062dc8 --- /dev/null +++ b/Projectiles/Ranged/LeviatitanMeteor.cs @@ -0,0 +1,105 @@ +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Particles; +using Terraria.DataStructures; +using System; + +namespace CalamityMod.Projectiles.Ranged +{ + public class LeviatitanMeteor : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Melee/AftershockRock"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + public static int Lifetime = 600; + public override void SetDefaults() + { + Projectile.width = 38; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = Lifetime; + Projectile.DamageType = DamageClass.Ranged; + } + + public override void AI() + { + if (Projectile.velocity.Y < 25f) + Projectile.velocity.Y += 0.12f; + Projectile.rotation += Projectile.velocity.X * 0.05f; + + if (Projectile.timeLeft <= Lifetime - 6) + { + if (Main.rand.NextBool(3)) + { + MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center + new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f) * Projectile.scale, (-Projectile.velocity * 0.2f).RotatedByRandom(0.2f) + (new Vector2(3, 3).RotatedByRandom(100)), Color.Peru, Color.PeachPuff, Main.rand.NextFloat(0.4f, 1.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(SandCloud); + } + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, Main.rand.NextFloat(0.75f, 1.2f)); + Main.dust[dust].velocity *= 0f; + } + } + public override void OnSpawn(IEntitySource source) + { + Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5; + int smokeAmount = Main.rand.Next(8, 12 + 1); + for (int i = 0; i < smokeAmount; i++) + { + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + } + } + public override void OnKill(int timeLeft) + { + if (Projectile.owner == Main.myPlayer) + { + SoundStyle explo = new("CalamityMod/Sounds/Item/MineralMortarExplode"); + SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center); + 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 < 8; i++) + { + Vector2 randVel = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.7f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.Peru, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); + GeneralParticleHandler.SpawnParticle(smoke); + MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center, randVel * 0.8f, Color.Peru, Color.PeachPuff, Main.rand.NextFloat(0.4f, 1.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(SandCloud); + } + int debriAmount = Main.rand.Next(10, 15 + 1); + for (int debriIndex = 0; debriIndex < debriAmount; debriIndex++) + { + float angle = MathHelper.TwoPi / debriAmount * debriIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(2f, 8f); + Particle debri = new StoneDebrisParticle(Projectile.Center, velocity, Color.Lerp(Color.White, Color.LightGray, Main.rand.NextFloat()), Main.rand.NextFloat(0.4f, 0.6f), Main.rand.Next(30, 45 + 1), Main.rand.NextFloat(MathHelper.Pi)); + GeneralParticleHandler.SpawnParticle(debri); + } + int mistAmount = Main.rand.Next(5, 8 + 1); + for (int mistIndex = 0; mistIndex < mistAmount; mistIndex++) + { + float angle = MathHelper.TwoPi / mistAmount * mistIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(5f, 15f); + Particle boomMist = new MediumMistParticle(Projectile.Center, velocity, Color.SaddleBrown * 0.8f, Color.Transparent, Main.rand.NextFloat(.6f, 1.4f), Main.rand.NextFloat(200f, 400f)); + GeneralParticleHandler.SpawnParticle(boomMist); + } + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.width / 5000f, Projectile.width / 200f, 29, true, 0.7f); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.SaddleBrown * 0.8f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.width / 5000f, Projectile.width / 300f, 29); + GeneralParticleHandler.SpawnParticle(blastRing); + } + } + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Ranged/LuxorsGiftRanged.cs b/Projectiles/Ranged/LuxorsGiftRanged.cs index 70ab922648..7bcf579a96 100644 --- a/Projectiles/Ranged/LuxorsGiftRanged.cs +++ b/Projectiles/Ranged/LuxorsGiftRanged.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,93 +15,74 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { - Projectile.width = 14; - Projectile.height = 14; + Projectile.width = 38; + Projectile.height = 38; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 180; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 5; } - - 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 void AI() { - 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; - } - } + Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3() * 0.35f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 3f) + if (Projectile.timeLeft == 300) + Projectile.velocity *= 0.5f; + if (Projectile.timeLeft > 30) { - for (int l = 0; l < 12; l++) + for (int i = 0; i < 2; i++) { - 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, 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; - Main.dust[electric].velocity = Projectile.velocity * 0.1f; - Main.dust[electric].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[electric].position) * 1.25f; + Vector2 dustPos = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2) * (i == 0 ? -3 : 3); + Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.2f) * Main.rand.NextFloat(2.5f, 8.5f); + Dust dust = Dust.NewDustPerfect(dustPos + Main.rand.NextVector2Circular(2, 2), Main.rand.NextBool() ? 278 : ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.3f, 0.4f); + dust.color = Color.Cyan; + dust.noLightEmittence = true; } } } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.5f; + int hitsToMinMult = 3; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } public override void OnKill(int timeLeft) { - Projectile.ExpandHitboxBy(16); - Projectile.maxPenetrate = Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item92, Projectile.position); - int dustAmt = Main.rand.Next(10, 20); - for (int d = 0; d < dustAmt; d++) + for (int i = 0; i < 12; i++) { - 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; + Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.2f) * Main.rand.NextFloat(2.5f, 8.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(11, 11), Main.rand.NextBool() ? 278 : ModContent.DustType(), dustVel * Main.rand.NextFloat(0.3f, 1.7f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.1f); + dust.color = Color.Cyan; + dust.noLightEmittence = true; } } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20, targetHitbox); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Asset tex = ModContent.Request(Texture); + Color drawColor = Color.Cyan; + float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); + + for (int i = 0; i < 8; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Ranged/LuxorsGiftRanged.png b/Projectiles/Ranged/LuxorsGiftRanged.png index 21c519768f..4537405b02 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 b67a1b6cdb..50ef7b39b3 100644 --- a/Projectiles/Ranged/MaelstromHoldout.cs +++ b/Projectiles/Ranged/MaelstromHoldout.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged public void ShootProjectiles(Vector2 shootPosition) { // Create electric particles. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 16; i++) { @@ -105,14 +105,13 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Maelstrom bow + float aimInterpolant = Utils.GetLerpValue(5f, 25f, Projectile.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), aimInterpolant); if (Projectile.velocity != oldVelocity) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); } Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity * 24f; diff --git a/Projectiles/Ranged/MagnaShot.cs b/Projectiles/Ranged/MagnaShot.cs index acdb64ef78..874aa255a4 100644 --- a/Projectiles/Ranged/MagnaShot.cs +++ b/Projectiles/Ranged/MagnaShot.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged 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[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index 3f2f51beb3..7408ace3d2 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -13,9 +13,10 @@ namespace CalamityMod.Projectiles.Ranged private bool spawnedAura = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -116,7 +117,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[exo].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 9; @@ -164,7 +165,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -184,15 +185,11 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.owner == Main.myPlayer) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - for (int i = 0; i < 4; i++) + float angleOffset = Main.rand.NextFloat(-30f, 30f); + for (int i = 0; i < 8; i++) { - double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj1 = 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 / 4, Projectile.knockBack / 4, Projectile.owner, 0f, 1f); - int proj2 = 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 / 4, Projectile.knockBack / 4, Projectile.owner, 0f, 1f); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f + angleOffset) - Projectile.velocity.ToRotation())).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner, ai1: 1f); } } } diff --git a/Projectiles/Ranged/MarksmanShot.cs b/Projectiles/Ranged/MarksmanShot.cs index e7f74735cf..f0ed4e0c90 100644 --- a/Projectiles/Ranged/MarksmanShot.cs +++ b/Projectiles/Ranged/MarksmanShot.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 4000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 4000; } public override void SetDefaults() @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Ranged { Player coinOwner = Main.player[struckCoin.owner]; if (coinOwner.name.ToLower() == "v1" || coinOwner.name.ToLower() == "v2" || coinOwner.name.ToLower() == "mirage") - ORDERSystem.JUDGMENT(); + ORDERSystem.JUDGEMENT(); } } @@ -183,7 +183,10 @@ namespace CalamityMod.Projectiles.Ranged Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); // Instead of immediately killing the projectile, simply set the time left so the trail can fade out. - Projectile.timeLeft = Math.Min(Lifetime - Projectile.timeLeft, trailLength); + if (Projectile.numHits == 0) + Projectile.timeLeft = Math.Min(Lifetime - Projectile.timeLeft, trailLength); + + Projectile.numHits++; return false; } @@ -192,8 +195,11 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.Midas, 60); // Instead of immediately killing the projectile, simply set the time left so the trail can fade out. - Projectile.velocity = Vector2.Zero; - Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), trailLength); + if (Projectile.numHits == 0) + { + Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), trailLength); + } } internal Color ColorFunction(float completionRatio) diff --git a/Projectiles/Ranged/MechanicalBarracuda.cs b/Projectiles/Ranged/MechanicalBarracuda.cs index fcb0193cc4..ca668b7d03 100644 --- a/Projectiles/Ranged/MechanicalBarracuda.cs +++ b/Projectiles/Ranged/MechanicalBarracuda.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Buffs.DamageOverTime; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -8,7 +9,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -27,5 +29,10 @@ namespace CalamityMod.Projectiles.Ranged // This needs to happen retroactively due to Deadshot Brooch and other potential items boosting updates public override void AI() => Projectile.localNPCHitCooldown = 6 * Projectile.MaxUpdates; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/Projectiles/Ranged/MegalodonShot.cs b/Projectiles/Ranged/MegalodonShot.cs new file mode 100644 index 0000000000..9ecee22bea --- /dev/null +++ b/Projectiles/Ranged/MegalodonShot.cs @@ -0,0 +1,65 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MegalodonShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.MaxUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + public override void AI() + { + // Bubbles + if (Main.rand.NextBool()) + { + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411); + bubble.timeLeft = 9 + Main.rand.Next(7); + bubble.scale = Main.rand.NextFloat(0.6f, 1f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; + } + + // Water trail + for (int i = 0; i < 6; i++) + { + Dust water = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Wet, 0f, 0f, 100); + water.noGravity = true; + water.velocity = Projectile.velocity * 0.5f; + } + } + + public override void OnKill(int timeLeft) + { + // Bubbles + for (int i = 0; i < 10; i++) + { + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(60f)) * 0.3f, 411); + bubble.timeLeft = 9 + Main.rand.Next(7); + bubble.scale = Main.rand.NextFloat(0.6f, 1f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 240); + } +} diff --git a/Projectiles/Ranged/MeowCreature.cs b/Projectiles/Ranged/MeowCreature.cs index 1186139e71..081011d165 100644 --- a/Projectiles/Ranged/MeowCreature.cs +++ b/Projectiles/Ranged/MeowCreature.cs @@ -17,8 +17,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 36; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -63,7 +64,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D glow = Terraria.GameContent.TextureAssets.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/MineralMortarHoldout.cs b/Projectiles/Ranged/MineralMortarHoldout.cs index aa1f8f32b6..06c9d2f8cb 100644 --- a/Projectiles/Ranged/MineralMortarHoldout.cs +++ b/Projectiles/Ranged/MineralMortarHoldout.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public override void HoldoutAI() { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 mouse = Owner.Calamity().mouseWorld; Time++; @@ -31,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged { Owner.PickAmmo(Owner.ActiveItem(), out _, out float speed, out int damage, out float knockback, out int usedItemAmmoId); - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitX) * speed * 1.5f, ModContent.ProjectileType(), damage, knockback, Projectile.owner, usedItemAmmoId); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitX) * speed * 1.5f, ModContent.ProjectileType(), damage, knockback, Projectile.owner, usedItemAmmoId); // Doesn't sync this to the server, it's just effects. if (!Main.dedServ) @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; diff --git a/Projectiles/Ranged/MineralMortarProjectile.cs b/Projectiles/Ranged/MineralMortarProjectile.cs index bbda255676..50f8a74119 100644 --- a/Projectiles/Ranged/MineralMortarProjectile.cs +++ b/Projectiles/Ranged/MineralMortarProjectile.cs @@ -55,11 +55,7 @@ namespace CalamityMod.Projectiles.Ranged // Multiplayer syncing every second. if (Projectile.timeLeft % 60 == 0) - { - Projectile.netUpdate = true; - if (Projectile.netSpam >= 10) - Projectile.netSpam = 9; - } + Projectile.ForceNetUpdate(false); } public override void OnSpawn(IEntitySource source) @@ -172,14 +168,14 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 position = Projectile.Center - Main.screenPosition; float rotation = Projectile.rotation + MathHelper.PiOver2; Vector2 origin = texture.Size() * 0.5f; GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SwordSlashTexture")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, ColorTrailFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 50); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Ranged/MiniSharkron.cs b/Projectiles/Ranged/MiniSharkron.cs index f0e32544b6..6f357a690c 100644 --- a/Projectiles/Ranged/MiniSharkron.cs +++ b/Projectiles/Ranged/MiniSharkron.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 2; } public override void SetDefaults() @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Ranged Dust dust = Main.dust[idx]; dust.velocity /= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int tail = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.8f, 584, 1f); Main.gore[tail].timeLeft /= 10; diff --git a/Projectiles/Ranged/MiniatureFolly.cs b/Projectiles/Ranged/MiniatureFolly.cs index fef7dd96fd..d3d590baa2 100644 --- a/Projectiles/Ranged/MiniatureFolly.cs +++ b/Projectiles/Ranged/MiniatureFolly.cs @@ -1,8 +1,15 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -10,56 +17,98 @@ namespace CalamityMod.Projectiles.Ranged public class MiniatureFolly : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + + public bool SpawnedByFatFuck => Projectile.ai[2] == 1f; + + // Randomized trail offsets required + public List TrailPos = new List(); + public const int TrailLength = 12; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() { - Projectile.width = 24; - Projectile.height = 8; + Projectile.width = Projectile.height = 30; Projectile.friendly = true; Projectile.DamageType = DamageClass.Generic; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.light = 0.25f; - Projectile.extraUpdates = 1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 180 * Projectile.MaxUpdates; } - public override bool OnTileCollide(Vector2 oldVelocity) + public override void OnKill(int timeLeft) { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); SoundEngine.PlaySound(SoundID.NPCHit51, Projectile.Center); - return true; + + for (int i = 0; i < 4; i++) + { + Color color = Color.Lerp(Color.Red, Color.Magenta, Main.rand.NextFloat(0f, 0.6f)); + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.ToRadians(15f) * (i + Main.rand.NextFloat(-0.5f, 0.5f))) * (Main.rand.NextFloat(8f, 12f)); + BoltParticle bolt = new BoltParticle(Projectile.Center, velocity, false, 18, Main.rand.NextFloat(0.4f, 0.6f), color, new Vector2(0.6f, 1f), true); + GeneralParticleHandler.SpawnParticle(bolt); + } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 90); - SoundEngine.PlaySound(SoundID.NPCHit51, Projectile.Center); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 90); public override void AI() { Projectile.frameCounter++; - if (Projectile.frameCounter > 4) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 1) - { - Projectile.frame = 0; - } + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust dustTrail = Dust.NewDustPerfect(Projectile.Center, DustID.CopperCoin, Main.rand.NextVector2Circular(0.2f, 0.2f)); + dustTrail.noLight = true; } + + if (Projectile.FinalExtraUpdate() || TrailPos == null) + { + // Ideally move it closer to the front of the birb + Vector2 posOffset = Projectile.velocity.SafeNormalize(Vector2.Zero) * 12f; + + // Initialize all points immediately + if (TrailPos == null) + { + TrailPos = new List(TrailLength); + for (int i = 0; i < TrailLength; ++i) + TrailPos.Add(Projectile.Center + posOffset); + } + + // Add some random value for the natural lightning look + Vector2 randOffset = (Vector2.UnitY * Main.rand.NextFloat(-12f, 12f)).RotatedBy(Projectile.rotation); + TrailPos.Insert(0, Projectile.Center + randOffset + posOffset); + + while (TrailPos.Count > TrailLength) + TrailPos.RemoveAt(TrailPos.Count - 1); + } + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.Pi : 0f); - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 10f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, SpawnedByFatFuck ? 960f : 300f, 10f, 20f); + } + + internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 10f; + internal Color ColorFunction(float completionRatio) => Color.Lerp(Color.Red, Color.Magenta, 0.7f * completionRatio + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 20f)) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + if (TrailPos == null) + return false; + + GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].UseImage1("Images/Misc/Perlin"); + GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].Apply(); + PrimitiveRenderer.RenderTrail(TrailPos, new(WidthFunction, ColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"]), TrailLength); + + // Draw the swarmer at full brightness so it's less awkward with the trail + Texture2D glow = TextureAssets.Projectile[Type].Value; + Rectangle frame = glow.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + return false; } } } diff --git a/Projectiles/Ranged/MiniatureFolly.png b/Projectiles/Ranged/MiniatureFolly.png index 0cfd804a6c..f18e06eb3f 100644 Binary files a/Projectiles/Ranged/MiniatureFolly.png and b/Projectiles/Ranged/MiniatureFolly.png differ diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index 50b745512a..60782c2b63 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() diff --git a/Projectiles/Ranged/MistArrowFrostMist.cs b/Projectiles/Ranged/MistArrowFrostMist.cs index 64f4f7d36d..2c38992adf 100644 --- a/Projectiles/Ranged/MistArrowFrostMist.cs +++ b/Projectiles/Ranged/MistArrowFrostMist.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; switch (Projectile.ai[0]) { case 0: diff --git a/Projectiles/Ranged/MortarRoundProj.cs b/Projectiles/Ranged/MortarRoundProj.cs index 07ac04dbda..f84155a472 100644 --- a/Projectiles/Ranged/MortarRoundProj.cs +++ b/Projectiles/Ranged/MortarRoundProj.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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; } @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Ranged // Reused by Rubber Mortar Rounds. internal static void SpawnExplosionGores(Projectile p) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Vector2 goreSource = p.Center; diff --git a/Projectiles/Ranged/NitroShot.cs b/Projectiles/Ranged/NitroShot.cs index 1efd86ee4b..5496c63ec7 100644 --- a/Projectiles/Ranged/NitroShot.cs +++ b/Projectiles/Ranged/NitroShot.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.penetrate = 5; Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index ff90d3f020..caeb01d06d 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -119,6 +119,7 @@ namespace CalamityMod.Projectiles.Ranged // The center of the player, taking into account if they have a mount or not. Vector2 ownerPosition = Owner.MountedCenter; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // The vector between the player and the mouse. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; @@ -194,7 +195,7 @@ namespace CalamityMod.Projectiles.Ranged 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); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack, Projectile.owner, 0, i, PUNISHMENTMODE ? 1 : 0); } NetUpdate(); @@ -321,12 +322,7 @@ namespace CalamityMod.Projectiles.Ranged } } - private void NetUpdate() - { - Projectile.netUpdate = true; - if (Projectile.netSpam >= 10) - Projectile.netSpam = 9; - } + private void NetUpdate() => Projectile.ForceNetUpdate(false); public override void OnSpawn(IEntitySource source) { diff --git a/Projectiles/Ranged/NorfleetComet.cs b/Projectiles/Ranged/NorfleetComet.cs index e10696a580..6ad655c2d3 100644 --- a/Projectiles/Ranged/NorfleetComet.cs +++ b/Projectiles/Ranged/NorfleetComet.cs @@ -15,13 +15,12 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; 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] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -89,7 +88,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - 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); + Projectile.NewProjectile(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) { @@ -185,7 +184,7 @@ namespace CalamityMod.Projectiles.Ranged 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); + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 75, targetHitbox); diff --git a/Projectiles/Ranged/NovaChargedShot.cs b/Projectiles/Ranged/NovaChargedShot.cs index 7571a40057..26e5da2318 100644 --- a/Projectiles/Ranged/NovaChargedShot.cs +++ b/Projectiles/Ranged/NovaChargedShot.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Ranged/NovaShot.cs b/Projectiles/Ranged/NovaShot.cs index 01f16f0119..c121177a34 100644 --- a/Projectiles/Ranged/NovaShot.cs +++ b/Projectiles/Ranged/NovaShot.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Ranged } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs deleted file mode 100644 index 255fa30cd0..0000000000 --- a/Projectiles/Ranged/Nuke.cs +++ /dev/null @@ -1,215 +0,0 @@ -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; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Nuke : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public int flarePowderTimer = 12; - private ref float RocketType => ref Projectile.ai[0]; - - 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 = 22; - Projectile.height = 22; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 125; - Projectile.DamageType = DamageClass.Ranged; - } - - public override void AI() - { - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > 7) - { - 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; - - flarePowderTimer--; - if (flarePowderTimer <= 0) - { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); - } - 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, 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, 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; - } - - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - Projectile.ignoreWater = false; - if (Projectile.wet) - Projectile.timeLeft = 1; - } - } - - 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) - { - Projectile.ExpandHitboxBy(192); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 40; i++) - { - 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()) - { - Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int i = 0; i < 60; i++) - { - 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, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - Main.dust[idx].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 10; - 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 = 6; - else if (RocketType == ItemID.RocketIV) - blastRadius = 12; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 18; - - Projectile.ExpandHitboxBy(22); - - if (blastRadius > 0) - Projectile.ExplodeTiles(blastRadius); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 4f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 4.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); - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Ranged/Nuke.png b/Projectiles/Ranged/Nuke.png deleted file mode 100644 index d855762b23..0000000000 Binary files a/Projectiles/Ranged/Nuke.png and /dev/null differ diff --git a/Projectiles/Ranged/NukeOfBliss.cs b/Projectiles/Ranged/NukeOfBliss.cs new file mode 100644 index 0000000000..a8ff6adc94 --- /dev/null +++ b/Projectiles/Ranged/NukeOfBliss.cs @@ -0,0 +1,224 @@ +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; +using static CalamityMod.Projectiles.Ranged.BlissfulBombardierHoldout; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NukeOfBliss : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + private ref float RocketID => ref Projectile.ai[0]; + public ref float time => ref Projectile.ai[2]; + public int reachedPeakTime = 120; + public int rainDownTimer = 150; + public NPC targeted; + public float fade = 1; + + public override void SetDefaults() + { + Projectile.width = 36; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 700; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Vector2 mouse = Owner.ClampedMouseWorld(); + if (Projectile.Center.Y > mouse.Y && rainDownTimer <= 0) + Projectile.tileCollide = true; + + //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; + + if (time > reachedPeakTime) + { + if (rainDownTimer > 1) // Make sure the missiles are raining down from above your cursor + { + Projectile.Center = new Vector2(mouse.X, Owner.Center.Y) + new Vector2(0, -600); + } + + if (targeted == null || rainDownTimer > 0) + targeted = (rainDownTimer == 0 ? Projectile.Center + Projectile.velocity * 4 : mouse).ClosestNPCAt(rainDownTimer == 0 ? 350 : 250); + if (targeted != null && Projectile.Center.Y > targeted.Center.Y) + targeted = null; + + if (rainDownTimer >= 80) + { + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + if (rainDownTimer % 15 == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + SoundEngine.PlaySound(fire with { Volume = 0.45f, Pitch = (0 - 0.3f * Utils.GetLerpValue(0, 300, rainDownTimer, true)) }, Projectile.Center); + for (int i = 0; i < (isClusterRocket ? 4 : 2); i++) + { + // 15NOV2024: Ozzatron: clamped mouse position is not used here intentionally so split rockets can attempt to go to your mouse's real position + Vector2 variance = (i % 2 == 0 ? 0.2f : 1) * (new Vector2(80 * (isClusterRocket ? 3 : 1), 0) * Main.rand.NextFloat(-1f, 1f)); + Vector2 velocity = (((targeted != null ? targeted.Center : Owner.Calamity().mouseWorld) - Projectile.Center).SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(8, 12)) + variance * 0.008f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + variance, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 0.15f : 0.3f)), Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); + } + } + } + if (rainDownTimer > 0) + rainDownTimer--; + if (rainDownTimer == 65) + { + for (int i = 0; i < 3; i++) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/MissileNearing"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = 0.4f, MaxInstances = 2 }, Projectile.Center); + } + } + if (rainDownTimer == 1) + { + targeted = null; + Projectile.extraUpdates = 10; + Projectile.penetrate = 1; + Projectile.velocity = ((targeted != null ? targeted.Center : mouse) - Projectile.Center).SafeNormalize(Vector2.UnitX) * 15; + } + if (rainDownTimer == 0) + { + Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 19, 1.7f, Color.Goldenrod); + GeneralParticleHandler.SpawnParticle(spark2); + if (targeted != null && targeted.Center.Y > Projectile.Center.Y) + { + // Since this uses either mouse or target position, it will not use the homing Utility + Vector2 moveToTrackingPos = ((targeted != null ? targeted.Center : mouse) - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 15) + Projectile.velocity = Projectile.velocity * 0.98f + moveToTrackingPos * 2.5f; + else + Projectile.velocity *= 0.9f; + } + } + } + else + Projectile.velocity *= 0.995f; + + fade = rainDownTimer > 0 ? Utils.GetLerpValue(reachedPeakTime, reachedPeakTime * 0.7f, time, true) : 1; + if (fade > 0.2f) + { + Particle smoke = new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.6f), 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); + } + + if (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket) + { + Projectile.ignoreWater = false; + if (Projectile.wet) + Projectile.timeLeft = 1; + } + + time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + } + public override void OnKill(int timeLeft) + { + // Only do rocket effects for the owner client side + if (Projectile.owner != Main.myPlayer) + return; + + 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, + }; + + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + SoundStyle fire = new("CalamityMod/Sounds/Item/MineralMortarExplode"); + SoundEngine.PlaySound(fire with { Volume = 0.9f, Pitch = 0.4f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/BlazingCoreParry"); + SoundEngine.PlaySound(fire2 with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + int blastRadius = (int)(MathHelper.Clamp(Projectile.RocketBehavior(info), 3, 100)); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.damage = (int)(Projectile.damage * 0.5f); + Projectile.penetrate = -1; + Projectile.Damage(); + + float blastRadiusVisual = blastRadius * 0.5f; + + Particle orb4 = new CustomPulse(Projectile.Center, Vector2.Zero, staticEffectsColor, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.07f * blastRadiusVisual, 19); + GeneralParticleHandler.SpawnParticle(orb4); + Particle orb5 = new CustomPulse(Projectile.Center, Vector2.Zero, effectsColor, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.05f * blastRadiusVisual, 19); + GeneralParticleHandler.SpawnParticle(orb5); + + for (int i = 0; i < 3; i++) + { + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.45f * blastRadiusVisual, 15, true); + GeneralParticleHandler.SpawnParticle(orb3); + } + + for (int i = 0; i < 40; i++) + { + Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + c.velocity = (MathHelper.TwoPi * i / 40f).ToRotationVector2() * 8.5f * (i % 2 == 0 ? 0.88f : 1f) * blastRadiusVisual; + c.scale = Main.rand.NextFloat(0.3f, 0.6f) * blastRadius * 0.3f * (i % 2 == 0 ? 2.2f : 1.8f); + c.noGravity = true; + c.color = effectsColor; + c.noLightEmittence = true; + } + for (int i = 0; i < 25; i++) + { + if (i < 14) + { + Particle spark = new CustomSpark(Projectile.Center, new Vector2(4, 4).RotatedByRandom(100) * blastRadiusVisual * Main.rand.NextFloat(0.3f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(2.45f, 2.7f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.35f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Dust l = Dust.NewDustPerfect(Projectile.Center, 278); + l.velocity = new Vector2(5, 5).RotatedByRandom(100) * blastRadiusVisual * Main.rand.NextFloat(0.4f, 1f); + l.scale = Main.rand.NextFloat(0.6f, 0.8f) * blastRadiusVisual * 0.2f * (i % 2 == 0 ? 2.2f : 1.8f); + l.noGravity = false; + l.color = staticEffectsColor; + } + } + for (int i = 0; i < 15; i++) + { + Vector2 velocity = new Vector2(8, 8).RotatedByRandom(100) * blastRadiusVisual * Main.rand.NextFloat(0.4f, 1f); + Particle spark = new CustomSpark(Projectile.Center, velocity, "CalamityMod/Projectiles/Boss/ProvidenceCrystal", false, 12, 0.15f * blastRadius, Color.White, new Vector2(1.5f, 0.4f), true, false, 0, false, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.35f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (rainDownTimer <= 0 ? 1 : 0.2f); + } + public override bool? CanDamage() => (fade <= 0.2f) ? false : null; + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/NukeOfBliss").Value; + + float fade2 = rainDownTimer > 0 ? Utils.GetLerpValue(reachedPeakTime, reachedPeakTime * 0.7f, time) : 1; + Projectile.DrawProjectileWithBackglow(staticEffectsColor with { A = 0 } * fade2, lightColor * fade2, 6f * Utils.GetLerpValue(0, reachedPeakTime, time, true), texture); + return false; + } + } +} diff --git a/Projectiles/Ranged/NukeOfBliss.png b/Projectiles/Ranged/NukeOfBliss.png new file mode 100644 index 0000000000..73cc8955e2 Binary files /dev/null and b/Projectiles/Ranged/NukeOfBliss.png differ diff --git a/Projectiles/Ranged/NullFlash.cs b/Projectiles/Ranged/NullFlash.cs new file mode 100644 index 0000000000..1b9bae9402 --- /dev/null +++ b/Projectiles/Ranged/NullFlash.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.NPCs; +using CalamityMod.NPCs.NormalNPCs; +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.Ranged +{ + public class NullFlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public Color baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + public override void SetDefaults() + { + Projectile.width = 70; + Projectile.height = 70; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 40; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + } + + public override void AI() + { + if (time == 0) + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + float rate = (Main.GlobalTimeWrappedHourly * 5); + List eColors = new List() + { + Color.Turquoise, + Color.Orchid + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + if (!Main.zenithWorld) + baseColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (Projectile.ai[1] == 5 && !Main.zenithWorld) + baseColor = Color.White; + + Projectile.velocity *= 0.95f; + time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player Owner = Main.player[Projectile.owner]; + if (Projectile.numHits == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/NullImpact"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = 0.5f }, Projectile.Center); + } + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 20, true); + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 1) + return false; + Vector2 placement = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 50; + Asset tex = ModContent.Request("CalamityMod/Particles/VerticalSmear"); + for (int i = 0; i < 3; i++) + { + Vector2 scale = new Vector2(1 - (time * 0.025f) + i * 0.1f, 1 + (time * 0.025f) - i * 0.1f) * Projectile.scale * (0.7f - (i * 0.05f)); + Main.EntitySpriteDraw(tex.Value, placement - Main.screenPosition, null, baseColor with { A = 0 } * 0.5f, Projectile.rotation, tex.Size() * 0.5f, scale, SpriteEffects.None); + } + return false; + } + } +} diff --git a/Projectiles/Ranged/NullShot.cs b/Projectiles/Ranged/NullShot.cs index 2ec483b36b..bdb58ffa4f 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -1,8 +1,15 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -12,79 +19,242 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - + public ref float time => ref Projectile.ai[0]; + public Color baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + public int sineDir = 1; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 25; + ProjectileID.Sets.TrailingMode[Type] = 2; + } public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; + Projectile.width = 28; + Projectile.height = 28; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.penetrate = -1; + Projectile.timeLeft = 400; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.extraUpdates = 4; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 3f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (time == 0) { - for (int num134 = 0; num134 < 10; num134++) + Projectile.scale = Projectile.ai[1] == 5 ? 2.2f : 1.5f; + sineDir = Main.rand.NextBool() ? 1 : -1; + } + float rate = (Main.GlobalTimeWrappedHourly * 5); + List eColors = new List() { - 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, 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; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; + Color.Turquoise, + Color.Orchid + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + if (!Main.zenithWorld) + baseColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (Projectile.ai[1] == 5 && !Main.zenithWorld) + baseColor = Color.White; + + if (time == 5) + { + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 5 ? ModContent.DustType() : ModContent.DustType(), (Projectile.velocity * 4).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.15f, 1.35f); + dust.color = baseColor; } } + if (time > 20) + { + if (Projectile.ai[1] == 5) + { + // 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; + float scale = Main.rand.NextFloat(0.8f, 1.1f); + if (Main.rand.NextBool(2)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + offset * sineDir, ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f)); + dust2.noGravity = true; + dust2.scale = scale; + dust2.color = baseColor; + } + if (Main.rand.NextBool(2)) + { + Dust dust3 = Dust.NewDustPerfect(Projectile.Center - offset * sineDir, ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f)); + dust3.noGravity = true; + dust3.scale = scale; + dust3.color = baseColor; + } + } + else if (Main.rand.NextBool(13)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10), Projectile.ai[1] == 5 ? (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.05f, 1.65f); + dust.color = baseColor; + } + } + if (time > 13 && time < 34 && Projectile.ai[2] > 0) + { + Projectile.Center += Projectile.velocity.RotatedBy((Projectile.ai[2] == 1 ? MathHelper.PiOver2 : -MathHelper.PiOver2)) * 0.2f; + } + + if (Projectile.ai[1] == 5) + { + NPC targetedNPC = Projectile.Center.ClosestNPCAt(700); + if (targetedNPC != null && time > 30 && Projectile.numHits < 1 && Vector2.Distance(targetedNPC.Center, Projectile.Center) < 700) + { + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, 0.2f, 8, 0.97f, accelerate: true); + } + } + else + { + if (Projectile.timeLeft < 100) + { + Projectile.velocity *= 0.96f; + Projectile.scale *= 0.98f; + } + Projectile.timeLeft--; + if (Projectile.timeLeft <= 1) + { + for (int i = 0; i < 4; i++) + { + Particle orb2 = new LineParticle(Projectile.Center, (Projectile.velocity * 5).RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 1f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), baseColor); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + } + + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (target.type == NPCID.TargetDummy) + if (Projectile.ai[1] == 5) { - return; - } - - int randAmt = (CalamityPlayer.areThereAnyDamnBosses || CalamityLists.AquaticScourgeIDs.Contains(target.type)) ? 6 : 8; - int nullBuff = Main.rand.Next(randAmt); - if (!target.boss) - { - switch (nullBuff) + for (int i = 0; i < 8; i++) { - case 0: - if (target.type != ModContent.NPCType()) - target.damage += 10; - break; - case 1: - target.damage -= 10; - break; - case 2: - target.knockBackResist = 0f; - break; - case 3: - target.knockBackResist = 1f; - break; - case 4: - target.defense += 5; - break; - case 5: - target.defense -= 5; - break; - case 6: - target.scale *= 2f; - break; - case 7: - target.scale *= 0.5f; - break; - default: - break; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 5 ? (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType(), (Projectile.velocity * 3).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust.color = baseColor; + } + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.3f, 0.65f, 13); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloomRingLayered", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.75f, 13, false); + GeneralParticleHandler.SpawnParticle(orb2); + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.25f, 16, false); + GeneralParticleHandler.SpawnParticle(orb3); + } + else + { + for (int i = 0; i < 3; i++) + { + Particle orb2 = new LineParticle(Projectile.Center, (Projectile.velocity * 2).RotatedByRandom(0.1f) * Main.rand.NextFloat(0.1f, 1f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), baseColor); + GeneralParticleHandler.SpawnParticle(orb2); } } + SoundStyle fire = new("CalamityMod/Sounds/Item/NullHit"); + SoundEngine.PlaySound(fire with { Volume = (Projectile.ai[1] == 5 ? 1 : 0.7f), Pitch = Main.rand.NextFloat(0, 0.1f) * (Projectile.ai[1] == 5 ? 3 : 1) }, Projectile.Center); + if (Main.zenithWorld) + { + #region NPC Nullification + if (Projectile.ai[1] == 5) + { + // Enemies tend to float away when corrupted, this helps with that + if (Utils.Distance(Main.player[Projectile.owner].Center, target.Center) > 1000) + target.velocity = Utils.DirectionTo(target.Center, Main.player[Projectile.owner].Center); + + int nullCorrupt = Main.rand.Next(4); + switch (nullCorrupt) + { + case 0: + target.ai[0] = Main.rand.Next(0, 100 + 1); + target.localAI[0] = Main.rand.Next(0, 100 + 1); + break; + case 1: + target.ai[1] = Main.rand.Next(0, 100 + 1); + target.localAI[1] = Main.rand.Next(0, 100 + 1); + break; + case 2: + target.ai[2] = Main.rand.Next(0, 100 + 1); + target.localAI[2] = Main.rand.Next(0, 100 + 1); + break; + case 3: + target.ai[3] = Main.rand.Next(0, 100 + 1); + target.localAI[3] = Main.rand.Next(0, 100 + 1); + break; + default: + break; + } + } + else + { + int nullBuff = Main.rand.Next(8); + switch (nullBuff) + { + case 0: + if (target.type != ModContent.NPCType()) + target.damage += Main.rand.Next(5, 40 + 1); + break; + case 1: + target.damage -= Main.rand.Next(5, 40 + 1); + break; + case 2: + target.knockBackResist = 0f; + break; + case 3: + target.knockBackResist = Main.rand.Next(1, 3 + 1); + break; + case 4: + target.defense += Main.rand.Next(5, 30 + 1); + break; + case 5: + target.defense -= Main.rand.Next(5, 30 + 1); + break; + case 6: + target.scale *= 2f; + break; + case 7: + target.scale *= 0.5f; + break; + default: + break; + } + } + #endregion + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.97f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 18) + return false; + + Asset tex = ModContent.Request("CalamityMod/Particles/DrainLineBloom"); + Asset tex2 = ModContent.Request("CalamityMod/Particles/DrainLine"); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], baseColor with { A = 0 } * 0.35f, 1, tex.Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Projectile.ai[1] == 5 ? Color.Black : Color.Lerp(baseColor, Color.White, 0.5f), 1, tex2.Value, true, true); + return false; } } } diff --git a/Projectiles/Ranged/NullShot2.cs b/Projectiles/Ranged/NullShot2.cs deleted file mode 100644 index d24185b9d0..0000000000 --- a/Projectiles/Ranged/NullShot2.cs +++ /dev/null @@ -1,96 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.NPCs.NormalNPCs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class NullShot2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 6; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 120; - Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 3f) - { - for (int num134 = 0; num134 < 10; num134++) - { - 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, 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; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - - int randAmt = (CalamityPlayer.areThereAnyDamnBosses || CalamityLists.AquaticScourgeIDs.Contains(target.type)) ? 8 : 10; - int nullBuff = Main.rand.Next(randAmt); - if (!target.boss) - { - switch (nullBuff) - { - case 0: - if (target.type != ModContent.NPCType()) - target.damage += 20; - break; - case 1: - target.damage -= 20; - break; - case 2: - target.knockBackResist = 0f; - break; - case 3: - target.knockBackResist = 1f; - break; - case 4: - target.defense += 10; - break; - case 5: - target.defense -= 10; - break; - case 6: - target.velocity.Y = Main.rand.NextBool() ? 30f : -30f; - break; - case 7: - target.velocity.X = Main.rand.NextBool() ? 30f : -30f; - break; - case 8: - target.scale *= 5f; - break; - case 9: - target.scale *= 0.1f; - break; - default: - break; - } - } - } - } -} diff --git a/Projectiles/Ranged/OntoligicalDespoilerBurst.cs b/Projectiles/Ranged/OntoligicalDespoilerBurst.cs new file mode 100644 index 0000000000..4de91212fa --- /dev/null +++ b/Projectiles/Ranged/OntoligicalDespoilerBurst.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OntoligicalDespoilerBurst : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = 100; + Projectile.height = 100; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.45f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 450, targetHitbox); + } +} diff --git a/Projectiles/Ranged/OntoligicalDespoilerGhost.png b/Projectiles/Ranged/OntoligicalDespoilerGhost.png new file mode 100644 index 0000000000..ceab98de55 Binary files /dev/null and b/Projectiles/Ranged/OntoligicalDespoilerGhost.png differ diff --git a/Projectiles/Ranged/OntologicalDespoilerBeam.cs b/Projectiles/Ranged/OntologicalDespoilerBeam.cs new file mode 100644 index 0000000000..5aecd11315 --- /dev/null +++ b/Projectiles/Ranged/OntologicalDespoilerBeam.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OntologicalDespoilerBeam : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public Color baseColor = Color.White; + public bool fading = false; + public override void SetDefaults() + { + Projectile.width = 45; + Projectile.height = 45; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 80; + Projectile.tileCollide = false; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + bool inRange = targetDist < 1400; + + Projectile.rotation = Projectile.velocity.ToRotation(); + if (time <= 5) + Projectile.scale = 0.1f; + else if (Projectile.scale < 1 && !fading) + Projectile.scale += 0.07f; + else if (fading) + { + Projectile.velocity *= 0.992f; + Projectile.scale *= 0.992f; + } + if (time > 11) + { + if (Main.rand.NextBool(4) && !fading) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()), Projectile.velocity.RotatedByRandom(0.1f) * Main.rand.NextFloat(2.3f, 5.8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.3f, 2.15f); + dust.color = baseColor; + } + if (Main.rand.NextBool(12) && !fading) + { + Particle beam = new CustomSpark(Projectile.Center - Projectile.velocity * 8, Projectile.velocity * Main.rand.NextFloat(0.5f, 4f), "CalamityMod/Particles/DrainLine", false, 80, 4.5f * Projectile.scale, Color.Black, new Vector2(0.4f, 3f), false, false, 0, false, false, 0); + GeneralParticleHandler.SpawnParticle(beam); + } + if (time % (fading ? 2 : 1) == 0) + { + for (int i = 0; i < 2; i++) + { + bool glow = i == 0; + Particle beam = new CustomSpark(Projectile.Center - Projectile.velocity * 8, -Projectile.velocity * 0.1f, glow ? "CalamityMod/Particles/VoidBeamGlow" : "CalamityMod/Particles/VoidBeam", false, 23, 2.3f * Projectile.scale, glow ? baseColor : Color.Black, Vector2.One, glow ? true : false, false, 0, false, false, 0.5f); + GeneralParticleHandler.SpawnParticle(beam); + } + } + } + time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + for (int i = 0; i < 30; i++) + { + float dustPower = Main.rand.NextFloat(0.2f, 1f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()), (Projectile.velocity * 15 * (dustPower * dustPower)).RotatedByRandom(1f - dustPower * dustPower) * Main.rand.NextFloat(0.9f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(2.15f, 3.45f) * dustPower; + dust.color = baseColor; + Dust dust3 = Dust.NewDustPerfect(Projectile.Center, 278, (Projectile.velocity * 25 * (dustPower * dustPower)).RotatedByRandom(1f - dustPower * dustPower) * Main.rand.NextFloat(0.9f, 1f)); + dust3.noGravity = true; + dust3.scale = Main.rand.NextFloat(1.35f, 1.75f) * dustPower; + dust3.color = baseColor; + Particle orb2 = new AltLineParticle(Projectile.Center, (Projectile.velocity * 15 * (dustPower * dustPower)).RotatedByRandom(1f - dustPower * dustPower) * Main.rand.NextFloat(0.9f, 1f), false, Main.rand.Next(30, 38 + 1), Main.rand.NextFloat(2.6f, 3.3f) * dustPower, Color.Black); + GeneralParticleHandler.SpawnParticle(orb2); + } + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.5f, 1.35f, 18); + GeneralParticleHandler.SpawnParticle(orb); + for (int i = 0; i < 6; i++) + { + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.05f - i * 0.1f, 0.4f, 25 - i * 2, false); + GeneralParticleHandler.SpawnParticle(orb3); + } + + fading = true; + Projectile.velocity *= 0.5f; + Projectile.scale = 1.3f; + + for (int i = 0; i < 3; i++) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/OntologicalDespoilerLargeImpact"); + SoundEngine.PlaySound(fire with { Volume = 0.65f, MaxInstances = 3 }, Projectile.Center); + } + SoundStyle fire2 = new("CalamityMod/Sounds/Item/MeldExplosion"); + SoundEngine.PlaySound(fire2 with { Volume = 1, Pitch = Main.rand.NextFloat(-0.5f, -0.6f) }, Projectile.Center); + } + public override bool? CanDamage() => Projectile.numHits < 1 ? null : false; + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/Ranged/OntologicalDespoilerFlame.png b/Projectiles/Ranged/OntologicalDespoilerFlame.png new file mode 100644 index 0000000000..f17176a2f7 Binary files /dev/null and b/Projectiles/Ranged/OntologicalDespoilerFlame.png differ diff --git a/Projectiles/Ranged/OntologicalDespoilerFlame2.png b/Projectiles/Ranged/OntologicalDespoilerFlame2.png new file mode 100644 index 0000000000..d719aad65a Binary files /dev/null and b/Projectiles/Ranged/OntologicalDespoilerFlame2.png differ diff --git a/Projectiles/Ranged/OntologicalDespoilerFlash.png b/Projectiles/Ranged/OntologicalDespoilerFlash.png new file mode 100644 index 0000000000..3ffbb56a0c Binary files /dev/null and b/Projectiles/Ranged/OntologicalDespoilerFlash.png differ diff --git a/Projectiles/Ranged/OntologicalDespoilerGrenade.cs b/Projectiles/Ranged/OntologicalDespoilerGrenade.cs new file mode 100644 index 0000000000..ea3b79ba0d --- /dev/null +++ b/Projectiles/Ranged/OntologicalDespoilerGrenade.cs @@ -0,0 +1,225 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OntologicalDespoilerGrenade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/OntologicalDespoilerGrenade"; + public ref float time => ref Projectile.ai[0]; + public bool explode = true; + public Color baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + public Player Owner => Main.player[Projectile.owner]; + public Color color1; + public Color color2; + public Color color3; + public Color color4; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 25; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 3; + Projectile.tileCollide = false; + } + + public override void AI() + { + color1 = Owner.shirtColor; + color2 = Color.Lerp(Owner.shirtColor, Color.Black, 0.3f); + color3 = Color.Lerp(Owner.shirtColor, Color.White, 0.2f); + color4 = Color.Lerp(Owner.shirtColor, Color.White, 0.4f); + + Projectile.rotation = Projectile.velocity.ToRotation(); + + Projectile.frameCounter++; + if (Projectile.frameCounter > 12) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 5) + { + Projectile.frame = 0; + } + + if (time < 60) + Projectile.velocity *= 0.982f; + + if (Owner.shirtColor != Color.White) + { + float rate = (Main.GlobalTimeWrappedHourly * 15); + List eColors = new List() + { + color1, + color2, + color3, + color4 + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + baseColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + } + else + baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + if (time > 20) + { + // Spawn in a helix-style pattern + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + Projectile.scale = MathHelper.Clamp(1 + sine, 0.7f, 1.3f); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 12f; + float scale = Main.rand.NextFloat(1.3f, 1.4f); + if (Main.rand.NextBool(3)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f)); + dust2.noGravity = true; + dust2.scale = scale; + dust2.color = baseColor; + } + if (Main.rand.NextBool(3)) + { + Dust dust3 = Dust.NewDustPerfect(Projectile.Center - offset, ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f)); + dust3.noGravity = true; + dust3.scale = scale; + dust3.color = baseColor; + } + } + + if (Projectile.timeLeft == 1) + explode = false; + + NPC targetedNPC = Projectile.Center.ClosestNPCAt(1200); + if (targetedNPC != null && time > 30 && Projectile.numHits < 1 && Vector2.Distance(targetedNPC.Center, Projectile.Center) < 1200) + { + float moveSpeed = Utils.GetLerpValue(570, 120, Projectile.timeLeft, true); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, moveSpeed, 7, 0.98f, accelerate: true); + explode = true; + } + time++; + } + public override void OnKill(int timeLeft) + { + Player Owner = Main.player[Projectile.owner]; + + if (explode) + { + Owner.Calamity().GeneralScreenShakePower = 8.5f; + float power = 1.5f; + + for (int i = 0; i < 55; i++) + { + Color useColor = GetRandomColor(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (Main.rand.NextBool(6) ? ModContent.DustType() : ModContent.DustType()), (Projectile.velocity * 6 * power).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.75f, 2.25f) * power; + dust.color = useColor; + if (Owner.shirtColor == Color.White) + useColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + if (i % 2 == 0) + { + Particle orb2 = new CustomSpark(Projectile.Center, new Vector2(0, -40 * power).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f), "CalamityMod/Particles/Sparkle", false, 40, Main.rand.NextFloat(1.4f, 2.4f) * power, useColor, new Vector2(0.4f, 1.1f)); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + for (int i = 0; i < 3; i++) + { + Color useColor = GetRandomColor(); + Particle orb4 = new CustomPulse(Projectile.Center, Vector2.Zero, useColor, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.4f - i * 0.03f * power, 13); + GeneralParticleHandler.SpawnParticle(orb4); + } + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, baseColor, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.15f * power, 2.5f * power, 38); + GeneralParticleHandler.SpawnParticle(orb); + int parts = 8; + float rot = Main.rand.NextFloat(-9, 9); + for (int i = 0; i < parts; i++) + { + Color useColor = GetRandomColor(); + Particle orb2 = new CustomSpark(Projectile.Center, new Vector2(0, -15 * (i % 2 == 0 ? 1.8f : 1f) * power).RotatedBy(i * (MathHelper.ToRadians(360f) / parts)).RotatedBy(rot), "CalamityMod/Particles/VerticalSmear", false, 19, 3 * power, useColor, new Vector2(0.2f, 1)); + GeneralParticleHandler.SpawnParticle(orb2); + } + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.2f * power, 39, false); + GeneralParticleHandler.SpawnParticle(orb3); + + for (int i = 0; i < 3; i++) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/EarthMeteor"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = -0.1f * (i + 1), MaxInstances = 3 }, Projectile.Center); + } + SoundStyle fire2 = new("CalamityMod/Sounds/Item/ShadowboltReflect"); + SoundEngine.PlaySound(fire2 with { Volume = 0.9f, Pitch = -0.4f}, Projectile.Center); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 12f), Projectile.knockBack * 3, Projectile.owner, 0, 0, 0); + } + else + { + for (int i = 0; i < 20; i++) + { + Color useColor = GetRandomColor(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()), (Projectile.velocity * 3).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.85f, 2.45f); + dust.color = useColor; + } + } + } + public Color GetRandomColor() + { + Color useColor = Main.rand.Next(4) switch + { + 0 => color1, + 1 => color2, + 2 => color3, + _ => color4, + }; + if (Owner.shirtColor == Color.White) + useColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + return useColor; + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation; + + Asset tex = ModContent.Request("CalamityMod/Particles/DrainLineBloom2"); + Asset tex2 = ModContent.Request("CalamityMod/Particles/DrainLine2"); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], baseColor with { A = 0 } * 0.8f, 1, tex.Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Black, 1, tex2.Value, true, true); + + Asset tex3 = ModContent.Request("CalamityMod/Projectiles/Ranged/OntologicalDespoilerGrenade"); + Rectangle frame = tex3.Frame(1, 6, 0, Projectile.frame); + Vector2 rotationPoint = frame.Size() * 0.5f; + for (int i = 0; i < 4; i++) + Main.EntitySpriteDraw(tex3.Value, drawPosition + Main.rand.NextVector2Circular(7, 7), frame, baseColor with { A = 0 }, drawRotation, rotationPoint, 1, SpriteEffects.None); + Main.EntitySpriteDraw(tex3.Value, drawPosition, frame, baseColor, drawRotation, rotationPoint, 1, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/OntologicalDespoilerGrenade.png b/Projectiles/Ranged/OntologicalDespoilerGrenade.png new file mode 100644 index 0000000000..fa6d3b761d Binary files /dev/null and b/Projectiles/Ranged/OntologicalDespoilerGrenade.png differ diff --git a/Projectiles/Ranged/OntologicalDespoilerHoldout.cs b/Projectiles/Ranged/OntologicalDespoilerHoldout.cs new file mode 100644 index 0000000000..05b655bfd8 --- /dev/null +++ b/Projectiles/Ranged/OntologicalDespoilerHoldout.cs @@ -0,0 +1,502 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +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.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OntologicalDespoilerHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 29f; + public override float OffsetXUpwards => -8f; + public override float BaseOffsetY => -10f; + public override float OffsetYDownwards => 8f; + public override float RecoilResolveSpeed => 0.5f; + public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 45).RotatedBy(0.18f * Projectile.direction); + + public int FramesPerLoad = 9; + public int MaxLoadableShots = 23; + public float BulletSpeed = 6.5f; + public SlotId OntologicalChargeSlot; + public SlotId OntologicalChargeSlotDeep; + public int Time = 0; + + public ref float CurrentChargingFrames => ref Projectile.ai[0]; + public float ShotsLoaded = 1; + public Color baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + public Color color1; + public Color color2; + public Color color3; + public Color color4; + + public bool hasBegunFiring = false; + public bool Positive => (Projectile.ai[2] == 0 || Projectile.ai[2] == 10); + public ref float ShootRecoilTimer => ref Projectile.ai[1]; // Dual functions for rapid fire shooting cooldown and recoil + + public int AftershotCooldownFrames = 8; + public int Charge1Frames = 156; + public int Charge2Frames = 312; + public bool hasReachedLV1 = false; + public bool hasReachedLV2 = false; + + public int fireFrameCounter = 0; + public int fireFrame = 0; + public int flashFrameCounter = 0; + public int flashFrame = 0; + public bool showFlash = false; + public Vector2 flashPos; + public float flashRot; + + // Distortion effect visuals + public Vector2 voidPlacement; + public int inverseTimer = 14; + public bool drawInverse = false; + public bool ChargeLV1 => CurrentChargingFrames >= Charge1Frames; + public bool ChargeLV2 => CurrentChargingFrames >= Charge2Frames; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 7; + } + public override void KillHoldoutLogic() + { + if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + color1 = Owner.shirtColor; + color2 = Color.Lerp(Owner.shirtColor, Color.Black, 0.3f); + color3 = Color.Lerp(Owner.shirtColor, Color.White, 0.2f); + color4 = Color.Lerp(Owner.shirtColor, Color.White, 0.4f); + + if (SoundEngine.TryGetActiveSound(OntologicalChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; + if (SoundEngine.TryGetActiveSound(OntologicalChargeSlotDeep, out var ChargeSound6) && ChargeSound6.IsPlaying) + ChargeSound6.Position = Projectile.Center; + + if (Owner.shirtColor != Color.White) + { + float rate = (Main.GlobalTimeWrappedHourly * 15); + List eColors = new List() + { + color1, + color2, + color3, + color4 + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + baseColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + } + + if ((!Positive && Projectile.ai[2] < 10) || Projectile.ai[2] == 15) // Color is white when Negative + baseColor = Color.White; + else if (Owner.shirtColor == Color.White) + baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + #region Frame control + Projectile.frameCounter++; + if (Projectile.frameCounter > (Projectile.ai[2] >= 10 ? 2 : 1)) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 5) + { + Projectile.frame = 0; + } + + fireFrameCounter++; + if (fireFrameCounter > (Projectile.ai[2] >= 10 ? 2 : 1)) + { + fireFrame++; + fireFrameCounter = 0; + } + if (fireFrame > 5) + fireFrame = 0; + + if (showFlash) + { + flashFrameCounter++; + if (flashFrameCounter > (flashFrame == 2 ? 7 : 1)) + { + flashFrame++; + flashFrameCounter = 0; + } + if (flashFrame > 6) + showFlash = false; + } + #endregion + + if (Time % 2 == 0) + voidPlacement = Main.rand.NextVector2Circular(10.5f, 10.5f); + + if (inverseTimer <= 9) + { + drawInverse = true; + if (inverseTimer == 0) + { + drawInverse = false; + inverseTimer = Main.rand.Next(20, 40 + 1); + } + } + if (ChargeLV2) + inverseTimer--; + + // Changing Mode + if (Projectile.ai[2] >= 10) + { + ShotsLoaded = 0; + if (Time == 0) + { + for (int i = 0; i < 18; i++) + { + Color useColor = GetRandomColor(); + + Dust dust = Dust.NewDustPerfect(Owner.Center, !Positive ? (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType(), new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.25f); + dust.color = Projectile.ai[2] == 15 ? baseColor : useColor; + } + Projectile.timeLeft = (int)(AftershotCooldownFrames * 2.5f * (!Owner.Calamity().despoilerNerf ? 3 : 1)); // If you're swapping with no penalty, the swap takes longer + Owner.Calamity().despoilerNerf = false; // Remove charge speed penalty if you swap + OffsetLengthFromArm = 45f; + } + if (Main.rand.NextBool() && Time > 1) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition - (Projectile.velocity * 60).RotatedBy(0.15f * Projectile.direction), Projectile.ai[2] == 15 ? (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType(), (Projectile.velocity * 14).RotatedBy(MathHelper.ToRadians(-135f) * Projectile.direction).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.6f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 0.9f) * Utils.GetLerpValue(-10, 15, Projectile.timeLeft); + dust.color = baseColor; + } + } + + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if (Owner.CantUseHoldout() || Projectile.ai[2] >= 10) + { + if (Projectile.ai[2] < 10 && ChargeLV1) // Give charge speed nerf if you use any form of charge + Owner.Calamity().despoilerNerf = true; + hasBegunFiring = true; + + if (SoundEngine.TryGetActiveSound(OntologicalChargeSlot, out var ChargeSound3)) + ChargeSound3?.Stop(); + if (SoundEngine.TryGetActiveSound(OntologicalChargeSlotDeep, out var ChargeSound4)) + ChargeSound4?.Stop(); + + KeepRefreshingLifetime = false; + + // Big Shot mode + if (ChargeLV2) + { + if (ShotsLoaded > 0) + { + // Set lifespan to double of remaining cooldown so that it can finish the recoil animation + Projectile.timeLeft = AftershotCooldownFrames * 2; + + ChargeSound?.Stop(); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; + int charge2DamagePos = Projectile.damage; // Most of the damage comes from the explosion + int charge2DamageNeg = Projectile.damage * 40; // Big charge time? Check. No pierce? Check. 40x damage? Yes! + + if (Positive) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 2.5f, ModContent.ProjectileType(), charge2DamagePos, Projectile.knockBack, Projectile.owner); + SoundEngine.PlaySound(OntologicalDespoiler.BigShot, Projectile.Center); + } + else + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 0.6f, ModContent.ProjectileType(), charge2DamageNeg, Projectile.knockBack * 3, Projectile.owner); + Owner.Calamity().GeneralScreenShakePower = 12f; + SoundEngine.PlaySound(OntologicalDespoiler.BigShot2 with { Pitch = 0.2f }, Projectile.Center); + SoundEngine.PlaySound(OntologicalDespoiler.BigShot with { Pitch = -0.3f }, Projectile.Center); + } + + // Setting stats for the flash visual effect so it doesn't stick to the gun + flashPos = GunTipPosition + Projectile.velocity * 90; + flashRot = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + showFlash = true; + + for (int i = 0; i < 20; i++) + { + Color useColor = GetRandomColor(); + + float rand = Main.rand.NextFloat(0, 2.5f); + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, (i % 2 == 0 ? ModContent.DustType() : ModContent.DustType()), shootVelocity.RotatedByRandom(0.12f + rand * 0.2f) * (Main.rand.NextFloat(2.5f, 6.3f) - rand)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.55f, 1.85f); + dust.color = Positive ? useColor : baseColor; + } + + ShotsLoaded = 0; + ShootRecoilTimer = 34f; + OffsetLengthFromArm -= 35f; + } + // Retracting recoil + else if (ShootRecoilTimer > 0) + ShootRecoilTimer -= 2; + } + // Rapid Fire mode + else if (ShotsLoaded > 0) + { + // While bullets are remaining, refresh the lifespan; it will not refresh again after bullets run out + Projectile.timeLeft = (ChargeLV1 ? AftershotCooldownFrames : (int)(AftershotCooldownFrames * 1.5f)); + + // Retract recoil & shoot faster if charged + ShootRecoilTimer -= ChargeLV1 ? 3f : 2f; + + if (ShootRecoilTimer <= 0f) + { + ChargeSound?.Stop(); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; + Vector2 fireVec = shootVelocity * Main.rand.NextFloat(0.9f, 1.1f); + if (Positive) + { + for (int i = 0; i < 3; i++) + { + float angle = i == 0 ? -0.25f : i == 2 ? 0.25f : 0; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec.RotatedBy(angle) * (1 - Math.Abs(angle * 0.25f)), ModContent.ProjectileType(), (int)(Projectile.damage / 1.5f), Projectile.knockBack, Projectile.owner, 0, 0, i); + } + } + else + { + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.8f, 1f), ModContent.ProjectileType(), (int)(Projectile.damage / 2.5f), Projectile.knockBack, Projectile.owner, 0, 0, 5); + } + } + + SoundEngine.PlaySound(OntologicalDespoiler.SmallShot with { Pitch = Positive ? 0 : -0.2f, MaxInstances = Positive ? 1 : -1, Volume = Positive ? 1 : 0.5f }, Projectile.Center); + if (!Positive) + SoundEngine.PlaySound(MagnaCannon.Fire with { Pitch = 0.3f, Volume = 0.5f }, Projectile.Center); + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, !Positive ? (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType(), shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.3f, 2.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.15f, 1.35f); + dust.color = baseColor; + } + + ShotsLoaded -= (Positive ? 2 : 1); + ShootRecoilTimer = Positive ? 16 : 12f; + OffsetLengthFromArm -= 3.2f; + } + } + // Retracting any remaining recoil + else if (ShootRecoilTimer > 0) + ShootRecoilTimer -= 2; + } + else + { + // Loads shots until maxed out + ShotsLoaded = Utils.Remap(CurrentChargingFrames, 0, Charge1Frames, 1, MaxLoadableShots / 2); + if (ChargeLV1) + ShotsLoaded = MaxLoadableShots; + + CurrentChargingFrames += ((ChargeLV1 && !Positive) ? 0.5f : 2) * (Owner.Calamity().despoilerNerf ? 0.4f : 1); // Charges slower if nerfed, charge LV2 for Negative is slower + + // Sounds + if (!hasBegunFiring) + { + if (SoundEngine.TryGetActiveSound(OntologicalChargeSlot, out var ChargeSound2)) + { + ChargeSound2.Volume = Utils.Remap(CurrentChargingFrames, 0, Charge1Frames, 0, 0.8f, true) * 100; + ChargeSound2.Pitch = Utils.Remap(CurrentChargingFrames, 0, Charge2Frames, -1, 0.45f, true); + } + else + OntologicalChargeSlot = SoundEngine.PlaySound(OntologicalDespoiler.ChargeLoop with { Volume = 0.01f, Pitch = 0f, IsLooped = true }, Projectile.Center); + + if (SoundEngine.TryGetActiveSound(OntologicalChargeSlotDeep, out var ChargeSound5)) + { + ChargeSound5.Volume = Positive ? 0 : Utils.Remap(CurrentChargingFrames, Charge1Frames, Charge2Frames, 0, 1.8f, true) * 100; + ChargeSound5.Pitch = Utils.Remap(CurrentChargingFrames, Charge2Frames * 0.9f, Charge2Frames, 1f, (CurrentChargingFrames >= Charge2Frames ? -0.1f : 0.2f), true); + } + else + OntologicalChargeSlotDeep = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/MagnaCannonChargeLoop") with { Volume = 0.01f, Pitch = 0f, IsLooped = true }, Projectile.Center); + } + + // Charge-up visuals + if (CurrentChargingFrames >= 10 && (Positive || (!Positive && !ChargeLV2))) + { + float particleScale = MathHelper.Clamp(CurrentChargingFrames, 0f, Charge2Frames); + for (int i = 0; i < (ChargeLV2 ? 3 : ChargeLV1 ? 2 : 1); i++) + { + Vector2 dustVel = -Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(1.1f, 15.8f); + Vector2 addedPlace = Positive ? Vector2.Zero : dustVel * 3; + bool dustChance = Main.rand.NextBool((int)(30 * Utils.GetLerpValue(Charge2Frames, Charge1Frames, CurrentChargingFrames, true) + 1)); + int dustType = !Positive ? (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()) : ChargeLV1 ? (dustChance ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType(); + + Dust dust = Dust.NewDustPerfect(GunTipPosition + (Positive ? Vector2.Zero : (dustVel * 15 * Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true))), dustType, dustVel - addedPlace * Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.25f) * Utils.GetLerpValue(0, Charge1Frames, CurrentChargingFrames, true); + dust.color = baseColor; + } + Particle orb = new GenericBloom(GunTipPosition, Projectile.velocity, Positive ? Color.Lerp(Color.White, Color.Black, Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true)) : Color.Black * Utils.GetLerpValue(0, Charge1Frames, CurrentChargingFrames, true), (particleScale / 400f) * Main.rand.NextFloat(0.9f, 1.1f), 2, false, false); + GeneralParticleHandler.SpawnParticle(orb); + + float strength = particleScale / 45f; + Vector3 DustLight = baseColor.ToVector3() * 0.2f; + Lighting.AddLight(GunTipPosition, DustLight * strength); + } + if (ChargeLV2 && !Positive) + { + for (int i = 0; i < 3; i++) + { + Particle orb = new CustomSpark(GunTipPosition, Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(1.1f, 15.8f), "CalamityMod/Particles/PearlParticleGlow", false, 3, Main.rand.NextFloat(2.3f, 2.6f), Color.Black, new Vector2(0.3f, 1.35f), false, false); + GeneralParticleHandler.SpawnParticle(orb); + bool color = Main.rand.NextBool(4); + Vector2 dustVel = -Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(1.1f, 15.8f); + Dust dust = Dust.NewDustPerfect(GunTipPosition, (color ? ModContent.DustType() : ModContent.DustType()), dustVel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.25f); + dust.color = color ? Color.Black : baseColor; + } + } + + // Full charge dusts and sounds + if (ChargeLV1 && !hasReachedLV1) + { + SoundEngine.PlaySound(OntologicalDespoiler.ChargeLV1, Projectile.Center); + for (int i = 0; i < 16; i++) + { + Color useColor = GetRandomColor(); + + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, !Positive ? (i % 2 == 0 ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType()); + chargefull.velocity = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * 16f * (i % 2 == 0 ? 0.7f : 1); + chargefull.scale = Main.rand.NextFloat(1.1f, 1.3f); + chargefull.noGravity = true; + chargefull.color = Positive ? useColor : baseColor; + } + Particle orb2 = new CustomPulse(GunTipPosition, Vector2.Zero, Positive ? baseColor : Color.Black, "CalamityMod/Particles/SmallBloomRingLayered", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.65f, 0.85f, 11, Positive); + GeneralParticleHandler.SpawnParticle(orb2); + hasReachedLV1 = true; + } + if (ChargeLV2 && !hasReachedLV2) + { + SoundEngine.PlaySound(OntologicalDespoiler.ChargeLV2, Projectile.Center); + for (int i = 0; i < 24; i++) + { + Color useColor = GetRandomColor(); + + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, !Positive ? (i % 2 == 0 ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType()); + chargefull.velocity = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 22f * (i % 2 == 0 ? 0.7f : 1); + chargefull.scale = Main.rand.NextFloat(1.45f, 1.55f); + chargefull.noGravity = true; + chargefull.color = Positive ? useColor : baseColor; + } + Particle orb2 = new CustomPulse(GunTipPosition, Vector2.Zero, Positive ? baseColor : Color.Black, "CalamityMod/Particles/SmallBloomRingLayered", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.85f, 1.05f, 11, Positive); + GeneralParticleHandler.SpawnParticle(orb2); + hasReachedLV2 = true; + } + } + if (!hasBegunFiring && Projectile.ai[2] < 10) // Prevents firing animation from playing when not firing or swapping types + { + Projectile.frame = 6; + fireFrame = 6; + } + else + { + Lighting.AddLight(Projectile.Center, baseColor.ToVector3() * 0.75f); + } + Time++; + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(OntologicalChargeSlot, out var ChargeSound)) + ChargeSound?.Stop(); + if (SoundEngine.TryGetActiveSound(OntologicalChargeSlotDeep, out var ChargeSound2)) + ChargeSound2?.Stop(); + } + public Color GetRandomColor() + { + Color useColor = Main.rand.Next(4) switch + { + 0 => color1, + 1 => color2, + 2 => color3, + _ => color4, + }; + if (Owner.shirtColor == Color.White) + useColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + return useColor; + } + public override bool PreDraw(ref Color lightColor) + { + if (Time < 3) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/OntologicalDespoilerHoldout").Value; + Texture2D textureAlt = ModContent.Request("CalamityMod/Projectiles/Ranged/OntologicalDespoilerHoldout2").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 rotationPoint = frame.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (!Owner.CantUseHoldout()) + { + float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, Charge2Frames); + drawPosition += Main.rand.NextVector2Circular(rumble / 120f, rumble / 120f); + } + + Texture2D fireTexture = ModContent.Request("CalamityMod/Projectiles/Ranged/OntologicalDespoilerFlame").Value; + Texture2D fireTexture2 = ModContent.Request("CalamityMod/Projectiles/Ranged/OntologicalDespoilerFlame2").Value; + Rectangle frame2 = fireTexture.Frame(1, 7, 0, fireFrame); + Vector2 rotationPoint2 = frame2.Size() * 0.5f; + + Texture2D flashTexture = ModContent.Request("CalamityMod/Projectiles/Ranged/OntologicalDespoilerFlash").Value; + Rectangle frame3 = fireTexture.Frame(1, 6, 0, flashFrame); + Vector2 rotationPoint3 = frame3.Size() * 0.5f; + + // Glow Orb + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/FlameExplosion").Value; + Texture2D rechargeTexture2 = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + float randSize = Main.rand.NextFloat(0.9f, 1.1f); + if (!hasBegunFiring) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, baseColor with { A = 0 }, Projectile.rotation + Main.rand.NextFloat(-30, 30), rechargeTexture.Size() * 0.5f, 0.028f * Utils.GetLerpValue(0, Charge2Frames, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture2, GunTipPosition - Main.screenPosition, null, Positive ? Color.Lerp(Color.White, Color.Black, Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true)) : Color.Black, Projectile.rotation + Main.rand.NextFloat(-30, 30), rechargeTexture2.Size() * 0.5f, 0.58f * Utils.GetLerpValue(0, Charge2Frames, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0); + } + + if (ChargeLV1 && !Positive && !hasBegunFiring) + { + for (int i = 0; i < 2; i++) + { + Vector2 placement = drawPosition + voidPlacement; + Main.EntitySpriteDraw(texture, placement, frame, baseColor with { A = 0 } * 0.3f * Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true), drawRotation, rotationPoint, new Vector2(Main.rand.NextFloat(0.7f, 1f), Main.rand.NextFloat(0.8f, 1.2f)) * Projectile.scale * Owner.gravDir * 1.1f, flipSprite); + Main.EntitySpriteDraw(texture, placement, frame, Color.Black * Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true), drawRotation, rotationPoint, new Vector2(Main.rand.NextFloat(0.7f, 1f), Main.rand.NextFloat(0.6f, 1f)) * Projectile.scale * Owner.gravDir, flipSprite); + } + } + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + if (drawInverse && !Positive) + Main.EntitySpriteDraw(textureAlt, drawPosition, frame, Color.White * Utils.GetLerpValue(0, 5, inverseTimer, true), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + if (Projectile.frame < 6) + { + for (int i = 0; i< 4; i++) + Main.EntitySpriteDraw(fireTexture, drawPosition + Main.rand.NextVector2Circular(4.5f, 4.5f), frame2, baseColor with { A = 0 } * 0.3f, drawRotation, rotationPoint2, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(Positive ? fireTexture : fireTexture2, drawPosition, frame2, Positive ? baseColor with { A = 0 } : baseColor, drawRotation, rotationPoint2, Projectile.scale * Owner.gravDir, flipSprite); + } + if (showFlash) + { + for (int i = 0; i < 4; i++) + Main.EntitySpriteDraw(flashTexture, flashPos - Main.screenPosition + Main.rand.NextVector2Circular(4.5f, 4.5f), frame3, baseColor with { A = 0 } * 0.3f, flashRot, rotationPoint3, new Vector2(3, 0.8f) * Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(flashTexture, flashPos - Main.screenPosition, frame3, Color.Black, flashRot, rotationPoint3, new Vector2(3, 0.8f) * Projectile.scale * Owner.gravDir, flipSprite); + } + + return false; + } + } +} diff --git a/Projectiles/Ranged/OntologicalDespoilerHoldout.png b/Projectiles/Ranged/OntologicalDespoilerHoldout.png new file mode 100644 index 0000000000..693bdd24b7 Binary files /dev/null and b/Projectiles/Ranged/OntologicalDespoilerHoldout.png differ diff --git a/Projectiles/Ranged/OntologicalDespoilerHoldout2.png b/Projectiles/Ranged/OntologicalDespoilerHoldout2.png new file mode 100644 index 0000000000..e3d15bebc0 Binary files /dev/null and b/Projectiles/Ranged/OntologicalDespoilerHoldout2.png differ diff --git a/Projectiles/Ranged/OntologicalDespoilerShot.cs b/Projectiles/Ranged/OntologicalDespoilerShot.cs new file mode 100644 index 0000000000..0056e5832b --- /dev/null +++ b/Projectiles/Ranged/OntologicalDespoilerShot.cs @@ -0,0 +1,239 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OntologicalDespoilerShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/OntologicalDespoilerShot"; + public ref float time => ref Projectile.ai[0]; + public Color baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + public int sineDir = 1; + + public Player Owner => Main.player[Projectile.owner]; + public Color color1; + public Color color2; + public Color color3; + public Color color4; + public bool Positive => Projectile.ai[2] < 5; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 25; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 750; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 4; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + color1 = Owner.shirtColor; + color2 = Color.Lerp(Owner.shirtColor, Color.Black, 0.2f); + color3 = Color.Lerp(Owner.shirtColor, Color.White, 0.1f); + color4 = Color.Lerp(Owner.shirtColor, Color.White, 0.2f); + + Projectile.rotation = Projectile.velocity.ToRotation(); + + Projectile.frameCounter++; + if (Projectile.frameCounter > 10) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 5) + { + Projectile.frame = 0; + } + + if (time == 0) + { + Projectile.scale = 1f; + sineDir = Main.rand.NextBool() ? 1 : -1; + Projectile.frame = Main.rand.Next(0, 6 + 1); + if (!Positive) + Projectile.penetrate = 1; + } + if (Owner.shirtColor != Color.White) + { + float rate = (Main.GlobalTimeWrappedHourly * 15); + List eColors = new List() + { + color1, + color2, + color3, + color4 + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + baseColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + } + else + baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + if (!Positive) + { + baseColor = Color.White; + Projectile.extraUpdates = 3; + } + else + Projectile.extraUpdates = 5; + + if (time > 20) + { + if (!Positive) + { + + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 13f; + float scale = Main.rand.NextFloat(0.45f, 0.55f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + offset * sineDir, (time % 2 == 0 ? ModContent.DustType() : ModContent.DustType()), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f)); + dust2.noGravity = true; + dust2.scale = scale; + dust2.color = baseColor; + } + else + { + if (Main.rand.NextBool(21)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10), ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 1.8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.15f); + dust.color = baseColor; + } + if ((time < 15 || time % 25 <= 15) && Projectile.ai[2] != 1) + { + Projectile.velocity = Projectile.velocity.RotatedBy(0.5f / 15f * (Projectile.ai[2] == 2 ? 1 : -1)); + if (time % 25 == 0 || time == 15) + Projectile.ai[2] = (Projectile.ai[2] == 2 ? 0 : 2); + } + } + } + + if (!Positive) + { + NPC targetedNPC = Projectile.Center.ClosestNPCAt(700); + if (targetedNPC != null && time > 30 && Projectile.numHits < 1 && Vector2.Distance(targetedNPC.Center, Projectile.Center) < 700) + { + float moveSpeed = (0.42f + Utils.GetLerpValue(650, 450, Projectile.timeLeft, true)); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, moveSpeed, 8, 0.95f, accelerate: true); + } + } + else + { + if (Projectile.timeLeft < 100) + { + Projectile.velocity *= 0.96f; + Projectile.scale *= 0.98f; + } + Projectile.timeLeft--; + if (Projectile.timeLeft <= 1) + { + for (int i = 0; i < 2; i++) + { + Particle orb2 = new LineParticle(Projectile.Center, (Projectile.velocity * 5).RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 1f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), baseColor); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + } + + time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (!Positive) + { + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, !Positive ? (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType(), (Projectile.velocity * 3).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust.color = baseColor; + } + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.15f, 0.65f, 8); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloomRingLayered", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.2f, 0.75f, 8, false); + GeneralParticleHandler.SpawnParticle(orb2); + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.05f, 9, false); + GeneralParticleHandler.SpawnParticle(orb3); + } + else + { + for (int i = 0; i < MathHelper.Clamp((int)(3 - Projectile.numHits * 0.3f), 1, 3); i++) + { + Particle orb2 = new LineParticle(Projectile.Center, (Projectile.velocity * 4).RotatedByRandom(0.15f) * Main.rand.NextFloat(0.1f, 1f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), baseColor); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + SoundStyle fire = Positive ? new SoundStyle("CalamityMod/Sounds/Item/OntologicalDespoilerSmallImpact") : OntologicalDespoiler.SmallImpact; // Yes these are two different sounds... + SoundEngine.PlaySound(fire with { Volume = (!Positive ? 1 : 0.3f), Pitch = Main.rand.NextFloat(0.05f, 0.15f) * (!Positive ? 3 : 5), MaxInstances = !Positive ? 1 : 6 }, Projectile.Center); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.35f; + int hitsToMinMult = 3; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation; + + Asset tex = ModContent.Request("CalamityMod/Particles/DrainLineBloom2"); + Asset tex2 = ModContent.Request("CalamityMod/Particles/DrainLine2"); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], baseColor with { A = 0 } * 0.8f, 1, tex.Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Positive ? Color.Lerp(Color.White, baseColor, MathHelper.Clamp(Utils.GetLerpValue(50, 175, time, true), 0, 0.5f)) with { A = 0 } : Color.Black, 1, tex2.Value, true, true); + + Asset tex3 = ModContent.Request("CalamityMod/Projectiles/Ranged/OntologicalDespoilerShot"); + Asset tex4 = ModContent.Request("CalamityMod/Projectiles/Ranged/OntologicalDespoilerShot2"); + + Texture2D rTex = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + + Rectangle frame = tex3.Frame(1, 6, 0, Projectile.frame); + Vector2 rotationPoint = frame.Size() * 0.5f; + + if (Positive) + { + for (int i = 0; i < 5; i++) + { + Main.EntitySpriteDraw(Positive ? tex4.Value : tex3.Value, drawPosition, frame, Positive ? baseColor with { A = 0 } : baseColor, drawRotation, rotationPoint, new Vector2(1 + i * 0.45f, 1 - i * 0.25f) * Projectile.scale * 0.9f, SpriteEffects.None); + Main.EntitySpriteDraw(tex4.Value, drawPosition, frame, Color.Lerp(baseColor, Color.White, 0.7f) with { A = 0 }, drawRotation, rotationPoint, new Vector2(1 + i * 0.45f, 1 - i * 0.25f) * Projectile.scale * 0.8f, SpriteEffects.None); + } + } + else + { + Main.EntitySpriteDraw(Positive ? tex4.Value : tex3.Value, drawPosition, frame, Positive ? baseColor with { A = 0 } : baseColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + } + + return false; + } + } +} diff --git a/Projectiles/Ranged/OntologicalDespoilerShot.png b/Projectiles/Ranged/OntologicalDespoilerShot.png new file mode 100644 index 0000000000..897479fad9 Binary files /dev/null and b/Projectiles/Ranged/OntologicalDespoilerShot.png differ diff --git a/Projectiles/Ranged/OntologicalDespoilerShot2.png b/Projectiles/Ranged/OntologicalDespoilerShot2.png new file mode 100644 index 0000000000..8103eba981 Binary files /dev/null and b/Projectiles/Ranged/OntologicalDespoilerShot2.png differ diff --git a/Projectiles/Ranged/OpalChargedStrike.cs b/Projectiles/Ranged/OpalChargedStrike.cs index 6abb6efd69..52cf57f8aa 100644 --- a/Projectiles/Ranged/OpalChargedStrike.cs +++ b/Projectiles/Ranged/OpalChargedStrike.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Ranged/OpalStrike.cs b/Projectiles/Ranged/OpalStrike.cs index e4fa59607f..c2d0bbc307 100644 --- a/Projectiles/Ranged/OpalStrike.cs +++ b/Projectiles/Ranged/OpalStrike.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Ranged/PhotovisceratorHoldout.cs b/Projectiles/Ranged/PhotovisceratorHoldout.cs index 2b5d81ed2c..2fe75164e6 100644 --- a/Projectiles/Ranged/PhotovisceratorHoldout.cs +++ b/Projectiles/Ranged/PhotovisceratorHoldout.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -21,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public ref float ShootTimer => ref Projectile.ai[0]; public ref float ForcedLifespan => ref Projectile.ai[1]; public Color sparkColor; + public Color sparkColorSmooth; public int Time = 0; public ref int PhotoTimer => ref Main.player[Projectile.owner].Calamity().PhotoTimer; public SlotId PhotoUseSound; @@ -54,6 +56,19 @@ namespace CalamityMod.Projectiles.Ranged _ => Color.LawnGreen, }; + List eColors = new List() + { + Color.OrangeRed, + Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen + }; + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColorSmooth = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + if (Owner.Calamity().mouseRight) { if (SoundEngine.TryGetActiveSound(PhotoUseSound, out var Sound2)) @@ -152,7 +167,7 @@ namespace CalamityMod.Projectiles.Ranged 2 => Color.Orange, _ => Color.LawnGreen, }; - SquishyLightParticle exoEnergy = new(position, (Projectile.velocity * 3).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.3f, 1.6f), 0.9f, sparkColor, 60); + SquishyLightParticle exoEnergy = new(position, (Projectile.velocity * 3).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.3f, 1.6f), 0.9f, sparkColorSmooth, 60); GeneralParticleHandler.SpawnParticle(exoEnergy); } SoundEngine.PlaySound(DeadSunsWind.ShootSound with { Volume = 1.9f }, Owner.MountedCenter); @@ -161,16 +176,16 @@ namespace CalamityMod.Projectiles.Ranged Dust dust = Dust.NewDustPerfect(position, 263, (Projectile.velocity * 10).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.6f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(1.3f, 1.8f) - PhotoTimer * 0.02f; - dust.color = sparkColor; + dust.color = sparkColorSmooth; Dust dust2 = Dust.NewDustPerfect(position, 263, (Projectile.velocity * 15).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.3f, 1.6f)); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(1.3f, 1.8f) - PhotoTimer * 0.02f; - dust2.color = sparkColor; + dust2.color = sparkColorSmooth; if (Main.rand.NextBool()) { - MediumMistParticle smoke = new MediumMistParticle(position + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 15).RotatedByRandom(0.15f) * Main.rand.NextFloat(0.5f, 2.1f), sparkColor, Color.White, Main.rand.NextFloat(1.8f, 2.9f) - PhotoTimer * 0.026f, 160, Main.rand.NextFloat(-3f, 3f)); + MediumMistParticle smoke = new MediumMistParticle(position + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 15).RotatedByRandom(0.15f) * Main.rand.NextFloat(0.5f, 2.1f), sparkColorSmooth, Color.White, Main.rand.NextFloat(1.8f, 2.9f) - PhotoTimer * 0.026f, 160, Main.rand.NextFloat(-3f, 3f)); GeneralParticleHandler.SpawnParticle(smoke); - MediumMistParticle smoke2 = new MediumMistParticle(position + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 18).RotatedByRandom(0.05f) * Main.rand.NextFloat(1.8f, 3.1f), sparkColor, Color.White, Main.rand.NextFloat(0.8f, 1.9f) - PhotoTimer * 0.02f, 160, Main.rand.NextFloat(-3f, 3f)); + MediumMistParticle smoke2 = new MediumMistParticle(position + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 18).RotatedByRandom(0.05f) * Main.rand.NextFloat(1.8f, 3.1f), sparkColorSmooth, Color.White, Main.rand.NextFloat(0.8f, 1.9f) - PhotoTimer * 0.02f, 160, Main.rand.NextFloat(-3f, 3f)); GeneralParticleHandler.SpawnParticle(smoke2); } @@ -234,14 +249,13 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Photoviscerator itself + float interpolant = Utils.GetLerpValue(5f, 90f, 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; - } + Projectile.ForceNetUpdate(); } Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.UnitY) * 28f; @@ -273,7 +287,7 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 origin = new Vector2(85f, 33f); SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index 6a40f1bd25..f6ee408e98 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/PlagueTaintedDrone.cs b/Projectiles/Ranged/PlagueTaintedDrone.cs index 132aaf1c82..c364af3ef6 100644 --- a/Projectiles/Ranged/PlagueTaintedDrone.cs +++ b/Projectiles/Ranged/PlagueTaintedDrone.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; NPC target = Projectile.FindTargetWithinRange(1600f); @@ -90,8 +91,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); @@ -100,8 +101,8 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; @@ -158,7 +159,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[dust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 2; diff --git a/Projectiles/Ranged/PlagueTaintedProjectile.cs b/Projectiles/Ranged/PlagueTaintedProjectile.cs index 93191a077a..1c24282b48 100644 --- a/Projectiles/Ranged/PlagueTaintedProjectile.cs +++ b/Projectiles/Ranged/PlagueTaintedProjectile.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index 217acf83c3..49223801bc 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -10,16 +10,16 @@ namespace CalamityMod.Projectiles.Ranged public class PlanarRipperBolt : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Rogue/ShockGrenadeBolt"; + public override string Texture => "CalamityMod/Projectiles/Rogue/ShockBolt"; public static int frameWidth = 12; public static int frameHeight = 26; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index 16afcdb0b1..96e5cd5da1 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Projectiles.Ranged private int dustType = 0; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index 93548a466e..af1049f2ba 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[extraDust].position = Projectile.Center + extraDustVel * 12f; } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int gore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[gore].velocity *= 0.66f; @@ -82,7 +83,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.light = 0.9f; if (Main.rand.NextBool(10)) 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) + if (Main.rand.NextBool(20) && !Main.dedServ) 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); } @@ -91,9 +92,13 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } public override void OnKill(int timeLeft) { diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs index fd0109446f..6490f6fa34 100644 --- a/Projectiles/Ranged/PolarStar.cs +++ b/Projectiles/Ranged/PolarStar.cs @@ -29,11 +29,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.penetrate = -1; // Only hits once, "pierces" so that it can last a bit after hitting Projectile.extraUpdates = 2; - Projectile.timeLeft = 40; + Projectile.timeLeft = 60; Projectile.DamageType = DamageClass.Ranged; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.tileCollide = true; + Projectile.ArmorPenetration = 15; } public override void AI() @@ -84,15 +85,15 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.01f, 0.045f); } - if (Projectile.timeLeft % 2 == 0 && Time > 4 && DoSlowdown) // Particle trail + if (Time > 4 && DoSlowdown) // Particle trail { - PointParticle spark = new PointParticle(Projectile.Center - Projectile.velocity * 1f, -Projectile.velocity * 0.01f, false, 7, 2f, EffectsColor * 0.6f); + Particle spark = new CustomSpark(Projectile.Center - Projectile.velocity * 3f, -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomLineFade", false, 6, 0.04f, EffectsColor * 0.8f, new Vector2(0.8f, 1), shrinkSpeed: 0.4f); GeneralParticleHandler.SpawnParticle(spark); } if (Projectile.timeLeft <= 2 && DoSlowdown) { - 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.timeLeft = 7; Projectile.velocity = Vector2.Zero; DoSlowdown = false; } @@ -109,7 +110,7 @@ namespace CalamityMod.Projectiles.Ranged { if (DoSlowdown) { - 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.timeLeft = 7; Projectile.velocity = Vector2.Zero; DoSlowdown = false; } @@ -123,8 +124,10 @@ namespace CalamityMod.Projectiles.Ranged for (int k = 0; k < points; k++) { 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); + //PointParticle spark = new PointParticle((Projectile.Center + velocity * 7.5f) + addedPlacement, velocity * 2.5f, false, 13, 1.2f, EffectsColor); + //GeneralParticleHandler.SpawnParticle(spark); + Particle spark3 = new CustomSpark((Projectile.Center + velocity * 7.5f) + addedPlacement, velocity * 2.5f, "CalamityMod/Particles/BloomLineFade", false, 13, 0.02f, EffectsColor * 0.8f, new Vector2(2.8f, 1), shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(spark3); } } public override bool? CanDamage() => Projectile.numHits > 1 ? false : null; diff --git a/Projectiles/Ranged/PrecisionBolt.cs b/Projectiles/Ranged/PrecisionBolt.cs index bea7d232e5..4b11483a72 100644 --- a/Projectiles/Ranged/PrecisionBolt.cs +++ b/Projectiles/Ranged/PrecisionBolt.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; NPC potentialTarget = null; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 72; diff --git a/Projectiles/Ranged/PressurizedBubbleStream.cs b/Projectiles/Ranged/PressurizedBubbleStream.cs index 54b78cc3e1..4b593181e5 100644 --- a/Projectiles/Ranged/PressurizedBubbleStream.cs +++ b/Projectiles/Ranged/PressurizedBubbleStream.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -32,9 +33,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; + Projectile.penetrate = 3; Projectile.extraUpdates = 4; Projectile.timeLeft = FireTime + ChargeupTime; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool ShouldUpdatePosition() @@ -80,7 +83,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 bubblePosition = Owner.MountedCenter - Vector2.UnitY * 4f + bubbleRotation.ToRotationVector2() * 55f; - SoundEngine.PlaySound(ReedBlowgun.BubbleBurstSound, bubblePosition); + SoundEngine.PlaySound(SoundID.Item64, bubblePosition); } Projectile.velocity *= 0.985f; @@ -130,7 +133,8 @@ namespace CalamityMod.Projectiles.Ranged waterDust.velocity -= Projectile.velocity * 0.1f; } } - + 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 OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item21, Projectile.position); diff --git a/Projectiles/Ranged/PrismComet.cs b/Projectiles/Ranged/PrismComet.cs index f607e32fdf..94d0ccf5c0 100644 --- a/Projectiles/Ranged/PrismComet.cs +++ b/Projectiles/Ranged/PrismComet.cs @@ -13,9 +13,10 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 5; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, Color.LightSeaGreen.ToVector3()); Projectile.frameCounter++; if (Projectile.frameCounter % 6 == 5) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; Projectile.alpha = Utils.Clamp(Projectile.alpha - 25, 30, 255); @@ -75,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } diff --git a/Projectiles/Ranged/PrismEnergyBullet.cs b/Projectiles/Ranged/PrismEnergyBullet.cs index e28af7dd0d..7de5fd8833 100644 --- a/Projectiles/Ranged/PrismEnergyBullet.cs +++ b/Projectiles/Ranged/PrismEnergyBullet.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 9279a24993..d8fefeee20 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 1a7fff1cfc..c4f8675e0f 100644 --- a/Projectiles/Ranged/PrismExplosionSmall.cs +++ b/Projectiles/Ranged/PrismExplosionSmall.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; + Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.frameCounter % 8 == 7) Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.Kill(); Projectile.scale *= 1.0115f; Projectile.Opacity = Utils.GetLerpValue(5f, 36f, Projectile.timeLeft, true); @@ -43,9 +43,9 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Ranged/PrismMine.cs b/Projectiles/Ranged/PrismMine.cs index d677b63c99..d0bcb38d43 100644 --- a/Projectiles/Ranged/PrismMine.cs +++ b/Projectiles/Ranged/PrismMine.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; + Projectile.extraUpdates = 1; Projectile.localNPCHitCooldown = 7; Projectile.timeLeft = 280; } @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D baseTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D baseTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D glowTexture = ModContent.Request($"{Texture}Glowmask").Value; Texture2D laserTexture = ModContent.Request($"CalamityMod/Projectiles/Ranged/PrismMineArc").Value; diff --git a/Projectiles/Ranged/PrismaticEnergyBlast.cs b/Projectiles/Ranged/PrismaticEnergyBlast.cs index 2fe416f9c6..e7f29f76f0 100644 --- a/Projectiles/Ranged/PrismaticEnergyBlast.cs +++ b/Projectiles/Ranged/PrismaticEnergyBlast.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { // Start texture drawing. - Rectangle beginFrame = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle beginFrame = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Main.EntitySpriteDraw(LaserBeginTexture, Projectile.Center - Main.screenPosition, beginFrame, @@ -108,14 +108,14 @@ namespace CalamityMod.Projectiles.Ranged // Prepare things for body drawing. float laserBodyLength = LaserLength; - laserBodyLength -= (LaserBeginTexture.Height * 0.5f + LaserEndTexture.Height) * Projectile.scale / Main.projFrames[Projectile.type]; + laserBodyLength -= (LaserBeginTexture.Height * 0.5f + LaserEndTexture.Height) * Projectile.scale / Main.projFrames[Type]; Vector2 centerOnLaser = Projectile.Center; // Body drawing. - Rectangle middleFrame = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle middleFrame = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); if (laserBodyLength > 30f) { - float laserOffset = (LaserMiddleTexture.Height - 10f) * Projectile.scale / Main.projFrames[Projectile.type]; + float laserOffset = (LaserMiddleTexture.Height - 10f) * Projectile.scale / Main.projFrames[Type]; float incrementalBodyLength = 0f; while (incrementalBodyLength + 1f < laserBodyLength) { @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Ranged } // End texture drawing. - Rectangle endFrame = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle endFrame = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; Main.EntitySpriteDraw(LaserEndTexture, laserEndCenter, diff --git a/Projectiles/Ranged/PristineFire.cs b/Projectiles/Ranged/PristineFire.cs index 00bf2f3f8a..38a8616c6e 100644 --- a/Projectiles/Ranged/PristineFire.cs +++ b/Projectiles/Ranged/PristineFire.cs @@ -3,10 +3,12 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -17,39 +19,66 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Particles/MediumMist"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 20; - ProjectileID.Sets.TrailingMode[Type] = 2; - } - public float smokeOpa = 0.25f; + public ref float time => ref Projectile.ai[2]; + public Vector2 beamPos; + public Vector2 beamPos2; + public bool hasIgnited = false; + + public int boomTime = PristineFury.boomTime; public override void SetDefaults() { - Projectile.width = Projectile.height = 6; + Projectile.width = Projectile.height = 40; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.MaxUpdates = 4; + Projectile.MaxUpdates = 5; Projectile.timeLeft = 120; + Projectile.tileCollide = false; } public override void AI() { - if (Projectile.timeLeft < 118) + float mult = Utils.GetLerpValue(140, 75, Projectile.timeLeft, true); + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.Red, Color.Goldenrod, mult).ToVector3() * 0.7f); + + if (Projectile.timeLeft < 116) { - if (smokeOpa > 0) - smokeOpa -= 0.02f; + float sine = (float)Math.Sin(time * 0.65f / MathHelper.Pi); - Lighting.AddLight(Projectile.Center, 1f, 1f, 0.25f); - - // Light smoke - Color smokeColor = new Color(255, Main.rand.Next(160, 230 + 1), 100, 100); - Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(smokeOpa * 10) * (Main.rand.NextFloat(0.4f, 0.65f) - smokeOpa), smokeColor, 16, Main.rand.NextFloat(0.6f, 1.2f), 0.2f + smokeOpa, glowing: true); - GeneralParticleHandler.SpawnParticle(smoke); + beamPos = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (30f * mult * -1) * Utils.GetLerpValue(116, 108, Projectile.timeLeft, true); + beamPos2 = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (30f * mult) * Utils.GetLerpValue(116, 108, Projectile.timeLeft, true); + for (int i = 0; i < 2; i++) + { + Particle beam = new CustomSpark(i == 0 ? beamPos : beamPos2, Projectile.velocity * 0.1f, "CalamityMod/Particles/SmallBloom", false, 6, (0.065f * mult) + 0.01f, Color.Lerp(Color.Red, Color.Goldenrod, mult), new Vector2(1f, 2.5f), true, false); + GeneralParticleHandler.SpawnParticle(beam); + } } + + if (!hasIgnited) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Projectile.Center, projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.Opacity > 0.5f) + { + if (projectile.ai[2] == 0) + { + projectile.ai[2] = boomTime; + hasIgnited = true; + SoundStyle ignite = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn"); + SoundEngine.PlaySound(ignite with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.6f), SoundLimitBehavior = SoundLimitBehavior.IgnoreNew }, Projectile.Center); + } + else + hasIgnited = true; + } + } + } + Projectile.rotation = Projectile.velocity.ToRotation(); + time--; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); @@ -63,11 +92,15 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.23f, 0.56f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 1.2f, Main.rand.NextBool() ? Color.Orange : Color.DarkOrange); - GeneralParticleHandler.SpawnParticle(spark); - LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.23f, -0.56f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 1.2f, Main.rand.NextBool() ? Color.Orange : Color.DarkOrange); - GeneralParticleHandler.SpawnParticle(spark2); - + for (int i = 0; i < 4; i++) + { + Vector2 linePos = i < 2 ? beamPos : beamPos2; + Vector2 lineVel = (Utils.DirectionFrom(linePos, Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 40) * 3).RotatedByRandom(0.16f) * Main.rand.NextFloat(0.4f, 2.5f); + + Particle beam = new CustomSpark(linePos, lineVel, "CalamityMod/Particles/SmallBloom", false, 11, 0.09f, Main.rand.NextBool() ? Color.Orange : Color.DarkOrange, new Vector2(2f, 1.5f), true, false, 0, false, false, 1.1f); + GeneralParticleHandler.SpawnParticle(beam); + } + for (int i = 0; i <= 3; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 169 : 158, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f)); @@ -83,29 +116,10 @@ namespace CalamityMod.Projectiles.Ranged Particle smoke = new MediumMistParticle(smokePos, smokeVel, Main.rand.NextBool() ? Color.Orange : Color.DarkOrange, Color.Black, Main.rand.NextFloat(0.7f, 1.9f) - velMulti, 225 - Main.rand.Next(60), 0.1f); GeneralParticleHandler.SpawnParticle(smoke); } + } - - public float HelixTrailWidthFunction(float completionRatio) => Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * 1.5f; - public Color HelixTrailColorFunction(float completionRatio) => Projectile.timeLeft < 105 ? Projectile.ai[0] == 1 ? Color.DarkOrange * (1f - completionRatio) : Color.Orange * (1f - completionRatio) : Color.Transparent; - public override bool PreDraw(ref Color lightColor) { - // Draw a double helix trail - for (int direction = -1; direction <= 1; direction += 2) - { - List trailPositions = new List(); - int trailPoints = ProjectileID.Sets.TrailCacheLength[Type]; - // Add points adjusted for sine - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - if (Projectile.oldPos[i] == Vector2.Zero) - break; - - Vector2 sinOffset = (Vector2.UnitY * direction * MathF.Sin(i * MathHelper.Pi * 0.125f) * 24f).RotatedBy(Projectile.oldRot[i]); - trailPositions.Add(Projectile.oldPos[i] + sinOffset); - } - PrimitiveRenderer.RenderTrail(trailPositions, new(HelixTrailWidthFunction, HelixTrailColorFunction, (_) => Projectile.Size * 0.5f), 60); - } return false; } } diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index ef5744f2d4..da8d891e33 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -1,8 +1,13 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -14,9 +19,13 @@ namespace CalamityMod.Projectiles.Ranged public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; public ref float ScaleFactor => ref Projectile.ai[0]; - public ref float LightPower => ref Projectile.ai[1]; + public float LightPower = 0; - public Color FogColor = new Color(255, 220, 100); + public Color FogColor = Color.Orchid; + public float FogRotation = 0; + public int boomTime = PristineFury.boomTime; + + public bool Ignited = false; public override void SetDefaults() { @@ -26,49 +35,107 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; - Projectile.timeLeft = 150; + Projectile.timeLeft = 230; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 2; } public override void AI() { - // Add some degree of variation to the fog with scale/rotation/color - if (Projectile.ai[2] == 0f) + if (Projectile.ai[2] == boomTime) + Ignited = true; + if (Ignited) { - Projectile.scale = Main.rand.NextFloat(0.15f, 0.75f); - Projectile.ai[2] = Main.rand.NextFloat(MathHelper.TwoPi); - FogColor.G = (byte)Main.rand.Next(160, 230 + 1); - } - ScaleFactor += 0.01f; - ScaleFactor = MathHelper.Clamp(ScaleFactor, 0f, Projectile.scale); - Lighting.AddLight(Projectile.Center, new Vector3(1f, 1f, 0.25f) * ScaleFactor); - Projectile.rotation = Projectile.velocity.ToRotation() + Projectile.ai[2]; + if (Projectile.ai[2] == boomTime) + { + // Xyk: "This is probably too much lol" + // Yeah I'd say 7x base damage is a bit much + Projectile.damage *= 4; + FogColor = Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat()); - Projectile.velocity *= 0.98f; - Projectile.Opacity = Utils.GetLerpValue(150f, 135f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); + SoundStyle ignite = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); + SoundEngine.PlaySound(ignite with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.5f, 0.6f) }, Projectile.Center); + } + FogColor = Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat(0.5f, 1)); + if (Projectile.timeLeft > boomTime + 1) + Projectile.timeLeft = (int)(Projectile.timeLeft * 0.95f); + Projectile.scale *= 1.12f; + ScaleFactor *= 1.06f; + if (Projectile.ai[2] > 1) + Projectile.ai[2]--; + } + // Add some degree of variation to the fog with scale/rotation/color + if (FogRotation == 0f) + { + Projectile.scale = Main.rand.NextFloat(0.62f, 1.15f); + FogRotation = Main.rand.NextFloat(MathHelper.TwoPi); + FogColor.G += (byte)Main.rand.Next(10, 80 + 1); + } + ScaleFactor += 0.014f; + ScaleFactor = MathHelper.Clamp(ScaleFactor, 0f, Projectile.scale); + Lighting.AddLight(Projectile.Center,FogColor.ToVector3() * ScaleFactor); + Projectile.rotation = Projectile.velocity.ToRotation() + FogRotation; + + Projectile.velocity *= Main.rand.NextFloat(0.95f, 0.99f); + Projectile.Opacity = Utils.GetLerpValue(280f, 135f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. // Without this, it may render over the fullblack that the game renders for obscured tiles. float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); + + if (Projectile.timeLeft < 220) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(7f, 25f) * Projectile.Opacity * Projectile.scale; + + if (Main.rand.NextBool(40)) + { + Particle spark = new CustomSpark(Projectile.Center + vel * 4 * Projectile.Opacity, vel * 0.05f, "CalamityMod/Particles/ProvidenceMarkParticle", false, 25, Main.rand.NextFloat(0.9f, 1.2f) * (Ignited ? 1.8f : 1), FogColor * Projectile.Opacity * 0.4f, new Vector2(1.3f, 0.5f), true, false, (Ignited ? 0 : Main.rand.NextFloat(-4, 4)), false, false, (Ignited ? 0.5f : 0)); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(30)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), vel * 0.25f * (Ignited ? 2f : 1)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.55f, 0.95f) * Projectile.Opacity * (Ignited ? 2f : 1); + dust.color = FogColor; + } + } + if (Projectile.Opacity > 0.5f && Ignited) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Projectile.Center, projectile.Center) <= 200 * Projectile.scale && projectile.active && ((projectile.type == ModContent.ProjectileType() && Projectile.ai[2] == 2 && projectile.ai[2] == 0 && projectile.Opacity > 0.5f)) && projectile != Projectile && Projectile.ai[1] < 100) + { + projectile.ai[2] = boomTime; + Projectile.ai[1] = Projectile.ai[1] + 1; + } + } + } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * ScaleFactor * 0.5f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.Opacity < 0.3f ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * ScaleFactor * 0.5f, targetHitbox); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Ignited) + { + target.AddBuff(ModContent.BuffType(), 420); + } + } public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f; + float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.7f; Color drawColor = FogColor * opacity; Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, Projectile.rotation, texture.Size() * 0.5f, ScaleFactor, SpriteEffects.None); diff --git a/Projectiles/Ranged/PumplerHoldout.cs b/Projectiles/Ranged/PumplerHoldout.cs index 93522b1934..7333516569 100644 --- a/Projectiles/Ranged/PumplerHoldout.cs +++ b/Projectiles/Ranged/PumplerHoldout.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -21,15 +22,20 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 9; + Main.projFrames[Type] = 9; } private Player Owner => Main.player[Projectile.owner]; private ref float CurrentChargingFrames => ref Projectile.ai[0]; private ref float PumpkinsCharge => ref Projectile.ai[1]; + private ref float FramesToLoadNextPumpkin => ref Projectile.localAI[0]; + + //This possibly could moved to ai[2] ¯\_(ツ)_/¯ private ref float Overfilled => ref Projectile.localAI[1]; //This functionally is a "IsPlayingShootAnim" variable + + private bool IsOverfilled => (Overfilled >= 0.5f); private float angularSpread = MathHelper.ToRadians(15); public override void SetDefaults() @@ -49,10 +55,10 @@ 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 (Owner.CantUseHoldout() || Overfilled == 1f) + if (Owner.CantUseHoldout() || IsOverfilled) { - if (PumpkinsCharge <= 0f && Overfilled == 0f) //If the projectile isnt playing its animation and if there arent any pumpkins loaded, kill it + if (PumpkinsCharge <= 0f && !IsOverfilled) //If the projectile isnt playing its animation and if there arent any pumpkins loaded, kill it { Projectile.Kill(); return; @@ -63,12 +69,12 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.frameCounter >= 10) //10 fps anim { Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) + if (Projectile.frame >= Main.projFrames[Type] - 1) Projectile.frame = 0; Projectile.frameCounter = 0; } // Shoot anim is done? Remove the shoot anim tag - if (Projectile.frame == 0 && Overfilled == 1f) + if (Projectile.frame == 0 && IsOverfilled) Overfilled = 0f; //Animation stuff end @@ -145,7 +151,7 @@ namespace CalamityMod.Projectiles.Ranged SmokeBurst(tipPosition); FramesToLoadNextPumpkin = Owner.ActiveItem().useAnimation; //reset the reload time PumpkinsCharge = 0; //Unload the barrel - if (!(Overfilled == 1f)) + if (!IsOverfilled) Overfilled = 1f; //Make the shoot anim play Projectile.frame = 6; //Initialize the animation } @@ -168,14 +174,13 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Pumpler itself + float interpolant = Utils.GetLerpValue(5f, 25f, Owner.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Owner.SafeDirectionTo(Main.MouseWorld), interpolant); if (Projectile.velocity != oldVelocity) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); } //Please someone kill me i dont want to deal with offset moments, //Dom oomfie! @@ -213,7 +218,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.EnterShaderRegion(); - if (PumpkinsCharge > 0 && Overfilled == 0f) + if (PumpkinsCharge > 0 && !IsOverfilled) { 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 @@ -226,8 +231,8 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:BasicTint"].Apply(); Vector2 drawPosition = Projectile.Center - Main.screenPosition; - 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); + Rectangle frameRectangle = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Frame(1, 9, 0, Projectile.frame); + Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.Projectile[Type].Value, drawPosition, frameRectangle, lightColor, Projectile.rotation, frameRectangle.Size() * 0.5f, 1f, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); Main.spriteBatch.ExitShaderRegion(); @@ -240,12 +245,12 @@ namespace CalamityMod.Projectiles.Ranged //netcode hell public override void SendExtraAI(BinaryWriter writer) { - writer.Write(Overfilled); + writer.Write(IsOverfilled); } public override void ReceiveExtraAI(BinaryReader reader) { - Overfilled = reader.ReadInt32(); + Overfilled = reader.ReadBoolean() ? 1.0f : 0.0f; } } } diff --git a/Projectiles/Ranged/RainbowFront.cs b/Projectiles/Ranged/RainbowFront.cs index b8154deb06..0a4305437a 100644 --- a/Projectiles/Ranged/RainbowFront.cs +++ b/Projectiles/Ranged/RainbowFront.cs @@ -7,6 +7,7 @@ namespace CalamityMod.Projectiles.Ranged public class RainbowFront : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "Terraria/Images/Projectile_251"; public override void SetDefaults() { Projectile.width = 12; diff --git a/Projectiles/Ranged/RainbowFront.png b/Projectiles/Ranged/RainbowFront.png deleted file mode 100644 index 5ee9d346d1..0000000000 Binary files a/Projectiles/Ranged/RainbowFront.png and /dev/null differ diff --git a/Projectiles/Ranged/RainbowTrail.cs b/Projectiles/Ranged/RainbowTrail.cs index 20abe41bb0..b785e78402 100644 --- a/Projectiles/Ranged/RainbowTrail.cs +++ b/Projectiles/Ranged/RainbowTrail.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Projectiles.Ranged public class RainbowTrail : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Ranged/RainbowFront"; + public override string Texture => "Terraria/Images/Projectile_251"; public override void SetDefaults() { diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index 64d52761a0..76570d8ccd 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Ranged/RicoshotCoin.cs b/Projectiles/Ranged/RicoshotCoin.cs index 1d62162a82..b8090108e7 100644 --- a/Projectiles/Ranged/RicoshotCoin.cs +++ b/Projectiles/Ranged/RicoshotCoin.cs @@ -91,9 +91,10 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 60; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 8; + ProjectileID.Sets.TrailCacheLength[Type] = 60; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 8; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; // Produce a tiny amount of light based on coin type. @@ -252,8 +253,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int numFrames = Main.projFrames[Projectile.type]; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int numFrames = Main.projFrames[Type]; Rectangle frame = new Rectangle( /* X */ (int)CoinType * tex.Width / 3, /* Y */ Projectile.frame * tex.Height / numFrames, diff --git a/Projectiles/Ranged/PhangasmBow.cs b/Projectiles/Ranged/RiftburstBow.cs similarity index 97% rename from Projectiles/Ranged/PhangasmBow.cs rename to Projectiles/Ranged/RiftburstBow.cs index cf9d398386..5c6196bf96 100644 --- a/Projectiles/Ranged/PhangasmBow.cs +++ b/Projectiles/Ranged/RiftburstBow.cs @@ -10,10 +10,10 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class PhangasmBow : ModProjectile + public class RiftburstBow : ModProjectile { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Ranged/Phangasm"; + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Riftburst"; public override void SetDefaults() { @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/PhangasmGlow").Value; + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/RiftburstGlow").Value; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; diff --git a/Projectiles/Ranged/RocketFire.cs b/Projectiles/Ranged/RocketFire.cs index 47a34a1452..899990b1ac 100644 --- a/Projectiles/Ranged/RocketFire.cs +++ b/Projectiles/Ranged/RocketFire.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged if (!initialized) { initialized = true; - Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); } Projectile.frameCounter++; if (Projectile.frameCounter > 6) @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/RubberMortarRoundProj.cs b/Projectiles/Ranged/RubberMortarRoundProj.cs index 8355606f88..1c734273d3 100644 --- a/Projectiles/Ranged/RubberMortarRoundProj.cs +++ b/Projectiles/Ranged/RubberMortarRoundProj.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/RubicoPrimeMag.cs b/Projectiles/Ranged/RubicoPrimeMag.cs new file mode 100644 index 0000000000..0a4d72860d --- /dev/null +++ b/Projectiles/Ranged/RubicoPrimeMag.cs @@ -0,0 +1,54 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +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 Humanizer.In; + +namespace CalamityMod.Projectiles.Ranged +{ + public class RubicoPrimeMag : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/RubicoPrimeMag"; + public int Time = 0; + public bool TouchedGrass = false; + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; + Projectile.penetrate = -1; + Projectile.timeLeft = 700; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Projectile.extraUpdates = 0; + Time++; + Player Owner = Main.player[Projectile.owner]; + if (!TouchedGrass) + { + Projectile.rotation += 0.5f * (float)Projectile.direction; + } + Projectile.velocity.Y -= 0.055f; + Projectile.velocity.X *= 0.992f; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.damage = 0; + TouchedGrass = true; + Projectile.velocity *= 0.98f; + return false; + } + } +} diff --git a/Projectiles/Ranged/RubicoPrimeMag.png b/Projectiles/Ranged/RubicoPrimeMag.png new file mode 100644 index 0000000000..7aa946cf43 Binary files /dev/null and b/Projectiles/Ranged/RubicoPrimeMag.png differ diff --git a/Projectiles/Ranged/SandstormBullet.cs b/Projectiles/Ranged/SandblasterBullet.cs similarity index 92% rename from Projectiles/Ranged/SandstormBullet.cs rename to Projectiles/Ranged/SandblasterBullet.cs index c2763f0659..7bdf86ebc3 100644 --- a/Projectiles/Ranged/SandstormBullet.cs +++ b/Projectiles/Ranged/SandblasterBullet.cs @@ -7,15 +7,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class SandstormBullet : ModProjectile, ILocalizedModType + public class SandblasterBullet : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/Boss/SandBlast"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs index f3381143da..d806b0180c 100644 --- a/Projectiles/Ranged/ScorchedEarthRocket.cs +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -10,9 +10,10 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 10; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 6; } @@ -68,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ExpandHitboxBy(300); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 10; @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ScorpioHoldout.cs b/Projectiles/Ranged/ScorpioHoldout.cs index 36669dd5f8..ea27ca7445 100644 --- a/Projectiles/Ranged/ScorpioHoldout.cs +++ b/Projectiles/Ranged/ScorpioHoldout.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Ranged } // Spawns the projectile. - Projectile.NewProjectileDirect( + Projectile.NewProjectile( Projectile.GetSource_FromThis(), GunTipPosition, projectileVelocity.RotatedByRandom(isRMB ? 0f : MathHelper.PiOver4) * projSpeed * (isRMB ? 1f : Main.rand.NextFloat(0.8f, 1f)), @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D glowTexture = Request(GlowTexture).Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Color drawColor = Projectile.GetAlpha(lightColor); diff --git a/Projectiles/Ranged/ScorpioLargeRocket.cs b/Projectiles/Ranged/ScorpioLargeRocket.cs index f4382f2726..0e6e837318 100644 --- a/Projectiles/Ranged/ScorpioLargeRocket.cs +++ b/Projectiles/Ranged/ScorpioLargeRocket.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 8; } @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 1.032f; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + 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. @@ -209,7 +210,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); diff --git a/Projectiles/Ranged/ScorpioRocket.cs b/Projectiles/Ranged/ScorpioRocket.cs index 309634c16a..94e9965fc4 100644 --- a/Projectiles/Ranged/ScorpioRocket.cs +++ b/Projectiles/Ranged/ScorpioRocket.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 8; } @@ -37,6 +38,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = Projectile.height = 34; Projectile.timeLeft = 600; Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 1; Projectile.friendly = true; Projectile.usesLocalNPCImmunity = true; } @@ -73,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged else Projectile.velocity *= 0.9f; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) Projectile.Kill(); // Rotates towards its velocity. @@ -158,7 +160,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index ee4feaeb26..570618b113 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Ranged public class SeaDragonRocket : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 18; diff --git a/Projectiles/Ranged/SeasSearingBubble.cs b/Projectiles/Ranged/SeasSearingBubble.cs index a9a0fa85c7..f6f3aa3cb7 100644 --- a/Projectiles/Ranged/SeasSearingBubble.cs +++ b/Projectiles/Ranged/SeasSearingBubble.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SeasSearingSpout.cs b/Projectiles/Ranged/SeasSearingSpout.cs index 1a0f8a08e4..51c231e793 100644 --- a/Projectiles/Ranged/SeasSearingSpout.cs +++ b/Projectiles/Ranged/SeasSearingSpout.cs @@ -9,9 +9,11 @@ namespace CalamityMod.Projectiles.Ranged public class SeasSearingSpout : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Melee/BrinySpout"; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -118,8 +120,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/SeasSearingSpout.png b/Projectiles/Ranged/SeasSearingSpout.png deleted file mode 100644 index 1cca5e1bae..0000000000 Binary files a/Projectiles/Ranged/SeasSearingSpout.png and /dev/null differ diff --git a/Projectiles/Ranged/SepticChain.png b/Projectiles/Ranged/SepticChain.png new file mode 100644 index 0000000000..cf87d1f927 Binary files /dev/null and b/Projectiles/Ranged/SepticChain.png differ diff --git a/Projectiles/Ranged/SepticSkewerBacteria.cs b/Projectiles/Ranged/SepticSkewerBacteria.cs index b6e487b778..23e8884714 100644 --- a/Projectiles/Ranged/SepticSkewerBacteria.cs +++ b/Projectiles/Ranged/SepticSkewerBacteria.cs @@ -1,5 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,146 +13,57 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - + public bool setStats = true; + public int rotDirection = 1; + public int time = 0; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; + Projectile.width = 45; + Projectile.height = 45; Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 300; + Projectile.timeLeft = 80; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - int dustType = 171; + if (setStats) + { + Projectile.timeLeft += Main.rand.Next(0, 25 + 1); + rotDirection = (Main.rand.NextBool() ? -1 : 1); + Projectile.rotation = Main.rand.NextFloat(-20, 20); + Projectile.scale = Main.rand.NextFloat(0.55f, 0.8f); + setStats = false; + } + if (time % 8 == 0 && time > 40) + { + Particle spark = new CustomSpark(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.4f), "CalamityMod/Projectiles/Boss/OldDukeGore", false, Main.rand.Next(9, 20 + 1), Main.rand.NextFloat(0.4f, 0.6f), Color.Lerp(Color.White, Color.Chartreuse, 0.5f) * Main.rand.NextFloat(0.55f, 0.7f) * Utils.GetLerpValue(255, 0, Projectile.alpha), new Vector2(1, 1), false, false, Main.rand.NextFloat(-1f, 1f)); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(15)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(13, 13), (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f) * Utils.GetLerpValue(255, 0, Projectile.alpha); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); + } if (Main.rand.NextBool(3)) { - dustType = 46; - } - 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; - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 90f) - { - Projectile.localAI[0] *= -1f; - } - if (Projectile.localAI[0] >= 0f) - { - Projectile.scale += 0.003f; - } - else - { - Projectile.scale -= 0.003f; - } - Projectile.rotation += 0.0025f * Projectile.scale; - float yVelControl = 1f; - float xVelControl = 1f; - if (Projectile.identity % 6 == 0) - { - xVelControl *= -1f; - } - if (Projectile.identity % 6 == 1) - { - yVelControl *= -1f; - } - if (Projectile.identity % 6 == 2) - { - xVelControl *= -1f; - yVelControl *= -1f; - } - if (Projectile.identity % 6 == 3) - { - xVelControl = 0f; - } - if (Projectile.identity % 6 == 4) - { - yVelControl = 0f; - } - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] > 60f) - { - Projectile.localAI[1] = -180f; - } - if (Projectile.localAI[1] >= -60f) - { - Projectile.velocity.X = Projectile.velocity.X + 0.002f * xVelControl; - Projectile.velocity.Y = Projectile.velocity.Y + 0.002f * yVelControl; - } - else - { - Projectile.velocity.X = Projectile.velocity.X - 0.002f * xVelControl; - Projectile.velocity.Y = Projectile.velocity.Y - 0.002f * yVelControl; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5400f) - { - Projectile.damage = 0; - Projectile.ai[1] = 1f; - if (Projectile.alpha < 255) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - } - } - else if (Projectile.owner == Main.myPlayer) - { - Projectile.Kill(); - } - } - else - { - float playerDist = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (playerDist > 4f) - { - playerDist *= 1.1f; - } - if (playerDist > 5f) - { - playerDist *= 1.2f; - } - if (playerDist > 6f) - { - playerDist *= 1.3f; - } - if (playerDist > 7f) - { - playerDist *= 1.4f; - } - if (playerDist > 8f) - { - playerDist *= 1.5f; - } - if (playerDist > 9f) - { - playerDist *= 1.6f; - } - if (playerDist > 10f) - { - playerDist *= 1.7f; - } - Projectile.ai[0] += playerDist; - if (Projectile.alpha > 50) - { - Projectile.alpha -= 10; - if (Projectile.alpha < 50) - { - Projectile.alpha = 50; - } - } - } - if ((double)Projectile.velocity.Length() > 0.2) - { - Projectile.velocity *= 0.98f; + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + dust.alpha = (int)MathHelper.Clamp(Projectile.alpha, 0, 255); } + Projectile.rotation += 0.035f * rotDirection * Utils.GetLerpValue(0, 100, Projectile.timeLeft, true); + Projectile.velocity *= 0.965f; + if (Projectile.timeLeft < 60) + Projectile.alpha += 5; + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -159,21 +73,20 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 56; - 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, 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; - } + + } + public override bool PreDraw(ref Color lightColor) + { + + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeGore").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + return false; } } } diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 5e4628a6e4..10ffcec20c 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -1,7 +1,14 @@ -using System; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,119 +17,461 @@ namespace CalamityMod.Projectiles.Ranged public class SepticSkewerHarpoon : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public ref float time => ref Projectile.ai[0]; + + public Vector2[] OldVelocities = new Vector2[20]; + public bool canDamage = true; + public bool returning = false; + public float CenterX; + public float CenterY; + public bool setPosition = true; + public int returnTime = 75; + + public NPC chosenTarget = null; + public bool stuckInTarget = false; + public bool canStick = true; + public Vector2 placementCenter; + float placementDistance; + Vector2 placementVelocity; + public Vector2 storedVelocity; + public bool collideWithTiles = true; + public bool hasHitTile = false; + public Color bColor = Color.Chartreuse; + + public bool ripped = false; + public bool pullingTarget = false; + public bool hasLatchedTarget = false; + public bool spawnPullBlood = true; + public bool calledToPull = false; + public bool strongEnemy = false; + public bool normalHit = false; + + public bool pullCheckValid => ((chosenTarget != null && chosenTarget.life < Projectile.damage * 28f && !calledToPull && chosenTarget.realLife == -1 && !normalHit) || Main.zenithWorld); + public override void SetStaticDefaults() + { + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + } + public Vector2 DrawStartPosition + { + get + { + if (Projectile.owner < 0 || Projectile.owner >= Main.player.Length) + return Vector2.Zero; + return Main.player[Projectile.owner].Center; + } + } public override void SetDefaults() { Projectile.width = 4; Projectile.height = 4; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.alpha = 255; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 900; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { - Player player = Main.player[Projectile.owner]; - if (Main.rand.NextBool(5)) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (calledToPull && !hasLatchedTarget) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Venom, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + ripped = true; + pullingTarget = false; } - Vector2 playerDist = player.Center - Projectile.Center; - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 5f) + if (Projectile.ai[1] > 0) + Projectile.extraUpdates = (int)(MathHelper.Clamp(Projectile.ai[1], 1, 50)); + + if (!stuckInTarget && (!hasHitTile && !returning)) + storedVelocity = Projectile.velocity; + + if (Projectile.velocity.Length() < 7) + collideWithTiles = false; + + if (Main.zenithWorld) { - Projectile.alpha = 0; + returnTime = 90; + Projectile.extraUpdates = 7; } - if (Projectile.ai[1] % 8f == 0f && Projectile.owner == Main.myPlayer && Main.rand.NextBool(5)) + + if (time >= returnTime * (pullCheckValid ? strongEnemy ? 1.5f : 0.9f : stuckInTarget ? 5 : 1) || ripped) { - Vector2 harpoonPos = playerDist * -1f; - harpoonPos.Normalize(); - harpoonPos *= Main.rand.Next(45, 65) * 0.1f; - harpoonPos = harpoonPos.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver2); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, harpoonPos.X, harpoonPos.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.175), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); - } - if (player.dead) - { - Projectile.Kill(); - return; - } - if (Projectile.alpha == 0) - { - if (Projectile.position.X + (float)(Projectile.width / 2) > player.position.X + (float)(player.width / 2)) + stuckInTarget = false; + returning = true; + if (pullCheckValid && chosenTarget != null && spawnPullBlood) { - player.ChangeDir(1); + CalamityGlobalNPC modNPC = chosenTarget.Calamity(); + pullingTarget = true; + canDamage = false; + chosenTarget.damage = 0; + modNPC.pacified = true; + chosenTarget.Center = Projectile.Center; + chosenTarget.velocity = Projectile.velocity; } else { - player.ChangeDir(-1); + canDamage = true; } } - if (Projectile.ai[0] == 0f) + if (hasLatchedTarget && !pullingTarget) { - Projectile.extraUpdates = 2; + chosenTarget.velocity = (storedVelocity * (strongEnemy ? 0.4f : 2)); + storedVelocity *= strongEnemy ? 0.982f : 0.975f; } - else + + if (returning) { - Projectile.extraUpdates = 3; - } - 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)); - if (Projectile.ai[0] == 0f) - { - if (playerDistance > 2000f) + int startTime = 1000; + int endTime = startTime + (int)((pullingTarget ? 45 : ripped ? 25 : 85)); + if (setPosition) { - Projectile.ai[0] = 1f; + SoundStyle pull3 = new("CalamityMod/Sounds/Item/ChainPull"); + SoundEngine.PlaySound(pull3 with { Pitch = (Main.rand.NextFloat(0, 0.05f)), Volume = (Projectile.numHits > 0 && ripped ? 0.6f : 0.4f) }, Owner.Center); + + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + canStick = false; + time = 1000; + CenterX = Projectile.Center.X; + CenterY = Projectile.Center.Y; + setPosition = false; + if (Projectile.numHits > 0 && !pullingTarget) + { + float ripIntensity = ripped ? 2 : 1; + if (ripped) + { + SoundStyle pull = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveIchorShoot"); + SoundStyle pull2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(pull with { Pitch = Main.rand.NextFloat(0, -0.2f), Volume = 0.7f }, Projectile.Center); + SoundEngine.PlaySound(pull2 with { Pitch = Main.rand.NextFloat(0.3f, 0.4f), Volume = 0.9f }, Projectile.Center); + } + else + { + SoundStyle pull = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveShoot3"); + SoundStyle pull2 = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); + SoundEngine.PlaySound(pull with { Pitch = -0.2f, Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(pull2 with { Pitch = -0.6f, Volume = 0.5f }, Projectile.Center); + } + + for (int i = 0; i < 7 * ripIntensity; i++) + { + Vector2 vel = ((Projectile.Center - Owner.Center).SafeNormalize(Vector2.UnitX) * -18).RotatedByRandom(0.2f * ripIntensity) * Main.rand.NextFloat(0.2f, 0.6f) * ripIntensity; + if (i % 3 == 0) + { + Particle spark = new AltLineParticle(Projectile.Center, vel, true, (int)(18 * ripIntensity), Main.rand.NextFloat(0.55f, 0.8f) * ripIntensity, Color.DarkRed * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Particle spark = new GlowOrbParticle(Projectile.Center, vel, true, (int)(18 * ripIntensity), Main.rand.NextFloat(0.55f, 0.8f) * ripIntensity, Color.DarkRed * 0.8f, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, vel * 3, 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + } + + if (!pullingTarget) + { + for (int i = 0; i < 4 + (ripped ? 2 : 0); i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, ((Projectile.Center - Owner.Center).SafeNormalize(Vector2.UnitX) * -18).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.3f, 1.2f), ModContent.ProjectileType(), Projectile.damage / 9, Projectile.knockBack, Projectile.owner, 0); + } + } } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 5f) - { - Projectile.alpha = 0; - } - if (Projectile.ai[1] > 8f) - { - Projectile.ai[1] = 8f; - } - if (Projectile.ai[1] >= 10f) - { - Projectile.ai[1] = 15f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.3f; - } - } - else if (Projectile.ai[0] == 1f) - { - Projectile.tileCollide = false; - Projectile.rotation = (float)Math.Atan2((double)yDist, (double)xDist) - MathHelper.PiOver2; - float returnSpeed = 20f; - if (playerDistance < 50f) - { + + storedVelocity += (Projectile.Center - Owner.Center).SafeNormalize(Vector2.UnitX) * 0.5f; + Projectile.Center = new Vector2(MathHelper.Lerp(CenterX, Owner.Center.X, Utils.GetLerpValue(startTime, endTime, time, true)), MathHelper.Lerp(CenterY, Owner.Center.Y, Utils.GetLerpValue(startTime, endTime, time, true))); + if (time >= endTime) Projectile.Kill(); + + if (time >= endTime - 2 && pullingTarget) + { + if (spawnPullBlood && chosenTarget != null && chosenTarget.life > 0) + { + if (Projectile.ai[1] == 0 && strongEnemy) + { + SoundStyle die2 = new("CalamityMod/Sounds/NPCKilled/PerfHiveDeath"); + SoundEngine.PlaySound(die2 with { Pitch = Main.rand.NextFloat(0.1f, 0.2f), Volume = 0.95f }, Projectile.Center); + SoundStyle die3 = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + SoundEngine.PlaySound(die3 with { Pitch = Main.rand.NextFloat(0f, 0.1f), Volume = 0.85f }, Projectile.Center); + + for (int i = 0; i < 3; i++) + { + Particle orb7 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Maroon, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, (0.5f + i * 0.2f), 30, false); + GeneralParticleHandler.SpawnParticle(orb7); + } + + Owner.Calamity().GeneralScreenShakePower = 8.5f; + } + + SoundStyle die = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + SoundEngine.PlaySound(die with { Pitch = Main.rand.NextFloat(0.2f, 0.3f), Volume = 0.85f }, Projectile.Center); + float intensity = strongEnemy ? 1.2f : 0.5f; + for (int i = 0; i < (int)(40 * intensity); i++) + { + Vector2 vel = (Vector2.One * -28).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.9f) * intensity; + if (i % 3 == 0) + { + Particle spark = new AltLineParticle(Projectile.Center, vel, true, (int)(35), Main.rand.NextFloat(0.55f, 1.3f), Color.DarkRed * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Particle spark = new GlowOrbParticle(Projectile.Center, vel, true, (int)(35), Main.rand.NextFloat(0.55f, 1.3f), Color.DarkRed * 0.8f, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int r = 0; r < 2; r++) + { + Vector2 vel2 = (Vector2.One * -28).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f) * intensity; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, vel2, 100, default, Main.rand.NextFloat(0.9f, 1.7f)); + dust.noGravity = false; + } + if (strongEnemy) + { + Dust dust5 = Dust.NewDustPerfect(Projectile.Center, 278, vel * 0.6f, 0, Color.Red, Main.rand.NextFloat(0.7f, 0.9f)); + dust5.noGravity = false; + } + } + + NPC closestTarget = null; + float distance = 2000; + for (int index = 0; index < Main.npc.Length; index++) + { + if (Main.npc[index].CanBeChasedBy(null, false)) + { + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + bool canHit = true; + + if (Vector2.Distance(Projectile.Center, Main.npc[index].Center) < distance && canHit && Main.npc[index] != chosenTarget) + { + distance = Vector2.Distance(Projectile.Center, Main.npc[index].Center); + closestTarget = Main.npc[index]; + } + } + if (Main.zenithWorld && Main.npc[index] != null && index < 80 && Main.npc[index].realLife == -1 && Owner.ownedProjectileCounts[Type] < 80) + { + closestTarget = Main.npc[index]; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, ((closestTarget.Center - Owner.Center + closestTarget.velocity * 1.5f).SafeNormalize(Vector2.UnitX) * 18), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1] + 1); + } + } + if (closestTarget != null) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, ((closestTarget.Center - Owner.Center + closestTarget.velocity * 1.5f).SafeNormalize(Vector2.UnitX) * 18), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1] + 1); + } + + int heal = 25; + Owner.HealPlayer(heal); + + spawnPullBlood = false; + } + canDamage = true; } - playerDistance = returnSpeed / playerDistance; - xDist *= playerDistance; - yDist *= playerDistance; - Projectile.velocity.X = xDist; - Projectile.velocity.Y = yDist; } + + if ((time <= returnTime * 0.6f && !stuckInTarget || returning && Main.rand.NextBool(5))) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(9, 9), Main.rand.NextBool(7) ? 28 : 215, storedVelocity * Main.rand.NextFloat(0.05f, 0.15f), 0, default, Main.rand.NextFloat(0.5f, 0.9f)); + dust.noGravity = true; + } + + if (stuckInTarget) + { + placementCenter = chosenTarget.Center + placementVelocity * placementDistance + storedVelocity * 2; + + Projectile.Center = placementCenter; + + if (chosenTarget.life <= 0 || chosenTarget == null) + { + returning = true; + stuckInTarget = false; + } + } + else if (time >= returnTime * 0.4f && !returning) + { + Projectile.velocity *= 0.95f; + } + + if (collideWithTiles && Collision.SolidCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30, 4, 4) && !Main.zenithWorld && Projectile.ai[1] < 1) + { + hasHitTile = true; + Projectile.velocity *= -0.5f; + Vector2 sparkVelocity = Projectile.velocity * 3; + for (int i = 0; i < 6; i++) + { + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(Projectile.Center, sparkvelocity1, true, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark1); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/CeramicImpact", 2) with { Pitch = 0.4f, Volume = 0.5f }, Projectile.Center); + } + + time = returnTime * 0.5f; + collideWithTiles = false; + canStick = false; + } + + if (!hasHitTile || returning) + { + Projectile.rotation = storedVelocity.ToRotation() + MathHelper.ToRadians(90f); + } + + if (Projectile.ai[2] == 5 && !pullingTarget && !hasLatchedTarget) + calledToPull = true; + + AdjustOldVelocityArray(); + time++; + } + public void AdjustOldVelocityArray() + { + for (int i = OldVelocities.Length - 1; i > 0; i--) + OldVelocities[i] = OldVelocities[i - 1]; + + OldVelocities[0] = storedVelocity; } - public override bool OnTileCollide(Vector2 oldVelocity) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - Projectile.ai[0] = 1f; - return false; - } + if (!stuckInTarget && canStick) + { + for (int i = 0; i <= 8; i++) + { + Vector2 sparkVelocity = Projectile.velocity * 0.5f; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(Projectile.Center, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); + Particle spark2 = new LineParticle(Projectile.Center, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, sparkvelocity2, 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + } + + time = 1; + collideWithTiles = false; + canDamage = false; + placementDistance = -Vector2.Distance(target.Center, Projectile.Center); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + placementCenter = placementVelocity * (placementDistance * 0.01f); + chosenTarget = target; + stuckInTarget = true; + canStick = false; + storedVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + SoundStyle sound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + + if (pullCheckValid) + { + chosenTarget.velocity += storedVelocity * (strongEnemy ? 0.3f : 1.5f); + hasLatchedTarget = true; + if ((chosenTarget.lifeMax >= Projectile.damage * 28f) || chosenTarget.boss) + strongEnemy = true; + SoundStyle sound5 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); + SoundEngine.PlaySound(sound5 with { Volume = 0.55f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + if (strongEnemy) + { + SoundStyle sound8 = new("CalamityMod/Sounds/Item/MetalEcho"); + SoundEngine.PlaySound(sound8 with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.8f, 0.9f) }, Projectile.Center); + } + } + else + normalHit = true; + } + + bool hitTarget = chosenTarget != null && target == chosenTarget; + modifiers.SourceDamage *= hitTarget ? (ripped ? 2 : Projectile.numHits < 1 ? 0.01f : 1) : 0.2f; + if (hitTarget && pullingTarget) + { + chosenTarget.velocity = -storedVelocity * 3; + modifiers.SetInstantKill(); + } + + if (!pullCheckValid) + target.AddBuff(ModContent.BuffType(), 180); + } + public override bool? CanDamage() => canDamage ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 25 * (!spawnPullBlood ? 4 : 1), targetHitbox); + + public override bool PreDraw(ref Color lightColor) { - target.AddBuff(ModContent.BuffType(), 180); + Player Owner = Main.player[Projectile.owner]; + Texture2D chain = ModContent.Request("CalamityMod/Projectiles/Ranged/SepticChain").Value; + Vector2 end = Projectile.Center - storedVelocity.SafeNormalize(Vector2.UnitX) * 35; + + List controlPoints = new List + { + DrawStartPosition + }; + for (int i = 0; i < OldVelocities.Length; i++) + { + float swayResponsiveness = Utils.GetLerpValue(0f, 6f, i, true) * Utils.GetLerpValue(OldVelocities.Length, OldVelocities.Length - 6f, i, true); + Vector2 swayTotalOffset = OldVelocities[i] * swayResponsiveness; + controlPoints.Add(Vector2.Lerp(DrawStartPosition, end, i / (float)OldVelocities.Length) + swayTotalOffset); + } + controlPoints.Add(end); + + int chainPointCount = (int)(Vector2.Distance(controlPoints.First(), controlPoints.Last()) / 7f); + if (chainPointCount < 12) + chainPointCount = 12; + BezierCurve bezierCurve = new BezierCurve(controlPoints.ToArray()); + List chainPoints = bezierCurve.GetPoints(chainPointCount); + if (hasLatchedTarget) + { + for (int i = 0; i < chainPoints.Count; i++) + { + Vector2 positionAtPoint = chainPoints[i]; + if (Vector2.Distance(Owner.Center, positionAtPoint) > 1400) + continue; + if (Vector2.Distance(positionAtPoint, Projectile.Center) < 10f) + continue; + float angleAtPoint = i == chainPoints.Count - 1 ? (end - chainPoints[i]).ToRotation() : (chainPoints[i + 1] - chainPoints[i]).ToRotation(); + angleAtPoint += MathHelper.PiOver2; + + Main.EntitySpriteDraw(chain, + positionAtPoint - Main.screenPosition + Main.rand.NextVector2Circular(3, 3), + null, + Color.Chartreuse with { A = 0 } * Utils.GetLerpValue(0, returnTime, time, true), + angleAtPoint, + chain.Size() / 2f, + 1.35f, + SpriteEffects.None, + 0); + } + } + for (int i = 0; i < chainPoints.Count; i++) + { + Vector2 positionAtPoint = chainPoints[i]; + if (Vector2.Distance(Owner.Center, positionAtPoint) > 1400) + continue; + if (Vector2.Distance(positionAtPoint, Projectile.Center) < 10f) + continue; + float angleAtPoint = i == chainPoints.Count - 1 ? (end - chainPoints[i]).ToRotation() : (chainPoints[i + 1] - chainPoints[i]).ToRotation(); + angleAtPoint += MathHelper.PiOver2; + + Main.EntitySpriteDraw(chain, + positionAtPoint - Main.screenPosition, + null, + Lighting.GetColor(positionAtPoint.ToTileCoordinates()), + angleAtPoint, + chain.Size() / 2f, + 0.85f, + SpriteEffects.None, + 0); + } + return true; } } } diff --git a/Projectiles/Ranged/SevensStrikerCherry.cs b/Projectiles/Ranged/SevensStrikerCherry.cs index 5bc834bd1d..62daf522cb 100644 --- a/Projectiles/Ranged/SevensStrikerCherry.cs +++ b/Projectiles/Ranged/SevensStrikerCherry.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Ranged; + +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -16,6 +17,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 20; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; Projectile.timeLeft = 300; } diff --git a/Projectiles/Ranged/SevensStrikerHoldout.cs b/Projectiles/Ranged/SevensStrikerHoldout.cs index 8d25d50b28..b94d1e005f 100644 --- a/Projectiles/Ranged/SevensStrikerHoldout.cs +++ b/Projectiles/Ranged/SevensStrikerHoldout.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 19; + Main.projFrames[Type] = 19; } public override void SetDefaults() @@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.alpha = 255; } public override void AI() @@ -94,7 +93,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frameCounter = 0; } // Once the animation is finished, stop rolling, set the extra timer to 16 frames, and reset the sprite to frame 0 - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { rolling = false; rolltimer = 16; @@ -215,7 +214,7 @@ namespace CalamityMod.Projectiles.Ranged // Sounds // Crank & new casino - if (Projectile.frameCounter == 0 && Projectile.frame == 2 * (Main.projFrames[Projectile.type] / 19)) + if (Projectile.frameCounter == 0 && Projectile.frame == 2 * (Main.projFrames[Type] / 19)) { SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.9f }, Projectile.Center); RouletteSoundSlot = SoundEngine.PlaySound(TheSevensStriker.RouletteSound, Projectile.Center); @@ -235,7 +234,7 @@ namespace CalamityMod.Projectiles.Ranged player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } // Calculates which attack will occur based on coin. @@ -320,8 +319,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 armPosition = player.RotatedRelativePoint(player.MountedCenter, true); armPosition += Projectile.velocity.SafeNormalize(player.direction * Vector2.UnitX) * 32f; armPosition.Y -= 20f; - Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(-Vector2.UnitY); - Vector2 gunTip = armPosition + shootDirection * player.ActiveItem().scale * 90f; + Vector2 gunTip = armPosition + Projectile.velocity.SafeNormalize(player.direction * Vector2.UnitX) * player.ActiveItem().scale * 70f; for (int i = 0; i < projcount; ++i) { Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-spreadfactor, spreadfactor, i / 7f)) * scaleFactor; @@ -342,11 +340,12 @@ namespace CalamityMod.Projectiles.Ranged Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? gun.Width - 33f : 33f, 33f); Vector2 drawOffset = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() - Main.screenPosition; drawOffset.Y -= 10; - int indframeheight = gun.Height / Main.projFrames[Projectile.type]; + int indframeheight = gun.Height / Main.projFrames[Type]; int currentframe = indframeheight * Projectile.frame; Rectangle frame = new Rectangle(0, currentframe, gun.Width, indframeheight); - Main.EntitySpriteDraw(gun, drawOffset, frame, lightColor, drawAngle, drawOrigin, Projectile.scale, flip, 0); + // This is full brightness but it's better than random flickering for whatever reason + Main.EntitySpriteDraw(gun, drawOffset, frame, Color.White, drawAngle, drawOrigin, Projectile.scale, flip, 0); return false; } @@ -365,5 +364,8 @@ namespace CalamityMod.Projectiles.Ranged // This gun does not deal melee damage, thanks. public override bool? CanDamage() => false; + + // Has velocity but updates positions manually + public override bool ShouldUpdatePosition() => false; } } diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index fab6292353..94df4dbaac 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); diff --git a/Projectiles/Ranged/Shroom.cs b/Projectiles/Ranged/Shroom.cs index 7952c103f4..0adf02657b 100644 --- a/Projectiles/Ranged/Shroom.cs +++ b/Projectiles/Ranged/Shroom.cs @@ -8,10 +8,13 @@ namespace CalamityMod.Projectiles.Ranged public class Shroom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "Terraria/Images/Item_183"; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -38,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/Shroom.png b/Projectiles/Ranged/Shroom.png deleted file mode 100644 index a6cd029b87..0000000000 Binary files a/Projectiles/Ranged/Shroom.png and /dev/null differ diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index 0140d85c0a..b67f488a47 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index a9334a32eb..0cf0fafcba 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -10,8 +10,9 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -33,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index 919494bf8b..bc9098440e 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -58,18 +58,12 @@ namespace CalamityMod.Projectiles.Ranged { 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; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; if (Projectile.owner == Main.myPlayer) { - for (i = 0; i <= 1; i++) + for (int 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(), (int)(Projectile.damage * 0.35), 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(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 4f) - (MathHelper.Pi / 2f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index efe0d6612b..a89ee193a5 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Ranged { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/SpeedBlasterShot.cs b/Projectiles/Ranged/SpeedBlasterShot.cs index d5258593dc..25f6e366d2 100644 --- a/Projectiles/Ranged/SpeedBlasterShot.cs +++ b/Projectiles/Ranged/SpeedBlasterShot.cs @@ -18,14 +18,15 @@ namespace CalamityMod.Projectiles.Ranged public bool PostDashShot => Projectile.ai[1] == 2f; // the higher velocity post dash shots public Color MainColor; public bool PostHit = false; + public int time = 0; 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 }; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -86,10 +87,10 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (!PostHit) + if (!PostHit && time > (PostDashShot ? 35 : 25)) { - Projectile.velocity *= (DashShot ? 1f : PostDashShot ? 0.985f : 0.97f); - Projectile.velocity.Y += (DashShot ? 0f : PostDashShot ? 0.15f : 0.25f); + Projectile.velocity *= (DashShot ? 1f : 0.945f); + Projectile.velocity.Y += (DashShot ? 0f : 0.6f); } Color ColorUsed = GetColor(Projectile.ai[0]); @@ -109,13 +110,18 @@ namespace CalamityMod.Projectiles.Ranged float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); if (targetDist < 1400f) { - 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); + //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); + //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); + } + if (targetDist < 1400) + { + Particle spark2 = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/SmallBloom", false, 11, 0.15f, MainColor, new Vector2(0.7f, 1.1f), false, false, 0, false, false, 0.65f); + GeneralParticleHandler.SpawnParticle(spark2); } Dust dust = Dust.NewDustPerfect(Projectile.Center, 192); @@ -150,7 +156,7 @@ namespace CalamityMod.Projectiles.Ranged dust.noLight = true; } } - + time++; } public override bool? CanHitNPC(NPC target) => !PostHit ? null : false; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Ranged/SporeBomb.cs b/Projectiles/Ranged/SporeBomb.cs index 8bf8a13126..8dce1067ed 100644 --- a/Projectiles/Ranged/SporeBomb.cs +++ b/Projectiles/Ranged/SporeBomb.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/SproutingArrowMain.cs b/Projectiles/Ranged/SproutingArrowMain.cs index c67de8f3a6..4857e9db0d 100644 --- a/Projectiles/Ranged/SproutingArrowMain.cs +++ b/Projectiles/Ranged/SproutingArrowMain.cs @@ -1,9 +1,14 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.GameContent.Animations.IL_Actions.Sprites; namespace CalamityMod.Projectiles.Ranged { @@ -22,7 +27,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.arrow = true; Projectile.penetrate = -1; Projectile.timeLeft = 35; - Projectile.extraUpdates = 8; + Projectile.extraUpdates = 80; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; @@ -35,12 +40,49 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.ai[0] == 0) { Projectile.damage = (int)(Projectile.damage * 0.3f); - 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.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5; + + Particle orb2 = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 86, Projectile.velocity * 0.1f, "CalamityMod/Particles/BloomArrow", false, 9, 0.7f, Main.rand.NextBool() ? Color.LimeGreen : Color.Lime, new Vector2(0.5f, 4f), true, true, shrinkSpeed: Main.rand.NextFloat(0.1f, 0.3f), glowCenterScale: 0.95f, glowOpacity: 0.8f); + GeneralParticleHandler.SpawnParticle(orb2); } Projectile.ai[0]++; + if (Projectile.timeLeft == 1) + { + for (int index = 0; index < Main.npc.Length; index++) + { + NPC nPC = Main.npc[index]; + float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f); + + if (Utils.Distance(nPC.Center, Projectile.Center) < 15 + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType()) && nPC.CanBeChasedBy() && !hitDirect) + { + float blastSize = 45; + float minMultiplier = 0.4f; + int hitsToMinMult = 4; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25f), 0, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.DamageType = DamageClass.Ranged; + blast.ArmorPenetration = 8; + + hitDirect = true; + + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound((i == 0 ? SoundID.Item53 : SoundID.Item52) with { Pitch = (i == 0 ? 0.9f : 0.5f), Volume = 0.45f, MaxInstances = 2 }, nPC.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.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } @@ -51,40 +93,20 @@ namespace CalamityMod.Projectiles.Ranged 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 * 2), 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 * 2), 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); - if (Projectile.Calamity().allProjectilesHome) // Allows the split arrows to home when using Arterial Assault as well + Particle sparker = new CustomSpark(Projectile.Center, Projectile.velocity.RotatedByRandom(0.9f) * 0.01f, "CalamityMod/Particles/FullStar", false, 10, Main.rand.NextFloat(0.8f, 1.1f) * (hitDirect ? 4 : 2), Color.LimeGreen, new Vector2(1f, 0.5f), true, true, shrinkSpeed: 1f, glowCenterScale: 0.8f, glowOpacity: 0.8f); + GeneralParticleHandler.SpawnParticle(sparker); + Projectile split1 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel1 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), Projectile.damage * 2, 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); + Projectile split2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel2 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), Projectile.damage * 2, 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); + if (Projectile.Calamity().conditionalHomingRange > 0f) // Allows the split arrows to home when using Arterial Assault as well { - Main.projectile[split1].Calamity().allProjectilesHome = true; - Main.projectile[split2].Calamity().allProjectilesHome = true; + split1.Calamity().conditionalHomingRange = Projectile.Calamity().conditionalHomingRange; + split2.Calamity().conditionalHomingRange = Projectile.Calamity().conditionalHomingRange; } - - 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 index 94009910e9..32c8e504c3 100644 --- a/Projectiles/Ranged/SproutingArrowSplit.cs +++ b/Projectiles/Ranged/SproutingArrowSplit.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Items/Ammo/SproutingArrow"; + public bool expanded = false; public override void SetDefaults() { @@ -19,23 +20,29 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 3; Projectile.alpha = 255; Projectile.timeLeft = 450; Projectile.ArmorPenetration = 8; + Projectile.tileCollide = false; } 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; + if (!expanded) + { + Projectile.ExpandHitboxBy(100); + expanded = true; + } } + else + Projectile.tileCollide = true; 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 dust = Dust.NewDustPerfect(Projectile.Center, 264, Projectile.velocity.RotatedByRandom(0.6) * Main.rand.NextFloat(0.05f, 1.5f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.8f, 1.3f); dust.color = Main.rand.NextBool(3) ? Color.MediumAquamarine : Color.Lime; diff --git a/Projectiles/Ranged/SputterComet.cs b/Projectiles/Ranged/SputterComet.cs index 8a519534ad..315818597a 100644 --- a/Projectiles/Ranged/SputterComet.cs +++ b/Projectiles/Ranged/SputterComet.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 306e29e01d..7f227bbb77 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -75,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Ranged/SpykerProj.cs b/Projectiles/Ranged/SpykerProj.cs index 34ccd4eba6..78994fca75 100644 --- a/Projectiles/Ranged/SpykerProj.cs +++ b/Projectiles/Ranged/SpykerProj.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/StarfleetMK2Gun.cs b/Projectiles/Ranged/StarfleetMK2Gun.cs index 9b872555ba..304bdf7b2b 100644 --- a/Projectiles/Ranged/StarfleetMK2Gun.cs +++ b/Projectiles/Ranged/StarfleetMK2Gun.cs @@ -102,7 +102,6 @@ namespace CalamityMod.Projectiles.Ranged { ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), ProjectileID.StarCannonStar, ProjectileID.Starfury }); diff --git a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs index 045c84200e..30c4c325b1 100644 --- a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs +++ b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs @@ -34,8 +34,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Ranged/StarmageddonHeld.cs b/Projectiles/Ranged/StarmageddonHeld.cs index b19eea0f43..87f3bc97ff 100644 --- a/Projectiles/Ranged/StarmageddonHeld.cs +++ b/Projectiles/Ranged/StarmageddonHeld.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + Main.projFrames[Type] = 8; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 7; bool timeToFire = noStars && Projectile.frame == 7; @@ -155,8 +155,8 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Ranged/StarmageddonStar.cs b/Projectiles/Ranged/StarmageddonStar.cs index 9891b14303..1f37ecea6d 100644 --- a/Projectiles/Ranged/StarmageddonStar.cs +++ b/Projectiles/Ranged/StarmageddonStar.cs @@ -23,8 +23,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -77,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; double deg = Projectile.ai[2]; @@ -137,7 +138,6 @@ namespace CalamityMod.Projectiles.Ranged { ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), ProjectileID.StarCannonStar, ProjectileID.Starfury }); @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Ranged int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, speed, type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); if (star.WithinBounds(Main.maxProjectiles)) { - if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) + if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) Main.projectile[star].ai[0] = 1f; Main.projectile[star].extraUpdates += 4; @@ -163,8 +163,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Ranged/StarmageddonStar2.cs b/Projectiles/Ranged/StarmageddonStar2.cs index 1ed3100ebc..99b8d1a175 100644 --- a/Projectiles/Ranged/StarmageddonStar2.cs +++ b/Projectiles/Ranged/StarmageddonStar2.cs @@ -23,8 +23,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -77,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; double deg = Projectile.ai[2]; @@ -137,7 +138,6 @@ namespace CalamityMod.Projectiles.Ranged { ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), ProjectileID.StarCannonStar, ProjectileID.Starfury }); @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Ranged int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, speed, type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); if (star.WithinBounds(Main.maxProjectiles)) { - if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) + if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) Main.projectile[star].ai[0] = 1f; Main.projectile[star].extraUpdates += 4; @@ -163,8 +163,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Ranged/StormSurgeTornado.cs b/Projectiles/Ranged/StormSurgeTornado.cs index a66d24cc72..75f40154c6 100644 --- a/Projectiles/Ranged/StormSurgeTornado.cs +++ b/Projectiles/Ranged/StormSurgeTornado.cs @@ -1,23 +1,24 @@ using System; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class StormSurgeTornado : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Melee/BrinySpout"; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() { - Projectile.width = 66; - Projectile.height = 66; - Projectile.scale = 0.5f; + Projectile.width = 160; + Projectile.height = 42; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -29,35 +30,19 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(Projectile.Center, 0f, 1.25f, 1.25f); - if (Projectile.scale <= 2f) - { - Projectile.scale *= 1.03f; - } - if (Projectile.scale >= 2f) - { - Projectile.Kill(); - } - Projectile.frameCounter++; - if (Projectile.frameCounter > 2) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= 6) - { - Projectile.frame = 0; - } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 0f, 1.25f, 1.25f); + + Projectile.ai[0]++; + Projectile.scale = 0.25f * MathF.Pow(1.03f, Projectile.ai[0]); + + if (Projectile.scale >= 1f) + Projectile.Kill(); + + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Type]; } - public override bool PreDraw(ref Color lightColor) - { - 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 bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); } } diff --git a/Projectiles/Ranged/StormSurgeTornado.png b/Projectiles/Ranged/StormSurgeTornado.png deleted file mode 100644 index c3b106595a..0000000000 Binary files a/Projectiles/Ranged/StormSurgeTornado.png and /dev/null differ diff --git a/Projectiles/Ranged/SulphuricAcidCannonExplosion.cs b/Projectiles/Ranged/SulphuricAcidCannonExplosion.cs new file mode 100644 index 0000000000..7f30d0aa99 --- /dev/null +++ b/Projectiles/Ranged/SulphuricAcidCannonExplosion.cs @@ -0,0 +1,62 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SulphuricAcidCannonExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 400; + Projectile.height = 365; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -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); + } + + public override void OnSpawn(IEntitySource source) + { + base.OnSpawn(source); + int dustAmount = Main.rand.Next(14, 20 + 1); + for (int i = 0; i <= 28; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.3f), 0, default, Main.rand.NextFloat(0.7f, 1.3f)); + dust.noGravity = false; + dust.color = Color.SeaGreen; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); + } +} diff --git a/Projectiles/Ranged/SulphuricBlast.cs b/Projectiles/Ranged/SulphuricBlast.cs deleted file mode 100644 index 5e0e660b4a..0000000000 --- a/Projectiles/Ranged/SulphuricBlast.cs +++ /dev/null @@ -1,89 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SulphuricBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public const int TotalSecondsToStick = 8; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 20; - } - - public override void SetDefaults() - { - Projectile.width = 36; - Projectile.height = 36; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = -1; - Projectile.alpha = 255; - Projectile.MaxUpdates = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 11; - } - - public override void AI() - { - if (Projectile.FinalExtraUpdate()) - Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Projectile.type]; - - Projectile.StickyProjAI(8); - Projectile.Opacity = Utils.GetLerpValue(CalamityUtils.SecondsToFrames(TotalSecondsToStick), CalamityUtils.SecondsToFrames(TotalSecondsToStick * 0.5f), Projectile.localAI[0], true); - - // Emit sulpuric gas. - if (Main.netMode != NetmodeID.Server && Projectile.FinalExtraUpdate() && Projectile.velocity.Length() > 3f) - { - Color color = new Color(136, 211, 113, 127); - Color fadeColor = new Color(165, 165, 86); - Vector2 gasSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); - Vector2 gasVelocity = Projectile.velocity * 1.2f + Projectile.velocity.RotatedBy(0.75f) * 0.3f; - gasVelocity *= Main.rand.NextFloat(0.24f, 0.6f); - - Particle gas = new MediumMistParticle(gasSpawnPosition, gasVelocity, color, fadeColor, Main.rand.NextFloat(0.5f, 1f), 205 - Main.rand.Next(50), 0.02f); - GeneralParticleHandler.SpawnParticle(gas); - } - - // Home in on enemies if not sticking to anything. - if (Projectile.ai[0] != 1f) - { - CalamityUtils.HomeInOnNPC(Projectile, true, 720f, 16f, Projectile.MaxUpdates * 20f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - } - } - - 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) => Projectile.ModifyHitNPCSticky(2); - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - public override bool PreDraw(ref Color lightColor) - { - 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/SulphuricBlast.png b/Projectiles/Ranged/SulphuricBlast.png deleted file mode 100644 index 3d5a42c1ee..0000000000 Binary files a/Projectiles/Ranged/SulphuricBlast.png and /dev/null differ diff --git a/Projectiles/Ranged/SulphuricDrop.cs b/Projectiles/Ranged/SulphuricDrop.cs new file mode 100644 index 0000000000..f987c5725a --- /dev/null +++ b/Projectiles/Ranged/SulphuricDrop.cs @@ -0,0 +1,104 @@ +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 SulphuricDrop : 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.penetrate = 3; + Projectile.timeLeft = 840; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.DamageType = DamageClass.Ranged; + } + public override void AI() + { + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.4f, 0.65f); + dust.velocity = -Projectile.velocity * 0.4f; + dust.color = Color.SeaGreen; + } + if (Projectile.velocity.Y < 0f) + { + Projectile.velocity.Y *= 0.97f; + } + else + { + Projectile.velocity.Y *= 1.03f; + if (Projectile.velocity.Y > 16f) + { + Projectile.velocity.Y = 16f; + } + } + if (Projectile.velocity.Y > -1f && Projectile.localAI[1] == 0f) + { + Projectile.localAI[1] = 1f; + Projectile.velocity.Y = 1f; + } + Projectile.velocity.X *= 0.995f; + if (Projectile.ai[0] >= 2f) + { + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + { + Projectile.alpha = 0; + } + } + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 5; ++i) + { + int bloodLifetime = Main.rand.Next(22, 25); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.SeaGreen, Color.Lime, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + } + 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/SuperradiantBolt.cs b/Projectiles/Ranged/SuperradiantBolt.cs index 00e2a11ccd..2ba1733524 100644 --- a/Projectiles/Ranged/SuperradiantBolt.cs +++ b/Projectiles/Ranged/SuperradiantBolt.cs @@ -20,8 +20,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 20); - Texture2D glow = TextureAssets.Projectile[Projectile.type].Value; + Texture2D glow = TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; } diff --git a/Projectiles/Ranged/SuperradiantSaw.cs b/Projectiles/Ranged/SuperradiantSaw.cs index 023582e299..b6e808d15f 100644 --- a/Projectiles/Ranged/SuperradiantSaw.cs +++ b/Projectiles/Ranged/SuperradiantSaw.cs @@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -61,10 +61,6 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - // Deadshot Brooch makes me die inside - if (Projectile.MaxUpdates > 1) - Projectile.MaxUpdates = 1; - // Timer and rotation Time++; Projectile.rotation += MathHelper.ToRadians(6f + 18f * SawLevel); @@ -85,7 +81,8 @@ namespace CalamityMod.Projectiles.Ranged if (Empowered && !Returning && Time > 30) { float homingTurnSpeed = 0.2f; - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.MouseWorld).ToRotation(), homingTurnSpeed).ToRotationVector2() * SuperradiantSlaughterer.ShootSpeed; + Vector2 mouse = Owner.ClampedMouseWorld(); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(mouse).ToRotation(), homingTurnSpeed).ToRotationVector2() * SuperradiantSlaughterer.ShootSpeed; } // Saws automatically return 2 seconds after hitting an enemy @@ -353,7 +350,7 @@ namespace CalamityMod.Projectiles.Ranged } // Draw the saw itself at full brightness - Texture2D buzzsawTexture = TextureAssets.Projectile[Projectile.type].Value; + Texture2D buzzsawTexture = TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(buzzsawTexture, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, buzzsawTexture.Size() * 0.5f, 1f, SpriteEffects.None); if (Empowered) // Rainbow outline while empowered @@ -363,7 +360,7 @@ namespace CalamityMod.Projectiles.Ranged Main.EntitySpriteDraw(outline, Projectile.Center - Main.screenPosition, null, Main.DiscoColor, Projectile.rotation, outline.Size() * 0.5f, 1f, SpriteEffects.None); } - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return false; // Special afterimage drawing to include the slashes diff --git a/Projectiles/Ranged/SuperradiantSawLingering.cs b/Projectiles/Ranged/SuperradiantSawLingering.cs index e576590ff9..2397d1ca85 100644 --- a/Projectiles/Ranged/SuperradiantSawLingering.cs +++ b/Projectiles/Ranged/SuperradiantSawLingering.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -45,10 +45,6 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - // dies from cringe (Deadshot Brooch moment) - if (Projectile.MaxUpdates > 1) - Projectile.MaxUpdates = 1; - // Timer and rotation Time++; Projectile.rotation += MathHelper.ToRadians(42f); @@ -174,14 +170,14 @@ namespace CalamityMod.Projectiles.Ranged } // Draw the saw itself at full brightness, glow and outline in rainbow - Texture2D buzzsawTexture = TextureAssets.Projectile[Projectile.type].Value; + Texture2D buzzsawTexture = TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(buzzsawTexture, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, buzzsawTexture.Size() * 0.5f, 1f, SpriteEffects.None); SawOutline ??= ModContent.Request("CalamityMod/Projectiles/Ranged/SuperradiantSawOutline"); Texture2D outline = SawOutline.Value; Main.EntitySpriteDraw(outline, Projectile.Center - Main.screenPosition, null, Main.DiscoColor, Projectile.rotation, outline.Size() * 0.5f, 1f, SpriteEffects.None); - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return false; // Special afterimage drawing to include the slashes diff --git a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs index 0306b7f797..24ba2a20b3 100644 --- a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs +++ b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -82,8 +82,9 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition); // Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x) - float mouseDist = Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld) / 21f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * mouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); + float clampedMouseDist = MathHelper.Clamp(Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld), 0f, 960f); + float adjustedMouseDist = clampedMouseDist / 21f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); // Special case: right-clicking while not holding left-click // This is to keep it friendly to use both fires at the same time, but end the animation early if not @@ -328,7 +329,7 @@ namespace CalamityMod.Projectiles.Ranged if (Time / ChargeupTime >= 0.25f) Main.EntitySpriteDraw(smallSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor, Time * MathHelper.ToRadians(42f), smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None); - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return false; // Special afterimage drawing for the slashes only diff --git a/Projectiles/Ranged/SurgeDriverHoldout.cs b/Projectiles/Ranged/SurgeDriverHoldout.cs index b0542bac73..dbc776ec05 100644 --- a/Projectiles/Ranged/SurgeDriverHoldout.cs +++ b/Projectiles/Ranged/SurgeDriverHoldout.cs @@ -65,6 +65,7 @@ namespace CalamityMod.Projectiles.Ranged projectileType = ModContent.ProjectileType(); knockback = Owner.GetWeaponKnockback(heldItem, knockback); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(-Vector2.UnitY); Vector2 shootVelocity = shootDirection * shootSpeed; diff --git a/Projectiles/Ranged/TauCannonBeam.cs b/Projectiles/Ranged/TauCannonBeam.cs new file mode 100644 index 0000000000..d61422d5c2 --- /dev/null +++ b/Projectiles/Ranged/TauCannonBeam.cs @@ -0,0 +1,115 @@ +using CalamityMod.Buffs.DamageOverTime; +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.ModLoader; +using static CalamityMod.Projectiles.Ranged.TauCannonHoldout; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TauCannonBeam : BaseLaserbeamProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public override float Lifetime => IsStage3Laser ? 90 : 25; + + public override float MaxScale => IsStage3Laser ? 4f : 1f; + + public override float MaxLaserLength => 2000f; + + private const string LaserTexturePath = "CalamityMod/ExtraTextures/Lasers/TauCannonBeam"; + public override Texture2D LaserBeginTexture => Request(LaserTexturePath + "Start").Value; + public override Texture2D LaserMiddleTexture => Request(LaserTexturePath + "Middle").Value; + public override Texture2D LaserEndTexture => Request(LaserTexturePath + "End").Value; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private Projectile Holdout => Main.projectile[(int)Projectile.ai[1]]; + + private bool IsStage3Laser => Projectile.ai[2] == 1f; + public Color color1 = Color.MediumTurquoise; + public Color color2 = Color.Coral; + + private Player Owner { get; set; } + + private SlotId BigBeamSoundSlot; + public int time = 0; + + public override void SetDefaults() + { + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.usesLocalNPCImmunity = true; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 90); + + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * (IsStage3Laser ? 1 : 0.75f)); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, IsStage3Laser ? 70f : 10f, ref _); + } + + public override void UpdateLaserMotion() + { + Projectile.velocity = Holdout.velocity; + Projectile.rotation = Holdout.velocity.ToRotation() - MathHelper.PiOver2; + } + + public override void AttachToSomething() + { + if (Owner == null || !Owner.active || Owner.dead || Owner.CCed || Owner.noItems || Owner.ownedProjectileCounts[ProjectileType()] == 0 || Holdout.ModProjectile() == null) + return; + Projectile.Center = Holdout.ModProjectile().GunTipPosition + Holdout.velocity * (IsStage3Laser ? 20f : 5f); + } + + public override void ExtraBehavior() + { + Owner ??= Main.player[Projectile.owner]; + Projectile.localNPCHitCooldown = IsStage3Laser ? 4 : -1; + + float Lifet = Lifetime - time; + if (!SoundEngine.TryGetActiveSound(BigBeamSoundSlot, out var sound)) + BigBeamSoundSlot = SoundEngine.PlaySound(BigBeamSound with { Volume = 0.01f, IsLooped = true }, Projectile.Center); + else + { + sound.Position = Projectile.Center; + sound.Volume = Utils.GetLerpValue(0, 20, Lifet, true) * 100; + sound.Pitch = (1 - 1 * Utils.GetLerpValue(0, 20, Lifet, true)) * -1; + } + + Vector2 effectsPosition = Vector2.Lerp(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, Main.rand.NextFloat()); + Vector2 randomLineEffectPosition = effectsPosition + Main.rand.NextVector2Circular(40f * (IsStage3Laser ? 1.2f : 0.8f), 40f * (IsStage3Laser ? 1.2f : 0.8f)); + + Dust laserDust = Dust.NewDustPerfect(randomLineEffectPosition, 278, Projectile.velocity * Main.rand.NextFloat(5f, 40f), Scale: Main.rand.NextFloat(0.8f, 1.1f)); + laserDust.noGravity = true; + laserDust.color = Main.rand.NextBool(3) ? color2 : color1; + + for (int i = 0; i < 2; i++) + { + randomLineEffectPosition = effectsPosition + Main.rand.NextVector2Circular(50f * (IsStage3Laser ? 1.2f : 0.8f), 50f * (IsStage3Laser ? 1.2f : 0.8f)); + Particle spark2 = new LineParticle(randomLineEffectPosition, Projectile.velocity * Main.rand.NextFloat(20f, 90f), false, 18, 0.8f, Main.rand.NextBool(3) ? color2 : color1); + GeneralParticleHandler.SpawnParticle(spark2); + } + + time++; + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(BigBeamSoundSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + } +} diff --git a/Projectiles/Ranged/TauCannonBolt.cs b/Projectiles/Ranged/TauCannonBolt.cs new file mode 100644 index 0000000000..491ebfcdd0 --- /dev/null +++ b/Projectiles/Ranged/TauCannonBolt.cs @@ -0,0 +1,83 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +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 TauCannonBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Color turquoiseColor = Color.MediumTurquoise; + public Color coralColor = Color.Coral; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Ranged; + Projectile.width = Projectile.height = 32; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.extraUpdates = 1; + } + + public override void AI() + { + if (Main.dedServ) + return; + if (Main.rand.NextBool(10)) + { + Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 278, Scale: Main.rand.NextFloat(0.5f, 0.8f)); + trailDust.noGravity = true; + trailDust.color = Main.rand.NextBool(3) ? coralColor : turquoiseColor; + } + + Particle orb = new CustomSpark(Projectile.Center, Projectile.velocity, "CalamityMod/Projectiles/StarProj",false, 2, 1f, Color.Lerp(turquoiseColor, Color.White, 0.7f), new Vector2(1f, 1f)); + GeneralParticleHandler.SpawnParticle(orb); + + if (Projectile.ai[2] == 5) + CalamityUtils.HomeInOnNPC(Projectile, true, 500f, 15f, 50f); + } + + public override void OnKill(int timeLeft) + { + if (Main.dedServ) + return; + + int dustAmount = Main.rand.Next(5, 10); + for (int i = 0; i < dustAmount; i++) + { + Dust boomDust = Dust.NewDustPerfect(Projectile.Center, 278, (MathHelper.TwoPi / dustAmount * i).ToRotationVector2() * Main.rand.NextFloat(5f, 8f), Scale: Main.rand.NextFloat(0.6f, 1f)); + boomDust.noGravity = true; + boomDust.color = Main.rand.NextBool(3) ? coralColor : turquoiseColor; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + } + private float WidthFunction(float completionRatio) => Projectile.scale * 32f * CalamityUtils.Convert01To010(completionRatio); + + private Color ColorFunction(float completionRatio) => Color.Lerp(turquoiseColor, Color.Transparent, completionRatio) * Utils.GetLerpValue(0f, 30f, Projectile.timeLeft, true); + + public override bool PreDraw(ref Color lightColor) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"])); + return false; + } + } +} diff --git a/Projectiles/Ranged/TauCannonHoldout.cs b/Projectiles/Ranged/TauCannonHoldout.cs new file mode 100644 index 0000000000..216a74c57f --- /dev/null +++ b/Projectiles/Ranged/TauCannonHoldout.cs @@ -0,0 +1,368 @@ +using System.IO; +using CalamityMod.Items; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TauCannonHoldout : BaseGunHoldoutProjectile + { + #region Fields & Properties + + private ref float Timer => ref Projectile.ai[0]; + + private bool HasShotBeam + { + get => Projectile.ai[1] == 1f; + set => Projectile.ai[1] = value == true ? 1f : 0f; + } + + private enum AIState { Level0, Level1, Level2, Level3 }; + + private const float TimePerCharge = 60f; + private float ChargeLV1 => TimePerCharge; + private float ChargeLV2 => TimePerCharge * 2; + private float ChargeLV3 => TimePerCharge * 3; + + private AIState State => Timer switch + { + >= TimePerCharge * 3 => AIState.Level3, + >= TimePerCharge * 2 => AIState.Level2, + >= TimePerCharge => AIState.Level1, + _ => AIState.Level0, + }; + + private const int CoolingDownTime = 40; + + public bool hasReachedLV1 = false; + public bool hasReachedLV2 = false; + public bool hasReachedLV3 = false; + + public Color color1 = Color.MediumTurquoise; + public Color color2 = Color.Coral; + + #region Overriden Base Holdout Members + + public override int AssociatedItemID => ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 3f * Projectile.spriteDirection; + public override float WeaponTurnSpeed => HasShotBeam ? Utils.Remap(Timer, 0f, TimePerCharge * 2f, 0.4f, 0.018f, true) : 0.4f; + public override float MaxOffsetLengthFromArm => 30f; + public override float OffsetXUpwards => -15f; + public override float OffsetXDownwards => 5f; + public override float BaseOffsetY => -15f; + public override float OffsetYUpwards => 10f; + public override float OffsetYDownwards => 15f; + + #endregion + + #region SoundStyles & SlotsIDs + + public static readonly SoundStyle ChargeLV1Sound = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV1") { Volume = 0.6f }; + public static readonly SoundStyle ChargeLV2Sound = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV2") { Volume = 0.6f }; + public static readonly SoundStyle OrbSound = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLoop"); + public static readonly SoundStyle BoltShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/ExoLaserShoot") { Volume = 0.1f, PitchVariance = 0.3f }; + public static readonly SoundStyle SmallBeamSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusMine") { Volume = 0.2f, PitchVariance = 0.1f }; + public static readonly SoundStyle BigBeamSound = new("CalamityMod/Sounds/Item/PhotoUseSound"); + public static readonly SoundStyle CoolingDownSound = new("CalamityMod/Sounds/Custom/ExoMechs/ThanatosVent") { Volume = 0.025f }; + private SlotId OrbSoundSlot; + private SlotId CoolingDownSoundSlot; + + #endregion + + #endregion + + public override void KillHoldoutLogic() + { + // If the holdout hasn't reached any charge and the player's isn't holding the weapon anymore: kill it. + if (State == AIState.Level0 && Owner.CantUseHoldout()) + Projectile.Kill(); + + // At all times, don't allow the holdout to persist if the player dies or is no longer active. + if (!Owner.active || Owner.dead) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + CalamityGlobalItem modItem = Owner.ActiveItem().Calamity(); + + if (Owner.CantUseHoldout() && KeepRefreshingLifetime) + { + KeepRefreshingLifetime = false; + Projectile.timeLeft = State switch + { + AIState.Level1 => 54 + CoolingDownTime + 1, + AIState.Level2 => 30 + CoolingDownTime + 1, + AIState.Level3 => 95 + CoolingDownTime + 1, + _ => 0, + }; + Projectile.netUpdate = true; + } + + if (KeepRefreshingLifetime == false && Main.myPlayer == Projectile.owner) + { + switch (State) + { + case AIState.Level1: + + if (Projectile.timeLeft % 4 == 0 && Projectile.timeLeft > CoolingDownTime && Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), + GunTipPosition, + Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.25f) * HeldItem.shootSpeed, + ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + OffsetLengthFromArm -= 5f; + SoundEngine.PlaySound(BoltShootSound with { Volume = 0.3f, Pitch = 0.8f }, GunTipPosition); + } + + if (!HasShotBeam) + { + modItem.Charge -= 0.2f; + HasShotBeam = true; + } + + break; + + case AIState.Level2: + + if (!HasShotBeam && Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectile( + Projectile.GetSource_FromThis(), + GunTipPosition, + Projectile.velocity, + ProjectileType(), + (int)(Projectile.damage * 13f), + Projectile.knockBack * 3, + Projectile.owner, + ai1: Projectile.whoAmI); + OffsetLengthFromArm -= 25f; + modItem.Charge -= 0.8f; + HasShotBeam = true; + SoundEngine.PlaySound(SmallBeamSound, GunTipPosition); + } + + break; + + case AIState.Level3: + + if (!HasShotBeam) + { + if (Projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile( + Projectile.GetSource_FromThis(), + GunTipPosition + Projectile.velocity * 25f, + Projectile.velocity, + ProjectileType(), + (int)(Projectile.damage * 0.7f), + Projectile.knockBack * 5, + Projectile.owner, + ai1: Projectile.whoAmI, + ai2: 1f); + + int randomPortalAmount = Main.rand.Next(4, 5+1); + for (int i = 0; i < randomPortalAmount; i++) + { + Projectile.NewProjectile( + Projectile.GetSource_FromThis(), + Owner.Center + Main.rand.NextVector2CircularEdge(480f, 480f) * Main.rand.NextFloat(0.8f, 1.2f), + Vector2.Zero, + ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + } + } + + modItem.Charge -= 2.5f; + HasShotBeam = true; + } + + if (Projectile.timeLeft > CoolingDownTime) + { + if (Projectile.timeLeft % 6f == 0f) + { + Particle ring = new DirectionalPulseRing(GunTipPosition - Projectile.velocity * 10f, Projectile.velocity * 5f, Main.rand.NextBool(3) ? color2 : color1, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.6f, 15); + GeneralParticleHandler.SpawnParticle(ring); + } + + if (Main.rand.NextBool(2)) + { + Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(4f, 9f), Main.rand.NextBool(3) ? color2 : color1, 17, Main.rand.NextFloat(0.9f, 1.7f), 0.7f, 0, true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + break; + } + } + + if (Timer == ChargeLV1 && !hasReachedLV1 || Timer == ChargeLV2 && !hasReachedLV2 || Timer == ChargeLV3 && !hasReachedLV3) + { + if (Timer == ChargeLV1 && !hasReachedLV1) + { + PerLevelChargeEffect(State); + hasReachedLV1 = true; + } + if (Timer == ChargeLV2 && !hasReachedLV2) + { + PerLevelChargeEffect(State); + hasReachedLV2 = true; + } + if (Timer == ChargeLV3 && !hasReachedLV3) + { + PerLevelChargeEffect(State); + hasReachedLV3 = true; + } + } + + if (Projectile.timeLeft < CoolingDownTime && !KeepRefreshingLifetime && Timer > TimePerCharge) + { + if (Projectile.timeLeft % 3 == 0) + { + Particle heat = new MediumMistParticle( + Projectile.Center - Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.4f, + -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(5f, 12f), + Color.DarkGray, + Color.Transparent, + Main.rand.NextFloat(0.6f, 0.9f), + Main.rand.NextFloat(300f, 400f)); + GeneralParticleHandler.SpawnParticle(heat); + } + SoundStyle steam = new("CalamityMod/Sounds/Item/HeliumFlashSteamRelease"); + if (!SoundEngine.TryGetActiveSound(CoolingDownSoundSlot, out var sound)) + CoolingDownSoundSlot = SoundEngine.PlaySound(steam with { Volume = 0.5f, Pitch = -0.5f }, GunTipPosition); + else + sound.Position = Projectile.Center; + } + + if (KeepRefreshingLifetime) + { + if (Main.rand.NextBool(4)) + { + float randomRadius = Utils.Remap(Timer, 0f, TimePerCharge * 3f, 5f, 15f); + Dust orbDust = Dust.NewDustPerfect( + GunTipPosition + Main.rand.NextVector2Circular(randomRadius, randomRadius), + 278, + -Vector2.UnitY.RotatedByRandom(100) * Main.rand.NextFloat(2f, 5f) * Utils.Remap(Timer, 0f, TimePerCharge * 3f, 1f, 5f), + Scale: Main.rand.NextFloat(0.3f, 0.9f)); + orbDust.noGravity = true; + orbDust.color = Main.rand.NextBool(3) ? color2 : color1; + } + + Particle orb = new GenericBloom(GunTipPosition, Projectile.velocity, color1, Utils.Remap(Timer, 0f, TimePerCharge * 3f, 0f, 1f), 2, false); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new GenericBloom(GunTipPosition, Projectile.velocity, Color.White, Utils.Remap(Timer, 0f, TimePerCharge * 3f, 0f, 0.8f), 2, false); + GeneralParticleHandler.SpawnParticle(orb2); + + float distanceFromTip = Utils.Remap(Timer, 0f, TimePerCharge * 3f, 25f, 300f); + float sizeIncrease = Utils.Remap(Timer, 0f, TimePerCharge * 3f, 0.05f, 0.4f); + Particle lineCharge = new ManaDrainStreak(Owner, sizeIncrease, Main.rand.NextVector2Circular(distanceFromTip, distanceFromTip), Main.rand.NextFloat(5f, 10f), Color.White, Main.rand.NextBool(3) ? color2 : color1, Main.rand.Next(10, 21), GunTipPosition); + GeneralParticleHandler.SpawnParticle(lineCharge); + + if (!SoundEngine.TryGetActiveSound(OrbSoundSlot, out var sound)) + OrbSoundSlot = SoundEngine.PlaySound(OrbSound with { Volume = 0.01f, Pitch = -1, IsLooped = true }, GunTipPosition); + else + { + sound.Position = Projectile.Center; + sound.Volume = Utils.GetLerpValue(0, ChargeLV2, Timer, true) * 100; + sound.Pitch = 1 * Utils.GetLerpValue(0, ChargeLV2, Timer, true); + } + } + + if (KeepRefreshingLifetime == true) + Timer++; + + if (Projectile.timeLeft <= 1 || (KeepRefreshingLifetime == false)) + { + if (SoundEngine.TryGetActiveSound(OrbSoundSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + } + + private void PerLevelChargeEffect(AIState state) + { + int dustAmount = state switch + { + AIState.Level3 => 36, + AIState.Level2 => 24, + AIState.Level1 => 12, + }; + + for (int i = 0; i < dustAmount; i++) + { + float angle = MathHelper.TwoPi / dustAmount * i; + Vector2 velocity = angle.ToRotationVector2() * 8f; + Dust chargeDust = Dust.NewDustPerfect(GunTipPosition, 267, velocity, Scale: Utils.Remap(dustAmount, 10f, 30f, 1.5f, 2.2f)); + chargeDust.noGravity = true; + chargeDust.noLight = true; + chargeDust.noLightEmittence = true; + chargeDust.color = Main.rand.NextBool(3) ? color2 : color1; + } + + Particle chargeRing = new DirectionalPulseRing( + GunTipPosition, + Vector2.Zero, + color1, + Vector2.One, + 0f, + 1f, + 0f, + 30); + GeneralParticleHandler.SpawnParticle(chargeRing); + + SoundStyle chargeSound = state switch + { + AIState.Level3 => ChargeLV2Sound, + AIState.Level2 => ChargeLV1Sound, + AIState.Level1 => ChargeLV1Sound, + }; + + SoundEngine.PlaySound(chargeSound, GunTipPosition); + } + + public override bool PreDraw(ref Color lightColor) + { + if (Timer < 2) + return false; + Texture2D texture = Request(Texture, AssetRequestMode.AsyncLoad).Value; + Texture2D glowTexture = Request(GlowTexture, AssetRequestMode.AsyncLoad).Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color glowDrawColor = Color.Lerp(Color.Black, Color.White, Utils.GetLerpValue(0f, TimePerCharge * 3f, Timer, true)); + 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.timeLeft > CoolingDownTime || KeepRefreshingLifetime == true) + { + float shake = KeepRefreshingLifetime ? Utils.Remap(Timer, TimePerCharge, TimePerCharge * 3f, 0f, 4f) : 3f; + drawPosition += Main.rand.NextVector2Circular(shake, shake); + } + if (Timer >= ChargeLV2 && KeepRefreshingLifetime == true) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(texture, drawPosition + Main.rand.NextVector2Circular(12, 12) * Utils.GetLerpValue(ChargeLV2, ChargeLV3, Timer, true), null, color1 with { A = 0 } * Utils.GetLerpValue(ChargeLV2, ChargeLV3, Timer, true), drawRotation, rotationPoint, Projectile.scale, flipSprite); + } + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(glowTexture, drawPosition, null, glowDrawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + return false; + } + + public override void SendExtraAIHoldout(BinaryWriter writer) => writer.Write7BitEncodedInt(Projectile.timeLeft); + + public override void ReceiveExtraAIHoldout(BinaryReader reader) => Projectile.timeLeft = reader.Read7BitEncodedInt(); + } +} diff --git a/Projectiles/Ranged/TauCannonPortal.cs b/Projectiles/Ranged/TauCannonPortal.cs new file mode 100644 index 0000000000..a3b5a0852b --- /dev/null +++ b/Projectiles/Ranged/TauCannonPortal.cs @@ -0,0 +1,104 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TauCannonPortal : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public override string Texture => "CalamityMod/ExtraTextures/GreyscaleVortex"; + public Color color1 = Color.Coral; + public Color color2 = Color.MediumTurquoise; + private float Scale01 + { + get + { + if (Projectile.timeLeft > 360) + return Utils.GetLerpValue(420f, 360f, Projectile.timeLeft, true); + + if (Projectile.timeLeft >= 60 && Projectile.timeLeft <= 360) + return 1f; + + if (Projectile.timeLeft < 60) + return Utils.GetLerpValue(0f, 60f, Projectile.timeLeft, true); + + return 0f; + } + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Ranged; + Projectile.width = Projectile.height = 100; + Projectile.timeLeft = 420; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5 * Projectile.MaxUpdates; + Projectile.extraUpdates = 2; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + => CalamityUtils.CircularHitboxCollision(Projectile.Center, 100f * Scale01, targetHitbox); + + public override void AI() + { + Projectile.rotation += MathHelper.ToRadians(1.5f) * Scale01; + + if (Projectile.timeLeft < 300) + { + Player Owner = Main.player[Projectile.owner]; + Vector2 moveTotarget = (Owner.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 15) + Projectile.velocity += moveTotarget * 0.05f; + else + Projectile.velocity *= 0.98f; + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= 0.08f; + + public override void OnKill(int timeLeft) + { + if (Main.myPlayer == Projectile.owner) + { + int randomBoltAmount = Main.rand.Next(9, 12+1); + float starterAngle = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < randomBoltAmount; i++) + { + float angle = starterAngle + (MathHelper.TwoPi / randomBoltAmount * i); + Vector2 velocity = angle.ToRotationVector2() * 14f; + Projectile.NewProjectile( + Projectile.GetSource_FromThis(), + Projectile.Center, + velocity, + ModContent.ProjectileType(), + (int)(Projectile.damage * 0.65f), + Projectile.knockBack, + Projectile.owner, 0, 0, 5); + } + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 anchorPoint = texture.Size() * 0.5f; + for (int i = 0; i < 13; i++) + Main.EntitySpriteDraw(texture, drawPosition, null, Color.Lerp(color1, Color.White, i * 0.075f) with { A = 0 } * Scale01 * 0.45f, Projectile.rotation * 3 - i * 0.15f, anchorPoint, MathHelper.Clamp(Scale01 * 0.375f - i * 0.02f, 0, 5), SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs index 5cfd0ef4b3..5e6bb758a4 100644 --- a/Projectiles/Ranged/TelluricGlareArrow.cs +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -2,10 +2,10 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; 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; @@ -18,15 +18,16 @@ namespace CalamityMod.Projectiles.Ranged public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; private const int Lifetime = 180; - private static Color ShaderColorOne = new Color(237, 194, 66); - private static Color ShaderColorTwo = new Color(235, 227, 117); - private static Color ShaderEndColor = new Color(199, 153, 26); + + public int time = 0; + public int fadeTime = 22; + public bool colorAlt = false; 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; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 21; } public override void SetDefaults() @@ -39,15 +40,68 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.timeLeft = Lifetime; Projectile.MaxUpdates = 3; - Projectile.penetrate = 2; // Can hit up to two enemies. Will explode extremely soon after hitting the first, though. + Projectile.penetrate = -1; // Can hit many enemies. Will explode extremely soon after hitting the first, though. Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } - public override bool? CanDamage() => Projectile.timeLeft < Lifetime - 4 ? null : false; + public override bool? CanDamage() => (Projectile.timeLeft < Lifetime - 4) ? null : false; - public override void AI() => Lighting.AddLight(Projectile.Center, ShaderColorOne.ToVector3()); + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3()); + if (time % 8 == 0 && time > 6) + { + bool isSpark = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(Projectile.Center, isSpark ? 278 : ModContent.DustType(), (Projectile.velocity * 2).RotatedByRandom(0.2f) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.velocity *= (isSpark ? 0.5f : 1); + dust.scale = Main.rand.NextFloat(0.95f, 1.25f) * (isSpark ? 0.9f : 1); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + if (isSpark) + dust.noGravity = false; + else + dust.noLightEmittence = true; + } + if (time == 4) + { + for (int i = 0; i < 5; i++) + { + if (i < 3) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.15f); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + dust.noLightEmittence = true; + } + else + { + Particle spark = new CustomSpark(Projectile.Center, (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.3f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle spark2 = new GlowSparkParticle(Projectile.Center, (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 1f), false, 9, 0.017f, Color.Goldenrod, new Vector2(1.5f, 0.7f), true, false, 1.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + if (time == 0) + colorAlt = Main.rand.NextBool(); + if (Projectile.timeLeft < 8 && fadeTime > 0) + { + Projectile.velocity *= 0.92f; + Projectile.scale -= 0.023f; + fadeTime--; + Projectile.timeLeft++; + if (fadeTime == 6) + { + Particle spark2 = new GlowSparkParticle(Projectile.Center, Projectile.velocity, false, 7, 0.012f, Color.Goldenrod, new Vector2(1.5f, 0.7f), true, false, 2); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + time++; + } private void RestrictLifetime() { @@ -68,12 +122,25 @@ namespace CalamityMod.Projectiles.Ranged { RestrictLifetime(); target.AddBuff(ModContent.BuffType(), 180); - } + // Explode into a bunch of holy fire. + for (int i = 0; i < 3; i++) + { + LineParticle spark2 = new LineParticle(Projectile.Center + Main.rand.NextVector2Circular(13, 13), Projectile.velocity * Main.rand.NextFloat(0.5f, 2.1f), false, 12, 1.1f, colorAlt ? (Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod) : (Main.rand.NextBool(5) ? Color.Goldenrod : Color.DarkGoldenrod)); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } private float PrimitiveWidthFunction(float completionRatio) { float arrowheadCutoff = 0.36f; - float width = 39f; + float width = 29f * Projectile.scale; float minHeadWidth = 0.02f; float maxHeadWidth = width; if (completionRatio <= arrowheadCutoff) @@ -92,10 +159,10 @@ namespace CalamityMod.Projectiles.Ranged float cosArgument = completionRatio * completionRatioFactor - Main.GlobalTimeWrappedHourly * globalTimeFactor + endFadeTerm; float startingInterpolant = (float)Math.Cos(cosArgument) * 0.5f + 0.5f; - float colorLerpFactor = 0.6f; - Color startingColor = Color.Lerp(ShaderColorOne, ShaderColorTwo, startingInterpolant * colorLerpFactor); + float colorLerpFactor = 0.8f; + Color startingColor = Color.Lerp(colorAlt ? Color.DarkGoldenrod : Color.Goldenrod, Color.Khaki, startingInterpolant * colorLerpFactor); - return Color.Lerp(startingColor, ShaderEndColor, MathHelper.SmoothStep(0f, 1f, Utils.GetLerpValue(0f, endFadeRatio, completionRatio, true))); + return Color.Lerp(startingColor, colorAlt ? (Color.DarkGoldenrod with { A = 0 } * 0.8f) : (Color.Goldenrod * 0.8f), MathHelper.SmoothStep(0f, 1f, Utils.GetLerpValue(0f, endFadeRatio, completionRatio, true))); } public override bool PreDraw(ref Color lightColor) @@ -107,32 +174,5 @@ namespace CalamityMod.Projectiles.Ranged PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), numPoints); return false; } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - - // Explode into a bunch of holy fire on death. - for (int i = 0; i < 10; i++) - { - Dust holyFire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); - holyFire.velocity *= 3f; - - if (Main.rand.NextBool()) - { - holyFire.scale = 0.5f; - holyFire.fadeIn = Main.rand.NextFloat(1f, 2f); - } - } - for (int i = 0; i < 20; i++) - { - Dust holyFire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); - holyFire.noGravity = true; - holyFire.velocity *= 5f; - - holyFire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); - holyFire.velocity *= 2f; - } - } } } diff --git a/Projectiles/Ranged/TheHiveHoldout.cs b/Projectiles/Ranged/TheHiveHoldout.cs index a282f52ad9..6be2de4d51 100644 --- a/Projectiles/Ranged/TheHiveHoldout.cs +++ b/Projectiles/Ranged/TheHiveHoldout.cs @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGBarrageLaunch"); SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = 0.1f }, Projectile.Center); - Projectile.NewProjectileDirect( + Projectile.NewProjectile( Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * 0.3f, @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = (shootDirection).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectileDirect( + Projectile.NewProjectile( Projectile.GetSource_FromThis(), GunTipPosition, perturbedSpeed * projSpeed * VelocityMultiplier, @@ -245,7 +245,7 @@ namespace CalamityMod.Projectiles.Ranged if (ShootingTimer <= 0) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D glowTexture = Request(GlowTexture).Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Color drawColor = Projectile.GetAlpha(lightColor); diff --git a/Projectiles/Ranged/TheMaelstromExplosion.cs b/Projectiles/Ranged/TheMaelstromExplosion.cs index 77bc361ffb..e8a8318177 100644 --- a/Projectiles/Ranged/TheMaelstromExplosion.cs +++ b/Projectiles/Ranged/TheMaelstromExplosion.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 75; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 75; } public override void SetDefaults() @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Opacity = Projectile.scale * Utils.GetLerpValue(0f, 30f, Projectile.timeLeft, true); // Emit sparks and dust. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int sparkLifetime = Main.rand.Next(22, 36); float sparkScale = Main.rand.NextFloat(1f, 1.3f); @@ -61,13 +61,13 @@ namespace CalamityMod.Projectiles.Ranged } } - 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 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); public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 2af536ec39..a9a4037ffe 100644 --- a/Projectiles/Ranged/TheMaelstromShark.cs +++ b/Projectiles/Ranged/TheMaelstromShark.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.arrow = true; Projectile.penetrate = 1; + Projectile.extraUpdates = 1; Projectile.Opacity = 0f; Projectile.DamageType = DamageClass.Ranged; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.spriteDirection = (Math.Cos(Projectile.rotation) > 0f).ToDirectionInt(); @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged { // Create death effects for the shark, including a death sound, gore, and some blood. SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity, Mod.Find("MaelstromReaperShark1").Type, Projectile.scale); Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity, Mod.Find("MaelstromReaperShark2").Type, Projectile.scale); @@ -91,8 +92,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.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; SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; diff --git a/Projectiles/Ranged/ThePackMinissile.cs b/Projectiles/Ranged/ThePackMinissile.cs index 57f02cb569..7044b1bbb1 100644 --- a/Projectiles/Ranged/ThePackMinissile.cs +++ b/Projectiles/Ranged/ThePackMinissile.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Ranged/ThePackMissile.cs b/Projectiles/Ranged/ThePackMissile.cs index 9a369c0616..6d16b07aaf 100644 --- a/Projectiles/Ranged/ThePackMissile.cs +++ b/Projectiles/Ranged/ThePackMissile.cs @@ -11,9 +11,10 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -112,7 +113,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/TheStormLightningShot.cs b/Projectiles/Ranged/TheStormLightningShot.cs new file mode 100644 index 0000000000..8dc6f6328c --- /dev/null +++ b/Projectiles/Ranged/TheStormLightningShot.cs @@ -0,0 +1,124 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TheStormLightningShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public bool homing = true; + public bool hasZaged = false; + public int zagDirection = 1; + public Vector2 effectVel; + public NPC closestTarget; + public float colorValue = 0; + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 3; + Projectile.extraUpdates = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 20; // Fast weapon go brr + Projectile.timeLeft = 300; + } + + public override void AI() + { + if (time == 0) + { + if (Projectile.ai[0] == 5) + { + Projectile.extraUpdates = 60; + Projectile.penetrate = -1; + } + colorValue += Main.rand.Next(0, 20); + zagDirection = Main.rand.NextBool() ? 1 : -1; + effectVel = Projectile.velocity; + } + colorValue = MathHelper.Lerp(colorValue, 50, 0.035f); + Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)); + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (targetDist < 1400f) + { + if (Projectile.timeLeft % 2 == 0) + { + Particle spark2 = new BoltParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 7, 0.3f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(35)) + { + Particle spark2 = new BoltParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.3f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + if (time % 15 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, (effectVel * 10) * Main.rand.NextFloat(-0.4f, -0.7f), 0, default, Main.rand.NextFloat(0.45f, 0.6f)); + dust.noGravity = true; + dust.color = usedColor; + effectVel = Projectile.velocity.RotatedBy(0.2f * zagDirection * (hasZaged ? 1 : 0.5f)) * 0.08f; + } + if (time % 20 == 0) + { + hasZaged = true; + zagDirection *= -1; + } + + closestTarget = Projectile.Center.ClosestNPCAt(900); + if (closestTarget != null && homing && Projectile.ai[0] < 5) + { + float moveSpeed = Utils.GetLerpValue(300, 250, Projectile.timeLeft, true); + CalamityUtils.HomeInOnSelectedNPC(Projectile, closestTarget, true, moveSpeed, 12, 0.97f, accelerate: true); + + colorValue = MathHelper.Lerp(50, 0, Utils.GetLerpValue(500, 0, Vector2.Distance(closestTarget.Center, Projectile.Center), true)); + } + if (!homing && Projectile.velocity.Length() < 12) + Projectile.velocity *= 1.01f; + + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (target != closestTarget && Projectile.ai[0] < 5) + { + Projectile.numHits--; + Projectile.penetrate++; + } + else + { + colorValue = Main.rand.Next(0, 10); + homing = false; + } + + target.AddBuff(BuffID.Electrified, 90); + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, (Projectile.velocity * 4).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(0.6f, 0.8f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid; + } + } + } +} diff --git a/Projectiles/Ranged/TitaniumRailgunScope.cs b/Projectiles/Ranged/TitaniumRailgunScope.cs index 9d79448e35..c9daab4596 100644 --- a/Projectiles/Ranged/TitaniumRailgunScope.cs +++ b/Projectiles/Ranged/TitaniumRailgunScope.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Ranged public Player Owner => Main.player[Projectile.owner]; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary. All uses are direction only. public Vector2 MousePosition => Owner.Calamity().mouseWorld - Owner.MountedCenter; public const float WeaponLength = 52f; public const float MaxSightAngle = MathHelper.Pi * (2f / 3f); @@ -169,7 +170,7 @@ namespace CalamityMod.Projectiles.Ranged // Converge the sights float spread = (1f - ChargePercent) * MaxSightAngle; float halfAngle = spread / 2f; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Color sightsColor = Color.Lerp(Color.LightBlue, Color.Crimson, ChargePercent); diff --git a/Projectiles/Ranged/ToxicArrow.png b/Projectiles/Ranged/ToxicArrow.png index a791e861f1..d837cc26d5 100644 Binary files a/Projectiles/Ranged/ToxicArrow.png and b/Projectiles/Ranged/ToxicArrow.png differ diff --git a/Projectiles/Ranged/TyphoonBubble.cs b/Projectiles/Ranged/TyphoonBubble.cs index 85307684f9..08be6cba30 100644 --- a/Projectiles/Ranged/TyphoonBubble.cs +++ b/Projectiles/Ranged/TyphoonBubble.cs @@ -9,11 +9,11 @@ namespace CalamityMod.Projectiles.Ranged public class TyphoonBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Melee/BrinyTyphoonBubble"; + public override string Texture => "Terraria/Images/Projectile_385"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() diff --git a/Projectiles/Ranged/UltimaBolt.cs b/Projectiles/Ranged/UltimaBolt.cs index 588d3b154c..2c321b7ad7 100644 --- a/Projectiles/Ranged/UltimaBolt.cs +++ b/Projectiles/Ranged/UltimaBolt.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public const int MaxBounces = 1; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; } public override void SetDefaults() @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 4a7d7e186b..6dfb5da650 100644 --- a/Projectiles/Ranged/UltimaBowProjectile.cs +++ b/Projectiles/Ranged/UltimaBowProjectile.cs @@ -65,6 +65,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shotPosition = player.RotatedRelativePoint(player.MountedCenter, true); shotPosition += Projectile.velocity.ToRotation().ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(40f)).RotatedBy(-0.25f * Projectile.spriteDirection) * 42f; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = player.SafeDirectionTo(Main.MouseWorld); Vector2 shotVelocity = Projectile.velocity * shotSpeed; // The velocity should always be a unit vector. diff --git a/Projectiles/Ranged/UltimaSpark.cs b/Projectiles/Ranged/UltimaSpark.cs index 1bf45cc6f3..a8e4e13bf0 100644 --- a/Projectiles/Ranged/UltimaSpark.cs +++ b/Projectiles/Ranged/UltimaSpark.cs @@ -1,6 +1,7 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -16,6 +17,8 @@ namespace CalamityMod.Projectiles.Ranged } public const int DustType = 261; public const float MaxHomingDistance = 1200f; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 8; diff --git a/Projectiles/Ranged/UniversalGenesisStar.cs b/Projectiles/Ranged/UniversalGenesisStar.cs index 5f3a7af876..9eabd1a422 100644 --- a/Projectiles/Ranged/UniversalGenesisStar.cs +++ b/Projectiles/Ranged/UniversalGenesisStar.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.penetrate = 5; Projectile.timeLeft = 180; + Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } @@ -43,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged } } Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.2f, 16, 1f); Main.gore[idx].velocity *= 0.66f; @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged { 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) + if (Main.rand.NextBool(20) && !Main.dedServ) { 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); } @@ -67,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DrawStarTrail(Color.Blue, Color.White); //Draw the actual projectile - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[idx].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Ranged/UniversalGenesisStarcaller.cs b/Projectiles/Ranged/UniversalGenesisStarcaller.cs index 2c95e6bdeb..fc22e9fde8 100644 --- a/Projectiles/Ranged/UniversalGenesisStarcaller.cs +++ b/Projectiles/Ranged/UniversalGenesisStarcaller.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Ranged { 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) + if (!Main.dedServ) { for (int g = 0; g < 3; g++) { diff --git a/Projectiles/Ranged/VanquisherArrowProj.cs b/Projectiles/Ranged/VanquisherArrowProj.cs index d2f4555ac3..b0c39fb9b8 100644 --- a/Projectiles/Ranged/VanquisherArrowProj.cs +++ b/Projectiles/Ranged/VanquisherArrowProj.cs @@ -21,10 +21,12 @@ namespace CalamityMod.Projectiles.Ranged public bool Phase2 = false; public float HomingTime = 0; public Color MainColor; + public NPC targeted; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { @@ -35,8 +37,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.arrow = true; Projectile.penetrate = 2; - Projectile.timeLeft = 1200; - Projectile.extraUpdates = 8; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 7; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 15 * Projectile.extraUpdates; @@ -52,25 +54,28 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Time > 4f && Main.rand.NextBool(4)) + if (Time > 4f && Main.rand.NextBool(6)) { 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); + dust.noLightEmittence = true; } + if (Phase2 == false) + targeted = Projectile.Center.ClosestNPCAt(165); - NPC target = Projectile.Center.ClosestNPCAt(65); - - if (target != null) + if (targeted != null) { - //Projectile.velocity = Projectile.velocity.RotatedByRandom(0.1f); Phase2 = true; HomingTime = 1; } if (HomingTime == 1) + { + Projectile.timeLeft++; CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 12, 200f); + } Time++; } @@ -78,7 +83,7 @@ namespace CalamityMod.Projectiles.Ranged 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); + Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Width, Terraria.GameContent.TextureAssets.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); } @@ -105,19 +110,21 @@ namespace CalamityMod.Projectiles.Ranged } 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); + if (Projectile.numHits > 0) + { + 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; + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; if (Time > 6) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], MainColor * 0.3f, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], MainColor * 0.3f, 1, texture); return true; } } diff --git a/Projectiles/Ranged/VeriumBoltProj.cs b/Projectiles/Ranged/VeriumBoltProj.cs index cfe3975f58..3c62464ca2 100644 --- a/Projectiles/Ranged/VeriumBoltProj.cs +++ b/Projectiles/Ranged/VeriumBoltProj.cs @@ -14,8 +14,8 @@ namespace CalamityMod.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; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -34,8 +34,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, 0, Color.Plum); - return true; + CalamityUtils.DrawAfterimagesCentered(Projectile, 2, Color.Plum); + return false; } public override void AI() diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs index 690d4b33da..ada7f27283 100644 --- a/Projectiles/Ranged/Voidragon.cs +++ b/Projectiles/Ranged/Voidragon.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,8 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[extraDust].velocity = value3 * 0.66f; Main.dust[extraDust].position = Projectile.Center + value3 * 12f; } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int voidGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[voidGore].velocity *= 0.66f; @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged { 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) + if (Main.rand.NextBool(20) && !Main.dedServ) { 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); } @@ -93,10 +94,13 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } - + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } public override void OnKill(int timeLeft) { if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index fd74bc6e11..b46c5fb43a 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -112,8 +112,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/WildfireBloomFlare.cs b/Projectiles/Ranged/WildfireBloomFlare.cs index d0a4586228..f21d9f5d93 100644 --- a/Projectiles/Ranged/WildfireBloomFlare.cs +++ b/Projectiles/Ranged/WildfireBloomFlare.cs @@ -16,8 +16,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 18; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 18; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -48,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D lightTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D lightTexture = Terraria.GameContent.TextureAssets.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/WulfrumScrapBullet.cs b/Projectiles/Ranged/WulfrumScrapBullet.cs index 09cfa52d89..908adae75c 100644 --- a/Projectiles/Ranged/WulfrumScrapBullet.cs +++ b/Projectiles/Ranged/WulfrumScrapBullet.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile.cs b/Projectiles/Rogue/AbyssalMirrorProjectile.cs index b08dea9d1e..514bdfd82d 100644 --- a/Projectiles/Rogue/AbyssalMirrorProjectile.cs +++ b/Projectiles/Rogue/AbyssalMirrorProjectile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() diff --git a/Projectiles/Rogue/AcidBarrelDrop.cs b/Projectiles/Rogue/AcidBarrelDrop.cs index 0591f2951a..d635b81c3f 100644 --- a/Projectiles/Rogue/AcidBarrelDrop.cs +++ b/Projectiles/Rogue/AcidBarrelDrop.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Rogue/AcidShrapnel.cs b/Projectiles/Rogue/AcidShrapnel.cs index 4feb1b9207..8797e58c73 100644 --- a/Projectiles/Rogue/AcidShrapnel.cs +++ b/Projectiles/Rogue/AcidShrapnel.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Rogue public bool HitTile = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index 39a07ff343..9c28fd938f 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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; } @@ -79,25 +79,24 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) { - // Stolen from Twisting Thunder, the old "lightning" effect was so puny -CIT + // Stolen from Twisting Thunder, the old "lightning" effect was just ???? -CIT SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Projectile.position); - var source = Projectile.GetSource_FromThis(); for (int n = 0; n < 4; n++) { - Vector2 spawnPoint = new Vector2(Projectile.Center.X + (float)Main.rand.Next(-20, 21), Projectile.Center.Y - (float)Main.rand.Next(700, 801)); + Vector2 spawnPoint = new Vector2(Projectile.Center.X + Main.rand.NextFloat(-20f, 20f), Projectile.Center.Y - Main.rand.NextFloat(700f, 800f)); 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; + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.Pi / 10f)) * 9f; + + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnPoint, velocity, ProjectileID.CultistBossLightningOrbArc, Projectile.damage, Projectile.knockBack, Projectile.owner, ai0.ToRotation(), Main.rand.NextFloat(100f), 1f); + proj.extraUpdates += 14; + proj.friendly = true; + proj.hostile = false; + proj.tileCollide = false; + proj.penetrate = 3; + proj.usesLocalNPCImmunity = true; + proj.localNPCHitCooldown = -1; } } } diff --git a/Projectiles/Rogue/AlphaSeeker.cs b/Projectiles/Rogue/AlphaSeeker.cs deleted file mode 100644 index 7d91a5bc1f..0000000000 --- a/Projectiles/Rogue/AlphaSeeker.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class AlphaSeeker : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - private const float MaxSpeed = 15f; - private const float HomingStartRange = 400f; - - public static float moveSpeed = 2f; - public static float rotateSpeed = 0.04f; - public static int lifetime = 120; - public static int returnTime = 60; - public bool initialized = false; - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = lifetime; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.Calamity().CannotProc = true; - Projectile.extraUpdates = 1; - } - - public override void AI() - { - if (!initialized) - { - Projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); - Projectile.localAI[1] = Main.rand.NextFloat(-rotateSpeed, rotateSpeed); - initialized = true; - } - - // ai[0], when set to 1, makes the projectile cling to a parent projectile instead. - // in this case, ai[1] is the index of the parent projectile. - // otherwise, ai[1] is the index of the homing target, because it homes in. - if (Projectile.ai[0] == 1f) - { - // projectile.localAI[0] controls the distance from the parent projectile - Projectile.tileCollide = false; - - Projectile parent = Main.projectile[0]; - bool active = false; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.identity == Projectile.ai[1]) - { - parent = p; - active = true; - } - } - - if (active) - { - Vector2 pos = new Vector2(0, Projectile.localAI[0]); - pos = pos.RotatedBy(Projectile.rotation); - - Projectile.Center = parent.Center + pos; - Projectile.rotation += Projectile.localAI[1]; - - if (Projectile.timeLeft > returnTime) - { - Projectile.localAI[0] += moveSpeed; - } - else - { - Projectile.localAI[0] -= moveSpeed; - } - - // Also look for an enemy to home in on every few frames. If you find one, switch to homing mode. - if (Projectile.timeLeft % 6 == 0) - { - int targetID = AcquireTarget(); - if (targetID != -1) - { - Projectile.ai[0] = 0f; // Switch to homing mode - Projectile.ai[1] = targetID + 1f; // Already have a target loaded in - } - } - } - else - { - Projectile.Kill(); - } - } - else - { - HomingAI(); - } - - 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; - } - - // TODO -- shamelessly copied from Nanoblack Reaper. This should be made into a Utils function ASAP - private void HomingAI() - { - // If we don't currently have a target, go try and get one! - int targetID = (int)Projectile.ai[1] - 1; - if (targetID < 0) - targetID = AcquireTarget(); - - // Save the target, whether we have one or not. - Projectile.ai[1] = targetID + 1f; - - // If there's no target, just don't do anything. Otherwise home in. - if (targetID < 0) - return; - NPC target = Main.npc[targetID]; - - // Adds a multiple of the towards-target vector to its velocity every frame. - float homingFactor = 2.5f; - Vector2 posDiff = target.Center - Projectile.Center; - posDiff = posDiff.SafeNormalize(Vector2.Zero); - posDiff *= homingFactor; - Vector2 newVelocity = Projectile.velocity += posDiff; - - // Caps speed to make sure it doesn't go too fast. - if (newVelocity.Length() >= MaxSpeed) - { - newVelocity = newVelocity.SafeNormalize(Vector2.Zero); - newVelocity *= MaxSpeed; - } - - Projectile.velocity = newVelocity; - } - - // TODO -- shamelessly copied from Nanoblack Reaper. This should be made into a Utils function ASAP - private int AcquireTarget() - { - int target = -1; - float minDist = HomingStartRange; - foreach (var npc in Main.ActiveNPCs) - { - if (npc.type == NPCID.TargetDummy) - continue; - - if (npc.CanBeChasedBy(Projectile, false)) - { - float xDist = Projectile.Center.X - npc.Center.X; - float yDist = Projectile.Center.Y - npc.Center.Y; - float distToNPC = (float)Math.Sqrt(xDist * xDist + yDist * yDist); - if (distToNPC < minDist) - { - minDist = distToNPC; - target = npc.whoAmI; - } - } - } - return target; - } - - 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/AlphaSeeker.png b/Projectiles/Rogue/AlphaSeeker.png deleted file mode 100644 index 787c983f6d..0000000000 Binary files a/Projectiles/Rogue/AlphaSeeker.png and /dev/null differ diff --git a/Projectiles/Rogue/AlphaVirusAura.png b/Projectiles/Rogue/AlphaVirusAura.png deleted file mode 100644 index 6fb7bdd5fe..0000000000 Binary files a/Projectiles/Rogue/AlphaVirusAura.png and /dev/null differ diff --git a/Projectiles/Rogue/AlphaVirusProjectile.cs b/Projectiles/Rogue/AlphaVirusProjectile.cs deleted file mode 100644 index 37249a4dc7..0000000000 --- a/Projectiles/Rogue/AlphaVirusProjectile.cs +++ /dev/null @@ -1,217 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.NPCs.StormWeaver; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class AlphaVirusProjectile : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/AlphaVirus"; - - public static int lifetime = 600; - public static float finalVelocity = 2f; - public static float decelerationRate = 0.07f; - private const float radius = 100f; - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 5; - Projectile.timeLeft = lifetime; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; - Projectile.extraUpdates = 1; - } - - public override void AI() - { - Projectile.rotation += 0.05f * Projectile.direction; - - if (Projectile.Calamity().stealthStrike) - { - if (Projectile.ai[0] > finalVelocity) - { - Projectile.ai[0] -= decelerationRate; - if (Projectile.ai[0] < finalVelocity) - { - Projectile.ai[0] = finalVelocity; - } - - Projectile.velocity.Normalize(); - Projectile.velocity *= Projectile.ai[0]; - } - if (Projectile.timeLeft < lifetime - 30 && Projectile.timeLeft % 15 == 0 && Projectile.ai[0] <= finalVelocity) - { - int projID = ModContent.ProjectileType(); - int damage = (int)(Projectile.damage * 0.125f); - float kb = 1f; - float ai0 = 1f; // Stealth strike spawned seekers set ai[0] to 1, which makes them cling to the parent projectile. - Vector2 vel = Main.rand.NextVector2CircularEdge(5f, 5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel, projID, damage, kb, Projectile.owner, ai0, Projectile.identity); - } - } - else - { - Projectile.timeLeft--; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - 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 minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; - - if (minDist <= Projectile.width) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - 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 minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; - - if (minDist <= Projectile.width) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } - - 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 minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; - - if (minDist > Projectile.width) - { - modifiers.SourceDamage *= 0.2f; - modifiers.Knockback *= 0f; - } - } - - public override bool PreDraw(ref Color lightColor) - { - // Aura effect - Texture2D aura = ModContent.Request("CalamityMod/Projectiles/Rogue/AlphaVirusAura").Value; - float scaleStep = 0.03f; - float rotationOffset = 0.03f; - float drawTransparency = 0.1f; - - if (Projectile.timeLeft > lifetime - 10) - { - drawTransparency = (lifetime - Projectile.timeLeft) * (drawTransparency / 10); - } - else if (Projectile.timeLeft < 25) - { - drawTransparency = Projectile.timeLeft * (drawTransparency / 25); - } - - Color drawCol = Color.White; - - for (int i = 0; i < 10; i++) - { - Main.EntitySpriteDraw(aura, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, -(Projectile.rotation * 0.2f) + (rotationOffset * i * i), aura.Size() / 2f, Projectile.scale - (i * scaleStep), SpriteEffects.None, 0); - } - - // Dust - for (int i = 0; i < (lifetime - Projectile.timeLeft) / 30; i++) - { - float min = Projectile.width / 2; - float max = radius; - - Vector2 pos = new Vector2(0f, -Main.rand.NextFloat(min, max)); - pos = pos.RotatedByRandom(MathHelper.TwoPi); - Vector2 velocity = -pos * 0.02f; - pos += Projectile.Center; - - 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 = 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 bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - Projectile.Kill(); - return false; - } - - public override void OnKill(int timeLeft) - { - int numSeekers = 6; - int damage = Projectile.damage; - float kb = 1f; - float speed = 10f; - for (int i = 0; i < numSeekers; i++) - { - Vector2 velocity = (MathHelper.Pi * i / 3f).ToRotationVector2() * speed; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), damage, kb, Projectile.owner, 0f, 0f); - } - - int numDust = 20; - for (int i = 0; i < numDust; i++) - { - float min = Projectile.width / 2; - float max = radius; - - Vector2 velocity = new Vector2(0f, -Main.rand.NextFloat(min, max)); - velocity = velocity.RotatedByRandom(MathHelper.TwoPi); - velocity *= 0.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; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); - } -} diff --git a/Projectiles/Rogue/AntlionSkewerProj.cs b/Projectiles/Rogue/AntlionSkewerProj.cs new file mode 100644 index 0000000000..d5352afbda --- /dev/null +++ b/Projectiles/Rogue/AntlionSkewerProj.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AntlionSkewerProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/AntlionSkewer"; + + public ref float Time => ref Projectile.ai[0]; + + public static float TimeToSpit => 15f; + public static float TimeToAccelerate => 30f; + public static int StealthExtraSpit = 4; + public static float SandBlastDamage = 0.5f; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 180; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; + Projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + + Time++; + if (Time == TimeToSpit && Projectile.owner == Main.myPlayer) + { + SoundEngine.PlaySound(Projectile.Calamity().stealthStrike ? SoundID.NPCDeath13 : SoundID.Item17, Projectile.Center); + + var source = Projectile.GetSource_FromThis(); + if (Projectile.Calamity().stealthStrike) + { + for (int i = 0; i < 9; i++) + { + float offset = MathHelper.ToRadians(MathHelper.Lerp(-30f, 30f, i / 8f)); + Vector2 spreadVel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(offset) * (i % 2 == 0 ? 6f : 4f); + Projectile.NewProjectile(source, Projectile.Center, spreadVel, ModContent.ProjectileType(), 0, 0f, Projectile.owner); + } + + for (int i = 0; i < StealthExtraSpit; i++) + { + Vector2 velocity = Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(24f)); + Projectile.NewProjectile(source, Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * SandBlastDamage), Projectile.knockBack * SandBlastDamage, Projectile.owner); + } + } + + Projectile.NewProjectile(source, Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * SandBlastDamage), Projectile.knockBack * SandBlastDamage, Projectile.owner); + } + + if (Time > TimeToSpit && Time <= TimeToSpit + TimeToAccelerate) + Projectile.velocity *= 1.015f; + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); + return false; + } + } +} diff --git a/Projectiles/Rogue/AntlionSkewerSandBlast.cs b/Projectiles/Rogue/AntlionSkewerSandBlast.cs new file mode 100644 index 0000000000..b73072d373 --- /dev/null +++ b/Projectiles/Rogue/AntlionSkewerSandBlast.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AntlionSkewerSandBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "Terraria/Images/Projectile_" + ProjectileID.SandBallGun; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 60 * Projectile.MaxUpdates; + Projectile.DamageType = RogueDamageClass.Instance; + } + + public override void AI() + { + Projectile.rotation += 0.1f; + if (Main.rand.NextBool()) + { + Dust sand = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5f, 5f), DustID.Sand, Main.rand.NextVector2Circular(2f, 2f)); + sand.noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/AntlionSkewerSandCloud.cs b/Projectiles/Rogue/AntlionSkewerSandCloud.cs new file mode 100644 index 0000000000..db9e2423b6 --- /dev/null +++ b/Projectiles/Rogue/AntlionSkewerSandCloud.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AntlionSkewerSandCloud : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; + public ref float CloudHue => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 256; + Projectile.friendly = true; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; + Projectile.DamageType = RogueDamageClass.Instance; + } + + public override void AI() + { + if (CloudHue == 0f) + { + Projectile.scale = Main.rand.NextFloat(1f, 1.7f); + Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); + CloudHue = Main.rand.NextFloat(0.08f, 0.18f); + } + + Projectile.rotation += Projectile.velocity.X * 0.004f; + Projectile.velocity *= 0.985f; + Projectile.Opacity = Utils.GetLerpValue(300f, 240f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); + + foreach (NPC target in Main.ActiveNPCs) + { + if (CalamityUtils.CircularHitboxCollision(Projectile.Center, 80f, target.Hitbox)) + target.Calamity().antlionCloudDebuffTimer = 30; + } + } + + public override bool? CanDamage() => false; + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + width = height = 160; + return true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.velocity != oldVelocity) + Projectile.velocity = Main.rand.NextFloat(-1.15f, -0.85f) * oldVelocity; + return false; + } + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 origin = texture.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color mainColor = Main.hslToRgb(CloudHue, 1f, 0.7f) * Projectile.Opacity * 0.3f; + Main.EntitySpriteDraw(texture, drawPosition, null, mainColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Color secondColor = Main.hslToRgb(MathHelper.Lerp(CloudHue, 0.15f, 0.6f), 1f, 0.7f) * Projectile.Opacity * 0.3f; + Main.EntitySpriteDraw(texture, drawPosition, null, secondColor, Projectile.rotation + MathHelper.PiOver2, origin, Projectile.scale, SpriteEffects.None, 0); + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index 8362bf5a60..c233a5a823 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -1,15 +1,11 @@ using System; -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Dusts; using CalamityMod.Particles; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Typeless; 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.Rogue { @@ -62,6 +58,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[2] > 0 && time == 0) { closestTarget = Projectile.Center.ClosestNPCAt(2000); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction storedVelocity = ((closestTarget == null ? Owner.Calamity().mouseWorld : closestTarget.Center) - Projectile.Center).SafeNormalize(Vector2.UnitX); Projectile.alpha = 255; Projectile.velocity = Vector2.Zero; @@ -131,11 +128,7 @@ namespace CalamityMod.Projectiles.Rogue } if (closestTarget != null && Projectile.numHits < 1 && closestTarget.CanBeChasedBy(Projectile)) { - Vector2 moveTotarget = (closestTarget.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 16) - Projectile.velocity += moveTotarget * 0.85f; - else - Projectile.velocity *= 0.8f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 0.95f, 16, 0.96f); } } } @@ -149,11 +142,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Center = placementCenter; - if (Main.rand.NextBool()) + if (Main.rand.NextBool(4)) { - int dustStyle = Main.rand.NextBool() ? 66 : 263; + int dustStyle = ModContent.DustType(); Dust dust = Dust.NewDustPerfect(portalSpot, dustStyle, Projectile.velocity); - dust.scale = Main.rand.NextFloat(0.4f, 0.8f); + dust.scale = Main.rand.NextFloat(0.6f, 1.1f); dust.velocity = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f) * Utils.GetLerpValue(180, 0, stuckTimer); dust.noGravity = true; dust.color = Color.LightGreen; @@ -206,6 +199,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Center = portalSpot; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction if (closestTarget == null) Projectile.velocity = (Projectile.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * -16; else @@ -213,10 +207,11 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i <= 12; i++) { - int dustStyle = Main.rand.NextBool() ? 66 : 263; + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + int dustStyle = ModContent.DustType(); Dust dust2 = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity); - dust2.scale = Main.rand.NextFloat(0.5f, 1.1f); - dust2.velocity = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); + dust2.scale = Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance); + dust2.velocity = Projectile.velocity.RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)); dust2.noGravity = true; dust2.color = Color.LightGreen; } @@ -247,9 +242,9 @@ namespace CalamityMod.Projectiles.Rogue for (int k = 0; k < 8; k++) { Vector2 partPos = Projectile.Center + storedVelocity.SafeNormalize(Vector2.UnitX) * 68; - Color colorType = Main.rand.NextBool() ? Color.LightGreen : Color.Black; - Particle spark3 = new GlowOrbParticle(partPos, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), false, 19, Main.rand.NextFloat(0.6f, 1f), colorType, colorType == Color.Black ? false : true, false, colorType == Color.Black ? false : true); - GeneralParticleHandler.SpawnParticle(spark3); + Dust dust = Dust.NewDustPerfect(partPos, ModContent.DustType(), new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(1.4f, 1.75f)); + dust.noGravity = true; + dust.color = Color.LightGreen; } } @@ -260,7 +255,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.88f); + Projectile.damage = (int)(Projectile.damage * 0.83f); if (Projectile.damage < 1) Projectile.damage = 1; @@ -321,6 +316,8 @@ namespace CalamityMod.Projectiles.Rogue Main.EntitySpriteDraw(portal.Value, portalDrawPos, null, Color.Black * (1 - fading * 0.3f), 0, portal.Size() * 0.5f, 1.8f * portalFading, SpriteEffects.None); Main.EntitySpriteDraw(portal.Value, portalDrawPos, null, Color.LightGreen with { A = 0 } * (1 - fading), 0, portal.Size() * 0.5f, 1.1f * portalFading, SpriteEffects.None); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 expectedVel = ((closestTarget == null ? Owner.Calamity().mouseWorld : closestTarget.Center) - portalSpot).SafeNormalize(Vector2.UnitX); if (true) { @@ -335,11 +332,10 @@ namespace CalamityMod.Projectiles.Rogue if (!canStick || stuckInTarget) { - for (int i = 0; i < 4; i++) + for (int i = 0; i < 7; i++) { - Color auraColor = Color.Lerp(Color.LightGreen, Color.White, Utils.GetLerpValue(0, 4, i)) * (1 - fading); - Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); - rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f + (!canStick ? 1.5f : 0)); + Color auraColor = Color.LightGreen * (1 - fading); + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f).ToRotationVector2() * 3; Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, (auraColor * alpha) with { A = 0 }, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, storedVelocity.X > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically); } } diff --git a/Projectiles/Rogue/ApoctolithExplosion.cs b/Projectiles/Rogue/ApoctolithExplosion.cs new file mode 100644 index 0000000000..2016e7b790 --- /dev/null +++ b/Projectiles/Rogue/ApoctolithExplosion.cs @@ -0,0 +1,47 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ApoctolithExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 300; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Projectile.ai[0] == 0f) + { + float screenShakePower = 7 * Utils.GetLerpValue(1300f, 0f, Projectile.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + + CustomPulse blastRing1 = new(Projectile.Center, Vector2.Zero, Color.Blue, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f, 0.35f, 15); + GeneralParticleHandler.SpawnParticle(blastRing1); + + CustomPulse blastRing2 = new(Projectile.Center, Vector2.Zero, Color.Blue, "CalamityMod/Particles/FlameExplosion", new(1f, 0.5f), 0, 0.05f, 0.35f, 20); + GeneralParticleHandler.SpawnParticle(blastRing2); + + Projectile.ai[0] = 1f; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 240); + } +} diff --git a/Projectiles/Rogue/ApoctolithProj.cs b/Projectiles/Rogue/ApoctolithProj.cs index 873ba49c82..590be93ddb 100644 --- a/Projectiles/Rogue/ApoctolithProj.cs +++ b/Projectiles/Rogue/ApoctolithProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue public static Color LowBlueColor => Color.Blue; public static Color HighBlueColor => Color.DodgerBlue; - public int ShardDamage => (int)(Projectile.damage * 0.12f); + public int ShardDamage => (int)(Projectile.damage * 0.15f); public int ExplosionDamage => (int)(Projectile.damage * 0.5f); public int ExplosionRadius => 150; @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -98,92 +98,35 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { - #region Long convoluted particle code - - if (Projectile.Calamity().stealthStrike) - { - float screenShakePower = 7 * Utils.GetLerpValue(1300f, 0f, Projectile.Distance(Main.LocalPlayer.Center), true); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; - - Particle blastRing = new CustomPulse( - Projectile.Center, - Vector2.Zero, - Projectile.Calamity().stealthStrike ? Color.Black : LowBlueColor, - "CalamityMod/Particles/FlameExplosion", - Vector2.One, - Main.rand.NextFloat(-10, 10), - 0.05f, - Projectile.Calamity().stealthStrike ? 0.5f : 0.2f, - 15); - GeneralParticleHandler.SpawnParticle(blastRing); - - Particle blastRing1 = new CustomPulse( - Projectile.Center, - Vector2.Zero, - LowBlueColor, - "CalamityMod/Particles/FlameExplosion", - Vector2.One, - Main.rand.NextFloat(-10, 10), - 0.05f, - 0.35f, - 15); - GeneralParticleHandler.SpawnParticle(blastRing1); - - Particle blastRing2 = new CustomPulse( - Projectile.Center, - Vector2.Zero, - LowBlueColor, - "CalamityMod/Particles/FlameExplosion", - new(1f, 0.5f), - 0, - 0.05f, - 0.35f, - 20); - GeneralParticleHandler.SpawnParticle(blastRing2); - } - GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, LowBlueColor, "CalamityMod/Particles/LargeBloom", Vector2.One, 0f, 1f, 0f, 25)); GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", Vector2.One, 0f, 0.5f, 0f, 15)); for (int i = 0; i < 5; i++) GeneralParticleHandler.SpawnParticle(new BloodParticle2(Projectile.Center, new Vector2(Main.rand.NextFloat(6, 12), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)), 12, Main.rand.NextFloat(0.2f, 0.8f), HighBlueColor)); - GlowSparkParticle gs = new GlowSparkParticle(Projectile.Center, Vector2.Zero, false, 20, Projectile.Calamity().stealthStrike ? 0.06f : 0.03f, HighBlueColor, Vector2.One, true); + GlowSparkParticle gs = new(Projectile.Center, Vector2.Zero, false, 20, Projectile.Calamity().stealthStrike ? 0.06f : 0.03f, HighBlueColor, Vector2.One, true); gs.Rotation = Main.rand.NextFloat(-10, 10); - GeneralParticleHandler.SpawnParticle(gs); - #endregion - // Sounds - SoundEngine.PlaySound(AbyssGravel.MineSound, Projectile.position); SoundEngine.PlaySound(GiantClam.SlamSound, Projectile.position); SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode.WithPitchOffset(0.5f), Projectile.position); if (Projectile.Calamity().stealthStrike) SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/MineralMortarExplode"), Projectile.position); - // This only triggers if stealth is full - if (Projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) { - // Explosion damage + // Explosion + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), ExplosionDamage, 0, Projectile.owner); - foreach (NPC npc in Main.npc) + // Split shards + for (int i = 0; i < 5; i++) { - if (npc.active && npc.Distance(Projectile.Center) < ExplosionRadius && !npc.justHit) - { - npc.AddBuff(ModContent.BuffType(), 240); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), ExplosionDamage, 0, Projectile.owner, npc.whoAmI); - } - } - - int split = 0; - while (split < 5) - { - //Calculate the velocity of the projectile + // 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 + + // Prevents the projectile speed from being too low if (shardspeedX < 2f && shardspeedX > -2f) { shardspeedX += -Projectile.velocity.X; @@ -192,21 +135,19 @@ namespace CalamityMod.Projectiles.Rogue { shardspeedY += -Projectile.velocity.Y; } - shardspeedX *= 2f; shardspeedY *= 2f; - //Spawn the projectile - int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), ShardDamage, Projectile.knockBack / 2f, Projectile.owner); + // Spawn the projectile + int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + shardspeedX, Projectile.Center.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), ShardDamage, Projectile.knockBack / 2f, Projectile.owner); Main.projectile[shard].frame = Main.rand.Next(3); - split += 1; } } } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 71b80be562..f3bc88cee6 100644 --- a/Projectiles/Rogue/ApoctolithShard.cs +++ b/Projectiles/Rogue/ApoctolithShard.cs @@ -20,20 +20,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; + Main.projFrames[Type] = 3; } public override void SetDefaults() { - TimeBeforeHoming = Main.rand.Next(30, 60); - Projectile.friendly = true; - Projectile.ignoreWater = true; Projectile.width = 13; - Projectile.scale = Main.rand.NextFloat(0.7f, 1.2f); Projectile.height = 13; + Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.scale = Main.rand.NextFloat(0.7f, 1.2f); + Projectile.timeLeft = 240; + TimeBeforeHoming = Main.rand.Next(30, 60); } public override bool? CanDamage() { @@ -52,10 +53,18 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ai[2] = MathHelper.Lerp(Projectile.ai[2], 10, 0.05f); CalamityUtils.HomeInOnNPC(Projectile, false, 400, Projectile.ai[2], 0.2f); - Projectile.velocity.Y += 0.4f; + Projectile.velocity.Y += 0.25f; } } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -Projectile.velocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -Projectile.velocity.Y; + return false; + } public override bool PreDraw(ref Color lightColor) { Asset tex = ModContent.Request(Texture); diff --git a/Projectiles/Rogue/AshenStalactiteDebris.cs b/Projectiles/Rogue/AshenStalactiteDebris.cs index 2d3f21e080..45e2583878 100644 --- a/Projectiles/Rogue/AshenStalactiteDebris.cs +++ b/Projectiles/Rogue/AshenStalactiteDebris.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/AshenStalactiteDebris.png b/Projectiles/Rogue/AshenStalactiteDebris.png index c19bebc35f..8afd326680 100644 Binary files a/Projectiles/Rogue/AshenStalactiteDebris.png and b/Projectiles/Rogue/AshenStalactiteDebris.png differ diff --git a/Projectiles/Rogue/AshenStalactiteProj.cs b/Projectiles/Rogue/AshenStalactiteProj.cs index b0baa5e4f5..f0e3046f7a 100644 --- a/Projectiles/Rogue/AshenStalactiteProj.cs +++ b/Projectiles/Rogue/AshenStalactiteProj.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/AshenStalagmiteProj.cs b/Projectiles/Rogue/AshenStalagmiteProj.cs index 2802db70f0..d6df8cb06e 100644 --- a/Projectiles/Rogue/AshenStalagmiteProj.cs +++ b/Projectiles/Rogue/AshenStalagmiteProj.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/AshenStalagmiteProj.png b/Projectiles/Rogue/AshenStalagmiteProj.png index 2f1751aaa4..4f22b80bf9 100644 Binary files a/Projectiles/Rogue/AshenStalagmiteProj.png and b/Projectiles/Rogue/AshenStalagmiteProj.png differ diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index 40d0ea5715..be67889e6f 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[astral].velocity *= 2f; Main.dust[astral].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int g = 0; g < 3; g++) { diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index 2b0acbde3b..ce88e9d5ee 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -20,8 +20,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -108,7 +109,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -126,7 +127,7 @@ namespace CalamityMod.Projectiles.Rogue { Vector2 pos = new Vector2(targetPos.X + width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (targetPos - pos) / 40f; - int comet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25), Projectile.knockBack, Projectile.owner); + int comet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25), Projectile.knockBack, Projectile.owner); if (comet.WithinBounds(Main.maxProjectiles)) { Main.projectile[comet].DamageType = RogueDamageClass.Instance; @@ -157,7 +158,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[astral].velocity *= 2f; Main.dust[astral].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int g = 0; g < 3; g++) { diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index 6ef3ba74cc..828e638019 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[fire].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/BallisticPoisonCloud.cs b/Projectiles/Rogue/BallisticPoisonCloud.cs index f6255437fe..efd74924e6 100644 --- a/Projectiles/Rogue/BallisticPoisonCloud.cs +++ b/Projectiles/Rogue/BallisticPoisonCloud.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame = 0; } } - else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Projectile.type]) + else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Type]) { Projectile.Kill(); } diff --git a/Projectiles/Rogue/BarrelShrapnel.cs b/Projectiles/Rogue/BarrelShrapnel.cs index 28f65cdfae..b753bc41b3 100644 --- a/Projectiles/Rogue/BarrelShrapnel.cs +++ b/Projectiles/Rogue/BarrelShrapnel.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public bool hitTile = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() diff --git a/Projectiles/Rogue/BettyExplosion.cs b/Projectiles/Rogue/BettyExplosion.cs deleted file mode 100644 index 7371583539..0000000000 --- a/Projectiles/Rogue/BettyExplosion.cs +++ /dev/null @@ -1,103 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BettyExplosion : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 75; - Projectile.height = 75; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 20; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - if (Projectile.ai[0] == 0f) - SpawnExplosionDust(); - if (Projectile.ai[0] <= 1f) - Projectile.ai[0]++; - } - - void SpawnExplosionDust() - { - // Sparks and such - Vector2 corner = Projectile.position; - for (int i = 0; i < 15; i++) - { - 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()) - { - Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int i = 0; i < 25; i++) - { - 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, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[idx].velocity *= 2f; - } - - // Smoke, which counts as a Gore - 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_FromAI(), 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_FromAI(), 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_FromAI(), 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_FromAI(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - } - - } -} diff --git a/Projectiles/Rogue/BileExplosion.cs b/Projectiles/Rogue/BileExplosion.cs index ac90bd0cd3..e9a21f4ad8 100644 --- a/Projectiles/Rogue/BileExplosion.cs +++ b/Projectiles/Rogue/BileExplosion.cs @@ -1,7 +1,10 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -13,39 +16,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { + Projectile.width = 150; + Projectile.height = 150; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 60; + Projectile.timeLeft = 180; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 9; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 25; } public override void AI() { - // projectile.ai[0] == 1f means spawned by Skyfin Bombers SS - Projectile.position = Projectile.Center; - - if (Projectile.Calamity().stealthStrike || Projectile.ai[0] == 1f) - Projectile.width = Projectile.height = 120; - else - Projectile.width = Projectile.height = 70; - - Projectile.position -= Projectile.Size / 2f; - - for (int i = 0; i < 15; i++) + Vector2 randVel = new Vector2(8, 8).RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.04f, (Main.rand.NextBool(3) ? 0.4f : 0.5f)); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.GreenYellow, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.3f, 0.5f), 0.3f); + GeneralParticleHandler.SpawnParticle(smoke); + if (Main.rand.NextBool(2)) { - 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; + Color bubbleColor = Main.rand.NextBool() ? Color.DarkOliveGreen : Color.GreenYellow; + Vector2 bubbleSpawnPos = Projectile.Center + Main.rand.NextVector2Circular(70, 70); + Vector2 bubbleVelocity = Vector2.UnitY * Main.rand.NextFloat(-3.5f, -5f); + Particle bubble = new DirectionalPulseRing(bubbleSpawnPos, bubbleVelocity, bubbleColor, new Vector2(0.6f, 0.8f), 0, 0.1f, 0f, 65); + GeneralParticleHandler.SpawnParticle(bubble); + } + if (Projectile.Calamity().stealthStrike) + { + if (Main.rand.NextBool(4)) + { + Projectile bubble = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(70, 70), Vector2.UnitY * Main.rand.NextFloat(-3.5f, -5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); + if (bubble.whoAmI.WithinBounds(Main.maxProjectiles)) + { + //We mark it as a stealth strike to change its dust + bubble.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; + bubble.DamageType = RogueDamageClass.Instance; + bubble.timeLeft = 45; + } + } } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 480); + 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(), 60); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 480); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index 390b2f5ba3..50ebbd1133 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Rogue public bool CollideX => Projectile.oldPosition.X == Projectile.position.X; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) => false; public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index acbeb72bc4..79ce3bb0d0 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 276796b634..4884fc3f27 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) //afterimages { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/BlueFlamePillar.cs b/Projectiles/Rogue/BlueFlamePillar.cs index 4f97fc008e..414069dc13 100644 --- a/Projectiles/Rogue/BlueFlamePillar.cs +++ b/Projectiles/Rogue/BlueFlamePillar.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 e8b00af4b1..29bd9d4098 100644 --- a/Projectiles/Rogue/BlunderBoosterLightning.cs +++ b/Projectiles/Rogue/BlunderBoosterLightning.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 10; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.penetrate = 3; + Projectile.penetrate = 1; Projectile.timeLeft = 120; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.cs b/Projectiles/Rogue/BouncingEyeballProjectile.cs index 22eaba59ad..00510d890d 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectile.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectile.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue private int Bounces = 5; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs index c8bd1fc82f..923fcfb63d 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BouncyBol.cs b/Projectiles/Rogue/BouncyBol.cs deleted file mode 100644 index 32dfaba20c..0000000000 --- a/Projectiles/Rogue/BouncyBol.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BouncyBol : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/BouncySpikyBall"; - - private bool hasHitEnemy = false; - private int targetNPC = -1; - private List previousNPCs = new List() { -1 }; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 8; - Projectile.timeLeft = 600; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.aiStyle = ProjAIStyleID.GroundProjectile; - } - - public override void AI() - { - if (hasHitEnemy && Projectile.timeLeft < 575) - { - Projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out - Projectile.velocity.Y *= 1.005f; - if (Projectile.velocity.X > 16f) - { - Projectile.velocity.X = 16f; - } - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - float minDist = 999f; - int index = 0; - foreach (NPC npc in Main.ActiveNPCs) - { - bool hasHitNPC = false; - for (int j = 0; j < previousNPCs.Count; j++) - { - if (previousNPCs[j] == npc.whoAmI) - { - hasHitNPC = true; - } - } - - if (npc == target) - { - previousNPCs.Add(npc.whoAmI); - } - if (npc.CanBeChasedBy(Projectile, false) && npc != target && !hasHitNPC) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - - Vector2 velocityNew; - if (minDist < 999f) - { - Projectile.damage = (int)(Projectile.damage * 1.1f); - hasHitEnemy = true; - targetNPC = index; - velocityNew = Main.npc[index].Center - Projectile.Center; - velocityNew.Normalize(); - velocityNew *= 15f; - Projectile.velocity = velocityNew; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X * 1.001f; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y * 1.001f; - } - return false; - } - } -} diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs deleted file mode 100644 index f51c3460b9..0000000000 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BrackishFlaskProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/BrackishFlask"; - - public override void SetDefaults() - { - Projectile.width = 24; - Projectile.height = 24; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; - Projectile.timeLeft = 180; - AIType = ProjectileID.ThrowingKnife; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.ignoreWater = true; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - int randomDust = Utils.SelectRandom(Main.rand, new int[] - { - 33, - 89 - }); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X, Projectile.oldVelocity.Y); - } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - if (Projectile.owner == Main.myPlayer) - { - if (Projectile.Calamity().stealthStrike) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, -32f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - - for (int 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 / 2, Projectile.knockBack * 0.5f, 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 / 2, Projectile.knockBack * 0.5f, Projectile.owner, 1f, 0f); - } - } - } - - 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); - } - } -} diff --git a/Projectiles/Rogue/BrackishSpear.cs b/Projectiles/Rogue/BrackishSpear.cs deleted file mode 100644 index 00bc4c3b88..0000000000 --- a/Projectiles/Rogue/BrackishSpear.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BrackishSpear : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Magic/AtlantisSpear"; - - public static int TotalSegments = 12; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 52; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Projectile.ai[1] == 0f) - { - Projectile.alpha -= 100; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.ai[1] = 1f; - - // This projectile normally does not move by itself, so this will manually move it one time only - // This is only for the first segment and the on-kill segments - if (Projectile.ai[0] == 0f || Projectile.ai[0] > TotalSegments) - { - Projectile.ai[0]++; - Projectile.position += Projectile.velocity; - } - - // Spawn the next segment - if (Main.myPlayer == Projectile.owner && Projectile.ai[0] < TotalSegments) - { - int nextSegment = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0] + 1f); - NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, nextSegment); - } - } - } - else // Begin fading out - { - int AlphaPerFrame = 12; - Projectile.alpha += AlphaPerFrame; - if (Projectile.alpha == AlphaPerFrame * 14) - { - for (int i = 0; i < 8; i++) - { - 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; - } - } - - if (Projectile.alpha >= 255) - Projectile.Kill(); - } - if (Main.rand.NextBool(4)) - 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 - public override bool ShouldUpdatePosition() => false; - - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); - - 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 OnKill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - 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 - if (Projectile.ai[0] > TotalSegments || Main.myPlayer != Projectile.owner) - return; - - // Spawn two ungrowing segments to either side on death - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - 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, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, TotalSegments + 1f); - } - } - } -} diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs deleted file mode 100644 index 0a2ef3f6a7..0000000000 --- a/Projectiles/Rogue/BrackishWater.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BrackishWater : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 60; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); - if (Projectile.localAI[0] == 0f && Projectile.ai[0] == 1f) - { - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); - Projectile.localAI[0] += 1f; - } - if (Projectile.timeLeft % 2 == 0) - { - int randomDust = Utils.SelectRandom(Main.rand, new int[] - { - 33, - 89 - }); - 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; - } - } - - 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, 0f, 0f); - } - } - - 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); - } - } -} diff --git a/Projectiles/Rogue/BrackishWater.png b/Projectiles/Rogue/BrackishWater.png deleted file mode 100644 index 29d231bf6d..0000000000 Binary files a/Projectiles/Rogue/BrackishWater.png and /dev/null differ diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs deleted file mode 100644 index e575a3f54a..0000000000 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BrackishWaterBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 130; - Projectile.height = 130; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 60; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); - int randomDust = Utils.SelectRandom(Main.rand, new int[] - { - 33, - 89 - }); - if (Projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); - Projectile.localAI[0] += 1f; - } - 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; - float timerCompare = 0f; - while (timerCompare < projTimer) - { - float random1 = (float)Main.rand.Next(-10, 11); - float random2 = (float)Main.rand.Next(-10, 11); - float random3 = (float)Main.rand.Next(3, 9); - float randomAdjust = (float)Math.Sqrt((double)(random1 * random1 + random2 * random2)); - randomAdjust = random3 / randomAdjust; - random1 *= randomAdjust; - random2 *= randomAdjust; - 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; - 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 = random1; - dust.velocity.Y = random2; - timerCompare++; - } - } - - 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); - } -} diff --git a/Projectiles/Rogue/BurningStrifeExplosion.cs b/Projectiles/Rogue/BurningStrifeExplosion.cs new file mode 100644 index 0000000000..72666b7303 --- /dev/null +++ b/Projectiles/Rogue/BurningStrifeExplosion.cs @@ -0,0 +1,48 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BurningStrifeExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 130; + Projectile.height = 130; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 40; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.ai[1]++; + if (Projectile.ai[1] % 3f == 0f) + { + for (var i = 0; i < 3; i++) + { + Dust.NewDustPerfect(Projectile.Center, DustID.Shadowflame, Main.rand.NextVector2Circular(8f, 8f), Scale: Main.rand.NextFloat(1f, 1.5f)); + } + + Vector2 spawnPos = new Vector2(Projectile.position.X + Main.rand.NextFloat(Projectile.width), Projectile.position.Y + Main.rand.NextFloat(Projectile.height)); + FlameParticle flame = new(spawnPos, 10, 0.45f, 0.05f, Color.Violet, Color.DarkViolet); + GeneralParticleHandler.SpawnParticle(flame); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.ShadowFlame, 180); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + } +} diff --git a/Projectiles/Rogue/BurningStrifeProj.cs b/Projectiles/Rogue/BurningStrifeProj.cs index 916024baa0..c0cbb74b13 100644 --- a/Projectiles/Rogue/BurningStrifeProj.cs +++ b/Projectiles/Rogue/BurningStrifeProj.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -19,8 +20,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; } public override void AI() @@ -53,39 +52,26 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.ShadowFlame, 180); - if (Projectile.Calamity().stealthStrike && Projectile.penetrate != 1) - { - SoundEngine.PlaySound(SoundID.Item103, Projectile.Center); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner); - Main.projectile[proj].timeLeft += 20; - Main.projectile[proj].Center = Projectile.Center; - Main.projectile[proj].DamageType = RogueDamageClass.Instance; - } + OnHitEffect(target); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.ShadowFlame, 180); - if (Projectile.Calamity().stealthStrike && Projectile.penetrate != 1) - { - SoundEngine.PlaySound(SoundID.Item103, Projectile.Center); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner); - Main.projectile[proj].timeLeft += 20; - Main.projectile[proj].Center = Projectile.Center; - Main.projectile[proj].DamageType = RogueDamageClass.Instance; - } + target.AddBuff(ModContent.BuffType(), 180); + OnHitEffect(target); } - public override void OnKill(int timeLeft) + private void OnHitEffect(Entity target) { - int proj; SoundEngine.PlaySound(SoundID.Item103, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); 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); - Main.projectile[proj].Center = Projectile.Center; - Main.projectile[proj].DamageType = RogueDamageClass.Instance; + { + for (int i = 0; i < 4; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Main.rand.NextVector2CircularEdge(10f, 10f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, Main.rand.NextFloat(-0.1f, 0.1f), Main.rand.NextFloat(-0.1f, 0.1f)); + } + } } } } diff --git a/Projectiles/Rogue/BurningTentacle.cs b/Projectiles/Rogue/BurningTentacle.cs new file mode 100644 index 0000000000..ab8187a81a --- /dev/null +++ b/Projectiles/Rogue/BurningTentacle.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BurningTentacle : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 40; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 3; + Projectile.MaxUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Projectile.scale = 1f - Projectile.localAI[0]; + Projectile.height = Projectile.width = (int)(20f * Projectile.scale); + + if (Projectile.localAI[0] < 0.1f) + Projectile.localAI[0] += 0.01f; + else + Projectile.localAI[0] += 0.025f; + + if (Projectile.localAI[0] >= 0.95f) + Projectile.Kill(); + + Projectile.velocity.X += Projectile.ai[0]; + Projectile.velocity.Y += Projectile.ai[1]; + if (Projectile.velocity.Length() > 10f) + Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 10f; + + Projectile.ai[0] *= 1.04f; + Projectile.ai[1] *= 1.04f; + if (Projectile.scale < 1f) + { + for (int i = 0; i < Projectile.scale * 8f; i++) + { + Dust shadowflameDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + shadowflameDust.position = (shadowflameDust.position + Projectile.Center) / 2f; + shadowflameDust.noGravity = true; + shadowflameDust.velocity *= 0.1f; + shadowflameDust.velocity -= Projectile.velocity * (1.3f - Projectile.scale); + shadowflameDust.fadeIn = 100; + shadowflameDust.scale += Projectile.scale * 0.75f; + } + } + } + } +} diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index 3cf2ecce4f..50845d0ef5 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -14,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -109,6 +110,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += RotationIncrement; return; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 360); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 360); public override bool OnTileCollide(Vector2 oldVelocity) { @@ -126,7 +130,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index 6a4d2fb686..ba321e035e 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.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; @@ -10,8 +11,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -40,9 +41,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } + 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 PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CelestialReaperAfterimage.cs b/Projectiles/Rogue/CelestialReaperAfterimage.cs index 28d2198142..34024d6c99 100644 --- a/Projectiles/Rogue/CelestialReaperAfterimage.cs +++ b/Projectiles/Rogue/CelestialReaperAfterimage.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -8,13 +9,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CelestialReaper"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 66; Projectile.height = 76; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; Projectile.timeLeft = 51; Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft < 150) { - NPC target = Projectile.Center.ClosestNPCAt(640f); + NPC target = Projectile.Center.ClosestNPCAt(800f); if (target != null) Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(target.Center) * 20f) / 21f; } diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index a75bd9ccdc..3531a0ba5c 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -1,6 +1,7 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -11,7 +12,9 @@ namespace CalamityMod.Projectiles.Rogue public override string Texture => "CalamityMod/Items/Weapons/Rogue/CelestialReaper"; public int HomingCooldown = 0; + public NPC HitTarget; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 66; @@ -35,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - NPC target = Projectile.Center.ClosestNPCAt(640f); + NPC target = (HitTarget != null && HitTarget.active) ? HitTarget : Projectile.Center.ClosestNPCAt(800f); if (target != null) Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(target.Center) * 20f) / 21f; } @@ -55,13 +58,14 @@ namespace CalamityMod.Projectiles.Rogue } } - // The explicit (bool?) cast is necessary until C# 9.0. How ugly. - public override bool? CanHitNPC(NPC target) => HomingCooldown > 0 ? false : (bool?)null; + public override bool? CanHitNPC(NPC target) => HomingCooldown > 0 ? false : null; public override bool CanHitPvp(Player target) => HomingCooldown <= 0; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (HitTarget == null || !HitTarget.active) + HitTarget = target; HomingCooldown = 25; Projectile.velocity *= -0.75f; // Bounce off of the enemy. } diff --git a/Projectiles/Rogue/CelestusMiniScythe.cs b/Projectiles/Rogue/CelestusMiniScythe.cs index 87e4349b9b..cb561bc9cd 100644 --- a/Projectiles/Rogue/CelestusMiniScythe.cs +++ b/Projectiles/Rogue/CelestusMiniScythe.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CelestusProj.cs b/Projectiles/Rogue/CelestusProj.cs index 4b226f24f5..d1f724e892 100644 --- a/Projectiles/Rogue/CelestusProj.cs +++ b/Projectiles/Rogue/CelestusProj.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -152,15 +152,10 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 8; 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.7), Projectile.knockBack, Projectile.owner); - 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.7), Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 2.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); @@ -168,7 +163,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index 7bd04a0b07..1ba199ca9b 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,12 +13,22 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Cinquedea"; + public ref float Timer => ref Projectile.ai[0]; + public ref float Target => ref Projectile.ai[1]; + public static readonly SoundStyle StealthSliceSound = new("CalamityMod/Sounds/Custom/SwiftSlice"); + internal float gravspin = 0f; + private Vector2 StoredVelocity; + private Vector2 StickOffset; + private const int StickTime = 30; + private int Stick = 0; + private int elecFrame = 0; + private int elecFrameCounter = 0; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -25,6 +37,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = 2; + Projectile.timeLeft = 600; Projectile.tileCollide = false; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; @@ -34,61 +47,70 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + var modProj = Projectile.Calamity(); DrawOriginOffsetY = 11; DrawOffsetX = -22; + gravspin = Projectile.velocity.Y * (0.03f * Projectile.spriteDirection); + Timer++; - bool stealthstrike = Projectile.ai[1] == 1 && Projectile.penetrate == 1; - if (Projectile.spriteDirection == 1) - { - gravspin = Projectile.velocity.Y * 0.03f; - } - if (Projectile.spriteDirection == -1) - { - gravspin = Projectile.velocity.Y * -0.03f; - } - Projectile.ai[0]++; //Fucking slopes - if (Projectile.ai[0] > 2f) - { + if (Timer > 2f) Projectile.tileCollide = true; + + // Stealth sticking handle + if (Stick > 0) + { + Projectile.Center = Main.npc[(int)Target].Center + StickOffset; + Stick--; + if (Stick == 0) + { + // Play sound, increase hitbox size, launch using stored velocity and with several extra updates + SoundEngine.PlaySound(StealthSliceSound, Projectile.Center); + Projectile.velocity = StoredVelocity; + Projectile.extraUpdates = 8; + Projectile.timeLeft = 90; + + // Launch particles + for (int i = 0; i < 6; i++) + { + ElectricSpark spark = new(Projectile.Center, -Projectile.velocity.RotatedByRandom(MathHelper.Pi / 6f), Color.Aqua, Color.AliceBlue, 1.2f, 60); + GeneralParticleHandler.SpawnParticle(spark); + } + } } + + // Stealth visual code + if (modProj.stealthStrike && Stick == 0 && Timer % (Projectile.numHits > 0 ? 1 : 3) == 0) + { + ElectricSpark spark = new(Projectile.Center, Main.rand.NextVector2CircularEdge(3f, 3f), Color.Aqua, Color.AliceBlue, 0.9f, 25); + GeneralParticleHandler.SpawnParticle(spark); + } + elecFrameCounter++; + if (elecFrameCounter > 2) + { + elecFrameCounter = 0; + elecFrame++; + if (elecFrame > 3) + elecFrame = 0; + } + //Face-forward rotation code - if ((Projectile.ai[0] <= 80 && !stealthstrike) || stealthstrike || Projectile.velocity.Y <= 0) + if (((Timer <= 80 && !modProj.stealthStrike) || modProj.stealthStrike || Projectile.velocity.Y <= 0) && Stick == 0) { Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - //Rotating 45 degrees if shooting right - if (Projectile.spriteDirection == 1) - { - Projectile.rotation += MathHelper.ToRadians(45f); - } - //Rotating 45 degrees if shooting left - if (Projectile.spriteDirection == -1) - { - Projectile.rotation -= MathHelper.ToRadians(45f); - } + Projectile.rotation += MathHelper.ToRadians(45f) * Projectile.spriteDirection; } - //Stealth strike - if (stealthstrike) + // Gravity code + if (Timer > 80 && !modProj.stealthStrike) { - CalamityUtils.HomeInOnNPC(Projectile, true, 250f, 7f, 20f); - } - //Gravity code - else - { - if (Projectile.ai[0] > 80) - { - Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; - if (Projectile.velocity.Y > 0) - { - Projectile.rotation += gravspin; - } - if (Projectile.velocity.Y > 10f) - { - Projectile.velocity.Y = 10f; - } - } + Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; + if (Projectile.velocity.Y > 0) + Projectile.rotation += gravspin; + + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -100,14 +122,40 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } + public override bool? CanDamage() => Stick == 0; + + // Increase hitbox size after stealth strike launch + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + if (Projectile.Calamity().stealthStrike && Projectile.numHits > 0 && Stick == 0) + hitbox.Inflate(38, 38); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.ai[1] == 1f && Projectile.penetrate == 1) - Projectile.timeLeft = 180; + if (Projectile.Calamity().stealthStrike && Projectile.numHits == 0) + { + Target = target.whoAmI; + Projectile.penetrate = -1; + Stick = StickTime; + StickOffset = Projectile.Center - target.Center; + StoredVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + } + } + + public override void PostDraw(Color lightColor) + { + if (Projectile.Calamity().stealthStrike && Projectile.numHits > 0 && Stick == 0) + { + Texture2D electric = ModContent.Request("Terraria/Images/Projectile_443").Value; + Rectangle frame = electric.Frame(1, 4, 0, elecFrame); + Main.EntitySpriteDraw(electric, Projectile.Center - Main.screenPosition, frame, Color.White, 0f, frame.Size() / 2f, 1f, SpriteEffects.None); + } } } } diff --git a/Projectiles/Rogue/CircletMark.cs b/Projectiles/Rogue/CircletMark.cs index d3d27dd67c..1222796e47 100644 --- a/Projectiles/Rogue/CircletMark.cs +++ b/Projectiles/Rogue/CircletMark.cs @@ -145,8 +145,8 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle rectangle = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture2D27 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle rectangle = texture2D27.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Color alphaColor = Projectile.GetAlpha(originalColor); Vector2 origin7 = rectangle.Size() / 2f; Color sandyColor = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index 083ef42cd3..8ea5f2ff63 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2D23 = Terraria.GameContent.TextureAssets.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 d6ead0de25..0bfb8cffe7 100644 --- a/Projectiles/Rogue/CobaltEnergy.cs +++ b/Projectiles/Rogue/CobaltEnergy.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Rogue private int targetNPC = -1; private List previousNPCs = new List() { -1 }; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; @@ -107,7 +108,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index 6113862dfa..07c4e8ee65 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 14; Projectile.height = 14; Projectile.friendly = true; - Projectile.penetrate = 3; + Projectile.penetrate = 2; Projectile.timeLeft = Lifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/ContaminatedBileFlask.cs b/Projectiles/Rogue/ContaminatedBileFlask.cs index 2d130b58eb..75e3ff1cc2 100644 --- a/Projectiles/Rogue/ContaminatedBileFlask.cs +++ b/Projectiles/Rogue/ContaminatedBileFlask.cs @@ -1,8 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using CalamityMod.Particles; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Projectiles.Rogue { @@ -18,30 +20,35 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.tileCollide = true; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.alpha = 0; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - if (Projectile.ai[0]++ > 45f) - { - if (Projectile.velocity.Y < 10f) - Projectile.velocity.Y += 0.15f; - } - - Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.Length()); + float rotateratio = 0.002f; + float rotation = (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * rotateratio; + Projectile.rotation += rotation * Projectile.direction; } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item107, Projectile.Bottom); - - Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); + #region Visuals + Particle blast = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkOliveGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.7f, 200, true, 0.7f); + GeneralParticleHandler.SpawnParticle(blast); + Particle blast1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OliveDrab * 0.5f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.02f, 0.05f, 340); + GeneralParticleHandler.SpawnParticle(blast1); + Particle blast2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OliveDrab * 0.5f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.03f, 0.07f, 340); + GeneralParticleHandler.SpawnParticle(blast2); + Particle blast3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkOliveGreen * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.04f, 0.08f, 340); + GeneralParticleHandler.SpawnParticle(blast3); + #endregion + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), Projectile.knockBack, Projectile.owner); if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) { explosion.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; - explosion.timeLeft = explosion.Calamity().stealthStrike ? 60 : 20; } } } diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs index 01589210b9..561260ec7a 100644 --- a/Projectiles/Rogue/CorpusAvertorClone.cs +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,10 +13,14 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + public const int MaxClones = 3; + private ref float CloneNum => ref Projectile.ai[0]; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -34,26 +39,8 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.04f; - Projectile.velocity.X *= 1.005f; - Projectile.velocity.Y *= 1.005f; - - switch ((int)Projectile.ai[0]) - { - case 20: - Projectile.scale = 0.7f; - break; - case 40: - Projectile.scale = 0.8f; - break; - case 60: - Projectile.scale = 0.9f; - break; - default: - break; - } - Projectile.width = Projectile.height = (int)(24f * Projectile.scale); - - CalamityUtils.HomeInOnNPC(Projectile, true, 150f, 12f, 20f); + if (Projectile.timeLeft < 165) + CalamityUtils.HomeInOnNPC(Projectile, true, 480f, 14f, 20f); } public override Color? GetAlpha(Color lightColor) @@ -65,32 +52,18 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } + public override bool? CanDamage() => Projectile.timeLeft > 165 ? false : null; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int heal = (int)Math.Round(hit.Damage * 0.05); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; + target.AddBuff(ModContent.BuffType(), 180); - 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) - { - 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; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + if (CloneNum < MaxClones && Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -Projectile.velocity.RotatedByRandom(MathHelper.Pi / 8f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, CloneNum + 1); } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index f0411b6978..7c00bf1283 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,10 +13,12 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + private ref float Timer => ref Projectile.ai[0]; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -31,29 +34,22 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.03f; - if (Projectile.ai[0] < 120f) - Projectile.ai[0] += 1f; + if (Timer < 120f) + Timer += 1f; - if (Projectile.ai[0] < 61f) + if (Timer == 20f) { - if (Projectile.ai[0] % 20f == 0f) - { - Vector2 velocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y); - float mult = Projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75 - velocity *= mult; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), - (int)(Projectile.damage * mult), Projectile.knockBack * mult, Projectile.owner, Projectile.ai[0]); - } + Vector2 cloneVel = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1f, 1.75f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, cloneVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 1f); } - else - { - Projectile.velocity.X *= 1.01f; - Projectile.velocity.Y *= 1.01f; - int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); + if (Timer > 60f) + { + Projectile.velocity *= 1.01f; + + int scale = (int)((Timer - 60f) * 3f); 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; @@ -62,27 +58,33 @@ namespace CalamityMod.Projectiles.Rogue public override Color? GetAlpha(Color lightColor) { - if (Projectile.ai[0] >= 61f) + Color returnColor; + if (Timer >= 61f) { - int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); - return new Color(scale, 0, 0, 50); + returnColor = Color.Lerp(Color.White, Color.Red, Math.Min((Timer - 60f) / 120f * 3f, 1f)); + returnColor.A = 50; + return returnColor; } - return new Color(0, 0, 0, 50); + returnColor = Color.White; + returnColor.A = 50; + return returnColor; } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 180); + 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) + if (Main.player[Projectile.owner].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -90,11 +92,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { - int heal = ((int)Math.Round(info.Damage * 0.05)); + target.AddBuff(ModContent.BuffType(), 180); + + 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) + if (Main.player[Projectile.owner].lifeSteal <= 0f || heal <= 0) return; 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 57c49b9897..99f36ef71e 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -1,9 +1,12 @@ -using System; -using CalamityMod.Balancing; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -14,82 +17,111 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + private ref float Timer => ref Projectile.ai[0]; + private ref float Slash => ref Projectile.ai[1]; // If set to 1, this is the slash projectile + private Vector2 startPos = Vector2.Zero; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { - Projectile.width = 24; - Projectile.height = 24; + Projectile.width = 32; + Projectile.height = 32; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 300; } public override void AI() { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; + if (startPos == Vector2.Zero) + startPos = Projectile.Center; - if (Projectile.ai[0] < 120f) - Projectile.ai[0] += 1f; + if (Timer < 120f) + Timer += 1f; - Projectile.velocity.X *= 1.01f; - Projectile.velocity.Y *= 1.01f; + Projectile.rotation = Projectile.velocity.ToRotation() + (MathHelper.Pi / 3f); + Projectile.velocity *= 1.01f; - int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); - 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; + if (Slash == 1f) + { + if (Timer > 4f) + { + GlowSparkParticle glow = new(Projectile.Center, Vector2.Normalize(Projectile.velocity), false, 10, 0.055f, Color.DarkRed, new Vector2(0.66f, 1.5f), true, false); + GeneralParticleHandler.SpawnParticle(glow); + } + } + else + { + int scale = (int)((Timer - 60f) * 4.25f); + 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; + } + + if (Timer == 60f && Slash == 0f) + { + SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Volume = 0.4f, PitchVariance = 0.06f }, startPos); + if (Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPos, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); + } + Projectile.tileCollide = true; + } } public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + if (Slash == 1f) + return false; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (target.lifeMax > 5) + target.AddBuff(ModContent.BuffType(), 180); + if (target.lifeMax > 5 && Projectile.numHits == 0 && Slash == 0f) OnHitEffects(hit.Damage); + + if (Projectile.numHits > 0 && !(target.life <= 0 && target.realLife == -1)) + Projectile.damage = (int)(Projectile.damage * 0.9f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - OnHitEffects(info.Damage); + target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.numHits == 0 && Slash == 0f) + OnHitEffects(info.Damage); } private void OnHitEffects(int damage) { Player player = Main.player[Projectile.owner]; - if (Main.rand.NextBool(7)) - { - int lifeLossAmt = (int)Math.Ceiling(player.statLife * 0.5); - player.statLife -= lifeLossAmt; - if (Main.myPlayer == player.whoAmI) - player.HealEffect(-lifeLossAmt, true); - if (player.statLife <= 0) - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CorpusAvertor").Format(player.name)), 1000.0, 0, false); - } - else if (Main.LocalPlayer.team == player.team && player.team != 0) + if (Main.LocalPlayer.team == player.team && player.team != 0) { Main.LocalPlayer.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); int heal = (int)Math.Round(damage * 0.025); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.LocalPlayer, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Rogue/Corrocloud1.cs b/Projectiles/Rogue/Corrocloud1.cs index 206005a920..1a277ec5db 100644 --- a/Projectiles/Rogue/Corrocloud1.cs +++ b/Projectiles/Rogue/Corrocloud1.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; } public override void SetDefaults() diff --git a/Projectiles/Rogue/Corrocloud2.cs b/Projectiles/Rogue/Corrocloud2.cs index 67711f3448..32115a9cf5 100644 --- a/Projectiles/Rogue/Corrocloud2.cs +++ b/Projectiles/Rogue/Corrocloud2.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; } public override void SetDefaults() diff --git a/Projectiles/Rogue/Corrocloud3.cs b/Projectiles/Rogue/Corrocloud3.cs index 720440764a..06fa8761d7 100644 --- a/Projectiles/Rogue/Corrocloud3.cs +++ b/Projectiles/Rogue/Corrocloud3.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; } public override void SetDefaults() diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 41d1a8092b..21c1045017 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -16,8 +16,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -59,12 +60,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 240); Projectile.Kill(); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CraniumSMASH.cs b/Projectiles/Rogue/CraniumSMASH.cs index ed0d560383..924e0375d5 100644 --- a/Projectiles/Rogue/CraniumSMASH.cs +++ b/Projectiles/Rogue/CraniumSMASH.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -13,8 +14,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 192; - Projectile.height = 192; + Projectile.width = Projectile.height = 200; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -27,65 +27,49 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + // Stealth on-death explosion is larger + if (Projectile.ai[1] == 1f) + Projectile.ExpandHitboxBy(300); + if (Projectile.ai[0] == 0f) - SpawnExplosionDust(); - if (Projectile.ai[0] <= 1f) - Projectile.ai[0]++; + { + SpawnExplosionDust(Projectile.width); + Projectile.ai[0] = 1f; + } } - void SpawnExplosionDust() + void SpawnExplosionDust(int size) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Vector2 goreSource = Projectile.Center; int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + Vector2 source = Projectile.Center - new Vector2(24f); + for (int goreIndex = 1; 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_FromAI(), 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_FromAI(), 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_FromAI(), 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_FromAI(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; + float velocityMult = 0.33f * goreIndex; + int type = Main.rand.Next(61, 63 + 1); + Gore smoke = Gore.NewGoreDirect(Projectile.GetSource_Death(), source, default, type, 1f); + smoke.velocity *= velocityMult; + type = Main.rand.Next(61, 63 + 1); + smoke = Gore.NewGoreDirect(Projectile.GetSource_Death(), source, default, type, 1f); + smoke.velocity *= velocityMult; } } - for (int i = 0; i < 25; i++) + for (int i = 0; i < 30; i++) { - 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; + float edgeOffset = Main.rand.NextFloat(size * 0.35f, size / 2) * (Main.rand.NextBool() ? -1 : 1); + float randOffset = Main.rand.NextFloat(-size / 2, size / 2); + Vector2 spawnPos = Projectile.Center + (i % 2 == 0 ? new Vector2(edgeOffset, randOffset) : new Vector2(randOffset, edgeOffset)); + Dust dust = Dust.NewDustPerfect(spawnPos, DustID.IceTorch, Vector2.Zero, 100, default, 2f); + dust.noGravity = true; + } + if (Projectile.ai[1] == 1f) + { + CustomPulse boo = new(Projectile.Center, Vector2.Zero, Color.SkyBlue, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.1f, 1.1f, 10); + GeneralParticleHandler.SpawnParticle(boo); } } } diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 81c22a57e6..3fcf3036a9 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,9 +17,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 50; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; Projectile.timeLeft = 300; - Projectile.localNPCHitCooldown = 15; Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; } @@ -26,20 +26,18 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 5f) - { Projectile.tileCollide = true; - } + Projectile.rotation += Projectile.velocity.X * 0.02f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; - Projectile.velocity.X = Projectile.velocity.X * 0.99f; + Projectile.velocity.Y += 0.085f; + Projectile.velocity.X *= 0.99f; } + 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 OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 192; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.ExpandHitboxBy(200); Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; @@ -47,55 +45,29 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Vector2 goreSource = Projectile.Center; int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + Vector2 source = Projectile.Center - new Vector2(24f); + for (int goreIndex = 1; 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; + float velocityMult = 0.33f * goreIndex; + int type = Main.rand.Next(61, 63 + 1); + Gore smoke = Gore.NewGoreDirect(Projectile.GetSource_Death(), source, default, type, 1f); + smoke.velocity *= velocityMult; + type = Main.rand.Next(61, 63 + 1); + smoke = Gore.NewGoreDirect(Projectile.GetSource_Death(), source, default, type, 1f); + smoke.velocity *= velocityMult; } } - for (int i = 0; i < 25; i++) + for (int i = 0; i < 30; i++) { - 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; + float edgeOffset = Main.rand.NextFloat(60f, 100f) * (Main.rand.NextBool() ? -1 : 1); + float randOffset = Main.rand.NextFloat(-100f, 100f); + Vector2 spawnPos = Projectile.Center + (i % 2 == 0 ? new Vector2(edgeOffset, randOffset) : new Vector2(randOffset, edgeOffset)); + Dust dust = Dust.NewDustPerfect(spawnPos, DustID.IceTorch, Vector2.Zero, 100, default, 2f); + dust.noGravity = true; } } } diff --git a/Projectiles/Rogue/CraniumSmasherProj.cs b/Projectiles/Rogue/CraniumSmasherProj.cs index ed8559ee80..f6ceede1e9 100644 --- a/Projectiles/Rogue/CraniumSmasherProj.cs +++ b/Projectiles/Rogue/CraniumSmasherProj.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; @@ -27,15 +28,17 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= 3f) - { + if (Projectile.ai[0] >= 5f) Projectile.tileCollide = true; - } + Projectile.rotation += Projectile.velocity.X * 0.02f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; - Projectile.velocity.X = Projectile.velocity.X * 0.99f; + Projectile.velocity.X *= 0.99f; + Projectile.velocity.Y += 0.085f; } + 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 OnKill(int timeLeft) { for (int i = 0; i < 5; i++) diff --git a/Projectiles/Rogue/CraniumSmasherStealth.cs b/Projectiles/Rogue/CraniumSmasherStealth.cs index 08b9cf9f6f..5c22c4ad96 100644 --- a/Projectiles/Rogue/CraniumSmasherStealth.cs +++ b/Projectiles/Rogue/CraniumSmasherStealth.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -12,112 +13,94 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/Rogue/CraniumSmasherExplosive"; + private NPC StickTarget; + private Vector2 StickOffset; + public override void SetDefaults() { Projectile.width = 50; Projectile.height = 50; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 5; + Projectile.penetrate = 2; Projectile.timeLeft = 300; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; + Projectile.localNPCHitCooldown = 60; Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { + // Sticking AI, ignore everything else if sticking + if (StickTarget != null) + { + Projectile.velocity = Vector2.Zero; + Projectile.Center = StickTarget.Center + StickOffset; + Projectile.tileCollide = false; + + if (!StickTarget.active) + Projectile.Kill(); + return; + } + Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 5f) - { Projectile.tileCollide = true; - } + Projectile.rotation += Projectile.velocity.X * 0.02f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; - Projectile.velocity.X = Projectile.velocity.X * 0.99f; + Projectile.velocity.Y += 0.085f; + Projectile.velocity.X *= 0.99f; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.owner == Main.myPlayer) + target.AddBuff(ModContent.BuffType(), 300); + if (StickTarget == null) { - int smash = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); - Main.projectile[smash].Center = Projectile.Center; + StickTarget = target; + StickOffset = Projectile.Center - target.Center; + if (Projectile.timeLeft < 62) + Projectile.timeLeft = 62; } + + if (Projectile.penetrate > 1) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.owner == Main.myPlayer) - { - int smash = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); - Main.projectile[smash].Center = Projectile.Center; - } - } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 192; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0f, Projectile.owner, 0f, 1f); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3.5f) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3.5f; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Vector2 goreSource = Projectile.Center; int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + Vector2 source = Projectile.Center - new Vector2(24f); + for (int goreIndex = 1; 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; + float velocityMult = 0.33f * goreIndex; + int type = Main.rand.Next(61, 63 + 1); + Gore smoke = Gore.NewGoreDirect(Projectile.GetSource_Death(), source, default, type, 1f); + smoke.velocity *= velocityMult; + type = Main.rand.Next(61, 63 + 1); + smoke = Gore.NewGoreDirect(Projectile.GetSource_Death(), source, default, type, 1f); + smoke.velocity *= velocityMult; } } - for (int i = 0; i < 25; i++) + for (int i = 0; i < 30; i++) { - 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; + float edgeOffset = Main.rand.NextFloat(60f, 100f) * (Main.rand.NextBool() ? -1 : 1); + float randOffset = Main.rand.NextFloat(-100f, 100f); + Vector2 spawnPos = Projectile.Center + (i % 2 == 0 ? new Vector2(edgeOffset, randOffset) : new Vector2(randOffset, edgeOffset)); + Dust dust = Dust.NewDustPerfect(spawnPos, DustID.IceTorch, Vector2.Zero, 100, default, 2f); + dust.noGravity = true; } } diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index e4faf91f2e..f8f7e01382 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue public class Crushax : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 30; @@ -16,19 +19,32 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 2; - Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; + Projectile.DamageType = RogueDamageClass.Instance; Projectile.timeLeft = 300; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; - AIType = ProjectileID.ThrowingKnife; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 7; } public override void AI() { - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.03f * Projectile.direction; + + Projectile.ai[0]++; + if (Projectile.ai[0] >= 20f) + { + Projectile.velocity.Y += 0.35f; + Projectile.velocity.X *= 0.97f; + } + else + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + if (Projectile.velocity.Y > 15f) + Projectile.velocity.Y = 15f; + + if (Projectile.ai[0] >= 20f) + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 280f, 14f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -54,13 +70,13 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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.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 0e52f58ddb..61cb9505f0 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index f14f4858d9..0401358dc1 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.timeLeft == (Projectile.ai[1] == 2f ? 20 : 30)) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/CrystallineProj.cs b/Projectiles/Rogue/CrystallineProj.cs index 7ff1767715..237e3bb6f0 100644 --- a/Projectiles/Rogue/CrystallineProj.cs +++ b/Projectiles/Rogue/CrystallineProj.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/CursedDaggerProj.cs b/Projectiles/Rogue/CursedDaggerProj.cs index 90127ca24c..b7878c41c5 100644 --- a/Projectiles/Rogue/CursedDaggerProj.cs +++ b/Projectiles/Rogue/CursedDaggerProj.cs @@ -28,10 +28,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; Projectile.friendly = true; + Projectile.tileCollide = false; } public override void AI() { + if (Collision.SolidCollision(Projectile.Center, 3, 3)) + Projectile.Kill(); + 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.SulphurousSeaAcid, Projectile.velocity.X * -3f, Projectile.velocity.Y * -3f, 0, default, Projectile.Calamity().stealthStrike ? Main.rand.NextFloat(2.5f, 3.2f) : 1.5f)]; @@ -66,13 +70,13 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.Calamity().stealthStrike) { SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.position); - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack * 2, Projectile.owner, 0, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack * 2, Projectile.owner, 0, 0f); } } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 7c58cfb78b..0d9fcd7c32 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell1.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell1.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f }, Projectile.position); @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f }, Projectile.position); diff --git a/Projectiles/Rogue/DeepSeaDumbbell2.cs b/Projectiles/Rogue/DeepSeaDumbbell2.cs index 6a1671bc6e..5bfb9bcbc1 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell2.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell2.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f }, Projectile.position); @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f }, Projectile.position); diff --git a/Projectiles/Rogue/DeepSeaDumbbell3.cs b/Projectiles/Rogue/DeepSeaDumbbell3.cs index f1f25a14da..c4bb1358bb 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell3.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell3.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f }, Projectile.position); @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f }, Projectile.position); diff --git a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs index c5953a8397..dc4d6fb937 100644 --- a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs +++ b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs @@ -57,12 +57,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Rogue/DeepWounderProjectile.cs b/Projectiles/Rogue/DeepWounderProjectile.cs index 3cbadfac87..8575ee7ec5 100644 --- a/Projectiles/Rogue/DeepWounderProjectile.cs +++ b/Projectiles/Rogue/DeepWounderProjectile.cs @@ -14,10 +14,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/DeepWounder"; + public NPC StuckTo; + public Vector2 StuckOffset = Vector2.Zero; + public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 30; + Projectile.height = 30; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 3; @@ -29,26 +32,32 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.rotation += 0.2f * Projectile.direction; + Projectile.rotation += (StuckTo == null ? 0.2f : 0.35f) * Projectile.direction; if (Projectile.Calamity().stealthStrike) { int spriteWidth = 52; int spriteHeight = 48; - Vector2 spriteCenter = Projectile.Center - new Vector2(spriteWidth / 2, spriteHeight / 2); - for (int i = 0; i < 30; i++) + for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(spriteCenter, spriteWidth, spriteHeight, DustID.Water, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); + int dust = Dust.NewDust(Projectile.position, spriteWidth, spriteHeight, DustID.Water, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); Main.dust[dust].noGravity = true; } - if (Main.rand.NextBool(5)) + if (StuckTo != null) { - 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.05f), 1, Projectile.owner, 0, 0); + if (!StuckTo.CanBeChasedBy(Projectile)) + Projectile.Kill(); + + Projectile.Center = StuckTo.Center + StuckOffset; + Projectile.velocity = Vector2.Zero; + + if (Projectile.timeLeft % 5 == 0) + { + Vector2 waterVelocity = (Projectile.Center - StuckTo.Center).SafeNormalize(Vector2.UnitX).RotatedByRandom(MathHelper.Pi / 6f) * 8f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, waterVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 1, Projectile.owner, 0, 0); + } } } } @@ -59,34 +68,25 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + if (StuckTo == null) + { + StuckTo = target; + StuckOffset = Projectile.Center - target.Center; + } } } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 150); - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 120); } } - public override bool PreDraw(ref Color lightColor) - { - 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); - } - else - { - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.FlipHorizontally, 0); - } - 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/DeepWounderWater.cs b/Projectiles/Rogue/DeepWounderWater.cs index e9cf620e03..01e4daddb8 100644 --- a/Projectiles/Rogue/DeepWounderWater.cs +++ b/Projectiles/Rogue/DeepWounderWater.cs @@ -1,6 +1,5 @@ - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,48 +9,74 @@ namespace CalamityMod.Projectiles.Rogue public class DeepWounderWater : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + + private const int TimeBeforeBurst = 120; + private bool foundTarget = false; + public override void SetDefaults() { Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; + Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 50; + Projectile.timeLeft = 160; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; } public override void AI() { - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, Projectile.velocity.X, Projectile.velocity.Y); - Main.dust[dust].noGravity = true; - } - + Dust idleDust = Dust.NewDustPerfect(Projectile.Center, DustID.Water, Vector2.Zero, Scale: 1.5f); + idleDust.noGravity = true; Projectile.rotation += 0.2f; - Projectile.velocity.Y += 0.2f; - if (Projectile.velocity.Y > 16f) + if (Projectile.timeLeft > TimeBeforeBurst) { - Projectile.velocity.Y = 16f; + Projectile.velocity *= 0.97f; + } + else + { + // Zoom off towards the nearest target + // Don't bother running code if you've already found one + if (foundTarget) + return; + + // Find the closest target + float npcDistCompare = 960f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile)) + continue; + + float hitboxWidth = Math.Max(n.Hitbox.Width / 2f, n.Hitbox.Height / 2f); + float currentNPCDist = n.Distance(Projectile.Center) - hitboxWidth; + if ((currentNPCDist < npcDistCompare) && (Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1))) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + + if (index != -1) + { + foundTarget = true; + + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], 7f, 4); + Projectile.MaxUpdates = 4; + if (Projectile.timeLeft < TimeBeforeBurst) + Projectile.timeLeft = TimeBeforeBurst; + + for (int i = 0; i < 12; i++) + { + Vector2 dustVel = Main.rand.NextVector2CircularEdge(7, 7); + Dust dustBurst = Dust.NewDustPerfect(Projectile.Center, DustID.Water, dustVel); + dustBurst.noGravity = true; + } + } } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - Projectile.Kill(); - return false; - } - - 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 bool? CanDamage() => Projectile.timeLeft <= TimeBeforeBurst; } } diff --git a/Projectiles/Rogue/DesecratedBubble.cs b/Projectiles/Rogue/DesecratedBubble.cs index 6fc7447c9a..1403cef06a 100644 --- a/Projectiles/Rogue/DesecratedBubble.cs +++ b/Projectiles/Rogue/DesecratedBubble.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Rogue public class DesecratedBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; diff --git a/Projectiles/Rogue/DesecratedWaterProj.cs b/Projectiles/Rogue/DesecratedWaterProj.cs index f38e07224b..3f8cab8c40 100644 --- a/Projectiles/Rogue/DesecratedWaterProj.cs +++ b/Projectiles/Rogue/DesecratedWaterProj.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 a6aa89de0b..b1f39306a7 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -49,8 +49,9 @@ namespace CalamityMod.Projectiles.Rogue } if (time == 180 + timerOffset) { - MouseX = Owner.Calamity().mouseWorld.X; - MouseY = Owner.Calamity().mouseWorld.Y; + Vector2 mouse = Owner.ClampedMouseWorld(); + MouseX = mouse.X; + MouseY = mouse.Y; } else if (time < 180) { @@ -121,7 +122,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Asset tex2 = ModContent.Request("CalamityMod/Projectiles/Rogue/DestructionBoltGhost"); Asset tex3 = ModContent.Request("CalamityMod/Particles/BloomCircle"); float fading = Utils.GetLerpValue(180, 90, time, true); diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 308432534e..2f70791b27 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -1,10 +1,12 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -23,6 +25,8 @@ namespace CalamityMod.Projectiles.Rogue public int rotDirection = 1; public float rot = 0.01f; public bool setRot = true; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 94; @@ -49,22 +53,32 @@ namespace CalamityMod.Projectiles.Rogue rot += (Utils.Remap(Projectile.timeLeft, 0, 240, 0.02f, 0.0015f)) * rotDirection; Player Owner = Main.player[Projectile.owner]; - Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + Vector2 moveToMouse = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); if (Projectile.numHits == 0 || Projectile.Calamity().stealthStrike) { - if (Projectile.velocity.Length() < (Projectile.Calamity().stealthStrike ? 18 : 13) && time > 8) - Projectile.velocity += moveToMouse * (Projectile.Calamity().stealthStrike ? 0.8f : 0.4f); - else if (time > 8) - Projectile.velocity *= 0.9f; + if (time > 8) + { + if (Projectile.velocity.Length() < (Projectile.Calamity().stealthStrike ? 20 : 13)) + Projectile.velocity += moveToMouse * (Projectile.Calamity().stealthStrike ? 1f : 0.4f); + else + Projectile.velocity *= 0.9f; + } - if (Projectile.velocity.Length() > 3 && Main.rand.NextBool()) + if (Projectile.velocity.Length() > 3) { Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(70, 70); - float speed = Main.rand.NextFloat(0.9f, 1.9f); - Particle spark = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 11, 0.8f, Color.Black, false, false, false); - GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 11, 0.5f, Color.LightGreen, true, false, true); - GeneralParticleHandler.SpawnParticle(spark2); + float speed = Main.rand.NextFloat(0.6f, 0.9f); + if (Main.rand.NextBool()) + { + int dustStyle = ModContent.DustType(); + Dust dust = Dust.NewDustPerfect(placement, dustStyle); + dust.scale = Main.rand.NextFloat(0.8f, 1.2f); + dust.velocity = -Projectile.velocity * speed; + dust.noGravity = true; + dust.color = Color.LightGreen; + } + Particle smoke = new HeavySmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * speed, Color.Black, 22, Main.rand.NextFloat(-0.2f, 0.2f) + speed, 0.4f, Main.rand.NextFloat(-0.05f, 0.05f), false); + GeneralParticleHandler.SpawnParticle(smoke); } fade = MathHelper.Lerp(fade, 0, 0.088f); @@ -90,7 +104,6 @@ namespace CalamityMod.Projectiles.Rogue if (time == 8) Projectile.Kill(); } - //if (Projectile.Calamity().stealthStrike) time++; if (stealthHitCooldown > 0) @@ -134,14 +147,7 @@ namespace CalamityMod.Projectiles.Rogue Particle orb7 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 3, 0f, 12, false); GeneralParticleHandler.SpawnParticle(orb7); } - public override void OnKill(int timeLeft) - { - if (!Projectile.Calamity().stealthStrike) - Explode(false); - else - Explode(true); - - } + public override void OnKill(int timeLeft) => Explode(Projectile.Calamity().stealthStrike); internal void Explode(bool big) { @@ -153,7 +159,7 @@ namespace CalamityMod.Projectiles.Rogue Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11); GeneralParticleHandler.SpawnParticle(orb2); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.4f : 0.8f)), Projectile.knockBack * 1.5f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.25f : 1f)), Projectile.knockBack * 1.5f, Projectile.owner); SoundStyle explo = new("CalamityMod/Sounds/Item/MeldExplosion"); SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center); if (big) @@ -179,12 +185,14 @@ namespace CalamityMod.Projectiles.Rogue Particle orb7 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), (2.2f + i * 0.5f) * sizeBonus, 0f, 80, false); GeneralParticleHandler.SpawnParticle(orb7); } - for (int i = 0; i < 12; i++) + for (int i = 0; i < (19 * sizeBonus); i++) { - Particle spark3 = new GlowOrbParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f) * sizeBonus, false, 25, Main.rand.NextFloat(0.8f, 1.5f) * sizeBonus, Color.LightGreen, true, false, false); - GeneralParticleHandler.SpawnParticle(spark3); - Particle spark4 = new GlowOrbParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f) * sizeBonus, false, 25, Main.rand.NextFloat(0.8f, 1.5f) * sizeBonus, Color.Black, false, false, false); - GeneralParticleHandler.SpawnParticle(spark4); + int dustStyle = ModContent.DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(1.4f, 2.2f) * sizeBonus; + dust.velocity = new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f) * sizeBonus; + dust.noGravity = true; + dust.color = Color.LightGreen; } for (int i = 0; i < (25 * sizeBonus); i++) { @@ -207,18 +215,10 @@ namespace CalamityMod.Projectiles.Rogue { Main.EntitySpriteDraw(portal.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 } * Utils.GetLerpValue(45, 0, stealthHitCooldown), 0, portal.Size() * 0.5f, 1.1f * Utils.GetLerpValue(45, 0, stealthHitCooldown), SpriteEffects.None); } - for (int i = 0; i < 3; i++) + for (int i = 0; i < 15; i++) { - Color auraColor = Color.Black; - Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); - rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f); - Vector2 rotationalDrawOffset2 = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); - rotationalDrawOffset2 *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f - 2); - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - for (int b = 0; b < 2; b++) - { - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset2, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - } + Vector2 rotationalDrawOffset2 = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 5 * (fade + 0.2f); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset2, null, Color.LightGreen with { A = 0 } * 0.4f, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, SpriteEffects.None); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs new file mode 100644 index 0000000000..cd6fc21372 --- /dev/null +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -0,0 +1,435 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DoomsdayDeviceProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DoomsdayDevice"; + public ref float time => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public float rotSpeed = 0.05f; // How fast the projectile rotates. + public int tileHits = 0; // Keeps track of if the projectile has hit a tile. + public bool flung = false; // If the projectile has entered the thrown state. + public float charge = 1; // How charged the projectile is, ranges from 1 - 4. + public bool hasReachedFullCharge = false; // If the projectile is fully charged. + public bool hasStoppedHolding = false; // If the player has let go of m1, thereby throwing the projectile. + public int stealthPenaltyTimer = 0; // Timer to keep track of how long the player has held charge, if held for long enough stealth is drained. + public bool doneHitting = false; // If the projectile has finished its normal throwing arc and is now in a falling state. + public bool giveStealth = true; // If the projectile gives stealth on hit. + + public int maxStealthHits = 5; // How many bounces the stealth strike has. This does not include the inital and final hit, so be sure to take those into account if you adjust this. + + public Color mainColor = Color.White; + + public NPC lastHitTarget; + public override void SetDefaults() + { + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + + Projectile.timeLeft = 3000; + Projectile.DamageType = RogueDamageClass.Instance; + } + public override bool ShouldUpdatePosition() => flung; + public override bool? CanDamage() => (flung && tileHits == 0 ? null : false); + public override void AI() + { + // The main color shifting + float rate = (Main.GlobalTimeWrappedHourly * 6); + List eColors = new List() + { + Color.Turquoise, + Color.Orchid + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (tileHits == 0) // Trail effects for charged throws + { + if (hasReachedFullCharge && !doneHitting) + { + float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true); + Particle fadeInfx = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 23, 0.4f, mainColor * 0.4f * squash, new Vector2(1 - 0.15f * squash, 1f), true, false, shrinkSpeed: 0.2f * squash); + GeneralParticleHandler.SpawnParticle(fadeInfx); + } + } + + if (flung) + { + if ((time / Projectile.extraUpdates) > Owner.HeldItem.useAnimation * 0.45f) + Projectile.localAI[1] = 5; // Make sure you can throw another grenade, if any genade has this value at zero you cant throw another one. + + if (!doneHitting) + { + if (!Collision.SolidCollision(Projectile.Center, 5, 5) && tileHits == 0) // Since the arc of the throw is done by adjusting position and not velocity, extra checks are needed for tile collison. + Projectile.Center += new Vector2(0, Utils.Remap(time, 0, 120, -3, 3, false) * Projectile.ai[1]); + else + { + TileHit(); + } + rotSpeed += 0.0002f; + } + else // When the grenade is falling to the floor after hitting an enemy. + { + if (rotSpeed != 0) + rotSpeed *= 0.99f; + Projectile.velocity.Y += 0.05f; + charge *= 0.98f; + Projectile.Opacity = charge; + } + + if (tileHits == 0) // Dust trail produced after being thrown. + { + Projectile.rotation += Projectile.direction * rotSpeed; + + bool smokey = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -10).RotatedBy(Projectile.rotation), smokey && Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType(), Projectile.rotation.ToRotationVector2() * Main.rand.NextFloat(2f, 3f), 0, default, Main.rand.NextFloat(0.4f, 0.75f)); + dust.noGravity = smokey; + dust.color = smokey ? Color.White : mainColor; + dust.noLight = true; + dust.alpha = 180; + dust.scale *= (smokey ? 2.2f : 1); + dust.velocity += (smokey ? Vector2.UnitY * -2 : Vector2.Zero); + dust.noLightEmittence = true; + } + else + Projectile.timeLeft = (int)(Projectile.timeLeft * 0.98f); // Decay lifetime if it has hit a tile. + } + else + { + Projectile.velocity = Owner.velocity; + float completion = time / (Owner.HeldItem.useAnimation * 0.7f); // The completion of the throw animation. + if (completion >= 1) // The moment of being thrown. + { + time = -1; + Projectile.Center = Owner.Center; + Projectile.extraUpdates = hasReachedFullCharge ? 16 : 5; + Projectile.rotation += Main.rand.NextFloat(-4, 4); + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float speedMult = (float)Math.Pow(Utils.GetLerpValue(1, 4, charge, true), 2) + 0.05f; + float arcValue = hasReachedFullCharge ? 0 : (float)Math.Pow(Utils.Remap(speedMult, 0, 1f, 1f, 0.8f), 4); + Projectile.ai[1] = arcValue; + Projectile.velocity = velocity * 9 * speedMult; + + SoundStyle w = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(w with { Volume = 1f, Pitch = 0.2f, MaxInstances = 6 }, Projectile.Center); + if (hasReachedFullCharge) + { + rotSpeed *= 2; + SoundStyle w2 = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(w2 with { Volume = 1f, Pitch = -0.4f, MaxInstances = 6 }, Projectile.Center); + } + else + Owner.Calamity().ConsumeStealthByAttacking(); + + if (Owner.Calamity().StealthStrikeAvailable() && hasReachedFullCharge) + { + Projectile.Calamity().stealthStrike = true; + Owner.Calamity().ConsumeStealthByAttacking(); + } + + Projectile.tileCollide = true; + flung = true; + } + else + { + if (Main.mouseLeft && !hasStoppedHolding) // The charging up. + { + if (completion >= 0.7f && completion <= 0.8f) + { + time--; + if (charge < 4) + charge += 0.1f; + else + { + // Player has 18 frames to let go after it has fully charged, otherwise it will start to drain stealth. Timing is key! + if (stealthPenaltyTimer == 18) + { + SoundStyle w = new("CalamityMod/Sounds/Item/MeldSlice"); + SoundEngine.PlaySound(w with { Volume = 0.3f, Pitch = 0.4f }, Projectile.Center); + } + if (stealthPenaltyTimer >= 18) + { + Owner.Calamity().rogueStealth -= Owner.Calamity().rogueStealthMax * 0.035f; + CheckStealth(); + } + else + charge = 4; + stealthPenaltyTimer++; + } + if (charge >= 4 && !hasReachedFullCharge) + { + SoundStyle w = new("CalamityMod/Sounds/Item/MeldSlice"); + SoundEngine.PlaySound(w with { Volume = 0.55f, Pitch = 1f }, Projectile.Center); + + for (int i = 0; i < 12; i++) + { + Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + c.velocity = (MathHelper.TwoPi * i / 12f).ToRotationVector2().RotatedBy(Projectile.rotation) * 5.5f * (i % 2 == 0 ? 0.8f : 1f); + c.scale = 0.7f * (i % 2 == 0 ? 2.2f : 1.8f); + c.noGravity = true; + c.color = i % 2 == 0 ? Color.Turquoise : Color.Orchid; + c.noLightEmittence = true; + } + + hasReachedFullCharge = true; + } + } + } + else + hasStoppedHolding = true; + + Projectile.Opacity = (charge - 1) / 4; // This opacity if for the glowing effects of the projectile, not the projectile itself. + Owner.direction = Math.Sign(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).X); + float grenadeRot = 0; + // All the annoying to make rotation and placement code for the throw animation. + if (completion >= 0.7f) + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7); + grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(-75, 130f, completionLerp) * Owner.direction); + } + else + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp) * Owner.direction); + } + grenadeRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation(); + Vector2 grenadePos = Owner.MountedCenter + new Vector2(0, -24 * Owner.direction).RotatedBy(grenadeRot); + float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + float grenadeHalfRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction); + + Projectile.Center = grenadePos; + Projectile.rotation = grenadeRot - MathHelper.ToRadians(25 * grenadeHalfRot); + + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation() - MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, grenadeRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0))); + } + } + time++; + Lighting.AddLight(Projectile.Center, mainColor.ToVector3() * (0.3f + charge * 0.1f)); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + TileHit(); + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float finalHitMult = 1; // If it is the last hit of a stealth strike, this is increased. + + if (Projectile.Calamity().stealthStrike && !doneHitting) // Stealth strike bounce code, TODO: port this over to Pulse Rifle/Pusle Pistol because this is just a more functional version of theirs. + { + NPC chosenTarget = null; + float distance = 2500; + for (int index = 0; index < Main.npc.Length; index++) // look for a target that isnt one it has already hit in the last two hits. + { + NPC searchedTarget = Main.npc[index]; + if (searchedTarget.CanBeChasedBy(null, false)) + { + float extraDistance = (searchedTarget.width / 2) + (searchedTarget.height / 2); + + bool canHit = true; + if (extraDistance < distance) + canHit = Collision.CanHit(Projectile.Center, 1, 1, Main.npc[index].Center, 1, 1); + + if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && (lastHitTarget != null ? searchedTarget != lastHitTarget : true) && searchedTarget != target && searchedTarget.active && searchedTarget.life > 0 && canHit) + { + distance = Vector2.Distance(Projectile.Center, searchedTarget.Center); + chosenTarget = searchedTarget; + } + } + } + if (chosenTarget == null) // If no target was found, check again but accept last hit targets as viable. + { + if (lastHitTarget != null) + Projectile.localNPCImmunity[lastHitTarget.whoAmI] = 0; + + for (int index = 0; index < Main.npc.Length; index++) + { + NPC searchedTarget = Main.npc[index]; + if (searchedTarget.CanBeChasedBy(null, false)) + { + float extraDistance = (searchedTarget.width / 2) + (searchedTarget.height / 2); + + bool canHit = true; + if (extraDistance < distance) + canHit = Collision.CanHit(Projectile.Center, 1, 1, Main.npc[index].Center, 1, 1); + + if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && searchedTarget != target && searchedTarget.active && searchedTarget.life > 0 && canHit) + { + distance = Vector2.Distance(Projectile.Center, searchedTarget.Center); + chosenTarget = searchedTarget; + } + } + } + } + + if (chosenTarget != null && Projectile.numHits <= maxStealthHits) // If a valid target is found and it can still bounce, redirect the projectile. + { + if (lastHitTarget != null) + Projectile.localNPCImmunity[lastHitTarget.whoAmI] = 0; + lastHitTarget = target; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, chosenTarget.Center) * 9; + + SoundStyle sound = new("CalamityMod/Sounds/Item/DoomsdayDeviceImpact"); + SoundEngine.PlaySound(sound with { Volume = 0.9f, Pitch = 0.1f + Projectile.numHits * 0.15f, MaxInstances = 6 }, Projectile.Center); + + for (int i = 0; i <= 6; i++) + { + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity); + dust2.scale = Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance); + dust2.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5 * charge).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)) * finalHitMult; + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Turquoise : Color.Orchid; + } + + Particle pulse = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.2f, Color.Turquoise * 0.85f, new Vector2(3f, 1f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2.5f, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.175f * finalHitMult, Color.Orchid * 0.7f, new Vector2(2.5f, 2f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(pulse2); + + Owner.Calamity().GeneralScreenShakePower = 3; + } + else // If there's no targets other than the currently hit one or the projectile is out of bounces, deal the final stronger blow. + { + finalHitMult = 2; + SoundStyle sound = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = 0.2f }, Projectile.Center); + Projectile.numHits = maxStealthHits; + } + + } + + // Do the damage calculation now. It's not at the bottom of this section because of some variables that are changed below. + float minMult = 0.2f; + int hitsToMinMult = maxStealthHits + 2; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true) * (doneHitting ? 0.3f : 1); + float finalDamageMult = (charge / 4) * (hasReachedFullCharge ? 1.5f : 1) * damageMult * Utils.Remap(finalHitMult, 1, 2, 1, 5); + modifiers.SourceDamage *= finalDamageMult; + + if ((!doneHitting && !Projectile.Calamity().stealthStrike) || (!doneHitting && finalHitMult > 1)) // Regular hits and the final hit from stealth strikes. + { + Vector2 launchDir = Utils.DirectionTo(Projectile.Center, target.Center); + float launchPower = ((hasReachedFullCharge ? 9 : 0) + charge * 1.5f) * finalHitMult; + + target.MoveNPC(launchDir, launchPower, true); + + float extraPitch = (Owner.Calamity().rogueStealthMax > 0 ? (0.25f * (Owner.Calamity().rogueStealth / Owner.Calamity().rogueStealthMax)) : 0); + + if (!Projectile.Calamity().LocketClone && finalHitMult == 1 && giveStealth) // Locket clones and stealth strikes don't create stealth. + { + Owner.Calamity().rogueStealth += Owner.Calamity().rogueStealthMax * 0.3f; + CheckStealth(); + giveStealth = false; + } + + Owner.Calamity().GeneralScreenShakePower = charge * (hasReachedFullCharge ? 1.2f : 0.8f) * finalHitMult; + + for (int i = 0; i <= 12 * finalHitMult; i++) + { + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, dustStyle, launchDir * 5); + dust2.scale = Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance); + dust2.velocity = (launchDir * 5 * charge).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)) * finalHitMult; + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Turquoise : Color.Orchid; + } + + if (hasReachedFullCharge) + { + SoundStyle soundExtra = new("CalamityMod/Sounds/Item/DoomsdayDeviceImpact"); + SoundEngine.PlaySound(soundExtra with { Volume = 1f, Pitch = 0.35f + extraPitch, MaxInstances = 6 }, Projectile.Center); + + Particle pulse = new CustomSpark(Projectile.Center, -launchDir * 3, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.4f * finalHitMult, Color.Turquoise * 0.85f, new Vector2(3f, 1f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new CustomSpark(Projectile.Center, -launchDir * 2.5f, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.35f * finalHitMult, Color.Orchid * 0.7f, new Vector2(2.5f, 2f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(pulse2); + } + SoundStyle sound = new("CalamityMod/Sounds/Item/DoomsdayDeviceImpact"); + SoundEngine.PlaySound(sound with { Volume = hasReachedFullCharge ? 1 : 0.7f, Pitch = 0.1f + extraPitch, MaxInstances = 6 }, Projectile.Center); + + doneHitting = true; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + bool onKill = ((target.life <= 0 && target.realLife == -1) || target.lifeMax == 1); + + if (onKill && Projectile.numHits < maxStealthHits && hasReachedFullCharge) // If an enemy is killed by the grenade impact, don't increase the hit counter and allow it to pierce them. + { + Projectile.numHits--; + doneHitting = false; + } + else if (doneHitting && Projectile.extraUpdates != 4) // The fall to ground after hit effect. + { + Projectile.velocity = Vector2.Lerp(Utils.DirectionFrom(Projectile.Center, target.Center) * 4, Vector2.UnitY * -2, 0.75f).RotatedByRandom(0.1f); + Projectile.extraUpdates = 4; + } + } + public void TileHit() + { + Projectile.velocity = Vector2.Zero; + rotSpeed = 0; + Projectile.extraUpdates = 3; + hasReachedFullCharge = false; + if (tileHits == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3); + SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = -0.55f, MaxInstances = 6 }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + SoundEngine.PlaySound(sound2 with { Volume = 0.4f, Pitch = -0.2f, MaxInstances = 6 }, Projectile.Center); + } + tileHits++; + + } + public void CheckStealth() + { + if (Owner.Calamity().rogueStealth > Owner.Calamity().rogueStealthMax) + Owner.Calamity().rogueStealth = Owner.Calamity().rogueStealthMax; + if (Owner.Calamity().rogueStealth < 0) + Owner.Calamity().rogueStealth = 0; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 30, targetHitbox); + public override bool PreDraw(ref Color lightColor) + { + Color glowColor = Color.Lerp(mainColor, Color.Red, Utils.GetLerpValue(60, 18, (stealthPenaltyTimer >= 18 ? stealthPenaltyTimer : 60))); + float fade = Utils.GetLerpValue(0, 300, Projectile.timeLeft, true); + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + for (int i = 0; i < 25; i++) + { + Color auraColor = glowColor with { A = 0 } * 0.35f * fade; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * (hasReachedFullCharge ? 7 : 3f) * Projectile.Opacity; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + drawOffset + Main.rand.NextVector2Circular(4, 4), null, auraColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None); + } + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * fade, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value, Projectile.Center - Main.screenPosition, null, glowColor * Projectile.Opacity * fade, Projectile.rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + overPlayers.Add(index); + } + } +} diff --git a/Projectiles/Rogue/DragonScalesInfernado.cs b/Projectiles/Rogue/DragonScalesInfernado.cs index a2d7cfb451..f30b9462d4 100644 --- a/Projectiles/Rogue/DragonScalesInfernado.cs +++ b/Projectiles/Rogue/DragonScalesInfernado.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Rogue bool intersectingSomething = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; + Main.projFrames[Type] = 12; } public override void SetDefaults() @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -146,8 +146,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameDraw = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameDraw = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 2f0cbb809e..22ca91db72 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; if (Projectile.timeLeft >= 420) @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Rogue { int cap = 5; float capDamageFactor = 0.05f; - int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type] - cap; + int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap; modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f); } @@ -82,8 +82,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D projectileTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D projectileTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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; @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/DukesDecapitatorProj.cs b/Projectiles/Rogue/DukesDecapitatorProj.cs index f6684198f6..99f9cb0933 100644 --- a/Projectiles/Rogue/DukesDecapitatorProj.cs +++ b/Projectiles/Rogue/DukesDecapitatorProj.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,8 +14,8 @@ namespace CalamityMod.Projectiles.Rogue public override string Texture => "CalamityMod/Items/Weapons/Rogue/DukesDecapitator"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -60,10 +61,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 120); Projectile.velocity = Vector2.Zero; rotationAmount -= 0.05f; } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnKill(int timeLeft) { for (int i = 0; i < 20; i++) @@ -74,7 +78,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index 39820711d9..be9d2ec200 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -5,10 +5,7 @@ namespace CalamityMod.Projectiles.Rogue public class DuststormCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - } + public override void SetStaticDefaults() => Main.projFrames[Type] = 4; public override void SetDefaults() { @@ -16,13 +13,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 14; Projectile.friendly = true; Projectile.alpha = 255; - Projectile.penetrate = -1; //Would only be used by Sandslasher stealth Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Generic; - Projectile.usesIDStaticNPCImmunity = true; //Would only be used by Sandslasher stealth - Projectile.idStaticNPCHitCooldown = 6; //Also only used by Sandslasher stealth } public override void AI() @@ -33,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Rogue/DuststormInABottleProj.png b/Projectiles/Rogue/DuststormInABottleProj.png deleted file mode 100644 index 1e049812e3..0000000000 Binary files a/Projectiles/Rogue/DuststormInABottleProj.png and /dev/null differ diff --git a/Projectiles/Rogue/DynamicPursuerElectricity.cs b/Projectiles/Rogue/DynamicPursuerElectricity.cs index 1e79b95400..9e44160aad 100644 --- a/Projectiles/Rogue/DynamicPursuerElectricity.cs +++ b/Projectiles/Rogue/DynamicPursuerElectricity.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Projectiles.Rogue }*/ public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 50; + ProjectileID.Sets.TrailCacheLength[Type] = 50; ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { diff --git a/Projectiles/Rogue/DynamicPursuerProjectile.cs b/Projectiles/Rogue/DynamicPursuerProjectile.cs index d12823defd..132302e852 100644 --- a/Projectiles/Rogue/DynamicPursuerProjectile.cs +++ b/Projectiles/Rogue/DynamicPursuerProjectile.cs @@ -48,8 +48,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -289,8 +289,8 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, ProjectileID.Sets.TrailCacheLength[Type]); + Texture2D texture = Terraria.GameContent.TextureAssets.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; diff --git a/Projectiles/Rogue/EclipseMirrorBurst.cs b/Projectiles/Rogue/EclipseMirrorBurst.cs index 9076e35af0..e378a547f9 100644 --- a/Projectiles/Rogue/EclipseMirrorBurst.cs +++ b/Projectiles/Rogue/EclipseMirrorBurst.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Main.spriteBatch.Draw ( texture, diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index 62e45e3ebe..f9831d85bc 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.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.Rogue @@ -8,6 +9,7 @@ namespace CalamityMod.Projectiles.Rogue public class EclipsesSmol : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 24; @@ -28,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/EnchantedAxe2.cs b/Projectiles/Rogue/EnchantedAxe2.cs index 7d9ade368b..201416cdb1 100644 --- a/Projectiles/Rogue/EnchantedAxe2.cs +++ b/Projectiles/Rogue/EnchantedAxe2.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.Rogue { @@ -9,13 +10,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/EnchantedAxe"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.penetrate = 2; Projectile.timeLeft = 150; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -25,12 +26,13 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Projectile.rotation += 0.4f * Projectile.direction; - return; + if (Projectile.ai[0] == 1f) + CalamityUtils.HomeInOnNPC(Projectile, true, 256f, 15f, 20f); } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 3ef7ccf355..ff859e9c29 100644 --- a/Projectiles/Rogue/EnchantedAxeProj.cs +++ b/Projectiles/Rogue/EnchantedAxeProj.cs @@ -14,11 +14,12 @@ namespace CalamityMod.Projectiles.Rogue private bool recall = false; private bool summonAxe = true; + private int Lifetime = 600; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.timeLeft = 600; + Projectile.timeLeft = Lifetime; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 15; Projectile.DamageType = RogueDamageClass.Instance; @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.Calamity().stealthStrike) { - if (Projectile.timeLeft < 585) + if (Projectile.timeLeft < Lifetime - 18) { recall = true; Projectile.tileCollide = false; @@ -45,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - if (Projectile.timeLeft < 590) + if (Projectile.timeLeft < Lifetime - 10) { recall = true; Projectile.tileCollide = false; @@ -70,51 +71,14 @@ namespace CalamityMod.Projectiles.Rogue if (summonAxe) { - float minDist = 999f; - int index = 0; - // Get the closest enemy to the axe - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false)) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - Vector2 newAxeVelocity; - if (minDist < 999f) - { - newAxeVelocity = Main.npc[index].Center - Projectile.Center; - } - else - { - newAxeVelocity = -Projectile.velocity; - } - newAxeVelocity.Normalize(); - newAxeVelocity *= 20f; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, newAxeVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), 2, Projectile.owner, 0, 0); - Main.projectile[p].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; - summonAxe = false; + SummonAxe(true); } } else { - if (Projectile.timeLeft % 7 == 1 && Projectile.Calamity().stealthStrike) + if (Projectile.timeLeft % 3 == 1 && Projectile.Calamity().stealthStrike) { - float axeSpeed = 15f; - int axeDamage = Projectile.damage / 2; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(0f, 1f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(-1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(0f, -1f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, Vector2.Normalize(new Vector2(1f, 1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, Vector2.Normalize(new Vector2(1f, -1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, Vector2.Normalize(new Vector2(-1f, -1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, Vector2.Normalize(new Vector2(-1f, 1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); + SummonAxe(false); } } @@ -125,11 +89,41 @@ namespace CalamityMod.Projectiles.Rogue return; } + public void SummonAxe(bool recall) + { + float minDist = 999f; + int index = 0; + // Get the closest enemy to the axe + foreach (NPC npc in Main.ActiveNPCs) + { + if (npc.CanBeChasedBy(Projectile, false)) + { + float dist = (Projectile.Center - npc.Center).Length(); + if (dist < minDist) + { + minDist = dist; + index = npc.whoAmI; + } + } + } + Vector2 newAxeVelocity; + if (minDist < 999f) + newAxeVelocity = Main.npc[index].Center - Projectile.Center; + else + newAxeVelocity = -Projectile.velocity; + + newAxeVelocity.Normalize(); + newAxeVelocity *= 20f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, newAxeVelocity, ModContent.ProjectileType(), Projectile.damage, 2, Projectile.owner, recall ? 0f : 1f); + if (recall) + summonAxe = false; + } + public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/EquanimityDarkShard.cs b/Projectiles/Rogue/EquanimityDarkShard.cs index aa65007872..3945f25301 100644 --- a/Projectiles/Rogue/EquanimityDarkShard.cs +++ b/Projectiles/Rogue/EquanimityDarkShard.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,6 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public class EquanimityDarkShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "Terraria/Images/Item_527"; public override void SetDefaults() { Projectile.width = 12; @@ -16,65 +19,23 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.alpha = 0; - Projectile.penetrate = 1; + Projectile.penetrate = 4; Projectile.tileCollide = true; - Projectile.timeLeft = 120; + Projectile.timeLeft = 45; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - Projectile.velocity.Y += 0.1f; - Projectile.rotation += 0.4f * Projectile.direction; - if (Projectile.timeLeft < 130) + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.03f; + Projectile.velocity *= 0.94f; + if (Projectile.ai[0] == 1f) { - float minDist = 999f; - int index = 0; - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false)) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - - Vector2 velocityNew; - if (minDist < 999f) - { - velocityNew = Main.npc[index].Center - Projectile.Center; - velocityNew.Normalize(); - Projectile.velocity += velocityNew; - if (Projectile.velocity.Length() > 10f) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= 10f; - } - } - } - - if (Projectile.timeLeft < 51) - { - Projectile.alpha += 5; + Projectile.penetrate = -1; } } - - 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); @@ -82,5 +43,34 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Kill(); return true; } + public override void OnKill(int timeLeft) + { + if (Projectile.ai[0] == 1f) + { + + } + for (int i = 0; i < 16; i++) + { + int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.Asphalt, 0f, 0f, 100, default, 1.5f); + Main.dust[dust].velocity *= 0.6f; + Main.dust[dust].noGravity = true; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + if (Projectile.ai[0] == 1f) + { + for (int i = 0; i < 3; i++) + { + Main.EntitySpriteDraw(Texture, Projectile.Center - Main.screenPosition, null, Color.Indigo with { A = 0 }, Projectile.rotation, Texture.Size() * 0.5f, Projectile.scale * 1.5f, SpriteEffects.None); + } + } + 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); + return false; + } } } diff --git a/Projectiles/Rogue/EquanimityDarkShard.png b/Projectiles/Rogue/EquanimityDarkShard.png deleted file mode 100644 index 1ba148ffdc..0000000000 Binary files a/Projectiles/Rogue/EquanimityDarkShard.png and /dev/null differ diff --git a/Projectiles/Rogue/EquanimityLightShard.cs b/Projectiles/Rogue/EquanimityLightShard.cs index 1969d188fa..08d2cd1b20 100644 --- a/Projectiles/Rogue/EquanimityLightShard.cs +++ b/Projectiles/Rogue/EquanimityLightShard.cs @@ -1,4 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,6 +12,10 @@ namespace CalamityMod.Projectiles.Rogue public class EquanimityLightShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "Terraria/Images/Item_528"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; + + public int TimeBeforeHoming = 30; public override void SetDefaults() { Projectile.width = 12; @@ -16,22 +23,39 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.alpha = 0; - Projectile.penetrate = 3; Projectile.tileCollide = true; - Projectile.timeLeft = 120; + Projectile.timeLeft = 180; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + TimeBeforeHoming = Main.rand.Next(30, 60); + } + public override bool? CanDamage() + { + if (Projectile.ai[1] < TimeBeforeHoming) return false; + return base.CanDamage(); } - public override void AI() { - Projectile.velocity.Y += 0.1f; - Projectile.rotation += 0.4f * Projectile.direction; - - if (Projectile.timeLeft < 51) + Projectile.ai[1]++; + //Rotation and gravity + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.03f; + if (Projectile.ai[1] < TimeBeforeHoming) { - Projectile.alpha += 5; + Projectile.velocity *= 0.94f; + } + else + { + Projectile.ai[2] = MathHelper.Lerp(Projectile.ai[2], 10, 0.05f); + CalamityUtils.HomeInOnNPC(Projectile, false, Projectile.ai[0] == 1f ? 800 : 400, Projectile.ai[2], 0.2f); + Projectile.velocity.Y += 0.25f; + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.GemDiamond, 0f, 0f, 100, default, 1f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].noGravity = true; } } @@ -42,5 +66,21 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Kill(); return true; } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + if (Projectile.ai[0] == 1f) + { + for (int i = 0; i < 3; i++) + { + Main.EntitySpriteDraw(Texture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, Texture.Size() * 0.5f, Projectile.scale * 1.25f, SpriteEffects.None); + } + } + 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); + return false; + } } } diff --git a/Projectiles/Rogue/EquanimityLightShard.png b/Projectiles/Rogue/EquanimityLightShard.png deleted file mode 100644 index f3b3357126..0000000000 Binary files a/Projectiles/Rogue/EquanimityLightShard.png and /dev/null differ diff --git a/Projectiles/Rogue/EquanimityProj.cs b/Projectiles/Rogue/EquanimityProj.cs index 903bd27b27..6ca0713e32 100644 --- a/Projectiles/Rogue/EquanimityProj.cs +++ b/Projectiles/Rogue/EquanimityProj.cs @@ -1,8 +1,16 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Melee; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using System.Collections.Generic; +using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.Typeless; namespace CalamityMod.Projectiles.Rogue { @@ -11,124 +19,279 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Equanimity"; - private bool recall = false; + public static int ChargeupTime = 10; + public static int Lifetime = 500; + 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 override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } + public Player Owner => Main.player[Projectile.owner]; + public ref float Returning => ref Projectile.ai[0]; + public ref float Bouncing => ref Projectile.ai[2]; + + public bool swapType = false; public override void SetDefaults() { - Projectile.width = 28; - Projectile.height = 36; + Projectile.width = 46; + Projectile.height = 46; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.timeLeft = 600; + Projectile.timeLeft = Lifetime + ChargeupTime; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; + Projectile.localNPCHitCooldown = 10; Projectile.DamageType = RogueDamageClass.Instance; } + 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; + + if (Returning == 1f) + 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 ((Main.player[Projectile.owner].position - Projectile.position).Length() > 600f) + //Anticipation animation. Make the player look like theyre holding the boomerang + if (ChargeProgress < 1) { - recall = true; + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -40f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver2 + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + Projectile.tileCollide = false; - } - - Projectile.rotation += 0.4f * Projectile.direction; - - if (recall) - { - if (Main.rand.Next(0, 10) == 0) - { - 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); - if (Projectile.Calamity().stealthStrike) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); - } - } - - Vector2 posDiff = Main.player[Projectile.owner].position - Projectile.position; - if (posDiff.Length() > 30f) - { - posDiff.Normalize(); - Projectile.velocity = posDiff * 30f; - } - else - { - Projectile.timeLeft = 0; - OnKill(Projectile.timeLeft); - } 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) + { + SoundEngine.PlaySound(SoundID.DD2_GoblinBomberThrow, Projectile.Center); + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * 17.5f; + Projectile.tileCollide = true; + } + + Projectile.rotation += (MathHelper.PiOver4 / 4f + MathHelper.PiOver4 / 2f * Math.Clamp(ThrowProgress * 2f, 0, 1)) * Math.Sign(Projectile.velocity.X); + + //Boomerang spinny sounds + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.Item7, Projectile.Center); + Projectile.soundDelay = 8; + } + + if (Projectile.velocity.Length() < 2f && Bouncing == 0f) + { + Returning = 1f; + Projectile.numHits = 0; + } + + if (Returning == 0f && Bouncing == 0f && Projectile.velocity.Length() > 2f && Projectile.timeLeft < (455 + ChargeupTime)) + { + Projectile.velocity *= 0.88f; + } + + if (Returning == 1f && Projectile.velocity.Length() < 20f) + { + Projectile.velocity *= 1.1f; + } + + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 14f; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool() ? 91 : 109, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 3f); + dust.noGravity = true; + } + + if (Returning == 1f) + { + Projectile.tileCollide = false; + //Aim back at the player + Projectile.velocity = Projectile.velocity.Length() * (Owner.MountedCenter - Projectile.Center).SafeNormalize(Vector2.One); + + if ((Projectile.Center - Owner.MountedCenter).Length() < 24f) + { + Projectile.Kill(); + } + + if (Projectile.numHits >= 7) + { + Projectile.Kill(); + } + } + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Confused, 30); - - if (!recall) + //If a non stealth strike, spawn no visuals and the regular versions of the shards + if (!Projectile.Calamity().stealthStrike) { - int shardCount = Main.rand.Next(1, 3); - for (int i = 0; i <= shardCount; i++) + float baseDirectionRotation = Main.rand.NextFloat(MathHelper.TwoPi); + Vector2 shootVelocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + if (!swapType) { - 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); - if (Projectile.Calamity().stealthStrike) + for (int s = 0; s < 2; s++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity.RotatedByRandom(100), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner); + } + if (swapType) + { + for (int s = 0; s < 2; s++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity.RotatedByRandom(100), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner); + } + swapType = !swapType; + } + //If stealth strike, spawn the explosion visuals and enhance shards + else + { + float baseDirectionRotation = Main.rand.NextFloat(MathHelper.TwoPi); + Vector2 shootVelocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + if (!swapType) + { + #region Visuals and Sounds + SoundEngine.PlaySound(DeadSunsWind.Explosion with { Volume = 0.4f }, Projectile.Center); + for (int i = 0; i < 3; i++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); + Particle innerglow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0, 0.3f, 15); + GeneralParticleHandler.SpawnParticle(innerglow); + } + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/FlameExplosion2", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.04f, 25, false, 0.85f); + GeneralParticleHandler.SpawnParticle(explosion); + Particle explosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/FlameExplosion2", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.07f, 25, false, 0.85f); + GeneralParticleHandler.SpawnParticle(explosion2); + Particle explosion3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.07f, 0.08f, 30); + GeneralParticleHandler.SpawnParticle(explosion3); + for (int s = 0; s < 13; s++) + { + Vector2 randVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.Black, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(0.3f, 0.5f), 0.8f); + GeneralParticleHandler.SpawnParticle(smoke); + } + #endregion + // Create Blast + float blastSize = 90; + float minMultiplier = 0.25f; + int hitsToMinMult = 8; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.DamageType = RogueDamageClass.Instance; + for (int s = 0; s < 2; s++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity.RotatedByRandom(100), ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner, 1f, 1f); + } + if (swapType) + { + #region Visuals and Sounds + SoundEngine.PlaySound(LunicEye.UseSound with { Volume = 0.7f }, Projectile.Center); + for (int i = 0; i < 3; i++) + { + Particle innerglow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightPink, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0, 0.3f, 15); + GeneralParticleHandler.SpawnParticle(innerglow); + } + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.WhiteSmoke, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.07f, 20, true); + GeneralParticleHandler.SpawnParticle(explosion); + Particle explosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.07f, 20, true); + GeneralParticleHandler.SpawnParticle(explosion2); + Particle explosion4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightPink, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.3f, 20, true); + GeneralParticleHandler.SpawnParticle(explosion4); + Particle explosion3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightPink, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.04f, 20); + GeneralParticleHandler.SpawnParticle(explosion3); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.09f, 25); + GeneralParticleHandler.SpawnParticle(blastRing2); + for (int i = 0; i < 10; i++) + { + CritSpark spark2 = new CritSpark(Projectile.Center, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f), Color.White, Color.Orchid, 0.9f, 20, 2f, 2.2f); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int k = 0; k < 10; k++) + { + Vector2 velocity = new Vector2(10, 10).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.009f, 0.005f), Color.Lerp(Color.DarkOrchid, Color.IndianRed, colorRando), new Vector2(2.2f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + #endregion + // Create Blast + float blastSize = 90; + float minMultiplier = 0.25f; + int hitsToMinMult = 8; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.DamageType = RogueDamageClass.Instance; + for (int s = 0; s < 2; s++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity.RotatedByRandom(100), ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner, 1f, 1f); + } + swapType = !swapType; + } + + if (Projectile.numHits > 4) + { + Projectile.velocity *= 0.3f; + Returning = 1f; + } + + else + { + //Retarget + NPC newTarget = null; + float closestNPCDistance = 10000f; + float targettingDistance = 900f; + + foreach (NPC n in Main.ActiveNPCs) + { + if (n.whoAmI == target.whoAmI) + continue; + + if (n.CanBeChasedBy(Projectile)) + { + float potentialNewDistance = (Projectile.Center - n.Center).Length(); + if (potentialNewDistance < targettingDistance && potentialNewDistance < closestNPCDistance) + { + closestNPCDistance = potentialNewDistance; + newTarget = n; + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, newTarget, 30f, 3); + } } } - } - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(BuffID.Confused, 30); - - if (!recall) - { - int shardCount = Main.rand.Next(1, 3); - for (int i = 0; i <= shardCount; i++) + if (newTarget == null) { - 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); - if (Projectile.Calamity().stealthStrike) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); - } + Projectile.velocity *= 0.3f; + Returning = 1f; + return; } - } - } - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3); - return false; + // The boomerang loses 15% damage per bounce. + Projectile.damage = (int)(Projectile.damage * 0.85f); + Bouncing = 2f; + } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (recall) - { - return false; - } - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - recall = true; - Projectile.tileCollide = false; + Projectile.velocity = Projectile.oldVelocity.Length() * 0.3f * (Owner.MountedCenter - Projectile.Center).SafeNormalize(Vector2.One); + Returning = 1f; return false; } } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 6ae62597b9..6c32ebf15d 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -227,7 +227,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index b52e8d2ad2..ae1c6226d1 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -27,8 +27,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -105,7 +106,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs index 40b244acc3..7eca83fe91 100644 --- a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 79b74887d0..86102bdd3f 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -1,8 +1,15 @@ -using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; -using Terraria.ID; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -12,105 +19,449 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Exorcism"; + public ref float time => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + + public bool flung = false; // If the projectile has entered the thrown state. + public bool hitTiles => Projectile.ai[1] == -5; // In post hit tiles state + public bool inSky => Projectile.ai[1] == 5; // After being thrown, waiting to come down state + public bool falling => Projectile.ai[1] == 10; // Falling from the sky state + public int fallTime = 55; // Time spend in the sky + public NPC targeted; // Target impaled into + public Vector2 impaleDist; // Distance from impaled target's center + public int hitRate = 60; // How fast the cross burns with holy light + public float randpitch = 0; // Some random pitch for the looping sound + public bool stealth => Projectile.Calamity().stealthStrike; + public Vector2 storedStealthVel; // stored velocity for the boomerang turn around + public Vector2 crossCenter => Projectile.Center + (Vector2.UnitY * -11).RotatedBy(Projectile.rotation); // The center of the cross + + public Color mainColor = Color.Gold; + public SlotId AudSlot; public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 25; + Projectile.height = 80; Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.alpha = 0; - Projectile.penetrate = 1; - Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.extraUpdates = 1; } - + public override bool ShouldUpdatePosition() => flung && !inSky && !hitTiles && (impaleDist == Vector2.Zero || stealth); + public override bool? CanDamage() => ((flung && !inSky && !hitTiles && impaleDist == Vector2.Zero) ? null : false); public override void AI() { - Projectile.velocity.Y += 0.1f; - Projectile.rotation += 0.05f * Projectile.direction; - - // Dust Effects - Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(Projectile.rotation); - Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(Projectile.rotation); - - float minSpeed = 1.5f; - float maxSpeed = 5f; - float minScale = 0.8f; - float maxScale = 1.4f; - - int dustType = 175; - int dustCount = (int)(5 * (Projectile.ai[0])); - - for (int i = 0; i < dustCount; i++) + if (stealth && Projectile.ai[2] != 5) // Multiplayer Syncing? { - int left = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[left].noGravity = true; - Main.dust[left].position = Projectile.Center; - Main.dust[left].velocity = dustLeft * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale); + Projectile.ai[2] = 5; + Projectile.ForceNetUpdate(); + } + if (Projectile.ai[2] == 5) + Projectile.Calamity().stealthStrike = true; - int right = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[right].noGravity = true; - Main.dust[right].position = Projectile.Center; - Main.dust[right].velocity = dustRight * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale); + if (!flung && time == 0) + randpitch = Main.rand.NextFloat(-0.1f, 0.1f); + if (flung) + { + if (hitTiles) + { + holySound(); + if (Projectile.timeLeft > 300) + Projectile.timeLeft = 300; + } + else if (inSky) + { + Projectile.Center = new Vector2(Owner.ClampedMouseWorld().X, Owner.Center.Y) + new Vector2(0, -700); + Projectile.Opacity = 0; + Projectile.extraUpdates = 0; + Projectile.timeLeft++; + fallTime--; + if (fallTime <= 0) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.Opacity = 1; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld) * 7; + Projectile.numHits = 0; + Projectile.extraUpdates = 25; + Projectile.ai[1] = 10; + } + if (fallTime == 10) + { + for (int i = 0; i < 2; i++) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/MissileNearing"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = 0.8f, MaxInstances = 2 }, Projectile.Center); + } + } + } + else if (falling) + { + if (Projectile.numHits == 0) + { + Projectile.timeLeft++; + if (Projectile.Center.Y + 80 > Owner.Calamity().mouseWorld.Y && Collision.SolidCollision(Projectile.Center, 20, 20)) + { + Projectile.netUpdate = true; + Projectile.extraUpdates = 3; + Projectile.ai[1] = -5; + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit2"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0f, 0.1f) }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + SoundEngine.PlaySound(sound2 with { Volume = 0.7f, Pitch = -0.3f }, Projectile.Center); + } - int up = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[up].noGravity = true; - Main.dust[up].position = Projectile.Center; - Main.dust[up].velocity = dustUp * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - int down = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[down].noGravity = true; - Main.dust[down].position = Projectile.Center; - Main.dust[down].velocity = dustDown * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale); + float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true); + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 35, Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 43, 0.4f, mainColor * 0.4f * squash, new Vector2(1 - 0.15f * squash, 1f), true, false, shrinkSpeed: 0.07f * squash); + GeneralParticleHandler.SpawnParticle(trail); + } + else + { + Projectile.extraUpdates = 3; + Projectile.Center = targeted.Center + impaleDist; + if (stealth) + Projectile.rotation += (0.08f - hitRate * 0.001f) * Projectile.direction * 0.3f; + + holySound(); + + if (time >= hitRate) + { + impaleDist.Y *= 0.93f; + Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), targeted.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * Utils.Remap(hitRate, 50, 5, 0.05f, 0.1f)), 0f, Owner.whoAmI, targeted.whoAmI, 1f); + strike.ArmorPenetration = 30; + strike.DamageType = RogueDamageClass.Instance; + if (hitRate > 10) + hitRate -= 10; + time = 0; + } + } + } + else // State before it enters the sky + { + if (stealth) + { + if (Projectile.timeLeft > 240) + { + // Boomerang noises + if (Projectile.soundDelay == 0) + { + Projectile.soundDelay = 5 * Projectile.MaxUpdates; + SoundStyle sound = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(sound with { MaxInstances = -1, Volume = 0.5f, Pitch = -0.2f }, Projectile.Center); + } + Projectile.rotation += 0.07f * Projectile.direction; + } + + if (time > 80) + { + if (Projectile.velocity.Length() < storedStealthVel.Length()) + Projectile.velocity += Utils.DirectionTo(Projectile.Center, Owner.Center) * 0.1f; + Projectile.velocity *= 0.99f; + if (time == 180) // Reset iframes when it starts to come back + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + } + if (Projectile.timeLeft <= 240) + { + impaleDist = Vector2.One; // This is so the projectile stops dealing damage + Projectile.extraUpdates = 3; + float endLerp = Utils.GetLerpValue(240, 90, Projectile.timeLeft, true); + Vector2 endPos = Vector2.Lerp((Owner.Center + Vector2.UnitY * (-50 - 90 * endLerp)), Owner.ClampedMouseWorld(), (float)Math.Pow(endLerp, 5)); + Projectile.velocity = (endPos - Projectile.Center) / 25; + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, 0, endLerp); + } + } + else + storedStealthVel = -Projectile.velocity * 1.1f; + + if (Projectile.timeLeft > 240) + { + int numParts = 2; + for (int i = 0; i < numParts; i++) + { + float fade = (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true) * 3 + 1); + + float rot = Projectile.rotation + (MathHelper.TwoPi * i / numParts); + Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * Projectile.direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); + + if (time % 5 == 0) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust2.noGravity = (dust2.type == 278 ? false : true); + dust2.scale = (dust2.type == 278 ? 0.95f : 1.2f) * 0.6f; + dust2.color = Color.Red; + dust2.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + if (time % 2 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust.noGravity = (dust.type == 278 ? false : true); + dust.scale = (dust.type == 278 ? 0.75f : 0.9f) * 0.6f; + dust.color = Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod; + dust.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + } + } + + holySound(); + } + else + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (time >= 120) + Projectile.ai[1] = 5; + if (time % 6 == 0 && time > 12) + { + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 35 + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 13, 0.2f, mainColor * 0.6f, new Vector2(0.6f, 1f), true, false, shrinkSpeed: 0.6f); + GeneralParticleHandler.SpawnParticle(trail); + } + } + } + } + else + { + Vector2 projToSky = Utils.DirectionTo(Projectile.Center, new Vector2(MathHelper.Lerp(Owner.ClampedMouseWorld().X, Owner.Center.X, 0.35f), Owner.Center.Y) + new Vector2(0, -500)); + Projectile.velocity = projToSky; + float completion = time / (Owner.HeldItem.useAnimation * 0.7f); // The completion of the throw animation. + if (completion >= 1) // The moment of being thrown. + { + Projectile.Center = Owner.Center; + Projectile.extraUpdates = stealth ? 9 : 6; + if (stealth) + Projectile.timeLeft = 560; + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float speed = 9; + Projectile.velocity = (stealth ? velocity : projToSky) * speed; + time = -1; + SoundStyle w = new("CalamityMod/Sounds/Item/SwooshMid"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(w with { Volume = 1f, Pitch = -0.4f + 0.2f * i, MaxInstances = 6 }, Projectile.Center); + + flung = true; + } + else + { + Owner.direction = Math.Sign(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).X); + float crossRot = 0; + // All the annoying to make rotation and placement code for the throw animation. + if (completion >= 0.7f) + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7); + crossRot = MathHelper.ToRadians(MathHelper.Lerp(-45, 130f, completionLerp) * Owner.direction); + } + else + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + crossRot = MathHelper.ToRadians(MathHelper.Lerp(120, -45f, completionLerp) * Owner.direction); + } + crossRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation(); + Vector2 crossPos = Owner.MountedCenter + new Vector2(0, -24 * Owner.direction).RotatedBy(crossRot); + float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + + Projectile.Center = crossPos; + if (stealth) + Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Pow(completion, 3) * 12 * Owner.direction; + else + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation() - MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, crossRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0))); + } + } + time++; + if (!inSky) + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.5f); + if (targeted != null && ((targeted.life <= 0 && targeted.realLife == -1) || targeted.lifeMax == 1)) + Projectile.Kill(); + } + public void holySound() + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var holy) && holy.IsPlaying) + { + holy.Position = Projectile.Center; + holy.Pitch = Utils.Remap(Projectile.timeLeft, 300, 0, -0.4f + randpitch, (stealth ? -0.15f : -0.3f) + randpitch); + holy.Volume = Utils.Remap(Projectile.timeLeft, 300, 0, 0f, 0.5f) * 100; + } + else if (Projectile.timeLeft > 1) + { + SoundStyle choir = new("CalamityMod/Sounds/Item/HolyLoop"); + AudSlot = SoundEngine.PlaySound(choir with { Volume = 0.01f, Pitch = 0 }, Projectile.Center); } } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (stealth) + { + float minMult = 0.35f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + else if (!falling || Projectile.numHits != 0) + modifiers.SourceDamage *= 0.1f; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - // Stars - if (Projectile.Calamity().stealthStrike) + bool onKill = ((target.life <= 0 && target.realLife == -1) || target.lifeMax == 1); + if (!onKill && falling) { - for (int i = 0; i < 6; i++) + if (!stealth) { - 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)); - Vector2 starVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(pos, target, 30f, 2); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, starVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); + time = 0; + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit4"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0.15f, 0.25f) }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/ExoHit3"); + SoundEngine.PlaySound(sound2 with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.1f, 0f) }, Projectile.Center); + Owner.Calamity().GeneralScreenShakePower = 5.5f; + Projectile.timeLeft = 300; + targeted = target; + impaleDist = (Projectile.Center - targeted.Center); + } + } + else + Projectile.numHits--; + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var holy)) + { + holy?.Stop(); + } + if (stealth) + { + if (Main.zenithWorld) + { + for (int index = 0; index < Main.npc.Length; index++) + { + NPC searchedTarget = Main.npc[index]; + searchedTarget.active = false; + } + + SoundStyle gfb = new("CalamityMod/Sounds/Item/HolyBurst"); + for (int i = 0; i < 7; i++) + SoundEngine.PlaySound(gfb with { Volume = 1f, Pitch = 0.2f * i, MaxInstances = 7 }, Projectile.Center); + } + else + { + Owner.Calamity().GeneralScreenShakePower = 7f; + SoundStyle soundBurst = new("CalamityMod/Sounds/Item/HolyBurst"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(soundBurst with { Volume = 0.8f, Pitch = 0.2f * i, MaxInstances = 3 }, Projectile.Center); + SoundStyle soundExplosion = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); + SoundEngine.PlaySound(soundExplosion with { Volume = 0.65f, Pitch = 0.6f }, Projectile.Center); + + for (int i = 0; i < 4; i++) + { + for (int y = 0; y < 24; y++) + { + bool red = Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(0.7f, 1); + float placementVariance = 35; + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * Main.rand.NextFloat(y * 1.2f, y * 1.5f) * (i == 0 ? 1.7f : 1) * variance; + Vector2 fxPos = crossCenter + Main.rand.NextVector2CircularEdge(placementVariance - variance * placementVariance, placementVariance - variance * placementVariance); + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), fxVel * 1.7f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.scale = (red ? 1.4f : 1.2f) * Main.rand.NextFloat(0.7f, 0.9f); + dust.color = red ? Color.Red : mainColor; + if (y % 2 == 0) + { + Particle spark = new GlowSparkParticle(fxPos, fxVel, false, 24, 0.065f, Main.rand.NextBool() ? Color.Khaki : mainColor, new Vector2(0.8f, 0.3f), true, false, 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + Vector2 fxVel2 = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * (i == 0 ? 1.7f : 1); + Particle bigCross = new CustomSpark(crossCenter + fxVel2 * 145, fxVel2, "CalamityMod/Particles/BloomLineFade", false, 15, 0.15f, mainColor, new Vector2(1.8f, 1.2f), true, true, 0, false, false, 0.8f, 0.8f, 0.8f); + GeneralParticleHandler.SpawnParticle(bigCross); + } + } + Projectile crossBurst = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), crossCenter, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0f, Owner.whoAmI); + crossBurst.Calamity().stealthStrike = true; + } + else + { + SoundStyle soundBurst = new("CalamityMod/Sounds/Item/HolyBurst"); + SoundEngine.PlaySound(soundBurst with { Volume = 1f, Pitch = 0 }, Projectile.Center); + Projectile crossBurst = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), crossCenter, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 0f, Owner.whoAmI); + for (int i = 0; i < 4; i++) + { + for (int y = 0; y < 14; y++) + { + bool red = Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(0.7f, 1); + float placementVariance = 27; + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * Main.rand.NextFloat(y * 0.8f, y) * (i == 0 ? 1.7f : 1) * variance; + Vector2 fxPos = crossCenter + Main.rand.NextVector2CircularEdge(placementVariance - variance * placementVariance, placementVariance - variance * placementVariance); + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), fxVel * 1.5f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.scale = (red ? 1.2f : 1) * Main.rand.NextFloat(0.7f, 0.9f); + dust.color = red ? Color.Red : mainColor; + if (y % 2 == 0) + { + Particle spark = new GlowSparkParticle(fxPos, fxVel, false, 18, 0.05f, Main.rand.NextBool() ? Color.Khaki : mainColor, new Vector2(0.8f, 0.3f), true, false, 0.6f); + GeneralParticleHandler.SpawnParticle(spark); + } + } } } } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (stealth) + return CalamityUtils.CircularHitboxCollision(Projectile.Center, 120, targetHitbox); + else + return base.Colliding(projHitbox, targetHitbox); + } 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); + float glowUp = (1 + Utils.GetLerpValue(250, 0, Projectile.timeLeft, true)); + float throwCompletion = flung ? 1 : (float)Math.Pow(Math.Min(time / (Owner.HeldItem.useAnimation * 0.7f), 1), 5); + Color glowColor = Color.Lerp(mainColor, Color.Khaki, glowUp - 1); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Asset glowBlade = ModContent.Request("CalamityMod/Particles/GlowBlade"); + Asset woosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + if (hitTiles || falling || stealth) + { + for (int i = 0; i < 25; i++) + { + Vector2 drawPos = Projectile.Center; + Color auraColor = glowColor with { A = 0 } * 0.05f * glowUp; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * glowUp * 2; + Main.EntitySpriteDraw(tex, drawPos - Main.screenPosition + drawOffset + Main.rand.NextVector2Circular(6, 6) * (1 - glowUp), null, auraColor with { A = 0 } * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + if (stealth) + { + for (int i = 0; i < 4; i++) + { + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i).RotatedBy(Projectile.rotation) * (i == 0 ? 1.2f : 1) * 80 * throwCompletion; + Vector2 fxPos = crossCenter + fxVel; + + if (i == 0 && Projectile.timeLeft > 240) + { + Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, Color.Khaki with { A = 0 } * 0.1f, fxVel.ToRotation() + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.45f * throwCompletion, SpriteEffects.None, 0); + Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * 0.15f, fxVel.ToRotation() - 1.3f * Projectile.direction + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.41f * throwCompletion, SpriteEffects.None, 0); + } + + for (int y = 0; y < 2; y++) + Main.EntitySpriteDraw(glowBlade.Value, fxPos - Main.screenPosition, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.3f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.4f * (y != 0 ? 0.65f : 1f), 1f * throwCompletion * glowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * 0.04f, SpriteEffects.None, 0); + } + } + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White with { A = 0 }, lightColor, (2 - glowUp)) * (inSky ? 0 : 1), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + return false; } - - public override bool OnTileCollide(Vector2 oldVelocity) + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); - Projectile.Kill(); - return true; - } - - public override void OnKill(int timeLeft) - { - //Crystal smash sound - SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); - // Light burst - 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; + overPlayers.Add(index); } } } diff --git a/Projectiles/Rogue/ExorcismShockwave.cs b/Projectiles/Rogue/ExorcismShockwave.cs index 03b4e58e09..40234674e5 100644 --- a/Projectiles/Rogue/ExorcismShockwave.cs +++ b/Projectiles/Rogue/ExorcismShockwave.cs @@ -1,6 +1,13 @@ -using Microsoft.Xna.Framework; +using CalamityMod.NPCs.Yharon; +using CalamityMod.UI; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.GameContent; using Terraria.ModLoader; +using System.Text.RegularExpressions; namespace CalamityMod.Projectiles.Rogue { @@ -8,116 +15,50 @@ 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 RadiusStealth = 200; - public override void SetDefaults() { - Projectile.width = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); - Projectile.height = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); + Projectile.width = 5; + Projectile.height = 5; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 9; + Projectile.timeLeft = 14; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.DamageType = RogueDamageClass.Instance; } - - public override void AI() + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.timeLeft >= 5) - { - Projectile.alpha = (int)((1 - Projectile.ai[0]) * 255f); + float minMult = 0.35f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; - // Blast wave should be brighter on stealth strikes - int numDust = (int)(40 * Projectile.ai[0]) + 10; - - for (int i = 0; i < numDust; i++) - { - // Dust Type - int dustToUse = Main.rand.Next(0, 3); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 175; - break; - case 1: - dustType = 229; - break; - case 2: - dustType = 263; - break; - } - - // Shockwave - Vector2 circleVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - circleVelocity.Normalize(); - 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; - } - - // Cross - Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(Projectile.rotation); - Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(Projectile.rotation); - - int dustScale = 7; - Vector2 dustPos = Projectile.Center - new Vector2((dustScale - 1) * 0.5f, (dustScale - 1) * 0.5f); - - float minSpeed = 0f; - float maxSpeed = 5f; - float minScale = 1.9f; - float maxScale = 2.1f; - int dustCount = (int)(5 * Projectile.ai[0]); - - for (int i = 0; i < dustCount; i++) - { - // Dust Type - int dustToUse = Main.rand.Next(0, 3); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 175; - break; - case 1: - dustType = 229; - break; - case 2: - dustType = 263; - break; - } - - int left = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[left].noGravity = true; - Main.dust[left].velocity = dustLeft * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale); - - int right = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[right].noGravity = true; - Main.dust[right].velocity = dustRight * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale); - - int up = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[up].noGravity = true; - Main.dust[up].velocity = dustUp * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale); - - int down = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[down].noGravity = true; - Main.dust[down].velocity = dustDown * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale); - } - } + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center) - Vector2.UnitY; + float launchPower = (Projectile.Calamity().stealthStrike ? 4f : 1) * 10; + target.MoveNPC(launchVel, launchPower, true); } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float crossSize = (Projectile.Calamity().stealthStrike ? 4f : 1) * 130; + float crosThickness = (Projectile.Calamity().stealthStrike ? 4f : 1) * 25; + float _ = float.NaN; + bool horizontalHit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.UnitX * crossSize, Projectile.Center + Vector2.UnitX * crossSize, crosThickness, ref _); + bool verticalHit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.UnitY * crossSize, Projectile.Center + Vector2.UnitY * crossSize * 1.7f, crosThickness, ref _); + return (horizontalHit || verticalHit); + } + public override bool PreDraw(ref Color lightColor) + { + Player Owner = Main.player[Projectile.owner]; + float fade = Utils.GetLerpValue(0, 9, Projectile.timeLeft, true); + Asset him = ModContent.Request("CalamityMod/ExtraTextures/Jesus"); - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius), targetHitbox); + if (Projectile.Calamity().stealthStrike && Main.zenithWorld) + { + Main.EntitySpriteDraw(him.Value, Owner.Center - Main.screenPosition, null, Color.White * 0.45f * fade, 0, him.Size() / 2f, 10, SpriteEffects.None, 0); + } + return false; + } } } diff --git a/Projectiles/Rogue/ExorcismStar.cs b/Projectiles/Rogue/ExorcismStar.cs deleted file mode 100644 index 9c31376c1d..0000000000 --- a/Projectiles/Rogue/ExorcismStar.cs +++ /dev/null @@ -1,59 +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.Rogue -{ - public class ExorcismStar : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 32; - Projectile.height = 32; - Projectile.alpha = 50; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = 300; - Projectile.MaxUpdates = 2; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - - 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(), 60); - - public override Color? GetAlpha(Color lightColor) => new Color(250, 200, 45, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) - { - Projectile.DrawStarTrail(Color.DarkGoldenrod, Color.Gold); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Rogue/ExorcismStar.png b/Projectiles/Rogue/ExorcismStar.png deleted file mode 100644 index e31c55bba6..0000000000 Binary files a/Projectiles/Rogue/ExorcismStar.png and /dev/null differ diff --git a/Projectiles/Rogue/ExplosiveSun.cs b/Projectiles/Rogue/ExplosiveSun.cs deleted file mode 100644 index ca0e3f46ed..0000000000 --- a/Projectiles/Rogue/ExplosiveSun.cs +++ /dev/null @@ -1,94 +0,0 @@ -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.Rogue -{ - public class ExplosiveSun : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 22; - //Projectile.aiStyle = ProjAIStyleID.TerrarianBeam; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.light = 0.5f; - Projectile.alpha = 50; - Projectile.scale = 1.2f; - Projectile.timeLeft = 60; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - Projectile.velocity.X *= 0.985f; - Projectile.velocity.Y *= 0.985f; - } - - public override bool PreDraw(ref Color lightColor) - { - //Changes the texture of the projectile - if (Projectile.ai[0] == 1f) - { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/ExplosiveSun2").Value; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - if (Projectile.ai[0] == 2f) - { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/ExplosiveSun3").Value; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - return true; - } - - 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 OnKill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 192; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.damage /= 2; - Projectile.Damage(); - if (Main.rand.NextBool(3)) - { - SoundEngine.PlaySound(SoundID.Item14 with { Volume = SoundID.Item14.Volume * 0.5f }, Projectile.Center); - } - for (int i = 0; i < 5; i++) - { - 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()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 10; j++) - { - 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(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 f9c734ca63..ccbb12405c 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Rogue AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = -1; Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } @@ -42,10 +43,9 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.timeLeft % 10 == 0) { - if (Main.rand.NextBool()) + if (Main.rand.NextBool(8)) { - int spiritDamage = Projectile.damage / 2; - Projectile ghost = CalamityUtils.SpawnOrb(Projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + Projectile ghost = CalamityUtils.SpawnOrb(Projectile, (int)(Projectile.damage * 0.4f), ProjectileID.SpectreWrath, 1000f, 4f); if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) { ghost.DamageType = RogueDamageClass.Instance; @@ -58,11 +58,11 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(3); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(12); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index 25d6cbf1f7..c15729eb34 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = -1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -39,28 +40,14 @@ namespace CalamityMod.Projectiles.Rogue { 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) - { - if (Projectile.timeLeft % 10 == 0) - { - if (Projectile.owner == Main.myPlayer) - { - // Use a tiny velocity to ensure that rotation works correctly. - // The speed should be so low that it will make no meaningful mechanical difference. - Vector2 soulVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * 0.0001f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, soulVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } Projectile.StickyProjAI(4); if (Projectile.ai[0] == 1f) { if (Projectile.timeLeft % 4 == 0) { - if (Main.rand.NextBool()) + if (Main.rand.NextBool(3)) { - int spiritDamage = Projectile.damage / 2; - Projectile ghost = CalamityUtils.SpawnOrb(Projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + Projectile ghost = CalamityUtils.SpawnOrb(Projectile, (int)(Projectile.damage * 0.2f), ProjectileID.SpectreWrath, 1000f, 4f); if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) { ghost.DamageType = RogueDamageClass.Instance; @@ -73,11 +60,22 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(1); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(9); + + public override void OnKill(int timeLeft) + { + if (Projectile.owner == Main.myPlayer) + { + for (int j = 0; j <= 3; j++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + } + } + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index 8fc80ea665..1c454320dd 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 77e2e24401..bfd59add8c 100644 --- a/Projectiles/Rogue/FinalDawnFireSlash.cs +++ b/Projectiles/Rogue/FinalDawnFireSlash.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Rogue public static float StealthReturnRatio = 0.40f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 11; + Main.projFrames[Type] = 11; } public override void SetDefaults() { @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.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 cb25e37003..58ca9578a5 100644 --- a/Projectiles/Rogue/FinalDawnFireball.cs +++ b/Projectiles/Rogue/FinalDawnFireball.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -14,7 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public const float InterpolationTime = 10; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() { @@ -56,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.frame++; Projectile.frameCounter = 0; - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; } } @@ -69,8 +71,8 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D glowmask = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D glowmask = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 60789f2f1f..d45cb79e75 100644 --- a/Projectiles/Rogue/FinalDawnFlame.cs +++ b/Projectiles/Rogue/FinalDawnFlame.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue public const int TotalFlames = 120; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; } public override void SetDefaults() { @@ -59,8 +59,8 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; if (Flames.Length > 0) diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs index e41cb19294..1f03f7c82b 100644 --- a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs +++ b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 9; + Main.projFrames[Type] = 9; } public override void SetDefaults() { @@ -72,9 +72,9 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D scytheGlowTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow").Value; - int height = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + int height = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 d6c0d2e372..a372fab743 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Rogue public const float MaxChargeTime = 20f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 2; } public override void SetDefaults() { @@ -36,6 +36,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.myPlayer == player.whoAmI) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, the result is immediately normalized Projectile.velocity = Main.MouseWorld - player.Center; Projectile.velocity.Normalize(); } @@ -99,6 +100,7 @@ namespace CalamityMod.Projectiles.Rogue // Stealth Strike if (player.Calamity().StealthStrikeAvailable() && Projectile.ai[1] != 1f) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, player.SafeDirectionTo(Main.MouseWorld) * 28f, ModContent.ProjectileType(), @@ -156,9 +158,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D glowmask = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnProjectile_Glow").Value; - int height = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + int height = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 19001e5563..3e1f091290 100644 --- a/Projectiles/Rogue/FinalDawnReticle.cs +++ b/Projectiles/Rogue/FinalDawnReticle.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D ring = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D ring = Terraria.GameContent.TextureAssets.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 273f8d58d7..b5743c9437 100644 --- a/Projectiles/Rogue/FinalDawnThrow.cs +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public const float InterpolationTime = 15; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { @@ -70,9 +70,9 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D scytheGlowTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnThrow_Glow").Value; - int height = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + int height = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 71e5979a8f..7038aeda7c 100644 --- a/Projectiles/Rogue/FinalDawnThrow2.cs +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue bool HasHitEnemy = false; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { @@ -115,9 +115,9 @@ namespace CalamityMod.Projectiles.Rogue Player player = Main.player[Projectile.owner]; float scytheRotation = player.fullRotation; - Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D glowScytheTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnThrow2_Glow").Value; - int num214 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + int num214 = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 f15ed5da4d..bfe0172d80 100644 --- a/Projectiles/Rogue/FishboneBoomerangProjectile.cs +++ b/Projectiles/Rogue/FishboneBoomerangProjectile.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -25,8 +26,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -155,7 +156,7 @@ namespace CalamityMod.Projectiles.Rogue } } - if (((Projectile.Calamity().stealthStrike && Projectile.numHits > 2) || !Projectile.Calamity().stealthStrike) && Returning != 1f) + if (Projectile.numHits > 2) { Projectile.velocity *= 0.3f; Returning = 1f; @@ -191,6 +192,26 @@ namespace CalamityMod.Projectiles.Rogue return; } + if (Projectile.Calamity().stealthStrike && Returning != 1f) + { + if (Projectile.owner == Main.myPlayer) + { + for (int s = 0; s < 3; s++) + { + Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (velocity.X == 0f && velocity.Y == 0f) + { + velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + velocity.Normalize(); + velocity *= (float)Main.rand.Next(70, 101) * 0.1f; + int proj = 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); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].DamageType = RogueDamageClass.Instance; + } + } + } + Bouncing = 1f; Projectile.velocity = 15f * (newTarget.Center - Projectile.Center).SafeNormalize(Vector2.One); } diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index 3a621e5fa9..fd05f16eb4 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -37,10 +37,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } + 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 PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/FrostShardFriendly.cs b/Projectiles/Rogue/FrostShardFriendly.cs index 5f166e6d70..fe9ca6f148 100644 --- a/Projectiles/Rogue/FrostShardFriendly.cs +++ b/Projectiles/Rogue/FrostShardFriendly.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void AI() diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs index 2c0a70a70d..05f1d15d2b 100644 --- a/Projectiles/Rogue/GacruxianHome.cs +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/GacruxianMollusk"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index 2a7639c289..79f2a0b1fb 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/GhoulishGougerBoomerang.cs b/Projectiles/Rogue/GhoulishGougerBoomerang.cs index 850823fa0c..ffb1af702c 100644 --- a/Projectiles/Rogue/GhoulishGougerBoomerang.cs +++ b/Projectiles/Rogue/GhoulishGougerBoomerang.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 7; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/GildedDaggerProj.cs b/Projectiles/Rogue/GildedDaggerProj.cs index 5d1d4d48f2..bafb14937a 100644 --- a/Projectiles/Rogue/GildedDaggerProj.cs +++ b/Projectiles/Rogue/GildedDaggerProj.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index ef3c88a0a6..5ba3bdc63f 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/GleamingDaggerProj.cs b/Projectiles/Rogue/GleamingDaggerProj.cs index 99c742ee71..2adb2139bb 100644 --- a/Projectiles/Rogue/GleamingDaggerProj.cs +++ b/Projectiles/Rogue/GleamingDaggerProj.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/GodsParanoiaDart.cs b/Projectiles/Rogue/GodsParanoiaDart.cs index 5313f73144..dd3c0c915f 100644 --- a/Projectiles/Rogue/GodsParanoiaDart.cs +++ b/Projectiles/Rogue/GodsParanoiaDart.cs @@ -10,20 +10,19 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; - Projectile.ignoreWater = true; Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 600; + Projectile.ignoreWater = true; + Projectile.timeLeft = 180; Projectile.aiStyle = ProjAIStyleID.Beam; } @@ -32,17 +31,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (MathHelper.Pi / 2); - Projectile.velocity.X *= 1.025f; - Projectile.velocity.Y *= 1.025f; - if (Projectile.velocity.X > 12f) - { - Projectile.velocity.X = 12f; - } - if (Projectile.velocity.Y > 12f) - { - Projectile.velocity.Y = 12f; - } - if (Main.rand.NextBool(3)) { Dust flame = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 1f); @@ -54,16 +42,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 192; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.damage /= 2; - Projectile.Damage(); for (int i = 0; i < 2; i++) { Dust flame = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); @@ -80,7 +58,6 @@ namespace CalamityMod.Projectiles.Rogue } 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 bool PreDraw(ref Color lightColor) @@ -88,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index 235c6ada4c..d0834ef778 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -12,12 +12,11 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/GodsParanoia"; - public int kunaiStabbing = 10; - public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -29,10 +28,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = -1; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; + Projectile.localNPCHitCooldown = 40; } public override void AI() @@ -49,53 +47,37 @@ namespace CalamityMod.Projectiles.Rogue Projectile.StickyProjAI(50); if (Projectile.ai[0] == 1f) - { - kunaiStabbing++; - if (kunaiStabbing >= 30 || (Projectile.Calamity().stealthStrike && kunaiStabbing >= 20)) - { - kunaiStabbing = 0; - float startOffsetX = Main.rand.NextFloat(100f, 200f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(100f, 200f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(Projectile.position.X + startOffsetX, Projectile.position.Y + startOffsetY); - float dx = Projectile.position.X - startPos.X; - float dy = Projectile.position.Y - startPos.Y; - - // Add some randomness / inaccuracy - dx += Main.rand.NextFloat(-5f, 5f); - dy += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(20f, 25f); - float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy)); - dist = speed / dist; - dx *= dist; - dy *= dist; - Vector2 kunaiSp = new Vector2(dx, dy); - float angle = Main.rand.NextFloat(MathHelper.TwoPi); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 3; i++) - { - int idx = Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPos, kunaiSp, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack / 3f, Projectile.owner, 0f, 0f); - Main.projectile[idx].rotation = angle; - } - } - } - } + Projectile.MaxUpdates = 1; // Prevents the homing function extra updates from carrying over else { - Projectile.rotation += 0.2f * (float)Projectile.direction; - CalamityUtils.HomeInOnNPC(Projectile, false, 400f, Projectile.Calamity().stealthStrike ? 10f : 5f, 20f); - } - - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.killSpikyBalls == true) - { - Projectile.active = false; - Projectile.netUpdate = true; + Projectile.rotation += 0.2f * Projectile.direction; + CalamityUtils.HomeInOnNPC(Projectile, false, 400f, Projectile.Calamity().stealthStrike ? 16f : 8f, 20f); } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + OnHitDarts(); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 120); + OnHitDarts(); + } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(10); + private void OnHitDarts() + { + for (int i = 0; i < 2; i++) + { + float startOffsetX = Main.rand.NextFloat(125f, 250f) * Main.rand.NextBool().ToDirectionInt(); + float startOffsetY = Main.rand.NextFloat(125f, 250f) * Main.rand.NextBool().ToDirectionInt(); + Vector2 startPos = Projectile.Center + new Vector2(startOffsetX, startOffsetY); + + Vector2 kunaiSp = Vector2.Normalize(Projectile.Center - startPos) * 25f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPos, kunaiSp, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 3f, Projectile.owner); + } + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -108,12 +90,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return 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/Rogue/GraveGrimreaverProjectile.cs b/Projectiles/Rogue/GraveGrimreaverProjectile.cs index bc0b984642..904833a4df 100644 --- a/Projectiles/Rogue/GraveGrimreaverProjectile.cs +++ b/Projectiles/Rogue/GraveGrimreaverProjectile.cs @@ -14,8 +14,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -67,16 +68,16 @@ namespace CalamityMod.Projectiles.Rogue { // Stealth strikes play a wraith death noise, summon a larger dust explosion, a swarm of 20 bats, and a rain of 10 skulls SoundEngine.PlaySound(SoundID.NPCDeath52 with { Volume = SoundID.NPCDeath52.Volume * 0.75f }, Projectile.Center); - SpawnBats(20, -12, 12); //"At least 20"... + SpawnBats(10, -12, 12); // "At least 20" - Sorry, balancing! DustExplosion(15, 6, 12, 30, 2.4f); - for (int i = 0; i < 10; i++) + for (int i = 0; i < 8; i++) { CalamityUtils.ProjectileRain(Projectile.GetSource_FromThis(), Projectile.Center, 600f, 100f, 700f, 1000f, 20, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 3f, Projectile.owner); } } else { - // Normal strikes play no extra sound, have a smaller dust explosion, and summon 4 bats + // Normal strikes play no extra sound, have a smaller dust explosion, and summon 4 bats SpawnBats(4, -12, 12); DustExplosion(10, 3, 9, 20, 2.15f); } diff --git a/Projectiles/Rogue/GreenDonkeyKongReference.cs b/Projectiles/Rogue/GreenDonkeyKongReference.cs index 1b8e63e9dd..fce9c945f1 100644 --- a/Projectiles/Rogue/GreenDonkeyKongReference.cs +++ b/Projectiles/Rogue/GreenDonkeyKongReference.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/GrimreaverBat.cs b/Projectiles/Rogue/GrimreaverBat.cs index 2577bb628c..035f912300 100644 --- a/Projectiles/Rogue/GrimreaverBat.cs +++ b/Projectiles/Rogue/GrimreaverBat.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); diff --git a/Projectiles/Rogue/GrimreaverSkull.cs b/Projectiles/Rogue/GrimreaverSkull.cs index c9a3d74a60..36f83f8a40 100644 --- a/Projectiles/Rogue/GrimreaverSkull.cs +++ b/Projectiles/Rogue/GrimreaverSkull.cs @@ -11,9 +11,10 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/HeavenfallenEnergy.cs b/Projectiles/Rogue/HeavenfallenEnergy.cs index 970d99845b..74056c7f34 100644 --- a/Projectiles/Rogue/HeavenfallenEnergy.cs +++ b/Projectiles/Rogue/HeavenfallenEnergy.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -12,6 +13,7 @@ namespace CalamityMod.Projectiles.Rogue public bool raining => Projectile.ai[1] == 0f; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs index 2916cc6b65..aa6704c88a 100644 --- a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs +++ b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -167,7 +167,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/HellsSunProj.cs b/Projectiles/Rogue/HellsSunProj.cs deleted file mode 100644 index b160d689a3..0000000000 --- a/Projectiles/Rogue/HellsSunProj.cs +++ /dev/null @@ -1,89 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class HellsSunProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/HellsSun"; - - public override void SetDefaults() - { - Projectile.width = 15; - Projectile.height = 15; - Projectile.friendly = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = 20; - Projectile.timeLeft = 1200; - - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void AI() - { - Projectile.ai[0] += 1f; - - if (Projectile.ai[0] >= 70f) - { - Projectile.velocity.X *= 0.96f; - Projectile.velocity.Y *= 0.96f; - Projectile.localAI[1]++; - if (Projectile.Calamity().stealthStrike) - { - 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_1.Normalize(); - 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; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - vector2_5.X, Projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0.0f); - Projectile.localAI[1] = 0.0f; - } - } - else - { - 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_1.Normalize(); - 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; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - vector2_5.X, Projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0.0f); - Projectile.localAI[1] = 0.0f; - } - } - } - else - { - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.killSpikyBalls == true) - { - Projectile.active = false; - Projectile.netUpdate = 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/Honeycomb.cs b/Projectiles/Rogue/Honeycomb.cs index 307c85c0b0..535e0c6eb7 100644 --- a/Projectiles/Rogue/Honeycomb.cs +++ b/Projectiles/Rogue/Honeycomb.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (Projectile.Calamity().stealthStrike) player.AddBuff(BuffID.Honey, 600); SpawnProjectiles(); @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (Projectile.Calamity().stealthStrike) player.AddBuff(BuffID.Honey, 600); SpawnProjectiles(); @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Rogue return; Projectile.ai[1] = 1f; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; int fragAmt = 2; for (int i = 0; i < fragAmt; i++) { @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index 278b40b93e..bdedfa919b 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -11,8 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -74,19 +75,19 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Frostburn2, 300); + target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(ModContent.BuffType(), 150); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.Frostburn2, 300); + target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(ModContent.BuffType(), 150); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs index 75a7cede89..054cdff67c 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -70,14 +71,14 @@ namespace CalamityMod.Projectiles.Rogue } } - 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(ModContent.BuffType(), 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(ModContent.BuffType(), 120); public override bool PreDraw(ref Color lightColor) { //Changes the texture of the projectile - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 30320b7672..c30a3b9955 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Projectiles.Rogue private bool initStealth = false; private Vector2 initialVelocity; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 30; diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index 4ae1e85156..3ab30014a9 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -28,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.WoodenBoomerang; Projectile.coldDamage = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -40,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { if (explosionCount < 3) //max amount of explosions to prevent worm memes { - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f, 1f); if (ice.WithinBounds(Main.maxProjectiles)) Main.projectile[ice].DamageType = RogueDamageClass.Instance; explosionCount++; @@ -85,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.Calamity().stealthStrike) { //no explosion count cap in pvp - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f, 1f); if (ice.WithinBounds(Main.maxProjectiles)) Main.projectile[ice].DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/IchorSpearProj.cs b/Projectiles/Rogue/IchorSpearProj.cs index c61396d01c..f6b9d9f36a 100644 --- a/Projectiles/Rogue/IchorSpearProj.cs +++ b/Projectiles/Rogue/IchorSpearProj.cs @@ -27,14 +27,18 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = 6; Projectile.timeLeft = 900; - Projectile.aiStyle = 0; + Projectile.extraUpdates = 1; + Projectile.scale = 1.2f; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 50; + Projectile.tileCollide = false; } public override void AI() { + if (Collision.SolidCollision(Projectile.Center, 3, 3) && !Projectile.Calamity().stealthStrike) + Projectile.Kill(); framesInAir++; if (framesInAir > 90 && !Projectile.Calamity().stealthStrike) { @@ -42,10 +46,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y += 0.3f; } - Projectile.scale = 1.2f; - if (!Projectile.Calamity().stealthStrike) - Projectile.extraUpdates = 1; - if (Main.rand.NextBool() && !posthit) { Vector2 position = Projectile.Center + Vector2.Normalize(Projectile.velocity); @@ -64,19 +64,16 @@ namespace CalamityMod.Projectiles.Rogue } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - bool defaultsonce = true; + bool stealthSet = true; if (Projectile.Calamity().stealthStrike) { - Projectile.tileCollide = false; - Projectile.aiStyle = 0; Projectile.extraUpdates = 2; if (Projectile.ai[0] == 0f) { - if (defaultsonce) + if (stealthSet) { - Projectile.penetrate = 10; Projectile.localNPCHitCooldown = 60; - defaultsonce = false; + stealthSet = false; } } Projectile.StickyProjAI(10); @@ -85,7 +82,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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,8 +102,10 @@ namespace CalamityMod.Projectiles.Rogue SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, true, sparkLifetime, sparkScale, sparkColor); GeneralParticleHandler.SpawnParticle(spark); } + SoundEngine.PlaySound(Hitsound, Projectile.position); target.AddBuff(BuffID.Ichor, Projectile.Calamity().stealthStrike ? 900 : 180); + if (Projectile.Calamity().stealthStrike) { posthit = true; diff --git a/Projectiles/Rogue/InfernalKrisCinder.cs b/Projectiles/Rogue/InfernalKrisCinder.cs index 237bfae602..648d864ded 100644 --- a/Projectiles/Rogue/InfernalKrisCinder.cs +++ b/Projectiles/Rogue/InfernalKrisCinder.cs @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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; diff --git a/Projectiles/Rogue/InfernalKrisProjectile.cs b/Projectiles/Rogue/InfernalKrisProjectile.cs index 66c7e17204..60d4e259a8 100644 --- a/Projectiles/Rogue/InfernalKrisProjectile.cs +++ b/Projectiles/Rogue/InfernalKrisProjectile.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Rogue { // If this is a stealth strike, make the blade glow orange Color glowColour = new Color(255, 215, 100, 100); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], glowColour, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], glowColour, 1); float minScale = 1.9f; float maxScale = 2.5f; @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); } return false; } diff --git a/Projectiles/Rogue/InfestedClawmerangProj.cs b/Projectiles/Rogue/InfestedClawmerangProj.cs index 13a9af0825..ab0c7314d9 100644 --- a/Projectiles/Rogue/InfestedClawmerangProj.cs +++ b/Projectiles/Rogue/InfestedClawmerangProj.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 42621db550..7f9f6b90cc 100644 --- a/Projectiles/Rogue/InkBombProjectile.cs +++ b/Projectiles/Rogue/InkBombProjectile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 1; Projectile.tileCollide = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 50; + Projectile.timeLeft = 20; Projectile.DamageType = RogueDamageClass.Instance; } @@ -52,25 +52,10 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 20; i++) { - int projType = Main.rand.Next(0, 3); - int inkType; - switch (projType) - { - case 0: - inkType = ModContent.ProjectileType(); - break; - case 1: - inkType = ModContent.ProjectileType(); - break; - default: - inkType = ModContent.ProjectileType(); - break; - } int damage = (int)player.GetTotalDamage().ApplyTo(22); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - int inkID = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), inkType, damage, 7, Projectile.owner); - Main.projectile[inkID].timeLeft += Main.rand.Next(-20, 25); + int inkID = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, 7, Projectile.owner, Main.rand.Next(3) + 1); + Main.projectile[inkID].timeLeft += Main.rand.Next(-15, 15 + 1); } Projectile.Kill(); } diff --git a/Projectiles/Rogue/InkCloud.cs b/Projectiles/Rogue/InkCloud.cs index f4df29dad5..b45ad2b89a 100644 --- a/Projectiles/Rogue/InkCloud.cs +++ b/Projectiles/Rogue/InkCloud.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,10 +9,11 @@ namespace CalamityMod.Projectiles.Rogue public class InkCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; // Will get overwritten by PreDraw public override void SetDefaults() { - Projectile.width = 32; - Projectile.height = 28; + Projectile.width = 36; + Projectile.height = 30; Projectile.friendly = true; Projectile.alpha = 0; Projectile.penetrate = -1; @@ -37,7 +40,15 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Confused, 300); } } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Confused, 300); + + public override bool PreDraw(ref Color lightColor) + { + string texPath = "CalamityMod/Projectiles/Rogue/InkCloud" + Projectile.ai[0].ToString(); + Texture2D tex = ModContent.Request(texPath).Value; + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } } } diff --git a/Projectiles/Rogue/InkCloud.png b/Projectiles/Rogue/InkCloud1.png similarity index 100% rename from Projectiles/Rogue/InkCloud.png rename to Projectiles/Rogue/InkCloud1.png diff --git a/Projectiles/Rogue/InkCloud2.cs b/Projectiles/Rogue/InkCloud2.cs deleted file mode 100644 index 4a7d9e8a1d..0000000000 --- a/Projectiles/Rogue/InkCloud2.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class InkCloud2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetDefaults() - { - Projectile.width = 36; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.alpha = 0; - Projectile.penetrate = -1; - Projectile.tileCollide = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 100; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - if (Projectile.timeLeft < 50) - Projectile.alpha += 5; - if (Projectile.timeLeft < 75) - Projectile.velocity *= 0.95f; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (!target.friendly) - { - target.AddBuff(BuffID.Confused, 300); - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Confused, 300); - } -} diff --git a/Projectiles/Rogue/InkCloud3.cs b/Projectiles/Rogue/InkCloud3.cs deleted file mode 100644 index d3e149c735..0000000000 --- a/Projectiles/Rogue/InkCloud3.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class InkCloud3 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 24; - Projectile.friendly = true; - Projectile.alpha = 0; - Projectile.penetrate = -1; - Projectile.tileCollide = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 100; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - if (Projectile.timeLeft < 50) - Projectile.alpha += 5; - if (Projectile.timeLeft < 75) - Projectile.velocity *= 0.95f; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (!target.friendly) - { - target.AddBuff(BuffID.Confused, 300); - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Confused, 300); - } -} diff --git a/Projectiles/Rogue/IronFranciscaProj.cs b/Projectiles/Rogue/IronFranciscaProj.cs index 92520b56eb..6352c68223 100644 --- a/Projectiles/Rogue/IronFranciscaProj.cs +++ b/Projectiles/Rogue/IronFranciscaProj.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 73a0ad5587..25b55a5c37 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -64,9 +64,8 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { - target.AddBuff(ModContent.BuffType(), 120); - int shockwaveDamage = (int)player.GetTotalDamage().ApplyTo(100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), shockwaveDamage, 10f, Projectile.owner, 0, 0); + target.AddBuff(ModContent.BuffType(), 120); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 10f, Projectile.owner, 0, 0); } } @@ -77,9 +76,8 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { - target.AddBuff(ModContent.BuffType(), 120); - int shockwaveDamage = (int)player.GetTotalDamage().ApplyTo(100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), shockwaveDamage, 10f, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 10f, Projectile.owner, 0, 0); + target.AddBuff(ModContent.BuffType(), 120); } } @@ -93,7 +91,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/JawsShockwave.cs b/Projectiles/Rogue/JawsShockwave.cs index 41437e9836..b1eb5e72ba 100644 --- a/Projectiles/Rogue/JawsShockwave.cs +++ b/Projectiles/Rogue/JawsShockwave.cs @@ -58,9 +58,9 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 240); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 160f, targetHitbox); } diff --git a/Projectiles/Rogue/KelvinCatalystBoomerang.cs b/Projectiles/Rogue/KelvinCatalystBoomerang.cs index 6a2f3827e0..db15c7a74b 100644 --- a/Projectiles/Rogue/KelvinCatalystBoomerang.cs +++ b/Projectiles/Rogue/KelvinCatalystBoomerang.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -188,7 +188,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index 32e6c36e8d..860ff5228b 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.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; @@ -10,8 +11,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -37,10 +38,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } + 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 PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/KylieBoomerang.cs b/Projectiles/Rogue/KylieBoomerang.cs index 12d1648a1c..7717d51e00 100644 --- a/Projectiles/Rogue/KylieBoomerang.cs +++ b/Projectiles/Rogue/KylieBoomerang.cs @@ -13,16 +13,18 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Kylie"; - //This variable will be used for the stealth strike - public float ReboundTime = 0f; - public float timer = 0f; + public ref float State => ref Projectile.ai[0]; + public ref float Timer => ref Projectile.ai[1]; + + // Used for the stealth strike + public int TileBounceDelay = 0; public override void SetDefaults() { Projectile.friendly = true; Projectile.width = 40; Projectile.height = 40; Projectile.penetrate = -1; - Projectile.timeLeft = 360; + Projectile.timeLeft = 240; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 30; @@ -32,11 +34,11 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + Player Owner = Main.player[Projectile.owner]; //Constant rotation Projectile.rotation += 0.2f; - - timer++; + //Dust trail if (Main.rand.NextBool(15)) { @@ -49,88 +51,113 @@ namespace CalamityMod.Projectiles.Rogue Projectile.soundDelay = 15; SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - //Slopes REEEEEEEEEEEE - if (timer == 3f) - Projectile.tileCollide = true; - //Decide the range of the boomerang depending on stealth + + // If stealth strike, stay close to the player's cursor. if (Projectile.Calamity().stealthStrike) - ReboundTime = 36f; - else - ReboundTime = 55f; - - // ai[0] stores whether the boomerang is returning. If 0, it isn't. If 1, it is. - if (Projectile.ai[0] == 0f) { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= ReboundTime) + Projectile.tileCollide = true; + if (TileBounceDelay > 0) + TileBounceDelay--; + + Vector2 mousePos = Owner.ClampedMouseWorld(); + if (Vector2.Distance(Projectile.Center, mousePos) > 115f && TileBounceDelay == 0) { - Projectile.ai[0] = 1f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; + float accelerationFactor = 12f; // Higher number = Takes longer to turn around. + Projectile.velocity += (mousePos - Projectile.Center).SafeNormalize(Vector2.UnitX) * Kylie.Speed / accelerationFactor; + if (Projectile.velocity.Length() > Kylie.Speed) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= Kylie.Speed; + } + } + else // Accelerate to top speed if close enough to prevent it staying slow if you move in the cursor while it's slowing down. + { + Projectile.velocity *= 1.1f; + if (Projectile.velocity.Length() > Kylie.Speed) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= Kylie.Speed; + } } } else { - Projectile.tileCollide = false; - float returnSpeed = Kylie.Speed * 1.5f; - float acceleration = 3.2f; - Player owner = Main.player[Projectile.owner]; - - // Delete the boomerang if it's excessively far away. - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - Projectile.Center.X; - float yDist = playerCenter.Y - Projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - Projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (Projectile.velocity.X < xDist) + // State of 0 = Going out. State of 1 = Returning. + if (State == 0f) { - 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; - } + Timer += 1f; + //Slopes REEEEEEEEEEEE + if (Timer == 3f) + Projectile.tileCollide = true; - // Delete the projectile if it touches its owner. - if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(owner.Hitbox)) + if (Timer >= 35f) // Return to the player + { + State = 1f; + Timer = 0f; + Projectile.netUpdate = true; + } + } + else + { + Projectile.tileCollide = false; + float returnSpeed = Kylie.Speed * 1.5f; + float acceleration = 3.2f; + Player owner = Main.player[Projectile.owner]; + + // Delete the boomerang if it's excessively far away. + Vector2 playerCenter = owner.Center; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; + float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + if (dist > 3000f) Projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + 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. + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); + } } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - //Start homing at player if you hit an enemy - Projectile.ai[0] = 1; - } + // Return to player after hitting an enemy + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => State = 1f; public override bool OnTileCollide(Vector2 oldVelocity) { - //Bounce off tiles and start homing on player if it hits a tile + //Bounce off tiles and return to player after hitting a tile Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); SoundEngine.PlaySound(SoundID.Dig, Projectile.position); if (Projectile.velocity.X != oldVelocity.X) @@ -141,9 +168,21 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.velocity.Y = -oldVelocity.Y; } - Projectile.ai[0] = 1; + State = 1f; + if (TileBounceDelay == 0) + TileBounceDelay = 10; return false; + } + // Spawn splinter gores on stealth strike death + public override void OnKill(int timeLeft) + { + if (Projectile.Calamity().stealthStrike) + { + Vector2 splinterVel = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 12f); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, splinterVel, Mod.Find("KylieGore1").Type); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, splinterVel, Mod.Find("KylieGore2").Type); + } } } } diff --git a/Projectiles/Rogue/LanceofDestiny.cs b/Projectiles/Rogue/LanceofDestiny.cs index 49ec34f37a..60d06ad8ae 100644 --- a/Projectiles/Rogue/LanceofDestiny.cs +++ b/Projectiles/Rogue/LanceofDestiny.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 d2a961382c..714492858c 100644 --- a/Projectiles/Rogue/LeadTomahawkProj.cs +++ b/Projectiles/Rogue/LeadTomahawkProj.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 d797ae04f1..babf525421 100644 --- a/Projectiles/Rogue/LeonidCometBig.cs +++ b/Projectiles/Rogue/LeonidCometBig.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1); return false; } @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Rogue dust2.velocity *= 2f; dust2.noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int index1 = 0; index1 < 2; ++index1) { diff --git a/Projectiles/Rogue/LeonidCometSmall.cs b/Projectiles/Rogue/LeonidCometSmall.cs index 9714deddb6..9bcf7cc54e 100644 --- a/Projectiles/Rogue/LeonidCometSmall.cs +++ b/Projectiles/Rogue/LeonidCometSmall.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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; } diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.cs b/Projectiles/Rogue/LeonidProgenitorBombshell.cs index 1eedb2ca47..8ecefdb0c6 100644 --- a/Projectiles/Rogue/LeonidProgenitorBombshell.cs +++ b/Projectiles/Rogue/LeonidProgenitorBombshell.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 fddf210ab3..69c9b1b43b 100644 --- a/Projectiles/Rogue/LeonidStar.cs +++ b/Projectiles/Rogue/LeonidStar.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Rogue int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); Main.dust[dust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int num480 = 0; num480 < 3; num480++) { diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index 8785e9f73e..85a6f13add 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -1,4 +1,5 @@ -using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,101 +12,262 @@ namespace CalamityMod.Projectiles.Rogue public class LeviathanTooth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public ref float time => ref Projectile.ai[0]; + + // Vanilla sticky code is jank, So I did my own (for better or worse) + public NPC chosenTarget; + public bool stuckInTarget = false; + public bool stuckInGround = false; + public bool canDamage = true; + public bool canStick = true; + public Vector2 vibrate = Vector2.Zero; + public int stuckTimer = 120; + public Vector2 placementCenter; + float placementDistance; + Vector2 placementVelocity; + public Vector2 storedVelocity; + public bool collideWithTiles = true; + + public bool jawline = true; // Tooth direction for the stealthstrike + public Vector2 startingVel; + public bool toothDirection = false; + public Vector2 chomp = Vector2.Zero; + public bool chomping = true; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 2; + Projectile.height = 2; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Projectile.ai[0] == 0f) + if (time == 0) { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.timeLeft < 575 && !Projectile.Calamity().stealthStrike) + stuckTimer = Main.rand.Next(100, 120 + 1); + startingVel = Projectile.velocity; + if (Projectile.ai[1] < 4) + toothDirection = Main.rand.NextBool(); + } + if (!stuckInTarget && !stuckInGround) + { + if (!Projectile.Calamity().stealthStrike) { - Projectile.velocity.Y += 0.5f; - if (Projectile.velocity.Y > 16f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if ((time % 2 == 0 || !canStick) && time > 15) { - Projectile.velocity.Y = 16f; + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + } + if (time > 90 && canStick) + { + Projectile.velocity.Y += 0.03f; + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.99f; } } } - //Sticky Behaviour - Projectile.StickyProjAI(15); + else if (stuckInTarget) + { + float power = 5 * Utils.GetLerpValue(120, 0, stuckTimer, true); + vibrate = Main.rand.NextVector2Circular(power, power); + + Projectile.rotation = (storedVelocity).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2; + + Vector2 impaleVel = (storedVelocity * 0.5f) * Utils.GetLerpValue(120, 0, stuckTimer, true); + placementCenter = chosenTarget.Center + placementVelocity * placementDistance + impaleVel; + + Projectile.Center = placementCenter; + + stuckTimer--; + if (chosenTarget.life <= 0 || chosenTarget == null) + stuckTimer = 0; + if (stuckTimer == 0) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + canDamage = true; + vibrate = Vector2.Zero; + canStick = false; + collideWithTiles = true; + Projectile.velocity = storedVelocity * 1.3f; + stuckInTarget = false; + + for (int i = 0; i <= 7; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, (storedVelocity * 2.5f).RotatedByRandom(0.7) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.9f, 1.8f)); + dust.noGravity = false; + } + for (int i = 0; i <= 3; i++) + { + Particle spark = new AltSparkParticle(Projectile.Center, (storedVelocity * 4.5f).RotatedByRandom(0.7) * Main.rand.NextFloat(0.1f, 0.8f) + new Vector2(0, -2), true, 20, 0.5f, Color.DarkRed * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); + } + + } + if (stuckInGround) + { + Projectile.rotation = storedVelocity.ToRotation() + MathHelper.PiOver2; + } + + if (Projectile.Calamity().stealthStrike) + { + collideWithTiles = false; + if (time > 15 && (Projectile.ai[1] == 4 ? Projectile.timeLeft > 60 : time < 40)) + { + for (int i = 0; i < (Projectile.ai[1] == 4 ? 2 : 1); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.6f)); + dust.noGravity = true; + } + } + if (Projectile.ai[1] == 4) + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + int jawDir = jawline ? 1 : -1; + Vector2 spawnPos = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(90f * jawDir)) * 170; + Vector2 jawVel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(90f * jawDir)) * 17; + if (time > 10 && Projectile.timeLeft >= 60) + { + if (time % 3 == 0) + { + Projectile tooth = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnPos, jawVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack / 12, Projectile.owner, 0, 0, Projectile.velocity.X > 0 ? 1 : -1); + tooth.Calamity().stealthStrike = true; + tooth.timeLeft = 120; + tooth.extraUpdates = 0; + tooth.usesIDStaticNPCImmunity = true; + tooth.usesLocalNPCImmunity = false; + tooth.idStaticNPCHitCooldown = 5; + tooth.ai[1] = Main.rand.Next(1, 3 + 1); + jawline = !jawline; + } + if (time % 2 == 0) + { + Particle spark = new AltSparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 15, 1f, Color.DarkRed * 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.timeLeft == 60) + Projectile.velocity *= 0.5f; + } + else if (Projectile.timeLeft <= 60) + { + Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0)); + Projectile.velocity *= 0.95f; + } + } + else + { + Projectile.rotation = startingVel.ToRotation() + MathHelper.ToRadians(270f); + if (Projectile.timeLeft > 90) + { + Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, -startingVel.X * 1.3f, 0.045f); + Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, -startingVel.Y * 1.3f, 0.045f); + Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 120, 90, 255, 0)); + } + else + { + Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 30, 255, 0)); + Projectile.velocity *= 0.9f; + } + if (time > 40) + { + if (!chomping) + { + chomp.X = MathHelper.Lerp(chomp.X, startingVel.X * 3, 0.2f); + chomp.Y = MathHelper.Lerp(chomp.Y, startingVel.Y * 3, 0.2f); + } + else + { + chomp.X = MathHelper.Lerp(chomp.X, 0, 0.2f); + chomp.Y = MathHelper.Lerp(chomp.Y, 0, 0.2f); + } + if (time % 18 == 0) + chomping = !chomping; + } + + } + } + time++; + + if (collideWithTiles && Collision.SolidCollision(Projectile.Center, 4, 4)) // Vanilla tile collision messes with velocity so we use this instead + { + canDamage = false; + if (Projectile.timeLeft > 180) + Projectile.timeLeft = 180; + stuckInGround = true; + storedVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX); + Projectile.velocity = Vector2.Zero; + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit1"); + SoundEngine.PlaySound(sound with { Volume = 0.25f, Pitch = Main.rand.NextFloat(-0.3f, -0.6f) }, Projectile.Center); + collideWithTiles = false; + + } + + if (!Projectile.Calamity().stealthStrike) + Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0)); } - 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 ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.Calamity().stealthStrike) + modifiers.SourceDamage *= Projectile.ai[1] == 4 ? 0.6f : 0.5f; + else + modifiers.SourceDamage *= target == chosenTarget ? 1 : (canStick ? 0.2f : 0.5f); + } + public override bool? CanDamage() => canDamage ? null : false; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Venom, 180); - if (Projectile.Calamity().stealthStrike) + if (target == chosenTarget || Projectile.Calamity().stealthStrike) + target.AddBuff(ModContent.BuffType(), 180); + if (!stuckInTarget && canStick && !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); - 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; + if (Projectile.timeLeft < 400) + Projectile.timeLeft = 400; + collideWithTiles = false; + canDamage = false; + placementDistance = -Vector2.Distance(target.Center, Projectile.Center); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + placementCenter = placementVelocity * (placementDistance * 0.01f); + chosenTarget = target; + stuckInTarget = true; + storedVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8; + Projectile.velocity = Vector2.Zero; } } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - if (Projectile.Calamity().lineColor == 1) + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + if (Projectile.ai[1] == 2) tex = ModContent.Request("CalamityMod/Projectiles/Rogue/LeviathanTooth2").Value; - if (Projectile.Calamity().lineColor == 2) + if (Projectile.ai[1] == 3) tex = ModContent.Request("CalamityMod/Projectiles/Rogue/LeviathanTooth3").Value; + if (Projectile.ai[1] == 4) + tex = ModContent.Request("CalamityMod/Projectiles/Melee/GreenWater").Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - if (Projectile.Calamity().stealthStrike) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, tex); - } + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + vibrate + chomp, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, toothDirection ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + return 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); - Projectile.Kill(); - return false; - } - - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.Water, 0, 0, 0, default, 1.5f); - Main.dust[dust].noGravity = true; - } - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Calamity().stealthStrike ? 50 : 18, targetHitbox); } } diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 33fe5a4944..6d6bd45d06 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 8641d91ad2..1976f6b70e 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -9,9 +9,10 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -20,6 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.penetrate = 1; Projectile.timeLeft = 240; Projectile.DamageType = RogueDamageClass.Instance; @@ -38,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0.25f); @@ -54,9 +56,9 @@ namespace CalamityMod.Projectiles.Rogue { if (!Projectile.CountsAsClass()) { - int cap = 5; + int cap = 10; float capDamageFactor = 0.05f; - int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type] - cap; + int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap; modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f); } } @@ -73,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index ae1f678100..0e9238f4ce 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; @@ -15,9 +16,10 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -51,6 +53,11 @@ namespace CalamityMod.Projectiles.Rogue 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 OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override void OnKill(int timeLeft) { if (lunarEnhance) @@ -88,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index c970824e1c..be8ef36f5a 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -1,5 +1,8 @@ using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,101 +14,94 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { - Projectile.width = 18; - Projectile.height = 18; + Projectile.width = 34; + Projectile.height = 48; Projectile.friendly = true; - Projectile.penetrate = 4; - Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; - Projectile.alpha = 255; - Projectile.timeLeft = 300; - AIType = ProjectileID.ThrowingKnife; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.DamageType = RogueDamageClass.Instance; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 3; } - public override void AI() { + Lighting.AddLight(Projectile.Center, Color.Magenta.ToVector3() * 0.35f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.localAI[0] == 0f) + if (Projectile.numHits == 0) + Projectile.velocity.Y += 0.04f; + else + Projectile.velocity.Y += 0.06f; + + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.99f; + + if (Projectile.timeLeft > 60 && Projectile.timeLeft % 2 == 0) { - 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; - } - } - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 3f) - { - for (int l = 0; l < 12; l++) - { - 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, 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; - Main.dust[dusty].velocity = Projectile.velocity * 0.1f; - Main.dust[dusty].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[dusty].position) * 1.25f; - } + Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 0.3f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.5f); + dust.color = Color.Magenta; + dust.noLightEmittence = true; } } - - public override Color? GetAlpha(Color lightColor) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - 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); - } + float minMult = 0.4f; + int hitsToMinMult = 3; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + Projectile.velocity = Utils.DirectionTo(target.Center, Projectile.Center).RotatedByRandom(0.2f) * 7; + Projectile.velocity.X *= 0.25f; + Projectile.velocity.Y *= 1.2f; + + for (int i = 0; i < 8; i++) + { + Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + c.velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2().RotatedBy(MathHelper.PiOver4) * 4.5f * (i % 2 == 0 ? 0.78f : 1f); + c.scale = Main.rand.NextFloat(0.6f, 0.7f) * (i % 2 == 0 ? 2.2f : 1.8f); + c.noGravity = true; + c.color = Color.Magenta; + c.noLightEmittence = true; + } + } public override bool OnTileCollide(Vector2 oldVelocity) { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) + if (Projectile.numHits == 0) + Projectile.numHits = 1; + 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; } + Projectile.velocity *= 0.92f; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; return false; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 30, targetHitbox); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Asset tex = ModContent.Request(Texture); + Color drawColor = Color.Magenta; + float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); + + for (int i = 0; i < 8; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 1f; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Rogue/LuxorsGiftRogue.png b/Projectiles/Rogue/LuxorsGiftRogue.png index 2ffc26c9c7..c64245ed65 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 bfcae585c3..6645114223 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/MalachiteProj.cs b/Projectiles/Rogue/MalachiteProj.cs index f5653839f9..6ee5620237 100644 --- a/Projectiles/Rogue/MalachiteProj.cs +++ b/Projectiles/Rogue/MalachiteProj.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/MalachiteStealth.cs b/Projectiles/Rogue/MalachiteStealth.cs index 77206f17f0..d8bd435577 100644 --- a/Projectiles/Rogue/MalachiteStealth.cs +++ b/Projectiles/Rogue/MalachiteStealth.cs @@ -15,8 +15,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs index 6bd879b46b..81f4212305 100644 --- a/Projectiles/Rogue/MangroveChakramProjectile.cs +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/MetalChunk.cs b/Projectiles/Rogue/MetalChunk.cs index b779646437..8e04f477d5 100644 --- a/Projectiles/Rogue/MetalChunk.cs +++ b/Projectiles/Rogue/MetalChunk.cs @@ -11,6 +11,9 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/MetalMonstrosity"; + public bool StuckInEnemy = false; + public int StealthShardTimer = 0; + public override void SetDefaults() { Projectile.width = 32; @@ -19,45 +22,66 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.ignoreWater = true; //Its hella heavy so ofc Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; } public override void AI() { - // Gravity - Projectile.velocity.Y += 0.11f; - if (Projectile.velocity.Y > 16f) - Projectile.velocity.Y = 16f; - - // Rotation - Projectile.rotation += 0.14f * Projectile.direction; - if (Projectile.Calamity().stealthStrike) + if (!StuckInEnemy) // Gravity and rotation rotate if not stuck { - Projectile.ai[0]++; - if (Projectile.ai[0] >= 10f) - { - Vector2 speed = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-6f, 6f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, speed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 0f, Projectile.owner, 0f, 0f); - Projectile.ai[0] = 0f; - } + Projectile.velocity.Y += 0.11f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + + Projectile.rotation += 0.14f * Projectile.direction; } + + if (Projectile.Calamity().stealthStrike) + Projectile.StickyProjAI(10); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.Calamity().stealthStrike) + StuckInEnemy = true; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.Calamity().stealthStrike) + Projectile.ModifyHitNPCSticky(1); } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCHit42, Projectile.Center); + + // Spiky balls and shards on death for (int i = 0; i < 3; i++) { - Vector2 S1 = new Vector2(-Projectile.velocity.X, -Projectile.velocity.Y).RotatedBy(MathHelper.ToRadians(Main.rand.Next(-45, 46))); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, S1, ProjectileID.SpikyBall, (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); - Main.projectile[proj].DamageType = RogueDamageClass.Instance; - Main.projectile[proj].timeLeft = 600; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 20; - S1 = new Vector2(-Projectile.velocity.X * 0.7f, -Projectile.velocity.Y * 0.7f).RotatedBy(MathHelper.ToRadians(Main.rand.Next(-45, 46))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, S1, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); + Vector2 sVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * 4.5f; + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, sVelocity, ProjectileID.SpikyBall, (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); + proj.DamageType = RogueDamageClass.Instance; + proj.timeLeft = 600; + proj.usesLocalNPCImmunity = true; + proj.localNPCHitCooldown = 20; + sVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * 3f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); } - //Dust - for (int i = 0; i < 20; i++) + + // Bunch of shards on stealth strike death + if (Projectile.Calamity().stealthStrike) + { + for (int i = 0; i < 4; i++) + { + Vector2 shardVel = (Main.npc[(int)Projectile.ai[1]].Center - Projectile.Center).SafeNormalize(Vector2.UnitX).RotatedByRandom(MathHelper.Pi / 6f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), 0f, Projectile.owner); + } + } + + // Dust + for (int i = 0; i < 15; i++) { Dust.NewDust(Projectile.Center, 1, 1, DustID.Lead, 0f, 0f, 0, default, 1.1f); } diff --git a/Projectiles/Rogue/MetalShard.cs b/Projectiles/Rogue/MetalShard.cs index 83ae2a801f..0310ef4f94 100644 --- a/Projectiles/Rogue/MetalShard.cs +++ b/Projectiles/Rogue/MetalShard.cs @@ -11,13 +11,14 @@ namespace CalamityMod.Projectiles.Rogue public class MetalShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public bool Stuck = false; public override void SetDefaults() { Projectile.friendly = true; Projectile.width = 12; Projectile.height = 12; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = 10; + Projectile.penetrate = 2; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 60; @@ -25,17 +26,22 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - //Rotation - if (Projectile.ai[0] == 0f) - Projectile.rotation += 0.1f; - //Gravity - Projectile.velocity.Y += 0.1f; - if (Projectile.velocity.Y > 16f) - Projectile.velocity.Y = 16f; + // Rotation and gravity if not stuck + if (!Stuck) + { + if (Projectile.ai[0] == 0f) + Projectile.rotation += 0.1f; + + Projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } //Sticky Behaviour Projectile.StickyProjAI(15); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Stuck = true; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(8); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/MeteorFistMeteorite.cs b/Projectiles/Rogue/MeteorFistMeteorite.cs new file mode 100644 index 0000000000..5281f17885 --- /dev/null +++ b/Projectiles/Rogue/MeteorFistMeteorite.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +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.Projectiles.Rogue +{ + public class MeteorFistMeteorite : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "Terraria/Images/Backgrounds/Ambience/Meteor"; + + public override void SetDefaults() + { + Projectile.width = 62; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.MaxUpdates = 2; + Projectile.tileCollide = false; + Projectile.timeLeft = 360; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.scale = 2f; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 5 * Projectile.MaxUpdates) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 3) + Projectile.frame = 0; + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + for (int i = 0; i < 2; i++) + { + Dust meteorDust = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 0.5f, Projectile.width, Projectile.height / 2, DustID.Torch, 0f, 0f, 100, default, 0.5f); + meteorDust.scale *= 2f + Main.rand.NextFloat(); + meteorDust.velocity *= 0.2f; + meteorDust.noGravity = true; + } + + if (Projectile.Center.Y > Main.npc[(int)Projectile.ai[0]].Center.Y) + Projectile.tileCollide = true; + } + + public override void OnKill(int timeLeft) + { + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3f) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HellbornImpact"), Projectile.Center); + + Projectile.ExpandHitboxBy(300); + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Damage(); + + for (int k = 0; k < 50; k++) + { + 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(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); + Main.dust[boomDust2].velocity *= 2f; + } + CustomPulse outerRing = new(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 2.8f, 15); + GeneralParticleHandler.SpawnParticle(outerRing); + CustomPulse innerRing = new(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.8f, 30, true, 0.8f); + GeneralParticleHandler.SpawnParticle(innerRing); + } + + // Can hit if: + // 1: Is the same NPC the fist hit. 2: The NPC the fist hit is no longer active. 3: The fist hit a worm segment, and this NPC is another segment of the same worm. 4: Damage from the explosion. + public override bool? CanHitNPC(NPC target) => target.whoAmI == Projectile.ai[0] || !Main.npc[(int)Projectile.ai[0]].active || (target.realLife != -1 && target.realLife == Main.npc[(int)Projectile.ai[0]].realLife) || Projectile.penetrate == -1 ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire, 240); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 240); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, 4, 0, Projectile.frame); + SpriteEffects effect = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() / 2f, Projectile.scale, effect); + return false; + } + } +} diff --git a/Projectiles/Rogue/MeteorFistProj.cs b/Projectiles/Rogue/MeteorFistProj.cs index 009cbfeda3..cc694bad98 100644 --- a/Projectiles/Rogue/MeteorFistProj.cs +++ b/Projectiles/Rogue/MeteorFistProj.cs @@ -1,6 +1,10 @@ -using System; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,88 +15,131 @@ namespace CalamityMod.Projectiles.Rogue public class MeteorFistProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + + public List Wire; + private const int Lifetime = 210; + private const int WireSegments = 15; + private const float MaxSpeed = 22.5f; + public ref float Timer => ref Projectile.ai[0]; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 360; + Projectile.penetrate = 2; // Only hits once, has 2 pierce to create a visual illusion of the connecting wire being left behind after hit + Projectile.timeLeft = Lifetime; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Projectile.velocity.Length() >= 4f) + Player Owner = Main.player[Projectile.owner]; + Timer++; + + // Initialize the connecting wire + if (Wire == null || Wire.Count < WireSegments) { - for (int i = 0; i < 2; i++) + Wire = new List(WireSegments); + for (int i = 0; i < WireSegments; i++) { - float dustyX = 0f; - float dustyY = 0f; - if (i == 1) - { - 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, 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; + VerletSimulatedSegment segment = new VerletSimulatedSegment(Owner.Center + Vector2.UnitY * i * 10f); + Wire.Add(segment); + } + + Wire[0].locked = true; + Wire[Wire.Count - 1].locked = true; + } + + // Spawn some fire dust, plus smoke if traveling fast enough + if (Projectile.numHits == 0) + { + Dust meteorDust = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 0.5f, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); + meteorDust.scale *= 2f + Main.rand.NextFloat(); + meteorDust.velocity *= 0.2f; + meteorDust.noGravity = true; + + if (Projectile.velocity.Length() >= 7f) + { + Vector2 smokePos = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * 10f; + HeavySmokeParticle smoking = new(smokePos, Vector2.UnitX.RotatedBy(Projectile.rotation + MathHelper.Pi) * 4f, Color.Orange, 5, 0.33f, 0.75f); + GeneralParticleHandler.SpawnParticle(smoking); } } - // Almost instantly accelerate to very high speed - if (Projectile.velocity.Length() < 12f) + if (Projectile.numHits == 0) { - Projectile.velocity *= 1.25f; + // Homing movement + Vector2 guidedDirection = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); + float guidedSpeed = Timer < 60f && !Projectile.Calamity().stealthStrike ? 4f : (Timer + (Projectile.Calamity().stealthStrike ? 60f : 0f)) / 7.5f; + if (guidedSpeed > MaxSpeed) + guidedSpeed = MaxSpeed; + float guidedTurnStrength = MathHelper.Lerp(0.05f, Projectile.Calamity().stealthStrike ? 0.32f : 0.18f, Timer / (float)Lifetime); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Owner.ClampedMouseWorld()).ToRotation(), guidedTurnStrength).ToRotationVector2() * guidedSpeed * Owner.Calamity().rogueVelocity; + + // If you haven't hit anything, explode and leave the wire + if (Projectile.timeLeft == 2) + SetUpLeftoverWireEffect(); } - else if (Main.rand.NextBool()) + else { - 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(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; + // Used for the sagging motion of the leftover wire + Projectile.velocity.X *= 0.9f; + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; } - Projectile.ai[0] += 1f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[0] > 10f || Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 10f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y += 0.1f; - } + // Done to ensure the leftover wire is flush with the ground + Projectile.rotation = Projectile.numHits > 0 ? 0f : Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Wire[0].oldPosition = Wire[0].position; + Wire[0].position = Owner.Center; + Wire[Wire.Count - 1].oldPosition = Wire[0].position; + Wire[Wire.Count - 1].position = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * (Projectile.numHits > 0 ? 14f : 8f); + Wire = VerletSimulatedSegment.SimpleSimulation(Wire, 10, loops: 1, gravity: 0.3f); } - public override void OnKill(int timeLeft) + // Both of these are done for wire leftover effect + public override bool OnTileCollide(Vector2 oldVelocity) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 40; j++) + if (Projectile.numHits == 0) + SetUpLeftoverWireEffect(); + return false; + } + public override bool? CanDamage() => Projectile.numHits == 0 ? null : false; + + // Fuck off stupid Vile Spits + public override bool? CanHitNPC(NPC target) => NPCID.Sets.ProjectileNPC[target.type] ? false : null; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.OnFire, 120); + if (Main.myPlayer == Projectile.owner) { - 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()) + // Stealth strikes drop a whole ass meteorite because hell yeah + if (Projectile.Calamity().stealthStrike) { - Main.dust[boomDust].scale = 0.5f; - Main.dust[boomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Vector2 meteorSpawn = target.Center + new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-650f, -750f)); + Vector2 meteorVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(meteorSpawn, target, 15f, 2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), meteorSpawn, meteorVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 2, Projectile.owner, target.whoAmI); } } - for (int k = 0; k < 70; k++) + + // Visual effects + SetUpLeftoverWireEffect(); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 120); + + private void SetUpLeftoverWireEffect() + { + Projectile.numHits++; + Timer = 0f; + Projectile.timeLeft = 90; + + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + for (int k = 0; k < 30; k++) { int boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[boomDust2].noGravity = true; @@ -101,57 +148,47 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[boomDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + Vector2 source = new Vector2(Projectile.Center.X - 24f, Projectile.Center.Y - 24f); + for (int g = 1; g <= 3; g++) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) + float velocityMult = g * 0.33f; + for (int spawn = 0; spawn < 2; spawn++) { - velocityMult = 0.66f; + 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; } - 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) + public float WidthFunction(float completionRatio) => 0.4f; + public Color ColorFunction(float completionRatio) { - target.AddBuff(BuffID.OnFire, 120); - 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); + float fadeThreshold = 60f; + float opacity = Projectile.numHits > 0 && Timer > fadeThreshold ? MathHelper.Lerp(0.75f, 0f, (Timer - fadeThreshold) / 30f) : 0.75f; + return Color.Orange * opacity; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 120); + public override bool PreDraw(ref Color lightColor) + { + // Draw the wire + List wirePoints = new List(); + if (Wire != null && Wire.Count > 0) + { + for (int i = 0; i < Wire.Count; i++) + { + wirePoints.Add(Wire[i].position); + } + } + PrimitiveRenderer.RenderTrail(wirePoints, new(WidthFunction, ColorFunction), 75); + + // Fist itself only draws if it hasn't hit + // After hitting, the fist stops drawing, creating the illusion of the wire being left behind + return Projectile.numHits == 0; + } } } diff --git a/Projectiles/Rogue/MeteorFistStealth.cs b/Projectiles/Rogue/MeteorFistStealth.cs deleted file mode 100644 index d08caeb9a1..0000000000 --- a/Projectiles/Rogue/MeteorFistStealth.cs +++ /dev/null @@ -1,189 +0,0 @@ -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; - -namespace CalamityMod.Projectiles.Rogue -{ - public class MeteorFistStealth : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Rogue/MeteorFistProj"; - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 4; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 360; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - if (Projectile.velocity.Length() >= 4f) - { - for (int i = 0; i < 2; i++) - { - float dustyX = 0f; - float dustyY = 0f; - if (i == 1) - { - 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, 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; - } - } - - // Almost instantly accelerate to very high speed - if (Projectile.velocity.Length() < 12f) - { - Projectile.velocity *= 1.25f; - } - else if (Main.rand.NextBool()) - { - 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(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; - } - - Projectile.ai[0] += 1f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[0] > 10f || Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 10f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 40; j++) - { - 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()) - { - Main.dust[boomDust].scale = 0.5f; - Main.dust[boomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int k = 0; k < 70; k++) - { - 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(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[boomDust2].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(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 = (int)(Projectile.damage * 0.6666); - float minDist = 999f; - int index = 0; - // Get the closest enemy to the fist - if (Projectile.penetrate != -1) - { - foreach (var npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false) && npc != target) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - Vector2 newFistVelocity; - if (minDist < 999f) - { - newFistVelocity = Main.npc[index].Center - Projectile.Center; - } - else - { - newFistVelocity = -Projectile.velocity; - } - newFistVelocity.Normalize(); - newFistVelocity *= 10f; - Projectile.velocity = newFistVelocity; - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 120); - } -} diff --git a/Projectiles/Rogue/MoltenAmputatorAnimated.png b/Projectiles/Rogue/MoltenAmputatorAnimated.png new file mode 100644 index 0000000000..05feb7d2aa Binary files /dev/null and b/Projectiles/Rogue/MoltenAmputatorAnimated.png differ diff --git a/Projectiles/Rogue/MoltenAmputatorProj.cs b/Projectiles/Rogue/MoltenAmputatorProj.cs index 4abfdf3453..85870c6c1c 100644 --- a/Projectiles/Rogue/MoltenAmputatorProj.cs +++ b/Projectiles/Rogue/MoltenAmputatorProj.cs @@ -1,6 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,13 +16,23 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/MoltenAmputator"; - private const int FramesBeforeReturning = 15; - private const int FramesPerBlob = 8; + + public int time = 0; + public Vector2 squash = new Vector2(1, 1); + public float fakeRot = 0; + public int returnTime = 180; + public bool pulled = false; + public bool returning = false; + public int direction = 0; + public int pulledTimer = 0; + public bool AMPUTATE = false; + + public float effectScale = 0; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -30,168 +44,278 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; - Projectile.timeLeft = 180; + Projectile.localNPCHitCooldown = 35 * Projectile.MaxUpdates; + Projectile.timeLeft = 900; + Projectile.extraUpdates = 4; Projectile.DamageType = RogueDamageClass.Instance; } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - - private void SpawnBlobs(int blobCount) - { - for (int i = 0; i < blobCount; i++) - { - Vector2 iAmSpeed = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (iAmSpeed.X == 0f && iAmSpeed.Y == 0f) - { - iAmSpeed = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - iAmSpeed.Normalize(); - iAmSpeed *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, iAmSpeed.X, iAmSpeed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, 0f, 0f); - } - } - - // Manually implemented boomerang AI copied from Ghoulish Gouger - // TODO -- this should be a utils function public override void AI() { - // Stealth strikes constantly spawn molten blobs. - if (Projectile.Calamity().stealthStrike) + Player Owner = Main.player[Projectile.owner]; + if (Projectile.ai[2] == 5 && Projectile.ai[2] < 10 && !Projectile.Calamity().stealthStrike) { - // If the stealth blob timer isn't set up yet, set it up - if (Projectile.ai[1] == 0f) - Projectile.ai[1] = FramesPerBlob; - else + if (time >= returnTime * 0.07f && time < returnTime * 1.4f) { - Projectile.ai[1]--; - if (Projectile.ai[1] <= 0f) + if (!pulled) { - SpawnBlobs(1); - Projectile.ai[1] = FramesPerBlob; + Projectile.localNPCHitCooldown = -1; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.ai[2] = 10; + Projectile.numHits = 0; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Owner.Center) * 3; + Projectile.extraUpdates += 4; + pulled = true; } } + else + Projectile.ai[2] = 0; + } + if (time >= returnTime) + returning = true; + + fakeRot += 0.13f * direction; + Projectile.rotation = (Projectile.velocity.ToRotation()) + MathHelper.PiOver2; + + if (Projectile.velocity.Length() < 5) + effectScale = MathHelper.Lerp(effectScale, 1, 0.05f); + else if (returning) + effectScale = MathHelper.Lerp(effectScale, 0, 0.05f); + + float x = MathHelper.Clamp(Utils.GetLerpValue(16, 2, Projectile.velocity.Length(), true), 0.3f, 1); + float y = 1; + squash = new Vector2(x, y); + + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 7) + { + Projectile.frame = 0; + } + + if (pulled) + { + if (time < returnTime * 1.5f) + time = (int)(returnTime * 1.5f); + if (pulledTimer > 20) + { + if (time % 2 == 0) + { + Particle spark2 = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 19, 0.05f, Color.Orchid * 0.3f, new Vector2(0.7f, 1.2f), true, false, 0.35f); + GeneralParticleHandler.SpawnParticle(spark2); + } + else + { + Particle spark2 = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 11, 0.07f, Color.Goldenrod * 0.45f, new Vector2(0.7f, 1.2f), true, false, 0.55f); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + pulledTimer++; } // Frame 1, pick a direction for the scythe. This direction isn't changed from that point on - if (Projectile.ai[0] == 0f) - Projectile.spriteDirection = Projectile.direction; + if (direction == 0f) + { + direction = (Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld).X > 0 ? 1 : -1); + } // Boomerang glows orange - Lighting.AddLight(Projectile.Center, 0.65f, 0.45f, 0f); + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 1.5f); // Boomerang noises if (Projectile.soundDelay == 0) { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); + Projectile.soundDelay = 7 * Projectile.MaxUpdates; + SoundStyle sound = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(sound with { MaxInstances = -1, Volume = Projectile.Calamity().stealthStrike ? 0.15f : 0.3f }, Projectile.Center); } // Main boomerang logic. projectile.ai[0] is a frame counter. Projectile.ai[0] += 1f; // On the first returning frame, send a net update. - if (Projectile.ai[0] == FramesBeforeReturning) + if (time == returnTime) Projectile.netUpdate = true; // Once returning, use boomerang return AI. - if (Projectile.ai[0] >= FramesBeforeReturning) + if (returning) { - float returnSpeed = MoltenAmputator.Speed * 2f; - float acceleration = 1.15f; - - Player owner = Main.player[Projectile.owner]; - Vector2 delta = owner.Center - Projectile.Center; - float dx = delta.X; - float dy = delta.Y; - - // If the boomerang is excessively far away, destroy it. - float dist = delta.Length(); - if (dist > 3000f) - Projectile.Kill(); - - // Homing vector math (the boomerang homes in on the player using rather ugly code) - dist = returnSpeed / dist; - dx *= dist; - dy *= dist; - - // X/Y specific boomerang return code. This is what gives them their unique flight path. - if (Projectile.velocity.X < dx) - { - Projectile.velocity.X = Projectile.velocity.X + acceleration; - if (Projectile.velocity.X < 0f && dx > 0f) - { - Projectile.velocity.X = Projectile.velocity.X + acceleration; - } - } - else if (Projectile.velocity.X > dx) - { - Projectile.velocity.X = Projectile.velocity.X - acceleration; - if (Projectile.velocity.X > 0f && dx < 0f) - { - Projectile.velocity.X = Projectile.velocity.X - acceleration; - } - } - if (Projectile.velocity.Y < dy) - { - Projectile.velocity.Y = Projectile.velocity.Y + acceleration; - if (Projectile.velocity.Y < 0f && dy > 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y + acceleration; - } - } - else if (Projectile.velocity.Y > dy) - { - Projectile.velocity.Y = Projectile.velocity.Y - acceleration; - if (Projectile.velocity.Y > 0f && dy < 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y - acceleration; - } - } + Vector2 moveToTrackingPos = (Owner.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 3 + (8 * Utils.GetLerpValue(returnTime * 1.2f, returnTime * 1.5f, time, true))) + Projectile.velocity += moveToTrackingPos * (0.02f + (4 * Utils.GetLerpValue(returnTime * 1.2f, returnTime * 2.5f, time, true))); + else + Projectile.velocity *= 0.95f; // Destroy the boomerang when it returns to the player. if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(owner.Hitbox)) + if (Projectile.Hitbox.Intersects(Owner.Hitbox)) Projectile.Kill(); } - - // Rotate the scythe as it flies. - float spin = Projectile.spriteDirection <= 0 ? -1f : 1f; - Projectile.rotation += spin * 0.38f; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - if (Projectile.owner == Main.myPlayer) + else { - int blobCount = Projectile.Calamity().stealthStrike ? 4 : 2; - SpawnBlobs(blobCount); + if (Projectile.Calamity().stealthStrike && time > returnTime * 0.2f) + { + Vector2 moveToTrackingPos = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 16 * Utils.GetLerpValue(returnTime * 0.7f, 0, time, true)) + Projectile.velocity += moveToTrackingPos * (0.5f * Utils.GetLerpValue(returnTime * 0.7f, 0, time, true)); + else + Projectile.velocity *= 0.95f; + } + Projectile.velocity *= (time > returnTime * 0.4f ? 0.97f : 0.982f); } - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - for (int k = 0; k < 10; k++) + + if (Main.rand.NextBool(5 * (Projectile.Calamity().stealthStrike ? 2 : 1))) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + int numParts = 2; + for (int i = 0; i < numParts; i++) + { + float fade = (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true) * 3 + 1) * squash.X; + + float rot = fakeRot + (MathHelper.TwoPi * i / numParts); + Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); + + if (Main.rand.NextBool(6)) + { + Particle spark2 = new CustomSpark(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), vel.RotatedByRandom(0.4f) * fade, "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.3f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + else + { + Particle spark = new CustomSpark(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), vel.RotatedByRandom(0.4f) * fade, "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(0.75f, 0.82f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Main.rand.NextBool(6)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust2.noGravity = (dust2.type == 278 ? false : true); + dust2.scale = dust2.type == 278 ? 0.95f : 1.2f; + dust2.color = Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)); + dust2.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust.noGravity = (dust.type == 278 ? false : true); + dust.scale = dust.type == 278 ? 0.75f : 0.9f; + dust.color = Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod; + dust.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + } + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 120); + + Player Owner = Main.player[Projectile.owner]; + if (Projectile.Calamity().stealthStrike) + { + if (Projectile.numHits == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = Main.rand.NextFloat(0.4f, 0.85f), MaxInstances = -1 }, Projectile.Center); + } + + if (Projectile.numHits < 8) + { + int numParts = 2; + for (int i = 0; i < numParts; i++) + { + float fade = 4; + + float rot = fakeRot + (MathHelper.TwoPi * i / numParts) * 0.4f + Projectile.numHits * 5; + Vector2 vel = (new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * direction)) * squash.X; + + Particle spark2 = new CustomSpark(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), (vel * 0.02f).RotatedByRandom(1.4f) * fade, "CalamityMod/Particles/GlowSpark", false, 18, Main.rand.NextFloat(0.015f, 0.025f), Color.Goldenrod, new Vector2(2f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.6f, 0.7f)); + GeneralParticleHandler.SpawnParticle(spark2); + + BloodParticle blood = new BloodParticle(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), (vel * 0.04f).RotatedByRandom(1.4f) * fade, Main.rand.Next(13, 24 + 1), Main.rand.NextFloat(0.85f, 1.2f), Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + GeneralParticleHandler.SpawnParticle(blood); + + if (Main.rand.NextBool(6)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust2.noGravity = true; + dust2.scale = dust2.type == 278 ? 0.95f : 1.2f; + dust2.color = Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)); + dust2.velocity = (vel * 0.04f).RotatedByRandom(1.4f) * fade; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust.noGravity = true; + dust.scale = dust.type == 278 ? 0.75f : 0.9f; + dust.color = Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod; + dust.velocity = (vel * 0.04f).RotatedByRandom(1.4f) * fade; + } + } + } + } + if (pulled && (pulledTimer < 10 || Owner.Calamity().amputatorBuff > 0) && !AMPUTATE && !Projectile.Calamity().stealthStrike) + { + // Amputate them + Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 7, 0f, Owner.whoAmI, target.whoAmI, 1f); + Particle blastRingBase = new CustomPulse(target.Center, Vector2.Zero, Color.Orange, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.1f, 1f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRingBase); + for (int i = 0; i < 3; i++) + { + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f * (i + 1), 1f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f * (i + 1), 0.5f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + for (int i = 0; i < 6; i++) + { + Particle spark = new GlowSparkParticle(target.Center, (Projectile.velocity).SafeNormalize(Vector2.UnitY) * -5 * (i % 2 == 0 ? -1 : 1), false, 15, 0.08f - i * 0.01f, Color.Goldenrod, new Vector2(5, 0.8f), true, false, 1.2f); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = 0; i < 20; i++) + { + int dir = (i < 10 ? 1 : -1); + LineParticle spark2 = new LineParticle(Projectile.Center + Main.rand.NextVector2Circular(13, 13), (Projectile.velocity).SafeNormalize(Vector2.UnitY) * -25 * Main.rand.NextFloat(0.4f, 2f) * dir, false, 12, 1.1f, Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod); + GeneralParticleHandler.SpawnParticle(spark2); + + BloodParticle blood = new BloodParticle(Projectile.Center, (((Projectile.velocity).SafeNormalize(Vector2.UnitY) * -25).RotatedByRandom(0.6f) + new Vector2(0, -1.5f)) * Main.rand.NextFloat(0.4f, 2f) * dir, Main.rand.Next(13, 24 + 1), Main.rand.NextFloat(0.85f, 1.2f), Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + GeneralParticleHandler.SpawnParticle(blood); + } + + SoundStyle slice = new("CalamityMod/Sounds/Item/HellkiteFullCharge"); + SoundEngine.PlaySound(slice with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.6f) }, target.Center); + SoundStyle cut = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + SoundEngine.PlaySound(cut with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.6f) }, target.Center); + + AMPUTATE = true; } } - public override void OnHitPlayer(Player target, Player.HurtInfo info) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 80, targetHitbox); + public override bool PreDraw(ref Color lightColor) { - target.AddBuff(ModContent.BuffType(), 180); - if (Projectile.owner == Main.myPlayer) + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation; + + Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearFire2"); + Asset p2 = ModContent.Request("CalamityMod/Particles/CircularSmearFire3"); + for (int i = 0; i < 3; i++) { - int blobCount = Projectile.Calamity().stealthStrike ? 4 : 2; - SpawnBlobs(blobCount); - } - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Main.EntitySpriteDraw(p2.Value, drawPosition, null, Color.Orchid with { A = 0 } * 0.25f * effectScale, fakeRot * (Main.rand.NextFloat(1.5f, 1.55f) * (i * 0.5f + 0.2f)), p2.Size() * 0.5f, 1.1f * Main.rand.NextFloat(0.8f, 1.15f) * effectScale, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, drawPosition, null, Color.Orange with { A = 0 } * 0.35f * effectScale, fakeRot * (Main.rand.NextFloat(1.1f, 1.15f) * (i * 0.5f + 0.2f)), p.Size() * 0.5f, 0.9f * effectScale, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); } + + Asset tex3 = ModContent.Request("CalamityMod/Projectiles/Rogue/MoltenAmputatorAnimated"); + Rectangle frame = tex3.Frame(1, 8, 0, Projectile.frame); + Vector2 rotationPoint = frame.Size() * 0.5f; + Main.EntitySpriteDraw(tex3.Value, drawPosition, frame, lightColor, drawRotation, rotationPoint, squash * Projectile.scale, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + return false; } } } diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs deleted file mode 100644 index ae0d6d85fb..0000000000 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ /dev/null @@ -1,100 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class MoltenBlobThrown : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Boss/MoltenBlob"; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 2; - } - - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 180; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - Projectile.velocity.X *= 0.95f; - if (Projectile.wet || Projectile.lavaWet) - { - Projectile.velocity.Y = 0f; - } - else - { - Projectile.velocity.Y = Projectile.velocity.Y + 0.1f; - if (Projectile.velocity.Y > 5f) - { - Projectile.velocity.Y = 5f; - } - } - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 1) - { - Projectile.frame = 0; - } - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) - { - fallThrough = false; - return true; - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, Projectile.alpha); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 90); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 90); - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 10; - Projectile.height = 10; - 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 < 3; i++) - { - 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; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 5; j++) - { - 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(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 deleted file mode 100644 index 7d120c08aa..0000000000 --- a/Projectiles/Rogue/MonkeyDart.cs +++ /dev/null @@ -1,106 +0,0 @@ -using CalamityMod.Items.Weapons.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class MonkeyDart : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 6; - DrawOffsetX = -10; - DrawOriginOffsetY = 0; - DrawOriginOffsetX = 0; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - Projectile.extraUpdates = 2; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - //Code to make it not shoot backwards - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - //Gravity - Projectile.velocity.Y = Projectile.velocity.Y + 0.04f; - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - //Dust trail - if (Main.rand.NextBool(25)) - { - 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; - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - //Dust splash - int dustsplash = 0; - while (dustsplash < 4) - { - 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; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - //This makes the projectile only bounce once - if (Projectile.ai[0] == 1) - { - if (Projectile.ai[1] >= 1f) - { - Projectile.Kill(); - } - else - { - //Code for bouncing - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - Projectile.ai[1] += 1f; - } - return false; - } - return true; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.ai[0] == 1) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - return true; - } - } -} diff --git a/Projectiles/Rogue/MonkeyDart.png b/Projectiles/Rogue/MonkeyDart.png deleted file mode 100644 index b6e8cce5da..0000000000 Binary files a/Projectiles/Rogue/MonkeyDart.png and /dev/null differ diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index ac6d594ff2..1e519983af 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Rogue public class MoonSigil : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; @@ -44,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue { int cap = 5; float capDamageFactor = 0.05f; - int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type] - cap; + int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap; modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f); } diff --git a/Projectiles/Rogue/MycorootProj.cs b/Projectiles/Rogue/MycorootProj.cs index 3fe48a9a8c..681c6a2201 100644 --- a/Projectiles/Rogue/MycorootProj.cs +++ b/Projectiles/Rogue/MycorootProj.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 57eaf29f2b..0e041f6aba 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 829a6f0a22..cd18f9f0ff 100644 --- a/Projectiles/Rogue/NanoblackMain.cs +++ b/Projectiles/Rogue/NanoblackMain.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 7; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/NanoblackSplit.cs b/Projectiles/Rogue/NanoblackSplit.cs index 6fb8f943a6..b311e37066 100644 --- a/Projectiles/Rogue/NanoblackSplit.cs +++ b/Projectiles/Rogue/NanoblackSplit.cs @@ -23,8 +23,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -167,7 +168,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/NanoblackStealthSplit.cs b/Projectiles/Rogue/NanoblackStealthSplit.cs index b91da360f6..eaaef636bf 100644 --- a/Projectiles/Rogue/NanoblackStealthSplit.cs +++ b/Projectiles/Rogue/NanoblackStealthSplit.cs @@ -23,8 +23,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 7; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -176,7 +177,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index 0ce92f488b..492b0a54db 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -86,8 +86,8 @@ namespace CalamityMod.Projectiles.Rogue for (int n = 0; n < needleAmt; n++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - // Since damage is reset on stick, this needs new damage calculations or stored damage in some way. - int damage = Projectile.Calamity().stealthStrike ? Projectile.originalDamage / 2 : (int)player.GetTotalDamage().ApplyTo(0.5f * NastyCholla.BaseDamage); + //The damage is set to 1 since anything more is an AP monster - Angel + int damage = 1; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), damage, 0f, Projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Rogue/NastyChollaNeedle.cs b/Projectiles/Rogue/NastyChollaNeedle.cs index 41340217ce..f4e9383ae5 100644 --- a/Projectiles/Rogue/NastyChollaNeedle.cs +++ b/Projectiles/Rogue/NastyChollaNeedle.cs @@ -41,5 +41,9 @@ namespace CalamityMod.Projectiles.Rogue //So you can stick a needle up the Tinkerer's ass public override bool? CanHitNPC(NPC target) => target.type != NPCID.DD2EterniaCrystal && !target.immortal && !target.dontTakeDamage; + + // 18NOV2024: Ozzatron: Nasty Cholla needles are not allowed to deal more than 1 damage under any circumstances. + // This prevents them from becoming demonchungus when given flat damage boosts like Copper armor or Thorium's The Ring. + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SetMaxDamage(1); } } diff --git a/Projectiles/Rogue/NiceCock.cs b/Projectiles/Rogue/NiceCock.cs index 11bc1ff1ca..51360e48a2 100644 --- a/Projectiles/Rogue/NiceCock.cs +++ b/Projectiles/Rogue/NiceCock.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Rogue if (!initialized) { // Pick a random frame to start on - Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); initialized = true; } @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; int index = (int)Projectile.ai[1]; diff --git a/Projectiles/Rogue/NightsGazeProjectile.cs b/Projectiles/Rogue/NightsGazeProjectile.cs index ea2a217ec1..1676e41309 100644 --- a/Projectiles/Rogue/NightsGazeProjectile.cs +++ b/Projectiles/Rogue/NightsGazeProjectile.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -55,13 +55,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); + target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); OnHitEffects(); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); + target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); OnHitEffects(); } @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/NightsGazeSpark.cs b/Projectiles/Rogue/NightsGazeSpark.cs index 6d51909b88..a33e54ff06 100644 --- a/Projectiles/Rogue/NightsGazeSpark.cs +++ b/Projectiles/Rogue/NightsGazeSpark.cs @@ -63,9 +63,9 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => 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); public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs index fad89f3222..69829d8f21 100644 --- a/Projectiles/Rogue/NightsGazeStar.cs +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -96,9 +96,9 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => 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); public override bool OnTileCollide(Vector2 oldVelocity) { @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1); return false; } diff --git a/Projectiles/Rogue/NychthemeronOrb.cs b/Projectiles/Rogue/NychthemeronOrb.cs deleted file mode 100644 index 2c2a439121..0000000000 --- a/Projectiles/Rogue/NychthemeronOrb.cs +++ /dev/null @@ -1,114 +0,0 @@ - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class NychthemeronOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public static float[] playerDists = new float[10] { 48f, 80f, 80f, 80f, 80f, 112f, 112f, 112f, 112f, 112f }; - public static float[] rotationSpeeds = new float[10] { 0.1f, -0.075f, -0.075f, -0.075f, -0.075f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f }; - - private Vector2 velocity = Vector2.Zero; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 600; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - bool isActive = false; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.identity == Projectile.ai[1]) - { - isActive = true; - } - } - if (!isActive) - { - Projectile.localAI[0] = 1f; - Projectile.penetrate = 1; - } - - Player player = Main.player[Projectile.owner]; - - if (Projectile.localAI[0] == 0f) - { - // Orbit - Projectile.rotation += rotationSpeeds[(int)Projectile.localAI[1]]; - - Vector2 relativePos = new Vector2(0, -1); - relativePos *= playerDists[(int)Projectile.localAI[1]]; - relativePos = relativePos.RotatedBy(Projectile.rotation); - Projectile.Center = player.Center + relativePos; - velocity = Projectile.position - Projectile.oldPosition; - } - else if (Projectile.localAI[0] == 1f) - { - if (Projectile.timeLeft > 240 && Projectile.Calamity().lineColor == 1) - Projectile.timeLeft = 240; - // Follow Enemy - float minDist = 999f; - int index = 0; - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false)) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - - Vector2 velocityNew; - if (minDist < 999f) - { - velocityNew = Main.npc[index].Center - Projectile.Center; - velocityNew.Normalize(); - Projectile.velocity += velocityNew; - if (Projectile.velocity.Length() > 10f) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= 10f; - } - velocity = Projectile.velocity; - } - else - { - Projectile.velocity = velocity; - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texLight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Texture2D texDark = ModContent.Request("CalamityMod/Projectiles/Rogue/NychthemeronOrb2").Value; - if (Projectile.ai[0] == 0f) - { - Main.EntitySpriteDraw(texLight, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, texLight.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - } - else if (Projectile.ai[0] == 1f) - { - Main.EntitySpriteDraw(texDark, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, texDark.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - } - return false; - } - } -} diff --git a/Projectiles/Rogue/NychthemeronOrb.png b/Projectiles/Rogue/NychthemeronOrb.png deleted file mode 100644 index 161f1df392..0000000000 Binary files a/Projectiles/Rogue/NychthemeronOrb.png and /dev/null differ diff --git a/Projectiles/Rogue/NychthemeronOrb2.png b/Projectiles/Rogue/NychthemeronOrb2.png deleted file mode 100644 index bab3df5e77..0000000000 Binary files a/Projectiles/Rogue/NychthemeronOrb2.png and /dev/null differ diff --git a/Projectiles/Rogue/NychthemeronProjectile.cs b/Projectiles/Rogue/NychthemeronProjectile.cs deleted file mode 100644 index 8810f57ab2..0000000000 --- a/Projectiles/Rogue/NychthemeronProjectile.cs +++ /dev/null @@ -1,103 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class NychthemeronProjectile : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/Nychthemeron"; - - public static int lifetime = 300; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 4; - Projectile.timeLeft = lifetime; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - if (Projectile.ai[0] == 0f) - { - // Thrown out and floating in the air - Projectile.velocity *= 0.99f; - } - else - { - Player owner = Main.player[Projectile.owner]; - - Projectile.tileCollide = false; - - // Recall to the player - Vector2 toPlayer = owner.Center - Projectile.Center; - toPlayer.Normalize(); - toPlayer *= Projectile.ai[0]; - Projectile.velocity = toPlayer; - - Projectile.ai[0] += 0.5f; - Projectile.extraUpdates = 1; - if (Projectile.ai[0] > 20f) - { - Projectile.ai[0] = 20f; - } - - // Delete the projectile if it touches its owner. - if (Main.myPlayer == Projectile.owner && Projectile.Hitbox.Intersects(owner.Hitbox)) - { - Projectile.Kill(); - } - } - Projectile.rotation += 0.4f * Projectile.direction * ((float)Projectile.timeLeft / (float)lifetime); - } - - 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 bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - - float minScale = 0.9f; - float maxScale = 1.1f; - int numDust = 2; - for (int i = 0; i < numDust; i++) - { - 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(); - return false; - } - - public override void OnKill(int timeLeft) - { - if (timeLeft <= 0) - { - float minScale = 0.9f; - float maxScale = 1.1f; - int numDust = 2; - for (int i = 0; i < numDust; i++) - { - 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 1bdd516980..dab49da486 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 2b5a7562de..515e6f14b1 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.penetrate = 3; + Projectile.penetrate = 2; Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; Projectile.MaxUpdates = 2; @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 9fcf5404d8..941dae41cc 100644 --- a/Projectiles/Rogue/PanSpark.cs +++ b/Projectiles/Rogue/PanSpark.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue if (!initialized) { initialized = true; - Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); } Projectile.frameCounter++; if (Projectile.frameCounter > 6) @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/PenumbraBomb.cs b/Projectiles/Rogue/PenumbraBomb.cs index adff0d85fb..3ecbfb63bd 100644 --- a/Projectiles/Rogue/PenumbraBomb.cs +++ b/Projectiles/Rogue/PenumbraBomb.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index c070de5b1c..a942a55356 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -11,8 +11,9 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PhantasmalRuinProj.cs b/Projectiles/Rogue/PhantasmalRuinProj.cs index 28c391a7cc..e0b8e583db 100644 --- a/Projectiles/Rogue/PhantasmalRuinProj.cs +++ b/Projectiles/Rogue/PhantasmalRuinProj.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 3); return false; } diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index 263c73a0dd..f902cf4c79 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -17,9 +17,10 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -100,7 +101,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft > Lifetime - NoDrawFrames) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PhantasmalSoulBlue.cs b/Projectiles/Rogue/PhantasmalSoulBlue.cs index f3c196a970..a8d0612531 100644 --- a/Projectiles/Rogue/PhantasmalSoulBlue.cs +++ b/Projectiles/Rogue/PhantasmalSoulBlue.cs @@ -18,9 +18,10 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft > Lifetime - NoDrawFrames) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PlaguenadeBee.cs b/Projectiles/Rogue/PlaguenadeBee.cs index e32a981df4..b7bd8e95f2 100644 --- a/Projectiles/Rogue/PlaguenadeBee.cs +++ b/Projectiles/Rogue/PlaguenadeBee.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -43,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -136,8 +137,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int drawStart = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Rogue/PlaguenadeProj.cs b/Projectiles/Rogue/PlaguenadeProj.cs index 4efa0328c3..7e1a120629 100644 --- a/Projectiles/Rogue/PlaguenadeProj.cs +++ b/Projectiles/Rogue/PlaguenadeProj.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 +111,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[fire].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/PoisonBol.cs b/Projectiles/Rogue/PoisonBol.cs deleted file mode 100644 index 61f1448c2e..0000000000 --- a/Projectiles/Rogue/PoisonBol.cs +++ /dev/null @@ -1,70 +0,0 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class PoisonBol : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/PoisonPack"; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 5; - Projectile.timeLeft = 1200; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.aiStyle = ProjAIStyleID.GroundProjectile; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 45; - } - - public override void AI() - { - if (Main.rand.NextBool(20)) - { - 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) - Projectile.alpha += 13; - if (Projectile.Calamity().stealthStrike) - { - Projectile.localAI[1]++; - if (Projectile.localAI[1] % 35f == 0f) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 20f); - if (Main.rand.NextBool(3)) - 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); - if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].DamageType = RogueDamageClass.Instance; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 45; - } - } - } - - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.killSpikyBalls) - { - Projectile.active = false; - Projectile.netUpdate = true; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 240); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Poisoned, 240); - } -} - diff --git a/Projectiles/Rogue/PrismRocket.cs b/Projectiles/Rogue/PrismRocket.cs deleted file mode 100644 index ad17ba775c..0000000000 --- a/Projectiles/Rogue/PrismRocket.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class PrismRocket : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public float ExponentialAccelerationFactor => Projectile.Calamity().stealthStrike ? 1.027f : 1.015f; - public float MaxHomingSpeed => Projectile.Calamity().stealthStrike ? 26f : 21f; - public const int Lifetime = 150; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 16; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = Lifetime; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - NPC potentialTarget = Projectile.Center.ClosestNPCAt(800f, true); - if (potentialTarget != null) - AttackTarget(potentialTarget); - - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - EmitDust(); - } - - public void AttackTarget(NPC target) - { - float newSpeed = Projectile.velocity.Length() * ExponentialAccelerationFactor; - if (newSpeed > MaxHomingSpeed) - newSpeed = MaxHomingSpeed; - - if (!Projectile.WithinRange(target.Center, 30f)) - { - Projectile.velocity = (Projectile.velocity * 5f + Projectile.SafeDirectionTo(target.Center) * newSpeed) / 6f; - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(target.Center), 0.15f).ToRotationVector2() * newSpeed; - } - } - - public void EmitDust() - { - if (Main.dedServ) - return; - - for (int i = 0; i < 2; i++) - { - if (!Main.rand.NextBool(3)) - continue; - - Dust dust = Dust.NewDustPerfect(Projectile.Center - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f, 261); - dust.color = Color.Cyan; - dust.velocity = Main.rand.NextVector2Unit(); - dust.scale = Main.rand.NextFloat(0.75f, 1.05f); - dust.noGravity = true; - } - } - } -} diff --git a/Projectiles/Rogue/PrismRocket.png b/Projectiles/Rogue/PrismRocket.png deleted file mode 100644 index dd035814fc..0000000000 Binary files a/Projectiles/Rogue/PrismRocket.png and /dev/null differ diff --git a/Projectiles/Rogue/PrismShurikenBlade.cs b/Projectiles/Rogue/PrismShurikenBlade.cs index e993e01731..fe3d80d954 100644 --- a/Projectiles/Rogue/PrismShurikenBlade.cs +++ b/Projectiles/Rogue/PrismShurikenBlade.cs @@ -1,5 +1,13 @@ -using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -8,44 +16,57 @@ namespace CalamityMod.Projectiles.Rogue public class PrismShurikenBlade : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 22; Projectile.friendly = true; Projectile.ignoreWater = true; + Projectile.penetrate = -1; Projectile.DamageType = RogueDamageClass.Instance; Projectile.extraUpdates = 1; - Projectile.timeLeft = Projectile.MaxUpdates * 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.tileCollide = false; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = 300; } public override void AI() { - CalamityUtils.HomeInOnNPC(Projectile, false, 850f, 19f, 30f); + if (Projectile.timeLeft <= 260) + CalamityUtils.HomeInOnNPC(Projectile, false, 850f, 19f, 30f); + Projectile.velocity += Projectile.velocity.RotatedBy(MathHelper.ToRadians(90f)) * 0.02f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Main.rand.NextBool(4)) + { + List eColors = new List() + { + Color.PaleVioletRed, + Color.Turquoise, + Color.OrangeRed, + Color.GreenYellow + }; + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(-0.2f, -0.6f), usedColor, 40, Main.rand.NextFloat(0.45f, 0.6f), 0.8f, Main.rand.NextFloat(-0.2f, 0.2f), true, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.dedServ) - return; - - for (int i = 0; i < 15; i++) + if (Projectile.timeLeft <= 260) { - Vector2 circularOffsetDirection = (MathHelper.TwoPi * i / 15f).ToRotationVector2().RotatedBy(Projectile.velocity.ToRotation() - MathHelper.PiOver2); - Vector2 spawnPosition = Projectile.Center - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Projectile.height * 1.25f; - spawnPosition += circularOffsetDirection * new Vector2(12f, 7f); - - Dust energy = Dust.NewDustPerfect(spawnPosition, 261); - energy.velocity = circularOffsetDirection * new Vector2(3f, 2f); - energy.color = Color.Cyan; - energy.scale = 0.7f; - energy.noGravity = true; + Projectile.Kill(); } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } } diff --git a/Projectiles/Rogue/Prismalline2.cs b/Projectiles/Rogue/Prismalline2.cs index 84c7e8de2f..040527656c 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/Prismalline3.cs b/Projectiles/Rogue/Prismalline3.cs index 9032060ee5..a57b72b223 100644 --- a/Projectiles/Rogue/Prismalline3.cs +++ b/Projectiles/Rogue/Prismalline3.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Prismalline"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/PrismallineProj.cs b/Projectiles/Rogue/PrismallineProj.cs index c47deff442..60ff9fdaa0 100644 --- a/Projectiles/Rogue/PrismallineProj.cs +++ b/Projectiles/Rogue/PrismallineProj.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/ProfanedPartisanProj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs index edb349683d..b7c056a4ad 100644 --- a/Projectiles/Rogue/ProfanedPartisanProj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/ProfanedPartisanSpear.cs b/Projectiles/Rogue/ProfanedPartisanSpear.cs index 789a2576f9..0f9ab63c40 100644 --- a/Projectiles/Rogue/ProfanedPartisanSpear.cs +++ b/Projectiles/Rogue/ProfanedPartisanSpear.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 @@ -11,6 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public int timer = 0; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; @@ -88,7 +90,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index 2fc8e04e0a..d50bc1c07a 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -16,8 +16,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/RadiantStarKnife.cs b/Projectiles/Rogue/RadiantStarKnife.cs index fa3d6ca7ff..33e48e406f 100644 --- a/Projectiles/Rogue/RadiantStarKnife.cs +++ b/Projectiles/Rogue/RadiantStarKnife.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/RadiationBurst.cs b/Projectiles/Rogue/RadiationBurst.cs new file mode 100644 index 0000000000..a3f2054340 --- /dev/null +++ b/Projectiles/Rogue/RadiationBurst.cs @@ -0,0 +1,102 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Buffs.StatDebuffs; + +namespace CalamityMod.Projectiles.Rogue +{ + public class RadiationBurst : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public NPC targetedNPC; + public int time = 0; + public int boomTime = 50; + + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = boomTime + 2; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (time < boomTime) + { + float fade = Utils.GetLerpValue(boomTime + 3, 0, time); + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f); + velOffset *= Main.rand.NextFloat(25, 45) * fade; + Particle energy = new GlowOrbParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, (int)(14 - (5 * fade)), Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, Color.Chartreuse); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, 278, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = Color.Chartreuse; + } + } + if (time == boomTime && targetDist < 1400) + { + for (int i = 0; i <= 30; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 278 : (int)CalamityDusts.SulphurousSeaAcid, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(0.9f, 1.3f)); + dust.noGravity = true; + if (dust.type == 278) + { + dust.noGravity = false; + dust.color = Color.Chartreuse; + } + else + dust.scale *= 1.5f; + + } + for (int i = 0; i < 3; i++) + { + Particle Smear = new CustomPulse(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 18, Projectile.velocity, Color.Chartreuse * 0.7f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0, 0.25f + i * 0.11f, 18 - i * 3); + GeneralParticleHandler.SpawnParticle(Smear); + } + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.5f, 0.5f, 32); + 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), 1f, 0.2f, 32); + GeneralParticleHandler.SpawnParticle(orb2); + + Owner.Calamity().GeneralScreenShakePower = 3.5f; + } + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.75f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => time >= boomTime ? CalamityUtils.CircularHitboxCollision(Projectile.Center, 350, targetHitbox) : false; + } +} diff --git a/Projectiles/Rogue/RadiationRain.cs b/Projectiles/Rogue/RadiationRain.cs new file mode 100644 index 0000000000..b4d1c05c71 --- /dev/null +++ b/Projectiles/Rogue/RadiationRain.cs @@ -0,0 +1,121 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Rogue +{ + public class RadiationRain : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public NPC targetedNPC; + public int time = 0; + public Vector2 spawnSpot; + + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 200; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; + Projectile.ArmorPenetration = 30; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (time == 0) + { + float orbScale = 0.6f * Main.rand.NextFloat(0.8f, 1.1f); + Color smokeColor = Color.Lerp(Color.DimGray, Color.DarkGreen, Main.rand.NextFloat(0.2f, 0.6f)); + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor * 0.7f, "CalamityMod/ExtraTextures/GreyscaleVortex", new Vector2(1, 1), Projectile.ai[2] * 0.45f, orbScale, orbScale * 1.1f, 12, false); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.8f, 0.4f, 18); + GeneralParticleHandler.SpawnParticle(orb3); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.2f, 18); + GeneralParticleHandler.SpawnParticle(orb2); + + for (int i = 0; i < 2; i++) + { + int dir = (i == 0 ? 1 : -1); + Particle pulse3 = new GlowSparkParticle(Projectile.Center + new Vector2(20 * dir, 0), new Vector2(10 * dir, 0), false, 12, 0.087f, Color.Chartreuse, new Vector2(1.7f, 0.8f), true, true, 0.8f); + GeneralParticleHandler.SpawnParticle(pulse3); + } + + for (int i = 0; i < 3; i++) + { + smokeColor = Color.Lerp(Color.DimGray, Color.DarkGreen, Main.rand.NextFloat(0.2f, 0.6f)); + Particle smoke = new HeavySmokeParticle(Projectile.Center, new Vector2(27, 27).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), smokeColor, Main.rand.Next(25, 40 + 1), Main.rand.NextFloat(0.7f, 1.3f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: false); + GeneralParticleHandler.SpawnParticle(smoke); + } + spawnSpot = Projectile.Center; + + targetedNPC = Projectile.Center.ClosestNPCAt(1200); + if (targetedNPC != null) + Projectile.velocity = (targetedNPC.Center - Projectile.Center + targetedNPC.velocity * 1.5f).SafeNormalize(Vector2.UnitX) * 8; + else + Projectile.velocity = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX) * 8; + } + + if (targetDist < 1400 && time > 5) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(70, 70), Projectile.velocity * Main.rand.NextFloat(1.5f, 5f), false, 2, Main.rand.NextFloat(0.04f, 0.06f), Color.Lerp(Color.Green, Color.Chartreuse, Main.rand.NextFloat(0.2f, 1f)), new Vector2(0.2f * (3 * Utils.GetLerpValue(40, 0, time, true) + 1), 1.5f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + if (time % 6 == 0) + { + Particle spark2 = new AltLineParticle(Projectile.Center + Main.rand.NextVector2Circular(70, 70), Projectile.velocity * Main.rand.NextFloat(4.5f, 9f), false, 12, Main.rand.NextFloat(0.9f, 1.1f) * (2 * Utils.GetLerpValue(40, 0, time, true) + 1), Color.Lerp(Color.Green, Color.Chartreuse, Main.rand.NextFloat(0.2f, 1f))); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % 4 == 0) + { + Dust c = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(70, 70), 267); + c.velocity = Projectile.velocity * Main.rand.NextFloat(0.5f, 3f); + c.scale = Main.rand.NextFloat(0.45f, 0.75f); + c.noGravity = true; + c.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : Color.Chartreuse, 0.7f); + c.noLight = true; + c.noLightEmittence = true; + } + } + if (time % 10 * Projectile.MaxUpdates == 0) + { + Owner.Calamity().GeneralScreenShakePower = 1.5f; + } + + if (Projectile.ai[2] > 0 && time == 30) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage), 0f, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + + time++; + } + 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) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.9f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 60, targetHitbox); + } +} diff --git a/Projectiles/Rogue/RealityRuptureLance.cs b/Projectiles/Rogue/RealityRuptureLance.cs index 3fe8595e45..1c809342c0 100644 --- a/Projectiles/Rogue/RealityRuptureLance.cs +++ b/Projectiles/Rogue/RealityRuptureLance.cs @@ -54,9 +54,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Type]; int frameY = frameHeight * Projectile.frame; float scale = Projectile.scale; float rotation = Projectile.rotation; diff --git a/Projectiles/Rogue/RealityRuptureMini.cs b/Projectiles/Rogue/RealityRuptureMini.cs index aa16a31513..ce5384bb64 100644 --- a/Projectiles/Rogue/RealityRuptureMini.cs +++ b/Projectiles/Rogue/RealityRuptureMini.cs @@ -17,20 +17,17 @@ namespace CalamityMod.Projectiles.Rogue public int framesInAir = 0; public int SparkChance = 1; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 34; Projectile.height = 34; Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 3; - Projectile.timeLeft = 800; - AIType = 0; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; - Projectile.extraUpdates = 3; Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 800; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.extraUpdates = 3; } public override void AI() @@ -96,7 +93,5 @@ namespace CalamityMod.Projectiles.Rogue { SoundEngine.PlaySound(Hitsound, Projectile.position); } - - //public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Ichor, 120); } } diff --git a/Projectiles/Rogue/RealityRuptureStealth.cs b/Projectiles/Rogue/RealityRuptureStealth.cs index ce21f21560..5842c87c3b 100644 --- a/Projectiles/Rogue/RealityRuptureStealth.cs +++ b/Projectiles/Rogue/RealityRuptureStealth.cs @@ -77,9 +77,9 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Type]; int frameY = frameHeight * Projectile.frame; float scale = Projectile.scale; float rotation = Projectile.rotation; diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index b1f15611b0..836b7d10e8 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -1,27 +1,38 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; -using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; -using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Projectiles.Rogue { public class ReaperProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public int time = 0; + public int ChargeupTime = 50; + public int Lifetime = 500; + public bool spinning = false; public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheOldReaper"; + 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; + + Vector2 squash = Vector2.One; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -33,168 +44,242 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.extraUpdates = 2; - Projectile.timeLeft = Projectile.MaxUpdates * 120; + Projectile.timeLeft = Lifetime + ChargeupTime; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 9; // can't hit too fast, but can hit many many times + Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; Projectile.DamageType = RogueDamageClass.Instance; } + 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.rotation += 0.4f; - if (Projectile.soundDelay == 0) + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.spriteDirection = Projectile.direction; + + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound) && SpinSound.IsPlaying) + SpinSound.Position = Projectile.Center; + + //Anticipation animation. Make the player look like theyre holding the weapon + if (ChargeProgress < 1) { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); + 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) * -70f * Owner.gravDir + new Vector2(14 * Owner.direction, 0); + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + time++; + return; } - if (Projectile.localAI[0] == 0f) + + //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.ai[1] += 1f; + Projectile.netUpdate = true; - // If the Reaper lands a hit, switch to second behavior mode immediately. - if (Projectile.ai[1] >= 60f || Projectile.numHits > 0) + SoundStyle fire = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center); + + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 4f; + if (Projectile.Calamity().stealthStrike) { - Projectile.localAI[0] = 1f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; + Projectile.velocity = new Vector2(0.5f * Owner.direction, -1) * 18; } - - // Initial homing before landing a hit. else - CalamityUtils.HomeInOnNPC(Projectile, true, 250f, 14f, 14f); + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for initial throw direction + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; + } + Projectile.spriteDirection = Projectile.direction; + SpinSoundSlot = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/SpinningWoosh") with { Pitch = -0.3f, Volume = 0.75f }, Projectile.Center); + + time = 0; + spinning = true; } - // Homing after landing a hit. This homing repeatedly turns on and off. + if (Projectile.velocity.X > 0) + Projectile.direction = 1; else + Projectile.direction = -1; + + if (spinning) { - float homingRange = 1100f; //tbh 700 works for fat targets but then we'll get so many bug reports cuz it doesnt work on dummies - bool noHomingThisFrame = false; - if (Projectile.ai[0] == 1f) + if (Projectile.velocity.Length() < 15) + Projectile.velocity *= 1.01f; + if (time == 0) + Projectile.rotation += Main.rand.NextFloat(0, 10) * Projectile.direction; + squash = new Vector2(1.3f, 0.8f); + Projectile.rotation += 0.2f * Projectile.direction; + + if (targetDist < 1400) { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 30f) + for (int i = 0; i < 2; i++) { - Projectile.ai[1] = 0f; - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; + float rot = Main.rand.NextFloat(-5.5f, 5.5f); + float scale = Main.rand.NextFloat(1f, 1.15f); + Particle Smear = new CustomPulse(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 18, Projectile.velocity, Color.Chartreuse * Main.rand.NextFloat(0.68f, 0.75f), "CalamityMod/Particles/CircularSmearSmokey", squash.RotatedBy(rot), Projectile.velocity.ToRotation() + MathHelper.ToRadians(150f) - rot, scale, scale, 3); + GeneralParticleHandler.SpawnParticle(Smear); + } + + if (time % 7 == 0) + { + Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 60, Main.rand.NextFloat(0.9f, 1.5f), Color.Chartreuse); + GeneralParticleHandler.SpawnParticle(trail); + } + for (int i = 0; i < 2; i++) + { + float rot2 = (Projectile.rotation * Projectile.direction); + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation * 0.3f + MathHelper.PiOver2).ToRotationVector2() * 70f; + Dust dust = Dust.NewDustPerfect(dustPos, 267); + dust.noGravity = true; + dust.scale = 0.8f; + dust.color = Color.Chartreuse; + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.45f, 0.6f); + } + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(23, 23), Main.rand.NextBool(7) ? 28 : 215); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); } - else - noHomingThisFrame = true; } - if (noHomingThisFrame) - return; - - Vector2 homingTarget = Projectile.Center; - bool foundTarget = false; - Vector2 targetVelocity = new Vector2(0f); - foreach (NPC potentialTarget in Main.ActiveNPCs) + if (Projectile.Calamity().stealthStrike) { - if (potentialTarget.CanBeChasedBy(Projectile, false) && Projectile.WithinRange(potentialTarget.Center, homingRange)) + if (time == 30) { - if (!foundTarget) + SpinSound?.Stop(); + SoundStyle fire = new("CalamityMod/Sounds/Item/RadiationBurst"); + SpinSoundSlot = SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0.3f }, Projectile.Center); + } + if (time >= 150) + { + NPC target = Owner.ClampedMouseWorld().ClosestNPCAt(2000); + if (time == 150) { - homingRange = Vector2.Distance(Projectile.Center, potentialTarget.Center); - homingTarget = potentialTarget.Center; - targetVelocity = potentialTarget.velocity; - foundTarget = true; - break; + Projectile.extraUpdates = 25; + } + if (target != null) + { + if (Projectile.numHits <= 0) + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.85f, 15, 0.97f); + } + else if (time == 150) + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for immediate direction impulse + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; + } + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 7, 0.13f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.65f, new Vector2(1, 0.3f), true, false, 1.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + else if (time > 30) + { + Projectile.velocity *= 0.955f; + float fade = Utils.GetLerpValue(150, 0, time); + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f); + velOffset *= Main.rand.NextFloat(25, 45) * fade; + Particle energy = new GlowOrbParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, (int)(14 - (5 * fade)), Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, Color.Chartreuse); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, 278, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = Color.Chartreuse; } } } - - - if (foundTarget && Projectile.ai[0] == 0f) - { - bool perfectAim = Main.rand.NextBool(3); - if (perfectAim) - Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, homingTarget, targetVelocity, Main.rand.NextFloat(18f, 20f)); - else - { - float angularTurnSpeed = 0.35f; - float angleToTargetCoords = Projectile.AngleTo(homingTarget); - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(angleToTargetCoords, angularTurnSpeed).ToRotationVector2() * Main.rand.NextFloat(18f, 20f); - } - } - - if (Projectile.ai[1] > 0f) - Projectile.ai[1] += (float)Main.rand.Next(1, 5); - if (Projectile.ai[1] > 30f) - { - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; - } - - if (Projectile.ai[0] == 0f) - { - if (Projectile.ai[1] == 0f && foundTarget && homingRange < 500f) - { - Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner) - Projectile.ai[0] = 1f; - } - } } - } - public override bool PreDraw(ref Color lightColor) + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.ai[0] == 1) + if (Projectile.Calamity().stealthStrike && time <= 151) + Projectile.numHits--; + if (Projectile.numHits == 0) { - //Glowing - Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1.64f, 0.8f, 0.5f)); //Using RGB directly fails, gotta use HSL - float opacityFactor = Projectile.ai[1] - 5; - if (opacityFactor < 0f) - opacityFactor = 0f; - GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(opacityFactor / 40f); - GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - Main.spriteBatch.ExitShaderRegion(); + if (Projectile.Calamity().stealthStrike) // Rainstorm + { + Vector2 rainSpot = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 490; + SoundStyle fire = new("CalamityMod/Sounds/Item/RadiationRain"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0 }, rainSpot); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/ViperSpit"); + SoundEngine.PlaySound(fire2 with { Volume = 1f, Pitch = -0.3f }, rainSpot); + for (int i = 0; i < 37; i++) + { + Dust chargefull = Dust.NewDustPerfect(rainSpot, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(1, 8); + chargefull.scale = Main.rand.NextFloat(0.45f, 0.75f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : Color.Chartreuse, 0.7f); + } + Particle Smear = new CustomPulse(rainSpot, Vector2.Zero, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-5, 5), 0, 0.35f, 12); + GeneralParticleHandler.SpawnParticle(Smear); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), rainSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0, 0, 100); + } + else // Radiation Burst + { + SoundStyle fire = new("CalamityMod/Sounds/Item/RadiationBurst"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0, MaxInstances = -1 }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + target.velocity * 32, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack * 3, Projectile.owner, 0, 0, 0); + } } - else - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } + target.AddBuff(ModContent.BuffType(), 90); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); + float minMult = 0.1f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 100; - Projectile.height = 100; - 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++) - { - 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()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 8; j++) - { - 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(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound)) + SpinSound?.Stop(); } + public override bool PreDraw(ref Color lightColor) + { + Vector2 drawPos = Projectile.Center - Main.screenPosition; + Asset tex = ModContent.Request(Texture); + Main.EntitySpriteDraw(tex.Value, drawPos, null, spinning ? Color.White : Color.Lerp(lightColor, Color.White, Utils.GetLerpValue(0, ChargeupTime, time, true)), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + Asset p = ModContent.Request("CalamityMod/Particles/VerticalSmear"); + + if (spinning) + { + Main.EntitySpriteDraw(p.Value, drawPos + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4, null, Color.Chartreuse with { A = 0 } * 0.45f, Projectile.velocity.ToRotation() + MathHelper.PiOver2, p.Size() * 0.5f, new Vector2(0.9f - 0.3f * Utils.GetLerpValue(25, 0, time, true), 1 + 0.6f * Utils.GetLerpValue(25, 0, time, true)) * Main.rand.NextFloat(1.25f, 1.4f), SpriteEffects.None); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Chartreuse * 0.5f, 1); + } + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 70, targetHitbox); } } diff --git a/Projectiles/Rogue/ElementalDiskProj.cs b/Projectiles/Rogue/ReboundingRainbowProj.cs similarity index 78% rename from Projectiles/Rogue/ElementalDiskProj.cs rename to Projectiles/Rogue/ReboundingRainbowProj.cs index 0d32eba95d..8f847a26a8 100644 --- a/Projectiles/Rogue/ElementalDiskProj.cs +++ b/Projectiles/Rogue/ReboundingRainbowProj.cs @@ -9,17 +9,17 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class ElementalDiskProj : ModProjectile, ILocalizedModType + public class ReboundingRainbowProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/ElementalDisk"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ReboundingRainbow"; private int Lifetime = 400; private int ReboundTime = 30; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue } // Returns after some number of frames in the air - int timeMult = Projectile.Calamity().stealthStrike ? ElementalDisk.stealthTimeMult : 1; + int timeMult = Projectile.Calamity().stealthStrike ? ReboundingRainbow.stealthTimeMult : 1; if (Projectile.timeLeft < Lifetime * timeMult - ReboundTime * timeMult) Projectile.ai[0] = 1f; @@ -139,23 +139,18 @@ namespace CalamityMod.Projectiles.Rogue int counter = Projectile.Calamity().stealthStrike ? 40 : 60; if (Main.player[Projectile.owner].miscCounter % counter == 0) { - int splitProj = ModContent.ProjectileType(); + int splitProj = ModContent.ProjectileType(); if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[splitProj] < 16) { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int disk = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); - int disk2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 4f; + Projectile split = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); if (Projectile.Calamity().stealthStrike) { - Main.projectile[disk].idStaticNPCHitCooldown = Main.projectile[disk2].idStaticNPCHitCooldown = 8; - Main.projectile[disk].usesIDStaticNPCImmunity = Main.projectile[disk2].usesIDStaticNPCImmunity = true; - Main.projectile[disk].timeLeft = Main.projectile[disk2].timeLeft = 60; + split.idStaticNPCHitCooldown = 8; + split.usesIDStaticNPCImmunity = true; + split.timeLeft = 60; } } } @@ -191,7 +186,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/ElementalDiskSplit.cs b/Projectiles/Rogue/ReboundingRainbowSplit.cs similarity index 86% rename from Projectiles/Rogue/ElementalDiskSplit.cs rename to Projectiles/Rogue/ReboundingRainbowSplit.cs index 6cc5c92660..95aecb60a2 100644 --- a/Projectiles/Rogue/ElementalDiskSplit.cs +++ b/Projectiles/Rogue/ReboundingRainbowSplit.cs @@ -6,15 +6,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class ElementalDiskSplit : ModProjectile, ILocalizedModType + public class ReboundingRainbowSplit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/ElementalDisk"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ReboundingRainbow"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Rogue/RefractionRotorProjectile.cs b/Projectiles/Rogue/RefractionRotorProjectile.cs index dfc1f380ca..202178f0a5 100644 --- a/Projectiles/Rogue/RefractionRotorProjectile.cs +++ b/Projectiles/Rogue/RefractionRotorProjectile.cs @@ -1,7 +1,15 @@ using System; +using System.Collections.Generic; +using System.Security.AccessControl; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,12 +19,14 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public const int EnergyShotCount = 6; + public const int StealthEnergyShotCount = 4; + private static float RotationIncrement = 0.5f; public override string Texture => "CalamityMod/Items/Weapons/Rogue/RefractionRotor"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 16; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 16; } public override void SetDefaults() @@ -24,9 +34,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 142; Projectile.height = 126; Projectile.friendly = true; - Projectile.penetrate = 10; + Projectile.penetrate = -1; Projectile.timeLeft = 300; Projectile.alpha = 255; + Projectile.MaxUpdates = 2; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; @@ -35,22 +46,46 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + float spin = Projectile.direction <= 0 ? -0.8f : 0.8f; + Projectile.rotation += spin * RotationIncrement; Projectile.alpha = Utils.Clamp(Projectile.alpha - 18, 0, 255); - Projectile.rotation += Projectile.velocity.Length() * Math.Sign(Projectile.velocity.X) * 0.036f; + if (Projectile.timeLeft == 80) + OnhitGrind(spin); + Projectile.StickyProjAI(80, true); + if (Projectile.Calamity().stealthStrike) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 450f, 24f, 30f); + } } - public override bool? CanDamage() => Projectile.alpha <= 128 ? null : false; + private void OnhitGrind(float spinDir) + { + // Spin extra fast to visually shred the enemy. + Projectile.rotation += spinDir * RotationIncrement * 0.8f; + Projectile.StickyProjAI(12, true); + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.timeLeft > 20) - Projectile.timeLeft = 20; + if (Projectile.timeLeft > 80) + Projectile.timeLeft = 80; + Projectile.ModifyHitNPCSticky(10); + Projectile.velocity *= 0.8f; + if (Projectile.soundDelay == 0) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.7f }, Projectile.Center); + Projectile.soundDelay = 10; + } + if (Main.myPlayer == Projectile.owner) + { + int slash = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.1f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, target.whoAmI, Projectile.velocity.ToRotation()); + if (Main.projectile.IndexInRange(slash)) + Main.projectile[slash].timeLeft = 20; + } } - public override void OnKill(int timeLeft) { - // Release a puff of rainbow dust and some blades. - // If this projectile is a stealth strike, don't create the blades as a gore-- create them as a projectile instead. + // Creates an explosion and fan of blades on death if (!Main.dedServ) { for (int i = 0; i < 15; i++) @@ -62,48 +97,27 @@ namespace CalamityMod.Projectiles.Rogue rainbowBurst.fadeIn = Main.rand.NextFloat(0.8f, 1.6f); rainbowBurst.noGravity = true; } - - if (!Projectile.Calamity().stealthStrike) - { - if (Main.netMode != NetmodeID.Server) - { - int goreType = Mod.Find("PrismShurikenBlade").Type; - for (int i = 0; i < 6; i++) - { - Vector2 shootDirection = (MathHelper.TwoPi * i / 6f + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2(); - Vector2 spawnPosition = Projectile.Center + Projectile.Size * 0.5f * Projectile.scale * shootDirection * 0.85f; - if (!WorldGen.SolidTile((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16)) - Gore.NewGorePerfect(Projectile.GetSource_Death(), spawnPosition, Projectile.velocity * 0.5f + shootDirection * 7f, goreType, Projectile.scale); - } - } - } + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.2f, 25); + GeneralParticleHandler.SpawnParticle(bolt2); + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.SkyBlue, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.1f, 21); + GeneralParticleHandler.SpawnParticle(bolt3); + Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkGreen, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.15f, 19); + GeneralParticleHandler.SpawnParticle(bolt4); } - int shootType = ModContent.ProjectileType(); + int shootType = ModContent.ProjectileType(); if (Main.myPlayer != Projectile.owner) return; - // Release a circle of damaging blades if this projectile is a stealth strike. - if (Projectile.Calamity().stealthStrike) - { - int bladeType = ModContent.ProjectileType(); - int rocketDamage = (int)(Projectile.damage * 0.8); - for (int i = 0; i < 6; i++) - { - Vector2 shootDirection = (MathHelper.TwoPi * i / 6f + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2(); - Vector2 spawnPosition = Projectile.Center + Projectile.Size * 0.5f * Projectile.scale * shootDirection * 0.85f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, Projectile.velocity * 0.5f + shootDirection * 7f, bladeType, rocketDamage, Projectile.knockBack, Projectile.owner); - } - } - - if (CalamityUtils.CountProjectiles(shootType) > 24) + if (CalamityUtils.CountOwnedProjectiles(shootType, Projectile.owner) > 24) return; - int energyDamage = (int)(Projectile.damage * 0.495); + int energyDamage = (int)(Projectile.damage * 0.5f); + int shotAmt = Projectile.Calamity().stealthStrike ? StealthEnergyShotCount : EnergyShotCount; float baseDirectionRotation = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < EnergyShotCount; i++) + for (int i = 0; i < shotAmt; i++) { - Vector2 shootVelocity = (MathHelper.TwoPi * i / EnergyShotCount + baseDirectionRotation).ToRotationVector2() * 9f; + Vector2 shootVelocity = (MathHelper.TwoPi * i / shotAmt + baseDirectionRotation).ToRotationVector2() * 9f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + shootVelocity, shootVelocity, shootType, energyDamage, Projectile.knockBack, Projectile.owner); } } @@ -114,6 +128,11 @@ namespace CalamityMod.Projectiles.Rogue Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; Vector2 origin = glowmask.Size() * 0.5f; Main.EntitySpriteDraw(glowmask, drawPosition, null, Projectile.GetAlpha(Color.White), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey"); + Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, (Main.rand.NextBool() ? Color.YellowGreen : Color.Goldenrod) with { A = 0 } * 0.55f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, (Main.rand.NextBool() ? 1.6f : 1.4f) * Main.rand.NextFloat(0.8f, 1.15f), SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, (Main.rand.NextBool() ? Color.OrangeRed : Color.CornflowerBlue) with { A = 0 } * 0.75f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, Main.rand.NextBool() ? 1.4f : 1.2f, SpriteEffects.None); } } } diff --git a/Projectiles/Rogue/RefractionRotorSlashCreator.cs b/Projectiles/Rogue/RefractionRotorSlashCreator.cs new file mode 100644 index 0000000000..48414382ae --- /dev/null +++ b/Projectiles/Rogue/RefractionRotorSlashCreator.cs @@ -0,0 +1,60 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class RefractionRotorSlashCreator : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + 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 = 45; + Projectile.MaxUpdates = 2; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + if (Main.myPlayer == Projectile.owner && Projectile.timeLeft % 20 == 19) + { + float maxOffset = Target.width * 0.4f; + if (maxOffset > 300f) + maxOffset = 300f; + Vector2 baseDirection = Vector2.UnitX; + if (Projectile.timeLeft <= 20) + baseDirection = -Vector2.UnitY; + + Vector2 spawnOffset = SlashDirection.ToRotationVector2(); + spawnOffset *= Main.rand.NextFloatDirection() * maxOffset; + Vector2 sliceVelocity = spawnOffset.SafeNormalize(Vector2.UnitY) * 0.1f; + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + spawnOffset, sliceVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); + } + } + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Rogue/RefractionSlash.cs b/Projectiles/Rogue/RefractionSlash.cs new file mode 100644 index 0000000000..69aa4d974d --- /dev/null +++ b/Projectiles/Rogue/RefractionSlash.cs @@ -0,0 +1,56 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class RefractionSlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() + { + Projectile.width = 512; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + 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; + if (Projectile.timeLeft == 34) + { + Particle spark2 = new GlowSparkParticle(Projectile.Center, new Vector2(0.1f, 0.1f).RotatedByRandom(100), false, 10, Main.rand.NextFloat(0.05f, 0.09f), (Main.rand.NextBool() ? Color.Cyan : Main.rand.NextBool() ? Color.LimeGreen : Color.PaleVioletRed) * 0.7f, new Vector2(2f, 0.5f), true); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); + + public override bool ShouldUpdatePosition() => true; + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.Cyan, Color.Lime, Projectile.identity / 7f % 1f) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/Rogue/RegulusEnergy.cs b/Projectiles/Rogue/RegulusEnergy.cs index cac9b64289..d3ec508ccb 100644 --- a/Projectiles/Rogue/RegulusEnergy.cs +++ b/Projectiles/Rogue/RegulusEnergy.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -11,100 +13,58 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float Timer => ref Projectile.ai[0]; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; Projectile.height = 8; Projectile.ignoreWater = true; Projectile.friendly = true; - Projectile.penetrate = 1; Projectile.tileCollide = false; + Projectile.timeLeft = 360; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - int constant = 14; - int coolDust; - Projectile.ai[0] += 1; - if (Projectile.ai[0] % 2 == 0) + Timer++; + if (Timer % 2 == 0) { - if (Projectile.ai[0] % 4 == 0) - { - 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(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; - Main.dust[coolDust].velocity += Projectile.velocity * 0.5f; + int dustType = Timer % 4 == 0 ? ModContent.DustType() : ModContent.DustType(); + Dust ambientDust = Dust.NewDustDirect(Projectile.position, Projectile.width - 28, Projectile.height - 28, dustType, 0f, 0f, 100, default, 1.5f); + ambientDust.noGravity = true; + ambientDust.velocity *= 0.1f; + ambientDust.velocity += Projectile.velocity * 0.5f; } - if (Projectile.ai[0] < 90) + + if (Timer < 60) { Projectile.velocity.X *= 0.98f; Projectile.velocity.Y *= 0.98f; } else { - Projectile.extraUpdates = 1; - - Vector2 center = Projectile.Center; - float maxDistance = 500f; - bool homeIn = false; - - foreach (NPC n in Main.ActiveNPCs) - { - if (n.CanBeChasedBy(Projectile, false)) - { - float extraDistance = (float)(n.width / 2) + (float)(n.height / 2); - - if (Vector2.Distance(n.Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1)) - { - center = n.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); } - - Projectile.rotation += 0.25f; } - public override bool? CanDamage() - { - return Projectile.ai[0] >= 90 ? null : false; - } + public override bool? CanDamage() => Timer >= 60 ? 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 otherConstant = 36; - for (int j = 0; j < otherConstant; j++) + int dustAmt = 18; + 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 - (otherConstant / 2 - 1)) * 6.28318548f / (float)otherConstant), default) + Projectile.Center; - Vector2 facingDirection = rotate - Projectile.Center; - int dusty = Dust.NewDust(rotate + facingDirection, 0, 0, ModContent.DustType(), facingDirection.X * 0.5f, facingDirection.Y * 0.5f, 100, default, 0.75f); - Main.dust[dusty].noGravity = true; + float dustRotation = MathHelper.Pi / dustAmt * j; + Vector2 dustVel = -Vector2.UnitY.RotatedBy(dustRotation) * (float)(Math.Sin(dustRotation) + 5f) * 2f; + + Dust deathDust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 50, default, 0.8f); + deathDust.noGravity = true; } } 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(), 60); } } diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index 34857952a4..626f47a9ce 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -14,10 +14,14 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/RegulusRiot"; + public ref float Timer => ref Projectile.ai[0]; + private bool canHome = false; + private int homingDelay = 0; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -31,6 +35,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.timeLeft = 240; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 15; } @@ -38,122 +43,71 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { if (Projectile.alpha > 0) - { Projectile.alpha -= 20; - } if (Projectile.alpha < 0) - { Projectile.alpha = 0; + + Dust blueDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); + blueDust.noGravity = true; + blueDust.velocity = Vector2.Zero; + Dust orangeDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); + orangeDust.noGravity = true; + orangeDust.velocity = Vector2.Zero; + + Timer++; + Projectile.rotation -= MathHelper.Pi / 30f; + if (homingDelay > 0) + homingDelay--; + if (Timer > 30f && homingDelay == 0) + canHome = true; + + if (Timer == 30f && !canHome) + { + Projectile.velocity *= 0.5f; + canHome = true; } - int blueDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); - Main.dust[blueDust].noGravity = true; - Main.dust[blueDust].velocity = Vector2.Zero; - int orangeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); - Main.dust[orangeDust].noGravity = true; - Main.dust[orangeDust].velocity = Vector2.Zero; - - Projectile.ai[0] += 1f; - int behaviorInt = 0; - if (Projectile.velocity.Length() <= 8f) //4 + if (canHome) { - behaviorInt = 1; - } - if (behaviorInt == 0) - { - Projectile.rotation -= MathHelper.Pi / 30f; - - if (Projectile.ai[0] >= 30f) - { - Projectile.extraUpdates = 2; - Projectile.velocity *= 0.98f; - Projectile.rotation -= 0.0174532924f; - } - if (Projectile.velocity.Length() < 8.2f) //4.1 - { - Projectile.velocity.Normalize(); - Projectile.velocity *= 4f; - Projectile.ai[0] = 0f; - Projectile.extraUpdates = 1; - } - } - else if (behaviorInt == 1) - { - Projectile.rotation -= MathHelper.Pi / 30f; Vector2 targetCenter = Projectile.Center; - float homingRange = 300f; - bool homeIn = false; - int targetIndex = 0; - if (Projectile.ai[1] == 0f) + float homingRange = 500f; + int targetIndex = -1; + + foreach (NPC n in Main.ActiveNPCs) { - for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + float extraDistance = (n.width / 2) + (n.height / 2); + if (!n.CanBeChasedBy(Projectile) || !Projectile.WithinRange(n.Center, homingRange + extraDistance)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < homingRange) { - NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(Projectile, false)) - { - Vector2 npcCenter = npc.Center; - if (Projectile.Distance(npcCenter) < homingRange) - { - homingRange = Projectile.Distance(npcCenter); - targetCenter = npcCenter; - homeIn = true; - targetIndex = npcIndex; - break; - } - } - } - if (homeIn) - { - if (Projectile.ai[1] != (float)(targetIndex + 1)) - { - Projectile.netUpdate = true; - } - Projectile.ai[1] = (float)(targetIndex + 1); - } - homeIn = false; - } - if (Projectile.ai[1] != 0f) - { - int npcIndex2 = (int)(Projectile.ai[1] - 1f); - NPC npc2 = Main.npc[npcIndex2]; - if (npc2.active && npc2.CanBeChasedBy(Projectile, true) && Projectile.Distance(npc2.Center) < 1000f) - { - homeIn = true; - targetCenter = Main.npc[npcIndex2].Center; + homingRange = currentNPCDist; + targetIndex = n.whoAmI; } } - if (!Projectile.friendly) + if (targetIndex != -1) { - homeIn = false; + targetCenter = Main.npc[targetIndex].Center; + Projectile.velocity = (Projectile.velocity * 15f + Vector2.Normalize(targetCenter - Projectile.Center) * 14f) / 16f; } - if (homeIn) - { - float homeSpeed = 24f; - float turnMult = 10f; - 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)); - totalDist = homeSpeed / totalDist; - xDist *= totalDist; - yDist *= totalDist; - Projectile.velocity.X = (Projectile.velocity.X * (turnMult - 1f) + xDist) / turnMult; - Projectile.velocity.Y = (Projectile.velocity.Y * (turnMult - 1f) + yDist) / turnMult; - } - } - if (Projectile.ai[0] >= 180f) - { - Projectile.Kill(); } } - 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); + if (Timer > 30f) + { + canHome = false; + homingDelay = 20; + } + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } @@ -162,29 +116,22 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int i = 0; i < 10; i++) { - int blueDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[blueDust].noGravity = true; - Main.dust[blueDust].velocity = Vector2.Zero; - } - for (int i = 0; i < 10; i++) - { - int orangeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[orangeDust].noGravity = true; - Main.dust[orangeDust].velocity = Vector2.Zero; + Dust killBlue = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + killBlue.noGravity = true; + killBlue.velocity = Vector2.Zero; + + Dust killOrange = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + killOrange.noGravity = true; + killOrange.velocity = Vector2.Zero; } if (Projectile.Calamity().stealthStrike) { if (Projectile.owner == Main.myPlayer) { - float spread = 60f * 0.0174f; - 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++) + for (int i = 0; i < 5; 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.4), 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.4), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 5f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 2f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.45f), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Rogue/RotBallProjectile.cs b/Projectiles/Rogue/RotBallProjectile.cs index 47437ea0d3..66ce8495dc 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 2c946b43b3..8da92c9fc3 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Rogue public override string Texture => "CalamityMod/Items/Weapons/Rogue/Sacrifice"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 8; } public override void SetDefaults() @@ -57,17 +57,14 @@ namespace CalamityMod.Projectiles.Rogue { int heal = Projectile.Calamity().stealthStrike ? 40 : 3; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) + if (Main.LocalPlayer.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; + Main.LocalPlayer.lifeSteal -= heal; + Owner.HealPlayer(heal); } Projectile.Kill(); @@ -105,7 +102,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } diff --git a/Projectiles/Rogue/SamsaraSlicerProjectile.cs b/Projectiles/Rogue/SamsaraSlicerProjectile.cs index e0c48554f8..1433f615a4 100644 --- a/Projectiles/Rogue/SamsaraSlicerProjectile.cs +++ b/Projectiles/Rogue/SamsaraSlicerProjectile.cs @@ -1,7 +1,12 @@ using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using MonoMod.Core.Utils; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,14 +17,22 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SamsaraSlicer"; - private bool initialized = false; - private int Lifetime = 180; - private int ReboundTime = 45; + public float ReboundVelocity => 20; + public float StealthReboundVelocity => 30; + public float StealthPauseTime => 55; + public int ReboundTime => 20; + + public int SmallDiskDamage => 8; + public int SmallDiskStealthDamage => 17; + + public bool initialized = false; + + Vector2 oldVelocity; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -27,180 +40,240 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 46; Projectile.ignoreWater = true; Projectile.friendly = true; - Projectile.tileCollide = false; + Projectile.tileCollide = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 30; Projectile.penetrate = -1; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.aiStyle = -1; + Projectile.ai[0] = -200; + Projectile.ai[2] = -200; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + width = 20; + height = 20; + + return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); } public override void AI() { - Initialize(); - BoomerangAI(); - StealthStrikeAI(); - SpawnProjectilesNearEnemies(); - LightingandDust(); - } + Lighting.AddLight(Projectile.Center, new Vector3(0.1f, 0.5f, 0.03f)); - private void Initialize() - { - if (initialized) - return; - - Lifetime = Projectile.Calamity().stealthStrike ? 360 : 180; - ReboundTime = Projectile.Calamity().stealthStrike ? 90 : 45; - Projectile.timeLeft = Lifetime; - initialized = true; - } - - private void BoomerangAI() - { - // Boomerang rotation - Projectile.rotation += 0.4f * Projectile.direction; - - // Boomerang sound - if (Projectile.soundDelay == 0) + if (!initialized) { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); + Projectile.ai[2] = -200; + Projectile.ai[0] = -200; + initialized = true; } - // Returns after some number of frames in the air - if (Projectile.timeLeft < Lifetime - ReboundTime) - Projectile.ai[0] = 1f; + Player player = Main.player[Projectile.owner]; - if (Projectile.ai[0] == 1f) + // Main movement + + if (Projectile.ai[0] < 0) { - //Ignore tiles and fly faster - Projectile.tileCollide = false; - Projectile.extraUpdates = 1; + Projectile.ai[1]++; - Player player = Main.player[Projectile.owner]; - float returnSpeed = 16f; - float acceleration = 1.4f; - Vector2 playerVec = player.Center - Projectile.Center; - float dist = playerVec.Length(); - - // Delete the projectile if it's excessively far away. - if (dist > 3000f) - Projectile.Kill(); - - playerVec.Normalize(); - playerVec *= returnSpeed; - - // Home back in on the player. - if (Projectile.velocity.X < playerVec.X) + if (Projectile.ai[1] > ReboundTime) { - Projectile.velocity.X += acceleration; - if (Projectile.velocity.X < 0f && playerVec.X > 0f) - Projectile.velocity.X += acceleration; - } - else if (Projectile.velocity.X > playerVec.X) - { - Projectile.velocity.X -= acceleration; - if (Projectile.velocity.X > 0f && playerVec.X < 0f) - Projectile.velocity.X -= acceleration; - } - if (Projectile.velocity.Y < playerVec.Y) - { - Projectile.velocity.Y += acceleration; - if (Projectile.velocity.Y < 0f && playerVec.Y > 0f) - Projectile.velocity.Y += acceleration; - } - else if (Projectile.velocity.Y > playerVec.Y) - { - Projectile.velocity.Y -= acceleration; - if (Projectile.velocity.Y > 0f && playerVec.Y < 0f) - Projectile.velocity.Y -= acceleration; - } + Projectile.tileCollide = false; - // Delete the projectile if it touches its owner. - if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(player.Hitbox)) - Projectile.Kill(); - } - } + float lerp = (float)(Projectile.ai[1] - ReboundTime) * 0.01f; - private void StealthStrikeAI() - { - if (!Projectile.Calamity().stealthStrike) - return; + if (Projectile.Calamity().stealthStrike) + lerp = (float)(Projectile.ai[1] - ReboundTime) * 0.005f; - 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)); - Main.projectile[disk].timeLeft *= 2; - Main.projectile[disk].aiStyle = -1; - } - } + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.DirectionTo(player.Center) * (Projectile.Calamity().stealthStrike ? StealthReboundVelocity : ReboundVelocity), lerp); - private void SpawnProjectilesNearEnemies() - { - if (!Projectile.friendly) - return; - - const float maxDistance = 300f; - bool homeIn = false; - - foreach (NPC npc in Main.ActiveNPCs) - { - 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) + if (Projectile.Distance(player.Center) < Projectile.velocity.Length() * 1.4f) { - homeIn = true; - break; - } - } - } - - if (homeIn) - { - if (Main.player[Projectile.owner].miscCounter % 50 == 0) - { - int splitProj = ModContent.ProjectileType(); - if (Projectile.owner == Main.myPlayer) - { - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - for (int i = 0; i < 6; i++) + for (int i = 0; i < Main.projectile.Length; 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 proj = Main.projectile[i]; + + if (proj.type == ModContent.ProjectileType()) + { + if ((proj.ModProjectile as SamsaraSlicerSmallDisk).Parent == Projectile) + { + (Main.projectile[i].ModProjectile as SamsaraSlicerSmallDisk).Parent = null; + } + } } + + Projectile.Kill(); } } } - } - private void LightingandDust() - { - Lighting.AddLight(Projectile.Center, 0f, 0.75f, 0f); - if (!Main.rand.NextBool(5)) - return; - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y); + // Frame pause + + if (Projectile.ai[0] > -150) Projectile.ai[0]--; + + if (Projectile.ai[0] == 0) + { + Projectile.velocity = oldVelocity; + + SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot.WithPitchOffset(1f)); + + + if (Projectile.Calamity().stealthStrike) + { + SoundEngine.PlaySound(SoundID.Item122.WithPitchOffset(1f), Projectile.Center); + + for (int i = 1; i <= 3; i++) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, oldVelocity * MathHelper.Lerp(2f, 1f, (float)i / 3f) / 4, Color.LimeGreen, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(0.6f, 1f), oldVelocity.ToRotation(), 0.02f, 0.05f * i, 30)); + } + + for (int i = -10; i <= 20; i++) + { + GeneralParticleHandler.SpawnParticle(new CustomSpark(Projectile.Center, new Vector2(i * 2, 0).RotatedBy(Projectile.velocity.ToRotation()), "CalamityMod/Particles/ThinEndedLine", false, 10, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool() ? new Color(1f, 0.8f, 0.1f) : Color.LimeGreen, new Vector2(Main.rand.NextFloat(0.4f, 1f), 1f))); + } + } + else + { + for (int i = 1; i <= 2; i++) + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, new Vector2(i == 1 ? 2 : 6, 0).RotatedBy(Projectile.velocity.ToRotation()), Color.LimeGreen, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.5f - (i * 0.1f), 20)); + } + + for (int i = 0; i <= 5; i++) + GeneralParticleHandler.SpawnParticle(new CustomSpark(Projectile.Center, new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-10f, 10f)).RotatedBy(Projectile.velocity.ToRotation()), "CalamityMod/Particles/ThinEndedLine", false, 10, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool() ? new Color(1f, 0.8f, 0.1f) : Color.LimeGreen, new Vector2(Main.rand.NextFloat(0.4f, 1f), 1f))); + } + + if (Projectile.ai[0] <= 0 && Projectile.ai[0] > -4) + { + Projectile.extraUpdates = 1; + } + else + { + Projectile.extraUpdates = 0; + } + + Vector2 vel = Projectile.velocity; + if (Projectile.ai[0] > 0) + { + vel = new Vector2(18); + } + + if (Projectile.ai[2] > -150) + { + Projectile.ai[2]--; + } + + if (Projectile.ai[2] > 0) + { + if (Projectile.ai[2] % (Projectile.Calamity().stealthStrike ? 3 : 5) == 0) + { + SoundEngine.PlaySound(SoundID.Item23.WithPitchOffset(MathHelper.Lerp(1f, 0f, Projectile.ai[2] / 30)).WithVolumeScale(0.8f)); + } + + for (int i = 0; i <= 2; i++) + GeneralParticleHandler.SpawnParticle(new CustomSpark(Projectile.Center + new Vector2(25, 0).RotatedBy(oldVelocity.ToRotation()), new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-10f, 10f)).RotatedBy(oldVelocity.ToRotation()), "CalamityMod/Particles/ThinEndedLine", false, 10, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool() ? new Color(1f, 0.8f, 0.1f) : Color.LimeGreen, new Vector2(Main.rand.NextFloat(0.4f, 1f), 1f))); + } + + if (Projectile.ai[2] > -150) + { + if (Projectile.Calamity().stealthStrike) + { + float SpawnVel = 15; + + float g = Main.rand.NextFloat(360f); + + if (!Main.dedServ) + { + Projectile proj = Projectile.NewProjectileDirect(new EntitySource_Parent(Projectile), Projectile.Center, new Vector2(SpawnVel, 0).RotatedBy(MathHelper.ToRadians(g)), + ModContent.ProjectileType(), Projectile.Calamity().stealthStrike ? SmallDiskStealthDamage : SmallDiskDamage, 1f, Projectile.owner, Projectile.whoAmI); + (proj.ModProjectile as SamsaraSlicerSmallDisk).Parent = Projectile; + } + } + } + + if (Projectile.ai[2] == 0) + { + Projectile.localNPCHitCooldown = 30; + } + + Projectile.rotation += MathHelper.ToRadians(vel.Length() * 1.5f); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Asset tex = ModContent.Request(Texture); + + float rand = 0; + if (Projectile.ai[2] > 0) + { + rand = 4; + } + + Vector2 randVec = new Vector2(Main.rand.NextFloat(-rand, rand), 0).RotatedBy(oldVelocity.ToRotation()); + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + randVec, tex.Frame(), Color.White, Projectile.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); + + if (Projectile.ai[2] < 0) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], new Color(0f, 0.6f, 0f, 0f), 2, ModContent.Request("CalamityMod/Items/Weapons/Rogue/SamsaraSlicerGlow").Value); + } + else + { + //Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/SamsaraSlicerGlow").Value, Projectile.Center - Main.screenPosition + randVec, tex.Frame(), new Color(0f, 1f, 0f, 0f), Projectile.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); + + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/SamsaraSlicerGlow").Value, Projectile.Center - Main.screenPosition + randVec, tex.Frame(), new Color(0f, 1f, 0f, 0f), Projectile.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); + } return false; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.velocity != Vector2.Zero) + { + if (Projectile.ai[0] <= -200) + oldVelocity = Projectile.velocity * 1.5f; + else + oldVelocity = Projectile.velocity; + } + Projectile.ai[1] = ReboundTime - 10; + Projectile.velocity = Vector2.Zero; + Projectile.ai[0] = 5; + + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); + + if (Projectile.ai[2] == -200) + { + float lag = 20; + if (Projectile.Calamity().stealthStrike) lag = StealthPauseTime; + + Projectile.ai[0] = lag; + Projectile.ai[2] = lag; + + Projectile.localNPCHitCooldown = (int)lag; + + float g = Main.rand.NextFloat(360f); + + g -= 15f; + + float SpawnVel = 15; + if (Projectile.Calamity().stealthStrike) + SpawnVel = 20; + + if (!Main.dedServ) + { + for (float i = g; i < g + 360f; i += Projectile.Calamity().stealthStrike ? 45f : 90f) + { + Projectile proj = Projectile.NewProjectileDirect(new EntitySource_Parent(Projectile), Projectile.Center, new Vector2(SpawnVel, 0).RotatedBy(MathHelper.ToRadians(i)), + ModContent.ProjectileType(), Projectile.Calamity().stealthStrike ? SmallDiskStealthDamage : SmallDiskDamage, 1f, Projectile.owner, Projectile.whoAmI); + (proj.ModProjectile as SamsaraSlicerSmallDisk).Parent = Projectile; + proj.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; + } + } + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - // Return to the player after striking an enemy. Stealth strikes don't return immediately. - if (!Projectile.Calamity().stealthStrike || Projectile.ai[1] > 3) - Projectile.ai[0] = 1f; - Projectile.ai[1]++; } // Make it bounce on tiles. @@ -218,7 +291,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.velocity.Y = -oldVelocity.Y; } - Projectile.ai[0] = 1f; + return false; } } diff --git a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs index 9d0c40de2b..dac74b5b0d 100644 --- a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs +++ b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,88 +10,117 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; private double rotation = 0; + public Projectile Parent = null; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { Projectile.width = 40; Projectile.height = 40; - Projectile.alpha = 75; Projectile.ignoreWater = true; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.aiStyle = ProjAIStyleID.Boomerang; - Projectile.timeLeft = 60; - AIType = ProjectileID.WoodenBoomerang; + Projectile.aiStyle = -1; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 3; } public override void AI() { - StealthStrikeAI(); - LightingandDust(); - } - - private void StealthStrikeAI() - { - if (Projectile.aiStyle == 3) - return; - - Projectile.rotation += 0.4f * Projectile.direction; - - Projectile parent = Main.projectile[0]; - bool active = false; - foreach (Projectile p in Main.ActiveProjectiles) + if (Parent != null) { - if (p.identity == Projectile.ai[0] && p.type == ModContent.ProjectileType()) + if (!Parent.active) Parent = null; + } + + Player player = Main.player[Projectile.owner]; + + if (Projectile.Calamity().stealthStrike) + { + Projectile.localNPCHitCooldown = 3; + Projectile.usesLocalNPCImmunity = true; + } + + bool returning = false; + + Projectile.ai[1]++; + + Projectile.rotation += MathHelper.ToRadians(12f); + + float Vel = 15; + if (Projectile.Calamity().stealthStrike) Vel = 20; + + float length = 10; + if (Projectile.Calamity().stealthStrike) length = 15; + + if (Projectile.ai[1] > length) + { + Vel += (Projectile.ai[1] - length); + if (Parent != null) { - parent = p; - active = true; - break; + if (Parent.active) + { + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.DirectionTo(Parent.Center) * Vel, Projectile.Calamity().stealthStrike ? 0.25f : 0.35f); + + if ((Projectile.Center + Projectile.velocity).Distance(Parent.Center) < Projectile.velocity.Length()) + { + Projectile.Kill(); + } + } + else returning = true; } + else returning = true; } - if (active) + if (Parent != null && Parent.active) { - Vector2 vector = parent.Center - Projectile.Center; - Projectile.Center = parent.Center + new Vector2(80, 0).RotatedBy(rotation); - double rotateAmt = (double)Projectile.ai[1]; - rotation += rotateAmt; - if (rotation >= 360) + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(8f)); + } + + if (Parent != null && !returning) + { + Projectile.position += Parent.velocity; + } + + if (Parent == null) + { + Projectile.timeLeft = 5; + Projectile.position += player.velocity; + Projectile.velocity = Projectile.DirectionTo(player.Center) * 4f; + Projectile.scale *= 0.9f; + if (Projectile.Distance(player.Center) < Projectile.velocity.Length()) { - rotation = 0; + Projectile.Kill(); } - Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; - } - else - { - Projectile.Kill(); - } - - if (!parent.active) - { - Projectile.Kill(); } } - private void LightingandDust() + public override void OnSpawn(IEntitySource source) { - Lighting.AddLight(Projectile.Center, 0f, 0.75f, 0f); - if (!Main.rand.NextBool(5)) - return; - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y); + Parent = Main.projectile[(int)Projectile.ai[0]]; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.immune[Projectile.owner] = 0; } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + for (int i = 1; i < Projectile.oldPos.Length; i++) + { + Vector2 oldP1 = Projectile.oldPos[i]; + Vector2 oldP2 = Projectile.oldPos[i - 1]; + + Projectile.oldPos[i] = oldP2 + (oldP2.DirectionTo(oldP1) * MathHelper.Min(oldP2.Distance(oldP1), 5)); + } + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], new Color(0.2f, 1f, 0f, 0f), 2); return false; } } diff --git a/Projectiles/Rogue/SandslasherProj.cs b/Projectiles/Rogue/SandslasherProj.cs deleted file mode 100644 index 804f778f39..0000000000 --- a/Projectiles/Rogue/SandslasherProj.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SandslasherProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/Sandslasher"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 40; - Projectile.height = 40; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 16; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Projectile.ai[0] += 1f; - Projectile.ai[1] += 1f; - if (Projectile.ai[0] == 3f) - Projectile.tileCollide = true; - 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) - { - 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) - { - 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); - Projectile.ai[1] = 0; - } - } - - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 15; i++) - { - 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); - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Rogue/ScarletDevilBullet.cs b/Projectiles/Rogue/ScarletDevilBullet.cs index 7dadea5643..bdd68edb7c 100644 --- a/Projectiles/Rogue/ScarletDevilBullet.cs +++ b/Projectiles/Rogue/ScarletDevilBullet.cs @@ -1,11 +1,13 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class ScarletDevilBullet : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 16; diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 07873133be..fa631e61cb 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -19,13 +19,13 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 45; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 45; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 45; + ProjectileID.Sets.TrailCacheLength[Type] = 45; Projectile.width = 108; Projectile.height = 108; Projectile.friendly = true; @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Rogue { if (!Projectile.Calamity().stealthStrike) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(100, 100, 100)); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], new Color(100, 100, 100)); return true; } else @@ -192,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D spearTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; for (int i = 0; i < 7; i++) { diff --git a/Projectiles/Rogue/ScourgeVenomCloud.cs b/Projectiles/Rogue/ScourgeVenomCloud.cs index 1ea306b316..a1fa4c3477 100644 --- a/Projectiles/Rogue/ScourgeVenomCloud.cs +++ b/Projectiles/Rogue/ScourgeVenomCloud.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame = 0; } } - else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Projectile.type]) + else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Type]) { Projectile.Kill(); } diff --git a/Projectiles/Rogue/ScourgeoftheDesertProj.cs b/Projectiles/Rogue/ScourgeoftheDesertProj.cs index 15f6029cb4..3b9e665621 100644 --- a/Projectiles/Rogue/ScourgeoftheDesertProj.cs +++ b/Projectiles/Rogue/ScourgeoftheDesertProj.cs @@ -1,16 +1,10 @@ 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 Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Humanizer.In; namespace CalamityMod.Projectiles.Rogue { @@ -27,11 +21,14 @@ namespace CalamityMod.Projectiles.Rogue public Vector2 SavedOldVelocity; public Vector2 NPCDestination; public bool SetPierce = false; + public int postHitNoDig = 0; + public bool collideWithTiles = true; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -41,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.penetrate = 2; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.tileCollide = true; + Projectile.tileCollide = false; Projectile.timeLeft = 600; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; @@ -54,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = Projectile.Calamity().stealthStrike ? 4 : 2; SetPierce = true; } - InsideTiles = Collision.SolidCollision(Projectile.Center, 50, 50); + InsideTiles = Collision.SolidCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX * 10), 10, 10); Time++; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Player Owner = Main.player[Projectile.owner]; @@ -62,12 +59,15 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(2)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), Main.rand.NextBool() ? 288 : 207); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), Main.rand.NextBool() ? 288 : 121); dust.scale = Main.rand.NextFloat(0.3f, 0.55f); dust.noGravity = true; dust.velocity = -Projectile.velocity * 0.5f; } + if (postHitNoDig > 0) + postHitNoDig--; + if (!InitialTileHit && Time > 45) { if (Projectile.velocity.Y < 0) @@ -86,13 +86,15 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.NPCHit11 with { Volume = 1.3f, Pitch = 1.1f }, Projectile.Center); for (int i = 0; i <= 25; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 6.5f, Main.rand.NextBool() ? 207 : 216, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.3f, 0.9f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 6.5f, Main.rand.NextBool() ? 121 : 216, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.3f, 0.9f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); dust.noGravity = true; } PostExitTiles = true; } if (PostExitTiles) { + if (Projectile.velocity.Length() < 10) + Projectile.velocity *= 1.02f; if (Projectile.timeLeft % 2 == 0 && playerDist < 1400f) { SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 8f, -Projectile.velocity * 0.1f, false, 9, 2.3f, Color.White * 0.1f); @@ -160,23 +162,28 @@ namespace CalamityMod.Projectiles.Rogue } } } + + CustomTileCollide(); } - public override bool OnTileCollide(Vector2 oldVelocity) + public void CustomTileCollide() { - SavedOldVelocity = oldVelocity; - Projectile.tileCollide = false; - if (!InitialTileHit) // Enter ground + if (collideWithTiles && postHitNoDig == 0 && InsideTiles && Time > 5) { - for (int i = 0; i <= 25; i++) + SavedOldVelocity = Projectile.velocity; + collideWithTiles = false; + + if (!InitialTileHit) // Enter ground { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 3, Main.rand.NextBool() ? 207 : 216, -Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.3f, 0.9f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); - dust.noGravity = true; + for (int i = 0; i <= 25; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 3, Main.rand.NextBool() ? 121 : 216, -Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.3f, 0.9f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + dust.noGravity = true; + } + Projectile.velocity = SavedOldVelocity * 0.7f; + SoundEngine.PlaySound(SoundID.WormDig with { Volume = 1.5f, Pitch = 1.1f }, Projectile.Center); + InitialTileHit = true; } - Projectile.velocity = oldVelocity * 0.7f; - SoundEngine.PlaySound(SoundID.WormDig with { Volume = 1.5f, Pitch = 1.1f }, Projectile.Center); - InitialTileHit = true; } - return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -187,26 +194,28 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.Calamity().stealthStrike) { + if (PostExitTiles || InsideTiles) + Projectile.extraUpdates = 4; Projectile.timeLeft = 600; Time = 10; TimeUnderground = 0; PostExitTiles = false; + postHitNoDig = 50; InitialTileHit = false; - InsideTiles = false; - Projectile.tileCollide = true; + collideWithTiles = true; } } public override void OnKill(int timeLeft) { for (int i = 0; i <= 25; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity, Main.rand.NextBool(3) ? 216 : 207, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.05f, 2.2f), 0, default, Main.rand.NextFloat(1.5f, 2.8f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity, Main.rand.NextBool(3) ? 216 : 121, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.05f, 2.2f), 0, default, Main.rand.NextFloat(1.5f, 2.8f)); dust.noGravity = true; } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2, null, true, true); return false; } } diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index e3a34b3310..ec0174b1a5 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index aef6b80960..ea6787c932 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -8,90 +12,101 @@ namespace CalamityMod.Projectiles.Rogue public class SeafoamBombProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public int time = 0; + public bool notTheClone => Projectile.Calamity().stealthStrike && Projectile.ai[0] == 0; // If the bomb is the initial thrown stealth strike bomb and not a split public override void SetDefaults() { - Projectile.width = 14; - Projectile.height = 20; + Projectile.width = Projectile.height = 38; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 240; + Projectile.timeLeft = 400; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.extraUpdates = 1; } public override void AI() { - Projectile.rotation += Projectile.velocity.X * 0.1f; - 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; + Projectile.spriteDirection = Projectile.direction; + float dustscaleMult = 1; + if (notTheClone) + { + Projectile.scale = 1.15f; + Projectile.extraUpdates = 2; + dustscaleMult = 1.5f; + } + if (time > 25) + { + Projectile.velocity.Y = Projectile.velocity.Y + 0.1f; + if (Projectile.velocity.Y > 0) + Projectile.velocity.X = Projectile.velocity.X * 0.975f; + } + Projectile.rotation += Projectile.velocity.X * 0.07f + Projectile.direction * 0.07f; + + Vector2 dustPos = Projectile.Center + (Vector2.UnitY * -22 * Projectile.scale).RotatedBy(Projectile.rotation - (MathHelper.PiOver2 + 0.4f) * Projectile.spriteDirection); + Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType(), Projectile.velocity * Main.rand.NextFloat(0.15f, 0.35f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.4f, 0.55f) * dustscaleMult; + dust2.color = Color.Lerp(Color.Cyan, Color.Turquoise, Main.rand.NextFloat(0, 0.7f)); + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustPerfect(dustPos, ModContent.DustType(), Projectile.velocity.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(0.65f, 0.85f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.7f, 1f) * dustscaleMult; + dust.color = Color.Lerp(Color.Cyan, Color.Turquoise, Main.rand.NextFloat(0, 0.7f)); + } + + time++; + Lighting.AddLight(Projectile.Center, Color.DodgerBlue.ToVector3() * 0.3f * dustscaleMult); } public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = Projectile.Calamity().stealthStrike ? 256 : 128; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - 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 < (Projectile.Calamity().stealthStrike ? 5 : 1); i++) + if (notTheClone) // Split into a few normal bombs that have reduced damage { - float posX = Projectile.Center.X + (Projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); - float posY = Projectile.Center.Y + (Projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), posX, posY, 0f, 0f, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.4), 0f, Projectile.owner, 0f, 0f); - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = Projectile.Calamity().stealthStrike ? 6 : 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + for (int i = 0; i < 15; i++) { - 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; + Vector2 randVel = new Vector2(7, 7).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.SlateGray * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); + GeneralParticleHandler.SpawnParticle(smoke); } + + float throwCount = Projectile.localAI[0]; + if (Main.myPlayer == Projectile.owner) + { + for (int i = 0; i < (Main.zenithWorld ? 38 : 8); i++) + { + throwCount++; + Vector2 vel = (Vector2.UnitY * -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.8f, 1.3f); + int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel, Projectile.type, Projectile.damage / 4, Projectile.knockBack, Projectile.owner); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].localAI[0] = throwCount; + Main.projectile[stealth].ai[0] = 1; + Main.projectile[stealth].extraUpdates = 3; + } + } + + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = -0.3f, Volume = 0.8f }, Projectile.Center); + } + else // Normal bubble spawn + { + Projectile bubble = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f, -5f); + bubble.localAI[0] = Projectile.localAI[0]; + SoundEngine.PlaySound(SoundID.Item14 with { Pitch = Main.rand.NextFloat(0.15f, 0.3f), Volume = 0.6f, MaxInstances = 10 }, Projectile.Center); } } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request(Texture); + if (notTheClone) + { + for (int i = 0; i < 25; i++) + { + Color auraColor = Color.Turquoise with { A = 0 } * 0.35f; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 3; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + return true; + } + public override bool? CanDamage() => (!notTheClone && Projectile.Calamity().stealthStrike && time < 30) ? false : null; // Dont have the cluster bomb splits detonate on enemies right when they spawn } } diff --git a/Projectiles/Rogue/SeafoamBombProj.png b/Projectiles/Rogue/SeafoamBombProj.png index 128c4f76bb..b12539c68c 100644 Binary files a/Projectiles/Rogue/SeafoamBombProj.png and b/Projectiles/Rogue/SeafoamBombProj.png differ diff --git a/Projectiles/Rogue/SeafoamBubble.cs b/Projectiles/Rogue/SeafoamBubble.cs index d33e0aa2b0..5cd7cf61a0 100644 --- a/Projectiles/Rogue/SeafoamBubble.cs +++ b/Projectiles/Rogue/SeafoamBubble.cs @@ -1,4 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,59 +14,199 @@ namespace CalamityMod.Projectiles.Rogue public class SeafoamBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Typeless/CoralBubble"; + public ref float time => ref Projectile.ai[0]; + public ref float bubbleLevel => ref Projectile.ai[1]; // -1 = small bubble, 0 = fusing bubble, 1 = big bubble + public bool startEffects = true; // Spawn effects + public float radius => 40 * Projectile.scale; + public bool canHit = false; // Only the small bubbles can directly hit enemies + public Projectile fuseGoal; // The bubble to fuse with + public NPC targeted; // The enemy to home in on as a small bubble + + public override void SetStaticDefaults() => Main.projFrames[Type] = 2; public override void SetDefaults() { - Projectile.width = 28; - Projectile.height = 28; + Projectile.width = Projectile.height = 32; Projectile.friendly = true; - Projectile.penetrate = 3; - Projectile.timeLeft = 180; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 1; Projectile.tileCollide = false; - Projectile.alpha = 255; - Projectile.scale = 1f; - Projectile.localNPCHitCooldown = 30; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 15; } - public override void AI() { - Projectile.ai[0] += 1f; - if (Projectile.alpha < 50) + // All the on spawn effects, also happens when a mid bubble becomes a big bubble + if (startEffects) { - Projectile.alpha = 50; + if (bubbleLevel == 0) + { + canHit = false; + for (int i = 0; i < 5; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 6f * (i % 2 == 0 ? 0.88f : 1f); + Particle sparks = new VelChangingSpark(Projectile.Center, (vel * Main.rand.NextFloat(1.6f, 2.4f)).RotatedByRandom(0.35f), Vector2.UnitY * -6, "CalamityMod/Particles/BloomRing", Main.rand.Next(28, 32 + 1), Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, new Vector2(1f, 1), true, false, 0, false, 0.065f, 0.13f); + GeneralParticleHandler.SpawnParticle(sparks); + } + } + if (bubbleLevel == 1) + { + Projectile.extraUpdates = 2; + Projectile.timeLeft = 180; + Projectile.velocity = Vector2.UnitY * -1.5f; + canHit = false; + for (int i = 0; i < 10; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 8f * (i % 2 == 0 ? 0.88f : 1f); + Particle sparks = new VelChangingSpark(Projectile.Center, (vel * Main.rand.NextFloat(1.6f, 2.4f)).RotatedByRandom(0.35f), Vector2.UnitY * -6, "CalamityMod/Particles/BloomRing", Main.rand.Next(28, 32 + 1), Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, new Vector2(1f, 1), true, false, 0, false, 0.065f, 0.13f); + GeneralParticleHandler.SpawnParticle(sparks); + } + } + if (bubbleLevel == -1) + { + Projectile.scale = 0.6f; + canHit = true; + } + startEffects = false; } - else if (Projectile.alpha > 50) - { - Projectile.alpha -= 10; - } - Projectile.scale += 0.002f; - if (Projectile.ai[0] % 60 == 0) - { - Projectile.damage *= 2; - } - } + // Mid + if (bubbleLevel == 0) + { + Projectile.scale = 1f; + float distance = 500; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile != Projectile && Vector2.Distance(Projectile.Center, projectile.Center) < distance && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] == 0 && projectile.owner == Projectile.owner) + { + distance = Vector2.Distance(Projectile.Center, projectile.Center); + fuseGoal = projectile; + } + } + if (fuseGoal != null) + { + if (Projectile.velocity.Length() < 5) + Projectile.velocity = Projectile.velocity * 0.99f + Utils.DirectionTo(Projectile.Center, fuseGoal.Center) * 0.03f; + else + Projectile.velocity *= 0.995f; + + if (Utils.Distance(Projectile.Center, fuseGoal.Center) < radius) + { + if (fuseGoal.localAI[0] > Projectile.localAI[0]) + { + fuseGoal.localAI[0] = -5; + fuseGoal.Kill(); + Projectile.ai[1]++; + startEffects = true; + } + } + + if (!fuseGoal.active || fuseGoal.ai[1] != 0) + fuseGoal = null; + } + else if (Projectile.velocity.Length() > 2) + Projectile.velocity *= 0.99f; + + if (Projectile.velocity.Y > -2) + Projectile.velocity.Y -= 0.012f; + } + // Large + if (bubbleLevel == 1) + { + Projectile.scale = 1f; + Projectile.velocity *= 0.99f; + } + // Small + if (bubbleLevel == -1) + { + if (targeted == null || !targeted.active || targeted.life <= 0) + targeted = Projectile.Center.ClosestNPCAt(500); + if (time > 90) + { + Projectile.extraUpdates = 2; + if (targeted == null) + { + if (Projectile.velocity.Y > -3) + Projectile.velocity.Y -= 0.02f; + } + else + CalamityUtils.HomeInOnSelectedNPC(Projectile, Projectile.Center.ClosestNPCAt(700), false, 0.18f, 7, 0.98f, accelerate: true); + } + else + { + Projectile.velocity *= 0.99f; + Projectile.velocity.Y -= 0.027f; + } + } + + if (Projectile.ai[1] == -1) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, Color.Turquoise.ToVector3() * 0.3f * Projectile.scale); + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 60); + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 60; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int inc; - for (int i = 0; i < 25; i = inc + 1) + float miniBubbles = 0; + if (bubbleLevel == 0) + miniBubbles = 2; + if (bubbleLevel == 1) + miniBubbles = 5; + if (bubbleLevel == -1) { - 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(); - Dust dust = Main.dust[waterDust]; - dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[waterDust].alpha = Projectile.alpha; - inc = i; + SoundEngine.PlaySound(SoundID.Item54 with { MaxInstances = 6 }, Projectile.Center); + for (int i = 0; i < 2; i++) + { + Vector2 vel = (Vector2.One * 2).RotatedByRandom(Math.PI); + Particle sparks = new VelChangingSpark(Projectile.Center, (vel * Main.rand.NextFloat(1f, 2.4f)).RotatedByRandom(0.35f), Vector2.UnitY * -6, "CalamityMod/Particles/BloomRing", Main.rand.Next(28, 32 + 1), Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, new Vector2(1f, 1), true, false, 0, false, 0.065f, 0.13f); + GeneralParticleHandler.SpawnParticle(sparks); + } + } + else + { + SoundStyle sound = new("CalamityMod/Sounds/Custom/BubblyPop"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(0.7f, 0.9f) - Projectile.scale * 0.6f, MaxInstances = 10 }, Projectile.Center); + + float blastSize = 70 + 70 * bubbleLevel; + float minMultiplier = 0.25f; + int hitsToMinMult = 5; + int debuff1 = ModContent.BuffType(); + int debuffTime = 180; + if (Projectile.localAI[0] >= 0 && Main.myPlayer == Projectile.owner) // On kill but exclude small bubbles and bubbled that died in a fuse + { + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[1] = debuffTime; + blast.DamageType = RogueDamageClass.Instance; + + for (int i = 0; i < miniBubbles; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Vector2.One * 1.5f).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.9f, 1.6f) + Vector2.UnitY * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), Projectile.knockBack / 5, Projectile.owner, 0, -1); + + } + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Turquoise, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10, 10), 0.3f * Projectile.scale, 0.65f * Projectile.scale, 20); + GeneralParticleHandler.SpawnParticle(blastRing2); } } + public override bool PreDraw(ref Color lightColor) + { + float sine = (float)Math.Sin(time * Projectile.scale * 0.275f / MathHelper.Pi); + float sizeMult = ((sine + 2) * 0.05f); + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.ai[1] == 1 ? 1 : 0); + + Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 2, 6, 1, 0.7f), Utils.Remap(Projectile.velocity.Length(), 2, 6, 1, 2f)); + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, squash * (Projectile.scale + sizeMult), SpriteEffects.None, 0); + return false; + } + public override bool? CanCutTiles() => false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => canHit ? CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox) : false; } } diff --git a/Projectiles/Rogue/SeafoamBubble.png b/Projectiles/Rogue/SeafoamBubble.png new file mode 100644 index 0000000000..f7b27cd5c1 Binary files /dev/null and b/Projectiles/Rogue/SeafoamBubble.png differ diff --git a/Projectiles/Rogue/SealedSingularityBlackhole.cs b/Projectiles/Rogue/SealedSingularityBlackhole.cs index 2450b07510..2ca31c17bd 100644 --- a/Projectiles/Rogue/SealedSingularityBlackhole.cs +++ b/Projectiles/Rogue/SealedSingularityBlackhole.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; + Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.frame++; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Rogue/SealedSingularityGore.cs b/Projectiles/Rogue/SealedSingularityGore.cs index 4a8db4cc51..77492eb2cc 100644 --- a/Projectiles/Rogue/SealedSingularityGore.cs +++ b/Projectiles/Rogue/SealedSingularityGore.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue texture = ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityGore3").Value; break; default: - texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + texture = Terraria.GameContent.TextureAssets.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); diff --git a/Projectiles/Rogue/SearedPanProjectile.cs b/Projectiles/Rogue/SearedPanProjectile.cs index a7022fce06..11e591ffc0 100644 --- a/Projectiles/Rogue/SearedPanProjectile.cs +++ b/Projectiles/Rogue/SearedPanProjectile.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SeraphimAngelicLight.cs b/Projectiles/Rogue/SeraphimAngelicLight.cs index 3519a18273..e1f1561977 100644 --- a/Projectiles/Rogue/SeraphimAngelicLight.cs +++ b/Projectiles/Rogue/SeraphimAngelicLight.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.scale = CalamityUtils.Convert01To010(Projectile.timeLeft / 10f); Projectile.Opacity = (float)Math.Sqrt(Projectile.scale); Projectile.velocity *= 0.8f; - Projectile.frame = Main.projFrames[Projectile.type] - Projectile.timeLeft; + Projectile.frame = Main.projFrames[Type] - Projectile.timeLeft; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Rogue/SeraphimAngelicLight2.cs b/Projectiles/Rogue/SeraphimAngelicLight2.cs index bae53092ef..3c3d4e443b 100644 --- a/Projectiles/Rogue/SeraphimAngelicLight2.cs +++ b/Projectiles/Rogue/SeraphimAngelicLight2.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Rogue public override string Texture => "CalamityMod/Projectiles/Rogue/SeraphimAngelicLight"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.scale = CalamityUtils.Convert01To010(Projectile.timeLeft / (float)Lifetime); Projectile.Opacity = (float)Math.Sqrt(Projectile.scale); Projectile.velocity *= 0.8f; - Projectile.frame = (int)(Utils.GetLerpValue(Lifetime, 0f, Projectile.timeLeft, true) * Main.projFrames[Projectile.type]); + Projectile.frame = (int)(Utils.GetLerpValue(Lifetime, 0f, Projectile.timeLeft, true) * Main.projFrames[Type]); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Rogue/SeraphimBeamLarge.cs b/Projectiles/Rogue/SeraphimBeamLarge.cs index f0940f0ab8..ad41f9fa89 100644 --- a/Projectiles/Rogue/SeraphimBeamLarge.cs +++ b/Projectiles/Rogue/SeraphimBeamLarge.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue // Determine frames. Projectile.frameCounter++; if (Projectile.frameCounter % 5f == 4f) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } // Rapidly decrease damage every hit @@ -117,9 +117,9 @@ namespace CalamityMod.Projectiles.Rogue return false; Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); // Start texture drawing. Vector2 centerOnLaser = Projectile.Center + Projectile.velocity * Projectile.scale * 116f; diff --git a/Projectiles/Rogue/SeraphimDagger.cs b/Projectiles/Rogue/SeraphimDagger.cs index 3f1ad68265..fc174afd86 100644 --- a/Projectiles/Rogue/SeraphimDagger.cs +++ b/Projectiles/Rogue/SeraphimDagger.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Rogue public const int AimTime = 25; public ref float Time => ref Projectile.ai[0]; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 50; @@ -86,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 2e27bbe5bd..e16685c4a0 100644 --- a/Projectiles/Rogue/SeraphimProjectile.cs +++ b/Projectiles/Rogue/SeraphimProjectile.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 baseDrawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Rogue/ShatteredSunKnife.cs b/Projectiles/Rogue/ShatteredDawnKnife.cs similarity index 95% rename from Projectiles/Rogue/ShatteredSunKnife.cs rename to Projectiles/Rogue/ShatteredDawnKnife.cs index 9a6017b8d5..03e02ca577 100644 --- a/Projectiles/Rogue/ShatteredSunKnife.cs +++ b/Projectiles/Rogue/ShatteredDawnKnife.cs @@ -8,15 +8,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class ShatteredSunKnife : ModProjectile, ILocalizedModType + public class ShatteredDawnKnife : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/ShatteredSun"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ShatteredDawn"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.owner == Main.myPlayer) { int spread = 6; - int projID = ModContent.ProjectileType(); + int projID = ModContent.ProjectileType(); int splitDamage = (int)(0.75f * Projectile.damage); float splitKB = 1f; for (int i = 0; i < numProj; i++) @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredDawnScorchedBlade.cs similarity index 97% rename from Projectiles/Rogue/ShatteredSunScorchedBlade.cs rename to Projectiles/Rogue/ShatteredDawnScorchedBlade.cs index ce556d1071..97e716a7c8 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredDawnScorchedBlade.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class ShatteredSunScorchedBlade : ModProjectile, ILocalizedModType + public class ShatteredDawnScorchedBlade : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; int counter = 0; @@ -17,8 +17,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -144,7 +145,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -229,7 +230,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[dusty].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.png b/Projectiles/Rogue/ShatteredDawnScorchedBlade.png similarity index 100% rename from Projectiles/Rogue/ShatteredSunScorchedBlade.png rename to Projectiles/Rogue/ShatteredDawnScorchedBlade.png diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index 2b457f6bdb..8ce4a2584a 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -1,7 +1,10 @@ using CalamityMod.Balancing; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -14,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -23,9 +26,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 16; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.MaxUpdates = 5; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.MaxUpdates = 5; + Projectile.timeLeft = 60 * Projectile.MaxUpdates; } public override void AI() @@ -35,14 +38,14 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.MagicMirror); - Main.dust[dust].noGravity = true; + Dust trail = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.MagicMirror); + trail.noGravity = true; } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -50,8 +53,8 @@ namespace CalamityMod.Projectiles.Rogue { 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)) + // 8 hits total + if (Projectile.Calamity().stealthStrike && Projectile.ai[1] < 8f && (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); @@ -59,6 +62,13 @@ namespace CalamityMod.Projectiles.Rogue 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; + echo.tileCollide = false; + + Vector2 slashVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + GlowSparkParticle slash = new(Projectile.Center, slashVel, false, 12, 0.06f, Color.DarkBlue, Vector2.One, true, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(slash); + + SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); } if (target.life <= 0 && target.lifeMax > 5) @@ -73,11 +83,11 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { + int dustType = 42; for (int i = 0; i < 5; i++) { - int dustType = 42; - int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X / 2, Projectile.velocity.Y / 2, 0, default, 1.5f); - Main.dust[dust].noGravity = true; + Dust crumble = Dust.NewDustDirect(Projectile.Center, 1, 1, dustType, Projectile.velocity.X / 2, Projectile.velocity.Y / 2, 0, default, 1.5f); + crumble.noGravity = true; } } } diff --git a/Projectiles/Rogue/ShockGrenadeBolt.cs b/Projectiles/Rogue/ShockBolt.cs similarity index 93% rename from Projectiles/Rogue/ShockGrenadeBolt.cs rename to Projectiles/Rogue/ShockBolt.cs index 3d647376a3..741e2daa70 100644 --- a/Projectiles/Rogue/ShockGrenadeBolt.cs +++ b/Projectiles/Rogue/ShockBolt.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class ShockGrenadeBolt : ModProjectile, ILocalizedModType + public class ShockBolt : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; public static int frameWidth = 12; @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -93,9 +93,9 @@ namespace CalamityMod.Projectiles.Rogue { Texture2D sprite; if (Projectile.ai[0] == 0f) - sprite = ModContent.Request("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt").Value; + sprite = ModContent.Request("CalamityMod/Projectiles/Rogue/ShockBolt").Value; else - sprite = ModContent.Request("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt2").Value; + sprite = ModContent.Request("CalamityMod/Projectiles/Rogue/ShockBolt2").Value; Color drawColour = Color.White; Vector2 origin = new Vector2(frameWidth / 2, frameHeight / 2); diff --git a/Projectiles/Rogue/ShockGrenadeBolt.png b/Projectiles/Rogue/ShockBolt.png similarity index 100% rename from Projectiles/Rogue/ShockGrenadeBolt.png rename to Projectiles/Rogue/ShockBolt.png diff --git a/Projectiles/Rogue/ShockGrenadeBolt2.png b/Projectiles/Rogue/ShockBolt2.png similarity index 100% rename from Projectiles/Rogue/ShockGrenadeBolt2.png rename to Projectiles/Rogue/ShockBolt2.png diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.cs b/Projectiles/Rogue/ShockGrenadeExplosion.cs deleted file mode 100644 index 0c39e224ee..0000000000 --- a/Projectiles/Rogue/ShockGrenadeExplosion.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ShockGrenadeExplosion : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - private const float radius = 100f; - - public override void SetDefaults() - { - Projectile.width = 320; - Projectile.height = 320; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = 10; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - if (Projectile.timeLeft >= 8) - { - for (int i = 0; i < 50; i++) - { - int dustType = 132; - if (Main.rand.NextBool()) - { - dustType = 264; - } - - Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - dustVelocity.Normalize(); - dustVelocity *= 8; - - int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 0.75f); - Main.dust[dust].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Electrified, 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Electrified, 180); - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); - } -} diff --git a/Projectiles/Rogue/ShockGrenadeProjectile.cs b/Projectiles/Rogue/ShockGrenadeProjectile.cs deleted file mode 100644 index 16ec5fcfd3..0000000000 --- a/Projectiles/Rogue/ShockGrenadeProjectile.cs +++ /dev/null @@ -1,130 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ShockGrenadeProjectile : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/ShockGrenade"; - - public static int spriteWidth = 14; - public static int spriteHeight = 30; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 180; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - Projectile.velocity.Y += 0.1f; - if (Projectile.velocity.Y >= 16f) - { - Projectile.velocity.Y = 16f; - } - - Projectile.rotation += Projectile.direction * 0.2f; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - - Projectile.localAI[0] = 0; - Projectile.localAI[1] = 0; - - if (Projectile.velocity.X != oldVelocity.X) - { - if (oldVelocity.X < 0) - { - Projectile.localAI[0] = 1; - } - if (oldVelocity.X > 0) - { - Projectile.localAI[0] = -1; - } - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - if (oldVelocity.Y < 0) - { - Projectile.localAI[1] = 1; - } - if (oldVelocity.Y > 0) - { - Projectile.localAI[1] = -1; - } - } - Projectile.Kill(); - return false; - } - - 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 PostDraw(Color lightColor) - { - Vector2 origin = new Vector2(spriteWidth / 2, spriteHeight / 2); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow").Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item94 with { Volume = SoundID.Item94.Volume * 0.75f }, Projectile.position); - - int boltCount = Main.rand.Next(5, 11); - for (int i = 0; i < boltCount; i++) - { - int boltScatter = 1; - Vector2 boltVelocity = new Vector2(Main.rand.NextFloat(-boltScatter, boltScatter), Main.rand.NextFloat(-boltScatter * 2, boltScatter * 2)); - if (Projectile.localAI[0] != 0) - { - boltVelocity.X *= -1; - } - if (Projectile.localAI[1] != 0) - { - boltVelocity.Y *= -1; - } - boltVelocity.X += Projectile.localAI[0]; - boltVelocity.Y += Projectile.localAI[1] * 2; - boltVelocity.Normalize(); - boltVelocity *= 10; - - int boltType = Main.rand.Next(0, 2); - int boltDamage = Projectile.damage / 2; - - int boltAI = 0; - if (Projectile.Calamity().stealthStrike) - { - boltAI = 1; - } - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, boltVelocity, ModContent.ProjectileType(), boltDamage, 0, Projectile.owner, boltType, boltAI); - } - - if (Projectile.Calamity().stealthStrike) - { - int auraDamage = Projectile.damage / 4; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 1, Projectile.owner, 0, 0); - - SoundEngine.PlaySound(SoundID.Item93 with { Volume = SoundID.Item93.Volume * 0.5f }, Projectile.position); - } - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 3, Projectile.owner, 0, 0); - } - } -} diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs index 799665639c..da9583480a 100644 --- a/Projectiles/Rogue/ShockTeslaAura.cs +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D sprite = Terraria.GameContent.TextureAssets.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/SkyfinNuke.cs b/Projectiles/Rogue/SkyfinNuke.cs index bc464c0284..4f3d4c4d3f 100644 --- a/Projectiles/Rogue/SkyfinNuke.cs +++ b/Projectiles/Rogue/SkyfinNuke.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,6 +14,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SkyfinBombers"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 30; @@ -84,6 +86,17 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.Calamity().stealthStrike) { + #region Visuals + //Taken from Contaminated Bile's rework since they use the same projectiles + Particle blast = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkOliveGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.7f, 200, true, 0.7f); + GeneralParticleHandler.SpawnParticle(blast); + Particle blast1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OliveDrab * 0.5f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.02f, 0.05f, 340); + GeneralParticleHandler.SpawnParticle(blast1); + Particle blast2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OliveDrab * 0.5f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.03f, 0.07f, 340); + GeneralParticleHandler.SpawnParticle(blast2); + Particle blast3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkOliveGreen * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.04f, 0.08f, 340); + GeneralParticleHandler.SpawnParticle(blast3); + #endregion 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; diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs index 5e325c56e6..ce965f114c 100644 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ b/Projectiles/Rogue/SlickCaneProjectile.cs @@ -2,12 +2,11 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -22,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue private bool initialized = false; public override void SetDefaults() { - Projectile.width = 42; + Projectile.width = 40; Projectile.height = 36; Projectile.DamageType = RogueDamageClass.Instance; Projectile.timeLeft = 120; @@ -34,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ownerHitCheck = true; Projectile.hide = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 2; + Projectile.localNPCHitCooldown = 5; Projectile.alpha = 180; Projectile.scale = 1.25f; } @@ -55,7 +54,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 : Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Rogue/SlickCaneProjectileAlt").Value : Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 origin = new Vector2(Projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f); Main.EntitySpriteDraw(alternateHookTexture, drawPosition, null, lightColor, Projectile.rotation, @@ -80,14 +79,15 @@ namespace CalamityMod.Projectiles.Rogue 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)) + //Dont drop money from Dummies, WoF eyes and worm segments to make grinding money a bit harder and not give money from Dummies since that was apparently happening + if (Projectile.owner == Main.myPlayer && target.IsAnEnemy(false) && !target.dontCountMe && !NeedsDebuffIconDisplayList.Includes(target.type)) { float moneyValueToDrop = target.value / Main.rand.NextFloat(15f, 35f); // Maximum of 50 silver, not counting steath strikes moneyValueToDrop = (int)MathHelper.Clamp(moneyValueToDrop, 0, 5000f); if (Projectile.Calamity().stealthStrike && Main.rand.NextBool(20)) { - moneyValueToDrop += Item.buyPrice(0, Main.rand.Next(1, 4), Main.rand.Next(0, 100), Main.rand.Next(0, 100)); + moneyValueToDrop += Item.buyPrice(0, Main.rand.Next(1, 3), Main.rand.Next(0, 100), Main.rand.Next(0, 100)); SoundEngine.PlaySound(TheSevensStriker.TriplesSound, Projectile.Center); } else if (moneyValueToDrop > 0f) @@ -142,16 +142,17 @@ namespace CalamityMod.Projectiles.Rogue } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - // Boost dmg in proportion to money, caps at 2 plat + // Boost dmg in proportion to money, caps at 1 plat. Much higher cap in GFB cuz it would be funny if (Projectile.Calamity().stealthStrike) { Player player = Main.player[Projectile.owner]; double money = Utils.CoinsCount(out bool overflow, player.inventory); - if (money >= 2000000) - money = 2000000; + double cap = Main.zenithWorld ? 100000000 : 1000000; + if (money >= cap) + money = cap; if (money != 0) { - modifiers.SourceDamage *= (float)(money / 500000 + 1); + modifiers.SourceDamage *= (float)(money / 1000000 + 1); SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center); for (int j = 0; j < 8; j++) { diff --git a/Projectiles/Rogue/SludgeSplotchProj2.cs b/Projectiles/Rogue/SludgeSplotchProj2.cs index db7798497c..9d8560b6c3 100644 --- a/Projectiles/Rogue/SludgeSplotchProj2.cs +++ b/Projectiles/Rogue/SludgeSplotchProj2.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 f9dfd6d0da..f84567151f 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index 7e8c16117d..a7dd3b8d1c 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Type] = 2; } public override void SetDefaults() diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index cbec922070..3a8948bad7 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -15,21 +15,17 @@ namespace CalamityMod.Projectiles.Rogue public static readonly SoundStyle Hitsound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2") { PitchVariance = 0.3f, Volume = 0.5f }; public int framesInAir = 0; - private bool initialized = false; public int SparkChance = 1; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 2; Projectile.timeLeft = 600; - AIType = 0; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; Projectile.extraUpdates = 2; } @@ -42,15 +38,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y += 0.3f; } - if (!initialized) - { - if (Projectile.Calamity().stealthStrike) - { - Projectile.penetrate++; - Projectile.tileCollide = false; - } - initialized = true; - } if (Projectile.timeLeft % 2 == 0 && Main.rand.NextBool(SparkChance) && Projectile.numHits == 0) { SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 7, 0.7f, Color.PaleGoldenrod * 0.3f); @@ -108,9 +95,9 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Type]; int frameY = frameHeight * Projectile.frame; float scale = Projectile.scale; float rotation = Projectile.rotation; @@ -120,7 +107,5 @@ namespace CalamityMod.Projectiles.Rogue Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), rectangle, Color.White, rotation, origin, scale, SpriteEffects.None, 0); return false; } - - //public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Ichor, 120); } } diff --git a/Projectiles/Rogue/SpearofDestinyStealth.cs b/Projectiles/Rogue/SpearofDestinyStealth.cs index 9e68d646a7..d117d5262e 100644 --- a/Projectiles/Rogue/SpearofDestinyStealth.cs +++ b/Projectiles/Rogue/SpearofDestinyStealth.cs @@ -87,9 +87,9 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Type]; int frameY = frameHeight * Projectile.frame; float scale = Projectile.scale; float rotation = Projectile.rotation; diff --git a/Projectiles/Rogue/SpearofPaleolithProj.cs b/Projectiles/Rogue/SpearofPaleolithProj.cs index d8ba7f1c6a..1ddf1453bf 100644 --- a/Projectiles/Rogue/SpearofPaleolithProj.cs +++ b/Projectiles/Rogue/SpearofPaleolithProj.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/SphereBladed.cs b/Projectiles/Rogue/SphereBladed.cs index ba66d6bdc2..41f5c87f10 100644 --- a/Projectiles/Rogue/SphereBladed.cs +++ b/Projectiles/Rogue/SphereBladed.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereBlue.cs b/Projectiles/Rogue/SphereBlue.cs index ebc771fa14..4a9aeb4033 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -10,8 +10,9 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.damage /= 2; Projectile.Damage(); SoundEngine.PlaySound(SoundID.NPCDeath37, Projectile.position); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { @@ -91,7 +92,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereSpiked.cs b/Projectiles/Rogue/SphereSpiked.cs index 443ccef165..7d2c53512d 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereYellow.cs b/Projectiles/Rogue/SphereYellow.cs index 77c6e434de..cfa9694d3b 100644 --- a/Projectiles/Rogue/SphereYellow.cs +++ b/Projectiles/Rogue/SphereYellow.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SporeKnifeBud.cs b/Projectiles/Rogue/SporeKnifeBud.cs new file mode 100644 index 0000000000..19bf3b86cd --- /dev/null +++ b/Projectiles/Rogue/SporeKnifeBud.cs @@ -0,0 +1,96 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.GameContent.Animations.Actions.Sprites; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SporeKnifeBud : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/Summon/PlantationStaffTentacle"; + + public bool Sticky = false; + public static int Lifetime = 300; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + Main.projFrames[Type] = 4; + } + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 50; + Projectile.timeLeft = Lifetime; + } + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft <= 285 && target.CanBeChasedBy(Projectile); + + public override void AI() + { + //Animation + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Type]) + Projectile.frame = 0; + //Rotation + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + if (!Sticky && Projectile.timeLeft <= Lifetime - 15) + { + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 6.5f, 20f); + int dust = Dust.NewDust(Projectile.position - new Vector2(10, 10), 30, 30, DustID.JungleTorch, Projectile.velocity.X, Projectile.velocity.Y, 50, default, Main.rand.NextFloat(0.3f, 0.7f)); + Main.dust[dust].noGravity = true; + } + else if (Sticky) + { + Projectile.StickyProjAI(15); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Sticky = true; + target.AddBuff(BuffID.Poisoned, 60); + for (int i = 0; i < 3; i++) + { + Vector2 smokeVel = Main.rand.NextVector2Unit() * Main.rand.NextVector2Circular(6f, 6f); + Color smokeColor = Main.rand.NextBool(2) ? Color.GreenYellow : Color.Green; + Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.2f, 0.4f), 250 - Main.rand.Next(60), 0.08f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int k = 0; k < 2; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.MagicMirror, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 0.8f), 0, Color.YellowGreen, Main.rand.NextFloat(0.4f, 0.9f)); + dust.noGravity = false; + dust.alpha = Main.rand.Next(20, 30 + 1); + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Projectile.ModifyHitNPCSticky(6); + } + + public override void OnKill(int timeLeft) + { + for (int d = 0; d < 7; ++d) + { + int idx = Dust.NewDust(Projectile.Center - Vector2.One * 4f, 25, 25, DustID.MagicMirror, 0f, -2f, 0, Color.YellowGreen, 0.4f); + Dust dust = Main.dust[idx]; + dust.velocity /= 2f; + } + } + } +} diff --git a/Projectiles/Rogue/SporeKnifeProj.cs b/Projectiles/Rogue/SporeKnifeProj.cs new file mode 100644 index 0000000000..55298d704f --- /dev/null +++ b/Projectiles/Rogue/SporeKnifeProj.cs @@ -0,0 +1,110 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Ammo; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +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.Rogue +{ + public class SporeKnifeProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SporeKnife"; + public static int spinTime = 270; + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; + Projectile.timeLeft = 300; + AIType = ProjectileID.ThrowingKnife; + Projectile.DamageType = RogueDamageClass.Instance; + } + + public override void AI() + { + float minScale = 0.5f; + float maxScale = 0.8f; + int dust = Dust.NewDust(Projectile.position - new Vector2(10, 10), 30, 30, DustID.JungleSpore, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Main.dust[dust].noGravity = true; + if (Projectile.timeLeft < spinTime) + { + Projectile.rotation += 0.4f * Projectile.direction; + } + else + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.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.AddBuff(BuffID.Poisoned, 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Poisoned, 120); + public override void OnKill(int timeLeft) + { + #region Visuals and Sound + SoundEngine.PlaySound(SoundID.Grass with { Pitch = -0.5f, PitchVariance = 0.4f }, Projectile.Center); + + for (int i = 0; i < 18; i++) + { + Vector2 smokeVel = Main.rand.NextVector2Unit() * Main.rand.NextVector2Circular(20f, 20f); + Color smokeColor = Main.rand.NextBool() ? Color.DarkOliveGreen : Color.ForestGreen; + Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.9f, 1.6f), 200 - Main.rand.Next(60), 0.08f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int k = 0; k < 11; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.JungleSpore, new Vector2(6, 6).RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(4f, 9f), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = false; + dust.alpha = Main.rand.Next(100, 120 + 1); + } + for (int k = 0; k < 11; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.MagicMirror, new Vector2(6, 6).RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.5f, 0.8f), 0, Color.GreenYellow, Main.rand.NextFloat(0.6f, 0.8f)); + dust.noGravity = false; + dust.alpha = Main.rand.Next(100, 120 + 1); + } + //Explosion effect + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.ForestGreen * 0.8f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.04f, 0.09f, 20, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Green * 0.8f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.04f, 0.07f, 20, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + #endregion + //On hit, expand the hitbox and hit again for 30% of the projectile's damage + if (Projectile.owner == Main.myPlayer) + { + Projectile.damage = (int)(Projectile.damage * 0.3f); + Projectile.penetrate = -1; + Projectile.ExpandHitboxBy(120); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + } + if (!Projectile.Calamity().stealthStrike) + return; + else + { + for (int k = 0; k < 3; k++) + { + float baseDirectionRotation = Main.rand.NextFloat(MathHelper.TwoPi); + Vector2 shootVelocity = (MathHelper.TwoPi * k / 15 + baseDirectionRotation).ToRotationVector2() * 9f; + int bud = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0f, Projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Rogue/StealthNimbus.cs b/Projectiles/Rogue/StealthNimbus.cs index 7a5cfc0e3e..dcc429b897 100644 --- a/Projectiles/Rogue/StealthNimbus.cs +++ b/Projectiles/Rogue/StealthNimbus.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -26,10 +26,10 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Projectile.ai[0] == 1f) texture = ModContent.Request("CalamityMod/Projectiles/Rogue/StealthNimbus2").Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Rogue/StealthNimbusCloud.cs b/Projectiles/Rogue/StealthNimbusCloud.cs index d1e3eab024..3f6c3d1f6e 100644 --- a/Projectiles/Rogue/StealthNimbusCloud.cs +++ b/Projectiles/Rogue/StealthNimbusCloud.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -26,10 +26,10 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Projectile.ai[0] == 1f) texture = ModContent.Request("CalamityMod/Projectiles/Rogue/StealthNimbusCloud2").Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Rogue/StellarKnifeProj.cs b/Projectiles/Rogue/StellarKnifeProj.cs index 1b90218b98..6b1d717b9b 100644 --- a/Projectiles/Rogue/StellarKnifeProj.cs +++ b/Projectiles/Rogue/StellarKnifeProj.cs @@ -15,8 +15,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -109,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/StickyBol.cs b/Projectiles/Rogue/StickyBol.cs deleted file mode 100644 index bfa90c3367..0000000000 --- a/Projectiles/Rogue/StickyBol.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class StickyBol : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/StickySpikyBall"; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 5; - Projectile.timeLeft = 300; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 60; - } - - public override void AI() - { - 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, DustID.TintableDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 175, color, 1.2f); - } - //Sticky Behaviour - Projectile.StickyProjAI(10); - if (Projectile.ai[0] != 1f) - { - Projectile.StickToTiles(true, false); - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] > 10f) - { - Projectile.localAI[1] = 10f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y += 0.2f; - } - Projectile.rotation += Projectile.velocity.X * 0.1f; - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(5); - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Slimed, 120); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Slimed, 120); - } -} diff --git a/Projectiles/Rogue/StormfrontLightning.cs b/Projectiles/Rogue/StormfrontLightning.cs index 00b1816ea2..bab525c68b 100644 --- a/Projectiles/Rogue/StormfrontLightning.cs +++ b/Projectiles/Rogue/StormfrontLightning.cs @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 50; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 50; } public override void SetDefaults() diff --git a/Projectiles/Rogue/StormfrontRazorProjectile.cs b/Projectiles/Rogue/StormfrontRazorProjectile.cs index 3a9dc47f28..625317777c 100644 --- a/Projectiles/Rogue/StormfrontRazorProjectile.cs +++ b/Projectiles/Rogue/StormfrontRazorProjectile.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SubductionFlameburst.cs b/Projectiles/Rogue/SubductionFlameburst.cs index bbcb328bf8..9ba236808d 100644 --- a/Projectiles/Rogue/SubductionFlameburst.cs +++ b/Projectiles/Rogue/SubductionFlameburst.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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; diff --git a/Projectiles/Rogue/SubductionSlicerProj.cs b/Projectiles/Rogue/SubductionSlicerProj.cs index e1a0b88425..429d657d1b 100644 --- a/Projectiles/Rogue/SubductionSlicerProj.cs +++ b/Projectiles/Rogue/SubductionSlicerProj.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(5)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 127, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); Vector2 goreVec = new Vector2(Projectile.position.X + Projectile.width / 2 + Projectile.velocity.X, Projectile.position.Y + Projectile.height / 2 + Projectile.velocity.Y); - if (Main.rand.NextBool(8) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(8) && !Main.dedServ) { int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), goreVec, default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index 8798841e8b..fdfb0aea35 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -26,8 +26,9 @@ namespace CalamityMod.Projectiles.Rogue public bool returning = false; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -307,7 +308,7 @@ namespace CalamityMod.Projectiles.Rogue } if (!homing) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(Color.White, randomColor, 0.3f), 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Lerp(Color.White, randomColor, 0.3f), 1); return true; } } diff --git a/Projectiles/Rogue/SupernovaBoom.cs b/Projectiles/Rogue/SupernovaBoom.cs index a2616f9c96..c2e12a9887 100644 --- a/Projectiles/Rogue/SupernovaBoom.cs +++ b/Projectiles/Rogue/SupernovaBoom.cs @@ -170,7 +170,7 @@ namespace CalamityMod.Projectiles.Rogue } } - if (currentFrame < 13) + if (currentFrame < 13) // suck in enemies, or you if it's GFB { if (Main.zenithWorld) { @@ -183,7 +183,10 @@ namespace CalamityMod.Projectiles.Rogue if (target.CanBeMoved(true) && 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; + target.SyncMotionToServer(); + } } else if (target != null && CalamityPlayer.areThereAnyDamnBosses) { @@ -214,7 +217,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; int length = texture.Width / horizontalFrames; int height = texture.Height / verticalFrames; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); @@ -226,11 +229,9 @@ namespace CalamityMod.Projectiles.Rogue 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); - } + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); + target.MoveNPC(launchVel, 30, true); + target.AddBuff(ModContent.BuffType(), 90); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Rogue/SupernovaStealthBoom.cs b/Projectiles/Rogue/SupernovaStealthBoom.cs index 07b456c0f6..d2f46b2302 100644 --- a/Projectiles/Rogue/SupernovaStealthBoom.cs +++ b/Projectiles/Rogue/SupernovaStealthBoom.cs @@ -74,16 +74,21 @@ namespace CalamityMod.Projectiles.Rogue } mainColor = Color.Lerp(mainColor, variedColor, 0.07f); - Lighting.AddLight(Projectile.Center, mainColor.ToVector3() * 4); + // Golly gee willikers I sure wonder why Supernova stealth needs the Photosensitivity config + bool photosen = CalamityClientConfig.Instance.Photosensitivity; + 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); + if (!photosen) + { + 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; @@ -163,144 +168,66 @@ namespace CalamityMod.Projectiles.Rogue 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++) + if (!photosen) { - randomColor = Main.rand.Next(4) switch - { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, - }; + 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); + } - 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); + Vector2 BurstFXDirectionX = Vector2.UnitX * 5f; + Vector2 BurstFXDirectionY = Vector2.UnitY * 5f; + + if (!photosen) + { + for (int i = 0; i < 8; i++) + { + randomColor = RandomizeColor(); + GlowSparkParticle spark = new GlowSparkParticle(Projectile.Center, BurstFXDirectionX * (i + 1f), false, 12, (0.09f + i * 0.02f) * 1.5f, randomColor, new Vector2(2.7f, 1.3f), true); + GeneralParticleHandler.SpawnParticle(spark); + + randomColor = RandomizeColor(); + GlowSparkParticle sparkOpp = new GlowSparkParticle(Projectile.Center, (-BurstFXDirectionX) * (i + 1f), false, 12, (0.09f + i * 0.02f) * 1.5f, randomColor, new Vector2(2.7f, 1.3f), true); + GeneralParticleHandler.SpawnParticle(sparkOpp); + + randomColor = RandomizeColor(); + GlowSparkParticle sparkBurst = new GlowSparkParticle(Projectile.Center, BurstFXDirectionY * (i + 1f), false, 12, (0.09f + i * 0.02f) * 1.5f, randomColor, new Vector2(2.7f, 1.3f), true); + GeneralParticleHandler.SpawnParticle(sparkBurst); + + randomColor = RandomizeColor(); + GlowSparkParticle sparkBurstOpp = new GlowSparkParticle(Projectile.Center, (-BurstFXDirectionY) * (i + 1f), false, 12, (0.09f + i * 0.02f) * 1.5f, randomColor, new Vector2(2.7f, 1.3f), true); + GeneralParticleHandler.SpawnParticle(sparkBurstOpp); + } } 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)); + randomColor = RandomizeColor(); + GlowSparkParticle spark2 = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), BurstFXDirectionX * 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, - }; + randomColor = RandomizeColor(); + GlowSparkParticle spark2Opp = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), -BurstFXDirectionX * 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(spark2Opp); - 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, - }; + randomColor = RandomizeColor(); + GlowSparkParticle spark2Burst = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), BurstFXDirectionY * 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(spark2Burst); - 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); + randomColor = RandomizeColor(); + GlowSparkParticle spark2BurstOpp = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), -BurstFXDirectionY * 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(spark2BurstOpp); } for (int i = 0; i < 10; i++) { - randomColor = Main.rand.Next(4) switch - { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, - }; - + randomColor = RandomizeColor(); 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) + if (time < 80) // Suck in enemies { for (int i = 0; i < Main.maxNPCs; i++) { @@ -311,6 +238,7 @@ namespace CalamityMod.Projectiles.Rogue { 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; + target.SyncMotionToServer(); } } } @@ -323,9 +251,9 @@ namespace CalamityMod.Projectiles.Rogue } } - public Color RandomizeColor(Color randomColor) + public Color RandomizeColor() { - randomColor = Main.rand.Next(4) switch + Color randomColor = Main.rand.Next(4) switch { 0 => Color.Red, 1 => Color.MediumTurquoise, @@ -333,6 +261,8 @@ namespace CalamityMod.Projectiles.Rogue _ => Color.LawnGreen, }; + if (CalamityClientConfig.Instance.Photosensitivity) + randomColor *= 0.5f; return randomColor; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); @@ -364,11 +294,8 @@ namespace CalamityMod.Projectiles.Rogue 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); - } + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); + target.MoveNPC(launchVel, 60, true); } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) // Add to regular plz diff --git a/Projectiles/Rogue/TalonLargeProj.cs b/Projectiles/Rogue/TalonLargeProj.cs index f5ed435467..6b33174415 100644 --- a/Projectiles/Rogue/TalonLargeProj.cs +++ b/Projectiles/Rogue/TalonLargeProj.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +9,11 @@ namespace CalamityMod.Projectiles.Rogue public class TalonLargeProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + private NPC hitTarget = null; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -20,13 +22,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 5; + Projectile.penetrate = 2; Projectile.tileCollide = false; Projectile.timeLeft = 180; Projectile.DamageType = RogueDamageClass.Instance; Projectile.MaxUpdates = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 30 total + Projectile.localNPCHitCooldown = -1; } public override void AI() @@ -39,26 +41,85 @@ namespace CalamityMod.Projectiles.Rogue { 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) + + // Fade out after hitting + // After completely fading, spawn an extra slash if you haven't hit the limit + if (Projectile.numHits > 0) { - Projectile.tileCollide = true; + Projectile.alpha += 12; + if (Projectile.alpha >= 255) + { + // Exit early if we've hit the limit of 5 slashes + if (Projectile.ai[1] >= 4f) + { + Projectile.Kill(); + return; + } + + // Target index is originally the index of the NPC that was hit, but if this becomes invalid, find a new NPC to target + int index = hitTarget.whoAmI; + if (!hitTarget.CanBeChasedBy(Projectile)) + { + float checkDist = 1000f; + index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile, false)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < checkDist) + { + checkDist = currentNPCDist; + index = n.whoAmI; + } + } + } + // Spawn the extra slash + if (index != -1) + { + Vector2 spawnOffset = Main.npc[index].Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 8f).RotatedBy(Main.rand.NextBool() ? MathHelper.Pi : 0) * Main.rand.NextFloat(140f, 180f); + Vector2 spawnVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnOffset, Main.npc[index], 12f, 3); + + if (Main.myPlayer == Projectile.owner) + { + Projectile extraSlash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnOffset, spawnVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1] + 1); + extraSlash.Calamity().stealthStrike = true; + extraSlash.tileCollide = false; + (extraSlash.ModProjectile as TalonLargeProj).hitTarget = hitTarget; + } + + PointParticle point = new(spawnOffset, Vector2.Normalize(spawnVel), false, 6, 2.25f, Color.Cyan); + GeneralParticleHandler.SpawnParticle(point); + } + Projectile.Kill(); + } } + + Projectile.ai[0]++; + Projectile.tileCollide = Projectile.ai[1] == 0f && Projectile.ai[0] > 2f; Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } - public override void OnKill(int timeLeft) + public override bool? CanDamage() { - for (int i = 0; i <= 10; i++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } + if (Projectile.numHits > 0) + return false; + if (hitTarget == null || Projectile.getRect().Intersects(hitTarget.getRect())) + return null; + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + hitTarget = target; + Projectile.tileCollide = false; } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1); return false; } } diff --git a/Projectiles/Rogue/TalonSmallProj.cs b/Projectiles/Rogue/TalonSmallProj.cs index da51fad4f5..017bdfe455 100644 --- a/Projectiles/Rogue/TalonSmallProj.cs +++ b/Projectiles/Rogue/TalonSmallProj.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,24 +10,17 @@ namespace CalamityMod.Projectiles.Rogue public class TalonSmallProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - private static float SineFrequency = 0.05f; - private static float SineAmplitude = 0.008f; - private static float RotationIncrement = 0.26f; public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; - - SineFrequency = 0.15f; - SineAmplitude = 0.06f; - RotationIncrement = 0.26f; } public override void AI() @@ -42,45 +36,41 @@ namespace CalamityMod.Projectiles.Rogue // Doesn't collide with tiles for the first 2 frames Projectile.tileCollide = Projectile.ai[0] > 2f; - // Apply fancy sine movement, then slight gravity, then cap velocity. - // Original velocity is reconstructed so that it can be used in the calculation + // Apply fancy sine movement. Original velocity is reconstructed so that it can be used in the calculation. Vector2 originalVelocity = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); ApplySineVelocity(originalVelocity); - // projectile.velocity.Y += 0.08f; - float currentSpeed = Projectile.velocity.Length(); - float maxSpeed = 1.4f * originalVelocity.Length(); - if (currentSpeed > maxSpeed) - Projectile.velocity *= maxSpeed / currentSpeed; // spawn dust if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + int dustType = Main.rand.NextBool() ? DustID.Chlorophyte : DustID.UnusedBrown; + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, Scale: 0.9f); } // freely spins instead of facing forwards - Projectile.rotation += RotationIncrement; + Projectile.rotation += 0.26f; Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.ai[0]++; } private void ApplySineVelocity(Vector2 baseVelocity) { - float radians = Projectile.ai[1] * (-MathHelper.PiOver2 + SineFrequency * Projectile.ai[0]); - Projectile.velocity += SineAmplitude * baseVelocity.RotatedBy(radians); + float radians = Projectile.ai[1] * (float)Math.Sin(-MathHelper.PiOver2 + 0.25f * Projectile.ai[0]); + Projectile.velocity = baseVelocity.RotatedBy(radians); } public override void OnKill(int timeLeft) { - for (int i = 0; i <= 5; i++) + for (int i = 0; i < 4; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + int dustType = Main.rand.NextBool() ? DustID.Chlorophyte : DustID.UnusedBrown; + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 7560dbac9e..32413a97ee 100644 --- a/Projectiles/Rogue/TarraThornRight.cs +++ b/Projectiles/Rogue/TarraThornRight.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Rogue // Draw the tip for the final thorn public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 3989f2219e..9741c76fb2 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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; } @@ -51,19 +51,10 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.Calamity().stealthStrike) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - - int projID = ModContent.ProjectileType(); - int splitDamage = (int)(Projectile.damage * 0.25f); - float splitKB = 1f; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - double 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) * 2f, (float)(Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f) * 2f, (float)(-Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 10f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack * 0.25f, Projectile.owner); } } } diff --git a/Projectiles/Rogue/TheAtomSplitterDuplicate.cs b/Projectiles/Rogue/TheAtomSplitterDuplicate.cs index b6c6d20e63..a4af127001 100644 --- a/Projectiles/Rogue/TheAtomSplitterDuplicate.cs +++ b/Projectiles/Rogue/TheAtomSplitterDuplicate.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public ref float Lifetime => ref Projectile.ai[1]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 16; + Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 900; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue Color drawColor = CalamityUtils.MulticolorLerp((Time / 35f + Projectile.identity / 4f) % 1f, CalamityUtils.ExoPalette); drawColor.A = 0; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], drawColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], drawColor); return false; } } diff --git a/Projectiles/Rogue/TheAtomSplitterProjectile.cs b/Projectiles/Rogue/TheAtomSplitterProjectile.cs index d96fee817c..c2278e7890 100644 --- a/Projectiles/Rogue/TheAtomSplitterProjectile.cs +++ b/Projectiles/Rogue/TheAtomSplitterProjectile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.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. public static float NormalSplitMultiplier = 0.7f; - public static float StealthSplitMultiplier = 0.23f; + public static float StealthSplitMultiplier = 0.3f; public ref float HitTargetIndex => ref Projectile.ai[0]; public ref float Time => ref Projectile.ai[1]; @@ -124,7 +124,8 @@ namespace CalamityMod.Projectiles.Rogue spawnPosition.X += Main.rand.NextFloatDirection() * target.width * 0.45f; int damage = (int)(Projectile.damage * StealthSplitMultiplier); Vector2 shootVelocity = Vector2.UnitY * (target.Center.Y - spawnPosition.Y > 0f).ToDirectionInt() * Main.rand.NextFloat(14f, 16.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 24f); + int extra = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 24f); + Main.projectile[extra].extraUpdates = 2; } public void ReleaseHitDust(Vector2 spawnPosition) @@ -174,7 +175,7 @@ namespace CalamityMod.Projectiles.Rogue if (!Main.npc.IndexInRange((int)HitTargetIndex)) { HitTargetIndex = target.whoAmI; - Projectile.timeLeft = Projectile.Calamity().stealthStrike ? 100 : 60; + Projectile.timeLeft = 60; Projectile.netUpdate = true; } } diff --git a/Projectiles/Rogue/TheSyringeCinder.cs b/Projectiles/Rogue/TheSyringeCinder.cs index 7a16399617..fcd99f75ce 100644 --- a/Projectiles/Rogue/TheSyringeCinder.cs +++ b/Projectiles/Rogue/TheSyringeCinder.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Rogue/TheSyringeProj.cs b/Projectiles/Rogue/TheSyringeProj.cs index 583442bdf8..21301511b7 100644 --- a/Projectiles/Rogue/TheSyringeProj.cs +++ b/Projectiles/Rogue/TheSyringeProj.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/TheSyringeS1.cs b/Projectiles/Rogue/TheSyringeS1.cs index 1835c30d57..66832fedd0 100644 --- a/Projectiles/Rogue/TheSyringeS1.cs +++ b/Projectiles/Rogue/TheSyringeS1.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Rogue/TimeBoltKnife.cs b/Projectiles/Rogue/TimeBoltKnife.cs index 0372da7e39..b9a74852d3 100644 --- a/Projectiles/Rogue/TimeBoltKnife.cs +++ b/Projectiles/Rogue/TimeBoltKnife.cs @@ -19,8 +19,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -224,7 +225,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/TitaniumClone.cs b/Projectiles/Rogue/TitaniumClone.cs index 5d83d1bd1d..220362b204 100644 --- a/Projectiles/Rogue/TitaniumClone.cs +++ b/Projectiles/Rogue/TitaniumClone.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Rogue private static float RotationIncrement = 0.22f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ai[0] += 1f; if (Projectile.ai[0] > 30f) { - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, true, 320f, 12f, 20f); } } @@ -43,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index 286c01ae26..de17c8d7e8 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -52,6 +52,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ai[0] = 1f; Projectile.ai[1] = 0f; Projectile.netUpdate = true; + Projectile.ResetLocalNPCHitImmunity(); // Stealth uses -1 local and resets it when returning to guarantee it can hit again on the way back } } else @@ -103,8 +104,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.myPlayer == Projectile.owner) if (Projectile.Hitbox.Intersects(owner.Hitbox)) { - Projectile.Kill(); //boomerangs return to you so you get a refund - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); + Projectile.Kill(); } } @@ -133,10 +133,10 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Projectile.Calamity().stealthStrike) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); } else { @@ -145,32 +145,16 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => SpawnStealthClones(); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => SpawnStealthClones(); + private void SpawnStealthClones() { - if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike && Projectile.numHits < 3) + if (Projectile.Calamity().stealthStrike && Projectile.numHits < 3) { - for (int index2 = 0; index2 < 4; index2++) + for (int i = 0; i < 4; i++) { - float xVector = (float)Main.rand.Next(-35, 36) * 0.02f; - float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; - xVector *= 10f; - yVector *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike && Projectile.numHits < 3) - { - for (int index2 = 0; index2 < 4; index2++) - { - float xVector = (float)Main.rand.Next(-35, 36) * 0.02f; - float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; - xVector *= 10f; - yVector *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 randSpeed = Main.rand.NextVector2CircularEdge(6.5f, 6.5f) * Main.rand.NextFloat(0.4f, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index 13742c844d..dda87de504 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/TotalMeltdown.cs b/Projectiles/Rogue/TotalMeltdown.cs index 1b824a2e4e..48e2eb7e92 100644 --- a/Projectiles/Rogue/TotalMeltdown.cs +++ b/Projectiles/Rogue/TotalMeltdown.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 13; + Main.projFrames[Type] = 13; } public override void SetDefaults() @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = -1; - Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.timeLeft = Main.projFrames[Type] * 5; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 30; } diff --git a/Projectiles/Rogue/TotalityFire.cs b/Projectiles/Rogue/TotalityFire.cs index 3202ed7114..9ecf91af5a 100644 --- a/Projectiles/Rogue/TotalityFire.cs +++ b/Projectiles/Rogue/TotalityFire.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue if (!initialized) { initialized = true; - Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); } Projectile.frameCounter++; if (Projectile.frameCounter > 6) @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ToxicantTwisterDust.cs b/Projectiles/Rogue/ToxicantTwisterDust.cs index e7c66ff3e9..e45b387d1d 100644 --- a/Projectiles/Rogue/ToxicantTwisterDust.cs +++ b/Projectiles/Rogue/ToxicantTwisterDust.cs @@ -1,7 +1,14 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Rogue { @@ -9,29 +16,69 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public NPC targetedNPC; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 6; Projectile.height = 6; Projectile.friendly = true; - Projectile.tileCollide = true; + Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.penetrate = 1; + Projectile.MaxUpdates = 4; Projectile.timeLeft = 180; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.noEnchantmentVisuals = true; } public override void AI() { - 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; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.ai[1] % 2 == 0 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 5, 0.04f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.65f, new Vector2(1, 0.3f), true, false, 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + + Projectile.rotation += 0.2f; + + targetedNPC = (Projectile.ai[1] > 90) ? Projectile.Center.ClosestNPCAt(1200) : null; + float moveSpeed = Utils.GetLerpValue(200, 0, Projectile.timeLeft) * 0.5f; + if (targetedNPC == null) + { + Vector2 position = (Owner.ClampedMouseWorld() + ((new Vector2(0, -250).RotatedBy(Projectile.rotation * 0.2f)).RotatedBy(MathHelper.ToRadians(90f) * Projectile.ai[2]))); + Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 8) + Projectile.velocity += moveToMouse * (0.7f); + else + Projectile.velocity *= 0.9f; + } + else + { + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, moveSpeed, 13, 0.98f); + if (Projectile.ai[1] % 2 == 0) + Projectile.timeLeft++; // Lasts longer if it has a target + } + if (targetedNPC != null && targetedNPC.life <= 0) + targetedNPC = null; + + Projectile.ai[1]++; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override bool? CanHitNPC(NPC target) => target == targetedNPC ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 40, targetHitbox); + public override void OnKill(int timeLeft) { - target.AddBuff(ModContent.BuffType(), 120); + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + dust.noGravity = true; + } } } } diff --git a/Projectiles/Rogue/ToxicantTwisterProj.cs b/Projectiles/Rogue/ToxicantTwisterProj.cs new file mode 100644 index 0000000000..8099348e8e --- /dev/null +++ b/Projectiles/Rogue/ToxicantTwisterProj.cs @@ -0,0 +1,147 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ToxicantTwisterProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ToxicantTwister"; + + public float circleRange = -150; + public float circleSpeed = 1; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 42; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 300; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60 * Projectile.MaxUpdates; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + + if (Owner.dead || !Owner.active) + { + Projectile.Kill(); + return; + } + + if (Projectile.Calamity().stealthStrike) + { + Projectile.MaxUpdates = 3; + if (Projectile.ai[1] == 0) + { + Projectile.timeLeft = 600; + circleRange *= 5; + circleSpeed *= 3; + } + if (Projectile.timeLeft % 50 == 0) + { + Projectile dustProjectile = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.1f) * -0.6f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33f), 0f, Projectile.owner, 0, 0, Projectile.ai[2]); + dustProjectile.timeLeft = 240; + } + } + else if (Projectile.ai[1] == 0) + Projectile.timeLeft = (int)(Projectile.timeLeft * Main.rand.NextFloat(1.05f, 1.2f)); + + if (Main.rand.NextBool(4) && Projectile.ai[1] > 7) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(13, 13), Main.rand.NextBool(3) ? 215 : (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f) * Utils.GetLerpValue(255, 0, Projectile.alpha); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); + } + + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.ai[1] % 2 == 0 && Projectile.ai[1] > 7 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 6, 0.07f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.65f, new Vector2(1, 0.3f), true, false, 1); + GeneralParticleHandler.SpawnParticle(spark); + } + + // Boomerang rotation + Projectile.rotation += 0.5f / circleSpeed; + + if (Projectile.ai[1] > 20f) + { + Vector2 position = (Owner.ClampedMouseWorld() + ((new Vector2(0, circleRange).RotatedBy(Projectile.rotation * 0.2f)).RotatedBy(MathHelper.ToRadians(90f) * Projectile.ai[2]))); + Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 18) + Projectile.velocity += moveToMouse * circleSpeed; + else + Projectile.velocity *= 0.9f; + } + else + { + Projectile.velocity *= 0.985f; + } + Projectile.ai[1]++; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 215 : (int)CalamityDusts.SulphurousSeaAcid, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + dust.noGravity = true; + } + for (int i = 0; i < 5; i++) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4, 8); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + dustVel, 278, dustVel * 0.7f); + dust2.scale = Main.rand.NextFloat(0.8f, 0.9f); + dust2.noGravity = false; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Chartreuse : Color.Green, 0.7f); + } + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.07f, 8); + GeneralParticleHandler.SpawnParticle(pulse); + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = Main.rand.NextFloat(-0.2f, 0.2f), MaxInstances = 4 }, Projectile.Center); + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request(Texture); + + for (int i = 0; i < 3; i++) + { + Color auraColor = Color.Lerp(Color.Chartreuse, Color.Lime, Utils.GetLerpValue(0, 3, i)) * 0.7f; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 27f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 15f) * 0.5f + 1f); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor with { A = 0 } * Utils.GetLerpValue(255, 0, Projectile.alpha), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.3f, 2); + return true; + } + + 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) + { + if (target.Calamity().unbreakableDR) + modifiers.SourceDamage *= MathHelper.Clamp((float)Math.Pow(0.9f, Projectile.numHits - 1), 0.1f, 1f); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 55, targetHitbox); + } +} diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs deleted file mode 100644 index 66788be39e..0000000000 --- a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs +++ /dev/null @@ -1,151 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ToxicantTwisterTwoPointZero : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/ToxicantTwister"; - - private int lifeTime = 300; - private int targetIndex = -1; - - public override void SetDefaults() - { - Projectile.width = 42; - Projectile.height = 46; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.timeLeft = lifeTime; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; - } - - public override void AI() - { - if (Projectile.Calamity().stealthStrike) - { - if (Projectile.timeLeft % 20 == 0 && Main.myPlayer == Projectile.owner) - { - for (int i = 0; i < 2; i++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.1f) * -0.6f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner); - } - Projectile.rotation += 0.06f * (Projectile.velocity.X > 0).ToDirectionInt(); - } - // Boomerang rotation - Projectile.rotation += 0.4f * Projectile.direction; - - // Boomerang sound - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); - } - - Projectile.ai[1]++; - if (Projectile.ai[0] != 0f) - { - float returnSpeed = 30f; - float acceleration = 1.4f; - - Player owner = Main.player[Projectile.owner]; - - // Delete the projectile if it's excessively far away. - Vector2 projVector = owner.Center - Projectile.Center; - float dist = projVector.Length(); - if (dist > 3000f) - Projectile.Kill(); - - dist = returnSpeed / dist; - projVector.X *= dist; - projVector.Y *= dist; - - // Home back in on the player. - if (Projectile.velocity.X < projVector.X) - { - Projectile.velocity.X += acceleration; - if (Projectile.velocity.X < 0f && projVector.X > 0f) - Projectile.velocity.X += acceleration; - } - else if (Projectile.velocity.X > projVector.X) - { - Projectile.velocity.X -= acceleration; - if (Projectile.velocity.X > 0f && projVector.X < 0f) - Projectile.velocity.X -= acceleration; - } - if (Projectile.velocity.Y < projVector.Y) - { - Projectile.velocity.Y += acceleration; - if (Projectile.velocity.Y < 0f && projVector.Y > 0f) - Projectile.velocity.Y += acceleration; - } - else if (Projectile.velocity.Y > projVector.Y) - { - Projectile.velocity.Y -= acceleration; - if (Projectile.velocity.Y > 0f && projVector.Y < 0f) - Projectile.velocity.Y -= acceleration; - } - - // Delete the projectile if it touches its owner. - if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(owner.Hitbox)) - Projectile.Kill(); - } - else if (Projectile.ai[1] > 40f) - { - NPC closestTarget = Projectile.Center.ClosestNPCAt(1769f, true, true); - if (closestTarget != null) - { - Projectile.extraUpdates = 1; - targetIndex = closestTarget.whoAmI; - float inertia = 20f; - float homingVelocity = Projectile.Calamity().stealthStrike ? 30f : 20f; - Vector2 moveDirection = Projectile.SafeDirectionTo(closestTarget.Center, Vector2.UnitY); - - Projectile.velocity = (Projectile.velocity * inertia + moveDirection * homingVelocity) / (inertia + 1f); - } - } - else - { - Projectile.velocity *= 0.985f; - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Projectile.ai[1] <= 40f && Projectile.ai[0] != 1f) - { - modifiers.SourceDamage *= 0.3333f; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (targetIndex == target.whoAmI) - Projectile.ai[0] = 1f; - - 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.SulphurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - Projectile.ai[0] = 1f; - 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.SulphurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - } -} diff --git a/Projectiles/Rogue/TurbulanceProjectile.cs b/Projectiles/Rogue/TurbulanceProjectile.cs index 514385eaef..138663322f 100644 --- a/Projectiles/Rogue/TurbulanceProjectile.cs +++ b/Projectiles/Rogue/TurbulanceProjectile.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index 59ecdedeb3..b524a9179d 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -9,9 +9,10 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/TwistingThunderProj.cs b/Projectiles/Rogue/TwistingThunderProj.cs index 38e242db93..f0703df833 100644 --- a/Projectiles/Rogue/TwistingThunderProj.cs +++ b/Projectiles/Rogue/TwistingThunderProj.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 8; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 8; } public override void SetDefaults() @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/UrchinIrradiation.cs b/Projectiles/Rogue/UrchinIrradiation.cs new file mode 100644 index 0000000000..d7fbdc14b8 --- /dev/null +++ b/Projectiles/Rogue/UrchinIrradiation.cs @@ -0,0 +1,68 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class UrchinIrradiation : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 45; + Projectile.height = 45; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = RogueDamageClass.Instance; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, 0f, 0.4f, 0.15f); + + if (Projectile.timeLeft == 60) + { + for (int i = 0; i < 40; i++) + { + int randDust; + switch (Main.rand.Next(4)) + { + case 0: + case 1: + randDust = DustID.Water; + break; + case 2: + default: + randDust = (int)CalamityDusts.SulphurousSeaAcid; + break; + case 3: + randDust = DustID.GemEmerald; + break; + } + + Dust burst = Dust.NewDustPerfect(Projectile.Center, randDust, Main.rand.NextVector2Circular(7f, 7f), 100, Scale: 1.5f); + if (randDust == DustID.GemEmerald) + burst.scale *= 0.7f; + burst.noGravity = true; + } + + MediumMistParticle mist = new(Projectile.Center, Vector2.Zero, new Color(105, 255, 122), Color.Green, 1.2f, 200f, 0.15f * Main.rand.NextBool().ToDirectionInt()); + GeneralParticleHandler.SpawnParticle(mist); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 360); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 360); + } +} diff --git a/Projectiles/Rogue/UrchinStingerProj.cs b/Projectiles/Rogue/UrchinStingerProj.cs index 51847ff991..d874b1ee34 100644 --- a/Projectiles/Rogue/UrchinStingerProj.cs +++ b/Projectiles/Rogue/UrchinStingerProj.cs @@ -1,8 +1,9 @@ -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Typeless; +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; @@ -12,77 +13,128 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/UrchinStinger"; + public ref float Timer => ref Projectile.ai[2]; public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = 2; - Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; - AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } - public override bool PreAI() + public override void AI() { - if (Projectile.Calamity().stealthStrike) + Projectile.StickyProjAI(Projectile.Calamity().stealthStrike ? 10 : 3); + Timer++; + + if (Projectile.ai[0] != 1f) { - Projectile.StickyProjAI(15); - Projectile.localAI[1]++; - if (Projectile.localAI[1] <= 20f && Projectile.ai[0] != 1f) + if (Timer <= 30f) { 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; } - if (Projectile.localAI[1] > 20f && Projectile.ai[0] != 1f) + else { - Projectile.velocity.Y += 0.4f; - Projectile.velocity.X *= 0.97f; + Projectile.velocity.Y += 0.3f; + Projectile.velocity.X *= 0.98f; if (Projectile.velocity.Y > 16f) Projectile.velocity.Y = 16f; Projectile.rotation += 0.2f * Projectile.direction; } - if (Projectile.localAI[0] % 40 == 0 && Projectile.ai[0] == 1f) - { - Vector2 projspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projspeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 1f, Projectile.owner, 2f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = RogueDamageClass.Instance; - } - return false; } - return true; - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Projectile.Calamity().stealthStrike) - Projectile.ModifyHitNPCSticky(4); } public override bool? CanDamage() => Projectile.ai[0] == 1f ? false : base.CanDamage(); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Removes Poisoned immunity + target.buffImmune[BuffID.Poisoned] = false; + target.AddBuff(BuffID.Poisoned, Projectile.Calamity().stealthStrike ? 600 : 180); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Poisoned, 180); + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Projectile.ai[0] = 1f; + Projectile.ai[1] = target.whoAmI; + Projectile.velocity = target.Center - Projectile.Center; + Projectile.netUpdate = true; + + // Count how many projectiles are attached + int maxStick = 7; + Point[] stuckProjArray = new Point[maxStick]; + int projCount = 0; + bool stealthProjStuck = false; + + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.whoAmI != Projectile.whoAmI && Main.myPlayer == p.owner && p.type == Projectile.type && p.ai[0] == 1f && p.ai[1] == Projectile.ai[1]) + { + stuckProjArray[projCount++] = new Point(p.whoAmI, p.timeLeft); + if (p.Calamity().stealthStrike) + stealthProjStuck = true; + if (projCount >= stuckProjArray.Length) + break; + } + } + // Deleting excess projectiles + if (projCount >= stuckProjArray.Length) + { + // If there's a stealth projectile stuck, delete everything and spawn the irradiated blast + if (stealthProjStuck) + { + for (int m = 0; m < stuckProjArray.Length; m++) + Main.projectile[stuckProjArray[m].X].Kill(); + + SoundEngine.PlaySound(SoundID.Item64, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.75f), 0f, Projectile.owner); + } + // Otherwise, delete the oldest stuck projectile (found using the timeLeft stored in the Y of the Point) + else + { + int stuckProjAmt = 0; + for (int m = 1; m < stuckProjArray.Length; m++) + { + if (stuckProjArray[m].Y < stuckProjArray[stuckProjAmt].Y) + { + stuckProjAmt = m; + } + } + Main.projectile[stuckProjArray[stuckProjAmt].X].Kill(); + } + } + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100); + dust.noGravity = true; + } + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (Projectile.Calamity().stealthStrike) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - return base.Colliding(projHitbox, targetHitbox); + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + return null; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Poisoned, 180); - + public override Color? GetAlpha(Color lightColor) + { + if (Projectile.Calamity().stealthStrike) + return Color.Lerp(Color.White, Color.Green, (float)Math.Abs(Math.Sin(Timer * MathHelper.Pi / 30f))); + return null; + } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 a5fb0b0005..9db3525406 100644 --- a/Projectiles/Rogue/ValariBoomerang.cs +++ b/Projectiles/Rogue/ValariBoomerang.cs @@ -2,6 +2,8 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -15,37 +17,40 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/FrostcrushValari"; - //This variable will be used for the stealth strike - public float ReboundTime = 0f; - public float timer = 0f; + // Used for the stealth strike + public int TileCollideDelay = 0; + public ref float State => ref Projectile.ai[0]; + public ref float Timer => ref Projectile.ai[1]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + } public override void SetDefaults() { - Projectile.friendly = true; Projectile.width = 40; Projectile.height = 40; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.timeLeft = 360; + Projectile.timeLeft = 240; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 60; + Projectile.localNPCHitCooldown = 30; Projectile.coldDamage = true; - - Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - //Dust trail - if (Main.rand.NextBool(5)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } + Timer++; //Constant rotation Projectile.rotation += 0.2f; - - timer++; + //Dust trail + if (Main.rand.NextBool(5)) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); //Constant sound effects if (Projectile.soundDelay == 0) { @@ -53,92 +58,128 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } //Slopes REEEEEEEEEEEE - if (timer == 3f) + if (Timer == 3f) Projectile.tileCollide = true; - //Decide the range of the boomerang depending on stealth - if (Projectile.Calamity().stealthStrike) - ReboundTime = 36f; - else - ReboundTime = 55f; - // ai[0] stores whether the boomerang is returning. If 0, it isn't. If 1, it is. - if (Projectile.ai[0] == 0f) + // Stealth strikes follow the cursor + if (Projectile.Calamity().stealthStrike) { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= ReboundTime) + Projectile.tileCollide = true; + if (TileCollideDelay > 0) + TileCollideDelay--; + + Vector2 mousePos = Main.player[Projectile.owner].ClampedMouseWorld(); + if (Vector2.Distance(Projectile.Center, mousePos) > 115f && TileCollideDelay == 0) { - Projectile.ai[0] = 1f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; + float accelerationFactor = 9.5f; // Higher number = Takes longer to turn around. + Projectile.velocity += (mousePos - Projectile.Center).SafeNormalize(Vector2.UnitX) * FrostcrushValari.Speed / accelerationFactor; + if (Projectile.velocity.Length() > FrostcrushValari.Speed) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= FrostcrushValari.Speed; + } + } + else // Accelerate to top speed if close enough to prevent it staying slow if you move in the cursor while it's slowing down. + { + Projectile.velocity *= 1.1f; + if (Projectile.velocity.Length() > FrostcrushValari.Speed) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= FrostcrushValari.Speed; + } } } else { - Projectile.tileCollide = false; - float returnSpeed = FrostcrushValari.Speed * 1.5f; - float acceleration = 3.2f; - Player owner = Main.player[Projectile.owner]; - - // Delete the boomerang if it's excessively far away. - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - Projectile.Center.X; - float yDist = playerCenter.Y - Projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - Projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (Projectile.velocity.X < xDist) + // If State is 0, it is outgoing. If 1, it is returning. + if (State == 0f) { - Projectile.velocity.X += acceleration; - if (Projectile.velocity.X < 0f && xDist > 0f) - Projectile.velocity.X += acceleration; + if (Timer >= 50f) // Return to the player + { + State = 1f; + Projectile.netUpdate = true; + } } - else if (Projectile.velocity.X > xDist) + else { - Projectile.velocity.X -= acceleration; - if (Projectile.velocity.X > 0f && xDist < 0f) - Projectile.velocity.X -= acceleration; - } - if (Projectile.velocity.Y < yDist) - { - Projectile.velocity.Y += acceleration; - if (Projectile.velocity.Y < 0f && yDist > 0f) - Projectile.velocity.Y += acceleration; - } - else if (Projectile.velocity.Y > yDist) - { - Projectile.velocity.Y -= acceleration; - if (Projectile.velocity.Y > 0f && yDist < 0f) - Projectile.velocity.Y -= acceleration; - } + Projectile.tileCollide = false; + float returnSpeed = FrostcrushValari.Speed * 1.5f; + float acceleration = 3.2f; + Player owner = Main.player[Projectile.owner]; - - // Delete the projectile if it touches its owner. - if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(owner.Hitbox)) + // Delete the boomerang if it's excessively far away. + Vector2 playerCenter = owner.Center; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; + float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + if (dist > 3000f) Projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + if (Projectile.velocity.X < xDist) + { + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; + } + else if (Projectile.velocity.X > xDist) + { + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; + } + if (Projectile.velocity.Y < yDist) + { + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; + } + else if (Projectile.velocity.Y > yDist) + { + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; + } + + + // Delete the projectile if it touches its owner. + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); + } } } - private void OnHitEffects() + private void OnHitEffects(Entity target) { - // Start homing at player if you hit an enemy, UNLESS its a stealth strike - if (!Projectile.Calamity().stealthStrike) + // Start homing at player if you hit an enemy + State = 1f; - Projectile.ai[0] = 1; - - int icicleAmt = Main.rand.Next(2, 4); if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < icicleAmt; i++) + for (int i = 0; i < 3; 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); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 4, 0f, Projectile.owner, ai2: Main.rand.NextBool() ? 1f : 0f); + } + } + + // Stealth visuals and hit sound + if (Projectile.Calamity().stealthStrike) + { + SoundStyle freeze = new("CalamityMod/Sounds/NPCHit/CryogenPhaseTransitionCrack"); + SoundEngine.PlaySound(freeze with { Volume = 0.4f, Pitch = 1f }, Projectile.Center); + + float randOffset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 6; i++) + { + Vector2 particleVel = Vector2.UnitX.RotatedBy(MathHelper.Pi / 3f * i + randOffset) * 7.5f; + WaterFlavoredParticle flashed = new(target.Center, particleVel, false, 10, 0.7f, Color.AliceBlue); + GeneralParticleHandler.SpawnParticle(flashed); } } } @@ -146,7 +187,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - OnHitEffects(); + OnHitEffects(target); target.AddBuff(BuffID.Frostburn2, 120); if (Projectile.Calamity().stealthStrike) target.AddBuff(ModContent.BuffType(), 45); @@ -155,7 +196,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { - OnHitEffects(); + OnHitEffects(target); target.AddBuff(BuffID.Frostburn2, 120); if (Projectile.Calamity().stealthStrike) target.AddBuff(ModContent.BuffType(), 45); @@ -163,9 +204,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - //Bounce off tiles and start homing on player if it hits a tile + //Bounce off tiles and return to player if it hits a tile Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + SoundEngine.PlaySound(SoundID.Item50, Projectile.position); if (Projectile.velocity.X != oldVelocity.X) { Projectile.velocity.X = -oldVelocity.X; @@ -174,8 +215,32 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.velocity.Y = -oldVelocity.Y; } - Projectile.ai[0] = 1; + State = 1f; + if (TileCollideDelay == 0) + TileCollideDelay = 10; return false; } + + // Stealth strike shatter effects on death + public override void OnKill(int timeLeft) + { + if (Projectile.Calamity().stealthStrike) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); + Vector2 splinterVel = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 12f); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, splinterVel, Mod.Find("FrostcrushValariGore1").Type); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, splinterVel, Mod.Find("FrostcrushValariGore2").Type); + } + } + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.Calamity().stealthStrike) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, 2, lightColor); + return false; + } + return true; + } } } diff --git a/Projectiles/Rogue/Valaricicle.cs b/Projectiles/Rogue/Valaricicle.cs index a6100f7335..4030492b69 100644 --- a/Projectiles/Rogue/Valaricicle.cs +++ b/Projectiles/Rogue/Valaricicle.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,27 +10,30 @@ namespace CalamityMod.Projectiles.Rogue public class Valaricicle : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = 1; Projectile.timeLeft = 180; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.coldDamage = true; + Projectile.ArmorPenetration = 10; } public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - Projectile.velocity.X *= 0.9995f; - Projectile.velocity.Y += 0.01f; - if (Projectile.timeLeft < 150) - CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 8f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 9f, 20f); + else + { + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y += 0.01f; + } } public override void OnKill(int timeLeft) @@ -39,5 +44,15 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } + + public override bool PreDraw(ref Color lightColor) + { + string texString = Projectile.ai[2] == 1f ? "CalamityMod/Projectiles/Rogue/Valaricicle2" : Texture; + Texture2D tex = ModContent.Request(texString).Value; + SpriteEffects spr = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, spr); + return false; + } } } diff --git a/Projectiles/Rogue/Valaricicle2.cs b/Projectiles/Rogue/Valaricicle2.cs deleted file mode 100644 index 1ccddf4d15..0000000000 --- a/Projectiles/Rogue/Valaricicle2.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class Valaricicle2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = 1; - Projectile.timeLeft = 180; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.coldDamage = true; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - Projectile.velocity.X *= 0.9995f; - Projectile.velocity.Y += 0.01f; - - if (Projectile.timeLeft < 150) - CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 8f, 20f); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); - for (int k = 0; k < 5; k++) - { - 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 095665bff9..a06515a9e8 100644 --- a/Projectiles/Rogue/ValedictionBoomerang.cs +++ b/Projectiles/Rogue/ValedictionBoomerang.cs @@ -15,8 +15,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -114,19 +115,19 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(); } diff --git a/Projectiles/Rogue/VeneratedKnife.cs b/Projectiles/Rogue/VeneratedKnife.cs index 960c4eb363..11d4cf013e 100644 --- a/Projectiles/Rogue/VeneratedKnife.cs +++ b/Projectiles/Rogue/VeneratedKnife.cs @@ -14,8 +14,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -71,13 +72,13 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[0] == 0f) { - Texture2D knife1 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3, knife1); + Texture2D knife1 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 3, knife1); } else if (Projectile.ai[0] == 1f) { Texture2D knife2 = ModContent.Request("CalamityMod/Projectiles/Rogue/VeneratedKnife2").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3, knife2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 3, knife2); } return false; } diff --git a/Projectiles/Rogue/WaveSkipperProjectile.cs b/Projectiles/Rogue/WaveSkipperProjectile.cs index 3d1277da7d..82ab76963c 100644 --- a/Projectiles/Rogue/WaveSkipperProjectile.cs +++ b/Projectiles/Rogue/WaveSkipperProjectile.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, Projectile.Calamity().stealthStrike ? 4 : 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, Projectile.Calamity().stealthStrike ? 4 : 2); return false; } } diff --git a/Projectiles/Rogue/WhitewaterAura.cs b/Projectiles/Rogue/WhitewaterAura.cs new file mode 100644 index 0000000000..cc86ca7ba0 --- /dev/null +++ b/Projectiles/Rogue/WhitewaterAura.cs @@ -0,0 +1,89 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class WhitewaterAura : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public float fade = 0; + public float areaScale = 1; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 5; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + Projectile.rotation += Main.rand.NextFloat(0.09f, 0.23f); + areaScale = (Math.Abs((float)Math.Sin(time * 0.175f / MathHelper.Pi)) * 0.05f) + 1; + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + float targetDist = Vector2.Distance(player.Center, Projectile.Center); + + if (targetDist < 200f * areaScale && player.Calamity().whitewaterHeal == 0) + { + player.Calamity().whitewaterHeal = (player.whoAmI == Projectile.owner ? 300 : 600); + } + } + + if (Projectile.timeLeft < 30) + { + fade = MathHelper.Lerp(fade, 0, 0.12f); + areaScale = MathHelper.Lerp(areaScale, 0, 0.12f); + } + if (time < 30) + fade = MathHelper.Lerp(fade, 1, 0.12f); + else if (Projectile.timeLeft > 30) + { + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(200f * areaScale, 200f * areaScale), 66); + dust.scale = Main.rand.NextFloat(0.3f, 0.7f); + dust.velocity = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f); + dust.color = Color.LightBlue; + dust.noGravity = true; + } + } + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Wet, 300); + target.AddBuff(ModContent.BuffType(), 300); + + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); + target.MoveNPC(launchVel, 9, true); + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request("CalamityMod/Particles/HighResFoggyCircleHardEdge").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/SoftRoundExplosion").Value; + Color drawColor2 = Color.LightBlue; + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 }, 0, tex.Size() / 2f, 0.2f * fade * areaScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * 0.3f, Projectile.rotation, tex2.Size() / 2f, 0.2f * fade * areaScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * 0.3f, -Projectile.rotation, tex2.Size() / 2f, 0.2f * fade * areaScale, SpriteEffects.None, 0); + + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 200 * areaScale, targetHitbox); + } +} diff --git a/Projectiles/Rogue/WhitewaterProj.cs b/Projectiles/Rogue/WhitewaterProj.cs new file mode 100644 index 0000000000..1bc378ec2d --- /dev/null +++ b/Projectiles/Rogue/WhitewaterProj.cs @@ -0,0 +1,240 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class WhitewaterProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Whitewater"; + public ref float time => ref Projectile.ai[0]; + + public bool returning = false; + public bool empowered = false; + public bool shattered = false; + public int shatterTimer = 230; + public float fade = 0; + public float damageModifier = 1; + public float randSize; + + public int returnTime = 500; + public int becomeEmpoweredTime = 60; + + public override void SetDefaults() + { + Projectile.width = 36; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 800; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + + randSize = Main.rand.NextFloat(0.8f, 1.2f); + Projectile.rotation += 0.02f * Projectile.velocity.Length(); + + if (time >= returnTime) + returning = true; + if (time > becomeEmpoweredTime && time < returnTime && !shattered) + { + fade = MathHelper.Lerp(fade, 1, 0.06f); + empowered = true; + } + else + { + fade = MathHelper.Lerp(fade, 0, 0.07f); + empowered = false; + } + if (empowered) + { + Lighting.AddLight(Projectile.Center, Color.LightBlue.ToVector3() * fade); + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15, 15), 278); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.3f, 0.55f); + dust.velocity = Projectile.velocity * Main.rand.NextFloat(0.2f, 0.4f); + dust.color = Color.LightBlue; + } + } + + if (time > 20 && !returning && !shattered) + { + Vector2 moveToMouse = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 12) + Projectile.velocity += moveToMouse * ( 1 - (0.85f * Utils.GetLerpValue(returnTime / 2, 0, time, true))); + else + Projectile.velocity *= 0.9f; + } + if (shattered && !returning) + { + fade = MathHelper.Lerp(fade, 1, 0.07f); + Projectile.extraUpdates = 5; + Projectile.velocity = Vector2.Zero; + Projectile.alpha = 255; + randSize = Main.rand.NextFloat(1.8f, 2.2f); + + Projectile.timeLeft++; + time--; + + if (shatterTimer <= 140) + { + if (Main.rand.NextBool(5)) + { + Vector2 vel = (Vector2.One * 19).RotatedByRandom(100) * Main.rand.NextFloat(0.9f, 1.1f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 3, 66); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.85f); + dust.velocity = -vel * Main.rand.NextFloat(0.2f, 0.4f); + dust.color = Color.LightBlue; + } + } + if (shatterTimer == 230) + { + for (int i = 0; i < 25; i++) + { + Vector2 vel = (Vector2.One * 24).RotatedByRandom(100) * Main.rand.NextFloat(0.9f, 1.1f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 66); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.85f); + dust.velocity = vel * Main.rand.NextFloat(0.2f, 0.4f); + dust.color = Color.LightBlue; + } + } + shatterTimer--; + if (shatterTimer <= 0) + { + Projectile.alpha = 0; + empowered = false; + returning = true; + } + } + if (returning) + { + Projectile.extraUpdates = 1; + Projectile.alpha = 0; + float returnSpeed = 13; + float acceleration = 1.2f; + 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 + if (Main.myPlayer == Projectile.owner) + { + if (Projectile.Hitbox.Intersects(Owner.Hitbox)) + { + Projectile.Kill(); + if (Projectile.Calamity().stealthStrike) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == ModContent.ProjectileType()) + { + if (projectile.timeLeft > 30) + projectile.timeLeft = 30; + } + } + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), Projectile.knockBack, Projectile.owner, 0f, 0f); + } + } + } + } + time++; + } + public override bool? CanDamage() => (shattered && !returning) ? false : null; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (damageModifier > 0.05f) + damageModifier -= 0.05f; + + if (empowered && !shattered) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/BreakAndReform"); + SoundEngine.PlaySound(sound with { Volume = 0.4f }, Projectile.Center); + + int points = Projectile.Calamity().stealthStrike ? 8 : 4; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(Projectile.ai[1] == 1 ? MathHelper.ToRadians(45f) : 0) * 4; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 0f, 0f); + } + shattered = true; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.Calamity().stealthStrike) + modifiers.SourceDamage *= damageModifier; + else // if hitting before being empowered it does less damage, otherwise on the empowered hit it does full damage, but both hits are effected by the damageMult + modifiers.SourceDamage *= (empowered && !returning) ? damageModifier : damageModifier * 0.5f; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D rTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D wTexture = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + Color drawColor2 = Color.LightBlue; + + Main.EntitySpriteDraw(rTexture, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * fade * 0.5f, Projectile.rotation, rTexture.Size() * 0.5f, 0.45f * randSize, SpriteEffects.None, 0); + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + + for (int k = 0; k < 2; k++) + { + float rot = (k == 0 ? MathHelper.ToRadians(90f) : 0) + (Projectile.ai[1] == -1 ? MathHelper.ToRadians(45f) : 0); + Main.EntitySpriteDraw(wTexture, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * fade * 0.4f, rot, wTexture.Size() * 0.5f, 1.15f * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(wTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * fade * 0.4f, rot, wTexture.Size() * 0.5f, 0.68f * randSize, SpriteEffects.None, 0); + } + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45, targetHitbox); + } +} diff --git a/Projectiles/Rogue/WhitewaterSpear.cs b/Projectiles/Rogue/WhitewaterSpear.cs new file mode 100644 index 0000000000..dedcc42106 --- /dev/null +++ b/Projectiles/Rogue/WhitewaterSpear.cs @@ -0,0 +1,62 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class WhitewaterSpear : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + + public ref float time => ref Projectile.ai[0]; + public Vector2 startVel; + public Vector2 startPos; + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 230; + Projectile.extraUpdates = 5; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 25; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.LightBlue.ToVector3() * 0.4f); + if (time == 0) + { + startVel = Projectile.velocity; + startPos = Projectile.Center; + } + + if (Projectile.timeLeft % 3 == 0) + { + Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 14, 1f, Color.LightBlue * 0.2f); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (time > 80) + { + Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, -startVel.X, 0.02f); + Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, -startVel.Y, 0.02f); + } + else + Projectile.velocity *= 0.995f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Wet, 180); + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 15, targetHitbox); + } +} diff --git a/Projectiles/Rogue/WhitewaterSpear.png b/Projectiles/Rogue/WhitewaterSpear.png new file mode 100644 index 0000000000..a50659774e Binary files /dev/null and b/Projectiles/Rogue/WhitewaterSpear.png differ diff --git a/Projectiles/Rogue/WrathwingCinder.cs b/Projectiles/Rogue/WrathwingCinder.cs index accba2f53e..ab70362863 100644 --- a/Projectiles/Rogue/WrathwingCinder.cs +++ b/Projectiles/Rogue/WrathwingCinder.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 5; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/WrathwingFireball.cs b/Projectiles/Rogue/WrathwingFireball.cs index ea87dc0f35..b5996c3d83 100644 --- a/Projectiles/Rogue/WrathwingFireball.cs +++ b/Projectiles/Rogue/WrathwingFireball.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 5; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; // Keep the fireball rotated the correct way because the sheet faces down, not up @@ -53,11 +53,11 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Rogue/WrathwingSpear.cs b/Projectiles/Rogue/WrathwingSpear.cs index 0549e21f39..93d1a16cf8 100644 --- a/Projectiles/Rogue/WrathwingSpear.cs +++ b/Projectiles/Rogue/WrathwingSpear.cs @@ -14,9 +14,10 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -109,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/WulfrumKnifeProj.cs b/Projectiles/Rogue/WulfrumKnifeProj.cs index a233eb1fa8..4f6a26f038 100644 --- a/Projectiles/Rogue/WulfrumKnifeProj.cs +++ b/Projectiles/Rogue/WulfrumKnifeProj.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 0; } public static int Lifetime = 950; @@ -89,13 +89,9 @@ namespace CalamityMod.Projectiles.Rogue } } } - - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.rand.NextBool()) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } + SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -119,7 +115,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; float opacitey = StealthEffectOpacity; if (Projectile.Calamity().stealthStrike) diff --git a/Projectiles/Summon/AmphibiansGuitarHoldout.cs b/Projectiles/Summon/AmphibiansGuitarHoldout.cs new file mode 100644 index 0000000000..966171311f --- /dev/null +++ b/Projectiles/Summon/AmphibiansGuitarHoldout.cs @@ -0,0 +1,108 @@ +using System; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class AmphibiansGuitarHoldout : ModProjectile, ILocalizedModType + { + public override string LocalizationCategory => "Projectiles.Summon"; + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + + private Player Owner => Main.player[Projectile.owner]; + + private ref float SpawnTimer => ref Projectile.ai[0]; + + private static float ArmSwing => MathHelper.PiOver4 + Utils.Remap(MathF.Sin(Main.GlobalTimeWrappedHourly * 6.7f), -1f, 1f, -MathHelper.ToRadians(15f), MathHelper.ToRadians(15f)); + + private static readonly int MinionType = ModContent.ProjectileType(); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 50; + Projectile.tileCollide = false; + Projectile.netImportant = true; + } + + public override void AI() + { + SpawnTimer++; + if (SpawnTimer > 19f && Owner.ownedProjectileCounts[MinionType] < 8 && Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectile( + Projectile.GetSource_FromThis(), + Owner.MountedCenter, + Vector2.Zero, + MinionType, + Projectile.damage, + Projectile.knockBack, + Projectile.owner, + Owner.ownedProjectileCounts[MinionType]); + SpawnTimer = 0f; + } + + ManageHoldout(); + } + + private void ManageHoldout() + { + if (Owner.CantUseHoldout()) + Projectile.Kill(); + + // The center of the player, taking into account if they have a mount or not. + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // 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(); + + int direction = MathF.Sign(ownerToMouse.X); + + Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * 15f; + Projectile.Center = armPosition + lengthOffset; + 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, Player.CompositeArmStretchAmount.ThreeQuarters, armRotation + ArmSwing * direction); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation); + + Projectile.timeLeft = 2; + Projectile.ForceNetUpdate(); + } + + public override bool ShouldUpdatePosition() => false; + + 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; + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Summon/AmphibiansGuitarHoldout.png b/Projectiles/Summon/AmphibiansGuitarHoldout.png new file mode 100644 index 0000000000..b790271574 Binary files /dev/null and b/Projectiles/Summon/AmphibiansGuitarHoldout.png differ diff --git a/Projectiles/Summon/AmphibiansGuitarMinion.cs b/Projectiles/Summon/AmphibiansGuitarMinion.cs new file mode 100644 index 0000000000..ddfab3cd17 --- /dev/null +++ b/Projectiles/Summon/AmphibiansGuitarMinion.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Summon +{ + public class AmphibiansGuitarMinion : BaseMinionProjectile + { + public override int AssociatedProjectileTypeID => ProjectileType(); + + public override int AssociatedBuffTypeID => BuffType(); + + public override ref bool AssociatedMinionBool => ref ModdedOwner.AmphibiansGuitarBool; + + /// + /// A property that states which guitar sprite is using from the spritesheet.
+ /// First guitar goes from 0 and the last to 7. + ///
+ private int GuitarSprite + { + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = MathHelper.Clamp(value, 0, 7); + } + private ref float ShootTimer => ref Projectile.ai[1]; + private ref float ShootCount => ref Projectile.ai[2]; + + // Position is same for targeting and non targeting but is left open to be changed because they may want it changed. + private Vector2 RotationPosition => Target == null ? Owner.MountedCenter : Owner.MountedCenter; + private float IntendedRotationAngle => MathHelper.TwoPi / (Owner == null ? 1f : MathHelper.Clamp(Owner.ownedProjectileCounts[Type], 1f, 8f)) * GuitarSprite + Time * 2.4f; + private static float Time => Main.GameUpdateCount / 60f; + + private bool _hasSpawned; + private Color _effectsColor = Color.White; + + public override void SetDefaults() + { + base.SetDefaults(); + (Projectile.width, Projectile.height) = (92, 92); + } + + public override void MinionAI() + { + if (!_hasSpawned) + { + // Pitch matches the song if played with proper timing + SoundStyle spawnSound = new("CalamityMod/Sounds/Item/AmphibiansGuitarSummon"); + SoundEngine.PlaySound(spawnSound with { Volume = 0.8f, Pitch = (GuitarSprite == 2 || GuitarSprite == 5) ? -0.15f : 0f }, Projectile.Center); + + ShootTimer = GuitarSprite * 10f; + + _hasSpawned = true; + } + + float oscillation = MathHelper.Clamp(Math.Abs((float)Math.Sin(Time * 5f / MathHelper.Pi)), 0f, 1f); + Vector2 intendedPosition = RotationPosition - Vector2.UnitY.RotatedBy(IntendedRotationAngle) * (Target == null ? 100f : (Target.Size.Length() / 2f) + (600f - 350f * oscillation)); + Projectile.Center = Vector2.Lerp(Projectile.Center, intendedPosition, Utils.Remap(Projectile.DistanceSQ(intendedPosition), 6400f, 0f, 0.1f, 0.3f)); + Projectile.rotation = IntendedRotationAngle; + + if (Target != null) + { + bool bigShot = ShootCount % 3 == 0; + if (ShootTimer > 80f && Main.myPlayer == Projectile.owner) + { + for (int i = 0; i < (bigShot ? 3 : 1); i++) + { + float rot = i == 1 ? -0.25f : i == 2 ? 0.25f : 0; + Projectile.NewProjectile( + Projectile.GetSource_FromThis(), + Projectile.Center, + CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, 18f * (1f - Math.Abs(rot))).RotatedBy(rot), + ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner, + (Main.rand.NextBool() && Owner.ownedProjectileCounts[Type] == 8).ToInt(), + Main.rand.Next(0, 4 + 1), + bigShot ? 5 : 0); + } + + if (bigShot) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/Evernote"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 10 }, Projectile.Center); + + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, _effectsColor, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.01f, 0.09f, 17); + GeneralParticleHandler.SpawnParticle(blastRing); + } + else + { + SoundStyle fireSmall = new("CalamityMod/Sounds/Item/WulfrumProsthesisShoot"); + SoundEngine.PlaySound(fireSmall with { Volume = 0.3f, Pitch = Main.rand.NextFloat(0.6f, 0.7f) }, Projectile.Center); + } + + ShootCount++; + ShootTimer = 0; + } + + if (ShootTimer < 10f) + Projectile.Center -= Utils.DirectionTo(Projectile.Center, Target.Center) * 10; + + float rate = Time * 2f; + List eColors = + [ + Color.Red, + Color.Cyan, + Color.Goldenrod, + Color.Magenta, + Color.Lime, + ]; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + _effectsColor = Color.Lerp(Color.White, Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), 0.7f); + + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(70, 70), DustType(), (Utils.DirectionTo(Projectile.Center, intendedPosition) * -9).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.75f, 1.25f); + dust.color = _effectsColor; + dust.noLightEmittence = true; + } + else + { + Particle spark = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(70, 70), (Utils.DirectionTo(Projectile.Center, intendedPosition) * -9f).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 1f), false, 7, Main.rand.NextFloat(0.5f, 0.8f), _effectsColor, true, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + ShootTimer++; + } + } + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(horizontalFrames: 8, frameX: GuitarSprite); + + Projectile.DrawProjectileWithBackglow(_effectsColor with { A = 0 }, lightColor, Target == null ? 0 : 8, texture, frame); + + Main.EntitySpriteDraw( + texture, + Projectile.Center - Main.screenPosition, + frame, + Color.White, + Projectile.rotation, + frame.Size() * 0.5f, + Projectile.scale, + SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Summon/AmphibiansGuitarMinion.png b/Projectiles/Summon/AmphibiansGuitarMinion.png new file mode 100644 index 0000000000..81890fba8c Binary files /dev/null and b/Projectiles/Summon/AmphibiansGuitarMinion.png differ diff --git a/Projectiles/Summon/AmphibiansGuitarProjectile.cs b/Projectiles/Summon/AmphibiansGuitarProjectile.cs new file mode 100644 index 0000000000..5782e66785 --- /dev/null +++ b/Projectiles/Summon/AmphibiansGuitarProjectile.cs @@ -0,0 +1,125 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using CalamityMod.Dusts; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Summon +{ + public class AmphibiansGuitarProjectile : ModProjectile, ILocalizedModType + { + public override string LocalizationCategory => "Projectiles.Summon"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public bool IsHatNote => Projectile.ai[0] != 0f; + public Color noteColor = Color.White; + public int time = 0; + public NPC targeted; + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 54; + Projectile.height = 44; + Projectile.timeLeft = 150; + Projectile.localNPCHitCooldown = 20; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + } + public override void AI() + { + if (time == 0) + { + if (IsHatNote) + Projectile.penetrate = 1; + if (Projectile.ai[2] == 5) + Projectile.extraUpdates = 1; + } + Projectile.scale = 1.6f * Utils.GetLerpValue(-5, 20, time, true); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (time % 10 == 0) + { + if (Projectile.ai[1] < 4) + Projectile.ai[1]++; + else + Projectile.ai[1] = 0; + } + Color chooseColor = Projectile.ai[1] switch + { + 0 => Color.Red, + 1 => Color.Cyan, + 2 => Color.Goldenrod, + 3 => Color.Magenta, + _ => Color.Lime, + }; + if (time == 0) + noteColor = chooseColor; + else + noteColor = Color.Lerp(noteColor, chooseColor, 0.07f); + + Lighting.AddLight(Projectile.Center, noteColor.ToVector3() * 0.5f); + if (time % 3 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(40, 40), ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.35f); + dust.color = noteColor; + dust.noLightEmittence = true; + } + if (Projectile.ai[2] == 5 && time % 2 == 0) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 8, 0.065f, noteColor * 0.75f, new Vector2(1, 0.3f), true, false, 1f); + GeneralParticleHandler.SpawnParticle(spark); + } + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= IsHatNote ? 1.5f : 1f; + public override void OnKill(int timeLeft) + { + if (IsHatNote) + { + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.8f, Pitch = -0.5f }, Projectile.Center); + } + for (int i = 0; i <= (IsHatNote ? 8 : 4); i++) + { + Particle spark = new SparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(IsHatNote ? 100 : 0.5f) * Main.rand.NextFloat(0.4f, 1.3f), false, 15, 1.2f, noteColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request("CalamityMod/Projectiles/Summon/Evernote"); + Asset tex2 = ModContent.Request("CalamityMod/Projectiles/Summon/EvernoteWall"); + Asset glow = ModContent.Request("CalamityMod/Particles/Light"); + + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], noteColor with { A = 0 } * 0.4f, 1, tex.Value, true, true); + + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, noteColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.9f * Utils.GetLerpValue(-5, 20, time, true), 1) * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.Lerp(Color.White, noteColor, 0.15f) with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.9f * Utils.GetLerpValue(-5, 20, time, true), 1) * Projectile.scale * 0.88f, SpriteEffects.None); + + if (IsHatNote) + { + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(tex2.Value, generalDrawPos, null, noteColor with { A = 0 }, Main.GlobalTimeWrappedHourly * 7.3f + i * 2, tex2.Size() * 0.5f, Projectile.scale * (0.7f + i * 0.7f) * 0.9f, SpriteEffects.None); + } + return false; + } + } +} diff --git a/Projectiles/Summon/AndromedaDeathRay.cs b/Projectiles/Summon/AndromedaDeathRay.cs index c9e0b2819f..887b45d8a6 100644 --- a/Projectiles/Summon/AndromedaDeathRay.cs +++ b/Projectiles/Summon/AndromedaDeathRay.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/AndromedaRegislash.cs b/Projectiles/Summon/AndromedaRegislash.cs index cef379f099..17bdca96bc 100644 --- a/Projectiles/Summon/AndromedaRegislash.cs +++ b/Projectiles/Summon/AndromedaRegislash.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -36,12 +36,14 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; if (Projectile.localAI[0] == 0f) { - if (CalamityUtils.CountProjectiles(Projectile.type) > 1) + if (CalamityUtils.CountOwnedProjectiles(Projectile.type, Projectile.owner) > 1) { Projectile.Kill(); return; } SoundEngine.PlaySound(SoundID.DD2_DrakinShot, Projectile.Center); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.rotation = Projectile.AngleTo(Main.MouseWorld); Projectile.localAI[0] = 1f; } @@ -56,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame++; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.Kill(); } @@ -66,9 +68,9 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 startPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Type]; int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); Vector2 origin = rectangle.Size() / 2f; diff --git a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs index 5546744709..a2094971eb 100644 --- a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs +++ b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs @@ -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(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, + Main.spriteBatch.Draw(Terraria.GameContent.TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Color.White * Projectile.Opacity, diff --git a/Projectiles/Summon/AngelBolt.cs b/Projectiles/Summon/AngelBolt.cs index aaedab1f12..fddc5914d7 100644 --- a/Projectiles/Summon/AngelBolt.cs +++ b/Projectiles/Summon/AngelBolt.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/AngelOrb.cs b/Projectiles/Summon/AngelOrb.cs index ea400a3f84..25e78969da 100644 --- a/Projectiles/Summon/AngelOrb.cs +++ b/Projectiles/Summon/AngelOrb.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/AngelRay.cs b/Projectiles/Summon/AngelRay.cs index bcadf072d3..2aee50bd33 100644 --- a/Projectiles/Summon/AngelRay.cs +++ b/Projectiles/Summon/AngelRay.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/AngelicAllianceArchangel.cs b/Projectiles/Summon/AngelicAllianceArchangel.cs index 9f13089822..c3c46831be 100644 --- a/Projectiles/Summon/AngelicAllianceArchangel.cs +++ b/Projectiles/Summon/AngelicAllianceArchangel.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Summon private int lifeSpan = 900; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -147,8 +147,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index 58ba156d6c..e0063dc6e0 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; @@ -17,9 +18,9 @@ namespace CalamityMod.Projectiles.Summon private int HitCooldown = 0; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 8; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -242,6 +243,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.rand.NextBool(3)) target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 90); 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); diff --git a/Projectiles/Summon/ApparatusExplosion.cs b/Projectiles/Summon/ApparatusExplosion.cs index 1e3caa54c8..bdac9e8860 100644 --- a/Projectiles/Summon/ApparatusExplosion.cs +++ b/Projectiles/Summon/ApparatusExplosion.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - Main.projFrames[Projectile.type] = 10; + ProjectileID.Sets.MinionShot[Type] = true; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.Kill(); } diff --git a/Projectiles/Summon/AquasScepterRaindrop.cs b/Projectiles/Summon/AquasScepterRaindrop.cs index 876910da3f..4df8cfb6ad 100644 --- a/Projectiles/Summon/AquasScepterRaindrop.cs +++ b/Projectiles/Summon/AquasScepterRaindrop.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { // Sets the amount of frames this minion has on its spritesheet - Main.projFrames[Projectile.type] = 1; + Main.projFrames[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 diff --git a/Projectiles/Summon/AquasScepterTeslaAura.cs b/Projectiles/Summon/AquasScepterTeslaAura.cs index d3d8c6d728..d55ee2ca0d 100644 --- a/Projectiles/Summon/AquasScepterTeslaAura.cs +++ b/Projectiles/Summon/AquasScepterTeslaAura.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { // Sets the amount of frames this minion has on its spritesheet - Main.projFrames[Projectile.type] = 5; + Main.projFrames[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 diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 74c039a521..f060849af8 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/AstrageldonLaser.cs b/Projectiles/Summon/AstrageldonLaser.cs index 2ed1ac7556..6b5f11be8b 100644 --- a/Projectiles/Summon/AstrageldonLaser.cs +++ b/Projectiles/Summon/AstrageldonLaser.cs @@ -11,10 +11,10 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index 4d1f353634..795b62514b 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -20,9 +20,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -218,8 +218,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int height = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Summon/AstralProbeRound.cs b/Projectiles/Summon/AstralProbeRound.cs index 6f44db1d80..bc9ba0db92 100644 --- a/Projectiles/Summon/AstralProbeRound.cs +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = Projectile.velocity.ToRotation(); // The projectile looks at where it's going. Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Type]; // The projectile does it's animation. Lighting.AddLight(Projectile.Center, Vector3.One * 0.1f); // The projectile emtis light. @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 c8e16422cd..64de6fe834 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/AtlasMunitionsAutocannon.cs b/Projectiles/Summon/AtlasMunitionsAutocannon.cs index 5161f2b0b5..fd34912391 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannon.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannon.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Summon // Handle frames. bool frameChangeInterval = Projectile.frameCounter % 6 == 5; Projectile.frameCounter++; - if (frameChangeInterval && Projectile.frame < Main.projFrames[Projectile.type] - 1) + if (frameChangeInterval && Projectile.frame < Main.projFrames[Type] - 1) Projectile.frame++; // Handle turret frames. diff --git a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs index be7518fde5..2fa308dd49 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs @@ -243,10 +243,7 @@ namespace CalamityMod.Projectiles.Summon // Notify other clients and the server if the cannon's firing state has changed. This sync cannot be blocked by the net spam threshold. if (wasFiring != IsFiring) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); } public void ShootProjectiles() @@ -282,6 +279,7 @@ namespace CalamityMod.Projectiles.Summon // Update the cannon direction. if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Atlas cannon float interpolant = Utils.GetLerpValue(16f, 56f, Projectile.Distance(Main.MouseWorld), true) * Utils.GetLerpValue(3f, 10f, MathHelper.Distance(Main.MouseWorld.X, Owner.Center.X), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant).SafeNormalize(Vector2.UnitX * Owner.direction); @@ -289,10 +287,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); Projectile.spriteDirection = Projectile.direction; if (Projectile.velocity != oldVelocity) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } + Projectile.ForceNetUpdate(); } Vector2 cannonEndOffset = Projectile.velocity * 26f + Projectile.velocity.RotatedBy(MathHelper.PiOver2 * Projectile.spriteDirection) * 2f; diff --git a/Projectiles/Summon/AtlasMunitionsDropPod.cs b/Projectiles/Summon/AtlasMunitionsDropPod.cs index 63355a6e0e..a2850a87e0 100644 --- a/Projectiles/Summon/AtlasMunitionsDropPod.cs +++ b/Projectiles/Summon/AtlasMunitionsDropPod.cs @@ -32,9 +32,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 14; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 14; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -94,8 +94,8 @@ namespace CalamityMod.Projectiles.Summon } } } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - Projectile.frame = Main.projFrames[Projectile.type] - 1; + if (Projectile.frame >= Main.projFrames[Type]) + Projectile.frame = Main.projFrames[Type] - 1; } // Fall downward. @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 8688a7dc16..823f66367d 100644 --- a/Projectiles/Summon/AtlasMunitionsDropPodUpper.cs +++ b/Projectiles/Summon/AtlasMunitionsDropPodUpper.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Summon/AtlasMunitionsLaser.cs b/Projectiles/Summon/AtlasMunitionsLaser.cs index ac2e8bb612..2087709aef 100644 --- a/Projectiles/Summon/AtlasMunitionsLaser.cs +++ b/Projectiles/Summon/AtlasMunitionsLaser.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frameCounter++; if (Projectile.frameCounter >= 5) { - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; Projectile.frameCounter = 0; } diff --git a/Projectiles/Summon/AtlasMunitionsLaserOverdrive.cs b/Projectiles/Summon/AtlasMunitionsLaserOverdrive.cs index cd9a767bb5..b178aadb8e 100644 --- a/Projectiles/Summon/AtlasMunitionsLaserOverdrive.cs +++ b/Projectiles/Summon/AtlasMunitionsLaserOverdrive.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frameCounter++; if (Projectile.frameCounter >= 5) { - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; Projectile.frameCounter = 0; } @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 74e448eb29..4dd7f1f898 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -4,6 +4,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -12,13 +13,15 @@ namespace CalamityMod.Projectiles.Summon public class AureusBomber : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 1; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 3; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 1; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -253,7 +256,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + var dye = Owner?.cMinion ?? 0; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, armorShaderToUse: dye); return false; } diff --git a/Projectiles/Summon/AureusBomberGlow.png b/Projectiles/Summon/AureusBomberGlow.png new file mode 100644 index 0000000000..1faa9ff87d Binary files /dev/null and b/Projectiles/Summon/AureusBomberGlow.png differ diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs index 3bd8c32128..c3b33c47d2 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 11; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 11; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BabyPlaguebringer.cs b/Projectiles/Summon/BabyPlaguebringer.cs index 862928f071..a16bb53690 100644 --- a/Projectiles/Summon/BabyPlaguebringer.cs +++ b/Projectiles/Summon/BabyPlaguebringer.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -227,8 +227,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; Vector2 origin = new Vector2(texture.Width / 2f, framing / 2f); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture.Width, framing), Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); diff --git a/Projectiles/Summon/BelladonnaPetal.cs b/Projectiles/Summon/BelladonnaPetal.cs index ad834aeacb..4c2cc34c04 100644 --- a/Projectiles/Summon/BelladonnaPetal.cs +++ b/Projectiles/Summon/BelladonnaPetal.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Summon public class BelladonnaPetal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "Terraria/Images/Projectile_276"; public Player Owner => Main.player[Projectile.owner]; // The timer for the AI to do it's actions. @@ -23,9 +24,11 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 2; } public override void SetDefaults() @@ -54,6 +57,14 @@ namespace CalamityMod.Projectiles.Summon // Gives it a jungl-y green color. Lighting.AddLight(Projectile.Center, 0.5f, 1f, 0.3f); + // Animation + Projectile.frameCounter++; + if (Projectile.frameCounter >= 8) + { + Projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; + } + Projectile.netUpdate = true; } @@ -149,7 +160,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { if (CheckForFiring == 1f) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return true; } diff --git a/Projectiles/Summon/BelladonnaPetal.png b/Projectiles/Summon/BelladonnaPetal.png deleted file mode 100644 index 43bc9ac92d..0000000000 Binary files a/Projectiles/Summon/BelladonnaPetal.png and /dev/null differ diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index 81183ea2ce..5d99e1cd20 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -35,9 +35,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.MinionAntiClump(); Projectile.spriteDirection = Target == null ? MathF.Sign(Projectile.velocity.X) : MathF.Sign(Target.Center.X - Projectile.Center.X); - Projectile.netUpdate = true; - if (Projectile.netSpam >= 10) - Projectile.netSpam = 9; + Projectile.ForceNetUpdate(false); } #region AI Methods @@ -112,7 +110,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 a390bb3802..42328be24b 100644 --- a/Projectiles/Summon/BetterHornetStinger.cs +++ b/Projectiles/Summon/BetterHornetStinger.cs @@ -54,14 +54,12 @@ namespace CalamityMod.Projectiles.Summon } } - Projectile.netUpdate = true; - if (Projectile.netSpam >= 10) - Projectile.netSpam = 9; + Projectile.ForceNetUpdate(false); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/BlackDragonHead.cs b/Projectiles/Summon/BlackDragonHead.cs index db0b8331bc..3bca4cd7c6 100644 --- a/Projectiles/Summon/BlackDragonHead.cs +++ b/Projectiles/Summon/BlackDragonHead.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Summon Dictionary segments = new Dictionary(); public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -39,8 +40,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.minionSlots = 2; Projectile.minion = true; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 100; } public override void AI() @@ -185,7 +186,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/BlackHawkBullet.cs b/Projectiles/Summon/BlackHawkBullet.cs index e327863c9d..7d43617505 100644 --- a/Projectiles/Summon/BlackHawkBullet.cs +++ b/Projectiles/Summon/BlackHawkBullet.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 44502c4b9f..a3b25021a1 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -304,7 +304,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 36ade4f63d..b486c23676 100644 --- a/Projectiles/Summon/BloodBreath.cs +++ b/Projectiles/Summon/BloodBreath.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Summon } public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BloodRain.cs b/Projectiles/Summon/BloodRain.cs index c54f31062a..9d79d29582 100644 --- a/Projectiles/Summon/BloodRain.cs +++ b/Projectiles/Summon/BloodRain.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index ba286dd60e..1a0908f86e 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 3; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Projectile.frameCounter++ > 4) { - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; Projectile.frameCounter = 0; } } @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.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/BoneMatter.cs b/Projectiles/Summon/BoneMatter.cs index a1034d2ec6..5b86428a3d 100644 --- a/Projectiles/Summon/BoneMatter.cs +++ b/Projectiles/Summon/BoneMatter.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.frameCounter++ % 9 == 8) { Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.Kill(); } } diff --git a/Projectiles/Summon/BoneMatter2.cs b/Projectiles/Summon/BoneMatter2.cs index 8ad45c4663..f13ef7e259 100644 --- a/Projectiles/Summon/BoneMatter2.cs +++ b/Projectiles/Summon/BoneMatter2.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.frameCounter % 9 == 8) { Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.Kill(); } } diff --git a/Projectiles/Summon/BrimseekerAuraBall.cs b/Projectiles/Summon/BrimseekerAuraBall.cs index 243c888d82..5579bd266e 100644 --- a/Projectiles/Summon/BrimseekerAuraBall.cs +++ b/Projectiles/Summon/BrimseekerAuraBall.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BrimstoneDartMinion.cs b/Projectiles/Summon/BrimstoneDartMinion.cs index ea5ddd301c..d0161a2496 100644 --- a/Projectiles/Summon/BrimstoneDartMinion.cs +++ b/Projectiles/Summon/BrimstoneDartMinion.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.Other; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,10 +14,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Projectile.Opacity = Utils.GetLerpValue(300f, 285f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 15f, Projectile.timeLeft, true); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -42,12 +43,19 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); } + public override bool? CanHitNPC(NPC target) + { + if (target.type == ModContent.NPCType()) + return false; + return null; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); public override bool PreDraw(ref Color lightColor) { lightColor.R = (byte)(255 * Projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/BrimstoneDartSummon.cs b/Projectiles/Summon/BrimstoneDartSummon.cs index 61cc1c5666..a422cd416c 100644 --- a/Projectiles/Summon/BrimstoneDartSummon.cs +++ b/Projectiles/Summon/BrimstoneDartSummon.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Projectiles.Summon public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneBarrage"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frameCounter++; if (Projectile.frameCounter % 5 == 4) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; Projectile.Opacity = Utils.GetLerpValue(0f, 40f, Projectile.timeLeft, true); @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { lightColor.R = (byte)(255 * Projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index 7abda0562d..9def69225a 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BrimstoneExplosionMinion.cs b/Projectiles/Summon/BrimstoneExplosionMinion.cs index c9c5c3e6cc..2e2db8edf5 100644 --- a/Projectiles/Summon/BrimstoneExplosionMinion.cs +++ b/Projectiles/Summon/BrimstoneExplosionMinion.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BrimstoneFireSummon.cs b/Projectiles/Summon/BrimstoneFireSummon.cs index 166873d105..d3399e3df5 100644 --- a/Projectiles/Summon/BrimstoneFireSummon.cs +++ b/Projectiles/Summon/BrimstoneFireSummon.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs index b547525944..3f6fa09d13 100644 --- a/Projectiles/Summon/BrimstoneFireballMinion.cs +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/BrimstoneLaserSummon.cs b/Projectiles/Summon/BrimstoneLaserSummon.cs index 5c7607822d..4e5fda6383 100644 --- a/Projectiles/Summon/BrimstoneLaserSummon.cs +++ b/Projectiles/Summon/BrimstoneLaserSummon.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index 9ec49d7203..c9feccb7dc 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -29,11 +29,10 @@ namespace CalamityMod.Projectiles.Summon public int ReformingTimer = 25; public bool Reforming = false; public int Time = 0; - public float ProjKnock; public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 28; + Projectile.width = 42; + Projectile.height = 42; Projectile.localNPCHitCooldown = 15; base.SetDefaults(); } @@ -52,10 +51,9 @@ namespace CalamityMod.Projectiles.Summon } public override void MinionAI() { + Projectile.knockBack = 0; // Has custom knockback Time++; - if (Time == 1) - ProjKnock = Projectile.knockBack; - Projectile.knockBack = ProjKnock * (MinionBuffMode ? 2.5f : 1f); + if (ReformingTimer < 25) { Projectile.alpha = 255; @@ -74,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(Main.rand.NextFloat(1.5f, 4f), 0).RotatedBy(rot * Main.rand.NextFloat(3.1f, 9.1f)); Vector2 velOffset = new Vector2(Main.rand.NextFloat(1.5f, 4f), 0).RotatedBy(rot * Main.rand.NextFloat(3.1f, 9.1f)); - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool(3) ? 216 : 207, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool(3) ? 216 : 121, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; dust.velocity = velOffset; dust.scale = Main.rand.NextFloat(1.3f, 1.9f); @@ -115,7 +113,7 @@ namespace CalamityMod.Projectiles.Summon if (MinionBuffMode) // Minion when circling { - Projectile.localNPCHitCooldown = 25; + Projectile.localNPCHitCooldown = 20; Reforming = false; Projectile.alpha = 0; HitCounter = 0; @@ -180,7 +178,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i <= 5; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity, Main.rand.NextBool(3) ? 216 : 207, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.05f, 0.4f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity, Main.rand.NextBool(3) ? 216 : 121, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.05f, 0.4f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); dust.noGravity = true; } SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt with { Pitch = 0.5f }, Projectile.Center); @@ -198,7 +196,7 @@ namespace CalamityMod.Projectiles.Summon float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(Main.rand.NextFloat(0.5f, 2.5f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); Vector2 velOffset = new Vector2(Main.rand.NextFloat(0.5f, 2.5f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool(3) ? 216 : 207, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool(3) ? 216 : 121, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; dust.velocity = velOffset; dust.scale = Main.rand.NextFloat(1.3f, 1.8f); @@ -206,6 +204,14 @@ namespace CalamityMod.Projectiles.Summon HitCounter = 0; } } - public override bool? CanDamage() => Reforming ? false : null; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float damageMult = MinionBuffMode ? 2f : 1; + modifiers.SourceDamage *= damageMult; + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center); + target.MoveNPC(launchVel, (MinionBuffMode ? 5f : 0.5f), false); + } + public override bool MinionContactDamage() => !Reforming; } } diff --git a/Projectiles/Summon/BrittleStarMinion.png b/Projectiles/Summon/BrittleStarMinion.png index 739f28d509..4497bd57e6 100644 Binary files a/Projectiles/Summon/BrittleStarMinion.png and b/Projectiles/Summon/BrittleStarMinion.png differ diff --git a/Projectiles/Summon/CalamarisLamentMinion.cs b/Projectiles/Summon/CalamarisLamentMinion.cs index a52f6bf1ef..dd9d517abe 100644 --- a/Projectiles/Summon/CalamarisLamentMinion.cs +++ b/Projectiles/Summon/CalamarisLamentMinion.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -185,12 +186,7 @@ namespace CalamityMod.Projectiles.Summon SyncVariables(); } - private void SyncVariables() - { - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } - + private void SyncVariables() => Projectile.ForceNetUpdate(); #endregion public override void OnSpawn(IEntitySource source) @@ -209,14 +205,16 @@ namespace CalamityMod.Projectiles.Summon } // The minion will only have contact damage if it's on latching mode. - public override bool? CanDamage() => (State == AIState.Latching) ? null : false; + public override bool MinionContactDamage() => State == AIState.Latching; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); // The minion will do 1.5x damage if it's latched on. public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= CalamarisLament.LatchingDamageMultiplier; public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 b7c6c9e762..56f317b73b 100644 --- a/Projectiles/Summon/CalamarisLamentProjectile.cs +++ b/Projectiles/Summon/CalamarisLamentProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -19,6 +20,7 @@ namespace CalamityMod.Projectiles.Summon { Main.projFrames[Type] = 5; ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 4; ProjectileID.Sets.DrawScreenCheckFluff[Type] = (int)CalamarisLament.EnemyDistanceDetection; @@ -45,8 +47,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = (Projectile.velocity * inertia + Projectile.SafeDirectionTo(TargetShot.Center) * CalamarisLament.ShootingProjectileSpeed) / (inertia + 1f); Projectile.extraUpdates = 1; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } else Projectile.extraUpdates = 0; @@ -71,6 +72,8 @@ namespace CalamityMod.Projectiles.Summon // and hit DoG's head and/or tail reliably and without penetration. public override bool? CanDamage() => Projectile.getRect().Intersects(TargetShot.getRect()) ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnKill(int timeLeft) { for (int i = 0; i < 15; i++) @@ -85,7 +88,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 7c2f5709c4..a7c0bfb1ec 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -19,9 +19,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 3; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -238,8 +239,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index 6b31ab97db..dabd888069 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -13,9 +13,10 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 3; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -232,8 +233,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Summon/CataclysmSummon.cs b/Projectiles/Summon/CataclysmSummon.cs index 2a6fcb532d..8c2597e858 100644 --- a/Projectiles/Summon/CataclysmSummon.cs +++ b/Projectiles/Summon/CataclysmSummon.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Projectiles.Summon public override string Texture => "CalamityMod/NPCs/SupremeCalamitas/SupremeCataclysm"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = false; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = false; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.MinionSacrificable[Type] = false; + ProjectileID.Sets.MinionTargettingFeature[Type] = false; } public override void SetDefaults() @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 7f7d256486..1766bdf8be 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -13,9 +13,10 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 3; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -84,8 +85,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Summon/CatastropheSummon.cs b/Projectiles/Summon/CatastropheSummon.cs index 48198377b8..d44f9b9b8b 100644 --- a/Projectiles/Summon/CatastropheSummon.cs +++ b/Projectiles/Summon/CatastropheSummon.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Projectiles.Summon public override string Texture => "CalamityMod/NPCs/SupremeCalamitas/SupremeCatastrophe"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = false; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = false; + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.MinionSacrificable[Type] = false; + ProjectileID.Sets.MinionTargettingFeature[Type] = false; } public override void SetDefaults() @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 1a93a130b9..79ad9f70d0 100644 --- a/Projectiles/Summon/CausticStaffProjectile.cs +++ b/Projectiles/Summon/CausticStaffProjectile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index 41f4126702..ca75b21aa9 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -220,7 +220,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/CelestialAxeMinion.cs b/Projectiles/Summon/CelestialAxeMinion.cs index ef8d7d91cb..888c97d688 100644 --- a/Projectiles/Summon/CelestialAxeMinion.cs +++ b/Projectiles/Summon/CelestialAxeMinion.cs @@ -15,14 +15,14 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() { - Projectile.width = 52; - Projectile.height = 52; + Projectile.width = 100; + Projectile.height = 110; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -33,6 +33,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minion = true; Projectile.tileCollide = false; Projectile.extraUpdates = 1; + Projectile.scale = 0.75f; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 30; Projectile.DamageType = DamageClass.Summon; @@ -68,14 +69,9 @@ namespace CalamityMod.Projectiles.Summon } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha); - } - public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/CelestialAxeMinion.png b/Projectiles/Summon/CelestialAxeMinion.png index d5862b9ec7..7ac940983f 100644 Binary files a/Projectiles/Summon/CelestialAxeMinion.png and b/Projectiles/Summon/CelestialAxeMinion.png differ diff --git a/Projectiles/Summon/Cinder.cs b/Projectiles/Summon/Cinder.cs index 4ed48a74b7..3645d9f464 100644 --- a/Projectiles/Summon/Cinder.cs +++ b/Projectiles/Summon/Cinder.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/CinderBlossom.cs b/Projectiles/Summon/CinderBlossom.cs index c28866c326..d594e5ff50 100644 --- a/Projectiles/Summon/CinderBlossom.cs +++ b/Projectiles/Summon/CinderBlossom.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon CheckMinionExistince(); // Checks if the minion can still exist. ShootTarget(Target); // Shoots at the target if there's one. - Projectile.Center = Owner.Center - Vector2.UnitY * 60f; + Projectile.Center = Owner.Center - Vector2.UnitY * (60f - Owner.gfxOffY); Projectile.rotation += MathHelper.ToRadians(5f * Owner.direction); // The projectile normally will spin in the direction of the player. Lighting.AddLight(Projectile.Center, Color.Orange.ToVector3()); } diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index bb4b1eacb7..2a8fa900b4 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 8; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs index 45e342e5a3..a26b46828f 100644 --- a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs +++ b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs @@ -13,7 +13,6 @@ using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; using static Terraria.ModLoader.ModContent; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Summon { @@ -72,6 +71,7 @@ namespace CalamityMod.Projectiles.Summon public void Initialize() { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary -- the helper function caps this based on whip range //Initialize the segments SetOrigin(Owner.Calamity().mouseWorld); @@ -107,6 +107,7 @@ namespace CalamityMod.Projectiles.Summon if (Owner.channel) Projectile.timeLeft = FadeoutTime; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary -- the helper function caps this based on whip range SetOrigin(Projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 10f)); SimulateSegments(); @@ -177,7 +178,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), CnidarianPos, velocity, ProjectileType(), (int)(Projectile.damage * ZapDamageMultiplier), Projectile.knockBack, Projectile.owner, targetArray[i], 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), CnidarianPos, velocity, ProjectileType(), (int)(Projectile.damage * ZapDamageMultiplier), Projectile.knockBack, Projectile.owner, targetArray[i], 0f); } } } @@ -199,8 +200,7 @@ namespace CalamityMod.Projectiles.Summon Segments = VerletSimulatedSegment.SimpleSimulation(Segments, SegmentDistance); - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -242,7 +242,7 @@ namespace CalamityMod.Projectiles.Summon PrimitiveRenderer.RenderTrail(segmentPositions, new(PrimWidthFunction, PrimColorFunction), 66); - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 squish = new Vector2(2 - StretchRatio(), StretchRatio()); diff --git a/Projectiles/Summon/CorroslimeMinion.cs b/Projectiles/Summon/CorroslimeMinion.cs index fde825cff4..06d676e565 100644 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ b/Projectiles/Summon/CorroslimeMinion.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -82,8 +82,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 7127930079..3f0975c5ca 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 2; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index 1c2884860e..1ae50a8b9d 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -65,8 +66,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index 46cafc7536..7cc8b704ca 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[rainbowDust].velocity = value3 * 0.66f; Main.dust[rainbowDust].position = Projectile.Center + value3 * 12f; } - if (Main.rand.NextBool(24) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(24) && !Main.dedServ) { int rainbowGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[rainbowGore].velocity *= 0.66f; @@ -59,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon 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) + if (Main.rand.NextBool(10) && !Main.dedServ) { 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/Summon/CosmicEnergySpiral.cs b/Projectiles/Summon/CosmicEnergySpiral.cs index a57cf8ad25..bc06a90b67 100644 --- a/Projectiles/Summon/CosmicEnergySpiral.cs +++ b/Projectiles/Summon/CosmicEnergySpiral.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/CosmicViperConcussionMissile.cs b/Projectiles/Summon/CosmicViperConcussionMissile.cs index 2766a26437..933047d037 100644 --- a/Projectiles/Summon/CosmicViperConcussionMissile.cs +++ b/Projectiles/Summon/CosmicViperConcussionMissile.cs @@ -11,10 +11,10 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/CosmicViperHomingRocket.cs b/Projectiles/Summon/CosmicViperHomingRocket.cs index c5efb9e256..945bfb566d 100644 --- a/Projectiles/Summon/CosmicViperHomingRocket.cs +++ b/Projectiles/Summon/CosmicViperHomingRocket.cs @@ -11,10 +11,11 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -43,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -114,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/CosmicViperSplitRocket1.cs b/Projectiles/Summon/CosmicViperSplitRocket1.cs index 08b5b6355a..6b28bce238 100644 --- a/Projectiles/Summon/CosmicViperSplitRocket1.cs +++ b/Projectiles/Summon/CosmicViperSplitRocket1.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/CosmicViperSplittingRocket.cs b/Projectiles/Summon/CosmicViperSplittingRocket.cs index f439605e5f..47f09be8d6 100644 --- a/Projectiles/Summon/CosmicViperSplittingRocket.cs +++ b/Projectiles/Summon/CosmicViperSplittingRocket.cs @@ -11,10 +11,11 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -163,7 +164,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -194,7 +195,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 8f62806777..747eb5e5c6 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -311,8 +311,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) @@ -326,7 +326,7 @@ namespace CalamityMod.Projectiles.Summon public override void PostDraw(Color lightColor) { Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/CosmicViperGlow").Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Type]; int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Summon/CosmilampBeam.cs b/Projectiles/Summon/CosmilampBeam.cs index 8bc3f2f2bb..68d6b66b8f 100644 --- a/Projectiles/Summon/CosmilampBeam.cs +++ b/Projectiles/Summon/CosmilampBeam.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; @@ -24,9 +25,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 32; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 32; } public override void SetDefaults() @@ -103,6 +105,8 @@ namespace CalamityMod.Projectiles.Summon return MathHelper.Lerp(0f, maxWidth, expansionCompletion); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override bool PreDraw(ref Color lightColor) { Projectile.localAI[0] = 0f; diff --git a/Projectiles/Summon/CosmilampMinion.cs b/Projectiles/Summon/CosmilampMinion.cs index 598b85622b..a3f6adb628 100644 --- a/Projectiles/Summon/CosmilampMinion.cs +++ b/Projectiles/Summon/CosmilampMinion.cs @@ -38,11 +38,12 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + Main.projPet[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 8; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -107,12 +108,12 @@ namespace CalamityMod.Projectiles.Summon public void DecideFrames() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Type]; } public void HoverInPlace() { - Vector2 hoverDestination = Owner.Top + new Vector2(MathHelper.Lerp(-100f, 100f, HoverOffsetInterpolant), -80f); + Vector2 hoverDestination = Owner.Top + Vector2.UnitY * Owner.gfxOffY + new Vector2(MathHelper.Lerp(-100f, 100f, HoverOffsetInterpolant), -80f); hoverDestination.Y += ((float)Math.Sin(MathHelper.TwoPi * HoverOffsetInterpolant + Timer / 50f) * 0.5f + 0.5f) * 40f; // Zoom towards the hover destination. @@ -121,7 +122,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 f4239eba8b..2ce626218e 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/CrimslimeMinion.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -82,8 +82,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = texture2D13.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = texture2D13.Height / Main.projFrames[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/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index de7c9f436c..fa6f533cff 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 2; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index 590cf7215a..67dd230937 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/DaedalusCrystalShot.cs b/Projectiles/Summon/DaedalusCrystalShot.cs index 10f72febfa..8cfb190581 100644 --- a/Projectiles/Summon/DaedalusCrystalShot.cs +++ b/Projectiles/Summon/DaedalusCrystalShot.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/DaedalusGolem.cs b/Projectiles/Summon/DaedalusGolem.cs index 2febf13996..dfcfa3f201 100644 --- a/Projectiles/Summon/DaedalusGolem.cs +++ b/Projectiles/Summon/DaedalusGolem.cs @@ -25,9 +25,9 @@ namespace CalamityMod.Projectiles.Summon public ref float StuckJumpSpeed => ref Projectile.ai[1]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 18; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 18; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Summon #region AI public override void AI() { - Main.projFrames[Projectile.type] = 16; + Main.projFrames[Type] = 16; bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); Owner.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) @@ -221,21 +221,19 @@ namespace CalamityMod.Projectiles.Summon !Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, Owner.position, Owner.width, Owner.height)) { Projectile.velocity.Y = -12f - StuckJumpSpeed; - Projectile.netSpam -= 10; StuckJumpSpeed += 3.5f; StuckJumpSpeed = Utils.Clamp(StuckJumpSpeed, 0f, 14f); StuckWalkThroughWallsTimer += 10f; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } else if (tilesSearchedAhead > 0) { Projectile.velocity.X = 7f; Projectile.velocity.Y = -(5f + tilesSearchedAhead * 2f); - Projectile.netSpam -= 10; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } else { diff --git a/Projectiles/Summon/DaedalusLightning.cs b/Projectiles/Summon/DaedalusLightning.cs index 4d6959f07d..23d7b00dda 100644 --- a/Projectiles/Summon/DaedalusLightning.cs +++ b/Projectiles/Summon/DaedalusLightning.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 100; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() diff --git a/Projectiles/Summon/DaedalusPellet.cs b/Projectiles/Summon/DaedalusPellet.cs index 6ff153d027..4589199980 100644 --- a/Projectiles/Summon/DaedalusPellet.cs +++ b/Projectiles/Summon/DaedalusPellet.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } } diff --git a/Projectiles/Summon/DankCreeperMinion.cs b/Projectiles/Summon/DankCreeperMinion.cs index d18311e5fc..98dadc21e2 100644 --- a/Projectiles/Summon/DankCreeperMinion.cs +++ b/Projectiles/Summon/DankCreeperMinion.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs index 887ba13c2f..b965693fe2 100644 --- a/Projectiles/Summon/DazzlingStabber.cs +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -1,8 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; +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; @@ -14,28 +18,32 @@ namespace CalamityMod.Projectiles.Summon public Player Owner => Main.player[Projectile.owner]; public ref float AttackDelay => ref Projectile.ai[0]; public ref float RestOffsetAngle => ref Projectile.ai[1]; + public ref float KnifeType => ref Projectile.ai[2]; // 1 - Crystal, 2 - Stone, 3 - Fire + public Color color1 = Color.White; + public int attackCooldown = 0; + public int attacksDone = 0; + public NPC potentialTarget; + public float moveSmoothing = 50; + public float damageMult = 1; + public Vector2 storedPos; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 25; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = false; // To prevent blade type desync + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() { Projectile.width = 26; - Projectile.height = 58; + Projectile.height = 50; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; + Projectile.minionSlots = 0.333f; Projectile.timeLeft = 90000; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.minion = true; - Projectile.light = 1f; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.DamageType = DamageClass.Summon; @@ -43,19 +51,123 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + switch (KnifeType) + { + case 1: // Crystal + color1 = Color.Orchid; + Projectile.extraUpdates = 1; + damageMult = 0.5f; + Projectile.ArmorPenetration = 40; + break; + case 2: // Rock + color1 = Color.OrangeRed; + Projectile.extraUpdates = 2; + damageMult = 3; + break; + default: // Flame + color1 = Color.Orange; + damageMult = 1; + Projectile.ArmorPenetration = 20; + break; + } + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); ApplyPlayerBuffs(); - UpdateFrames(); - NPC potentialTarget = Projectile.Center.MinionHoming(1100f, Owner); + potentialTarget = Projectile.Center.MinionHoming(1100f, Owner); + + if (potentialTarget != null && attackCooldown == 0 && AttackDelay <= 0) + { + storedPos = potentialTarget.Center; + } if (potentialTarget != null) - SliceTarget(potentialTarget); - else - ReturnToRestingPosition(); - } + { + if (KnifeType == 1 && attacksDone > 0 && Utils.Distance(Projectile.Center, storedPos) < 150 && attackCooldown == 0) + { + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.1f, false, 20, 0.03f, color1 * 0.55f, new Vector2(0.8f, 2.3f), true, false, 0.45f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (KnifeType == 2 && attackCooldown == 0) + { + if (Main.rand.NextBool(4)) + { + Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.8f), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6", false, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.55f, 1.2f), Color.White, Vector2.One, false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + bool memesHatesLists = Main.rand.NextBool(5); + Dust dust = Dust.NewDustPerfect(Projectile.Center, memesHatesLists ? 278 : ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.4f) * Main.rand.NextFloat(1f, 4f)); + dust.noGravity = !memesHatesLists; + dust.scale = Main.rand.NextFloat(0.55f, 1.1f); + dust.color = color1; + } + } + if (KnifeType == 3) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.4f) * Main.rand.NextFloat(2f, 8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.65f, 1f); + dust.color = Color.Goldenrod; + dust.noLightEmittence = true; + Particle spark2 = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.5f) * Main.rand.NextFloat(1f, 5f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 14, Main.rand.NextFloat(0.9f, 1.2f), Color.Gold, new Vector2(0.5f, 1.5f), true, false, 0, false, false, -0.25f); + GeneralParticleHandler.SpawnParticle(spark2); + + for (int i = 0; i < 2; i++) + { + Particle trail = new GlowSparkParticle(Projectile.Center + i * Projectile.velocity * 0.4f, -Projectile.velocity * 0.05f, false, 9, 0.05f, Color.Orange * 0.6f, new Vector2(1, 0.3f), true, false, 0.85f); + GeneralParticleHandler.SpawnParticle(trail); + } + + } + if (attackCooldown == 0) + SliceTarget(potentialTarget); + else + { + manageAttackCooldown(); + } + } + else + { + manageAttackCooldown(); + ReturnToRestingPosition(); + } + } + public void manageAttackCooldown() + { + if (attackCooldown > 0) + { + attackCooldown--; + if (KnifeType == 1) + ReturnToRestingPosition(); + else if (KnifeType == 2) + Projectile.velocity *= 0.96f; + if (attackCooldown == 0) + { + attacksDone = 0; + + if (KnifeType == 1) + { + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.7f, 10); + GeneralParticleHandler.SpawnParticle(orb2); + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.35f, 15, true); + GeneralParticleHandler.SpawnParticle(orb3); + + for (int i = 0; i < 6; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4f, 8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.65f, 1.15f); + dust.color = Color.Orchid; + dust.noLightEmittence = true; + } + } + } + } + } public void ApplyPlayerBuffs() { Owner.AddBuff(ModContent.BuffType(), 3600); @@ -67,22 +179,24 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - - public void UpdateFrames() - { - Projectile.frameCounter++; - if (Projectile.frameCounter % 6 == 0) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; - } - public void SliceTarget(NPC target) { + moveSmoothing = 50; // Don't do anything if the attack delay is still passing. if (AttackDelay > -60f) { AttackDelay--; if (AttackDelay > 0f) + { + if (KnifeType == 1) + { + if (!Projectile.WithinRange(storedPos, 150f)) + Projectile.velocity = Projectile.velocity.RotatedBy(0.1f); + else + Projectile.velocity *= 1.004f; + } return; + } } // Reset the velocity to fly upward if there is very little motion to ensure @@ -91,23 +205,34 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = Vector2.UnitY * -12f; // If close to the target, slow down dramatically. - if (Projectile.velocity.Length() > 5f && Projectile.WithinRange(target.Center, 90f)) + if (Projectile.velocity.Length() > 5f && Projectile.WithinRange(storedPos, 50f)) Projectile.velocity *= 0.93f; // Otherwise, if not close, speed up dramatically. - else if (Projectile.velocity.Length() < 40f) + else if (Projectile.velocity.Length() < (KnifeType == 2 ? 15 : 40f)) Projectile.velocity *= 1.03f; - float angularTurnSpeed = 0.35f; - float angleToTargetCoords = Projectile.AngleTo(target.Center); + float angularTurnSpeed = 0.15f; + float angleToTargetCoords = Projectile.AngleTo(storedPos); - if (!Projectile.WithinRange(target.Center, 200f)) - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(angleToTargetCoords, angularTurnSpeed).ToRotationVector2() * Projectile.velocity.Length(); - - // If not super close to the target but the target is very much in the line of sight of the summon, charge. - if (!Projectile.WithinRange(target.Center, 75f) && Vector2.Dot(Projectile.SafeDirectionTo(target.Center), Projectile.velocity.SafeNormalize(Vector2.Zero)) > 0.85f) + if (KnifeType == 3) { - Projectile.velocity = Projectile.SafeDirectionTo(target.Center) * 36f; + if (!Projectile.WithinRange(storedPos, 50f)) + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(angleToTargetCoords, angularTurnSpeed).ToRotationVector2() * Projectile.velocity.Length(); + } + if (KnifeType == 2) + { + Projectile.velocity = Projectile.SafeDirectionTo(storedPos) * 15f; + } + if (KnifeType == 1) + { + if (!Projectile.WithinRange(storedPos, 400f)) + Projectile.velocity = Projectile.SafeDirectionTo(storedPos) * 20f; + } + // If not super close to the target but the target is very much in the line of sight of the summon, charge. + if (!Projectile.WithinRange(storedPos, 75f) && Vector2.Dot(Projectile.SafeDirectionTo(storedPos), Projectile.velocity.SafeNormalize(Vector2.Zero)) > 0.99f && KnifeType == 3) + { + Projectile.velocity = Projectile.SafeDirectionTo(storedPos) * 36f; AttackDelay = 15f; Projectile.netUpdate = true; @@ -118,46 +243,80 @@ namespace CalamityMod.Projectiles.Summon public void ReturnToRestingPosition() { - Projectile.rotation = Projectile.rotation.AngleTowards(RestOffsetAngle, 0.25f); + if (moveSmoothing > 2) + moveSmoothing--; + Projectile.rotation = Projectile.rotation.AngleTowards(RestOffsetAngle + Main.GlobalTimeWrappedHourly, 0.25f); + + float sine = Math.Abs((float)Math.Sin((Main.GlobalTimeWrappedHourly + RestOffsetAngle * 1.8f) * 8f / MathHelper.Pi)); // Rapidly approach the resting position. - Vector2 destination = Owner.Center + Vector2.UnitY.RotatedBy(RestOffsetAngle) * -120f; - Projectile.velocity = (destination - Projectile.Center) / 10f; + Vector2 destination = Owner.Center + Vector2.UnitY.RotatedBy(RestOffsetAngle + Main.GlobalTimeWrappedHourly) * -220f * (MathHelper.Lerp(sine, 0.8f, 0.8f)); + Projectile.velocity = (destination - Projectile.Center) / (potentialTarget == null ? moveSmoothing : 18); } - - public override void PostDraw(Color lightColor) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - for (int i = 1; i < Projectile.oldPos.Length; i++) - CalamityUtils.DistanceClamp(ref Projectile.oldPos[i - 1], ref Projectile.oldPos[i], 6f); - - Texture2D trailSegmentTexture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; - for (int i = 2; i < Projectile.oldPos.Length; i++) + if (KnifeType == 1) { - float completionRatio = i / (float)Projectile.oldPos.Length; - float rotation = (Projectile.oldPos[i - 1] - Projectile.oldPos[i]).ToRotation() + MathHelper.PiOver2; - float scale = MathHelper.Lerp(0.7f, 0.1f, completionRatio) * Projectile.scale; - Color color = Color.Lerp(Color.LightPink, Color.Goldenrod, completionRatio * 3f % 1f) * 1.5f; - - // Become dimmer the slower the projectile is moving. - color *= Utils.GetLerpValue(1f, 8f, Projectile.velocity.Length(), true); - - // As well as how close the projectile is to pointing away from its rotation. - color *= Utils.GetLerpValue(0.65f, 0.45f, Projectile.velocity.AngleBetween(-(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2()) / MathHelper.Pi, true); - - Main.EntitySpriteDraw(trailSegmentTexture, - Projectile.oldPos[i] + Projectile.Size * 0.5f + new Vector2(0f, 8f).RotatedBy(Projectile.rotation) - Main.screenPosition, - null, - color, - rotation, - trailSegmentTexture.Size() * 0.5f, - scale, - SpriteEffects.None, - 0); + AttackDelay = 15; + attacksDone++; + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, Pitch = attacksDone * 0.05f }, Projectile.Center); + if (attacksDone >= 6) + { + for (int i = 0; i < 9; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.5f) * Main.rand.NextFloat(10f, 20f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.25f, 1.75f); + dust.color = Color.Orchid; + dust.noLightEmittence = true; + } + for (int i = 0; i < 4; i++) + { + Particle spark = new CustomSpark(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(15f, 20f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 25, Main.rand.NextFloat(1.35f, 1.6f), Color.Orchid, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.25f, 0.35f)); + GeneralParticleHandler.SpawnParticle(spark); + } + attackCooldown = Main.rand.Next(80, 95 + 1); + } + } + if (KnifeType == 2) + { + SoundStyle slam = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 2); + SoundEngine.PlaySound(slam with { Volume = 0.4f, Pitch = Main.rand.NextFloat(-0.25f, -0.15f), MaxInstances = -1 }, Projectile.Center); + for (int i = 0; i < 7; i++) + { + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 5f), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6", false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(0.75f, 1.2f), Color.White, new Vector2(1.3f, 0.5f), false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile.velocity = (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15).RotatedByRandom(0.7f); + attackCooldown = Main.rand.Next(45, 60 + 1); + } + if (KnifeType == 3) + { + if (attackCooldown == 0) + attackCooldown = 5; + target.AddBuff(ModContent.BuffType(), 180); } } - - 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) + { + modifiers.SourceDamage *= damageMult; + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + public override bool? CanDamage() => attackCooldown == 0 ? null : false; + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + if (KnifeType == 1) + tex = ModContent.Request("CalamityMod/Projectiles/Summon/DazzlingStabber").Value; + if (KnifeType == 2) + tex = ModContent.Request("CalamityMod/Projectiles/Summon/DazzlingStabber2").Value; + if (KnifeType == 3) + tex = ModContent.Request("CalamityMod/Projectiles/Summon/DazzlingStabber3").Value; + + Projectile.DrawProjectileWithBackglow(color1 with { A = 0 }, lightColor, 3.5f, tex); + + return false; + } } } diff --git a/Projectiles/Summon/DazzlingStabber.png b/Projectiles/Summon/DazzlingStabber.png index 0a22d893bf..dad78c0406 100644 Binary files a/Projectiles/Summon/DazzlingStabber.png and b/Projectiles/Summon/DazzlingStabber.png differ diff --git a/Projectiles/Summon/DazzlingStabber2.png b/Projectiles/Summon/DazzlingStabber2.png new file mode 100644 index 0000000000..220b4ce393 Binary files /dev/null and b/Projectiles/Summon/DazzlingStabber2.png differ diff --git a/Projectiles/Summon/DazzlingStabber3.png b/Projectiles/Summon/DazzlingStabber3.png new file mode 100644 index 0000000000..a456db9370 Binary files /dev/null and b/Projectiles/Summon/DazzlingStabber3.png differ diff --git a/Projectiles/Summon/DeathstareBeam.cs b/Projectiles/Summon/DeathstareBeam.cs index 38b884dadb..4c8b737425 100644 --- a/Projectiles/Summon/DeathstareBeam.cs +++ b/Projectiles/Summon/DeathstareBeam.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Projectiles.Summon public ref float OwnerUUID => ref Projectile.ai[0]; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(ref Color lightColor) { - Texture2D beamTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D beamTexture = Terraria.GameContent.TextureAssets.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 fa43a54fce..6ef2b94958 100644 --- a/Projectiles/Summon/DeathstareEyeball.cs +++ b/Projectiles/Summon/DeathstareEyeball.cs @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D eyeTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D eyeTexture = Terraria.GameContent.TextureAssets.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 e92f6098c6..8f9fea1c46 100644 --- a/Projectiles/Summon/DormantBrimseekerAura.cs +++ b/Projectiles/Summon/DormantBrimseekerAura.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index cfa29fec4b..f26f66f14a 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 7; + ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; } public override void SetDefaults() @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Summon { if ((Projectile.ai[0] > 0f && Projectile.ai[0] <= MaxChargeTime && Projectile.velocity.Length() >= 8f) || SeekingTarget) { - Texture2D projectileTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D projectileTexture = Terraria.GameContent.TextureAssets.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[Type] / 2); for (int oldPositionDrawIndex = 6; oldPositionDrawIndex >= 0; oldPositionDrawIndex--) { Color drawColor = Color.Lerp(Color.LightGoldenrodYellow, new Color(142, 24, 67), completionRatio); @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.Summon Rectangle flameFrameRectangle = flameTexture.Frame(1, 4, 0, yFrame); Vector2 flameOrigin = new Vector2(flameTexture.Width / 2, flameTexture.Height / 8 + 14); Main.EntitySpriteDraw(flameTexture, - new Vector2(Projectile.oldPos[oldPositionDrawIndex].X - Main.screenPosition.X + Projectile.width / 2 - projectileTexture.Width * Projectile.scale / 2f + modifiedProjectileTexture.X * Projectile.scale, Projectile.oldPos[oldPositionDrawIndex].Y - Main.screenPosition.Y + Projectile.height - projectileTexture.Height * Projectile.scale / Main.projFrames[Projectile.type] + 4f + modifiedProjectileTexture.Y * Projectile.scale + Projectile.gfxOffY), + new Vector2(Projectile.oldPos[oldPositionDrawIndex].X - Main.screenPosition.X + Projectile.width / 2 - projectileTexture.Width * Projectile.scale / 2f + modifiedProjectileTexture.X * Projectile.scale, Projectile.oldPos[oldPositionDrawIndex].Y - Main.screenPosition.Y + Projectile.height - projectileTexture.Height * Projectile.scale / Main.projFrames[Type] + 4f + modifiedProjectileTexture.Y * Projectile.scale + Projectile.gfxOffY), new Rectangle?(flameFrameRectangle), drawColor, Projectile.oldRot[oldPositionDrawIndex] + Projectile.oldSpriteDirection[oldPositionDrawIndex] * MathHelper.PiOver2, diff --git a/Projectiles/Summon/DormantBrimseekerSummoner.cs b/Projectiles/Summon/DormantBrimseekerSummoner.cs index e9371d0064..3f8591ac99 100644 --- a/Projectiles/Summon/DormantBrimseekerSummoner.cs +++ b/Projectiles/Summon/DormantBrimseekerSummoner.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index d352755434..cf476b8845 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -201,7 +202,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[dust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index ee71f068e6..eb8f33d7f9 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/EXPLODINGFROG.cs b/Projectiles/Summon/EXPLODINGFROG.cs index a52bc47d1c..a54e7caea0 100644 --- a/Projectiles/Summon/EXPLODINGFROG.cs +++ b/Projectiles/Summon/EXPLODINGFROG.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Summon public const float ExplosionAngleVariance = 0.8f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 5; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/EndoBeam.cs b/Projectiles/Summon/EndoBeam.cs index c2e96a448f..54675d40ef 100644 --- a/Projectiles/Summon/EndoBeam.cs +++ b/Projectiles/Summon/EndoBeam.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index 311ac275e6..bab1116e24 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; @@ -18,10 +19,11 @@ namespace CalamityMod.Projectiles.Summon private int laserdirection = 1; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -337,7 +339,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + var dye = Main.player[Projectile.owner]?.cMinion ?? 0; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, armorShaderToUse: dye); return false; } @@ -351,7 +354,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(ModContent.BuffType(), 180); } public override bool? CanDamage() => AttackMode == 2; diff --git a/Projectiles/Summon/EndoCooperLimbs.cs b/Projectiles/Summon/EndoCooperLimbs.cs index 45fd326ec5..80b5efc46f 100644 --- a/Projectiles/Summon/EndoCooperLimbs.cs +++ b/Projectiles/Summon/EndoCooperLimbs.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; @@ -17,10 +18,10 @@ namespace CalamityMod.Projectiles.Summon private int AttackMode = 0; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -128,7 +129,9 @@ namespace CalamityMod.Projectiles.Summon { if (Projectile.ai[0] == 2f) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + + var dye = Main.player[Projectile.owner]?.cMinion ?? 0; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, armorShaderToUse: dye); return false; } @@ -145,7 +148,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(ModContent.BuffType(), 180); } public override bool? CanDamage() => AttackMode == 2; diff --git a/Projectiles/Summon/EndoFire.cs b/Projectiles/Summon/EndoFire.cs index 3b40c7d549..697fa142f3 100644 --- a/Projectiles/Summon/EndoFire.cs +++ b/Projectiles/Summon/EndoFire.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -16,7 +17,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -104,7 +105,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Summon/EndoHydraBody.cs b/Projectiles/Summon/EndoHydraBody.cs index 6d74607809..59dfdbf2f9 100644 --- a/Projectiles/Summon/EndoHydraBody.cs +++ b/Projectiles/Summon/EndoHydraBody.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Projectiles.Summon public const float DistanceToCheck = 2800f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 5; + ProjectileID.Sets.NeedsUUID[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.frameCounter++ > (potentialTarget is null ? 8 : 6)) { - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; Projectile.frameCounter = 0; } diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index 660a10c5a6..cb231e8ac5 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -25,11 +25,11 @@ namespace CalamityMod.Projectiles.Summon } public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon return; } - int totalHeads = CalamityUtils.CountProjectiles(Projectile.type); + int totalHeads = CalamityUtils.CountOwnedProjectiles(Projectile.type, Projectile.owner); if (Projectile.localAI[0] == 0f) { DeltaPosition = DeltaPositionMoving = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); @@ -110,17 +110,17 @@ namespace CalamityMod.Projectiles.Summon { if (Time % 40f == 24f) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 6f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 6f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } if (Time % 40f >= 33f) - Projectile.frame = Main.projFrames[Projectile.type] - 1; + Projectile.frame = Main.projFrames[Type] - 1; else if (Time % 40f >= 27f) - Projectile.frame = Main.projFrames[Projectile.type] - 2; + Projectile.frame = Main.projFrames[Type] - 2; else if (Time % 40f >= 22f) - Projectile.frame = Main.projFrames[Projectile.type] - 3; + Projectile.frame = Main.projFrames[Type] - 3; else if (Time % 40f >= 17f) - Projectile.frame = Main.projFrames[Projectile.type] - 4; + Projectile.frame = Main.projFrames[Type] - 4; Projectile.direction = Projectile.spriteDirection = (player.Center.X - Projectile.Center.X > 0).ToDirectionInt(); if (Math.Abs(player.Center.X - Projectile.Center.X) < 80f) @@ -229,10 +229,10 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(headTexture, Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, - headTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), + headTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), lightColor, Projectile.rotation, Projectile.Size * 0.5f, diff --git a/Projectiles/Summon/EndoRay.cs b/Projectiles/Summon/EndoHydraRay.cs similarity index 81% rename from Projectiles/Summon/EndoRay.cs rename to Projectiles/Summon/EndoHydraRay.cs index 7373b166b2..afc80011de 100644 --- a/Projectiles/Summon/EndoRay.cs +++ b/Projectiles/Summon/EndoHydraRay.cs @@ -1,17 +1,18 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class EndoRay : ModProjectile, ILocalizedModType + public class EndoHydraRay : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -45,5 +46,9 @@ namespace CalamityMod.Projectiles.Summon } } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/Projectiles/Summon/EndoIceShard.cs b/Projectiles/Summon/EndoIceShard.cs index 9d87d5f665..eb4dab939e 100644 --- a/Projectiles/Summon/EndoIceShard.cs +++ b/Projectiles/Summon/EndoIceShard.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -12,9 +13,10 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -118,14 +120,14 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Summon/EnergyOrb.cs b/Projectiles/Summon/EnergyOrb.cs index 5648b09315..6220149128 100644 --- a/Projectiles/Summon/EnergyOrb.cs +++ b/Projectiles/Summon/EnergyOrb.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override string Texture => "CalamityMod/Projectiles/Magic/BlueBubble"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 14; diff --git a/Projectiles/Summon/Evernote.png b/Projectiles/Summon/Evernote.png new file mode 100644 index 0000000000..3a90244254 Binary files /dev/null and b/Projectiles/Summon/Evernote.png differ diff --git a/Projectiles/Summon/EvernoteWall.png b/Projectiles/Summon/EvernoteWall.png new file mode 100644 index 0000000000..f42fc3b140 Binary files /dev/null and b/Projectiles/Summon/EvernoteWall.png differ diff --git a/Projectiles/Summon/EyeOfNightCell.cs b/Projectiles/Summon/EyeOfNightCell.cs index fb4319e683..ffa1a756c0 100644 --- a/Projectiles/Summon/EyeOfNightCell.cs +++ b/Projectiles/Summon/EyeOfNightCell.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/EyeOfNightSummon.cs b/Projectiles/Summon/EyeOfNightSummon.cs index 25b0e139ac..ffeccfa56a 100644 --- a/Projectiles/Summon/EyeOfNightSummon.cs +++ b/Projectiles/Summon/EyeOfNightSummon.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Summon public const int ShootRate = 60; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FieryDraconid.cs b/Projectiles/Summon/FieryDraconid.cs index dcd0a2b075..f93412f81f 100644 --- a/Projectiles/Summon/FieryDraconid.cs +++ b/Projectiles/Summon/FieryDraconid.cs @@ -21,9 +21,10 @@ namespace CalamityMod.Projectiles.Summon public const int FireballShootRate = 20; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 10; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 6; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 6; } @@ -239,8 +240,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 aed0a92082..4230820a80 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -16,71 +18,58 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() { Projectile.width = Projectile.height = 6; Projectile.friendly = true; - Projectile.tileCollide = true; - Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 240; Projectile.DamageType = DamageClass.Summon; } public override void AI() { Player player = Main.player[Projectile.owner]; + NPC potentialTarget = Projectile.Center.MinionHoming(900f, Main.player[Projectile.owner]); + float velPower = Utils.GetLerpValue(2, 5, Projectile.velocity.Length(), true); if (count == 0f) { - SoundEngine.PlaySound(SoundID.Item73, 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(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 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 < 20; j++) - { - 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(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } + count += 1f; } Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int k = 0; k < 5; k++) - { - int otherDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 0.75f); - Main.dust[otherDust].velocity *= 0f; - } + Particle beam = new CustomSpark(Projectile.Center, Projectile.velocity * 0.1f, "CalamityMod/Particles/SmallBloom", false, 8, 0.085f, Color.Lerp(Color.OrangeRed, Color.Goldenrod, Utils.GetLerpValue(270, 230, Projectile.timeLeft)), new Vector2(1f, (1 + 0.8f * velPower)), true, false, 0, false, false, 0.5f * velPower); + GeneralParticleHandler.SpawnParticle(beam); } - NPC potentialTarget = Projectile.Center.MinionHoming(300f, Main.player[Projectile.owner]); - if (potentialTarget != null) - Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 25f) / 21f; + + if (potentialTarget != null && (Projectile.localAI[0] % 100 <= 55 || Projectile.localAI[0] < 20)) + { + Projectile.timeLeft++; // Extend liftime so it doesnt fizzle out so fast while tracking something + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 8f) / 21f; + } + else + Projectile.velocity *= Main.rand.NextFloat(0.96f, 0.97f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override void OnKill(int timeLeft) { - for (int k = 0; k < 5; k++) + for (int j = 0; j < 9; j++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); + Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + c.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.5f) * Main.rand.NextFloat(7, 15); + c.scale = Main.rand.NextFloat(0.9f, 1.1f); + c.noGravity = true; + c.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + c.noLightEmittence = true; } } } diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index 3ddb9ff483..275894d092 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FlarebatMinion.cs b/Projectiles/Summon/FlarebatMinion.cs new file mode 100644 index 0000000000..66e1a5b87b --- /dev/null +++ b/Projectiles/Summon/FlarebatMinion.cs @@ -0,0 +1,224 @@ +using System; +using System.IO; +using CalamityMod.Buffs.Summon; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Summon +{ + public class FlarebatMinion : BaseMinionProjectile + { + public override int AssociatedProjectileTypeID => ProjectileType(); + + public override int AssociatedBuffTypeID => BuffType(); + + public override ref bool AssociatedMinionBool => ref ModdedOwner.FlarebatBool; + + public override bool PreHardmodeMinionTileVision => true; + + public override int AnimationFrames => 8; + + private Vector2 IdlePosition => Owner.MountedCenter + + -Vector2.UnitY.RotatedBy(MathHelper.ToRadians(15f) * (Owner.ownedProjectileCounts[Type] + Owner.ownedProjectileCounts[ProjectileType()] - 1) - MathHelper.ToRadians(30f) * MinionIndex) * 80f; + + private Action CurrentBehavior; + + [Flags] + private enum AttackBehaviorFlags : byte + { + None = 0, + HasDashed = 1, + HasHitTargetOnDash = 2, + IsReturningToOwner = 4, + } + + private AttackBehaviorFlags AttackState; + + public int MinionIndex; + + public override void SetDefaults() + { + base.SetDefaults(); + (Projectile.width, Projectile.height) = (32, 28); + } + + #region AI + + public override void MinionAI() + { + if (Projectile.ai[0] == 0f) + { + CurrentBehavior = IdleBehavior; + FramesUntilNextAnimationFrame = 3; + + int minionIndex = 0; + foreach (var proj in Main.ActiveProjectiles) + { + if ((proj.type != Type && proj.type != ProjectileType()) || proj.owner != Projectile.owner) + continue; + + if (proj.type == Type) + MinionIndex = minionIndex; + else + proj.ModProjectile().MinionIndex = minionIndex; + + minionIndex++; + } + + Projectile.ai[0]++; + } + + CurrentBehavior.Invoke(); + Projectile.rotation = Projectile.rotation.AngleTowards(MathHelper.ToRadians(Projectile.velocity.X * 3f), 0.2f); + Projectile.spriteDirection = MathF.Sign(Projectile.velocity.X); + + if (!Main.dedServ) + { + if (CurrentBehavior == AttackBehavior || (CurrentBehavior == IdleBehavior && Main.rand.NextBool(10))) + { + Dust ambientDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Torch); + ambientDust.noGravity = Main.rand.NextBool(); + ambientDust.noLight = true; + ambientDust.noLightEmittence = true; + } + + Lighting.AddLight(Projectile.Center, Color.OrangeRed.ToVector3() * 0.5f); + } + } + + private void IdleBehavior() + { + if (Target is not null) + { + CurrentBehavior = AttackBehavior; + Projectile.velocity = Projectile.DirectionTo(Target.Center).RotatedByRandom(MathHelper.PiOver2 * 0.7f) * 10f; + return; + } + + Projectile.velocity = Projectile.DirectionTo(IdlePosition) * Utils.Remap(Projectile.DistanceSQ(IdlePosition), 25600f, 0f, 6f, 0f); + Projectile.MinionAntiClump(); + } + + private void AttackBehavior() + { + if (Target is null) + { + CurrentBehavior = IdleBehavior; + return; + } + + // The first stage is redirecting towards the target. + if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Vector2.Dot(Projectile.DirectionTo(Target.Center), Projectile.velocity.SafeNormalize(-Vector2.UnitY)) < 0.96f) + { + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(Target.Center).ToRotation(), 0.08f).ToRotationVector2() * + Utils.Remap(Projectile.DistanceSQ(Target.Center), 6400f, 0f, 12f, 0f); + } + + // When it's whithin a distnce and it hasn't dashed yet, it'll dash. + else if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Projectile.DistanceSQ(Target.Center) < 57600f) + { + Projectile.velocity = Projectile.DirectionTo(Target.Center) * 15f; + AttackState |= AttackBehaviorFlags.HasDashed; + Projectile.netUpdate = true; + + if (!Main.dedServ) + { + Particle dashRing = new DirectionalPulseRing( + Projectile.Center, + Projectile.velocity.SafeNormalize(-Vector2.UnitY) * 5f, + Color.OrangeRed, + new Vector2(0.5f, 1f), + Projectile.velocity.ToRotation(), + 0.04f, + 0.4f, + 30); + GeneralParticleHandler.SpawnParticle(dashRing); + + SoundEngine.PlaySound(SoundID.Item1 with { Pitch = 0.5f, PitchVariance = 0.1f, Volume = 0.6f }, Projectile.Center); + } + } + + // The second stage is after the dash. + // If it has hit the target is was supposed to hit or he missed: + // Return to the owner. + if (AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && !AttackState.HasFlag(AttackBehaviorFlags.IsReturningToOwner)) + { + if (Vector2.Dot(Projectile.DirectionTo(Target.Center), Projectile.velocity.SafeNormalize(-Vector2.UnitY)) < 0f || AttackState.HasFlag(AttackBehaviorFlags.HasHitTargetOnDash)) + { + AttackState |= AttackBehaviorFlags.IsReturningToOwner; + Projectile.netUpdate = true; + } + } + + // The minion will redirect towards its idle position. + // When it has arrived to it at a distance, reset the state and start over. + if (AttackState.HasFlag(AttackBehaviorFlags.IsReturningToOwner)) + { + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(IdlePosition).ToRotation(), 0.08f).ToRotationVector2() * + Utils.Remap(Projectile.DistanceSQ(IdlePosition), 6400f, 0f, 12f, 0f); + + if (Projectile.DistanceSQ(IdlePosition) < 6400f) + { + AttackState = AttackBehaviorFlags.None; + Projectile.netUpdate = true; + } + } + } + + public override bool MinionContactDamage() => true; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && !AttackState.HasFlag(AttackBehaviorFlags.HasHitTargetOnDash) && Target == target) + AttackState |= AttackBehaviorFlags.HasHitTargetOnDash; + + target.AddBuff(BuffID.OnFire, 60); + } + + #endregion + + #region Drawing + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); + Main.EntitySpriteDraw( + texture, + Projectile.Center - Main.screenPosition, + frame, + Color.White * 0.6f, + Projectile.rotation, + frame.Size() * 0.5f, + Projectile.scale, + Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + return false; + } + + #endregion + + #region Syncing + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write7BitEncodedInt(MinionIndex); + writer.Write((byte)AttackState); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + MinionIndex = reader.Read7BitEncodedInt(); + AttackState = (AttackBehaviorFlags)reader.ReadByte(); + } + + #endregion + } +} diff --git a/Projectiles/Summon/FlarebatMinion.png b/Projectiles/Summon/FlarebatMinion.png new file mode 100644 index 0000000000..2a588918c0 Binary files /dev/null and b/Projectiles/Summon/FlarebatMinion.png differ diff --git a/Projectiles/Summon/FleshBallMinion.cs b/Projectiles/Summon/FleshBallMinion.cs index 8997f26b4d..3125b8f324 100644 --- a/Projectiles/Summon/FleshBallMinion.cs +++ b/Projectiles/Summon/FleshBallMinion.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Summon public ref float HopTimer => ref Projectile.ai[0]; public ref float HopAmount => ref Projectile.ai[1]; public bool SittingOnGround => Math.Abs(Projectile.velocity.X) < 1.55f && Projectile.velocity.Y == 0f; - public const float Gravity = 0.25f; + public const float FleshGravity = 0.25f; public const float MaxFallSpeed = 12f; public override void SetStaticDefaults() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon internal void EnforceGravity() { if (Projectile.velocity.Y < MaxFallSpeed) - Projectile.velocity.Y += Gravity; + Projectile.velocity.Y += FleshGravity; } internal void GenerateVisuals() diff --git a/Projectiles/Summon/FleshBlood.cs b/Projectiles/Summon/FleshBlood.cs index cb94a352f8..7729f2a5fd 100644 --- a/Projectiles/Summon/FleshBlood.cs +++ b/Projectiles/Summon/FleshBlood.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FlowersOfMortalityPetal.cs b/Projectiles/Summon/FlowersOfMortalityPetal.cs index 5f4b0f4b04..3ddd3ef53a 100644 --- a/Projectiles/Summon/FlowersOfMortalityPetal.cs +++ b/Projectiles/Summon/FlowersOfMortalityPetal.cs @@ -18,10 +18,11 @@ namespace CalamityMod.Projectiles.Summon public float Hue => OffsetAngle % MathHelper.TwoPi / MathHelper.TwoPi % 1f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projPet[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -61,7 +62,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 shootVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 10f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - Projectile.Center = player.Center + OffsetAngle.ToRotationVector2() * (150f + (float)Math.Sin(Time * 0.08f) * 15f); + Projectile.Center = player.Center + OffsetAngle.ToRotationVector2() * (150f + (float)Math.Sin(Time * 0.08f) * 15f) + Vector2.UnitY * Owner.gfxOffY; Projectile.rotation += MathHelper.ToRadians(7f); OffsetAngle += MathHelper.ToRadians(6f); } @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D petalTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D petalTexture = Terraria.GameContent.TextureAssets.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 457566b0c8..11ce13b68c 100644 --- a/Projectiles/Summon/FlyingOrthocera.cs +++ b/Projectiles/Summon/FlyingOrthocera.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame++; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/FlyingOrthoceraStream.cs b/Projectiles/Summon/FlyingOrthoceraStream.cs index 7304b46fb2..b7a9f750ac 100644 --- a/Projectiles/Summon/FlyingOrthoceraStream.cs +++ b/Projectiles/Summon/FlyingOrthoceraStream.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index 23a01694bd..90472d54b1 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -1,6 +1,7 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -12,7 +13,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FrogGore1.cs b/Projectiles/Summon/FrogGore1.cs index ebb7d39b47..7c325f64d6 100644 --- a/Projectiles/Summon/FrogGore1.cs +++ b/Projectiles/Summon/FrogGore1.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FrogGore2.cs b/Projectiles/Summon/FrogGore2.cs index 4fa8ad1efd..7edcfe8e55 100644 --- a/Projectiles/Summon/FrogGore2.cs +++ b/Projectiles/Summon/FrogGore2.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FrogGore3.cs b/Projectiles/Summon/FrogGore3.cs index a2ff4f7b71..aeeccd5a2a 100644 --- a/Projectiles/Summon/FrogGore3.cs +++ b/Projectiles/Summon/FrogGore3.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FrogGore4.cs b/Projectiles/Summon/FrogGore4.cs index 826b8a7745..9e6b404a0c 100644 --- a/Projectiles/Summon/FrogGore4.cs +++ b/Projectiles/Summon/FrogGore4.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FrogGore5.cs b/Projectiles/Summon/FrogGore5.cs index 6dfaba3b8b..59b42510c4 100644 --- a/Projectiles/Summon/FrogGore5.cs +++ b/Projectiles/Summon/FrogGore5.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FrostBeam.cs b/Projectiles/Summon/FrostBeam.cs index 4bea79a3f7..387742cada 100644 --- a/Projectiles/Summon/FrostBeam.cs +++ b/Projectiles/Summon/FrostBeam.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FrostBlossom.cs b/Projectiles/Summon/FrostBlossom.cs index 3c203d287c..c430427aad 100644 --- a/Projectiles/Summon/FrostBlossom.cs +++ b/Projectiles/Summon/FrostBlossom.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/FrostMistFriendly.cs b/Projectiles/Summon/FrostMistFriendly.cs index 35076dce8d..b315063341 100644 --- a/Projectiles/Summon/FrostMistFriendly.cs +++ b/Projectiles/Summon/FrostMistFriendly.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 8; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -98,8 +98,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = texture2D13.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = texture2D13.Height / Main.projFrames[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/FrostbatMinion.cs b/Projectiles/Summon/FrostbatMinion.cs new file mode 100644 index 0000000000..a6de4258f3 --- /dev/null +++ b/Projectiles/Summon/FrostbatMinion.cs @@ -0,0 +1,224 @@ +using System; +using System.IO; +using CalamityMod.Buffs.Summon; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Summon +{ + public class FrostbatMinion : BaseMinionProjectile + { + public override int AssociatedProjectileTypeID => ProjectileType(); + + public override int AssociatedBuffTypeID => BuffType(); + + public override ref bool AssociatedMinionBool => ref ModdedOwner.FrostbatBool; + + public override bool PreHardmodeMinionTileVision => true; + + public override int AnimationFrames => 8; + + private Vector2 IdlePosition => Owner.MountedCenter + + -Vector2.UnitY.RotatedBy(MathHelper.ToRadians(15f) * (Owner.ownedProjectileCounts[Type] + Owner.ownedProjectileCounts[ProjectileType()] - 1) - MathHelper.ToRadians(30f) * MinionIndex) * 80f; + + private Action CurrentBehavior; + + [Flags] + private enum AttackBehaviorFlags : byte + { + None = 0, + HasDashed = 1, + HasHitTargetOnDash = 2, + IsReturningToOwner = 4, + } + + private AttackBehaviorFlags AttackState; + + public int MinionIndex; + + public override void SetDefaults() + { + base.SetDefaults(); + (Projectile.width, Projectile.height) = (32, 28); + } + + #region AI + + public override void MinionAI() + { + if (Projectile.ai[0] == 0f) + { + CurrentBehavior = IdleBehavior; + FramesUntilNextAnimationFrame = 3; + + int minionIndex = 0; + foreach (var proj in Main.ActiveProjectiles) + { + if ((proj.type != Type && proj.type != ProjectileType()) || proj.owner != Projectile.owner) + continue; + + if (proj.type == Type) + MinionIndex = minionIndex; + else + proj.ModProjectile().MinionIndex = minionIndex; + + minionIndex++; + } + + Projectile.ai[0]++; + } + + CurrentBehavior.Invoke(); + Projectile.rotation = Projectile.rotation.AngleTowards(MathHelper.ToRadians(Projectile.velocity.X * 3f), 0.2f); + Projectile.spriteDirection = MathF.Sign(Projectile.velocity.X); + + if (!Main.dedServ) + { + if (CurrentBehavior == AttackBehavior || (CurrentBehavior == IdleBehavior && Main.rand.NextBool(10))) + { + Dust ambientDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch); + ambientDust.noGravity = Main.rand.NextBool(); + ambientDust.noLight = true; + ambientDust.noLightEmittence = true; + } + + Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3() * 0.5f); + } + } + + private void IdleBehavior() + { + if (Target is not null) + { + CurrentBehavior = AttackBehavior; + Projectile.velocity = Projectile.DirectionTo(Target.Center).RotatedByRandom(MathHelper.PiOver2 * 0.7f) * 10f; + return; + } + + Projectile.velocity = Projectile.DirectionTo(IdlePosition) * Utils.Remap(Projectile.DistanceSQ(IdlePosition), 25600f, 0f, 6f, 0f); + Projectile.MinionAntiClump(); + } + + private void AttackBehavior() + { + if (Target is null) + { + CurrentBehavior = IdleBehavior; + return; + } + + // The first stage is redirecting towards the target. + if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Vector2.Dot(Projectile.DirectionTo(Target.Center), Projectile.velocity.SafeNormalize(-Vector2.UnitY)) < 0.96f) + { + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(Target.Center).ToRotation(), 0.08f).ToRotationVector2() * + Utils.Remap(Projectile.DistanceSQ(Target.Center), 6400f, 0f, 8f, 0f); + } + + // When it's whithin a distnce and it hasn't dashed yet, it'll dash. + else if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Projectile.DistanceSQ(Target.Center) < 57600f) + { + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, 18f); + AttackState |= AttackBehaviorFlags.HasDashed; + Projectile.netUpdate = true; + + if (!Main.dedServ) + { + Particle dashRing = new DirectionalPulseRing( + Projectile.Center, + Projectile.velocity.SafeNormalize(-Vector2.UnitY) * 5f, + Color.Cyan, + new Vector2(0.5f, 1f), + Projectile.velocity.ToRotation(), + 0.04f, + 0.4f, + 30); + GeneralParticleHandler.SpawnParticle(dashRing); + + SoundEngine.PlaySound(SoundID.Item1 with { Pitch = 0.5f, PitchVariance = 0.1f, Volume = 0.6f }, Projectile.Center); + } + } + + // The second stage is after the dash. + // If it has hit the target is was supposed to hit or he missed: + // Return to the owner. + if (AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && !AttackState.HasFlag(AttackBehaviorFlags.IsReturningToOwner)) + { + if (Vector2.Dot(Projectile.DirectionTo(Target.Center), Projectile.velocity.SafeNormalize(-Vector2.UnitY)) < 0f || AttackState.HasFlag(AttackBehaviorFlags.HasHitTargetOnDash)) + { + AttackState |= AttackBehaviorFlags.IsReturningToOwner; + Projectile.netUpdate = true; + } + } + + // The minion will redirect towards its idle position. + // When it has arrived to it at a distance, reset the state and start over. + if (AttackState.HasFlag(AttackBehaviorFlags.IsReturningToOwner)) + { + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(IdlePosition).ToRotation(), 0.08f).ToRotationVector2() * + Utils.Remap(Projectile.DistanceSQ(IdlePosition), 6400f, 0f, 8f, 0f); + + if (Projectile.DistanceSQ(IdlePosition) < 6400f) + { + AttackState = AttackBehaviorFlags.None; + Projectile.netUpdate = true; + } + } + } + + public override bool MinionContactDamage() => true; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && !AttackState.HasFlag(AttackBehaviorFlags.HasHitTargetOnDash) && Target == target) + AttackState |= AttackBehaviorFlags.HasHitTargetOnDash; + + target.AddBuff(BuffID.Frostburn, 60); + } + + #endregion + + #region Drawing + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); + Main.EntitySpriteDraw( + texture, + Projectile.Center - Main.screenPosition, + frame, + Color.White * 0.6f, + Projectile.rotation, + frame.Size() * 0.5f, + Projectile.scale, + Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + return false; + } + + #endregion + + #region Syncing + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write7BitEncodedInt(MinionIndex); + writer.Write((byte)AttackState); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + MinionIndex = reader.Read7BitEncodedInt(); + AttackState = (AttackBehaviorFlags)reader.ReadByte(); + } + + #endregion + } +} diff --git a/Projectiles/Summon/FrostbatMinion.png b/Projectiles/Summon/FrostbatMinion.png new file mode 100644 index 0000000000..4533ef027e Binary files /dev/null and b/Projectiles/Summon/FrostbatMinion.png differ diff --git a/Projectiles/Summon/GammaCanister.cs b/Projectiles/Summon/GammaCanister.cs index 6220b6b57f..e42c75fcde 100644 --- a/Projectiles/Summon/GammaCanister.cs +++ b/Projectiles/Summon/GammaCanister.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Projectiles.Summon public const float Gravity = 0.2f; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index 62059832a9..c769643882 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Summon } public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Summon public void PerformInitializationEffects() { - int totalHeads = CalamityUtils.CountProjectiles(Projectile.type); + int totalHeads = CalamityUtils.CountOwnedProjectiles(Projectile.type, Projectile.owner); CurrentPositionOffset = IdealPositionOffset = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); Projectile.netUpdate = true; @@ -136,8 +136,8 @@ namespace CalamityMod.Projectiles.Summon // Open the mouth prior to firing. if (Time % canisterShootRate > canisterShootRate - 20) - Projectile.frame = (int)(Main.projFrames[Projectile.type] * Utils.GetLerpValue(canisterShootRate - 20, canisterShootRate - 4, Time % canisterShootRate, true)); - Projectile.frame %= Main.projFrames[Projectile.type]; + Projectile.frame = (int)(Main.projFrames[Type] * Utils.GetLerpValue(canisterShootRate - 20, canisterShootRate - 4, Time % canisterShootRate, true)); + Projectile.frame %= Main.projFrames[Type]; Vector2 spawnPosition = Projectile.Center; float shootSpeed = MathHelper.Lerp(8f, 29f, Utils.GetLerpValue(90f, 850f, target.Distance(spawnPosition), true)); @@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = (Projectile.velocity * 9f + Projectile.SafeDirectionTo(returnPosition) * flySpeed) / 10f; } - int totalHeads = CalamityUtils.CountProjectiles(Projectile.type); + int totalHeads = CalamityUtils.CountOwnedProjectiles(Projectile.type, Projectile.owner); int moveRate = 40 + totalHeads * 4; // Reset the ideal offset from time to time. @@ -251,10 +251,10 @@ namespace CalamityMod.Projectiles.Summon 0); } - Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(headTexture, Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, - headTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), + headTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), lightColor, Projectile.rotation, Projectile.Size * 0.5f, diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs index 3be0bd40f2..12856293d4 100644 --- a/Projectiles/Summon/GastricBelcher.cs +++ b/Projectiles/Summon/GastricBelcher.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame++; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -303,8 +303,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Summon/GastricBelcherBubble.cs b/Projectiles/Summon/GastricBelcherBubble.cs index d071f10363..8a1aee8724 100644 --- a/Projectiles/Summon/GastricBelcherBubble.cs +++ b/Projectiles/Summon/GastricBelcherBubble.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/GastricBelcherVomit.cs b/Projectiles/Summon/GastricBelcherVomit.cs index 91a23b1890..f5c7e0265a 100644 --- a/Projectiles/Summon/GastricBelcherVomit.cs +++ b/Projectiles/Summon/GastricBelcherVomit.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon texture = ModContent.Request("CalamityMod/Projectiles/Summon/GastricBelcherVomit3").Value; break; default: - texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + texture = Terraria.GameContent.TextureAssets.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 79aa43ef9b..d4f5d8136a 100644 --- a/Projectiles/Summon/GhostFire.cs +++ b/Projectiles/Summon/GhostFire.cs @@ -17,9 +17,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index c79c442c8f..ccc2102d01 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -131,6 +131,7 @@ namespace CalamityMod.Projectiles.Summon ExitChargeModeEarly(player); } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction player.velocity = Vector2.Lerp(player.velocity, Projectile.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * RightIconLungeSpeed, 0.225f); Projectile.rotation = player.velocity.ToRotation() + MathHelper.PiOver2; } @@ -331,7 +332,10 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center); int damage = (int)player.GetTotalDamage().ApplyTo(LaserBaseDamage); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 laserVelocity = (Main.MouseWorld - (Main.player[Projectile.owner].Center + new Vector2(Projectile.spriteDirection == 1 ? 48f : 22f, -28f))).SafeNormalize(Vector2.UnitX * Projectile.spriteDirection); + Projectile deathLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, laserVelocity, diff --git a/Projectiles/Summon/GlacialEmbracePointyThing.cs b/Projectiles/Summon/GlacialEmbracePointyThing.cs index a06cefa7f5..cdba300dd8 100644 --- a/Projectiles/Summon/GlacialEmbracePointyThing.cs +++ b/Projectiles/Summon/GlacialEmbracePointyThing.cs @@ -52,8 +52,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 7; } public override void SetDefaults() @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Summon writer.Write(recharging); writer.Write(circling); writer.Write(circlingPlayer); - writer.Write((double)floatyDistance); + writer.Write(floatyDistance); writer.Write(target is null ? -1 : target.whoAmI); } public override void ReceiveExtraAI(BinaryReader reader) @@ -84,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon recharging = reader.ReadInt32(); circling = reader.ReadBoolean(); circlingPlayer = reader.ReadBoolean(); - floatyDistance = (float)reader.ReadDouble(); + floatyDistance = reader.ReadSingle(); int targ = reader.ReadInt32(); target = targ == -1 ? null : Main.npc[targ]; } @@ -132,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon } if (circlingPlayer) { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; if (Projectile.penetrate == 1) { Projectile.penetrate++; @@ -197,7 +198,7 @@ namespace CalamityMod.Projectiles.Summon { float math = recharging == 0 ? 90f : (300 - recharging) / 3; float regularDistance = math > 90f ? 90f : math; - Projectile.Center = player.Center + Projectile.ai[0].ToRotationVector2() * regularDistance; + Projectile.Center = player.Center + Projectile.ai[0].ToRotationVector2() * regularDistance + Vector2.UnitY * player.gfxOffY; Projectile.rotation = Projectile.ai[0] + (float)Math.Atan(90); Projectile.ai[0] -= MathHelper.ToRadians(4f); NPC target = recharging > 0 ? null : CalamityUtils.MinionHoming(Projectile.Center, 800f, player); @@ -307,7 +308,7 @@ namespace CalamityMod.Projectiles.Summon { if (!circling || (!circlingPlayer && recharging == 0)) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, !circlingPlayer ? 1 : 3); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, !circlingPlayer ? 1 : 3); } return true; } diff --git a/Projectiles/Summon/HallowedStarSummon.cs b/Projectiles/Summon/HallowedStarSummon.cs index c87acbafe7..4bb33d179c 100644 --- a/Projectiles/Summon/HallowedStarSummon.cs +++ b/Projectiles/Summon/HallowedStarSummon.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.alpha = alphaMin; } Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.2f, 16, 1f); Main.gore[idx].velocity *= 0.66f; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon { 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) + if (Main.rand.NextBool(20) && !Main.dedServ) { 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); } @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { Projectile.DrawStarTrail(Color.Purple, Color.White); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[idx].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Summon/HarvestStaffMinion.cs b/Projectiles/Summon/HarvestStaffMinion.cs index 15842a6816..f81a2ebd01 100644 --- a/Projectiles/Summon/HarvestStaffMinion.cs +++ b/Projectiles/Summon/HarvestStaffMinion.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon if (value == AIState.Attack) { Animation = AnimationState.Run; - SoundEngine.PlaySound(_screamSound, Projectile.Center); + SoundEngine.PlaySound(ScreamSound, Projectile.Center); } else if (value == AIState.Idle) Animation = AnimationState.Idle; @@ -154,19 +154,19 @@ namespace CalamityMod.Projectiles.Summon set => Projectile.spriteDirection = Projectile.direction = value; } - private SoundStyle _growSound = new("CalamityMod/Sounds/Custom/PumpkinEmerge", 3); + public static SoundStyle GrowSound = new("CalamityMod/Sounds/Custom/PumpkinEmerge", 3); - private SoundStyle _idleSound = new("CalamityMod/Sounds/Custom/PumpkinIdle", 4); + public static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/PumpkinIdle", 4); - private SoundStyle _idleRareSound = new("CalamityMod/Sounds/Custom/PumpkinRareIdle") { Volume = 0.2f }; + public static SoundStyle IdleRareSound = new("CalamityMod/Sounds/Custom/PumpkinRareIdle") { Volume = 0.2f }; - private SoundStyle _screamSound = new("CalamityMod/Sounds/Custom/PumpkinScream", 2) { Volume = 0.5f }; + public static SoundStyle ScreamSound = new("CalamityMod/Sounds/Custom/PumpkinScream", 2) { Volume = 0.5f }; - private SoundStyle _jumpSound = new("CalamityMod/Sounds/Custom/PumpkinJump"); + public static SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/PumpkinJump"); - private SoundStyle _boomSound = new("CalamityMod/Sounds/Custom/PumpkinExplode", 2) { Volume = 0.6f }; + public static SoundStyle BoomSound = new("CalamityMod/Sounds/Custom/PumpkinExplode", 2) { Volume = 0.6f }; - private SoundStyle _boomSoundGFB = new("CalamityMod/Sounds/Custom/PumpkinExplodeGFB", 2); + public static SoundStyle BoomSoundGFB = new("CalamityMod/Sounds/Custom/PumpkinExplodeGFB", 2); /// /// The owner of this minion. @@ -247,7 +247,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; DoGravity(); DoAnimation(); - NetUpdate(); + Projectile.ForceNetUpdate(); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -325,9 +325,9 @@ namespace CalamityMod.Projectiles.Summon } if (Main.zenithWorld) - SoundEngine.PlaySound(_boomSoundGFB, Projectile.Center); + SoundEngine.PlaySound(BoomSoundGFB, Projectile.Center); else - SoundEngine.PlaySound(_boomSound, Projectile.Center); + SoundEngine.PlaySound(BoomSound, Projectile.Center); } /// @@ -340,7 +340,7 @@ namespace CalamityMod.Projectiles.Summon 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); + SoundEngine.PlaySound(GrowSound, Projectile.Center); } // And when they have completed their jumping out animation, they idle until they find a target. @@ -386,7 +386,7 @@ namespace CalamityMod.Projectiles.Summon 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); + SoundEngine.PlaySound(Main.rand.NextBool(20) ? IdleRareSound : IdleSound, Projectile.Center); } /// @@ -436,7 +436,7 @@ namespace CalamityMod.Projectiles.Summon 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); + SoundEngine.PlaySound(JumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center); } /// @@ -465,7 +465,7 @@ namespace CalamityMod.Projectiles.Summon // 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); + SoundEngine.PlaySound(JumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center); } /// @@ -521,16 +521,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } } - - /// - /// A covenient way to do a while also handling . - /// - public void NetUpdate() - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } - #endregion #region Other Overrides diff --git a/Projectiles/Summon/HarvestStaffSentry.cs b/Projectiles/Summon/HarvestStaffSentry.cs index f4eeecaec9..c8e839e665 100644 --- a/Projectiles/Summon/HarvestStaffSentry.cs +++ b/Projectiles/Summon/HarvestStaffSentry.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 spawnPosition = Projectile.Center + new Vector2(Main.rand.NextFloat(-randomOffset, randomOffset), -80f); MakeSpawnValid(ref spawnPosition); - Projectile.NewProjectileDirect( + Projectile.NewProjectile( Projectile.GetSource_FromThis(), spawnPosition, Vector2.Zero, @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index 3e06fb2e60..c37e9eca65 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - Main.projFrames[Projectile.type] = 19; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + Main.projFrames[Type] = 19; } public override void SetDefaults() @@ -578,7 +578,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int index = Gore.NewGore(Projectile.GetSource_Death(), new Vector2(Projectile.position.X - (float)(Projectile.width / 2), Projectile.position.Y - (float)(Projectile.height / 2)), new Vector2(0.0f, 0.0f), Main.rand.Next(61, 64), Projectile.scale); Main.gore[index].velocity *= 0.1f; diff --git a/Projectiles/Summon/HermitCrabMinion.cs b/Projectiles/Summon/HermitCrabMinion.cs index 924e296129..c40b5a5741 100644 --- a/Projectiles/Summon/HermitCrabMinion.cs +++ b/Projectiles/Summon/HermitCrabMinion.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 9; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 9; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/HerringAI.cs b/Projectiles/Summon/HerringAI.cs index 9e2f1e0400..1c5e8e6087 100644 --- a/Projectiles/Summon/HerringAI.cs +++ b/Projectiles/Summon/HerringAI.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 838e71f4ec..050a280eea 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 8; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Summon public void DoAnimation() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Type]; } public void PointInRightDirection(Projectile origin, NPC target) diff --git a/Projectiles/Summon/Hive.cs b/Projectiles/Summon/Hive.cs index 1c04ec50a5..7f93da745a 100644 --- a/Projectiles/Summon/Hive.cs +++ b/Projectiles/Summon/Hive.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/Hiveling.cs b/Projectiles/Summon/Hiveling.cs index 1bb9860418..5066e2c133 100644 --- a/Projectiles/Summon/Hiveling.cs +++ b/Projectiles/Summon/Hiveling.cs @@ -12,10 +12,11 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.SentryShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() @@ -66,7 +67,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + var dye = Main.player[Projectile.owner]?.cMinion ?? 0; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, armorShaderToUse: dye); return false; } } diff --git a/Projectiles/Summon/HomingGammaBullet.cs b/Projectiles/Summon/HomingGammaBullet.cs index 63313ddecd..55cbf798a7 100644 --- a/Projectiles/Summon/HomingGammaBullet.cs +++ b/Projectiles/Summon/HomingGammaBullet.cs @@ -18,7 +18,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/HowlsHeartCalcifer.cs b/Projectiles/Summon/HowlsHeartCalcifer.cs index b09f42ac20..b82c23fd29 100644 --- a/Projectiles/Summon/HowlsHeartCalcifer.cs +++ b/Projectiles/Summon/HowlsHeartCalcifer.cs @@ -9,9 +9,9 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.LightPet[Projectile.type] = true; + Main.projFrames[Type] = 4; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; } public override void SetDefaults() @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/HowlsHeartFireball.cs b/Projectiles/Summon/HowlsHeartFireball.cs index d343308b61..a0a3af3ecf 100644 --- a/Projectiles/Summon/HowlsHeartFireball.cs +++ b/Projectiles/Summon/HowlsHeartFireball.cs @@ -11,8 +11,9 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index c2d346f8e8..8bfe2b7d4e 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -13,9 +13,9 @@ 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; + Main.projFrames[Type] = 5; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -217,7 +217,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/HowlsHeartTurnipHead.cs b/Projectiles/Summon/HowlsHeartTurnipHead.cs index 73dc75e9a5..5716b53c44 100644 --- a/Projectiles/Summon/HowlsHeartTurnipHead.cs +++ b/Projectiles/Summon/HowlsHeartTurnipHead.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - Main.projPet[Projectile.type] = true; + Main.projFrames[Type] = 5; + Main.projPet[Type] = true; } public override void SetDefaults() @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/HydrothermicVent.cs b/Projectiles/Summon/HydrothermicVent.cs index fb4e86f626..a90d0b2d32 100644 --- a/Projectiles/Summon/HydrothermicVent.cs +++ b/Projectiles/Summon/HydrothermicVent.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index 94aca8ef17..a3c210090f 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Summon { Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, 25f); - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), @@ -154,13 +154,7 @@ namespace CalamityMod.Projectiles.Summon } } - public void SyncVariables() - { - Projectile.netUpdate = true; - if (Projectile.netSpam >= 10) - Projectile.netSpam = 9; - } - + public void SyncVariables() => Projectile.ForceNetUpdate(false); #endregion public override void OnSpawn(IEntitySource source) @@ -185,11 +179,11 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool? CanDamage() => (State == AIState.Ram) ? null : false; + public override bool MinionContactDamage() => State == AIState.Ram; public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; @@ -199,7 +193,7 @@ namespace CalamityMod.Projectiles.Summon AfterimageInterpolant = MathHelper.Clamp(AfterimageInterpolant, 0f, 1f); float AfterimageFade = MathHelper.Lerp(0f, 1f, AfterimageInterpolant); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/IceClasperSummonProjectile.cs b/Projectiles/Summon/IceClasperSummonProjectile.cs index c7c6c17af1..f82d96de31 100644 --- a/Projectiles/Summon/IceClasperSummonProjectile.cs +++ b/Projectiles/Summon/IceClasperSummonProjectile.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Summon public class IceClasperSummonProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/Projectiles/Melee/DarkIceZero"; public override void SetStaticDefaults() { diff --git a/Projectiles/Summon/IceClasperSummonProjectile.png b/Projectiles/Summon/IceClasperSummonProjectile.png deleted file mode 100644 index 98bedb5a00..0000000000 Binary files a/Projectiles/Summon/IceClasperSummonProjectile.png and /dev/null differ diff --git a/Projectiles/Summon/IceSentry.cs b/Projectiles/Summon/IceSentry.cs index e6532ff2ba..204cf095bf 100644 --- a/Projectiles/Summon/IceSentry.cs +++ b/Projectiles/Summon/IceSentry.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 18; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 18; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/IceSentryFrostBolt.cs b/Projectiles/Summon/IceSentryFrostBolt.cs index 6dee2bd3a4..c63cf1ebdf 100644 --- a/Projectiles/Summon/IceSentryFrostBolt.cs +++ b/Projectiles/Summon/IceSentryFrostBolt.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/IceSentryShard.cs b/Projectiles/Summon/IceSentryShard.cs index 05734d51ff..8b2be7394b 100644 --- a/Projectiles/Summon/IceSentryShard.cs +++ b/Projectiles/Summon/IceSentryShard.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void AI() diff --git a/Projectiles/Summon/IgneousBlade.cs b/Projectiles/Summon/IgneousBlade.cs index d0623e72a9..4bff9cf79d 100644 --- a/Projectiles/Summon/IgneousBlade.cs +++ b/Projectiles/Summon/IgneousBlade.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon public bool Firing = false; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 7; } public override void SetDefaults() @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Summon if (!Firing) { const float outwardPosition = 180f; - Projectile.Center = player.Center + Projectile.ai[0].ToRotationVector2() * outwardPosition; + Projectile.Center = player.Center + Projectile.ai[0].ToRotationVector2() * outwardPosition + Vector2.UnitY * player.gfxOffY; Projectile.rotation = Projectile.ai[0] + MathHelper.PiOver2 + MathHelper.PiOver4; Projectile.ai[0] -= MathHelper.ToRadians(4f); } diff --git a/Projectiles/Summon/IgneousBladeStrike.cs b/Projectiles/Summon/IgneousBladeStrike.cs index aa3ec7daa4..6762bec590 100644 --- a/Projectiles/Summon/IgneousBladeStrike.cs +++ b/Projectiles/Summon/IgneousBladeStrike.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/LanternFlame.cs b/Projectiles/Summon/LanternFlame.cs index 2086d4398e..0707bd5bbf 100644 --- a/Projectiles/Summon/LanternFlame.cs +++ b/Projectiles/Summon/LanternFlame.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.SentryShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.SentryShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/LanternSoul.cs b/Projectiles/Summon/LanternSoul.cs index 98817c5858..82211048fc 100644 --- a/Projectiles/Summon/LanternSoul.cs +++ b/Projectiles/Summon/LanternSoul.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/LiliesOfFinalityAriane.cs b/Projectiles/Summon/LiliesOfFinalityAriane.cs index a6e2b0c3bf..7139fe46db 100644 --- a/Projectiles/Summon/LiliesOfFinalityAriane.cs +++ b/Projectiles/Summon/LiliesOfFinalityAriane.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon // 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); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ProjectileType(), Projectile.damage, 0f, Projectile.owner, Projectile.whoAmI); Timer = 0f; } @@ -177,8 +177,7 @@ namespace CalamityMod.Projectiles.Summon Timer++; - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); // If on a dedicated server, don't bother running the visuals and sounds to save resources. if (Main.dedServ) @@ -285,7 +284,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 shootDirection = Projectile.SafeDirectionTo(Target.Center).RotatedByRandom(MathHelper.PiOver4); - Projectile.NewProjectileDirect( + Projectile.NewProjectile( Projectile.GetSource_FromThis(), Projectile.Center, shootDirection * Ariane_BoltProjectileSpeed, @@ -379,7 +378,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D glowTexture = Request(GlowTexture).Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(3, 9, (int)Animation, Projectile.frame); diff --git a/Projectiles/Summon/LiliesOfFinalityBolt.cs b/Projectiles/Summon/LiliesOfFinalityBolt.cs index a51698a541..662b165cf3 100644 --- a/Projectiles/Summon/LiliesOfFinalityBolt.cs +++ b/Projectiles/Summon/LiliesOfFinalityBolt.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 6; } diff --git a/Projectiles/Summon/LiliesOfFinalityElster.cs b/Projectiles/Summon/LiliesOfFinalityElster.cs index 04baf4f098..3d52276011 100644 --- a/Projectiles/Summon/LiliesOfFinalityElster.cs +++ b/Projectiles/Summon/LiliesOfFinalityElster.cs @@ -176,8 +176,7 @@ namespace CalamityMod.Projectiles.Summon Timer++; - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } private void IdleState() @@ -304,7 +303,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 bulletSpawnPosition = Projectile.Center - Vector2.UnitX * 15f * Projectile.spriteDirection; Vector2 bulletVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(bulletSpawnPosition, Target, Elster_BulletProjectileSpeed, Elster_BulletMaxUpdates); - Projectile.NewProjectileDirect( + Projectile.NewProjectile( Projectile.GetSource_FromThis(), bulletSpawnPosition, //Vector2.UnitX * Elster_BulletProjectileSpeed * Projectile.spriteDirection, @@ -403,7 +402,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; diff --git a/Projectiles/Summon/LostSoulGiant.cs b/Projectiles/Summon/LostSoulGiant.cs index 0db6da9464..c50208768b 100644 --- a/Projectiles/Summon/LostSoulGiant.cs +++ b/Projectiles/Summon/LostSoulGiant.cs @@ -14,10 +14,11 @@ namespace CalamityMod.Projectiles.Summon public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.SentryShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() @@ -72,8 +73,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { for (int j = 0; j < Projectile.oldPos.Length / 2; j++) diff --git a/Projectiles/Summon/LostSoulGold.cs b/Projectiles/Summon/LostSoulGold.cs index e21c967adb..c9b0b3853d 100644 --- a/Projectiles/Summon/LostSoulGold.cs +++ b/Projectiles/Summon/LostSoulGold.cs @@ -14,10 +14,11 @@ namespace CalamityMod.Projectiles.Summon public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.SentryShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() @@ -43,8 +44,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { for (int j = 0; j < Projectile.oldPos.Length / 2; j++) diff --git a/Projectiles/Summon/LostSoulLarge.cs b/Projectiles/Summon/LostSoulLarge.cs index 91540b2511..819ffc07be 100644 --- a/Projectiles/Summon/LostSoulLarge.cs +++ b/Projectiles/Summon/LostSoulLarge.cs @@ -14,10 +14,11 @@ namespace CalamityMod.Projectiles.Summon public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.SentryShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() @@ -44,8 +45,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { for (int j = 0; j < Projectile.oldPos.Length / 2; j++) diff --git a/Projectiles/Summon/LostSoulSmall.cs b/Projectiles/Summon/LostSoulSmall.cs index df8a619ad4..6e2bf53586 100644 --- a/Projectiles/Summon/LostSoulSmall.cs +++ b/Projectiles/Summon/LostSoulSmall.cs @@ -14,10 +14,11 @@ namespace CalamityMod.Projectiles.Summon public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.SentryShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() @@ -43,8 +44,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { for (int j = 0; j < Projectile.oldPos.Length / 2; j++) diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index 044636fc24..4e1654aa79 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -1,5 +1,10 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,99 +15,97 @@ namespace CalamityMod.Projectiles.Summon { public new string LocalizationCategory => "Projectiles.Summon"; private int dust = 3; - + public NPC targeted; + public int attackTime = 0; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() { Projectile.width = 14; - Projectile.height = 14; - Projectile.netImportant = true; + Projectile.height = 46; Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.minionSlots = 0f; - Projectile.timeLeft = 180000; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.timeLeft *= 5; - Projectile.minion = true; + Projectile.penetrate = -1; // 3 + Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.DamageType = DamageClass.Summon; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; } - public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (dust > 0) - { - 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 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; - } - dust--; - } - 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; - } - } - - bool isMinion = Projectile.type == ModContent.ProjectileType(); - if (isMinion) - { - if (!modPlayer.luxorsGift || player.dead) - { - Projectile.Kill(); - } - } - - Projectile.ChargingMinionAI(700f, 1000f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); - + Lighting.AddLight(Projectile.Center, Color.Lime.ToVector3() * 0.35f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) + if (targeted == null || !targeted.active || targeted.life <= 0) + targeted = Projectile.Center.ClosestNPCAt(500); + if (targeted != null && attackTime == 0) { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.8f, 12, 0.93f, 0.99f); + } + if (attackTime > 0) + { + attackTime--; + Projectile.velocity = Projectile.velocity.RotatedBy(0.09f * (Projectile.numHits % 2 == 0 ? -1 : 1)); + if (Projectile.velocity.Length() < 12) + Projectile.velocity *= 1.025f; } - return new Color(255, 255, 255, 100); - } + if (Projectile.timeLeft % 2 == 0) + { + bool sparkly = Main.rand.NextBool(3); + Vector2 dustVel = -(Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), sparkly ? 278 : ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); + dust.noGravity = !sparkly; + dust.scale = Main.rand.NextFloat(0.45f, 0.6f) * (sparkly ? 1.6f : 1); + dust.color = Color.Lime; + dust.noLightEmittence = true; + dust.velocity *= (sparkly ? 1 : 8); + } + + Particle spark = new CustomSpark(Projectile.Center - Projectile.velocity * 0.5f, -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 9, 0.18f, Color.Lime * 0.7f, new Vector2(0.9f, 1.2f), true, false, 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.5f; + int hitsToMinMult = 3; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + attackTime = 45; + + if (Projectile.numHits >= 2) + { + for (int i = 0; i < 12; i++) + { + Vector2 dustVel = -(Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.8f) * Main.rand.NextFloat(6f, 14f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), ModContent.DustType(), dustVel); + dust.noGravity = Main.rand.NextBool(); + dust.scale = Main.rand.NextFloat(0.65f, 1.2f); + dust.color = Color.Lime; + dust.noLightEmittence = true; + } + Projectile.Kill(); + } + } + public override bool? CanHitNPC(NPC target) => (targeted != null && target == targeted && attackTime == 0) ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 8, targetHitbox); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Asset tex = ModContent.Request(Texture); + Color drawColor = Color.Lime; + float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); + + + for (int i = 0; i < 8; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 1f; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Summon/LuxorsGiftSummon.png b/Projectiles/Summon/LuxorsGiftSummon.png index 0c2d362ed3..8a4c550a80 100644 Binary files a/Projectiles/Summon/LuxorsGiftSummon.png and b/Projectiles/Summon/LuxorsGiftSummon.png differ diff --git a/Projectiles/Summon/MK2FlaskSummon.cs b/Projectiles/Summon/MK2FlaskSummon.cs index 13769a795a..019830b134 100644 --- a/Projectiles/Summon/MK2FlaskSummon.cs +++ b/Projectiles/Summon/MK2FlaskSummon.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MK2RocketHoming.cs b/Projectiles/Summon/MK2RocketHoming.cs index 0d1e44946f..89e47ab7bd 100644 --- a/Projectiles/Summon/MK2RocketHoming.cs +++ b/Projectiles/Summon/MK2RocketHoming.cs @@ -11,8 +11,9 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/MK2RocketNormal.cs b/Projectiles/Summon/MK2RocketNormal.cs index 0e785f7f96..4e64dacdbb 100644 --- a/Projectiles/Summon/MK2RocketNormal.cs +++ b/Projectiles/Summon/MK2RocketNormal.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 3; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 071383cb99..b628517c67 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -128,11 +128,7 @@ namespace CalamityMod.Projectiles.Summon // If the head is set to net update every body segment will also update. // This update cannot be blocked by netSpam. if (head.netUpdate) - { - projectile.netUpdate = true; - if (projectile.netSpam > 59) - projectile.netSpam = 59; - } + projectile.ForceNetUpdate(false); projectile.extraUpdates = head.extraUpdates; @@ -193,7 +189,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 d84c7adc57..bf954c8832 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -44,9 +44,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -193,11 +193,7 @@ namespace CalamityMod.Projectiles.Summon // If it changed for some reason, fire a net update. This update cannot be blocked by netSpam. if (previousDirection != Projectile.direction) - { - Projectile.netUpdate = true; - if (Projectile.netSpam > 59) - Projectile.netSpam = 59; - } + Projectile.ForceNetUpdate(false); } private static bool TargetInSafeBoundaries(NPC target) => target?.Center.Between(WorldTopLeft(), WorldBottomRight()) ?? true; @@ -396,7 +392,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 2790acbd81..8237d39a03 100644 --- a/Projectiles/Summon/MechwormLaser.cs +++ b/Projectiles/Summon/MechwormLaser.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index 703902e240..3e4257fb5f 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 97406ecd5d..913d734f22 100644 --- a/Projectiles/Summon/MechwormTeleportRift.cs +++ b/Projectiles/Summon/MechwormTeleportRift.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon public ref float GeneralRotationalOffset => ref Projectile.ai[0]; public override void SetStaticDefaults() { - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Type] = true; } public override void SetDefaults() @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 23e4f18854..25a08a7c8e 100644 --- a/Projectiles/Summon/MidnightSunBeaconProj.cs +++ b/Projectiles/Summon/MidnightSunBeaconProj.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MidnightSunBeam.cs b/Projectiles/Summon/MidnightSunBeam.cs index f921c8feae..a6fef63506 100644 --- a/Projectiles/Summon/MidnightSunBeam.cs +++ b/Projectiles/Summon/MidnightSunBeam.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MidnightSunShot.cs b/Projectiles/Summon/MidnightSunShot.cs index 372bad85f1..94f9863b41 100644 --- a/Projectiles/Summon/MidnightSunShot.cs +++ b/Projectiles/Summon/MidnightSunShot.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Summon public static int MaxUpdate = 4; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 1; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 1; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index 0f3c40a5d9..c809587298 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -3,8 +3,10 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -17,10 +19,9 @@ namespace CalamityMod.Projectiles.Summon public ref float Timer => ref Projectile.ai[0]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.SentryShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -77,7 +78,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -137,7 +138,21 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + Color trailColor = Color.Lerp(drawColor, Color.Transparent, i / (float)Projectile.oldPos.Length); + Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.EntitySpriteDraw(tex, trailPos, frame, trailColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, drawColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 26db5b6ad2..614db32a4d 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -85,11 +85,11 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -323,9 +323,8 @@ namespace CalamityMod.Projectiles.Summon if (shouldDrawDust) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); var shouldAdjust = !Main.dayTime && buffedAi; - int dustId = ProvUtils.GetDustID(pscState); + int dustId = ProvUtils.GetDustID(!Main.dayTime); for (int i = 0; i < 6; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center + (Projectile.Size / 2f).RotatedBy(Projectile.rotation), dustId); @@ -359,7 +358,6 @@ namespace CalamityMod.Projectiles.Summon // Dynamically update stats here, originalDamage can be found in MiscEffects Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); Projectile.localNPCHitCooldown = SpawnedFromPSC ? 6 : 9; var currentAIState = getAiState; @@ -396,7 +394,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.direction = Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Type]; } // Vanity stuff can't damage @@ -453,7 +451,8 @@ namespace CalamityMod.Projectiles.Summon // Has afterimages if maximum empowerment if (!ForcedVanity && SpawnedFromPSC) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + var dye = Owner?.cMinion ?? 0; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, armorShaderToUse: dye); return false; } return true; diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 7f05149aa0..5ec0668b23 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Summon } //dust and framing Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Type]; var psc = Owner.Calamity().profanedCrystal; if (psc && !SpawnedFromPSC || !psc && SpawnedFromPSC) @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 dustPos = new Vector2(Owner.Center.X + Main.rand.NextFloat(-10, 10), Owner.Center.Y + Main.rand.NextFloat(-10, 10)); Vector2 velocity = (Owner.Center - dustPos).SafeNormalize(Vector2.Zero); velocity *= (Main.dayTime || !SpawnedFromPSC) ? 3f : 6.9f; - var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID((float)((Main.dayTime || !SpawnedFromPSC) ? Providence.BossMode.Day : Providence.BossMode.Night)), velocity, 0, default(Color), 2f); + var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID(!Main.dayTime && SpawnedFromPSC), velocity, 0, default(Color), 2f); if (!Main.dayTime && SpawnedFromPSC) dust.noGravity = true; } @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Summon if (!Main.rand.NextBool(3)) continue; - Dust dust = Dust.NewDustDirect(Owner.position, Owner.width, Owner.height, ProvUtils.GetDustID((float)((Main.dayTime || !SpawnedFromPSC) ? Providence.BossMode.Day : Providence.BossMode.Night))); + Dust dust = Dust.NewDustDirect(Owner.position, Owner.width, Owner.height, ProvUtils.GetDustID(!Main.dayTime && SpawnedFromPSC)); dust.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f); dust.velocity.Y -= Main.rand.NextFloat(1f, 3f); dust.scale = Main.rand.NextFloat(1.15f, 1.45f); @@ -282,7 +282,8 @@ namespace CalamityMod.Projectiles.Summon // Has afterimages if maximum empowerment if (SpawnedFromPSC && !ForcedVanity) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + var dye = Owner?.cMinion ?? 0; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, armorShaderToUse: dye); return false; } return true; diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index bd791dc12e..92b2796588 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public bool isEmpowered => Main.player[Projectile.owner].Calamity().pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered; @@ -314,9 +314,7 @@ 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 dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(!Main.dayTime)); dust.velocity = dustVelocity; dust.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); dust.color = Color.Lerp(Color.LightCoral, Color.White, Projectile.ai[2] / 120 * Main.rand.NextFloat(0.65f, 1f)); @@ -331,7 +329,8 @@ namespace CalamityMod.Projectiles.Summon // Has afterimages if maximum empowerment if (SpawnedFromPSC && !ForcedVanity && Owner.Calamity().pscState == (int)ProfanedSoulCrystalState.Empowered) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + var dye = Owner?.cMinion ?? 0; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, armorShaderToUse: dye); return false; } return true; diff --git a/Projectiles/Summon/MiniGuardianHolyRay.cs b/Projectiles/Summon/MiniGuardianHolyRay.cs index c2fa1521ab..7064b63c4f 100644 --- a/Projectiles/Summon/MiniGuardianHolyRay.cs +++ b/Projectiles/Summon/MiniGuardianHolyRay.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; } public override void SetDefaults() @@ -62,7 +62,6 @@ namespace CalamityMod.Projectiles.Summon Vector2 fireFrom = new Vector2(owner.Center.X, owner.Center.Y); Projectile.position = fireFrom - new Vector2(Projectile.width, Projectile.height) / 2f; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); } else Projectile.Kill(); @@ -107,8 +106,7 @@ namespace CalamityMod.Projectiles.Summon // Fire laser through walls at max length num807 = 2400f; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustType = ProvUtils.GetDustID(pscState); + int dustType = ProvUtils.GetDustID(!Main.dayTime); float amount = 0.5f; Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); // Length of laser, linear interpolation Vector2 vector79 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); @@ -149,8 +147,7 @@ namespace CalamityMod.Projectiles.Summon ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; float num223 = Projectile.localAI[1]; //length of laser - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Color color44 = ProvUtils.GetProjectileColor(pscState, 0) * 0.9f; + Color color44 = ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 0) * 0.9f; Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/MiniGuardianRock.cs b/Projectiles/Summon/MiniGuardianRock.cs index 5f7c775d22..664e157772 100644 --- a/Projectiles/Summon/MiniGuardianRock.cs +++ b/Projectiles/Summon/MiniGuardianRock.cs @@ -4,6 +4,8 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -19,10 +21,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -44,7 +46,6 @@ namespace CalamityMod.Projectiles.Summon { // Dynamically update stats here, originalDamage can be found in MiscEffects Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); // Despawn properly if (Owner.Calamity().pSoulGuardians && Projectile.ai[0] == 0f) @@ -105,6 +106,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { + var dye = Owner?.cMinion ?? 0; bool psc = Owner.Calamity().profanedCrystalBuffs; int rockType = (int)MathHelper.Clamp(Projectile.ai[2], 1f, 6f); ; Texture2D texture = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedRocks" + rockType.ToString()).Value; @@ -122,19 +124,34 @@ namespace CalamityMod.Projectiles.Summon 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 + if (CalamityClientConfig.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) { 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 * mult, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); + color *= mult; + + var drawData = new DrawData(texture, drawPos, frame, color) + { + rotation = Projectile.rotation, + origin = drawOrigin + }; + GameShaders.Armor.Apply(dye, Projectile, drawData); + Main.spriteBatch.Draw(texture, drawPos, frame, color, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); } } else { - Main.spriteBatch.Draw(texture, drawPos, frame, Color.White * mult, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); + var color = Color.White * mult; + var drawData = new DrawData(texture, drawPos, frame, color) + { + rotation = Projectile.rotation, + origin = drawOrigin + }; + GameShaders.Armor.Apply(dye, Projectile, drawData); + Main.spriteBatch.Draw(texture, drawPos, frame, color, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); } return false; diff --git a/Projectiles/Summon/MiniGuardianStars.cs b/Projectiles/Summon/MiniGuardianStars.cs index 2d2092bd96..100c83282d 100644 --- a/Projectiles/Summon/MiniGuardianStars.cs +++ b/Projectiles/Summon/MiniGuardianStars.cs @@ -33,7 +33,6 @@ 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) { @@ -51,7 +50,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; @@ -87,8 +86,7 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.ExpandHitboxBy(50); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustType = ProvUtils.GetDustID(pscState); + int dustType = ProvUtils.GetDustID(!Main.dayTime); for (int d = 0; d < 5; d++) { int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -118,9 +116,6 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitPlayer(Player target, Player.HurtInfo info) { - 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 e3d59bb319..fd1ef345c5 100644 --- a/Projectiles/Summon/MiniSandShark.cs +++ b/Projectiles/Summon/MiniSandShark.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs b/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs index 062b95b202..f7199ae813 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 240bb95b91..6789b67e45 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredder.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredder.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions { Projectile.frameCounter++; if (Projectile.frameCounter % MirrorofKalandra.Vile_BowChargeTime == 0) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } public void ShootTarget() @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/HopeShredderArrow.cs b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs index 5e064d63a7..03367385bd 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Projectile.MaxUpdates = MirrorofKalandra.Vile_ArrowSpeedMult; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public override void AI() { @@ -60,12 +60,12 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs b/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs index 2ac39278e4..34d42f7ebe 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; ProjectileID.Sets.DrawScreenCheckFluff[Type] = 12000; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override void ReceiveExtraAI(BinaryReader reader) { hasTeleported = reader.ReadBoolean(); - ChargeStartingPosition = reader.ReadPackedVector2(); + ChargeStartingPosition = reader.ReadVector2(); } public override void AI() @@ -184,13 +184,13 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; float rotation = (Target is not null) ? Projectile.rotation : Projectile.rotation + MathHelper.PiOver4; - if (CalamityConfig.Instance.Afterimages && Target is not null) + if (CalamityClientConfig.Instance.Afterimages && Target is not null) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs b/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs index 2ddb451933..4cacdd4e90 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs @@ -131,14 +131,14 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; DrawSpin -= MathHelper.ToRadians(MirrorofKalandra.Purple_SpinSpeed); float rotation = (Target is not null) ? DrawSpin : Projectile.rotation + MathHelper.Pi - MathHelper.PiOver4; - if (CalamityConfig.Instance.Afterimages && Target is not null) + if (CalamityClientConfig.Instance.Afterimages && Target is not null) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MirrorofKalandraMinions/WindRipper.cs b/Projectiles/Summon/MirrorofKalandraMinions/WindRipper.cs index 9495ba6c3a..3da0112863 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/WindRipper.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/WindRipper.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions { Projectile.frameCounter++; if (Projectile.frameCounter % MirrorofKalandra.Wind_BowChargeTime == 0) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } public void ShootTarget() @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 e972745785..cfd523dd96 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Projectile.MaxUpdates = MirrorofKalandra.Wind_ArrowSpeedMult; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); public override void AI() { @@ -51,12 +51,12 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MoonFist.cs b/Projectiles/Summon/MoonFist.cs index 75f720a819..dec5c356bd 100644 --- a/Projectiles/Summon/MoonFist.cs +++ b/Projectiles/Summon/MoonFist.cs @@ -44,8 +44,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 18; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -203,6 +204,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.netUpdate = true; } + public override bool MinionContactDamage() => true; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { // Rebound on collision. @@ -239,7 +242,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 7b8a3fe0df..bea41c2742 100644 --- a/Projectiles/Summon/MoonFistTeleportVisual.cs +++ b/Projectiles/Summon/MoonFistTeleportVisual.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D telegraphTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D telegraphTexture = Terraria.GameContent.TextureAssets.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 ea0b0a81bd..49e9e13c28 100644 --- a/Projectiles/Summon/MortalityBeam.cs +++ b/Projectiles/Summon/MortalityBeam.cs @@ -15,9 +15,10 @@ namespace CalamityMod.Projectiles.Summon public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MortalityBolt.cs b/Projectiles/Summon/MortalityBolt.cs index 26a6c2fcc0..040465d30e 100644 --- a/Projectiles/Summon/MortalityBolt.cs +++ b/Projectiles/Summon/MortalityBolt.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Summon public Color ProjectileColor => Main.hslToRgb(Projectile.localAI[0], 1f, 0.5f); public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MutatedTruffleMinion.cs b/Projectiles/Summon/MutatedTruffleMinion.cs index 20ca2992a1..6d9da588ec 100644 --- a/Projectiles/Summon/MutatedTruffleMinion.cs +++ b/Projectiles/Summon/MutatedTruffleMinion.cs @@ -244,30 +244,24 @@ namespace CalamityMod.Projectiles.Summon SyncVariables(); } - private void SyncVariables() - { - Projectile.netUpdate = true; - if (Projectile.netSpam >= 10) - Projectile.netSpam = 9; - } - + private void SyncVariables() => Projectile.ForceNetUpdate(false); #endregion - public override bool? CanDamage() => (State == AIState.Dashing) ? null : false; + public override bool MinionContactDamage() => State == AIState.Dashing; // The minion while dashing does 1.25x more damge. public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= 1.25f; public override bool PreDraw(ref Color lightColor) { - Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = TextureAssets.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; float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 && State != AIState.Idle ? MathHelper.Pi : 0f); SpriteEffects effects = (Projectile.spriteDirection == 1) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - if (CalamityConfig.Instance.Afterimages && (State == AIState.Dashing || State == AIState.Vortex)) + if (CalamityClientConfig.Instance.Afterimages && (State == AIState.Dashing || State == AIState.Vortex)) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MutatedTruffleToothball.cs b/Projectiles/Summon/MutatedTruffleToothball.cs index e9e60f2538..a80d5824e1 100644 --- a/Projectiles/Summon/MutatedTruffleToothball.cs +++ b/Projectiles/Summon/MutatedTruffleToothball.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Summon { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/NPCs/OldDuke/OldDukeToothBall"; + public ref float TargetShotID => ref Projectile.ai[0]; public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Type] = true; @@ -64,8 +66,7 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); } - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } } } diff --git a/Projectiles/Summon/MutatedTruffleToothball.png b/Projectiles/Summon/MutatedTruffleToothball.png deleted file mode 100644 index dfed859377..0000000000 Binary files a/Projectiles/Summon/MutatedTruffleToothball.png and /dev/null differ diff --git a/Projectiles/Summon/MutatedTruffleToothballSpike.cs b/Projectiles/Summon/MutatedTruffleToothballSpike.cs index b71cbdcd0f..46b1ae0f5b 100644 --- a/Projectiles/Summon/MutatedTruffleToothballSpike.cs +++ b/Projectiles/Summon/MutatedTruffleToothballSpike.cs @@ -16,7 +16,11 @@ namespace CalamityMod.Projectiles.Summon public const int TimeForHitbox = 15; - public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Type] = true; + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } public override void SetDefaults() { @@ -42,8 +46,7 @@ namespace CalamityMod.Projectiles.Summon { float inertia = 25f; Projectile.velocity = (Projectile.velocity * inertia + Projectile.SafeDirectionTo(TargetShot.Center) * Utils.Remap(Projectile.timeLeft, 600f, 540f, MutatedTruffle.ToothballSpikeSpeed - 15f, MutatedTruffle.ToothballSpikeSpeed)) / (inertia + 1f); - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } } diff --git a/Projectiles/Summon/MutatedTruffleVortex.cs b/Projectiles/Summon/MutatedTruffleVortex.cs index 26d1d065ce..32fcdfe886 100644 --- a/Projectiles/Summon/MutatedTruffleVortex.cs +++ b/Projectiles/Summon/MutatedTruffleVortex.cs @@ -66,8 +66,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnSpawn(IEntitySource source) { Projectile.scale = 0f; - Projectile.netUpdate = true; - Projectile.netSpam = 0; + Projectile.ForceNetUpdate(); } public override bool? CanDamage() diff --git a/Projectiles/Summon/OldDukeHeadCorpse.cs b/Projectiles/Summon/OldDukeHeadCorpse.cs index e546d39384..ea34f9e8aa 100644 --- a/Projectiles/Summon/OldDukeHeadCorpse.cs +++ b/Projectiles/Summon/OldDukeHeadCorpse.cs @@ -1,6 +1,10 @@ using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Skies; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -10,10 +14,11 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 2; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } + public int GFBTimer = 3000; public override void SetDefaults() { Projectile.width = 64; @@ -38,6 +43,91 @@ namespace CalamityMod.Projectiles.Summon target = null; } } + + if (Main.zenithWorld) + { + if (GFBTimer > 0) + { + if (Main.rand.NextBool((int)(400 * Utils.GetLerpValue(0, 2000, GFBTimer)) + 1)) + { + Projectile.velocity += (Vector2.One * 0.3f).RotatedByRandom(100); + SoundStyle heartbeat = new("CalamityMod/Sounds/Item/Heartbeat"); + SoundEngine.PlaySound(heartbeat with { Volume = 0.5f, MaxInstances = -1 }, player.Center); + player.Calamity().GeneralScreenShakePower = 6.5f * Utils.GetLerpValue(600, 0, GFBTimer); + Projectile.velocity *= 0.99f; + } + GFBTimer--; + if (GFBTimer == 0) + { + SoundStyle h = new("CalamityMod/Sounds/Custom/GFB/HeComes"); + SoundEngine.PlaySound(h with { Volume = 1f, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew }, player.Center); + } + } + else + { + bool far = Utils.Distance(player.Center, Projectile.Center) > 2000; + if (Utils.Distance(player.Center, Projectile.Center) > 50 && Projectile.timeLeft % (far ? 2 : 10) == 0) + { + Projectile.scale = 1; + Vector2 moveDir = Utils.DirectionTo(Projectile.Center, player.Center); + Vector2 moveDir2 = (moveDir * (far ? 40 : Main.rand.NextFloat(20f, 25f))).RotatedByRandom(0.4f); + Projectile.Center += moveDir2; + Projectile.velocity += far ? Vector2.Zero : moveDir2 * 0.4f; + for (int j = 0; j < 8; j++) + { + Dust c = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(35, 35), ModContent.DustType()); + c.velocity = -Projectile.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(3, 7); + c.scale = Main.rand.NextFloat(0.5f, 0.7f); + c.noGravity = true; + c.color = Color.Chartreuse; + c.noLightEmittence = true; + } + SoundEngine.PlaySound(SoundID.NPCDeath13 with { Volume = 0.85f, MaxInstances = -1 }, Projectile.Center); + if (far && Projectile.timeLeft % 30 == 0) + { + SoundStyle h = new("CalamityMod/Sounds/Custom/GFB/YouAreNotSafe"); + SoundEngine.PlaySound(h with { Volume = 0.8f, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew }, player.Center); + + Main.NewText(CalamityUtils.GetTextValue("Misc.NotSafe"), Color.Chartreuse); + } + } + else + Projectile.velocity *= 0.9f; + if (Utils.Distance(player.Center, Projectile.Center) < 50) + { + player.AddBuff(BuffID.Obstructed, 30); + player.AddBuff(BuffID.Darkness, 30); + player.AddBuff(ModContent.BuffType(), 15); + + if (player.statLife > 15) + player.statLife = (int)(player.statLife * 0.97f); + + player.velocity *= 0.95f; + player.Center += (Vector2.One * 7).RotatedByRandom(100); + + if (Projectile.timeLeft % 20 == 0) + { + for (int i = 0; i < 4; i++) + { + SoundStyle heartbeat = new("CalamityMod/Sounds/Item/Heartbeat"); + SoundEngine.PlaySound(heartbeat with { Volume = 0.8f, MaxInstances = -1 }, player.Center); + } + player.Calamity().GeneralScreenShakePower = 4.5f; + } + Projectile.Center = player.Center; + SoundEngine.PlaySound(SoundID.NPCDeath20 with { Volume = 0.35f, MaxInstances = -1 }, Projectile.Center); + + if (player.dead) + Projectile.scale *= 1.02f; + else + Projectile.scale = 1; + } + } + + } + + + Projectile.frame = (target != null).ToInt(); if (target != null) { diff --git a/Projectiles/Summon/OldDukeSharkVomit.cs b/Projectiles/Summon/OldDukeSharkVomit.cs index be484f33a8..fd7b640122 100644 --- a/Projectiles/Summon/OldDukeSharkVomit.cs +++ b/Projectiles/Summon/OldDukeSharkVomit.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -103,7 +104,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; } diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index fbaf86c064..a86a9b90d6 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/PhantomicDagger.cs b/Projectiles/Summon/PhantomicDagger.cs index 7ffcd03e5a..114b11ab6c 100644 --- a/Projectiles/Summon/PhantomicDagger.cs +++ b/Projectiles/Summon/PhantomicDagger.cs @@ -14,8 +14,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 7; } public override void SetDefaults() @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Summon int cap = 3; float capDamageFactor = 0.05f; - int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type] - cap; + int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap; modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f); // Bypass a portion of the target's DR @@ -91,9 +92,9 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); } return true; } diff --git a/Projectiles/Summon/PhantomicShield.cs b/Projectiles/Summon/PhantomicShield.cs index 52bcfcef30..e8cde40735 100644 --- a/Projectiles/Summon/PhantomicShield.cs +++ b/Projectiles/Summon/PhantomicShield.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index ffdfa52520..62400663b8 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 0.5f; + Projectile.minionSlots = 1f; Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -67,7 +67,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } Lighting.AddLight(Projectile.Center, 0.3f, 0.2f, 0.3f); - float attackRange = 1200f; bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isMinion) @@ -82,44 +81,48 @@ namespace CalamityMod.Projectiles.Summon } } Projectile.MinionAntiClump(); - bool returnbool = false; - if (returnbool) - { - return; - } + Vector2 projPos = Projectile.position; bool canAttack = false; + float attackRange = 1200f; int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if ((npc.CanBeChasedBy(Projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) + if (npc.CanBeChasedBy(Projectile, false)) { float targetDist = Vector2.Distance(npc.Center, Projectile.Center); - if (!canAttack && targetDist < attackRange) - { - projPos = npc.Center; - canAttack = true; + if (targetDist < attackRange) targetIndex = npc.whoAmI; - } + } + if (targetIndex != -1) + { + canAttack = true; + projPos = npc.Center; } } if (!canAttack) { foreach (NPC nPC2 in Main.ActiveNPCs) { - if (nPC2.CanBeChasedBy(Projectile, false) || nPC2.type == NPCID.DukeFishron) + if (!nPC2.CanBeChasedBy(Projectile)) + continue; + + float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if (targetDist < attackRange) { - float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); - if (!canAttack && targetDist < attackRange) - { - attackRange = targetDist; - projPos = nPC2.Center; - canAttack = true; - targetIndex = nPC2.whoAmI; - } + attackRange = targetDist; + targetIndex = nPC2.whoAmI; + + if (nPC2.type == NPCID.DukeFishron) + break; } } + if (targetIndex != -1) + { + canAttack = true; + projPos = Main.npc[targetIndex].Center; + } } float separationAnxietyDist = 1500f; if (canAttack) @@ -193,10 +196,10 @@ namespace CalamityMod.Projectiles.Summon // Projectile fire timer if (Projectile.ai[1] > 0f) - Projectile.ai[1] += (float)Main.rand.Next(1, 2 + 1); + Projectile.ai[1] += Main.rand.Next(1, 2 + 1); // Reset timer - if (Projectile.ai[1] > 240f) + if (Projectile.ai[1] > 180f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; @@ -236,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 7a163764d3..3bf84e8362 100644 --- a/Projectiles/Summon/PlagueBeeSmall.cs +++ b/Projectiles/Summon/PlagueBeeSmall.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -42,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -157,8 +158,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int drawStart = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Summon/PlaguePrincess.cs b/Projectiles/Summon/PlaguePrincess.cs index d605fc559e..be7f43f5e7 100644 --- a/Projectiles/Summon/PlaguePrincess.cs +++ b/Projectiles/Summon/PlaguePrincess.cs @@ -40,7 +40,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; + Main.projPet[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 8; ProjectileID.Sets.MinionSacrificable[Type] = true; @@ -113,7 +114,7 @@ namespace CalamityMod.Projectiles.Summon public void DecideFrames() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Type]; } public void DoBehavior_HoverNearOwner(NPC potentialTarget) @@ -378,7 +379,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; @@ -400,6 +401,6 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - public override bool? CanDamage() => CurrentState == ViriliAIState.ChargeAtEnemies ? null : false; + public override bool MinionContactDamage() => CurrentState == ViriliAIState.ChargeAtEnemies; } } diff --git a/Projectiles/Summon/PlaguebringerMK2.cs b/Projectiles/Summon/PlaguebringerMK2.cs index 04167de9f5..45bb6d1396 100644 --- a/Projectiles/Summon/PlaguebringerMK2.cs +++ b/Projectiles/Summon/PlaguebringerMK2.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Summon public const float DistanceToCheck = 1000.0001f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index 359b783e52..93401191a7 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/PlantationStaffSeed.cs b/Projectiles/Summon/PlantationStaffSeed.cs index 86f09239fc..6932140534 100644 --- a/Projectiles/Summon/PlantationStaffSeed.cs +++ b/Projectiles/Summon/PlantationStaffSeed.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,7 @@ namespace CalamityMod.Projectiles.Summon public class PlantationStaffSeed : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "Terraria/Images/Projectile_" + ProjectileID.SeedPlantera; public ref float RandomTexture => ref Projectile.ai[0]; @@ -18,6 +20,8 @@ namespace CalamityMod.Projectiles.Summon ProjectileID.Sets.MinionShot[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 3; + if (!Main.dedServ) + Main.instance.LoadProjectile(ProjectileID.PoisonSeedPlantera); } public override void SetDefaults() @@ -54,12 +58,12 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (RandomTexture == 0f) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Summon/PlantationStaffSeed2").Value; + Texture2D texture = (RandomTexture == 0f) ? Terraria.GameContent.TextureAssets.Projectile[ProjectileID.PoisonSeedPlantera].Value : TextureAssets.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; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/PlantationStaffSeed.png b/Projectiles/Summon/PlantationStaffSeed.png deleted file mode 100644 index 14abac4751..0000000000 Binary files a/Projectiles/Summon/PlantationStaffSeed.png and /dev/null differ diff --git a/Projectiles/Summon/PlantationStaffSeed2.png b/Projectiles/Summon/PlantationStaffSeed2.png deleted file mode 100644 index 56d10c0cdd..0000000000 Binary files a/Projectiles/Summon/PlantationStaffSeed2.png and /dev/null differ diff --git a/Projectiles/Summon/PlantationStaffSporeCloud.cs b/Projectiles/Summon/PlantationStaffSporeCloud.cs index d483f5e8d6..d41d8bc0d3 100644 --- a/Projectiles/Summon/PlantationStaffSporeCloud.cs +++ b/Projectiles/Summon/PlantationStaffSporeCloud.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 8e0f6380f5..8c63dbcea8 100644 --- a/Projectiles/Summon/PlantationStaffSummon.cs +++ b/Projectiles/Summon/PlantationStaffSummon.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 8; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; @@ -283,7 +284,7 @@ namespace CalamityMod.Projectiles.Summon int tentacleAmount = 6; for (int tentacleIndex = 0; tentacleIndex < tentacleAmount; tentacleIndex++) - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI, tentacleIndex, Projectile.whoAmI); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI, tentacleIndex, Projectile.whoAmI); SoundEngine.PlaySound(SoundID.Roar with { Volume = .3f, Pitch = 1f, PitchVariance = .1f }, Projectile.Center); } @@ -328,6 +329,8 @@ namespace CalamityMod.Projectiles.Summon #endregion + public override bool MinionContactDamage() => true; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (State == AIState.Ramming) @@ -336,12 +339,12 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; - if (State == AIState.Ramming && CalamityConfig.Instance.Afterimages) + if (State == AIState.Ramming && CalamityClientConfig.Instance.Afterimages) CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/PlantationStaffTentacle.cs b/Projectiles/Summon/PlantationStaffTentacle.cs index a713ee71f3..788c936649 100644 --- a/Projectiles/Summon/PlantationStaffTentacle.cs +++ b/Projectiles/Summon/PlantationStaffTentacle.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Summon { Main.projFrames[Type] = 4; ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 4; } @@ -229,7 +230,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else if (CalamityConfig.Instance.Afterimages) + else if (CalamityClientConfig.Instance.Afterimages) CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return true; diff --git a/Projectiles/Summon/PlantationStaffThornball.cs b/Projectiles/Summon/PlantationStaffThornball.cs index 3ced054594..12f880bae2 100644 --- a/Projectiles/Summon/PlantationStaffThornball.cs +++ b/Projectiles/Summon/PlantationStaffThornball.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/PlateProjectile.cs b/Projectiles/Summon/PlateProjectile.cs index 951280b1a6..a5b13efe10 100644 --- a/Projectiles/Summon/PlateProjectile.cs +++ b/Projectiles/Summon/PlateProjectile.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionShot[Type] = true; + Main.projFrames[Type] = 5; } public override void SetDefaults() diff --git a/Projectiles/Summon/PolypLauncherProjectile.cs b/Projectiles/Summon/PolypLauncherProjectile.cs index d82595cdee..d73745b2f2 100644 --- a/Projectiles/Summon/PolypLauncherProjectile.cs +++ b/Projectiles/Summon/PolypLauncherProjectile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public const float Gravity = 0.4f; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/PolypLauncherSentry.cs b/Projectiles/Summon/PolypLauncherSentry.cs index 74214ad952..1c30e6c755 100644 --- a/Projectiles/Summon/PolypLauncherSentry.cs +++ b/Projectiles/Summon/PolypLauncherSentry.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/PolypLauncherShrapnel.cs b/Projectiles/Summon/PolypLauncherShrapnel.cs index 77b3440b76..28274fc0ff 100644 --- a/Projectiles/Summon/PolypLauncherShrapnel.cs +++ b/Projectiles/Summon/PolypLauncherShrapnel.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { //Changes the texture of the projectile - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 3a0113fe1d..379971a921 100644 --- a/Projectiles/Summon/PowerfulRaven.cs +++ b/Projectiles/Summon/PowerfulRaven.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Summon public const float SeparationAnxietyDistance = 2000f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 5; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.ai[1] % 45f >= 28f) { - Projectile.frame = Main.projFrames[Projectile.type] - 1; + Projectile.frame = Main.projFrames[Type] - 1; Lighting.AddLight(Projectile.Center, 1f, 1f, 1f); } else @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) + if (Projectile.frame >= Main.projFrames[Type] - 1) { Projectile.frame = 0; } @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) + if (Projectile.frame >= Main.projFrames[Type] - 1) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index 66da00abc3..ae5a03e61c 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -1,5 +1,9 @@ using System; +using System.Collections.Generic; using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -14,11 +18,23 @@ namespace CalamityMod.Projectiles.Summon public override string Texture => "CalamityMod/NPCs/NormalNPCs/ImpiousImmolator"; private float count = 0f; + public bool flapping = false; + public NPC targeted; + public int maxTargetDistance = 500; // Since they move, the targeting distance is lower than normal + + public int maxRechargeTime = 180; + + public ref float attackTimer => ref Projectile.ai[0]; + public ref float attackCooldown => ref Projectile.ai[1]; + public int attacks = 0; + public int maxAttacks = 10; + + public int reactTimer = 0; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -36,122 +52,170 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; Projectile.frameCounter++; + flapping = false; if (Projectile.frameCounter > 5) { Projectile.frame++; + if (Projectile.frame == 2) + flapping = true; Projectile.frameCounter = 0; } if (Projectile.frame > 3) { Projectile.frame = 0; } - if (count == 0f) + + if (flapping) + Projectile.velocity += -Vector2.UnitY * 4.6f; + else + Projectile.velocity += Vector2.UnitY * 0.2f; + + // Anticlump + for (int x = 0; x < Main.maxProjectiles; x++) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - for (int i = 0; i < 5; i++) + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Projectile.Center, projectile.Center) <= 70 && projectile.active && projectile.type == Projectile.type && projectile != Projectile) { - int holy = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); - Main.dust[holy].velocity *= 3f; - Main.dust[holy].position = Projectile.Center; - if (Main.rand.NextBool()) + Projectile.velocity += Utils.DirectionFrom(Projectile.Center, projectile.Center) * 0.02f; + } + } + + float rate = Main.GlobalTimeWrappedHourly * 2; + List eColors = new List() + { + Color.Gold, + Color.Khaki + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Lighting.AddLight(Projectile.Center, usedColor.ToVector3() * 0.8f); + + if (targeted == null) // Find target or move closer to the player + { + Vector2 moveDir = Utils.DirectionTo(Projectile.Center, player.Center); + // If there's no target and the player isnt too close, flap closer them a bit (woah non stationary sentry crazy) + if (flapping && Utils.Distance(player.Center, Projectile.Center) > 300) + { + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.3f, Pitch = 0.8f }, Projectile.Center); + Projectile.velocity += (moveDir * Main.rand.NextFloat(3f, 5f)).RotatedByRandom(0.4f); + + for (int j = 0; j < 8; j++) { - Main.dust[holy].scale = 0.5f; - Main.dust[holy].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Dust c = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(35, 35), ModContent.DustType()); + c.velocity = -Projectile.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(3, 7); + c.scale = Main.rand.NextFloat(0.5f, 0.7f); + c.noGravity = true; + c.color = Color.Orchid; + c.noLightEmittence = true; } } - for (int j = 0; j < 10; j++) + + if (reactTimer < 600) { - 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, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - Main.dust[fire].position = Projectile.Center; + if (Utils.Distance(player.Center, Projectile.Center) < 120) + reactTimer++; + } + else + { + SoundStyle happy = new("CalamityMod/Sounds/Item/SanctifiedSparkHappy"); + SoundEngine.PlaySound(happy with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.Center); + for (int i = 0; i < 3; i++) + { + Particle spark = new CustomSpark(Projectile.Center, (-Vector2.UnitY * Main.rand.NextFloat(3f, 5f)).RotatedByRandom(0.6f), "CalamityMod/Particles/HeartParticle", false, 75, Main.rand.NextFloat(1.3f, 1.8f), Color.Lerp(Color.Goldenrod, Color.OrangeRed, i * 0.5f), Vector2.One, true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + reactTimer = Main.rand.Next(0, 120 + 1); + } + + if (player.HasMinionAttackTargetNPC) + { + targeted = Main.npc[player.MinionAttackTargetNPC]; + if (!targeted.CanBeChasedBy(Projectile, false) || Utils.Distance(Projectile.Center, targeted.Center) > maxTargetDistance) + targeted = null; + } + else + { + targeted = Projectile.Center.ClosestNPCAt(maxTargetDistance); + } + + Projectile.spriteDirection = Math.Sign(-moveDir.X); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, 0, 0.05f); + } + if (targeted != null && ((Utils.Distance(Projectile.Center, targeted.Center) > maxTargetDistance) || attackCooldown > 0 || targeted.active == false || targeted.life <= 0)) // Reset targeting if they leave aggro range or are on attack cooldown + { + targeted = null; + } + if (targeted != null) // Attacks + { + reactTimer = Main.rand.Next(0, 120 + 1); + if (Projectile.owner == Main.myPlayer) + { + Vector2 shootVel = Utils.DirectionTo(Projectile.Center, targeted.Center) * 8; + Projectile.spriteDirection = Math.Sign(-shootVel.X); + if (attackTimer <= 0) + { + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (shootVel * Main.rand.NextFloat(0.8f, 1.2f)).RotatedBy(0.75f * (attacks % 2 == 0 ? -1 : 1)).RotatedByRandom(0.4f), ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, Main.rand.NextFloat(0.75f, 1f), 15); + GeneralParticleHandler.SpawnParticle(orb2); + + attackTimer = 8; + attacks++; + } + else + attackTimer--; + + if (attacks >= 18) + { + attackCooldown = maxRechargeTime; + attacks = 0; + } + + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, shootVel.ToRotation() + (Projectile.spriteDirection == -1 ? 0 : MathHelper.ToRadians(180f)), 0.07f); + } + } + if (attackTimer > 0) + attackTimer--; + if (attackCooldown > 0) + { + int healShots = (int)(player.maxMinions / 4); + if (healShots != 0 && attackCooldown != maxRechargeTime && (attackCooldown % (maxRechargeTime / (healShots + 1)) == 0)) + { + Vector2 vel = ((Projectile.Center - player.Center) - player.velocity * 10).SafeNormalize(Vector2.UnitX) * -10; + Projectile healStar = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0, 10, 5); + healStar.extraUpdates = 2; + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(fireHeal with { Volume = 0.7f, Pitch = 0.3f }, Projectile.Center); + + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(54, 209, 54), "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.3f, 24); + GeneralParticleHandler.SpawnParticle(orb2); + } + attackCooldown--; + } + + Projectile.velocity *= 0.97f; + + if (count == 0f) // Spawn effects + { + reactTimer += Main.rand.Next(0, 120 + 1); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + c.velocity = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 15.5f * (i % 2 == 0 ? 0.88f : 1f); + c.scale = Main.rand.NextFloat(1.3f, 1.6f) * 0.8f * (i % 2 == 0 ? 2.2f : 1.8f); + c.noGravity = true; + c.color = Color.Goldenrod; + c.noLightEmittence = true; } count += 1f; } - if (Projectile.owner == Main.myPlayer) - { - if (Projectile.ai[0] != 0f) - { - Projectile.ai[0] -= 1f; - return; - } - bool canAttack = false; - float projX = Projectile.Center.X; - float projY = Projectile.Center.Y; - float attackDistance = 1000f; - int target = 0; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float targetX = npc.Center.X; - float targetY = npc.Center.Y; - float targetDist = Math.Abs(Projectile.Center.X - targetX) + Math.Abs(Projectile.Center.Y - targetY); - if (targetDist < attackDistance && Collision.CanHit(Projectile.Center, Projectile.width, Projectile.height, npc.Center, npc.width, npc.height)) - { - projX = targetX; - projY = targetY; - canAttack = true; - target = npc.whoAmI; - } - } - } - if (!canAttack) - { - foreach (NPC n in Main.ActiveNPCs) - { - if (n.CanBeChasedBy(Projectile, false)) - { - float npcX = n.position.X + (float)(n.width / 2); - float npcY = n.position.Y + (float)(n.height / 2); - float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); - if (npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, n.position, n.width, n.height)) - { - attackDistance = npcDist; - projX = npcX; - projY = npcY; - canAttack = true; - target = n.whoAmI; - } - } - } - } - if (canAttack) - { - float projXStore = projX; - float projYStore = projY; - projX -= Projectile.Center.X; - projY -= Projectile.Center.Y; - if (projX < 0f) - { - Projectile.spriteDirection = 1; - } - else - { - Projectile.spriteDirection = -1; - } - int projectileType = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); - float speed = 25f; - Vector2 fireDirection = Projectile.Center; - float fireXVel = projXStore - fireDirection.X; - float fireYVel = projYStore - fireDirection.Y; - float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); - fireVelocity = speed / fireVelocity; - fireXVel *= fireVelocity; - fireYVel *= fireVelocity; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, fireXVel, fireYVel, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, (float)target, 0f); - - Projectile.ai[0] = 16f; - } - } + } public override bool? CanDamage() => false; diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 5b17d39ef2..2fe43d71ee 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -30,10 +30,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } private void Split(bool hit, bool chaseable) @@ -125,29 +125,26 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustID = ProvUtils.GetDustID(pscState); + int pscState = (int)(Main.dayTime ? Providence.BossMode.Normal : Providence.BossMode.Enraged); + int dustID = ProvUtils.GetDustID(!Main.dayTime); int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; var Owner = Main.player[Projectile.owner]; 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); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - 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]; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 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, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -180,8 +177,7 @@ namespace CalamityMod.Projectiles.Summon Split(false, false); } SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustID = ProvUtils.GetDustID(pscState); + int dustID = ProvUtils.GetDustID(!Main.dayTime); for (int num193 = 0; num193 < 6; num193++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, 1.5f); @@ -210,8 +206,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0.3f; } @@ -243,7 +240,6 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, 0.5f, 0.1f, 0f); var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); if (Projectile.timeLeft == 600) { damage = Projectile.damage; @@ -251,7 +247,7 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.timeLeft > 550) Projectile.velocity *= 0.95f; - int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID((float)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night)), 0f, 0f, 100, default, Main.dayTime ? 1f : 0.75f); + int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID(!Main.dayTime), 0f, 0f, 100, default, Main.dayTime ? 1f : 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; @@ -329,17 +325,15 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - 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]; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 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, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -380,8 +374,7 @@ 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); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -416,8 +409,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0.6f; } @@ -444,7 +437,6 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, 1f, 0.2f, 0f); var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); } public override bool PreAI() @@ -507,9 +499,8 @@ 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, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetProjectileColor(pscState, Projectile.alpha), 1); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Type].Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha), 1); return false; } @@ -524,8 +515,7 @@ 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); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -670,9 +660,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 3; ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0.4f; } @@ -717,7 +707,6 @@ namespace CalamityMod.Projectiles.Summon var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); Projectile.frameCounter++; if (Projectile.frameCounter > 8) @@ -736,8 +725,7 @@ namespace CalamityMod.Projectiles.Summon 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); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; @@ -747,17 +735,15 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - 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]; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Summon/ProfanedCrystalRangedHugesNight").Value; + int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 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, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -792,8 +778,7 @@ 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); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -816,7 +801,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.scale != 1.5f) return; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int num625 = 0; num625 < 3; num625++) { @@ -856,7 +841,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -883,7 +868,6 @@ namespace CalamityMod.Projectiles.Summon { var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); Projectile.frameCounter++; if (Projectile.frameCounter > 4) @@ -922,8 +906,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.height = 50; 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); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -956,16 +939,14 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 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, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -983,6 +964,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0.25f; } public override void SetDefaults() @@ -1006,7 +988,6 @@ namespace CalamityMod.Projectiles.Summon { var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); if (Projectile.timeLeft > 120) { @@ -1309,7 +1290,6 @@ 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[1] == 0f) { @@ -1462,7 +1442,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; ProjectileID.Sets.NoLiquidDistortion[Type] = true; } @@ -1507,9 +1487,7 @@ 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 dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(!Main.dayTime)); dust.velocity = dustVelocity; dust.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); dust.noGravity = true; @@ -1567,7 +1545,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 dustPos = new Vector2(Owner.Center.X + Main.rand.NextFloat(-10, 10), Owner.Center.Y + Main.rand.NextFloat(-10, 10)); Vector2 velocity = (Owner.Center - dustPos).SafeNormalize(Vector2.Zero); velocity *= Main.dayTime ? 3f : 6.9f; - var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID((float)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night)), velocity, 0, default(Color), 2f); + var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID(!Main.dayTime), velocity, 0, default(Color), 2f); if (!Main.dayTime) dust.noGravity = true; } @@ -1583,8 +1561,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; ProjectileID.Sets.NoLiquidDistortion[Type] = true; } @@ -1656,7 +1634,7 @@ namespace CalamityMod.Projectiles.Summon 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); - if (CalamityConfig.Instance.Afterimages) //handle afterimages manually since the utility broke it and didn't render correctly + if (CalamityClientConfig.Instance.Afterimages) //handle afterimages manually since the utility broke it and didn't render correctly { for (int i = 0; i < Projectile.oldPos.Length; ++i) { @@ -1687,6 +1665,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailCacheLength[Type] = 2; ProjectileID.Sets.TrailingMode[Type] = 0; ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0.5f; @@ -1791,12 +1770,10 @@ namespace CalamityMod.Projectiles.Summon { var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); //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(Projectile.position, 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(!Main.dayTime && psc), 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); @@ -1813,9 +1790,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { 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, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetProjectileColor(pscState, Projectile.alpha), 1); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime && psc, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Type].Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], ProvUtils.GetColorBasedOnEnrage(!Main.dayTime && psc, Projectile.alpha), 1); return false; } @@ -1830,9 +1806,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); var psc = Projectile.ai[0] > 0f; - var shouldAdjust = !Main.dayTime && psc; - int pscState = (int)(shouldAdjust ? Providence.BossMode.Night : Providence.BossMode.Day); - int dustID = ProvUtils.GetDustID(pscState); + bool shouldAdjust = !Main.dayTime && psc; + int dustID = ProvUtils.GetDustID(shouldAdjust); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 2f); @@ -1867,10 +1842,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; } private void Split() @@ -1925,27 +1900,23 @@ namespace CalamityMod.Projectiles.Summon { var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID(pscState), 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID(!Main.dayTime), 0f, 0f, 100, default, 1f); 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); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - 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]; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 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, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -1980,8 +1951,7 @@ namespace CalamityMod.Projectiles.Summon Split(); } SoundEngine.PlaySound(HolyBlast.ImpactSound, Projectile.Center); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustID = ProvUtils.GetDustID(pscState); + int dustID = ProvUtils.GetDustID(!Main.dayTime); for (int num193 = 0; num193 < 6; num193++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, Main.dayTime ? 1.5f : 0.5f); @@ -2010,8 +1980,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0.3f; } @@ -2044,7 +2015,6 @@ namespace CalamityMod.Projectiles.Summon var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); - Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); Projectile.frameCounter++; if (Projectile.frameCounter > 6) @@ -2077,17 +2047,15 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - 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]; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 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, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -2102,8 +2070,7 @@ namespace CalamityMod.Projectiles.Summon 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); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { diff --git a/Projectiles/Summon/PuffCloud.cs b/Projectiles/Summon/PuffCloud.cs index a273d0d622..1239e67bef 100644 --- a/Projectiles/Summon/PuffCloud.cs +++ b/Projectiles/Summon/PuffCloud.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 7; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.frameCounter % 4 == 3) { Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.Kill(); } } diff --git a/Projectiles/Summon/PuffWarrior.cs b/Projectiles/Summon/PuffWarrior.cs index 3ca4803c5e..91dc1aa0a2 100644 --- a/Projectiles/Summon/PuffWarrior.cs +++ b/Projectiles/Summon/PuffWarrior.cs @@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 10; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 10; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -108,15 +108,15 @@ namespace CalamityMod.Projectiles.Summon 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; + int startingFrame = Jumping ? Main.projFrames[Type] - 3 : 0; + int endingFrame = Jumping ? Main.projFrames[Type] - 4 : Main.projFrames[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; + startingFrame = Main.projFrames[Type] - 1; + endingFrame = Main.projFrames[Type] - 1; JumpCountdown--; } diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index 6255caab7f..790c60d81a 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -27,15 +27,15 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 0.5f; + Projectile.minionSlots = 1f; Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 8; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() @@ -55,6 +55,19 @@ namespace CalamityMod.Projectiles.Summon } dust--; } + bool isMinion = Projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isMinion) + { + if (player.dead) + { + modPlayer.resButterfly = false; + } + if (modPlayer.resButterfly) + { + Projectile.timeLeft = 2; + } + } if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; @@ -72,26 +85,13 @@ namespace CalamityMod.Projectiles.Summon } Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f); 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) - { - if (player.dead) - { - modPlayer.resButterfly = false; - } - if (modPlayer.resButterfly) - { - Projectile.timeLeft = 2; - } - } } public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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/RustyBeaconPulse.cs b/Projectiles/Summon/RustyBeaconPulse.cs index b562ab9a46..db6d3a5737 100644 --- a/Projectiles/Summon/RustyBeaconPulse.cs +++ b/Projectiles/Summon/RustyBeaconPulse.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Color drawColor = Projectile.GetAlpha(lightColor) * 0.33f; for (int i = 0; i < 8; i++) { diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index be4f3b428f..4435cc6f3d 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 12; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon { // Determine frames. Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; // Hover in place. Projectile.velocity = -Vector2.UnitY * (float)Math.Sin(MathHelper.TwoPi * Projectile.timeLeft / 96f) * 3f; diff --git a/Projectiles/Summon/SageNeedle.cs b/Projectiles/Summon/SageNeedle.cs index d015b5019f..0efecc2a3b 100644 --- a/Projectiles/Summon/SageNeedle.cs +++ b/Projectiles/Summon/SageNeedle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Summon public const int OnDeathHealValue = 1; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/SageSpirit.cs b/Projectiles/Summon/SageSpirit.cs index 467ab93077..c7925c58ac 100644 --- a/Projectiles/Summon/SageSpirit.cs +++ b/Projectiles/Summon/SageSpirit.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Projectiles.Summon internal const int ShootRate = 40; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frameCounter++; if (Projectile.frameCounter % 5 == 4) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } internal void ResetOwnerFlyValues() @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Summon { Vector2 destination = Owner.Center + Vector2.UnitX * Owner.width * 1.6f * Owner.direction; - int totalSageSpirits = Owner.ownedProjectileCounts[Projectile.type]; + int totalSageSpirits = Owner.ownedProjectileCounts[Type]; destination += (SageSpiritIndex * MathHelper.TwoPi / totalSageSpirits).ToRotationVector2() * 70f; if (PlayerFlyTime >= 1f) { @@ -175,7 +175,7 @@ namespace CalamityMod.Projectiles.Summon { AttackTimer++; - int totalSageSpirits = Owner.ownedProjectileCounts[Projectile.type]; + int totalSageSpirits = Owner.ownedProjectileCounts[Type]; Vector2 destinationOffsetFactor = Vector2.Max(target.Size, new Vector2(160f)) * new Vector2(0.3f, 0.2f); Vector2 destination = target.Center + (AttackTimer / 12f).ToRotationVector2() * destinationOffsetFactor; destination += (SageSpiritIndex * MathHelper.TwoPi / totalSageSpirits).ToRotationVector2() * 130f; diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index b1d43958f6..594ec3ea27 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/SandBolt.cs b/Projectiles/Summon/SandBolt.cs index 1a29b4cb0c..409da292f1 100644 --- a/Projectiles/Summon/SandBolt.cs +++ b/Projectiles/Summon/SandBolt.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index f1f2029331..8ec3c83484 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - Main.projPet[Projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + Main.projFrames[Type] = 6; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; } public override void SetDefaults() @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index c748e8c0da..59c7f9c2bf 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 12; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/SandMark.cs b/Projectiles/Summon/SandMark.cs index e48e12b4ff..42213e2c88 100644 --- a/Projectiles/Summon/SandMark.cs +++ b/Projectiles/Summon/SandMark.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -143,8 +143,8 @@ namespace CalamityMod.Projectiles.Summon { 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle rectangle = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture2D27 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle rectangle = texture2D27.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Color alphaColor = Projectile.GetAlpha(originalColor); Vector2 origin7 = rectangle.Size() / 2f; Color sandyColor = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); diff --git a/Projectiles/Summon/SandTornado.cs b/Projectiles/Summon/SandTornado.cs index 0b5b84344e..5a125e9ce1 100644 --- a/Projectiles/Summon/SandTornado.cs +++ b/Projectiles/Summon/SandTornado.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2D23 = Terraria.GameContent.TextureAssets.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 6beba7d3f1..4fcc69068f 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Summon public void DoAnimation() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Type]; } public void Idle() diff --git a/Projectiles/Summon/SarosAura.cs b/Projectiles/Summon/SarosAura.cs index ecb2894157..e626a5ea77 100644 --- a/Projectiles/Summon/SarosAura.cs +++ b/Projectiles/Summon/SarosAura.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.TrailCacheLength[Type] = 8; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon AttackTarget(potentialTarget); // Stay near the target and spin around. - Projectile.Center = Owner.Center - Vector2.UnitY * 16f; + Projectile.Center = Owner.Center - Vector2.UnitY * (16f - Owner.gfxOffY); // The projectile spins right at a constant speed. Projectile.rotation += MathHelper.ToRadians(1.5f); diff --git a/Projectiles/Summon/SarosMicrosun.cs b/Projectiles/Summon/SarosMicrosun.cs index eba68327a0..4e20199930 100644 --- a/Projectiles/Summon/SarosMicrosun.cs +++ b/Projectiles/Summon/SarosMicrosun.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -53,12 +53,12 @@ namespace CalamityMod.Projectiles.Summon public void DoAnimation() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Type]; } public override bool PreDraw(ref Color lightColor) // Makes the afterimages of the disk. { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 4e2cc361ea..d454f593ac 100644 --- a/Projectiles/Summon/SarosSunfire.cs +++ b/Projectiles/Summon/SarosSunfire.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/SeashineSwordProj.cs b/Projectiles/Summon/SeashineSwordProj.cs new file mode 100644 index 0000000000..a138121bc1 --- /dev/null +++ b/Projectiles/Summon/SeashineSwordProj.cs @@ -0,0 +1,321 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Summon; +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.Summon +{ + public class SeashineSwordProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + public Player Owner => Main.player[Projectile.owner]; + public float attackTimer = 0; + public float time = 0; + public bool isSpawning => time < 180; + + public float bladeCharge = 0; // The charge level of the blade, ranges from 0 to 1 + + public Vector2 tipPosition; + public Vector2 savedTipPos = Vector2.Zero; + public bool attackMode => Owner.HeldItem.type == ModContent.ItemType(); // If not holding the weapon, the blades won't charge (no whips for you) + + // Values stored to create blade swing arc + public Vector2 startPos; + public Vector2 endPos; + public bool setPos = true; + + public bool isAttacking = false; // If the blade is in the swinging animation to attack + public bool readySound = true; + public static int baseReturnSpeed = 18; + public int returnSpeed = baseReturnSpeed; // How fast blades retun to you + public float bladeValue = 0; // The delay between each sword swing + public Color mainColor; + + public float bladeChargeSpeed = 0.0015f; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = true; + // Minion targeting feature is not active here since this isn't a normal summon weapon + } + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 34; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 70 * Projectile.MaxUpdates; + Projectile.DamageType = DamageClass.Summon; + Projectile.extraUpdates = 2; + } + + public override void AI() + { + // Color shifting + float rate = (Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 6; + List eColors = new List() + { + Color.RoyalBlue, + Color.Turquoise + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + // This is the delay between each sword swing, the time bewteen gets shorter as you get more swords + // This is so it doesn't take forever for swords to come out when you have a lot of them + bladeValue = (Projectile.ai[1] * (6 / MathHelper.Clamp(Owner.ownedProjectileCounts[Projectile.type] * 0.1f, 1, 1000))) + 10; + + // This checks when the blade is told to attacking to see if it can attack + if (Projectile.ai[0] == 5 && bladeCharge >= 1) + isAttacking = true; + else if (attackTimer == 0) + Projectile.ai[0] = 0; + + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.6f); + ApplyPlayerBuffs(); + + tipPosition = Projectile.Center + (Vector2.UnitX * MathHelper.Clamp(bladeCharge * 103, 0, 2000)).RotatedBy(Projectile.rotation) * Projectile.scale; + Vector2 tipVel = (savedTipPos - tipPosition); + savedTipPos = tipPosition; + + if (isSpawning) // The effects when you first throw out a summon + { + if (time >= 110) // Shine effect when spawning + { + if (time == 110) + { + for (int i = 0; i < 15; i++) + { + Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(7f, 14f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.3f); + dust.color = mainColor; + dust.noLightEmittence = true; + } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ExobladeBeamSlash") with { Volume = 0.45f, Pitch = 0.9f }, Projectile.Center); + for (int i = 0; i < 2; i++) + { + Particle fx = new CustomSpark(tipPosition, (i == 0 ? Vector2.UnitY : Vector2.UnitX).RotatedBy(MathHelper.ToRadians(45)) * 0.01f, "CalamityMod/Particles/ThinEndedLine", false, 18, 1, mainColor, new Vector2(3.3f, 0.6f), extraRotation: 0, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(fx); + } + } + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, -Vector2.UnitY.ToRotation(), 0.1f); + Projectile.velocity *= 0.95f; + } + else // Spinning + { + Projectile.velocity *= 0.96f; + Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.2f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.55f, 0.7f); + dust.color = mainColor; + dust.noLightEmittence = true; + if (time >= 80) + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, -Vector2.UnitY.ToRotation(), 0.09f); + else + Projectile.rotation += 0.15f; + } + bladeCharge = 0.4f; + } + else // The actual active ai for the summon + { + if (isAttacking) // When commanded to attack and is fully charged + { + attackTimer++; + if (attackTimer >= 120 + bladeValue) // Reset values after a swing + { + Projectile.netUpdate = true; + attackTimer = 80; + Projectile.ai[0] = 0; + setPos = true; + isAttacking = false; + readySound = true; + bladeCharge = 0.9f; + Projectile.numHits = 0; + Projectile.scale = 1; + returnSpeed = 460; + } + + if (attackTimer > bladeValue && Projectile.ai[0] != 0) // The actual swing + { + Vector2 toMouse = Utils.DirectionTo(Projectile.Center, Owner.ClampedMouseWorld()); + float lerp = Utils.GetLerpValue(30 + bladeValue, 100 + bladeValue, attackTimer, true); + if (setPos) + { + Projectile.netUpdate = true; + startPos = Projectile.Center; + endPos = Owner.Calamity().mouseWorld + toMouse * 480; + Projectile.numHits = 0; + setPos = false; + } + + Projectile.velocity = (Vector2.Lerp(startPos, endPos, lerp) - Projectile.Center) / returnSpeed; + float angles = 180 * (Projectile.ai[1] % 2 == 0 ? -1 : 1); + float rot = Utils.DirectionTo(startPos, endPos).RotatedBy(MathHelper.Lerp(MathHelper.ToRadians(-angles), MathHelper.ToRadians(angles) / 5, (float)Math.Pow(lerp, 1.5f))).ToRotation(); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, rot, 0.1f); + + } + else // An altered version of the on back code to get them into position to swing + { + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 4 / MathHelper.Pi); + Vector2 bonusPos = (Vector2.UnitY * 6).RotatedBy((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 7); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, Utils.DirectionTo(Owner.Center, Projectile.Center).ToRotation(), 0.05f); + + float destLerp = Utils.GetLerpValue(0, bladeValue, attackTimer, true); + Vector2 destination = Owner.Center + bonusPos + (Vector2.UnitX * Owner.direction).RotatedBy(Projectile.ai[2] * Owner.direction / 2) * (-20 - 330 * (float)Math.Pow(destLerp, 2)); + Projectile.velocity = (destination - Projectile.Center) / (returnSpeed * 0.6f); + } + } + else // Chill on the players back while charging the blade + { + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 4 / MathHelper.Pi); + Vector2 bonusPos = (Vector2.UnitY * 6).RotatedBy((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 7); + + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, Utils.DirectionTo(Owner.Center + Vector2.UnitY * -60, Projectile.Center).ToRotation(), Utils.Remap(returnSpeed, baseReturnSpeed, 460, 0.05f, 0.005f, true)); + + Vector2 destination = Owner.Center + bonusPos - Vector2.UnitY * 40 + (Vector2.UnitX * Owner.direction).RotatedBy(Projectile.ai[2] * Owner.direction / 3) * (-15 - Projectile.ai[1] * 18); + Projectile.velocity = (destination - Projectile.Center) / returnSpeed; + if (bladeCharge < 1f) + bladeCharge += bladeChargeSpeed; + + // The weapon theoretically works with projectile scale, though I ended up not using it + //if (Projectile.scale < 3) + //Projectile.scale += 0.01f; + } + if (readySound && bladeCharge >= 1) // Effect when the blade is fully charged + { + Projectile.netUpdate = true; + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 1f); + dust.color = mainColor; + dust.noLightEmittence = true; + } + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) + Projectile.ai[1] * 0.05f }, Projectile.Center); + readySound = false; + } + } + // This is the tip trail for the blades, it is a very consistently good looking trail, however it creates a LOT of particles + // I do not recommend reusing this effect unless you're using it carefully + if ((returnSpeed == baseReturnSpeed && bladeCharge >= 1 || (isAttacking && attackTimer > bladeValue + 5)) || isSpawning) + { + Particle orb = new CustomSpark(tipPosition, tipVel.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/BloomCircle", false, isAttacking ? 30 : 12, Utils.Remap(tipVel.Length(), 2, 15, 0.15f, 0.3f, true) * Projectile.scale, mainColor * 0.65f, new Vector2(1f, isAttacking ? 1.3f : 1), true, true, shrinkSpeed: Utils.Remap(tipVel.Length(), 1, 8, 0f, 0.4f, true), glowOpacity: 0.5f, glowCenterScale: 0.8f); + GeneralParticleHandler.SpawnParticle(orb); + } + // The uncharge of the blades when you're not holding the item or after they slash + if (!isAttacking && (attackTimer > 0 || !attackMode)) + { + bladeCharge = MathHelper.Clamp(MathHelper.Lerp(bladeCharge, 0, 0.025f), 0.4f, 1); + if (attackTimer > 0) + attackTimer--; + readySound = true; + } + // How fast the blades try to reach their goal position when not activley slashing + // Tries to get back to the base value when possible + if (returnSpeed > baseReturnSpeed) + { + returnSpeed = (int)(returnSpeed * 0.99f); + } + else + returnSpeed = baseReturnSpeed; + + time++; + } + public void ApplyPlayerBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + Owner.Calamity().seashineSwordBuff = false; + if (Owner.Calamity().seashineSwordBuff) + Projectile.timeLeft = 2; + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Summon/SeashineSword").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; + Texture2D tex3 = ModContent.Request("CalamityMod/Particles/FullStar").Value; + + Vector2 drawPos = Projectile.Center - Main.screenPosition; + float extremeLerp = (float)Math.Pow(bladeCharge, 10); + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(tex2, drawPos - (Vector2.UnitY.RotatedBy(Projectile.rotation + MathHelper.ToRadians(90)) * 59 * bladeCharge * Projectile.scale), null, Color.Lerp(mainColor, Color.White, i * 0.3f) with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(90), tex2.Size() * 0.5f, new Vector2(0.33f - i * 0.05f, (0.75f + i * 0.03f) * bladeCharge) * 0.05f * Projectile.scale, SpriteEffects.None); + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tex, drawPos, null, Color.Lerp(lightColor, (i == 0 ? Color.White : mainColor) with { A = 0 }, extremeLerp), Projectile.rotation + MathHelper.ToRadians(45), tex.Size() * 0.5f, (i == 0 ? 0.8f : 1) * Projectile.scale, SpriteEffects.None); + + if (!isAttacking && bladeCharge < 1) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tex3, drawPos, null, mainColor with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(45), tex3.Size() * 0.5f, new Vector2(i == 0 ? 1 : 3, i == 0 ? 3 : 1) * Main.rand.NextFloat(0.8f, 1.1f) * extremeLerp, SpriteEffects.None); + } + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + if (isAttacking) + { + for (int i = 0; i < 6; i++) + { + if (i % 2 == 0) + { + Particle spark = new SeaPrismParticle(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 30f), true, 40, Main.rand.NextFloat(0.85f, 1.3f), Color.White, Vector2.One, false, Main.rand.NextFloat(-0.3f, 0.3f), affectedByLight: false); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle e = new CustomSpark(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(7f, 20f), "CalamityMod/Particles/WaterFoam", false, 14, Main.rand.NextFloat(0.1f, 0.2f) * 2.5f, Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(e); + } + for (int i = 0; i < 3; i++) + { + //Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(5f, 15f)); + //dust.noGravity = false; + //dust.scale = Main.rand.NextFloat(0.95f, 1.4f); + //dust.color = mainColor; + //dust.noLightEmittence = true; + } + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, PitchVariance = 0.3f }, Projectile.Center); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // Blades should do big damage on the inital hit due to the large delay between attacks + // However, it's pierce reduction is quite severe (at least right now) + float minMult = 0.1f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) // Custom collision since it's a spear + { + // Perform an AABB line collision check to check the whole spear. + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, tipPosition, 30 * Projectile.scale, ref _); + } + public override bool? CanDamage() => (isAttacking && attackTimer > bladeValue && Projectile.ai[0] != 0) ? null : false; + } +} diff --git a/Projectiles/Melee/SeashineSwordProj.png b/Projectiles/Summon/SeashineSwordProj.png similarity index 100% rename from Projectiles/Melee/SeashineSwordProj.png rename to Projectiles/Summon/SeashineSwordProj.png diff --git a/Projectiles/Summon/SeekerSummonProj.cs b/Projectiles/Summon/SeekerSummonProj.cs index 99a0bc8d05..19acb71cf0 100644 --- a/Projectiles/Summon/SeekerSummonProj.cs +++ b/Projectiles/Summon/SeekerSummonProj.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + Main.projFrames[Type] = 5; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; } public override void SetDefaults() @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.FinalExtraUpdate()) Projectile.frameCounter++; if (Projectile.frameCounter % 6 == 5) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; } internal void FlyNearOwner() diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index 93860c3ce5..61ce1510ae 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -75,12 +75,12 @@ namespace CalamityMod.Projectiles.Summon HoverNearOwner, AttackEnemy_Charge, AttackEnemy_ReleaseDartBurst, - AttackOwner + AttackHearts } public int IdleTimer; public int AttackTimer; - public int PlayerAttackCountdown; + public int HeartAttackCountdown; public SepulcherSegment[] Segments = new SepulcherSegment[24]; public List Arms = new List(); public Player Owner => Main.player[Projectile.owner]; @@ -105,10 +105,11 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projPet[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.DrawScreenCheckFluff[Type] = 12000; } @@ -134,11 +135,11 @@ namespace CalamityMod.Projectiles.Summon #region Syncing public override void SendExtraAI(BinaryWriter writer) { - if (Arms is null || Arms[0] is null) + if (Arms is null || Arms.Count == 0 || Arms[0] is null) Initialize(); writer.Write(IdleTimer); - writer.Write(PlayerAttackCountdown); + writer.Write(HeartAttackCountdown); writer.Write(Arms.Count); for (int i = 0; i < Arms.Count; i++) { @@ -154,11 +155,11 @@ namespace CalamityMod.Projectiles.Summon public override void ReceiveExtraAI(BinaryReader reader) { - if (Arms is null || Arms[0] is null) + if (Arms is null || Arms.Count == 0 || Arms[0] is null) Initialize(); IdleTimer = reader.ReadInt32(); - PlayerAttackCountdown = reader.ReadInt32(); + HeartAttackCountdown = reader.ReadInt32(); int armCount = reader.ReadInt32(); Arms.Clear(); for (int i = 0; i < armCount; i++) @@ -183,7 +184,7 @@ namespace CalamityMod.Projectiles.Summon NPC potentialTarget = AttemptToFindTarget(1450f); // Enter the attack state if a valid enemy is found and go back to hovering otherwise. - // This will be overriden if attacking the owner. + // This will be overriden if attacking its hearts. if (CurrentAIState != AIState.AttackEnemy_ReleaseDartBurst && CurrentAIState != AIState.AttackEnemy_Charge) { if (potentialTarget != null) @@ -195,23 +196,19 @@ namespace CalamityMod.Projectiles.Summon AttackTimer = 0; } - // Reset the AI to player attack mode if the countdown is going on. - if (PlayerAttackCountdown > 0) + // Reset the AI to heart attack mode if the countdown is going on. + if (HeartAttackCountdown > 0) { - if (CurrentAIState != AIState.AttackOwner) - CurrentAIState = AIState.AttackOwner; + if (CurrentAIState != AIState.AttackHearts) + CurrentAIState = AIState.AttackHearts; - PlayerAttackCountdown--; + HeartAttackCountdown--; // If it's finished, go back to idle owner hover movement. - if (PlayerAttackCountdown <= 0) + if (HeartAttackCountdown <= 0) CurrentAIState = AIState.HoverNearOwner; } - - // Determine whether the projectile can attack its owner based on the attakc countdown. - Projectile.hostile = PlayerAttackCountdown > 0; - switch (CurrentAIState) { case AIState.HoverNearOwner: @@ -225,8 +222,8 @@ namespace CalamityMod.Projectiles.Summon AttackEnemyByCharging(potentialTarget); AttackTimer++; break; - case AIState.AttackOwner: - AttackOwner(); + case AIState.AttackHearts: + AttackHearts(); break; } @@ -248,7 +245,7 @@ namespace CalamityMod.Projectiles.Summon chanceToBecomeAngry = Utils.GetLerpValue(2f, 6f, heartsAttachedToOwner, true); if (Main.rand.NextFloat() < chanceToBecomeAngry) { - PlayerAttackCountdown = 300; + HeartAttackCountdown = 300; Projectile.netUpdate = true; } else if (Main.netMode != NetmodeID.MultiplayerClient) @@ -349,7 +346,7 @@ namespace CalamityMod.Projectiles.Summon float rotationalVelocityFactor = Utils.GetLerpValue(0f, 6f, Projectile.velocity.Length(), true); if (CurrentAIState == AIState.AttackEnemy_Charge) rotationalVelocityFactor *= 0.85f; - if (CurrentAIState == AIState.AttackOwner) + if (CurrentAIState == AIState.AttackHearts) rotationalVelocityFactor *= 1.2f; if (Arms[i].ReelingBack) @@ -455,14 +452,39 @@ namespace CalamityMod.Projectiles.Summon } } - public void AttackOwner() + public void AttackHearts() { // Attempt to angle towards the owner. float newSpeed = MathHelper.Lerp(Projectile.velocity.Length(), 21f, 0.025f); - if (!Projectile.WithinRange(Owner.Center, 370f)) + // Find the closest heart to the minion. + float npcDistCompare = 960f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) { - Vector2 idealVelocity = Projectile.SafeDirectionTo(Owner.Center) * newSpeed; + if (!n.CanBeChasedBy(Projectile, false) || n.type != ModContent.NPCType()) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCompare) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + + // If there are no Hearts left, immediately go back to being passive. + if (index == -1) + { + HeartAttackCountdown = 0; + CurrentAIState = AIState.HoverNearOwner; + return; + } + // Otherwise, move towards the targeted heart. + NPC targetHeart = Main.npc[index]; + if (!Projectile.WithinRange(targetHeart.Center, 185f)) + { + Vector2 idealVelocity = Projectile.SafeDirectionTo(targetHeart.Center) * newSpeed; Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); float idealAimDirection = idealVelocity.ToRotation(); @@ -470,15 +492,15 @@ namespace CalamityMod.Projectiles.Summon } else if (Projectile.velocity.Length() < 36f) { - Projectile.velocity *= 1.03f; + Projectile.velocity *= 1.066f; if (JawSnapTimer <= 0f) { // Open the mouth of the jaw if close but not super close to the owner. - if (Projectile.WithinRange(Owner.Center, 300f)) + if (Projectile.WithinRange(targetHeart.Center, 150f)) JawRotation = JawRotation.AngleLerp(0.87f, 0.12f); // If really close, snap. - if (Projectile.WithinRange(Owner.Center, 180f)) + if (Projectile.WithinRange(targetHeart.Center, 90f)) { SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt, Projectile.Center); JawSnapTimer = 45f; @@ -526,7 +548,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - float angerFactor = Utils.GetLerpValue(300f, 280f, PlayerAttackCountdown, true) * Utils.GetLerpValue(0f, 30f, PlayerAttackCountdown, true); + float angerFactor = Utils.GetLerpValue(300f, 280f, HeartAttackCountdown, true) * Utils.GetLerpValue(0f, 30f, HeartAttackCountdown, true); float afterimageOutwardness = MathHelper.Lerp(6f, 8f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 2.3f) * 0.5f + 0.5f) * angerFactor; Color backAfterimageColor = Color.Red * angerFactor; backAfterimageColor.A = 0; @@ -671,21 +693,11 @@ namespace CalamityMod.Projectiles.Summon #endregion - #region Damage Stuff - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - modifiers.SourceDamage *= 0f; - if (Main.masterMode) modifiers.SourceDamage.Flat += 450f; - else if (Main.expertMode) modifiers.SourceDamage.Flat += 375f; - else modifiers.SourceDamage.Flat += 300f; - } - public override bool? CanHitNPC(NPC target) { if (target.type == ModContent.NPCType()) - return false; + return HeartAttackCountdown > 0; return null; } - #endregion } } diff --git a/Projectiles/Summon/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index 0417c1e67a..c49d18530f 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -17,9 +17,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 2; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index 34b378dcc7..3cbe3f521a 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -182,8 +182,8 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Color colorAlpha = Projectile.GetAlpha(colorArea); Vector2 halfRectangle = rectangular.Size() / 2f; float scaleFactor = (float)Math.Cos((double)(6.28318548f * (Projectile.localAI[0] / 60f))) + 3f + 3f; diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index 75143d5646..70fcf7d03b 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -138,8 +138,8 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Color colorAlpha = Projectile.GetAlpha(colorArea); Vector2 halfRectangle = rectangular.Size() / 2f; Color projColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Color(255, 255, 255, 0)); diff --git a/Projectiles/Summon/SiriusBeam.cs b/Projectiles/Summon/SiriusBeam.cs index 52185dadfc..8f4c544141 100644 --- a/Projectiles/Summon/SiriusBeam.cs +++ b/Projectiles/Summon/SiriusBeam.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -48,7 +49,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); float x4 = Main.rgbToHsl(new Color(103, 203, Main.DiscoB)).X; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, Projectile.whoAmI); } diff --git a/Projectiles/Summon/SiriusExplosion.cs b/Projectiles/Summon/SiriusExplosion.cs index d4ea45da2a..2dc85a8276 100644 --- a/Projectiles/Summon/SiriusExplosion.cs +++ b/Projectiles/Summon/SiriusExplosion.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -139,8 +139,8 @@ 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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Color colorAlpha = Projectile.GetAlpha(colorArea); Vector2 halfRectangle = rectangular.Size() / 2f; Color projColor = Main.hslToRgb(0.5f, 1f, Projectile.ai[0]).MultiplyRGBA(new Color(255, 255, 255, 0)); @@ -231,6 +231,6 @@ namespace CalamityMod.Projectiles.Summon return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } - 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); } } diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index 1b40d31d96..8078ce92df 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -22,8 +22,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -50,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon SpawnEffect(); // Does a dust spawn effect. ShootTarget(target); // If there's a target, shoot at the target. - Projectile.Center = Owner.Center - Vector2.UnitY * 60f; // Stays above the player. + Projectile.Center = Owner.Center - Vector2.UnitY * (60f - Owner.gfxOffY); // Stays above the player. Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 1f); // Passively makes blue light. diff --git a/Projectiles/Summon/SkeletalDragonChild.cs b/Projectiles/Summon/SkeletalDragonChild.cs index ec95b09ac2..1c8edf6dc0 100644 --- a/Projectiles/Summon/SkeletalDragonChild.cs +++ b/Projectiles/Summon/SkeletalDragonChild.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/SkeletalDragonMother.cs b/Projectiles/Summon/SkeletalDragonMother.cs index b8864fe285..533f5934b4 100644 --- a/Projectiles/Summon/SkeletalDragonMother.cs +++ b/Projectiles/Summon/SkeletalDragonMother.cs @@ -12,9 +12,10 @@ namespace CalamityMod.Projectiles.Summon public const float DistanceToCheck = 1100f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -132,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/SlimePuppet.cs b/Projectiles/Summon/SlimePuppet.cs index 2b602008f7..37f791b7a1 100644 --- a/Projectiles/Summon/SlimePuppet.cs +++ b/Projectiles/Summon/SlimePuppet.cs @@ -3,8 +3,11 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace CalamityMod.Projectiles.Summon { @@ -14,10 +17,11 @@ namespace CalamityMod.Projectiles.Summon public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 1; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 1; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -100,7 +104,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + var dye = Owner?.cMinion ?? 0; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, armorShaderToUse: dye); return false; } } diff --git a/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs index 4307be1609..d59573fd37 100644 --- a/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs +++ b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 5; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() { @@ -98,9 +98,9 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms return false; Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); // Start texture drawing. Main.EntitySpriteDraw(LaserBeginTexture, @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms 0); incrementalBodyLength += laserOffset; centerOnLaser += Projectile.velocity * laserOffset; - middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Projectile.type]; + middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Type]; if (middleFrameArea.Y + middleFrameArea.Height > LaserMiddleTexture.Height) middleFrameArea.Y = 0; } diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs index 8518677727..ad59ba6a1f 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs @@ -83,6 +83,10 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms { Projectile.rotation = reader.ReadSingle(); + //limb count has passed from SendExtraAI + //therefore we should read this for packet aligns sake + _ = reader.ReadInt32(); + int limbCount = Limbs.Limbs.Length; for (int i = 0; i < limbCount; i++) { @@ -100,13 +104,14 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Vector2 connectPosition = Main.LocalPlayer.Center + ConnectOffset; connectPosition.X += (OwnerRestingOffset.X > 0f).ToDirectionInt() * Projectile.scale * 20f; Vector2 endPosition = Owner.Center + OwnerRestingOffset; + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, the limb system caps the resulting possible length endPosition += (Main.MouseWorld - endPosition) * 0.075f; ClampFirstLimbRotation(ref Limbs[0].Rotation); Limbs.Update(connectPosition, endPosition); - Projectile.netSpam = 0; - Projectile.netUpdate = true; + Projectile.ForceNetUpdate(); } Projectile.ai[1] = 0f; @@ -122,7 +127,9 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms // Look at the mouse if not targetting anything. // If something is being targeted, look at them instead. + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float idealRotation = Main.myPlayer != Projectile.owner ? Projectile.rotation : Projectile.AngleTo(Main.MouseWorld); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(AresExoskeleton.TargetingDistance); if (potentialTarget != null) { @@ -146,7 +153,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public void DefaultDrawCannon(Texture2D glowmask) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 9364b9f124..de8d848196 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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/ExoskeletonPanel.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs index bb7dfcce40..1637fc380c 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs @@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms if (Main.myPlayer != Projectile.owner) return false; - Texture2D panelTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D panelTexture = Terraria.GameContent.TextureAssets.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/MinionGaussBoom.cs b/Projectiles/Summon/SmallAresArms/MinionGaussBoom.cs index fc42f7a1c5..67c70ca822 100644 --- a/Projectiles/Summon/SmallAresArms/MinionGaussBoom.cs +++ b/Projectiles/Summon/SmallAresArms/MinionGaussBoom.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override float GetScreenshakePower(float pulseCompletionRatio) => 0f; public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Lerp(Color.Yellow * 1.6f, Color.White, MathHelper.Clamp(pulseCompletionRatio * 2.2f, 0f, 1f)); - public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Projectile.type] = true; + public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Type] = true; public override void SetDefaults() { diff --git a/Projectiles/Summon/SmallAresArms/MinionGaussNuke.cs b/Projectiles/Summon/SmallAresArms/MinionGaussNuke.cs index e00c901ab2..4dcd98841d 100644 --- a/Projectiles/Summon/SmallAresArms/MinionGaussNuke.cs +++ b/Projectiles/Summon/SmallAresArms/MinionGaussNuke.cs @@ -12,7 +12,11 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms { public new string LocalizationCategory => "Projectiles.Summon"; - public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Projectile.type] = true; + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } public override void SetDefaults() { diff --git a/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs b/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs index 6cec678d28..c16562f71f 100644 --- a/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs +++ b/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override void SetStaticDefaults() { Main.projFrames[Type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms // Handle frames and rotation. Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Projectile.rotation = Projectile.velocity.ToRotation(); } @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs b/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs index c5f1955ef0..8b3cd052b1 100644 --- a/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs +++ b/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs @@ -14,9 +14,10 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override void SetStaticDefaults() { Main.projFrames[Type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms // Handle frames and rotation. Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; // Home towards targets. @@ -71,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs index a2aa2e83ad..3945b1d12d 100644 --- a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs +++ b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public ref float Time => ref Projectile.ai[1]; - public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Projectile.type] = true; + public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Type] = true; public override void SetDefaults() { @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Time++; // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public void AdditiveDraw(SpriteBatch spriteBatch) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 7e24206cd7..44f5dd439d 100644 --- a/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs +++ b/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs @@ -22,11 +22,11 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms // Handle frames. Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Time++; } @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/SmallSkeletonMinion.cs b/Projectiles/Summon/SmallSkeletonMinion.cs index a0ace7991c..2cc5640838 100644 --- a/Projectiles/Summon/SmallSkeletonMinion.cs +++ b/Projectiles/Summon/SmallSkeletonMinion.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public int Variant; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - Main.projFrames[Projectile.type] = 7; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 1; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 1; } @@ -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(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2f, 1f, spriteEffects, 0); + Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.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 2cf5edbfa2..cee2d0e534 100644 --- a/Projectiles/Summon/SolarBeam.cs +++ b/Projectiles/Summon/SolarBeam.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index 5f9ee985f2..890f7bbf8c 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index fd06939b02..3ca4ff1c0f 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index 219ca81408..f78e7076b2 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/SpikecragSpike.cs b/Projectiles/Summon/SpikecragSpike.cs index 6431b5561c..54160267e4 100644 --- a/Projectiles/Summon/SpikecragSpike.cs +++ b/Projectiles/Summon/SpikecragSpike.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.SentryShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Type] = true; } public override void SetDefaults() @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 120); if (Main.zenithWorld) { target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Summon/SquirrelSquireAcorn.cs b/Projectiles/Summon/SquirrelSquireAcorn.cs index b5456cd62e..6031563d3f 100644 --- a/Projectiles/Summon/SquirrelSquireAcorn.cs +++ b/Projectiles/Summon/SquirrelSquireAcorn.cs @@ -1,39 +1,68 @@ -using Terraria; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Summon.SquirrelSquireStaff; namespace CalamityMod.Projectiles.Summon { public class SquirrelSquireAcorn : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public const float Gravity = 0.5f; - public override void SetStaticDefaults() - { - ProjectileID.Sets.SentryShot[Projectile.type] = true; - } + + public override void SetStaticDefaults() => ProjectileID.Sets.SentryShot[Type] = true; public override void SetDefaults() { - Projectile.width = 10; + Projectile.DamageType = DamageClass.Summon; + Projectile.timeLeft = ProjectileTimeAlive; + Projectile.width = 16; Projectile.height = 16; Projectile.friendly = true; - Projectile.penetrate = 2; - Projectile.timeLeft = 180; - Projectile.MaxUpdates = 2; - Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override void AI() { - Projectile.velocity.Y += Gravity; - Projectile.rotation += (Projectile.velocity.X > 0f).ToDirectionInt() * 0.3f; + if (Projectile.timeLeft < ProjectileTimeAlive - TimeBeforeFalling) + Projectile.velocity.Y += ProjectileGravity; + + Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.X * 3f); + + if (!Main.dedServ) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 7 : 79); + dust.noGravity = true; + dust.scale = 0.85f; + dust.velocity = Projectile.velocity * 0.4f; + dust.noLight = true; + dust.noLightEmittence = true; + } + } } public override void OnKill(int timeLeft) { - for (int k = 0; k < 5; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.WoodFurniture, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Projectile.ExpandHitboxBy(ProjectileAoERadiusSize * 2); + if (Main.myPlayer == Projectile.owner) + Projectile.Damage(); + + if (Main.dedServ) + return; + + for (int k = 0; k < 6; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 7 : 167); + dust.scale = Main.rand.NextFloat(0.6f, 1.1f); + dust.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f); + dust.noGravity = false; + Particle spark = new AltLineParticle(Projectile.Center, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.9f), true, 15, 0.7f, Color.Lerp(Color.White, Color.Brown, Main.rand.NextFloat(0.3f, 0.7f)) * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } } } } diff --git a/Projectiles/Summon/SquirrelSquireAcorn.png b/Projectiles/Summon/SquirrelSquireAcorn.png index 7746f7829f..65f893126a 100644 Binary files a/Projectiles/Summon/SquirrelSquireAcorn.png and b/Projectiles/Summon/SquirrelSquireAcorn.png differ diff --git a/Projectiles/Summon/SquirrelSquireMinion.cs b/Projectiles/Summon/SquirrelSquireMinion.cs index 561b59c262..20e1199064 100644 --- a/Projectiles/Summon/SquirrelSquireMinion.cs +++ b/Projectiles/Summon/SquirrelSquireMinion.cs @@ -1,148 +1,151 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Summon.SquirrelSquireStaff; namespace CalamityMod.Projectiles.Summon { public class SquirrelSquireMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public ref float AttackTimer => ref Projectile.ai[1]; - public bool Attacking + + private enum AIState { Idle, Attack } + + private AIState State { - get => Projectile.localAI[1] == 1f; - set => Projectile.localAI[1] = value.ToInt(); - } - public bool OnSolidGround - { - get + get => (AIState)Projectile.ai[0]; + set { - bool groundSolid = false; - for (int i = (int)Projectile.Left.X / 16 - 1; i < (int)Projectile.Right.X / 16 + 1; i++) - { - bool bottomTileSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)Projectile.Bottom.Y / 16).IsTileSolidGround(); - bool firstTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)Projectile.Bottom.Y / 16 + 1).IsTileSolidGround(); - bool secondTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)Projectile.Bottom.Y / 16 + 2).IsTileSolidGround(); - groundSolid |= bottomTileSolid || firstTileDownSolid || secondTileDownSolid; - } - return groundSolid; + Projectile.ai[0] = (float)value; + Projectile.ForceNetUpdate(); } } - public Player Owner => Main.player[Projectile.owner]; + + private bool OnSpawnCheck + { + get => Projectile.ai[2] == 1f; + set => Projectile.ai[2] = value == true ? 1f : 0f; + } + + private Player Owner; + + private NPC Target; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - Main.projFrames[Projectile.type] = 16; + Main.projFrames[Type] = 14; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() { - Projectile.width = 34; - Projectile.height = 64; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Summon; Projectile.timeLeft = Projectile.SentryLifeTime; Projectile.penetrate = -1; + + Projectile.width = 40; + Projectile.height = 32; + Projectile.friendly = true; Projectile.tileCollide = true; Projectile.sentry = true; - Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; } public override void AI() { - if (Projectile.localAI[0] == 0f) + if (!OnSpawnCheck) { - DoInitializationEffects(); - Projectile.localAI[0] = 1f; + ActualOnSpawn(); + OnSpawnCheck = true; } - Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.004f, -12f, 12f); + SetTarget(); + ApplyGravity(); + DoAnimation(); + + switch (State) + { + case AIState.Idle: + IdleBehavior(); + break; + case AIState.Attack: + AttackBehavior(); + break; + } + } + + #region AI Methods + + private void ActualOnSpawn() + { + Owner = Main.player[Projectile.owner]; + Projectile.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + } + + private void SetTarget() => Target = Projectile.Center.MinionHoming(960f, Owner, false); + + private void ApplyGravity() + { + float speedY = Projectile.velocity.Y; + if (speedY < 20f) + speedY = MathF.Min(speedY + 0.4f, 20f); + Projectile.velocity.Y = speedY; + } + + private void DoAnimation() + { Projectile.frameCounter++; - - Attacking = false; - NPC potentialTarget = Projectile.Center.MinionHoming(800f, Owner, false); - if (potentialTarget is null) + if (Projectile.frameCounter >= 5) { - if (OnSolidGround) - { - if (Projectile.frameCounter > 3) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - { - Projectile.frame = 0; - } - } - else - { - if (Projectile.frameCounter > 5) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame < 8 || Projectile.frame > 11) - { - Projectile.frame = 9; - } - } + Projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % 7; } - else - { - Attacking = true; - AttackTarget(potentialTarget); - } - - Projectile.rotation = 0f; - Projectile.tileCollide = true; } - public void DoInitializationEffects() + private void IdleBehavior() { - int dustQuantity = 36; - for (int d = 0; d < dustQuantity; d++) + if (Target is not null) { - // 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; - dust.noLight = true; + State = AIState.Attack; + return; } + + if (Projectile.Distance(Owner.Center) < 60f) + Projectile.spriteDirection = MathF.Sign(Owner.Center.X - Projectile.Center.X); } - public void AttackTarget(NPC target) + private void AttackBehavior() { - AttackTimer++; - - // Pelt the target with acorns. - if (!OnSolidGround) - Projectile.frame = 12 + (int)(AttackTimer / 6.4) % 4; - else + if (Target is null) { - Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.2f, -12f, 12f); - Projectile.frame = 4 + (int)(AttackTimer / 6.4) % 4; + State = AIState.Idle; + return; } - if (Main.myPlayer == Projectile.owner && AttackTimer % 30f == 27f) + + if (Projectile.frame == 0 && Projectile.frameCounter == 0 && Main.myPlayer == Projectile.owner) { - Projectile.spriteDirection = (target.Center.X > Projectile.Center.X).ToDirectionInt(); - Vector2 acornSpawnPosition = Projectile.Center + new Vector2(Projectile.spriteDirection * 6f, 10f); - float acornShootSpeed = MathHelper.Lerp(15f, 32f, Projectile.Distance(target.Center) / 800f); - Vector2 acornShootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(acornSpawnPosition, target.Top + target.velocity * 25f, SquirrelSquireAcorn.Gravity, acornShootSpeed); - - if (Projectile.WithinRange(target.Center, 200f)) - acornShootVelocity = (target.Center - acornSpawnPosition).SafeNormalize(-Vector2.UnitY) * acornShootSpeed; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), acornSpawnPosition, acornShootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 spawnPosition = Projectile.spriteDirection == -1 ? Projectile.Left : Projectile.Right; + Vector2 shootVelocity = CalamityUtils.CalculatePredictiveAimToTarget(spawnPosition, Target, ProjectileVelocity); + Projectile.NewProjectile( + Projectile.GetSource_FromThis(), + spawnPosition, + shootVelocity, + ModContent.ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + SoundEngine.PlaySound(SoundID.Item1 with { Volume = 0.5f, Pitch = 0.8f, PitchVariance = 0.1f }, spawnPosition); + Projectile.ForceNetUpdate(); } + + Projectile.spriteDirection = MathF.Sign(Target.Center.X - Projectile.Center.X); } - - public override bool? CanDamage() => false; + #endregion public override bool OnTileCollide(Vector2 oldVelocity) => false; @@ -152,13 +155,20 @@ namespace CalamityMod.Projectiles.Summon return true; } - public override void OnKill(int timeLeft) + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) { - if (Main.netMode != NetmodeID.Server) - { - int index = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Vector2.Zero, Main.rand.Next(61, 64), Projectile.scale); - Main.gore[index].velocity *= 0.1f; - } + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Top - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + Rectangle frame = texture.Frame(2, 7, (int)State, Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + Vector2 anchorPoint = new(frame.Size().X * 0.5f, 0f); + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, Projectile.rotation, anchorPoint, Projectile.scale, flipSprite); + + return false; } } } diff --git a/Projectiles/Summon/SquirrelSquireMinion.png b/Projectiles/Summon/SquirrelSquireMinion.png index 57814576d0..a4d153ee6c 100644 Binary files a/Projectiles/Summon/SquirrelSquireMinion.png and b/Projectiles/Summon/SquirrelSquireMinion.png differ diff --git a/Projectiles/Summon/StellarTorusSummon.cs b/Projectiles/Summon/StellarTorusSummon.cs index f3d67efc07..0be79f013e 100644 --- a/Projectiles/Summon/StellarTorusSummon.cs +++ b/Projectiles/Summon/StellarTorusSummon.cs @@ -263,7 +263,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 e196726c0a..dfa4c71d3b 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - Main.projFrames[Projectile.type] = 10; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -551,7 +551,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int index = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, new Vector2(0f, 0f), Main.rand.Next(61, 64), Projectile.scale); Main.gore[index].velocity *= 0.1f; diff --git a/Projectiles/Summon/StormjawSpark.cs b/Projectiles/Summon/StormjawSpark.cs index 6c06785a0a..4bba548bec 100644 --- a/Projectiles/Summon/StormjawSpark.cs +++ b/Projectiles/Summon/StormjawSpark.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Summon public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; // Clone of Typeless/GenericElectricSpark but specfically benefits from whips - public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Projectile.type] = true; + public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Type] = true; public override void SetDefaults() { diff --git a/Projectiles/Summon/SummonAstralExplosion.cs b/Projectiles/Summon/SummonAstralExplosion.cs index eb4e8d567e..8dad826d6a 100644 --- a/Projectiles/Summon/SummonAstralExplosion.cs +++ b/Projectiles/Summon/SummonAstralExplosion.cs @@ -1,6 +1,8 @@ -using Terraria; +using CalamityMod.Buffs.DamageOverTime; +using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class SummonAstralExplosion : ModProjectile, ILocalizedModType @@ -8,8 +10,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionShot[Type] = true; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -18,7 +20,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.height = 48; Projectile.friendly = true; Projectile.penetrate = 2; - Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.timeLeft = Main.projFrames[Type] * 5; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 30; Projectile.DamageType = DamageClass.Summon; @@ -31,5 +33,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.timeLeft % 5f == 4f) Projectile.frame++; } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Summon/SummonBrimstoneExplosion.cs b/Projectiles/Summon/SummonBrimstoneExplosion.cs index f2c539e6aa..2dfde5204e 100644 --- a/Projectiles/Summon/SummonBrimstoneExplosion.cs +++ b/Projectiles/Summon/SummonBrimstoneExplosion.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionShot[Type] = true; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.hostile = true; Projectile.penetrate = -1; - Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.timeLeft = Main.projFrames[Type] * 5; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.DamageType = DamageClass.Summon; diff --git a/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs index f827f85f65..888231d2f1 100644 --- a/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs +++ b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionShot[Type] = true; + Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.hostile = false; Projectile.penetrate = -1; - Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.timeLeft = Main.projFrames[Type] * 5; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index 1a98dfb84c..0fad924ff2 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 3; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; player.AddBuff(ModContent.BuffType(), 3600); diff --git a/Projectiles/Summon/TundraFlameBlossom.cs b/Projectiles/Summon/TundraFlameBlossom.cs index 2b34cb6953..8d7d4333ea 100644 --- a/Projectiles/Summon/TundraFlameBlossom.cs +++ b/Projectiles/Summon/TundraFlameBlossom.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon TargetNPC(potentialTarget); // Targets the NPC. Lighting.AddLight(Projectile.Center, Color.Fuchsia.ToVector3()); // Makes a light with the same color as the flowers. - Projectile.Center = Owner.Center + RotationMovement.ToRotationVector2() * 100f; // Spins around the player. + Projectile.Center = Owner.Center + RotationMovement.ToRotationVector2() * 100f + Vector2.UnitY * Owner.gfxOffY; // Spins around the player. Projectile.rotation += MathHelper.ToRadians(6.25f * Owner.direction); // Rotates around itself in the direction of the owner Projectile.scale = MathHelper.Lerp(1f, 1.005f, FlowerShootTimer % 100f); // Expands the closer it is to shooting, goes back to normal once shot; peridoically. RotationMovement += MathHelper.ToRadians(1.25f * Owner.direction); // The changing variable that moves the flower, changes directions depending on the player. diff --git a/Projectiles/Summon/TundraFlameBlossomsOrb.cs b/Projectiles/Summon/TundraFlameBlossomsOrb.cs index 5c2a2bf967..f818350390 100644 --- a/Projectiles/Summon/TundraFlameBlossomsOrb.cs +++ b/Projectiles/Summon/TundraFlameBlossomsOrb.cs @@ -18,9 +18,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -119,7 +120,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/Umbrella/MagicArrow.cs b/Projectiles/Summon/Umbrella/MagicArrow.cs index e0dbdf0aea..81cb37803c 100644 --- a/Projectiles/Summon/Umbrella/MagicArrow.cs +++ b/Projectiles/Summon/Umbrella/MagicArrow.cs @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); @@ -180,7 +180,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } // Draw the bat. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.CurrentDrawnEntityShader = Main.player[Projectile.owner]?.cMinion ?? 0; + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } diff --git a/Projectiles/Summon/Umbrella/MagicAxe.cs b/Projectiles/Summon/Umbrella/MagicAxe.cs index c283fd7383..8c58102600 100644 --- a/Projectiles/Summon/Umbrella/MagicAxe.cs +++ b/Projectiles/Summon/Umbrella/MagicAxe.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; - ProjectileID.Sets.TrailingMode[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 40; + ProjectileID.Sets.TrailingMode[Type] = 4; } public override void SetDefaults() @@ -246,7 +246,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); @@ -265,7 +265,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } // Draw the axe. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.CurrentDrawnEntityShader = Main.player[Projectile.owner]?.cMinion ?? 0; + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } diff --git a/Projectiles/Summon/Umbrella/MagicBird.cs b/Projectiles/Summon/Umbrella/MagicBird.cs index 2672893275..33389e5744 100644 --- a/Projectiles/Summon/Umbrella/MagicBird.cs +++ b/Projectiles/Summon/Umbrella/MagicBird.cs @@ -10,10 +10,11 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Type] = 7; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -127,7 +128,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/Umbrella/MagicBullet.cs b/Projectiles/Summon/Umbrella/MagicBullet.cs index 10938fe054..d65f48bb37 100644 --- a/Projectiles/Summon/Umbrella/MagicBullet.cs +++ b/Projectiles/Summon/Umbrella/MagicBullet.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella if (Projectile.alpha != 0) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella 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); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } } diff --git a/Projectiles/Summon/Umbrella/MagicBulletBig.cs b/Projectiles/Summon/Umbrella/MagicBulletBig.cs index 5a0b5c307c..4c6080aca4 100644 --- a/Projectiles/Summon/Umbrella/MagicBulletBig.cs +++ b/Projectiles/Summon/Umbrella/MagicBulletBig.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella if (Projectile.alpha != 0) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella 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); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return false; } } diff --git a/Projectiles/Summon/Umbrella/MagicBunny.cs b/Projectiles/Summon/Umbrella/MagicBunny.cs index c2bb997aa2..fd493f033b 100644 --- a/Projectiles/Summon/Umbrella/MagicBunny.cs +++ b/Projectiles/Summon/Umbrella/MagicBunny.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/Umbrella/MagicHammer.cs b/Projectiles/Summon/Umbrella/MagicHammer.cs index a5fc677445..5f939a93d9 100644 --- a/Projectiles/Summon/Umbrella/MagicHammer.cs +++ b/Projectiles/Summon/Umbrella/MagicHammer.cs @@ -34,8 +34,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; - ProjectileID.Sets.TrailingMode[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 40; + ProjectileID.Sets.TrailingMode[Type] = 4; } public override void SetDefaults() @@ -275,7 +275,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella 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()) + if (!Main.dedServ && Main.rand.NextBool()) { int confettiGore = Main.rand.Next(276, 283); int idx = Gore.NewGore(Projectile.GetSource_FromThis(), target.Center, target.velocity, confettiGore, 1f); @@ -311,7 +311,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); @@ -330,7 +330,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } // Draw the hammer. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.CurrentDrawnEntityShader = Main.player[Projectile.owner]?.cMinion ?? 0; + Main.EntitySpriteDraw(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 663c9df9e3..367a495d61 100644 --- a/Projectiles/Summon/Umbrella/MagicHat.cs +++ b/Projectiles/Summon/Umbrella/MagicHat.cs @@ -18,10 +18,11 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -126,9 +127,9 @@ namespace CalamityMod.Projectiles.Summon.Umbrella Player player = Main.player[Projectile.owner]; // Use a different texture if the player is invisible or has at least 50% stealth - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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; + bool hasStealth = player.Calamity().rogueStealth > 0f && stealthPercent > 0.5f && player.townNPCs < 3f && CalamityClientConfig.Instance.StealthInvisibility; if (player.ShouldNotDraw || hasStealth) texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/MagicHatInvis").Value; diff --git a/Projectiles/Summon/Umbrella/MagicRifle.cs b/Projectiles/Summon/Umbrella/MagicRifle.cs index 5b5e977842..cd8b8b46d0 100644 --- a/Projectiles/Summon/Umbrella/MagicRifle.cs +++ b/Projectiles/Summon/Umbrella/MagicRifle.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; - ProjectileID.Sets.TrailingMode[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 40; + ProjectileID.Sets.TrailingMode[Type] = 4; } public override void SetDefaults() @@ -280,7 +280,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); @@ -300,7 +300,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } // Draw the rifle. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.CurrentDrawnEntityShader = Main.player[Projectile.owner]?.cMinion ?? 0; + Main.EntitySpriteDraw(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 a02cfacb31..6eea005194 100644 --- a/Projectiles/Summon/Umbrella/MagicTree.cs +++ b/Projectiles/Summon/Umbrella/MagicTree.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella break; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 20; i++) { @@ -165,7 +165,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella if (Projectile.ai[1] == 0f) return false; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; switch (TreeType) { case Tree.Astral: diff --git a/Projectiles/Summon/Umbrella/MagicUmbrella.cs b/Projectiles/Summon/Umbrella/MagicUmbrella.cs index 952850a152..093f93a876 100644 --- a/Projectiles/Summon/Umbrella/MagicUmbrella.cs +++ b/Projectiles/Summon/Umbrella/MagicUmbrella.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; - ProjectileID.Sets.TrailingMode[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 40; + ProjectileID.Sets.TrailingMode[Type] = 4; } public override void SetDefaults() @@ -333,7 +333,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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); @@ -352,7 +352,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } // Draw the umbrella. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.CurrentDrawnEntityShader = Main.player[Projectile.owner]?.cMinion ?? 0; + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } } diff --git a/Projectiles/Summon/UniverseSplitterHugeBeam.cs b/Projectiles/Summon/UniverseSplitterHugeBeam.cs index ee2d47c20a..0d4b0b518f 100644 --- a/Projectiles/Summon/UniverseSplitterHugeBeam.cs +++ b/Projectiles/Summon/UniverseSplitterHugeBeam.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { ProjectileID.Sets.DrawScreenCheckFluff[Type] = 12000; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/UniverseSplitterSmallBeam.cs b/Projectiles/Summon/UniverseSplitterSmallBeam.cs index 16edc6ca77..e8fc84e72c 100644 --- a/Projectiles/Summon/UniverseSplitterSmallBeam.cs +++ b/Projectiles/Summon/UniverseSplitterSmallBeam.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { ProjectileID.Sets.DrawScreenCheckFluff[Type] = 12000; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/UrchinSpike.cs b/Projectiles/Summon/UrchinSpike.cs index 86f95b21ca..bb7dd11f81 100644 --- a/Projectiles/Summon/UrchinSpike.cs +++ b/Projectiles/Summon/UrchinSpike.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 82120f71b2..ddcf3733dc 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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 52e1cc5bf2..64a6a06fbe 100644 --- a/Projectiles/Summon/VictideSeaSnail.cs +++ b/Projectiles/Summon/VictideSeaSnail.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - Main.projFrames[Projectile.type] = 7; + ProjectileID.Sets.MinionSacrificable[Type] = true; + Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -216,7 +216,7 @@ namespace CalamityMod.Projectiles.Summon { Player owner = Main.player[Projectile.owner]; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 8e0b672027..6593fee1ce 100644 --- a/Projectiles/Summon/VileFeederProjectile.cs +++ b/Projectiles/Summon/VileFeederProjectile.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Projectiles.Summon { Main.projFrames[Type] = 4; ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index e3ee0abc14..d17ed5e292 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 3; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -261,8 +261,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = texture.Height / Main.projFrames[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); return false; diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index 260d3e8e78..d8180d7698 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -361,7 +361,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 371dc5272b..37970e73a4 100644 --- a/Projectiles/Summon/VoidConcentrationAura.cs +++ b/Projectiles/Summon/VoidConcentrationAura.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Summon public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public int timer = 0; + public override void SetStaticDefaults() => Main.projPet[Type] = true; + public override void SetDefaults() { Projectile.width = 46; @@ -46,6 +48,7 @@ namespace CalamityMod.Projectiles.Summon public void HandleRightClick() { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 velocity = Main.MouseWorld - Main.player[Projectile.owner].Center; velocity.Normalize(); velocity *= 2f; @@ -67,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon mp.voidAura = false; Projectile.Kill(); } - if (owner.whoAmI == Main.myPlayer && owner.ownedProjectileCounts[Projectile.type] <= 25 && timer > 0 && timer % 4 == 0) + if (owner.whoAmI == Main.myPlayer && owner.ownedProjectileCounts[Type] <= 25 && timer > 0 && timer % 4 == 0) { NPC target = CalamityUtils.MinionHoming(Projectile.Center, 1800f, owner); if (target != null) diff --git a/Projectiles/Summon/VoidConcentrationBlackhole.cs b/Projectiles/Summon/VoidConcentrationBlackhole.cs index b92eae0d7f..b79ca5a550 100644 --- a/Projectiles/Summon/VoidConcentrationBlackhole.cs +++ b/Projectiles/Summon/VoidConcentrationBlackhole.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -125,9 +125,9 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - int height = texture.Height / Main.projFrames[Projectile.type]; + int height = texture.Height / Main.projFrames[Type]; int frameHeight = height * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameHeight, texture.Width, height); Vector2 origin = new Vector2(texture.Width / 2f, height / 2f); @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) + if (Projectile.frame >= Main.projFrames[Type] - 1) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/VoidConcentrationOrb.cs b/Projectiles/Summon/VoidConcentrationOrb.cs index f1f31a7547..7de9d93ea7 100644 --- a/Projectiles/Summon/VoidConcentrationOrb.cs +++ b/Projectiles/Summon/VoidConcentrationOrb.cs @@ -11,9 +11,10 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -99,7 +100,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) + if (Projectile.frame >= Main.projFrames[Type] - 1) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/VolcanicFireballSummon.cs b/Projectiles/Summon/VolcanicFireballSummon.cs index 203f191d63..3bdb255644 100644 --- a/Projectiles/Summon/VolcanicFireballSummon.cs +++ b/Projectiles/Summon/VolcanicFireballSummon.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame++; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.timeLeft == 300) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index 86e7a1de94..2e5ea2d82f 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/WaterElementalSong.cs b/Projectiles/Summon/WaterElementalSong.cs index b5725388d7..6cb4b317d4 100644 --- a/Projectiles/Summon/WaterElementalSong.cs +++ b/Projectiles/Summon/WaterElementalSong.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/WaterSpearFriendly.cs b/Projectiles/Summon/WaterSpearFriendly.cs index c13ae788a4..55ad239937 100644 --- a/Projectiles/Summon/WaterSpearFriendly.cs +++ b/Projectiles/Summon/WaterSpearFriendly.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Type] = true; } public override void SetDefaults() @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/WhiteDragonHead.cs b/Projectiles/Summon/WhiteDragonHead.cs index 0915f26c63..421192a221 100644 --- a/Projectiles/Summon/WhiteDragonHead.cs +++ b/Projectiles/Summon/WhiteDragonHead.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Summon Dictionary segments = new Dictionary(); public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -40,8 +41,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.minionSlots = 2; Projectile.minion = true; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 100; } public override void AI() @@ -184,7 +185,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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/WitherBlossom.cs b/Projectiles/Summon/WitherBlossom.cs index f52b50ed24..833562f02a 100644 --- a/Projectiles/Summon/WitherBlossom.cs +++ b/Projectiles/Summon/WitherBlossom.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Summon public override void MinionAI() { - Projectile.Center = Owner.Center + OffsetAngle.ToRotationVector2() * 150f; + Projectile.Center = Owner.Center + OffsetAngle.ToRotationVector2() * 150f + Vector2.UnitY * Owner.gfxOffY; Time++; if (Time % 50 == 49 && Main.myPlayer == Projectile.owner && Target != null) diff --git a/Projectiles/Summon/WitherBolt.cs b/Projectiles/Summon/WitherBolt.cs index cbbafe4024..6711988904 100644 --- a/Projectiles/Summon/WitherBolt.cs +++ b/Projectiles/Summon/WitherBolt.cs @@ -11,8 +11,11 @@ namespace CalamityMod.Projectiles.Summon { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/Projectiles/StarProj"; + public override void SetStaticDefaults() { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 25; ProjectileID.Sets.MinionShot[Type] = true; @@ -53,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D boltTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D boltTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; for (int i = 0; i < Projectile.oldPos.Length; i++) { float completionRatio = i / (float)Projectile.oldPos.Length; diff --git a/Projectiles/Summon/WitherBolt.png b/Projectiles/Summon/WitherBolt.png deleted file mode 100644 index 0968156e79..0000000000 Binary files a/Projectiles/Summon/WitherBolt.png and /dev/null differ diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index 1a5083b4db..cc8d4f7eee 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -98,9 +98,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 12; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -177,7 +177,7 @@ namespace CalamityMod.Projectiles.Summon bool buffMode = BuffModeBuffer <= 0; //Do frame stuff i guess - Projectile.frame = Projectile.frame % (Main.projFrames[Projectile.type] / 2); + Projectile.frame = Projectile.frame % (Main.projFrames[Type] / 2); Projectile.frameCounter++; if (Projectile.frameCounter > 8) @@ -185,13 +185,13 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type] / 2) + if (Projectile.frame >= Main.projFrames[Type] / 2) { Projectile.frame = 0; } if (buffMode) - Projectile.frame += Main.projFrames[Projectile.type] / 2; + Projectile.frame += Main.projFrames[Type] / 2; //Buff stuff @@ -310,6 +310,7 @@ namespace CalamityMod.Projectiles.Summon AyeAyeCaptainCooldown = 50f; Player playerToBuff = Owner; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is used to determine "player intent" for buffing and healing float mouseDistanceToOwner = (Owner.MountedCenter - Owner.Calamity().mouseWorld).Length(); if (Main.netMode == NetmodeID.MultiplayerClient && mouseDistanceToOwner > 120f) diff --git a/Projectiles/Summon/WulfrumEnergyBurst.cs b/Projectiles/Summon/WulfrumEnergyBurst.cs index 836cfab051..3aa9aab80d 100644 --- a/Projectiles/Summon/WulfrumEnergyBurst.cs +++ b/Projectiles/Summon/WulfrumEnergyBurst.cs @@ -44,9 +44,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -189,7 +189,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 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 2007486933..6b1d5808af 100644 --- a/Projectiles/Summon/WulfrumFusionBolt.cs +++ b/Projectiles/Summon/WulfrumFusionBolt.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Summon/YharonMinionFireball.cs b/Projectiles/Summon/YharonMinionFireball.cs index 61c54b2438..de570b3bec 100644 --- a/Projectiles/Summon/YharonMinionFireball.cs +++ b/Projectiles/Summon/YharonMinionFireball.cs @@ -15,10 +15,11 @@ namespace CalamityMod.Projectiles.Summon public override string Texture => "CalamityMod/Projectiles/Boss/YharonFireball"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + Main.projFrames[Type] = 5; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; } public override void SetDefaults() @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.075f, 0f, 1f); @@ -58,13 +59,13 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); SpriteEffects direction = SpriteEffects.None; if (Projectile.spriteDirection == -1) direction = SpriteEffects.FlipHorizontally; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Turret/DraedonLaserBuffer.cs b/Projectiles/Turret/DraedonLaserBuffer.cs index 8e6f8f7eff..0e0eae6b9f 100644 --- a/Projectiles/Turret/DraedonLaserBuffer.cs +++ b/Projectiles/Turret/DraedonLaserBuffer.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/FireShot.cs b/Projectiles/Turret/FireShot.cs index 563e0b7c6c..f6f40c8d53 100644 --- a/Projectiles/Turret/FireShot.cs +++ b/Projectiles/Turret/FireShot.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Turret public bool ableToHit = true; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 16; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 16; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Turret public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire3, 600); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire3, 100); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 300); public override bool? CanDamage() => ableToHit ? (bool?)null : false; diff --git a/Projectiles/Turret/FireShotBuffer.cs b/Projectiles/Turret/FireShotBuffer.cs index cd618b91ab..23e27cd8ea 100644 --- a/Projectiles/Turret/FireShotBuffer.cs +++ b/Projectiles/Turret/FireShotBuffer.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/IceExplosion.cs b/Projectiles/Turret/IceExplosion.cs index f26d9ac54b..9b8a1cf7c9 100644 --- a/Projectiles/Turret/IceExplosion.cs +++ b/Projectiles/Turret/IceExplosion.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Turret return; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 cbe9c9193d..bef1dc5cb2 100644 --- a/Projectiles/Turret/IceShot.cs +++ b/Projectiles/Turret/IceShot.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Turret public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(BuffID.Frostburn, 180); if (Projectile.hostile && Main.netMode == NetmodeID.MultiplayerClient) //hostile version pierces through players in multiplayer return; Projectile.Kill(); diff --git a/Projectiles/Turret/IceShotBuffer.cs b/Projectiles/Turret/IceShotBuffer.cs index 7e7d8f7789..9017700252 100644 --- a/Projectiles/Turret/IceShotBuffer.cs +++ b/Projectiles/Turret/IceShotBuffer.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/LaserShot.cs b/Projectiles/Turret/LaserShot.cs index 72a11e960f..ae852dfc63 100644 --- a/Projectiles/Turret/LaserShot.cs +++ b/Projectiles/Turret/LaserShot.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Turret public NPC struckNPC = null; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Turret { // This is the drawcode from surge driver // Start texture drawing. - Rectangle beginFrame = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle beginFrame = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Main.EntitySpriteDraw(LaserBeginTexture, Projectile.Center - Main.screenPosition, beginFrame, @@ -91,14 +91,14 @@ namespace CalamityMod.Projectiles.Turret // Prepare things for body drawing. float laserBodyLength = LaserLength; - laserBodyLength -= (LaserBeginTexture.Height * 0.5f + LaserEndTexture.Height) * Projectile.scale / Main.projFrames[Projectile.type]; + laserBodyLength -= (LaserBeginTexture.Height * 0.5f + LaserEndTexture.Height) * Projectile.scale / Main.projFrames[Type]; Vector2 centerOnLaser = Projectile.Center; // Body drawing. - Rectangle middleFrame = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle middleFrame = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); if (laserBodyLength > 30f) { - float laserOffset = (LaserMiddleTexture.Height - 10f) * Projectile.scale / Main.projFrames[Projectile.type]; + float laserOffset = (LaserMiddleTexture.Height - 10f) * Projectile.scale / Main.projFrames[Type]; float incrementalBodyLength = 0f; while (incrementalBodyLength + 1f < laserBodyLength) { @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Turret } // End texture drawing. - Rectangle endFrame = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle endFrame = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; Main.EntitySpriteDraw(LaserEndTexture, laserEndCenter, diff --git a/Projectiles/Turret/LaserShotBuffer.cs b/Projectiles/Turret/LaserShotBuffer.cs index a3b6f124d0..12af064f46 100644 --- a/Projectiles/Turret/LaserShotBuffer.cs +++ b/Projectiles/Turret/LaserShotBuffer.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center + new Vector2(3f, 0f), Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/OnyxShot.cs b/Projectiles/Turret/OnyxShot.cs index ecbfb2d06f..a1b6c4716c 100644 --- a/Projectiles/Turret/OnyxShot.cs +++ b/Projectiles/Turret/OnyxShot.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Turret public bool ableToHit = true; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Turret/OnyxShotBuffer.cs b/Projectiles/Turret/OnyxShotBuffer.cs index 9635370dde..5f90edf3aa 100644 --- a/Projectiles/Turret/OnyxShotBuffer.cs +++ b/Projectiles/Turret/OnyxShotBuffer.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Turret } if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); for (int i = -1; i < 2; i++) Projectile.NewProjectile(source, Projectile.Center + new Vector2(3f, 0f), Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.035f, 0.11f) * i), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); diff --git a/Projectiles/Turret/PlagueExplosionGas.cs b/Projectiles/Turret/PlagueExplosionGas.cs index fa76879a54..a4102fba0f 100644 --- a/Projectiles/Turret/PlagueExplosionGas.cs +++ b/Projectiles/Turret/PlagueExplosionGas.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Turret return; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = 1f; diff --git a/Projectiles/Turret/PlagueShotBuffer.cs b/Projectiles/Turret/PlagueShotBuffer.cs index a3ddc09930..1e1a6d91e7 100644 --- a/Projectiles/Turret/PlagueShotBuffer.cs +++ b/Projectiles/Turret/PlagueShotBuffer.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/WaterShot.cs b/Projectiles/Turret/WaterShot.cs index bf3555dee9..2ec3d66d03 100644 --- a/Projectiles/Turret/WaterShot.cs +++ b/Projectiles/Turret/WaterShot.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Turret public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Turret/WaterShotBuffer.cs b/Projectiles/Turret/WaterShotBuffer.cs index c26d65be2d..3b41d8810e 100644 --- a/Projectiles/Turret/WaterShotBuffer.cs +++ b/Projectiles/Turret/WaterShotBuffer.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center + new Vector2(3f, 0f), Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Typeless/AeroExplosive.cs b/Projectiles/Typeless/AeroExplosive.cs index b2526a6fd6..c5598f8f9a 100644 --- a/Projectiles/Typeless/AeroExplosive.cs +++ b/Projectiles/Typeless/AeroExplosive.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[fire].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Typeless/AmuletEnergy.cs b/Projectiles/Typeless/AmuletEnergy.cs new file mode 100644 index 0000000000..f6fd3a19e5 --- /dev/null +++ b/Projectiles/Typeless/AmuletEnergy.cs @@ -0,0 +1,273 @@ +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Projectiles.Typeless +{ + public class AmuletEnergy : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public Color bColor = Color.White; + public bool canDamage = false; + public bool visuals => Owner.Calamity().sSpiritAmuletVisual; // Enables/disables visuals and sounds based on accessory visibility + public ref float time => ref Projectile.ai[0]; + public ref float energyNumber => ref Projectile.ai[1]; // The number assigned to this energy, ranging from 1 to the max number of energies + public bool idle => Projectile.ai[2] == 0; // Floating around the player + public bool healing = false; // If the energies should heal the player. If false they will attack + public int soundCooldown = 0; // A cooldown after making a sound. Also used for some of the visuals when a sound is made + public SlotId soundSlot; + public NPC targeted; + public override void SetStaticDefaults() + { + ProjectileID.Sets.NoLiquidDistortion[Type] = true; + } + public override void SetDefaults() + { + Projectile.width = Projectile.height = 30; + Projectile.ignoreWater = true; + Projectile.timeLeft = 400; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 20; + } + + public override void AI() + { + bool spoke = (soundCooldown >= 250 * Projectile.MaxUpdates); + int startTime = 100; // Time after launch when it will begin attacking/healing + int endTime = 300; // Time after launch when it's movement code reaches it's cap on strength + + // Color is in blues if idle or healing, but becomes orange breifley if they speak or constantly if they are attacking + float colorShift = spoke ? Utils.GetLerpValue(250 * Projectile.MaxUpdates, 300 * Projectile.MaxUpdates, soundCooldown) : (idle || healing ? 0 : Utils.GetLerpValue(0, startTime, time)); + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + Color.Lerp(Color.Aquamarine, Color.LightSalmon, colorShift), + Color.Lerp(Color.MediumTurquoise, Color.Coral, colorShift) + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (idle || time < startTime) // If not attacking/healing keep it alive + Projectile.timeLeft++; + + if (Owner.dead || !Owner.Calamity().sSpiritAmulet) + Projectile.Kill(); + + if (Utils.Distance(Owner.Center, Projectile.Center) > 1100) // If it's too far away either teleport to the player if idle (or kill it if needed) + { + if (idle) + Projectile.Center = Owner.Center; + else if (targeted == null && !healing) + Projectile.Kill(); + } + + // Emit some light + Lighting.AddLight(Projectile.Center, bColor.ToVector3() * 0.65f); + + if (SoundEngine.TryGetActiveSound(soundSlot, out var sound) && sound.IsPlaying) + sound.Position = Projectile.Center; + + if (idle) // Following Ai + { + if (time == 0 && visuals) // On spawn fx + { + for (int i = 0; i <= 4; i++) + { + float variance = Main.rand.NextFloat(-0.5f, 0.5f); + Vector2 vel = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)) * 2; + float scale = (Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance)) * 0.35f; + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), vel); + dust2.scale = scale * 3; + dust2.noGravity = false; + dust2.alpha = 180; + dust2.color = Main.rand.NextBool(4) ? Color.Lerp(Color.Yellow, bColor, 0.5f) : bColor; + dust2.noLight = true; + dust2.noLightEmittence = true; + } + } + if (time > 80) // Track the player in a natural motion simular to swimming + { + float homingSpeed = Utils.Remap(Utils.Distance(Projectile.Center, Owner.Center), 200, 600, 0.07f, 0.16f) + 0.005f * energyNumber; + float offsetPower = Utils.GetLerpValue(1, 5, Owner.velocity.Length(), true); + float sine = (float)Math.Sin((time * 0.1f) / MathHelper.Pi); + float sine2 = (float)Math.Sin((time * 0.04f) / MathHelper.Pi); + Vector2 bonusMobility = (offsetPower > 0 ? ((Utils.DirectionTo(Projectile.Center, Owner.Center) * 50) * sine2).RotatedBy(0.8f * sine) * offsetPower : Vector2.Zero); + Vector2 goalPosition = Owner.MountedCenter + bonusMobility + ((MathHelper.TwoPi * energyNumber) / Math.Max(Owner.ownedProjectileCounts[ModContent.ProjectileType()], 1)).ToRotationVector2().RotatedBy(Main.GlobalTimeWrappedHourly * 0.4f) * 80; + + bool outOfRange = Utils.Distance(Projectile.Center, goalPosition) > 100; + if (Projectile.velocity.Length() < 5 && outOfRange) + Projectile.velocity = Projectile.velocity * 0.995f + Utils.DirectionTo(Projectile.Center, goalPosition) * homingSpeed; + else if (outOfRange) + Projectile.velocity *= 0.985f; + if (!outOfRange) + Projectile.velocity = Projectile.velocity.RotatedBy(0.0065f * (energyNumber % 2 == 0 ? -1 : 1)) * 1.004f; + + if (soundCooldown == 0 && Main.rand.NextBool(4500 * Projectile.MaxUpdates) && visuals && time > 18000 * Projectile.MaxUpdates && !Main.dedServ) // Sounds are an easter egg that only plays if they've been alive for over 5 minutes + { + SoundStyle certainlyNotADeadChild = new("CalamityMod/Sounds/Item/AmuletVox", 6); + soundSlot = SoundEngine.PlaySound(certainlyNotADeadChild with { Volume = 0.3f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = -1 }, Projectile.Center); + soundCooldown = 800 * Projectile.MaxUpdates; + } + if (soundCooldown > 0) + soundCooldown--; + } + else + Projectile.velocity *= 0.99f; + } + else // Attack/Healing Ai + { + soundCooldown = 0; + if (Projectile.ai[2] == 5) // Effects for the moment they stop being idle + { + Projectile.netUpdate = true; + time = 0; + healing = (Owner.statLife < Owner.statLifeMax2 * 0.5f); + Projectile.ai[2]++; + Projectile.velocity = Vector2.Lerp(Utils.DirectionTo(Owner.Center, Projectile.Center), Owner.velocity.SafeNormalize(Vector2.UnitX), 0.6f) * Main.rand.NextFloat(4.5f, 5.5f); + } + if (time <= startTime) + Projectile.velocity *= 0.99f; + + if (healing) // I wonder what this does :clueless: + { + float sine = (float)Math.Sin((time * 0.3f) / MathHelper.Pi); + Projectile.extraUpdates = 6; + + if (time > startTime) + { + float homingSpeed = Utils.Remap(time, startTime, endTime, 0.01f, 0.1f); + + Vector2 goalPosition = Owner.Center; + + if (Projectile.velocity.Length() < 5) + Projectile.velocity = Projectile.velocity.RotatedBy(0.02f * sine) * 0.99f + Utils.DirectionTo(Projectile.Center, goalPosition) * homingSpeed; + else + Projectile.velocity *= 0.985f; + + if (Utils.Distance(goalPosition, Projectile.Center) < 50) + { + Owner.HealPlayer((energyNumber % 2 == 0 ? 3 : 4)); + Projectile.netUpdate = true; + Projectile.Kill(); + } + } + } + else // Attacking + { + canDamage = true; + Projectile.extraUpdates = 6; + + if (time > startTime) + { + float homingSpeed = Utils.Remap(time, startTime, endTime, 0.01f, 0.1f); + + targeted = Projectile.Center.ClosestNPCAt(1200); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, homingSpeed, 25, 0.99f, accelerate: true); + + if (targeted == null) + { + Projectile.extraUpdates = 2; + if (Projectile.velocity.Y > -5) + { + Projectile.velocity.Y -= 0.8f * homingSpeed; + Projectile.velocity.X *= 0.997f; + } + } + else + Projectile.timeLeft++; + } + } + } + + float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true); + if (squash > 0.15f && visuals) + { + Particle fadeInfx = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 15, 0.4f * Projectile.scale, bColor * 0.3f * squash, new Vector2(1 - 0.15f * squash, 1f), true, false, shrinkSpeed: 0.3f * squash); + GeneralParticleHandler.SpawnParticle(fadeInfx); + } + + Projectile.scale = MathHelper.Lerp(Projectile.scale, spoke ? 1.4f : 1, 0.1f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 420); + Projectile.netUpdate = true; + } + public override void OnKill(int timeLeft) + { + if (!healing && visuals) + { + for (int i = 0; i <= 4; i++) + { + float variance = Main.rand.NextFloat(-0.5f, 0.5f); + Vector2 vel = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)) * 4; + float scale = (Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance)) * 0.35f; + + Particle sparks = new CustomSpark(Projectile.Center + vel, vel, "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(13, 16 + 1), scale, bColor * 0.7f, new Vector2(1f, 1), true, false, 0, false, shrinkSpeed: 0.25f); + GeneralParticleHandler.SpawnParticle(sparks); + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), vel); + dust2.scale = scale * 3; + dust2.noGravity = false; + dust2.alpha = 180; + dust2.color = Main.rand.NextBool(4) ? Color.Lerp(Color.Yellow, bColor, 0.5f) : bColor; + dust2.noLight = true; + dust2.noLightEmittence = true; + } + } + Projectile.netUpdate = true; + } + public override bool PreDraw(ref Color lightColor) + { + Asset orb = ModContent.Request("CalamityMod/Particles/BloomCircle"); + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 10) / MathHelper.Pi); + Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 1, 5, 1, 0.6f), Utils.Remap(Projectile.velocity.Length(), 1, 5, 1, 2f)); + + for (int i = 0; i < 6; i++) + { + Color orbColor = Color.Lerp(bColor, Color.Yellow, (i + 1) / 6) with { A = 0 } * 0.4f * (visuals ? 1 : 0.1f); + Vector2 scale = Projectile.scale * squash * (0.05f + i * 0.01f) * 3; + Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None); + } + + return false; + } + public override bool? CanDamage() => canDamage ? null : false; + public override bool? CanCutTiles() => false; + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteFlags(canDamage, healing); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + reader.ReadFlags(out canDamage, out healing); + } + } +} diff --git a/Projectiles/Typeless/ArcZap.cs b/Projectiles/Typeless/ArcZap.cs index 4a66e6b033..15c838ea73 100644 --- a/Projectiles/Typeless/ArcZap.cs +++ b/Projectiles/Typeless/ArcZap.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Typeless public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 90; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 90; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index 782c9d73ab..7e75dadd3c 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -1,332 +1,224 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Projectiles.Damageable; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - // TODO -- Make this one projectile with multiple frames instead of multiple projectiles with one frame. - public class ArtifactOfResilienceShard1 : ModProjectile, ILocalizedModType + public class ArtifactOfResilienceShards : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const int MaxTimeLeft = 360; - public const int FallTime = 240; - public const float OutwardMovementTime = 85f; - public const float InwardReturnMovementTime = 100f; - public const float MaxRadius = 240f; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 1; - } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public bool orbiting => Projectile.ai[1] == 0; + public Player Owner => Main.player[Projectile.owner]; + public Vector2 goalPosition; + public bool behind = false; + public int relicType = 1; + public float orbitSine = 0; + + public int burstTimer = 0; + public float speedMult = 1; + public float placementMult = 1; + public float orbitRot = 0; + public bool isAttacking => (burstTimer == 0 && !orbiting && Projectile.ai[1] != -1); public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = 50; + Projectile.height = 50; Projectile.friendly = true; Projectile.penetrate = -1; + Projectile.extraUpdates = 4; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = MaxTimeLeft; + Projectile.timeLeft = 230; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; + Projectile.ContinuouslyUpdateDamageStats = true; } - - public override void SendExtraAI(BinaryWriter writer) + public override void AI() { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } + float sine = (float)Math.Sin(time * 0.03f * speedMult / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * (0.03f * 0.5f * speedMult) / MathHelper.Pi); + float sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi); - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } + orbitSine = MathHelper.Lerp(Math.Abs(sine2), 0.1f, 1 - Math.Abs(sine2)); + float shardNumMult = Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType()], true) * (Owner.Calamity().profanedSoulRelicBuff ? 2 : 1); - public static void ArtifactOfResilienceShardAI(Projectile projectile, ref Vector2 StartingPosition, ref int Timer) - { - // Spinning - if (projectile.localAI[1] == 0f) + float displace = new Vector2(25, 0).RotatedBy(sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine * 0.5f).ToRotation(); + orbitRot = Utils.AngleLerp(orbitRot, displace, 0.01f); + goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult, (125 * orbitSine - 45) * shardNumMult * placementMult)).RotatedBy(orbitRot); + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.White, Color.Sienna, 0.5f).ToVector3() * 0.8f); + + if (Owner.Calamity().rOfResilienceCooldown > 0 && Projectile.ai[1] == 0) { - if (projectile.localAI[0] == 0f) + burstTimer = 120; + Projectile.ai[1] = 1; + Projectile.netUpdate = true; + } + if (Owner.Calamity().rOfResilienceEffect == 0 && Projectile.ai[1] == 0) + { + Projectile.ai[1] = -1; + Projectile.timeLeft = 95; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, goalPosition) * Main.rand.NextFloat(1f, 3f); + } + + if (time == 0) + { + relicType = Main.rand.Next(1, 6 + 1); + speedMult = (Owner.Calamity().profanedSoulRelicBuff ? Main.rand.NextFloat(0.6f, 1.5f) : Main.rand.NextFloat(0.8f, 1.2f)); + placementMult = Main.rand.NextFloat(0.75f, 1.15f); + } + + if (orbiting) + { + Projectile.scale = 0.8f + orbitSine * 0.5f; + Projectile.rotation += 0.02f * sine; + + Projectile.timeLeft++; + + Projectile.Center = goalPosition; + Projectile.velocity = Vector2.Zero; + + if (Projectile.scale < 0.9f) { - StartingPosition = projectile.Center; - projectile.netUpdate = true; - projectile.localAI[0] = 1f; + behind = true; + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0.15f, 0.057f); } - Timer++; - if (Timer < OutwardMovementTime) + else { - projectile.ai[1] = MathHelper.Lerp(0f, MaxRadius, Timer / OutwardMovementTime); + behind = false; + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0.7f, 0.027f); } - if (Timer > MaxTimeLeft - InwardReturnMovementTime) + } + else + { + Projectile.Opacity = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); + if (Projectile.ai[1] == -1) { - projectile.ai[1] = MathHelper.Lerp(0f, MaxRadius, (Timer - MaxTimeLeft) / -InwardReturnMovementTime); + Projectile.velocity *= 0.98f; } - projectile.ai[0] += MathHelper.Pi / (projectile.ai[1] / MathHelper.Pi + 1); - projectile.Center = StartingPosition + projectile.ai[0].ToRotationVector2() * projectile.ai[1]; - projectile.rotation = projectile.ai[0]; - if (projectile.timeLeft == 1) + else { - for (int i = 0; i < 50; i++) + if (burstTimer > 0) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); - dust.velocity = Utils.NextVector2Circular(Main.rand, 36f, 36f); - dust.scale = Main.rand.NextFloat(1.9f, 2.45f); - dust.noGravity = true; - } - projectile.timeLeft = FallTime; - projectile.tileCollide = true; - projectile.velocity = Utils.NextVector2Circular(Main.rand, 18f, 9f); - projectile.localAI[1] = 1; - } - if (projectile.ModProjectile is ArtifactOfResilienceShard1) - { - foreach (var n in Main.ActiveNPCs) - { - if (n.Distance(StartingPosition) < projectile.ai[1] && - n.damage > 0) + Projectile.extraUpdates = 1; + Projectile.velocity *= 0.9f; + if (Utils.Distance(Projectile.Center, Owner.Center) < 15) { - if (n.Calamity().relicOfResilienceCooldown <= 0) + behind = true; + Projectile.Center = Owner.Center; + } + else + { + Projectile.Center += Utils.DirectionTo(Projectile.Center, Owner.Center) * 40f * Utils.GetLerpValue(90, 0, burstTimer); + if (time % 8 == 0) { - n.Calamity().relicOfResilienceCooldown = 600; - n.Calamity().relicOfResilienceWeakness = 180; - n.AddBuff(ModContent.BuffType(), n.Calamity().relicOfResilienceWeakness); + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 8), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(20, 32 + 1), Main.rand.NextFloat(0.65f, 1.1f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), Vector2.One, false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + burstTimer--; + if (burstTimer == 0) + { + Projectile.Opacity = 1; + + int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType()] - 4; + + Projectile.velocity = ((MathHelper.TwoPi * Projectile.ai[2] / projNum).ToRotationVector2()) * 15 * speedMult; + Owner.Calamity().GeneralScreenShakePower = 5f; + + if (Projectile.ai[2] == 1) + { + SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center); + SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center); + } + for (int i = 0; i < 3; i++) + { + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38)); + dust.noGravity = Main.rand.NextBool(); + dust.scale = Main.rand.NextFloat(1.35f, 2.8f); + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna; } } } - } - } - // Falling - else - { - if (projectile.frameCounter <= ArtifactOfResilienceBulwark.MaxReformations) - { - // Reform - if (projectile.ModProjectile is ArtifactOfResilienceShard1 && Main.myPlayer == projectile.owner) + else { - Projectile reformedBulwark = Projectile.NewProjectileDirect(projectile.GetSource_FromThis(), - projectile.Center, - Vector2.Zero, - ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner); - reformedBulwark.frameCounter = projectile.frameCounter; // Incremented on death, not reformation. + Projectile.velocity *= 0.97f; } - projectile.Kill(); - return; - } - if (projectile.velocity.Y < 12f) - { - projectile.velocity.Y += 0.25f; - } - projectile.velocity.X *= 0.95f; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.timeLeft < 60f) - { - projectile.alpha = 255 - (int)MathHelper.Lerp(0, 255, projectile.timeLeft / 60f); } } - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 1; - } + if (isAttacking && Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.55f, 1.1f) * Projectile.Opacity; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + } - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; + time++; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= (isAttacking ? 1 : 0.45f); + if (isAttacking) + target.AddBuff(ModContent.BuffType(), 520); + } + public override void OnKill(int timeLeft) + { + + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = relicType switch + { + 1 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard1").Value, + 2 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard2").Value, + 3 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard3").Value, + 4 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard4").Value, + 5 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard5").Value, + _ => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6").Value + }; + if (isAttacking) + Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex); + else + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + if (behind) + behindProjectiles.Add(index); + else + overPlayers.Add(index); + } + public override bool? CanDamage() => (Projectile.ai[1] == -1 || burstTimer > 0) ? false : null; public override void SendExtraAI(BinaryWriter writer) { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); + writer.Write7BitEncodedInt(burstTimer); + writer.Write7BitEncodedInt(Owner.Calamity().rOfResilienceCooldown); } public override void ReceiveExtraAI(BinaryReader reader) { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); + burstTimer = reader.Read7BitEncodedInt(); + Owner.Calamity().rOfResilienceCooldown = reader.Read7BitEncodedInt(); } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard3 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard4 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard5 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard6 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); } } diff --git a/Projectiles/Typeless/AscendantAura.cs b/Projectiles/Typeless/AscendantAura.cs index 6e5b32dcc9..311dfd0c3d 100644 --- a/Projectiles/Typeless/AscendantAura.cs +++ b/Projectiles/Typeless/AscendantAura.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -69,6 +70,7 @@ namespace CalamityMod.Projectiles.Typeless int lifetime = Main.rand.Next(3, 6); float scale = Main.rand.NextFloat(0.5f, 0.9f); Color color = Main.rand.NextBool(3) ? Color.LightGreen : Color.Khaki; + /* SparkParticle spark1 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(7, 12), Main.rand.NextFloat(7, 12)), false, lifetime, scale, color); GeneralParticleHandler.SpawnParticle(spark1); SparkParticle spark2 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(-7, -12), Main.rand.NextFloat(7, 12)), false, lifetime, scale, color); @@ -81,6 +83,7 @@ namespace CalamityMod.Projectiles.Typeless GeneralParticleHandler.SpawnParticle(spark5); SparkParticle spark6 = new SparkParticle(Projectile.Center + new Vector2(-20, 0), new Vector2(Main.rand.NextFloat(-7, -12), 0), false, lifetime, scale - 0.3f, color); GeneralParticleHandler.SpawnParticle(spark6); + */ // Emit some light Vector3 Light = new Vector3(0.251f, 0.255f, 0.219f); @@ -94,14 +97,42 @@ namespace CalamityMod.Projectiles.Typeless { float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(8f, 0).RotatedBy(rot); - Vector2 velOffset = new Vector2(2.5f, 0).RotatedBy(rot); - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 204, new Vector2(velOffset.X, velOffset.Y)); + Vector2 velOffset = new Vector2(10.5f, 0).RotatedBy(rot); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 278, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; - dust.velocity = velOffset * Main.rand.NextFloat(0.9f, 1.1f); - dust.scale = 2.5f; + dust.velocity = velOffset * Main.rand.NextFloat(0.2f, 1.1f); + dust.scale = Main.rand.NextFloat(0.3f, 0.8f); + dust.color = Main.rand.NextBool(3) ? Color.LightGreen : Color.Khaki; } + + SoundStyle s = new("CalamityMod/Sounds/Item/AscendantActivate"); + SoundEngine.PlaySound(s with { Volume = 0.3f, Pitch = -0.9f }, Projectile.Center); } + public override bool PreDraw(ref Color lightColor) + { + Texture2D rTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/AscendantAura").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Color drawColor = Color.Lerp(Color.Khaki, Color.LightGreen, Utils.GetLerpValue(240, -100, Projectile.timeLeft, true)); + + Vector2 bScale = new Vector2(Main.rand.NextFloat(0.15f, 0.2f), 0.5f) * Projectile.scale * 0.04f * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true) * Main.rand.NextFloat(0.7f, 1.3f); + + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(-30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), MathHelper.ToRadians(90f), bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), MathHelper.ToRadians(-90f), bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(0, -30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true)) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0, bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(0, 30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true)) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), MathHelper.ToRadians(180f), bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + + for (int i = 0; i < 4; i++) + { + Vector2 bScale2 = new Vector2(0.1f, 0.8f) * Projectile.scale * 0.04f * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true) * Main.rand.NextFloat(0.7f, 1.3f); + Vector2 bVel = new Vector2(20 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0).RotatedBy(MathHelper.ToRadians(45f + (i * 90))) * Main.rand.NextFloat(0.6f, 1.3f); + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + bVel, null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), bVel.ToRotation() + MathHelper.ToRadians(90f), bTexture.Size() * 0.5f, bScale2, SpriteEffects.None, 0); + } + + Main.EntitySpriteDraw(rTexture, Projectile.Center - Main.screenPosition, null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), Projectile.rotation, rTexture.Size() * 0.5f, Projectile.scale * 0.4f * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), SpriteEffects.None, 0); + return false; + } public override bool? CanDamage() => false; } } diff --git a/Projectiles/Typeless/AscendantAura.png b/Projectiles/Typeless/AscendantAura.png index fb2bd6cc34..e48fd57ef6 100644 Binary files a/Projectiles/Typeless/AscendantAura.png and b/Projectiles/Typeless/AscendantAura.png differ diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index fed26b266e..3958cf21cd 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[astralDust].position = Projectile.Center + rotational * 12f; } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int starry = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[starry].velocity *= 0.66f; @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.light = 0.9f; if (Main.rand.NextBool(10)) Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(20) && !Main.dedServ) 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); } } @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Typeless 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) + if (!Main.dedServ) { for (int k = 0; k < 3; k++) 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); @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { Projectile.DrawStarTrail(Color.Coral, Color.White); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Typeless/BabyCannonballProjectile.cs b/Projectiles/Typeless/BabyCannonballProjectile.cs new file mode 100644 index 0000000000..15f00571b0 --- /dev/null +++ b/Projectiles/Typeless/BabyCannonballProjectile.cs @@ -0,0 +1,137 @@ +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 +{ + // This is p much just the Sulphuric Acid Cannon rocket but without the sticky behaviour + public class BabyCannonballProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public override string Texture => "CalamityMod/NPCs/Abyss/BabyCannonballJellyfish"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + Main.projFrames[Type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 36; + Projectile.height = 36; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 11; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + CalamityUtils.HomeInOnNPC(Projectile, true, 720f, 16f, Projectile.MaxUpdates * 20f); + // Trailing effects + if (!Main.dedServ && Projectile.FinalExtraUpdate() && Projectile.velocity.Length() > 3f) + { + Color color = new Color(136, 211, 113, 127); + Color fadeColor = new Color(165, 165, 86); + Vector2 gasSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); + Vector2 gasVelocity = Projectile.velocity * 1.2f + Projectile.velocity.RotatedBy(0.75f) * 0.3f; + gasVelocity *= Main.rand.NextFloat(0.24f, 0.6f); + + Particle gas = new MediumMistParticle(gasSpawnPosition, gasVelocity, color, fadeColor, Main.rand.NextFloat(0.5f, 1f), 205 - Main.rand.Next(50), 0.02f); + GeneralParticleHandler.SpawnParticle(gas); + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.13f * (i == 0 ? 0.2f : 0.5f), Color.Lerp(Color.SeaGreen, Color.PaleGreen, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 2; i++) + { + Color bubbleColor = Main.rand.NextBool() ? Color.SeaGreen : Color.YellowGreen; + Vector2 bubbleSpawnPos = Projectile.Center + Main.rand.NextVector2Circular(50, 50); + Vector2 bubbleVelocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f); + Particle bubble = new DirectionalPulseRing(bubbleSpawnPos, bubbleVelocity, bubbleColor, new Vector2(0.8f, 1), 0, 0.1f, 0f, 75); + GeneralParticleHandler.SpawnParticle(bubble); + } + } + Projectile.Opacity = 1f; + + if (Projectile.frameCounter++ > 4) + { + Projectile.frameCounter = 0; + Projectile.frame++; + } + if (Projectile.frame >= Main.projFrames[Type]) + { + Projectile.frame = 0; + } + } + + 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 OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item62, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); + if (Projectile.owner == Main.myPlayer) + { + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[p].DamageType = DamageClass.Default; + } + // Circular spread of clouds and bubbles for impact + for (int i = 0; i < 35; i++) + { + Vector2 smokeVel = Main.rand.NextVector2Unit() * Main.rand.NextVector2Circular(32f, 32f); + Color smokeColor = Main.rand.NextBool() ? Color.SeaGreen : Color.PaleGreen; + Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(1.4f, 4f), (200 - Main.rand.Next(60)), 0.08f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 8; i++) + { + Vector2 bubbleVel = Main.rand.NextVector2Circular(26f, 26f); + Color bubbleColor = Main.rand.NextBool() ? Color.OliveDrab : Color.SeaGreen; + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center, bubbleVel, bubbleColor, new Vector2(0.8f, 1), 0, 0.21f, 0f, 50); + GeneralParticleHandler.SpawnParticle(pulse); + } + //Explosion effect + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.SeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = frame.Size() * 0.5f; + Main.EntitySpriteDraw(Texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Projectiles/Typeless/BasicBurst.cs b/Projectiles/Typeless/BasicBurst.cs new file mode 100644 index 0000000000..df59243a41 --- /dev/null +++ b/Projectiles/Typeless/BasicBurst.cs @@ -0,0 +1,95 @@ +using System; +using System.IO; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BasicBurst : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Vector2 pushVelocity; + public float customKnockback = 0; + + public bool hasStongDisplacement = false; // If you set Knockback to anything below zero, the custom knockback will be able to effect enemies that normally ignore knockback. + + // Projectile.ai[0] is the size of the circular hitbox. + // Projectile.ai[1] is the minimum multiplier on pierce damage. + // Projectile.ai[2] is the number of hits to reach minimum pierce damage. + + // You can use the local ai variables 0 - 2 to inflict up to two debuffs, if you need more than two debuffs just make your own projectile + // 0 and 2 are what debuff is being inflicted + // 1 is the debuff duration + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + // Get custom knockback strength. + // Takes the knockback applied to the projectile to determine strength, then sets regular knockback to zero + // Negative knockback is Abs'd and turns on strong knockback that effects more kinds of enemies + if (customKnockback == 0) + { + if (Projectile.knockBack < 0) + hasStongDisplacement = true; + customKnockback = Math.Abs(Projectile.knockBack); + Projectile.knockBack = 0; + } + if (Projectile.ai[0] == 0) + Projectile.ai[0] = 50; // The base size for explosions is 50. + if (Projectile.ai[1] == 0) + Projectile.ai[1] = 0.1f; // The base minimum damage multiplier is 0.1f. + if (Projectile.ai[2] == 0) + Projectile.ai[2] = 5; // The base number of hit to reach minimum damage is 5. + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.localAI[0] != 0) // Debuff 1 + { + target.AddBuff((int)(Projectile.localAI[0]), (int)(Projectile.localAI[1])); + } + if (Projectile.localAI[2] != 0) // Debuff 2 + { + target.AddBuff((int)(Projectile.localAI[2]), (int)(Projectile.localAI[1])); + } + pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback; + float minMult = Projectile.ai[1]; + int hitsToMinMult = (int)Projectile.ai[2]; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + if (customKnockback != 0 && target.CanBeMoved(hasStongDisplacement)) + { + target.velocity = (pushVelocity * (target.knockBackResist == 0 ? 0.5f : 1)); + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[0], targetHitbox); + } + public override void SendExtraAI(BinaryWriter writer) // Sending extra ai for the debuff infliction + { + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); + writer.Write(Projectile.localAI[2]); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[2] = reader.ReadSingle(); + } + } +} diff --git a/Projectiles/Typeless/BasicPlagueBee.cs b/Projectiles/Typeless/BasicPlagueBee.cs index 6122f85d3a..dbdc38363a 100644 --- a/Projectiles/Typeless/BasicPlagueBee.cs +++ b/Projectiles/Typeless/BasicPlagueBee.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Typeless public int tileCollisions = 0; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -31,6 +32,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = 2; + Projectile.extraUpdates = 1; Projectile.timeLeft = 300; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; @@ -66,7 +68,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -182,8 +184,8 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; int drawStart = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) diff --git a/Projectiles/Typeless/BlackGlassBandProjectile.cs b/Projectiles/Typeless/BlackGlassBandProjectile.cs new file mode 100644 index 0000000000..62e17f4eb4 --- /dev/null +++ b/Projectiles/Typeless/BlackGlassBandProjectile.cs @@ -0,0 +1,68 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BlackGlassBandProjectile : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public int time = 0; + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 0; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.timeLeft = 2; + Projectile.ArmorPenetration = 25; + } + public override void PostAI() + { + if (time == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Custom/AuricMine", 3); + SoundEngine.PlaySound(sound with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.15f, 0.25f), MaxInstances = -1 }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/Item/NullHit"); + SoundEngine.PlaySound(sound2 with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.3f, 0.45f), MaxInstances = -1 }, Projectile.Center); + + for (int i = 0; i < 18; i++) + { + Particle spark = new CustomSpark(Projectile.Center, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f), "CalamityMod/Particles/GlowOrbParticle", true, 35, Main.rand.NextFloat(0.6f, 0.8f), Main.rand.NextBool() ? Color.DarkSlateBlue : Color.MediumPurple, new Vector2(0.8f, 1.2f), false); + GeneralParticleHandler.SpawnParticle(spark); + } + float randRot = Main.rand.NextFloat(0, MathHelper.Pi); + for (int i = -1; i <= 1; i += 2) + { + Vector2 position = Projectile.Center + (Vector2.UnitX * 20 * i).RotatedBy(randRot); + Particle spark = new CustomSpark(position, Vector2.UnitY.RotatedBy(randRot) * 0.001f, "CalamityMod/Particles/GlowSpark", false, 15, 0.03f, Color.DarkSlateBlue, new Vector2(7f, 0.2f), true, shrinkSpeed: 0.55f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = -1; i <= 1; i += 2) + { + Vector2 position = Projectile.Center + (Vector2.UnitY * 20 * i).RotatedBy(randRot); + Particle spark = new CustomSpark(position, Vector2.UnitX.RotatedBy(randRot) * 0.001f, "CalamityMod/Particles/GlowSpark", false, 15, 0.03f, Color.DarkSlateBlue, new Vector2(7f, 0.2f), true, shrinkSpeed: 0.55f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SetCrit(); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player Owner = Main.player[Projectile.owner]; + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().bGlassbandCooldown > BlackGlassBand.cooldown / 2) + Owner.Calamity().bGlassbandCooldown = BlackGlassBand.cooldown / 2; + } + } +} diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index 4509aaf731..813cd82252 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -1,8 +1,15 @@ using System; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -11,23 +18,35 @@ namespace CalamityMod.Projectiles.Typeless public class BlazingStarHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Particles/Sparkle"; - public override string Texture => "CalamityMod/Projectiles/StarProj"; + public static Asset Bloom; + public override void Load() => Bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 25; + ProjectileID.Sets.TrailingMode[Type] = 2; + } public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = Projectile.height = 30; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 200; } public override void AI() { + if (Projectile.timeLeft == 200) + Projectile.rotation = Projectile.velocity.ToRotation(); + + Projectile.rotation += MathHelper.ToRadians(6f) * Utils.GetLerpValue(0f, 30f, Projectile.timeLeft, true); + Projectile.scale = Utils.GetLerpValue(-10f, 30f, Projectile.timeLeft, true); // Gets smaller but not completely invisible while dying out + if (Projectile.timeLeft % 4 == 0) //only once per 4 frames Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); if (Projectile.timeLeft > 190) @@ -43,13 +62,10 @@ namespace CalamityMod.Projectiles.Typeless return; float playerDist = Vector2.Distance(player.Center, Projectile.Center); - if (!player.immune && playerDist < 50f && !player.dead && 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) + if (!player.immune && playerDist < 30f * Projectile.scale && Projectile.timeLeft <= 190) { int healAmt = Utils.Clamp((200 - Projectile.timeLeft) / 10, 1, 10); //min heal is 5, max heal is 10, achievable after 2 seconds - player.HealEffect(healAmt, false); - player.statLife += healAmt; - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + player.HealPlayer(healAmt, HealTextType.Local); NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt); @@ -57,67 +73,56 @@ namespace CalamityMod.Projectiles.Typeless } } + internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 16f; + internal Color ColorFunction(float completionRatio) + { + float hue = 0.35f + 0.1f * completionRatio * CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly * 0.25f) % 1f); + Color trailColor = Main.hslToRgb(hue, 0.6f, 0.5f); + return trailColor * Projectile.Opacity; + } + public override bool PreDraw(ref Color lightColor) { - 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; - Vector2 colorSize = starTexture.Size() / 2f; - Color lesserHealGreen = healGreen * 0.5f; - float colorLerp = 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 scaledColorLerp1 = new Vector2(0.5f, 1f) * colorLerp; - Vector2 scaledColorLerp2 = new Vector2(0.5f, 1f) * colorLerp; - healGreenDraw *= colorLerp; - lesserHealGreen *= colorLerp; + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); - Vector2 drawPos = projPos + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0; + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D sparkleTex = TextureAssets.Projectile[Type].Value; + Texture2D bloomTex = Bloom.Value; + float bloomScale = (sparkleTex.Height / (float)bloomTex.Height) * Projectile.scale; + float sparkleScale = (0.5f + CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly % 2f) / 2f) * 0.2f) * Projectile.scale; - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, (float)Math.PI / 2f, colorSize, scaledColorLerp1, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, 0f, colorSize, scaledColorLerp2, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, (float)Math.PI / 2f, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, 0f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); - - Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.36f, spriteEffects, 0); + Color color = ColorFunction(0f); + Vector2 drawPos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(bloomTex, drawPos, null, color * 0.5f, 0, bloomTex.Size() * 0.5f, 5f * bloomScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, Color.Lerp(color, Color.White, 0.7f), Projectile.rotation, sparkleTex.Size() * 0.5f, 2.2f * sparkleScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, color, Projectile.rotation + MathHelper.PiOver4, sparkleTex.Size() * 0.5f, 1.6f * sparkleScale, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 40; - Projectile.height = 40; - 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++) + SoundEngine.PlaySound(SoundID.Item14 with { Pitch = -0.3f, Volume = 0.7f }, Projectile.Center); + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); + SoundEngine.PlaySound(fireHeal with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center); + + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, ColorFunction(0f), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.04f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Color smokeColor = Color.Lerp(ColorFunction(0f), Color.DarkSlateGray, 0.5f); + for (int i = 0; i < 7; i++) { - 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()) - { - Main.dust[duster].scale = 0.5f; - Main.dust[duster].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Particle smoke = new HeavySmokeParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(7f), smokeColor, 30, Main.rand.NextFloat(0.4f, 1f), 0.5f, Main.rand.NextFloat(-0.03f, 0.03f), true); + GeneralParticleHandler.SpawnParticle(smoke); } - for (int j = 0; j < 8; j++) + for (int i = 0; i < 8; i++) { - 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(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[duster2].velocity *= 2f; - Main.dust[duster2].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.8f, 10f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.color = ColorFunction(0f); + dust.noLightEmittence = true; } } diff --git a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs index 1498b0c95f..d782b2b97d 100644 --- a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs +++ b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs @@ -1,11 +1,15 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.NPCs.Providence; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +18,16 @@ namespace CalamityMod.Projectiles.Typeless public class BlazingStarThatDoesNotHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/StarProj"; + public override string Texture => "CalamityMod/Particles/Sparkle"; + + public static Asset Bloom; + public override void Load() => Bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; + } public override void SetDefaults() { @@ -22,107 +35,72 @@ namespace CalamityMod.Projectiles.Typeless Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.alpha = 255; Projectile.penetrate = 1; - Projectile.timeLeft = 200; + Projectile.timeLeft = 180; } public override void AI() { + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.timeLeft % 4 == 0) //only once per 4 frames Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); - if (Projectile.ai[0] < 240f) - { - Projectile.ai[0] += 1f; + if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.015f; + } - if (Projectile.timeLeft < 160) - Projectile.timeLeft = 160; - } - - if (Projectile.velocity.Length() < 16f) - Projectile.velocity *= 1.01f; + internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 16f; + internal Color ColorFunction(float completionRatio) + { + float hue = 0.04f * (Projectile.ai[0] % 4f) + 0.1f * completionRatio * CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly * 0.25f) % 1f); + Color trailColor = Main.hslToRgb(hue, 0.8f, 0.6f); + return trailColor * Projectile.Opacity * 0.5f; } public override bool PreDraw(ref Color lightColor) { - 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; + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 8); - 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; - baseColor.A = 0; - Color colorA = baseColor; - Color colorB = baseColor * 0.5f; - colorA *= lerpMult; - colorB *= lerpMult; - Vector2 origin = texture.Size() / 2f; - Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult; + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D sparkleTex = TextureAssets.Projectile[Type].Value; + Texture2D bloomTex = Bloom.Value; + float bloomScale = (float)sparkleTex.Height / (float)bloomTex.Height; + float sparkleScale = 0.5f + CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly % 2f) / 2f) * 0.2f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - float upRight = MathHelper.PiOver4; - float up = MathHelper.PiOver2; - float upLeft = 3f * MathHelper.PiOver4; - float left = MathHelper.Pi; - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upLeft, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upRight, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, spriteEffects, 0); + Color color = ColorFunction(0f); + float rotation = Projectile.rotation + Main.GlobalTimeWrappedHourly * 8f; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(bloomTex, drawPos, null, color * 0.5f, 0, bloomTex.Size() * 0.5f, 5f * bloomScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, Color.Lerp(color, Color.White, 0.7f), rotation, sparkleTex.Size() * 0.5f, 2.2f * sparkleScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, color, rotation + MathHelper.PiOver4, sparkleTex.Size() * 0.5f, 1.6f * sparkleScale, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); return false; } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.ExpandHitboxBy(50); - int dustType = (int)CalamityDusts.ProfanedFire; - for (int d = 0; d < 5; d++) + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, ColorFunction(0f), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.04f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Color smokeColor = Color.Lerp(ColorFunction(0f), Color.DarkSlateGray, 0.5f); + for (int i = 0; i < 7; i++) { - int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holy].velocity *= 3f; - Main.dust[holy].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[holy].scale = 0.5f; - Main.dust[holy].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Particle smoke = new HeavySmokeParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(7f), smokeColor, 30, Main.rand.NextFloat(0.4f, 1f), 0.5f, Main.rand.NextFloat(-0.03f, 0.03f), true); + GeneralParticleHandler.SpawnParticle(smoke); } - for (int d = 0; d < 8; d++) + for (int i = 0; i < 8; i++) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - Main.dust[fire].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.8f, 10f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.color = ColorFunction(0f); + dust.noLightEmittence = true; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 60 * 5); - - Projectile.Kill(); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - // If the player is dodging, don't apply debuffs - if (target.creativeGodMode) - return; - - target.AddBuff(ModContent.BuffType(), 60 * 5, false); - - Projectile.Kill(); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60 * 5); } } diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs index 61bf31726a..4a534b93c1 100644 --- a/Projectiles/Typeless/BlunderBoosterAura.cs +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; } public override void SetDefaults() @@ -86,42 +86,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - // Don't draw the aura at all if visibility is toggled off - if (!Main.player[Projectile.owner].Calamity().blunderBoosterVisibility) - return false; - - Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D sprite = Terraria.GameContent.TextureAssets.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); Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); - float opacity = 1f; - int sparkCount = 0; - int fadeTime = 20; - - if (Projectile.timeLeft < fadeTime) - { - opacity = Projectile.timeLeft * (1f / fadeTime); - sparkCount = fadeTime - Projectile.timeLeft; - } - - for (int i = 0; i < sparkCount * 2; i++) - { - int dustType = 132; - if (Main.rand.NextBool()) - { - dustType = 264; - } - float rangeDiff = 2f; - - Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - dustPos.Normalize(); - dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); - - int dust = Dust.NewDust(Projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); - Main.dust[dust].noGravity = true; - } + float opacity = Main.player[Projectile.owner].Calamity().blunderBoosterVisibility ? 1f : 0.25f; Main.EntitySpriteDraw(sprite, Projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, Projectile.rotation, origin, 1f, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Typeless/BobbitHead.cs b/Projectiles/Typeless/BobbitHead.cs index c49a121a9c..58add5c52b 100644 --- a/Projectiles/Typeless/BobbitHead.cs +++ b/Projectiles/Typeless/BobbitHead.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Tools; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,14 +12,15 @@ namespace CalamityMod.Projectiles.Typeless public class BobbitHead : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public const float PullSpeed = 24f; - public const float ReelbackSpeed = 28f; - public const float LaunchSpeed = 25f; - public const float GrappleRangInTiles = 40f; - public override void SetDefaults() - { - Projectile.CloneDefaults(ProjectileID.GemHookAmethyst); - } + + public static Asset Chain; + public override void Load() => Chain = Request("CalamityMod/Projectiles/Typeless/BobbitHookChain"); + + public override void SetDefaults() => Projectile.CloneDefaults(ProjectileID.GemHookAmethyst); + + public override float GrappleRange() => BobbitHook.Reach * 16f; + public override void GrappleRetreatSpeed(Player player, ref float speed) => speed = BobbitHook.ReelbackSpeed; + public override void GrapplePullSpeed(Player player, ref float speed) => speed = BobbitHook.PullSpeed; // Use this hook for hooks that can have multiple hooks mid-flight: Dual Hook, Web Slinger, Fish Hook, Static Hook, Lunar Hook public override bool? CanUseGrapple(Player player) @@ -36,31 +39,9 @@ namespace CalamityMod.Projectiles.Typeless } return true; } + public override void NumGrappleHooks(Player player, ref int numHooks) => numHooks = 1; - // Amethyst Hook is 300, Static Hook is 600, 16f = 1 tile - public override float GrappleRange() => GrappleRangInTiles * 16f; - - public override void NumGrappleHooks(Player player, ref int numHooks) - { - numHooks = 1; - } - - // default is 11, Lunar is 24 - public override void GrappleRetreatSpeed(Player player, ref float speed) - { - speed = ReelbackSpeed; - } - - public override void GrapplePullSpeed(Player player, ref float speed) - { - speed = PullSpeed; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawHook(Projectile, Request("CalamityMod/Projectiles/Typeless/BobbitHookChain").Value); - return true; - } + public override bool PreDraw(ref Color lightColor) => Projectile.DrawHook(Chain.Value); public override void AI() { diff --git a/Projectiles/Typeless/BobbitHead.png b/Projectiles/Typeless/BobbitHead.png index e7cebc02a2..5b5d8bb298 100644 Binary files a/Projectiles/Typeless/BobbitHead.png and b/Projectiles/Typeless/BobbitHead.png differ diff --git a/Projectiles/Typeless/BobbitHookChain.png b/Projectiles/Typeless/BobbitHookChain.png index 8fff99d3a4..25064840ca 100644 Binary files a/Projectiles/Typeless/BobbitHookChain.png and b/Projectiles/Typeless/BobbitHookChain.png differ diff --git a/Projectiles/Typeless/BossRushEffectThing.cs b/Projectiles/Typeless/BossRushEffectThing.cs index afd9b6d18a..7b91925a73 100644 --- a/Projectiles/Typeless/BossRushEffectThing.cs +++ b/Projectiles/Typeless/BossRushEffectThing.cs @@ -1,6 +1,7 @@ using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs; +using CalamityMod.Packets; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; @@ -68,12 +69,9 @@ namespace CalamityMod.Projectiles.Typeless BossRushDialogueSystem.StartDialogue(DownedBossSystem.startedBossRushAtLeastOnce ? BossRushDialoguePhase.StartRepeat : BossRushDialoguePhase.Start); CalamityNetcode.SyncWorld(); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { - var netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(BossRushEvent.BossRushStage); - netMessage.Send(); + BossRushStagePacket.Send(); } } } diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs index 879c088d75..67ad0a2a99 100644 --- a/Projectiles/Typeless/BossRushEndEffectThing.cs +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Typeless foreach (Player p in Main.ActivePlayers) { int rock = Item.NewItem(p.GetSource_Misc("CalamityMod_BossRushRock"), (int)p.position.X, (int)p.position.Y, p.width, p.height, ModContent.ItemType()); - if (Main.netMode == NetmodeID.Server) + if (rock < Main.maxItems && Main.dedServ) { Main.timeItemSlotCannotBeReusedFor[rock] = 54000; NetMessage.SendData(MessageID.InstancedItem, p.whoAmI, -1, null, rock); diff --git a/Projectiles/Typeless/ChaoticGeyser.cs b/Projectiles/Typeless/ChaoticGeyser.cs index b3eabf5aef..174b62342d 100644 --- a/Projectiles/Typeless/ChaoticGeyser.cs +++ b/Projectiles/Typeless/ChaoticGeyser.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Typeless { int cap = 3; float capDamageFactor = 0.05f; - int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type] - cap; + int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap; modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f); } diff --git a/Projectiles/Typeless/ChlorophyteLifePulse.cs b/Projectiles/Typeless/ChlorophyteLifePulse.cs index c76a6f1bc5..98e98e702e 100644 --- a/Projectiles/Typeless/ChlorophyteLifePulse.cs +++ b/Projectiles/Typeless/ChlorophyteLifePulse.cs @@ -57,8 +57,7 @@ namespace CalamityMod.Projectiles.Typeless continue; int healQuantity = (int)owner.GetBestClassDamage().ApplyTo(ChlorophyteArmorSetChange.AmountToHealPerPulse); - player.statLife += healQuantity; - player.HealEffect(healQuantity); + player.HealPlayer(healQuantity); player.Calamity().ChlorophyteHealDelay = ChlorophyteArmorSetChange.DelayBetweenHeals; } } @@ -73,7 +72,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Color drawColor = Projectile.GetAlpha(lightColor) * 0.4f; for (int i = 0; i < 8; i++) { diff --git a/Projectiles/Typeless/ChronoClock.cs b/Projectiles/Typeless/ChronoClock.cs index 565a8ed14a..b699426f5d 100644 --- a/Projectiles/Typeless/ChronoClock.cs +++ b/Projectiles/Typeless/ChronoClock.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Type] = 8; } diff --git a/Projectiles/Typeless/CoralBubble.cs b/Projectiles/Typeless/CoralBubble.cs index c3218486a7..9d4cd5e92e 100644 --- a/Projectiles/Typeless/CoralBubble.cs +++ b/Projectiles/Typeless/CoralBubble.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Typeless/CoralBubbleSmall.cs b/Projectiles/Typeless/CoralBubbleSmall.cs index 1ab46a05b0..d6bc051dae 100644 --- a/Projectiles/Typeless/CoralBubbleSmall.cs +++ b/Projectiles/Typeless/CoralBubbleSmall.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Typeless/CryonicShield.cs b/Projectiles/Typeless/CryonicShield.cs index cf4f131080..d32a00d7f5 100644 --- a/Projectiles/Typeless/CryonicShield.cs +++ b/Projectiles/Typeless/CryonicShield.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; } public override void SetDefaults() diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index af813ea592..99313d1a2a 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -178,7 +179,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } @@ -188,23 +189,11 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - Vector2 velocity = Projectile.velocity; - velocity.Normalize(); - velocity *= 4f; - - int spread = 45; - int numProj = 4; - float rotation = MathHelper.ToRadians(spread); - float baseSpeed = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y); - double startAngle = Math.Atan2(velocity.X, velocity.Y) - rotation / 2; - double deltaAngle = rotation / (float)numProj; - double offsetAngle; - - for (int i = 0; i < numProj; i++) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4f; + for (int i = 0; i < 4; i++) { - offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), - ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.33f, Projectile.owner, 0f, 0f); + float offset = MathHelper.ToRadians(MathHelper.Lerp(-22.5f, 22.5f, i / 3f)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(offset), ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.33f, Projectile.owner); } SoundEngine.PlaySound(SoundID.Item110, Projectile.Center); diff --git a/Projectiles/Typeless/CursorProjSplit.cs b/Projectiles/Typeless/CursorProjSplit.cs index 1031a67052..3c2174243a 100644 --- a/Projectiles/Typeless/CursorProjSplit.cs +++ b/Projectiles/Typeless/CursorProjSplit.cs @@ -14,8 +14,9 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -180,7 +181,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } diff --git a/Projectiles/Typeless/CyanLabSeeker.cs b/Projectiles/Typeless/CyanLabSeeker.cs index f876fb8975..07f7da0ee5 100644 --- a/Projectiles/Typeless/CyanLabSeeker.cs +++ b/Projectiles/Typeless/CyanLabSeeker.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/DemonshadeRedDevil.cs b/Projectiles/Typeless/DemonshadeRedDevil.cs index df25b38ec2..6a464560cb 100644 --- a/Projectiles/Typeless/DemonshadeRedDevil.cs +++ b/Projectiles/Typeless/DemonshadeRedDevil.cs @@ -14,11 +14,14 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public int dust = 3; + public ref float State => ref Projectile.ai[0]; // 0 = attacking, 1 = returning, 2 = initial spawn + public ref float Timer => ref Projectile.ai[1]; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 5; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -55,6 +58,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = 2; } } + dust--; if (dust >= 0) { @@ -65,57 +69,41 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[brimDust].scale *= 1.15f; } } + Projectile.frameCounter++; if (Projectile.frameCounter > 8) { - Projectile.frame++; Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 4) + Projectile.frame = 0; } - if (Projectile.frame > 4) - { - Projectile.frame = 0; - } + float lights = (float)Main.rand.Next(90, 111) * 0.01f; lights *= Main.essScale; Lighting.AddLight(Projectile.Center, 1f * lights, 0f * lights, 0.15f * lights); + Projectile.rotation = Projectile.velocity.X * 0.04f; if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { Projectile.spriteDirection = -Projectile.direction; } - float attackRange = 2000f; - bool decelerate = false; - if (Projectile.ai[0] == 2f) + + if (State == 2f) { - Projectile.ai[1] += 1f; - Projectile.extraUpdates = 1; - if (Projectile.ai[1] > 40f) + Timer++; + if (Timer > 60f) { - Projectile.ai[1] = 1f; - Projectile.ai[0] = 0f; - Projectile.extraUpdates = 0; - Projectile.numUpdates = 0; + Timer = 1f; + State = 0f; Projectile.netUpdate = true; } - else - { - decelerate = true; - } - } - if (decelerate) - { return; } - Vector2 projPos = Projectile.position; + + Vector2 attackPos = Projectile.position; + float attackRange = 2000f; bool canAttack = false; - if (Projectile.ai[0] != 1f) - { - Projectile.tileCollide = false; - } - if (Projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16))) - { - Projectile.tileCollide = false; - } if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; @@ -125,7 +113,7 @@ namespace CalamityMod.Projectiles.Typeless if (!canAttack && npcDist < attackRange) { attackRange = npcDist; - projPos = npc.Center; + attackPos = npc.Center; canAttack = true; } } @@ -140,68 +128,54 @@ namespace CalamityMod.Projectiles.Typeless if ((!canAttack && npcDist < attackRange) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) { attackRange = npcDist; - projPos = nPC2.Center; + attackPos = nPC2.Center; canAttack = true; } } } } - float separationAnxietyDist = 2000f; - if (canAttack) - { - separationAnxietyDist = 3000f; - } + + float separationAnxietyDist = canAttack ? 3000f: 2000f; if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { - Projectile.ai[0] = 1f; - Projectile.tileCollide = false; + State = 1f; Projectile.netUpdate = true; } - if (canAttack && Projectile.ai[0] == 0f) + if (canAttack && State == 0f) { - Vector2 projDirection = projPos - Projectile.Center; + Vector2 projDirection = attackPos - Projectile.Center; float projDist = projDirection.Length(); projDirection.Normalize(); if (projDist > 200f) { - float scaleFactor2 = 16f; //8 - projDirection *= scaleFactor2; + projDirection *= 25f; Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } else { - projDirection *= -4f; + projDirection *= -9f; Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } } else { - bool isReturning = false; - if (!isReturning) - { - isReturning = Projectile.ai[0] == 1f; - } - float returnSpeed = 5f; //6 - if (isReturning) - { - returnSpeed = 12f; //15 - } - Vector2 center2 = Projectile.Center; - Vector2 playerDirection = player.Center - center2 + new Vector2(0f, -30f); //-60 + bool isReturning = State == 1f; + float returnSpeed = isReturning ? 24f : 15f; + + Vector2 playerDirection = player.Center - Projectile.Center + new Vector2(0f, -30f); float playerDist = playerDirection.Length(); - if (playerDist > 200f && returnSpeed < 6.5f) //200 and 8 + if (playerDist > 200f && returnSpeed < 10f) { - returnSpeed = 6.5f; //8 + returnSpeed = 18f; } if (playerDist < 150f && isReturning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - Projectile.ai[0] = 0f; + State = 0f; Projectile.netUpdate = true; } if (playerDist > 2000f) { - Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); - Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.Center = player.Center; Projectile.netUpdate = true; } if (playerDist > 70f) @@ -210,34 +184,29 @@ namespace CalamityMod.Projectiles.Typeless playerDirection *= returnSpeed; Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } - else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) + else if (Projectile.velocity == Vector2.Zero) { - Projectile.velocity.X = -0.2f; - Projectile.velocity.Y = -0.1f; + Projectile.velocity = new Vector2(-0.2f, -0.1f); } } - if (Projectile.ai[1] > 0f) + if (Timer > 0f) { - Projectile.ai[1] += (float)Main.rand.Next(1, 4); + Timer += Main.rand.Next(1, 2 + 1); } - if (Projectile.ai[1] > 80f) + if (Timer > 80f) { - Projectile.ai[1] = 0f; + Timer = 0f; Projectile.netUpdate = true; } - if (Projectile.ai[0] == 0f) + if (State == 0f) { - float speed = 24f; - int projType = ProjectileID.UnholyTridentFriendly; - if (canAttack && Projectile.ai[1] == 0f) + if (canAttack && Timer == 0f) { - Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, projPos, 0, 0)) + Timer += 1f; + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, attackPos, 0, 0)) { - Vector2 velocity = projPos - Projectile.Center; - velocity.Normalize(); - velocity *= speed; - int trident = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, 0f, Main.myPlayer); + Vector2 velocity = Vector2.Normalize(attackPos - Projectile.Center) * 24f; + int trident = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ProjectileID.UnholyTridentFriendly, Projectile.damage, 0f, Main.myPlayer); if (trident.WithinBounds(Main.maxProjectiles)) { Main.projectile[trident].timeLeft = 300; @@ -251,16 +220,6 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool PreDraw(ref Color lightColor) - { - SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - 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; - } - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Typeless/DirectStrike.cs b/Projectiles/Typeless/DirectStrike.cs index 00e5e29391..7cdb417153 100644 --- a/Projectiles/Typeless/DirectStrike.cs +++ b/Projectiles/Typeless/DirectStrike.cs @@ -1,4 +1,5 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -7,7 +8,11 @@ namespace CalamityMod.Projectiles.Typeless { public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool invalidTarget => (Projectile.ai[0] < 0f || Projectile.ai[0] > 199f); + public Vector2 pushVelocity => new Vector2(Projectile.ai[1], Projectile.ai[2]); + // You can set projectile.ai 1 & 2 to the x and y velocity that you would like to launch the target, even if the direct strike deals no damage + public bool hasStongDisplacement = false; // If you set Knockback to anything below zero, the custom knockback will be able to effect enemies that normally ignore knockback public override void SetDefaults() { Projectile.width = 2; @@ -20,13 +25,39 @@ namespace CalamityMod.Projectiles.Typeless Projectile.alpha = 255; Projectile.timeLeft = 2; } + public override void AI() + { + if (Projectile.knockBack < 0) + { + hasStongDisplacement = true; + Projectile.knockBack = 0; + } + + // If the target is moving VERY fast, direct strikes spawned on top of them can actually miss + // Setting a target will gaurentee hits on said target by teleporting the projectile onto them every frame + if (!invalidTarget) + Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; + } // If the AI parameter isn't a valid NPC slot, it can hit anything. Otherwise it can only hit one NPC. public override bool? CanHitNPC(NPC target) { - if (Projectile.ai[0] < 0f || Projectile.ai[0] > 199f || Projectile.ai[0] == target.whoAmI) + if (invalidTarget || Projectile.ai[0] == target.whoAmI) return null; return (bool?)false; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + NPC target = Main.npc[(int)Projectile.ai[0]]; + if (pushVelocity != Vector2.Zero && !invalidTarget && target.CanBeMoved(hasStongDisplacement)) + { + target.velocity = (pushVelocity * (target.knockBackResist == 0 ? 0.5f : 1)); + } + return true; + } + return false; + } } } diff --git a/Projectiles/Typeless/EmpyreanGlob.cs b/Projectiles/Typeless/EmpyreanGlob.cs index e37baee7dd..ca6b639559 100644 --- a/Projectiles/Typeless/EmpyreanGlob.cs +++ b/Projectiles/Typeless/EmpyreanGlob.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Typeless public class EmpyreanGlob : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; diff --git a/Projectiles/Typeless/EmpyreanMarble.cs b/Projectiles/Typeless/EmpyreanMarble.cs index 1b778ace31..7345791cff 100644 --- a/Projectiles/Typeless/EmpyreanMarble.cs +++ b/Projectiles/Typeless/EmpyreanMarble.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Healing/EmpyreanHealOrb"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; diff --git a/Projectiles/Typeless/EmpyreanStellarDetritus.cs b/Projectiles/Typeless/EmpyreanStellarDetritus.cs index 3a758b25e4..0e33d4b217 100644 --- a/Projectiles/Typeless/EmpyreanStellarDetritus.cs +++ b/Projectiles/Typeless/EmpyreanStellarDetritus.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Typeless public class EmpyreanStellarDetritus : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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 291cd761a3..7850d6aadb 100644 --- a/Projectiles/Typeless/EnergyShell.cs +++ b/Projectiles/Typeless/EnergyShell.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; + Main.projFrames[Type] = 6; } public override void SetDefaults() diff --git a/Projectiles/Typeless/ExoTankHoverThrust.cs b/Projectiles/Typeless/ExoTankHoverThrust.cs new file mode 100644 index 0000000000..8c13df1ed1 --- /dev/null +++ b/Projectiles/Typeless/ExoTankHoverThrust.cs @@ -0,0 +1,62 @@ +using CalamityMod.Items.Mounts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ExoTankHoverThrust : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 5; + + public override void SetDefaults() + { + Projectile.width = 186; + Projectile.height = 74; + Projectile.friendly = true; + } + + public override void AI() + { + if (Owner is null || Owner.dead || Owner.mount is null || !Owner.mount.Active) + Projectile.Kill(); + + if (Owner.mount._type != ModContent.MountType()) + Projectile.Kill(); + + var data = (ExoTank.ExoTankData)Owner.mount._mountSpecificData; + if (!data.Hovering) + Projectile.Kill(); + + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Type]; + + Projectile.Center = Owner.Bottom + Vector2.UnitY * (Projectile.height / 2); + Projectile.spriteDirection = Projectile.direction = Owner.direction; + Projectile.timeLeft = 2; + + // Left thruster + Dust flame = Dust.NewDustPerfect(Projectile.Top - Vector2.UnitX * Main.rand.NextFloat(44f, 64f) * Owner.direction, DustID.BlueTorch); + flame.noGravity = true; + flame.noLight = true; + flame.velocity = Owner.velocity + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(6f)) * Main.rand.NextFloat(5f, 12f); + flame.scale = Main.rand.NextFloat(0.5f, 1.5f); + + // Right thruster + flame = Dust.NewDustPerfect(Projectile.Top + Vector2.UnitX * Main.rand.NextFloat(30f, 50f) * Owner.direction, DustID.BlueTorch); + flame.noGravity = true; + flame.noLight = true; + flame.velocity = Owner.velocity + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(6f)) * Main.rand.NextFloat(5f, 12f); + flame.scale = Main.rand.NextFloat(0.5f, 1.5f); + } + + public override bool ShouldUpdatePosition() => false; + + public override Color? GetAlpha(Color lightColor) => Color.White; + } +} diff --git a/Projectiles/Typeless/ExoTankHoverThrust.png b/Projectiles/Typeless/ExoTankHoverThrust.png new file mode 100644 index 0000000000..680ed14a37 Binary files /dev/null and b/Projectiles/Typeless/ExoTankHoverThrust.png differ diff --git a/Projectiles/Typeless/ExoTankLaser.cs b/Projectiles/Typeless/ExoTankLaser.cs new file mode 100644 index 0000000000..484ff94ef3 --- /dev/null +++ b/Projectiles/Typeless/ExoTankLaser.cs @@ -0,0 +1,71 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + // Modified clone of Atlas Munitions Laser to circumvent the minion attack type tag + public class ExoTankLaser : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Summon/AtlasMunitionsLaserOverdrive"; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 4; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 18; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 240; + Projectile.Opacity = 0f; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * Projectile.Opacity * 0.5f); + + Projectile.Opacity = Utils.GetLerpValue(240f, 235f, Projectile.timeLeft, true); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; + + if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.03f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Main.rand.NextBool()) + { + int dustCount = 16; + bool sideways = Main.rand.NextBool(6); + float generalAngularOffset = Main.rand.NextFloatDirection() * MathHelper.Pi / 24f; + if (sideways) + dustCount += 36; + + for (int i = 0; i < dustCount; i++) + { + float offsetAngle = MathHelper.TwoPi * i / dustCount; + + float unitOffsetX = MathF.Pow(MathF.Cos(offsetAngle), 3f); + float unitOffsetY = MathF.Pow(MathF.Sin(offsetAngle), 3f); + + Vector2 puffDustVelocity = new Vector2(unitOffsetX, unitOffsetY) * 5f; + if (sideways) + puffDustVelocity = puffDustVelocity.RotatedBy(MathHelper.PiOver4) * 1.7f; + else + puffDustVelocity = puffDustVelocity.RotatedBy(generalAngularOffset); + + Dust magic = Dust.NewDustPerfect(target.Center, 182, puffDustVelocity); + magic.scale = sideways ? 1.8f : 1f; + magic.fadeIn = 0.5f; + magic.noGravity = true; + } + } + } + } +} diff --git a/Projectiles/Typeless/ExoTankMissile.cs b/Projectiles/Typeless/ExoTankMissile.cs new file mode 100644 index 0000000000..7976c7f7bc --- /dev/null +++ b/Projectiles/Typeless/ExoTankMissile.cs @@ -0,0 +1,72 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ExoTankMissile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public static Asset Glow; + public override void Load() => Glow = ModContent.Request(Texture + "Glow"); + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } + + public override void SetDefaults() + { + Projectile.width = 66; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 90 * Projectile.MaxUpdates; + } + + public override void AI() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; + + CalamityUtils.HomeInOnNPC(Projectile, false, 1200f, 15f, 20f); + Projectile.rotation = Projectile.velocity.ToRotation(); + } + + public override void OnKill(int timeLeft) + { + Color boomColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.4f) * 0.6f; + CustomPulse boom = new (Projectile.Center, Vector2.Zero, boomColor, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.08f, 24); + GeneralParticleHandler.SpawnParticle(boom); + + for (int i = 0; i < 5; i++) + { + Vector2 velocity = Vector2.UnitX.RotatedBy(MathHelper.TwoPi * 0.2f * (i + Main.rand.NextFloat(-0.5f, 0.5f))) * (Main.rand.NextFloat(3f, 10f)); + Color energyColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.4f); + SquishyLightParticle energy = new (Projectile.Center, velocity, Main.rand.NextFloat(0.1f, 0.5f), energyColor, 15, 1f, 2.5f); + GeneralParticleHandler.SpawnParticle(energy); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); + + public override void PostDraw(Color lightColor) + { + if (Glow != null) + { + Rectangle frame = Glow.Value.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(Glow.Value, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + } +} diff --git a/Projectiles/Typeless/ExoTankMissile.png b/Projectiles/Typeless/ExoTankMissile.png new file mode 100644 index 0000000000..20caaad2d9 Binary files /dev/null and b/Projectiles/Typeless/ExoTankMissile.png differ diff --git a/Projectiles/Typeless/ExoTankMissileGlow.png b/Projectiles/Typeless/ExoTankMissileGlow.png new file mode 100644 index 0000000000..7fb9064031 Binary files /dev/null and b/Projectiles/Typeless/ExoTankMissileGlow.png differ diff --git a/Projectiles/Typeless/ExoTankMuzzleFlash.cs b/Projectiles/Typeless/ExoTankMuzzleFlash.cs new file mode 100644 index 0000000000..5d35148268 --- /dev/null +++ b/Projectiles/Typeless/ExoTankMuzzleFlash.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ExoTankMuzzleFlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 3; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3 * Main.projFrames[Type]) + Projectile.Kill(); + Projectile.frame = Projectile.frameCounter / 3; + Projectile.rotation = Projectile.velocity.ToRotation(); + } + + public override bool ShouldUpdatePosition() => false; + + public override Color? GetAlpha(Color lightColor) => Color.White; + } +} diff --git a/Projectiles/Typeless/ExoTankMuzzleFlash.png b/Projectiles/Typeless/ExoTankMuzzleFlash.png new file mode 100644 index 0000000000..954368bbca Binary files /dev/null and b/Projectiles/Typeless/ExoTankMuzzleFlash.png differ diff --git a/Projectiles/Typeless/FlameLickedBarrage.cs b/Projectiles/Typeless/FlameLickedBarrage.cs index 494f9b6096..f94d416372 100644 --- a/Projectiles/Typeless/FlameLickedBarrage.cs +++ b/Projectiles/Typeless/FlameLickedBarrage.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Typeless { lightColor.R = (byte)(255 * Projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Typeless/FlameLickedHellblast.cs b/Projectiles/Typeless/FlameLickedHellblast.cs index d9071df464..944ca206b1 100644 --- a/Projectiles/Typeless/FlameLickedHellblast.cs +++ b/Projectiles/Typeless/FlameLickedHellblast.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Typeless public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellblast"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Typeless { lightColor.R = (byte)(255 * Projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Typeless/FlashBolt.cs b/Projectiles/Typeless/FlashBolt.cs new file mode 100644 index 0000000000..3f86de4862 --- /dev/null +++ b/Projectiles/Typeless/FlashBolt.cs @@ -0,0 +1,126 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class FlashBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float colorValue = 0; + public float sizeMult = 1; + public bool invalidTarget => (Projectile.ai[0] < 0f || Projectile.ai[0] > 199f); + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = AverageDamageClass.Instance; + Projectile.penetrate = 1; // Survives through its first hit by "cheating" and incrementing its own pierce counter + Projectile.extraUpdates = 75; + Projectile.timeLeft = 200; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + // Visibility/Sound toggle on acc visibility + bool visible = Owner.Calamity().arcFlashRingVisual; + colorValue = MathHelper.Lerp(colorValue, 50, 0.025f); + Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)); + + if (time == 0) + { + colorValue += Main.rand.Next(0, 20); + sizeMult = 1; + if (visible) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/ArcFlash"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Owner.Center); + } + } + + // If the target is dead, remove them as a target and hit anything + NPC target = (invalidTarget ? null : Main.npc[(int)Projectile.ai[0]]); + if (target == null || !target.active || target.life <= 0) + Projectile.ai[0] = -1; + + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (targetDist < 1400f) + { + Vector2 pos = Projectile.Center - Projectile.velocity * 15; + if (Projectile.timeLeft % 4 == 0) + { + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f * sizeMult, usedColor * (visible ? 1 : 0.25f), new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(35)) + { + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * sizeMult, usedColor * (visible ? 1 : 0.3f), new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(10) && visible) + { + Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult, usedColor * (visible ? 1 : 0.3f), new Vector2(1, 4), true, true); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % 5 == 0 && visible) + { + Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.45f, 0.6f)); + dust.noGravity = true; + dust.color = usedColor; + } + } + if (Projectile.numHits > 0) + { + sizeMult *= 0.97f; + } + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Stops the projectile from deleting itself, while maintaining the masquerade + Projectile.penetrate++; + + //colorValue = Main.rand.Next(0, 10); + target.AddBuff(BuffID.Electrified, 180); + Projectile.timeLeft = 25; + Player Owner = Main.player[Projectile.owner]; + if (Owner.Calamity().arcFlashRingVisual && Projectile.numHits == 0) + { + Vector2 pos = target.Center; + for (int i = 0; i < 10; i++) + { + Particle spark2 = new BoltParticle(pos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.9f), true, 13, Main.rand.NextFloat(0.2f, 0.3f) * sizeMult, Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid, new Vector2(1.8f, 0.8f), true, true, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.8f, 0.9f)); + dust.noGravity = false; + dust.color = Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid; + } + Particle pulse2 = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/HighResFoggyCircleHardEdge", new Vector2(1, 1), 0, 0f, 0.0715f, 10); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle orb = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.78f, 0.5f, 14); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(pos, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.325f, 0.2f, 14); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + public override bool? CanHitNPC(NPC target) + { + if (invalidTarget || Projectile.ai[0] == target.whoAmI) + return null; + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.numHits > 0 ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, 60 * sizeMult, targetHitbox); + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Typeless/FuckYou.cs b/Projectiles/Typeless/FuckYou.cs index 67aef36b36..76dee98268 100644 --- a/Projectiles/Typeless/FuckYou.cs +++ b/Projectiles/Typeless/FuckYou.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ai[1] += 0.01f; Projectile.scale = Projectile.ai[1] * 0.5f; Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= (float)(3 * Main.projFrames[Projectile.type])) + if (Projectile.ai[0] >= (float)(3 * Main.projFrames[Type])) { Projectile.Kill(); return; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.frameCounter = 0; incrementer = Projectile.frame + 1; Projectile.frame = incrementer; - if (incrementer >= Main.projFrames[Projectile.type]) + if (incrementer >= Main.projFrames[Type]) { Projectile.hide = true; } diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index 4b5c5923b8..49f7b51a74 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } @@ -238,7 +238,7 @@ namespace CalamityMod.Projectiles.Typeless if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); diff --git a/Projectiles/Typeless/GemTechArmorGem.cs b/Projectiles/Typeless/GemTechArmorGem.cs index 21dc514a86..d31ffe8079 100644 --- a/Projectiles/Typeless/GemTechArmorGem.cs +++ b/Projectiles/Typeless/GemTechArmorGem.cs @@ -22,8 +22,9 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() @@ -147,7 +148,7 @@ namespace CalamityMod.Projectiles.Typeless { case (int)GemTechArmorGemType.Melee: default: - texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; break; case (int)GemTechArmorGemType.Ranged: texture = ModContent.Request("CalamityMod/Projectiles/Typeless/GemTechGreenGem").Value; @@ -179,7 +180,7 @@ namespace CalamityMod.Projectiles.Typeless public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { Projectile.velocity = Vector2.Zero; - Projectile.timeLeft = ProjectileID.Sets.TrailCacheLength[Projectile.type]; + Projectile.timeLeft = ProjectileID.Sets.TrailCacheLength[Type]; Projectile.netUpdate = true; } } diff --git a/Projectiles/Typeless/GenericElectricSpark.cs b/Projectiles/Typeless/GenericElectricSpark.cs index 607550060d..fc40405418 100644 --- a/Projectiles/Typeless/GenericElectricSpark.cs +++ b/Projectiles/Typeless/GenericElectricSpark.cs @@ -17,13 +17,18 @@ namespace CalamityMod.Projectiles.Typeless Projectile.width = 6; Projectile.height = 12; Projectile.friendly = true; - Projectile.penetrate = 5; + Projectile.penetrate = 3; Projectile.timeLeft = 60; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 15; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Prevents Amidias' Spark sparks from inflicting it to not make its other effect worthless + if (Projectile.ai[1] != 1f) + target.AddBuff(ModContent.BuffType(), 120); + } public override void AI() { diff --git a/Projectiles/Typeless/GhostlyBolt.cs b/Projectiles/Typeless/GhostlyBolt.cs index 78889af8fa..ceb42cf336 100644 --- a/Projectiles/Typeless/GhostlyBolt.cs +++ b/Projectiles/Typeless/GhostlyBolt.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 6; Projectile.friendly = true; Projectile.alpha = 255; - Projectile.penetrate = -1; + Projectile.penetrate = 1; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; diff --git a/Projectiles/Typeless/GodKiller.cs b/Projectiles/Typeless/GodKiller.cs index d353152be2..13cfd33eec 100644 --- a/Projectiles/Typeless/GodKiller.cs +++ b/Projectiles/Typeless/GodKiller.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; } public override void SetDefaults() @@ -109,7 +110,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); return false; } } diff --git a/Projectiles/Typeless/GreenLabSeeker.cs b/Projectiles/Typeless/GreenLabSeeker.cs index f9cadeddd6..65a48dec84 100644 --- a/Projectiles/Typeless/GreenLabSeeker.cs +++ b/Projectiles/Typeless/GreenLabSeeker.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index 07be3430a7..29bed8cabb 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -1,9 +1,9 @@ -using Microsoft.CodeAnalysis.CSharp.Syntax; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -36,11 +36,12 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 90; 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 < 24; i++) + for (int i = 0; i < 14; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 228, new Vector2(4.5f, 4.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.9f), 0, default, Main.rand.NextFloat(1.5f, 2.8f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(7.5f, 7.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.9f), 0, default, Main.rand.NextFloat(1.1f, 1.9f)); dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); dust.noGravity = true; + dust.color = Color.Goldenrod; } for (int j = 0; j < 12; j++) { @@ -48,6 +49,9 @@ namespace CalamityMod.Projectiles.Typeless Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 2, 259, dustVel, 0, default, 1f); dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + + Particle spark = new CustomSpark(Projectile.Center, (new Vector2(15, 15).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 37, Main.rand.NextFloat(1.35f, 1.5f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); } } } diff --git a/Projectiles/Typeless/HolyStarDamage.cs b/Projectiles/Typeless/HolyStarDamage.cs new file mode 100644 index 0000000000..455d337210 --- /dev/null +++ b/Projectiles/Typeless/HolyStarDamage.cs @@ -0,0 +1,178 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.World; +using Humanizer; +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.Projectiles.Typeless +{ + public class HolyStarDamage : ModProjectile, ILocalizedModType + { + bool started = false; + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/StarProj"; + + public int time = 0; + public bool reachedMaxDamage = false; + public override void SetDefaults() + { + Projectile.localAI[1] = Main.rand.NextFloat(30f); + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + + if (!started) + { + Color cl = Color.Goldenrod; + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, cl, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(2f, 4f), 1.5f), Vector2.Zero.AngleTo(Projectile.velocity), 1f * Projectile.scale, 0f, 30)); + started = true; + } + + if (Projectile.ai[0] < 240f) + { + Projectile.ai[0] += 1f; + + if (Projectile.timeLeft < 160) + Projectile.timeLeft = 160; + } + + if (Projectile.ai[1] == 5) + { + // Homing stars from burning revalation + if (Projectile.ai[2] != -1 && time > 20) + { + NPC targeted = Projectile.ai[2] == -1 ? null : Main.npc[(int)Projectile.ai[2]]; + if (targeted != null && targeted.life <= 0) + targeted = null; + else + Projectile.timeLeft++; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.5f, 12, 0.975f); + } + if (Projectile.scale < 1) + Projectile.scale += 0.0035f; + if (Projectile.scale >= 1 && !reachedMaxDamage) + { + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.5f, 8); + GeneralParticleHandler.SpawnParticle(orb2); + reachedMaxDamage = true; + } + } + + if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.01f; + + Projectile.localAI[1] += (Projectile.velocity.Length() / 20); + + Color col = Projectile.ai[1] == 5 ? (Color.Lerp(Color.Goldenrod, Color.Orchid, Utils.GetLerpValue(0.85f, 1f, Projectile.scale))) : Color.Goldenrod; + + float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f); + + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.8f, false, 5, 0.06f * Projectile.scale, col * 0.7f, new Vector2(1, 0.3f), true, false, 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 240); + if (Projectile.ai[1] == 5) + { + modifiers.SourceDamage *= Projectile.scale; + } + } + + public override bool PreDraw(ref Color lightColor) + { + float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs((float)Math.Sin(Projectile.localAI[1] / 10f))); + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color baseColor = Color.Goldenrod with { A = 0 }; + Color baseColor2 = Color.Khaki with { A = 0 }; + baseColor.A = 0; + baseColor *= lerpMult; + baseColor2 *= lerpMult; + Vector2 origin = texture.Size() / 2f; + Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Projectile.rotation += MathHelper.ToRadians(lerpMult * 4f); + + float upRight = MathHelper.PiOver4; + float up = MathHelper.PiOver2; + float upLeft = 3f * MathHelper.PiOver4; + float left = MathHelper.Pi; + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f * Projectile.scale, spriteEffects, 0); + + return false; + } + + public override void OnKill(int timeLeft) + { + int dustType = ModContent.DustType(); + for (int i = 0; i < 7; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, ((new Vector2(7, 7) * Projectile.scale).RotatedByRandom(100) + (reachedMaxDamage ? Vector2.Zero : Projectile.velocity)) * Main.rand.NextFloat(0.2f, 1f) * (reachedMaxDamage ? 2 : 1)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.95f, 1.45f) * Projectile.scale; + dust.color = Main.rand.NextBool(4) ? (reachedMaxDamage ? Color.Orchid : Color.Khaki) : Color.Goldenrod; + dust.noLightEmittence = true; + } + if (reachedMaxDamage) + { + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f }, Projectile.Center); + + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.5f, 10); + GeneralParticleHandler.SpawnParticle(orb2); + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.65f, 15, true); + GeneralParticleHandler.SpawnParticle(orb3); + + for (int i = 0; i < 4; i++) + { + Particle spark = new CustomSpark(Projectile.Center, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.3f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + // Sub projectiles spawning sub explosions... yea it needs armor pen + Projectile explo = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0.75f); + explo.ArmorPenetration = 30; + } + } + public override bool? CanDamage() => time > 15 ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 50, targetHitbox); + } +} diff --git a/Projectiles/Typeless/HydrothermalSmoke.cs b/Projectiles/Typeless/HydrothermalSmoke.cs index 7278015b26..7d0236bda1 100644 --- a/Projectiles/Typeless/HydrothermalSmoke.cs +++ b/Projectiles/Typeless/HydrothermalSmoke.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Typeless } Vector2 goreVec = Projectile.position; - if (Main.rand.NextBool(8) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(8) && !Main.dedServ) { int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), goreVec, default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; diff --git a/Projectiles/Typeless/HydrothermicFlare.cs b/Projectiles/Typeless/HydrothermicFlare.cs index ecbcaa7ab9..67236f2d47 100644 --- a/Projectiles/Typeless/HydrothermicFlare.cs +++ b/Projectiles/Typeless/HydrothermicFlare.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/Typeless/HydrothermicFlareRogue.cs b/Projectiles/Typeless/HydrothermicFlareRogue.cs index cc97baf05e..3b5a45c826 100644 --- a/Projectiles/Typeless/HydrothermicFlareRogue.cs +++ b/Projectiles/Typeless/HydrothermicFlareRogue.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 8; diff --git a/Projectiles/Typeless/HydrothermicSphere.cs b/Projectiles/Typeless/HydrothermicSphere.cs index 4973fa9b50..2b2ef7da6b 100644 --- a/Projectiles/Typeless/HydrothermicSphere.cs +++ b/Projectiles/Typeless/HydrothermicSphere.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; diff --git a/Projectiles/Typeless/JewelSpike.cs b/Projectiles/Typeless/JewelSpike.cs index ae5ea54418..a2de1dd804 100644 --- a/Projectiles/Typeless/JewelSpike.cs +++ b/Projectiles/Typeless/JewelSpike.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() diff --git a/Projectiles/Typeless/KelvinCatalystStar.cs b/Projectiles/Typeless/KelvinCatalystStar.cs index 184570c27d..5442bf8c6e 100644 --- a/Projectiles/Typeless/KelvinCatalystStar.cs +++ b/Projectiles/Typeless/KelvinCatalystStar.cs @@ -11,8 +11,9 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Typeless/LeviAmberDash.cs b/Projectiles/Typeless/LeviAmberDash.cs index 6f40b18d0a..ce78561a5f 100644 --- a/Projectiles/Typeless/LeviAmberDash.cs +++ b/Projectiles/Typeless/LeviAmberDash.cs @@ -35,11 +35,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (target.CanBeMoved(true)) - { - target.velocity.Y += -1.8f; - target.velocity.X += 4.2f * Owner.direction; - } + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 16, true); target.AddBuff(BuffID.Wet, 300); target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Typeless/LunicBeam.cs b/Projectiles/Typeless/LunicBeam.cs index 99360f627e..61570198d5 100644 --- a/Projectiles/Typeless/LunicBeam.cs +++ b/Projectiles/Typeless/LunicBeam.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,190 +14,60 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { - Projectile.width = 8; - Projectile.height = 8; + Projectile.width = Projectile.height = 8; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 2; - Projectile.alpha = 255; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } public override void AI() { - float aiTrack = 5f; - float scaleFactor = 6f; - Vector2 dustRotation = new Vector2(10f, 20f); - int dustType = Utils.SelectRandom(Main.rand, new int[] + if (Projectile.ai[0] == 0f) { - 246, - 244, - 229, - 262, - 247 - }); - int solarDustType = 259; - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); - } - else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) - { - int targetID = -1; - float hitDistance = 150f; - foreach (NPC n in Main.ActiveNPCs) + for (int i = 0; i < 4; i++) { - if (n.CanBeChasedBy(Projectile, false)) - { - Vector2 targetCenter = n.Center; - float targetDist = Vector2.Distance(targetCenter, Projectile.Center); - if (targetDist < hitDistance && targetID == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, targetCenter, 1, 1)) - { - hitDistance = targetDist; - targetID = n.whoAmI; - } - } - } - if (hitDistance < 8f) - { - Projectile.Kill(); - return; - } - if (targetID != -1) - { - Projectile.ai[1] = aiTrack + 1f; - Projectile.ai[0] = (float)targetID; - Projectile.netUpdate = true; + Vector2 velocity = (MathHelper.TwoPi * i / 4f + Projectile.velocity.ToRotation() + MathHelper.PiOver4).ToRotationVector2() * 0.8f; + Particle cross = new GlowSparkParticle(Projectile.Center, velocity, false, 6, 0.015f, Color.DarkOrange, Vector2.One, true); + GeneralParticleHandler.SpawnParticle(cross); } + Projectile.ai[0] = 1f; } - else if (Projectile.ai[1] > aiTrack) - { - Projectile.ai[1] += 1f; - int npcTrack = (int)Projectile.ai[0]; - if (!Main.npc[npcTrack].active || !Main.npc[npcTrack].CanBeChasedBy(Projectile, false)) - { - Projectile.ai[1] = 1f; - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; - } - else - { - Projectile.velocity.ToRotation(); - Vector2 npcDirection = Main.npc[npcTrack].Center - Projectile.Center; - if (npcDirection.Length() < 20f) - { - Projectile.Kill(); - return; - } - if (npcDirection != Vector2.Zero) - { - npcDirection.Normalize(); - npcDirection *= scaleFactor; - } - Projectile.velocity = (Projectile.velocity * 29f + npcDirection) / 30f; - } - } - if (Projectile.ai[1] >= 1f && Projectile.ai[1] < aiTrack) - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] == aiTrack) - { - Projectile.ai[1] = 1f; - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 48f) - { - Projectile.localAI[0] = 0f; - } - else if (Projectile.alpha == 0) - { - for (int j = 0; j < 2; j++) - { - Vector2 rotateFirstDust = Vector2.UnitX * -30f; - rotateFirstDust = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)j * 3.14159274f), default) * dustRotation - Projectile.rotation.ToRotationVector2() * 10f; - int solarDust = Dust.NewDust(Projectile.Center, 0, 0, solarDustType, 0f, 0f, 160, default, 1f); - Main.dust[solarDust].scale = 1f; - Main.dust[solarDust].noGravity = true; - Main.dust[solarDust].position = Projectile.Center + rotateFirstDust + Projectile.velocity * 2f; - Main.dust[solarDust].velocity = Vector2.Normalize(Projectile.Center + Projectile.velocity * 2f * 8f - Main.dust[solarDust].position) * 2f + Projectile.velocity * 2f; - } - } - if (Main.rand.NextBool(12)) - { - 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, 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; - } - } - if (Main.rand.NextBool(64)) - { - 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, 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()) - { - Main.dust[smokyDust2].fadeIn = 1.4f; - } - } - } - if (Main.rand.NextBool(4)) - { - for (int m = 0; m < 2; m++) - { - Vector2 rotateFourthDust = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int randomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1.2f); - Main.dust[randomDust].velocity *= 0.3f; - Main.dust[randomDust].noGravity = true; - Main.dust[randomDust].position = Projectile.Center + rotateFourthDust * (float)Projectile.width / 2f; - if (Main.rand.NextBool()) - { - Main.dust[randomDust].fadeIn = 1.4f; - } - } - } - if (Main.rand.NextBool(3)) - { - Vector2 rotateFifthDust = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int solarDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, solarDustType, 0f, 0f, 100, default, 1f); - Main.dust[solarDust2].velocity *= 0.3f; - Main.dust[solarDust2].position = Projectile.Center + rotateFifthDust * (float)Projectile.width / 2f; - Main.dust[solarDust2].fadeIn = 1.2f; - Main.dust[solarDust2].scale = 1.5f; - Main.dust[solarDust2].noGravity = true; - } - 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(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(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; - } - } - 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; + // Find the closest NPC targetable + Color trailColor = new Color(100, 30, 20); + float range = 240f; + int targetNPC = -1; + foreach (NPC target in Main.ActiveNPCs) + { + if (!target.CanBeChasedBy(Projectile)) + continue; + + float distance = Vector2.Distance(target.Center, Projectile.Center); + if (distance < range && Collision.CanHit(Projectile, target)) + { + range = distance; + targetNPC = target.whoAmI; + } + } + if (targetNPC > -1) + { + NPC target = Main.npc[targetNPC]; + Vector2 idealVelocity = Projectile.SafeDirectionTo(target.Center) * 12f; + Projectile.velocity = (Projectile.velocity * 39f + idealVelocity) / 40f; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 1f); + trailColor = Color.Lerp(new Color(100, 30, 20), Color.Indigo, Utils.GetLerpValue(240f, 0f, Vector2.Distance(Projectile.Center, target.Center), true)); + } + Lighting.AddLight(Projectile.Center, trailColor.ToVector3() * 0.5f); + + Dust trail = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity * 0.05f); + trail.noGravity = true; + trail.scale = Main.rand.NextFloat(1f, 1.6f); + trail.color = trailColor; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 480); @@ -204,63 +76,23 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - int m = Utils.SelectRandom(Main.rand, new int[] + SoundEngine.PlaySound(LunicEye.ImpactSound, Projectile.Center); + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 4; i++) { - 246, - 244, - 229, - 262, - 247 - }); - int randomDust = 259; - int height = 50; - float solarDust2 = 1.7f; - Vector2 dustRotate = (Projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 dustVel = dustRotate * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - 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(); - int inc; - for (int j = 0; j < 40; j = inc + 1) - { - m = Utils.SelectRandom(Main.rand, new int[] - { - 246, - 244, - 229, - 262, - 247 - }); - 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(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; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += dustVel * Main.rand.NextFloat(); - inc = j; + Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f; + Particle outline = new AltSparkParticle(Projectile.Center + velocity * 50f, velocity, false, 12, 2f, Color.Black); + GeneralParticleHandler.SpawnParticle(outline); + Particle cross = new SparkParticle(Projectile.Center + velocity * 50f, velocity, false, 12, 1f, Color.Indigo); + GeneralParticleHandler.SpawnParticle(cross); } - for (int k = 0; k < 20; k = inc + 1) + for (int i = 0; i < 25; i++) { - 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; - dust.velocity *= 0.5f; - dust.velocity += dustVel * (0.6f + 0.6f * Main.rand.NextFloat()); - inc = k; + Vector2 velocity = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 6f; + Dust ring = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity); + ring.noGravity = true; + ring.scale = Main.rand.NextFloat(1.6f, 1.8f); + ring.color = Color.Indigo * 0.5f; } } } diff --git a/Projectiles/Typeless/Luxor.cs b/Projectiles/Typeless/Luxor.cs new file mode 100644 index 0000000000..bc170f8aa9 --- /dev/null +++ b/Projectiles/Typeless/Luxor.cs @@ -0,0 +1,259 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; +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.Typeless +{ + public class Luxor : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color usedColor = Color.White; + public DamageClass lastDamageClass = null; + public ref float time => ref Projectile.ai[0]; + public ref float attackTimer => ref Projectile.ai[1]; + public ref float idleTimer => ref Projectile.localAI[0]; + public int classType = 0; // 0 = Classless, 1 = Melee, 2 = Ranged, 3 = Mage, 4 = Summoner, 5 = Rogue + public Vector2 tipPosition => Projectile.Center + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 15; + + public float fxFade = 0; // The glow visuals multiplier + public float postFireBoost = 0; // The glow increases right when you fire, then quickly fades + public float followSpeed = 6; // The speed Luxor follows you, lower is faster + public bool rogueChain = true; // Used for rogue's double projectile shot + public override void SetDefaults() + { + Projectile.width = 114; + Projectile.height = 38; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + Color classColor = Color.White; + DamageClass itemClass = Owner.HeldItem.DamageType; + // Held item class is not updated when you hold any tools + if ((Owner.HeldItem.axe > 0 || Owner.HeldItem.hammer > 0 || Owner.HeldItem.pick > 0) && lastDamageClass != null) + itemClass = lastDamageClass; + if (itemClass == null) + { + Projectile.Kill(); + return; + } + else if (itemClass.CountsAsClass()) + { classColor = Color.Red; classType = 1; } + else if (itemClass.CountsAsClass()) + { classColor = Color.Cyan; classType = 2; } + else if (itemClass.CountsAsClass()) + { classColor = Color.Gold; classType = 3; } + else if (itemClass.CountsAsClass()) + { classColor = Color.Lime; classType = 4; } + else if (itemClass.CountsAsClass()) + { classColor = Color.Magenta; classType = 5; } + else + { classColor = Color.Gray; classType = 0; }; + + if (time == 0 || itemClass != lastDamageClass) + { + Projectile.netUpdate = true; + attackTimer = 60; // 60 frame attack delay on spawn or swapping class weapons + } + lastDamageClass = itemClass; + + float rate = Main.GlobalTimeWrappedHourly * 7; + List eColors = new List() + { + Color.Lerp(classColor, Color.White, 0.15f), + Color.Lerp(classColor, Color.Black, 0.15f) + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld); + + Vector2 destination = Vector2.Lerp(Owner.Center - Projectile.velocity * (70 + 100 * Utils.GetLerpValue(0, 110, attackTimer, true)), Owner.Center + Vector2.UnitY * -40, Utils.GetLerpValue(280, 300, idleTimer, true)); + Projectile.velocity = (destination - Projectile.Center) / followSpeed; + + Projectile.rotation = Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld).ToRotation() + MathHelper.PiOver2; + + fxFade = moddedOwner.luxorsGiftVanity ? 1 : (float)Math.Pow(Utils.GetLerpValue(30, 0, attackTimer, true), 3) + postFireBoost; + + if (idleTimer >= 280) + { + if (moddedOwner.luxorHit) + { + if (idleTimer > 320) + idleTimer = 320; + idleTimer -= 1; + } + else + { + fxFade = 1; + attackTimer = 40; + } + } + else + { + + } + + if (!moddedOwner.luxorsGiftVanity) + { + if (attackTimer == 0 && moddedOwner.luxorHit) + { + int attackSpeed = 0; + int attackDamage = 0; + int projType = 0; + switch (classType) + { + case 0: attackSpeed = LuxorsGift.classlessAttackSpeed; attackDamage = LuxorsGift.classlessDamage; projType = ModContent.ProjectileType(); break; + case 1: attackSpeed = LuxorsGift.meleeAttackSpeed; attackDamage = LuxorsGift.meleeDamage; projType = ModContent.ProjectileType(); break; + case 2: attackSpeed = LuxorsGift.rangedAttackSpeed; attackDamage = LuxorsGift.rangedDamage; projType = ModContent.ProjectileType(); break; + case 3: attackSpeed = LuxorsGift.magicAttackSpeed; attackDamage = LuxorsGift.magicDamage; projType = ModContent.ProjectileType(); break; + case 4: attackSpeed = LuxorsGift.summonerAttackSpeed; attackDamage = LuxorsGift.summonerDamage; projType = ModContent.ProjectileType(); break; + case 5: attackSpeed = LuxorsGift.rogueAttackSpeed; attackDamage = LuxorsGift.rogueDamage; projType = ModContent.ProjectileType(); break; + } + float powerMult = Utils.GetLerpValue(-120, 140, attackSpeed, true); // An intensity multiplier based on the fire rate of the mode + if (Main.zenithWorld) // Just like old times + { + attackSpeed = 0; + attackDamage = Math.Max(1, (int)(Owner.HeldItem.damage * Utils.Remap(Owner.HeldItem.useAnimation, 3, 120, 0.025f, 1f, false))); + } + + for (int i = 0; i < (int)(20 * powerMult); i++) // Firing dust + { + Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * 12 * powerMult; + Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); + dust.noGravity = !Main.rand.NextBool(3); + dust.scale = Main.rand.NextFloat(0.75f, 1.4f) * powerMult; + dust.color = usedColor; + dust.noLightEmittence = true; + } + if (classType == 1) // Melee shotgun + { + for (int i = -1; i <= 1; i++) + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld).RotatedBy(-0.12f * i * Main.rand.NextFloat(0.7f, 1f)) * (12 - Main.rand.NextFloat(0f, 0.6f) - Math.Abs(i)), projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI); + proj.ArmorPenetration = LuxorsGift.luxArmorPen; + } + for (int i = 0; i < 5; i++) // These are visual + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld).RotatedByRandom(0.4f) * (12 - Main.rand.NextFloat(2f, 5f)), projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI, 5); + proj.timeLeft = 95; + } + } + else // Everything else + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld) * 12, projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI); + proj.ArmorPenetration = LuxorsGift.luxArmorPen; + if (classType == 5) // Rogue has gravity so velocity is adjusted a bit + proj.velocity.Y -= 1.5f; + } + + SoundStyle blam = new("CalamityMod/Sounds/Item/GunShotSmall"); + SoundEngine.PlaySound(blam with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.6f, 0.8f) }, tipPosition); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, Pitch = 0.2f }, tipPosition); + + if (classType == 5 && rogueChain) + { + rogueChain = false; + attackTimer = attackSpeed / 3; + } + else + { + attackTimer = attackSpeed; + moddedOwner.luxorHit = false; + if (!CalamityClientConfig.Instance.Photosensitivity) + postFireBoost = 1.7f; + idleTimer = 0; + rogueChain = true; + } + Projectile.netUpdate = true; + } + if (attackTimer > 0) + attackTimer--; + if (postFireBoost > 0) // Quickly fade out the increased poost fire visuals + postFireBoost -= 0.2f; + } + + if (time % 2 == 0 && false) + { + Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Owner.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.7f); + dust.color = usedColor; + dust.noLightEmittence = true; + } + + float idleFade = Utils.GetLerpValue(280, 300, idleTimer, true); + Lighting.AddLight(tipPosition, Color.Lerp(usedColor, Color.Lerp(usedColor, Color.White, 0.5f), idleFade).ToVector3() * (0.5f * MathHelper.Lerp(fxFade, 1, 0.55f) + 0.35f * idleFade)); + + if (moddedOwner.luxorsGift || moddedOwner.luxorsGiftVanity) + Projectile.timeLeft++; + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + time++; + if (!moddedOwner.luxorHit && !moddedOwner.luxorsGiftVanity) + idleTimer++; + else if (moddedOwner.luxorsGiftVanity) + idleTimer = 0; + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request(Texture); + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D cTexture = ModContent.Request("CalamityMod/Particles/Light").Value; + float idleFade = moddedOwner.luxorsGiftVanity ? 0 : (float)Math.Pow(Utils.GetLerpValue(280, 300, idleTimer, true), 5); + Color drawColor = usedColor; + Color bodyColor = Color.Lerp(lightColor, Color.Gold with { A = 0 }, idleFade); + float drawMult = Math.Max(idleFade, fxFade); + + if (idleFade == 0) + { + for (int i = 0; i < 18; i++) // Backglow + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 6 * drawMult; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.2f * drawMult, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + // Main body + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, bodyColor * (1 - idleFade), Projectile.rotation, tex.Size() * 0.5f, new Vector2(1 - 0.85f * idleFade, 1f) * Projectile.scale, SpriteEffects.None); + for (int i = 0; i < 4; i++) // Glow orb + { + Main.EntitySpriteDraw(bTexture, Vector2.Lerp(tipPosition, Projectile.Center, idleFade) - Main.screenPosition, null, drawColor with { A = 0 } * 0.35f * drawMult, time * 0.13f * (i + 1), bTexture.Size() * 0.5f, new Vector2(1 + i * 0.15f, i - 0.3f * i) * Projectile.scale * MathHelper.Lerp(0.33f, 0.22f, idleFade) * drawMult, SpriteEffects.None); + } + // Glow orb center + Main.EntitySpriteDraw(cTexture, Vector2.Lerp(tipPosition, Projectile.Center, idleFade) - Main.screenPosition, null, Color.White with { A = 0 } * 0.75f * drawMult, Projectile.rotation, cTexture.Size() * 0.5f, Projectile.scale * MathHelper.Lerp(0.4f, 0.3f, idleFade) * drawMult, SpriteEffects.None); + return false; + } + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/Luxor.png b/Projectiles/Typeless/Luxor.png new file mode 100644 index 0000000000..6962d76a0d Binary files /dev/null and b/Projectiles/Typeless/Luxor.png differ diff --git a/Projectiles/Typeless/LuxorsGiftClassless.cs b/Projectiles/Typeless/LuxorsGiftClassless.cs new file mode 100644 index 0000000000..79ba8f85d7 --- /dev/null +++ b/Projectiles/Typeless/LuxorsGiftClassless.cs @@ -0,0 +1,94 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class LuxorsGiftClassless : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; + } + public override void SetDefaults() + { + Projectile.width = 30; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 6; + Projectile.tileCollide = false; + } + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.35f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Projectile.timeLeft < 294) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity, -Projectile.velocity * 0.3f, false, 18, 0.03f * (1 + Utils.GetLerpValue(270, 300, Projectile.timeLeft, true)), Color.Gray * 0.45f, new Vector2(1.1f * (1 + Utils.GetLerpValue(270, 300, Projectile.timeLeft, true)), 1.3f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.1f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + for (int i = 0; i < Math.Max(6 - Projectile.numHits, 1); i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f), false, 8, 0.02f, Color.White * 0.75f, new Vector2(0.8f, 1.3f), true, false, 1f); + GeneralParticleHandler.SpawnParticle(spark); + + for (int y = 0; y < 2; y++) + { + SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f), false, 35, 0.5f, Color.White); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } + 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; + } + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20, targetHitbox); + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request(Texture); + Color drawColor = Color.Gray; + float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); + + + for (int i = 0; i < 8; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); + return false; + } + } +} diff --git a/Projectiles/Typeless/LuxorsGiftClassless.png b/Projectiles/Typeless/LuxorsGiftClassless.png new file mode 100644 index 0000000000..923a4e34aa Binary files /dev/null and b/Projectiles/Typeless/LuxorsGiftClassless.png differ diff --git a/Projectiles/Typeless/MageHammerBoom.cs b/Projectiles/Typeless/MageHammerBoom.cs deleted file mode 100644 index 7dc61d9aa9..0000000000 --- a/Projectiles/Typeless/MageHammerBoom.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class MageHammerBoom : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 500; - Projectile.height = 500; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 5; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; - } - } -} diff --git a/Projectiles/Typeless/MagnusBeam.cs b/Projectiles/Typeless/MagnusBeam.cs index c5ca9718f5..3cb564ae69 100644 --- a/Projectiles/Typeless/MagnusBeam.cs +++ b/Projectiles/Typeless/MagnusBeam.cs @@ -1,11 +1,17 @@ using System; using CalamityMod.Balancing; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Particles; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -14,188 +20,94 @@ namespace CalamityMod.Projectiles.Typeless public class MagnusBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + + public ref float ProximityFactor => ref Projectile.ai[1]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 30; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() { - Projectile.width = 8; - Projectile.height = 8; + Projectile.width = Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 2; - Projectile.alpha = 0; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation(); - float limit = 5f; - float scaleFactor = 6f; - if (Projectile.ai[1] == 0f) + if (Projectile.ai[0] == 0f) { - Projectile.ai[1] = 1f; - Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); - } - else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) - { - int targetIdx = -1; - float npcRange = 150f; - foreach (NPC n in Main.ActiveNPCs) + for (int i = 0; i < 6; i++) { - if (n.CanBeChasedBy(Projectile, false)) - { - Vector2 npcPos = n.Center; - float npcDist = Vector2.Distance(npcPos, Projectile.Center); - if (npcDist < npcRange && targetIdx == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, npcPos, 1, 1)) - { - npcRange = npcDist; - targetIdx = n.whoAmI; - } - } - } - if (npcRange < 8f) - { - Projectile.Kill(); - return; - } - if (targetIdx != -1) - { - Projectile.ai[1] = limit + 1f; - Projectile.ai[0] = (float)targetIdx; - Projectile.netUpdate = true; - } - } - else if (Projectile.ai[1] > limit) - { - Projectile.ai[1] += 1f; - int idx = (int)Projectile.ai[0]; - if (!Main.npc[idx].active || !Main.npc[idx].CanBeChasedBy(Projectile, false)) - { - Projectile.ai[1] = 1f; - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; - } - else - { - Projectile.velocity.ToRotation(); - Vector2 toNPC = Main.npc[idx].Center - Projectile.Center; - if (toNPC.Length() < 20f) - { - Projectile.Kill(); - return; - } - if (toNPC != Vector2.Zero) - { - toNPC.Normalize(); - toNPC *= scaleFactor; - } - float homingSpeed = 30f; - Projectile.velocity = (Projectile.velocity * (homingSpeed - 1f) + toNPC) / homingSpeed; - } - } - if (Projectile.ai[1] >= 1f && Projectile.ai[1] < limit) - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] == limit) - { - Projectile.ai[1] = 1f; + Vector2 velocity = (MathHelper.TwoPi * i / 6f + Projectile.rotation + MathHelper.ToRadians(30f)).ToRotationVector2() * 0.8f; + Color crossColor = i % 2 == 1 ? Color.MidnightBlue : Color.CornflowerBlue; + Particle cross = new GlowSparkParticle(Projectile.Center, velocity, false, 6, 0.015f, crossColor, Vector2.One, true); + GeneralParticleHandler.SpawnParticle(cross); } + Projectile.ai[0] = 1f; } - int dustTypeRand = Utils.SelectRandom(Main.rand, new int[] + // Find the closest NPC targetable + Color trailColor = Color.CornflowerBlue; + float range = 320f; + int targetNPC = -1; + foreach (NPC target in Main.ActiveNPCs) { - 56, - 92, - 229, - 206, - 181 - }); - int dustType = 261; - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 48f) - { - Projectile.localAI[0] = 0f; - } - else if (Projectile.alpha == 0) - { - for (int i = 0; i < 2; i++) + if (!target.CanBeChasedBy(Projectile)) + continue; + + float distance = Vector2.Distance(target.Center, Projectile.Center); + if (distance < range && Collision.CanHit(Projectile, target)) { - Vector2 offset = Vector2.UnitX * -30f; - offset = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + i * MathHelper.Pi), default) * new Vector2(10f, 20f) - Projectile.rotation.ToRotationVector2() * 10f; - int idx = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); - Main.dust[idx].scale = 1f; - Main.dust[idx].noGravity = true; - Main.dust[idx].position = Projectile.Center + offset + Projectile.velocity * 2f; - Main.dust[idx].velocity = Vector2.Normalize(Projectile.Center + Projectile.velocity * 2f * 8f - Main.dust[idx].position) * 2f + Projectile.velocity * 2f; + range = distance; + targetNPC = target.whoAmI; } } - if (Main.rand.NextBool(12)) + if (targetNPC > -1) { - Vector2 offset = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - 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; - } - 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, 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()) - { - Main.dust[idx].fadeIn = 1.4f; - } - } - if (Main.rand.NextBool(4)) - { - for (int i = 0; i < 2; i++) - { - Vector2 offset = -Vector2.UnitX.RotatedByRandom(0.8).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustTypeRand, 0f, 0f, 0, default, 1.2f); - Main.dust[idx].velocity *= 0.3f; - Main.dust[idx].noGravity = true; - Main.dust[idx].position = Projectile.Center + offset * (float)Projectile.width / 2f; - if (Main.rand.NextBool()) - { - Main.dust[idx].fadeIn = 1.4f; - } - } - } - if (Main.rand.NextBool(3)) - { - Vector2 offset = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); - Main.dust[idx].velocity *= 0.3f; - Main.dust[idx].position = Projectile.Center + offset * (float)Projectile.width / 2f; - Main.dust[idx].fadeIn = 1.2f; - Main.dust[idx].scale = 1.5f; - Main.dust[idx].noGravity = true; - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - for (int i = 0; i < 2; i++) - { - int sizeFactor = 14; - 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; - } - if (Main.rand.NextBool(8)) - { - int sizeFactor = 16; - 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; + NPC target = Main.npc[targetNPC]; + Vector2 idealVelocity = Projectile.SafeDirectionTo(target.Center) * 12f; + Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 1f); + ProximityFactor = Utils.GetLerpValue(320f, 0f, Vector2.Distance(Projectile.Center, target.Center), true); } + trailColor = Color.Lerp(Color.CornflowerBlue, Color.Magenta, ProximityFactor); + Lighting.AddLight(Projectile.Center, trailColor.ToVector3() * 0.5f); + + Dust trail = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity * 0.05f); + trail.noGravity = true; + trail.scale = Main.rand.NextFloat(0.8f, 1f); + trail.color = trailColor; + + Vector2 sinOffset = (Vector2.UnitY * MathF.Sin(Projectile.timeLeft * MathHelper.Pi * 0.05f) * 24f).RotatedBy(Projectile.rotation); + Dust offTrail = Dust.NewDustPerfect(Projectile.Center + sinOffset, 175, Main.rand.NextVector2Circular(0.2f, 0.2f)); + offTrail.noGravity = true; + offTrail.scale = Main.rand.NextFloat(1.2f, 1.8f); + offTrail.alpha = Main.rand.Next(120, 180 + 1); } - public override bool PreDraw(ref Color lightColor) + internal float WidthFunction(float completionRatio) => Projectile.scale * 24f; + internal Color ColorFunction(float completionRatio) { - 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; + Vector3 trailColor = Main.rgbToHsl(Color.Lerp(Color.CornflowerBlue, Color.Magenta, ProximityFactor)); + Vector3 endColor = trailColor + new Vector3(0.1f + MathF.Sin(Main.GlobalTimeWrappedHourly * 5f) * 0.05f, 0f, 0.1f); + return Main.hslToRgb(Vector3.Lerp(trailColor, endColor, Utils.GetLerpValue(0f, 0.72f, completionRatio, true))) * Utils.GetLerpValue(0.8f, 0.54f, completionRatio, true) * Projectile.Opacity; + } + + public override void PostDraw(Color lightColor) + { + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 30); + Texture2D glow = TextureAssets.Projectile[Type].Value; + Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -210,7 +122,7 @@ namespace CalamityMod.Projectiles.Typeless if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); @@ -218,54 +130,10 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - int dustType1 = 263; - int dustType2 = 263; - int height = 50; - float scale1 = 1.7f; - float scale2 = 0.8f; - float scale3 = 2f; - 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.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - for (int i = 0; i < 40; i++) - { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 56, - 92, - 229, - 206, - 181 - }); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, scale1); - Dust dust = Main.dust[idx]; - dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust.noGravity = true; - dust.velocity *= 3f; - dust.velocity += velocity * Main.rand.NextFloat(); - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType1, 0f, 0f, 100, default, scale2); - dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust.velocity *= 2f; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += velocity * Main.rand.NextFloat(); - } - for (int i = 0; i < 20; i++) - { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType2, 0f, 0f, 0, default, scale3); - Dust dust = Main.dust[idx]; - dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; - dust.noGravity = true; - dust.velocity *= 0.5f; - dust.velocity += velocity * (0.6f + 0.6f * Main.rand.NextFloat()); - } + SoundEngine.PlaySound(EyeofMagnus.ImpactSound, Projectile.Center); + + 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/Typeless/MagnusBoom.cs b/Projectiles/Typeless/MagnusBoom.cs new file mode 100644 index 0000000000..95d64842ca --- /dev/null +++ b/Projectiles/Typeless/MagnusBoom.cs @@ -0,0 +1,84 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Typeless +{ + public class MagnusBoom : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 80; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Time == 0f) + { + for (int i = 0; i < 5; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Magenta, Color.LightPink, Utils.GetLerpValue(0, 5, i, true)), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.09f + 0.005f * i, (int)(20 - i * 1.5f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 3; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Magenta, Color.LightPink, Utils.GetLerpValue(0, 3, i, true)), "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.09f + 0.01f * i, (int)(20 - i * 2f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + + Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.PowderBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.1f, 2f, 24, true); + GeneralParticleHandler.SpawnParticle(outerGlow); + Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.05f, 1f, 24, true); + GeneralParticleHandler.SpawnParticle(innerGlow); + + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 4; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2(); + Particle cross = new GlowSparkParticle(Projectile.Center, velocity, false, 12, 0.4f, Color.Magenta, new Vector2(1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(cross); + } + } + + Projectile.scale = MathHelper.Lerp(0f, 1f, PiecewiseAnimation(Time / 20f, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) })); + if (Time < 10f) + { + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.Next(71, 73 + 1), Main.rand.NextVector2CircularEdge(6f, 6f) * (Main.rand.NextFloat(1f, 1.2f) + Projectile.scale)); + dust.noGravity = true; + dust.noLight = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.2f) + Projectile.scale; + dust.alpha = Main.rand.Next(120, 180 + 1); + } + } + + Time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 480); + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox); + } +} + + diff --git a/Projectiles/Typeless/MythrilFlare.cs b/Projectiles/Typeless/MythrilFlare.cs index 56ebc10890..d3c1b2d01d 100644 --- a/Projectiles/Typeless/MythrilFlare.cs +++ b/Projectiles/Typeless/MythrilFlare.cs @@ -18,8 +18,9 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 15; } public override void SetDefaults() diff --git a/Projectiles/Typeless/NanoFlare.cs b/Projectiles/Typeless/NanoFlare.cs index 9a7a34cff4..7d3096428b 100644 --- a/Projectiles/Typeless/NanoFlare.cs +++ b/Projectiles/Typeless/NanoFlare.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreVec = new Vector2(Projectile.position.X + (float)(Projectile.width / 2) - 24f, Projectile.position.Y + (float)(Projectile.height / 2) - 24f); float smokeScale = 0.66f; diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index a5867ff07c..7be094e82b 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Typeless public class Nanotech : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 26; @@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Typeless { int cap = 5; float capDamageFactor = 0.05f; - int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type] - cap; + int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap; modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f); } diff --git a/Projectiles/Typeless/NebulaDust.cs b/Projectiles/Typeless/NebulaDust.cs index 1577d47e52..001369b0f8 100644 --- a/Projectiles/Typeless/NebulaDust.cs +++ b/Projectiles/Typeless/NebulaDust.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Typeless 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); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Typeless/NebulaStar.cs b/Projectiles/Typeless/NebulaStar.cs index 8c988c24e1..224ac1e258 100644 --- a/Projectiles/Typeless/NebulaStar.cs +++ b/Projectiles/Typeless/NebulaStar.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -10,6 +11,7 @@ namespace CalamityMod.Projectiles.Typeless public class NebulaStar : BaseSporeSacProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 34; @@ -34,7 +36,7 @@ namespace CalamityMod.Projectiles.Typeless public override void PostDraw(Color lightColor) { - Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Width, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height); + Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Width, Terraria.GameContent.TextureAssets.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/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index b908dd04a6..3bb6f28ae9 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -206,7 +206,7 @@ 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?()); - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D segmentSprite = ModContent.Request("CalamityMod/Projectiles/Typeless/OmegaBlueTentacleSegment1").Value; for (int i = 0; i < 5; i++) { diff --git a/Projectiles/Typeless/OnyxLabSeeker.cs b/Projectiles/Typeless/OnyxLabSeeker.cs index a5bc8e7f78..97a26da02c 100644 --- a/Projectiles/Typeless/OnyxLabSeeker.cs +++ b/Projectiles/Typeless/OnyxLabSeeker.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/PauldronDash.cs b/Projectiles/Typeless/PauldronDash.cs index 04613c3e65..31a4099d5a 100644 --- a/Projectiles/Typeless/PauldronDash.cs +++ b/Projectiles/Typeless/PauldronDash.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -35,29 +36,53 @@ namespace CalamityMod.Projectiles.Typeless { target.AddBuff(BuffID.OnFire3, 240); target.AddBuff(ModContent.BuffType(), 300); - SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 0.6f, PitchVariance = 0.4f }, Projectile.Center); - for (int i = 0; i <= 8; i++) + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); + SoundEngine.PlaySound(sound with { Volume = 0.4f, Pitch = 0.15f }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/Item/MagicRockImpact"); + SoundEngine.PlaySound(sound2 with { Volume = 0.6f, Pitch = 0.35f }, Projectile.Center); + + for (int i = 0; i <= 12; i++) { - Dust dust = Dust.NewDustPerfect(target.Center, Main.rand.NextBool() ? 174 : 127, new Vector2(0, -2).RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(2f, 4.5f), 0, default, Main.rand.NextFloat(2.8f, 3.4f)); - dust.noGravity = false; - } - for (int i = 0; i <= 5; i++) - { - Dust dust2 = Dust.NewDustPerfect(target.Center, Main.rand.NextBool() ? 174 : 127, new Vector2(0, -3).RotatedByRandom(MathHelper.ToRadians(8f)) * Main.rand.NextFloat(1f, 5f), 0, default, Main.rand.NextFloat(2.8f, 3.4f)); + float variance = Main.rand.NextFloat(-0.7f, 0.7f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle, Projectile.velocity); + dust2.scale = (Main.rand.NextFloat(1.1f, 1.3f) - Math.Abs(variance)) * 2.5f; + dust2.velocity = (Vector2.UnitY * -18).RotatedBy(variance) * Main.rand.NextFloat(0.7f, 1f) * (1 - Math.Abs(variance) * 1.3f); + dust2.color = Main.rand.NextBool() ? Color.Orange : Color.OrangeRed; dust2.noGravity = false; + + Particle spark = new SparkParticle(Projectile.Center, new Vector2(17, 17).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 55, 0.85f, Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark); + } + float baseRot = Main.rand.NextFloat(-9f, 9f); + for (int i = 0; i < 5; i++) + { + float rot = Main.rand.NextFloat(-0.3f, 0.3f); + for (int b = 0; b < 2; b++) + { + Vector2 pulseVel = new Vector2(0, Main.rand.NextFloat(-7, -9)).RotatedBy(i * (MathHelper.ToRadians(360f) / 5)).RotatedBy(rot + baseRot + 0.9f); + Particle orb = new CustomPulse(target.Center, pulseVel, (Main.rand.NextBool() ? Color.Orange : Color.OrangeRed) * 0.9f, "CalamityMod/Projectiles/Summon/RustyBeaconPulse", Vector2.One, pulseVel.ToRotation(), 0.2f, Main.rand.NextFloat(0.55f, 0.85f) * 3f, Main.rand.Next(14, 19 + 1)); + GeneralParticleHandler.SpawnParticle(orb); + } + Particle orb2 = new CustomSpark(target.Center, new Vector2(0, -7).RotatedBy(i * (MathHelper.ToRadians(360f) / 5)).RotatedBy(rot + baseRot), "CalamityMod/Particles/BloomLineFade", false, 13, 0.095f, Main.rand.NextBool() ? Color.Orange : Color.OrangeRed, new Vector2(2.9f, 0.5f), shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(orb2); } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 15f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 0, Projectile.owner); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); public override bool? CanDamage() => base.CanDamage(); public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.HitDirectionOverride = Math.Sign(Owner.direction); + Owner.Calamity().GeneralScreenShakePower = 4f; + for (int i = 0; i < 2; i++) + { + Particle bloom = new CustomSpark(target.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 20, 1.2f, Color.OrangeRed, new Vector2(1, 1), true, true, glowCenterScale: 0.7f, glowOpacity: 0.8f); + GeneralParticleHandler.SpawnParticle(bloom); + } } - public override bool? CanCutTiles() => false; } } diff --git a/Projectiles/Typeless/PauldronExplosion.cs b/Projectiles/Typeless/PauldronExplosion.cs index e3fd808406..ee02ad48c7 100644 --- a/Projectiles/Typeless/PauldronExplosion.cs +++ b/Projectiles/Typeless/PauldronExplosion.cs @@ -30,24 +30,24 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = 2; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 240); - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.OrangeRed, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.8f, 1.1f), 20); - GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkOrange, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.6f, 0.9f), 20); - GeneralParticleHandler.SpawnParticle(pulse2); + //Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.OrangeRed, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.8f, 1.1f), 20); + //GeneralParticleHandler.SpawnParticle(pulse); + //Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkOrange, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.6f, 0.9f), 20); + //GeneralParticleHandler.SpawnParticle(pulse2); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); public override bool? CanDamage() => base.CanDamage(); public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.HitDirectionOverride = Math.Sign(Owner.direction); + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 15, true); } public override bool? CanCutTiles() => false; diff --git a/Projectiles/Typeless/PendantProjectile3.cs b/Projectiles/Typeless/PearlAuraShard.cs similarity index 64% rename from Projectiles/Typeless/PendantProjectile3.cs rename to Projectiles/Typeless/PearlAuraShard.cs index cf8165e20d..6953d1f41b 100644 --- a/Projectiles/Typeless/PendantProjectile3.cs +++ b/Projectiles/Typeless/PearlAuraShard.cs @@ -6,27 +6,28 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class PendantProjectile3 : ModProjectile, ILocalizedModType + public class PearlAuraShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 14; Projectile.height = 14; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 220; - Projectile.penetrate = 1; + Projectile.timeLeft = 150; Projectile.tileCollide = false; } public override void AI() { - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 10f, 20f); + if (Projectile.timeLeft < 140) + CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 10f, 20f); Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int i = 0; i < 5; i++) + Projectile.rotation = Projectile.velocity.ToRotation() - (MathHelper.PiOver2 * Projectile.spriteDirection); + for (int i = 0; i < 4; i++) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); Main.dust[dust].noGravity = true; @@ -34,9 +35,5 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[dust].velocity += Projectile.velocity * 0.1f; } } - - 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(), 60); } } diff --git a/Projectiles/Typeless/PendantProjectile3.png b/Projectiles/Typeless/PearlAuraShard.png similarity index 100% rename from Projectiles/Typeless/PendantProjectile3.png rename to Projectiles/Typeless/PearlAuraShard.png diff --git a/Projectiles/Typeless/PendantProjectile1.cs b/Projectiles/Typeless/PendantProjectile1.cs deleted file mode 100644 index f04ae59970..0000000000 --- a/Projectiles/Typeless/PendantProjectile1.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class PendantProjectile1 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 220; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int i = 0; i < 5; i++) - { - 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; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 30); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 30); - } -} diff --git a/Projectiles/Typeless/PendantProjectile1.png b/Projectiles/Typeless/PendantProjectile1.png deleted file mode 100644 index df5a566c0b..0000000000 Binary files a/Projectiles/Typeless/PendantProjectile1.png and /dev/null differ diff --git a/Projectiles/Typeless/PendantProjectile2.cs b/Projectiles/Typeless/PendantProjectile2.cs deleted file mode 100644 index c50d8c358f..0000000000 --- a/Projectiles/Typeless/PendantProjectile2.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class PendantProjectile2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 220; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int i = 0; i < 5; i++) - { - 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; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 30); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 30); - } -} diff --git a/Projectiles/Typeless/PendantProjectile2.png b/Projectiles/Typeless/PendantProjectile2.png deleted file mode 100644 index bcf5f2e978..0000000000 Binary files a/Projectiles/Typeless/PendantProjectile2.png and /dev/null differ diff --git a/Projectiles/Typeless/PlaguePulse.cs b/Projectiles/Typeless/PlaguePulse.cs index 14e6e4158e..64e4a8f6d3 100644 --- a/Projectiles/Typeless/PlaguePulse.cs +++ b/Projectiles/Typeless/PlaguePulse.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Typeless public ref float time => ref Projectile.ai[0]; public ref float radius => ref Projectile.ai[1]; public float maxRadius = 300; - public int startDamage; + public bool visible; public override void SetDefaults() { Projectile.width = 96; @@ -36,23 +36,22 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (time == 0) - startDamage = Projectile.damage; - Player player = Main.player[Projectile.owner]; + visible = player.Calamity().toxicHeartVisuals; if (Projectile.ai[2] == 0) Projectile.Center = player.MountedCenter; if (Projectile.ai[2] == 1) { - maxRadius = 200; + maxRadius = Main.rand.Next(150, 250 + 1); + Projectile.extraUpdates = 2; } - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(5) && visible) { DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center + Main.rand.NextVector2Circular(radius, radius), Vector2.Zero, (Main.rand.NextBool(3) ? Color.LimeGreen : Color.Green) * 0.6f, new Vector2(1, 1), 0, Main.rand.NextFloat(0.07f, 0.23f), 0f, 20); GeneralParticleHandler.SpawnParticle(pulse); } - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(3) && visible) { for (int i = 0; i < 2; i++) { @@ -70,10 +69,10 @@ namespace CalamityMod.Projectiles.Typeless } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.85f); - if (Projectile.damage < 1) - Projectile.damage = 1; + float minMult = 0.4f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -83,15 +82,33 @@ namespace CalamityMod.Projectiles.Typeless if ((target.life <= 0 && target.realLife == -1)) { player.Heal(10); - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(startDamage * 0.8f), 0f, Projectile.owner, 0, 0, 1); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.9f), 0f, Projectile.owner, 0, Projectile.ai[1] + 1, 1); + } + if (target.CanBeMoved()) // Always push targets away from the player + { + Vector2 pushVelocity = Utils.DirectionTo(player.Center, target.Center) * 5; + target.velocity = pushVelocity; } } public override bool PreDraw(ref Color lightColor) { Player player = Main.player[Projectile.owner]; - Texture2D rexture = ModContent.Request("CalamityMod/Particles/HighResHollowCircleHardEdge").Value; - Main.EntitySpriteDraw(rexture, Projectile.Center - Main.screenPosition, null, (Color.Green * Utils.Remap(time, 30, 60, 0.35f, 0, true)) with { A = 0 }, Projectile.rotation, rexture.Size() * 0.5f, (Utils.Remap(time, 0, 60, 1, 6, true) / 21) * (maxRadius == 300 ? 1 : 0.7f), SpriteEffects.None, 0); + Texture2D rexture = ModContent.Request("CalamityMod/Particles/SoftRoundExplosion").Value; + Texture2D fexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color color = (Color.Green * Utils.Remap(time, 30, 60, 0.35f, 0, true)) with { A = 0 } * (visible ? 1f : 0.25f); + float scale = (Utils.Remap(time, 0, 60, 1, 6, true) / 21) * (maxRadius == 300 ? 1 : 0.7f); + Vector2 pos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(rexture, pos, null, color, Projectile.rotation - Main.GlobalTimeWrappedHourly * 1.5f, rexture.Size() * 0.5f, scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rexture, pos, null, color, Projectile.rotation + Main.GlobalTimeWrappedHourly * 3, rexture.Size() * 0.5f, scale * 0.95f, SpriteEffects.None, 0); + if (Projectile.ai[2] == 1) + { + for (int i = 0; i < 4; i++) + { + float pulseScale = (scale * 6 + 0.11f) - i * 0.022f; + Main.EntitySpriteDraw(fexture, pos, null, color, Projectile.rotation, fexture.Size() * 0.5f, pulseScale, SpriteEffects.None, 0); + } + } return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); diff --git a/Projectiles/Typeless/PuddleSplash.cs b/Projectiles/Typeless/PuddleSplash.cs new file mode 100644 index 0000000000..992b40eea4 --- /dev/null +++ b/Projectiles/Typeless/PuddleSplash.cs @@ -0,0 +1,65 @@ +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class PuddleSplash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public override void SetDefaults() + { + Projectile.width = 165; + Projectile.height = 80; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = AverageDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.timeLeft = 25; + } + + public override void AI() + { + if (time == 0) + { + SoundStyle waterSound = new("CalamityMod/Sounds/Item/WaterSplash" + (Main.rand.NextBool() ? "1" : "2")); + SoundEngine.PlaySound(waterSound with { Volume = 0.2f, Pitch = Main.rand.NextFloat(0.9f, 1f) }, Projectile.Center); + for (int i = 0; i < 6; i++) + { + BloodParticle water = new BloodParticle(Projectile.Center, (-Vector2.UnitY * Main.rand.NextFloat(6f, 12f)).RotatedByRandom(0.65f), 30, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.NextBool() ? Color.CornflowerBlue : Color.SkyBlue); + GeneralParticleHandler.SpawnParticle(water); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (-Vector2.UnitY * Main.rand.NextFloat(2f, 5f)).RotatedByRandom(0.65f), 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + dust.noGravity = false; + dust.color = Main.rand.NextBool() ? Color.CornflowerBlue : Color.SkyBlue; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 100; + } + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomSpark(Projectile.Center, -Vector2.UnitY * 0.1f, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, i == 0 ? 15 : 22, i == 0 ? 0.07f : 0.05f, i == 0 ? Color.CornflowerBlue : Color.SkyBlue, new Vector2(0.7f, i == 0 ? 1.3f : 0.9f), shrinkSpeed: i == 0 ? -0.6f : -0.5f); + GeneralParticleHandler.SpawnParticle(blastRing); + } + } + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Wet, 180); + Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center) + Vector2.UnitY * -0.75f; + target.MoveNPC(launchVel, 12, false); + } + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Typeless/ReaverThornBase.cs b/Projectiles/Typeless/ReaverThornBase.cs index afc80dbf28..a908340bf9 100644 --- a/Projectiles/Typeless/ReaverThornBase.cs +++ b/Projectiles/Typeless/ReaverThornBase.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Typeless // Draw the tip for the final thorn public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 929d83d3d8..7a57f2aada 100644 --- a/Projectiles/Typeless/RedLabSeeker.cs +++ b/Projectiles/Typeless/RedLabSeeker.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/RelicGuard.cs b/Projectiles/Typeless/RelicGuard.cs new file mode 100644 index 0000000000..42c242cfe4 --- /dev/null +++ b/Projectiles/Typeless/RelicGuard.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Items; +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 RelicGuard : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color bColor = Color.White; + public int time = 0; + public float rotMult = 0.05f; + public int direction = 1; + public float rot2 = 0; + public Vector2 aimVel; + public float xLerp = 0; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + float sine = (float)Math.Sin(time * 0.13f / MathHelper.Pi); + float rate = Main.GlobalTimeWrappedHourly * 2; + List eColors = new List() + { + Color.Sienna, + Color.Peru + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + xLerp = MathHelper.Lerp(xLerp, (30 + 10 * sine) * Math.Sign(aimVel.X), 0.05f); + Projectile.Center = Owner.MountedCenter + new Vector2(xLerp, -25 + 12 * sine); + Owner.direction = Math.Sign(aimVel.X); + + if (Owner.HeldItem.type == ModContent.ItemType()) + Projectile.timeLeft++; + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + // Emit some light + Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f); + + rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f; + + if (time % 2 == 0 && false) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.7f, 0.9f) * Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true); + dust.color = bColor; + dust.noLightEmittence = true; + } + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + aimVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float adjustedRot = aimVel.ToRotation(); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, adjustedRot + (MathHelper.ToRadians(90)), 0.05f); + + float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D rTexture = ModContent.Request("CalamityMod/Items/RelicOfResilience").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color drawColor = bColor; + float CDScale = Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true); + + for (int i = 0; i < 2; i++) + { + float bScale2 = 0.55f; + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * CDScale, SpriteEffects.None, 0); + } + + Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + return false; + } + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs index 8887c58242..027e3bebea 100644 --- a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs +++ b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs @@ -1,5 +1,10 @@ -using CalamityMod.Dusts; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Items; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -13,11 +18,20 @@ namespace CalamityMod.Projectiles.Typeless public class RelicOfConvergenceCrystal : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public const int SoundInterval = 15; - public const int TotalCrystalsToDraw = 3; - public const int CrystalsDrawTime = 90; - public const float MaxCrystalOffsetRadius = 80f; - public const float MaxDustOffsetRadius = 70f; + public int SoundInterval = 25; + public int TotalCrystalsToDraw = 3; + public int CrystalsDrawTime = 40; + public float MaxCrystalOffsetRadius = 80f; + public float MaxDustOffsetRadius = 70f; + + private Player Owner => Main.player[Projectile.owner]; + public List healList = new List(new bool[Main.maxPlayers]); + + public ref float time => ref Projectile.ai[0]; + public float completion = 0; + public float fade = 0; + public Vector2 mousePos; + public bool playSound = true; public override void SetDefaults() { Projectile.width = 32; @@ -25,115 +39,159 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 240; + Projectile.timeLeft = 125; } public override void AI() { - Player player = Main.player[Projectile.owner]; - if (!player.channel) + completion = Utils.GetLerpValue(120, 0, Projectile.timeLeft, true); + fade = MathHelper.Lerp(fade, 0, 0.04f); + if (Projectile.timeLeft >= 5) + mousePos = Owner.ClampedMouseWorld(); + + if (!Owner.channel) { Projectile.Kill(); return; } - // Restrict player movement (as a penalty). - player.velocity.X = MathHelper.Clamp(player.velocity.X, -5f, 5f); - if (player.velocity.Y < 0f) - { - player.velocity.Y = MathHelper.Clamp(player.velocity.Y, -6f, 0f); - } - UpdatePlayerVisuals(player); + if (Owner.Calamity().profanedSoulRelicBuff) + Projectile.extraUpdates = 1; + + UpdatePlayerVisuals(Owner); + // Make a constant "magical" sound. if (Projectile.soundDelay <= 0) { - SoundEngine.PlaySound(SoundID.Item4, Projectile.Center); - Projectile.soundDelay = SoundInterval; - } - Projectile.ai[0]++; - // Make a sound when fully charged. - if (Projectile.ai[0] == CrystalsDrawTime) - { - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); - } - // Create a circle of dust. The circle expands outward at first until it reaches its "destination" radius. - // Once the circle is at its maximum size, some of the dust moves inward. - if (Projectile.ai[0] >= CrystalsDrawTime) - { - GeneratePassiveDust(player); - } - if (Projectile.timeLeft == 1) - { - for (int i = 0; i < 45; i++) + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.5f * (time >= CrystalsDrawTime ? 1 : 2), Pitch = 0.5f * completion }, Projectile.Center); + + if (time >= CrystalsDrawTime) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); - dust.velocity = Utils.NextVector2Circular(Main.rand, 28f, 28f); - dust.fadeIn = Main.rand.NextFloat(3f, 4f); - dust.noGravity = true; + SoundStyle h = new("CalamityMod/Sounds/Item/NullHit"); + SoundEngine.PlaySound(h with { Volume = 0.4f, Pitch = -0.3f + 0.7f * completion }, Projectile.Center); + + float numberOfDusts = 10f; + for (int i = 0; i < numberOfDusts; i++) + { + Particle energy = new VelChangingSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(9f, 18f), Utils.DirectionFrom(mousePos, Projectile.Center) * 35, "CalamityMod/Particles/BloomCircle", 25, Main.rand.NextFloat(0.1f, 0.35f) * completion, Color.Lerp(Color.Orange, Color.Orchid, completion), new Vector2(1f, 1f), lerpRate: 0.04f, shrinkSpeed: 0.15f); + GeneralParticleHandler.SpawnParticle(energy); + } } - player.HealEffect(70, false); - player.statLife += 70; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); + + Projectile.soundDelay = (int)(SoundInterval * (time >= CrystalsDrawTime ? 1 - 0.9f * completion : 0.5f)); + fade = 1; } + + if (Projectile.timeLeft == 5) + { + //if (Projectile.owner != Main.myPlayer) + //return; + + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + float targetDist = player.Center.DistanceSQ(mousePos); + + if (targetDist < 138f * 138f && player.team == Owner.team) + { + if (healList[playerIndex] == false) + { + healList[playerIndex] = true; + int trueHealValue = (int)(RelicOfConvergence.HealValue * (player.whoAmI == Owner.whoAmI ? 1f : 1.5f) * (Owner.Calamity().profanedSoulRelicBuff ? 1.25f : 1f)); + player.HealPlayer(trueHealValue, HealTextType.Local); + + if (playSound) + { + SoundStyle heal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianHeal"); + SoundEngine.PlaySound(heal with { Volume = 1, MaxInstances = -1 }, Projectile.Center); + playSound = false; + } + + for (int i = 0; i < 5; i++) + { + Particle spark = new CustomSpark(player.Center + Main.rand.NextVector2Circular(15, 15), (-Vector2.UnitY * Main.rand.NextFloat(0.2f, 3f)), "CalamityMod/Particles/HealingPlus", false, Main.rand.Next(35, 50 + 1), Main.rand.NextFloat(1.1f, 1.9f), Color.Lerp(Color.Orchid, Color.White, i * 0.1f), Vector2.One, true, true, 0, false, false, 0.1f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + } + } + + if (time >= CrystalsDrawTime) + { + GeneratePassiveDust(Owner); + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.Orange, Color.Orchid, completion).ToVector3() * (2.5f * (completion - 0.375f) + fade)); + } + + time++; } public void UpdatePlayerVisuals(Player player) { - Projectile.Center = player.Center + Vector2.UnitX * 15f * player.direction; + Vector2 vel = Utils.DirectionTo(player.Center, mousePos); + float rot = vel.ToRotation() + (player.direction == -1 ? MathHelper.ToRadians(270f) : MathHelper.ToRadians(-90f)); + + player.ChangeDir(MathF.Sign(vel.X)); + + Projectile.Center = player.Center + vel * 15f; // The crystal is a holdout projectile, so change the player's variables to reflect that player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); } public void GeneratePassiveDust(Player player) { float radius = 45f; - if (Projectile.ai[0] < CrystalsDrawTime + 30f) - { - radius = MathHelper.Lerp(0f, 45f, (Projectile.ai[0] - CrystalsDrawTime) / 30f); - } + radius = MathHelper.Lerp(0f, 200f, completion - 0.375f); + for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(Main.rand.NextFloat(6f, 8f))) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * radius, (int)CalamityDusts.ProfanedFire); - dust.position = Projectile.Center + angle.ToRotationVector2() * radius; - dust.scale = Main.rand.NextFloat(0.8f, 1.1f); - dust.noGravity = true; - dust.velocity = player.velocity; - if (Main.rand.NextBool(15) || Projectile.timeLeft == 1) + Vector2 drawPos = mousePos + angle.ToRotationVector2() * radius; + Color useColor = Color.Lerp(Color.Orange, Color.Orchid, completion) * (completion - 0.25f); + float particleScale = 0.01f + fade * 0.08f + completion * 0.08f; + Particle aura = new CustomSpark(drawPos, Utils.DirectionTo(mousePos, drawPos), "CalamityMod/Particles/SmallBloom", false, 4, particleScale, useColor, new Vector2(0.5f + completion, (2f - completion) * 7 - completion * 7)); + GeneralParticleHandler.SpawnParticle(aura); + + if (Main.rand.NextBool(70)) { - dust.velocity = Projectile.DirectionFrom(dust.position) * Main.rand.NextFloat(4f, 5f); - if (Projectile.timeLeft == 1) - dust.velocity *= 1.7f; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * radius, ModContent.DustType()); + dust2.position = mousePos + angle.ToRotationVector2() * radius; + dust2.scale = Main.rand.NextFloat(1.4f, 1.9f) * completion; + dust2.noGravity = false; + dust2.velocity = new Vector2(0, Main.rand.NextFloat(1, 5)); + dust2.color = useColor; + } + + if (Projectile.timeLeft == 5) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * radius, ModContent.DustType()); + dust.position = drawPos; + dust.scale = Main.rand.NextFloat(1.6f, 1.9f); + dust.noGravity = !Main.rand.NextBool(5); + dust.velocity = Utils.DirectionTo(mousePos, drawPos) * Main.rand.NextFloat(2f, 4f); + dust.color = Color.Orchid; + dust.noLightEmittence = true; } } } public override bool PreDraw(ref Color lightColor) { - if (Projectile.ai[0] >= CrystalsDrawTime) - return true; - float opacity = Projectile.ai[0] / CrystalsDrawTime; - Texture2D crystalTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + float opacity = time / CrystalsDrawTime; + Texture2D crystalTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; for (int i = 0; i < TotalCrystalsToDraw; i++) { - float angle = MathHelper.TwoPi / TotalCrystalsToDraw * i + Projectile.ai[0] / 10f; - float radius = MathHelper.Lerp(MaxCrystalOffsetRadius, 0f, Projectile.ai[0] / CrystalsDrawTime); + float angle = MathHelper.TwoPi / TotalCrystalsToDraw * i + time / 10f; + float radius = MathHelper.Lerp(MaxCrystalOffsetRadius, 0f, time / CrystalsDrawTime); Vector2 drawPositionOffset = angle.ToRotationVector2() * radius; - Vector2 drawPosition = Projectile.Center + drawPositionOffset; - Main.EntitySpriteDraw(crystalTexture, - drawPosition - Main.screenPosition, - null, - Color.White * opacity, - Projectile.rotation, - Projectile.Size * 0.5f, - Projectile.scale, - SpriteEffects.None, - 0); + Vector2 drawPosition = (time >= CrystalsDrawTime ? Projectile.Center : Projectile.Center + drawPositionOffset + Main.rand.NextVector2Circular(12, 12)); + + Projectile.DrawProjectileWithBackglow(Color.Lerp(Color.Orchid, Color.Goldenrod, fade) with { A = 0 } * completion * 0.5f, Color.Lerp(Color.White, Color.White with { A = 0 }, fade * 0.5f) * MathHelper.Clamp(completion * 1.5f, time >= CrystalsDrawTime ? 0.8f : 0f, 1), 4f * completion + (fade * 3), crystalTexture, xPos: drawPosition.X, yPos: drawPosition.Y); } return false; } diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index 1c2161af35..cc5b122fa2 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -1,9 +1,14 @@ using System; using System.Collections.Generic; using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,18 +20,47 @@ namespace CalamityMod.Projectiles.Typeless public class RelicOfDeliveranceSpear : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public Vector2 IdealVelocity = -Vector2.UnitY * MinChargeSpeed; - public const int MaxCharges = 3; - public const float DustSpawnInterval = 3f; - public const float WaitTimeRequiredForCharge = 40f; - public const float WaitTimeRequiredForMaximumCharge = 180f; - public const float MinChargeSpeed = 16f; - public const float MaxChargeSpeed = 30f; + public ref float time => ref Projectile.ai[0]; + + public Vector2 idealVel; + public int driftFrames = 0; + public bool flying = false; + public Player Owner => Main.player[Projectile.owner]; + + public int boostTimer = 0; + public bool boosted => boostTimer > 0; + + public int driftTimer = 0; + public bool drifting => Main.mouseLeft; + public int driftPower = 1; + public float driftPowerScaling = 1; + public float driftBadMult = 1; + public bool killed = false; + + public float iframeLevel = 0.2f; // Decides the level of dash iframes it gives when starting a dash, lower is less + + public float velX; + public float velY; + + public Vector2 respawnPoint; + public int respawnTimer = 0; + public bool inTiles = false; + public float respawnMult = 0; + + int postHitTimer = 0; + public Color bColor = Color.White; + public SlotId digSoundSlot; + public int digFXCooldown = 0; + public float ramLerp; + + public float damageMult = 1; + public int hitCountDamageSource = 0; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -36,209 +70,462 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = -1; Projectile.friendly = true; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = 50 * Projectile.MaxUpdates; + Projectile.extraUpdates = 3; + Projectile.ContinuouslyUpdateDamageStats = true; } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.localAI[0]); - writer.Write(Projectile.localAI[1]); - writer.WriteVector2(IdealVelocity); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.localAI[0] = reader.ReadSingle(); - Projectile.localAI[1] = reader.ReadSingle(); - IdealVelocity = reader.ReadVector2(); - } - public override void AI() { - Player player = Main.player[Projectile.owner]; - if (player.dead || - Projectile.Center.Y < 200f || - Projectile.Center.X < 200f || - Projectile.Center.X > Main.maxTilesX * 16f - 200f) - { - Projectile.Kill(); + if (killed) return; + + ramLerp = Utils.GetLerpValue(120 * driftPower, 0, boostTimer, true); + Owner.Calamity().rOfDelivarenceRam = false; + + float rate = Main.GlobalTimeWrappedHourly * 7; + Color powerColor = Color.Khaki; + List eColors = new List() + { + Color.Goldenrod, + Color.OrangeRed, + Color.Orange, + Color.Gold + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), powerColor, Utils.Remap(ramLerp, iframeLevel, 0.17f, 0.5f, 0, true) * (driftPower == 1 ? 0 : 1)); + + if (Owner.dead || Owner.Calamity().mouseRight || !WorldGen.InWorld(Owner.Center.ToTileCoordinates().X, Owner.Center.ToTileCoordinates().Y, 20)) // Die if Owner dies or right clicks to exit + { + KillProj(); } Projectile.frameCounter++; - if (Projectile.frameCounter > 4) + if (Projectile.frameCounter > 4 * Projectile.MaxUpdates) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 0; } - Projectile.ai[0]++; - if (Projectile.velocity == Vector2.Zero) + + // Immediately die if the Owner is not holding the spear + if (Owner.ActiveItem() == null) { - // Immediately die if the player is not holding the spear - if (player.ActiveItem() == null) + KillProj(); + return; + } + if (Owner.ActiveItem().type != ModContent.ItemType()) + { + KillProj(); + return; + } + + float speed = (CalamityPlayer.areThereAnyDamnBosses ? 3f : 6f) * driftBadMult * (inTiles ? 0.65f : 1); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 aimDir = Owner.Calamity().mouseWorld; + + idealVel = Utils.DirectionTo(Owner.Center, aimDir) * speed * driftPower; + driftPowerScaling = MathHelper.Lerp(driftPowerScaling, driftPower * 0.7f, (driftPowerScaling > driftPower * 0.7f) ? 0.005f : 0.04f); + + if (time == 0) + { + Projectile.velocity = idealVel * 0.2f; + velX = Projectile.velocity.X; + velY = Projectile.velocity.Y; + } + + float lerpPower = (drifting ? 0 : (boosted && driftPower > 1) ? 0.01f * ramLerp : 0.02f); + velX = MathHelper.Lerp(Projectile.velocity.X, idealVel.X, lerpPower); + velY = MathHelper.Lerp(Projectile.velocity.Y, idealVel.Y, lerpPower); + + Projectile.velocity = new Vector2(velX, velY); + if (Projectile.velocity.Length() <= speed && !drifting) + { + Projectile.velocity *= 1.05f; + } + + if (drifting) + { + if (driftTimer == 0) + driftPower = 1; + + boostTimer = 0; + + if (time % Projectile.MaxUpdates == 0) { - Projectile.Kill(); - return; + if (Projectile.velocity.Length() > 1) + { + driftBadMult = 1; + driftTimer++; + driftPower = (driftTimer > 100 ? 3 : driftTimer > 40 ? 2 : 1); + } + else + { + driftPower = 1; + driftTimer = (int)(MathHelper.Clamp(driftTimer * 0.94f, 1, 300)); + } + Projectile.velocity *= (1f - 0.02f * (CalamityPlayer.areThereAnyDamnBosses ? 0.5f : 1)); } - if (player.ActiveItem().type != ModContent.ItemType()) + + Projectile.extraUpdates = 3; + float sparkPower = Utils.GetLerpValue(0, 100, driftTimer); + if (time % Projectile.MaxUpdates * 2 == 0) { - Projectile.Kill(); - return; + SoundStyle sound = new("CalamityMod/Sounds/Item/NullImpact"); + SoundEngine.PlaySound(sound with { Volume = 0.045f, Pitch = (Main.rand.NextFloat(-0.2f, -0.4f) + sparkPower * 0.4f) + (driftPower == 2 ? 0.3f : driftPower == 3 ? 0.7f : 0), MaxInstances = -1 }, Projectile.Center); } - Projectile.rotation = Projectile.AngleTo(Main.MouseWorld); - Projectile.Center = player.Center; - if (Projectile.ai[0] >= WaitTimeRequiredForCharge) + for (int i = 0; i < 2; i++) { - // Begin the lunge - bool noObstaclesInWay = Collision.CanHitLine(Projectile.Center, 1, 1, Projectile.Center + Projectile.SafeDirectionTo(Main.MouseWorld) * 25f, 1, 1); - if (Main.myPlayer == Projectile.owner && Main.mouseLeft && !Main.blockMouse && !player.mouseInterface && noObstaclesInWay) + Color sparkColor = (driftPower == 2 ? Color.Orange : driftPower == 3 ? Color.OrangeRed : Color.Khaki); + Vector2 baseVel = Vector2.Lerp(Projectile.velocity, -idealVel, sparkPower); + Vector2 vel = baseVel.RotatedByRandom(1.5f - sparkPower * 0.5f) * Main.rand.NextFloat(0.5f, 3f); + Particle energy = new VelChangingSpark(Projectile.Center + idealVel * 3, vel + baseVel.SafeNormalize(Vector2.UnitX) * 15, vel, "CalamityMod/Particles/BloomCircle", Main.rand.Next(6, 9 + 1), Main.rand.NextFloat(0.25f, 0.65f) * sparkPower, Color.Lerp(sparkColor, Color.Goldenrod, Main.rand.NextFloat(0, 0.3f)), new Vector2(0.2f, 1f), lerpRate: 0.35f, shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(energy); + } + } + if (!drifting) + { + // Iframes for the ram + if (driftPower > 1 && ramLerp < iframeLevel && !killed) + { + Owner.Calamity().rOfDelivarenceRam = true; + if (Main.rand.NextBool() || driftPower == 3) + { + Particle spark = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30 + Main.rand.NextVector2Circular(30, 30) * driftPowerScaling, Projectile.velocity * Main.rand.NextFloat(0.2f, 5), "CalamityMod/Particles/FullStar", false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(0.6f, 1.2f), Color.Khaki, new Vector2(2, 1), true, false, 0, false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + if (driftPower > 2) + Projectile.extraUpdates = 5; + else + Projectile.extraUpdates = 3; + + if (driftPower == 1 && driftBadMult == 1 && driftTimer > 0) + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * (speed * 0.1f); + driftBadMult = 0.1f; + } + + if (time % Projectile.MaxUpdates == 0) + { + if (driftBadMult < 1) + driftBadMult += 0.005f; + + if (boostTimer == 0 && driftTimer > 0) { - float chargeSpeed = MathHelper.Lerp(MinChargeSpeed, MaxChargeSpeed, (Projectile.ai[0] - WaitTimeRequiredForCharge) / WaitTimeRequiredForMaximumCharge); - if (chargeSpeed > MaxChargeSpeed) - chargeSpeed = MaxChargeSpeed; - Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld) * chargeSpeed; - IdealVelocity = Projectile.velocity; - Projectile.ai[1] = chargeSpeed; - SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); Projectile.netUpdate = true; - } - // Charge-up dust - if (Projectile.ai[0] <= WaitTimeRequiredForCharge + WaitTimeRequiredForMaximumCharge) - { - for (int i = 0; i < 3; i++) + driftBadMult = (driftPower > 1 ? 1 : time < 60 ? 0 : 0.35f); + driftTimer = 0; + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * speed * driftPower; + + Particle pulse2 = new CustomPulse(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3.1f * driftPower, Color.Goldenrod * 0.8f, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0f, 1.33f * driftPower, 25); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle pulse = new CustomPulse(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8.4f * driftPower, Color.OrangeRed * 0.8f, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0f, 0.92f * driftPower, 25); + GeneralParticleHandler.SpawnParticle(pulse); + + float volume = 0.1f + 0.3f * driftPower; + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderSmallHit"); + SoundEngine.PlaySound(sound with { Volume = volume, Pitch = (-0.7f + 0.1f * driftPower) }, Projectile.Center); + if (driftPower > 1) { - Vector2 dustPosition = Utils.NextVector2Circular(Main.rand, Projectile.width * 1.6f, Projectile.height * 2.3f) / 2f + Projectile.Center; - Dust dust = Dust.NewDustPerfect(dustPosition, (int)CalamityDusts.ProfanedFire); - dust.velocity = Projectile.SafeDirectionTo(dust.position) * Projectile.Distance(dust.position) / -11f; - dust.velocity += player.velocity; - dust.noGravity = true; - dust.fadeIn = 1.6f; + SoundStyle sound2 = new("CalamityMod/Sounds/Item/LauncherHeavyShot"); + SoundEngine.PlaySound(sound2 with { Volume = volume * 2, Pitch = (-0.3f - 0.1f * driftPower) }, Projectile.Center); } - Projectile.Center += Utils.NextVector2Circular(Main.rand, 1.8f, 1.8f); - } - // Full charge dust indicator - if (Projectile.ai[0] == WaitTimeRequiredForCharge + WaitTimeRequiredForMaximumCharge) - { - for (int i = 0; i < 60; i++) + if (driftPower > 2) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); - dust.velocity = Utils.NextVector2Circular(Main.rand, 9f, 9f) * Main.rand.NextFloat(0.8f, 1.2f); - dust.velocity += player.velocity; - dust.noGravity = true; - dust.fadeIn = 1.6f; + SoundStyle sound3 = new("CalamityMod/Sounds/Item/OpalChargedFire"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(sound3 with { Volume = 0.7f, Pitch = 0.4f, MaxInstances = 3 }, Projectile.Center); } - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); + if (driftPower > 1) + Owner.Calamity().GeneralScreenShakePower = (driftPower == 2 ? 6 : 9); + else if (driftBadMult > 0.15f) + driftBadMult -= 0.15f; + + + boostTimer = 120 * driftPower; + Projectile.numHits = 0; + hitCountDamageSource = 0; } - player.ChangeDir((Math.Cos(Projectile.rotation) > 0).ToDirectionInt()); + if (boostTimer > 0) + boostTimer--; + if (boostTimer == 0) + driftPower = 1; } + + if (driftBadMult > 0.2f) + { + float sine = (float)Math.Sin(time * 0.085f / MathHelper.Pi); + float mult = driftBadMult * driftPowerScaling; + Vector2 tipPos = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 125 * mult; + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 15.5f; + for (int i = 0; i < 2; i++) + { + offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 15.5f * (i == 0 ? -1 : 1); + Particle spark = new VelChangingSpark(tipPos + offset, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) + offset * 0.05f) * 20.5f * mult, -Projectile.velocity.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/SmallBloom", 15, 0.11f * mult, bColor * 0.65f, new Vector2(1, 3.8f), true, false, shrinkSpeed: 0.42f, lerpRate: 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (driftPower == 3) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1, 10); + Particle energy = new VelChangingSpark(Projectile.Center + vel, -Projectile.velocity.SafeNormalize(Vector2.UnitX), -Projectile.velocity.SafeNormalize(Vector2.UnitX) + vel * Main.rand.NextFloat(0.01f, 0.02f), "CalamityMod/Particles/BloomCircle", Main.rand.Next(12, 19 + 1), Main.rand.NextFloat(0.55f, 0.95f), Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat(0, 1f)), new Vector2(0.2f, 1f), lerpRate: 0.25f, shrinkSpeed: 0.35f); + GeneralParticleHandler.SpawnParticle(energy); + } + if (time % Projectile.MaxUpdates == 0) + { + Vector2 vel = (Projectile.velocity.SafeNormalize(Vector2.UnitX) + (offset * (Main.rand.NextBool() ? 1 : -1)) * 0.03f) * 50.5f * mult; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + (offset * (Main.rand.NextBool() ? 1 : -1)).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.6f, 1.4f), ModContent.DustType()); + dust2.scale = Main.rand.NextFloat(0.7f, 1.2f) * mult; + dust2.noGravity = true; + dust2.velocity = vel * Main.rand.NextFloat(0.6f, 1.4f); + dust2.color = bColor; + } + } + } + + if (Collision.SolidCollision(Projectile.Center, 20, 20)) + inTiles = true; + else + inTiles = false; + if (inTiles) + { + if (respawnTimer == 0 && time % Projectile.MaxUpdates == 0) + { + SoundStyle digSound = new("CalamityMod/Sounds/Item/HeavyDig"); + digSoundSlot = SoundEngine.PlaySound(digSound with { Volume = 0.7f, IsLooped = true }, Projectile.Center); + if (digFXCooldown == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/MagicRockImpact"); + SoundEngine.PlaySound(sound with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.3f, 0.7f) }, Projectile.Center); + for (int i = 0; i < 13; i++) + { + Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(2f, 24f), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6", true, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.85f, 2.3f), Color.White, new Vector2(1.1f, 0.8f), false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + if (i % 2 == 0) + { + MediumMistParticle RockCloud = new MediumMistParticle(Projectile.Center + Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 7f), -Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(1, 12), Color.Peru, Color.Sienna, Main.rand.NextFloat(1.4f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(RockCloud); + } + } + digFXCooldown = 5; + } + } + + if (time % Projectile.MaxUpdates == 0) + { + respawnTimer++; + Projectile.soundDelay--; + } + if (respawnTimer >= 300) + { + Projectile.netUpdate = true; + Projectile.Center = respawnPoint; + Owner.Center = respawnPoint; + Projectile.velocity *= 0.01f; + for (int i = 0; i < 15; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 15.5f * (i % 4 == 0 ? 0.88f : 1f) * Main.rand.NextFloat(0.8f, 1f); + float scale = Main.rand.NextFloat(1.3f, 1.6f) * 0.6f * (i % 4 == 0 ? 2.2f : 1.8f); + + Particle aura = new VelChangingSpark(respawnPoint, vel.RotatedBy(0.02f) * 3, -vel.RotatedBy(-0.04f) * 4, "CalamityMod/Particles/SmallBloom", 27, 0.2f, Color.Goldenrod, new Vector2(1.8f, 1.5f), lerpRate: 0.07f, shrinkSpeed: 0.25f); + GeneralParticleHandler.SpawnParticle(aura); + + } + Particle orb2 = new CustomPulse(respawnPoint, Vector2.Zero, Color.Khaki, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 2, 0.5f, 28); + GeneralParticleHandler.SpawnParticle(orb2); + + SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianHeal"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.7f, -0.9f) }, respawnPoint); + + KillProj(); + } + if (respawnPoint == Vector2.Zero) + respawnPoint = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 60; + + if (SoundEngine.TryGetActiveSound(digSoundSlot, out var zound) && zound.IsPlaying) + { + zound.Position = Projectile.Center; + zound.Pitch = 0.4f * respawnMult - (drifting ? 0.5f : 0); + zound.Volume = (drifting ? 0.6f : 1f); + } + + respawnMult = Utils.GetLerpValue(60, 300, respawnTimer); } else { - // Adjust direction so that the spear is always launching in the direction of the mouse. - // However, if the mouse position is really close to the projectile, don't do anything. - // Being close to the target may cause erratic movements. - // The projectile.localAI[1] part is to prevent the projectile from redirecting on a frame-by-frame basis (Main.mouseLeft seems to mean mouse hold, not release). - if (Projectile.Distance(Main.MouseWorld) > 60f && - Main.mouseLeft && !Main.blockMouse && !player.mouseInterface && - Projectile.localAI[0] <= MaxCharges && - Projectile.localAI[1] <= 0f) + if (SoundEngine.TryGetActiveSound(digSoundSlot, out var zound)) + zound?.Stop(); + respawnPoint = Projectile.Center; + if (respawnTimer > 0) { - IdealVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Projectile.ai[1]; - Projectile.localAI[0]++; - Projectile.localAI[1] = 40f; - SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); - Projectile.netUpdate = true; - } - else if (Projectile.localAI[0] > MaxCharges) - { - if (Projectile.timeLeft > 120) + if (digFXCooldown == 0) { - Projectile.timeLeft = 120; + SoundStyle sound = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(sound with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.3f, 0.7f) }, Projectile.Center); + for (int i = 0; i < 13; i++) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(2f, 24f), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6", true, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.85f, 2.3f), Color.White, new Vector2(1.1f, 0.8f), false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + if (i % 2 == 0) + { + MediumMistParticle RockCloud = new MediumMistParticle(Projectile.Center + Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 7f), Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(1, 12), Color.Peru, Color.Sienna, Main.rand.NextFloat(1.4f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(RockCloud); + } + } + digFXCooldown = 5; } - Projectile.alpha = (int)MathHelper.Lerp(0, 255, 1f - Projectile.timeLeft / 120f); - } - if (Projectile.velocity != IdealVelocity) - { - Projectile.velocity = Vector2.Lerp(Projectile.velocity, IdealVelocity, 0.125f); } + respawnTimer = 0; + respawnMult = 0f; - player.velocity = Projectile.velocity; - // Count down the charge cooldown - if (Projectile.localAI[1] > 0f) - Projectile.localAI[1]--; - Projectile.rotation = Projectile.velocity.ToRotation(); - // Player manipulations (setting the center point and disallowing mounts). - player.Center = Projectile.Center; - // Adjust the player's held projectile type. - if (player.heldProj == -1) - player.heldProj = Projectile.whoAmI; - player.mount?.Dismount(player); - player.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1); - // Generate dust - if (Projectile.ai[0] % DustSpawnInterval == DustSpawnInterval - 1f) + if (time % Projectile.MaxUpdates * 2 == 0 && !drifting) { - for (int i = 0; i < 12; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center + (Projectile.Size / 2f).RotatedBy(Projectile.rotation), (int)CalamityDusts.ProfanedFire); - dust.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(20f * (i % 2 == 0).ToDirectionInt())); - dust.noGravity = true; - dust.fadeIn = 1.8f; - } + SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(sound with { Volume = 0.065f * driftPowerScaling, Pitch = Main.rand.NextFloat(-0.4f, -0.9f) + (driftPower == 3 ? 1.4f : 0), MaxInstances = -1 }, Owner.Center); } } - // Don't die when colliding with tiles unless the spear is lunging (and after a bit of time has passed). - Projectile.tileCollide = Projectile.velocity != Vector2.Zero && Projectile.ai[0] >= WaitTimeRequiredForCharge + 10f; + if (time % Projectile.MaxUpdates == 0 && digFXCooldown > 0) + digFXCooldown--; - // Die immediately if the owner of this projectile is clipping into tiles because of its movement. - if (Collision.SolidCollision(player.position, player.width, player.height) && Projectile.velocity != Vector2.Zero) + Owner.Center = Projectile.Center; + Owner.velocity = Projectile.velocity * Projectile.MaxUpdates; + Owner.dashDelay = 0; + Projectile.timeLeft++; + Owner.RemoveAllGrapplingHooks(); + + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * (driftPowerScaling + 0.5f)); + + Owner.mount?.Dismount(Owner); + Owner.ChangeDir(Math.Sign(drifting ? idealVel.X : Projectile.velocity.X) <= 0 ? -1 : 1); + + if (!killed) { - player.velocity.Y = 0f; - DoDeathDust(Projectile.oldVelocity); + float idealRot = (drifting ? idealVel : Projectile.velocity).ToRotation(); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, idealRot, (boostTimer > 0 ? 1 : 0.15f)); + + Owner.fullRotationOrigin = Owner.Center - Owner.position; + Owner.fullRotation = (Owner.direction == -1 ? MathHelper.ToRadians(180f) : 0) + Projectile.rotation + MathHelper.ToRadians(65f * Owner.direction); + + float rot = (drifting ? idealVel : Projectile.velocity).ToRotation() + (Owner.direction == -1 ? MathHelper.ToRadians(270f) : MathHelper.ToRadians(-90f)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot - Owner.fullRotation); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot - Owner.fullRotation); - Projectile.Kill(); } - Lighting.AddLight(Projectile.Center, Color.LightGoldenrodYellow.ToVector3()); + time++; } - public void DoDeathDust(Vector2 oldVelocity) + public void KillProj() { - if (Main.dedServ) - return; + if (SoundEngine.TryGetActiveSound(digSoundSlot, out var sound)) + sound?.Stop(); - for (int i = 0; i < 60; i++) + if (inTiles && respawnPoint != Vector2.Zero) { - Vector2 spawnOffset = (Projectile.Size / 2f).RotatedBy(Projectile.rotation); - spawnOffset += Utils.NextVector2Circular(Main.rand, 10f, 10f); - Dust dust = Dust.NewDustPerfect(Projectile.Center + spawnOffset, (int)CalamityDusts.ProfanedFire); - dust.velocity = Utils.NextVector2Circular(Main.rand, 5f, 5f) + oldVelocity; - dust.noGravity = true; - dust.fadeIn = 1.9f; + Projectile.Center = respawnPoint; + if (!Owner.dead) + Owner.Center = respawnPoint; } - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + killed = true; + Owner.fullRotationOrigin = Owner.Center - Owner.position; + Owner.fullRotation = 0; + Owner.Calamity().rOfDelivarenceRam = false; + Projectile.netUpdate = true; + Projectile.Kill(); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.15f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(hitCountDamageSource, 0, hitsToMinMult, 1, minMult, true); + float driftMult = (driftPower == 1 ? 0.3f : driftPower == 2 ? 1.6f : 2.5f) * damageMult; // Drift power scaling is lower than regular + + float totalMult = driftMult * ((hitCountDamageSource == 0 && driftPower > 1) ? 1.9f : 1) * (Owner.Calamity().profanedSoulRelicBuff ? 8 : 1); + modifiers.SourceDamage *= totalMult; - public override bool? CanDamage() => Projectile.velocity != Vector2.Zero ? null : false; - + if (Projectile.numHits == 0 && driftPower > 1) + { + for (int i = 0; i < 5; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity, false, 18, 0.05f * driftPower, Color.Lerp(Color.White, Color.Orange, i * 0.2f) * 0.85f, new Vector2(4 + i * 0.55f, 0.4f + i * 0.1f), true, false, 1f); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundStyle sound = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(sound with { Volume = 1, Pitch = Main.rand.NextFloat(0.2f, 0.4f) * damageMult }, Projectile.Center); + } + if (Projectile.soundDelay <= 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderBigHit"); + SoundEngine.PlaySound(sound with { Volume = 1, Pitch = Main.rand.NextFloat(-0.2f, -0.4f) * damageMult }, Projectile.Center); + Projectile.soundDelay = 25; + } + } + public override bool? CanDamage() => (Projectile.velocity == Vector2.Zero || drifting) ? false : null; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30 * driftPowerScaling, 60 * driftPowerScaling, targetHitbox); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Vector2 drawPos = Owner.MountedCenter + (drifting ? idealVel : Projectile.velocity).SafeNormalize(Vector2.UnitX) * (55 - 35 * Utils.GetLerpValue(0, 25, driftTimer, true)); + Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 }, Color.White, 3f * driftPowerScaling, effects: Math.Sign((drifting ? idealVel.X : Projectile.velocity.X)) == -1 ? Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically : Microsoft.Xna.Framework.Graphics.SpriteEffects.None, xPos: drawPos.X, yPos: drawPos.Y); + + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Texture2D texture3 = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + if (inTiles) + { + float randSize = Main.rand.NextFloat(0.9f, 1.1f); + Vector2 vel = Utils.DirectionTo(Projectile.Center, respawnPoint); + for (int i = 0; i < 4; i++) + Main.EntitySpriteDraw(texture2, Projectile.Center - Main.screenPosition + vel * 80 * respawnMult, null, Color.Goldenrod with { A = 0 } * respawnMult, vel.ToRotation() + MathHelper.ToRadians(90f), texture2.Size() * 0.5f, new Vector2(1.2f - i * 0.2f, (1.2f + i * 0.3f) * respawnMult) * (0.7f + i * 0.07f) * 0.05f, SpriteEffects.None, 0); + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, (i == 0 ? Color.White : Color.Goldenrod) with { A = 0 } * respawnMult, vel.ToRotation(), texture.Size() * 0.5f, (0.43f + i * 0.08f) * respawnMult, SpriteEffects.None, 0); + + for (int i = 0; i < 2; i++) + { + Main.EntitySpriteDraw(texture, respawnPoint - Main.screenPosition, null, bColor with { A = 0 } * MathHelper.Clamp(respawnMult + 0.5f, 0.5f, 1), vel.ToRotation(), texture.Size() * 0.5f, 0.15f + respawnMult * 0.5f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture3, respawnPoint - Main.screenPosition, null, bColor with { A = 0 }, i == 0 ? MathHelper.ToRadians(90f) : 0, texture3.Size() * 0.5f, new Vector2(0.8f, 1.5f) * 1.65f * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture3, respawnPoint - Main.screenPosition, null, Color.White with { A = 0 } * 0.65f, i == 0 ? MathHelper.ToRadians(90f) : 0, texture3.Size() * 0.5f, new Vector2(0.8f, 1.5f) * 1.25f * randSize, SpriteEffects.None, 0); + } + } + if (!drifting) + { + Vector2 placement = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * (-20 + 80 * (driftPowerScaling <= 1 ? driftPowerScaling : 1)); + Asset tex = ModContent.Request("CalamityMod/Particles/VerticalSmear"); + Asset tex2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + for (int i = 0; i < 6; i++) + { + Vector2 scale = new Vector2(0.5f - i * 0.1f, (1.5f + i * 0.15f) * driftBadMult) * (0.75f * driftPowerScaling * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f); + Main.EntitySpriteDraw(tex.Value, placement - Main.screenPosition, null, bColor with { A = 0 } * 0.5f * driftBadMult, Projectile.rotation + MathHelper.ToRadians(90f), tex.Size() * 0.5f, scale, SpriteEffects.None); + } + } return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + bool onKill = (target.life <= 0 && target.realLife == -1); + if (!onKill) + hitCountDamageSource++; + else + hitCountDamageSource -= 3; + + if (hitCountDamageSource < 0) + hitCountDamageSource = 0; + } + // Force the spear to have "priority" when drawing so that it draws over the player. public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { overWiresUI.Add(index); } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - DoDeathDust(oldVelocity); - return base.OnTileCollide(oldVelocity); - } } } diff --git a/Projectiles/Typeless/RetaliationProjectile.cs b/Projectiles/Typeless/RetaliationProjectile.cs new file mode 100644 index 0000000000..4e1ff1718d --- /dev/null +++ b/Projectiles/Typeless/RetaliationProjectile.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Metaballs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class RetaliationProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public float radius = 25f; + public int time = 0; + public bool homing = false; + public NPC targeted; + public Color mainColor = Color.White; + public override void SetDefaults() + { + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.DamageType = AverageDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; // They only hit once, this is a visual thing + Projectile.timeLeft = 600; + Projectile.extraUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 25; + + Projectile.scale = 0.08f; // Normally you NEVER put scale in here, but since this doesnt use normal sprite drawing it's fine + } + public override void AI() + { + float fadeOut = Utils.GetLerpValue(0, 50, Projectile.timeLeft, true); + + List eColors = new List() + { + Color.DarkRed, + Color.Crimson, + }; + float rate = (Main.GlobalTimeWrappedHourly * 20); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (time % 2 == 0) // The trail + { + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/SmallBloom", false, 11, 0.11f, mainColor, new Vector2(Utils.Remap(Projectile.velocity.Length(), 0, 5, 1, 0.6f, true), 1f), true, false, 0, false, false, Utils.Remap(Projectile.velocity.Length(), 0, 5, 0, 0.9f, true)); + GeneralParticleHandler.SpawnParticle(spark2); + } + + if (Main.rand.NextBool(14)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.8f, 1.15f)); + dust.noGravity = true; + dust.color = mainColor; + } + + if ((time > 65 || homing) && Projectile.numHits == 0) // Homing before they hit a target + { + homing = true; + if (targeted == null || !targeted.CanBeChasedBy(Projectile, false) || !targeted.active || targeted.life <= 0) + { + targeted = Projectile.Center.ClosestNPCAt(2500); + } + + if (targeted != null) + { + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.18f, 25, 0.98f, accelerate: true); + Projectile.extraUpdates = 3; + Projectile.timeLeft++; + } + } + else // The rotate effect on spawn and on death + { + if (Projectile.numHits > 0) + { + Projectile.scale = fadeOut * 0.08f; + if (Projectile.timeLeft % 40 == 0) + Projectile.ai[1] *= -1; + } + Projectile.velocity = Projectile.velocity.RotatedBy((0.03f + (1 - fadeOut) * 0.05f) * Projectile.ai[1]) * (Projectile.numHits == 0 ? 0.98f : 1); + Projectile.extraUpdates = 2; + } + if (targeted == null && homing && Projectile.numHits == 0 && Projectile.velocity.Length() < 7) + Projectile.velocity *= 1.007f; + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.timeLeft = Main.rand.Next(50, 75 + 1); + + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/PerfHiveHit", 3); + SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = Main.rand.NextFloat(-0.1f, 0.2f), MaxInstances = 15 }, Projectile.Center); + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request("CalamityMod/Particles/BigHeart").Value; + Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 1, 7, 1, 0.5f), Utils.Remap(Projectile.velocity.Length(), 1, 7, 1, 3.2f)); + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8, null, mainColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, squash * Projectile.scale, SpriteEffects.None, 0); + + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => homing && Projectile.numHits == 0 ? CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox) : false; + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Typeless/SandBall.cs b/Projectiles/Typeless/SandBall.cs index b07b7f1ff3..c5f95893e9 100644 --- a/Projectiles/Typeless/SandBall.cs +++ b/Projectiles/Typeless/SandBall.cs @@ -1,4 +1,7 @@ using System; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.SunkenSea; @@ -13,32 +16,32 @@ namespace CalamityMod.Projectiles.Typeless { public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallAstral"; public override bool Fired => false; - public override int TileType => ModContent.TileType(); - public override int ItemType => ModContent.ItemType(); + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); public override int DustType => 108; } public class AstralSandBallGun : SandBall { public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallAstral"; - public override int TileType => ModContent.TileType(); - public override int ItemType => ModContent.ItemType(); + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); public override int DustType => 108; } public class EutrophicSandBallGun : SandBall { public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallEutrophic"; - public override int TileType => ModContent.TileType(); - public override int ItemType => 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 : SandBall { public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallSulphurous"; - public override int TileType => ModContent.TileType(); - public override int ItemType => ModContent.ItemType(); + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); // Uses normal sand dust } diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index 35ff4a2359..f31fb59353 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Typeless public class SandCloakVeil : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - private const float radius = 272f; - private const int duration = 900; + private const float Radius = 360f; + private const int Duration = 900; public override void SetDefaults() { @@ -23,82 +23,86 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = duration; + Projectile.timeLeft = Duration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.scale = 1.2f; + Projectile.scale = 1.5f; } public override void AI() { - Projectile.rotation += 0.01f; + Projectile.rotation += 0.025f; + Player Owner = Main.player[Projectile.owner]; + Player BuffedPlayer = Main.LocalPlayer; - Player player = Main.player[Main.myPlayer]; - Vector2 posDiff = player.Center - Projectile.Center; - if (posDiff.Length() <= radius) + Vector2 posDiff = BuffedPlayer.Center - Projectile.Center; + if (posDiff.Length() <= Radius) { - player.statDefense += 6; - player.lifeRegen += 2; + BuffedPlayer.Calamity().getSandCloakAccelBoost = true; + BuffedPlayer.statDefense += 10; + } + else + BuffedPlayer.Calamity().getSandCloakAccelBoost = false; + // Ensure the acceleration boost is removed if the player is still inside the sand veil when it dies + if (Projectile.timeLeft == 1) + BuffedPlayer.Calamity().getSandCloakAccelBoost = false; + + // Make the sand veil slowly follow its owner + float ownerDist = Vector2.Distance(Projectile.Center, Owner.Center); + if (ownerDist > Radius * 0.2f) + Projectile.Center += Vector2.Normalize(Owner.Center - Projectile.Center) * (ownerDist > Radius * 0.5f ? 2.5f : 1.25f); + + // Kill the sand veil early if the owner dashes + if (Owner.dashDelay == -1 && Projectile.timeLeft < Duration - 45) + { + if (Projectile.timeLeft > 25) + Projectile.timeLeft = 25; + } + + // Dust + Circle dustCircle = new Circle(Projectile.Center, Radius); + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = dustCircle.RandomPointInCircle(); + if ((dustPos - Projectile.Center).Length() > 48) + { + Vector2 dustVel = Projectile.SafeDirectionTo(dustPos).RotatedBy(-MathHelper.PiOver4) * Vector2.Distance(Projectile.Center, dustPos) * 0.04f; + Dust sand = Dust.NewDustPerfect(dustPos, DustID.Sand, dustVel, Scale: 0.5f); + sand.noGravity = true; + sand.fadeIn = 1f; + } } } + // Add Sand Cloak cooldown after the sand veil dies + public override void OnKill(int timeLeft) => Main.player[Projectile.owner].AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(15)); + public override bool PreDraw(ref Color lightColor) { // Sprite Circle - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - float scaleStep = 0.03f; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + float scaleStep = 0.05f; float rotationOffset = 0.03f; - Color drawCol = Projectile.GetAlpha(lightColor); + Color drawCol = Projectile.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f)); float drawTransparency = 0.1f; - if (Projectile.timeLeft > duration - 10) - { - drawTransparency = (duration - Projectile.timeLeft) * 0.01f; - } + if (Projectile.timeLeft > Duration - 10) + drawTransparency = (Duration - Projectile.timeLeft) * 0.01f; else if (Projectile.timeLeft < 25) - { drawTransparency = Projectile.timeLeft * 0.004f; - } - - // Dust effects - Circle dustCircle = new Circle(Projectile.Center, radius); for (int i = 0; i < 20; i++) { // Sprite - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, Projectile.rotation + (rotationOffset * i * i), tex.Size() / 2f, Projectile.scale - (i * scaleStep), SpriteEffects.None, 0); - - // Dust - Vector2 dustPos = dustCircle.RandomPointInCircle(); - if ((dustPos - Projectile.Center).Length() > 48) - { - Dust sand = Dust.NewDustPerfect(dustPos, DustID.Sand); - sand.noGravity = true; - sand.fadeIn = 1f; - sand.velocity = Projectile.SafeDirectionTo(dustPos).RotatedBy(-MathHelper.PiOver4) * Vector2.Distance(Projectile.Center, dustPos) * 0.04f; - } + float rotation = (Projectile.rotation + rotationOffset * i * i) * (i % 2 == 0).ToDirectionInt(); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, rotation, tex.Size() / 2f, (Radius * 0.0044f) - (i * scaleStep), SpriteEffects.None, 0); } - return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // Knockback has to be done manually to ensure the enemies are repelled from the aura as opposed to thrown to one side of it - - if (target.knockBackResist <= 0f) - return; - - // 12AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback - if (CalamityGlobalNPC.ShouldAffectNPC(target)) - { - float knockbackMultiplier = SandCloak.KnockbackStrength * MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); - Vector2 trueKnockback = target.Center - Projectile.Center; - trueKnockback.Normalize(); - target.velocity = trueKnockback * knockbackMultiplier; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + // CIT 14FEB2025: Replaced old manual knockback code with setting HitDirectionOverride + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Projectile.Center.X).ToDirectionInt(); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); + public override bool? CanCutTiles() => false; } } diff --git a/Projectiles/Typeless/SepulcherSoul.cs b/Projectiles/Typeless/SepulcherSoul.cs index 8d42f839a1..1973b199de 100644 --- a/Projectiles/Typeless/SepulcherSoul.cs +++ b/Projectiles/Typeless/SepulcherSoul.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Typeless public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Typeless { if (Projectile.localAI[0] == 0f) { - Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); Projectile.localAI[0] = 1f; } Vector2 idealVelocity = Vector2.Zero; diff --git a/Projectiles/Typeless/SerpentsBiteHook.cs b/Projectiles/Typeless/SerpentsBiteHook.cs index 1737fa6531..7f5b8feb07 100644 --- a/Projectiles/Typeless/SerpentsBiteHook.cs +++ b/Projectiles/Typeless/SerpentsBiteHook.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Fishing.SunkenSeaCatches; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,14 +12,15 @@ namespace CalamityMod.Projectiles.Typeless public class SerpentsBiteHook : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public const float PullSpeed = 12f; - public const float ReelbackSpeed = 14f; - public const float LaunchSpeed = 18f; - public const float GrappleRangInTiles = 28.125f; - public override void SetDefaults() - { - Projectile.CloneDefaults(ProjectileID.GemHookAmethyst); - } + + public static Asset Chain; + public override void Load() => Chain = Request("CalamityMod/Projectiles/Typeless/SerpentsBiteChain"); + + public override void SetDefaults() => Projectile.CloneDefaults(ProjectileID.GemHookAmethyst); + + public override float GrappleRange() => SerpentsBite.Reach * 16f; + public override void GrappleRetreatSpeed(Player player, ref float speed) => speed = SerpentsBite.ReelbackSpeed; + public override void GrapplePullSpeed(Player player, ref float speed) => speed = SerpentsBite.PullSpeed; // Use this hook for hooks that can have multiple hooks mid-flight: Dual Hook, Web Slinger, Fish Hook, Static Hook, Lunar Hook public override bool? CanUseGrapple(Player player) @@ -36,31 +39,9 @@ namespace CalamityMod.Projectiles.Typeless } return true; } + public override void NumGrappleHooks(Player player, ref int numHooks) => numHooks = 2; - // Amethyst Hook is 300, Static Hook is 600, 16f = 1 tile - public override float GrappleRange() => GrappleRangInTiles * 16f; - - public override void NumGrappleHooks(Player player, ref int numHooks) - { - numHooks = 2; - } - - // default is 11, Lunar is 24 - public override void GrappleRetreatSpeed(Player player, ref float speed) - { - speed = ReelbackSpeed; - } - - public override void GrapplePullSpeed(Player player, ref float speed) - { - speed = PullSpeed; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawHook(Projectile, Request("CalamityMod/Projectiles/Typeless/SerpentsBiteChain").Value); - return true; - } + public override bool PreDraw(ref Color lightColor) => Projectile.DrawHook(Chain.Value); public override void AI() { diff --git a/Projectiles/Typeless/ShadeNimbus.cs b/Projectiles/Typeless/ShadeNimbus.cs new file mode 100644 index 0000000000..c09fe95f9f --- /dev/null +++ b/Projectiles/Typeless/ShadeNimbus.cs @@ -0,0 +1,96 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadeNimbus : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Boss/ShadeNimbusHostile"; + + public const float Lifespan = 210f; + public ref float RainTimer => ref Projectile.ai[0]; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 6; + } + + public override void SetDefaults() + { + Projectile.width = 54; + Projectile.height = 24; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Type]) + { + Projectile.frame = 0; + } + } + + if (Projectile.velocity.Length() > 0.5f) + Projectile.velocity *= 0.9765f; + else + Projectile.velocity = Vector2.Zero; + + // Push away horizontally from other shade nimbuses + float pushForce = 0.02f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + float distanceGate = 20f; + if (sameProjType && taxicabDist < distanceGate) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + } + } + + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= Lifespan) + { + Projectile.alpha += 5; + if (Projectile.alpha > 255) + { + Projectile.alpha = 255; + Projectile.Kill(); + } + } + else if (Projectile.ai[1] >= 15f) + { + RainTimer += 1f; + if (RainTimer > 8f) + { + RainTimer = 0f; + if (Projectile.owner == Main.myPlayer) + { + float rainX = Projectile.position.X + Main.rand.NextFloat(14f, Projectile.width - 28f); + float rainY = Projectile.position.Y + Projectile.height + 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), rainX, rainY, 0f, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); + } + } + } + } + + // The cloud doesn't deal damage, just the rain + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/ShadeNimbusRain.cs b/Projectiles/Typeless/ShadeNimbusRain.cs new file mode 100644 index 0000000000..d1e6cfcad6 --- /dev/null +++ b/Projectiles/Typeless/ShadeNimbusRain.cs @@ -0,0 +1,57 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadeNimbusRain : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 180; + Projectile.alpha = 50; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 6; + } + + public override void AI() + { + if (Projectile.Center.Y > Main.player[Projectile.owner].Center.Y) + Projectile.tileCollide = true; + } + + public override void OnKill(int timeLeft) + { + 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; + dust.velocity *= 0.1f; + dust.velocity += -Projectile.oldVelocity * 0.25f; + dust.scale = 0.95f; + } + + public override Color? GetAlpha(Color lightColor) => new Color(100, 255, 100, Projectile.alpha); + + public override void OnHitNPC(NPC target, NPC.HitInfo info, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + if (Projectile.numHits > 0) + { + Projectile.damage = (int)(Projectile.damage * 0.75f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + } + } +} diff --git a/Projectiles/Typeless/ShadeNimbusRain.png b/Projectiles/Typeless/ShadeNimbusRain.png new file mode 100644 index 0000000000..e1ec088008 Binary files /dev/null and b/Projectiles/Typeless/ShadeNimbusRain.png differ diff --git a/Projectiles/Typeless/ShadeNimbusSpawner.cs b/Projectiles/Typeless/ShadeNimbusSpawner.cs new file mode 100644 index 0000000000..2217a60dd5 --- /dev/null +++ b/Projectiles/Typeless/ShadeNimbusSpawner.cs @@ -0,0 +1,60 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadeNimbusSpawner : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/NPCs/HiveMind/DankCreeper"; + + public ref float EffectStrength => ref Projectile.ai[2]; // 1 Rotten Brain, 2 Amal Brain, 3 The Amalgam + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 35; + } + + public override void AI() => Projectile.rotation = Projectile.velocity.X * 0.05f; + + // The spawner should not deal damage + public override bool? CanDamage() => false; + + public override void OnKill(int timeLeft) + { + // Kill sound, dust, and gores of Dank Creeper + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); + + for (int k = 0; k < 20; k++) + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Glass, Projectile.velocity.X > 0f ? 1f : -1f, -1f); + + if (!Main.dedServ) + { + Vector2 goreVelocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y * 0.4f); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore").Type); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore2").Type); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore3").Type); + } + + // Spawn shade rain clouds out to the sides + // Number of clouds and their damage scale based on what accessory in the upgrade path triggered it (damage is set when the spawner is created) + if (Main.myPlayer == Projectile.owner) + { + int cloudAmt = EffectStrength == 3f ? 11 : EffectStrength == 2f ? 7 : 5; + for (int c = -(cloudAmt - 1) / 2; c <= (cloudAmt - 1) / 2; c++) + { + Vector2 cloudVelocity = c == 0 ? Vector2.Zero : Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 72f) * Main.rand.NextFloat(3f, 9.5f); + cloudVelocity *= c < 0f ? -1f : 1f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, cloudVelocity, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); + } + } + } + } +} diff --git a/Projectiles/Typeless/ShadowflameExplosion.cs b/Projectiles/Typeless/ShadowflameExplosion.cs deleted file mode 100644 index e4b62a9966..0000000000 --- a/Projectiles/Typeless/ShadowflameExplosion.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ShadowflameExplosion : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 75; - Projectile.height = 75; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 30; - Projectile.tileCollide = false; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Projectile.ai[1]++; - if (Projectile.ai[1] >= 3f) - { - for (int i = 0; i < 2; i++) - { - Vector2 Dspeed = new Vector2(2.3f, 2.3f).RotatedBy(MathHelper.ToRadians(Projectile.ai[0])); - float Dscale = Main.rand.NextFloat(1f, 1.3f); - Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, Dspeed.X, Dspeed.Y, 0, default, Dscale); - Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, -Dspeed.X, -Dspeed.Y, 0, default, Dscale); - Projectile.ai[0] += 19f; - } - Projectile.ai[1] = 0f; - } - if (Projectile.timeLeft < 25) - { - Projectile.damage = 0; - } - - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.ShadowFlame, 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - } -} diff --git a/Projectiles/Typeless/ShadowflameExplosionBig.cs b/Projectiles/Typeless/ShadowflameExplosionBig.cs deleted file mode 100644 index b9fb142420..0000000000 --- a/Projectiles/Typeless/ShadowflameExplosionBig.cs +++ /dev/null @@ -1,54 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ShadowflameExplosionBig : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 130; - Projectile.height = 130; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 30; - Projectile.tileCollide = false; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Projectile.ai[1]++; - if (Projectile.ai[1] >= 3f) - { - for (int i = 0; i < 3; i++) - { - Vector2 Dspeed = new Vector2(4.3f, 4.3f).RotatedBy(MathHelper.ToRadians(Projectile.ai[0])); - float Dscale = Main.rand.NextFloat(1f, 1.5f); - Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, Dspeed.X, Dspeed.Y, 0, default, Dscale); - Vector2 Ds2 = Dspeed.RotatedBy(MathHelper.ToRadians(120)); - Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, Ds2.X, Ds2.Y, 0, default, Dscale); - Vector2 Ds3 = Dspeed.RotatedBy(MathHelper.ToRadians(240)); - Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, Ds3.X, Ds3.Y, 0, default, Dscale); - Projectile.ai[0] += 19f; - } - Projectile.ai[1] = 0f; - } - if (Projectile.timeLeft < 25) - { - Projectile.damage = 0; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.ShadowFlame, 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - } -} diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index 13d6819e0d..dac01d5b9a 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[skyDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Typeless/SpiritOriginBullseye.cs b/Projectiles/Typeless/SpiritOriginBullseye.cs index 6239f1dfcf..3aafbf1fdc 100644 --- a/Projectiles/Typeless/SpiritOriginBullseye.cs +++ b/Projectiles/Typeless/SpiritOriginBullseye.cs @@ -10,15 +10,26 @@ namespace CalamityMod.Projectiles.Typeless public class SpiritOriginBullseye : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + + public static readonly int FadeinFrames = 8; + public static readonly int FadeoutFrames = 15; + public static readonly float StartingFadeinScale = 1.6f; + public static readonly float FadeinScaleExponent = 0.95f; + public static readonly float FadeinOpacityExponent = 0.7f; + public static readonly float FadeoutFlatScaleBoost = 0.02f; + public static readonly float FadeoutOpacityLoss = 0.06f; + public Player Owner => Main.player[Projectile.owner]; + public NPC Target => Main.npc[(int)Projectile.ai[0]]; - public bool FadingOut - { - get => Projectile.ai[1] == 1f; - set => Projectile.ai[1] = value.ToInt(); - } + + private ref float FadeState => ref Projectile.ai[1]; + private ref float VisualScaleDiff => ref Projectile.localAI[0]; + public Vector2 BullseyeOffsetFromCenter; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { Projectile.width = Projectile.height = (int)(2 * DaawnlightSpiritOrigin.RegularEnemyBullseyeRadius); @@ -27,7 +38,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.hostile = false; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.timeLeft = 300; + Projectile.timeLeft = DaawnlightSpiritOrigin.BullseyeIdleLifetime; Projectile.Opacity = 0f; Projectile.penetrate = -1; } @@ -44,12 +55,42 @@ namespace CalamityMod.Projectiles.Typeless return; } - if (Projectile.timeLeft < 45) - FadingOut = true; + // If the projectile has only just started existing, rapidly increase its opacity and shrink it over the first few frames. + if (Projectile.timeLeft > DaawnlightSpiritOrigin.BullseyeIdleLifetime - FadeinFrames) + { + FadeState = 1f; - Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + (FadingOut ? -0.08f : 0.04f), 0f, 1f); - Projectile.scale = Projectile.Opacity; - if (FadingOut && Projectile.Opacity <= 0f) + // On the very first frame, set its visual scale diff to the starting fade-in scale. + if (VisualScaleDiff == 0f) + VisualScaleDiff = StartingFadeinScale; + VisualScaleDiff *= FadeinScaleExponent; + + float negOpacity = 1f - Projectile.Opacity; + negOpacity *= FadeinOpacityExponent; + Projectile.Opacity = 1f - negOpacity; + } + + // Otherwise, if the projectile is about to vanish, decrease its opacity accordingly and very slightly inflate it. + else if (Projectile.timeLeft < FadeoutFrames) + { + FadeState = 2f; + + if (VisualScaleDiff < 0f) + VisualScaleDiff = 0f; + VisualScaleDiff += FadeoutFlatScaleBoost; + + Projectile.Opacity -= FadeoutOpacityLoss; + } + + // Otherwise keep its opacity at maximum and its scale default at all times. + else + { + FadeState = 0f; + Projectile.Opacity = 1f; + } + + // If the bullseye is fading out and hits zero opacity for some reason, delete it immediately. + if (Projectile.Opacity < 0f && FadeState == 2f) Projectile.Kill(); if (BullseyeOffsetFromCenter == Vector2.Zero) @@ -66,14 +107,9 @@ namespace CalamityMod.Projectiles.Typeless if (Main.myPlayer != Projectile.owner) return false; - float scale = 2f - Projectile.scale; - float rotation = MathHelper.TwoPi * Projectile.scale; Vector2 drawPosition = Target.Center + BullseyeOffsetFromCenter - Main.screenPosition; - if (FadingOut) - { - scale = Projectile.scale; - rotation = 0f; - } + + float scaleToUse = VisualScaleDiff; Texture2D bullseyeTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/SpiritOriginRegularBullseye").Value; Rectangle frame = bullseyeTexture.Frame(); @@ -81,12 +117,11 @@ namespace CalamityMod.Projectiles.Typeless { bullseyeTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/SpiritOriginBossBullseye").Value; frame = bullseyeTexture.Frame(1, 4, 0, (int)(Main.GlobalTimeWrappedHourly * 7f) % 4); - rotation = 0f; drawPosition.Y -= 17; drawPosition.X -= 1; } - Main.EntitySpriteDraw(bullseyeTexture, drawPosition, frame, Color.White * Projectile.Opacity, rotation, frame.Size() * 0.5f, scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bullseyeTexture, drawPosition, frame, Color.White * Projectile.Opacity, Projectile.rotation, frame.Size() * 0.5f, scaleToUse, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Typeless/StarStruckWaterBottle.cs b/Projectiles/Typeless/StarStruckWaterBottle.cs index d87214f258..b201dfc760 100644 --- a/Projectiles/Typeless/StarStruckWaterBottle.cs +++ b/Projectiles/Typeless/StarStruckWaterBottle.cs @@ -49,5 +49,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner, 4f); } } + + public override bool? CanCutTiles() => false; } } diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index ca6585e9d3..6da5082c5c 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Magic/StickyFeather"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; diff --git a/Projectiles/Typeless/SuicideBomberDemon.cs b/Projectiles/Typeless/SuicideBomberDemon.cs index fb665cd92b..06254b320c 100644 --- a/Projectiles/Typeless/SuicideBomberDemon.cs +++ b/Projectiles/Typeless/SuicideBomberDemon.cs @@ -23,9 +23,10 @@ namespace CalamityMod.Projectiles.Typeless public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 12; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 11; + Main.projFrames[Type] = 12; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 11; } public override void SetDefaults() @@ -146,7 +147,7 @@ namespace CalamityMod.Projectiles.Typeless if (Time == 90f) SoundEngine.PlaySound(SoundID.DD2_WyvernDiveDown, Projectile.Center); - Projectile.frame = Main.projFrames[Projectile.type] - 1; + Projectile.frame = Main.projFrames[Type] - 1; // Fly away if no valid target was found. if (target is null) @@ -241,7 +242,7 @@ namespace CalamityMod.Projectiles.Typeless glowmask = ModContent.Request("CalamityMod/Projectiles/Typeless/SuicideBomberDemonGlowmaskFriendly").Value; orbTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/SuicideBomberDemonOrbFriendly").Value; } - Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 drawPosition = Projectile.Center - Main.screenPosition; SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; diff --git a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs index 39500ded01..ae998e00f5 100644 --- a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs +++ b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Typeless private bool fromArmour = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 7; + Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -101,8 +101,8 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[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; @@ -136,16 +136,30 @@ namespace CalamityMod.Projectiles.Typeless Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int inc; - for (int i = 0; i < 25; i = inc + 1) + //For use with Contaminated Bile's Stealth Strike + if (Projectile.Calamity().stealthStrike) { - 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(); - Dust dust = Main.dust[toxicDust]; - dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[toxicDust].alpha = Projectile.alpha; - inc = i; + for (int k = 0; k < 15; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(8, 8).RotatedByRandom(MathHelper.TwoPi) * 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) ? Color.YellowGreen : Color.OliveDrab; + } + } + else + { + for (int i = 0; i < 25; i = inc + 1) + { + 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(); + Dust dust = Main.dust[toxicDust]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[toxicDust].alpha = Projectile.alpha; + inc = i; + } } } } diff --git a/Projectiles/Typeless/TarraEnergy.cs b/Projectiles/Typeless/TarraEnergy.cs index 35c30797b4..47fb6ba6a7 100644 --- a/Projectiles/Typeless/TarraEnergy.cs +++ b/Projectiles/Typeless/TarraEnergy.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 4; @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Typeless { int cap = 2; float capDamageFactor = 0.05f; - int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type] - cap; + int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap; modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f); } diff --git a/Projectiles/Typeless/TatteredFairyDust.cs b/Projectiles/Typeless/TatteredFairyDust.cs new file mode 100644 index 0000000000..9d243ee0e6 --- /dev/null +++ b/Projectiles/Typeless/TatteredFairyDust.cs @@ -0,0 +1,34 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class TatteredFairyDust : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 25; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Generic; + Projectile.penetrate = 3; + Projectile.timeLeft = 150; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, 0.9f, 0.9f, 0.9f); + if (Projectile.timeLeft % 2 == 0) + { + Dust dustEffect = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BatScepter, Main.rand.NextFloat(0.1f), Main.rand.NextFloat(0.1f)); + dustEffect.noGravity = true; + Dust lightedDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.TintableDustLighted, Main.rand.NextFloat(0.1f), Main.rand.NextFloat(0.1f), 0, new Color(190, 3, 252)); + lightedDust.noGravity = true; + } + } + } +} diff --git a/Projectiles/Typeless/TerminusHoldout.cs b/Projectiles/Typeless/TerminusHoldout.cs index 5014080271..71e8385dd0 100644 --- a/Projectiles/Typeless/TerminusHoldout.cs +++ b/Projectiles/Typeless/TerminusHoldout.cs @@ -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 : Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Main.zenithWorld ? ModContent.Request("CalamityMod/Items/SummonItems/Terminus_GFB").Value : Terraria.GameContent.TextureAssets.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 64b1ae6879..26e2976644 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; } public override void SetDefaults() @@ -60,12 +60,6 @@ namespace CalamityMod.Projectiles.Typeless Player player = Main.player[Projectile.owner]; Projectile.Center = player.Center; - if (player is null || player.dead) - { - player.ClearBuff(ModContent.BuffType()); - player.Calamity().tesla = false; - Projectile.Kill(); - } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -94,38 +88,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D sprite = Terraria.GameContent.TextureAssets.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); Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); - float opacity = 1f; - int sparkCount = 0; - int fadeTime = 20; - - if (Projectile.timeLeft < fadeTime) - { - opacity = Projectile.timeLeft * (1f / fadeTime); - sparkCount = fadeTime - Projectile.timeLeft; - } - - for (int i = 0; i < sparkCount * 2; i++) - { - int dustType = 132; - if (Main.rand.NextBool()) - { - dustType = 264; - } - float rangeDiff = 2f; - - Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - dustPos.Normalize(); - dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); - - int dust = Dust.NewDust(Projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); - Main.dust[dust].noGravity = true; - } + float opacity = Main.player[Projectile.owner].Calamity().teslaVisuals ? 1f : 0.25f; Main.EntitySpriteDraw(sprite, Projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, Projectile.rotation, origin, 1f, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Typeless/TransformerAura.cs b/Projectiles/Typeless/TransformerAura.cs new file mode 100644 index 0000000000..ded29e11c5 --- /dev/null +++ b/Projectiles/Typeless/TransformerAura.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class TransformerAura : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color bColor = Color.White; + public int time = 0; + public float rotMult = 0.05f; + public int direction = 1; + public float rot2 = 0; + public float fullSine = 1; + public Vector2 squareRandomPos1; + public Vector2 squareRandomPos2; + public float fullChargeMult = 1; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 10; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + Color.LightSkyBlue, + Color.DodgerBlue + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Projectile.Center = Owner.MountedCenter; + fullChargeMult = MathHelper.Lerp(fullChargeMult, (Owner.ownedProjectileCounts[ModContent.ProjectileType()] >= 30 ? 0 : 1), 0.033f); + + if (moddedOwner.transformerVisual && moddedOwner.transformer) + { + if (moddedOwner.transformerCooldown == 0) + { + Projectile.timeLeft = (int)MathHelper.Clamp(Projectile.timeLeft + 5, 0, 300); + } + else + Projectile.timeLeft = (int)(Projectile.timeLeft * 0.98f); + } + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + // Emit some light + Lighting.AddLight(Projectile.Center, bColor.ToVector3() * 0.9f); + + rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f; + fullSine = (float)Math.Sin(time * 0.15f / MathHelper.Pi); + + if (time % 2 == 0) + { + Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Owner.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.7f); + dust.color = new Color(30, 30, 30); + dust.noLightEmittence = true; + } + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D vTexture = ModContent.Request("CalamityMod/Particles/BloomRingThinLarge").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D b2Texture = ModContent.Request("CalamityMod/Particles/Light").Value; + Color drawColor = bColor; + float deathLerp = (float)Math.Pow(Utils.GetLerpValue(10, 300, Projectile.timeLeft), 2); + + float bScale2 = 0.95f; + Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 } * deathLerp, 0, bTexture.Size() * 0.5f, (bScale2 * rot2 * Projectile.scale * deathLerp) + 2.5f * (fullChargeMult - 1), SpriteEffects.None, 0); + + Main.EntitySpriteDraw(b2Texture, Owner.Center - Main.screenPosition, null, new Color(30, 30, 30) * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 1.2f * rot2, SpriteEffects.None, 0); + Main.EntitySpriteDraw(b2Texture, Owner.Center - Main.screenPosition, null, Color.Black * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 0.8f * rot2, SpriteEffects.None, 0); + + for (int i = 0; i < 2; i++) + { + float subsine = rot2; + float rot = (MathHelper.TwoPi * i / 3f) + Main.GlobalTimeWrappedHourly; + Main.EntitySpriteDraw(vTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.16f * deathLerp * fullChargeMult, SpriteEffects.None, 0); + Main.EntitySpriteDraw(vTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot * 2 + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.157f * deathLerp * fullChargeMult, SpriteEffects.None, 0); + } + return false; + } + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/TransformerBlob.cs b/Projectiles/Typeless/TransformerBlob.cs new file mode 100644 index 0000000000..3184708412 --- /dev/null +++ b/Projectiles/Typeless/TransformerBlob.cs @@ -0,0 +1,294 @@ +using System; +using System.IO; +using CalamityMod.CalPlayer; +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; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Projectiles.Typeless +{ + public class TransformerBlob : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + private float radius = 25f; + public bool visuals => moddedOwner.transformerVisual; + public float visualMult => (!visuals && !powered) ? 0.2f : visuals ? 1 : 0.4f; + public ref float layer => ref Projectile.ai[0]; + public bool canDamage = false; + public float speed = 250; + public float rotationAngle = 0; + public int time = 0; + public int currentLayer = 0; + public float sine = 1; + public float rotSpeed = 1f; + public int savedFrame = 0; + public bool powered => Projectile.localAI[0] == 5; + public int poweredTimerMax = 140; + public int poweredTimer = -1; + public Color cl1 = Color.LightSkyBlue; + public Color cl2 = Color.DodgerBlue; + public float poweredLerp => (float)Math.Pow(Utils.GetLerpValue(poweredTimerMax, 90, poweredTimer, true), 4); + public override void SendExtraAI(BinaryWriter writer) // These MP syncs cause tons of errors so they're disabled until we can fix that + { + //writer.Write(time); + //writer.Write(currentLayer); + //writer.Write(speed); + //writer.Write(rotSpeed); + //writer.Write(rotationAngle); + //writer.Write(Projectile.localAI[0]); + + //writer.WriteFlags(canDamage); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + //time = reader.Read(); + //currentLayer = reader.Read(); + //speed = reader.ReadSingle(); + //rotSpeed = reader.ReadSingle(); + //rotationAngle = reader.ReadSingle(); + //Projectile.localAI[0] = reader.ReadSingle(); + + //reader.ReadFlags(out canDamage); + } + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 16; + ProjectileID.Sets.NoLiquidDistortion[Type] = true; + } + public override void SetDefaults() + { + Projectile.width = 42; + Projectile.height = 56; + Projectile.friendly = true; + Projectile.DamageType = AverageDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60 * Projectile.MaxUpdates; + Projectile.ArmorPenetration = 25; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + + Lighting.AddLight(Projectile.Center, cl1.ToVector3() * 0.5f); + + sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (Projectile.ai[1] % 2 == 0 ? 10 : 6) / MathHelper.Pi) * 0.4f; + if (!powered) + poweredTimerMax = (int)(140 + (MathHelper.Clamp(Utils.Remap(Owner.ownedProjectileCounts[ModContent.ProjectileType()], 1, 30, 7, 6, false), 1, 120)) * Projectile.ai[1]); + if (time == 0) + { + Projectile.netUpdate = true; + rotationAngle = Projectile.ai[2]; + Projectile.frame = 8; + } + if (poweredTimer == -1 && powered) + { + poweredTimer = poweredTimerMax; + savedFrame = Projectile.frame; + } + + if (time >= 40) + { + Projectile.frameCounter++; + if (Projectile.frameCounter > (6) * Projectile.MaxUpdates) + { + if (powered && Projectile.frame == 8) + Projectile.frame = 8; + else + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= 16) + Projectile.frame = 0; + } + else + Projectile.frame = (int)MathHelper.Lerp(savedFrame, 8, poweredLerp); + + layer = (int)(Utils.GetLerpValue(0, 10, Projectile.ai[1]) + 0.9f); + + if (time >= 90) + canDamage = true; + + if (!moddedOwner.transformer || Owner.dead) + { + Projectile.Kill(); + } + + if (layer != currentLayer) + { + currentLayer = (int)layer; + if (time > 60) + time = 60; + } + rotationAngle = MathHelper.Lerp(rotationAngle, Projectile.ai[2], 0.025f); + if (time >= 40) + { + if (poweredTimer == 1) + { + Projectile.netUpdate = true; + if (visuals) + Owner.Calamity().GeneralScreenShakePower = 3.5f; + Projectile.numHits = 0; + Projectile.velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 12; + Projectile.extraUpdates = 8; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + for (int i = 0; i <= 9; i++) + { + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + int dustStyle = 278; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity); + dust2.scale = Main.rand.NextFloat(0.9f, 1.2f) - Math.Abs(variance); + dust2.velocity = (Projectile.velocity * 2).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = cl1; + } + + if (visuals) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/OmicronBeam"); + SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = Main.rand.NextFloat(0.3f, 0.5f) + Projectile.ai[1] * 0.015f, MaxInstances = -1 }, Projectile.Center); + } + } + else if (poweredTimer == 0) + { + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 20f; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (targetDist < 1400) + { + if (visuals) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity, -Projectile.velocity * 0.3f, false, 21, 0.04f, cl1 * 0.65f, new Vector2(0.6f, 0.5f), true, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time % 2 == 0) + { + Vector2 dustVel = (-Projectile.velocity).RotatedByRandom(0.3f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.6f); + dust.color = new Color(30, 30, 30); + dust.noLightEmittence = true; + } + } + + Projectile.rotation = (Projectile.velocity.RotatedBy(MathHelper.ToRadians(-90))).ToRotation(); + } + else + { + Vector2 centerPoint = (powered ? Vector2.Lerp(Owner.Center, Vector2.Lerp(Owner.Calamity().mouseWorld, Owner.Center, 0.6f), poweredLerp) : Owner.Center); + float layerDist = (Utils.Remap(Owner.ownedProjectileCounts[ModContent.ProjectileType()], 1, 20, 60, 55, false) * layer); + float fadeValue = MathHelper.Clamp(Utils.Remap(Projectile.ai[1], 1, 10, 0.3f, 0.1f, false), 0.3f, 0); + float positioning = (-60 - layerDist + 30 * sine) * MathHelper.Clamp((powered ? (1 - poweredLerp) : 1), fadeValue, 1); + Projectile.velocity = ((centerPoint + new Vector2(0, positioning).RotatedBy(rotationAngle * -rotSpeed + Main.GlobalTimeWrappedHourly * 2.5f * (1 - layer * (powered ? 0.33f : 0.15f)) * (layer % 2 == 0 ? -1 : 1))) - Projectile.Center) / (speed); + Projectile.rotation = Projectile.rotation.AngleLerp(sine, 0.02f); + } + if (powered && poweredTimer != 0) + { + rotSpeed *= Utils.Remap(Projectile.ai[1], 1, 10, 1.0067f, 1.0058f, false); + + Projectile.rotation = Projectile.rotation.AngleLerp(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).RotatedBy(MathHelper.ToRadians(-90)).ToRotation(), poweredLerp); + } + } + else + { + Projectile.velocity *= 0.965f; + Projectile.rotation = (Projectile.velocity.RotatedBy(MathHelper.ToRadians(-90))).ToRotation(); + } + speed = MathHelper.Lerp(speed, 1, (float)Math.Pow(Utils.GetLerpValue(0, 180, time), 2)); + + if (poweredTimer != 0) + Projectile.timeLeft++; + if (poweredTimer > 0) + poweredTimer--; + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (target.life <= 0 && target.realLife == -1) + Projectile.numHits--; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (poweredTimer == 0) + { + float minMult = 0.05f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true) * (Projectile.numHits == 0 ? 1.5f : 1); // +50% damage on first hit, if it kills an enemy it keeps the bonus + modifiers.SourceDamage *= (damageMult + (Main.zenithWorld ? 0.2f * Projectile.ai[1] : 0)); + } + else + modifiers.SourceDamage *= 0.2f; + + target.MoveNPC(Utils.DirectionTo(Owner.Center, target.Center), (poweredTimer == 0 ? 7 : 3)); + + if (Projectile.numHits == 0 && poweredTimer == 0) + { + for (int i = 0; i <= 6; i++) + { + float variance = Main.rand.NextFloat(-0.4f, 0.4f); + Vector2 fxVel = (Projectile.velocity * 3).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)); + Particle spark2 = new SparkParticle(Projectile.Center + fxVel, fxVel, false, 45, Main.rand.NextFloat(0.8f, 1f) - Math.Abs(variance), Main.rand.NextBool(4) ? cl2 : cl1); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 14; i++) + { + Vector2 dustVel = (Vector2.One * 5).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.1f); + dust.color = new Color(30, 30, 30); + dust.noLightEmittence = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D orbTexture = ModContent.Request("CalamityMod/Items/Accessories/TheTransformer").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Rectangle frame = orbTexture.Frame(1, 16, 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + if (powered) + { + Color auraColor = cl1 with { A = 0 } * poweredLerp * visualMult; + for (int i = 0; i < 2; i++) + { + float bScale2 = 0.25f; + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, cl2 with { A = 0 } * Utils.GetLerpValue(poweredTimerMax, 180, poweredTimer, true) * visualMult, Projectile.rotation, bTexture.Size() * 0.5f, Vector2.Lerp(new Vector2(0.6f, 1.4f), Vector2.One, MathHelper.Min(Utils.GetLerpValue(8, 15, Projectile.frame, true), Utils.GetLerpValue(8, 0, Projectile.frame, true))) * bScale2 * Projectile.scale, SpriteEffects.None, 0); + } + } + Main.EntitySpriteDraw(orbTexture, Projectile.Center - Main.screenPosition, frame, Color.White * visualMult, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + + for (int i = 0; i < 10; i++) + { + Color auraColor = cl1 with { A = 0 } * (powered ? (float)Math.Pow(Utils.GetLerpValue(poweredTimerMax, 20, poweredTimer, true), 3) : sine) * 0.6f * visualMult; + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 4; + Main.EntitySpriteDraw(orbTexture, Projectile.Center - Main.screenPosition + drawOffset, frame, auraColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); + } + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + public override bool? CanDamage() => canDamage ? null : false; + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Typeless/UrsaSlash.cs b/Projectiles/Typeless/UrsaSlash.cs index 37b13b72f8..ac9e2c1012 100644 --- a/Projectiles/Typeless/UrsaSlash.cs +++ b/Projectiles/Typeless/UrsaSlash.cs @@ -87,9 +87,9 @@ namespace CalamityMod.Projectiles.Typeless if (visible) { SoundStyle sound = new("CalamityMod/Sounds/Item/AstralSlash", 3); - SoundEngine.PlaySound(sound with { Volume = 0.65f }, Projectile.Center); + SoundEngine.PlaySound(sound with { Volume = 0.45f }, Projectile.Center); SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); - SoundEngine.PlaySound(sound2 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, Projectile.Center); + SoundEngine.PlaySound(sound2 with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, Projectile.Center); } } visuals = false; diff --git a/Projectiles/Typeless/VoidofExtinctionCrit.cs b/Projectiles/Typeless/VoidofExtinctionCrit.cs new file mode 100644 index 0000000000..2a2eb12280 --- /dev/null +++ b/Projectiles/Typeless/VoidofExtinctionCrit.cs @@ -0,0 +1,55 @@ +using System; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class VoidofExtinctionCrit : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float ExplosionRadius = 300f; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 300; + Projectile.height = 300; + Projectile.friendly = true; + Projectile.DamageType = AverageDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player player = Main.player[Projectile.owner]; + for (int i = 0; i <= 30; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 218 : ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(MathHelper.ToRadians(360)) * Main.rand.NextFloat(1.1f, 2.2f), 0, default, Main.rand.NextFloat(2.8f, 3.4f)); + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cFace, player); + dust.noGravity = true; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 360); + SoundEngine.PlaySound(SoundID.Item89 with { Volume = 0.5f, PitchVariance = 0.4f }, Projectile.Center); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + public override bool? CanDamage() => base.CanDamage(); + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Typeless/WarbannerDamage.cs b/Projectiles/Typeless/WarbannerDamage.cs new file mode 100644 index 0000000000..a43011216e --- /dev/null +++ b/Projectiles/Typeless/WarbannerDamage.cs @@ -0,0 +1,20 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + // 13NOV2024: Ozzatron: Literally just a DirectStrike that inflicts holy flames. + // Because it's a separate projectile, it has its own name in the localization files. + public class WarbannerDamage : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 30); + } + + } +} diff --git a/Projectiles/Typeless/WarbannerLight.cs b/Projectiles/Typeless/WarbannerLight.cs new file mode 100644 index 0000000000..dfdcde65c0 --- /dev/null +++ b/Projectiles/Typeless/WarbannerLight.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +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 WarbannerLight : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color bColor = Color.White; + public int time = 0; + public float rotMult = 0.05f; + public int direction = 1; + public float rot2 = 0; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + Color.Goldenrod, + Color.Orange + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Projectile.Center = Owner.MountedCenter; + + if (moddedOwner.warbannerGlow && moddedOwner.WarbanneroftheRighteous) + Projectile.timeLeft++; + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + // Emit some light + Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f); + + rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f; + + if (time % 2 == 0) + { + Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Owner.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.7f); + dust.color = bColor; + dust.noLightEmittence = true; + } + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D rTexture = ModContent.Request("CalamityMod/Particles/ShatteredExplosion").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color drawColor = bColor; + + for (int i = 0; i < 5; i++) + { + float bScale2 = 0.75f; + Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * Projectile.scale, SpriteEffects.None, 0); + } + + Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.03f * rot2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.04f * rot2 * Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/WhiteLabSeeker.cs b/Projectiles/Typeless/WhiteLabSeeker.cs index 374eae49c3..e524e7f0e8 100644 --- a/Projectiles/Typeless/WhiteLabSeeker.cs +++ b/Projectiles/Typeless/WhiteLabSeeker.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs index 46beb0c945..616ca734da 100644 --- a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs +++ b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Typeless GeneralParticleHandler.SpawnParticle(smoke); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Typeless/WulfrumDrillProj.cs b/Projectiles/Typeless/WulfrumDrillProj.cs index 05eb75eab1..0bc98e5c28 100644 --- a/Projectiles/Typeless/WulfrumDrillProj.cs +++ b/Projectiles/Typeless/WulfrumDrillProj.cs @@ -58,7 +58,9 @@ namespace CalamityMod.Projectiles.Typeless Projectile.soundDelay = 30; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.One); + //Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); Owner.heldProj = Projectile.whoAmI; Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); @@ -87,7 +89,7 @@ namespace CalamityMod.Projectiles.Typeless if (!Projectile.active) return false; - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.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); SpriteEffects effect = SpriteEffects.None; diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs index 259e955588..687ac2c0ca 100644 --- a/Projectiles/Typeless/WulfrumHook.cs +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { //Expand the draw distance. Should never happen really , but just in case the player basically walks away from the hook. - ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 3000; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 3000; } public override void SetDefaults() diff --git a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs index 610fbe8bad..a4d86d4de0 100644 --- a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs +++ b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs @@ -83,6 +83,8 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { + // 15NOV2024: Ozzatron: Intentionally not clamping Wulfrum Scaffolds despite combat applicability due to them being mechanically closer to a UI feature. + if (Owner.channel && CanOwnerGoOn) { //Initialize the position @@ -115,7 +117,7 @@ namespace CalamityMod.Projectiles.Typeless Owner.ConsumeItem(ModContent.ItemType()); Kit.storedScrap = WulfrumScaffoldKit.TilesPerScrap - 1; SoundEngine.PlaySound(SoundID.Item65); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore shard = Gore.NewGoreDirect(Projectile.GetSource_FromThis(), Owner.Center, Main.rand.NextVector2Circular(4f, 4f), Mod.Find("WulfrumPinger2").Type, Main.rand.NextFloat(0.5f, 1f)); shard.timeLeft = 10; @@ -140,7 +142,7 @@ namespace CalamityMod.Projectiles.Typeless if (Main.myPlayer != Owner.whoAmI) return false; - Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Effect tileEffect = Filters.Scene["CalamityMod:WulfrumScaffoldSelection"].GetShader().Shader; diff --git a/Projectiles/Typeless/XykDeathAnim.cs b/Projectiles/Typeless/XykDeathAnim.cs new file mode 100644 index 0000000000..96b2bb29b9 --- /dev/null +++ b/Projectiles/Typeless/XykDeathAnim.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Graphics.Metaballs; +using CalamityMod.Particles; +using CalamityMod.World; +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 XykDeathAnim : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public ref float time => ref Projectile.ai[0]; + public int endTime = 25; + public override string Texture => "CalamityMod/Items/LabFinders/RedSeekingMechanism"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 32; + Projectile.scale = 0.55f; // Normally we don't put scale here, but it doesn't matter this time + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + bool Orange = Owner.Calamity().XykVisualsOrange; + Color effectColor = Orange ? Color.Gold : Color.DodgerBlue; + + float rate = Main.GlobalTimeWrappedHourly * 22; + List eColors = new List() + { + Orange ? Color.OrangeRed : Color.DodgerBlue, + Orange ? Color.Gold : Color.Cyan, + Orange ? Color.Orange : Color.RoyalBlue + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + effectColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (time == 0) + { + SoundStyle die = new("CalamityMod/Sounds/Item/XykDie"); + SoundEngine.PlaySound(die with { Volume = 1f }, Projectile.Center); + } + if (time < endTime) + { + float fade = Utils.GetLerpValue(35, 0, time, true); + float numberOfDusts = 3f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f); + velOffset *= Main.rand.NextFloat(15, 30) * fade; + Particle energy = new SparkParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, 14, Main.rand.NextFloat(1.1f, 1.25f) - 0.2f * fade, effectColor); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, 278, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = effectColor; + } + } + if (time >= endTime) + { + Projectile.scale *= 1.15f; + for (int i = 0; i < 3; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f * (i + 1) * Projectile.scale, 1f * Projectile.scale, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f * (i + 1) * Projectile.scale, 0.5f * Projectile.scale, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + for (int i = 0; i < 6; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center, new Vector2(Orange ? 0 : 1, Orange ? 1 : 0) * -5 * (i % 2 == 0 ? -1 : 1), false, 15, (0.08f - i * 0.01f) * Projectile.scale, effectColor, new Vector2(5, 0.8f), true, false, 1.2f); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (time == endTime) + { + if (Orange) + { + Particle spark1 = new CustomPulse(Projectile.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0, 2.2f, 22); + GeneralParticleHandler.SpawnParticle(spark1); + + Particle spark2 = new CustomPulse(Projectile.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0, 1.2f, 47); + GeneralParticleHandler.SpawnParticle(spark2); + } + else + { + Particle spark1 = new CustomPulse(Projectile.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, MathHelper.PiOver4, 0, 0.3f, 22); + GeneralParticleHandler.SpawnParticle(spark1); + } + for (int i = 0; i < 30; i++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Orange ? 267 : 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(2.5f, 15)); + dust2.scale = Main.rand.NextFloat(0.85f, 1.15f) * (Orange ? 1 : 1.2f); + dust2.noGravity = Orange ? true : false; + dust2.color = Color.Lerp(Color.White, effectColor, 0.5f); + + if (Orange) + { + Particle squarker = new CustomPulse(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20), effectColor, "CalamityMod/Particles/GlowSquareParticle", Vector2.One, MathHelper.PiOver4, Main.rand.NextFloat(1.3f, 3.8f), 0.2f, 38); + GeneralParticleHandler.SpawnParticle(squarker); + } + else + { + Particle sparker = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20), "CalamityMod/Particles/Sparkle", false, 38, Main.rand.NextFloat(2.2f, 4.8f), effectColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true, 0, false, false, 0.1f); + GeneralParticleHandler.SpawnParticle(sparker); + } + } + } + } + time++; + } + + public override bool? CanCutTiles() => false; + public override bool? CanDamage() => Projectile.damage > 0 ? null : false; + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs index 87e3fa20ed..8d9ccaaf70 100644 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Type] = 5; } public override void SetDefaults() @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.frameCounter % 7 == 0) { Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Type]) Projectile.Kill(); } @@ -79,6 +79,8 @@ namespace CalamityMod.Projectiles.Typeless { speed = player.ActiveItem().shootSpeed * Projectile.scale; } + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; // Sync if a velocity component changes. @@ -90,7 +92,7 @@ namespace CalamityMod.Projectiles.Typeless } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), YanmeisKnife.DebuffDuration); if (!Main.dedServ) { for (int i = 0; i < 60; i++) @@ -108,7 +110,7 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(YanmeisKnife.HitSound, Projectile.position); Projectile.ai[0] = 1f; } - Main.player[Projectile.owner].AddBuff(ModContent.BuffType(), 600); + Main.player[Projectile.owner].AddBuff(ModContent.BuffType(), YanmeisKnife.BoostDuration); } public override Color? GetAlpha(Color lightColor) => new Color(0, 215, 0, 0); } diff --git a/Projectiles/Typeless/YellowLabSeeker.cs b/Projectiles/Typeless/YellowLabSeeker.cs index e81976b4dd..b2668fff1a 100644 --- a/Projectiles/Typeless/YellowLabSeeker.cs +++ b/Projectiles/Typeless/YellowLabSeeker.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 1; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.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 fa30a51116..dcc0ff7262 100644 --- a/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs +++ b/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs @@ -52,7 +52,6 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides if (Main.myPlayer == projectile.owner) { int pulseDamage = (int)owner.GetBestClassDamage().ApplyTo(ChlorophyteArmorSetChange.BaseDamageToEnemies); - pulseDamage = owner.ApplyArmorAccDamageBonusesTo(pulseDamage); Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ModContent.ProjectileType(), pulseDamage, 0f, projectile.owner); } @@ -61,7 +60,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides return false; } - public static bool DoChlorophyteCrystalDrawing(Projectile projectile) + public static void DoChlorophyteCrystalDrawing(Projectile projectile) { // Why doesn't this work? How does one access the texture path of a vanilla projectile? Left bugged for someone else to figure out :) // It's me. I was that someone - Dominic @@ -81,7 +80,6 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides } Main.EntitySpriteDraw(texture, drawPosition, null, projectile.GetAlpha(Color.White * 0.75f), projectile.rotation, origin, projectile.scale, 0, 0); - return false; } } } diff --git a/Projectiles/VanillaProjectileOverrides/HornetMinionAI.cs b/Projectiles/VanillaProjectileOverrides/HornetMinionAI.cs index 6b5890f62a..4be45b16d0 100644 --- a/Projectiles/VanillaProjectileOverrides/HornetMinionAI.cs +++ b/Projectiles/VanillaProjectileOverrides/HornetMinionAI.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides { Vector2 toTargetDirection = CalamityUtils.CalculatePredictiveAimToTarget(proj.Center, Target, ProjectileVelocity); - Projectile.NewProjectileDirect(proj.GetSource_FromThis(), + Projectile.NewProjectile(proj.GetSource_FromThis(), proj.Center, toTargetDirection, ModContent.ProjectileType(), @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides } shootTimer = 0f; - SyncVariables(proj); + proj.ForceNetUpdate(false); } } @@ -113,24 +113,16 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides if (!proj.WithinRange(owner.Center, 160f)) { proj.velocity = (proj.velocity + proj.SafeDirectionTo(owner.Center)) * 0.9f; - SyncVariables(proj); + proj.ForceNetUpdate(false); } // The minion will teleport on the owner if they get far enough. if (!proj.WithinRange(owner.Center, MaxEnemyDistanceDetection)) { proj.Center = owner.Center; - SyncVariables(proj); + proj.ForceNetUpdate(false); } } - - private static void SyncVariables(Projectile proj) - { - proj.netUpdate = true; - if (proj.netSpam >= 10) - proj.netSpam = 9; - } - #endregion } } diff --git a/Projectiles/VanillaProjectileOverrides/ImpMinionAI.cs b/Projectiles/VanillaProjectileOverrides/ImpMinionAI.cs index e2669c6555..b79ed81667 100644 --- a/Projectiles/VanillaProjectileOverrides/ImpMinionAI.cs +++ b/Projectiles/VanillaProjectileOverrides/ImpMinionAI.cs @@ -141,13 +141,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides } } - private static void SyncVariables(Projectile proj) - { - proj.netUpdate = true; - if (proj.netSpam >= 10) - proj.netSpam = 9; - } - + private static void SyncVariables(Projectile proj) => proj.ForceNetUpdate(false); #endregion } } diff --git a/Projectiles/VanillaProjectileOverrides/RavenMinionAI.cs b/Projectiles/VanillaProjectileOverrides/RavenMinionAI.cs index 8aa29d19d9..5e43429685 100644 --- a/Projectiles/VanillaProjectileOverrides/RavenMinionAI.cs +++ b/Projectiles/VanillaProjectileOverrides/RavenMinionAI.cs @@ -31,8 +31,10 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides Player owner = Main.player[proj.owner]; Target = owner.Center.MinionHoming(EnemyDistanceDetection, owner); + var hasTarget = Target is not null; + CheckMinionExistence(proj, owner); - DoAnimation(proj); + DoAnimation(proj, charging: hasTarget); proj.localNPCHitCooldown = 10; proj.friendly = true; @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides proj.rotation = MathHelper.ToRadians(proj.velocity.X); proj.MinionAntiClump(0.5f); - if (Target is not null) + if (hasTarget) { Vector2 dashDirection = proj.SafeDirectionTo(Target.Center); @@ -96,7 +98,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides return false; } - public static bool DoRavenMinionDrawing(Projectile proj, ref Color lightColor) + public static void DoRavenMinionDrawing(Projectile proj, ref Color lightColor) { Texture2D texture = TextureAssets.Projectile[proj.type].Value; Vector2 drawPosition = proj.Center - Main.screenPosition; @@ -111,8 +113,6 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides CalamityUtils.DrawAfterimagesCentered(proj, 0, Color.MediumPurple with { A = 50 }); Main.EntitySpriteDraw(texture, drawPosition, frame, proj.GetAlpha(lightColor), proj.rotation, origin, proj.scale, effects); - - return false; } #region AI Methods @@ -129,23 +129,21 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides proj.timeLeft = 2; } - private static void DoAnimation(Projectile proj) + private static void DoAnimation(Projectile proj, bool charging) { proj.frameCounter++; if (proj.frameCounter >= 5) { - proj.frame = (proj.frame + 1) % Main.projFrames[proj.type]; + var maxFrames = Main.projFrames[proj.type] / 2; + proj.frame = (proj.frame + 1) % maxFrames; + + if (charging) proj.frame += maxFrames; + proj.frameCounter = 0; } } - private static void SyncVariables(Projectile proj) - { - proj.netUpdate = true; - if (proj.netSpam >= 10) - proj.netSpam = 9; - } - + private static void SyncVariables(Projectile proj) => proj.ForceNetUpdate(false); #endregion } } diff --git a/Scenes/MiscScenes/BossRushScene.cs b/Scenes/MiscScenes/BossRushScene.cs index 15dd9727b2..e9f9a021b3 100644 --- a/Scenes/MiscScenes/BossRushScene.cs +++ b/Scenes/MiscScenes/BossRushScene.cs @@ -39,7 +39,13 @@ namespace CalamityMod.Systems SkyManager.Instance.Update(new GameTime()); } - player.ManageSpecialBiomeVisuals("CalamityMod:BossRush", isActive); + if (SkyManager.Instance["CalamityMod:BossRush"] != null && isActive != SkyManager.Instance["CalamityMod:BossRush"].IsActive()) + { + if (isActive) + SkyManager.Instance.Activate("CalamityMod:BossRush"); + else + SkyManager.Instance.Deactivate("CalamityMod:BossRush"); + } } public override float GetWeight(Player player) => 1f; diff --git a/Scenes/MusicScenes/BaseMusicSceneEffect.cs b/Scenes/MusicScenes/BaseMusicSceneEffect.cs index 03a575e50f..51b18cffce 100644 --- a/Scenes/MusicScenes/BaseMusicSceneEffect.cs +++ b/Scenes/MusicScenes/BaseMusicSceneEffect.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Systems #region Overridable Properties public abstract int NPCType { get; } + public virtual int? ProjType => null; public abstract int? MusicModMusic { get; } public abstract int VanillaMusic { get; } public abstract int OtherworldMusic { get; } @@ -97,6 +98,22 @@ namespace CalamityMod.Systems if (screenRect.Intersects(npcBox)) return true; } + + if (ProjType is null) + return false; + foreach (Projectile proj in Main.ActiveProjectiles) + { + bool isActive = false; + if (proj.type == ProjType) + isActive = true; + + if (!isActive) + continue; + + Rectangle projBox = new Rectangle((int)proj.Center.X - MusicDistance, (int)proj.Center.Y - MusicDistance, musicDistance, musicDistance); + if (screenRect.Intersects(projBox)) + return true; + } return false; } diff --git a/Scenes/MusicScenes/PolterghastSilentMusicScene.cs b/Scenes/MusicScenes/PolterghastSilentMusicScene.cs index b769806cc2..b5d8408044 100644 --- a/Scenes/MusicScenes/PolterghastSilentMusicScene.cs +++ b/Scenes/MusicScenes/PolterghastSilentMusicScene.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs.Polterghast; +using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +16,7 @@ namespace CalamityMod.Systems public override int? MusicModMusic => SilentMusicSlot; public override int VanillaMusic => SilentMusicSlot; public override int OtherworldMusic => SilentMusicSlot; + public override int? ProjType => ModContent.ProjectileType(); public override bool AdditionalCheck() => Main.zenithWorld; } diff --git a/Scenes/MusicScenes/ProvidenceMusicScene.cs b/Scenes/MusicScenes/ProvidenceMusicScene.cs index 4965e5b757..7cc9fdd909 100644 --- a/Scenes/MusicScenes/ProvidenceMusicScene.cs +++ b/Scenes/MusicScenes/ProvidenceMusicScene.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs.Providence; +using CalamityMod.Projectiles.Boss; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,8 +11,33 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Providence"); + public override int? MusicModMusic + { + get + { + for (int i = 0; i < Main.projectile.Length; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.type == ModContent.ProjectileType() && proj.timeLeft > 35) + { + return MusicLoader.GetMusicSlot(Mod, "Sounds/Music/Silence"); + } + } + return CalamityMod.Instance.GetMusicFromMusicMod("Providence"); + } + } public override int VanillaMusic => MusicID.LunarBoss; public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; + public override void SpecialVisuals(Player player, bool isActive) + { + for (int i = 0; i < Main.projectile.Length; i++) + { + Projectile proj = Main.projectile[i]; + if (isActive && proj.type == ModContent.ProjectileType() && proj.timeLeft <= 35) + { + Main.musicFade[Main.curMusic] = 1f; + } + } + } } } diff --git a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs b/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs index 77398c4c76..e5597c0d2e 100644 --- a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs +++ b/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs @@ -9,6 +9,6 @@ namespace CalamityMod.Systems { 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; + public override bool IsSceneEffectActive(Player player) => CalamityWorld.death && NPC.AnyNPCs(NPCID.SkeletronPrime) && Main.npc[NPC.FindFirstNPC(NPCID.SkeletronPrime)].Distance(player.Center) <= 525f * 16f; } } diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index 44eb788302..64ef097fca 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -7,11 +7,11 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Schematics { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class SchematicManager + public sealed class SchematicManager : ModSystem { internal const string RustedWorkshopKey = "Rusted Workshop"; internal const string RustedWorkshopFilename = "Schematics/RustedWorkshop.csch"; @@ -61,6 +61,11 @@ namespace CalamityMod.Schematics internal const string SurfaceShrineKey = "Surface Shrine"; internal const string SurfaceShrineFilename = "Schematics/Shrine_Surface.csch"; + internal const string RoxcaliburShrineKey1 = "Roxcalibur Shrine 1"; + internal const string RoxcaliburShrine1Filename = "Schematics/Shrine_Roxcalibur_ShrineVariant.csch"; + internal const string RoxcaliburShrineKey2 = "Roxcalibur Shrine 2"; + internal const string RoxcaliburShrine2Filename = "Schematics/Shrine_Roxcalibur_TorchVariant.csch"; + internal const string VernalKey = "Vernal Pass"; internal const string VernalFilename = "Schematics/VernalPass.csch"; @@ -96,7 +101,7 @@ namespace CalamityMod.Schematics public delegate void PilePlacementFunction(int x, int y, Rectangle placeInArea); #region Load/Unload - internal static void Load() + public override void OnModLoad() { PilePlacementMaps = new Dictionary(); TileMaps = new Dictionary @@ -120,6 +125,8 @@ namespace CalamityMod.Schematics [MarbleShrineKey] = CalamitySchematicIO.LoadSchematic(MarbleShrineFilename), [MushroomShrineKey] = CalamitySchematicIO.LoadSchematic(MushroomShrineFilename), [SurfaceShrineKey] = CalamitySchematicIO.LoadSchematic(SurfaceShrineFilename), + [RoxcaliburShrineKey1] = CalamitySchematicIO.LoadSchematic(RoxcaliburShrine1Filename), + [RoxcaliburShrineKey2] = CalamitySchematicIO.LoadSchematic(RoxcaliburShrine2Filename), [VernalKey] = CalamitySchematicIO.LoadSchematic(VernalFilename), @@ -152,7 +159,8 @@ namespace CalamityMod.Schematics ["Sulphurous Scrap 7"] = CalamitySchematicIO.LoadSchematic("Schematics/SulphurousScrap7.csch").ShaveOffEdge(), }; } - internal static void Unload() + + public override void Unload() { TileMaps = null; PilePlacementMaps = null; @@ -171,10 +179,10 @@ namespace CalamityMod.Schematics #endregion Get Schematic Area #region Place Schematic - public static void PlaceSchematic(string name, Point pos, SchematicAnchor anchorType, ref bool specialCondition, T chestDelegate = null) where T : Delegate + public static void PlaceSchematic(string name, Point pos, SchematicAnchor anchorType, ref bool specialCondition, T chestDelegate = null, bool flipHorizontal = false) where T : Delegate { // If no schematic exists with this name, cancel with a helpful log message. - if (!TileMaps.ContainsKey(name)) + if (!TileMaps.TryGetValue(name, out SchematicMetaTile[,] schematic)) { CalamityMod.Instance.Logger.Warn($"Tried to place a schematic with name \"{name}\". No matching schematic file found."); return; @@ -190,7 +198,6 @@ namespace CalamityMod.Schematics PilePlacementMaps.TryGetValue(name, out PilePlacementFunction pilePlacementFunction); // Grab the schematic itself from the dictionary of loaded schematics. - SchematicMetaTile[,] schematic = TileMaps[name]; int width = schematic.GetLength(0); int height = schematic.GetLength(1); @@ -273,10 +280,214 @@ namespace CalamityMod.Schematics for (int x = 0; x < width; ++x) for (int y = 0; y < height; ++y) { - SchematicMetaTile smt = schematic[x, y]; + //Uses the tile opposite where its placing when the schematic is flipped horizontally + SchematicMetaTile smt = schematic[flipHorizontal ? width - 1 - x : x, y]; smt.ApplyTo(x + cornerX, y + cornerY, originalTiles[x, y]); Tile worldTile = Main.tile[x + cornerX, y + cornerY]; + //Handle any additional fixes that need to be made as a result of this structure being flipped horizontally + if (flipHorizontal && !smt.keepTile) + { + //Turns Left Slopes into Right Slopes and vice versa. + if (worldTile.Slope != SlopeType.Solid) + worldTile.Slope += (int)worldTile.Slope % 2 == 0 ? -1 : 1; + + //Correct Multi-Tile TileFrames + int style = 0, alt = 0; + TileObjectData.GetTileInfo(worldTile, ref style, ref alt); + TileObjectData data = TileObjectData.GetTileData(worldTile.TileType, style, alt); + if (data != null && !TileID.Sets.Platforms[worldTile.TileType]) + { + int sheetSquare = 16 + data.CoordinatePadding; + + if (data.Width > 1) + { + int frameNum = worldTile.TileFrameX / sheetSquare % data.Width; + //This equation gets us the amount we need to move TileFrameX to correct any issues MultiTiles that occurred during the flip process + worldTile.TileFrameX += (short)((-frameNum + (data.Width - (frameNum + 1))) * (16 + data.CoordinatePadding)); + } + + //Flips Tiles that place directionally (Chairs, Beds, ect.) + if (data.Direction != Terraria.Enums.TileObjectDirection.None)// && !ValidTileEntityTypes.Contains(worldTile.TileType)) + { + int range = 1; + if (data.RandomStyleRange > range) + range = data.RandomStyleRange; + if (worldTile.TileFrameX / sheetSquare % (data.Width * data.StyleMultiplier * range) < data.Width) + worldTile.TileFrameX += (short)(sheetSquare * data.Width); + else + worldTile.TileFrameX -= (short)(sheetSquare * data.Width); + } + } + //Fix Platform TileFrames + else if (TileID.Sets.Platforms[worldTile.TileType]) + switch (worldTile.TileFrameX / 18) + { + case 1: + worldTile.TileFrameX += 18; + break; + case 2: + worldTile.TileFrameX -= 18; + break; + case 3: + worldTile.TileFrameX += 18; + break; + case 4: + worldTile.TileFrameX -= 18; + break; + case 8: + worldTile.TileFrameX += 36; + break; + case 10: + worldTile.TileFrameX -= 36; + break; + case 12: + worldTile.TileFrameX += 18; + break; + case 13: + worldTile.TileFrameX -= 18; + break; + case 15: + worldTile.TileFrameX += 18; + break; + case 16: + worldTile.TileFrameX -= 18; + break; + case 19: + worldTile.TileFrameX += 18; + break; + case 20: + worldTile.TileFrameX -= 18; + break; + case 25: + worldTile.TileFrameX += 18; + break; + case 26: + worldTile.TileFrameX -= 18; + break; + } + //A handful of tiles do not have any TileObjectData and/or are unqiuely sheeted. Because of this we need to correct their frames manually + //Note that this is not a comprehensive list. So far only tiles which appear in existing Calamity Structures are here. There may be other tiles which need to be added in the future. + else + { + switch (worldTile.TileType) + { + case TileID.Pots: //Vanilla pots do not have any TileObjectData, however Modded pots which do will be caught by the above conditions. + if (worldTile.TileFrameX / 18 == 0) + worldTile.TileFrameX += 18; + else + worldTile.TileFrameX -= 18; + break; + case TileID.HolidayLights: //Christmas Lights must be fixed when facing Left or Right + if (worldTile.TileFrameY / 18 == 3) + worldTile.TileFrameY -= 18; + else if (worldTile.TileFrameY / 18 == 2) + worldTile.TileFrameY += 18; + break; + case TileID.MinecartTrack: //Minecart Tracks are very similar to Platforms, and must be dealt with accordingly. Strangely, their TileFrameX and Y are handled very differently when compared to most other tiles. + switch (worldTile.TileFrameX) + { + case 2: + worldTile.TileFrameX++; + break; + case 3: + worldTile.TileFrameX--; + break; + case 4: + worldTile.TileFrameX++; + break; + case 5: + worldTile.TileFrameX--; + break; + case 6: + worldTile.TileFrameX++; + break; + case 7: + worldTile.TileFrameX--; + break; + case 8: + worldTile.TileFrameX++; + break; + case 9: + worldTile.TileFrameX--; + break; + case 14: + worldTile.TileFrameX++; + break; + case 15: + worldTile.TileFrameX--; + break; + case 18: + worldTile.TileFrameX++; + break; + case 19: + worldTile.TileFrameX--; + break; + case 24: + worldTile.TileFrameX++; + break; + case 25: + worldTile.TileFrameX--; + break; + } + if (worldTile.TileFrameY == 8) + worldTile.TileFrameY++; + else if (worldTile.TileFrameY == 9) + worldTile.TileFrameY--; + break; + case TileID.ExposedGems: //Similarly to Holiday Lights, we need to determine if Exposed Gems are facing to the left or right and then flip them. However unlike holiday lights, Exposed Gems have 3 variants we must also account for. We do this by multiplying the standard size of 18 by three when dividing the TileFrameY + if (worldTile.TileFrameY / 54 == 3) + worldTile.TileFrameY -= 54; + else if (worldTile.TileFrameY / 54 == 2) + worldTile.TileFrameY += 54; + break; + case TileID.Trees: //Trees need to be corrected manually as their sheets are pretty much wholely unique. + if (worldTile.TileFrameY / 22 >= 9) + { + if (worldTile.TileFrameX / 22 == 1) + break; + else if (worldTile.TileFrameX / 22 == 2) + worldTile.TileFrameX += 22; + else if (worldTile.TileFrameX / 22 == 3) + worldTile.TileFrameX -= 22; + } + else + { + switch (worldTile.TileFrameX / 22) + { + case 0: + if (worldTile.TileFrameY / 22 > 5) + worldTile.TileFrameX += 66; + break; + case 1: + worldTile.TileFrameX += 22; + break; + case 2: + worldTile.TileFrameX -= 22; + break; + case 3: + worldTile.TileFrameX += 22; + if (worldTile.TileFrameY / 22 < 3) + worldTile.TileFrameY += 66; + else if (worldTile.TileFrameY / 18 < 6) + worldTile.TileFrameY -= 66; + break; + case 4: + worldTile.TileFrameX -= 22; + if (worldTile.TileFrameY / 22 < 3) + worldTile.TileFrameY += 66; + else if (worldTile.TileFrameY / 22 < 6) + worldTile.TileFrameY -= 66; + else if (worldTile.TileFrameY / 22 >= 6) + worldTile.TileFrameX -= 66; + break; + } + } + break; + } + } + } + // If the determined tile type is a chest and this is its top left corner, define it appropriately. // Skip this step if this schematic position preserves tiles. bool isChest = worldTile.TileType == TileID.Containers || TileID.Sets.BasicChest[worldTile.TileType]; @@ -312,37 +523,80 @@ namespace CalamityMod.Schematics #endregion #region Place Schematic Helper Methods + //This list allows us to check if a tile is valid before we get its data and try to place a Tile Entity + private static readonly List ValidTileEntityTypes = + [ + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType() + ]; private static void TryToPlaceTileEntities(int x, int y, Tile t) { - // A tile entity in an empty spot would make no sense. - if (!t.HasTile) - return; - // Ignore tiles that aren't at the top left of the tile. - // All of Calamity's worldgen-placed tile entities refuse to exist except at the top left corner of their host tile. - if (t.TileFrameX != 0 || t.TileFrameY != 0) + int tileType = t.TileType; + + if (!ValidTileEntityTypes.Contains(tileType)) return; - // This cannot be a switch because switch cases must be compile time constants, which ModContent calls are not. - // Therefore the only option is an if-else ladder. - int tileType = t.TileType; - if (tileType == ModContent.TileType()) - TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); - else if (tileType == ModContent.TileType()) - TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); - else if (tileType == ModContent.TileType()) - TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); - else if (tileType == ModContent.TileType()) - TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); - else if (tileType == ModContent.TileType()) - TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); - else if (tileType == ModContent.TileType()) - TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); - else if (tileType == ModContent.TileType()) - TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); - else if (tileType == ModContent.TileType()) - TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); - else if (tileType == ModContent.TileType()) - TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + int index = ValidTileEntityTypes.IndexOf(tileType); + + int FrameX, FrameY; + int style = 0, alt = 0; + TileObjectData.GetTileInfo(t, ref style, ref alt); + TileObjectData data = TileObjectData.GetTileData(t.TileType, style, alt); + //Using TileObjectData, we're able to check if the given tile is the top left of any style. + //This resolves issues in generating the Lab Hologram Projector when facing to the left, and should also apply to similar Tile Entities + if (data != null) + { + int sheetSquare = 16 + data.CoordinatePadding; + FrameX = t.TileFrameX / sheetSquare % data.Width; + FrameY = t.TileFrameY / sheetSquare % data.Height; + } + else + { + FrameX = t.TileFrameX; + FrameY = t.TileFrameY; + } + //Instead of just checking if t.TileFrameX == 0, we want to check if its the top left corner of any available style. + //For example, the old function would not work if the Lab Hologram Projector was facing to the left, due to the top left of that style not being at TileFrameX == 0. Now it will work! + if (t.HasTile && FrameX == 0 && FrameY == 0) + { + switch (index) + { + case 0: + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + break; + case 1: + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + break; + case 2: + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + break; + case 3: + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + break; + case 4: + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + break; + case 5: + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + break; + case 6: + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + break; + case 7: + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + break; + case 8: + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + break; + } + } } #endregion } diff --git a/Schematics/Shrine_Roxcalibur_ShrineVariant.csch b/Schematics/Shrine_Roxcalibur_ShrineVariant.csch new file mode 100644 index 0000000000..3230e378fd Binary files /dev/null and b/Schematics/Shrine_Roxcalibur_ShrineVariant.csch differ diff --git a/Schematics/Shrine_Roxcalibur_TorchVariant.csch b/Schematics/Shrine_Roxcalibur_TorchVariant.csch new file mode 100644 index 0000000000..0fb8c4b043 Binary files /dev/null and b/Schematics/Shrine_Roxcalibur_TorchVariant.csch differ diff --git a/Skies/AstralMonolithSky.cs b/Skies/AstralMonolithSky.cs index 11135236e0..e486069cd3 100644 --- a/Skies/AstralMonolithSky.cs +++ b/Skies/AstralMonolithSky.cs @@ -40,10 +40,10 @@ namespace CalamityMod.Skies 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); + spriteBatch.Draw(SkyTextureRefs.AstralSky.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity); // Terraria's conditions. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int bgTop = (int)((-Main.screenPosition.Y) / (Main.worldSurface * 16.0 - 600.0) * 200.0); float colorMult = 0.952f * opacity; diff --git a/Skies/AstralSky.cs b/Skies/AstralSky.cs index 7290303387..3814134d1a 100644 --- a/Skies/AstralSky.cs +++ b/Skies/AstralSky.cs @@ -56,10 +56,10 @@ namespace CalamityMod.Skies 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); + spriteBatch.Draw(SkyTextureRefs.AstralSky.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity); // Terraria's conditions. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int bgTop = (int)((-Main.screenPosition.Y) / (Main.worldSurface * 16.0 - 600.0) * 200.0); float colorMult = 0.952f * opacity; diff --git a/Skies/BossRushScreenShader.cs b/Skies/BossRushScreenShader.cs deleted file mode 100644 index 221d4e516a..0000000000 --- a/Skies/BossRushScreenShader.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.Events; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Graphics.Shaders; - -namespace CalamityMod.Skies -{ - public class BossRushScreenShader : ScreenShaderData - { - public BossRushScreenShader(string passName) : base(passName) { } - - public override void Apply() - { - UseTargetPosition(Main.LocalPlayer.Center); - base.Apply(); - } - - public override void Update(GameTime gameTime) - { - UseColor(Color.Lerp(BossRushSky.GeneralColor, Color.Black, BossRushEvent.WhiteDimness)); - } - } -} diff --git a/Skies/BossRushSky.cs b/Skies/BossRushSky.cs index b36fed965a..7cc3f753df 100644 --- a/Skies/BossRushSky.cs +++ b/Skies/BossRushSky.cs @@ -33,14 +33,6 @@ namespace CalamityMod.Skies SkyManager.Instance.Deactivate("CalamityMod:BossRush", new object[0]); } - if (useEffect != Filters.Scene["CalamityMod:BossRush"].IsActive()) - { - if (useEffect) - Filters.Scene.Activate("CalamityMod:BossRush"); - else - Filters.Scene["CalamityMod:BossRush"].Deactivate(new object[0]); - } - return useEffect; } @@ -67,7 +59,7 @@ namespace CalamityMod.Skies private float GetIntensity() { if (ShouldDrawRegularly || Main.LocalPlayer?.Calamity().monolithBossRushShader > 0) - return 1f; + return 0.57f; float fadeRatio = BossRushEvent.StartTimer / (float)BossRushEvent.StartEffectTotalTime; return Utils.GetLerpValue(0.57f, 1f, fadeRatio, true); diff --git a/Skies/ExoMechsSky.cs b/Skies/ExoMechsSky.cs index efdc1eb8f9..0a873ca312 100644 --- a/Skies/ExoMechsSky.cs +++ b/Skies/ExoMechsSky.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Skies public static void CreateLightningBolt(int count = 1, bool playSound = false) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; for (int i = 0; i < count; i++) diff --git a/Skies/MonolithSky.cs b/Skies/MonolithSky.cs index aadf6e38e0..0a619692c3 100644 --- a/Skies/MonolithSky.cs +++ b/Skies/MonolithSky.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Skies if (maxDepth >= float.MaxValue && minDepth < float.MaxValue && Main.LocalPlayer.Calamity().monolithAccursedShader > 21) { - Texture2D texture = ModContent.Request("CalamityMod/MainMenu/MenuBackground").Value; + Texture2D texture = ModContent.Request("CalamityMod/MainMenu/ClassicMenuBackground").Value; int offset = Main.BackgroundEnabled ? 200 : 0; spriteBatch.Draw(texture, new Rectangle(0, Math.Max(0, (int)((Main.worldSurface * 16 - Main.screenPosition.Y - texture.Height * 2) * 0.1f)) - offset, Main.screenWidth, Main.screenHeight), Color.White * Math.Min(1f, (Main.screenPosition.Y - 800f) / 1000f * opacity)); } diff --git a/Skies/SCalSky.cs b/Skies/SCalSky.cs index 739d66cdee..8f47be8370 100644 --- a/Skies/SCalSky.cs +++ b/Skies/SCalSky.cs @@ -215,7 +215,7 @@ namespace CalamityMod.Skies { float x = 0f; if (SCalIndex != -1) - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.SCalIndex].Center); float intensityFactor = BossRushEvent.BossRushActive ? -0.2f : 1f; return (1f - Utils.SmoothStep(4500f, 9000f, x)) * intensityFactor; diff --git a/Skies/SkyTextureRefs.cs b/Skies/SkyTextureRefs.cs new file mode 100644 index 0000000000..6e27c10ae5 --- /dev/null +++ b/Skies/SkyTextureRefs.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.ModLoader; + +namespace CalamityMod.Skies +{ + [Autoload(Side = ModSide.Client)] + internal sealed class SkyTextureRefs : ModSystem + { + // Astral Sky/BG + public static Asset AstralSky; + public static Asset AstralSurfaceFront; + public static Asset AstralSurfaceFrontGlow; + public static Asset AstralSurfaceClose; + public static Asset AstralSurfaceCloseGlow; + public static Asset AstralSurfaceMiddle; + public static Asset AstralSurfaceMiddleGlow; + + // Astral Desert Sky/BG + public static Asset AstralDesertSurfaceClose; + public static Asset AstralDesertSurfaceMiddle; + + // Astral Snow Sky/BG + public static Asset AstralSnowSurfaceMiddle; + + // Sulphur Sea Sky/BG + public static Asset SulphurSeaSky; + public static Asset SulphurSeaSkyFront; + public static Asset SulphurSeaSurface; + + public override void OnModLoad() + { + // Astral Sky/BG + AstralSky = ModContent.Request("CalamityMod/Skies/AstralSky"); + AstralSurfaceFront = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceFront"); + AstralSurfaceFrontGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceFrontGlow"); + AstralSurfaceClose = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceClose"); + AstralSurfaceCloseGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceCloseGlow"); + AstralSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceMiddle"); + AstralSurfaceMiddleGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceMiddleGlow"); + + //Astral Desert Sky/BG + AstralDesertSurfaceClose = ModContent.Request("CalamityMod/Backgrounds/AstralDesertSurfaceClose"); + AstralDesertSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralDesertSurfaceMiddle"); + + //Astral Snow Sky/BG + AstralSnowSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralSnowSurfaceMiddle"); + + // Sulpher Sea Sky/BG + SulphurSeaSky = ModContent.Request("CalamityMod/Skies/SulphurSeaSky"); + SulphurSeaSkyFront = ModContent.Request("CalamityMod/Skies/SulphurSeaSkyFront"); + SulphurSeaSurface = ModContent.Request("CalamityMod/Skies/SulphurSeaSurface"); + } + + public override void Unload() + { + AstralSky = null; + AstralSurfaceFront = null; + AstralSurfaceFrontGlow = null; + AstralSurfaceClose = null; + AstralSurfaceCloseGlow = null; + AstralSurfaceMiddle = null; + AstralSurfaceMiddleGlow = null; + + AstralDesertSurfaceClose = null; + AstralDesertSurfaceMiddle = null; + + AstralSnowSurfaceMiddle = null; + + SulphurSeaSky = null; + SulphurSeaSkyFront = null; + SulphurSeaSurface = null; + } + } +} diff --git a/Skies/SulphurSeaSky.cs b/Skies/SulphurSeaSky.cs index bd8c4f1233..2c85b7fa4d 100644 --- a/Skies/SulphurSeaSky.cs +++ b/Skies/SulphurSeaSky.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Skies public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { 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); + spriteBatch.Draw(SkyTextureRefs.SulphurSeaSky.Value, 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; @@ -58,7 +58,7 @@ namespace CalamityMod.Skies // This changes the speed of the parralax, the closer the layer to the player the faster it should be. if (maxDepth >= 1f && minDepth < 1f) { - Texture2D texture = CalamityMod.SulphurSeaSkyFront; + Texture2D texture = SkyTextureRefs.SulphurSeaSkyFront.Value; // Keep in mind that y paralex should always be half of x's or it will feel odd compared to how terraria does it. // Keep in mind when you change screen parralax it affects the y offset for the bg in the world. @@ -84,7 +84,7 @@ namespace CalamityMod.Skies if (maxDepth >= 3f && minDepth < 3f) { - Texture2D texture = CalamityMod.SulphurSeaSurface; + Texture2D texture = SkyTextureRefs.SulphurSeaSurface.Value; int x = (int)(Main.screenPosition.X * ScreenParralaxMultiplier); x %= (int)(texture.Width * Scale); diff --git a/Sounds/Custom/AstrumAureus/AstrumAureusSpawn.ogg b/Sounds/Custom/AstrumAureus/AstrumAureusSpawn.ogg new file mode 100644 index 0000000000..9319832fdc Binary files /dev/null and b/Sounds/Custom/AstrumAureus/AstrumAureusSpawn.ogg differ diff --git a/Sounds/Custom/BrimstoneElemental/BrimstoneSpawn.ogg b/Sounds/Custom/BrimstoneElemental/BrimstoneSpawn.ogg new file mode 100644 index 0000000000..f4c922d5cc Binary files /dev/null and b/Sounds/Custom/BrimstoneElemental/BrimstoneSpawn.ogg differ diff --git a/Sounds/Custom/BubbleCracklePop.ogg b/Sounds/Custom/BubbleCracklePop.ogg new file mode 100644 index 0000000000..f1f0f2deca Binary files /dev/null and b/Sounds/Custom/BubbleCracklePop.ogg differ diff --git a/Sounds/Custom/Crabulon/CrabJump.ogg b/Sounds/Custom/Crabulon/CrabJump.ogg new file mode 100644 index 0000000000..e3cd8bce6d Binary files /dev/null and b/Sounds/Custom/Crabulon/CrabJump.ogg differ diff --git a/Sounds/Custom/Crabulon/CrabSlam1.ogg b/Sounds/Custom/Crabulon/CrabSlam1.ogg new file mode 100644 index 0000000000..649de6ec6e Binary files /dev/null and b/Sounds/Custom/Crabulon/CrabSlam1.ogg differ diff --git a/Sounds/Custom/Crabulon/CrabSlam2.ogg b/Sounds/Custom/Crabulon/CrabSlam2.ogg new file mode 100644 index 0000000000..051527cda0 Binary files /dev/null and b/Sounds/Custom/Crabulon/CrabSlam2.ogg differ diff --git a/Sounds/Custom/GFB/HeComes.ogg b/Sounds/Custom/GFB/HeComes.ogg new file mode 100644 index 0000000000..7eb7dc5ecf Binary files /dev/null and b/Sounds/Custom/GFB/HeComes.ogg differ diff --git a/Sounds/Custom/GFB/OceanShieldParryGFB.ogg b/Sounds/Custom/GFB/OceanShieldParryGFB.ogg new file mode 100644 index 0000000000..89985cebee Binary files /dev/null and b/Sounds/Custom/GFB/OceanShieldParryGFB.ogg differ diff --git a/Sounds/Custom/GFB/YouAreNotSafe.ogg b/Sounds/Custom/GFB/YouAreNotSafe.ogg new file mode 100644 index 0000000000..d700a7da76 Binary files /dev/null and b/Sounds/Custom/GFB/YouAreNotSafe.ogg differ diff --git a/Sounds/Custom/GreatSandSharkRoar.ogg b/Sounds/Custom/GreatSandSharkRoar.ogg index a6761195bf..5b0a19e994 100644 Binary files a/Sounds/Custom/GreatSandSharkRoar.ogg and b/Sounds/Custom/GreatSandSharkRoar.ogg differ diff --git a/Sounds/Custom/KingSlimeJewelSpawn.ogg b/Sounds/Custom/KingSlimeJewelSpawn.ogg new file mode 100644 index 0000000000..d3cf2ee7cc Binary files /dev/null and b/Sounds/Custom/KingSlimeJewelSpawn.ogg differ diff --git a/Sounds/Custom/ProfanedGuardians/GuardianHeal.ogg b/Sounds/Custom/ProfanedGuardians/GuardianHeal.ogg new file mode 100644 index 0000000000..ba3e96c6c8 Binary files /dev/null and b/Sounds/Custom/ProfanedGuardians/GuardianHeal.ogg differ diff --git a/Sounds/Custom/ProfanedGuardians/GuardianSpawn.ogg b/Sounds/Custom/ProfanedGuardians/GuardianSpawn.ogg new file mode 100644 index 0000000000..06572d9cd4 Binary files /dev/null and b/Sounds/Custom/ProfanedGuardians/GuardianSpawn.ogg differ diff --git a/Sounds/Custom/RedJewelFire.ogg b/Sounds/Custom/RedJewelFire.ogg new file mode 100644 index 0000000000..5df8b03733 Binary files /dev/null and b/Sounds/Custom/RedJewelFire.ogg differ diff --git a/Sounds/Custom/SharkoonBoom.ogg b/Sounds/Custom/SharkoonBoom.ogg new file mode 100644 index 0000000000..bed6187a7a Binary files /dev/null and b/Sounds/Custom/SharkoonBoom.ogg differ diff --git a/Sounds/Custom/ur.ogg b/Sounds/Custom/ur.ogg new file mode 100644 index 0000000000..d8c84eb7b8 Binary files /dev/null and b/Sounds/Custom/ur.ogg differ diff --git a/Sounds/Item/AmphibiansGuitarSummon.ogg b/Sounds/Item/AmphibiansGuitarSummon.ogg new file mode 100644 index 0000000000..64c015e905 Binary files /dev/null and b/Sounds/Item/AmphibiansGuitarSummon.ogg differ diff --git a/Sounds/Item/AmuletVox1.ogg b/Sounds/Item/AmuletVox1.ogg new file mode 100644 index 0000000000..af09bedf93 Binary files /dev/null and b/Sounds/Item/AmuletVox1.ogg differ diff --git a/Sounds/Item/AmuletVox2.ogg b/Sounds/Item/AmuletVox2.ogg new file mode 100644 index 0000000000..631d38c19c Binary files /dev/null and b/Sounds/Item/AmuletVox2.ogg differ diff --git a/Sounds/Item/AmuletVox3.ogg b/Sounds/Item/AmuletVox3.ogg new file mode 100644 index 0000000000..933fea04ad Binary files /dev/null and b/Sounds/Item/AmuletVox3.ogg differ diff --git a/Sounds/Item/AmuletVox4.ogg b/Sounds/Item/AmuletVox4.ogg new file mode 100644 index 0000000000..6d3ec52bcb Binary files /dev/null and b/Sounds/Item/AmuletVox4.ogg differ diff --git a/Sounds/Item/AmuletVox5.ogg b/Sounds/Item/AmuletVox5.ogg new file mode 100644 index 0000000000..77888a2106 Binary files /dev/null and b/Sounds/Item/AmuletVox5.ogg differ diff --git a/Sounds/Item/AmuletVox6.ogg b/Sounds/Item/AmuletVox6.ogg new file mode 100644 index 0000000000..7f7ae9060d Binary files /dev/null and b/Sounds/Item/AmuletVox6.ogg differ diff --git a/Sounds/Item/ArcFlash.ogg b/Sounds/Item/ArcFlash.ogg new file mode 100644 index 0000000000..a21e314e73 Binary files /dev/null and b/Sounds/Item/ArcFlash.ogg differ diff --git a/Sounds/Item/BreakAndReform.ogg b/Sounds/Item/BreakAndReform.ogg new file mode 100644 index 0000000000..30ff43b1c8 Binary files /dev/null and b/Sounds/Item/BreakAndReform.ogg differ diff --git a/Sounds/Item/ChainPull.ogg b/Sounds/Item/ChainPull.ogg new file mode 100644 index 0000000000..f0e5d4ab00 Binary files /dev/null and b/Sounds/Item/ChainPull.ogg differ diff --git a/Sounds/Item/DashSound.ogg b/Sounds/Item/DashSound.ogg new file mode 100644 index 0000000000..2a2ebe9043 Binary files /dev/null and b/Sounds/Item/DashSound.ogg differ diff --git a/Sounds/Item/DemonSwordFinalStrike.ogg b/Sounds/Item/DemonSwordFinalStrike.ogg new file mode 100644 index 0000000000..2a41668677 Binary files /dev/null and b/Sounds/Item/DemonSwordFinalStrike.ogg differ diff --git a/Sounds/Item/DemonSwordImpact1.ogg b/Sounds/Item/DemonSwordImpact1.ogg new file mode 100644 index 0000000000..1813197afe Binary files /dev/null and b/Sounds/Item/DemonSwordImpact1.ogg differ diff --git a/Sounds/Item/DemonSwordImpact2.ogg b/Sounds/Item/DemonSwordImpact2.ogg new file mode 100644 index 0000000000..30cfa5e982 Binary files /dev/null and b/Sounds/Item/DemonSwordImpact2.ogg differ diff --git a/Sounds/Item/DemonSwordInsaneImpact.ogg b/Sounds/Item/DemonSwordInsaneImpact.ogg new file mode 100644 index 0000000000..4d4315b2a7 Binary files /dev/null and b/Sounds/Item/DemonSwordInsaneImpact.ogg differ diff --git a/Sounds/Item/DemonSwordKillMode.ogg b/Sounds/Item/DemonSwordKillMode.ogg new file mode 100644 index 0000000000..0b2edc3852 Binary files /dev/null and b/Sounds/Item/DemonSwordKillMode.ogg differ diff --git a/Sounds/Item/DemonSwordKillModeOffCooldown.ogg b/Sounds/Item/DemonSwordKillModeOffCooldown.ogg new file mode 100644 index 0000000000..4b045acde7 Binary files /dev/null and b/Sounds/Item/DemonSwordKillModeOffCooldown.ogg differ diff --git a/Sounds/Item/DemonSwordStrongImpact.ogg b/Sounds/Item/DemonSwordStrongImpact.ogg new file mode 100644 index 0000000000..b349e0a947 Binary files /dev/null and b/Sounds/Item/DemonSwordStrongImpact.ogg differ diff --git a/Sounds/Item/DemonSwordSwing1.ogg b/Sounds/Item/DemonSwordSwing1.ogg new file mode 100644 index 0000000000..99750f9a9e Binary files /dev/null and b/Sounds/Item/DemonSwordSwing1.ogg differ diff --git a/Sounds/Item/DemonSwordSwing2.ogg b/Sounds/Item/DemonSwordSwing2.ogg new file mode 100644 index 0000000000..c11277a986 Binary files /dev/null and b/Sounds/Item/DemonSwordSwing2.ogg differ diff --git a/Sounds/Item/DoomsdayDeviceImpact.ogg b/Sounds/Item/DoomsdayDeviceImpact.ogg new file mode 100644 index 0000000000..ee7eb61839 Binary files /dev/null and b/Sounds/Item/DoomsdayDeviceImpact.ogg differ diff --git a/Sounds/Item/Evernote.ogg b/Sounds/Item/Evernote.ogg new file mode 100644 index 0000000000..e1c921d2cd Binary files /dev/null and b/Sounds/Item/Evernote.ogg differ diff --git a/Sounds/Item/FireImplosion.ogg b/Sounds/Item/FireImplosion.ogg new file mode 100644 index 0000000000..ef5da14382 Binary files /dev/null and b/Sounds/Item/FireImplosion.ogg differ diff --git a/Sounds/Item/FrigidflashCharge.ogg b/Sounds/Item/FrigidflashCharge.ogg new file mode 100644 index 0000000000..04145628c5 Binary files /dev/null and b/Sounds/Item/FrigidflashCharge.ogg differ diff --git a/Sounds/Item/HeavyDig.ogg b/Sounds/Item/HeavyDig.ogg new file mode 100644 index 0000000000..97a41ba4e6 Binary files /dev/null and b/Sounds/Item/HeavyDig.ogg differ diff --git a/Sounds/Item/HeliumFlashCharge.ogg b/Sounds/Item/HeliumFlashCharge.ogg new file mode 100644 index 0000000000..bac7219115 Binary files /dev/null and b/Sounds/Item/HeliumFlashCharge.ogg differ diff --git a/Sounds/Item/HeliumFlashCoreImpact.ogg b/Sounds/Item/HeliumFlashCoreImpact.ogg new file mode 100644 index 0000000000..f6fc3238df Binary files /dev/null and b/Sounds/Item/HeliumFlashCoreImpact.ogg differ diff --git a/Sounds/Item/HeliumFlashDudFire.ogg b/Sounds/Item/HeliumFlashDudFire.ogg new file mode 100644 index 0000000000..0a4f154be3 Binary files /dev/null and b/Sounds/Item/HeliumFlashDudFire.ogg differ diff --git a/Sounds/Item/HeliumFlashExplodeNoMetal.ogg b/Sounds/Item/HeliumFlashExplodeNoMetal.ogg new file mode 100644 index 0000000000..0a92c514e4 Binary files /dev/null and b/Sounds/Item/HeliumFlashExplodeNoMetal.ogg differ diff --git a/Sounds/Item/HeliumFlashFire.ogg b/Sounds/Item/HeliumFlashFire.ogg new file mode 100644 index 0000000000..53ce7544c1 Binary files /dev/null and b/Sounds/Item/HeliumFlashFire.ogg differ diff --git a/Sounds/Item/HeliumFlashFullChargeLoop.ogg b/Sounds/Item/HeliumFlashFullChargeLoop.ogg new file mode 100644 index 0000000000..5b2b889c9e Binary files /dev/null and b/Sounds/Item/HeliumFlashFullChargeLoop.ogg differ diff --git a/Sounds/Item/HeliumFlashReady.ogg b/Sounds/Item/HeliumFlashReady.ogg new file mode 100644 index 0000000000..69bfb600bc Binary files /dev/null and b/Sounds/Item/HeliumFlashReady.ogg differ diff --git a/Sounds/Item/HeliumFlashReadyAlt.ogg b/Sounds/Item/HeliumFlashReadyAlt.ogg new file mode 100644 index 0000000000..355124aaa7 Binary files /dev/null and b/Sounds/Item/HeliumFlashReadyAlt.ogg differ diff --git a/Sounds/Item/HeliumFlashSteamRelease.ogg b/Sounds/Item/HeliumFlashSteamRelease.ogg new file mode 100644 index 0000000000..11a852f711 Binary files /dev/null and b/Sounds/Item/HeliumFlashSteamRelease.ogg differ diff --git a/Sounds/Item/HellbornImpact.ogg b/Sounds/Item/HellbornImpact.ogg new file mode 100644 index 0000000000..630befa59a Binary files /dev/null and b/Sounds/Item/HellbornImpact.ogg differ diff --git a/Sounds/Item/HellbornReload.ogg b/Sounds/Item/HellbornReload.ogg new file mode 100644 index 0000000000..e108eef19b Binary files /dev/null and b/Sounds/Item/HellbornReload.ogg differ diff --git a/Sounds/Item/HellbornShoot.ogg b/Sounds/Item/HellbornShoot.ogg new file mode 100644 index 0000000000..f136ea748b Binary files /dev/null and b/Sounds/Item/HellbornShoot.ogg differ diff --git a/Sounds/Item/HolyBurst.ogg b/Sounds/Item/HolyBurst.ogg new file mode 100644 index 0000000000..d98119c2fa Binary files /dev/null and b/Sounds/Item/HolyBurst.ogg differ diff --git a/Sounds/Item/HolyColliderBigHit.ogg b/Sounds/Item/HolyColliderBigHit.ogg new file mode 100644 index 0000000000..a51d0503c6 Binary files /dev/null and b/Sounds/Item/HolyColliderBigHit.ogg differ diff --git a/Sounds/Item/HolyColliderProjectileHit.ogg b/Sounds/Item/HolyColliderProjectileHit.ogg new file mode 100644 index 0000000000..f090228a14 Binary files /dev/null and b/Sounds/Item/HolyColliderProjectileHit.ogg differ diff --git a/Sounds/Item/HolyColliderSmallHit.ogg b/Sounds/Item/HolyColliderSmallHit.ogg new file mode 100644 index 0000000000..05d728a6f4 Binary files /dev/null and b/Sounds/Item/HolyColliderSmallHit.ogg differ diff --git a/Sounds/Item/HolyLoop.ogg b/Sounds/Item/HolyLoop.ogg new file mode 100644 index 0000000000..191e4f1bc8 Binary files /dev/null and b/Sounds/Item/HolyLoop.ogg differ diff --git a/Sounds/Item/ImpalerLaunch.ogg b/Sounds/Item/ImpalerLaunch.ogg new file mode 100644 index 0000000000..78d57487ca Binary files /dev/null and b/Sounds/Item/ImpalerLaunch.ogg differ diff --git a/Sounds/Item/LauncherHeavyShot.ogg b/Sounds/Item/LauncherHeavyShot.ogg new file mode 100644 index 0000000000..3d3e042d2d Binary files /dev/null and b/Sounds/Item/LauncherHeavyShot.ogg differ diff --git a/Sounds/Item/LeviathanHornSound.ogg b/Sounds/Item/LeviathanHornSound.ogg new file mode 100644 index 0000000000..719077cb3e Binary files /dev/null and b/Sounds/Item/LeviathanHornSound.ogg differ diff --git a/Sounds/Item/LunicImpact.ogg b/Sounds/Item/LunicImpact.ogg new file mode 100644 index 0000000000..5f3e8f955a Binary files /dev/null and b/Sounds/Item/LunicImpact.ogg differ diff --git a/Sounds/Item/LunicShot1.ogg b/Sounds/Item/LunicShot1.ogg new file mode 100644 index 0000000000..c7166fea88 Binary files /dev/null and b/Sounds/Item/LunicShot1.ogg differ diff --git a/Sounds/Item/LunicShot2.ogg b/Sounds/Item/LunicShot2.ogg new file mode 100644 index 0000000000..bcea333ff4 Binary files /dev/null and b/Sounds/Item/LunicShot2.ogg differ diff --git a/Sounds/Item/MagnusImpact.ogg b/Sounds/Item/MagnusImpact.ogg new file mode 100644 index 0000000000..c70caecd9e Binary files /dev/null and b/Sounds/Item/MagnusImpact.ogg differ diff --git a/Sounds/Item/MetalEcho.ogg b/Sounds/Item/MetalEcho.ogg new file mode 100644 index 0000000000..e8d97f13f6 Binary files /dev/null and b/Sounds/Item/MetalEcho.ogg differ diff --git a/Sounds/Item/MetalScrape.ogg b/Sounds/Item/MetalScrape.ogg new file mode 100644 index 0000000000..2f1963610a Binary files /dev/null and b/Sounds/Item/MetalScrape.ogg differ diff --git a/Sounds/Item/MissileNearing.ogg b/Sounds/Item/MissileNearing.ogg new file mode 100644 index 0000000000..544e1697f0 Binary files /dev/null and b/Sounds/Item/MissileNearing.ogg differ diff --git a/Sounds/Item/MoltenAmputatorRecall.ogg b/Sounds/Item/MoltenAmputatorRecall.ogg new file mode 100644 index 0000000000..87bbd1fcb7 Binary files /dev/null and b/Sounds/Item/MoltenAmputatorRecall.ogg differ diff --git a/Sounds/Item/NullHit.ogg b/Sounds/Item/NullHit.ogg new file mode 100644 index 0000000000..d5136982e1 Binary files /dev/null and b/Sounds/Item/NullHit.ogg differ diff --git a/Sounds/Item/NullImpact.ogg b/Sounds/Item/NullImpact.ogg new file mode 100644 index 0000000000..4736aabc2d Binary files /dev/null and b/Sounds/Item/NullImpact.ogg differ diff --git a/Sounds/Item/NullShot.ogg b/Sounds/Item/NullShot.ogg new file mode 100644 index 0000000000..829fa05e01 Binary files /dev/null and b/Sounds/Item/NullShot.ogg differ diff --git a/Sounds/Item/OntologicalDespoilerLargeImpact.ogg b/Sounds/Item/OntologicalDespoilerLargeImpact.ogg new file mode 100644 index 0000000000..7bc4251e2d Binary files /dev/null and b/Sounds/Item/OntologicalDespoilerLargeImpact.ogg differ diff --git a/Sounds/Item/OntologicalDespoilerLargeShot.ogg b/Sounds/Item/OntologicalDespoilerLargeShot.ogg new file mode 100644 index 0000000000..38c32efc6e Binary files /dev/null and b/Sounds/Item/OntologicalDespoilerLargeShot.ogg differ diff --git a/Sounds/Item/OntologicalDespoilerSmallImpact.ogg b/Sounds/Item/OntologicalDespoilerSmallImpact.ogg new file mode 100644 index 0000000000..108ddd8332 Binary files /dev/null and b/Sounds/Item/OntologicalDespoilerSmallImpact.ogg differ diff --git a/Sounds/Item/PhantasmalFuryShoot.ogg b/Sounds/Item/PhantasmalFuryShoot.ogg new file mode 100644 index 0000000000..27b47390c1 Binary files /dev/null and b/Sounds/Item/PhantasmalFuryShoot.ogg differ diff --git a/Sounds/Item/RadiationBurst.ogg b/Sounds/Item/RadiationBurst.ogg new file mode 100644 index 0000000000..df865e2b1c Binary files /dev/null and b/Sounds/Item/RadiationBurst.ogg differ diff --git a/Sounds/Item/RadiationRain.ogg b/Sounds/Item/RadiationRain.ogg new file mode 100644 index 0000000000..29823ce07b Binary files /dev/null and b/Sounds/Item/RadiationRain.ogg differ diff --git a/Sounds/Item/RubicoReload.ogg b/Sounds/Item/RubicoReload.ogg new file mode 100644 index 0000000000..4a2e895e09 Binary files /dev/null and b/Sounds/Item/RubicoReload.ogg differ diff --git a/Sounds/Item/SanctifiedSparkHappy.ogg b/Sounds/Item/SanctifiedSparkHappy.ogg new file mode 100644 index 0000000000..fad4b549d1 Binary files /dev/null and b/Sounds/Item/SanctifiedSparkHappy.ogg differ diff --git a/Sounds/Item/ShadowboltReflect.ogg b/Sounds/Item/ShadowboltReflect.ogg new file mode 100644 index 0000000000..a2d84277be Binary files /dev/null and b/Sounds/Item/ShadowboltReflect.ogg differ diff --git a/Sounds/Item/ShadowboltWallHit.ogg b/Sounds/Item/ShadowboltWallHit.ogg new file mode 100644 index 0000000000..9293a99d50 Binary files /dev/null and b/Sounds/Item/ShadowboltWallHit.ogg differ diff --git a/Sounds/Item/SharkoonBoom.ogg b/Sounds/Item/SharkoonBoom.ogg new file mode 100644 index 0000000000..8dd94403c2 Binary files /dev/null and b/Sounds/Item/SharkoonBoom.ogg differ diff --git a/Sounds/Item/SkytideSwing.ogg b/Sounds/Item/SkytideSwing.ogg new file mode 100644 index 0000000000..4559d5f4e2 Binary files /dev/null and b/Sounds/Item/SkytideSwing.ogg differ diff --git a/Sounds/Item/SkytiedBolt.ogg b/Sounds/Item/SkytiedBolt.ogg new file mode 100644 index 0000000000..e32426f331 Binary files /dev/null and b/Sounds/Item/SkytiedBolt.ogg differ diff --git a/Sounds/Item/SwooshMid.ogg b/Sounds/Item/SwooshMid.ogg new file mode 100644 index 0000000000..79a8433dfb Binary files /dev/null and b/Sounds/Item/SwooshMid.ogg differ diff --git a/Sounds/Item/ViperSpit.ogg b/Sounds/Item/ViperSpit.ogg new file mode 100644 index 0000000000..b7fb928fa1 Binary files /dev/null and b/Sounds/Item/ViperSpit.ogg differ diff --git a/Sounds/Item/VolterionFire.ogg b/Sounds/Item/VolterionFire.ogg new file mode 100644 index 0000000000..8a54bc99ef Binary files /dev/null and b/Sounds/Item/VolterionFire.ogg differ diff --git a/Sounds/Item/VolterionOrbShot.ogg b/Sounds/Item/VolterionOrbShot.ogg new file mode 100644 index 0000000000..721b006684 Binary files /dev/null and b/Sounds/Item/VolterionOrbShot.ogg differ diff --git a/Sounds/Item/WaterSplash1.ogg b/Sounds/Item/WaterSplash1.ogg new file mode 100644 index 0000000000..ccad82cb42 Binary files /dev/null and b/Sounds/Item/WaterSplash1.ogg differ diff --git a/Sounds/Item/WaterSplash2.ogg b/Sounds/Item/WaterSplash2.ogg new file mode 100644 index 0000000000..717b7bc646 Binary files /dev/null and b/Sounds/Item/WaterSplash2.ogg differ diff --git a/Sounds/Item/XykDie.ogg b/Sounds/Item/XykDie.ogg new file mode 100644 index 0000000000..f3c0b2889e Binary files /dev/null and b/Sounds/Item/XykDie.ogg differ diff --git a/Sounds/NPCHit/CrabulonHit1.ogg b/Sounds/NPCHit/CrabulonHit1.ogg new file mode 100644 index 0000000000..e6ddcec551 Binary files /dev/null and b/Sounds/NPCHit/CrabulonHit1.ogg differ diff --git a/Sounds/NPCHit/CrabulonHit2.ogg b/Sounds/NPCHit/CrabulonHit2.ogg new file mode 100644 index 0000000000..9e3fd64be3 Binary files /dev/null and b/Sounds/NPCHit/CrabulonHit2.ogg differ diff --git a/Sounds/NPCHit/CrabulonHit3.ogg b/Sounds/NPCHit/CrabulonHit3.ogg new file mode 100644 index 0000000000..ff72e58993 Binary files /dev/null and b/Sounds/NPCHit/CrabulonHit3.ogg differ diff --git a/Sounds/NPCHit/GreatSandSharkHit.ogg b/Sounds/NPCHit/GreatSandSharkHit.ogg index 9f7db8deb5..8042ffaa81 100644 Binary files a/Sounds/NPCHit/GreatSandSharkHit.ogg and b/Sounds/NPCHit/GreatSandSharkHit.ogg differ diff --git a/Sounds/NPCHit/WulfrumHit1.wav b/Sounds/NPCHit/WulfrumHit1.wav new file mode 100644 index 0000000000..a07f2b7194 Binary files /dev/null and b/Sounds/NPCHit/WulfrumHit1.wav differ diff --git a/Sounds/NPCHit/WulfrumHit2.wav b/Sounds/NPCHit/WulfrumHit2.wav new file mode 100644 index 0000000000..1ba1f11026 Binary files /dev/null and b/Sounds/NPCHit/WulfrumHit2.wav differ diff --git a/Sounds/NPCHit/WulfrumHit3.wav b/Sounds/NPCHit/WulfrumHit3.wav new file mode 100644 index 0000000000..782a47fb54 Binary files /dev/null and b/Sounds/NPCHit/WulfrumHit3.wav differ diff --git a/Sounds/NPCKilled/CrabulonDeath.ogg b/Sounds/NPCKilled/CrabulonDeath.ogg new file mode 100644 index 0000000000..84773f4dfc Binary files /dev/null and b/Sounds/NPCKilled/CrabulonDeath.ogg differ diff --git a/Sounds/NPCKilled/CrownJewelShatter.ogg b/Sounds/NPCKilled/CrownJewelShatter.ogg new file mode 100644 index 0000000000..daf9d97177 Binary files /dev/null and b/Sounds/NPCKilled/CrownJewelShatter.ogg differ diff --git a/Sounds/NPCKilled/GreatSandSharkDeath.ogg b/Sounds/NPCKilled/GreatSandSharkDeath.ogg index 19f1aac3ef..bf2471e824 100644 Binary files a/Sounds/NPCKilled/GreatSandSharkDeath.ogg and b/Sounds/NPCKilled/GreatSandSharkDeath.ogg differ diff --git a/Systems/Collections/AbyssValidTileReplacementList.cs b/Systems/Collections/AbyssValidTileReplacementList.cs new file mode 100644 index 0000000000..243d3ba97f --- /dev/null +++ b/Systems/Collections/AbyssValidTileReplacementList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of modded Tile IDs which the Abyss can replace while generating. + /// + public sealed class AbyssValidTileReplacementList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + // By default, Calamity does not add anything to this list. Mods are free to do so with reflection. + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not a tile can be replaced by the Abyss while generating. + /// + public static bool Includes(int tileType) => List.Contains(tileType); + } +} diff --git a/Systems/Collections/AlcoholsDict.cs b/Systems/Collections/AlcoholsDict.cs new file mode 100644 index 0000000000..bf7ef08f65 --- /dev/null +++ b/Systems/Collections/AlcoholsDict.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.Alcohol; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all alcohol buff's IDs and their corresponding poison level. + /// + public sealed class AlcoholsDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + Dict = new Dictionary + { + { BuffID.Tipsy, 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 2 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 } + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + /// + /// A shorthand method to obtain an alcohol buff's poison level from its buff ID. + /// + public static bool TryGet(int buffType, out int poisonLevel) + { + return Dict.TryGetValue(buffType, out poisonLevel); + } + } +} diff --git a/Systems/Collections/AmalgamBuffLists.cs b/Systems/Collections/AmalgamBuffLists.cs new file mode 100644 index 0000000000..468614edfb --- /dev/null +++ b/Systems/Collections/AmalgamBuffLists.cs @@ -0,0 +1,123 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Buffs.Potions; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a with all buff IDs of those who are boosted by The Amalgam accessory. + /// + public sealed class AmalgamBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffID.ObsidianSkin, + BuffID.Regeneration, + BuffID.Swiftness, + BuffID.Gills, + BuffID.Ironskin, + BuffID.ManaRegeneration, + BuffID.MagicPower, + BuffID.Featherfall, + BuffID.Spelunker, + BuffID.Invisibility, + BuffID.Shine, + BuffID.NightOwl, + BuffID.Battle, + BuffID.Thorns, + BuffID.WaterWalking, + BuffID.Archery, + BuffID.Hunter, + BuffID.Gravitation, + BuffID.Tipsy, + BuffID.WellFed, + BuffID.WellFed2, + BuffID.WellFed3, + BuffID.Honey, + BuffID.WeaponImbueVenom, + BuffID.WeaponImbueCursedFlames, + BuffID.WeaponImbueFire, + BuffID.WeaponImbueGold, + BuffID.WeaponImbueIchor, + BuffID.WeaponImbueNanites, + BuffID.WeaponImbueConfetti, + BuffID.WeaponImbuePoison, + BuffID.Lucky, + BuffID.Mining, + BuffID.Heartreach, + BuffID.Calm, + BuffID.Builder, + BuffID.Titan, + BuffID.Flipper, + BuffID.Summoning, + BuffID.Dangersense, + BuffID.AmmoReservation, + BuffID.Lifeforce, + BuffID.Endurance, + BuffID.Rage, + BuffID.Inferno, + BuffID.Wrath, + BuffID.Lovestruck, + BuffID.Stinky, + BuffID.Fishing, + BuffID.Sonar, + BuffID.Crate, + BuffID.Warmth, + BuffID.SugarRush + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not a buff is boosted by The Amalgam or not. + /// + public static bool Includes(int buffID) => List.Contains(buffID); + } +} diff --git a/Systems/Collections/AutoreuseableSpearsList.cs b/Systems/Collections/AutoreuseableSpearsList.cs new file mode 100644 index 0000000000..80d81b13f5 --- /dev/null +++ b/Systems/Collections/AutoreuseableSpearsList.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all Vanilla Spears to make them autoreusable. + /// + public sealed class AutoreusableSpearsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ItemID.AdamantiteGlaive, + ItemID.ChlorophytePartisan, + ItemID.CobaltNaginata, + ItemID.DarkLance, + ItemID.MonkStaffT2, + ItemID.Gungnir, + ItemID.MushroomSpear, + ItemID.MythrilHalberd, + ItemID.NorthPole, + ItemID.ObsidianSwordfish, + ItemID.OrichalcumHalberd, + ItemID.PalladiumPike, + ItemID.Spear, + ItemID.Swordfish, + ItemID.TheRottedFork, + ItemID.TitaniumTrident, + ItemID.Trident, + ItemID.ThunderSpear + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not an item is an autoreusable spear. + /// + public static bool Includes(int itemType) => List.Contains(itemType); + } +} diff --git a/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs b/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs new file mode 100644 index 0000000000..769faa281d --- /dev/null +++ b/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Melee; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BlacklistedWeaponsWithToolPowerList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + // This list intentionally does not contain Grax. + List = + [ + ItemID.ButchersChainsaw, + ItemID.LucyTheAxe, + ItemID.Rockfish, + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if this Item is Blacklisted. + /// + public static bool Includes(int itemType) => List.Contains(itemType); + } +} diff --git a/Systems/Collections/BuffedDungeonProjectilesList.cs b/Systems/Collections/BuffedDungeonProjectilesList.cs new file mode 100644 index 0000000000..2d847d0d29 --- /dev/null +++ b/Systems/Collections/BuffedDungeonProjectilesList.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A which contains a that has the Projectile IDs of all projectiles who are buffed Dungeon projectiles. + /// + public sealed class BuffedDungeonProjectilesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.PaladinsHammerHostile, + ProjectileID.ShadowBeamHostile, + ProjectileID.InfernoHostileBolt, + ProjectileID.InfernoHostileBlast, + ProjectileID.LostSoulHostile, + ProjectileID.SniperBullet, + ProjectileID.RocketSkeleton, + ProjectileID.BulletDeadeye, + ProjectileID.Shadowflames + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if this projectile is a buffed Dungeon projectile. + /// + public static bool Includes(int projType) => List.Contains(projType); + } +} diff --git a/Systems/Collections/ConfusionDebuffImmunitiesList.cs b/Systems/Collections/ConfusionDebuffImmunitiesList.cs new file mode 100644 index 0000000000..5b7e79cc23 --- /dev/null +++ b/Systems/Collections/ConfusionDebuffImmunitiesList.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains all of the NPC's IDs of the NPCs who are immune to the Confusion debuff. + /// + public sealed class ConfusionDebuffImmunitiesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if an NPC is supposed to be immune to the Confusion debuff. + /// + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/DebuffsList.cs b/Systems/Collections/DebuffsList.cs new file mode 100644 index 0000000000..39b22ffc30 --- /dev/null +++ b/Systems/Collections/DebuffsList.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; +using CalamityMod.Buffs; +using CalamityMod.Buffs.Cooldowns; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all Debuff IDs. + /// + public sealed class DebuffsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffID.Poisoned, + BuffID.Darkness, + BuffID.Cursed, + BuffID.OnFire, + BuffID.Bleeding, + BuffID.Confused, + BuffID.Slow, + BuffID.Weak, + BuffID.Silenced, + BuffID.BrokenArmor, + BuffID.CursedInferno, + BuffID.Frostburn, + BuffID.Chilled, + BuffID.Frozen, + BuffID.Burning, + BuffID.Suffocation, + BuffID.Ichor, + BuffID.Venom, + BuffID.Blackout, + BuffID.Electrified, + BuffID.Rabies, + BuffID.Webbed, + BuffID.Stoned, + BuffID.Dazed, + BuffID.VortexDebuff, + BuffID.WitheredArmor, + BuffID.WitheredWeapon, + BuffID.OgreSpit, + BuffID.BetsysCurse, + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + // BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a buff ID is a debuff. + /// + public static bool Includes(int buffID) => List.Contains(buffID); + } +} diff --git a/Systems/Collections/DisabledSummonerNerfItemList.cs b/Systems/Collections/DisabledSummonerNerfItemList.cs new file mode 100644 index 0000000000..0f312357da --- /dev/null +++ b/Systems/Collections/DisabledSummonerNerfItemList.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DisabledSummonerNerfItemList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = []; + } + + public override void Unload() => List = null; + + public static bool Includes(int itemType) => List.Contains(itemType); + } +} diff --git a/Systems/Collections/DisabledSummonerNerfMinionList.cs b/Systems/Collections/DisabledSummonerNerfMinionList.cs new file mode 100644 index 0000000000..48a47c670b --- /dev/null +++ b/Systems/Collections/DisabledSummonerNerfMinionList.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DisabledSummonerNerfMinionList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = []; + } + + public override void Unload() => List = null; + + public static bool Includes(int projType) => List.Contains(projType); + } +} diff --git a/Systems/Collections/DonatorsNameList.cs b/Systems/Collections/DonatorsNameList.cs new file mode 100644 index 0000000000..ed851b871a --- /dev/null +++ b/Systems/Collections/DonatorsNameList.cs @@ -0,0 +1,669 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that stores all of Calamity's Patreon donator's usernames. + /// + public sealed class DonatorsNameList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + "Vorbis", + "SoloMael", + "Chaotic Reks", + "The Buildmonger", + "YuH", + "Littlepiggy", + "LompL", + "Lilith", + "Ben Shapiro", + "Frederik", + "Faye", + "Gibb50", + "Braden", + "Hannes", + "profoundmango69", + "Jack", + "Hans Volter", + "Krankwagon", + "MishiroUsui", + "pixlgray", + "Arkhine", + "Lodude", + "DevAesthetic", + "Mister Winchester", + "Zacky", + "Veine", + "Javyz", + "Shifter", + "Crysthamyr", + "Elfinlocks", + "Ein", + "2Larry2", + "Jenonen", + "Dodu", + "Arti", + "Tervastator", + "Luis", + "Alexander", + "BakaQing", + "Taylor", + "Xaphlactus", + "MajinBagel", + "Bendy", + "Rando Calrissian", + "Tails the Fox 92", + "Bread", + "Minty Candy", + "Preston", + "MovingTarget_086", + "Shiro", + "Chip", + "Taylor", + "ShotgunAngel", + "Sandblast", + "ThomasThePencil", + "Aero (Aero#4599)", + "Shirosity", // used to be GlitchOut + "Daawnz", + "CrabBar", + "Yatagarasu", + "Jarod", + "Zombieh", + "MingWhy", + "Random Weeb", + "Afzofa", + "Eragon3942", + "TheBlackHand", + "william", + "Samuel", + "Christopher", + "DemoN K!ng", + "Malik", + "Ryan Baker-Ortiz", + "Aleksanders", + "TheSilverGhost", + "Lucazii", + "Shay", + "Prism", + "BobIsNotMyRealName", + "Guwahavel", + "Azura", + "Joshua", + "Doveda", + "William", + "Arche", + "DevilSunrise", + "Yanmei", + "Chaos", + "Ryan", + "Fish Repairs", + "Melvin", + "Vroomy Has -3,000 IQ", + "The Goliath", + "DaPyRo", + "Takeru", + "Circuit-Jay", + "Commmander Frostbite", + "cytokat", + "Cameron", + "Orudeon", + "BumbleDoge", + "Naglfar", + "Helixas", + "Vetus", + "High Charity", + "Devonte", + "Cerberus", + "Brendan", + "Victor", + "KAT-G307", + "Tombarry Expresserino", + "Drip Veezy", + "Glaid", + "Apotheosis", + "Bladesaber", + "Devon", + "Ruthoranium", + "cocodezi_", + "Mendzey", + "GameRDheAsianSandwich", + "Chigbungus", + "Streakist", + "Eisaya", + "Xenocrona", + "RKMoon", + "Eternal Silence", + "Jeff", + "Beta165", + "DanYami", + "Xenocrona", + "Ari", + "cosmickalamity", + "xd Ow0", + "Darren", + "Florian", + "dawn thunder", + "asdf935", + "GentSkeleton", + "Fizzlpoprock", + "Pigeon", + "Aleksh", + "Just a random guy", + "Dee", + "Æthereal", + "Broken Faucet", + "Sarcosuchus", + "Marissa443", + "Warlok", + "JackShizz", + "NebulaMagePlays", + "Primpy", + "Thys", + "Min", + "Wodernet", + "Pedro", + "Depressed Dad Gaming", + "Snowy", + "Stormone", + "Mobian", + "Rinja", + "Check pins", + "Dakota", + "Neoplasmatic", + "False", + "Whitegiraffe", + "Drakkece", + "Levi", + "Izuna", + "djsnj20", + "pyobbo", + "Alec", + "The Illustrious Sqouinchuousor", + "Moist Lad", + "TwanTheGOAT", + "3x1t_5tyl3", + "Will", + "SpookyNinja", + "Boomdiada", + "Culex", + "Rossadon", + "Ben", + "hubert thieblot", + "NepNep", + "Nanaki", + "CrimsonCrips", + "Lagohz", + "Timon", + "F00d Demon", + "Olkothan", + "Vmar98", + "Dasdruid", + "Cinder", + "Brutzli", + "Yhashtur", + "Zekai", + "Doug", + "Uberransy", + "KurlozClown", + "Nemesis 041", + "Asheel", + "Hayden", + "Lightedflare", + "Lady Shira", + "Devin", + "Qelrin", + "Thomas", + "Ne'er Dowell", + "Potion Man", + "martyrdomination", + "Destructoid", + "Coolguystorm YT", + "Wolfmaw", + "yiumik", + "Destiny Stallcup", + "GreenBerry", + "SolsticeUnlimitd", + "darkhawke", + "oracle", + "YumeiSenshi", + "Cameron", + "Toxin", + "Fweepachino", + "DESPACITO", + "Altzeus", + "Ryan", + "Spider region", + "WinterTire", + "Nycro", + "Vyster", // previously "Bewearium" + "William", + "HellGoat2", + "116taj", + "CaineSenpai", + "Suicide Dreams", + "Roxas", + "Obsoleek", + "Jetpat3", + "GreenTea", + "Woah", + "Ryaegos", + "Popsickle Yoshi", + "Arcadia", + "JensB__", + "Nuclei", + "Picasso's Bean", + "Corn M. Cobb", + "kgh8090", + "Luke", + "Barbara", + "Alexis", + "Soko", + "Albino gonkvader", + "Monic", + "Slim", + "ChaosChaos", + "Deallly", + "Jeff", + "vcf55", + "Kazurgundu", + "Jheybyrd", + "Kipluck", + "SCONICBOOM", + "Mr.Matter", + "Billy", + "jjth0m3", + "GTW High Cube", + "Sabrina", + "Potato - Stego", + "Perditio Astrum", + "MaxingOut", + "SharZz", + "Allegro", + "hoosfire", + "Lauren", + "Ultra Succ", + "Ethan", + "Pacnysam", + "dummyAzure", + "Jaykob", + "Goblin", + "NoOneElse", + "Nicholas", + "Toasty", + "oli saer", + "Blobby6799", + "Domrinth", + "zombieseatflesh7", + "Shiny", + "Whale", + "The Infinity", + "MrCreamen", + "TemperedAether", + "LucasTwocas", + "JustLonelyPi", + "Brian", + "Ashton", + "Rolandark", + "Ally2Cute", + "Dionysos", + "Plant Waifu", + "fire", + "Charles", + "Kaden", + "Dr. Pawsworth", + "Jackson", + "Freakish", + "Ashamper", + "Kinzoku", + "Elementari", + "The Wolf Commando", + "Jordan", + "Jessire", + "Ashton", + "callisto", + "velneu", + "Mathuantie", + "Robert", + "Matias", + "T E R M I N A T O R", + "apotofkoolaid", + "Matthew", + "Terrarian Dragon", + "Pomelo", + "Thomas", + "Iconic Parker Gaming", + "Jaydon", + "Aidan", + "Avery", + "yayoi", + "Splotchycrib", + "GIGA MAN", + "Eric", + "Merubel", + "Smug", + "Lime-Wars l 1", + "WillyDilly", + "xAqult", + "Himakaze", + "Face", + "Carboniferous", + "James", + "Taitou1", + "Yumi", + "NEBULA", + "Blackbluue", + "Alex", + "Ruben", + "Rixu", + "Antonie", + "Zerimore", + "Oblivionisbruh", + "Loser", + "Patrick", + "Magic Love", + "gluten tag", + "RetroRed", + "Katherine", + "SoyScoutSmasher", + "Jersey", + "Reiter splash", + "Conner", + "Ekun", + "Driser", + "bikmin", + "MittoMan", + "Pyromaniac146", + "Eddie Spaghetti", + "Colin", + "ZyferDex_", + "LumiEvi", + "Anish", + "MissMudflaps", + "Valkyrie", + "anglerraptor", + "Scribbles", + "Pneuma", + "OrrangProto", + "Tomat (Stevie)", + "That Katsafaros", + "PsychoGrizzly", + "Dayne", + "Hargestar", + "The Pyro", + "Lucas", + "Superbeepig", + "Larry That Barry", + "Monti", + "StarryFox", + "Kevin", + "Poopifier Poopifly", + "Lacuna", + "Nathan", + "Handburger", + "XusTingo9", + "Underlost", + "julius", + "Mark", + "Habb", + "Reanamet", + "Empress Vega", + "Team", + "GP", + "Xsiana", + "NyanLegacy215", + "ethan", + "Trinity Series", + "M001NG", + "WrathOfOlympus", + "dennis", + "Darkweb", + "Chaozhi", + "Mars", + "Elijah", + "Tezguin", + "Shpee", + "Archie", + "Meow", + "CosmicStarIight", + "Alfragiste", + "Number1piratepan", + "Noah", + "Max Kim", + "Anton", + "edm vibes", + "Hunter", + "Doodled_lynx", + "3en", + "Kiyotu", + "Aero", + "Iguy", + "병현 송", + "Tyler", + "Leonidas", + "GregTheSpinarak", + "Cheddar", + "Alex N", + "Magicoal", + "Seanツ", + "Ariscottle", + "Kevin", + "OnTheAirPogs", + "Zerafir", + "Bill", + "Starmitzy", + "FaeLoPondering", + "Brian", + "Smart2004", + "sherk", + "Squishy", + "Ash", + "rawpie2", + "Hokojin", + "sk", + "Done", + "MeanieG", + "Sanctuary", + "Landon", + "Moonicento", + "Hayden", + "Steven", + "Hana", + "Mikabul", + "Nathaniel", + "Brutus", + "EdelVollMilch", + "garfu", + "NuT NiTe", + "adain", + "Dylan", + "Lucas", + "Arthur", + "sweatingdishes", + "pomp neigh", + "Proffesor prostate", + "Saladify", + "26-4-1", + "VeryMasterNinja", + "Vorbis", + "Nyapano", + "Shadoku", + "allosar", + "jes", + "Paltham", + "Fartein", + "Derdjin", + "A_Normal_Person", + "Duck Satan", + "Jalapeno9", + "Grylken", + "Nexus", + "KJ", + "Goober", + "ChAoS DiScOrD", + "Mayhem", + "Zombified _G", + "Madd Cat", + "Natalie", + "Solaire", + "Dakota C", + "The Davester", + "Jose", + "Him", + "Umberto", + "Lance", + "Navigator", + "Ferret4T", + "Rooki", + "LvL-94", + "Feels Fishy", + "Korb Orb", + "Calcium Comrade", + "Talmadge", + "ddoogg88 tdog", + "CasualNoLifer", + "Bossy Punch", + "Creamy", + "Tyler", + "topnormal", + "Gilded Gryphon", + "Nightskyflyer", + "Schlarfblrfsch", + "MrNobody", + "Aden C.N.", + "zombie wolf", + "n0tacat", + "Marko", + "dexxer65", + "DeLordeyeee", + "Kaledoulas", + "Mohammad", + "Skeli_G", + "Arcxus", + "Sigil", + "Dull", + "DjackV", + "Misinput", + "Gameology", + "KugelBlitz", + "TheGreatSako", + "Joep", + "Rottingwood", + "anything5000", + "Gretchen", + "Spirit Shield", + "Briny_Coffee", + "_Skeggy_", + "just akkolite", + "J.U.N.E.S", + "Bruggs", + "Vimek Xol", + "Oceanman232", + "Sadouken", + "srxe", + "ProfessorWinston", + "OctolingGrimm", + "Cole", + "Markie", + "Met Vox", + "Tweee", + "Kaimonick", + "Chow Chow", + "drenmus!", + "Nitronium Productions", + "Goomfrontlut", + "Akkolite", + "Shaun", + "Bruh.PNG", + "James", + "Lord_Lucerne", + "Ulmod", + "Adamko", + "Gamma Freya", + "Finnrua", + "Maskedmilo", + "RockRecker39", + "Konorango", + "Indeciiissive", + "Curtis", + "Ponynator", + "Crippling-Ambition", + "TitaniumLlama", + "OriginForme487", + "FishBread", + "Real mystlc", + "Levi", + "jc.", + "Medi", + "Jakob", + "Borb9834", + "Georgios", + "KeL", + "Cody", + "Cristian(Mihaii)", + "Marco", + "RuskieThe3rd", + "BreachNClear747", + "happy thoughts", + "Azure", + "theHoopty", + "porglesupreme", + "XDkilljoy65XX", + "Mr. Bones", + "dawnboi", + "Joe", + "Sailor Jolt", + "SomeRando", + "Nuclear Chaos", + "Jankle", + "The Roborex", + "everquartz", + "discokittie", + "IsaacInsomnia", + "xElectrix_", + "Forge", + "MiyoshiEira", + "thebettercat", + "Darthlego", + "Azzilan", + "Griffin", + "LucasHM", + "ChrigTopher", + "Colin V", + "Scrumlet", + "Darkus", + "Homunculus Derelictus", + "Professor Pissington", + "Buppercups - Roblox", + "Pusheen_", + "Patrera" + ]; + } + + public override void Unload() => List = null; + + /// + /// Returns 25 random donator usernames. + /// + public static string[] GetRandomDonors() + { + List donorList = new(List); + const int maxDonorsListed = 25; + string[] donors = new string[maxDonorsListed]; + for (int i = 0; i < maxDonorsListed; i++) + { + donors[i] = donorList[Main.rand.Next(donorList.Count)]; + donorList.Remove(donors[i]); + } + + return donors; + } + } +} diff --git a/Systems/Collections/EncryptedSchematicIDRelationshipDict.cs b/Systems/Collections/EncryptedSchematicIDRelationshipDict.cs new file mode 100644 index 0000000000..216b4a70e9 --- /dev/null +++ b/Systems/Collections/EncryptedSchematicIDRelationshipDict.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.DraedonMisc; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class EncryptedSchematicIDRelationshipDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + var dict = new Dictionary() + { + [1] = ItemType(), + [2] = ItemType(), + [3] = ItemType(), + [4] = ItemType(), + }; + + Dict = dict; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + public static bool TryGet(int schematicID, out int schematicItemType) + { + return Dict.TryGetValue(schematicID, out schematicItemType); + } + + public static bool TryGetKey(int schematicItemType, out int schematicID) + { + try + { + var pair = Dict.First(pair => pair.Value == schematicItemType); + schematicID = pair.Key; + return true; + } + catch + { + schematicID = 0; + return false; + } + } + } +} diff --git a/Systems/Collections/EventProjectileBuffList.cs b/Systems/Collections/EventProjectileBuffList.cs new file mode 100644 index 0000000000..9f3db41e46 --- /dev/null +++ b/Systems/Collections/EventProjectileBuffList.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all Projectile Types that receive Post-DoG Event Buff + /// + public sealed class EventProjectileBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.FlamingWood, + ProjectileID.GreekFire1, + ProjectileID.GreekFire2, + ProjectileID.GreekFire3, + ProjectileID.FlamingScythe, + ProjectileID.FlamingArrow, + ProjectileID.PineNeedleHostile, + ProjectileID.OrnamentHostile, + ProjectileID.OrnamentHostileShrapnel, + ProjectileID.FrostWave, + ProjectileID.FrostShard, + ProjectileID.Missile, + ProjectileID.Present, + ProjectileID.Spike, + ProjectileID.BulletDeadeye, + ProjectileID.EyeLaser, + ProjectileID.Nail, + ProjectileID.DrManFlyFlask + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int projType) => List.Contains(projType); + } +} diff --git a/Systems/Collections/FireDebuffsList.cs b/Systems/Collections/FireDebuffsList.cs new file mode 100644 index 0000000000..f68d38db98 --- /dev/null +++ b/Systems/Collections/FireDebuffsList.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all the IDs of all Fire-type debuffs. + /// + public sealed class FireDebuffsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffID.OnFire, + BuffID.OnFire3, // Hellfire + BuffID.Burning, // Touching meteorite ore or hellstone without obsidian skull + BuffID.CursedInferno, + BuffID.ShadowFlame, // Vanilla Shadowflame, can normally never be applied to players + BuffType(), // Calamity Shadowflame copy for players + BuffType(), // Crags lava + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), // Aflame enchant self damage + BuffType(), + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a buff ID is a fire debuff. + /// + public static bool Includes(int buffID) => List.Contains(buffID); + } +} diff --git a/Systems/Collections/FriendlyBeesList.cs b/Systems/Collections/FriendlyBeesList.cs new file mode 100644 index 0000000000..4ccdaf609f --- /dev/null +++ b/Systems/Collections/FriendlyBeesList.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all the Projectile IDs of all friendly bees. + /// + public sealed class FriendlyBeesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.GiantBee, + ProjectileID.Bee, + ProjectileID.Wasp, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a projectile is a friendly bee. + /// + public static bool Includes(int projType) => List.Contains(projType); + } +} diff --git a/Systems/Collections/GrenadeResistIDList.cs b/Systems/Collections/GrenadeResistIDList.cs new file mode 100644 index 0000000000..917ae8271c --- /dev/null +++ b/Systems/Collections/GrenadeResistIDList.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class GrenadeResistIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.Grenade, + ProjectileID.StickyGrenade, + ProjectileID.BouncyGrenade, + ProjectileID.Bomb, + ProjectileID.StickyBomb, + ProjectileID.BouncyBomb, + ProjectileID.Dynamite, + ProjectileID.StickyDynamite, + ProjectileID.BouncyDynamite, + ProjectileID.Explosives, + ProjectileID.ExplosiveBunny, + ProjectileID.PartyGirlGrenade, + ProjectileID.BombFish, + ProjectileID.Beenade, + ProjectileID.Bee, + ProjectileID.GiantBee, + ProjectileType(), + ProjectileID.ScarabBomb, + ProjectileID.TNTBarrel + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int projectileType) => List.Contains(projectileType); + } +} diff --git a/Systems/Collections/HighTestFishingPoleList.cs b/Systems/Collections/HighTestFishingPoleList.cs new file mode 100644 index 0000000000..aea4781598 --- /dev/null +++ b/Systems/Collections/HighTestFishingPoleList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using CalamityMod.Items.Fishing.FishingRods; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class HighTestFishingPoleList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ItemID.GoldenFishingRod, + ItemType(), + ItemType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int itemType) => List.Contains(itemType); + } +} diff --git a/Systems/Collections/ItemsForcedInsideWorldList.cs b/Systems/Collections/ItemsForcedInsideWorldList.cs new file mode 100644 index 0000000000..6fd8da39ab --- /dev/null +++ b/Systems/Collections/ItemsForcedInsideWorldList.cs @@ -0,0 +1,110 @@ +using System.Collections.Generic; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; +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.Rogue; +using CalamityMod.Items.Weapons.Summon; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of Item IDs of those which are forced to be inside the world map. + /// + public sealed class ItemsForcedInsideWorldList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + 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(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemID.HotlineFishingHook, + ItemID.BottomlessBucket, + ItemID.SuperAbsorbantSponge, + ItemID.FishingPotion, + ItemID.SonarPotion, + ItemID.CratePotion, + ItemID.AnglerTackleBag, + ItemID.HighTestFishingLine, + ItemID.TackleBox, + ItemID.AnglerEarring, + ItemID.FishermansGuide, + ItemID.WeatherRadio, + ItemID.Sextant, + ItemID.AnglerHat, + ItemID.AnglerVest, + ItemID.AnglerPants, + ItemID.GoldenBugNet, + ItemID.FishronWings, + ItemID.Flairon, + ItemID.Tsunami, + ItemID.BubbleGun, + ItemID.RazorbladeTyphoon, + ItemID.TempestStaff, + ItemID.FishronBossBag, + ItemID.Coral, + ItemID.Seashell, + ItemID.Starfish, + ItemID.SoulofSight, + ItemID.GreaterHealingPotion, + ItemID.SuperHealingPotion + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not an item is an item that should be forced inside the world map. + /// + public static bool Includes(int itemType) => List.Contains(itemType); + } +} diff --git a/Systems/Collections/KamiDebuffColorImmuneList.cs b/Systems/Collections/KamiDebuffColorImmuneList.cs new file mode 100644 index 0000000000..028faa8375 --- /dev/null +++ b/Systems/Collections/KamiDebuffColorImmuneList.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.OldDuke; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class KamiDebuffColorImmuneList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + // Duke Fishron and Old Duke phase 3 becomes way too easy if you can make him stop being invisible with Yanmei's Knife. + // This is a list so that other NPCs can be added as necessary. + // IT DOES NOT make them immune to the debuff, just stops them from being recolored. + List = + [ + NPCID.DukeFishron, + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/LegOverrideList.cs b/Systems/Collections/LegOverrideList.cs new file mode 100644 index 0000000000..16b2989168 --- /dev/null +++ b/Systems/Collections/LegOverrideList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class LegOverrideList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + EquipLoader.GetEquipSlot(CalamityMod.Instance, nameof(ProfanedSoulCrystal), EquipType.Legs), + EquipLoader.GetEquipSlot(CalamityMod.Instance, nameof(AquaticHeart), EquipType.Legs), + //CalamityMod.Instance.GetEquipSlot(nameof(SirenLeg), EquipType.Legs), whate even was SirenLeg vs SirenLegAlt? + EquipLoader.GetEquipSlot(CalamityMod.Instance, nameof(Popo), EquipType.Legs) + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int equipSlot) => List.Contains(equipSlot); + } +} diff --git a/Systems/Collections/LivingFireTilesList.cs b/Systems/Collections/LivingFireTilesList.cs new file mode 100644 index 0000000000..81b2d27c33 --- /dev/null +++ b/Systems/Collections/LivingFireTilesList.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using CalamityMod.Tiles.LivingFire; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a with all Tile IDs of those which are Living-Fire-type tiles. + /// + public sealed class LivingFireTilesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + TileType(), + TileType(), + TileType(), + TileType(), + TileID.LivingFire, + TileID.LivingCursedFire, + TileID.LivingDemonFire, + TileID.LivingFrostFire, + TileID.LivingIchor, + TileID.LivingUltrabrightFire + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not a tile is a Living-Fire-type of tile. + /// + public static bool Includes(int tileType) => List.Contains(tileType); + } +} diff --git a/Systems/Collections/MagicGunIDList.cs b/Systems/Collections/MagicGunIDList.cs new file mode 100644 index 0000000000..bc6544d228 --- /dev/null +++ b/Systems/Collections/MagicGunIDList.cs @@ -0,0 +1,65 @@ +using System.Collections.Generic; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Magic; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class MagicGunIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + 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 + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if this Item is Magic Gun. + /// + public static bool Includes(int itemType) => List.Contains(itemType); + } +} diff --git a/Systems/Collections/NPCIDs/AngryBonesIDList.cs b/Systems/Collections/NPCIDs/AngryBonesIDList.cs new file mode 100644 index 0000000000..7ca8a86472 --- /dev/null +++ b/Systems/Collections/NPCIDs/AngryBonesIDList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class AngryBonesIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.AngryBones, + NPCID.AngryBonesBig, + NPCID.AngryBonesBigMuscle, + NPCID.AngryBonesBigHelmet, + NPCID.BigBoned, + NPCID.ShortBones + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs b/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs new file mode 100644 index 0000000000..e6b8dae864 --- /dev/null +++ b/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AquaticScourge; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class AquaticScourgeIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/AresIDList.cs b/Systems/Collections/NPCIDs/AresIDList.cs new file mode 100644 index 0000000000..09b52cdd3a --- /dev/null +++ b/Systems/Collections/NPCIDs/AresIDList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.ExoMechs.Ares; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class AresIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/AstrumDeusIDList.cs b/Systems/Collections/NPCIDs/AstrumDeusIDList.cs new file mode 100644 index 0000000000..d5ddc2b632 --- /dev/null +++ b/Systems/Collections/NPCIDs/AstrumDeusIDList.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AstrumDeus; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class AstrumDeusIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/BoundNPCIDList.cs b/Systems/Collections/NPCIDs/BoundNPCIDList.cs new file mode 100644 index 0000000000..a3667b2fd0 --- /dev/null +++ b/Systems/Collections/NPCIDs/BoundNPCIDList.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BoundNPCIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.BoundGoblin, + NPCID.BoundWizard, + NPCID.BoundMechanic, + NPCID.SleepingAngler, + NPCID.BartenderUnconscious, + NPCID.WebbedStylist, + NPCID.GolferRescue + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs b/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs new file mode 100644 index 0000000000..ebacf52a13 --- /dev/null +++ b/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.DevourerofGods; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class CosmicGuardianIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/DemonEyeIDList.cs b/Systems/Collections/NPCIDs/DemonEyeIDList.cs new file mode 100644 index 0000000000..d0c72b67bf --- /dev/null +++ b/Systems/Collections/NPCIDs/DemonEyeIDList.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DemonEyeIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.DemonEye, + NPCID.CataractEye, + NPCID.SleepyEye, + NPCID.DialatedEye, // it is spelled "dilated" + NPCID.GreenEye, + NPCID.PurpleEye, + NPCID.DemonEyeOwl, + NPCID.DemonEyeSpaceship, + NPCID.DemonEye2, + NPCID.PurpleEye2, + NPCID.GreenEye2, + NPCID.DialatedEye2, + NPCID.SleepyEye2, + NPCID.CataractEye2 + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/DesertScourgeIDList.cs b/Systems/Collections/NPCIDs/DesertScourgeIDList.cs new file mode 100644 index 0000000000..280a969845 --- /dev/null +++ b/Systems/Collections/NPCIDs/DesertScourgeIDList.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.DesertScourge; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DesertScourgeIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/DestroyerIDList.cs b/Systems/Collections/NPCIDs/DestroyerIDList.cs new file mode 100644 index 0000000000..5199177076 --- /dev/null +++ b/Systems/Collections/NPCIDs/DestroyerIDList.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DestroyerIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs b/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs new file mode 100644 index 0000000000..ff37b9725c --- /dev/null +++ b/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.DevourerofGods; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DevourerOfGodsIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs b/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs new file mode 100644 index 0000000000..e4c2f65476 --- /dev/null +++ b/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class EaterOfWorldsIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/GolemIDList.cs b/Systems/Collections/NPCIDs/GolemIDList.cs new file mode 100644 index 0000000000..db9e1b362a --- /dev/null +++ b/Systems/Collections/NPCIDs/GolemIDList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class GolemIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Golem, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistLeft, + NPCID.GolemFistRight + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/HornetIDList.cs b/Systems/Collections/NPCIDs/HornetIDList.cs new file mode 100644 index 0000000000..3cb3d5e17f --- /dev/null +++ b/Systems/Collections/NPCIDs/HornetIDList.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class HornetIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.BigHornetStingy, + NPCID.LittleHornetStingy, + NPCID.BigHornetSpikey, + NPCID.LittleHornetSpikey, + NPCID.BigHornetLeafy, + NPCID.LittleHornetLeafy, + NPCID.BigHornetHoney, + NPCID.LittleHornetHoney, + NPCID.BigHornetFatty, + NPCID.LittleHornetFatty, + NPCID.BigStinger, + NPCID.LittleStinger, + NPCID.Hornet, + NPCID.HornetFatty, + NPCID.HornetHoney, + NPCID.HornetLeafy, + NPCID.HornetSpikey, + NPCID.HornetStingy + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/MossHornetIDList.cs b/Systems/Collections/NPCIDs/MossHornetIDList.cs new file mode 100644 index 0000000000..9f05bd9acf --- /dev/null +++ b/Systems/Collections/NPCIDs/MossHornetIDList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class MossHornetIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.MossHornet, + NPCID.TinyMossHornet, + NPCID.LittleMossHornet, + NPCID.BigMossHornet, + NPCID.GiantMossHornet + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/PerforatorWormIDList.cs b/Systems/Collections/NPCIDs/PerforatorWormIDList.cs new file mode 100644 index 0000000000..4bb42decc1 --- /dev/null +++ b/Systems/Collections/NPCIDs/PerforatorWormIDList.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Perforator; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PerforatorWormIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/RavagerIDList.cs b/Systems/Collections/NPCIDs/RavagerIDList.cs new file mode 100644 index 0000000000..61dfdb3135 --- /dev/null +++ b/Systems/Collections/NPCIDs/RavagerIDList.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Ravager; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class RavagerIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + // Purposefully does not include the freed head + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/SkeletonIDList.cs b/Systems/Collections/NPCIDs/SkeletonIDList.cs new file mode 100644 index 0000000000..ec63ae51f9 --- /dev/null +++ b/Systems/Collections/NPCIDs/SkeletonIDList.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class SkeletonIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Skeleton, + NPCID.HeadacheSkeleton, + NPCID.MisassembledSkeleton, + NPCID.PantlessSkeleton, + NPCID.BoneThrowingSkeleton, + NPCID.BoneThrowingSkeleton2, + NPCID.BoneThrowingSkeleton3, + NPCID.BoneThrowingSkeleton4, + NPCID.BigPantlessSkeleton, + NPCID.SmallPantlessSkeleton, + NPCID.BigMisassembledSkeleton, + NPCID.SmallMisassembledSkeleton, + NPCID.BigHeadacheSkeleton, + NPCID.SmallHeadacheSkeleton, + NPCID.BigSkeleton, + NPCID.SmallSkeleton, + + //Note: These skeletons don't count for Skeleton Banner for some god forsaken reason + NPCID.SkeletonTopHat, + NPCID.SkeletonAstonaut, + NPCID.SkeletonAlien, + + //Other skeleton types + NPCID.ArmoredSkeleton, + NPCID.HeavySkeleton, + NPCID.SkeletonArcher, + NPCID.GreekSkeleton, + NPCID.SporeSkeleton + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs b/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs new file mode 100644 index 0000000000..21c182ddfa --- /dev/null +++ b/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class SkeletronPrimeIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.SkeletronPrime, + NPCType(), + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeSaw, + NPCID.PrimeVice + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/SlimeGodIDList.cs b/Systems/Collections/NPCIDs/SlimeGodIDList.cs new file mode 100644 index 0000000000..85bdebd8b6 --- /dev/null +++ b/Systems/Collections/NPCIDs/SlimeGodIDList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.SlimeGod; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class SlimeGodIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/StormWeaverIDList.cs b/Systems/Collections/NPCIDs/StormWeaverIDList.cs new file mode 100644 index 0000000000..39f1ecd0fa --- /dev/null +++ b/Systems/Collections/NPCIDs/StormWeaverIDList.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.StormWeaver; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class StormWeaverIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/ThanatosIDList.cs b/Systems/Collections/NPCIDs/ThanatosIDList.cs new file mode 100644 index 0000000000..8688eac6b6 --- /dev/null +++ b/Systems/Collections/NPCIDs/ThanatosIDList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class ThanatosIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCIDs/ZombieIDList.cs b/Systems/Collections/NPCIDs/ZombieIDList.cs new file mode 100644 index 0000000000..0b5ece97d5 --- /dev/null +++ b/Systems/Collections/NPCIDs/ZombieIDList.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class ZombieIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Zombie, + NPCID.ArmedZombie, + NPCID.BaldZombie, + NPCID.PincushionZombie, + NPCID.ArmedZombiePincussion, // what is this spelling + NPCID.SlimedZombie, + NPCID.ArmedZombieSlimed, + NPCID.SwampZombie, + NPCID.ArmedZombieSwamp, + NPCID.TwiggyZombie, + NPCID.ArmedZombieTwiggy, + NPCID.FemaleZombie, + NPCID.ArmedZombieCenx, + NPCID.ZombieRaincoat, + NPCID.ZombieEskimo, + NPCID.ArmedZombieEskimo, + NPCID.BigRainZombie, + NPCID.SmallRainZombie, + NPCID.BigFemaleZombie, + NPCID.SmallFemaleZombie, + NPCID.BigTwiggyZombie, + NPCID.SmallTwiggyZombie, + NPCID.BigSwampZombie, + NPCID.SmallSwampZombie, + NPCID.BigSlimedZombie, + NPCID.SmallSlimedZombie, + NPCID.BigPincushionZombie, + NPCID.SmallPincushionZombie, + NPCID.BigBaldZombie, + NPCID.SmallBaldZombie, + NPCID.BigZombie, + NPCID.SmallZombie, + NPCID.MaggotZombie, + NPCType() + // halloween zombies not included because they don't drop shackles or zombie arms + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/BossHPScalingList.cs b/Systems/Collections/NPCs/BossHPScalingList.cs new file mode 100644 index 0000000000..5912dbbc55 --- /dev/null +++ b/Systems/Collections/NPCs/BossHPScalingList.cs @@ -0,0 +1,154 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +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; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all NPC IDs of bosses or boss minions that have HP scaling. + /// + public sealed class BossHPScalingList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.SkeletronHand, + NPCID.WallofFleshEye, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeVice, + NPCID.PrimeSaw, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistRight, + NPCID.GolemFistLeft, + NPCID.Sharkron, + NPCID.Sharkron2, + NPCID.MoonLordHead, + NPCID.MoonLordHand, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/BossRushHPChangeDict.cs b/Systems/Collections/NPCs/BossRushHPChangeDict.cs new file mode 100644 index 0000000000..97646e5f90 --- /dev/null +++ b/Systems/Collections/NPCs/BossRushHPChangeDict.cs @@ -0,0 +1,130 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BossRushHPChangeDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + Dict = new Dictionary + { + // Tier 1 + { NPCID.KingSlime, 300000 }, // 30 seconds + { NPCID.BlueSlime, 3600 }, + { NPCID.SlimeSpiked, 7200 }, + { NPCID.GreenSlime, 2700 }, + { NPCID.RedSlime, 5400 }, + { NPCID.PurpleSlime, 7200 }, + { NPCID.YellowSlime, 6300 }, + { NPCID.IceSlime, 4500 }, + { 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 }, + { NPCID.EaterofWorldsTail, 10000 }, + + { NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers + { 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 + + { NPCID.SkeletronHead, 150000 }, // 30 seconds + { NPCID.SkeletronHand, 60000 }, + + { 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, 200000 }, // 30 seconds + { NPCID.QueenSlimeMinionBlue, 6000 }, + { NPCID.QueenSlimeMinionPink, 6000 }, + { NPCID.QueenSlimeMinionPurple, 5000 }, + + { NPCID.Spazmatism, 150000 }, // 30 seconds + { NPCID.Retinazer, 125000 }, + { NPCType(), 137500 }, + + { NPCID.TheDestroyer, 600000 }, // 30 seconds + immunity timer at start + { NPCID.TheDestroyerBody, 600000 }, + { NPCID.TheDestroyerTail, 600000 }, + { NPCID.Probe, 10000 }, + + { 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, 5000 }, + { NPCType(), 5000 }, + + // Tier 3 + { NPCID.Golem, 50000 }, // 30 seconds + { NPCID.GolemHead, 30000 }, + { NPCID.GolemHeadFree, 30000 }, + { NPCID.GolemFistLeft, 25000 }, + { NPCID.GolemFistRight, 25000 }, + + { NPCID.HallowBoss, 200000 }, // 30 seconds + + { NPCID.DukeFishron, 290000 }, // 30 seconds + + { NPCID.CultistBoss, 220000 }, // 30 seconds + { NPCID.CultistDragonHead, 60000 }, + { NPCID.CultistDragonBody1, 60000 }, + { NPCID.CultistDragonBody2, 60000 }, + { NPCID.CultistDragonBody3, 60000 }, + { NPCID.CultistDragonBody4, 60000 }, + { NPCID.CultistDragonTail, 60000 }, + { NPCID.AncientCultistSquidhead, 50000 }, + + { NPCID.MoonLordCore, 160000 }, // 1 minute + { NPCID.MoonLordHand, 45000 }, + { NPCID.MoonLordHead, 60000 }, + { NPCID.MoonLordLeechBlob, 800 } + + // 9.5 minutes in total for vanilla Boss Rush bosses + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + public static bool TryGet(int npcType, out int newHP) + { + return Dict.TryGetValue(npcType, out newHP); + } + } +} diff --git a/Systems/Collections/NPCs/BossTypeDict.cs b/Systems/Collections/NPCs/BossTypeDict.cs new file mode 100644 index 0000000000..20ddc6d87e --- /dev/null +++ b/Systems/Collections/NPCs/BossTypeDict.cs @@ -0,0 +1,112 @@ +using System.Collections.Generic; +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.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BossTypeDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + Dict = new SortedDictionary() + { + { NPCID.KingSlime, 1 }, + { NPCType(), 2 }, + { NPCID.EyeofCthulhu, 3 }, + { NPCType(), 4 }, + { NPCID.EaterofWorldsHead, 5 }, + { NPCID.EaterofWorldsBody, 5 }, + { NPCID.EaterofWorldsTail, 5 }, + { NPCID.BrainofCthulhu, 6 }, + { NPCType(), 7 }, + { NPCType(), 8 }, + { NPCID.QueenBee, 9 }, + { NPCID.SkeletronHead, 10 }, + { NPCType(), 11 }, + { NPCType(), 11 }, + { NPCType(), 11 }, + { NPCID.WallofFlesh, 12 }, + { NPCType(), 13 }, + { NPCID.Retinazer, 14 }, + { NPCID.Spazmatism, 14 }, + { NPCType(), 15 }, + { NPCID.TheDestroyer, 16 }, + { NPCType(), 17 }, + { NPCID.SkeletronPrime, 18 }, + { NPCType(), 19 }, + { NPCID.Plantera, 20 }, + { NPCType(), 21 }, + { NPCType(), 21 }, + { NPCType(), 22 }, + { NPCID.Golem, 23 }, + { NPCType(), 24 }, + { NPCID.DukeFishron, 25 }, + { NPCType(), 26 }, + { NPCID.CultistBoss, 27 }, + { NPCType(), 28 }, + { NPCID.MoonLordCore, 29 }, + { NPCType(), 30 }, + { NPCType(), 31 }, + { NPCType(), 32 }, + { NPCType(), 33 }, + { NPCType(), 34 }, + { NPCType(), 35 }, + { NPCType(), 36 }, + { NPCType(), 37 }, + { NPCType(), 38 }, + { NPCType(), 39 }, + { NPCType(), 40 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCID.QueenSlimeBoss, 42 }, + { NPCID.HallowBoss, 43 }, + { NPCID.Deerclops, 44 } + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + public static bool TryGet(int npcType, out int type) + { + return Dict.TryGetValue(npcType, out type); + } + } +} diff --git a/Systems/Collections/NPCs/BossValueDict.cs b/Systems/Collections/NPCs/BossValueDict.cs new file mode 100644 index 0000000000..43b450ad80 --- /dev/null +++ b/Systems/Collections/NPCs/BossValueDict.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BossValueDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + // NOTE: This does not account for Calamity's base value increases + Dict = new SortedDictionary + { + { NPCID.KingSlime, Item.buyPrice(0, 2) }, + { NPCID.EyeofCthulhu, Item.buyPrice(0, 2) }, + // Evil bosses drop 5 gold in vanilla; unmodified + { NPCID.QueenBee, Item.buyPrice(0, 8) }, + { NPCID.Deerclops, Item.buyPrice(0, 8) }, + { NPCID.SkeletronHead, Item.buyPrice(0, 12) }, + { NPCID.WallofFlesh, Item.buyPrice(0, 12) }, + { NPCID.QueenSlimeBoss, Item.buyPrice(0, 16) }, + { NPCID.Spazmatism, Item.buyPrice(0, 16) }, + { NPCID.Retinazer, Item.buyPrice(0, 16) }, + { NPCID.TheDestroyer, Item.buyPrice(0, 16) }, + { NPCID.SkeletronPrime, Item.buyPrice(0, 16) }, + { NPCID.Plantera, Item.buyPrice(0, 20) }, + { NPCID.Golem, Item.buyPrice(0, 25) }, + { NPCID.HallowBoss, Item.buyPrice(0, 30) }, + { NPCID.DukeFishron, Item.buyPrice(0, 30) }, + { NPCID.CultistBoss, Item.buyPrice(0, 50) } + // Moon Lord drops 1 plat in vanilla; unmodified + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + public static bool TryGet(int npcType, out int value) + { + return Dict.TryGetValue(npcType, out value); + } + } +} diff --git a/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs b/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs new file mode 100644 index 0000000000..78c00a647b --- /dev/null +++ b/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A which contains a of all NPC's IDs of NPCs who are buffed dungeon enemies. + /// + public sealed class BuffedDungeonEnemiesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.SkeletonSniper, + NPCID.TacticalSkeleton, + NPCID.SkeletonCommando, + NPCID.Paladin, + NPCID.GiantCursedSkull, + NPCID.BoneLee, + NPCID.DiabolistWhite, + NPCID.DiabolistRed, + NPCID.NecromancerArmored, + NPCID.Necromancer, + NPCID.RaggedCasterOpenCoat, + NPCID.RaggedCaster, + NPCID.HellArmoredBonesSword, + NPCID.HellArmoredBonesMace, + NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBones, + NPCID.BlueArmoredBonesSword, + NPCID.BlueArmoredBonesNoPants, + NPCID.BlueArmoredBonesMace, + NPCID.BlueArmoredBones, + NPCID.RustyArmoredBonesSwordNoArmor, + NPCID.RustyArmoredBonesSword, + NPCID.RustyArmoredBonesFlail, + NPCID.RustyArmoredBonesAxe + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if an NPC is a buffed Dungeon enemy. + /// + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/DeathModeSplittingWormList.cs b/Systems/Collections/NPCs/DeathModeSplittingWormList.cs new file mode 100644 index 0000000000..9a9f638071 --- /dev/null +++ b/Systems/Collections/NPCs/DeathModeSplittingWormList.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DeathModeSplittingWormList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.DuneSplicerHead, + NPCID.DuneSplicerBody, + NPCID.DuneSplicerTail, + NPCID.DiggerHead, + NPCID.DiggerBody, + NPCID.DiggerTail, + NPCID.SeekerHead, + NPCID.SeekerBody, + NPCID.SeekerTail + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/EclipseBuffList.cs b/Systems/Collections/NPCs/EclipseBuffList.cs new file mode 100644 index 0000000000..aaff7f27b1 --- /dev/null +++ b/Systems/Collections/NPCs/EclipseBuffList.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all NPC Types that receive Post-DoG Eclipse Buff + /// + public sealed class EclipseBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Eyezor, + NPCID.Reaper, + NPCID.Frankenstein, + NPCID.SwampThing, + NPCID.Vampire, + NPCID.VampireBat, + NPCID.Butcher, + NPCID.CreatureFromTheDeep, + NPCID.Fritz, + NPCID.Nailhead, + NPCID.Psycho, + NPCID.DeadlySphere, + NPCID.DrManFly, + NPCID.ThePossessed, + NPCID.Mothron, + NPCID.MothronEgg, + NPCID.MothronSpawn + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/EnemyImmunitiesList.cs b/Systems/Collections/NPCs/EnemyImmunitiesList.cs new file mode 100644 index 0000000000..60d1d76aa7 --- /dev/null +++ b/Systems/Collections/NPCs/EnemyImmunitiesList.cs @@ -0,0 +1,190 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains all of the NPC IDs of all NPCs that are immune to special debuffs. + /// + public sealed class EnemyImmunitiesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.KingSlime, + NPCType(), + NPCType(), + NPCType(), + NPCID.EyeofCthulhu, + NPCType(), + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.BrainofCthulhu, + NPCID.Creeper, + NPCID.QueenBee, + NPCID.Deerclops, + NPCID.SkeletronHead, + NPCID.SkeletronHand, + NPCID.WallofFlesh, + NPCID.WallofFleshEye, + NPCID.PirateShipCannon, + NPCID.QueenSlimeBoss, + NPCID.Probe, + NPCID.Retinazer, + NPCID.Spazmatism, + NPCType(), + NPCID.SkeletronPrime, + NPCType(), + NPCID.PrimeCannon, + NPCID.PrimeSaw, + NPCID.PrimeLaser, + NPCID.PrimeVice, + NPCID.Plantera, + NPCID.PlanterasTentacle, + NPCType(), + NPCID.Everscream, + NPCID.SantaNK1, + NPCID.IceQueen, + NPCID.MourningWood, + NPCID.Pumpking, + NPCID.Mothron, + NPCID.Golem, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistRight, + NPCID.GolemFistLeft, + NPCID.MartianSaucerCore, + NPCID.MartianSaucerCannon, + NPCID.MartianSaucerTurret, + NPCID.DukeFishron, + NPCID.Sharkron, + NPCID.Sharkron2, + NPCID.HallowBoss, + NPCID.CultistBoss, + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + NPCID.MoonLordHead, + NPCID.MoonLordHand, + NPCID.MoonLordCore, + NPCID.MoonLordFreeEye, + NPCID.DD2WyvernT1, + NPCID.DD2WyvernT2, + NPCID.DD2WyvernT3, + NPCID.DD2DarkMageT1, + NPCID.DD2DarkMageT3, + NPCID.DD2SkeletonT1, + NPCID.DD2SkeletonT3, + NPCID.DD2WitherBeastT2, + NPCID.DD2WitherBeastT3, + NPCID.DD2DrakinT2, + NPCID.DD2DrakinT3, + NPCID.DD2KoboldWalkerT2, + NPCID.DD2KoboldWalkerT3, + NPCID.DD2KoboldFlyerT2, + NPCID.DD2KoboldFlyerT3, + NPCID.DD2OgreT2, + NPCID.DD2OgreT3, + NPCID.DD2Betsy, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if an NPC is in this list. + /// + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/FrostMoonBuffList.cs b/Systems/Collections/NPCs/FrostMoonBuffList.cs new file mode 100644 index 0000000000..d94d780e9e --- /dev/null +++ b/Systems/Collections/NPCs/FrostMoonBuffList.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all NPC Types that receive Post-DoG Frost Moon Buff + /// + public sealed class FrostMoonBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.ZombieElf, + NPCID.ZombieElfBeard, + NPCID.ZombieElfGirl, + NPCID.PresentMimic, + NPCID.GingerbreadMan, + NPCID.Yeti, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.ElfCopter, + NPCID.Nutcracker, + NPCID.NutcrackerSpinning, + NPCID.ElfArcher, + NPCID.Krampus, + NPCID.Flocko + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/HardmodeNPCNerfList.cs b/Systems/Collections/NPCs/HardmodeNPCNerfList.cs new file mode 100644 index 0000000000..a8d0a144bd --- /dev/null +++ b/Systems/Collections/NPCs/HardmodeNPCNerfList.cs @@ -0,0 +1,155 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class HardmodeNPCNerfList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + // Reduce contact damage by 25% + List = + [ + NPCID.AnglerFish, + NPCID.AngryTrapper, + NPCID.Arapaima, + NPCID.BlackRecluse, + NPCID.BlackRecluseWall, + NPCID.BloodJelly, + NPCID.FungoFish, + NPCID.GreenJellyfish, + NPCID.Clinger, + NPCID.ArmoredSkeleton, + NPCID.ArmoredViking, + NPCID.Mummy, + NPCID.DarkMummy, + NPCID.LightMummy, + NPCID.BloodFeeder, + NPCID.DesertBeast, + NPCID.ChaosElemental, + NPCID.BloodMummy, + NPCID.CorruptSlime, + NPCID.Slimeling, + NPCID.Corruptor, + NPCID.Crimslime, + NPCID.BigCrimslime, + NPCID.LittleCrimslime, + NPCID.CrimsonAxe, + NPCID.CursedHammer, + NPCID.Derpling, + NPCID.Herpling, + NPCID.DiggerHead, + NPCID.DesertGhoul, + NPCID.DesertGhoulCorruption, + NPCID.DesertGhoulCrimson, + NPCID.DesertGhoulHallow, + NPCID.DuneSplicerHead, + NPCID.EnchantedSword, + NPCID.FloatyGross, + NPCID.GiantBat, + NPCID.GiantFlyingFox, + NPCID.FungiSpore, + NPCID.GiantTortoise, + NPCID.IceTortoise, + NPCID.HoppinJack, + NPCID.Mimic, + NPCID.IlluminantBat, + NPCID.IlluminantSlime, + NPCID.JungleCreeper, + NPCID.JungleCreeperWall, + NPCID.DesertLamiaDark, + NPCID.DesertLamiaLight, + NPCID.BigMossHornet, + NPCID.GiantMossHornet, + NPCID.LittleMossHornet, + NPCID.MossHornet, + NPCID.TinyMossHornet, + NPCID.Moth, + NPCID.PigronCorruption, + NPCID.PigronCrimson, + NPCID.PigronHallow, + NPCID.Pixie, + NPCID.PossessedArmor, + NPCID.RockGolem, + NPCID.DesertScorpionWalk, + NPCID.DesertScorpionWall, + NPCID.Slimer, + NPCID.Slimer2, + NPCID.ToxicSludge, + NPCID.Unicorn, + NPCID.WanderingEye, + NPCID.Werewolf, + NPCID.Wolf, + NPCID.SeekerHead, + NPCID.Wraith, + NPCID.ChatteringTeethBomb, + NPCID.IceGolem, + NPCID.RainbowSlime, + NPCID.SandShark, + NPCID.SandsharkCorrupt, + NPCID.SandsharkCrimson, + NPCID.SandsharkHallow, + NPCID.ShadowFlameApparition, + NPCID.Parrot, + NPCID.PirateCorsair, + NPCID.PirateDeckhand, + NPCID.PirateGhost, + NPCID.BlueArmoredBonesMace, + NPCID.BlueArmoredBonesSword, + NPCID.BoneLee, + NPCID.DungeonSpirit, + NPCID.FlyingSnake, + NPCID.HellArmoredBones, + NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBonesSword, + NPCID.MisterStabby, + NPCID.Butcher, + NPCID.CreatureFromTheDeep, + NPCID.DeadlySphere, + NPCID.Frankenstein, + NPCID.Fritz, + NPCID.Psycho, + NPCID.Reaper, + NPCID.SwampThing, + NPCID.ThePossessed, + NPCID.Vampire, + NPCID.VampireBat, + NPCID.HeadlessHorseman, + NPCID.Hellhound, + NPCID.Poltergeist, + NPCID.Scarecrow1, + NPCID.Scarecrow2, + NPCID.Scarecrow3, + NPCID.Scarecrow4, + NPCID.Scarecrow5, + NPCID.Scarecrow6, + NPCID.Scarecrow7, + NPCID.Scarecrow8, + NPCID.Scarecrow9, + NPCID.Scarecrow10, + NPCID.Splinterling, + NPCID.Flocko, + NPCID.GingerbreadMan, + NPCID.Krampus, + NPCID.Nutcracker, + NPCID.NutcrackerSpinning, + NPCID.PresentMimic, + NPCID.Yeti, + NPCID.ZombieElf, + NPCID.ZombieElfBeard, + NPCID.ZombieElfGirl, + NPCID.BloodEelHead, + NPCID.GoblinShark, + NPCID.EyeballFlyingFish, + NPCID.ZombieMerman + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/MinibossList.cs b/Systems/Collections/NPCs/MinibossList.cs new file mode 100644 index 0000000000..f2e0ed4f62 --- /dev/null +++ b/Systems/Collections/NPCs/MinibossList.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.SunkenSea; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class MinibossList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCID.Pumpking, + NPCID.MourningWood, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.Everscream, + NPCID.DD2Betsy, + NPCID.Mothron, + NPCID.MartianSaucer, + NPCID.MartianSaucerCannon, + NPCID.MartianSaucerCore, + NPCID.MartianSaucerTurret + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/NoRageWormSegmentList.cs b/Systems/Collections/NPCs/NoRageWormSegmentList.cs new file mode 100644 index 0000000000..456dbaa828 --- /dev/null +++ b/Systems/Collections/NPCs/NoRageWormSegmentList.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.StormWeaver; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class NoRageWormSegmentList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/PierceResistList.cs b/Systems/Collections/NPCs/PierceResistList.cs new file mode 100644 index 0000000000..efbe96843f --- /dev/null +++ b/Systems/Collections/NPCs/PierceResistList.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PierceResistList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/PumpkinMoonBuffList.cs b/Systems/Collections/NPCs/PumpkinMoonBuffList.cs new file mode 100644 index 0000000000..6ab32c0323 --- /dev/null +++ b/Systems/Collections/NPCs/PumpkinMoonBuffList.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all NPC Types that receive Post-DoG Pumpkin Moon Buff + /// + public sealed class PumpkinMoonBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Scarecrow1, + NPCID.Scarecrow2, + NPCID.Scarecrow3, + NPCID.Scarecrow4, + NPCID.Scarecrow5, + NPCID.Scarecrow6, + NPCID.Scarecrow7, + NPCID.Scarecrow8, + NPCID.Scarecrow9, + NPCID.Scarecrow10, + NPCID.HeadlessHorseman, + NPCID.MourningWood, + NPCID.Splinterling, + NPCID.Pumpking, + NPCID.PumpkingBlade, + NPCID.Hellhound, + NPCID.Poltergeist + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs b/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs new file mode 100644 index 0000000000..dbc3aa6ffd --- /dev/null +++ b/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs @@ -0,0 +1,154 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class ZeroContactDamageNPCList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + 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, + NPCID.CultistArcherBlue, + NPCID.DesertDjinn, + NPCID.DiabolistRed, + NPCID.DiabolistWhite, + NPCID.Gastropod, + NPCID.IceElemental, + NPCID.IchorSticker, + NPCID.Necromancer, + NPCID.NecromancerArmored, + NPCID.RaggedCaster, + NPCID.RaggedCasterOpenCoat, + NPCID.RuneWizard, + NPCID.SkeletonArcher, + NPCID.SkeletonCommando, + NPCID.SkeletonSniper, + NPCID.TacticalSkeleton, + NPCID.Clown, + NPCID.GoblinArcher, + NPCID.GoblinSorcerer, + NPCID.GoblinSummoner, + NPCID.PirateCrossbower, + NPCID.PirateDeadeye, + NPCID.PirateCaptain, + NPCID.SnowmanGangsta, + NPCID.SnowBalla, + 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, + NPCID.MartianSaucerCore, + NPCID.MartianSaucerTurret, + NPCID.Probe, + NPCID.CultistBoss, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.MoonLordFreeEye, + NPCID.BloodSquid, + NPCID.PlanterasHook, + 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 + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/NeedsDebuffIconDisplayList.cs b/Systems/Collections/NeedsDebuffIconDisplayList.cs new file mode 100644 index 0000000000..1cd6d90efe --- /dev/null +++ b/Systems/Collections/NeedsDebuffIconDisplayList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class NeedsDebuffIconDisplayList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.TargetDummy, + NPCID.WallofFleshEye, + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/PersistentBuffList.cs b/Systems/Collections/PersistentBuffList.cs new file mode 100644 index 0000000000..01e165e604 --- /dev/null +++ b/Systems/Collections/PersistentBuffList.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.Potions; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PersistentBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffType(), + BuffType(), + BuffType(), + BuffID.WeaponImbueVenom, + BuffID.WeaponImbueCursedFlames, + BuffID.WeaponImbueFire, + BuffID.WeaponImbueGold, + BuffID.WeaponImbueIchor, + BuffID.WeaponImbueNanites, + BuffID.WeaponImbueConfetti, + BuffID.WeaponImbuePoison + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if this buffType is a PersistentBuff. + /// + public static bool Includes(int buffType) => List.Contains(buffType); + } +} diff --git a/Systems/Collections/PierceResistExceptionLeviAureusList.cs b/Systems/Collections/PierceResistExceptionLeviAureusList.cs new file mode 100644 index 0000000000..4c3f202da1 --- /dev/null +++ b/Systems/Collections/PierceResistExceptionLeviAureusList.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PierceResistExceptionLeviAureusList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.NettleBurstEnd, + ProjectileID.NettleBurstLeft, + ProjectileID.NettleBurstRight, + ProjectileID.PrincessWeapon, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int projectileType) => List.Contains(projectileType); + } +} diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs new file mode 100644 index 0000000000..95dc2ecceb --- /dev/null +++ b/Systems/Collections/PierceResistExceptionList.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PierceResistExceptionList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.Arkhalis, + ProjectileID.ChargedBlasterLaser, + ProjectileID.ClingerStaff, + ProjectileID.FinalFractal, + ProjectileID.FlyingKnife, + ProjectileID.LastPrismLaser, + ProjectileID.MonkStaffT3, + ProjectileID.PiercingStarlight, + ProjectileID.Terragrim, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int projectileType) => List.Contains(projectileType); + } +} diff --git a/Systems/Collections/ProjectileDestroyExceptionsList.cs b/Systems/Collections/ProjectileDestroyExceptionsList.cs new file mode 100644 index 0000000000..5992a004e2 --- /dev/null +++ b/Systems/Collections/ProjectileDestroyExceptionsList.cs @@ -0,0 +1,149 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that holds a list of all projectiles that should be, exceptionally, ignored by projectile destruction. + /// + public sealed class ProjectileDestroyExceptionsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + // Holdout projectiles. + ProjectileID.Phantasm, + ProjectileID.VortexBeater, + ProjectileID.DD2PhoenixBow, + ProjectileID.LastPrism, + ProjectileID.LastPrismLaser, + ProjectileID.LaserMachinegun, + ProjectileID.ChargedBlasterCannon, + ProjectileID.MedusaHead, + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + // Some hostile boss projectiles. + ProjectileID.SaucerDeathray, + ProjectileID.PhantasmalDeathray, + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a projectile belongs in the exception list. + /// + public static bool Includes(int projType) => List.Contains(projType); + } +} diff --git a/Systems/Collections/SicknessDebuffsList.cs b/Systems/Collections/SicknessDebuffsList.cs new file mode 100644 index 0000000000..7d687952a6 --- /dev/null +++ b/Systems/Collections/SicknessDebuffsList.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all the Sickness Debuffs' IDs. + /// + public sealed class SicknessDebuffsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffID.Poisoned, + BuffID.Venom, + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a buff ID is a Sickness Debuff. + /// + public static bool Includes(int buffID) => List.Contains(buffID); + } +} diff --git a/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs b/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs new file mode 100644 index 0000000000..5fb07cab3d --- /dev/null +++ b/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using CalamityMod.BiomeManagers; +using CalamityMod.Enums; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// Each Sunken Sea subbiome has a correspoding spawn condition boolean value and a biome type. + /// + public sealed class SunkenSeaBiomeCorrespondentDict : ModSystem + { + public static IDictionary SpawnCondition, int BiomeType)> Dict { get; private set; } + + public override void OnModLoad() + { + Dict = new Dictionary SpawnCondition, int BiomeType)>() + { + { SunkenSeaBiomeFlags.UndergroundDesert, (spawnInfo => spawnInfo.Player.ZoneDesert, -1 /* None needed. */) }, + { SunkenSeaBiomeFlags.TimelessShores, (spawnInfo => spawnInfo.Player.Calamity().ZoneTimelessShores, GetInstance().Type) }, + { SunkenSeaBiomeFlags.RadiantReefs, (spawnInfo => spawnInfo.Player.Calamity().ZoneRadiantReefs, GetInstance().Type) }, + { SunkenSeaBiomeFlags.PolypForest, (spawnInfo => spawnInfo.Player.Calamity().ZonePolypForest, GetInstance().Type) }, + { SunkenSeaBiomeFlags.GleamingBurrows, (spawnInfo => spawnInfo.Player.Calamity().ZoneGleamingBurrows, GetInstance().Type) }, + { SunkenSeaBiomeFlags.BasaltGully, (spawnInfo => spawnInfo.Player.Calamity().ZoneBasaltGully, GetInstance().Type) }, + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + public static bool TryGet(SunkenSeaBiomeFlags flags, out Func spawnCondition, out int biomeType) + { + if (!Dict.TryGetValue(flags, out var biomeInfoTuple)) + { + spawnCondition = null; + biomeType = default; + return false; + } + + spawnCondition = biomeInfoTuple.SpawnCondition; + biomeType = biomeInfoTuple.BiomeType; + return true; + } + } +} diff --git a/Systems/Collections/VeneratedLocketBanList.cs b/Systems/Collections/VeneratedLocketBanList.cs new file mode 100644 index 0000000000..e7a6921a99 --- /dev/null +++ b/Systems/Collections/VeneratedLocketBanList.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using CalamityMod.Items.Weapons.Rogue; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// To ban projectiles from locket, mainly spikeballs altho Toasty asked me to add mod calls for adding stuff like Dreamtastic + /// + public sealed class VeneratedLocketBanList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int itemType) => List.Contains(itemType); + } +} diff --git a/Systems/Graphic/CalamityModWaterStyle.cs b/Systems/Graphic/CalamityModWaterStyle.cs new file mode 100644 index 0000000000..15b3388551 --- /dev/null +++ b/Systems/Graphic/CalamityModWaterStyle.cs @@ -0,0 +1,69 @@ +using Terraria; +using Terraria.Graphics; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public abstract class CalamityModWaterStyle : ModWaterStyle + { + /// + /// Allows water styles to manipulate what color the liquid is drawn to, this can allow waters to be see-throughable to see backgrounds (surface and underground backgrounds not walls) + /// + /// X position of the water + /// Y position of the water + /// The vertexColor of the water color, this is both used to get the current color and to set the color of the water + public virtual void DrawColor(int x, int y, ref VertexColors liquidColor, bool isSlope) + { + } + + /// + /// Allows you to determine how much light this water emits.
+ /// It can also let you light up the block in front of this water.
+ /// See for vanilla tile light values to use as a reference.
+ ///
+ /// The x position in tile coordinates. + /// The y position in tile coordinates. + /// The red component of light, usually a value between 0 and 1 + /// The green component of light, usually a value between 0 and 1 + /// The blue component of light, usually a value between 0 and 1 + public virtual void ModifyLight(ref readonly Tile tile, int i, int j, ref float r, ref float g, ref float b) + { + } + } + + internal static class CalamityWaterLoader + { + internal static void ModifyLightSetup(ref readonly Tile tile, int i, int j, int type, ref float r, ref float g, ref float b) + { + if (TryGetCalamityWaterStyle(type, out var styles)) + { + styles.ModifyLight(in tile, i, j, ref r, ref g, ref b); + } + } + + internal static void DrawColorSetup(int x, int y, int type, ref VertexColors liquidColor, bool isSlope = false) + { + if (TryGetCalamityWaterStyle(type, out var styles)) + { + styles.DrawColor(x, y, ref liquidColor, isSlope); + } + } + + internal static bool TryGetCalamityWaterStyle(int type, out CalamityModWaterStyle waterStyle) + { + waterStyle = GetCalamityWaterStyle(type); + return waterStyle != null; + } + + internal static CalamityModWaterStyle GetCalamityWaterStyle(int type) + { + var modWaterStyle = LoaderManager.Get().Get(type); + if (modWaterStyle is CalamityModWaterStyle calWaterStyle) + { + return calWaterStyle; + } + + return null; + } + } +} diff --git a/Systems/HellBackgroundSystem.cs b/Systems/Graphic/HellBackgroundSystem.cs similarity index 100% rename from Systems/HellBackgroundSystem.cs rename to Systems/Graphic/HellBackgroundSystem.cs diff --git a/Systems/Graphic/LavaRenderingSystem.cs b/Systems/Graphic/LavaRenderingSystem.cs new file mode 100644 index 0000000000..84d5f6cce2 --- /dev/null +++ b/Systems/Graphic/LavaRenderingSystem.cs @@ -0,0 +1,1187 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Liquid; +using Terraria.Graphics; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.WaterfallManager; + +namespace CalamityMod.Systems +{ + [Autoload(Side = ModSide.Client)] + public sealed class LavaRenderingSystem : ModSystem + { + //Welcome to Calamity's lava rendering. Prepare your eyes + public static LavaRenderingSystem Instance; + + public static int LavaStyle; + public static float[] LavaAlpha = new float[1]; + internal static float[] AlphaSave = new float[1]; + + // Holds the Texture Arrays for all the lava textures. + // These are used for the lava styles. They are seperate from Textureasset.Instance._liquidTexture as they will conflict with ModWaterStyle + // Can hold up to 255 lava styles (more than enough) (excluding the normal lava texture which is liquidTexture 1) + public struct Textures + { + public static Asset[] liquid = new Asset[1]; + public static Asset[] slope = new Asset[1]; + public static Asset[] block = new Asset[1]; + public static Asset[] fall = new Asset[1]; + } + + public int WaterStyleMaxCount = 0; + + public override void Load() + { + Instance = this; + } + + public override void OnModLoad() + { + WaterStyleMaxCount = ModContent.GetContent().Count() + LoaderManager.Get().VanillaCount; + + // Lava Texture + Textures.liquid[0] = LiquidRenderer.Instance._liquidTextures[1]; + Textures.slope[0] = TextureAssets.LiquidSlope[1]; + Textures.block[0] = TextureAssets.Liquid[1]; + var waterfallTexture = (Asset[])typeof(WaterfallManager).GetField("waterfallTexture", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(Main.instance.waterfallManager); + Textures.fall[0] = waterfallTexture[1]; + } + + public void DrawLavas(bool isBackground = false) + { + Main.drewLava = false; + if (!isBackground) + { + LavaStyle = 0; + LavaStylesLoader.IsLavaActive(); + for (int i = 0; i < 1; i++) + { + if (LavaStyle != i) + { + LavaAlpha[i] = Math.Max(LavaAlpha[i] - 0.2f, 0f); + } + else + { + LavaAlpha[i] = Math.Min(LavaAlpha[i] + 0.2f, 1f); + } + } + LavaStylesLoader.UpdateLiquidAlphas(); + } + bool flag = false; + for (int j = 0; j < LavaStylesLoader.TotalCount; j++) + { + if (LavaAlpha[j] > 0f && j != LavaStyle) + { + DrawLiquid(isBackground, j, isBackground ? 1f : LavaAlpha[j], drawSinglePassLiquids: false); + flag = true; + } + } + DrawLiquid(isBackground, LavaStyle, flag ? LavaAlpha[LavaStyle] : 1f); + } + + protected internal void DrawLiquid(bool bg = false, int lavaStyle = 0, float Alpha = 1f, bool drawSinglePassLiquids = true) + { + if (!Lighting.NotRetro) // Is Retro + { + oldDrawLava(bg, lavaStyle, Alpha); + return; + } + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + Vector2 drawOffset = (Vector2)(Main.drawToScreen ? Vector2.Zero : new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange)) - Main.screenPosition; + if (bg) + { + DrawLiquidBehindTiles(lavaStyle); + } + LiquidRenderer.Instance.DrawNormalLiquids(Main.spriteBatch, drawOffset, lavaStyle + ModContent.GetContent().Count() + LoaderManager.Get().VanillaCount + 1, Alpha, bg); + if (!bg) + { + TimeLogger.DrawTime(4, stopwatch.Elapsed.TotalMilliseconds); + } + } + + public void oldDrawLava(bool bg = false, int Style = 0, float Alpha = 1f) + { + float num = 0f; + float num12 = 99999f; + float num23 = 99999f; + int num27 = -1; + int num28 = -1; + Vector2 vector = new((float)Main.offScreenRange, (float)Main.offScreenRange); + if (Main.drawToScreen) + { + vector = Vector2.Zero; + } + _ = new Color[4]; + int num29 = (int)(255f * (1f - Main.gfxQuality) + 40f * Main.gfxQuality); + _ = Main.gfxQuality; + _ = Main.gfxQuality; + int num30 = (int)((Main.screenPosition.X - vector.X) / 16f - 1f); + int num31 = (int)((Main.screenPosition.X + (float)Main.screenWidth + vector.X) / 16f) + 2; + int num32 = (int)((Main.screenPosition.Y - vector.Y) / 16f - 1f); + int num2 = (int)((Main.screenPosition.Y + (float)Main.screenHeight + vector.Y) / 16f) + 5; + if (num30 < 5) + { + num30 = 5; + } + if (num31 > Main.maxTilesX - 5) + { + num31 = Main.maxTilesX - 5; + } + if (num32 < 5) + { + num32 = 5; + } + if (num2 > Main.maxTilesY - 5) + { + num2 = Main.maxTilesY - 5; + } + Vector2 vector2; + Rectangle value; + Color newColor; + for (int i = num32; i < num2 + 4; i++) + { + for (int j = num30 - 2; j < num31 + 2; j++) + { + if (Main.tile[j, i].LiquidAmount <= 0 || (Main.tile[j, i].HasUnactuatedTile && Main.tileSolid[Main.tile[j, i].TileType] && !Main.tileSolidTop[Main.tile[j, i].TileType]) || !(Lighting.Brightness(j, i) > 0f || bg) || Main.tile[j, i].LiquidType != LiquidID.Lava) + { + continue; + } + Color color = Lighting.GetColor(j, i); + float num3 = 256 - Main.tile[j, i].LiquidAmount; + num3 /= 32f; + int num4 = 0; + if (Main.tile[j, i].LiquidType == LiquidID.Lava) + { + /*if (Main.drewLava) //disallows the back liquid to not draw until its alpha hits 1f apparently + { + continue; + }*/ + float num5 = Math.Abs((float)(j * 16 + 8) - (Main.screenPosition.X + (float)(Main.screenWidth / 2))); + float num6 = Math.Abs((float)(i * 16 + 8) - (Main.screenPosition.Y + (float)(Main.screenHeight / 2))); + if (num5 < (float)(Main.screenWidth * 2) && num6 < (float)(Main.screenHeight * 2)) + { + float num7 = (float)Math.Sqrt(num5 * num5 + num6 * num6); + float num8 = 1f - num7 / ((float)Main.screenWidth * 0.75f); + if (num8 > 0f) + { + num += num8; + } + } + if (num5 < num12) + { + num12 = num5; + num27 = j * 16 + 8; + } + if (num6 < num23) + { + num23 = num5; + num28 = i * 16 + 8; + } + } + if (num4 == 0) + { + num4 = Style; + } + if (Main.drewLava) + { + continue; + } + float num9 = 0.5f; + if (bg) + { + num9 = 1f; + } + num9 *= Alpha; + Main.DrawTileInWater(-Main.screenPosition + vector, j, i); //lily pads + vector2 = new((float)(j * 16), (float)(i * 16 + (int)num3 * 2)); + value = new(0, 0, 16, 16 - (int)num3 * 2); + bool flag2 = true; + if (Main.tile[j, i + 1].LiquidAmount < 245 && (!Main.tile[j, i + 1].HasUnactuatedTile || !Main.tileSolid[Main.tile[j, i + 1].TileType] || Main.tileSolidTop[Main.tile[j, i + 1].TileType])) + { + float num10 = 256 - Main.tile[j, i + 1].LiquidAmount; + num10 /= 32f; + num9 = 0.5f * (8f - num3) / 4f; + if ((double)num9 > 0.55) + { + num9 = 0.55f; + } + if ((double)num9 < 0.35) + { + num9 = 0.35f; + } + float num11 = num3 / 2f; + if (Main.tile[j, i + 1].LiquidAmount < 200) + { + if (bg) + { + continue; + } + if (Main.tile[j, i - 1].LiquidAmount > 0 && Main.tile[j, i - 1].LiquidAmount > 0) + { + value = new(0, 4, 16, 16); + num9 = 0.5f; + } + else if (Main.tile[j, i - 1].LiquidAmount > 0) + { + vector2 = new((float)(j * 16), (float)(i * 16 + 4)); + value = new(0, 4, 16, 12); + num9 = 0.5f; + } + else if (Main.tile[j, i + 1].LiquidAmount > 0) + { + vector2 = new((float)(j * 16), (float)(i * 16 + (int)num3 * 2 + (int)num10 * 2)); + value = new(0, 4, 16, 16 - (int)num3 * 2); + } + else + { + vector2 = new((float)(j * 16 + (int)num11), (float)(i * 16 + (int)num11 * 2 + (int)num10 * 2)); + value = new(0, 4, 16 - (int)num11 * 2, 16 - (int)num11 * 2); + } + } + else + { + num9 = 0.5f; + value = new(0, 4, 16, 16 - (int)num3 * 2 + (int)num10 * 2); + } + } + else if (Main.tile[j, i - 1].LiquidAmount > 32) + { + value = new(0, 4, value.Width, value.Height); + } + else if (num3 < 1f && Main.tile[j, i - 1].HasUnactuatedTile && Main.tileSolid[Main.tile[j, i - 1].TileType] && !Main.tileSolidTop[Main.tile[j, i - 1].TileType]) + { + vector2 = new((float)(j * 16), (float)(i * 16)); + value = new(0, 4, 16, 16); + } + else + { + for (int k = i + 1; k < i + 6 && (!Main.tile[j, k].HasUnactuatedTile || !Main.tileSolid[Main.tile[j, k].TileType] || Main.tileSolidTop[Main.tile[j, k].TileType]); k++) + { + if (Main.tile[j, k].LiquidAmount < 200) + { + flag2 = false; + break; + } + } + if (!flag2) + { + num9 = 0.5f; + value = new(0, 4, 16, 16); + } + else if (Main.tile[j, i - 1].LiquidAmount > 0) + { + value = new(0, 2, value.Width, value.Height); + } + } + if ((color.R > 20 || color.B > 20 || color.G > 20) && value.Y < 4) + { + int num13 = color.R; + if (color.G > num13) + { + num13 = color.G; + } + if (color.B > num13) + { + num13 = color.B; + } + num13 /= 30; + if (Main.rand.Next(20000) < num13) + { + newColor = new(255, 255, 255); + int num14 = Dust.NewDust(new Vector2((float)(j * 16), vector2.Y - 2f), 16, 8, DustID.TintableDustLighted, 0f, 0f, 254, newColor, 0.75f); + Dust obj = Main.dust[num14]; + obj.velocity *= 0f; + } + } + if (Main.tile[j, i].LiquidType == LiquidID.Lava) + { + num9 *= 1.8f; + if (num9 > 1f) + { + num9 = 1f; + } + if (Main.instance.IsActive && !Main.gamePaused && Dust.lavaBubbles < 200) + { + if (Main.tile[j, i].LiquidAmount > 200 && Main.rand.NextBool(700)) + { + Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, dustLava()); + } + if (value.Y == 0 && Main.rand.NextBool(350)) + { + int num15 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16) + num3 * 2f - 8f), 16, 8, dustLava(), 0f, 0f, 50, default(Color), 1.5f); + Dust obj2 = Main.dust[num15]; + obj2.velocity *= 0.8f; + Main.dust[num15].velocity.X *= 2f; + Main.dust[num15].velocity.Y -= (float)Main.rand.Next(1, 7) * 0.1f; + if (Main.rand.NextBool(10)) + { + Main.dust[num15].velocity.Y *= Main.rand.Next(2, 5); + } + Main.dust[num15].noGravity = true; + } + } + } + float num16 = (float)(int)color.R * num9; + float num17 = (float)(int)color.G * num9; + float num18 = (float)(int)color.B * num9; + float num19 = (float)(int)color.A * num9; + color = new((int)(byte)num16, (int)(byte)num17, (int)(byte)num18, (int)(byte)num19); + if (Lighting.NotRetro && !bg) + { + Color color2 = color; + if (((double)(int)color2.R > (double)num29 * 0.6 || (double)(int)color2.G > (double)num29 * 0.65 || (double)(int)color2.B > (double)num29 * 0.7)) + { + for (int l = 0; l < 4; l++) + { + int num20 = 0; + int num21 = 0; + int width = 8; + int height = 8; + Color color3 = color2; + Color color4 = Lighting.GetColor(j, i); + if (l == 0) + { + color4 = Lighting.GetColor(j - 1, i - 1); + if (value.Height < 8) + { + height = value.Height; + } + } + if (l == 1) + { + color4 = Lighting.GetColor(j + 1, i - 1); + num20 = 8; + if (value.Height < 8) + { + height = value.Height; + } + } + if (l == 2) + { + color4 = Lighting.GetColor(j - 1, i + 1); + num21 = 8; + height = 8 - (16 - value.Height); + } + if (l == 3) + { + color4 = Lighting.GetColor(j + 1, i + 1); + num20 = 8; + num21 = 8; + height = 8 - (16 - value.Height); + } + num16 = (float)(int)color4.R * num9; + num17 = (float)(int)color4.G * num9; + num18 = (float)(int)color4.B * num9; + num19 = (float)(int)color4.A * num9; + color4 = new((int)(byte)num16, (int)(byte)num17, (int)(byte)num18, (int)(byte)num19); + color3.R = (byte)((color2.R * 3 + color4.R * 2) / 5); + color3.G = (byte)((color2.G * 3 + color4.G * 2) / 5); + color3.B = (byte)((color2.B * 3 + color4.B * 2) / 5); + color3.A = (byte)((color2.A * 3 + color4.A * 2) / 5); + Main.spriteBatch.Draw(Textures.block[num4].Value, vector2 - Main.screenPosition + new Vector2((float)num20, (float)num21) + vector, (Rectangle?)new Rectangle(value.X + num20, value.Y + num21, width, height), color3, 0f, default(Vector2), 1f, (SpriteEffects)0, 0f); + } + } + else + { + Main.spriteBatch.Draw(Textures.block[num4].Value, vector2 - Main.screenPosition + vector, (Rectangle?)value, color, 0f, default(Vector2), 1f, (SpriteEffects)0, 0f); + } + } + else + { + if (value.Y < 4) + { + value.X += (int)(Main.wFrame * 18f); + } + Main.spriteBatch.Draw(Textures.block[num4].Value, vector2 - Main.screenPosition + vector, (Rectangle?)value, color, 0f, default(Vector2), 1f, (SpriteEffects)0, 0f); + } + if (!Main.tile[j, i + 1].IsHalfBlock) + { + continue; + } + color = Lighting.GetColor(j, i + 1); + num16 = (float)(int)color.R * num9; + num17 = (float)(int)color.G * num9; + num18 = (float)(int)color.B * num9; + num19 = (float)(int)color.A * num9; + color = new((int)(byte)num16, (int)(byte)num17, (int)(byte)num18, (int)(byte)num19); + vector2 = new((float)(j * 16), (float)(i * 16 + 16)); + Main.spriteBatch.Draw(Textures.block[num4].Value, vector2 - Main.screenPosition + vector, (Rectangle?)new Rectangle(0, 4, 16, 8), color, 0f, default(Vector2), 1f, (SpriteEffects)0, 0f); + float num22 = 6f; + float num24 = 0.75f; + num22 = 4f; + num24 = 0.5f; + for (int m = 0; (float)m < num22; m++) + { + int num25 = i + 2 + m; + if (WorldGen.SolidTile(j, num25)) + { + break; + } + float num26 = 1f - (float)m / num22; + num26 *= num24; + vector2 = new((float)(j * 16), (float)(num25 * 16 - 2)); + Main.spriteBatch.Draw(Textures.block[num4].Value, vector2 - Main.screenPosition + vector, (Rectangle?)new Rectangle(0, 18, 16, 16), color * num26, 0f, default(Vector2), 1f, (SpriteEffects)0, 0f); + } + } + } + if (!Main.drewLava) + { + Main.ambientLavaX = num27; + Main.ambientLavaY = num28; + Main.ambientLavaStrength = num; + } + Main.drewLava = true; + } + + private void DrawLiquidBehindTiles(int lavaStyleOverride = -1) + { + Vector2 unscaledPosition = Main.Camera.UnscaledPosition; + Vector2 vector = new((float)Main.offScreenRange, (float)Main.offScreenRange); + if (Main.drawToScreen) + { + vector = Vector2.Zero; + } + GetScreenDrawArea(unscaledPosition, vector + (Main.Camera.UnscaledPosition - Main.Camera.ScaledPosition), out var firstTileX, out var lastTileX, out var firstTileY, out var lastTileY); + for (int i = firstTileY; i < lastTileY + 4; i++) + { + for (int j = firstTileX - 2; j < lastTileX + 2; j++) + { + Tile tile = Main.tile[j, i]; + if (tile != null) + { + DrawTile_LiquidBehindTile(solidLayer: false, inFrontOfPlayers: false, lavaStyleOverride, unscaledPosition, vector, j, i, tile); + } + } + } + } + + private void GetScreenDrawArea(Vector2 screenPosition, Vector2 offSet, out int firstTileX, out int lastTileX, out int firstTileY, out int lastTileY) + { + firstTileX = (int)((screenPosition.X - offSet.X) / 16f - 1f); + lastTileX = (int)((screenPosition.X + (float)Main.screenWidth + offSet.X) / 16f) + 2; + firstTileY = (int)((screenPosition.Y - offSet.Y) / 16f - 1f); + lastTileY = (int)((screenPosition.Y + (float)Main.screenHeight + offSet.Y) / 16f) + 5; + if (firstTileX < 4) + { + firstTileX = 4; + } + if (lastTileX > Main.maxTilesX - 4) + { + lastTileX = Main.maxTilesX - 4; + } + if (firstTileY < 4) + { + firstTileY = 4; + } + if (lastTileY > Main.maxTilesY - 4) + { + lastTileY = Main.maxTilesY - 4; + } + if (Main.sectionManager.AnyUnfinishedSections) + { + TimeLogger.DetailedDrawReset(); + WorldGen.SectionTileFrameWithCheck(firstTileX, firstTileY, lastTileX, lastTileY); + TimeLogger.DetailedDrawTime(5); + } + if (Main.sectionManager.AnyNeedRefresh) + { + WorldGen.RefreshSections(firstTileX, firstTileY, lastTileX, lastTileY); + } + } + + public void DrawTile_LiquidBehindTile(bool solidLayer, bool inFrontOfPlayers, int waterStyleOverride, Vector2 screenPosition, Vector2 screenOffset, int tileX, int tileY, Tile tileCache) + { + Tile tile = Main.tile[tileX + 1, tileY]; + Tile tile2 = Main.tile[tileX - 1, tileY]; + Tile tile3 = Main.tile[tileX, tileY - 1]; + Tile tile4 = Main.tile[tileX, tileY + 1]; + if ((tileCache.LiquidType != LiquidID.Lava && tile.LiquidType != LiquidID.Lava && tile2.LiquidType != LiquidID.Lava && tile3.LiquidType != LiquidID.Lava && tile4.LiquidType != LiquidID.Lava)) + { + return; + } + //bool[] _tileSolidTop = (bool[])typeof(TileDrawing).GetField("_tileSolidTop", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance).GetValue(null); + if (!tileCache.HasTile || tileCache.IsActuated /*|| _tileSolidTop[tileCache.TileType]*/ || (tileCache.IsHalfBlock && (tile2.LiquidAmount > 160 || tile.LiquidAmount > 160) && Main.instance.waterfallManager.CheckForWaterfall(tileX, tileY)) || (TileID.Sets.BlocksWaterDrawingBehindSelf[tileCache.TileType] && tileCache.Slope == 0)) + { + return; + } + int num = 0; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + bool flag4 = false; + bool flag5 = false; + int num2 = 0; + bool flag6 = true; + int num3 = (int)tileCache.Slope; + int num4 = (int)tileCache.BlockType; + if (tileCache.TileType == 546 && tileCache.LiquidAmount > 0) + { + flag5 = true; + flag4 = true; + flag = true; + flag2 = true; + num = tileCache.LiquidAmount; + } + else + { + if (tileCache.LiquidAmount > 0 && num4 != 0 && (num4 != 1 || tileCache.LiquidAmount > 160)) + { + flag5 = true; + if (tileCache.LiquidAmount > num) + { + num = tileCache.LiquidAmount; + } + } + if (tile2.LiquidAmount > 0 && num3 != 1 && num3 != 3) + { + flag = true; + if (tile2.LiquidAmount > num) + { + num = tile2.LiquidAmount; + } + } + if (tile.LiquidAmount > 0 && num3 != 2 && num3 != 4) + { + flag2 = true; + if (tile.LiquidAmount > num) + { + num = tile.LiquidAmount; + } + } + if (tile3.LiquidAmount > 0 && num3 != 3 && num3 != 4) + { + flag3 = true; + } + if (tile4.LiquidAmount > 0 && num3 != 1 && num3 != 2) + { + if (tile4.LiquidAmount > 240) + { + flag4 = true; + } + } + } + if (!flag3 && !flag4 && !flag && !flag2 && !flag5) + { + return; + } + if (waterStyleOverride != -1) + { + LavaStyle = waterStyleOverride; + } + if (num2 == 0) + { + num2 = LavaStyle; + } + Lighting.GetCornerColors(tileX, tileY, out var vertices); + Vector2 vector = new((float)(tileX * 16), (float)(tileY * 16)); + Rectangle liquidSize = new(0, 4, 16, 16); + if (flag4 && (flag || flag2)) + { + flag = true; + flag2 = true; + } + if (tileCache.HasTile && (Main.tileSolidTop[tileCache.TileType] || !Main.tileSolid[tileCache.TileType])) + { + return; + } + if ((!flag3 || !(flag || flag2)) && !(flag4 && flag3)) + { + if (flag3) + { + liquidSize = new(0, 4, 16, 4); + if (tileCache.IsHalfBlock || tileCache.Slope != 0) + { + liquidSize = new(0, 4, 16, 12); + } + } + else if (flag4 && !flag && !flag2) + { + vector = new((float)(tileX * 16), (float)(tileY * 16 + 12)); + liquidSize = new(0, 4, 16, 4); + } + else + { + float num8 = (float)(256 - num) / 32f; + int y = 4; + if (tile3.LiquidAmount == 0 && (num4 != 0 || !WorldGen.SolidTile(tileX, tileY - 1))) + { + y = 0; + } + int num5 = (int)num8 * 2; + if (tileCache.Slope != 0) + { + vector = new((float)(tileX * 16), (float)(tileY * 16 + num5)); + liquidSize = new(0, num5, 16, 16 - num5); + } + else if ((flag && flag2) || tileCache.IsHalfBlock) + { + vector = new((float)(tileX * 16), (float)(tileY * 16 + num5)); + liquidSize = new(0, y, 16, 16 - num5); + } + else if (flag) + { + vector = new((float)(tileX * 16), (float)(tileY * 16 + num5)); + liquidSize = new(0, y, 4, 16 - num5); + } + else + { + vector = new((float)(tileX * 16 + 12), (float)(tileY * 16 + num5)); + liquidSize = new(0, y, 4, 16 - num5); + } + } + } + Vector2 position = vector - screenPosition + screenOffset; + float num6 = 1f; + if ((double)tileY <= Main.worldSurface || num6 > 1f) + { + num6 = 1f; + if (tileCache.WallType == 21) + { + num6 = 0.9f; + } + else if (tileCache.WallType > 0) + { + num6 = 0.6f; + } + } + if (tileCache.IsHalfBlock && tile3.LiquidAmount > 0 && tileCache.WallType > 0) + { + num6 = 0f; + } + if (num3 == 4 && tile2.LiquidAmount == 0 && !WorldGen.SolidTile(tileX - 1, tileY)) + { + num6 = 0f; + } + if (num3 == 3 && tile.LiquidAmount == 0 && !WorldGen.SolidTile(tileX + 1, tileY)) + { + num6 = 0f; + } + ref Color bottomLeftColor = ref vertices.BottomLeftColor; + bottomLeftColor *= num6; + ref Color bottomRightColor = ref vertices.BottomRightColor; + bottomRightColor *= num6; + ref Color topLeftColor = ref vertices.TopLeftColor; + topLeftColor *= num6; + ref Color topRightColor = ref vertices.TopRightColor; + topRightColor *= num6; + bool flag7 = false; + if (flag6) + { + for (int i = 0; i < LavaStylesLoader.TotalCount; i++) + { + if (LavaAlpha[i] > 0f && i != num2) + { + DrawPartialLiquid(!solidLayer, tileCache, ref position, ref liquidSize, i, ref vertices); + flag7 = true; + break; + } + } + } + VertexColors colors = vertices; + float num7 = (flag7 ? LavaAlpha[num2] : 1f); + ref Color bottomLeftColor2 = ref colors.BottomLeftColor; + bottomLeftColor2 *= num7; + ref Color bottomRightColor2 = ref colors.BottomRightColor; + bottomRightColor2 *= num7; + ref Color topLeftColor2 = ref colors.TopLeftColor; + topLeftColor2 *= num7; + ref Color topRightColor2 = ref colors.TopRightColor; + topRightColor2 *= num7; + DrawPartialLiquid(!solidLayer, tileCache, ref position, ref liquidSize, num2, ref colors); + } + + private void DrawPartialLiquid(bool behindBlocks, Tile tileCache, ref Vector2 position, ref Rectangle liquidSize, int liquidType, ref VertexColors colors) + { + int num = (int)tileCache.Slope; + bool flag = !TileID.Sets.BlocksWaterDrawingBehindSelf[tileCache.TileType]; + if (!behindBlocks) + { + flag = false; + } + if (flag || num == 0) + { + Main.tileBatch.Draw(Textures.block[liquidType].Value, position, liquidSize, colors, default(Vector2), 1f, (SpriteEffects)0); + return; + } + liquidSize.X += 18 * (num - 1); + switch (num) + { + case 1: + Main.tileBatch.Draw(Textures.slope[liquidType].Value, position, liquidSize, colors, Vector2.Zero, 1f, (SpriteEffects)0); + break; + case 2: + Main.tileBatch.Draw(Textures.slope[liquidType].Value, position, liquidSize, colors, Vector2.Zero, 1f, (SpriteEffects)0); + break; + case 3: + Main.tileBatch.Draw(Textures.slope[liquidType].Value, position, liquidSize, colors, Vector2.Zero, 1f, (SpriteEffects)0); + break; + case 4: + Main.tileBatch.Draw(Textures.slope[liquidType].Value, position, liquidSize, colors, Vector2.Zero, 1f, (SpriteEffects)0); + break; + } + } + + public void InitialDrawLavafall(WaterfallManager waterfallManager) + { + for (int i = 0; i < LavaStylesLoader.TotalCount; i++) + { + if (LavaAlpha[i] > 0f) + { + DrawLavafall(waterfallManager, i, LavaAlpha[i]); + } + } + } + + internal void DrawLavafall(WaterfallManager waterfallManager, int Style = 0, float Alpha = 1f) + { + int waterfallDist = (int)typeof(WaterfallManager).GetField("waterfallDist", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance).GetValue(waterfallManager); + int rainFrameForeground = (int)typeof(WaterfallManager).GetField("rainFrameForeground", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance).GetValue(waterfallManager); + int rainFrameBackground = (int)typeof(WaterfallManager).GetField("rainFrameBackground", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance).GetValue(waterfallManager); + int snowFrameForeground = (int)typeof(WaterfallManager).GetField("snowFrameForeground", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance).GetValue(waterfallManager); + WaterfallData[] waterfalls = (WaterfallData[])typeof(WaterfallManager).GetField("waterfalls", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance).GetValue(waterfallManager); + int currentMax = (int)typeof(WaterfallManager).GetField("currentMax", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance).GetValue(waterfallManager); + int slowFrame = (int)typeof(WaterfallManager).GetField("slowFrame", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance).GetValue(waterfallManager); + Main.tileSolid[546] = false; + float num = 0f; + float num12 = 99999f; + float num23 = 99999f; + int num34 = -1; + int num45 = -1; + float num47 = 0f; + float num48 = 99999f; + float num49 = 99999f; + int num50 = -1; + int num2 = -1; + Rectangle value = default(Rectangle); + Rectangle value2 = default(Rectangle); + Vector2 origin = default(Vector2); + for (int i = 0; i < currentMax; i++) + { + if (waterfalls[i].type != 1) + { + continue; + } + int num3 = 0; + int num4 = Style; + int num5 = waterfalls[i].x; + int num6 = waterfalls[i].y; + int num7 = 0; + int num8 = 0; + int num9 = 0; + int num10 = 0; + int num11 = 0; + int num13 = 0; + int num14; + int num15; + if (waterfalls[i].stopAtStep == 0) + { + continue; + } + num14 = 32 * slowFrame; + int num22 = 0; + num15 = waterfallDist; + Color color4 = Color.White; + for (int k = 0; k < num15; k++) + { + if (num22 >= 2) + { + break; + } + typeof(WaterfallManager).GetMethod("AddLight", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).Invoke(null, new object[] { 1, num5, num6 }); + Tile tile3 = Main.tile[num5, num6]; + if (tile3.HasUnactuatedTile && Main.tileSolid[tile3.TileType] && !Main.tileSolidTop[tile3.TileType] && !TileID.Sets.Platforms[tile3.TileType] && tile3.BlockType == 0) + { + break; + } + Tile tile4 = Main.tile[num5 - 1, num6]; + Tile tile5 = Main.tile[num5, num6 + 1]; + Tile tile6 = Main.tile[num5 + 1, num6]; + if (WorldGen.SolidTile(tile5) && !tile3.IsHalfBlock) + { + num3 = 8; + } + else if (num8 != 0) + { + num3 = 0; + } + int num24 = 0; + int num25 = num10; + int num26 = 0; + int num27 = 0; + bool flag2 = false; + if (tile5.TopSlope && !tile3.IsHalfBlock && tile5.TileType != 19) + { + flag2 = true; + if (tile5.Slope == (SlopeType)1) + { + num24 = 1; + num26 = 1; + num9 = 1; + num10 = num9; + } + else + { + num24 = -1; + num26 = -1; + num9 = -1; + num10 = num9; + } + num27 = 1; + } + else if ((!WorldGen.SolidTile(tile5) && !tile5.BottomSlope && !tile3.IsHalfBlock) || (!tile5.HasTile && !tile3.IsHalfBlock)) + { + num22 = 0; + num27 = 1; + num26 = 0; + } + else if ((WorldGen.SolidTile(tile4) || tile4.TopSlope || tile4.LiquidAmount > 0) && !WorldGen.SolidTile(tile6) && tile6.LiquidAmount == 0) + { + if (num9 == -1) + { + num22++; + } + num26 = 1; + num27 = 0; + num9 = 1; + } + else if ((WorldGen.SolidTile(tile6) || tile6.TopSlope || tile6.LiquidAmount > 0) && !WorldGen.SolidTile(tile4) && tile4.LiquidAmount == 0) + { + if (num9 == 1) + { + num22++; + } + num26 = -1; + num27 = 0; + num9 = -1; + } + else if (((!WorldGen.SolidTile(tile6) && !tile3.TopSlope) || tile6.LiquidAmount == 0) && !WorldGen.SolidTile(tile4) && !tile3.TopSlope && tile4.LiquidAmount == 0) + { + num27 = 0; + num26 = num9; + } + else + { + num22++; + num27 = 0; + num26 = 0; + } + if (num22 >= 2) + { + num9 *= -1; + num26 *= -1; + } + Color color5 = Lighting.GetColor(num5, num6); + if (k > 50) + { + typeof(WaterfallManager).GetMethod("TrySparkling", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).Invoke(null, new object[] { num5, num6, num9, color5 }); + } + float alpha = GetLavafallAlpha(Alpha, num15, num6, k, tile3); + color5 = (Color)typeof(WaterfallManager).GetMethod("StylizeColor", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).Invoke(null, new object[] { alpha, num15, 1, num6, k, tile3, color5 }); + float num33 = Math.Abs((float)(num5 * 16 + 8) - (Main.screenPosition.X + (float)(Main.screenWidth / 2))); + float num35 = Math.Abs((float)(num6 * 16 + 8) - (Main.screenPosition.Y + (float)(Main.screenHeight / 2))); + if (num33 < (float)(Main.screenWidth * 2) && num35 < (float)(Main.screenHeight * 2)) + { + float num36 = (float)Math.Sqrt(num33 * num33 + num35 * num35); + float num37 = 1f - num36 / ((float)Main.screenWidth * 0.75f); + if (num37 > 0f) + { + num += num37; + } + } + if (num33 < num12) + { + num12 = num33; + num34 = num5 * 16 + 8; + } + if (num35 < num23) + { + num23 = num33; + num45 = num6 * 16 + 8; + } + int num38 = tile3.LiquidAmount / 16; + if (flag2 && num9 != num25) + { + int num39 = 2; + if (num25 == 1) + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16 + 16 - num39)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38 - num39), color5, (SpriteEffects)1); + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16 + 16 - num39)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38 - num39), color5, (SpriteEffects)0); + } + } + if (num7 == 0 && num24 != 0 && num8 == 1 && num9 != num10) + { + num24 = 0; + num9 = num10; + color5 = Color.White; + if (num9 == 1) + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16 + 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color5, (SpriteEffects)1); + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16 + 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color5, (SpriteEffects)1); + } + } + if (num11 != 0 && num26 == 0 && num27 == 1) + { + if (num9 == 1) + { + if (num13 != num4) + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3 + 8)) - Main.screenPosition, new Rectangle(num14, 0, 16, 16 - num38 - 8), color4, (SpriteEffects)1); + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3 + 8)) - Main.screenPosition, new Rectangle(num14, 0, 16, 16 - num38 - 8), color5, (SpriteEffects)1); + } + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3 + 8)) - Main.screenPosition, new Rectangle(num14, 0, 16, 16 - num38 - 8), color5, (SpriteEffects)0); + } + } + if (num3 == 8 && num8 == 1 && num11 == 0) + { + if (num10 == -1) + { + if (num13 != num4) + { + DrawLavafall(num13, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 8), color4, (SpriteEffects)0); + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 8), color5, (SpriteEffects)0); + } + } + else if (num13 != num4) + { + DrawLavafall(num13, num5, num6, alpha, new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 8), color4, (SpriteEffects)1); + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 8), color5, (SpriteEffects)1); + } + } + if (num24 != 0 && num7 == 0) + { + if (num25 == 1) + { + if (num13 != num4) + { + DrawLavafall(num13, num5, num6, alpha, new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color4, (SpriteEffects)1); + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color5, (SpriteEffects)1); + } + } + else if (num13 != num4) + { + DrawLavafall(num13, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color4, (SpriteEffects)0); + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color5, (SpriteEffects)0); + } + } + if (num27 == 1 && num24 == 0 && num11 == 0) + { + if (num9 == -1) + { + if (num8 == 0) + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle(num14, 0, 16, 16 - num38), color5, (SpriteEffects)0); + } + else if (num13 != num4) + { + DrawLavafall(num13, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color4, (SpriteEffects)0); + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color5, (SpriteEffects)0); + } + } + else if (num8 == 0) + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle(num14, 0, 16, 16 - num38), color5, (SpriteEffects)1); + } + else if (num13 != num4) + { + DrawLavafall(num13, num5, num6, alpha, new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color4, (SpriteEffects)1); + } + else + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle(num14, 24, 32, 16 - num38), color5, (SpriteEffects)1); + } + } + else + { + switch (num26) + { + case 1: + if (Main.tile[num5, num6].LiquidAmount > 0 && !Main.tile[num5, num6].IsHalfBlock) + { + break; + } + if (num24 == 1) + { + for (int m = 0; m < 8; m++) + { + int num43 = m * 2; + int num44 = 14 - m * 2; + int num46 = num43; + num3 = 8; + if (num7 == 0 && m < 2) + { + num46 = 4; + } + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16 + num43), (float)(num6 * 16 + num3 + num46)) - Main.screenPosition, new Rectangle(16 + num14 + num44, 0, 2, 16 - num3), color5, (SpriteEffects)1); + } + } + else + { + int height2 = 16; + if (TileID.Sets.BlocksWaterDrawingBehindSelf[Main.tile[num5, num6].TileType]) + { + height2 = 8; + } + else if (TileID.Sets.BlocksWaterDrawingBehindSelf[Main.tile[num5, num6 + 1].TileType]) + { + height2 = 8; + } + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle(16 + num14, 0, 16, height2), color5, (SpriteEffects)1); + } + break; + case -1: + if (Main.tile[num5, num6].LiquidAmount > 0 && !Main.tile[num5, num6].IsHalfBlock) + { + break; + } + if (num24 == -1) + { + for (int l = 0; l < 8; l++) + { + int num40 = l * 2; + int num41 = l * 2; + int num42 = 14 - l * 2; + num3 = 8; + if (num7 == 0 && l > 5) + { + num42 = 4; + } + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16 + num40), (float)(num6 * 16 + num3 + num42)) - Main.screenPosition, new Rectangle(16 + num14 + num41, 0, 2, 16 - num3), color5, (SpriteEffects)1); + } + } + else + { + int height = 16; + if (TileID.Sets.BlocksWaterDrawingBehindSelf[Main.tile[num5, num6].TileType]) + { + height = 8; + } + else if (TileID.Sets.BlocksWaterDrawingBehindSelf[Main.tile[num5, num6 + 1].TileType]) + { + height = 8; + } + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle(16 + num14, 0, 16, height), color5, (SpriteEffects)0); + } + break; + case 0: + if (num27 == 0) + { + if (Main.tile[num5, num6].LiquidAmount <= 0 || Main.tile[num5, num6].IsHalfBlock) + { + DrawLavafall(num4, num5, num6, alpha, new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle(16 + num14, 0, 16, 16), color5, (SpriteEffects)0); + } + k = 1000; + } + break; + } + } + if (tile3.LiquidAmount > 0 && !tile3.IsHalfBlock) + { + k = 1000; + } + num8 = num27; + num10 = num9; + num7 = num26; + num5 += num26; + num6 += num27; + num11 = num24; + color4 = color5; + if (num13 != num4) + { + num13 = num4; + } + if ((tile4.HasTile && (tile4.TileType == 189 || tile4.TileType == 196)) || (tile6.HasTile && (tile6.TileType == 189 || tile6.TileType == 196)) || (tile5.HasTile && (tile5.TileType == 189 || tile5.TileType == 196))) + { + num15 = (int)(40f * ((float)Main.maxTilesX / 4200f) * Main.gfxQuality); + } + } + } + Main.ambientWaterfallX = num34; + Main.ambientWaterfallY = num45; + Main.ambientWaterfallStrength = num; + Main.ambientLavafallX = num50; + Main.ambientLavafallY = num2; + Main.ambientLavafallStrength = num47; + Main.tileSolid[546] = true; + } + + private void DrawLavafall(int waterfallType, int x, int y, float opacity, Vector2 position, Rectangle sourceRect, Color color, SpriteEffects effects) + { + Texture2D value = Textures.fall[waterfallType].Value; + Main.spriteBatch.Draw(value, position, (Rectangle?)sourceRect, color, 0f, default, 1f, effects, 0f); + } + + private static float GetLavafallAlpha(float Alpha, int maxSteps, int y, int s, Tile tileCache) + { + float num = (tileCache.WallType != 0 || !((double)y < Main.worldSurface)) ? (1f * Alpha) : Alpha; + if (s > maxSteps - 10) + { + num *= (float)(maxSteps - s) / 10f; + } + return num; + } + + public static int dustLava() + { + if (LavaStyle >= 1) + { + return LavaStylesLoader.Get(LavaStyle).GetSplashDust(); + } + else + { + return DustID.Lava; + } + } + + //just better as a method rather than hardcoded type values + public static int goreLava() + { + if (LavaStyle >= 1) + { + return LavaStylesLoader.Get(LavaStyle).GetDropletGore(); + } + else + { + return GoreID.LavaDrip; + } + } + } +} diff --git a/Systems/LightingEffectsSystem.cs b/Systems/Graphic/LightingEffectsSystem.cs similarity index 96% rename from Systems/LightingEffectsSystem.cs rename to Systems/Graphic/LightingEffectsSystem.cs index 679a7137dc..e9568a49a7 100644 --- a/Systems/LightingEffectsSystem.cs +++ b/Systems/Graphic/LightingEffectsSystem.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.Skies; @@ -66,6 +67,10 @@ namespace CalamityMod.Systems } } } + + // Bat Wings give stronger night vision + if (Main.LocalPlayer.wingsLogic == (int)VanillaWingID.BatWings) + scale *= 1.08f; } public override void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor) diff --git a/Systems/Graphic/ModLavaStyle.cs b/Systems/Graphic/ModLavaStyle.cs new file mode 100644 index 0000000000..bc015799fb --- /dev/null +++ b/Systems/Graphic/ModLavaStyle.cs @@ -0,0 +1,263 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent.Liquid; +using Terraria.GameContent; +using Terraria.Graphics; +using Terraria.ModLoader; +using System.Linq; +using Terraria.ID; +using Microsoft.Xna.Framework; +using CalamityMod.Items.Potions.Alcohol; + +namespace CalamityMod.Systems +{ + public abstract class ModLavaStyle : ModTexturedType + { + /// + /// The ID of the lava style. + /// + public int Slot { get; private set; } = -1; + + public override string Name => base.Name; + + public override string Texture => base.Texture; + + public virtual string BlockTexture => Texture + "_Block"; + + public virtual string SlopeTexture => Texture + "_Slope"; + + public virtual string WaterfallTexture => Texture + "_Waterfall"; + + protected sealed override void Register() + { + Slot = LavaStylesLoader.Register(this); + } + + public sealed override void SetupContent() + { + SetStaticDefaults(); + } + + /// + /// Allows you to determine how much light this lava emits.
+ /// It can also let you light up the block in front of this lava.
+ /// Keep in mind this also effects what color the lavafalls emit
+ /// See for vanilla tile light values to use as a reference.
+ ///
+ /// The x position in tile coordinates. + /// The y position in tile coordinates. + /// The red component of light, usually a value between 0 and 1 + /// The green component of light, usually a value between 0 and 1 + /// The blue component of light, usually a value between 0 and 1 + public virtual void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.55f; + g = 0.33f; + b = 0.11f; + } + + /// + /// Allows water styles to manipulate what color the liquid is drawn to, this can allow waters to be see-throughable to see backgrounds (surface and underground backgrounds not walls) + /// + /// X position of the water + /// Y position of the water + /// The vertexColor of the water color, this is both used to get the current color and to set the color of the water + public virtual void DrawColor(int x, int y, ref VertexColors liquidColor, bool isSlope) + { + } + + /// + /// The ID of the dust that is created when anything splashes in lava. + /// + public virtual int GetSplashDust() + { + return DustID.Lava; + } + + /// + /// The ID of the gore that represents droplets of lava falling down from a block. Return (or another existing droplet gore). + /// + public virtual int GetDropletGore() + { + return GoreID.LavaDrip; + } + + /// + /// Return true if the player is in the correct zone to activate the lava. + /// + /// + public virtual bool IsLavaActive() + { + return false; + } + + /// + /// Return false if the waterfall made by the lavastyle should have a glowmask + /// + /// + public virtual bool LavafallGlowmask() + { + return true; + } + + /// + /// Allows your lavastyle to inflict debuffs to Players and NPCs when they enter your lava style + /// + /// The Player that is inflicted with the debuff apon entering the lavastyle + /// The duration of the OnFire! debuff. This allows for easy replacement of OnFire + public virtual void InflictDebuff(Player player, int onfireDuration) + { + } + } + + public class LavaStylesLoader : ModSystem + { + private static readonly MethodInfo ResizeArrayMethodInfo; + + static LavaStylesLoader() + { + ResizeArrayMethodInfo = typeof(ModContent).GetMethod("ResizeArrays", BindingFlags.NonPublic | BindingFlags.Static); + } + + private static void ResizeArrays(ResizeArray_orig orig, bool unloading) + { + orig.Invoke(unloading); + int totalCount = TotalCount; + Array.Resize(ref LavaRenderingSystem.Textures.liquid, totalCount); + Array.Resize(ref LavaRenderingSystem.Textures.block, totalCount); + Array.Resize(ref LavaRenderingSystem.Textures.slope, totalCount); + Array.Resize(ref LavaRenderingSystem.Textures.fall, totalCount); + Array.Resize(ref LavaRenderingSystem.LavaAlpha, totalCount); + Array.Resize(ref LavaRenderingSystem.AlphaSave, totalCount); + } + + private static readonly List _content = []; + + public static IReadOnlyList Content => _content; + + public static int VanillaCount => 1; + + public static int ModCount => _content.Count; + + public static int TotalCount => VanillaCount + ModCount; + + public override void Load() + { + if (ResizeArrayMethodInfo != null) + { + MonoModHooks.Add(ResizeArrayMethodInfo, ResizeArrays); + } + } + + public override void PostSetupContent() + { + foreach (ModLavaStyle item in Content) + { + int Slot = item.Slot; + LavaRenderingSystem.Textures.liquid[Slot] = ModContent.Request(item.Texture, AssetRequestMode.AsyncLoad); + LavaRenderingSystem.Textures.block[Slot] = ModContent.Request(item.BlockTexture, AssetRequestMode.AsyncLoad); + LavaRenderingSystem.Textures.slope[Slot] = ModContent.Request(item.SlopeTexture, AssetRequestMode.AsyncLoad); + LavaRenderingSystem.Textures.fall[Slot] = ModContent.Request(item.WaterfallTexture, AssetRequestMode.AsyncLoad); + } + } + + public static ModLavaStyle Get(int type) + { + type -= VanillaCount; + return type >= 0 && type < _content.Count ? _content[type] : null; + } + + internal static int Register(ModLavaStyle instance) + { + int type = TotalCount; + ModTypeLookup.Register(instance); + _content.Add(instance); + return type; + } + + private delegate void ResizeArray_orig(bool unloading); + + public static void UpdateLiquidAlphas() + { + if (LavaRenderingSystem.LavaStyle >= VanillaCount) + { + for (int i = 0; i < VanillaCount; i++) + { + LavaRenderingSystem.LavaAlpha[i] -= 0.2f; + if (LavaRenderingSystem.LavaAlpha[i] < 0f) + { + LavaRenderingSystem.LavaAlpha[i] = 0f; + } + } + } + foreach (ModLavaStyle item in Content) + { + int type = item.Slot; + if (LavaRenderingSystem.LavaStyle == type) + { + LavaRenderingSystem.LavaAlpha[type] += 0.2f; + if (LavaRenderingSystem.LavaAlpha[type] > 1f) + { + LavaRenderingSystem.LavaAlpha[type] = 1f; + } + } + else + { + LavaRenderingSystem.LavaAlpha[type] -= 0.2f; + if (LavaRenderingSystem.LavaAlpha[type] < 0f) + { + LavaRenderingSystem.LavaAlpha[type] = 0f; + } + } + } + } + + public static void ModifyLightSetup(int i, int j, int style, ref float r, ref float g, ref float b) + { + ModLavaStyle lavaStyle = Get(style); + if (lavaStyle != null) + { + lavaStyle?.ModifyLight(i, j, ref r, ref g, ref b); + } + } + + internal static void DrawColorSetup(int x, int y, int type, ref VertexColors liquidColor, bool isSlope = false) + { + ModLavaStyle styles = Get(type); + if (styles != null) + { + styles?.DrawColor(x, y, ref liquidColor, isSlope); + } + } + + public static void InflictDebuff(Player player, int type, int onfireDuration) + { + ModLavaStyle lavaStyle = Get(type); + if (lavaStyle != null) + { + lavaStyle?.InflictDebuff(player, onfireDuration); + } + } + + public static void IsLavaActive() + { + foreach (ModLavaStyle item in Content) + { + int type = item.Slot; + ModLavaStyle lavaStyle = Get(type); + if (lavaStyle != null) + { + bool? flag = lavaStyle?.IsLavaActive(); + if (flag != null && flag == true) + { + LavaRenderingSystem.LavaStyle = lavaStyle.Slot; + } + } + } + } + } +} diff --git a/Systems/Graphic/MultiVariantWallDrawingSystem.cs b/Systems/Graphic/MultiVariantWallDrawingSystem.cs new file mode 100644 index 0000000000..7bd266dac7 --- /dev/null +++ b/Systems/Graphic/MultiVariantWallDrawingSystem.cs @@ -0,0 +1,72 @@ +using CalamityMod.ILEditing; +using CalamityMod.Walls; +using Microsoft.Xna.Framework; +using MonoMod.Cil; +using Terraria; +using Terraria.GameContent.Drawing; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + internal sealed class MultiVariantWallDrawingSystem : ModSystem + { + public sealed override void Load() + { + IL_WallDrawing.DrawWalls += DrawingFrameOffsetForWallSupport; + } + + private void DrawingFrameOffsetForWallSupport(ILContext il) + { + var cursor = new ILCursor(il); + + if (!cursor.TryGotoNext(x => x.MatchCall("wallFrameY"))) + { + LogILFailure("call::Tile.wallFrameY was not found!"); + return; + } + + int tileLocalIdx = -1; + int rectLocalIdx = -1; + if (!cursor.TryGotoPrev(x => x.MatchLdloca(out tileLocalIdx))) // First ldloca should be "tile" + { + LogILFailure("Ldloca::tile was not found!"); + return; + } + + if (!cursor.TryGotoPrev(x => x.MatchLdloca(out rectLocalIdx))) // Second ldloca should be "value" which is Rectangle for drawing + { + LogILFailure("Ldloca::rect was not found!"); + return; + } + + if (!cursor.TryGotoNext(MoveType.After, x => x.MatchStfld(nameof(Rectangle.Y)))) + { + LogILFailure("Stfld::Rectangle.Y was not found!"); + return; + } + + cursor.EmitLdloc(tileLocalIdx); + cursor.EmitLdloca(rectLocalIdx); + cursor.EmitDelegate((Tile tile, ref Rectangle drawRect) => + { + if (ModContent.GetModWall(tile.WallType) is MultiVariantModWall mvWall) + { + tile.TilePos(out var i, out var j); + + int offsetX = 0; + int offsetY = 0; + + mvWall.PopulateWallVariant(i, j, ref offsetX, ref offsetY); + + drawRect.X += offsetX; + drawRect.Y += offsetY; + } + }); + } + + private static void LogILFailure(string reason) + { + ILChanges.LogFailure("Support for Wall FrameOffset", reason); + } + } +} diff --git a/Systems/Graphic/SkyEffectLoaderSystem.cs b/Systems/Graphic/SkyEffectLoaderSystem.cs new file mode 100644 index 0000000000..8e8588063f --- /dev/null +++ b/Systems/Graphic/SkyEffectLoaderSystem.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.Yharon; +using CalamityMod.Skies; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + [Autoload(Side = ModSide.Client)] + internal sealed class SkyEffectLoaderSystem : ModSystem + { + public override void Load() + { + 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(); + + Filters.Scene["CalamityMod:CalamitasRun3"] = new Filter(new CalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.6f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:CalamitasRun3"] = new CalSky(); + + Filters.Scene["CalamityMod:PlaguebringerGoliath"] = new Filter(new PbGScreenShaderData("FilterMiniTower").UseColor(0.2f, 0.6f, 0.2f).UseOpacity(0.35f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:PlaguebringerGoliath"] = new PbGSky(); + + Filters.Scene["CalamityMod:Yharon"] = new Filter(new YScreenShaderData("FilterMiniTower").UseColor(1f, 0.4f, 0f).UseOpacity(0.75f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:Yharon"] = new YSky(); + + 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(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); + SkyManager.Instance["CalamityMod:Signus"] = new SignusSky(); + + SkyManager.Instance["CalamityMod:BossRush"] = new BossRushSky(); + + Filters.Scene["CalamityMod:ExoMechs"] = new Filter(new ExoMechsScreenShaderData("FilterMiniTower").UseColor(ExoMechsSky.DrawColor).UseOpacity(0.25f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:ExoMechs"] = new ExoMechsSky(); + + Filters.Scene["CalamityMod:MonolithAccursed"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:MonolithAccursed"] = new MonolithSky(); + + // Normal intensity is 4f + Texture2D DistortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/BlobbyNoise", AssetRequestMode.ImmediateLoad).Value; + Filters.Scene["CalamityMod:DrunkCrabulon"] = new Filter(new DrunkCrabScreenShaderData("FilterHeatDistortion").UseImage(DistortionTexture, 0, null).UseIntensity(20f), EffectPriority.VeryHigh); + + Filters.Scene["CalamityMod:BrimstoneCrag"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0f).UseOpacity(0f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:BrimstoneCrag"] = new BrimstoneCragSky(); + + SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); + SkyManager.Instance["CalamityMod:SulphurSea"] = new SulphurSeaSky(); + SkyManager.Instance["CalamityMod:Cryogen"] = new CryogenSky(); + SkyManager.Instance["CalamityMod:StormWeaverFlash"] = new StormWeaverFlashSky(); + } + } +} diff --git a/Systems/Mechanic/AttunementSystem.cs b/Systems/Mechanic/AttunementSystem.cs new file mode 100644 index 0000000000..707a654630 --- /dev/null +++ b/Systems/Mechanic/AttunementSystem.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public sealed class AttunementSystem : ModSystem + { + public static Attunement[] Registry; + public static Attunement Empty => Registry[EmptyID]; + public static int EmptyID => Registry.Length - 1; + + public override void OnModLoad() + { + // This probably could be replaced to ReflectionHelper.IterateCalamityModTypes + Registry = [ + + // Broken Biome Blade + new DefaultAttunement(), new HotAttunement(), new ColdAttunement(), new EvilAttunement(), + + // Biome Blade + new TrueDefaultAttunement(), new TrueHotAttunement(), new TrueColdAttunement(), new TrueTropicalAttunement(), new TrueEvilAttunement(), new HolyAttunement(), + + // True Biome Blade + new WhirlwindAttunement(), new FlailBladeAttunement(), new SuperPogoAttunement(), new ShockwaveAttunement(), + + // Galaxia + new PhoenixAttunement(), new AriesAttunement(), new PolarisAttunement(), new AndromedaAttunement(), + + // Empty Slot + null + ]; + } + + public override void Unload() + { + Registry = null; + } + + public static Attunement FindOrNull(int index) + { + if (index < 0) + return Empty; + + if (index >= Registry.Length) + return Empty; + + return Registry[index]; + } + + public static Attunement FindOrNull(AttunementID id) + { + return FindOrNull((int)id); + } + } +} diff --git a/Systems/DifficultyModeSystem.cs b/Systems/Mechanic/DifficultyModeSystem.cs similarity index 100% rename from Systems/DifficultyModeSystem.cs rename to Systems/Mechanic/DifficultyModeSystem.cs diff --git a/Systems/Mechanic/GraveyardBiomeSystem.cs b/Systems/Mechanic/GraveyardBiomeSystem.cs new file mode 100644 index 0000000000..b1104f87ba --- /dev/null +++ b/Systems/Mechanic/GraveyardBiomeSystem.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + internal sealed class GraveyardBiomeSystem : ModSystem + { + // For now it literally adjust the graveyard count required for GraveyardBiome + // But we can add something later on /shrug + + public override void OnModLoad() + { + // Make Graveyard biomes require more Gravestones + SceneMetrics.GraveyardTileMax = 60; + SceneMetrics.GraveyardTileMin = 40; + SceneMetrics.GraveyardTileThreshold = 52; + } + + public override void Unload() + { + SceneMetrics.GraveyardTileMax = 36; + SceneMetrics.GraveyardTileMin = 16; + SceneMetrics.GraveyardTileThreshold = 28; + } + } +} diff --git a/Systems/Mechanic/MountsBalancingSystem.cs b/Systems/Mechanic/MountsBalancingSystem.cs new file mode 100644 index 0000000000..ba8aac2082 --- /dev/null +++ b/Systems/Mechanic/MountsBalancingSystem.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + internal sealed class MountsBalancingSystem : ModSystem + { + public override void OnModLoad() + { + // Mount balancing occurs during runtime and is undone when Calamity is unloaded + // Buff DCU's pickaxe power to equal PML pickaxe capabilities + Mount.drillPickPower = 225; + } + + public override void Unload() + { + Mount.drillPickPower = 210; + } + } +} diff --git a/Systems/NerfExpertDebuffsSystem.cs b/Systems/Mechanic/NerfExpertDebuffsSystem.cs similarity index 96% rename from Systems/NerfExpertDebuffsSystem.cs rename to Systems/Mechanic/NerfExpertDebuffsSystem.cs index 49a6da275c..67ea9cdaaa 100644 --- a/Systems/NerfExpertDebuffsSystem.cs +++ b/Systems/Mechanic/NerfExpertDebuffsSystem.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Systems public override void PostUpdateTime() { // Reduce the expert+ debuff time multiplier to the normal mode multiplier - if (CalamityConfig.Instance.NerfExpertDebuffs) + if (CalamityServerConfig.Instance.NerfExpertDebuffs) { var copy = Main.RegisteredGameModes[GameModeID.Expert]; copy.DebuffTimeMultiplier = 1f; diff --git a/Systems/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs similarity index 92% rename from Systems/RecipeSystem.cs rename to Systems/Mechanic/RecipeSystem.cs index fec870b7aa..d2149df7c7 100644 --- a/Systems/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -9,11 +9,17 @@ using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Tools; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Systems { @@ -40,18 +46,18 @@ namespace CalamityMod.Systems { // Twinklers count as Fireflies RecipeGroup firefly = RecipeGroup.recipeGroups[RecipeGroupID.Fireflies]; - firefly.ValidItems.Add(ModContent.ItemType()); + firefly.ValidItems.Add(ItemType()); // Astral, Sunken Sea and Sulphurous Sea Sand is Sand RecipeGroup sand = RecipeGroup.recipeGroups[RecipeGroupID.Sand]; - sand.ValidItems.Add(ModContent.ItemType()); - sand.ValidItems.Add(ModContent.ItemType()); - sand.ValidItems.Add(ModContent.ItemType()); + sand.ValidItems.Add(ItemType()); + sand.ValidItems.Add(ItemType()); + sand.ValidItems.Add(ItemType()); // Acidwood is Wood RecipeGroup wood = RecipeGroup.recipeGroups[RecipeGroupID.Wood]; - wood.ValidItems.Add(ModContent.ItemType()); - wood.ValidItems.Add(ModContent.ItemType()); + wood.ValidItems.Add(ItemType()); + wood.ValidItems.Add(ItemType()); // Astral Monolith is decidedly not wood-like enough to be used as generic wood. } @@ -257,7 +263,8 @@ namespace CalamityMod.Systems ItemID.EbonstoneBlock, ItemID.CrimstoneBlock, ItemID.PearlstoneBlock, - ModContent.ItemType() + ItemType(), + ItemType() }); AnyStoneBlock = RecipeGroup.RegisterGroup("AnyStoneBlock", group); @@ -265,7 +272,7 @@ namespace CalamityMod.Systems group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.SnowBlock)}", new int[] { ItemID.SnowBlock, - ModContent.ItemType() + ItemType() }); AnySnowBlock = RecipeGroup.RegisterGroup("AnySnowBlock", group); @@ -276,7 +283,7 @@ namespace CalamityMod.Systems ItemID.PurpleIceBlock, ItemID.RedIceBlock, ItemID.PinkIceBlock, - ModContent.ItemType() + ItemType() }); AnyIceBlock = RecipeGroup.RegisterGroup("AnyIceBlock", group); @@ -285,7 +292,7 @@ namespace CalamityMod.Systems { ItemID.SiltBlock, ItemID.SlushBlock, - ModContent.ItemType() + ItemType() }); AnySiltBlock = RecipeGroup.RegisterGroup("AnySiltBlock", group); @@ -378,7 +385,7 @@ namespace CalamityMod.Systems ItemID.VortexPickaxe, ItemID.NebulaPickaxe, ItemID.StardustPickaxe, - ModContent.ItemType() + ItemType() }); LunarPickaxe = RecipeGroup.RegisterGroup("LunarPickaxe", group); @@ -440,13 +447,13 @@ namespace CalamityMod.Systems // List of wings that can't be used to craft Celestial Tracers, includes tracers themselves, specific wing ingredients, and non-traditional wings List excludedWings = new List { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), ItemID.Jetpack }; foreach (var i in ContentSamples.ItemsByType) @@ -501,6 +508,12 @@ namespace CalamityMod.Systems AddTile(TileID.DyeVat). Register(); + // Stohne smelts into Lihzahrd Bricks + Recipe.Create(ItemID.LihzahrdBrick). + AddIngredient(ItemType()). + AddTile(TileID.LihzahrdFurnace). + Register(); + // Earlier Rocket Is for early rocket weapons Recipe.Create(ItemID.RocketI, 100). AddRecipeGroup("IronBar"). @@ -551,8 +564,8 @@ namespace CalamityMod.Systems // Demon Conch Recipe.Create(ItemID.DemonConch). - AddIngredient(). AddIngredient(ItemID.HellstoneBar, 4). + AddIngredient(8). AddTile(TileID.Hellforge). Register(); @@ -565,8 +578,8 @@ namespace CalamityMod.Systems // Lava Fishing Hook Recipe.Create(ItemID.LavaFishingHook). - AddIngredient(ItemID.Seashell). AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(ItemID.Seashell). AddTile(TileID.Hellforge). Register(); @@ -799,17 +812,17 @@ namespace CalamityMod.Systems { 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.Trimarang), AddIngredient(ItemType(), 5) }, + { Vanilla(ItemID.BundleofBalloons), AddIngredient(ItemType(), 3) }, + { r => r.HasResult(ItemID.HorseshoeBundle) && !r.HasIngredient(ItemID.BundleofBalloons), AddIngredient(ItemType(), 3) }, + { Vanilla(ItemID.NightsEdge), AddIngredient(ItemType(), 5) }, { Vanilla(ItemID.FairyBoots), AddIngredient(ItemID.SoulofLight, 5) }, { Vanilla(ItemID.FairyBell), RemoveIngredient(ItemID.SoulofSight) }, - { Vanilla(ItemID.HellfireTreads), AddIngredient(ModContent.ItemType(), 4) }, + { Vanilla(ItemID.HellfireTreads), AddIngredient(ItemType(), 4) }, { Vanilla(ItemID.SpiritFlame), AddGroup(AnyAdamantiteBar, 2) }, - { Vanilla(ItemID.TerraBlade), AddIngredient(ModContent.ItemType(), 12) }, - { Vanilla(ItemID.FireGauntlet), AddIngredient(ModContent.ItemType(), 5) }, - { Vanilla(ItemID.Zenith), AddIngredient(ModContent.ItemType(), 5) }, + { Vanilla(ItemID.TerraBlade), AddIngredient(ItemType(), 12) }, + { Vanilla(ItemID.FireGauntlet), AddIngredient(ItemType(), 5) }, + { Vanilla(ItemID.Zenith), ZenithRecipeEdit }, // Tier unlock various items to a lower tier (sorted by progression) // Move a bunch of mythril anvil locked stuff in early HM to regular anvils to fit progression changes @@ -823,7 +836,7 @@ namespace CalamityMod.Systems { Vanilla(ItemID.OpticStaff), RemoveIngredient(ItemID.HallowedBar) }, // Swap hellstone recipe ordering (they have bars first and it's wrong and irritating) - { VanillaEach(ItemID.Flamarang, ItemID.PhoenixBlaster), SwapIngredients(0, 1) }, + { VanillaEach(ItemID.Flamarang, ItemID.PhoenixBlaster, ItemID.FireproofBugNet), SwapIngredients(0, 1) }, // Swap Beetle Armor recipe ordering (they have beetle husks first and it's wrong and irritating) { VanillaEach(ItemID.BeetleHelmet, ItemID.BeetleScaleMail, ItemID.BeetleShell, ItemID.BeetleLeggings), SwapIngredients(0, 1) }, @@ -833,7 +846,7 @@ namespace CalamityMod.Systems { Vanilla(ItemID.NaughtyPresent), RemoveIngredient(ItemID.SoulofFright) }, // Add 20 Souls of Flight to vanilla Luminite wings - { VanillaEach(ItemID.WingsSolar, ItemID.WingsVortex, ItemID.WingsNebula, ItemID.WingsStardust), AddIngredient(ItemID.SoulofFlight, 20) }, + { VanillaEach(ItemID.WingsSolar, ItemID.WingsVortex, ItemID.WingsNebula, ItemID.WingsStardust), LunarWingsRecipeEdits }, // Berserker's Glove recipe change now that it doesn't provide melee speed { Vanilla(ItemID.BerserkerGlove), ReplaceIngredient(ItemID.PowerGlove, ItemID.TitanGlove) }, @@ -975,6 +988,29 @@ namespace CalamityMod.Systems r.ChangeIngredientStack(ItemID.ViciousPowder, 20); r.ChangeIngredientStack(ItemID.Vertebrae, 10); } + + private static void ZenithRecipeEdit(Recipe r) + { + r.AddIngredient(ItemType(), 5); + int idx = r.requiredTile.IndexOf(TileID.MythrilAnvil); + if (idx == -1) + return; + r.requiredTile[idx] = TileType(); + } + + private static void LunarWingsRecipeEdits(Recipe r) + { + // Add Soul of Flight then move it to the top + r.AddIngredient(ItemID.SoulofFlight, 20); + + if (r.requiredItem.Count < 3) + return; + + var store = r.requiredItem[0]; + r.requiredItem[0] = r.requiredItem[2]; + r.requiredItem[2] = r.requiredItem[1]; + r.requiredItem[1] = store; + } #endregion #region Shimmer Recipes @@ -993,7 +1029,12 @@ namespace CalamityMod.Systems // shorthand for the ID set int[] convert = ItemID.Sets.ShimmerTransformToItem; - InsertShimmerResult(ModContent.ItemType(), ItemID.SummonerEmblem); + InsertShimmerResult(ItemType(), ItemID.SummonerEmblem); + + // Cyclical Travelling Merchant Cell Phone materials + convert[ItemID.DPSMeter] = ItemID.LifeformAnalyzer; + convert[ItemID.LifeformAnalyzer] = ItemID.Stopwatch; + convert[ItemID.Stopwatch] = ItemID.DPSMeter; // Pyramid loot edits. There's no good way to have this not be hardcoded. convert[ItemID.PharaohsMask] = ItemID.PharaohsRobe; @@ -1002,6 +1043,10 @@ namespace CalamityMod.Systems convert[ItemID.AmberHook] = ItemID.SandstorminaBottle; convert[ItemID.SandstorminaBottle] = ItemID.FlyingCarpet; convert[ItemID.FlyingCarpet] = ItemID.AmberHook; + + // Enchanted Sword and Terragrim shimmer into each other + convert[ItemID.EnchantedSword] = ItemID.Terragrim; + convert[ItemID.Terragrim] = ItemID.EnchantedSword; } #endregion @@ -1012,35 +1057,35 @@ namespace CalamityMod.Systems // Bowl Recipe r = Recipe.Create(ItemID.Bowl); - r.AddIngredient(ModContent.ItemType(), 2); + r.AddIngredient(2); r.AddTile(TileID.Furnaces); r.Register(); r.DisableDecraft(); // Clay Pot r = Recipe.Create(ItemID.ClayPot); - r.AddIngredient(ModContent.ItemType(), 5); + r.AddIngredient(5); r.AddTile(TileID.Furnaces); r.Register(); r.DisableDecraft(); // Pink Vase r = Recipe.Create(ItemID.PinkVase); - r.AddIngredient(ModContent.ItemType(), 4); + r.AddIngredient(4); r.AddTile(TileID.Furnaces); r.Register(); r.DisableDecraft(); // Plate r = Recipe.Create(ItemID.FoodPlatter); - r.AddIngredient(ModContent.ItemType(), 2); + r.AddIngredient(2); r.AddTile(TileID.Furnaces); r.Register(); r.DisableDecraft(); // Teapot r = Recipe.Create(ItemID.TeaKettle); - r.AddIngredient(ModContent.ItemType(), 12); + r.AddIngredient(12); r.AddIngredient(ItemID.Bone, 12); r.AddTile(TileID.Furnaces); r.Register(); @@ -1048,7 +1093,7 @@ namespace CalamityMod.Systems // Wandering Jingasa r = Recipe.Create(ItemID.RoninHat); - r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(10); r.AddIngredient(ItemID.Firefly, 3); // Does not use the recipe group in Vanilla r.AddTile(TileID.Loom); r.Register(); @@ -1060,38 +1105,22 @@ namespace CalamityMod.Systems private static void AddBloodOrbPotionRecipes() { // List of vanilla potions which can be crafted with Blood Orbs - short[] potions = new[] + short[] FiveOrbGroup = new[] { ItemID.WormholePotion, ItemID.TeleportationPotion, ItemID.SwiftnessPotion, ItemID.FeatherfallPotion, - ItemID.GravitationPotion, ItemID.ShinePotion, ItemID.InvisibilityPotion, ItemID.NightOwlPotion, - ItemID.SpelunkerPotion, ItemID.HunterPotion, ItemID.TrapsightPotion, - ItemID.BattlePotion, - ItemID.CalmingPotion, - ItemID.WrathPotion, - ItemID.RagePotion, ItemID.ThornsPotion, ItemID.IronskinPotion, - ItemID.EndurancePotion, ItemID.RegenerationPotion, - ItemID.LifeforcePotion, - ItemID.HeartreachPotion, ItemID.TitanPotion, - ItemID.ArcheryPotion, ItemID.AmmoReservationPotion, - ItemID.MagicPowerPotion, - ItemID.ManaRegenerationPotion, - ItemID.SummoningPotion, - ItemID.InfernoPotion, - ItemID.WarmthPotion, - ItemID.ObsidianSkinPotion, ItemID.GillsPotion, ItemID.WaterWalkingPotion, ItemID.FlipperPotion, @@ -1104,35 +1133,65 @@ namespace CalamityMod.Systems ItemID.LovePotion, ItemID.StinkPotion, ItemID.RecallPotion, + ItemID.LuckPotionLesser + }; + + short[] TenOrbGroup = new[] + { + ItemID.ArcheryPotion, + ItemID.GravitationPotion, + ItemID.SpelunkerPotion, + ItemID.BattlePotion, + ItemID.CalmingPotion, + ItemID.MagicPowerPotion, + ItemID.ManaRegenerationPotion, + ItemID.WarmthPotion, + ItemID.ObsidianSkinPotion, ItemID.PotionOfReturn, - ItemID.LuckPotionLesser, + ItemID.LuckPotion, ItemID.BiomeSightPotion }; + + short[] FifteenOrbGroup = new[] + { + ItemID.WrathPotion, + ItemID.RagePotion, + ItemID.EndurancePotion, + ItemID.LifeforcePotion, + ItemID.HeartreachPotion, + ItemID.SummoningPotion, + ItemID.InfernoPotion, + ItemID.LuckPotionGreater + }; Recipe r; - foreach (var potion in potions) + foreach (var potion in FiveOrbGroup) { r = Recipe.Create(potion); r.AddIngredient(ItemID.BottledWater); - r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(5); + r.AddTile(TileID.AlchemyTable); + r.Register(); + r.DisableDecraft(); + } + foreach (var potion in TenOrbGroup) + { + r = Recipe.Create(potion); + r.AddIngredient(ItemID.BottledWater); + r.AddIngredient(10); + r.AddTile(TileID.AlchemyTable); + r.Register(); + r.DisableDecraft(); + } + foreach (var potion in FifteenOrbGroup) + { + r = Recipe.Create(potion); + r.AddIngredient(ItemID.BottledWater); + r.AddIngredient(15); r.AddTile(TileID.AlchemyTable); r.Register(); r.DisableDecraft(); } - - r = Recipe.Create(ItemID.LuckPotion); - r.AddIngredient(ItemID.BottledWater); - r.AddIngredient(ModContent.ItemType(), 20); - r.AddTile(TileID.AlchemyTable); - r.Register(); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.LuckPotionGreater); - r.AddIngredient(ItemID.BottledWater); - r.AddIngredient(ModContent.ItemType(), 30); - r.AddTile(TileID.AlchemyTable); - r.Register(); - r.DisableDecraft(); } #endregion @@ -1140,67 +1199,68 @@ namespace CalamityMod.Systems private static void AddCookedFood() { Recipe r = Recipe.Create(ItemID.CookedFish); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.CookedFish); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.Sashimi); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(); r.AddTile(TileID.WorkBenches); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.CookedShrimp); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); - r.AddIngredient(ModContent.ItemType(), 2); + r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); - r.AddIngredient(ModContent.ItemType(), 2); + r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); - r.AddIngredient(ModContent.ItemType(), 2); + r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); - r.AddIngredient(ModContent.ItemType(), 2); + r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); - r.AddIngredient(ModContent.ItemType(), 2); + r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.Bacon); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(); r.AddTile(TileID.Hellforge); r.Register(); + r.DisableDecraft(); r = Recipe.Create(ItemID.BowlofSoup); r.AddIngredient(ItemID.Mushroom); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); @@ -1263,7 +1323,7 @@ namespace CalamityMod.Systems // Bloody Tear r = Recipe.Create(ItemID.BloodMoonStarter); - r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(10); r.AddRecipeGroup("AnyCopperBar", 3); r.AddTile(TileID.Anvils); r.Register(); @@ -1278,15 +1338,6 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Shadow Key - r = Recipe.Create(ItemID.ShadowKey); - r.AddIngredient(ItemID.GoldenKey); - r.AddIngredient(ItemID.Obsidian, 10); - r.AddIngredient(ItemID.Bone, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - // Sky Mill r = Recipe.Create(ItemID.SkyMill); r.AddIngredient(ItemID.SunplateBlock, 10); @@ -1353,15 +1404,6 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Gelatin Crystal (Queen Slime summon) - r = Recipe.Create(ItemID.QueenSlimeCrystal); - r.AddIngredient(ItemID.CrystalShard, 10); - r.AddIngredient(ItemID.PinkGel, 5); - r.AddIngredient(ItemID.SoulofLight, 5); - r.AddTile(TileID.Solidifier); - r.Register(); - r.DisableDecraft(); - // Temple Key r = Recipe.Create(ItemID.TempleKey); r.AddIngredient(ItemID.JungleSpores, 15); @@ -1371,14 +1413,6 @@ namespace CalamityMod.Systems 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, 5); - r.AddIngredient(ModContent.ItemType()); - r.AddTile(TileID.LihzahrdFurnace); - r.Register(); - r.DisableDecraft(); } #endregion @@ -1428,7 +1462,7 @@ namespace CalamityMod.Systems r = Recipe.Create(ItemID.Starfury); r.AddIngredient(ItemID.GoldBroadsword); r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(ModContent.ItemType(), 3); + r.AddIngredient(3); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1437,7 +1471,7 @@ namespace CalamityMod.Systems r = Recipe.Create(ItemID.Starfury); r.AddIngredient(ItemID.PlatinumBroadsword); r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(ModContent.ItemType(), 3); + r.AddIngredient(3); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1453,7 +1487,7 @@ namespace CalamityMod.Systems // Enchanted Sword r = Recipe.Create(ItemID.EnchantedSword); - r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(10); r.AddRecipeGroup(AnyGoldBar, 12); r.AddIngredient(ItemID.Diamond); r.AddIngredient(ItemID.Ruby); @@ -1463,7 +1497,7 @@ namespace CalamityMod.Systems // Muramasa r = Recipe.Create(ItemID.Muramasa); - r.AddIngredient(ModContent.ItemType(), 7); + r.AddIngredient(7); r.AddIngredient(ItemID.Bone, 10); r.AddTile(TileID.Anvils); r.Register(); @@ -1492,7 +1526,7 @@ namespace CalamityMod.Systems r.AddRecipeGroup(AnyIceBlock, 20); r.AddRecipeGroup(AnySnowBlock, 10); r.AddIngredient(ItemID.Shiverthorn); - r.AddTile(TileID.IceMachine); + r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); } @@ -1540,7 +1574,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Bottle); r.AddIngredient(ItemID.Cloud, 5); r.AddIngredient(ItemID.SandBlock, 5); - r.AddIngredient(ItemID.AntlionMandible, 3); + r.AddIngredient(3); r.AddIngredient(ItemID.Feather, 3); r.AddTile(TileID.Anvils); r.Register(); @@ -1565,7 +1599,7 @@ namespace CalamityMod.Systems r = Recipe.Create(ItemID.FlyingCarpet); r.AddIngredient(ItemID.Silk, 10); r.AddIngredient(ItemID.AntlionMandible, 2); - r.AddIngredient(ModContent.ItemType(), 5); + r.AddIngredient(5); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1668,14 +1702,6 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // DPS Meter - r = Recipe.Create(ItemID.DPSMeter); - r.AddIngredient(ItemID.Wire, 10); - r.AddRecipeGroup(AnyGoldBar, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - // Hand Warmer r = Recipe.Create(ItemID.HandWarmer); r.AddIngredient(ItemID.Silk, 10); @@ -1691,30 +1717,6 @@ namespace CalamityMod.Systems r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); - - // Band of Regeneration - r = Recipe.Create(ItemID.BandofRegeneration); - r.AddIngredient(ItemID.Shackle); - r.AddIngredient(ItemID.LifeCrystal, 1); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Shoe Spikes - r = Recipe.Create(ItemID.ShoeSpikes); - r.AddRecipeGroup("IronBar", 5); - r.AddIngredient(ItemID.Spike, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Flare Gun - r = Recipe.Create(ItemID.FlareGun); - r.AddRecipeGroup(AnyCopperBar, 5); - r.AddIngredient(ItemID.Torch, 10); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); } #endregion @@ -1771,7 +1773,7 @@ namespace CalamityMod.Systems // Armor Polish (broken armor) r = Recipe.Create(ItemID.ArmorPolish); r.AddIngredient(ItemID.Bone, 10); - r.AddIngredient(ModContent.ItemType(), 3); + r.AddIngredient(3); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1787,7 +1789,7 @@ namespace CalamityMod.Systems // Bezoar (poison) r = Recipe.Create(ItemID.Bezoar); - r.AddIngredient(ModContent.ItemType(), 3); + r.AddIngredient(ItemID.JungleSpores, 15); r.AddIngredient(ItemID.Stinger, 5); r.AddTile(TileID.Anvils); r.Register(); @@ -1807,7 +1809,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Waterleaf, 3); r.AddIngredient(ItemID.Blinkroot, 3); r.AddIngredient(ItemID.Daybloom, 3); - r.AddIngredient(ModContent.ItemType(), 5); + r.AddIngredient(5); r.AddTile(TileID.AlchemyTable); r.Register(); r.DisableDecraft(); @@ -1914,8 +1916,8 @@ namespace CalamityMod.Systems // Frozen Turtle Shell r = Recipe.Create(ItemID.FrozenTurtleShell); r.AddIngredient(ItemID.TurtleShell, 2); - r.AddIngredient(ModContent.ItemType(), 4); - r.AddTile(TileID.IceMachine); + r.AddIngredient(4); + r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1951,6 +1953,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.SoulofFright); r.AddIngredient(ItemID.SoulofMight); r.AddIngredient(ItemID.SoulofSight); + r.AddTile(TileID.TinkerersWorkbench); r.Register(); r.DisableDecraft(); @@ -1961,6 +1964,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.SoulofFright); r.AddIngredient(ItemID.SoulofMight); r.AddIngredient(ItemID.SoulofSight); + r.AddTile(TileID.TinkerersWorkbench); r.Register(); r.DisableDecraft(); diff --git a/Systems/Mechanic/SpeedrunTimerSystem.cs b/Systems/Mechanic/SpeedrunTimerSystem.cs new file mode 100644 index 0000000000..0a62f90e60 --- /dev/null +++ b/Systems/Mechanic/SpeedrunTimerSystem.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using Terraria.ModLoader; +using static System.Net.Mime.MediaTypeNames; + +namespace CalamityMod.Systems +{ + internal sealed class SpeedrunTimerSystem : ModSystem + { + public static TimeSpan Elapsed => _SpeedrunTimer.Elapsed; + + private static Stopwatch _SpeedrunTimer = new(); + + private const string FormatStringForDay = @"hh\:mm\:ss\.ff"; + private const string FormatString = @"d\:hh\:mm\:ss\.ff"; + + public static void Restart() + { + _SpeedrunTimer.Restart(); + } + + public static string GetTimerText(CalamityPlayer player) + { + string formatStr = @"hh\:mm\:ss\.ff"; + string formatStrDays = @"d\:hh\:mm\:ss\.ff"; + TimeSpan totalTime = Elapsed.Add(player.previousSessionTotal); + return totalTime.ToString(totalTime.Days > 0 ? formatStrDays : formatStr); + } + + public static string GetSplitText(CalamityPlayer player) + { + TimeSpan split = player.lastSplit; + return split.ToString(split.Days > 0 ? FormatStringForDay : FormatString); + } + + public override void PreSaveAndQuit() => _SpeedrunTimer?.Stop(); + } +} diff --git a/Systems/TilePingerSystem.cs b/Systems/Mechanic/TilePingerSystem.cs similarity index 100% rename from Systems/TilePingerSystem.cs rename to Systems/Mechanic/TilePingerSystem.cs diff --git a/Systems/WorldSelectionDifficultySystem.cs b/Systems/Mechanic/WorldSelectionDifficultySystem.cs similarity index 99% rename from Systems/WorldSelectionDifficultySystem.cs rename to Systems/Mechanic/WorldSelectionDifficultySystem.cs index 73621eb404..7193069b77 100644 --- a/Systems/WorldSelectionDifficultySystem.cs +++ b/Systems/Mechanic/WorldSelectionDifficultySystem.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Systems // 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) + if (ExternalMods.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))); diff --git a/Systems/AnyBossesOrEventsCheckSystem.cs b/Systems/ProgressionAndEvent/AnyBossesOrEventsCheckSystem.cs similarity index 100% rename from Systems/AnyBossesOrEventsCheckSystem.cs rename to Systems/ProgressionAndEvent/AnyBossesOrEventsCheckSystem.cs diff --git a/Systems/BossRushDialogueSystem.cs b/Systems/ProgressionAndEvent/BossRushDialogueSystem.cs similarity index 100% rename from Systems/BossRushDialogueSystem.cs rename to Systems/ProgressionAndEvent/BossRushDialogueSystem.cs diff --git a/Systems/DownedBossSystem.cs b/Systems/ProgressionAndEvent/DownedBossSystem.cs similarity index 100% rename from Systems/DownedBossSystem.cs rename to Systems/ProgressionAndEvent/DownedBossSystem.cs diff --git a/Systems/Quests/AmidiasQuest.cs b/Systems/Quests/AmidiasQuest.cs new file mode 100644 index 0000000000..43d8e1642e --- /dev/null +++ b/Systems/Quests/AmidiasQuest.cs @@ -0,0 +1,15 @@ +namespace CalamityMod.Systems.Quests +{ + /// + /// The different progression points of Amidias' Quest. + /// + public enum AmidiasQuestProgression + { + KilledGiantClam, + } + + /// + /// A ModSystem which controls, progresses, saves, and loads the data necessary for Amidias' Quest. + /// + public class AmidiasQuest : Quest { } +} diff --git a/Systems/Quests/Quest.cs b/Systems/Quests/Quest.cs new file mode 100644 index 0000000000..e424ce291c --- /dev/null +++ b/Systems/Quests/Quest.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Systems.Quests +{ + /// + /// An that implements the foundation to make quests in Terraria
+ /// and making their data be saved and loaded accordingly. + ///
+ /// A which contains all the progression points of the quest + public abstract class Quest : ModSystem where TEnum : Enum + { + #region Data Saving & Loading + + public override void Unload() => QuestProgression = null; + + public override void ClearWorld() + { + // Resets all the properties when loading a world without a TagCompound. + + QuestStarted = false; + QuestFinished = false; + QuestProgression = ResetQuestProgression(); + } + + public override void LoadWorldData(TagCompound tag) + { + QuestStarted = tag.ContainsKey("questStarted"); + QuestFinished = tag.ContainsKey("questFinished"); + + QuestProgression = ResetQuestProgression(); + + // Although this method may seem weird, it's endorsed by tML on their guides for save & loading dictionaries. + if (tag.TryGet>("questProgression", out var value)) + QuestProgression = QuestProgression.Keys.Zip(value, (k, v) => new { Key = k, Value = v }).ToDictionary(x => x.Key, x => x.Value); + } + + public override void SaveWorldData(TagCompound tag) + { + // If any of them have modified values from the default value, we save them on the TagCompound. + + if (QuestStarted) + tag.Add("questStarted", QuestStarted); + + if (QuestFinished) + tag.Add("questFinished", QuestFinished); + + if (QuestProgression.ContainsValue(true)) + tag.Add("questProgression", QuestProgression.Values.ToList()); + } + + #endregion + + /// + /// Whether or not this quest has started. + /// + public static bool QuestStarted { get; private set; } + + /// + /// Whether or not this quest has finished. + /// + public static bool QuestFinished { get; private set; } + + /// + /// A dictionary that saves a boolean for each progression point, to state which one was completed and which one was not. + /// + public static Dictionary QuestProgression { get; private set; } = ResetQuestProgression(); + + /// + /// An event that is triggered when this quest starts. + /// + public static event Action OnQuestStarted; + + /// + /// An event that is triggered when this quest finishes. + /// + public static event Action OnQuestFinish; + + /// + /// An event that is triggered when this quest completes a new progression point. + /// + public static event Action OnQuestProgression; + + /// + /// A method that makes this quest start and trigger its corresponding event.
+ /// Does nothing if the quest has already started. + ///
+ public static void StartQuest() + { + if (!QuestStarted) + { + QuestStarted = true; + OnQuestStarted?.Invoke(); + } + } + + /// + /// A method that makes this quest finishes and trigger its corresponding event.
+ /// Does nothing if the quest has already finished. + ///
+ public static void FinishQuest() + { + if (!QuestFinished) + { + QuestFinished = true; + OnQuestFinish?.Invoke(); + } + } + + /// + /// A method that makes a progression point be counted as completed.
+ /// Does nothing if the progression point has already been completed. + ///
+ /// The progression point that has been completed. + public static void ProgressQuest(TEnum progressionPoint) + { + if (!QuestProgression[progressionPoint]) + { + QuestProgression[progressionPoint] = true; + OnQuestProgression?.Invoke(progressionPoint); + } + } + + /// + /// A quick method to resets the progression of Amidias' Quest.
+ /// Used for when changing worlds or initializing . + ///
+ private static Dictionary ResetQuestProgression() + { + Dictionary questProgression = new(); + var progressionPoints = Enum.GetValues(typeof(TEnum)); + foreach (TEnum progressionPoint in progressionPoints) + questProgression.Add(progressionPoint, false); + return questProgression; + } + } +} diff --git a/Systems/ResizeArrayHook.cs b/Systems/ResizeArrayHook.cs new file mode 100644 index 0000000000..e5ffa028d2 --- /dev/null +++ b/Systems/ResizeArrayHook.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + internal delegate void ResizeArrayDelegate(bool unloading); + + internal sealed class ResizeArrayHook : ModSystem + { + public static event ResizeArrayDelegate OnResizeArrays; + public static event ResizeArrayDelegate OnPostResizeArrays; + + public override void Load() + { + var resizeArrayMethod = typeof(ModContent).GetMethod("ResizeArrays", BindingFlags.NonPublic | BindingFlags.Static); + MonoModHooks.Add(resizeArrayMethod, ResizeArrays); + } + + private static void ResizeArrays(ResizeArrayDelegate orig, bool unloading) + { + OnResizeArrays?.Invoke(unloading); + orig(unloading); + OnPostResizeArrays?.Invoke(unloading); + } + + // MonoMod Hook Unloads before this being called + // So we forcely call ResizeArray with Unload true + public override void Unload() + { + OnResizeArrays?.Invoke(unloading: true); + OnPostResizeArrays?.Invoke(unloading: true); + + OnResizeArrays = null; + OnPostResizeArrays = null; + } + } +} diff --git a/Systems/GungeonMusicSystem.cs b/Systems/Sound/GungeonMusicSystem.cs similarity index 100% rename from Systems/GungeonMusicSystem.cs rename to Systems/Sound/GungeonMusicSystem.cs diff --git a/Systems/MusicEventSystem.cs b/Systems/Sound/MusicEventSystem.cs similarity index 88% rename from Systems/MusicEventSystem.cs rename to Systems/Sound/MusicEventSystem.cs index 8349dca788..1746e62840 100644 --- a/Systems/MusicEventSystem.cs +++ b/Systems/Sound/MusicEventSystem.cs @@ -4,6 +4,7 @@ using System.IO; using System.Threading; using CalamityMod.Events; using CalamityMod.NPCs; +using CalamityMod.Packets; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -53,20 +54,20 @@ namespace CalamityMod.Systems } AddEntry("CloneDefeated", "Interlude1", TimeSpan.FromSeconds(214.577d), - () => DownedBossSystem.downedCalamitasClone, () => CalamityConfig.Instance.Interlude1); + () => DownedBossSystem.downedCalamitasClone, () => CalamityClientConfig.Instance.Interlude1); AddEntry("MLDefeated", "Interlude2", TimeSpan.FromSeconds(191.912d), () => NPC.downedMoonlord, - () => CalamityConfig.Instance.Interlude2, outroSilence: TimeSpan.FromSeconds(1f)); + () => CalamityClientConfig.Instance.Interlude2, outroSilence: TimeSpan.FromSeconds(1f)); // Alternative Interlude 2 -> AddEntry("MLDefeated", "Interlude2_CutIntro", TimeSpan.FromSeconds(160.989d), - // () => NPC.downedMoonlord, () => CalamityConfig.Instance.Interlude2, + // () => NPC.downedMoonlord, () => CalamityClientConfig.Instance.Interlude2, // outroSilence: TimeSpan.FromSeconds(1f)); AddEntry("YharonDefeated", "Interlude3", TimeSpan.FromSeconds(295.932d), - () => DownedBossSystem.downedYharon, () => CalamityConfig.Instance.Interlude3); + () => DownedBossSystem.downedYharon, () => CalamityClientConfig.Instance.Interlude3); AddEntry("DoGDefeated", "DevourerofGodsEulogy", TimeSpan.FromSeconds(203.620d), - () => DownedBossSystem.downedDoG, () => CalamityConfig.Instance.DevourerofGodsEulogy, + () => DownedBossSystem.downedDoG, () => CalamityClientConfig.Instance.DevourerofGodsEulogy, introSilence: TimeSpan.FromSeconds(7.5f)); // Acceptance is NOT toggleable in the config @@ -280,40 +281,7 @@ namespace CalamityMod.Systems public static void SendSyncRequest() { - ModPacket packet = CalamityMod.Instance.GetPacket(); - packet.Write((byte)CalamityModMessageType.MusicEventSyncRequest); - packet.Send(); - } - - public static void FulfillSyncRequest(int requester) - { - // Only fulfill requests as the server host - if (!Main.dedServ) - return; - - ModPacket packet = CalamityMod.Instance.GetPacket(); - packet.Write((byte)CalamityModMessageType.MusicEventSyncResponse); - - int trackCount = PlayedEvents.Count; - packet.Write(trackCount); - - for (int i = 0; i < trackCount; i++) - packet.Write(PlayedEvents[i]); - - packet.Send(toClient: requester); - } - - public static void ReceiveSyncResponse(BinaryReader reader) - { - // Only receive info on clients - if (Main.dedServ) - return; - - PlayedEvents.Clear(); - int trackCount = reader.ReadInt32(); - - for (int i = 0; i < trackCount; i++) - PlayedEvents.Add(reader.ReadString()); + MusicEventSyncRequestPacket.Send(); } #endregion diff --git a/Systems/ORDERSystem.cs b/Systems/Sound/ORDERSystem.cs similarity index 98% rename from Systems/ORDERSystem.cs rename to Systems/Sound/ORDERSystem.cs index 565546dbb0..d30877afca 100644 --- a/Systems/ORDERSystem.cs +++ b/Systems/Sound/ORDERSystem.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Systems } // DIE! - public static void JUDGMENT() + public static void JUDGEMENT() { if (!currentlyPlaying) orderSoundSlot = SoundEngine.PlaySound(ORDERTrack); diff --git a/Systems/SingularSoundInstanceSystem.cs b/Systems/Sound/SingularSoundInstanceSystem.cs similarity index 93% rename from Systems/SingularSoundInstanceSystem.cs rename to Systems/Sound/SingularSoundInstanceSystem.cs index 8fc518ee36..877c72ecef 100644 --- a/Systems/SingularSoundInstanceSystem.cs +++ b/Systems/Sound/SingularSoundInstanceSystem.cs @@ -44,11 +44,13 @@ namespace CalamityMod.Systems { bool foundSound = SoundEngine.TryGetActiveSound(SoundSlot, out var activeSound); // If an attached entity stops existing, so does the sound. - if (!foundSound || (AttachedEntity != null && !AttachedEntity.active)) + if (!foundSound || AttachedEntity == null || !AttachedEntity.active) { currentlyPlaying = false; maxPlaytime = 0; AttachedEntity = null; + activeSound?.Stop(); + SoundSlot = SlotId.Invalid; return; } // Otherwise, attach to the entity. diff --git a/Systems/SpeedrunTimerStoppingSystem.cs b/Systems/SpeedrunTimerStoppingSystem.cs deleted file mode 100644 index 0923a54879..0000000000 --- a/Systems/SpeedrunTimerStoppingSystem.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Systems -{ - // TODO -- Expand this ModSystem to contain the Speedrun Timer itself, as well as the UI. - public class SpeedrunTimerStoppingSystem : ModSystem - { - public override void PreSaveAndQuit() => CalamityMod.SpeedrunTimer?.Stop(); - } -} diff --git a/Systems/BiomeTileCounterSystem.cs b/Systems/Tile/BiomeTileCounterSystem.cs similarity index 91% rename from Systems/BiomeTileCounterSystem.cs rename to Systems/Tile/BiomeTileCounterSystem.cs index 4c96f125a0..e66ed5837c 100644 --- a/Systems/BiomeTileCounterSystem.cs +++ b/Systems/Tile/BiomeTileCounterSystem.cs @@ -55,10 +55,10 @@ namespace CalamityMod.Systems public override void TileCountsAvailable(ReadOnlySpan tileCounts) { BrimstoneCragTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + + tileCounts[ModContent.TileType()]; + SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaPolypTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaReefsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaReefsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaBurrowsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; AbyssTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SulphurTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; diff --git a/Systems/SulphuricWaterSafeZoneSystem.cs b/Systems/Tile/SulphuricWaterSafeZoneSystem.cs similarity index 100% rename from Systems/SulphuricWaterSafeZoneSystem.cs rename to Systems/Tile/SulphuricWaterSafeZoneSystem.cs diff --git a/Systems/TempTilesManagerSystem.cs b/Systems/Tile/TempTilesManagerSystem.cs similarity index 100% rename from Systems/TempTilesManagerSystem.cs rename to Systems/Tile/TempTilesManagerSystem.cs diff --git a/Systems/TileFramingSystem.cs b/Systems/Tile/TileFramingSystem.cs similarity index 65% rename from Systems/TileFramingSystem.cs rename to Systems/Tile/TileFramingSystem.cs index a5ac62a0b8..e55bedb771 100644 --- a/Systems/TileFramingSystem.cs +++ b/Systems/Tile/TileFramingSystem.cs @@ -43,47 +43,12 @@ namespace CalamityMod.Systems } #endregion - #region Merge Frame Data - 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; - } - } - #endregion - // This tiny GlobalTile exists for two purposes: // 1 - Ensure merge data is loaded and cached // 2 - Properly and automatically render merges in all cases for all tiles #region Sealed Global Tile private sealed class MergeableTileGlobalTile : GlobalTile { - public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) - { - DrawUniversalMergeFrames(i, j, GetOrCreateTileAdjacencies(type)); - } - public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) { // Custom plant framing @@ -98,9 +63,6 @@ namespace CalamityMod.Systems if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == ModContent.TileType()) VineFrame(i, j); - foreach (var adjacency in GetOrCreateTileAdjacencies(type)) - GetAdjacencyData(i, j, adjacency); - return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); } } @@ -108,12 +70,10 @@ namespace CalamityMod.Systems // 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> tileAdjacencyMap = []; - private static Dictionary> cachedBlendSheets = []; #region Plant Stuff - private static ushort[] PlantTypes = new ushort[] - { + private static ushort[] PlantTypes = + [ TileID.Plants, TileID.CorruptPlants, TileID.JunglePlants, @@ -132,8 +92,9 @@ namespace CalamityMod.Systems (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - }; - private static int[][] PlantCheckAgainst; + ]; + + private static int[][] PlantValidGrounds; private static Dictionary VineToGrass; #endregion @@ -142,24 +103,24 @@ namespace CalamityMod.Systems // All tiles from all mods are guaranteed to be loaded by the execution time of this hook. public override void PostAddRecipes() { - PlantCheckAgainst = new int[TileLoader.TileCount][]; - PlantCheckAgainst[TileID.Plants] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; - PlantCheckAgainst[TileID.CorruptPlants] = new int[1] { TileID.CorruptGrass }; - PlantCheckAgainst[TileID.JunglePlants] = new int[1] { TileID.JungleGrass }; - PlantCheckAgainst[TileID.MushroomPlants] = new int[1] { TileID.MushroomGrass }; - PlantCheckAgainst[TileID.Plants2] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; - PlantCheckAgainst[TileID.JunglePlants2] = new int[1] { TileID.JungleGrass }; - PlantCheckAgainst[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass }; - PlantCheckAgainst[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass }; - PlantCheckAgainst[TileID.CrimsonPlants] = new int[1] { TileID.CrimsonGrass }; - PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; - PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; - PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; - PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; - PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; - PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; - PlantCheckAgainst[ModContent.TileType()] = new int[2] { ModContent.TileType(), ModContent.TileType() }; - PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantValidGrounds = new int[TileLoader.TileCount][]; + PlantValidGrounds[TileID.Plants] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; + PlantValidGrounds[TileID.CorruptPlants] = new int[1] { TileID.CorruptGrass }; + PlantValidGrounds[TileID.JunglePlants] = new int[1] { TileID.JungleGrass }; + PlantValidGrounds[TileID.MushroomPlants] = new int[1] { TileID.MushroomGrass }; + PlantValidGrounds[TileID.Plants2] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; + PlantValidGrounds[TileID.JunglePlants2] = new int[1] { TileID.JungleGrass }; + PlantValidGrounds[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass }; + PlantValidGrounds[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass }; + PlantValidGrounds[TileID.CrimsonPlants] = new int[1] { TileID.CrimsonGrass }; + PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantValidGrounds[ModContent.TileType()] = new int[2] { ModContent.TileType(), ModContent.TileType() }; + PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; VineToGrass = new Dictionary { @@ -199,18 +160,118 @@ namespace CalamityMod.Systems public override void Unload() { - PlantCheckAgainst = null; + PlantValidGrounds = null; VineToGrass?.Clear(); VineToGrass = null; tileMergeTypes = null; + } + #endregion - tileAdjacencyMap?.Clear(); - tileAdjacencyMap = null; + #region Tile Variation Helpers + public static int GetVariation4x4_012_Low0(int i, int j) + { + int xRel = i & 0b0011; + int yRel = j & 0b0011; + var output = xRel switch + { + 0 => (yRel switch + { + 0 => 0, + 1 => 2, + 2 => 1, + _ => 2 + }), + 1 => (yRel switch + { + 0 => 2, + 1 => 0, + 2 => 2, + _ => 2 + }), + 2 => (yRel switch + { + 0 => 2, + 1 => 0, + 2 => 1, + _ => 2 + }), + _ => (yRel switch + { + 0 => 1, + 1 => 2, + 2 => 0, + _ => 2 + }), + }; + return output; + } - cachedBlendSheets?.Clear(); - cachedBlendSheets = null; + public static int GetVariation4x4_01_Low0(int i, int j) + { + int xRel = i & 0b0011; + int yRel = j & 0b0011; + var output = xRel switch + { + 0 => (yRel switch + { + 0 => 0, + 1 => 0, + 2 => 1, + _ => 1 + }), + 1 => (yRel switch + { + 0 => 1, + 1 => 0, + 2 => 1, + _ => 1 + }), + 2 => (yRel switch + { + 0 => 1, + 1 => 0, + 2 => 0, + _ => 1 + }), + _ => (yRel switch + { + 0 => 0, + 1 => 1, + 2 => 0, + _ => 1 + }), + }; + return output; + } + + public static int GetVariation3x3_01234_Low3(int i, int j) + { + int xRel = i % 3; + int yRel = j % 3; + var output = xRel switch + { + 0 => (yRel switch + { + 0 => 0, + 1 => 1, + _ => 2 + }), + 1 => (yRel switch + { + 0 => 2, + 1 => 3, + _ => 4 + }), + _ => (yRel switch + { + 0 => 4, + 1 => 0, + _ => 1 + }), + }; + return output; } #endregion @@ -289,82 +350,73 @@ namespace CalamityMod.Systems { if (x < 0 || x >= Main.maxTilesX) return; + if (y < 0 || y >= Main.maxTilesY) return; + + // If the tile below is off the bottom of the map, then assume it's invalid placement var tile = Main.tile[x, y]; - var checkType = -1; int plantType = tile.TileType; - - // If the tile below is off the bottom of the map, then assume it's the same tile type. if (y + 1 >= Main.maxTilesY) - checkType = plantType; - else { - var below = Main.tile[x, y + 1]; - if (below != null && below.HasUnactuatedTile && !below.IsHalfBlock && below.Slope == 0) - checkType = below.TileType; + WorldGen.KillTile(x, y); + return; } - // Sub function to determine whether the plant needs an update - static bool PlantNeedsUpdate(int plant, int check) + // If tile below is not elligible for growing plants, we kill the tile immediately + var below = Main.tile[x, y + 1]; + if (!below.HasTile || !below.HasUnactuatedTile || below.IsHalfBlock || below.Slope != SlopeType.Solid) { - if (PlantCheckAgainst[plant] is null) - return false; - - for (var i = 0; i < PlantCheckAgainst[plant].Length; ++i) - { - if (PlantCheckAgainst[plant][i] == check) - return false; - } - - return true; + WorldGen.KillTile(x, y); + return; } - // If no valid below tile type could be determined, then don't do anything. - // Additionally, don't do anything if the plant doesn't need a framing update. - if (checkType == -1 || !PlantNeedsUpdate(plantType, checkType)) + // Check if tile below is valid for given grass type, If so we don't need to update this + var belowTileType = (int)below.TileType; + if (PlantValidGrounds[plantType] is not null && PlantValidGrounds[plantType].Contains(belowTileType)) return; - if ((plantType == TileID.Plants || plantType == TileID.Plants2) && checkType != TileID.Grass && tile.TileFrameX >= 162) + var newPlantType = plantType; + + if ((plantType == TileID.Plants || plantType == TileID.Plants2) && belowTileType != TileID.Grass && tile.TileFrameX >= 162) { Main.tile[x, y].TileFrameX = 126; } - if (plantType == TileID.JunglePlants2 && checkType != TileID.JungleGrass && tile.TileFrameX >= 162) + if (plantType == TileID.JunglePlants2 && belowTileType != TileID.JungleGrass && tile.TileFrameX >= 162) { Main.tile[x, y].TileFrameX = 126; } - if (checkType == TileID.CorruptGrass) + #region Biome Grass Replacements + if (belowTileType == TileID.CorruptGrass) { - plantType = TileID.CorruptPlants; + newPlantType = TileID.CorruptPlants; if (tile.TileFrameX >= 162) { Main.tile[x, y].TileFrameX = 126; } } - else if (checkType == TileID.Grass) + else if (belowTileType == TileID.Grass) { - plantType = plantType == TileID.HallowedPlants2 ? TileID.Plants2 : TileID.Plants; + newPlantType = (plantType == TileID.HallowedPlants2 ? TileID.Plants2 : TileID.Plants); } - else if (checkType == TileID.HallowedGrass) + else if (belowTileType == TileID.HallowedGrass) { - plantType = plantType == TileID.Plants2 ? TileID.HallowedPlants2 : TileID.HallowedPlants; + newPlantType = (plantType == TileID.Plants2 ? TileID.HallowedPlants2 : TileID.HallowedPlants); } - else if (checkType == TileID.CrimsonGrass) + else if (belowTileType == TileID.CrimsonGrass) { - plantType = TileID.CrimsonPlants; + newPlantType = TileID.CrimsonPlants; } - else if (checkType == TileID.MushroomGrass) + else if (belowTileType == TileID.MushroomGrass) { - plantType = TileID.MushroomPlants; + newPlantType = TileID.MushroomPlants; while (Main.tile[x, y].TileFrameX > 72) { Main.tile[x, y].TileFrameX -= 72; } } - - // Astral grass and plant behavior - else if (checkType == ModContent.TileType()) + else if (belowTileType == ModContent.TileType()) { var isShortPlant = plantType == TileID.Plants || plantType == TileID.CorruptPlants || @@ -372,14 +424,15 @@ namespace CalamityMod.Systems plantType == TileID.HallowedPlants || plantType == TileID.MushroomPlants || plantType == TileID.JunglePlants; - plantType = isShortPlant ? ModContent.TileType() : ModContent.TileType(); + newPlantType = isShortPlant ? ModContent.TileType() : ModContent.TileType(); } + #endregion // If the tile type is not the same as the plant type, then set it equal. Otherwise, destroy it. - if (Main.tile[x, y].TileType != plantType) - Main.tile[x, y].TileType = (ushort)plantType; - else - WorldGen.KillTile(x, y, false, false, false); + if (plantType != newPlantType) + { + Main.tile[x, y].TileType = (ushort)newPlantType; + } } internal static void VineFrame(int x, int y) @@ -1301,57 +1354,48 @@ namespace CalamityMod.Systems #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(ref readonly Tile tile, int i, int j, Texture2D texture, Rectangle? sourceRectangle, Color drawColor, Vector2 positionOffset) { - var tile = Main.tile[i, j]; + int frameX = tile.TileFrameX; + int frameY = tile.TileFrameY; - int TileFrameX = tile.TileFrameX; - int TileFrameY = tile.TileFrameY; - - if (overrideTileFrame) - { - TileFrameX = 0; - TileFrameY = 0; - } - - var width = 16; - var height = 16; + int width = 16; + int height = 16; if (sourceRectangle != null) { - TileFrameX = ((Rectangle)sourceRectangle).X; - TileFrameY = ((Rectangle)sourceRectangle).Y; + frameX = ((Rectangle)sourceRectangle).X; + frameY = ((Rectangle)sourceRectangle).Y; } - var iX16 = i * 16; - var jX16 = j * 16; - var location = new Vector2(iX16, jX16); - var zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - zero = Vector2.Zero; + int iX16 = i * 16; + int jX16 = j * 16; - var offsets = -Main.screenPosition + zero + positionOffset; - var drawCoordinates = location + offsets; - if (tile.Slope == 0 && !tile.IsHalfBlock || Main.tileSolid[tile.TileType] && Main.tileSolidTop[tile.TileType]) //second one should be for platforms + Vector2 location = new Vector2(iX16, jX16); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Vector2 offsets = -Main.screenPosition + zero + positionOffset; + Vector2 drawCoordinates = location + offsets; + + if ((tile.Slope == 0 && !tile.IsHalfBlock) || (Main.tileSolid[tile.TileType] && Main.tileSolidTop[tile.TileType])) //second one should be for platforms { - Main.spriteBatch.Draw(texture, drawCoordinates, new Rectangle(TileFrameX, TileFrameY, width, height), drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, drawCoordinates, new Rectangle(frameX, frameY, width, height), drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } else if (tile.IsHalfBlock) { - Main.spriteBatch.Draw(texture, new Vector2(drawCoordinates.X, drawCoordinates.Y + 8), new Rectangle(TileFrameX, TileFrameY, width, 8), drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, new Vector2(drawCoordinates.X, drawCoordinates.Y + 8), new Rectangle(frameX, frameY, width, 8), drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } else { - var b = (byte)tile.Slope; + byte b = (byte)tile.Slope; Rectangle TileFrame; Vector2 drawPos; if (b == 1 || b == 2) { int length; int height2; - for (var a = 0; a < 8; ++a) + for (int a = 0; a < 8; ++a) { - var aX2 = a * 2; + int aX2 = a * 2; if (b == 2) { length = 16 - aX2 - 2; @@ -1363,12 +1407,12 @@ namespace CalamityMod.Systems height2 = 14 - length; } - TileFrame = new Rectangle(TileFrameX + length, TileFrameY, 2, height2); + TileFrame = new Rectangle(frameX + length, frameY, 2, height2); drawPos = new Vector2(iX16 + length, jX16 + aX2) + offsets; Main.spriteBatch.Draw(texture, drawPos, TileFrame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - TileFrame = new Rectangle(TileFrameX, TileFrameY + 14, 16, 2); + TileFrame = new Rectangle(frameX, frameY + 14, 16, 2); drawPos = new Vector2(iX16, jX16 + 14) + offsets; Main.spriteBatch.Draw(texture, drawPos, TileFrame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } @@ -1376,9 +1420,9 @@ namespace CalamityMod.Systems { int length; int height2; - for (var a = 0; a < 8; ++a) + for (int a = 0; a < 8; ++a) { - var aX2 = a * 2; + int aX2 = a * 2; if (b == 3) { length = aX2; @@ -1390,15 +1434,15 @@ namespace CalamityMod.Systems height2 = 16 - aX2; } - TileFrame = new Rectangle(TileFrameX + length, TileFrameY + 16 - height2, 2, height2); + TileFrame = new Rectangle(frameX + length, frameY + 16 - height2, 2, height2); drawPos = new Vector2(iX16 + length, jX16) + offsets; Main.spriteBatch.Draw(texture, drawPos, TileFrame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } drawPos = new Vector2(iX16, jX16) + offsets; - if (tile.TileType != ModContent.TileType()) + if (tile.TileType != EutrophicGlass.TypeCache) { - TileFrame = new Rectangle(TileFrameX, TileFrameY, 16, 2); + TileFrame = new Rectangle(frameX, frameY, 16, 2); Main.spriteBatch.Draw(texture, drawPos, TileFrame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } @@ -2019,498 +2063,5 @@ namespace CalamityMod.Systems CustomMergeFrameExplicit(x, y, myType, mergeType, out _, out _, out _, out _, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, true); } #endregion - - #region Universal Merge Code - // Code responsible for the 'Universal Tile Merge' code created to get around the issues with merging brimstone tile framing - // It'll work for any tile regardless of framing and could in theory be added to vanilla tiles as well if desired - // A single tile could also be set to blend with multiple other tiles, though a new adjacency data array will be needed for each tile type it'll merge with as well as a new call of each function so it's probably not the best - - // I chose to use bytes and byte masks to store and check the merge data so that the fully merge conditional tree wouldn't need to be called every frame for every tile - // Not sure if this is the best option, I thought it would minimise the amount of data required to store the adjacency info while being reasonably efficient - // Apologies for how unreadable this makes the code, I did my best to comment what each part of the merge tree in DrawUniversalMergeFrames is responsible for to compensate for this but it's still not ideal - // - Alta - - internal static void RegisterUniversalMerge(int tileId, int mergeType, string blendSheetPath) - { - SetUpUniversalMerge(tileId, mergeType, blendSheetPath, out var data); - GetOrCreateTileAdjacencies(tileId).Add(data); - } - - private static List GetOrCreateTileAdjacencies(int tileId) - { - if (!tileAdjacencyMap.TryGetValue(tileId, out var adjacencies)) - tileAdjacencyMap[tileId] = adjacencies = []; - - return adjacencies; - } - - /// - /// Call this in SetStaticDefaults. Used to set up the adjacency data array with the correct dimensions. - /// - internal static void SetUpUniversalMerge(int myType, int mergeType, string blendSheetPath, out MergeFrameData adjacencyData) - { - CalamityUtils.SetMerge(myType, mergeType, true); - 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, List mergeFrames) - { - var shadingColour = Lighting.GetColor(x, y); - var 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) - { - var adjacencyData = mergeFrameData.AdjacencyData; - var blendLayer = mergeFrameData.BlendSheet.Value; - var frameOffsetX = mergeFrameData.FrameOffsetX; - var frameOffsetY = mergeFrameData.FrameOffsetY; - - var zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - var drawOffset = new Vector2(x * 16 - Main.screenPosition.X, y * 16 - Main.screenPosition.Y) + zero; - - // Used for blending with metatiles/composite tiles (as in the tile being blended with is a metatile, not this tile) - var subFrameX = frameOffsetX * 270; - var subFrameY = frameOffsetY * 198; - - var thisTileData = adjacencyData[x, y]; - - // Get tile variant number - var randomFrame = myTile.TileFrameNumber; - var randomFrameX18 = randomFrame * 18; - var randomFrameX36 = randomFrame * 36; - - // Couple of commonly used masks - // bit to relative tile pos for reference - // 4 0 5 - // 3 X 1 - // 7 2 6 - - byte maskAdjSides = 0b11110000; - byte maskAdjCorners = 0b00001111; - - #region Merge Checks & Drawing - // Switch statement for the mutually exclusive states - switch (thisTileData & maskAdjSides) - { - case 0b11110000: - // All sides - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX18 + subFrameX, 18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - - case 0b01110000: - // All except north - switch (thisTileData & 0b00001100) - { - case 0b00001100: - // Extend to both north corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(144 + randomFrameX18 + subFrameX, 90 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00001000: - // Extend to northwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(198 + randomFrameX18 + subFrameX, 180 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000100: - // Extend to northeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(144 + randomFrameX18 + subFrameX, 180 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - default: - // Extend to neither corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(144 + randomFrameX18 + subFrameX, 144 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - } - - case 0b10110000: - // All except east - switch (thisTileData & 0b00000110) - { - case 0b00000110: - // Extend to both east corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(108 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000100: - // Extend to northeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(234 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000010: - // Extend to southeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(198 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - default: - // Extend to neither corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(162 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - } - - case 0b11010000: - // All except south - switch (thisTileData & 0b00000011) - { - case 0b00000011: - // Extend to both south corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(144 + randomFrameX18 + subFrameX, 72 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000010: - // Extend to southeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(144 + randomFrameX18 + subFrameX, 162 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000001: - // Extend to southwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(198 + randomFrameX18 + subFrameX, 162 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - default: - // Extend to neither corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(144 + randomFrameX18 + subFrameX, 126 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - } - - case 0b11100000: - // All except west - switch (thisTileData & 0b00001001) - { - case 0b00001001: - // Extend to both west corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(126 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000001: - // Extend to southwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(216 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00001000: - // Extend to northwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(252 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - default: - // Extend to neither corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(180 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - } - - case 0b10010000: - // North & West edges - if ((thisTileData & 0b01100010) == 0b00000010) - { - // Blending tile at southeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX36 + subFrameX, 54 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - - switch (thisTileData & 0b00000101) - { - case 0b00000101: - // Extend to both corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX36 + subFrameX, 90 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000100: - // Extend to northeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(234 + subFrameX, 54 + randomFrameX36 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000001: - // Extend to southwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(198 + subFrameX, 54 + randomFrameX36 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - default: - // Extend to neither corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX36 + subFrameX, 126 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - } - case 0b11000000: - // North & East edges - if ((thisTileData & 0b00110001) == 0b00000001) - { - // Blending tile at southwest corner - 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); - } - - switch (thisTileData & 0b00001010) - { - case 0b00001010: - // Extend to both corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX36 + subFrameX, 90 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00001000: - // Extend to northwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(252 + subFrameX, 54 + randomFrameX36 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000010: - // Extend to southeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(216 + subFrameX, 54 + randomFrameX36 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - default: - // Extend to neither corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX36 + subFrameX, 126 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - } - - case 0b01100000: - // South & East edges - if ((thisTileData & 0b10011000) == 0b00001000) - { - // Blending tile at northwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX36 + subFrameX, 72 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - - switch (thisTileData & 0b00000101) - { - case 0b00000101: - // Extend to both corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX36 + subFrameX, 108 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000100: - // Extend to northeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(216 + subFrameX, 72 + randomFrameX36 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000001: - // Extend to southwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(252 + subFrameX, 72 + randomFrameX36 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - default: - // Extend to neither corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX36 + subFrameX, 144 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - } - - case 0b00110000: - // South & West edges - if ((thisTileData & 0b11000100) == 0b00000100) - { - // Blending tile at northeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX36 + subFrameX, 72 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - - switch (thisTileData & 0b00001010) - { - case 0b00001010: - // Extend to both corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX36, 108 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00001000: - // Extend to northwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(198 + subFrameX, 72 + randomFrameX36 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - case 0b00000010: - // Extend to southeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(234 + subFrameX, 72 + randomFrameX36 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - default: - // Extend to neither corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX36 + subFrameX, 144 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return; - } - } - - // Handle edges and corners, which due to how they can be overlayed in so many ways kind of need their own way of doing things - // North Edge - if ((thisTileData & 0b11010000) == 0b10000000) - { - switch (thisTileData & 0b00001100) - { - case 0b00000000: - // Narrow - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(144 + randomFrameX18 + subFrameX, 108 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - case 0b00001000: - // Extends to Northwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(126 + subFrameX, 108 + randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - case 0b00000100: - // Extends to Northeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(108 + subFrameX, 108 + randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - default: - // Extends to both corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX18 + subFrameX, 36 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - } - } - - // East Edge - if ((thisTileData & 0b11100000) == 0b01000000) - { - switch (thisTileData & 0b00000110) - { - case 0b00000000: - // Narrow - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(90 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - case 0b00000100: - // Extends to Northeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX18 + subFrameX, 180 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - case 0b00000010: - // Extends to Southeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX18 + subFrameX, 162 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - default: - // Extends to both corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(0 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - } - } - - // South Edge - if ((thisTileData & 0b01110000) == 0b00100000) - { - switch (thisTileData & 0b00000011) - { - case 0b00000000: - // Narrow - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(144 + randomFrameX18 + subFrameX, 54 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - case 0b00000010: - // Extends to Southeast corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(108 + subFrameX, 54 + randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - case 0b00000001: - // Extends to Southwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(126 + subFrameX, 54 + randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - default: - // Extends to both corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX18 + subFrameX, 0 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - } - } - - // West Edge - if ((thisTileData & 0b10110000) == 0b00010000) - { - switch (thisTileData & 0b00001001) - { - case 0b00000000: - // Narrow - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(144 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - case 0b00000001: - // Extends to Southwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(54 + randomFrameX18 + subFrameX, 162 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - case 0b00001000: - // Extends to Northwest corner - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(54 + randomFrameX18 + subFrameX, 180 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - default: - // Extends to both corners - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(72 + subFrameX, randomFrameX18 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - break; - } - } - - // Northwest Corner - if ((thisTileData & 0b10011000) == 0b00001000) - { - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX36 + subFrameX, 72 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - - // Northeast Corner - if ((thisTileData & 0b11000100) == 0b00000100) - { - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX36 + subFrameX, 72 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - - // Southeast Corner - if ((thisTileData & 0b01100010) == 0b00000010) - { - Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(randomFrameX36 + subFrameX, 54 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - - // Southwest Corner - if ((thisTileData & 0b00110001) == 0b00000001) - { - 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 - } - - /// - /// 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, MergeFrameData data) - { - var 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) - return; - if (y < 0 || y >= Main.maxTilesY) - return; - - var tile = Main.tile[x, y]; - var north = Main.tile[x, y - 1]; - var south = Main.tile[x, y + 1]; - var west = Main.tile[x - 1, y]; - var east = Main.tile[x + 1, y]; - var southwest = Main.tile[x - 1, y + 1]; - var southeast = Main.tile[x + 1, y + 1]; - var northwest = Main.tile[x - 1, y - 1]; - var northeast = Main.tile[x + 1, y - 1]; - - // North - if (GetBlendSpecific(tile, north, blendType, false) && (north.Slope == 0 || north.Slope == SlopeType.SlopeDownLeft || north.Slope == SlopeType.SlopeDownRight)) - adjacencyData |= 0b10000000; - // East - if (GetBlendSpecific(tile, east, blendType, false) && (east.Slope == 0 || east.Slope == SlopeType.SlopeDownLeft || east.Slope == SlopeType.SlopeUpLeft)) - adjacencyData |= 0b01000000; - // South - if (GetBlendSpecific(tile, south, blendType, false) && (south.Slope == 0 || south.Slope == SlopeType.SlopeUpLeft || south.Slope == SlopeType.SlopeUpRight)) - adjacencyData |= 0b00100000; - // West - if (GetBlendSpecific(tile, west, blendType, false) && (west.Slope == 0 || west.Slope == SlopeType.SlopeDownRight || west.Slope == SlopeType.SlopeUpRight)) - adjacencyData |= 0b00010000; - // Northwest - if (GetCornerBlendCondition(tile, northwest, north, west, blendType) && (northwest.Slope == 0 || northwest.Slope == SlopeType.SlopeDownRight) && - (north.Slope == 0 || north.Slope == SlopeType.SlopeDownLeft || north.Slope == SlopeType.SlopeUpLeft) && - (west.Slope == 0 || west.Slope == SlopeType.SlopeUpLeft || west.Slope == SlopeType.SlopeUpRight)) - adjacencyData |= 0b00001000; - // Northeast - if (GetCornerBlendCondition(tile, northeast, north, east, blendType) && (northeast.Slope == 0 || northeast.Slope == SlopeType.SlopeDownLeft) && - (north.Slope == 0 || north.Slope == SlopeType.SlopeDownRight || north.Slope == SlopeType.SlopeUpRight) && - (east.Slope == 0 || east.Slope == SlopeType.SlopeUpLeft || east.Slope == SlopeType.SlopeUpRight)) - adjacencyData |= 0b00000100; - // Southeast - if (GetCornerBlendCondition(tile, southeast, south, east, blendType) && !southeast.IsHalfBlock && (southeast.Slope == 0 || southeast.Slope == SlopeType.SlopeUpLeft) && - (south.Slope == 0 || south.Slope == SlopeType.SlopeDownRight || south.Slope == SlopeType.SlopeUpRight) && - (east.Slope == 0 || east.Slope == SlopeType.SlopeDownLeft || east.Slope == SlopeType.SlopeDownRight)) - adjacencyData |= 0b00000010; - // Southwest - if (GetCornerBlendCondition(tile, southwest, south, west, blendType) && !southwest.IsHalfBlock && (southwest.Slope == 0 || southwest.Slope == SlopeType.SlopeUpRight) && - (south.Slope == 0 || south.Slope == SlopeType.SlopeDownLeft || south.Slope == SlopeType.SlopeUpLeft) && - (west.Slope == 0 || west.Slope == SlopeType.SlopeDownLeft || west.Slope == SlopeType.SlopeDownRight)) - adjacencyData |= 0b00000001; - } - - /// - /// Used to get the correct corner adjacency data because it's more complex than the simpler cardinal directions - /// - private static bool GetCornerBlendCondition(Tile myTile, Tile mergeTileCorner, Tile mergeTileEdgeA, Tile mergeTileEdgeB, int blendType) - { - int cornerType = mergeTileCorner.TileType; - int edgeAType = mergeTileEdgeA.TileType; - int edgeBType = mergeTileEdgeB.TileType; - - var isBlendTypeAdjacent = cornerType == blendType || edgeAType == blendType || edgeBType == blendType; - var areAllAdjacentsBlendable = GetBlendSpecific(myTile, mergeTileCorner, blendType, true) && GetBlendSpecific(myTile, mergeTileEdgeA, blendType, true) && GetBlendSpecific(myTile, mergeTileEdgeB, blendType, true); - - return isBlendTypeAdjacent && areAllAdjacentsBlendable; - } - #endregion } } diff --git a/Systems/TileMerging/DataStructures.cs b/Systems/TileMerging/DataStructures.cs new file mode 100644 index 0000000000..2a326cca3f --- /dev/null +++ b/Systems/TileMerging/DataStructures.cs @@ -0,0 +1,180 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.DataStructures; + +namespace CalamityMod.Systems +{ + // bit to relative tile pos for reference + // MSB 0->7 LSB + // 4 0 5 + // 2 X 3 + // 6 1 7 + + // NE N NW + // + // E □ W + // + // SE S SW + + public enum BlendSideFlags : byte + { + None = 0, + + Up = 0b1000_0000, + Down = 0b0100_0000, + Right = 0b0010_0000, + Left = 0b0001_0000, + UpLeft = 0b0000_1000, + UpRight = 0b0000_0100, + DownLeft = 0b0000_0010, + DownRight = 0b0000_0001, + + AllSide = 0b1111_1111, + + // Special Shapes + Shape_AllSide = AllSide, + ShapeCorner_UpLeft = UpLeft, + ShapeCorner_UpRight = UpRight, + ShapeCorner_DownLeft = DownLeft, + ShapeCorner_DownRight = DownRight, + + // I Shapes + + ShapeI_Up = Up | UpLeft | UpRight, + ShapeI_Up_End = Up, + ShapeI_Up_LeftEnd = Up | UpRight, + ShapeI_Up_RightEnd = Up | UpLeft, + + ShapeI_Down = Down | DownLeft | DownRight, + ShapeI_Down_End = Down, + ShapeI_Down_LeftEnd = Down | DownRight, + ShapeI_Down_RightEnd = Down | DownLeft, + + ShapeI_Left = Left | UpLeft | DownLeft, + ShapeI_Left_End = Left, + ShapeI_Left_UpEnd = Left | DownLeft, + ShapeI_Left_DownEnd = Left | UpLeft, + + ShapeI_Right = Right | UpRight | DownRight, + ShapeI_Right_End = Right, + ShapeI_Right_UpEnd = Right | DownRight, + ShapeI_Right_DownEnd = Right | UpRight, + + // L Shapes + + ShapeL_UpLeft = ShapeI_Up | ShapeI_Left, + ShapeL_UpLeft_End = ShapeI_Up_End | ShapeI_Left_End | UpLeft, + ShapeL_UpLeft_RightEnd = ShapeI_Up_RightEnd | ShapeI_Left, + ShapeL_UpLeft_DownEnd = ShapeI_Up | ShapeI_Left_DownEnd, + + ShapeL_UpRight = ShapeI_Up | ShapeI_Right, + ShapeL_UpRight_End = ShapeI_Up_End | ShapeI_Right_End | UpRight, + ShapeL_UpRight_LeftEnd = ShapeI_Up_End | ShapeI_Right, + ShapeL_UpRight_DownEnd = ShapeI_Up | ShapeI_Right_End, + + ShapeL_DownLeft = ShapeI_Down | ShapeI_Left, + ShapeL_DownLeft_End = ShapeI_Down_End | ShapeI_Left_End | DownLeft, + ShapeL_DownLeft_RightEnd = ShapeI_Down_End | ShapeI_Left, + ShapeL_DownLeft_UpEnd = ShapeI_Down | ShapeI_Left_End, + + ShapeL_DownRight = ShapeI_Down | ShapeI_Right, + ShapeL_DownRight_End = ShapeI_Down_End | ShapeI_Right_End | DownRight, + ShapeL_DownRight_LeftEnd = ShapeI_Down_End | ShapeI_Right, + ShapeL_DownRight_UpEnd = ShapeI_Down | ShapeI_Right_End, + + // U Shapes + + ShapeU_UpEmpty = ShapeI_Left | ShapeI_Right | ShapeI_Down, + ShapeU_UpEmpty_End = ShapeI_Left_End | ShapeI_Right_End | ShapeI_Down, + ShapeU_UpEmpty_LeftEnd = ShapeI_Left_End | ShapeI_Right | ShapeI_Down, + ShapeU_UpEmpty_RightEnd = ShapeI_Left | ShapeI_Right_End | ShapeI_Down, + + ShapeU_DownEmpty = ShapeI_Left | ShapeI_Right | ShapeI_Up, + ShapeU_DownEmpty_End = ShapeI_Left_End | ShapeI_Right_End | ShapeI_Up, + ShapeU_DownEmpty_LeftEnd = ShapeI_Left_End | ShapeI_Right | ShapeI_Up, + ShapeU_DownEmpty_RightEnd = ShapeI_Left | ShapeI_Right_End | ShapeI_Up, + + ShapeU_LeftEmpty = ShapeI_Up | ShapeI_Down | ShapeI_Right, + ShapeU_LeftEmpty_End = ShapeI_Up_End | ShapeI_Down_End | ShapeI_Right, + ShapeU_LeftEmpty_UpEnd = ShapeI_Up_End | ShapeI_Down | ShapeI_Right, + ShapeU_LeftEmpty_DownEnd = ShapeI_Up | ShapeI_Down_End | ShapeI_Right, + + ShapeU_RightEmpty = ShapeI_Up | ShapeI_Down | ShapeI_Left, + ShapeU_RightEmpty_End = ShapeI_Up_End | ShapeI_Down_End | ShapeI_Left, + ShapeU_RightEmpty_UpEnd = ShapeI_Up_End | ShapeI_Down | ShapeI_Left, + ShapeU_RightEmpty_DownEnd = ShapeI_Up | ShapeI_Down_End | ShapeI_Left, + } + + public struct TileBlendingData : ITileData + { + public const int Length = 8; + + private ulong SheetIndexPacked; // 8 bytes + private ulong DataPacked; // 8 bytes + + public void Clear() + { + for (int i = 0; i= Length) + throw new IndexOutOfRangeException(); + + var shift = idx * 8; + ulong value = ((ulong)data) << shift; + ulong mask = ((ulong)0xFF) << shift; + DataPacked = (DataPacked ^ (mask & DataPacked)) | value; + } + + public readonly byte GetData(int idx) + { + if (idx < 0 || idx >= Length) + throw new IndexOutOfRangeException(); + + var shift = idx * 8; + return (byte)((DataPacked >> shift) & 0xFF); + } + + public void SetSheetIndex(int idx, byte sheetIdx) + { + if (idx < 0 || idx >= Length) + throw new IndexOutOfRangeException(); + + var shift = idx * 8; + ulong value = ((ulong)sheetIdx) << shift; + ulong mask = ((ulong)0xFF) << shift; + SheetIndexPacked = (SheetIndexPacked ^ (mask & SheetIndexPacked)) | value; + } + + public readonly byte GetSheetIndex(int idx) + { + if (idx < 0 || idx >= Length) + throw new IndexOutOfRangeException(); + + var shift = idx * 8; + return (byte)((SheetIndexPacked >> shift) & 0xFF); + } + + public void Set(int idx, byte sheetIdx, byte data) + { + SetSheetIndex(idx, sheetIdx); + SetData(idx, data); + } + + public readonly void Get(int idx, out byte sheetIdx, out byte data) + { + sheetIdx = GetSheetIndex(idx); + data = GetData(idx); + } + } +} diff --git a/Systems/TileMerging/TileBlendMergeSystem.cs b/Systems/TileMerging/TileBlendMergeSystem.cs new file mode 100644 index 0000000000..5da7dde7a6 --- /dev/null +++ b/Systems/TileMerging/TileBlendMergeSystem.cs @@ -0,0 +1,140 @@ +using System; +using Terraria; +using Terraria.GameContent.Drawing; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + [Autoload(Side = ModSide.Client)] + public sealed partial class TileBlendMergeSystem : ModSystem + { + private static bool[,] _TileBlendable; // dimension: [TileTypeCount, AllBlendTextureCount] + private static bool[,] _TileBlendLooselyFillDiagonal; // dimension: [TileTypeCount, AllBlendTextureCount] + private static byte[] _TileTypeToBlendTextureSlot; // dimension: [TileTypeCount] + private static bool _IDSetsInitialized = false; + + #region Load/Unload + public override void OnModLoad() + { + // Draw Code + On_TileDrawing.DrawSingleTile += OnDrawSingleTile; + ResizeArrayHook.OnPostResizeArrays += OnResizeArrays; + } + + private static void OnResizeArrays(bool unloading) + { + var tileCount = TileLoader.TileCount; + var blendTextureCount = TileBlendTextureLoader.Count; // This count also should be updated on ResizeArrays call + + static void SetupTileTypeToBlendTextureSlot() + { + if (TileBlendTextureLoader.AllTextures == null) + return; + foreach (var blendTexture in TileBlendTextureLoader.AllTextures) + { + _TileTypeToBlendTextureSlot[blendTexture.TileType] = (byte)blendTexture.Slot; + } + } + + if (!_IDSetsInitialized) + { + _TileBlendable = new bool[tileCount, blendTextureCount + 1]; + _TileBlendLooselyFillDiagonal = new bool[tileCount, blendTextureCount + 1]; + _TileTypeToBlendTextureSlot = new byte[tileCount]; + _IDSetsInitialized = true; + SetupTileTypeToBlendTextureSlot(); + return; + } + + if (unloading) + { + _TileBlendable = null; + _TileBlendLooselyFillDiagonal = null; + _TileTypeToBlendTextureSlot = null; + return; + } + + ResizeArray2D(ref _TileBlendable, tileCount, blendTextureCount + 1); + ResizeArray2D(ref _TileBlendLooselyFillDiagonal, tileCount, blendTextureCount + 1); + Array.Resize(ref _TileTypeToBlendTextureSlot, tileCount); + SetupTileTypeToBlendTextureSlot(); + } + + private static void ResizeArray2D(ref T[,] array, int newColNum, int newRowNum) + { + var newArray = new T[newColNum, newRowNum]; + int colCount = array.GetLength(1); + int newColCount = newRowNum; + int cols = array.GetUpperBound(0); + for (int co = 0; co <= cols; co++) + Array.Copy(array, co * colCount, newArray, co * newColCount, colCount); + array = newArray; + } + + private static void SetupMergeData() + { + foreach (var blendTexture in TileBlendTextureLoader.AllTextures) + { + blendTexture.BakeBlendTexture(blendTexture.TextureAsset.Value); + } + } + #endregion + + #region Public API + public static void RegisterMerge(int myType, int blendTileType, bool looselyFillDiagonal = false) + { + if (Main.dedServ) + return; + + if (myType == blendTileType) + return; + + if (!_TileTypeToBlendTextureSlot.IndexInRange(myType)) + return; + + if (!_TileTypeToBlendTextureSlot.IndexInRange(blendTileType)) + return; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[blendTileType]; + if (blendTextureSlot == TileBlendTextureLoader.EmptySlot) + return; + + _TileBlendable[myType, blendTextureSlot] = true; + _TileBlendLooselyFillDiagonal[myType, blendTextureSlot] = looselyFillDiagonal; + CalamityUtils.SetMerge(myType, blendTileType, true); + } + + public static void RegisterMerge(int myType, TileBlendTexture blendTexture, bool looselyFillDiagonal = false) + { + if (Main.dedServ) + return; + + if (blendTexture == null) + return; + + if (blendTexture.Slot < 0) + return; + + if (!_TileTypeToBlendTextureSlot.IndexInRange(myType)) + return; + + var blendTileType = blendTexture.TileType; + if (myType == blendTileType) // Self blending should never be case, That will be extremely heavy to render! + return; + + _TileBlendable[myType, blendTexture.Slot] = true; + _TileBlendLooselyFillDiagonal[myType, blendTexture.Slot] = looselyFillDiagonal; + CalamityUtils.SetMerge(myType, blendTileType, true); + } + + public static void RegisterMerge(int myType, bool looselyFillDiagonal = false) where T : TileBlendTexture + { + if (Main.dedServ) + return; + + var blendTexture = ModContent.GetInstance(); + RegisterMerge(myType, blendTexture, looselyFillDiagonal); + } + #endregion + } +} diff --git a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs new file mode 100644 index 0000000000..207c4bc4ea --- /dev/null +++ b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs @@ -0,0 +1,154 @@ +using System; +using Microsoft.Xna.Framework.Graphics; +using Terraria.DataStructures; +using Terraria; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Terraria.GameContent.Drawing; +using System.Reflection; +using Terraria.ID; + +namespace CalamityMod.Systems +{ + public sealed partial class TileBlendMergeSystem : ModSystem + { + private static readonly BindingFlags NonPublicStatic = BindingFlags.NonPublic | BindingFlags.Static; + private static readonly BindingFlags NonPublicInstance = BindingFlags.NonPublic | BindingFlags.Instance; + + private static readonly FastField MediumQualityLightRequirement = new("_mediumQualityLightingRequirement", NonPublicInstance); + private static readonly FastField HighQualityLightRequirement = new("_highQualityLightingRequirement", NonPublicInstance); + + private readonly static Rectangle[] Rects9Slice = [ + new Rectangle(x: 0, y: 0, width: 4, height: 4), + new Rectangle(x: 4, y: 0, width: 8, height: 4), + new Rectangle(x: 12, y: 0, width: 4, height: 4), + + new Rectangle(x: 0, y: 4, width: 4, height: 8), + new Rectangle(x: 4, y: 4, width: 8, height: 8), + new Rectangle(x: 12, y: 4, width: 4, height: 8), + + new Rectangle(x: 0, y: 12, width: 4, height: 4), + new Rectangle(x: 4, y: 12, width: 8, height: 4), + new Rectangle(x: 12, y: 12, width: 4, height: 4), + ]; + + private readonly static Rectangle[] Rects4Slice = [ + new Rectangle(x: 0, y: 0, width: 8, height: 8), + new Rectangle(x: 8, y: 0, width: 8, height: 8), + new Rectangle(x: 0, y: 8, width: 8, height: 8), + new Rectangle(x: 8, y: 8, width: 8, height: 8), + ]; + + private enum SliceState : byte + { + None, + Slice_4, + Slice_9 + } + + private static void OnDrawSingleTile(On_TileDrawing.orig_DrawSingleTile orig, TileDrawing self, TileDrawInfo drawData, bool solidLayer, int waterStyleOverride, Vector2 screenPosition, Vector2 screenOffset, int tileX, int tileY) + { + orig(self, drawData, solidLayer, waterStyleOverride, screenPosition, screenOffset, tileX, tileY); + + var tile = drawData.tileCache; + var tileType = tile.TileType; + + Color tileLight = drawData.tileLight; + if (tileLight.R <= 0 && tileLight.G <= 0 && tileLight.B <= 0) + return; + + // Generic Drawing Parameter + Vector2 drawPos = new Vector2(tileX * 16, tileY * 16) - screenPosition + screenOffset; + var tileRandomFrame = Math.Clamp(tile.TileFrameNumber, 0, 2); + var isFullBright = tile.IsTileFullbright; + + // Sliced Rendering + var sliceRenderingPrepared = false; + var slices = drawData.colorSlices; + int sliceLength = 0; + var sliceRects = Array.Empty(); + var sliceState = SliceState.None; + var shouldTileShine = ShouldTileShine(tileType, (short)(drawData.tileFrameX + drawData.addFrX)); + + var blendingData = tile.Get(); // Since we are not editing the value, we can just copy the values from here + for (int idx = 0; idx < TileBlendingData.Length; idx++) + { + blendingData.Get(idx, out var sheetIdx, out var data); + + // Break here as standard for TileBlendingData is 0->Count fill, so further fields should be also Invalid + if (sheetIdx == TileBlendTextureLoader.EmptySlot) + break; + + var rect = TileBlendTexture.SideFlagsToSheetRect(data); + var texture = TileBlendTextureLoader.Registry[sheetIdx].BlendTextures[tileRandomFrame]; + + // Prepare Slice Rendering + if (!sliceRenderingPrepared) + { + // Is HalfBlock condition is also in vanilla, so we follow that + if (Lighting.NotRetro && !tile.IsHalfBlock && !TileID.Sets.DontDrawTileSliced[tileType]) + { + var midQualityThreshold = MediumQualityLightRequirement.Get(self); + var highQualityThreshold = HighQualityLightRequirement.Get(self); + if (tileLight.IsAnyChannelGreaterThan(highQualityThreshold)) + { + sliceLength = 9; + sliceState = SliceState.Slice_9; + sliceRects = Rects9Slice; + Lighting.GetColor9Slice(tileX, tileY, ref slices); + } + else if (tileLight.IsAnyChannelGreaterThan(midQualityThreshold)) + { + sliceLength = 4; + sliceState = SliceState.Slice_4; + sliceRects = Rects4Slice; + Lighting.GetColor4Slice(tileX, tileY, ref slices); + } + } + + sliceRenderingPrepared = true; + } + + // No Slice Drawing + if (sliceState == SliceState.None || isFullBright) + { + var drawColor = isFullBright ? Color.White : tileLight; + Main.spriteBatch.Draw(texture, drawPos, rect, drawColor, rotation: 0.0f, origin: default, scale: 1.0f, SpriteEffects.None, layerDepth: 0.0f); + continue; + } + + // Sliced Drawing + for (int i = 0; i < sliceLength; i++) + { + var drawRect = sliceRects[i]; + drawRect.X += rect.X; + drawRect.Y += rect.Y; + + var drawColorVec = (tileLight.ToVector3() + slices[i]) * 0.5f; + drawColorVec *= drawData.colorTint.ToVector3(); + + // Tile is Actucated, Reduce brightness + if (tile.IsActuated) + { + drawColorVec *= 0.4f; + } + + // Tile is shine + if (shouldTileShine) + { + Main.shine(ref drawColorVec, tileType); + } + + Main.spriteBatch.Draw(texture, drawPos, rect, new Color(drawColorVec), rotation: 0.0f, origin: default, scale: 1.0f, SpriteEffects.None, layerDepth: 0.0f); + } + } + } + + private static MethodInfo ShouldTileShineMethod; + private static bool ShouldTileShine(ushort type, short frameX) + { + ShouldTileShineMethod ??= typeof(TileDrawing).GetMethod("ShouldTileShine", NonPublicStatic); + return (bool)ShouldTileShineMethod.Invoke(null, [type, frameX]); + } + } +} diff --git a/Systems/TileMerging/TileBlendMergeSystem_GlobalTile.cs b/Systems/TileMerging/TileBlendMergeSystem_GlobalTile.cs new file mode 100644 index 0000000000..e20ad5757d --- /dev/null +++ b/Systems/TileMerging/TileBlendMergeSystem_GlobalTile.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public sealed partial class TileBlendMergeSystem : ModSystem + { + #region Don't mind this, This is a small GlobalTile for hooks + [Autoload(Side = ModSide.Client)] + private class FancyTileMergeGlobalTile : GlobalTile + { + [SuppressMessage("Simplify Method Call", "IDE0002", Justification = "Leave this alone for Consistency")] + public override void PostSetupTileMerge() + { + TileBlendMergeSystem.SetupMergeData(); + } + + public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) + { + TileBlendMergeSystem.TileFrame(i, j, type); + return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); + } + } + #endregion + } +} diff --git a/Systems/TileMerging/TileBlendMergeSystem_TileFrame.cs b/Systems/TileMerging/TileBlendMergeSystem_TileFrame.cs new file mode 100644 index 0000000000..5387070e05 --- /dev/null +++ b/Systems/TileMerging/TileBlendMergeSystem_TileFrame.cs @@ -0,0 +1,400 @@ +using System.Runtime.CompilerServices; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +using BlendSidesReg = System.Collections.Generic.Dictionary; + +namespace CalamityMod.Systems +{ + public sealed partial class TileBlendMergeSystem : ModSystem + { + private static void TileFrame(int i, int j, int type) + { + if (!WorldGen.InWorld(i, j)) + return; + + var tile = Main.tile[i, j]; + tile.Get().Clear(); + + if (!tile.HasTile) // Is this even possible? But I'm doing this for sanity check anyways + return; + + var blendDataUniqueIndex = 0; + var blendSidesReg = PopulateBlendSidesReg(i, j, tile.TileType); + + CalculateSides(i, j, in blendSidesReg); + + foreach (var pair in blendSidesReg) + { + var blendTextureSlot = pair.Key; + var sideFlags = pair.Value; + + if (sideFlags != BlendSideFlags.None) + { + tile.Get().Set(blendDataUniqueIndex, (byte)blendTextureSlot, (byte)sideFlags); + blendDataUniqueIndex++; + } + } + } + + private static void CalculateSides(int i, int j, in BlendSidesReg blendSidesReg) + { + _ = TryGetTile(i, j, out var centerTile, out _); + + bool leftMerged = false; + bool rightMerged = false; + bool upMerged = false; + bool downMerged = false; + + #region Basic 4 Direction Merges + + bool hasLeft = TryGetTile(i - 1, j, out var leftTile, out var leftType); + if (hasLeft && HasLeftMerge(centerTile, leftTile)) + { + leftMerged = true; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[leftType]; + if (blendSidesReg.ContainsKey(blendTextureSlot)) + { + blendSidesReg[blendTextureSlot] |= BlendSideFlags.Left; + } + } + + bool hasRight = TryGetTile(i + 1, j, out var rightTile, out var rightType); + if (hasRight && HasRightMerge(centerTile, rightTile)) + { + rightMerged = true; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[rightType]; + if (blendSidesReg.ContainsKey(blendTextureSlot)) + { + blendSidesReg[blendTextureSlot] |= BlendSideFlags.Right; + } + } + + bool hasUp = TryGetTile(i, j - 1, out var upTile, out var upType); + if (hasUp && HasUpMerge(centerTile, upTile)) + { + upMerged = true; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[upType]; + if (blendSidesReg.ContainsKey(blendTextureSlot)) + { + blendSidesReg[blendTextureSlot] |= BlendSideFlags.Up; + } + } + + bool hasDown = TryGetTile(i, j + 1, out var downTile, out var downType); + if (hasDown && HasDownMerge(centerTile, downTile)) + { + downMerged = true; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[downType]; + if (blendSidesReg.ContainsKey(blendTextureSlot)) + { + blendSidesReg[blendTextureSlot] |= BlendSideFlags.Down; + } + } + + #endregion + + #region Diagonal Direction Merges + + bool upLeftMerged = false; + bool upRightMerged = false; + bool downLeftMerged = false; + bool downRightMerged = false; + + bool hasUpLeft = TryGetTile(i - 1, j - 1, out var upLeftTile, out var upLeftType); + if (hasUpLeft && upMerged && leftMerged && HasRightMerge(upLeftTile, upTile) && HasDownMerge(upLeftTile, leftTile)) + { + upLeftMerged = true; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[upLeftType]; + if (blendSidesReg.ContainsKey(blendTextureSlot)) + { + blendSidesReg[blendTextureSlot] |= BlendSideFlags.UpLeft; + } + } + + bool hasUpRight = TryGetTile(i + 1, j - 1, out var upRightTile, out var upRightType); + if (hasUpRight && upMerged && rightMerged && HasLeftMerge(upRightTile, upTile) && HasDownMerge(upRightTile, leftTile)) + { + upRightMerged = true; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[upRightType]; + if (blendSidesReg.ContainsKey(blendTextureSlot)) + { + blendSidesReg[blendTextureSlot] |= BlendSideFlags.UpRight; + } + } + + bool hasDownLeft = TryGetTile(i - 1, j + 1, out var downLeftTile, out var downLeftType); + if (hasDownLeft && downMerged && leftMerged && HasRightMerge(downLeftTile, downTile) && HasUpMerge(downLeftTile, leftTile)) + { + downLeftMerged = true; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[downLeftType]; + if (blendSidesReg.ContainsKey(blendTextureSlot)) + { + blendSidesReg[blendTextureSlot] |= BlendSideFlags.DownLeft; + } + } + + bool hasDownRight = TryGetTile(i + 1, j + 1, out var downRightTile, out var downRightType); + if (hasDownRight && downMerged && rightMerged && HasLeftMerge(downRightTile, downTile) && HasUpMerge(downLeftTile, leftTile)) + { + downRightMerged = true; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[downRightType]; + if (blendSidesReg.ContainsKey(blendTextureSlot)) + { + blendSidesReg[blendTextureSlot] |= BlendSideFlags.DownRight; + } + } + + #endregion + + #region Special Corner Cases + foreach (var kv in blendSidesReg) + { + var slot = kv.Key; + var sides = kv.Value; + + // Up + if (sides.HasFlag(BlendSideFlags.Up)) + { + if (leftMerged && upLeftMerged && IsBlendableOrSame(leftType, slot) && IsBlendableOrSame(upLeftType, slot)) + { + blendSidesReg[slot] |= BlendSideFlags.UpLeft; + } + + if (rightMerged && upRightMerged && IsBlendableOrSame(rightType, slot) && IsBlendableOrSame(upRightType, slot)) + { + blendSidesReg[slot] |= BlendSideFlags.UpRight; + } + } + + // Down + if (sides.HasFlag(BlendSideFlags.Down)) + { + if (leftMerged && downLeftMerged && IsBlendableOrSame(leftType, slot) && IsBlendableOrSame(downLeftType, slot)) + { + blendSidesReg[slot] |= BlendSideFlags.DownLeft; + } + + if (rightMerged && downRightMerged && IsBlendableOrSame(rightType, slot) && IsBlendableOrSame(downRightType, slot)) + { + blendSidesReg[slot] |= BlendSideFlags.DownRight; + } + } + + // Left + if (sides.HasFlag(BlendSideFlags.Left)) + { + if (upLeftMerged && upMerged && IsBlendableOrSame(upLeftType, slot) && IsBlendableOrSame(upType, slot)) + { + blendSidesReg[slot] |= BlendSideFlags.UpLeft; + } + + if (downLeftMerged && downMerged && IsBlendableOrSame(downLeftType, slot) && IsBlendableOrSame(downType, slot)) + { + blendSidesReg[slot] |= BlendSideFlags.DownLeft; + } + } + + // Right + if (sides.HasFlag(BlendSideFlags.Right)) + { + if (upRightMerged && upMerged && IsBlendableOrSame(upRightType, slot) && IsBlendableOrSame(upType, slot)) + { + blendSidesReg[slot] |= BlendSideFlags.UpRight; + } + + if (downRightMerged && downMerged && IsBlendableOrSame(downRightType, slot) && IsBlendableOrSame(downType, slot)) + { + blendSidesReg[slot] |= BlendSideFlags.DownRight; + } + } + } + #endregion + } + + #region Merge Utilities + private static bool IsBlendableOrSame(int tileType, int blendTextureSlot) + { + if (_TileBlendable[tileType, blendTextureSlot]) return true; + if (!_TileBlendLooselyFillDiagonal[tileType, blendTextureSlot] && _TileTypeToBlendTextureSlot[tileType] == blendTextureSlot) return true; + return false; + } + + private static bool HasLeftMerge(Tile tileOnCenter, Tile tileOnLeft) + { + if (!IsMergable(tileOnCenter.TileType, tileOnLeft.TileType)) return false; + if (!HasLeftSolid(tileOnCenter)) return false; + if (!HasRightSolid(tileOnLeft)) return false; + + return true; + } + + private static bool HasRightMerge(Tile tileOnCenter, Tile tileOnRight) + { + if (!IsMergable(tileOnCenter.TileType, tileOnRight.TileType)) return false; + if (!HasRightSolid(tileOnCenter)) return false; + if (!HasLeftSolid(tileOnRight)) return false; + + return true; + } + + private static bool HasUpMerge(Tile tileOnCenter, Tile tileOnUp) + { + if (!IsMergable(tileOnCenter.TileType, tileOnUp.TileType)) return false; + if (!HasUpSolid(tileOnCenter)) return false; + if (!HasDownSolid(tileOnUp)) return false; + + return true; + } + + private static bool HasDownMerge(Tile tileOnCenter, Tile tileOnDown) + { + if (!IsMergable(tileOnCenter.TileType, tileOnDown.TileType)) return false; + if (!HasDownSolid(tileOnCenter)) return false; + if (!HasUpSolid(tileOnDown)) return false; + + return true; + } + + // BlockType.Solid, BlockType.SlopeUpLeft, BlockType.SlopeDownLeft + // 024 + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static bool HasLeftSolid(Tile tile) => ((int)tile.BlockType & 1) == 0; + + // BlockType.Solid, BlockType.DownRight, BlockType.SlopeUpRight + // 035 (there is no way to optimize this) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static bool HasRightSolid(Tile tile) + { + int b = (int)tile.BlockType; + return b == 0 || b == 3 || b == 5; + } + + // BlockType.Solid, BlockType.HalfBlock, BlockType.SlopeUpLeft, BlockType.SlopeUpRight + // 0145 + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static bool HasUpSolid(Tile tile) + { + int b = (int)tile.BlockType; + return b < 2 || b > 3; + } + + // BlockType.Solid, BlockType.SlopeDownLeft, BlockType.SlopeDownRight + // 023 + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static bool HasDownSolid(Tile tile) + { + int b = (int)tile.BlockType; + return (b & 4) == 0 && b != 1; + } + + private static bool IsMergable(int type, int otherType) + { + if (type < 0 || otherType < 0) + return false; + + if (type == otherType) + return true; + + var canBeMerged = Main.tileMerge[type][otherType]; + if (Main.tileBlendAll[type]) + { + return canBeMerged && !TileID.Sets.BlockMergesWithMergeAllBlock[otherType]; + } + else + { + return canBeMerged; + } + } + + private static BlendSidesReg PopulateBlendSidesReg(int i, int j, int centerType) + { + var reg = new BlendSidesReg(); + + int left = GetTileType(i - 1, j); + int right = GetTileType(i + 1, j); + + int up = GetTileType(i, j - 1); + int upLeft = GetTileType(i - 1, j - 1); + int upRight = GetTileType(i + 1, j - 1); + + int down = GetTileType(i, j + 1); + int downLeft = GetTileType(i - 1, j + 1); + int downRight = GetTileType(i + 1, j + 1); + + void Populate(int sideType) + { + if (sideType < 0) + return; + + if (!_TileTypeToBlendTextureSlot.IndexInRange(sideType)) + return; + + var blendTextureSlot = _TileTypeToBlendTextureSlot[sideType]; + if (blendTextureSlot == TileBlendTextureLoader.EmptySlot) + return; + + if (_TileBlendable[centerType, blendTextureSlot]) + { + reg[blendTextureSlot] = BlendSideFlags.None; + } + } + + Populate(left); + Populate(right); + + Populate(up); + Populate(upLeft); + Populate(upRight); + + Populate(down); + Populate(downLeft); + Populate(downRight); + + return reg; + } + + private static int GetTileType(int i, int j) + { + if (!WorldGen.InWorld(i, j)) + return -1; + + var tile = Main.tile[i, j]; + if (!tile.HasTile) + return -1; + + return tile.TileType; + } + + private static bool TryGetTile(int i, int j, out Tile tile, out int type) + { + if (!WorldGen.InWorld(i, j)) + { + tile = default; + type = -1; + return false; + } + + tile = Main.tile[i, j]; + if (!tile.HasTile) + { + tile = default; + type = -1; + return false; + } + + type = tile.TileType; + return true; + } + #endregion + } +} diff --git a/Systems/TileMerging/TileBlendTexture.cs b/Systems/TileMerging/TileBlendTexture.cs new file mode 100644 index 0000000000..4dc642f81a --- /dev/null +++ b/Systems/TileMerging/TileBlendTexture.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + [Autoload(Side = ModSide.Client)] + public abstract partial class TileBlendTexture : ModTexturedType + { + #region Constants + public const byte EmptySheetIndex = byte.MaxValue; + public const int VariantCount = 3; + + public const int BlendTextureXCount = 16; + public const int BlendTextureYCount = 16; + + // FA: 2024/OCT/01 + // Removing Margin as I believe artifacts never happens on Terraria + // And built sheets are not meant to be edited/viewed by human. + // But if graphic artifact happens, Please set these value to 18 and remove this comment + public const int BlendTextureFrameWidth = 16; + public const int BlendTextureFrameHeight = 16; + + public const int BlendTextureWidth = BlendTextureFrameWidth * BlendTextureXCount; + public const int BlendTextureHeight = BlendTextureFrameHeight * BlendTextureYCount; + #endregion + + + #region Properties + public Asset TextureAsset { get; private set; } + public int Slot { get; private set; } = -1; + public RenderTarget2D[] BlendTextures { get; private set; } // dimension: [3] + #endregion + + + #region Overrides + public abstract int TileType { get; } + #endregion + + + #region Setups + protected sealed override void Register() + { + Slot = TileBlendTextureLoader.Register(this); + TextureAsset = ModContent.Request(Texture); + BlendTextures = new RenderTarget2D[3]; + + Main.QueueMainThreadAction(() => + { + for (int v = 0; v < VariantCount; v++) + BlendTextures[v] = new( + Main.instance.GraphicsDevice, + BlendTextureWidth, + BlendTextureHeight, + mipMap: false, + preferredFormat: SurfaceFormat.Color, + preferredDepthFormat: DepthFormat.None, + preferredMultiSampleCount: 0, + usage: RenderTargetUsage.PreserveContents); + }); + } + + public sealed override void SetupContent() + { + SetStaticDefaults(); + } + + public sealed override void Unload() + { + Main.QueueMainThreadAction(() => + { + if (BlendTextures is not null) + { + foreach (var rt in BlendTextures) + { + if (rt is null) + continue; + + if (rt.IsDisposed) + continue; + + rt.Dispose(); + } + + Array.Clear(BlendTextures); + BlendTextures = null; + } + }); + + PostUnload(); + } + + public virtual void PostUnload() + { + + } + #endregion + + + #region Public API + public void RebuildBlendSheet(Texture2D texture = null) + { + texture ??= TextureAsset.Value; + BakeBlendTexture(texture); + } + #endregion + } +} diff --git a/Systems/TileMerging/TileBlendTextureLoader.cs b/Systems/TileMerging/TileBlendTextureLoader.cs new file mode 100644 index 0000000000..e5ec3cf46a --- /dev/null +++ b/Systems/TileMerging/TileBlendTextureLoader.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + internal sealed class TileBlendTextureLoader : ModSystem + { + internal const int EmptySlot = 0; + internal const int StartingIndex = 1; + internal const int MaxCount = 255; + + internal static TileBlendTexture[] Registry { get; private set; } + internal static IEnumerable AllTextures => Registry?.Where(tex => tex is not null); + internal static int Count => _UniqueSlot - StartingIndex; + + private static int _UniqueSlot = StartingIndex; + + public override void Load() + { + Registry = new TileBlendTexture[MaxCount]; + } + + public override void Unload() + { + Registry = null; + _UniqueSlot = StartingIndex; + } + + internal static int Register(TileBlendTexture sheet) + { + if (sheet.Slot >= 0) + throw new ArgumentException("Argument has already registered to System", nameof(sheet)); + + if (_UniqueSlot >= MaxCount) + throw new InvalidOperationException($"Slots are all used up to {MaxCount}, We can't allocate more!"); + + var slot = _UniqueSlot++; + Registry[slot] = sheet; + return slot; + } + } +} diff --git a/Systems/TileMerging/TileBlendTexture_Baking.cs b/Systems/TileMerging/TileBlendTexture_Baking.cs new file mode 100644 index 0000000000..7b923009c2 --- /dev/null +++ b/Systems/TileMerging/TileBlendTexture_Baking.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public abstract partial class TileBlendTexture : ModTexturedType + { + #region Sheet Baking Process + internal void BakeBlendTexture(Texture2D texture) + { + // It's baking moment + Main.QueueMainThreadAction(() => + { + BakeBlendTexture_Inner(texture); + }); + } + + private void BakeBlendTexture_Inner(Texture2D texture) + { + if (texture == null) + throw new ArgumentNullException(nameof(texture), "Texture is Null!"); + + if (texture.IsDisposed) + throw new ArgumentException(paramName: nameof(texture), message: "Texture is Disposed!"); + + for (int v = 0; v < VariantCount; v++) + { + var renderTarget = BlendTextures[v]; + var graphicsDevice = Main.instance.GraphicsDevice; + graphicsDevice.SetRenderTarget(renderTarget); + graphicsDevice.Clear(Color.Transparent); + + Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.AlphaBlend, null, Matrix.Identity, () => + { + for (int i = 0; i < 256; i++) + { + var drawPos = SideFlagsToPositionInSheet((byte)i); + var mergeSides = (BlendSideFlags)i; + + // Easy cases, It match on Shape Lookup Sheet Directly + if (_ShapeLookup.TryGetValue(mergeSides, out var rects)) + { + Main.spriteBatch.Draw(texture, drawPos, rects[v], Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.0f); + continue; + } + + var extractedShapes = ConsumeMergeSides(mergeSides); + foreach (var shape in extractedShapes) + { + if (_ShapeLookup.TryGetValue(shape, out var shapeRects)) + { + Main.spriteBatch.Draw(texture, drawPos, shapeRects[v], Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.0f); + } + } + } + }); + + graphicsDevice.SetRenderTarget(null); + } + } + + private static IEnumerable ConsumeMergeSides(BlendSideFlags sideFlags) + { + if (sideFlags == BlendSideFlags.None) + yield break; + + foreach (var shapeGroup in _ShapeConsumeMap) + { + foreach (var shape in shapeGroup) + { + if ((shape & sideFlags) == shape) + { + // Consume Shape it given and push the extracted shape + sideFlags &= ~shape; + yield return shape; + } + } + + if (sideFlags == BlendSideFlags.None) + yield break; + } + yield break; + } + #endregion + + #region Utils + public static Rectangle SideFlagsToSheetRect(byte data) + { + int y = Math.DivRem(data, 16, out int x); + return new Rectangle(x * BlendTextureFrameWidth, y * BlendTextureFrameHeight, 16, 16); + } + + public static Vector2 SideFlagsToPositionInSheet(byte data) + { + int y = Math.DivRem(data, 16, out int x); + return new Vector2(x * BlendTextureFrameWidth, y * BlendTextureFrameHeight); + } + #endregion + } +} diff --git a/Systems/TileMerging/TileBlendTexture_Lookup.cs b/Systems/TileMerging/TileBlendTexture_Lookup.cs new file mode 100644 index 0000000000..8fd90fccb3 --- /dev/null +++ b/Systems/TileMerging/TileBlendTexture_Lookup.cs @@ -0,0 +1,319 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +using static CalamityMod.Systems.BlendSideFlags; + +namespace CalamityMod.Systems +{ + public abstract partial class TileBlendTexture : ModTexturedType + { + // Welcome to Hardcoded hell + // Do NOT change anything in here unless you understand absolutely everything + + #region Sheet Rects + // I HATE THIS GAME I HATE THIS GAME I HATE THIS GAME I HATE THIS GAME I HATE THIS GAME + // I HATE THIS GAME I HATE THIS GAME I HATE THIS GAME I HATE THIS GAME I HATE THIS GAME + // I HATE THIS GAME I HATE THIS GAME I HATE THIS GAME I HATE THIS GAME I HATE THIS GAME + + // + // I shapes (16 variants) + // + + private static readonly Rectangle[] _I_Up = Create3RectsDirX(1, 2); + private static readonly Rectangle[] _I_Up_End = Create3RectsDirX(8, 6); + private static readonly Rectangle[] _I_Up_LeftEnd = Create3RectsDirY(6, 6); + private static readonly Rectangle[] _I_Up_RightEnd = Create3RectsDirY(7, 6); + + private static readonly Rectangle[] _I_Down = Create3RectsDirX(1, 0); + private static readonly Rectangle[] _I_Down_End = Create3RectsDirX(8, 3); + private static readonly Rectangle[] _I_Down_LeftEnd = Create3RectsDirY(6, 3); + private static readonly Rectangle[] _I_Down_RightEnd = Create3RectsDirY(7, 3); + + private static readonly Rectangle[] _I_Left = Create3RectsDirY(4, 0); + private static readonly Rectangle[] _I_Left_End = Create3RectsDirY(8, 0); + private static readonly Rectangle[] _I_Left_UpEnd = Create3RectsDirX(3, 9); + private static readonly Rectangle[] _I_Left_DownEnd = Create3RectsDirX(3, 10); + + private static readonly Rectangle[] _I_Right = Create3RectsDirY(0, 0); + private static readonly Rectangle[] _I_Right_End = Create3RectsDirY(5, 0); + private static readonly Rectangle[] _I_Right_UpEnd = Create3RectsDirX(0, 9); + private static readonly Rectangle[] _I_Right_DownEnd = Create3RectsDirX(0, 10); + + // + // L shapes (16 variants) + // + + private static readonly Rectangle[] _L_UpLeft = Create3RectsDirX(0, 5, increment: 2); + private static readonly Rectangle[] _L_UpLeft_End = Create3RectsDirX(0, 7, increment: 2); + private static readonly Rectangle[] _L_UpLeft_RightEnd = Create3RectsDirY(11, 3, increment: 2); + private static readonly Rectangle[] _L_UpLeft_DownEnd = Create3RectsDirY(13, 3, increment: 2); + + + private static readonly Rectangle[] _L_UpRight = Create3RectsDirX(1, 5, increment: 2); + private static readonly Rectangle[] _L_UpRight_End = Create3RectsDirX(1, 7, increment: 2); + private static readonly Rectangle[] _L_UpRight_LeftEnd = Create3RectsDirY(12, 3, increment: 2); + private static readonly Rectangle[] _L_UpRight_DownEnd = Create3RectsDirY(14, 3, increment: 2); + + + private static readonly Rectangle[] _L_DownLeft = Create3RectsDirX(0, 6, increment: 2); + private static readonly Rectangle[] _L_DownLeft_End = Create3RectsDirX(0, 8, increment: 2); + private static readonly Rectangle[] _L_DownLeft_RightEnd = Create3RectsDirY(11, 4, increment: 2); + private static readonly Rectangle[] _L_DownLeft_UpEnd = Create3RectsDirY(13, 4, increment: 2); + + + private static readonly Rectangle[] _L_DownRight = Create3RectsDirX(1, 6, increment: 2); + private static readonly Rectangle[] _L_DownRight_End = Create3RectsDirX(1, 8, increment: 2); + private static readonly Rectangle[] _L_DownRight_LeftEnd = Create3RectsDirY(12, 4, increment: 2); + private static readonly Rectangle[] _L_DownRight_UpEnd = Create3RectsDirY(14, 4, increment: 2); + + // + // U shapes (16 variants) + // + + private static readonly Rectangle[] _U_UpEmpty = Create3RectsDirX(8, 5); + private static readonly Rectangle[] _U_UpEmpty_End = Create3RectsDirX(8, 8); + private static readonly Rectangle[] _U_UpEmpty_LeftEnd = Create3RectsDirX(8, 10); + private static readonly Rectangle[] _U_UpEmpty_RightEnd = Create3RectsDirX(11, 10); + + private static readonly Rectangle[] _U_DownEmpty = Create3RectsDirX(8, 4); + private static readonly Rectangle[] _U_DownEmpty_End = Create3RectsDirX(8, 7); + private static readonly Rectangle[] _U_DownEmpty_LeftEnd = Create3RectsDirX(8, 9); + private static readonly Rectangle[] _U_DownEmpty_RightEnd = Create3RectsDirX(11, 9); + + private static readonly Rectangle[] _U_LeftEmpty = Create3RectsDirY(7, 0); + private static readonly Rectangle[] _U_LeftEmpty_End = Create3RectsDirY(10, 0); + private static readonly Rectangle[] _U_LeftEmpty_UpEnd = Create3RectsDirY(12, 0); + private static readonly Rectangle[] _U_LeftEmpty_DownEnd = Create3RectsDirY(14, 0); + + private static readonly Rectangle[] _U_RightEmpty = Create3RectsDirY(6, 0); + private static readonly Rectangle[] _U_RightEmpty_End = Create3RectsDirY(9, 0); + private static readonly Rectangle[] _U_RightEmpty_UpEnd = Create3RectsDirY(11, 0); + private static readonly Rectangle[] _U_RightEmpty_DownEnd = Create3RectsDirY(13, 0); + + // + // Special shapes (5 variants) + // + + private static readonly Rectangle[] _AllClosed = Create3RectsDirX(1, 1); + private static readonly Rectangle[] _Corner_UpLeft = Create3RectsDirX(1, 4, increment: 2); + private static readonly Rectangle[] _Corner_UpRight = Create3RectsDirX(0, 4, increment: 2); + private static readonly Rectangle[] _Corner_DownLeft = Create3RectsDirX(1, 3, increment: 2); + private static readonly Rectangle[] _Corner_DownRight = Create3RectsDirX(0, 3, increment: 2); + + // TOTAL: 53 + #endregion + + #region Sheet Lookup + private static readonly Dictionary _ShapeLookup = new() + { + // Special Shapes: 5 + [Shape_AllSide] = _AllClosed, + [ShapeCorner_UpLeft] = _Corner_UpLeft, + [ShapeCorner_UpRight] = _Corner_UpRight, + [ShapeCorner_DownLeft] = _Corner_DownLeft, + [ShapeCorner_DownRight] = _Corner_DownRight, + + // I Shape: 16 + [ShapeI_Up] = _I_Up, + [ShapeI_Up_End] = _I_Up_End, + [ShapeI_Up_RightEnd] = _I_Up_RightEnd, + [ShapeI_Up_LeftEnd] = _I_Up_LeftEnd, + + [ShapeI_Down] = _I_Down, + [ShapeI_Down_End] = _I_Down_End, + [ShapeI_Down_RightEnd] = _I_Down_RightEnd, + [ShapeI_Down_LeftEnd] = _I_Down_LeftEnd, + + [ShapeI_Left] = _I_Left, + [ShapeI_Left_End] = _I_Left_End, + [ShapeI_Left_DownEnd] = _I_Left_DownEnd, + [ShapeI_Left_UpEnd] = _I_Left_UpEnd, + + [ShapeI_Right] = _I_Right, + [ShapeI_Right_End] = _I_Right_End, + [ShapeI_Right_DownEnd] = _I_Right_DownEnd, + [ShapeI_Right_UpEnd] = _I_Right_UpEnd, + + // L Shape: 16 + [ShapeL_UpLeft] = _L_UpLeft, + [ShapeL_UpLeft_End] = _L_UpLeft_End, + [ShapeL_UpLeft_RightEnd] = _L_UpLeft_RightEnd, + [ShapeL_UpLeft_DownEnd] = _L_UpLeft_DownEnd, + + [ShapeL_UpRight] = _L_UpRight, + [ShapeL_UpRight_End] = _L_UpRight_End, + [ShapeL_UpRight_LeftEnd] = _L_UpRight_LeftEnd, + [ShapeL_UpRight_DownEnd] = _L_UpRight_DownEnd, + + [ShapeL_DownLeft] = _L_DownLeft, + [ShapeL_DownLeft_End] = _L_DownLeft_End, + [ShapeL_DownLeft_RightEnd] = _L_DownLeft_RightEnd, + [ShapeL_DownLeft_UpEnd] = _L_DownLeft_UpEnd, + + [ShapeL_DownRight] = _L_DownRight, + [ShapeL_DownRight_End] = _L_DownRight_End, + [ShapeL_DownRight_LeftEnd] = _L_DownRight_LeftEnd, + [ShapeL_DownRight_UpEnd] = _L_DownRight_UpEnd, + + // U Shape: 16 + [ShapeU_UpEmpty] = _U_UpEmpty, + [ShapeU_UpEmpty_End] = _U_UpEmpty_End, + [ShapeU_UpEmpty_LeftEnd] = _U_UpEmpty_LeftEnd, + [ShapeU_UpEmpty_RightEnd] = _U_UpEmpty_RightEnd, + + [ShapeU_DownEmpty] = _U_DownEmpty, + [ShapeU_DownEmpty_End] = _U_DownEmpty_End, + [ShapeU_DownEmpty_LeftEnd] = _U_DownEmpty_LeftEnd, + [ShapeU_DownEmpty_RightEnd] = _U_DownEmpty_RightEnd, + + [ShapeU_LeftEmpty] = _U_LeftEmpty, + [ShapeU_LeftEmpty_End] = _U_LeftEmpty_End, + [ShapeU_LeftEmpty_UpEnd] = _U_LeftEmpty_UpEnd, + [ShapeU_LeftEmpty_DownEnd] = _U_LeftEmpty_DownEnd, + + [ShapeU_RightEmpty] = _U_RightEmpty, + [ShapeU_RightEmpty_End] = _U_RightEmpty_End, + [ShapeU_RightEmpty_UpEnd] = _U_RightEmpty_UpEnd, + [ShapeU_RightEmpty_DownEnd] = _U_RightEmpty_DownEnd, + }; + + #endregion + + #region Shape Lookup + + private static readonly IReadOnlyCollection _Corner_Shapes = [ + ShapeCorner_UpLeft, + ShapeCorner_UpRight, + ShapeCorner_DownLeft, + ShapeCorner_DownRight + ]; + + private static readonly IReadOnlyCollection _I_Shapes = [ + ShapeI_Up, + ShapeI_Up_End, + ShapeI_Up_LeftEnd, + ShapeI_Up_RightEnd, + + ShapeI_Down, + ShapeI_Down_End, + ShapeI_Down_LeftEnd, + ShapeI_Down_RightEnd, + + ShapeI_Left, + ShapeI_Left_End, + ShapeI_Left_UpEnd, + ShapeI_Left_DownEnd, + + ShapeI_Right, + ShapeI_Right_End, + ShapeI_Right_UpEnd, + ShapeI_Right_DownEnd, + ]; + + private static readonly IReadOnlyCollection _L_Shapes = [ + ShapeL_UpLeft, + ShapeL_UpLeft_End, + ShapeL_UpLeft_RightEnd, + ShapeL_UpLeft_DownEnd, + + ShapeL_UpRight, + ShapeL_UpRight_End, + ShapeL_UpRight_LeftEnd, + ShapeL_UpRight_DownEnd, + + ShapeL_DownLeft, + ShapeL_DownLeft_End, + ShapeL_DownLeft_RightEnd, + ShapeL_DownLeft_UpEnd, + + ShapeL_DownRight, + ShapeL_DownRight_End, + ShapeL_DownRight_LeftEnd, + ShapeL_DownRight_UpEnd + ]; + + private static readonly IReadOnlyCollection _U_Shapes = [ + ShapeU_UpEmpty, + ShapeU_UpEmpty_End, + ShapeU_UpEmpty_LeftEnd, + ShapeU_UpEmpty_RightEnd, + + ShapeU_DownEmpty, + ShapeU_DownEmpty_End, + ShapeU_DownEmpty_LeftEnd, + ShapeU_DownEmpty_RightEnd, + + ShapeU_LeftEmpty, + ShapeU_LeftEmpty_End, + ShapeU_LeftEmpty_UpEnd, + ShapeU_LeftEmpty_DownEnd, + + ShapeU_RightEmpty, + ShapeU_RightEmpty_End, + ShapeU_RightEmpty_UpEnd, + ShapeU_RightEmpty_DownEnd + ]; + + /// + /// An Descend Ordered Consume Lookup Table + /// [U -> L -> I -> Corner] Order + /// [Most flags -> Least flags] Order + /// + private static readonly IReadOnlyCollection> _ShapeConsumeMap = [ + _U_Shapes.OrderByDescending(HotFlagCount).ToImmutableArray(), + _L_Shapes.OrderByDescending(HotFlagCount).ToImmutableArray(), + _I_Shapes.OrderByDescending(HotFlagCount).ToImmutableArray(), + // I shape includes up, down, left, right. So we don't need to consume them manually + _Corner_Shapes, + ]; + #endregion + + #region Utils + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static Rectangle CreateRect(int sheetX, int sheetY) + { + return new Rectangle(sheetX * 18, sheetY * 18, 16, 16); + } + + private static Rectangle[] Create3RectsDirX(int leftSheetX, int leftSheetY, int increment = 1) + { + return [ + CreateRect(leftSheetX, leftSheetY), + CreateRect(leftSheetX + (1 * increment), leftSheetY), + CreateRect(leftSheetX + (2 * increment), leftSheetY) + ]; + } + + private static Rectangle[] Create3RectsDirY(int topSheetX, int topSheetY, int increment = 1) + { + return [ + CreateRect(topSheetX, topSheetY), + CreateRect(topSheetX, topSheetY + (1 * increment)), + CreateRect(topSheetX, topSheetY + (2 * increment)) + ]; + } + + private static int HotFlagCount(BlendSideFlags flags) + { + var count = 0; + for (int i = 0; i < 8; i++) + { + var flag = (BlendSideFlags)(1 << i); + if (flag == (flags & flag)) + { + count++; + } + } + return count; + } + #endregion + } +} diff --git a/Systems/UIManagementSystem.cs b/Systems/UIManagementSystem.cs index bf003f4504..fa9408ef58 100644 --- a/Systems/UIManagementSystem.cs +++ b/Systems/UIManagementSystem.cs @@ -149,6 +149,14 @@ namespace CalamityMod.Systems DefenseDamageDisplayUI.Draw(Main.spriteBatch); return true; }, InterfaceScaleType.None)); + + // Canvas painting. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Canvas Painting", () => + { + if (Main.LocalPlayer.Calamity().CurrentlyViewedCanvasID != -1) + CanvasPaintingUIState.DrawCanvasUI(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); } // Invasion UIs. diff --git a/Systems/BestiaryRegistrySystem.cs b/Systems/World/BestiaryRegistrySystem.cs similarity index 70% rename from Systems/BestiaryRegistrySystem.cs rename to Systems/World/BestiaryRegistrySystem.cs index f14f47f6dc..10e32c9b49 100644 --- a/Systems/BestiaryRegistrySystem.cs +++ b/Systems/World/BestiaryRegistrySystem.cs @@ -1,5 +1,7 @@ using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.NormalNPCs; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +16,8 @@ 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[NPCType()]; + ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCID.LavaSlime]; } } diff --git a/Systems/MiscWorldStateSystem.cs b/Systems/World/MiscWorldStateSystem.cs similarity index 99% rename from Systems/MiscWorldStateSystem.cs rename to Systems/World/MiscWorldStateSystem.cs index 897754c9a7..2b95101060 100644 --- a/Systems/MiscWorldStateSystem.cs +++ b/Systems/World/MiscWorldStateSystem.cs @@ -46,7 +46,6 @@ namespace CalamityMod CalamityGlobalNPC.draedonExoMechWorm = -1; CalamityGlobalNPC.adultEidolonWyrmHead = -1; BossRushEvent.BossRushStage = 0; - ArmoredDiggerSpawnCooldown = 0; BossRushEvent.BossRushActive = false; BossRushEvent.BossRushSpawnCountdown = 180; BossRushEvent.HostileProjectileKillCounter = 0; diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/World/WorldMiscUpdateSystem.cs similarity index 83% rename from Systems/WorldMiscUpdateSystem.cs rename to Systems/World/WorldMiscUpdateSystem.cs index c172445a7b..ad3ac88db8 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/World/WorldMiscUpdateSystem.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Systems // Reset this int because it causes bugs with other mods if you delete Dr. Draedon through abnormal means. if (CalamityGlobalNPC.draedon != -1) { - if (!NPC.AnyNPCs(ModContent.NPCType())) + if (!NPC.AnyNPCs(NPCType())) CalamityGlobalNPC.draedon = -1; } @@ -85,7 +85,6 @@ namespace CalamityMod.Systems if (player is not null && player.active) { CalamityPlayer modPlayer = player.Calamity(); - TrySpawnArmoredDigger(player, modPlayer); TrySpawnDungeonGuardian(player); TrySpawnAEoW(player, modPlayer); } @@ -100,7 +99,7 @@ namespace CalamityMod.Systems // Disable sandstorms if the Desert Scourge is still alive and Hardmode hasn't begun. if (!DownedBossSystem.downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient && !Main.hardMode) - CalamityUtils.StopSandstorm(); + CalamityWorld.StopSandstorm(); // Attempt to summon lab critters manually since they refuse to exist when using vanilla's spawn methods. // This needs to check all players since the method only runs server-side. @@ -132,13 +131,13 @@ namespace CalamityMod.Systems if (DraedonSummonCountdown == DraedonSummonCountdownMax - 45) { IEntitySource source = new EntitySource_WorldEvent(); - Projectile.NewProjectile(source, DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(source, DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ProjectileType(), 0, 0f); } if (DraedonSummonCountdown == 0) { IEntitySource source = new EntitySource_WorldEvent(); - NPC.NewNPC(source, (int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType()); + NPC.NewNPC(source, (int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, NPCType()); } } #endregion Handle Draedon Summoning @@ -193,7 +192,7 @@ namespace CalamityMod.Systems WorldGen.SquareTileFrame(x, y2); WorldGen.SquareTileFrame(x + 2, y2); WorldGen.SquareTileFrame(x - 1, y2); - if (Main.tile[x, y2].TileType == TileID.PlanteraBulb && Main.netMode == NetmodeID.Server) + if (Main.tile[x, y2].TileType == TileID.PlanteraBulb && Main.dedServ) { NetMessage.SendTileSquare(-1, x, y2, 5); } @@ -226,7 +225,7 @@ namespace CalamityMod.Systems WorldGen.PlaceJunglePlant(x, y2, TileID.LifeFruit, WorldGen.genRand.Next(3), 0); WorldGen.SquareTileFrame(x, y2); WorldGen.SquareTileFrame(x + 1, y2 + 1); - if (Main.tile[x, y2].TileType == TileID.LifeFruit && Main.netMode == NetmodeID.Server) + if (Main.tile[x, y2].TileType == TileID.LifeFruit && Main.dedServ) { NetMessage.SendTileSquare(-1, x, y2, 4); } @@ -242,7 +241,7 @@ namespace CalamityMod.Systems if (CalamityGlobalTile.GrowthTiles.Contains(tileType) && growthTile.Slope == SlopeType.Solid && !growthTile.IsHalfBlock) { int growthChance = 2; - if (tileType == ModContent.TileType()) + if (tileType == TileType()) growthChance *= 5; if (Main.rand.NextBool(growthChance)) @@ -269,18 +268,18 @@ namespace CalamityMod.Systems { Tile tile = Main.tile[x, y]; bool growTile = !tile.HasTile && tile.LiquidAmount >= 128; - bool isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType(); + bool isSunkenSeaTile = tileType == TileType() || tileType == TileType(); bool meetsAdditionalGrowConditions = tile.Slope == SlopeType.Solid && !tile.IsHalfBlock && tile.LiquidType != LiquidID.Lava; if (growTile && meetsAdditionalGrowConditions) { - int tileType2 = ModContent.TileType(); + int tileType2 = TileType(); - if (tileType == ModContent.TileType()) - tileType2 = ModContent.TileType(); + if (tileType == TileType()) + tileType2 = TileType(); bool canPlaceBasedOnAttached = true; - if (tileType2 == ModContent.TileType() && !isSunkenSeaTile) + if (tileType2 == TileType() && !isSunkenSeaTile) canPlaceBasedOnAttached = false; if (canPlaceBasedOnAttached && CanPlaceBasedOnProximity(x, y, tileType2)) @@ -308,7 +307,7 @@ namespace CalamityMod.Systems WorldGen.SquareTileFrame(x, y); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } @@ -395,7 +394,7 @@ namespace CalamityMod.Systems public static bool CanPlaceBasedOnProximity(int x, int y, int tileType) { - if (tileType == ModContent.TileType() && !DownedBossSystem.downedLeviathan) + if (tileType == TileType() && !DownedBossSystem.downedLeviathan) return false; int minDistanceFromOtherTiles = 10; @@ -417,70 +416,6 @@ namespace CalamityMod.Systems } #endregion - #region Handle Armored Digger Random Spawns - public static void TrySpawnArmoredDigger(Player player, CalamityPlayer modPlayer) - { - bool gfbCondition = Main.zenithWorld && (player.ZoneHallow || player.ZoneUnderworldHeight) && NPC.downedMoonlord; - if ((gfbCondition || (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneJungle)) && !player.ZoneDungeon && !modPlayer.ZoneSunkenSea && !modPlayer.ZoneAbyss && !CalamityPlayer.areThereAnyDamnBosses) - { - if (NPC.downedPlantBoss && player.townNPCs < 3f) - { - double spawnRate = 100000D; - - if (CalamityWorld.LegendaryMode && revenge) - spawnRate *= 0.25D; - - if (revenge) - spawnRate *= 0.85D; - - if (death && Main.bloodMoon) - spawnRate *= 0.2D; - if (modPlayer.zerg) - spawnRate *= 0.5D; - if (modPlayer.chaosCandle) - spawnRate *= 0.6D; - if (player.enemySpawns) - spawnRate *= 0.7D; - if (Main.SceneMetrics.WaterCandleCount > 0) - spawnRate *= 0.8D; - - if (modPlayer.isNearbyBoss && CalamityConfig.Instance.BossZen) - spawnRate *= 50D; - if (modPlayer.zen || (CalamityConfig.Instance.ForceTownSafety && player.townNPCs > 1f && Main.expertMode)) - spawnRate *= 2D; - if (modPlayer.tranquilityCandle) - spawnRate *= 1.67D; - if (player.calmed) - spawnRate *= 1.43D; - if (Main.SceneMetrics.PeaceCandleCount > 0) - spawnRate *= 1.25D; - - int chance = (int)spawnRate; - if (Main.rand.NextBool(chance)) - { - if (!NPC.AnyNPCs(ModContent.NPCType()) && Main.netMode != NetmodeID.MultiplayerClient && - ArmoredDiggerSpawnCooldown <= 0) - { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - ArmoredDiggerSpawnCooldown = 36000; - } - } - } - } - if (ArmoredDiggerSpawnCooldown > 0) - { - ArmoredDiggerSpawnCooldown--; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ArmoredDiggerCountdownSync); - netMessage.Write(ArmoredDiggerSpawnCooldown); - netMessage.Send(); - } - } - } - #endregion - #region Handle Dungeon Guardian Spawns public static void TrySpawnDungeonGuardian(Player player) { @@ -502,12 +437,12 @@ namespace CalamityMod.Systems #region Handle Primordial Wyrm Spawns public static void TrySpawnAEoW(Player player, CalamityPlayer modPlayer) { - if (Main.netMode == NetmodeID.MultiplayerClient || !(modPlayer.ZoneAbyss || Main.zenithWorld) || !player.chaosState || player.dead) + if (Main.netMode == NetmodeID.MultiplayerClient || !(modPlayer.ZoneAbyss || Main.zenithWorld) || !player.chaosState || player.dead || BossRushEvent.BossRushActive) return; bool adultWyrmAlive = CalamityGlobalNPC.adultEidolonWyrmHead != -1 && Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active; if (!adultWyrmAlive) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, NPCType()); } #endregion } diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs similarity index 86% rename from Systems/WorldgenManagementSystem.cs rename to Systems/World/WorldgenManagementSystem.cs index d7c58193c9..58ff723779 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -1,5 +1,10 @@ using System.Collections.Generic; +using System.Threading; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.SummonItems; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Tiles.AstralSnow; +using CalamityMod.Tiles.Ores; using CalamityMod.World; using CalamityMod.World.Minibiomes; using CalamityMod.World.Planets; @@ -20,7 +25,7 @@ namespace CalamityMod.Systems public override void PreWorldGen() { Abyss.TotalPlacedIslandsSoFar = 0; - roxShrinePlaced = false; + //roxShrinePlaced = false; // This will only be applied at world-gen time to new worlds. // Old worlds will never receive this marker naturally. @@ -103,6 +108,30 @@ namespace CalamityMod.Systems })); } + // Move spawn point in Celebrationmk10 to not be in the Sulphurous Sea + int spawnPointIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Spawn Point")); + if (spawnPointIndex != -1 && WorldGen.tenthAnniversaryWorldGen && !WorldGen.getGoodWorldGen) + { + tasks.Insert(spawnPointIndex + 1, new PassLegacy("Fix Tenth Anniversary Spawn", (progress, config) => + { + if ((Main.spawnTileX < Main.maxTilesX / 2 && GenVars.dungeonSide == -1) || (Main.spawnTileX > Main.maxTilesX / 2 && GenVars.dungeonSide == 1)) + { + // Flip the side of the world you spawn on if it's the Dungeon side + Main.spawnTileX = Main.maxTilesX - Main.spawnTileX; + // Then fix the Y position of the spawn point + for (int i = 0; i < Main.maxTilesY; i++) + { + if (Main.tile[Main.spawnTileX, i].HasTile) + { + Main.spawnTileY = i; + break; + } + } + } + + })); + } + // Mechanic Shed int mechanicIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Sunflowers")); if (mechanicIndex != -1) @@ -136,10 +165,17 @@ namespace CalamityMod.Systems int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; int sunkenSeaY = Main.maxTilesY / 2; - //place each piece of the sunken sea based on the above positons + SunkenSea.ForLoop = CalamityClientConfig.Instance.SunkenSeaMultiThreading switch + { + 2 => SunkenSea.CSharpParallelFor, + 1 => SunkenSea.ReLogicParallelFor, + _ => SunkenSea.NormalForLoop, + }; + + // place each piece of the sunken sea based on the above positons SunkenSea.PlaceRadiantReefs(sunkenSeaX - 100, sunkenSeaY + 75, true); SunkenSea.PlaceRadiantReefs(sunkenSeaX + 100, sunkenSeaY + 75, false); - SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 75); + SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 500); SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); SunkenSea.PlaceSunkenSeaAmbience(); @@ -227,6 +263,9 @@ namespace CalamityMod.Systems progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SurfaceShrine").Value; UndergroundShrines.PlaceSurfaceShrine(GenVars.structures); + + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.Roxcalibur").Value; + UndergroundShrines.PlaceRoxShrine(GenVars.structures); })); // Aerialite @@ -300,12 +339,15 @@ namespace CalamityMod.Systems SulphurousSea.SulphurSeaGenerationAfterAbyss(); })); - // Roxcalibur - tasks.Insert(++currentFinalIndex, new PassLegacy("Roxcalibur", (progress, config) => + // No Traps/GFB Auric Land Mines + if (Main.noTrapsWorld) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.Roxcalibur").Value; - MiscWorldgenRoutines.PlaceRoxShrine(); - })); + tasks.Insert(++currentFinalIndex, new PassLegacy("Auric Land Mines", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.AuricLandMines").Value; + MiscWorldgenRoutines.GenerateAuricLandMines(); + })); + } } } @@ -333,7 +375,7 @@ namespace CalamityMod.Systems // Disable gen pass if Early Hardmode Rework is disabled. // Could just not add/remove gen pass, but that could lead to mod conflicts // in case whatever mod targets this specific gen pass. - if (!CalamityConfig.Instance.EarlyHardmodeProgressionRework) + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) { hardmodeOreT1Pass.Disable(); } @@ -344,7 +386,8 @@ namespace CalamityMod.Systems // Insert the Astral biome generation right before the final hardmode announcement. tasks.Insert(announceIndex, new PassLegacy("AstralMeteor", (progress, config) => { - AstralBiome.PlaceAstralMeteor(); + //Delaying it a bit so that weaker pcs dont suffer - Shade + ThreadPool.QueueUserWorkItem(_ => AstralBiome.PlaceAstralMeteor()); })); } #endregion @@ -381,6 +424,14 @@ namespace CalamityMod.Systems { if (chest.item[inventoryIndex].type == ItemID.SuspiciousLookingEye) { + // For Mushroom Chests, Suspicious Looking Eyes are replaced with Shroomerang instead + if (isMushroomChest) + { + chest.item[inventoryIndex].SetDefaults(ItemID.Shroomerang); + chest.item[inventoryIndex].Prefix(-1); + break; + } + // 60% chance of 3-5 Mining Potions // 20% chance of 2-3 Builder's Potions // 20% chance of 5-9 Shine Potions @@ -405,6 +456,17 @@ namespace CalamityMod.Systems } } + // Replace Step Stool in surface Chests with Kylie + // Calamity adds a very easy recipe for this so hopefully this isn't a big deal (The 4 unironic Step Stool lovers will be out for my head) + if (isBrownChest) + { + if (chest.item[0].type == ItemID.PortableStool) + { + chest.item[0].SetDefaults(ModContent.ItemType()); + chest.item[0].Prefix(-1); + } + } + // Give Dead Man's Chests better loot. if (isDeadManChest) { @@ -510,7 +572,7 @@ namespace CalamityMod.Systems } } - // Adds Desert Medallion to Sandstone Chests at a 20% chance + // Adds Desert Medallion and The Comb to Sandstone Chests, each at a 20% chance if (isSandstoneChest) { float rng = WorldGen.genRand.NextFloat(); @@ -526,6 +588,18 @@ namespace CalamityMod.Systems } } } + else if (rng < 0.4f) + { + for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) + { + if (chest.item[inventoryIndex].IsAir) + { + chest.item[inventoryIndex].SetDefaults(ModContent.ItemType()); + chest.item[inventoryIndex].stack = 1; + break; + } + } + } } } } diff --git a/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs index cc645762f3..305b23f87e 100644 --- a/TileEntities/TEBaseTurret.cs +++ b/TileEntities/TEBaseTurret.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.Packets; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -197,51 +198,19 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.Turret); - packet.Write(ID); - packet.Write(FiringTime); - packet.Write(Angle); - packet.WriteVector2(TargetPos); - WriteExtraData(packet); - packet.Send(-1, -1); - } - protected internal static bool ReadSyncPacket(Mod mod, BinaryReader reader) - { - int teID = reader.ReadInt32(); - bool exists = ByID.TryGetValue(teID, out TileEntity te); - - // The rest of the packet must be read even if it turns out the turret doesn't exist for whatever reason. - int firingTime = reader.ReadInt32(); - float angle = reader.ReadSingle(); - Vector2 targetVec = reader.ReadVector2(); - - if (exists && te is TEBaseTurret turret) - { - turret.FiringTime = firingTime; - turret.Angle = angle; - turret.TargetPos = targetVec; - turret.ReadExtraData(mod, reader); - return true; - } - else - { - // Otherwise, discard the fixed extra bytes so the message stream doesn't go haywire. - _ = reader.ReadBytes(NumExtraBytes); - return false; - } + TETurretPacket.Send(this); } // Subclasses cannot override SendSyncPacket, but they can override these functions to sync their own extra data. // 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) + public virtual void WriteExtraTurretData(BinaryWriter writer) { writer.Write(0Lu); writer.Write(0Lu); } - protected virtual void ReadExtraData(Mod mod, BinaryReader reader) => _ = reader.ReadBytes(NumExtraBytes); + public virtual void ReadExtraTurretData(BinaryReader reader) => _ = reader.ReadBytes(NumExtraBytes); } } diff --git a/TileEntities/TECanvasPainting.cs b/TileEntities/TECanvasPainting.cs new file mode 100644 index 0000000000..da548665ae --- /dev/null +++ b/TileEntities/TECanvasPainting.cs @@ -0,0 +1,83 @@ +using CalamityMod.Packets; +using CalamityMod.Tiles.Furniture; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.TileEntities +{ + public class TECanvasPainting : ModTileEntity + { + public Vector2 framePosition = new Vector2(0, 0); + public float scale = 1f; + + public override bool IsTileValidForEntity(int x, int y) + { + Tile tile = Main.tile[x, y]; + return tile.HasTile && (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) && tile.TileFrameX == 0 && tile.TileFrameY == 0; + } + + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction, int alternate) + { + // WHY do I need to subtract 1 from both???? + // Todo: Figure out what the heckity heckering heckling heckereckering heckly heccing hecky heck heck is happening here + int iMinus = i - 1; + int jMinus = j - 1; + + // If in multiplayer, tell the server to place the tile entity and DO NOT place it yourself. That would mismatch IDs. + // Also tell the server that you placed the 5x5 tiles that make up the painting. + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, iMinus, jMinus, 5, 5); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, iMinus, jMinus, Type); + return -1; + } + + // If in single player, just place the tile entity + int id = Place(iMinus, jMinus); + return id; + } + + public override void OnNetPlace() + { + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(framePosition.X); + writer.Write(framePosition.Y); + writer.Write(scale); + } + + public override void NetReceive(BinaryReader reader) + { + framePosition = new Vector2(reader.ReadSingle(), reader.ReadSingle()); + scale = reader.ReadSingle(); + } + + public override void SaveData(TagCompound tag) + { + tag.Add("posX", framePosition.X); + tag.Add("posY", framePosition.Y); + tag.Add("scale", scale); + } + + public override void LoadData(TagCompound tag) + { + framePosition = new Vector2(tag.Get("posX"), tag.Get("posY")); + scale = tag.Get("scale"); + } + + public void SendSyncPacket() + { + if (Main.netMode == NetmodeID.SinglePlayer) + return; + + TECanvasPaintingPacket.Send(this, framePosition.X, framePosition.Y, scale); + } + } +} diff --git a/TileEntities/TEChargingStation.cs b/TileEntities/TEChargingStation.cs index 33ec54628d..03b10d8b21 100644 --- a/TileEntities/TEChargingStation.cs +++ b/TileEntities/TEChargingStation.cs @@ -3,6 +3,7 @@ using System.Reflection; using CalamityMod.CalPlayer; using CalamityMod.Items; using CalamityMod.Items.DraedonMisc; +using CalamityMod.Packets; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; @@ -16,14 +17,16 @@ namespace CalamityMod.TileEntities public class TEChargingStation : ModTileEntity { public Vector2 Center => Position.ToWorldCoordinates(8f * ChargingStation.Width, 8f * ChargingStation.Height); - private short ChargingTimer = 0; - private short _stack = 0; + + internal short Internal_ChargingTimer = 0; + internal short Internal_Stack = 0; + public short CellStack { - get => _stack; + get => Internal_Stack; set { - _stack = value; + Internal_Stack = value; SendSyncPacket(); } } @@ -42,7 +45,7 @@ namespace CalamityMod.TileEntities return modItem.UsesCharge && modItem.Charge < modItem.MaxCharge; } } - public bool CanDoWork => _stack > 0 && PluggedItemCanCharge; + public bool CanDoWork => Internal_Stack > 0 && PluggedItemCanCharge; // Red when not actively charging an item, green when charging public Color LightColor => CanDoWork ? Color.MediumSpringGreen : Color.Red; @@ -59,13 +62,13 @@ namespace CalamityMod.TileEntities bool canWork = CanDoWork; if (!canWork) { - ChargingTimer = 0; + Internal_ChargingTimer = 0; return; } - ++ChargingTimer; + ++Internal_ChargingTimer; - if (ChargingTimer >= ChargingStation.FramesPerChargeAction) + if (Internal_ChargingTimer >= ChargingStation.FramesPerChargeAction) { // Apply charge to the plugged item first, as this doesn't send a sync packet. CalamityGlobalItem modItem = PluggedItem.Calamity(); @@ -80,7 +83,7 @@ namespace CalamityMod.TileEntities // Then decrement the cell stack. With the sync flag set, this will sync both the cell stack and the plugged item. CellStack--; - ChargingTimer = 0; + Internal_ChargingTimer = 0; } } @@ -159,8 +162,8 @@ namespace CalamityMod.TileEntities public override void SaveData(TagCompound tag) { - tag.Add("time", ChargingTimer); - tag.Add("cells", _stack); + tag.Add("time", Internal_ChargingTimer); + tag.Add("cells", Internal_Stack); Item forSaving; if (PluggedItem is null) { @@ -174,23 +177,23 @@ namespace CalamityMod.TileEntities public override void LoadData(TagCompound tag) { - ChargingTimer = tag.GetShort("time"); - _stack = tag.GetShort("cells"); + Internal_ChargingTimer = tag.GetShort("time"); + Internal_Stack = tag.GetShort("cells"); PluggedItem = ItemIO.Load(tag.GetCompound("item")); } public override void NetSend(BinaryWriter writer) { - writer.Write(ChargingTimer); - writer.Write(_stack); - ItemIO.Send(PluggedItem, writer, true); + writer.Write(Internal_ChargingTimer); + writer.Write(Internal_Stack); + ItemIO.Send(PluggedItem, writer, writeStack: true, writeFavorite: true); } public override void NetReceive(BinaryReader reader) { - ChargingTimer = reader.ReadInt16(); - _stack = reader.ReadInt16(); - PluggedItem = ItemIO.Receive(reader, true); + Internal_ChargingTimer = reader.ReadInt16(); + Internal_Stack = reader.ReadInt16(); + PluggedItem = ItemIO.Receive(reader, readStack: true, readFavorite: true); } // This packet may or may not contain the plugged item's charge value. If it doesn't, it contains a dummy value (NaN) instead. @@ -199,102 +202,22 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.ChargingStationStandard); - packet.Write(ID); - packet.Write(ChargingTimer); - packet.Write(_stack); // Either write the real charge or garbage data. If garbage data is written it will be ignored on the other end. - CalamityGlobalItem modItem = PluggedItem.IsAir ? null : PluggedItem.Calamity(); - packet.Write(syncItemCharge && modItem != null ? modItem.Charge : float.NaN); - packet.Send(-1, -1); + var modItem = PluggedItem.IsAir ? null : PluggedItem.Calamity(); + var chargeOrNaN = (syncItemCharge && modItem != null) ? modItem.Charge : float.NaN; + TEChargingStationStandardPacket.Send(this, Internal_ChargingTimer, Internal_Stack, chargeOrNaN); // If this flag was set to true, set it to false for any further updates (until it gets set to true again). syncItemCharge = false; } - internal static bool ReadSyncPacket(Mod mod, BinaryReader reader) - { - int teID = reader.ReadInt32(); - bool exists = ByID.TryGetValue(teID, out TileEntity te); - - // The rest of the packet must be read even if it turns out the charging station doesn't exist for whatever reason. - short timer = reader.ReadInt16(); - short cellStack = reader.ReadInt16(); - float chargeOrNaN = reader.ReadSingle(); - - // When a server gets this packet, it immediately sends an equivalent packet to all clients. - if (Main.netMode == NetmodeID.Server) - { - ModPacket packet = mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.ChargingStationStandard); - packet.Write(teID); - packet.Write(timer); - packet.Write(cellStack); - packet.Write(chargeOrNaN); - packet.Send(-1, -1); - } - - if (exists && te is TEChargingStation charger) - { - // Only clients update their timer from this packet. When a server receives this packet it ignores the time variable. - if (Main.netMode == NetmodeID.MultiplayerClient) - charger.ChargingTimer = timer; - charger._stack = cellStack; - - // If the charge value sent is not garbage, then try to apply the new charge to the plugged item. - if (!float.IsNaN(chargeOrNaN)) - { - bool itemExists = charger.PluggedItem != null && !charger.PluggedItem.IsAir; - CalamityGlobalItem modItem = itemExists ? charger.PluggedItem.Calamity() : null; - if (modItem != null && modItem.UsesCharge) - { - if (modItem.Charge != chargeOrNaN && Main.netMode == NetmodeID.MultiplayerClient) - charger.ClientChargingDust = true; - modItem.Charge = chargeOrNaN; - } - } - return true; - } - return false; - } - internal void SendItemSyncPacket() { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(1024); - packet.Write((byte)CalamityModMessageType.ChargingStationItemChange); - packet.Write(ID); - ItemIO.Send(PluggedItem, packet, true); - packet.Send(-1, -1); - } - internal static bool ReadItemSyncPacket(Mod mod, BinaryReader reader) - { - int teID = reader.ReadInt32(); - bool exists = ByID.TryGetValue(teID, out TileEntity te); - - // The rest of the packet must be read even if it turns out the charging station doesn't exist for whatever reason. - Item thePlug = ItemIO.Receive(reader, true); - - // When a server gets this packet, it immediately sends an equivalent packet to all clients. - if (Main.netMode == NetmodeID.Server) - { - ModPacket packet = mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.ChargingStationItemChange); - packet.Write(teID); - ItemIO.Send(thePlug, packet, true); - packet.Send(-1, -1); - } - - if (exists && te is TEChargingStation charger) - { - charger.PluggedItem = thePlug; - return true; - } - return false; + TEChargingStationItemChangePacket.Send(this, PluggedItem); } } } diff --git a/TileEntities/TECodebreaker.cs b/TileEntities/TECodebreaker.cs index 33daa22b17..78fcd95db6 100644 --- a/TileEntities/TECodebreaker.cs +++ b/TileEntities/TECodebreaker.cs @@ -2,6 +2,8 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; +using CalamityMod.Packets; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.DraedonSummoner; using Microsoft.Xna.Framework; using Terraria; @@ -38,17 +40,16 @@ namespace CalamityMod.TileEntities get { // You can't decrypt nothing. - if (HeldSchematicID == 0 || !CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + if (HeldSchematicID == 0 || !EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) return 0; - int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return 500; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return 950; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return 1750; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return 5000; return 0; @@ -71,17 +72,16 @@ namespace CalamityMod.TileEntities get { // You can't decrypt nothing. - if (HeldSchematicID == 0 || !CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + if (HeldSchematicID == 0 || !EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) return false; - int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return ContainsDecryptionComputer; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return ContainsDecryptionComputer && ContainsSensorArray; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return ContainsDecryptionComputer && ContainsSensorArray && ContainsAdvancedDisplay; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return ContainsDecryptionComputer && ContainsSensorArray && ContainsAdvancedDisplay && ContainsVoltageRegulationSystem; return false; @@ -93,15 +93,14 @@ namespace CalamityMod.TileEntities get { // You can't decrypt nothing. - if (HeldSchematicID == 0 || !CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + if (HeldSchematicID == 0 || !EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) return string.Empty; - int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; - if (schematicType == ModContent.ItemType() - || schematicType == ModContent.ItemType() - || schematicType == ModContent.ItemType() - || schematicType == ModContent.ItemType()) - return CalamityUtils.GetTextValueFromModItem(schematicType, "Content"); + if (schematicItemType == ModContent.ItemType() + || schematicItemType == ModContent.ItemType() + || schematicItemType == ModContent.ItemType() + || schematicItemType == ModContent.ItemType()) + return CalamityUtils.GetTextValueFromModItem(schematicItemType, "Content"); return string.Empty; } @@ -154,8 +153,8 @@ namespace CalamityMod.TileEntities if (ContainsCoolingCell) Item.NewItem(source, x * 16, y * 16, 32, 32, ModContent.ItemType()); - if (CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) - Item.NewItem(source, x * 16, y * 16, 32, 32, CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]); + if (EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) + Item.NewItem(source, x * 16, y * 16, 32, 32, schematicItemType); while (InputtedCellCount > 0) { @@ -175,56 +174,7 @@ namespace CalamityMod.TileEntities if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(); - BitsByte containmentFlagWrapper = new BitsByte(); - containmentFlagWrapper[0] = ContainsDecryptionComputer; - containmentFlagWrapper[1] = ContainsSensorArray; - containmentFlagWrapper[2] = ContainsAdvancedDisplay; - containmentFlagWrapper[3] = ContainsVoltageRegulationSystem; - containmentFlagWrapper[4] = ContainsCoolingCell; - - packet.Write((byte)CalamityModMessageType.UpdateCodebreakerConstituents); - packet.Write(ID); - packet.Write(sender); - packet.Write(containmentFlagWrapper); - packet.Send(-1, sender); - } - - public static void ReadConstituentsUpdateSync(Mod mod, BinaryReader reader) - { - int id = reader.ReadInt32(); - short sender = reader.ReadInt16(); - bool exists = ByID.TryGetValue(id, out TileEntity tileEntity); - - // Continue reading to the end even if a tile entity with the given ID does not exist. - // Not doing this will cause errors/bugs. - BitsByte containmentFlagWrapper = reader.ReadByte(); - bool containsDecryptionComputer = containmentFlagWrapper[0]; - bool containsSensorArray = containmentFlagWrapper[1]; - bool containsAdvancedDisplay = containmentFlagWrapper[2]; - bool containsVoltageRegulationSystem = containmentFlagWrapper[3]; - bool containsCoolingCell = containmentFlagWrapper[4]; - - // After doing reading, check again to see if the tile entity is actually there. - // If it isn't don't bother doing anything else. - if (!exists) - return; - - // Furthermore, verify to ensure that the tile entity is a valid one. - if (!(tileEntity is TECodebreaker codebreakerTileEntity)) - return; - - codebreakerTileEntity.ContainsDecryptionComputer = containsDecryptionComputer; - codebreakerTileEntity.ContainsSensorArray = containsSensorArray; - codebreakerTileEntity.ContainsAdvancedDisplay = containsAdvancedDisplay; - codebreakerTileEntity.ContainsVoltageRegulationSystem = containsVoltageRegulationSystem; - codebreakerTileEntity.ContainsCoolingCell = containsCoolingCell; - - // Send the packet again to the other clients if this packet was received on the server. - // Since ModPackets go solely to the server when sent by a client this is necesssary - // to ensure that all clients are informed of what happened. - if (Main.netMode == NetmodeID.Server) - codebreakerTileEntity.SyncConstituents(sender); + TEUpdateCodebreakerConstituentsPacket.Send(this); } public void SyncContainedStuff() @@ -233,39 +183,7 @@ namespace CalamityMod.TileEntities if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.UpdateCodebreakerContainedStuff); - packet.Write(ID); - packet.Write(InputtedCellCount); - packet.Write(InitialCellCountBeforeDecrypting); - packet.Write(HeldSchematicID); - packet.Write(ContainsBloodSample); - packet.Send(); - } - - public static void ReadContainmentSync(Mod mod, BinaryReader reader) - { - int id = reader.ReadInt32(); - bool exists = ByID.TryGetValue(id, out TileEntity tileEntity); - - // Continue reading to the end even if a tile entity with the given ID does not exist. - // Not doing this will cause errors/bugs. - int cellCount = reader.ReadInt32(); - int cellCountBeforeDecrypting = reader.ReadInt32(); - int schematicID = reader.ReadInt32(); - - // After doing reading, check again to see if the tile entity is actually there. - // If it isn't don't bother doing anything else. - if (!exists) - return; - - // Furthermore, verify to ensure that the tile entity is a valid one. - if (!(tileEntity is TECodebreaker codebreakerTileEntity)) - return; - - codebreakerTileEntity.InputtedCellCount = cellCount; - codebreakerTileEntity.InitialCellCountBeforeDecrypting = cellCountBeforeDecrypting; - codebreakerTileEntity.HeldSchematicID = schematicID; + TEUpdateCodebreakerContainedStuffPacket.Send(this); } public void SyncDecryptCountdown() @@ -274,32 +192,7 @@ namespace CalamityMod.TileEntities if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.UpdateCodebreakerDecryptCountdown); - packet.Write(ID); - packet.Write(DecryptionCountdown); - packet.Send(); - } - - public static void ReadDecryptCountdownSync(Mod mod, BinaryReader reader) - { - int id = reader.ReadInt32(); - bool exists = ByID.TryGetValue(id, out TileEntity tileEntity); - - // Continue reading to the end even if a tile entity with the given ID does not exist. - // Not doing this will cause errors/bugs. - int countdown = reader.ReadInt32(); - - // After doing reading, check again to see if the tile entity is actually there. - // If it isn't don't bother doing anything else. - if (!exists) - return; - - // Furthermore, verify to ensure that the tile entity is a valid one. - if (!(tileEntity is TECodebreaker codebreakerTileEntity)) - return; - - codebreakerTileEntity.DecryptionCountdown = countdown; + TEUpdateCodebreakerDecryptCountdownPacket.Send(this); } public void UpdateTime() @@ -322,7 +215,7 @@ namespace CalamityMod.TileEntities InitialCellCountBeforeDecrypting = 0; LearnFromHeldSchematic(out bool anythingChanged); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { SyncDecryptCountdown(); SyncContainedStuff(); @@ -338,33 +231,31 @@ namespace CalamityMod.TileEntities anythingChanged = false; // Do nothing if no valid schematic is inputted at the moment. - if (!CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + if (!EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) return; - int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; - - if (!RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes && schematicType == ModContent.ItemType()) + if (!RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes && schematicItemType == ModContent.ItemType()) { RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes = true; anythingChanged = true; } - if (!RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes && schematicType == ModContent.ItemType()) + if (!RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes && schematicItemType == ModContent.ItemType()) { RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes = true; anythingChanged = true; } - if (!RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes && schematicType == ModContent.ItemType()) + if (!RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes && schematicItemType == ModContent.ItemType()) { RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes = true; anythingChanged = true; } - if (!RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes && schematicType == ModContent.ItemType()) + if (!RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes && schematicItemType == ModContent.ItemType()) { RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes = true; anythingChanged = true; } - if (Main.netMode == NetmodeID.Server && anythingChanged) + if (Main.dedServ && anythingChanged) CalamityNetcode.SyncWorld(); } diff --git a/TileEntities/TEHostileFireTurret.cs b/TileEntities/TEHostileFireTurret.cs index 5f79addd68..33ae21e7c2 100644 --- a/TileEntities/TEHostileFireTurret.cs +++ b/TileEntities/TEHostileFireTurret.cs @@ -121,13 +121,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_playerTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _playerTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEHostileIceTurret.cs b/TileEntities/TEHostileIceTurret.cs index 17d4fec62d..d1ebcd8a6d 100644 --- a/TileEntities/TEHostileIceTurret.cs +++ b/TileEntities/TEHostileIceTurret.cs @@ -121,13 +121,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_playerTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _playerTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEHostileLabTurret.cs b/TileEntities/TEHostileLabTurret.cs index e56a00222a..d74b9474a4 100644 --- a/TileEntities/TEHostileLabTurret.cs +++ b/TileEntities/TEHostileLabTurret.cs @@ -121,13 +121,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_playerTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _playerTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEHostileLaserTurret.cs b/TileEntities/TEHostileLaserTurret.cs index f6957f917a..f34b471781 100644 --- a/TileEntities/TEHostileLaserTurret.cs +++ b/TileEntities/TEHostileLaserTurret.cs @@ -121,13 +121,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_playerTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _playerTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEHostileOnyxTurret.cs b/TileEntities/TEHostileOnyxTurret.cs index 6443c09f49..78a7fd87e9 100644 --- a/TileEntities/TEHostileOnyxTurret.cs +++ b/TileEntities/TEHostileOnyxTurret.cs @@ -121,13 +121,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_playerTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _playerTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEHostilePlagueTurret.cs b/TileEntities/TEHostilePlagueTurret.cs index b06e3301c5..05cca39c47 100644 --- a/TileEntities/TEHostilePlagueTurret.cs +++ b/TileEntities/TEHostilePlagueTurret.cs @@ -121,13 +121,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_playerTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _playerTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEHostileWaterTurret.cs b/TileEntities/TEHostileWaterTurret.cs index d89dc7c8a0..2b2f0a8923 100644 --- a/TileEntities/TEHostileWaterTurret.cs +++ b/TileEntities/TEHostileWaterTurret.cs @@ -121,13 +121,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_playerTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _playerTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TELabHologramProjector.cs b/TileEntities/TELabHologramProjector.cs index 791cd49489..08eea38d87 100644 --- a/TileEntities/TELabHologramProjector.cs +++ b/TileEntities/TELabHologramProjector.cs @@ -1,12 +1,14 @@ using System.IO; using System.Reflection; using CalamityMod.CalPlayer; +using CalamityMod.Packets; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.TileEntities { @@ -20,7 +22,16 @@ namespace CalamityMod.TileEntities public override bool IsTileValidForEntity(int x, int y) { Tile tile = Main.tile[x, y]; - return tile.HasTile && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; + + int style = 0, alt = 0; + TileObjectData.GetTileInfo(tile, ref style, ref alt); + TileObjectData data = TileObjectData.GetTileData(tile.TileType, style, alt); + + int sheetSquare = 16 + data.CoordinatePadding; + int FrameX = tile.TileFrameX / sheetSquare % data.Width; + int FrameY = tile.TileFrameY / sheetSquare % data.Height; + + return tile.HasTile && tile.TileType == ModContent.TileType() && FrameX == 0 && FrameY == 0; } // Check if the hologram should become visible. @@ -95,27 +106,8 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.LabHologramProjector); - packet.Write(ID); - packet.Write(PoppingUp); - packet.Send(-1, -1); - } - internal static bool ReadSyncPacket(Mod mod, BinaryReader reader) - { - int teID = reader.ReadInt32(); - bool exists = ByID.TryGetValue(teID, out TileEntity te); - - // The rest of the packet must be read even if it turns out the projector doesn't exist for whatever reason. - bool pop = reader.ReadBoolean(); - - if (exists && te is TELabHologramProjector projector) - { - projector.PoppingUp = pop; - return true; - } - return false; + TELabHologramProjectorPacket.Send(this, PoppingUp); } } } diff --git a/TileEntities/TEPlayerFireTurret.cs b/TileEntities/TEPlayerFireTurret.cs index ce3485376e..10feeedd45 100644 --- a/TileEntities/TEPlayerFireTurret.cs +++ b/TileEntities/TEPlayerFireTurret.cs @@ -124,13 +124,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_npcTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _npcTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEPlayerIceTurret.cs b/TileEntities/TEPlayerIceTurret.cs index b391d06346..2678aa9196 100644 --- a/TileEntities/TEPlayerIceTurret.cs +++ b/TileEntities/TEPlayerIceTurret.cs @@ -124,13 +124,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_npcTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _npcTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEPlayerLabTurret.cs b/TileEntities/TEPlayerLabTurret.cs index df9517428b..4e0bb773f1 100644 --- a/TileEntities/TEPlayerLabTurret.cs +++ b/TileEntities/TEPlayerLabTurret.cs @@ -124,13 +124,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_npcTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _npcTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEPlayerLaserTurret .cs b/TileEntities/TEPlayerLaserTurret .cs index 0360e32168..e7f7655804 100644 --- a/TileEntities/TEPlayerLaserTurret .cs +++ b/TileEntities/TEPlayerLaserTurret .cs @@ -124,13 +124,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_npcTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _npcTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEPlayerOnyxTurret.cs b/TileEntities/TEPlayerOnyxTurret.cs index 997b04959c..7cbcd7ae3a 100644 --- a/TileEntities/TEPlayerOnyxTurret.cs +++ b/TileEntities/TEPlayerOnyxTurret.cs @@ -124,13 +124,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_npcTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _npcTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEPlayerPlagueTurret.cs b/TileEntities/TEPlayerPlagueTurret.cs index 764f0c8ed8..7836915e60 100644 --- a/TileEntities/TEPlayerPlagueTurret.cs +++ b/TileEntities/TEPlayerPlagueTurret.cs @@ -105,13 +105,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_npcTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _npcTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEPlayerWaterTurret.cs b/TileEntities/TEPlayerWaterTurret.cs index 924f72e22c..3e389b070b 100644 --- a/TileEntities/TEPlayerWaterTurret.cs +++ b/TileEntities/TEPlayerWaterTurret.cs @@ -124,13 +124,13 @@ namespace CalamityMod.TileEntities // This type of turret syncs extra data: its player target index. // This only takes 2 bytes so a junk array is written for the remainder of the space. private const int BytesUsed = 2; - private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; - protected override void WriteExtraData(BinaryWriter writer) + private static readonly byte[] JunkData = new byte[NumExtraBytes - BytesUsed]; + public override void WriteExtraTurretData(BinaryWriter writer) { writer.Write((short)_npcTargetIndex); writer.Write(JunkData); } - protected override void ReadExtraData(Mod mod, BinaryReader reader) + public override void ReadExtraTurretData(BinaryReader reader) { _npcTargetIndex = reader.ReadInt16(); _ = reader.ReadBytes(NumExtraBytes - BytesUsed); diff --git a/TileEntities/TEPowerCellFactory.cs b/TileEntities/TEPowerCellFactory.cs index 93bdce0481..af36c627cd 100644 --- a/TileEntities/TEPowerCellFactory.cs +++ b/TileEntities/TEPowerCellFactory.cs @@ -2,6 +2,7 @@ using System.Reflection; using CalamityMod.CalPlayer; using CalamityMod.Items.DraedonMisc; +using CalamityMod.Packets; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; @@ -16,14 +17,15 @@ namespace CalamityMod.TileEntities { public Vector2 Center => Position.ToWorldCoordinates(8f * PowerCellFactory.Width, 8f * PowerCellFactory.Height); public long Time = 0; - private short _stack = 0; + + internal short Stack_Internal = 0; public short CellStack { - get => _stack; + get => Stack_Internal; set { - _stack = value; + Stack_Internal = value; SendSyncPacket(); } } @@ -71,11 +73,15 @@ namespace CalamityMod.TileEntities public override void Update() { - ++Time; - int maxCellStack = ModContent.GetModItem(ModContent.ItemType()).Item.maxStack; - if (IsCellFrame && CellStack < maxCellStack) - // The property setter will automatically send the necessary packet. - CellStack++; + // CIT 7OCT2024: Power Cell Factories now produce power cells faster when sleeping or using Journey's time rate multiplier. + for (int t = 0; t < Main.desiredWorldTilesUpdateRate; t++) + { + ++Time; + int maxCellStack = ModContent.GetModItem(ModContent.ItemType()).Item.maxStack; + if (IsCellFrame && CellStack < maxCellStack) + // The property setter will automatically send the necessary packet. + CellStack++; + } } // This code is called as a hook when the player places the Power Cell Factory tile so that the tile entity may be placed. @@ -120,68 +126,33 @@ namespace CalamityMod.TileEntities public override void SaveData(TagCompound tag) { tag["time"] = Time; - tag["cells"] = _stack; + tag["cells"] = Stack_Internal; } public override void LoadData(TagCompound tag) { Time = tag.GetLong("time"); - _stack = tag.GetShort("cells"); + Stack_Internal = tag.GetShort("cells"); } public override void NetSend(BinaryWriter writer) { writer.Write(Time); - writer.Write(_stack); + writer.Write(Stack_Internal); } public override void NetReceive(BinaryReader reader) { Time = reader.ReadInt64(); - _stack = reader.ReadInt16(); + Stack_Internal = reader.ReadInt16(); } private void SendSyncPacket() { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = Mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.PowerCellFactory); - packet.Write(ID); - packet.Write(Time); - packet.Write(_stack); - packet.Send(-1, -1); - } - internal static bool ReadSyncPacket(Mod mod, BinaryReader reader) - { - int teID = reader.ReadInt32(); - bool exists = ByID.TryGetValue(teID, out TileEntity te); - - // The rest of the packet must be read even if it turns out the factory doesn't exist for whatever reason. - long time = reader.ReadInt64(); - short cellStack = reader.ReadInt16(); - - // When a server gets this packet, it immediately sends an equivalent packet to all clients. - if (Main.netMode == NetmodeID.Server) - { - ModPacket packet = mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.PowerCellFactory); - packet.Write(teID); - packet.Write(time); - packet.Write(cellStack); - packet.Send(-1, -1); - } - - if (exists && te is TEPowerCellFactory factory) - { - // Only clients update their timer from this packet. When a server receives this packet it ignores the time variable. - if (Main.netMode == NetmodeID.MultiplayerClient) - factory.Time = time; - factory._stack = cellStack; - return true; - } - return false; + TEPowerCellFactoryPacket.Send(this, Time, Stack_Internal); } } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs index 97a4ee60a2..9a9483acf8 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs @@ -10,9 +10,10 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { - public class AbyssGiantKelp1 : ModTile + public class AbyssGiantKelp1 : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow"; + public override void SetupStatic() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -31,9 +32,8 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient AddMapEntry(new Color(92, 93, 42)); DustType = DustID.Grass; HitSound = SoundID.Grass; - - base.SetStaticDefaults(); } + public override void NearbyEffects(int i, int j, bool closer) { if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) @@ -62,26 +62,15 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient num = fail ? 1 : 2; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + return Color.White; } } //just clone the first one its literally the same size public class AbyssGiantKelp2 : AbyssGiantKelp1 { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow"; } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs index 0178df170f..78b8f09f8c 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs @@ -10,9 +10,11 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { - public class AbyssGiantKelp3 : ModTile + public class AbyssGiantKelp3 : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow"; + + public override void SetupStatic() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -31,8 +33,6 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient AddMapEntry(new Color(92, 93, 42)); DustType = DustID.Grass; HitSound = SoundID.Grass; - - base.SetStaticDefaults(); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) @@ -62,13 +62,9 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient num = fail ? 1 : 2; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + return Color.White; } } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs index 5d7deca65d..4068da5232 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs @@ -10,9 +10,11 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { - public class AbyssGiantKelp4 : ModTile + public class AbyssGiantKelp4 : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow"; + + public override void SetupStatic() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -31,8 +33,6 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient AddMapEntry(new Color(92, 93, 42)); DustType = DustID.Grass; HitSound = SoundID.Grass; - - base.SetStaticDefaults(); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) @@ -62,13 +62,9 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient num = fail ? 1 : 2; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + return Color.White; } } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssVent.cs b/Tiles/Abyss/AbyssAmbient/AbyssVent.cs index 96a6f51c6d..b9fd302559 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssVent.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssVent.cs @@ -1,11 +1,9 @@ using System; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Environment; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -52,7 +50,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)) + if (!Main.gamePaused && !CalamityPlayer.areThereAnyDamnBosses && 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; Vector2 smokeVelocity = -Vector2.UnitY.RotatedByRandom(0.11f) * MathHelper.Lerp(4.8f, 8.1f, positionInterpolant); diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree.cs b/Tiles/Abyss/AbyssAmbient/BulbTree.cs index b8fcb75a47..c4900cc1c9 100644 --- a/Tiles/Abyss/AbyssAmbient/BulbTree.cs +++ b/Tiles/Abyss/AbyssAmbient/BulbTree.cs @@ -9,9 +9,11 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { - public class BulbTree1 : ModTile + public class BulbTree1 : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow"; + + public override void SetupStatic() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -29,8 +31,6 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient TileObjectData.addTile(Type); AddMapEntry(new Color(52, 124, 153)); DustType = 33; - - base.SetStaticDefaults(); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) @@ -45,37 +45,19 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient num = fail ? 1 : 2; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + return Color.White; } } public class BulbTree2 : 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/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); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow"; } 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow"; } } diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs index bc6831691d..d23102c5d6 100644 --- a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs +++ b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs @@ -9,10 +9,15 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { - public class PirateCrate1 : ModTile + // + // Pirate Crate With Glow + + public class PirateCrate1 : GlowMaskTile { + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow"; + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/CrateBreak", 3) { Volume = 0.8f }; - public override void SetStaticDefaults() + public override void SetupStatic() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; @@ -24,8 +29,6 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient AddMapEntry(new Color(97, 69, 52), CalamityUtils.GetText("Tiles.PirateCrate")); DustType = DustID.WoodFurniture; HitSound = MineSound; - - base.SetStaticDefaults(); } public override void KillMultiTile(int i, int j, int frameX, int frameY) @@ -43,40 +46,25 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient num = fail ? 1 : 2; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow").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); + return Color.White; } } public class PirateCrate2 : PirateCrate1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow").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); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow"; } public class PirateCrate3 : PirateCrate1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate3Glow").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); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate3Glow"; } + // + // Pirate Crate Without Glow + public class PirateCrate4 : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/CrateBreak", 3) { Volume = 0.8f }; diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs b/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs index 11f62b915d..75c72a5ecc 100644 --- a/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs +++ b/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs @@ -11,9 +11,11 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { - public class SpiderCoral1 : ModTile + public class SpiderCoral1 : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow"; + + public override void SetupStatic() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient TileObjectData.addTile(Type); AddMapEntry(new Color(82, 49, 27)); DustType = 32; - - base.SetStaticDefaults(); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) @@ -33,61 +33,29 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient b = 0.08f; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + return Color.White; } } public class SpiderCoral2 : SpiderCoral1 { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow"; } public class SpiderCoral3 : SpiderCoral1 { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow"; } public class SpiderCoral4 : SpiderCoral1 { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow"; } public class SpiderCoral5 : SpiderCoral1 { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow"; } } diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs index 0c5ee30a41..76857a6d62 100644 --- a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs +++ b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs @@ -9,9 +9,11 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { - public class SulphurPireCoral1 : ModTile + public class SulphurPireCoral1 : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow"; + + public override void SetupStatic() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -29,8 +31,6 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient TileObjectData.addTile(Type); AddMapEntry(new Color(91, 128, 13)); DustType = 32; - - base.SetStaticDefaults(); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) @@ -45,37 +45,19 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient num = fail ? 1 : 2; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + return Color.White; } } public class SulphurPireCoral2 : 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/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); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow"; } 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); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow"; } } diff --git a/Tiles/Abyss/AbyssAmbient/ThermalVent.cs b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs index a37f2547ef..446118b8c7 100644 --- a/Tiles/Abyss/AbyssAmbient/ThermalVent.cs +++ b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs @@ -1,11 +1,10 @@ using System; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Environment; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -69,15 +68,20 @@ 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)) + if (!Main.gamePaused && !CalamityPlayer.areThereAnyDamnBosses && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) { + if (steamTimer <= 450) + return; + + if (!Main.rand.NextBool(3)) + return; + float positionInterpolant = (i + j) * 0.041f % 1f; Vector2 smokeVelocity = -Vector2.UnitY.RotatedByRandom(0.11f) * MathHelper.Lerp(4.8f, 8.1f, positionInterpolant); smokeVelocity.X += (float)Math.Cos(MathHelper.TwoPi * positionInterpolant) * 1.1f; smokeVelocity.Y -= Main.rand.Next(3, 6); - if (steamTimer >= 450 && Main.rand.NextBool(3)) - Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 20 : 30, 0f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 20 : 30, 0f); } } } diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index 04d2dd8bb0..061e29abef 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Systems; using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -60,100 +61,14 @@ 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.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 2; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = animationFrameWidth * TileFramingSystem.GetVariation4x4_012_Low0(i, j); } } } diff --git a/Tiles/Abyss/AbyssalPots.cs b/Tiles/Abyss/AbyssalPots.cs index 5b54a5cdf0..8e269c0357 100644 --- a/Tiles/Abyss/AbyssalPots.cs +++ b/Tiles/Abyss/AbyssalPots.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.Abyss Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreAmt = Main.rand.Next(1, 2 + 1); for (int k = 0; k < goreAmt; k++) @@ -44,15 +44,18 @@ namespace CalamityMod.Tiles.Abyss } } - // 1 in 400 for a Coin Portal + // Coin Portal @ 0.25% (varies with luck) 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)) + // FTW/GFB drop bombs @ 16.63% + else if (Main.getGoodWorld && Main.rand.NextBool(6)) 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)); + // Remix/GFB drop fallen stars @ 19.95% (@ 16.68% GFB) + else if (Main.remixWorld && Main.rand.NextBool(5)) + yield return new Item(ItemID.FallenStar); else yield return new Item(ModContent.ItemType()); } diff --git a/Tiles/Abyss/AbyssalPots.png b/Tiles/Abyss/AbyssalPots.png index 37feace4dd..0370b79196 100644 Binary files a/Tiles/Abyss/AbyssalPots.png and b/Tiles/Abyss/AbyssalPots.png differ diff --git a/Tiles/Abyss/AcidWoodTree.cs b/Tiles/Abyss/AcidWoodTree.cs index 63a8139aba..59f1194b03 100644 --- a/Tiles/Abyss/AcidWoodTree.cs +++ b/Tiles/Abyss/AcidWoodTree.cs @@ -1,7 +1,8 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Potions.Food; using CalamityMod.NPCs.AcidRain; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -114,6 +115,11 @@ namespace CalamityMod.Tiles.Abyss if (type != -1) Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } + else if (Main.rand.NextBool(3)) + { + int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } return false; } } diff --git a/Tiles/Abyss/AcidWoodTreeSapling.cs b/Tiles/Abyss/AcidWoodTreeSapling.cs index 28be3ad585..30a8bd2878 100644 --- a/Tiles/Abyss/AcidWoodTreeSapling.cs +++ b/Tiles/Abyss/AcidWoodTreeSapling.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Tiles.Abyss bool isPlayerNear = WorldGen.PlayerLOS(i, j); WorldGen.RangeFrame(i - 2, trueStartingPositionY - treeHeight - 1, i + 2, trueStartingPositionY + 1); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, i, (int)((double)trueStartingPositionY - (double)treeHeight * 0.5), treeHeight + 1, TileChangeType.None); if (isPlayerNear) WorldGen.TreeGrowFXCheck(i, j); diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.cs b/Tiles/Abyss/HardenedSulphurousSandstone.cs index f48079fad5..566169bb26 100644 --- a/Tiles/Abyss/HardenedSulphurousSandstone.cs +++ b/Tiles/Abyss/HardenedSulphurousSandstone.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); Main.tile[vineX, vineY].Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index 52fa770985..48bfde5d53 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Systems; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Walls; using Microsoft.Xna.Framework; @@ -29,7 +30,7 @@ namespace CalamityMod.Tiles.Abyss CalamityUtils.MergeWithAbyss(Type); DustType = 2; - AddMapEntry(new Color(84, 102, 39), CalamityUtils.GetItemName()); + AddMapEntry(new Color(84, 102, 39), CalamityUtils.GetItemName()); HitSound = MineSound; this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); @@ -51,93 +52,7 @@ namespace CalamityMod.Tiles.Abyss public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 1; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = animationFrameWidth * TileFramingSystem.GetVariation4x4_01_Low0(i, j); } public override void RandomUpdate(int i, int j) @@ -157,28 +72,30 @@ 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.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } + Tile down = Main.tile[i, j + 1]; int vineLength = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); - if (Main.tile[i, j + 1] != null) + if (down != null) { - if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) + if (!down.HasTile && down.TileType != (ushort)ModContent.TileType()) { - if (Main.tile[i, j + 1].LiquidAmount == 255 && - Main.tile[i, j + 1].WallType == (ushort)ModContent.WallType() && - Main.tile[i, j + 1].LiquidType != LiquidID.Lava) + if (down.LiquidAmount == 255 && + down.WallType == (ushort)ModContent.WallType() && + down.LiquidType != LiquidID.Lava) { bool canGrowVine = false; for (int k = vineLength; k > vineLength - 10; k--) { - if (Main.tile[i, k].BottomSlope) + var vineTile = Main.tile[i, k]; + if (vineTile.BottomSlope) { canGrowVine = false; break; } - if (Main.tile[i, k].HasTile && !Main.tile[i, k].BottomSlope) + if (vineTile.HasTile && !vineTile.BottomSlope) { canGrowVine = true; break; @@ -188,10 +105,11 @@ namespace CalamityMod.Tiles.Abyss { int vineX = i; int vineY = j + 1; - Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); - Main.tile[vineX, vineY].Get().HasTile = true; + var newVineTile = Main.tile[vineX, vineY]; + newVineTile.TileType = (ushort)ModContent.TileType(); + newVineTile.Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/PyreMantle.cs b/Tiles/Abyss/PyreMantle.cs index 90da582ec4..698c1b4422 100644 --- a/Tiles/Abyss/PyreMantle.cs +++ b/Tiles/Abyss/PyreMantle.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.Abyss HitSound = MineSound; MineResist = 10f; MinPick = 180; - AddMapEntry(new Color(19, 20, 32)); + AddMapEntry(new Color(43, 40, 40)); this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); @@ -63,7 +63,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.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/PyreMantleMolten.cs b/Tiles/Abyss/PyreMantleMolten.cs index f6e031ce93..a0f968d2e5 100644 --- a/Tiles/Abyss/PyreMantleMolten.cs +++ b/Tiles/Abyss/PyreMantleMolten.cs @@ -7,21 +7,20 @@ using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { - public class PyreMantleMolten : ModTile + public class PyreMantleMolten : GlowMaskTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - internal static Texture2D GlowTexture; - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/PyreMantleMolten_Glowmask"; + + public override void SetupStatic() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Abyss/PyreMantleMolten_Glowmask", AssetRequestMode.ImmediateLoad).Value; - Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -70,36 +69,15 @@ 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.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - if (GlowTexture is null) - return; - - 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, new Color(200, 200, 200, 200)); - Tile trackTile = Main.tile[i, j]; - float glowbrightness = 1f; - float glowspeed = Main.GameUpdateCount * 0.01f; - glowbrightness *= (float)MathF.Sin(i / 60f + glowspeed); - drawColour *= glowbrightness; - double num6 = Main.time * 0.08; - - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); - glowbrightness += 0.3f; - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { float brightness = 0.7f; - float lightspeed = Main.GameUpdateCount * 0.01f; + float lightspeed = (float)(Main.timeForVisualEffects * 0.01); brightness *= (float)MathF.Sin(i / 60f + lightspeed); brightness += 0.3f; r = 1f; @@ -110,17 +88,12 @@ namespace CalamityMod.Tiles.Abyss b *= brightness; } - private Color GetDrawColour(int i, int j, Color colour) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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; + float glowbrightness = 1f; + float glowspeed = (float)(Main.timeForVisualEffects * 0.01); + glowbrightness *= MathF.Sin(i / 60f + glowspeed); + return Color.White * glowbrightness; } } } diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs index 3e41284181..fa7a0a62b8 100644 --- a/Tiles/Abyss/RustyChestTile.cs +++ b/Tiles/Abyss/RustyChestTile.cs @@ -10,8 +10,12 @@ namespace CalamityMod.Tiles.Abyss { public class RustyChestTile : ModTile { + public static int Type; + public override void SetStaticDefaults() { + Type = (ushort)ModContent.TileType(); + this.SetUpChest(ModContent.ItemType()); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); } diff --git a/Tiles/Abyss/ShaleColumns.cs b/Tiles/Abyss/ShaleColumns.cs index ef89091409..aeb276c33a 100644 --- a/Tiles/Abyss/ShaleColumns.cs +++ b/Tiles/Abyss/ShaleColumns.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.Abyss public override void KillMultiTile(int i, int j, int frameX, int frameY) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; } diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index 7056860026..1f34d7de8b 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Projectiles.Environment; using Microsoft.Xna.Framework; @@ -52,15 +53,20 @@ 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)) + if (!Main.gamePaused && !CalamityPlayer.areThereAnyDamnBosses && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) { + if (steamTimer <= 180) + return; + + if (!Main.rand.NextBool(3)) + return; + float positionInterpolant = (i + j) * 0.041f % 1f; Vector2 smokeVelocity = -Vector2.UnitY.RotatedByRandom(0.11f) * MathHelper.Lerp(4.8f, 8.1f, positionInterpolant); smokeVelocity.X += (float)Math.Cos(MathHelper.TwoPi * positionInterpolant) * 1.1f; smokeVelocity.Y -= Main.rand.Next(3, 6); - if (steamTimer >= 180 && Main.rand.NextBool(3)) - Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 15 : 23, 0f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 15 : 23, 0f); } } } diff --git a/Tiles/Abyss/SulphurousColumn.cs b/Tiles/Abyss/SulphurousColumn.cs index 6cd644742d..285effeb6a 100644 --- a/Tiles/Abyss/SulphurousColumn.cs +++ b/Tiles/Abyss/SulphurousColumn.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.Abyss public override void KillMultiTile(int i, int j, int frameX, int frameY) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Explode into a bunch of rocks when broken. diff --git a/Tiles/Abyss/SulphurousPots.cs b/Tiles/Abyss/SulphurousPots.cs index fda78bd4ac..147d91b787 100644 --- a/Tiles/Abyss/SulphurousPots.cs +++ b/Tiles/Abyss/SulphurousPots.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.Abyss Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreAmt = Main.rand.Next(1, 2 + 1); for (int k = 0; k < goreAmt; k++) @@ -47,15 +47,18 @@ namespace CalamityMod.Tiles.Abyss } } - // 1 in 400 for a Coin Portal + // Coin Portal @ 0.25% (varies with luck) 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 + // FTW/GFB drop bombs @ 16.63% 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)); + // Remix/GFB drop fallen stars @ 19.95% (@ 16.68% GFB) + else if (Main.remixWorld && Main.rand.NextBool(5)) + yield return new Item(ItemID.FallenStar); else yield return new Item(ModContent.ItemType()); } diff --git a/Tiles/Abyss/SulphurousPots.png b/Tiles/Abyss/SulphurousPots.png index 3cd15fb0d5..7dc17f9c62 100644 Binary files a/Tiles/Abyss/SulphurousPots.png and b/Tiles/Abyss/SulphurousPots.png differ diff --git a/Tiles/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index 3dbc1957d9..c1782766db 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[i, tileLocationY - 4].LiquidAmount == 255) { WorldGen.PlaceTile(i, tileLocationY, 81, true, false, -1, 0); - if (Main.netMode == NetmodeID.Server && Main.tile[i, tileLocationY].HasTile) + if (Main.dedServ && Main.tile[i, tileLocationY].HasTile) NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); } } @@ -108,7 +108,7 @@ namespace CalamityMod.Tiles.Abyss if (ambientObjectAmt < ambientObjectMax) { WorldGen.PlaceTile(i, tileLocationY, 324, true, false, -1, Main.rand.Next(2)); - if (Main.netMode == NetmodeID.Server && Main.tile[i, tileLocationY].HasTile) + if (Main.dedServ && Main.tile[i, tileLocationY].HasTile) NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); } } @@ -162,7 +162,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); Main.tile[vineX, vineY].Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } Main.tile[i, j].Get().Slope = SlopeType.Solid; diff --git a/Tiles/Abyss/SulphurousSandstone.cs b/Tiles/Abyss/SulphurousSandstone.cs index 692a04edbc..716cfd62fb 100644 --- a/Tiles/Abyss/SulphurousSandstone.cs +++ b/Tiles/Abyss/SulphurousSandstone.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); Main.tile[vineX, vineY].Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } Main.tile[i, j].Get().Slope = SlopeType.Solid; diff --git a/Tiles/Abyss/SulphurousShale.cs b/Tiles/Abyss/SulphurousShale.cs index dbd4219573..1ecdc028b3 100644 --- a/Tiles/Abyss/SulphurousShale.cs +++ b/Tiles/Abyss/SulphurousShale.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -13,7 +15,7 @@ namespace CalamityMod.Tiles.Abyss int animationFrameWidth = 234; public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3); - + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -35,9 +37,12 @@ namespace CalamityMod.Tiles.Abyss public override void NearbyEffects(int i, int j, bool closer) { + if (Main.dedServ) + return; + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) { - Main.SceneMetrics.ActiveFountainColor = ModContent.Find("CalamityMod/SulphuricDepthsWater").Slot; + Main.SceneMetrics.ActiveFountainColor = SulphuricDepthsWater.Instance.Slot; } } @@ -53,7 +58,6 @@ 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++) @@ -99,7 +103,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); Main.tile[vineX, vineY].Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } Main.tile[i, j].Get().Slope = SlopeType.Solid; @@ -123,100 +127,14 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(22) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 2; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = animationFrameWidth * TileFramingSystem.GetVariation4x4_012_Low0(i, j); } } } diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index 1d49774fce..58306e6d98 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -1,7 +1,9 @@ using System; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; @@ -29,6 +31,12 @@ namespace CalamityMod.Tiles.Abyss TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Main.instance.TilesRenderer.CrawlToTopOfVineAndAddSpecialPoint(j, i); + return false; + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; @@ -127,7 +135,7 @@ namespace CalamityMod.Tiles.Abyss WorldGen.SquareTileFrame(i, j, true); // Send update packets as needed. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, x, y, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index d3ce6d3043..232125a4e6 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -21,6 +23,12 @@ namespace CalamityMod.Tiles.Abyss DustType = 2; } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Main.instance.TilesRenderer.CrawlToTopOfVineAndAddSpecialPoint(j, i); + return false; + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; @@ -88,7 +96,7 @@ namespace CalamityMod.Tiles.Abyss tileBelow.TileType = Type; tileBelow.HasTile = true; WorldGen.SquareTileFrame(i, j + 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); } diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index af545c680f..e9ce5af903 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -7,24 +7,26 @@ using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { - public class Voidstone : ModTile + public class Voidstone : GlowMaskTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - internal static Texture2D GlowTexture; - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/Voidstone_Glowmask"; + public GrayscaleTexture2D NoiseTexture; + + public override void SetupStatic() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Abyss/Voidstone_Glowmask", AssetRequestMode.ImmediateLoad).Value; + NoiseTexture = new("CalamityMod/ExtraTextures/GreyscaleGradients/BlobbyNoise"); Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileBrick[Type] = true; + Main.tileBrick[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); @@ -40,6 +42,12 @@ namespace CalamityMod.Tiles.Abyss this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PyreMantleMerge"); } + public override void OnUnload() + { + NoiseTexture?.Unload(); + NoiseTexture = null; + } + int animationFrameWidth = 234; public override bool CreateDust(int i, int j, ref int type) @@ -70,224 +78,22 @@ 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.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 2; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = animationFrameWidth * TileFramingSystem.GetVariation4x4_012_Low0(i, j); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - if (GlowTexture is null) - return; - - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - int xOffset = 0; - int relativeXPos = i % 4; - int relativeYPos = j % 4; - switch (relativeXPos) - { - case 0: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 1: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 2; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 2: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 3: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 0; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - } - - xOffset *= 234; - xPos += xOffset; - 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, new Color(255, 255, 255, 255)); - Tile trackTile = Main.tile[i, j]; - float brightness = 1f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; - brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawColour *= brightness; - - TileFramingSystem.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; + int time = (int)(Main.timeForVisualEffects * 0.11); + float brightness = 1.0f - NoiseTexture.GetRepeat((i * 100) + time, (j * 100) + time); + brightness -= 0.55f; + return new Color(brightness, brightness, brightness); } } } diff --git a/Tiles/Astral/AstralBeacon.png b/Tiles/Astral/AstralBeacon.png index d0ad4159fc..3824bd2ac8 100644 Binary files a/Tiles/Astral/AstralBeacon.png and b/Tiles/Astral/AstralBeacon.png differ diff --git a/Tiles/Astral/AstralChestLocked.png b/Tiles/Astral/AstralChestLocked.png index 058058fc15..d93f5cf946 100644 Binary files a/Tiles/Astral/AstralChestLocked.png and b/Tiles/Astral/AstralChestLocked.png differ diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index 18ff19942a..43204bb557 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; - + TileID.Sets.Conversion.Dirt[Type] = true; this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); diff --git a/Tiles/Astral/AstralGrass.cs b/Tiles/Astral/AstralGrass.cs index f5256945c1..7239f09f05 100644 --- a/Tiles/Astral/AstralGrass.cs +++ b/Tiles/Astral/AstralGrass.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Metadata; @@ -23,7 +24,7 @@ namespace CalamityMod.Tiles.Astral CalamityUtils.SetMerge(Type, TileID.CrimsonGrass); DustType = ModContent.DustType(); - RegisterItemDrop(ModContent.ItemType()); + RegisterItemDrop(ModContent.ItemType()); AddMapEntry(new Color(133, 109, 140)); @@ -57,7 +58,7 @@ namespace CalamityMod.Tiles.Astral up.TileFrameX = (short)(WorldGen.genRand.Next(20) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } @@ -73,7 +74,7 @@ namespace CalamityMod.Tiles.Astral up.TileFrameX = (short)(WorldGen.genRand.Next(23) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } @@ -81,93 +82,7 @@ namespace CalamityMod.Tiles.Astral } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 1; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = animationFrameWidth * TileFramingSystem.GetVariation4x4_01_Low0(i, j); } public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index 6273e857ec..5dd4bb0a03 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -61,6 +61,8 @@ namespace CalamityMod.Tiles.Astral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; int xOffset = i % 4; int yOffset = j % 4; @@ -77,7 +79,7 @@ namespace CalamityMod.Tiles.Astral Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Astral/AstralMonolithGlow").Value; 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, new Color(50, 50, 50, 50)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(50, 50, 50, 50)); if (!tile.IsHalfBlock && tile.Slope == 0) { Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -132,19 +134,6 @@ namespace CalamityMod.Tiles.Astral } } - 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 IsTileBiomeSightable(int i, int j, ref Color sightColor) { sightColor = Color.Cyan; diff --git a/Tiles/Astral/AstralShortPlants.cs b/Tiles/Astral/AstralShortPlants.cs index 33f5e65517..409ed6b84a 100644 --- a/Tiles/Astral/AstralShortPlants.cs +++ b/Tiles/Astral/AstralShortPlants.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Tiles.Astral Main.tileFrameImportant[Type] = true; TileID.Sets.ReplaceTileBreakUp[Type] = true; TileID.Sets.SwaysInWindBasic[Type] = true; + TileID.Sets.IgnoredByGrowingSaplings[Type] = true; TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); DustType = ModContent.DustType(); @@ -79,9 +80,6 @@ namespace CalamityMod.Tiles.Astral { 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/AstralStoneLargePiles.cs b/Tiles/Astral/AstralStoneLargePiles.cs new file mode 100644 index 0000000000..bce2f92b0e --- /dev/null +++ b/Tiles/Astral/AstralStoneLargePiles.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Astral +{ + public class AstralStoneLargePiles : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + + DustType = ModContent.DustType(); + + AddMapEntry(new Color(79, 61, 97)); + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } + } +} diff --git a/Tiles/Astral/AstralStoneLargePiles.png b/Tiles/Astral/AstralStoneLargePiles.png new file mode 100644 index 0000000000..c0b47f7a65 Binary files /dev/null and b/Tiles/Astral/AstralStoneLargePiles.png differ diff --git a/Tiles/Astral/AstralStoneMediumPiles.cs b/Tiles/Astral/AstralStoneMediumPiles.cs new file mode 100644 index 0000000000..8ff73668f3 --- /dev/null +++ b/Tiles/Astral/AstralStoneMediumPiles.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Astral +{ + public class AstralStoneMediumPiles : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.addTile(Type); + + DustType = ModContent.DustType(); + + AddMapEntry(new Color(79, 61, 97)); + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } + } +} diff --git a/Tiles/Astral/AstralStoneMediumPiles.png b/Tiles/Astral/AstralStoneMediumPiles.png new file mode 100644 index 0000000000..0aaaf71dfc Binary files /dev/null and b/Tiles/Astral/AstralStoneMediumPiles.png differ diff --git a/Tiles/Astral/AstralStoneSmallPiles.cs b/Tiles/Astral/AstralStoneSmallPiles.cs new file mode 100644 index 0000000000..d8215382c1 --- /dev/null +++ b/Tiles/Astral/AstralStoneSmallPiles.cs @@ -0,0 +1,40 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Astral +{ + public class AstralStoneSmallPiles : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + DustType = ModContent.DustType(); + AddMapEntry(new Color(79, 61, 97)); + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } + } +} diff --git a/Tiles/Astral/AstralStoneSmallPiles.png b/Tiles/Astral/AstralStoneSmallPiles.png new file mode 100644 index 0000000000..bbf4dcb9ae Binary files /dev/null and b/Tiles/Astral/AstralStoneSmallPiles.png differ diff --git a/Tiles/Astral/AstralStoneStalactite.cs b/Tiles/Astral/AstralStoneStalactite.cs new file mode 100644 index 0000000000..a6259873be --- /dev/null +++ b/Tiles/Astral/AstralStoneStalactite.cs @@ -0,0 +1,55 @@ + +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Astral +{ + public class AstralStoneStalactite : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + Main.tileBlockLight[Type] = true; + + DustType = ModContent.DustType(); + + AddMapEntry(new Color(79, 61, 97)); + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + Tile tile = Main.tile[i, j]; + if (tile.TileFrameY <= 18 || tile.TileFrameY == 72) + { + offsetY = -2; + } + else if ((tile.TileFrameY >= 36 && tile.TileFrameY <= 54) || tile.TileFrameY == 90) + { + offsetY = 2; + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + WorldGen.CheckTight(i, j); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } + } +} diff --git a/Tiles/Astral/AstralStoneStalactite.png b/Tiles/Astral/AstralStoneStalactite.png new file mode 100644 index 0000000000..c17af1aa5f Binary files /dev/null and b/Tiles/Astral/AstralStoneStalactite.png differ diff --git a/Tiles/Astral/AstralTallPlants.cs b/Tiles/Astral/AstralTallPlants.cs index f00fc33aa2..143fe638b2 100644 --- a/Tiles/Astral/AstralTallPlants.cs +++ b/Tiles/Astral/AstralTallPlants.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Tiles.Astral Main.tileFrameImportant[Type] = true; TileID.Sets.ReplaceTileBreakUp[Type] = true; TileID.Sets.SwaysInWindBasic[Type] = true; + TileID.Sets.IgnoredByGrowingSaplings[Type] = true; TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); @@ -64,9 +65,6 @@ namespace CalamityMod.Tiles.Astral { 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/AstralTree.cs b/Tiles/Astral/AstralTree.cs index 9bc4e6c1d6..4361cf3493 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -1,6 +1,8 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Food; using CalamityMod.NPCs.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,7 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { - public class AstralTree : ModTree + public class AstralTree : GlowMaskTree { public override void SetStaticDefaults() { @@ -32,7 +34,24 @@ namespace CalamityMod.Tiles.Astral SpecialGroupMaximumSaturationValue = 1f }; + public override Asset GetTexture() => ModContent.Request("CalamityMod/Tiles/Astral/AstralTree"); + public override Asset GetGlowTexture() => ModContent.Request("CalamityMod/Tiles/Astral/AstralTreeGlow"); + public override Asset GetBranchTextures() => ModContent.Request("CalamityMod/Tiles/Astral/AstralTree_Branches"); + public override Asset GetBranchGlowTextures() => ModContent.Request("CalamityMod/Tiles/Astral/AstralTree_BranchesGlow"); public override Asset GetTopTextures() => ModContent.Request("CalamityMod/Tiles/Astral/AstralTree_Tops"); + public override Asset GetTopGlowTextures() => ModContent.Request("CalamityMod/Tiles/Astral/AstralTree_TopsGlow"); + + public override Color GetGlowColor(int i, int j) + { + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.012f; + brightness *= MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness = MathHelper.Clamp(brightness, 0.0f, 1.0f); + return Color.White * MathHelper.Lerp(0.1f, 1.0f, brightness); + } public override void SetTreeFoliageSettings(Tile tile, ref int xoffset, ref int treeFrame, ref int floorY, ref int topTextureFrameWidth, ref int topTextureFrameHeight) { @@ -40,9 +59,7 @@ namespace CalamityMod.Tiles.Astral //treeFrame = (i + j * j) % 3; } - public override Asset GetBranchTextures() => ModContent.Request("CalamityMod/Tiles/Astral/AstralTree_Branches"); - public override Asset GetTexture() => ModContent.Request("CalamityMod/Tiles/Astral/AstralTree"); - public override int DropWood() => ModContent.ItemType(); + public override int DropWood() => ModContent.ItemType(); public override int CreateDust() => ModContent.DustType(); public override int SaplingGrowthType(ref int style) @@ -120,6 +137,11 @@ namespace CalamityMod.Tiles.Astral type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } + else if (Main.rand.NextBool(3)) + { + int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } return false; } } diff --git a/Tiles/Astral/AstralTreeGlow.png b/Tiles/Astral/AstralTreeGlow.png new file mode 100644 index 0000000000..cc173b6b66 Binary files /dev/null and b/Tiles/Astral/AstralTreeGlow.png differ diff --git a/Tiles/Astral/AstralTree_BranchesGlow.png b/Tiles/Astral/AstralTree_BranchesGlow.png new file mode 100644 index 0000000000..2b3ef6685e Binary files /dev/null and b/Tiles/Astral/AstralTree_BranchesGlow.png differ diff --git a/Tiles/Astral/AstralTree_TopsGlow.png b/Tiles/Astral/AstralTree_TopsGlow.png new file mode 100644 index 0000000000..384729360c Binary files /dev/null and b/Tiles/Astral/AstralTree_TopsGlow.png differ diff --git a/Tiles/Astral/AstralVines.cs b/Tiles/Astral/AstralVines.cs index 45c6249fb2..3eaaae5300 100644 --- a/Tiles/Astral/AstralVines.cs +++ b/Tiles/Astral/AstralVines.cs @@ -1,8 +1,10 @@ using System; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; @@ -32,6 +34,12 @@ namespace CalamityMod.Tiles.Astral AddMapEntry(new Color(65, 56, 83)); } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Main.instance.TilesRenderer.CrawlToTopOfVineAndAddSpecialPoint(j, i); + return false; + } + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { //GIVE VINE ROPE IF SPECIAL VINE BOOK diff --git a/Tiles/Astral/AstralVines.png b/Tiles/Astral/AstralVines.png index 9eb6362cc9..a7adaeb04a 100644 Binary files a/Tiles/Astral/AstralVines.png and b/Tiles/Astral/AstralVines.png differ diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index 2ea9214d4b..1daaa84617 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -5,18 +5,20 @@ using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class AstralBrick : ModTile + public class AstralBrick : GlowMaskTile { private const short subsheetWidth = 324; private const short subsheetHeight = 90; + public override string GlowMaskAsset => "CalamityMod/Tiles/AstralBrickGlow"; - public override void SetStaticDefaults() + public override void SetupStatic() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -46,36 +48,9 @@ namespace CalamityMod.Tiles frameYOffset = yPos * subsheetHeight; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - int xOffset = i % 2; - int yOffset = j % 2; - xOffset *= subsheetWidth; - yOffset *= subsheetHeight; - xPos += xOffset; - yPos += yOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/AstralBrickGlow").Value; - 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, new Color(50, 50, 50, 50)); - Tile trackTile = Main.tile[i, j]; - - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, 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; + return new Color(50, 50, 50); } } } diff --git a/Tiles/AstralDesert/AstralCactus.cs b/Tiles/AstralDesert/AstralCactus.cs index fa99db5039..d297df1600 100644 --- a/Tiles/AstralDesert/AstralCactus.cs +++ b/Tiles/AstralDesert/AstralCactus.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralDesert { - public class AstralCactus : ModCactus + public class AstralCactus : GlowMaskCactus { public override void SetStaticDefaults() { @@ -14,9 +15,15 @@ namespace CalamityMod.Tiles.AstralDesert //Idk what to make with the glowmask public override Asset GetTexture() => ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralCactus"); + public override Asset GetGlowTexture() => ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralCactusGlow"); - //What is a FruitTexture + // TODO: Fruit Texture for Astral Cactus (it's for Pink Prickly Pear) public override Asset GetFruitTexture() => null; + public override Asset GetFruitGlowTexture() => null; + public override Color GetGlowColor(int i, int j) + { + return Color.White; + } } } diff --git a/Tiles/AstralDesert/AstralPalmSaplingGlow.png b/Tiles/AstralDesert/AstralPalmSaplingGlow.png new file mode 100644 index 0000000000..2d52fe0746 Binary files /dev/null and b/Tiles/AstralDesert/AstralPalmSaplingGlow.png differ diff --git a/Tiles/AstralDesert/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs index 4ccdbe2be0..6c0d7fc4fe 100644 --- a/Tiles/AstralDesert/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -1,6 +1,8 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Food; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -13,7 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralDesert { - public class AstralPalmTree : ModPalmTree + public class AstralPalmTree : GlowMaskPalmTree { public override void SetStaticDefaults() { @@ -32,14 +34,29 @@ namespace CalamityMod.Tiles.AstralDesert }; public override Asset GetTexture() => ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralPalmTree"); + public override Asset GetGlowTexture() => ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralPalmTreeGlow"); public override Asset GetTopTextures() => ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralPalmTree_Tops"); + public override Asset GetTopGlowTextures() => ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralPalmTree_TopsGlow"); //I don't know what this means. Why do palm trees have branches?? Since when. Will ask spriters for an oasis alt later public override Asset GetOasisTopTextures() => ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralPalmTree_OasisTops"); + public override Asset GetOasisTopGlowTextures() => ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralPalmTree_OasisTopsGlow"); - public override int DropWood() => ModContent.ItemType(); + public override Color GetGlowColor(int i, int j) + { + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.012f; + brightness *= MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness = MathHelper.Clamp(brightness, 0.0f, 1.0f); + return Color.White * MathHelper.Lerp(0.05f, 0.75f, brightness); + } + + public override int DropWood() => ModContent.ItemType(); public override int CreateDust() => ModContent.DustType(); @@ -106,6 +123,16 @@ namespace CalamityMod.Tiles.AstralDesert type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } + else if (Main.rand.Next(36) < 5) // Vanilla palm fruit logic goes first + { + int fruitType = Main.rand.NextBool() ? ItemID.Coconut : ItemID.Banana; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } + else if (Main.rand.Next(36) < 5) + { + int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } return false; } } diff --git a/Tiles/AstralDesert/AstralPalmTreeGlow.png b/Tiles/AstralDesert/AstralPalmTreeGlow.png new file mode 100644 index 0000000000..5542321a50 Binary files /dev/null and b/Tiles/AstralDesert/AstralPalmTreeGlow.png differ diff --git a/Tiles/AstralDesert/AstralPalmTree_OasisTopsGlow.png b/Tiles/AstralDesert/AstralPalmTree_OasisTopsGlow.png new file mode 100644 index 0000000000..1c5c9e36a7 Binary files /dev/null and b/Tiles/AstralDesert/AstralPalmTree_OasisTopsGlow.png differ diff --git a/Tiles/AstralDesert/AstralPalmTree_TopsGlow.png b/Tiles/AstralDesert/AstralPalmTree_TopsGlow.png new file mode 100644 index 0000000000..c55367677e Binary files /dev/null and b/Tiles/AstralDesert/AstralPalmTree_TopsGlow.png differ diff --git a/Tiles/AstralDesert/CelestialRemains.cs b/Tiles/AstralDesert/CelestialRemains.cs index 984b7f9937..70bc6f2963 100644 --- a/Tiles/AstralDesert/CelestialRemains.cs +++ b/Tiles/AstralDesert/CelestialRemains.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Tiles.AstralDesert DustType = ModContent.DustType(); - AddMapEntry(new Color(59, 50, 77), CalamityUtils.GetItemName()); + AddMapEntry(new Color(59, 50, 77), CalamityUtils.GetItemName()); TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; diff --git a/Tiles/AstralSnow/AstralIce.cs b/Tiles/AstralSnow/AstralIce.cs index 767b6e94dd..84290b3cfe 100644 --- a/Tiles/AstralSnow/AstralIce.cs +++ b/Tiles/AstralSnow/AstralIce.cs @@ -1,24 +1,27 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using CalamityMod.Systems; using CalamityMod.Tiles.Astral; 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.AstralSnow { - public class AstralIce : ModTile + public class AstralIce : GlowMaskTile { - - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/AstralSnow/AstralIceLightmask"; + public override void SetupStatic() { Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = false; Main.tileBrick[Type] = true; TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Ice"]); - + Main.tileLighted[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithSnow(Type); CalamityUtils.MergeAstralTiles(Type); @@ -29,6 +32,7 @@ namespace CalamityMod.Tiles.AstralSnow AddMapEntry(new Color(153, 143, 168)); + TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.Ices[Type] = true; TileID.Sets.IcesSlush[Type] = true; TileID.Sets.IcesSnow[Type] = true; @@ -56,5 +60,38 @@ namespace CalamityMod.Tiles.AstralSnow sightColor = Color.Cyan; return true; } + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) + { + int time = (int)(Main.timeForVisualEffects * 0.11); + float brightness = 0.2f; + brightness += (float)MathF.Sin(-j / 1f + Main.GameUpdateCount * 0.002f + -i / 30f); + brightness -= (float)MathF.Sin(j / 8f + Main.GameUpdateCount * 0.002f - i / 11f); + brightness -= (float)MathF.Sin(j / 1f + Main.GameUpdateCount * 0.001f - i / 2f); + brightness -= (float)MathF.Sin(-j / 2f + Main.GameUpdateCount * 0.003f - i / 4f); + brightness += (float)MathF.Sin(-j / 4f + Main.GameUpdateCount * 0.003f - i / 8f); + return new Color(brightness, brightness, brightness); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.2f; + brightness *= (float)MathF.Sin(-j / 40f + Main.GameUpdateCount * 0.005f + i / 8f); + r = 131f / 1500f; + g = 111f / 1500f; + b = 171f / 1500f; + brightness += (float)MathF.Sin(-j / 1f + Main.GameUpdateCount * 0.002f + -i / 30f); + brightness -= (float)MathF.Sin(j / 8f + Main.GameUpdateCount * 0.002f - i / 11f); + brightness -= (float)MathF.Sin(j / 1f + Main.GameUpdateCount * 0.001f - i / 2f); + brightness -= (float)MathF.Sin(-j / 2f + Main.GameUpdateCount * 0.003f - i / 4f); + brightness += (float)MathF.Sin(-j / 4f + Main.GameUpdateCount * 0.003f - i / 8f); + + brightness -= 0.05f; + r *= brightness; + g *= brightness; + b *= brightness; + } } } diff --git a/Tiles/AstralSnow/AstralIce.png b/Tiles/AstralSnow/AstralIce.png index e3891a1e21..86a8d74879 100644 Binary files a/Tiles/AstralSnow/AstralIce.png and b/Tiles/AstralSnow/AstralIce.png differ diff --git a/Tiles/AstralSnow/AstralIceLightmask.png b/Tiles/AstralSnow/AstralIceLightmask.png new file mode 100644 index 0000000000..f3d3a35b3e Binary files /dev/null and b/Tiles/AstralSnow/AstralIceLightmask.png differ diff --git a/Tiles/AstralSnow/AstralSnow.cs b/Tiles/AstralSnow/AstralSnow.cs index 27b8b2a29e..734f17698b 100644 --- a/Tiles/AstralSnow/AstralSnow.cs +++ b/Tiles/AstralSnow/AstralSnow.cs @@ -1,19 +1,25 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using CalamityMod.Systems; using CalamityMod.Tiles.Astral; 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.AstralSnow { - public class AstralSnow : ModTile + public class AstralSnow : GlowMaskTile { - - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/AstralSnow/AstralSnowLightmask"; + public GrayscaleTexture2D NoiseTexture; + public override void SetupStatic() { + NoiseTexture = new("CalamityMod/ExtraTextures/GreyscaleGradients/BlobbyNoise"); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; @@ -28,8 +34,9 @@ namespace CalamityMod.Tiles.AstralSnow HitSound = SoundID.Item48; AddMapEntry(new Color(189, 211, 221)); - + TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.Snow[Type] = true; + TileID.Sets.Conversion.Snow[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; @@ -41,11 +48,31 @@ namespace CalamityMod.Tiles.AstralSnow { num = fail ? 1 : 3; } + public override void OnUnload() + { + NoiseTexture?.Unload(); + NoiseTexture = null; + } public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) { sightColor = Color.Cyan; return true; } + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) + { + int time = (int)(Main.timeForVisualEffects * 0.11); + float brightness = 1.0f - NoiseTexture.GetRepeat((i * 60) + time, (j * 50) + time); + brightness += (float)MathF.Sin(-j / 1f + Main.GameUpdateCount * 0.02f + -i / 30f); + brightness -= (float)MathF.Sin(j / 8f + Main.GameUpdateCount * 0.02f - i / 11f); + brightness -= (float)MathF.Sin(j / 1f + Main.GameUpdateCount * 0.01f - i / 2f); + brightness -= (float)MathF.Sin(-j / 2f + Main.GameUpdateCount * 0.03f - i / 4f); + brightness += (float)MathF.Sin(-j / 4f + Main.GameUpdateCount * 0.03f - i / 8f); + return new Color(brightness, brightness, brightness); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } } } diff --git a/Tiles/AstralSnow/AstralSnow.png b/Tiles/AstralSnow/AstralSnow.png index dd0facc49d..a0333f7c80 100644 Binary files a/Tiles/AstralSnow/AstralSnow.png and b/Tiles/AstralSnow/AstralSnow.png differ diff --git a/Tiles/AstralSnow/AstralSnowLightmask.png b/Tiles/AstralSnow/AstralSnowLightmask.png new file mode 100644 index 0000000000..6fcc9110e1 Binary files /dev/null and b/Tiles/AstralSnow/AstralSnowLightmask.png differ diff --git a/Tiles/AstralSnow/AstralSnowTree.cs b/Tiles/AstralSnow/AstralSnowTree.cs index f36ecac3c4..aaa2519155 100644 --- a/Tiles/AstralSnow/AstralSnowTree.cs +++ b/Tiles/AstralSnow/AstralSnowTree.cs @@ -1,6 +1,8 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Food; using CalamityMod.NPCs.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,7 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralSnow { - public class AstralSnowTree : ModTree + public class AstralSnowTree : GlowMaskTree { public override void SetStaticDefaults() { @@ -32,7 +34,24 @@ namespace CalamityMod.Tiles.AstralSnow SpecialGroupMaximumSaturationValue = 1f }; + public override Asset GetTexture() => ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree"); + public override Asset GetGlowTexture() => ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTreeGlow"); + public override Asset GetBranchTextures() => ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Branches"); + public override Asset GetBranchGlowTextures() => ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree_BranchesGlow"); public override Asset GetTopTextures() => ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Tops"); + public override Asset GetTopGlowTextures() => ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree_TopsGlow"); + + public override Color GetGlowColor(int i, int j) + { + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.012f; + brightness *= MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness = MathHelper.Clamp(brightness, 0.0f, 1.0f); + return Color.White * MathHelper.Lerp(0.35f, 1.0f, brightness); + } public override void SetTreeFoliageSettings(Tile tile, ref int xoffset, ref int treeFrame, ref int floorY, ref int topTextureFrameWidth, ref int topTextureFrameHeight) { @@ -40,11 +59,7 @@ namespace CalamityMod.Tiles.AstralSnow //treeFrame = (i + j * j) % 6; } - public override Asset GetBranchTextures() => ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Branches"); - - public override Asset GetTexture() => ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree"); - - public override int DropWood() => ModContent.ItemType(); + public override int DropWood() => ModContent.ItemType(); public override int CreateDust() => ModContent.DustType(); @@ -122,6 +137,11 @@ namespace CalamityMod.Tiles.AstralSnow type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } + else if (Main.rand.NextBool(3)) + { + int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } return false; } } diff --git a/Tiles/AstralSnow/AstralSnowTreeGlow.png b/Tiles/AstralSnow/AstralSnowTreeGlow.png new file mode 100644 index 0000000000..147cc38b7d Binary files /dev/null and b/Tiles/AstralSnow/AstralSnowTreeGlow.png differ diff --git a/Tiles/AstralSnow/AstralSnowTreeSaplingGlow.png b/Tiles/AstralSnow/AstralSnowTreeSaplingGlow.png new file mode 100644 index 0000000000..3b59887860 Binary files /dev/null and b/Tiles/AstralSnow/AstralSnowTreeSaplingGlow.png differ diff --git a/Tiles/AstralSnow/AstralSnowTree_BranchesGlow.png b/Tiles/AstralSnow/AstralSnowTree_BranchesGlow.png new file mode 100644 index 0000000000..00aac1645e Binary files /dev/null and b/Tiles/AstralSnow/AstralSnowTree_BranchesGlow.png differ diff --git a/Tiles/AstralSnow/AstralSnowTree_TopsGlow.png b/Tiles/AstralSnow/AstralSnowTree_TopsGlow.png new file mode 100644 index 0000000000..0a4fa7f4b6 Binary files /dev/null and b/Tiles/AstralSnow/AstralSnowTree_TopsGlow.png differ diff --git a/Tiles/BaseTiles/BaseMonolith.cs b/Tiles/BaseTiles/BaseMonolith.cs new file mode 100644 index 0000000000..b0475eed59 --- /dev/null +++ b/Tiles/BaseTiles/BaseMonolith.cs @@ -0,0 +1,171 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria.GameContent; +using Terraria; +using Terraria.ModLoader; +using ReLogic.Content; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Tiles.BaseTiles +{ + public abstract class BaseMonolith : ModTile + { + public abstract int TileWidth { get; } + public abstract int TileHeight { get; } + public abstract int AnimationFrameCount { get; } + public abstract int AnimationDelay { get; } + public abstract int CursorItemType { get; } + public virtual bool HasBottomTile18PixelsHeight => true; + public int EnabledFrameY => AnimationFrameHeight; + + /// + /// GlowMask to use for Monolith + /// + public Asset GlowMask; + + /// + /// Sound to play on right-clicked by player + /// + public SoundStyle? RightClickSound = SoundID.Mech; + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = CursorItemType != 0; + player.cursorItemIconID = CursorItemType; + } + + public override bool RightClick(int i, int j) + { + ToggleMonolith(i, j); + SoundEngine.PlaySound(RightClickSound, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + ToggleMonolith(i, j); + } + + private void ToggleMonolith(int i, int j) + { + var tile = Main.tile[i, j]; + var width = 18 * TileWidth; + var height = AnimationFrameHeight; + var leftTopI = i - ((tile.TileFrameX % width) / 18); + var leftTopJ = j - ((tile.TileFrameY % height) / 18); + var enabled = tile.TileFrameY >= height; + + for (int o = 0; o < TileWidth; o++) + { + for (int p = 0; p < TileHeight; p++) + { + var relI = leftTopI + o; + var relJ = leftTopJ + p; + var relTile = Main.tile[relI, relJ]; + + if (enabled) relTile.TileFrameY -= (short)height; + else relTile.TileFrameY += (short)height; + + if (Wiring.running) + { + Wiring.SkipWire(relI, relJ); + } + } + } + + if (Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendTileSquare(-1, leftTopI, leftTopJ, TileWidth, TileHeight); + } + } + + public sealed override void NearbyEffects(int i, int j, bool closer) + { + var enabled = Main.tile[i, j].TileFrameY >= EnabledFrameY; + NearbyEffects(i, j, closer, enabled, Main.LocalPlayer); + } + + public virtual void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) + { + + } + + public virtual Color GetGlowMaskDrawColor(int i, int j) + { + return Color.White; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= AnimationDelay) + { + frameCounter = 0; + if (++frame >= AnimationFrameCount) + { + frame = 0; + } + } + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + + var tile = Main.tile[i, j]; + var texture = TextureAssets.Tile[Type].Value; + + var zero = Main.drawToScreen ? Vector2.Zero : new(Main.offScreenRange, Main.offScreenRange); + var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero; + + var animateFrameOffset = (tile.TileFrameY >= EnabledFrameY) ? Main.tileFrame[Type] * AnimationFrameHeight : 0; + var isHeight18Pixels = HasBottomTile18PixelsHeight && (tile.TileFrameY % AnimationFrameHeight) >= (18 * (TileHeight - 1)); + var height = isHeight18Pixels ? 18 : 16; + + var rect = new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height); + + var drawColor = Lighting.GetColor(i, j); + var glowColor = GetGlowMaskDrawColor(i, j); + + Main.spriteBatch.Draw(texture, drawPos, rect, drawColor, 0f, default, 1f, SpriteEffects.None, 0f); + if (GlowMask != null) + Main.spriteBatch.Draw(GlowMask.Value, drawPos, rect, glowColor, 0f, default, 1f, SpriteEffects.None, 0f); + + DrawExtra(drawPos, rect, drawColor); + + // 02FEB2025: Ozzatron: code lifted from https://github.com/CalamityTeam/CalamityModPublic/pull/77 + // transplanted into base monolith as part of manual cherry pick merge + // + // Draws the Smart Cursor Highlight. Not 100% accurate, but its close enough + bool actuallySelected; + Color highlightColor; + Texture2D texhighlight = ModContent.Request(HighlightTexture).Value; + if (texhighlight is not null && Main.InSmartCursorHighlightArea(i, j, out actuallySelected)) + { + if (actuallySelected) + { + highlightColor = new Color(252, 252, 84); + } + else + { + highlightColor = new Color(125, 125, 125); + } + Main.spriteBatch.Draw(texhighlight, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height), highlightColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); ; + } + + return false; + } + + public virtual void DrawExtra(Vector2 drawPos, Rectangle rect, Color tileColor) + { + + } + } +} diff --git a/Tiles/BaseTiles/BranchDrawer.cs b/Tiles/BaseTiles/BranchDrawer.cs index 9f331ddd07..0a5eb328b5 100644 --- a/Tiles/BaseTiles/BranchDrawer.cs +++ b/Tiles/BaseTiles/BranchDrawer.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Tiles.BaseTiles { get { - if (Main.netMode != NetmodeID.Server && basicShader is null) + if (!Main.dedServ && basicShader is null) { basicShader = new BasicEffect(Main.instance.GraphicsDevice) { diff --git a/Tiles/BaseTiles/DynamicallyGrownTree.cs b/Tiles/BaseTiles/DynamicallyGrownTree.cs index e4a3882f33..a1b64d284f 100644 --- a/Tiles/BaseTiles/DynamicallyGrownTree.cs +++ b/Tiles/BaseTiles/DynamicallyGrownTree.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Tiles.BaseTiles MaxCutoffBranchesPerBranch = MaxCutoffBranchesPerBranch }; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) BranchDrawer.BarkTexture = ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value; } @@ -132,6 +132,9 @@ namespace CalamityMod.Tiles.BaseTiles public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); if (t.TileFrameX != 0 || t.TileFrameY != ((int)Math.Ceiling(DistanceUsedForTrunk / 16) - 1) * 18) return false; diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 299a868cf6..a003841988 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -6,16 +6,15 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; -using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.DraedonSummoner; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.Achievements; using Terraria.ID; using Terraria.ModLoader; @@ -37,52 +36,10 @@ namespace CalamityMod.Tiles { Main.tileSpelunker[TileID.LunarOre] = true; Main.tileOreFinderPriority[TileID.LunarOre] = 900; - } - public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) - { - // Guaranteed not null at this point - Tile tile = Main.tile[i, j]; - - // This function is only for Astral Cactus. If the tile isn't even cactus, forget about it. - if (type != TileID.Cactus) - return; - - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - zero = Vector2.Zero; - int frameX = tile.TileFrameX; - int frameY = tile.TileFrameY; - - // Search down the cactus to find out whether the block it is planted in is Astral Sand. - int xTile = i; - if (frameX == 36) // Cactus segment which splits left - xTile--; - if (frameX == 54) // Cactus segment which splits right - xTile++; - if (frameX == 108) // Cactus segment which splits both directions - xTile += (frameY == 18) ? -1 : 1; - - int yTile = j; - bool slidingDownCactus = Main.tile[xTile, yTile] != null && Main.tile[xTile, yTile].TileType == TileID.Cactus && Main.tile[xTile, yTile].HasTile; - while (!Main.tile[xTile, yTile].HasTile || !Main.tileSolid[Main.tile[xTile, yTile].TileType] || !slidingDownCactus) - { - if (Main.tile[xTile, yTile].TileType == TileID.Cactus && Main.tile[xTile, yTile].HasTile) - { - slidingDownCactus = true; - } - yTile++; - // Cacti are assumed to be no more than 20 blocks tall. - if (yTile > i + 20) - break; - } - bool astralCactus = Main.tile[xTile, yTile].TileType == (ushort)ModContent.TileType(); - - // If it is actually astral cactus, then draw its glowmask. - if (astralCactus) - { - spriteBatch.Draw(ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralCactusGlow").Value, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default, 1f, SpriteEffects.None, 0f); - } + // Allow Queen Bee larvae to be protected by Guide to Environmental Protection + // Yes this naming is backwards. Do not blame me! + TileID.Sets.TileCutIgnore.IgnoreDontHurtNature[TileID.Larva] = true; } public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) @@ -284,7 +241,7 @@ namespace CalamityMod.Tiles { tile.Get().HasTile = false; WorldGen.KillTile(x, y, fail: false, effectOnly: false, noItem: true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.TrySendData(17, -1, -1, null, 20, x, y); } } @@ -295,7 +252,7 @@ namespace CalamityMod.Tiles { Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 8, j * 16 + 8, 0f, 0.41f, projectileType, damage, 0f, Main.myPlayer); } - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) { int proj = Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 8, j * 16 + 8, 0f, 0.41f, projectileType, damage, 0f, Main.myPlayer); Main.projectile[proj].netUpdate = true; @@ -342,25 +299,56 @@ namespace CalamityMod.Tiles public override void Drop(int i, int j, int type)/* tModPorter Suggestion: Use CanDrop to decide if items can drop, use this method to drop additional items. See documentation. */ { - Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); - if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) + // Handle for Demon Altar Drops + // Drop: + // - Soul of Night (x4) (Only if Early Hardmode Progression Rework is on) + // - Evil Smasher (x1) (Every 12th altar) + if (type == TileID.DemonAltar && Main.hardMode) { - if (type == TileID.DemonAltar && Main.hardMode) + Vector2 spreadMinMax = new Vector2(-32.0f, 32.0f); + + // Drop 4 Soul of Night + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) { - Vector2 pos = new Vector2(i, j) * 16; - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) - { - WorldGen.altarCount++; - int quantity = 4; - for (int k = 0; k < quantity; k += 1) - { - pos.X += Main.rand.NextFloat(-32f, 32f); - pos.Y += Main.rand.NextFloat(-32f, 32f); - Item.NewItem(new EntitySource_TileBreak(i, j), pos, ItemID.SoulofNight); - } - } - if (WorldGen.altarCount % 12 == 0 && WorldGen.altarCount > 1) - Item.NewItem(new EntitySource_TileBreak(i, j), pos, ModContent.ItemType()); + DropItem(i, j, ItemID.SoulofNight, quantity: 4, asStack: false, spreadMinMax); + WorldGen.altarCount++; // altarCount does not update automatically if ProgressionRework is enabled! + AchievementsHelper.NotifyProgressionEvent(6); // Gives the Begone, Evil! achievement + } + + // Drop Evil Smasher on every 12 alter smashed + if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0) + { + DropItem(i, j, ModContent.ItemType(), quantity: 1, asStack: true); + } + } + // Drop Golden Bombs at a 0.33% chance from Pots + if (type == TileID.Pots) + { + if (Main.rand.NextBool(300)) + { + DropItem(i, j, ModContent.ItemType(), quantity: 1, asStack: true); + } + } + } + + private static void DropItem(int i, int j, int itemType, int quantity, bool asStack, Vector2 spreadMinMax = default) + { + // Multiplayer Client should not spawn item themselves + if (Main.netMode == NetmodeID.MultiplayerClient) + return; + + Vector2 worldPos = new Vector2(i, j) * 16.0f; + if (asStack) + { + Vector2 spawnOffset = Main.rand.NextVector2Unit(spreadMinMax.X, spreadMinMax.Y); + Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: quantity); + } + else + { + for (int k = 0; k < quantity; k += 1) + { + Vector2 spawnOffset = Main.rand.NextVector2Unit(spreadMinMax.X, spreadMinMax.Y); + Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: 1); } } } diff --git a/Tiles/CosmiliteBarTile.cs b/Tiles/CosmiliteBarTile.cs index 7ecfadf556..d37e1f19b5 100644 --- a/Tiles/CosmiliteBarTile.cs +++ b/Tiles/CosmiliteBarTile.cs @@ -19,10 +19,5 @@ namespace CalamityMod.Tiles type = ModContent.DustType(); return true; } - - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - return false; - } } } diff --git a/Tiles/Crags/BrimstoneSlag.cs b/Tiles/Crags/BrimstoneSlag.cs index 6d64f0c9e3..d88a236f6b 100644 --- a/Tiles/Crags/BrimstoneSlag.cs +++ b/Tiles/Crags/BrimstoneSlag.cs @@ -51,64 +51,5 @@ namespace CalamityMod.Tiles.Crags { return TileFramingSystem.BrimstoneFraming(i, j, resetFrame); } - - /*public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Main.tile[i, j]; - Texture2D sprite = ModContent.GetTexture("CalamityMod/Tiles/Crags/BrimstoneSlagGlow"); - int frameXOffset = i % 2 * subsheetWidth; - int frameYOffset = j % 2 * subsheetHeight; - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - if (Main.drawToScreen) - { - zero = Vector2.Zero; - } - if (tile.Slope == (byte)0 && !tile.IsHalfBlock) - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 16), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - else if (tile.IsHalfBlock) - { - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y + 10) + 8) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - else - { - byte num9 = tile.Slope; - for (int index4 = 0; index4 < 8; ++index4) - { - int width2 = index4 << 1; - Rectangle drawRectangle = new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset + index4 * 2, width2, 2); - int num10 = 0; - switch (num9) - { - case 2: - drawRectangle.X = 16 - width2; - num10 = 16 - width2; - break; - case 3: - drawRectangle.Width = 16 - width2; - break; - case 4: - drawRectangle.Width = 14 - width2; - drawRectangle.X = width2 + 2; - num10 = width2 + 2; - break; - } - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X) + (float)num10, (float)(j * 16 - (int)Main.screenPosition.Y + index4 * 2)) + zero, drawRectangle, drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - } - } - - 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; - }*/ } } diff --git a/Tiles/Crags/CinderBlossomTallPlants.cs b/Tiles/Crags/CinderBlossomTallPlants.cs index 77d71ff212..7cdea6fe06 100644 --- a/Tiles/Crags/CinderBlossomTallPlants.cs +++ b/Tiles/Crags/CinderBlossomTallPlants.cs @@ -60,11 +60,11 @@ namespace CalamityMod.Tiles.Crags height = 48; } - public override void KillMultiTile(int i, int j, int frameX, int frameY) + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { - if (Main.rand.NextBool(20)) + if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(20)) { - Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, ModContent.ItemType()); + Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, ModContent.ItemType()); } } } diff --git a/Tiles/Crags/Lily/LavaLily1.cs b/Tiles/Crags/Lily/LavaLily1.cs index e541a9a434..9ce7428ca5 100644 --- a/Tiles/Crags/Lily/LavaLily1.cs +++ b/Tiles/Crags/Lily/LavaLily1.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily2.cs b/Tiles/Crags/Lily/LavaLily2.cs index d392bcc01c..2e09e90016 100644 --- a/Tiles/Crags/Lily/LavaLily2.cs +++ b/Tiles/Crags/Lily/LavaLily2.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily3.cs b/Tiles/Crags/Lily/LavaLily3.cs index e33eac3bb7..1b32b892e4 100644 --- a/Tiles/Crags/Lily/LavaLily3.cs +++ b/Tiles/Crags/Lily/LavaLily3.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily4.cs b/Tiles/Crags/Lily/LavaLily4.cs index e922e4efea..8950207004 100644 --- a/Tiles/Crags/Lily/LavaLily4.cs +++ b/Tiles/Crags/Lily/LavaLily4.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily5.cs b/Tiles/Crags/Lily/LavaLily5.cs index 57c72e2661..6397483d8d 100644 --- a/Tiles/Crags/Lily/LavaLily5.cs +++ b/Tiles/Crags/Lily/LavaLily5.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily6.cs b/Tiles/Crags/Lily/LavaLily6.cs index bc8fa2c1bd..0aafb69d5d 100644 --- a/Tiles/Crags/Lily/LavaLily6.cs +++ b/Tiles/Crags/Lily/LavaLily6.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs index 5cf19faafc..9d48394481 100644 --- a/Tiles/Crags/ScorchedRemainsGrass.cs +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.Crags HitSound = SoundID.Dig; MinPick = 100; - RegisterItemDrop(ModContent.ItemType()); + RegisterItemDrop(ModContent.ItemType()); AddMapEntry(new Color(212, 82, 227)); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); @@ -82,7 +82,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.dedServ) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } @@ -113,7 +113,7 @@ namespace CalamityMod.Tiles.Crags up.TileFrameX = (short)(WorldGen.genRand.Next(8) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } @@ -147,9 +147,12 @@ namespace CalamityMod.Tiles.Crags public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + 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 drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j)); Texture2D leaves = ModContent.Request("CalamityMod/Tiles/Crags/CinderBlossomGrassGrass").Value; DrawExtraTop(i, j, leaves, drawOffset, drawColour); @@ -279,27 +282,6 @@ namespace CalamityMod.Tiles.Crags return Main.tile[i + x, j - y].TileType == type == equal; } - private Color GetDrawColour(int i, int j) - { - int colType = Main.tile[i, j].TileColor; - 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; - } - private int GetExtraState(string type) { switch (type) diff --git a/Tiles/Crags/Tree/SpineSapling.cs b/Tiles/Crags/Tree/SpineSapling.cs index 140f46a145..50ce8eee4e 100644 --- a/Tiles/Crags/Tree/SpineSapling.cs +++ b/Tiles/Crags/Tree/SpineSapling.cs @@ -49,13 +49,12 @@ namespace CalamityMod.Tiles.Crags.Tree { 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); - } + // if below tile is somewhat not sappling (only possible if it's from below part) + if (Main.tile[i, j + 1].TileType != Type) + SpineTree.Spawn(i, j, 22, 28, true); } } + + public override bool CanDrop(int i, int j) => false; } } diff --git a/Tiles/Crags/Tree/SpineTree.cs b/Tiles/Crags/Tree/SpineTree.cs index a5ab31f444..11adee04ed 100644 --- a/Tiles/Crags/Tree/SpineTree.cs +++ b/Tiles/Crags/Tree/SpineTree.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.Crags.Tree AddMapEntry(new Color(38, 25, 27), CreateMapEntryName()); DustType = 155; HitSound = SoundID.DD2_SkeletonHurt; - RegisterItemDrop(ModContent.ItemType()); + RegisterItemDrop(ModContent.ItemType()); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) @@ -62,13 +62,6 @@ namespace CalamityMod.Tiles.Crags.Tree public static bool Spawn(int i, int j, int minSize = 5, int maxSize = 18, bool saplingExists = false) { - //if this tree grew from a sapling, then kill the sapling its growing from - if (saplingExists) - { - WorldGen.KillTile(i, j, false, false, true); - WorldGen.KillTile(i, j - 1, false, false, true); - } - //set the minimum and maximum height the tree can grow to int height = Main.rand.Next(minSize, maxSize); for (int k = 1; k < height; ++k) @@ -85,6 +78,20 @@ namespace CalamityMod.Tiles.Crags.Tree return false; } + // something is blocking from growing the tree... + var sapplingType = ModContent.TileType(); + if (!WorldGen.EmptyTileCheck(i - 2, i + 2, j - height, j, sapplingType)) + { + return false; + } + + //if this tree grew from a sapling, then kill the sapling its growing from + if (saplingExists) + { + WorldGen.KillTile(i, j, false, false, true); + WorldGen.KillTile(i, j - 1, false, false, true); + } + //make sure the block is valid for the tree to place on if ((SolidTopTile(i, j + 1) || SolidTile(i, j + 1)) && !Framing.GetTileSafely(i, j).HasTile) { @@ -153,6 +160,10 @@ namespace CalamityMod.Tiles.Crags.Tree if (!Framing.GetTileSafely(i, j + 1).HasTile) { WorldGen.KillTile(i, j, false, false, false); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, i, j); + } } } @@ -165,14 +176,14 @@ namespace CalamityMod.Tiles.Crags.Tree int totalSeeds = Main.rand.Next(1, 3); for (int numSeed = 0; numSeed < totalSeeds; numSeed++) { - yield return new Item(ModContent.ItemType()); + yield return new Item(ModContent.ItemType()); } } //chance to drop extra wood if (Main.rand.NextBool()) { - yield return new Item(ModContent.ItemType()); + yield return new Item(ModContent.ItemType()); } } @@ -282,6 +293,9 @@ namespace CalamityMod.Tiles.Crags.Tree public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + Tile tile = Framing.GetTileSafely(i, j); float xOff = (float)Math.Sin((j * 19) * 0.04f) * 1.2f; diff --git a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs index 1e9d88b4dc..8df5cec10d 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryConsoleGlow").Value; diff --git a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs index 6d596e755e..4363f7433b 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs @@ -46,6 +46,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryDisplayGlow").Value; diff --git a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs index 92586a8eef..6df4e7fae9 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs @@ -36,6 +36,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryScreenGlow").Value; diff --git a/Tiles/DraedonStructures/AgedLaboratoryServer.cs b/Tiles/DraedonStructures/AgedLaboratoryServer.cs index 0edb6b3758..78e5f00ba1 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryServer.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryServer.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryServerGlow").Value; diff --git a/Tiles/DraedonStructures/AgedReinforcedCrate.cs b/Tiles/DraedonStructures/AgedReinforcedCrate.cs index 826777407f..09b2154712 100644 --- a/Tiles/DraedonStructures/AgedReinforcedCrate.cs +++ b/Tiles/DraedonStructures/AgedReinforcedCrate.cs @@ -42,6 +42,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedReinforcedCrateGlow").Value; diff --git a/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs b/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs new file mode 100644 index 0000000000..3104c250d7 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs @@ -0,0 +1,92 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class AgedBiolight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/PlagueContainmentCellsPulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 89; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), 9f / 255f * brightness, 195f / 255f * brightness, 0f * brightness); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/AgedBiolight.png b/Tiles/DraedonStructures/CagedLights/AgedBiolight.png new file mode 100644 index 0000000000..e89d370612 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/AgedBiolight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs new file mode 100644 index 0000000000..e3cf7fc74e --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs @@ -0,0 +1,91 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class AgedBlacklight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/OnyxplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 173; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), 182f / 255f * brightness, 28f / 255f * brightness, 232f / 255f * brightness); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/AgedBlacklight.png b/Tiles/DraedonStructures/CagedLights/AgedBlacklight.png new file mode 100644 index 0000000000..cfb58d9f3d Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/AgedBlacklight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs new file mode 100644 index 0000000000..10195c0bc6 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs @@ -0,0 +1,92 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class AgedCinderlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/CinderplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 6; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i, j), 252f / 255f * brightness, 184f / 255f * brightness, 29f / 255f * brightness); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/AgedCinderlight.png b/Tiles/DraedonStructures/CagedLights/AgedCinderlight.png new file mode 100644 index 0000000000..bdfdef3cd0 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/AgedCinderlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs new file mode 100644 index 0000000000..5582d62a8a --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs @@ -0,0 +1,92 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class AgedFlamelight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/HavocplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 60; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), (255f / 255f) * brightness, (104f / 255f) * brightness, (104f / 255f) * brightness); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/AgedFlamelight.png b/Tiles/DraedonStructures/CagedLights/AgedFlamelight.png new file mode 100644 index 0000000000..c5ce209991 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/AgedFlamelight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs new file mode 100644 index 0000000000..1944b32d90 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs @@ -0,0 +1,92 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class AgedFloodlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/NavyplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 187; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), 105f / 255f * brightness, 195f / 255f * brightness, 193f / 255f * brightness); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/AgedFloodlight.png b/Tiles/DraedonStructures/CagedLights/AgedFloodlight.png new file mode 100644 index 0000000000..33d4bbf5de Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/AgedFloodlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs new file mode 100644 index 0000000000..778a36dbc8 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs @@ -0,0 +1,92 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class AgedFrostlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/ElumplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 247; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), 9f / 255f * brightness, 158f / 255f * brightness, 238f / 255f * brightness); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/AgedFrostlight.png b/Tiles/DraedonStructures/CagedLights/AgedFrostlight.png new file mode 100644 index 0000000000..a5287f2329 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/AgedFrostlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/AgedLablight.cs b/Tiles/DraedonStructures/CagedLights/AgedLablight.cs new file mode 100644 index 0000000000..6e9d5af3c4 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/AgedLablight.cs @@ -0,0 +1,107 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class AgedLablight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 299; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 31f / 510f; + g = 251f / 510f; + b = 255f / 510f; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/CagedLights/AgedLablight_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 * 0.6f; + 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/DraedonStructures/CagedLights/AgedLablight.png b/Tiles/DraedonStructures/CagedLights/AgedLablight.png new file mode 100644 index 0000000000..37ce5e724b Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/AgedLablight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/AgedLablight_Glow.png b/Tiles/DraedonStructures/CagedLights/AgedLablight_Glow.png new file mode 100644 index 0000000000..74e1e5cab9 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/AgedLablight_Glow.png differ diff --git a/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs b/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs new file mode 100644 index 0000000000..f4e36ad4ab --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs @@ -0,0 +1,100 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class CagedBiolight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 89; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 9f / 255f; + g = 195f / 255f; + b = 0f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/CagedBiolight.png b/Tiles/DraedonStructures/CagedLights/CagedBiolight.png new file mode 100644 index 0000000000..7006f9dcf1 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/CagedBiolight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs new file mode 100644 index 0000000000..70abb33441 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs @@ -0,0 +1,100 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class CagedBlacklight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 173; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 182f / 255f; + g = 28f / 255f; + b = 232f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/CagedBlacklight.png b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.png new file mode 100644 index 0000000000..ce088f0e75 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs new file mode 100644 index 0000000000..e570ae6940 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs @@ -0,0 +1,101 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class CagedCinderlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 6; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 252f / 255f; + g = 184f / 255f; + b = 29f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/CagedCinderlight.png b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.png new file mode 100644 index 0000000000..7ed812e0eb Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs new file mode 100644 index 0000000000..dc6cbda8d6 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs @@ -0,0 +1,101 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class CagedFlamelight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 60; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 255f / 255f; + g = 104f / 255f; + b = 104f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/CagedFlamelight.png b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.png new file mode 100644 index 0000000000..dcf40d8e66 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs new file mode 100644 index 0000000000..0341b99b43 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs @@ -0,0 +1,101 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class CagedFloodlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 187; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 105f / 255f; + g = 195f / 255f; + b = 193f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/CagedFloodlight.png b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.png new file mode 100644 index 0000000000..1870807b7d Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs new file mode 100644 index 0000000000..46ebb7ed84 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs @@ -0,0 +1,101 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class CagedFrostlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 247; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 9f / 255f; + g = 158f / 255f; + b = 238f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/CagedFrostlight.png b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.png new file mode 100644 index 0000000000..1c81b806d0 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/CagedLablight.cs b/Tiles/DraedonStructures/CagedLights/CagedLablight.cs new file mode 100644 index 0000000000..1a59406c11 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/CagedLablight.cs @@ -0,0 +1,100 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class CagedLablight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 299; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 31f / 255f; + g = 251f / 255f; + b = 255f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/CagedLablight.png b/Tiles/DraedonStructures/CagedLights/CagedLablight.png new file mode 100644 index 0000000000..e5626c66ce Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/CagedLablight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.cs new file mode 100644 index 0000000000..02d5c1385e --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.cs @@ -0,0 +1,82 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniAgedBiolight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/PlagueContainmentCellsPulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 89; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), 9f / 255f * brightness, 195f / 255f * brightness, 0f * brightness); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.png b/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.png new file mode 100644 index 0000000000..761301e8d4 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.cs new file mode 100644 index 0000000000..cfc8b84013 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.cs @@ -0,0 +1,87 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniAgedBlacklight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/OnyxplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 173; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), 182f / 255f * brightness, 28f / 255f * brightness, 232f / 255f * brightness); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.png b/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.png new file mode 100644 index 0000000000..f7d20ce364 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.cs new file mode 100644 index 0000000000..15d7c4a15e --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.cs @@ -0,0 +1,87 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniAgedCinderlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/CinderplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 6; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), 252f / 255f * brightness, 184f / 255f * brightness, 29f / 255f * brightness); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.png b/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.png new file mode 100644 index 0000000000..160620e578 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.cs new file mode 100644 index 0000000000..0d858be4dc --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.cs @@ -0,0 +1,87 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniAgedFlamelight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/HavocplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 60; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), (255f / 255f) * brightness, (104f / 255f) * brightness, (104f / 255f) * brightness); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.png b/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.png new file mode 100644 index 0000000000..393be60238 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.cs new file mode 100644 index 0000000000..de6f883b24 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.cs @@ -0,0 +1,87 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniAgedFloodlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/NavyplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 187; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = MathHelper.Clamp(brightness, 0.2f, 0.6f); + + Lighting.AddLight(new Vector2(i * 16, j * 16), 105f / 255f * brightness, 195f / 255f * brightness, 193f / 255f * brightness); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.png b/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.png new file mode 100644 index 0000000000..d1e6978606 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.cs new file mode 100644 index 0000000000..c2343e0bd9 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.cs @@ -0,0 +1,87 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniAgedFrostlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static GrayscaleTexture1D PulseGradient; + + public override void SetStaticDefaults() + { + PulseGradient = new("CalamityMod/Tiles/Plates/ElumplatePulse"); + + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 247; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + 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) + { + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = 0.04f + (brightness * 0.156f); + + Lighting.AddLight(new Vector2(i, j), 9f / 255f * brightness, 158f / 255f * brightness, 238f / 255f * brightness); + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.png b/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.png new file mode 100644 index 0000000000..f4255c4916 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedLablight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedLablight.cs new file mode 100644 index 0000000000..8d163d7207 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedLablight.cs @@ -0,0 +1,102 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniAgedLablight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 299; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 31f / 510f; + g = 251f / 510f; + b = 255f / 510f; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/CagedLights/MiniAgedLablight_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 * 0.6f; + 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/DraedonStructures/CagedLights/MiniAgedLablight.png b/Tiles/DraedonStructures/CagedLights/MiniAgedLablight.png new file mode 100644 index 0000000000..fb5e81c003 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniAgedLablight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedLablight_Glow.png b/Tiles/DraedonStructures/CagedLights/MiniAgedLablight_Glow.png new file mode 100644 index 0000000000..79541c683d Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniAgedLablight_Glow.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs new file mode 100644 index 0000000000..b410cb04c0 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs @@ -0,0 +1,95 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniCagedBiolight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 89; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 9f / 255f; + g = 195f / 255f; + b = 0f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.png b/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.png new file mode 100644 index 0000000000..26bfeac1f7 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs new file mode 100644 index 0000000000..68cca8784d --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs @@ -0,0 +1,95 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniCagedBlacklight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 173; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 182f / 255f; + g = 29f / 255f; + b = 232f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.png b/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.png new file mode 100644 index 0000000000..aad70ad8ea Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs new file mode 100644 index 0000000000..1603d07df8 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs @@ -0,0 +1,95 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniCagedCinderlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 6; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 252f / 255f; + g = 184f / 255f; + b = 29f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.png b/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.png new file mode 100644 index 0000000000..7fae45cbcb Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs new file mode 100644 index 0000000000..778be69f0e --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs @@ -0,0 +1,95 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniCagedFlamelight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 60; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 255f / 255f; + g = 104f / 255f; + b = 104f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.png b/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.png new file mode 100644 index 0000000000..2aeb7f0793 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs new file mode 100644 index 0000000000..f440165a54 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs @@ -0,0 +1,95 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniCagedFloodlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 187; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 105f / 255f; + g = 195f / 255f; + b = 193f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.png b/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.png new file mode 100644 index 0000000000..fa4bc73dda Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs new file mode 100644 index 0000000000..c693efb99d --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs @@ -0,0 +1,95 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniCagedFrostlight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 247; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 9f / 255f; + g = 158f / 255f; + b = 238f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.png b/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.png new file mode 100644 index 0000000000..9b6044ef3c Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.png differ diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs new file mode 100644 index 0000000000..0c49ecb2a5 --- /dev/null +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs @@ -0,0 +1,96 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; + +namespace CalamityMod.Tiles.DraedonStructures.CagedLights +{ + public class MiniCagedLablight : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 299; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 0); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 31f / 255f; + g = 251f / 255f; + b = 255f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + } +} diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.png b/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.png new file mode 100644 index 0000000000..b1f9bca205 Binary files /dev/null and b/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.png differ diff --git a/Tiles/DraedonStructures/ChargingStation.cs b/Tiles/DraedonStructures/ChargingStation.cs index 6de7c06905..d3f1f65731 100644 --- a/Tiles/DraedonStructures/ChargingStation.cs +++ b/Tiles/DraedonStructures/ChargingStation.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Tiles.DraedonStructures Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); // No need to set width, height, origin, etc. here, Style3x2 is exactly what we want. TileObjectData.newTile.LavaDeath = false; @@ -111,6 +112,9 @@ namespace CalamityMod.Tiles.DraedonStructures // Draws the charger's glowing light on top of it. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + Tile t = Main.tile[i, j]; int xFrame = t.TileFrameX; int yFrame = t.TileFrameY; diff --git a/Tiles/DraedonStructures/ChargingStation_Highlight.png b/Tiles/DraedonStructures/ChargingStation_Highlight.png new file mode 100644 index 0000000000..629fbd54d3 Binary files /dev/null and b/Tiles/DraedonStructures/ChargingStation_Highlight.png differ diff --git a/Tiles/DraedonStructures/DraedonLabTurret.cs b/Tiles/DraedonStructures/DraedonLabTurret.cs index cc879d63a3..be174bc706 100644 --- a/Tiles/DraedonStructures/DraedonLabTurret.cs +++ b/Tiles/DraedonStructures/DraedonLabTurret.cs @@ -73,11 +73,13 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -85,6 +87,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseTurret").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileFireTurret .cs b/Tiles/DraedonStructures/HostileFireTurret .cs index e9fe453828..8884ceb5c6 100644 --- a/Tiles/DraedonStructures/HostileFireTurret .cs +++ b/Tiles/DraedonStructures/HostileFireTurret .cs @@ -68,11 +68,13 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileFireTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/FireTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileIceTurret .cs b/Tiles/DraedonStructures/HostileIceTurret .cs index 2b1b476c2b..0425289e9d 100644 --- a/Tiles/DraedonStructures/HostileIceTurret .cs +++ b/Tiles/DraedonStructures/HostileIceTurret .cs @@ -68,11 +68,13 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileIceTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/IceTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileLaserTurret .cs b/Tiles/DraedonStructures/HostileLaserTurret .cs index 149e0a7410..434a6c8043 100644 --- a/Tiles/DraedonStructures/HostileLaserTurret .cs +++ b/Tiles/DraedonStructures/HostileLaserTurret .cs @@ -68,11 +68,13 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileLaserTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/LaserTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileOnyxTurret.cs b/Tiles/DraedonStructures/HostileOnyxTurret.cs index 48773b95b1..2f65fecf9f 100644 --- a/Tiles/DraedonStructures/HostileOnyxTurret.cs +++ b/Tiles/DraedonStructures/HostileOnyxTurret.cs @@ -68,11 +68,13 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileOnyxTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/OnyxTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostilePlagueTurret.cs b/Tiles/DraedonStructures/HostilePlagueTurret.cs index 50ac6e3aa3..48d64e8aae 100644 --- a/Tiles/DraedonStructures/HostilePlagueTurret.cs +++ b/Tiles/DraedonStructures/HostilePlagueTurret.cs @@ -68,11 +68,13 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostilePlagueTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/PlagueTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileWaterTurret.cs b/Tiles/DraedonStructures/HostileWaterTurret.cs index 15231ede6f..3f9910d303 100644 --- a/Tiles/DraedonStructures/HostileWaterTurret.cs +++ b/Tiles/DraedonStructures/HostileWaterTurret.cs @@ -68,11 +68,13 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileWaterTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/WaterTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/LabHologramProjector.cs b/Tiles/DraedonStructures/LabHologramProjector.cs index 2e1da5d040..450338bc2d 100644 --- a/Tiles/DraedonStructures/LabHologramProjector.cs +++ b/Tiles/DraedonStructures/LabHologramProjector.cs @@ -101,6 +101,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Tile trackTile = Main.tile[i, j]; + if (trackTile.IsTileActuallyInvisible()) + return false; + int time = (int)(Main.GlobalTimeWrappedHourly * 60); TELabHologramProjector hologramTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/DraedonStructures/LaboratoryConsole.cs b/Tiles/DraedonStructures/LaboratoryConsole.cs index 832e50ae21..c04d63edf0 100644 --- a/Tiles/DraedonStructures/LaboratoryConsole.cs +++ b/Tiles/DraedonStructures/LaboratoryConsole.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryConsoleGlow").Value; diff --git a/Tiles/DraedonStructures/LaboratoryConsole.png b/Tiles/DraedonStructures/LaboratoryConsole.png index 05e336f141..9a33f98351 100644 Binary files a/Tiles/DraedonStructures/LaboratoryConsole.png and b/Tiles/DraedonStructures/LaboratoryConsole.png differ diff --git a/Tiles/DraedonStructures/LaboratoryContainmentBox.png b/Tiles/DraedonStructures/LaboratoryContainmentBox.png index 15b19d956f..52bf15bd45 100644 Binary files a/Tiles/DraedonStructures/LaboratoryContainmentBox.png and b/Tiles/DraedonStructures/LaboratoryContainmentBox.png differ diff --git a/Tiles/DraedonStructures/LaboratoryDisplay.cs b/Tiles/DraedonStructures/LaboratoryDisplay.cs index 4df308e759..cc2513cecc 100644 --- a/Tiles/DraedonStructures/LaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/LaboratoryDisplay.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryDisplayGlow").Value; diff --git a/Tiles/DraedonStructures/LaboratoryDisplay.png b/Tiles/DraedonStructures/LaboratoryDisplay.png index 6e57737c5c..27670cee4e 100644 Binary files a/Tiles/DraedonStructures/LaboratoryDisplay.png and b/Tiles/DraedonStructures/LaboratoryDisplay.png differ diff --git a/Tiles/DraedonStructures/LaboratoryElectricPanel.png b/Tiles/DraedonStructures/LaboratoryElectricPanel.png index da33bd7947..8b9701bc6c 100644 Binary files a/Tiles/DraedonStructures/LaboratoryElectricPanel.png and b/Tiles/DraedonStructures/LaboratoryElectricPanel.png differ diff --git a/Tiles/DraedonStructures/LaboratoryScreen.cs b/Tiles/DraedonStructures/LaboratoryScreen.cs index 2867c26119..2672f89918 100644 --- a/Tiles/DraedonStructures/LaboratoryScreen.cs +++ b/Tiles/DraedonStructures/LaboratoryScreen.cs @@ -36,6 +36,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryScreenGlow").Value; diff --git a/Tiles/DraedonStructures/LaboratoryScreen.png b/Tiles/DraedonStructures/LaboratoryScreen.png index 146c762e6c..b4a842243d 100644 Binary files a/Tiles/DraedonStructures/LaboratoryScreen.png and b/Tiles/DraedonStructures/LaboratoryScreen.png differ diff --git a/Tiles/DraedonStructures/LaboratoryServer.cs b/Tiles/DraedonStructures/LaboratoryServer.cs index d10bd2a433..0d658c83fb 100644 --- a/Tiles/DraedonStructures/LaboratoryServer.cs +++ b/Tiles/DraedonStructures/LaboratoryServer.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryServerGlow").Value; diff --git a/Tiles/DraedonStructures/LaboratoryServer.png b/Tiles/DraedonStructures/LaboratoryServer.png index a3953be071..511e51e240 100644 Binary files a/Tiles/DraedonStructures/LaboratoryServer.png and b/Tiles/DraedonStructures/LaboratoryServer.png differ diff --git a/Tiles/DraedonStructures/LaboratoryTerminal.cs b/Tiles/DraedonStructures/LaboratoryTerminal.cs index 94ff84121a..cd75e06802 100644 --- a/Tiles/DraedonStructures/LaboratoryTerminal.cs +++ b/Tiles/DraedonStructures/LaboratoryTerminal.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryTerminalGlow").Value; diff --git a/Tiles/DraedonStructures/LaboratoryTerminal.png b/Tiles/DraedonStructures/LaboratoryTerminal.png index b4afcaf8bb..a1525db4ee 100644 Binary files a/Tiles/DraedonStructures/LaboratoryTerminal.png and b/Tiles/DraedonStructures/LaboratoryTerminal.png differ diff --git a/Tiles/DraedonStructures/OnyxExcavatorTile.png b/Tiles/DraedonStructures/OnyxExcavatorTile.png index da19e9b9f3..e8bdda1c52 100644 Binary files a/Tiles/DraedonStructures/OnyxExcavatorTile.png and b/Tiles/DraedonStructures/OnyxExcavatorTile.png differ diff --git a/Tiles/DraedonStructures/PowerCellFactory.cs b/Tiles/DraedonStructures/PowerCellFactory.cs index 810360ee0b..f6253fb585 100644 --- a/Tiles/DraedonStructures/PowerCellFactory.cs +++ b/Tiles/DraedonStructures/PowerCellFactory.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.Localization; @@ -44,6 +45,7 @@ namespace CalamityMod.Tiles.DraedonStructures Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.newTile.Width = Width; TileObjectData.newTile.Height = Height; @@ -121,6 +123,8 @@ namespace CalamityMod.Tiles.DraedonStructures { // These offsets start as the tile offsets, i.e. which sub-tile of the FrameImportant structure this specific location is. Tile t = Main.tile[i, j]; + if (t.IsTileActuallyInvisible()) + return false; int frameXPos = t.TileFrameX; int frameYPos = t.TileFrameY; @@ -134,11 +138,32 @@ namespace CalamityMod.Tiles.DraedonStructures Vector2 offset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + offset; Color drawColor = Lighting.GetColor(i, j); + if (!t.IsHalfBlock && t.Slope == 0) spriteBatch.Draw(tex, drawOffset, new Rectangle(frameXPos, frameYPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); else if (t.IsHalfBlock) spriteBatch.Draw(tex, drawOffset + Vector2.UnitY * 8f, new Rectangle(frameXPos, frameYPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + + // Draws the Smart Cursor Highlight. Not 100% accurate, but its close enough + bool actuallySelected; + Color highlightColor; + Texture2D texhighlight = ModContent.Request(HighlightTexture).Value; + if (Main.InSmartCursorHighlightArea(i, j, out actuallySelected)) + { + if (actuallySelected) + { + highlightColor = new Color(252, 252, 84); + } + else + { + highlightColor = new Color(125, 125, 125); + } + spriteBatch.Draw(texhighlight, drawOffset, new Rectangle(frameXPos, frameYPos, 16, 16), highlightColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + + + return false; } } diff --git a/Tiles/DraedonStructures/PowerCellFactory.png b/Tiles/DraedonStructures/PowerCellFactory.png index 11ef8df935..2c3d652bda 100644 Binary files a/Tiles/DraedonStructures/PowerCellFactory.png and b/Tiles/DraedonStructures/PowerCellFactory.png differ diff --git a/Tiles/DraedonStructures/PowerCellFactory_Highlight.png b/Tiles/DraedonStructures/PowerCellFactory_Highlight.png new file mode 100644 index 0000000000..1b98a11403 Binary files /dev/null and b/Tiles/DraedonStructures/PowerCellFactory_Highlight.png differ diff --git a/Tiles/DraedonStructures/ReinforcedCrate.cs b/Tiles/DraedonStructures/ReinforcedCrate.cs index 06b9c32ffe..dfe34a429e 100644 --- a/Tiles/DraedonStructures/ReinforcedCrate.cs +++ b/Tiles/DraedonStructures/ReinforcedCrate.cs @@ -42,6 +42,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/ReinforcedCrateGlow").Value; diff --git a/Tiles/DraedonSummoner/CodebreakerT1Highlight.png b/Tiles/DraedonSummoner/CodebreakerT1Highlight.png new file mode 100644 index 0000000000..21bdb8f1c3 Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerT1Highlight.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerT2Highlight.png b/Tiles/DraedonSummoner/CodebreakerT2Highlight.png new file mode 100644 index 0000000000..90cd46a7e1 Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerT2Highlight.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerT3Highlight.png b/Tiles/DraedonSummoner/CodebreakerT3Highlight.png new file mode 100644 index 0000000000..e467d553c4 Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerT3Highlight.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerT4Highlight.png b/Tiles/DraedonSummoner/CodebreakerT4Highlight.png new file mode 100644 index 0000000000..bc744bfe92 Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerT4Highlight.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerTile.cs b/Tiles/DraedonSummoner/CodebreakerTile.cs index c8454d49f1..1a30d91ae3 100644 --- a/Tiles/DraedonSummoner/CodebreakerTile.cs +++ b/Tiles/DraedonSummoner/CodebreakerTile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Buffs.Potions; +using CalamityMod.Items.DraedonMisc; using CalamityMod.TileEntities; using CalamityMod.UI; using CalamityMod.UI.DraedonSummoning; @@ -32,6 +33,12 @@ namespace CalamityMod.Tiles.DraedonSummoner public static Texture2D VoltageRegulatorTexture2; public static Texture2D CoolingCellTexture; + public static Texture2D HighlightT1; + public static Texture2D HighlightT2; + public static Texture2D HighlightT3; + public static Texture2D HighlightT4; + + public override void SetStaticDefaults() { if (!Main.dedServ) @@ -43,6 +50,11 @@ namespace CalamityMod.Tiles.DraedonSummoner VoltageRegulatorTexture = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem", AssetRequestMode.ImmediateLoad).Value; VoltageRegulatorTexture2 = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem2", AssetRequestMode.ImmediateLoad).Value; CoolingCellTexture = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerAuricQuantumCoolingCell", AssetRequestMode.ImmediateLoad).Value; + + HighlightT1 = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerT1Highlight", AssetRequestMode.ImmediateLoad).Value; + HighlightT2 = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerT2Highlight", AssetRequestMode.ImmediateLoad).Value; + HighlightT3 = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerT3Highlight", AssetRequestMode.ImmediateLoad).Value; + HighlightT4 = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerT4Highlight", AssetRequestMode.ImmediateLoad).Value; } Main.tileLighted[Type] = true; @@ -78,6 +90,19 @@ namespace CalamityMod.Tiles.DraedonSummoner public override bool CanExplode(int i, int j) => false; + public override bool CanPlace(int i, int j) + { + // Cannot be placed on Teleporters in order to prevent a critical bug. + int startOfTileCoordinateCheckX = i - 2; + for (int k = startOfTileCoordinateCheckX; k < startOfTileCoordinateCheckX + Width; k++) + { + if (Main.tile[k, j + 1].TileType == TileID.Teleporter) + return false; + } + + return true; + } + // Prevent the tile from being destroyed while it's busy decrypting. // If it's destroyed the tile entity would be too and the resources used on decryption would be lost for nothing. public override bool CanKillTile(int i, int j, ref bool blockDamaged) @@ -158,6 +183,8 @@ namespace CalamityMod.Tiles.DraedonSummoner { // These offsets start as the tile offsets, i.e. which sub-tile of the FrameImportant structure this specific location is. Tile t = Main.tile[i, j]; + if (t.IsTileActuallyInvisible()) + return false; int left = i - t.TileFrameX % (Width * SheetSquare) / SheetSquare; int frameXPos = t.TileFrameX; int frameYPos = t.TileFrameY + Height * SheetSquare * (int)((Main.GlobalTimeWrappedHourly * 12f + left) % 8); @@ -172,6 +199,8 @@ namespace CalamityMod.Tiles.DraedonSummoner Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + offset; Color drawColor = Lighting.GetColor(i, j); Rectangle frame = new Rectangle(frameXPos, frameYPos, 16, 16); + + Texture2D HighlightToUse = HighlightT1; if ((!t.IsHalfBlock && t.Slope == 0) || t.IsHalfBlock) { @@ -181,7 +210,9 @@ namespace CalamityMod.Tiles.DraedonSummoner if (codebreakerTileEntity != null) { if (codebreakerTileEntity.ContainsDecryptionComputer) + { spriteBatch.Draw(ComputerTexture, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } if (codebreakerTileEntity.ContainsVoltageRegulationSystem) spriteBatch.Draw(VoltageRegulatorTexture2, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); if (codebreakerTileEntity.ContainsSensorArray) @@ -192,6 +223,35 @@ namespace CalamityMod.Tiles.DraedonSummoner spriteBatch.Draw(VoltageRegulatorTexture, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); if (codebreakerTileEntity.ContainsAdvancedDisplay) spriteBatch.Draw(DisplayTexture, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + // Handles which Smart Cursor highlight to draw + if (codebreakerTileEntity.ContainsDecryptionComputer && codebreakerTileEntity.ContainsSensorArray && !codebreakerTileEntity.ContainsAdvancedDisplay && !codebreakerTileEntity.ContainsVoltageRegulationSystem) + HighlightToUse = HighlightT2; + if (codebreakerTileEntity.ContainsDecryptionComputer && codebreakerTileEntity.ContainsSensorArray && codebreakerTileEntity.ContainsAdvancedDisplay && !codebreakerTileEntity.ContainsVoltageRegulationSystem) + HighlightToUse = HighlightT3; + if (codebreakerTileEntity.ContainsDecryptionComputer && codebreakerTileEntity.ContainsSensorArray && codebreakerTileEntity.ContainsAdvancedDisplay && codebreakerTileEntity.ContainsVoltageRegulationSystem) + HighlightToUse = HighlightT4; + + // Prevents Smart Cursor highlights from appearing if the Codebreaker upgrades are mismatched + if (codebreakerTileEntity.ContainsDecryptionComputer && !codebreakerTileEntity.ContainsSensorArray && (codebreakerTileEntity.ContainsAdvancedDisplay || codebreakerTileEntity.ContainsVoltageRegulationSystem)) + return false; + if (codebreakerTileEntity.ContainsDecryptionComputer && codebreakerTileEntity.ContainsSensorArray && !codebreakerTileEntity.ContainsAdvancedDisplay && codebreakerTileEntity.ContainsVoltageRegulationSystem) + return false; + + bool actuallySelected; + Color highlightColor; + if (Main.InSmartCursorHighlightArea(i, j, out actuallySelected) && codebreakerTileEntity.ContainsDecryptionComputer) + { + if (actuallySelected) + { + highlightColor = new Color(252, 252, 84); + } + else + { + highlightColor = new Color(125, 125, 125); + } + spriteBatch.Draw(HighlightToUse, drawPosition, frame, highlightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } } } return false; diff --git a/Tiles/FloralParadise/LushVines.cs b/Tiles/FloralParadise/LushVines.cs index eeb8817853..5300739e3e 100644 --- a/Tiles/FloralParadise/LushVines.cs +++ b/Tiles/FloralParadise/LushVines.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Tiles.FloralParadise Main.tile[i, below].Get().HasTile = true; WorldGen.SquareTileFrame(i, below, true); WorldGen.SquareTileFrame(i, below - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, below, 3, TileChangeType.None); NetMessage.SendTileSquare(-1, i, below - 1, 3, TileChangeType.None); diff --git a/Tiles/FloralParadise/PeatMoss.cs b/Tiles/FloralParadise/PeatMoss.cs index b92e58ecff..3824a28f8f 100644 --- a/Tiles/FloralParadise/PeatMoss.cs +++ b/Tiles/FloralParadise/PeatMoss.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Tiles.FloralParadise Main.tile[i, belowY].TileType = (ushort)ModContent.TileType(); Main.tile[i, belowY].Get().HasTile = true; WorldGen.SquareTileFrame(i, belowY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, belowY, 3, TileChangeType.None); } diff --git a/Tiles/FloralParadise/PinkFlower.cs b/Tiles/FloralParadise/PinkFlower.cs index 9ce0123ad4..f6c1a7bb90 100644 --- a/Tiles/FloralParadise/PinkFlower.cs +++ b/Tiles/FloralParadise/PinkFlower.cs @@ -50,6 +50,9 @@ namespace CalamityMod.Tiles.FloralParadise public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + // 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of this content. As such, it is ignored here. ILChanges.Windgrid.GetWindTime(i, j, WindPushLifetime, out int windTimeLeft, out int direction, out _); @@ -78,7 +81,7 @@ namespace CalamityMod.Tiles.FloralParadise public override void KillMultiTile(int i, int j, int frameX, int frameY) { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/FloralParadise/PinkFlowerBig.cs b/Tiles/FloralParadise/PinkFlowerBig.cs index ce416e6c8f..a4481e7853 100644 --- a/Tiles/FloralParadise/PinkFlowerBig.cs +++ b/Tiles/FloralParadise/PinkFlowerBig.cs @@ -59,6 +59,9 @@ namespace CalamityMod.Tiles.FloralParadise public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + // 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of this content. As such, it is ignored here. ILChanges.Windgrid.GetWindTime(i, j, WindPushLifetime, out int windTimeLeft, out int direction, out _); diff --git a/Tiles/FloralParadise/SmallVines.cs b/Tiles/FloralParadise/SmallVines.cs index 8cdbfd28dd..c49c7b19b4 100644 --- a/Tiles/FloralParadise/SmallVines.cs +++ b/Tiles/FloralParadise/SmallVines.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Tiles.FloralParadise Main.tile[i, below].Get().HasTile = true; WorldGen.SquareTileFrame(i, below, true); WorldGen.SquareTileFrame(i, below - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, below, 3, TileChangeType.None); NetMessage.SendTileSquare(-1, i, below - 1, 3, TileChangeType.None); diff --git a/Tiles/FloralParadise/WaterfallCreator.cs b/Tiles/FloralParadise/WaterfallCreator.cs index ad070df5af..9bda03602b 100644 --- a/Tiles/FloralParadise/WaterfallCreator.cs +++ b/Tiles/FloralParadise/WaterfallCreator.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FloralParadise public override void NearbyEffects(int i, int j, bool closer) { Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); - if (Main.netMode == NetmodeID.Server || !Main.rand.NextBool() || Main.gamePaused || tile.LiquidAmount > 0) + if (Main.dedServ || !Main.rand.NextBool() || Main.gamePaused || tile.LiquidAmount > 0) return; for (int k = 0; k < 16; k++) diff --git a/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs b/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs index 28ecf21af7..b0c3781911 100644 --- a/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs +++ b/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs @@ -32,6 +32,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 8; diff --git a/Tiles/Furniture/BabyCannonballJellyfishBowlTile.png b/Tiles/Furniture/BabyCannonballJellyfishBowlTile.png index aa6c53127b..c06c77a0cb 100644 Binary files a/Tiles/Furniture/BabyCannonballJellyfishBowlTile.png and b/Tiles/Furniture/BabyCannonballJellyfishBowlTile.png differ diff --git a/Tiles/Furniture/BabyFlakCrabCageTile.cs b/Tiles/Furniture/BabyFlakCrabCageTile.cs index 2e1ad66170..b1d2596cd8 100644 --- a/Tiles/Furniture/BabyFlakCrabCageTile.cs +++ b/Tiles/Furniture/BabyFlakCrabCageTile.cs @@ -1,7 +1,10 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -11,11 +14,18 @@ namespace CalamityMod.Tiles.Furniture { public class BabyFlakCrabCageTile : ModTile { + public static Asset topTexture; + public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; + if (!Main.dedServ) + { + topTexture = ModContent.Request("CalamityMod/Tiles/Furniture/TransparentCageTile_Top"); + } Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileTable[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); TileObjectData.addTile(Type); AnimationFrameHeight = 54; @@ -33,6 +43,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 34; @@ -56,5 +68,42 @@ namespace CalamityMod.Tiles.Furniture frame = 0; } } + + // Since this uses a custom top sprite, all drawing must be redone + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + + Tile tile = Main.tile[i, j]; + var zero = Main.drawToScreen ? Vector2.Zero : new(Main.offScreenRange, Main.offScreenRange); + var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; + var animateFrameOffset = Main.tileFrame[Type] * AnimationFrameHeight; + var height = 16; + var finalColor = CalamityUtils.ApplyPaint(tile.TileColor, Lighting.GetColor(i, j), false); + + var rect = new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height); + + if (rect.Y % 54 == 0) + { + Vector2 position = drawPos; + position.Y += 8f; + Rectangle drawRectangle = rect; + drawRectangle.Y += 8; + drawRectangle.Height -= 8; + Main.spriteBatch.Draw(TextureAssets.Tile[Type].Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + position = drawPos; + position.Y -= 2f; + drawRectangle = rect; + drawRectangle.Y = 0; + drawRectangle.Height = 10; + spriteBatch.Draw(topTexture.Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + else + { + spriteBatch.Draw(TextureAssets.Tile[Type].Value, drawPos, rect, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + return false; + } } } diff --git a/Tiles/Furniture/BabyGhostBellJarTile.cs b/Tiles/Furniture/BabyGhostBellJarTile.cs index a7a504383a..5f29ee1dee 100644 --- a/Tiles/Furniture/BabyGhostBellJarTile.cs +++ b/Tiles/Furniture/BabyGhostBellJarTile.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 8; diff --git a/Tiles/Furniture/BossRelics/SlimeGodRelic.png b/Tiles/Furniture/BossRelics/SlimeGodRelic.png index 9f20a8d8b0..c52d4bf182 100644 Binary files a/Tiles/Furniture/BossRelics/SlimeGodRelic.png and b/Tiles/Furniture/BossRelics/SlimeGodRelic.png differ diff --git a/Tiles/Furniture/CalamityCanvas2023Tile.cs b/Tiles/Furniture/CalamityCanvas2023Tile.cs new file mode 100644 index 0000000000..b5693bbff7 --- /dev/null +++ b/Tiles/Furniture/CalamityCanvas2023Tile.cs @@ -0,0 +1,226 @@ +using CalamityMod.TileEntities; +using CalamityMod.UI; +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.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class CalamityCanvas2023Tile : ModTile + { + public static Asset border; + public static Asset corner; + + public override void Load() + { + border = ModContent.Request("CalamityMod/Tiles/Furniture/CalamityCanvasBorder"); + corner = ModContent.Request("CalamityMod/Tiles/Furniture/CalamityCanvasCorner"); + } + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] { 18, 18, 18, 18, 18 }; + TileObjectData.newTile.UsesCustomCanPlace = true; + //TileObjectData.newTile.Origin = new Point16(2, 0); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, false); + TileObjectData.addTile(Type); + + TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; + + AddMapEntry(new Color(99, 50, 30), Language.GetText("MapObject.Painting")); + } + public override bool HasSmartInteract(int i, int j, Terraria.GameContent.ObjectInteractions.SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Main.LocalPlayer.CancelSignsAndChests(); + TECanvasPainting cube = CalamityUtils.FindTileEntity(i, j, 5, 5); + if (cube != null) + { + CanvasPaintingUIState.ResetVars(); + Main.LocalPlayer.Calamity().CurrentlyViewedCanvasID = cube.ID; + Main.LocalPlayer.Calamity().CurrentlyViewedCanvasType = 0; + SoundEngine.PlaySound(SoundID.MenuOpen); + Main.playerInventory = true; + Main.recBigList = false; + } + Recipe.FindRecipes(); + return false; + } + + public override void MouseOver(int i, int j) + { + Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.cursorItemIconEnabled = true; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile t = Main.tile[i, j]; + int left = i - t.TileFrameX % (5 * 18) / 18; + int top = j - t.TileFrameY % (5 * 18) / 18; + + TECanvasPainting canvas = CalamityUtils.FindTileEntity(i, j, 5, 5, 18); + + canvas?.Kill(left, top); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile t = Main.tile[i, j]; + Texture2D texture = TextureAssets.Tile[Type].Value; + TECanvasPainting cube = CalamityUtils.FindTileEntity(i, j, 1, 1); + float baseDimension = 80; // 5 * 16 + Vector2 pos = new Vector2(i * 16, j * 16) + CalamityUtils.TileDrawOffset; + if (cube != null && t.TileFrameX == 0) + { + int fPX = (int)cube.framePosition.X; + int fPY = (int)cube.framePosition.Y; + int scale = (int)(texture.Width * 0.1f * cube.scale); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null); + // TODO: make the 0.4 in scale not a hardcoded number with seemingly no meaning + spriteBatch.Draw(texture, pos - Main.screenPosition, new Rectangle(fPX, fPY, scale, scale), Lighting.GetColor(i, j), 0, new Vector2(0, 0), 1 / cube.scale * 0.4f, 0, 0); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, Main.Rasterizer, null); + } + // Calculate and draw the borders + if (t.TileFrameX == 0 && t.TileFrameY == 0) + DrawBorders(spriteBatch, pos - Main.screenPosition, new Point(i, j)); + return false; + } + public static void DrawBorders(SpriteBatch spriteBatch, Vector2 pos, Point cords) + { + Texture2D texture = border.Value; + Texture2D cornerTex = corner.Value; + ushort canvasID = (ushort)ModContent.TileType(); + int commonDim = 8; + int finalCord = 72; + int size = 80; + Color light = Lighting.GetColor(cords.X, cords.Y); + + // Check for nearby Canvas paintings + // If they are cleanly lined up with this Canvas painting, don't draw borders between them + bool drawTop = true; + bool drawLeft = true; + bool drawRight = true; + bool drawBottom = true; + // Corners + bool drawTopLeft = false; + bool drawTopRight = false; + bool drawBottomLeft = false; + bool drawBottomRight = false; + + // The bottom right tile of the canvas painting + Point bottomRight = new Point(cords.X + 4, cords.Y + 4); + + // Adjacent tiles that may or may not have other canvas paintings + Tile left = CalamityUtils.ParanoidTileRetrieval(cords.X - 1, cords.Y); + Tile top = CalamityUtils.ParanoidTileRetrieval(cords.X, cords.Y - 1); + Tile right = CalamityUtils.ParanoidTileRetrieval(bottomRight.X + 1, bottomRight.Y); + Tile bottom = CalamityUtils.ParanoidTileRetrieval(bottomRight.X, bottomRight.Y + 1); + + // Check if adjacent tiles are canvas paintings that are lined up with this one + bool validTop = ValidCanvasFrame(top, 0, size, canvasID); + bool validRight = ValidCanvasFrame(right, 0, size, canvasID); + bool validLeft = ValidCanvasFrame(left, finalCord, 0, canvasID); + bool validBottom = ValidCanvasFrame(bottom, finalCord, 0, canvasID); + + if (validTop) + { + drawTop = false; + } + if (validBottom) + { + drawBottom = false; + } + if (validRight) + { + drawRight = false; + // Check for junction corners + Tile topright = CalamityUtils.ParanoidTileRetrieval(bottomRight.X + 1, cords.Y - 1); + Tile bottomright = CalamityUtils.ParanoidTileRetrieval(bottomRight.X + 1, bottomRight.Y + 1); + if (!drawTop && !ValidCanvasFrame(topright, 0, size, canvasID)) + { + drawTopRight = true; + } + if (!drawBottom && !ValidCanvasFrame(bottomright, 0, 0, canvasID)) + { + drawBottomRight = true; + } + } + if (validLeft) + { + drawLeft = false; + // Check for junction corners + Tile topleft = CalamityUtils.ParanoidTileRetrieval(cords.X - 1, cords.Y - 1); + Tile bottomleft = CalamityUtils.ParanoidTileRetrieval(cords.X - 1, bottomRight.Y + 1); + if (!drawTop && !ValidCanvasFrame(topleft, finalCord, size, canvasID)) + { + drawTopLeft = true; + } + if (!drawBottom && !ValidCanvasFrame(bottomleft, finalCord, 0, canvasID)) + { + drawBottomLeft = true; + } + } + + // Draw the sides + if (drawBottom) + spriteBatch.Draw(texture, pos + Vector2.UnitY * finalCord, new Rectangle(0, texture.Height - commonDim, texture.Width, commonDim), light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawTop) + spriteBatch.Draw(texture, pos, new Rectangle(0, 0, texture.Width, commonDim), light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawRight) + spriteBatch.Draw(texture, pos + Vector2.UnitX * finalCord, new Rectangle(texture.Width - commonDim, commonDim, commonDim, texture.Height - (2 * commonDim)), light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawLeft) + spriteBatch.Draw(texture, pos, new Rectangle(0, commonDim, commonDim, texture.Height - (2 * commonDim)), light, 0, new Vector2(0, 0), 1, 0, 0); + + // Draw the corners + // All corner drawing is done with a single corner sprite that is rotated and flipped about depending on the situation + if (drawTop && drawLeft) + spriteBatch.Draw(cornerTex, pos, null, light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawTop && drawRight) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitX * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipHorizontally, 0); + if (drawBottom && drawLeft) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitY * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipVertically, 0); + if (drawBottom && drawRight) + spriteBatch.Draw(cornerTex, pos + Vector2.One * size, null, light, MathHelper.Pi, new Vector2(0, 0), 1, 0, 0); + + // Draw junction corners + if (drawTopLeft) + spriteBatch.Draw(cornerTex, pos + corner.Size(), null, light, MathHelper.Pi, new Vector2(0, 0), 1, 0, 0); + if (drawTopRight) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitX * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipVertically, 0); + if (drawBottomLeft) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitY * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipHorizontally, 0); + if (drawBottomRight) + spriteBatch.Draw(cornerTex, pos - corner.Size() + Vector2.One * size, null, light, 0, new Vector2(0, 0), 1, 0, 0); + } + + // Check if the tile is a canvas tile that has the correct tile frames + public static bool ValidCanvasFrame(Tile t, int frameX, int frameY, ushort canvasID) + { + return t.HasTile && t.TileType == canvasID && t.TileFrameX == frameX && t.TileFrameY == frameY; + } + } +} diff --git a/Tiles/Furniture/CalamityCanvas2023Tile.png b/Tiles/Furniture/CalamityCanvas2023Tile.png new file mode 100644 index 0000000000..24941a8f62 Binary files /dev/null and b/Tiles/Furniture/CalamityCanvas2023Tile.png differ diff --git a/Tiles/Furniture/CalamityCanvas2024Tile.cs b/Tiles/Furniture/CalamityCanvas2024Tile.cs new file mode 100644 index 0000000000..70df710ad1 --- /dev/null +++ b/Tiles/Furniture/CalamityCanvas2024Tile.cs @@ -0,0 +1,218 @@ +using CalamityMod.TileEntities; +using CalamityMod.UI; +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.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + // TODO: Probably make a base canvas painting class + public class CalamityCanvas2024Tile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] { 18, 18, 18, 18, 18 }; + TileObjectData.newTile.UsesCustomCanPlace = true; + //TileObjectData.newTile.Origin = new Point16(2, 0); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, false); + TileObjectData.addTile(Type); + + TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; + + AddMapEntry(new Color(99, 50, 30), Language.GetText("MapObject.Painting")); + } + public override bool HasSmartInteract(int i, int j, Terraria.GameContent.ObjectInteractions.SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Main.LocalPlayer.CancelSignsAndChests(); + TECanvasPainting cube = CalamityUtils.FindTileEntity(i, j, 5, 5); + if (cube != null) + { + CanvasPaintingUIState.ResetVars(); + Main.LocalPlayer.Calamity().CurrentlyViewedCanvasID = cube.ID; + Main.LocalPlayer.Calamity().CurrentlyViewedCanvasType = 1; + SoundEngine.PlaySound(SoundID.MenuOpen); + Main.playerInventory = true; + Main.recBigList = false; + } + Recipe.FindRecipes(); + return false; + } + + public override void MouseOver(int i, int j) + { + Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.cursorItemIconEnabled = true; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile t = Main.tile[i, j]; + int left = i - t.TileFrameX % (5 * 18) / 18; + int top = j - t.TileFrameY % (5 * 18) / 18; + + TECanvasPainting canvas = CalamityUtils.FindTileEntity(i, j, 5, 5, 18); + + canvas?.Kill(left, top); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile t = Main.tile[i, j]; + Texture2D texture = TextureAssets.Tile[Type].Value; + TECanvasPainting cube = CalamityUtils.FindTileEntity(i, j, 1, 1); + float baseDimension = 80; // 5 * 16 + Vector2 pos = new Vector2(i * 16, j * 16) + CalamityUtils.TileDrawOffset; + if (cube != null && t.TileFrameX == 0) + { + int fPX = (int)cube.framePosition.X; + int fPY = (int)cube.framePosition.Y; + int scale = (int)(texture.Width * 0.1f * cube.scale); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null); + // TODO: make the 0.8 in scale not a hardcoded number with seemingly no meaning + spriteBatch.Draw(texture, pos - Main.screenPosition, new Rectangle(fPX, fPY, scale, scale), Lighting.GetColor(i, j), 0, new Vector2(0, 0), 1 / cube.scale * 0.8f, 0, 0); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, Main.Rasterizer, null); + } + // Calculate and draw the borders + if (t.TileFrameX == 0 && t.TileFrameY == 0) + DrawBorders(spriteBatch, pos - Main.screenPosition, new Point(i, j)); + return false; + } + public static void DrawBorders(SpriteBatch spriteBatch, Vector2 pos, Point cords) + { + Texture2D texture = CalamityCanvas2023Tile.border.Value; + Texture2D cornerTex = CalamityCanvas2023Tile.corner.Value; + ushort canvasID = (ushort)ModContent.TileType(); + int commonDim = 8; + int finalCord = 72; + int size = 80; + Color light = Lighting.GetColor(cords.X, cords.Y); + + // Check for nearby Canvas paintings + // If they are cleanly lined up with this Canvas painting, don't draw borders between them + bool drawTop = true; + bool drawLeft = true; + bool drawRight = true; + bool drawBottom = true; + // Corners + bool drawTopLeft = false; + bool drawTopRight = false; + bool drawBottomLeft = false; + bool drawBottomRight = false; + + // The bottom right tile of the canvas painting + Point bottomRight = new Point(cords.X + 4, cords.Y + 4); + + // Adjacent tiles that may or may not have other canvas paintings + Tile left = CalamityUtils.ParanoidTileRetrieval(cords.X - 1, cords.Y); + Tile top = CalamityUtils.ParanoidTileRetrieval(cords.X, cords.Y - 1); + Tile right = CalamityUtils.ParanoidTileRetrieval(bottomRight.X + 1, bottomRight.Y); + Tile bottom = CalamityUtils.ParanoidTileRetrieval(bottomRight.X, bottomRight.Y + 1); + + // Check if adjacent tiles are canvas paintings that are lined up with this one + bool validTop = ValidCanvasFrame(top, 0, size, canvasID); + bool validRight = ValidCanvasFrame(right, 0, size, canvasID); + bool validLeft = ValidCanvasFrame(left, finalCord, 0, canvasID); + bool validBottom = ValidCanvasFrame(bottom, finalCord, 0, canvasID); + + if (validTop) + { + drawTop = false; + } + if (validBottom) + { + drawBottom = false; + } + if (validRight) + { + drawRight = false; + // Check for junction corners + Tile topright = CalamityUtils.ParanoidTileRetrieval(bottomRight.X + 1, cords.Y - 1); + Tile bottomright = CalamityUtils.ParanoidTileRetrieval(bottomRight.X + 1, bottomRight.Y + 1); + if (!drawTop && !ValidCanvasFrame(topright, 0, size, canvasID)) + { + drawTopRight = true; + } + if (!drawBottom && !ValidCanvasFrame(bottomright, 0, 0, canvasID)) + { + drawBottomRight = true; + } + } + if (validLeft) + { + drawLeft = false; + // Check for junction corners + Tile topleft = CalamityUtils.ParanoidTileRetrieval(cords.X - 1, cords.Y - 1); + Tile bottomleft = CalamityUtils.ParanoidTileRetrieval(cords.X - 1, bottomRight.Y + 1); + if (!drawTop && !ValidCanvasFrame(topleft, finalCord, size, canvasID)) + { + drawTopLeft = true; + } + if (!drawBottom && !ValidCanvasFrame(bottomleft, finalCord, 0, canvasID)) + { + drawBottomLeft = true; + } + } + + // Draw the sides + if (drawBottom) + spriteBatch.Draw(texture, pos + Vector2.UnitY * finalCord, new Rectangle(0, texture.Height - commonDim, texture.Width, commonDim), light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawTop) + spriteBatch.Draw(texture, pos, new Rectangle(0, 0, texture.Width, commonDim), light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawRight) + spriteBatch.Draw(texture, pos + Vector2.UnitX * finalCord, new Rectangle(texture.Width - commonDim, commonDim, commonDim, texture.Height - (2 * commonDim)), light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawLeft) + spriteBatch.Draw(texture, pos, new Rectangle(0, commonDim, commonDim, texture.Height - (2 * commonDim)), light, 0, new Vector2(0, 0), 1, 0, 0); + + // Draw the corners + // All corner drawing is done with a single corner sprite that is rotated and flipped about depending on the situation + if (drawTop && drawLeft) + spriteBatch.Draw(cornerTex, pos, null, light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawTop && drawRight) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitX * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipHorizontally, 0); + if (drawBottom && drawLeft) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitY * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipVertically, 0); + if (drawBottom && drawRight) + spriteBatch.Draw(cornerTex, pos + Vector2.One * size, null, light, MathHelper.Pi, new Vector2(0, 0), 1, 0, 0); + + // Draw junction corners + if (drawTopLeft) + spriteBatch.Draw(cornerTex, pos + CalamityCanvas2023Tile.corner.Size(), null, light, MathHelper.Pi, new Vector2(0, 0), 1, 0, 0); + if (drawTopRight) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitX * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipVertically, 0); + if (drawBottomLeft) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitY * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipHorizontally, 0); + if (drawBottomRight) + spriteBatch.Draw(cornerTex, pos - CalamityCanvas2023Tile.corner.Size() + Vector2.One * size, null, light, 0, new Vector2(0, 0), 1, 0, 0); + } + + // Check if the tile is a canvas tile that has the correct tile frames + public static bool ValidCanvasFrame(Tile t, int frameX, int frameY, ushort canvasID) + { + return t.HasTile && t.TileType == canvasID && t.TileFrameX == frameX && t.TileFrameY == frameY; + } + } +} diff --git a/Tiles/Furniture/CalamityCanvas2024Tile.png b/Tiles/Furniture/CalamityCanvas2024Tile.png new file mode 100644 index 0000000000..7b2139340d Binary files /dev/null and b/Tiles/Furniture/CalamityCanvas2024Tile.png differ diff --git a/Tiles/Furniture/CalamityCanvasBorder.png b/Tiles/Furniture/CalamityCanvasBorder.png new file mode 100644 index 0000000000..4d32a61675 Binary files /dev/null and b/Tiles/Furniture/CalamityCanvasBorder.png differ diff --git a/Tiles/Furniture/CalamityCanvasCorner.png b/Tiles/Furniture/CalamityCanvasCorner.png new file mode 100644 index 0000000000..cb1dc47a9e Binary files /dev/null and b/Tiles/Furniture/CalamityCanvasCorner.png differ diff --git a/Tiles/Furniture/CirrusCouch.png b/Tiles/Furniture/CirrusCouch.png index b494def714..1bca32a64a 100644 Binary files a/Tiles/Furniture/CirrusCouch.png and b/Tiles/Furniture/CirrusCouch.png differ diff --git a/Tiles/Furniture/CorruptionEffigy.cs b/Tiles/Furniture/CorruptionEffigy.cs index 55513d9acf..0e66e71ea8 100644 --- a/Tiles/Furniture/CorruptionEffigy.cs +++ b/Tiles/Furniture/CorruptionEffigy.cs @@ -1,8 +1,11 @@ using CalamityMod.Buffs.Placeables; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -13,9 +16,9 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.Width = 2; TileObjectData.newTile.Height = 4; @@ -25,17 +28,40 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.Origin = new Point16(0, 3); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); TileObjectData.addTile(Type); AddMapEntry(new Color(126, 156, 134), CalamityUtils.GetItemName()); } - public override void NearbyEffects(int i, int j, bool closer) + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove Crimson Effigy's buff. + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(SoundID.NPCHit13 with { Pitch = -0.4f, PitchVariance = 0.2f }, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; - if (player is null) - return; - if (!player.dead && player.active) - player.AddBuff(ModContent.BuffType(), 20); + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); } } } diff --git a/Tiles/Furniture/CorruptionEffigy.png b/Tiles/Furniture/CorruptionEffigy.png index fef465f910..4389f81731 100644 Binary files a/Tiles/Furniture/CorruptionEffigy.png and b/Tiles/Furniture/CorruptionEffigy.png differ diff --git a/Tiles/Furniture/CorruptionEffigy_Highlight.png b/Tiles/Furniture/CorruptionEffigy_Highlight.png new file mode 100644 index 0000000000..00449db10a Binary files /dev/null and b/Tiles/Furniture/CorruptionEffigy_Highlight.png differ diff --git a/Tiles/Furniture/CraftingStations/EutrophicShelf.cs b/Tiles/Furniture/CraftingStations/EutrophicShelf.cs index d4f3fda524..dca632f30e 100644 --- a/Tiles/Furniture/CraftingStations/EutrophicShelf.cs +++ b/Tiles/Furniture/CraftingStations/EutrophicShelf.cs @@ -18,17 +18,13 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations // public override void SetStaticDefaults() { - // 12AUG2023: Ozzatron: I had to touch this code - // It was absolutely necessary to allow for right-facing Eutrophic Shelves to drop following the TML 1.4.4 change: - // https://github.com/tModLoader/tModLoader/pull/3420 - RegisterItemDrop(ModContent.ItemType()); - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; // Remove the bottom anchor entirely, this thing hangs from the wall. TileObjectData.newTile.AnchorBottom = AnchorData.Empty; TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 1); diff --git a/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs b/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs index 907903a75f..8d19243ab9 100644 --- a/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs +++ b/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs @@ -28,26 +28,16 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/MonolithAmalgamGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - 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; - } } } diff --git a/Tiles/Furniture/CraftingStations/SCalAltar.cs b/Tiles/Furniture/CraftingStations/SCalAltar.cs index 36ab9cef5e..78e76fe29a 100644 --- a/Tiles/Furniture/CraftingStations/SCalAltar.cs +++ b/Tiles/Furniture/CraftingStations/SCalAltar.cs @@ -48,6 +48,8 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations TileObjectData.addTile(Type); AddMapEntry(new Color(43, 19, 42), CalamityUtils.GetItemName()); TileID.Sets.DisableSmartCursor[Type] = true; + + // This cannot be placed and only exists for backwards compatibility, so item has to be returned to the player manually if broken. RegisterItemDrop(ModContent.ItemType()); } @@ -66,10 +68,10 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public static void HoverItemIcon() { - bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; + bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; if (vodka) { - Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); + Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); } else if (Main.LocalPlayer.HasItem(ModContent.ItemType())) { @@ -92,12 +94,12 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations int top = j - tile.TileFrameY / 18; if (!Main.LocalPlayer.HasItem(ModContent.ItemType()) && - !Main.LocalPlayer.HasItem(ModContent.ItemType()) && !(Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld)) + !Main.LocalPlayer.HasItem(ModContent.ItemType()) && !(Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld)) { return true; } - bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; + bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; if (NPC.AnyNPCs(ModContent.NPCType()) || BossRushEvent.BossRushActive) return true; @@ -115,10 +117,10 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations if (vodka) { - Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); + Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); for (int f = 0; f < Main.maxNPCs; f++) { - if (Main.npc[f].type == ModContent.NPCType() && Main.npc[f].active) + if (Main.npc[f].type == ModContent.NPCType() && Main.npc[f].active) { Main.npc[f].active = false; } diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs index 8cd29cfa01..8b1cfe6971 100644 --- a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs +++ b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs @@ -33,26 +33,16 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/WulfrumLabstationGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - 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; - } } } diff --git a/Tiles/Furniture/CrimsonEffigy.cs b/Tiles/Furniture/CrimsonEffigy.cs index 12d51122ad..ba57c2a318 100644 --- a/Tiles/Furniture/CrimsonEffigy.cs +++ b/Tiles/Furniture/CrimsonEffigy.cs @@ -1,8 +1,11 @@ using CalamityMod.Buffs.Placeables; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -13,9 +16,9 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.Width = 2; TileObjectData.newTile.Height = 4; @@ -25,17 +28,40 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.Origin = new Point16(0, 3); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); TileObjectData.addTile(Type); AddMapEntry(new Color(238, 145, 105), CalamityUtils.GetItemName()); } - public override void NearbyEffects(int i, int j, bool closer) + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove Corruption Effigy's buff. + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(SoundID.NPCHit13 with { Pitch = 0.4f, PitchVariance = 0.2f }, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; - if (player is null) - return; - if (!player.dead && player.active) - player.AddBuff(ModContent.BuffType(), 20); + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); } } } diff --git a/Tiles/Furniture/CrimsonEffigy.png b/Tiles/Furniture/CrimsonEffigy.png index ef06cd32e7..623df7c679 100644 Binary files a/Tiles/Furniture/CrimsonEffigy.png and b/Tiles/Furniture/CrimsonEffigy.png differ diff --git a/Tiles/Furniture/CrimsonEffigy_Highlight.png b/Tiles/Furniture/CrimsonEffigy_Highlight.png new file mode 100644 index 0000000000..65062f866a Binary files /dev/null and b/Tiles/Furniture/CrimsonEffigy_Highlight.png differ diff --git a/Tiles/Furniture/EffigyOfDecayPlaceable.cs b/Tiles/Furniture/EffigyOfDecayPlaceable.cs index 9bf1b0aefd..e8f70ad6d6 100644 --- a/Tiles/Furniture/EffigyOfDecayPlaceable.cs +++ b/Tiles/Furniture/EffigyOfDecayPlaceable.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; @@ -26,6 +25,12 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.Origin = new Point16(0, 3); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); TileObjectData.addTile(Type); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); } diff --git a/Tiles/Furniture/EffigyOfDecayPlaceable.png b/Tiles/Furniture/EffigyOfDecayPlaceable.png index 61db8a5d83..375640636b 100644 Binary files a/Tiles/Furniture/EffigyOfDecayPlaceable.png and b/Tiles/Furniture/EffigyOfDecayPlaceable.png differ diff --git a/Tiles/Furniture/ForgottenNobleStatueTile.cs b/Tiles/Furniture/ForgottenNobleStatueTile.cs new file mode 100644 index 0000000000..31822fe198 --- /dev/null +++ b/Tiles/Furniture/ForgottenNobleStatueTile.cs @@ -0,0 +1,51 @@ +using CalamityMod.Items.Placeables.Furniture; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Tiles.Furniture +{ + public class ForgottenNobleStatueTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 7; + TileObjectData.newTile.Origin = new Point16(2, 7); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 20 }; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + + TileObjectData.addTile(Type); + AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Furniture/ForgottenNobleStatueTile.png b/Tiles/Furniture/ForgottenNobleStatueTile.png new file mode 100644 index 0000000000..1a7786c565 Binary files /dev/null and b/Tiles/Furniture/ForgottenNobleStatueTile.png differ diff --git a/Tiles/Furniture/ForgottenScholarStatueTile.cs b/Tiles/Furniture/ForgottenScholarStatueTile.cs new file mode 100644 index 0000000000..4aa9e5556a --- /dev/null +++ b/Tiles/Furniture/ForgottenScholarStatueTile.cs @@ -0,0 +1,51 @@ +using CalamityMod.Items.Placeables.Furniture; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Tiles.Furniture +{ + public class ForgottenScholarStatueTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 6; + TileObjectData.newTile.Origin = new Point16(2, 6); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 20 }; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + + TileObjectData.addTile(Type); + AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Furniture/ForgottenScholarStatueTile.png b/Tiles/Furniture/ForgottenScholarStatueTile.png new file mode 100644 index 0000000000..21859be3fb Binary files /dev/null and b/Tiles/Furniture/ForgottenScholarStatueTile.png differ diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.cs b/Tiles/Furniture/Fountains/AbyssFountainTile.cs index 02fde7f55c..9bdc67d1b1 100644 --- a/Tiles/Furniture/Fountains/AbyssFountainTile.cs +++ b/Tiles/Furniture/Fountains/AbyssFountainTile.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Furniture.Fountains; +using CalamityMod.Waters; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { if (!Main.dedServ && Main.tile[i, j].TileFrameX >= 36) - Main.SceneMetrics.ActiveFountainColor = ModContent.Find("CalamityMod/VoidWater").Slot; + Main.SceneMetrics.ActiveFountainColor = VoidWater.Instance.Slot; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/Furniture/Fountains/AstralFountainTile.cs b/Tiles/Furniture/Fountains/AstralFountainTile.cs index 44c0823d18..b21b19bd74 100644 --- a/Tiles/Furniture/Fountains/AstralFountainTile.cs +++ b/Tiles/Furniture/Fountains/AstralFountainTile.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Furniture.Fountains; +using CalamityMod.Waters; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { if (!Main.dedServ && Main.tile[i, j].TileFrameX >= 36) - Main.SceneMetrics.ActiveFountainColor = ModContent.Find("CalamityMod/AstralWater").Slot; + Main.SceneMetrics.ActiveFountainColor = AstralWater.Instance.Slot; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs index 5c79c78750..6b52380f3d 100644 --- a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs +++ b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Furniture.Fountains; +using CalamityMod.Waters; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains { string waterColor = Main.zenithWorld ? "CalamityMod/PissWater" : "CalamityMod/SulphuricWater"; if (!Main.dedServ && Main.tile[i, j].TileFrameX >= 36) - Main.SceneMetrics.ActiveFountainColor = ModContent.Find(waterColor).Slot; + Main.SceneMetrics.ActiveFountainColor = Main.zenithWorld ? PissWater.Instance.Slot : SulphuricWater.Instance.Slot; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs index 9aaf10a2d5..52a33930ad 100644 --- a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs +++ b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Furniture.Fountains; +using CalamityMod.Waters; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { if (!Main.dedServ && Main.tile[i, j].TileFrameX >= 36) - Main.SceneMetrics.ActiveFountainColor = ModContent.Find("CalamityMod/SunkenSeaWater").Slot; + Main.SceneMetrics.ActiveFountainColor = BasaltGullyWater.Type; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/Furniture/LanternCenterTile.cs b/Tiles/Furniture/LanternCenterTile.cs index 5d87d1aad6..6744a2c100 100644 --- a/Tiles/Furniture/LanternCenterTile.cs +++ b/Tiles/Furniture/LanternCenterTile.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -25,6 +26,8 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.addTile(Type); AddMapEntry(new Color(99, 99, 99), CalamityUtils.GetItemName()); TileID.Sets.HasOutlines[Type] = true; + TileID.Sets.InteractibleByNPCs[Type] = true; + TileID.Sets.DisableSmartInteract[Type] = true; AnimationFrameHeight = 54; } @@ -35,12 +38,21 @@ namespace CalamityMod.Tiles.Furniture public override void AnimateTile(ref int frame, ref int frameCounter) { - frameCounter++; - if (frameCounter >= 6) + if (!LanternNight.LanternsUp) { - frame = (frame + 1) % 6; + frame = 0; frameCounter = 0; } + else + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 7; + frameCounter = 0; + } + frame = Math.Clamp(frame, 1, 6); + } } public override void KillMultiTile(int i, int j, int frameX, int frameY) @@ -50,13 +62,11 @@ namespace CalamityMod.Tiles.Furniture public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); LanternNight.ToggleManualLanterns(); } public override bool RightClick(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); LanternNight.ToggleManualLanterns(); SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; diff --git a/Tiles/Furniture/LanternCenterTile.png b/Tiles/Furniture/LanternCenterTile.png index 1f8cc97ef3..fffbe3d12e 100644 Binary files a/Tiles/Furniture/LanternCenterTile.png and b/Tiles/Furniture/LanternCenterTile.png differ diff --git a/Tiles/Furniture/LanternCenterTile_Highlight.png b/Tiles/Furniture/LanternCenterTile_Highlight.png index 6e86215b5d..7c9e7546ef 100644 Binary files a/Tiles/Furniture/LanternCenterTile_Highlight.png and b/Tiles/Furniture/LanternCenterTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/AstralProjectorTile.cs b/Tiles/Furniture/Monoliths/AstralProjectorTile.cs index d44aa7b562..615418cf09 100644 --- a/Tiles/Furniture/Monoliths/AstralProjectorTile.cs +++ b/Tiles/Furniture/Monoliths/AstralProjectorTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.NPCs.Yharon; +using CalamityMod.Tiles.BaseTiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -16,17 +17,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.Monoliths { - public class AstralProjectorTile : ModTile + public class AstralProjectorTile : BaseMonolith { - public static Asset Glow; + public override int TileWidth => 2; + public override int TileHeight => 3; + public override int AnimationFrameCount => 9; + public override int AnimationDelay => 8; + public override int CursorItemType => ModContent.ItemType(); + public override void SetStaticDefaults() { if (!Main.dedServ) { - Glow = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow", AssetRequestMode.AsyncLoad); + GlowMask = ModContent.Request($"{Texture}_Glow"); } + RegisterItemDrop(ModContent.ItemType()); Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.Height = 3; TileObjectData.newTile.Origin = new Point16(0, 2); @@ -34,114 +42,22 @@ namespace CalamityMod.Tiles.Furniture.Monoliths TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + + AnimationFrameHeight = TileObjectData.newTile.CoordinateFullHeight; TileObjectData.addTile(Type); AddMapEntry(new Color(16, 50, 64)); DustType = ModContent.DustType(); - AnimationFrameHeight = 56; } - public override void NearbyEffects(int i, int j, bool closer) + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) { - if (Main.tile[i, j].TileFrameY < 56) - { + if (!monolithEnabled) 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; + if (localPlayer is not null && localPlayer.active) + localPlayer.Calamity().monolithAstralShader = 30; } } } diff --git a/Tiles/Furniture/Monoliths/AstralProjectorTile.png b/Tiles/Furniture/Monoliths/AstralProjectorTile.png index 4c5220bc9e..5698da0e59 100644 Binary files a/Tiles/Furniture/Monoliths/AstralProjectorTile.png and b/Tiles/Furniture/Monoliths/AstralProjectorTile.png differ diff --git a/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png b/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png index afb5b23e67..32b525194d 100644 Binary files a/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png and b/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/AstralProjectorTile_Highlight.png b/Tiles/Furniture/Monoliths/AstralProjectorTile_Highlight.png new file mode 100644 index 0000000000..5851b55eff Binary files /dev/null and b/Tiles/Furniture/Monoliths/AstralProjectorTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.cs b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.cs index 03fa351c0d..59867c9e93 100644 --- a/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.cs +++ b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.NPCs.Yharon; +using CalamityMod.Tiles.BaseTiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -15,12 +16,19 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.Monoliths { - public class BlueDistortedMonolithTile : ModTile + public class BlueDistortedMonolithTile : BaseMonolith { + public override int TileWidth => 5; + public override int TileHeight => 5; + public override int AnimationFrameCount => 6; + public override int AnimationDelay => 8; + public override int CursorItemType => ModContent.ItemType(); + public override void SetStaticDefaults() { RegisterItemDrop(ModContent.ItemType()); Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.Width = 5; TileObjectData.newTile.Height = 5; @@ -29,112 +37,22 @@ namespace CalamityMod.Tiles.Furniture.Monoliths TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 5, 0); + + AnimationFrameHeight = TileObjectData.newTile.CoordinateFullHeight; 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) + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) { - if (Main.tile[i, j].TileFrameY < 90) - { + if (!monolithEnabled) 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; + if (localPlayer is not null && localPlayer.active) + localPlayer.Calamity().monolithDevourerBShader = 30; } } } diff --git a/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.png b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.png index 6d3612ff2e..09889cf940 100644 Binary files a/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.png and b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.png differ diff --git a/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile_Highlight.png b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile_Highlight.png new file mode 100644 index 0000000000..39a2c06530 Binary files /dev/null and b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/BossRushMonolithTile.cs b/Tiles/Furniture/Monoliths/BossRushMonolithTile.cs index 9abede9eaa..454c6e9f08 100644 --- a/Tiles/Furniture/Monoliths/BossRushMonolithTile.cs +++ b/Tiles/Furniture/Monoliths/BossRushMonolithTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.NPCs.Yharon; +using CalamityMod.Tiles.BaseTiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -16,17 +17,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.Monoliths { - public class BossRushMonolithTile : ModTile + public class BossRushMonolithTile : BaseMonolith { - public static Asset Glow; + public override int TileWidth => 4; + public override int TileHeight => 4; + public override int AnimationFrameCount => 5; + public override int AnimationDelay => 8; + public override int CursorItemType => ModContent.ItemType(); + public override void SetStaticDefaults() { if (!Main.dedServ) { - Glow = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/BossRushMonolithTile_Glow", AssetRequestMode.AsyncLoad); + GlowMask = ModContent.Request($"{Texture}_Glow"); } + RegisterItemDrop(ModContent.ItemType()); Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.newTile.Width = 4; TileObjectData.newTile.Origin = new Point16(2, 3); @@ -34,114 +42,22 @@ namespace CalamityMod.Tiles.Furniture.Monoliths TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 4, 0); + + AnimationFrameHeight = TileObjectData.newTile.CoordinateFullHeight; 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) + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) { - if (Main.tile[i, j].TileFrameY < 72) - { + if (!monolithEnabled) 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; + if (localPlayer is not null && localPlayer.active) + localPlayer.Calamity().monolithBossRushShader = 30; } } } diff --git a/Tiles/Furniture/Monoliths/BossRushMonolithTile.png b/Tiles/Furniture/Monoliths/BossRushMonolithTile.png index f546e6ec43..2404e850a4 100644 Binary files a/Tiles/Furniture/Monoliths/BossRushMonolithTile.png and b/Tiles/Furniture/Monoliths/BossRushMonolithTile.png differ diff --git a/Tiles/Furniture/Monoliths/BossRushMonolithTile_Glow.png b/Tiles/Furniture/Monoliths/BossRushMonolithTile_Glow.png index 6dfbb80d91..42c63bd27b 100644 Binary files a/Tiles/Furniture/Monoliths/BossRushMonolithTile_Glow.png and b/Tiles/Furniture/Monoliths/BossRushMonolithTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/BossRushMonolithTile_Highlight.png b/Tiles/Furniture/Monoliths/BossRushMonolithTile_Highlight.png new file mode 100644 index 0000000000..e93fcd6782 Binary files /dev/null and b/Tiles/Furniture/Monoliths/BossRushMonolithTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.cs b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.cs index 8d9350c6e9..33fbf4e1de 100644 --- a/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.cs +++ b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.NPCs.Yharon; +using CalamityMod.Tiles.BaseTiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -15,124 +16,41 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.Monoliths { - public class DeepSeaAnchorTile : ModTile + public class DeepSeaAnchorTile : BaseMonolith { + public override int TileWidth => 3; + public override int TileHeight => 4; + public override int AnimationFrameCount => 6; + public override int AnimationDelay => 8; + public override int CursorItemType => ModContent.ItemType(); + public override void SetStaticDefaults() { RegisterItemDrop(ModContent.ItemType()); Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[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); + + AnimationFrameHeight = TileObjectData.newTile.CoordinateFullHeight; TileObjectData.addTile(Type); AddMapEntry(new Color(92, 24, 31)); DustType = DustID.Water; - AnimationFrameHeight = 72; } - public override void NearbyEffects(int i, int j, bool closer) + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) { - if (Main.tile[i, j].TileFrameY < 72) - { + if (!monolithEnabled) 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; + if (localPlayer is not null && localPlayer.active) + localPlayer.Calamity().monolithLeviathanShader = 30; } } } diff --git a/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.png b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.png index f11b3e66e5..f813f3e861 100644 Binary files a/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.png and b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.png differ diff --git a/Tiles/Furniture/Monoliths/DeepSeaAnchorTile_Highlight.png b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile_Highlight.png new file mode 100644 index 0000000000..2217a9872e Binary files /dev/null and b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/DraconicIncenseTile.cs b/Tiles/Furniture/Monoliths/DraconicIncenseTile.cs index d598a4f1bf..47aa4fbb37 100644 --- a/Tiles/Furniture/Monoliths/DraconicIncenseTile.cs +++ b/Tiles/Furniture/Monoliths/DraconicIncenseTile.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.Tiles.BaseTiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -14,17 +15,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.Monoliths { - public class DraconicIncenseTile : ModTile + public class DraconicIncenseTile : BaseMonolith { - public static Asset Glow; + public override int TileWidth => 2; + public override int TileHeight => 6; + public override int AnimationFrameCount => 6; + public override int AnimationDelay => 8; + public override int CursorItemType => ModContent.ItemType(); + public override void SetStaticDefaults() { if (!Main.dedServ) { - Glow = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/DraconicIncenseTile_Glow", AssetRequestMode.AsyncLoad); + GlowMask = ModContent.Request($"{Texture}_Glow"); } + RegisterItemDrop(ModContent.ItemType()); Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.Height = 6; TileObjectData.newTile.Origin = new Point16(0, 5); @@ -32,114 +40,22 @@ namespace CalamityMod.Tiles.Furniture.Monoliths TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + + AnimationFrameHeight = TileObjectData.newTile.CoordinateFullHeight; TileObjectData.addTile(Type); AddMapEntry(new Color(143, 106, 41)); DustType = DustID.Flare; - AnimationFrameHeight = 110; } - public override void NearbyEffects(int i, int j, bool closer) + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) { - if (Main.tile[i, j].TileFrameY < 110) - { + if (!monolithEnabled) 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; + if (localPlayer is not null && localPlayer.active) + localPlayer.Calamity().monolithYharonShader = 30; } } } diff --git a/Tiles/Furniture/Monoliths/DraconicIncenseTile.png b/Tiles/Furniture/Monoliths/DraconicIncenseTile.png index f41d683c71..45fa650c71 100644 Binary files a/Tiles/Furniture/Monoliths/DraconicIncenseTile.png and b/Tiles/Furniture/Monoliths/DraconicIncenseTile.png differ diff --git a/Tiles/Furniture/Monoliths/DraconicIncenseTile_Glow.png b/Tiles/Furniture/Monoliths/DraconicIncenseTile_Glow.png index 08635f8d22..5cec3eee91 100644 Binary files a/Tiles/Furniture/Monoliths/DraconicIncenseTile_Glow.png 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 index 0c4fd4884c..cc9a17ca31 100644 Binary files a/Tiles/Furniture/Monoliths/DraconicIncenseTile_Highlight.png and b/Tiles/Furniture/Monoliths/DraconicIncenseTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/ExoObeliskText.png b/Tiles/Furniture/Monoliths/ExoObeliskText.png index 374ee1df36..2dc766c63c 100644 Binary files a/Tiles/Furniture/Monoliths/ExoObeliskText.png and b/Tiles/Furniture/Monoliths/ExoObeliskText.png differ diff --git a/Tiles/Furniture/Monoliths/ExoObeliskTile.cs b/Tiles/Furniture/Monoliths/ExoObeliskTile.cs index 9712a5da57..8ff1638a78 100644 --- a/Tiles/Furniture/Monoliths/ExoObeliskTile.cs +++ b/Tiles/Furniture/Monoliths/ExoObeliskTile.cs @@ -1,7 +1,9 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.Potions; +using CalamityMod.Dusts; using CalamityMod.Items.Dyes; using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.NPCs.Yharon; +using CalamityMod.Tiles.BaseTiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -18,19 +20,26 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.Monoliths { - public class ExoObeliskTile : ModTile + public class ExoObeliskTile : BaseMonolith { - public static Asset Glow; + public override int TileWidth => 3; + public override int TileHeight => 5; + public override int AnimationFrameCount => 13; + public override int AnimationDelay => 8; + public override int CursorItemType => ModContent.ItemType(); + public static Asset Numbers; public override void SetStaticDefaults() { if (!Main.dedServ) { - Glow = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/ExoObeliskTile_Glow", AssetRequestMode.AsyncLoad); + GlowMask = ModContent.Request($"{Texture}_Glow"); Numbers = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/ExoObeliskText", AssetRequestMode.AsyncLoad); } + RegisterItemDrop(ModContent.ItemType()); Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.newTile.Height = 5; TileObjectData.newTile.Origin = new Point16(1, 4); @@ -38,113 +47,26 @@ namespace CalamityMod.Tiles.Furniture.Monoliths TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 3, 0); + + AnimationFrameHeight = TileObjectData.newTile.CoordinateFullHeight; TileObjectData.addTile(Type); AddMapEntry(new Color(54, 54, 54)); DustType = DustID.TerraBlade; - AnimationFrameHeight = 90; } - public override void NearbyEffects(int i, int j, bool closer) + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) { - if (Main.tile[i, j].TileFrameY < 90) - { + if (!monolithEnabled) return; - } - Player player = Main.LocalPlayer; - if (player is null) - { - return; - } - - if (player.active) - { - Main.LocalPlayer.Calamity().monolithExoShader = 30; - } + if (localPlayer is not null && localPlayer.active) + localPlayer.Calamity().monolithExoShader = 30; } - public override void AnimateTile(ref int frame, ref int frameCounter) + public override void DrawExtra(Vector2 drawPos, Rectangle rect, Color tileColor) { - 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); @@ -152,10 +74,8 @@ namespace CalamityMod.Tiles.Furniture.Monoliths 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); + Main.spriteBatch.Draw(Numbers.Value, drawPos, rect, exoColors, 0f, default, 1f, SpriteEffects.None, 0f); } - - return false; } } } diff --git a/Tiles/Furniture/Monoliths/ExoObeliskTile.png b/Tiles/Furniture/Monoliths/ExoObeliskTile.png index 53aa22ae4b..dd61b1adbf 100644 Binary files a/Tiles/Furniture/Monoliths/ExoObeliskTile.png and b/Tiles/Furniture/Monoliths/ExoObeliskTile.png differ diff --git a/Tiles/Furniture/Monoliths/ExoObeliskTile_Glow.png b/Tiles/Furniture/Monoliths/ExoObeliskTile_Glow.png index 35b578e203..7421e75f5c 100644 Binary files a/Tiles/Furniture/Monoliths/ExoObeliskTile_Glow.png and b/Tiles/Furniture/Monoliths/ExoObeliskTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/ExoObeliskTile_Highlight.png b/Tiles/Furniture/Monoliths/ExoObeliskTile_Highlight.png new file mode 100644 index 0000000000..f94d2cdc37 Binary files /dev/null and b/Tiles/Furniture/Monoliths/ExoObeliskTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/FrigidMonolithTile.cs b/Tiles/Furniture/Monoliths/FrigidMonolithTile.cs index df8c715d53..920b32002c 100644 --- a/Tiles/Furniture/Monoliths/FrigidMonolithTile.cs +++ b/Tiles/Furniture/Monoliths/FrigidMonolithTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.NPCs.Yharon; +using CalamityMod.Tiles.BaseTiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -15,124 +16,41 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.Monoliths { - public class FrigidMonolithTile : ModTile + public class FrigidMonolithTile : BaseMonolith { + public override int TileWidth => 3; + public override int TileHeight => 4; + public override int AnimationFrameCount => 6; + public override int AnimationDelay => 8; + public override int CursorItemType => ModContent.ItemType(); + public override void SetStaticDefaults() { RegisterItemDrop(ModContent.ItemType()); Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.newTile.Origin = new Point16(0, 2); + 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); + AnimationFrameHeight = TileObjectData.newTile.CoordinateFullHeight; + TileObjectData.addTile(Type); + AddMapEntry(new Color(55, 212, 230)); DustType = DustID.Ice; - AnimationFrameHeight = 74; } - public override void NearbyEffects(int i, int j, bool closer) + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) { - if (Main.tile[i, j].TileFrameY < 74) - { + if (!monolithEnabled) 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; + if (localPlayer is not null && localPlayer.active) + localPlayer.Calamity().monolithCryogenShader = 30; } } } diff --git a/Tiles/Furniture/Monoliths/FrigidMonolithTile.png b/Tiles/Furniture/Monoliths/FrigidMonolithTile.png index c77d1a431f..43021b3acf 100644 Binary files a/Tiles/Furniture/Monoliths/FrigidMonolithTile.png and b/Tiles/Furniture/Monoliths/FrigidMonolithTile.png differ diff --git a/Tiles/Furniture/Monoliths/FrigidMonolithTile_Highlight.png b/Tiles/Furniture/Monoliths/FrigidMonolithTile_Highlight.png new file mode 100644 index 0000000000..1d8468e67b Binary files /dev/null and b/Tiles/Furniture/Monoliths/FrigidMonolithTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/PlagueHumidifierTile.cs b/Tiles/Furniture/Monoliths/PlagueHumidifierTile.cs index 66e5f708a2..a0b8b05d2a 100644 --- a/Tiles/Furniture/Monoliths/PlagueHumidifierTile.cs +++ b/Tiles/Furniture/Monoliths/PlagueHumidifierTile.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.NPCs.Yharon; using CalamityMod.Particles; +using CalamityMod.Tiles.BaseTiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -16,134 +17,55 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.Monoliths { - public class PlagueHumidifierTile : ModTile + public class PlagueHumidifierTile : BaseMonolith { + public override int TileWidth => 2; + public override int TileHeight => 4; + public override int AnimationFrameCount => 4; + public override int AnimationDelay => 8; + public override int CursorItemType => ModContent.ItemType(); + public override void SetStaticDefaults() { RegisterItemDrop(ModContent.ItemType()); Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[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.CoordinateHeights = new[] { 16, 16, 16, 18 }; TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + + AnimationFrameHeight = TileObjectData.newTile.CoordinateFullHeight; 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) + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) { - if (Main.tile[i, j].TileFrameY < 74) - { + if (!monolithEnabled) return; - } - Player player = Main.LocalPlayer; - if (player is null) - { + if (localPlayer is null || !localPlayer.active) return; - } - if (player.active) - { - Main.LocalPlayer.Calamity().monolithPlagueShader = 30; - } + localPlayer.Calamity().monolithPlagueShader = 30; // Spawn mist particles at the bottom tiles - if (Main.tile[i,j +1].TileType != Type) + if (Main.tile[i, j + 1].TileType != Type && Main.rand.NextBool(30)) { - 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))); - } + var pos = new Vector2(i * 16, j * 16) + new Vector2(Main.rand.NextFloat(0, 16), Main.rand.NextFloat(16)); + var lifeTime = Main.rand.Next(40, 80); + var size = Main.rand.NextFloat(0.8f, 1.2f); + var speed = Vector2.UnitX * Main.rand.NextFloat(-0.8f, 0.8f); + var particle = new PlagueHumidifierMist(pos, lifeTime, size, speed); + GeneralParticleHandler.SpawnParticle(particle); } } - - 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 index a7e32a3f2d..74903f6bdc 100644 Binary files a/Tiles/Furniture/Monoliths/PlagueHumidifierTile.png and b/Tiles/Furniture/Monoliths/PlagueHumidifierTile.png differ diff --git a/Tiles/Furniture/Monoliths/PlagueHumidifierTile_Highlight.png b/Tiles/Furniture/Monoliths/PlagueHumidifierTile_Highlight.png new file mode 100644 index 0000000000..b089762e69 Binary files /dev/null and b/Tiles/Furniture/Monoliths/PlagueHumidifierTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs index dcc4f4557d..cfa45373d3 100644 --- a/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs +++ b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.NPCs.Yharon; +using CalamityMod.Tiles.BaseTiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -15,12 +16,19 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.Monoliths { - public class PurpleDistortedMonolithTile : ModTile + public class PurpleDistortedMonolithTile : BaseMonolith { + public override int TileWidth => 5; + public override int TileHeight => 5; + public override int AnimationFrameCount => 6; + public override int AnimationDelay => 8; + public override int CursorItemType => ModContent.ItemType(); + public override string HighlightTexture => "CalamityMod/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile_Highlight"; public override void SetStaticDefaults() { RegisterItemDrop(ModContent.ItemType()); Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.Width = 5; TileObjectData.newTile.Height = 5; @@ -29,112 +37,22 @@ namespace CalamityMod.Tiles.Furniture.Monoliths TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 5, 0); + + AnimationFrameHeight = TileObjectData.newTile.CoordinateFullHeight; 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) + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) { - if (Main.tile[i, j].TileFrameY < 92) - { + if (!monolithEnabled) 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; + if (localPlayer is not null && localPlayer.active) + localPlayer.Calamity().monolithDevourerPShader = 30; } } } diff --git a/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.png b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.png index 9c240370c4..124a3d6f78 100644 Binary files a/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.png and b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.png differ diff --git a/Tiles/Furniture/OtonilouStatueTile.cs b/Tiles/Furniture/OtonilouStatueTile.cs new file mode 100644 index 0000000000..2be6627a1f --- /dev/null +++ b/Tiles/Furniture/OtonilouStatueTile.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Items.Placeables.Furniture; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ObjectData; +using Terraria; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Tiles.Furniture +{ + public class OtonilouStatueTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Width = 14; + TileObjectData.newTile.Height = 26; + TileObjectData.newTile.Origin = new Point16(2, 24); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20 }; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + } +} diff --git a/Tiles/Furniture/OtonilouStatueTile.png b/Tiles/Furniture/OtonilouStatueTile.png new file mode 100644 index 0000000000..856cef13cb Binary files /dev/null and b/Tiles/Furniture/OtonilouStatueTile.png differ diff --git a/Tiles/Furniture/PiggyCageTile.cs b/Tiles/Furniture/PiggyCageTile.cs index 517372277c..3bb7fd1f87 100644 --- a/Tiles/Furniture/PiggyCageTile.cs +++ b/Tiles/Furniture/PiggyCageTile.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,9 +15,10 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileTable[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); TileObjectData.addTile(Type); AnimationFrameHeight = 54; @@ -33,6 +36,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 34; @@ -56,5 +61,42 @@ namespace CalamityMod.Tiles.Furniture frame = 0; } } + + // Since this uses a custom top sprite, all drawing must be redone + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + + Tile tile = Main.tile[i, j]; + var zero = Main.drawToScreen ? Vector2.Zero : new(Main.offScreenRange, Main.offScreenRange); + var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; + var animateFrameOffset = Main.tileFrame[Type] * AnimationFrameHeight; + var height = 16; + var finalColor = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); + + var rect = new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height); + + if (rect.Y % 54 == 0) + { + Vector2 position = drawPos; + position.Y += 8f; + Rectangle drawRectangle = rect; + drawRectangle.Y += 8; + drawRectangle.Height -= 8; + Main.spriteBatch.Draw(TextureAssets.Tile[Type].Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + position = drawPos; + position.Y -= 2f; + drawRectangle = rect; + drawRectangle.Y = 0; + drawRectangle.Height = 10; + spriteBatch.Draw(BabyFlakCrabCageTile.topTexture.Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + else + { + spriteBatch.Draw(TextureAssets.Tile[Type].Value, drawPos, rect, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + return false; + } } } diff --git a/Tiles/Furniture/RepairUnitCageTile.cs b/Tiles/Furniture/RepairUnitCageTile.cs new file mode 100644 index 0000000000..7f7a6c2d3f --- /dev/null +++ b/Tiles/Furniture/RepairUnitCageTile.cs @@ -0,0 +1,101 @@ +using CalamityMod.Buffs.Potions; +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Build.Tasks.Deployment.ManifestUtilities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class RepairUnitCageTile : ModTile + { + public static Asset topTexture; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + topTexture = ModContent.Request(Texture + "_Top"); + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileTable[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); + TileObjectData.addTile(Type); + AnimationFrameHeight = 54; + AddMapEntry(new Color(122, 217, 232), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Glass, 0f, 0f, 0, new Color(), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + int frameAmt = 10; + int timeNeeded = 10; + frameCounter++; + if (frameCounter >= timeNeeded) + { + frame++; + frameCounter = 0; + } + if (frame >= frameAmt) + { + frame = 0; + } + } + + // Since this uses a custom top sprite, all drawing must be redone + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + + Tile tile = Main.tile[i, j]; + var zero = Main.drawToScreen ? Vector2.Zero : new(Main.offScreenRange, Main.offScreenRange); + var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; + var animateFrameOffset = Main.tileFrame[Type] * AnimationFrameHeight; + var height = 16; + var finalColor = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); + + var rect = new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height); + + if (rect.Y % 54 == 0) + { + Vector2 position = drawPos; + position.Y += 8f; + Rectangle drawRectangle = rect; + drawRectangle.Y += 8; + drawRectangle.Height -= 8; + Main.spriteBatch.Draw(TextureAssets.Tile[Type].Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + position = drawPos; + position.Y -= 2f; + drawRectangle = rect; + drawRectangle.Y = 0; + drawRectangle.Height = 10; + spriteBatch.Draw(topTexture.Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + else + { + spriteBatch.Draw(TextureAssets.Tile[Type].Value, drawPos, rect, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Tiles/Furniture/RepairUnitCageTile.png b/Tiles/Furniture/RepairUnitCageTile.png new file mode 100644 index 0000000000..ed7cc4bb25 Binary files /dev/null and b/Tiles/Furniture/RepairUnitCageTile.png differ diff --git a/Tiles/Furniture/RepairUnitCageTile_Top.png b/Tiles/Furniture/RepairUnitCageTile_Top.png new file mode 100644 index 0000000000..015dbb46eb Binary files /dev/null and b/Tiles/Furniture/RepairUnitCageTile_Top.png differ diff --git a/Tiles/Furniture/SeaMinnowJarTile.cs b/Tiles/Furniture/SeaMinnowJarTile.cs index d8f90548b8..6d8ae9201b 100644 --- a/Tiles/Furniture/SeaMinnowJarTile.cs +++ b/Tiles/Furniture/SeaMinnowJarTile.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; + TileID.Sets.InteractibleByNPCs[Type] = true; // Emulating Fish Bowl. NPCs do not interact with Jelly jars (probably because they're deadly or something) TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); AnimationFrameHeight = 36; @@ -33,6 +33,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 12; diff --git a/Tiles/Furniture/SunkenIdolTile.cs b/Tiles/Furniture/SunkenIdolTile.cs new file mode 100644 index 0000000000..e3d5dadf61 --- /dev/null +++ b/Tiles/Furniture/SunkenIdolTile.cs @@ -0,0 +1,51 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class SunkenIdolTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(1, 4); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 18 }; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + + TileObjectData.addTile(Type); + AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Furniture/SunkenIdolTile.png b/Tiles/Furniture/SunkenIdolTile.png new file mode 100644 index 0000000000..5db73b921f Binary files /dev/null and b/Tiles/Furniture/SunkenIdolTile.png differ diff --git a/Tiles/Furniture/TransparentCageTile_Top.png b/Tiles/Furniture/TransparentCageTile_Top.png new file mode 100644 index 0000000000..cf9a09404c Binary files /dev/null and b/Tiles/Furniture/TransparentCageTile_Top.png differ diff --git a/Tiles/Furniture/TwinklerInABottleTile.cs b/Tiles/Furniture/TwinklerInABottleTile.cs index 0eaa5947fd..7c7a04ed05 100644 --- a/Tiles/Furniture/TwinklerInABottleTile.cs +++ b/Tiles/Furniture/TwinklerInABottleTile.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.Furniture AdjTiles = new int[] { TileID.HangingLanterns, TileID.FireflyinaBottle, TileID.LightningBuginaBottle }; } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override void AnimateTile(ref int frame, ref int frameCounter) { diff --git a/Tiles/Furniture/WulfrumLure.cs b/Tiles/Furniture/WulfrumLure.cs index 7e7d864482..4b3d07d82d 100644 --- a/Tiles/Furniture/WulfrumLure.cs +++ b/Tiles/Furniture/WulfrumLure.cs @@ -82,6 +82,9 @@ namespace CalamityMod.Tiles.Furniture public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + Vector2 offScreen = new Vector2(Main.offScreenRange); if (Main.drawToScreen) { diff --git a/Tiles/Furniture/ZenithThrone.cs b/Tiles/Furniture/ZenithThrone.cs new file mode 100644 index 0000000000..fc87137266 --- /dev/null +++ b/Tiles/Furniture/ZenithThrone.cs @@ -0,0 +1,87 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using static CalamityMod.Tiles.BaseTiles.BranchDrawer; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class ZenithThrone : ModTile + { + public override void SetStaticDefaults() + { + RegisterItemDrop(ModContent.ItemType()); + + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Height = 11; + TileObjectData.newTile.Width = 8; + TileObjectData.newTile.Origin = new Point16(4, 9); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.LavaPlacement = LiquidPlacement.Allowed; + TileObjectData.addTile(Type); + + // All sofas count as chairs. + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + AddMapEntry(new Color(43, 199, 217), Language.GetText("ItemName.Throne")); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.IceTorch); + 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) + { + Tile tile = Framing.GetTileSafely(i, j); + Player player = Main.LocalPlayer; + + int tileNum = tile.TileFrameX / 18; + + info.DirectionOffset = 0; + float offset = 0f; + // left 2 tiles + if (tileNum <= 1) + offset = 18 * (2 - tileNum); + // right 2 tiles + else if (tileNum >= 6) + offset = 18 * -(tileNum - 5); + + if (player.direction == -1) + offset *= -1; + + info.VisualOffset = new Vector2(offset, -8); + info.TargetDirection = player.direction; + + info.AnchorTilePosition.X = i; + info.AnchorTilePosition.Y = j; + } + + 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/ZenithThrone.png b/Tiles/Furniture/ZenithThrone.png new file mode 100644 index 0000000000..45b189d567 Binary files /dev/null and b/Tiles/Furniture/ZenithThrone.png differ diff --git a/Tiles/Furniture/ZenithThrone_Highlight.png b/Tiles/Furniture/ZenithThrone_Highlight.png new file mode 100644 index 0000000000..622ef22261 Binary files /dev/null and b/Tiles/Furniture/ZenithThrone_Highlight.png differ diff --git a/Tiles/FurnitureAbyss/AbyssChandelier.cs b/Tiles/FurnitureAbyss/AbyssChandelier.cs index bc9ca99128..f766e03cc8 100644 --- a/Tiles/FurnitureAbyss/AbyssChandelier.cs +++ b/Tiles/FurnitureAbyss/AbyssChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + 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(100, 130, 150), 1f); diff --git a/Tiles/FurnitureAbyss/AbyssLantern.cs b/Tiles/FurnitureAbyss/AbyssLantern.cs index 0e175cb6f2..870a1e2b71 100644 --- a/Tiles/FurnitureAbyss/AbyssLantern.cs +++ b/Tiles/FurnitureAbyss/AbyssLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public class AbyssLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs index 5c931195b2..65199dc73e 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs @@ -16,8 +16,6 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public override void SetStaticDefaults() { - RegisterItemDrop(ModContent.ItemType()); - Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; @@ -28,6 +26,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.Origin = new Point16(1, 1); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); diff --git a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs index 0d71135c72..5707586091 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType()); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs index caa6941efc..4cad230406 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public class AcidwoodLanternTile : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureAncient/AncientLantern.cs b/Tiles/FurnitureAncient/AncientLantern.cs index 523137a9d2..00ac4b6fd0 100644 --- a/Tiles/FurnitureAncient/AncientLantern.cs +++ b/Tiles/FurnitureAncient/AncientLantern.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public class AncientLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureAshen/AshenAccentSlab.cs b/Tiles/FurnitureAshen/AshenAccentSlab.cs index f92c169a76..6fa77bdb6f 100644 --- a/Tiles/FurnitureAshen/AshenAccentSlab.cs +++ b/Tiles/FurnitureAshen/AshenAccentSlab.cs @@ -272,6 +272,9 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int uniqueAnimationFrameX = 0; int uniqueAnimationFrameY = 0; int xPos = i % 2; @@ -512,7 +515,7 @@ namespace CalamityMod.Tiles.FurnitureAshen 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; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenSlabGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(64, 64, 64, 64)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(64, 64, 64, 64)); Tile trackTile = Main.tile[i, j]; if (!trackTile.IsHalfBlock && trackTile.Slope == 0) { @@ -524,19 +527,6 @@ namespace CalamityMod.Tiles.FurnitureAshen } } - 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; - } - /* /// /// Gets the tile variant to use. Returns -1 by default diff --git a/Tiles/FurnitureAshen/AshenChandelier.cs b/Tiles/FurnitureAshen/AshenChandelier.cs index d924e95579..877855977d 100644 --- a/Tiles/FurnitureAshen/AshenChandelier.cs +++ b/Tiles/FurnitureAshen/AshenChandelier.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Tiles.FurnitureAshen AnimationFrameHeight = 54; } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureAshen/AshenLantern.cs b/Tiles/FurnitureAshen/AshenLantern.cs index 3d039ecd85..ec7f983270 100644 --- a/Tiles/FurnitureAshen/AshenLantern.cs +++ b/Tiles/FurnitureAshen/AshenLantern.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public class AshenLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureAshen/AshenMonolith.cs b/Tiles/FurnitureAshen/AshenMonolith.cs index 6e0d5e1ca3..d1dbbae53f 100644 --- a/Tiles/FurnitureAshen/AshenMonolith.cs +++ b/Tiles/FurnitureAshen/AshenMonolith.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.FurnitureAshen { //This is used to draw the eye, where the frame is changed depending on the player's position relative to the eye's centre. Tile currentTile = Main.tile[i, j]; + if (currentTile.IsTileActuallyInvisible()) + return; + Vector2 eyeCentre = new Vector2(i * 16, j * 16); if (currentTile.TileFrameX == 0) { eyeCentre += new Vector2(16f, 0f); } diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 2534a691f7..440542777f 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -272,6 +272,9 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int uniqueAnimationFrameX = 0; int uniqueAnimationFrameY = 0; int xPos = i % 2; @@ -512,7 +515,7 @@ namespace CalamityMod.Tiles.FurnitureAshen 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; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenSlabGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(64, 64, 64, 64)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(64, 64, 64, 64)); Tile trackTile = Main.tile[i, j]; if (!trackTile.IsHalfBlock && trackTile.Slope == 0) { @@ -524,19 +527,6 @@ namespace CalamityMod.Tiles.FurnitureAshen } } - 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; - } - /* /// /// Gets the tile variant to use. Returns -1 by default diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs index c43658ab80..6c5b1290a7 100644 --- a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -3,14 +3,17 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen { - public class SmoothBrimstoneSlag : ModTile + public class SmoothBrimstoneSlag : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureAshen/SmoothBrimstoneSlagGlow"; + + public override void SetupStatic() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; @@ -33,30 +36,9 @@ namespace CalamityMod.Tiles.FurnitureAshen return false; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/SmoothBrimstoneSlagGlow").Value; - 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, new Color(25, 25, 25, 25)); - Tile trackTile = Main.tile[i, j]; - - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, 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; + return new Color(25, 25, 25); } } } diff --git a/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs b/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs index adf9d77758..24a4d7ed7d 100644 --- a/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs +++ b/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs @@ -4,18 +4,18 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAuric { - public class ActivatedAuricPanelTile : ModTile + public class ActivatedAuricPanelTile : GlowMaskTile { - internal static Texture2D GlowTexture; - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureAuric/ActivatedAuricPanelTile_Glow"; + + public override void SetupStatic() { - 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; @@ -30,31 +30,11 @@ namespace CalamityMod.Tiles.FurnitureAuric return false; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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; - - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + return Color.White; } - 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 TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); diff --git a/Tiles/FurnitureAuric/AuricAbsorberTile.cs b/Tiles/FurnitureAuric/AuricAbsorberTile.cs index 67c8f07997..35db8b1f40 100644 --- a/Tiles/FurnitureAuric/AuricAbsorberTile.cs +++ b/Tiles/FurnitureAuric/AuricAbsorberTile.cs @@ -23,29 +23,12 @@ namespace CalamityMod.Tiles.FurnitureAuric 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; - - TileFramingSystem.SlopedGlowmask(i, j, 0, TextureAssets.Tile[Type].Value, drawOffset, null, GetDrawColour(i, j, drawColour), default); + var tileCache = Main.tile[i, j]; + if (tileCache.IsTileActuallyInvisible()) + return; + TileFramingSystem.SlopedGlowmask(in tileCache, i, j, TextureAssets.Tile[Type].Value, null, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White), 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 TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); diff --git a/Tiles/FurnitureAuric/AuricConsoleTile.cs b/Tiles/FurnitureAuric/AuricConsoleTile.cs index e991ae4be9..c63214c960 100644 --- a/Tiles/FurnitureAuric/AuricConsoleTile.cs +++ b/Tiles/FurnitureAuric/AuricConsoleTile.cs @@ -50,6 +50,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricConsoleTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricDisplayTile.cs b/Tiles/FurnitureAuric/AuricDisplayTile.cs index 857f4a8a8c..3bee285bc0 100644 --- a/Tiles/FurnitureAuric/AuricDisplayTile.cs +++ b/Tiles/FurnitureAuric/AuricDisplayTile.cs @@ -54,6 +54,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricDisplayTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricPlatformTile.cs b/Tiles/FurnitureAuric/AuricPlatformTile.cs index 8e47dbe7b8..6374210994 100644 --- a/Tiles/FurnitureAuric/AuricPlatformTile.cs +++ b/Tiles/FurnitureAuric/AuricPlatformTile.cs @@ -45,6 +45,8 @@ namespace CalamityMod.Tiles.FurnitureAuric return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); + if (tile.IsTileActuallyInvisible()) + return; int xPos = tile.TileFrameX; int yPos = tile.TileFrameY; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs b/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs index 6fcdd98125..b12a59811b 100644 --- a/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs +++ b/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs @@ -39,6 +39,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricReinforcedCrateTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs b/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs index 740c2d764d..236306d9cb 100644 --- a/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs +++ b/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs @@ -4,18 +4,18 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAuric { - public class AuricRepulserPanelTile : ModTile + public class AuricRepulserPanelTile : GlowMaskTile { - internal static Texture2D GlowTexture; - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureAuric/AuricRepulserPanelTile_Glow"; + + public override void SetupStatic() { - 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; @@ -30,31 +30,11 @@ namespace CalamityMod.Tiles.FurnitureAuric return false; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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; - - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + return Color.White; } - 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 TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); diff --git a/Tiles/FurnitureAuric/AuricScreenTile.cs b/Tiles/FurnitureAuric/AuricScreenTile.cs index 612876ee9e..57d785b261 100644 --- a/Tiles/FurnitureAuric/AuricScreenTile.cs +++ b/Tiles/FurnitureAuric/AuricScreenTile.cs @@ -34,6 +34,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricScreenTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricServerTile.cs b/Tiles/FurnitureAuric/AuricServerTile.cs index 1574f7ed8c..859f124c91 100644 --- a/Tiles/FurnitureAuric/AuricServerTile.cs +++ b/Tiles/FurnitureAuric/AuricServerTile.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricServerTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricTerminalTile.cs b/Tiles/FurnitureAuric/AuricTerminalTile.cs index 081c67e195..b4870a0fe5 100644 --- a/Tiles/FurnitureAuric/AuricTerminalTile.cs +++ b/Tiles/FurnitureAuric/AuricTerminalTile.cs @@ -54,6 +54,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricTerminalTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricToiletTile.cs b/Tiles/FurnitureAuric/AuricToiletTile.cs index ae3b55fbfb..ba15b0194e 100644 --- a/Tiles/FurnitureAuric/AuricToiletTile.cs +++ b/Tiles/FurnitureAuric/AuricToiletTile.cs @@ -14,8 +14,6 @@ namespace CalamityMod.Tiles.FurnitureAuric { public override void SetStaticDefaults() { - RegisterItemDrop(ModContent.ItemType()); - Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; @@ -27,6 +25,7 @@ namespace CalamityMod.Tiles.FurnitureAuric TileObjectData.newTile.DrawYOffset = 4; TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.Origin = new Point16(1, 1); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); diff --git a/Tiles/FurnitureAuric/ExoAuricPanelTile.cs b/Tiles/FurnitureAuric/ExoAuricPanelTile.cs index 8431ec84e0..7f30c72c0b 100644 --- a/Tiles/FurnitureAuric/ExoAuricPanelTile.cs +++ b/Tiles/FurnitureAuric/ExoAuricPanelTile.cs @@ -4,18 +4,18 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAuric { - public class ExoAuricPanelTile : ModTile + public class ExoAuricPanelTile : GlowMaskTile { - internal static Texture2D GlowTexture; - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureAuric/ExoAuricPanelTile_Glow"; + + public override void SetupStatic() { - 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; @@ -30,31 +30,11 @@ namespace CalamityMod.Tiles.FurnitureAuric return false; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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; - - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + return Color.White; } - 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 TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); diff --git a/Tiles/FurnitureBotanic/BotanicChandelier.cs b/Tiles/FurnitureBotanic/BotanicChandelier.cs index 3a21c53662..5c09783ac6 100644 --- a/Tiles/FurnitureBotanic/BotanicChandelier.cs +++ b/Tiles/FurnitureBotanic/BotanicChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + 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); diff --git a/Tiles/FurnitureBotanic/BotanicLantern.cs b/Tiles/FurnitureBotanic/BotanicLantern.cs index c1de59b565..ff61750358 100644 --- a/Tiles/FurnitureBotanic/BotanicLantern.cs +++ b/Tiles/FurnitureBotanic/BotanicLantern.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public class BotanicLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs index b8af599897..c91d283dad 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs @@ -3,14 +3,17 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite { - public class CosmiliteBrick : ModTile + public class CosmiliteBrick : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBrickGlow"; + + public override void SetupStatic() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -26,31 +29,9 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return false; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBrickGlow").Value; - 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; - - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, 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; + return Color.White; } } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs index 936a449250..01e4933808 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs index de5f0a9f36..a220cc5230 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public class CosmiliteLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureEutrophic/AncientSmoothNavystone.cs b/Tiles/FurnitureEutrophic/AncientSmoothNavystone.cs new file mode 100644 index 0000000000..18ae30d146 --- /dev/null +++ b/Tiles/FurnitureEutrophic/AncientSmoothNavystone.cs @@ -0,0 +1,33 @@ + +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureEutrophic +{ + public class AncientSmoothNavystone : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeSmoothTiles(Type); + CalamityUtils.MergeDecorativeTiles(Type); + CalamityUtils.MergeWithDesert(Type); + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Tink; + AddMapEntry(new Color(39, 48, 53)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + 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/AncientSmoothNavystone.png b/Tiles/FurnitureEutrophic/AncientSmoothNavystone.png new file mode 100644 index 0000000000..7d498f636a Binary files /dev/null and b/Tiles/FurnitureEutrophic/AncientSmoothNavystone.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs index 74b2bd8f00..c98b6590b7 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType()); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); diff --git a/Tiles/FurnitureEutrophic/EutrophicLantern.cs b/Tiles/FurnitureEutrophic/EutrophicLantern.cs index 4c9d41174f..a238668f28 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLantern.cs +++ b/Tiles/FurnitureEutrophic/EutrophicLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public class EutrophicLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.cs b/Tiles/FurnitureEutrophic/SmoothNavystone.cs index 6f71592d07..ce85324b05 100644 --- a/Tiles/FurnitureEutrophic/SmoothNavystone.cs +++ b/Tiles/FurnitureEutrophic/SmoothNavystone.cs @@ -1,4 +1,5 @@  +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -11,23 +12,29 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override void SetStaticDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeSmoothTiles(Type); CalamityUtils.MergeDecorativeTiles(Type); + CalamityUtils.MergeWithAbyss(Type); CalamityUtils.MergeWithDesert(Type); TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.HasSlopeFrames[Type] = true; HitSound = SoundID.Tink; - AddMapEntry(new Color(39, 48, 53)); + DustType = 96; + AddMapEntry(new Color(44, 57, 64)); } - public override bool CreateDust(int i, int j, ref int type) + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); - return false; + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; } } } diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.png b/Tiles/FurnitureEutrophic/SmoothNavystone.png index 7d498f636a..2a125f4dd2 100644 Binary files a/Tiles/FurnitureEutrophic/SmoothNavystone.png and b/Tiles/FurnitureEutrophic/SmoothNavystone.png differ diff --git a/Tiles/FurnitureExo/ExoBathtubTile.cs b/Tiles/FurnitureExo/ExoBathtubTile.cs index 4253625413..bc6774561f 100644 --- a/Tiles/FurnitureExo/ExoBathtubTile.cs +++ b/Tiles/FurnitureExo/ExoBathtubTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoBathtubGlow").Value; diff --git a/Tiles/FurnitureExo/ExoBedTile.cs b/Tiles/FurnitureExo/ExoBedTile.cs index 59f35b3e58..5eac86fb0d 100644 --- a/Tiles/FurnitureExo/ExoBedTile.cs +++ b/Tiles/FurnitureExo/ExoBedTile.cs @@ -33,6 +33,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoBedGlow").Value; diff --git a/Tiles/FurnitureExo/ExoBookcaseTile.cs b/Tiles/FurnitureExo/ExoBookcaseTile.cs index a5bb51442c..ad3ea4978f 100644 --- a/Tiles/FurnitureExo/ExoBookcaseTile.cs +++ b/Tiles/FurnitureExo/ExoBookcaseTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoBookcaseGlow").Value; diff --git a/Tiles/FurnitureExo/ExoChairTile.cs b/Tiles/FurnitureExo/ExoChairTile.cs index f18d66742a..d04b7a3554 100644 --- a/Tiles/FurnitureExo/ExoChairTile.cs +++ b/Tiles/FurnitureExo/ExoChairTile.cs @@ -17,8 +17,6 @@ namespace CalamityMod.Tiles.FurnitureExo { public override void SetStaticDefaults() { - RegisterItemDrop(ModContent.ItemType()); - Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; @@ -29,6 +27,7 @@ namespace CalamityMod.Tiles.FurnitureExo TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.Origin = new Point16(1, 1); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); @@ -62,6 +61,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoChairGlow").Value; diff --git a/Tiles/FurnitureExo/ExoChandelierTile.cs b/Tiles/FurnitureExo/ExoChandelierTile.cs index af8d1ee90e..6292d83cc9 100644 --- a/Tiles/FurnitureExo/ExoChandelierTile.cs +++ b/Tiles/FurnitureExo/ExoChandelierTile.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureExo { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureExo/ExoChestGlow.png b/Tiles/FurnitureExo/ExoChestGlow.png index afd5dcd8d6..a4ffe528e6 100644 Binary files a/Tiles/FurnitureExo/ExoChestGlow.png and b/Tiles/FurnitureExo/ExoChestGlow.png differ diff --git a/Tiles/FurnitureExo/ExoChestTile.cs b/Tiles/FurnitureExo/ExoChestTile.cs index 3c949f4e59..8a05742926 100644 --- a/Tiles/FurnitureExo/ExoChestTile.cs +++ b/Tiles/FurnitureExo/ExoChestTile.cs @@ -36,12 +36,21 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; + + int xPos = tile.TileFrameX; + int yPos = tile.TileFrameY; + int chestIndex = Chest.FindChest(i - (xPos / 18), j - (yPos / 18)); + if (chestIndex == -1) + return; + int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoChestGlow").Value; - Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + drawOffset; Color drawColour = Color.White; - Main.spriteBatch.Draw(glowmask, drawPosition, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), drawColour, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)); + Rectangle frame = new Rectangle(xPos, yPos + Main.chest[chestIndex].frame * 38, 18, 18); + Main.spriteBatch.Draw(glowmask, drawPosition, frame, drawColour, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } } } diff --git a/Tiles/FurnitureExo/ExoClockTile.cs b/Tiles/FurnitureExo/ExoClockTile.cs index f060ed0f9e..aa0b55400a 100644 --- a/Tiles/FurnitureExo/ExoClockTile.cs +++ b/Tiles/FurnitureExo/ExoClockTile.cs @@ -41,6 +41,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoClockGlow").Value; diff --git a/Tiles/FurnitureExo/ExoConsoleTile.cs b/Tiles/FurnitureExo/ExoConsoleTile.cs index bc17227112..b0ee83fc8f 100644 --- a/Tiles/FurnitureExo/ExoConsoleTile.cs +++ b/Tiles/FurnitureExo/ExoConsoleTile.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoConsoleGlow").Value; diff --git a/Tiles/FurnitureExo/ExoDisplayTile.cs b/Tiles/FurnitureExo/ExoDisplayTile.cs index 0e34ea42af..864d84c0dd 100644 --- a/Tiles/FurnitureExo/ExoDisplayTile.cs +++ b/Tiles/FurnitureExo/ExoDisplayTile.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoDisplayGlow").Value; diff --git a/Tiles/FurnitureExo/ExoDresserTile.cs b/Tiles/FurnitureExo/ExoDresserTile.cs index 17bd4a2633..2b0807917f 100644 --- a/Tiles/FurnitureExo/ExoDresserTile.cs +++ b/Tiles/FurnitureExo/ExoDresserTile.cs @@ -34,6 +34,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoDresserGlow").Value; diff --git a/Tiles/FurnitureExo/ExoKeyboardTile.cs b/Tiles/FurnitureExo/ExoKeyboardTile.cs index a58cffd87d..b54456e596 100644 --- a/Tiles/FurnitureExo/ExoKeyboardTile.cs +++ b/Tiles/FurnitureExo/ExoKeyboardTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoKeyboardGlow").Value; diff --git a/Tiles/FurnitureExo/ExoLanternTile.cs b/Tiles/FurnitureExo/ExoLanternTile.cs index 7b3d0660b2..30c1883ff0 100644 --- a/Tiles/FurnitureExo/ExoLanternTile.cs +++ b/Tiles/FurnitureExo/ExoLanternTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo public class ExoLanternTile : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CanExplode(int i, int j) => false; diff --git a/Tiles/FurnitureExo/ExoPlatingTile.cs b/Tiles/FurnitureExo/ExoPlatingTile.cs index 44edc712ae..9a4408ed15 100644 --- a/Tiles/FurnitureExo/ExoPlatingTile.cs +++ b/Tiles/FurnitureExo/ExoPlatingTile.cs @@ -4,22 +4,18 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo { - public class ExoPlatingTile : ModTile + public class ExoPlatingTile : GlowMaskTile { - internal static Texture2D GlowTexture; + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureExo/ExoPlatingTileGlow"; - public override void SetStaticDefaults() + public override void SetupStatic() { - if (!Main.dedServ) - { - GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoPlatingTileGlow", AssetRequestMode.ImmediateLoad).Value; - } - Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -46,33 +42,9 @@ namespace CalamityMod.Tiles.FurnitureExo frameYOffset = yPos * AnimationFrameHeight; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - // 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 frameOffset = j % 2 * AnimationFrameHeight; - int yPos = tile.TileFrameY + frameOffset; - Color drawColour = GetDrawColour(i, j, Color.White); - 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; - - TileFramingSystem.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; + return Color.White; } } } diff --git a/Tiles/FurnitureExo/ExoPrismPanelTile.cs b/Tiles/FurnitureExo/ExoPrismPanelTile.cs index f3c9429df2..5a560bf5eb 100644 --- a/Tiles/FurnitureExo/ExoPrismPanelTile.cs +++ b/Tiles/FurnitureExo/ExoPrismPanelTile.cs @@ -4,22 +4,18 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo { - public class ExoPrismPanelTile : ModTile + public class ExoPrismPanelTile : GlowMaskTile { - internal static Texture2D GlowTexture; + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureExo/ExoPrismPanelTileGlow"; - public override void SetStaticDefaults() + public override void SetupStatic() { - if (!Main.dedServ) - { - GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoPrismPanelTileGlow", AssetRequestMode.ImmediateLoad).Value; - } - Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -46,33 +42,9 @@ namespace CalamityMod.Tiles.FurnitureExo frameYOffset = frameOffset * AnimationFrameHeight; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - // 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 frameOffset = (i + j) % 6 * AnimationFrameHeight; - int yPos = tile.TileFrameY + frameOffset; - Color drawColour = GetDrawColour(i, j, Color.White); - 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; - - TileFramingSystem.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; + return Color.White; } } } diff --git a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs index b3bbe480e9..aee4df9a8e 100644 --- a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs +++ b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs @@ -54,6 +54,9 @@ namespace CalamityMod.Tiles.FurnitureExo return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); + if (tile.IsTileActuallyInvisible()) + return; + int xPos = tile.TileFrameX; int frameOffset = (i + j) % 6 * AnimationFrameHeight; int yPos = tile.TileFrameY + frameOffset; diff --git a/Tiles/FurnitureExo/ExoScreenTile.cs b/Tiles/FurnitureExo/ExoScreenTile.cs index 0293c537a7..21b0def587 100644 --- a/Tiles/FurnitureExo/ExoScreenTile.cs +++ b/Tiles/FurnitureExo/ExoScreenTile.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; + int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoScreenGlow").Value; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/FurnitureExo/ExoServerTile.cs b/Tiles/FurnitureExo/ExoServerTile.cs index 45c3fb4f38..cdc835ff58 100644 --- a/Tiles/FurnitureExo/ExoServerTile.cs +++ b/Tiles/FurnitureExo/ExoServerTile.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoServerGlow").Value; diff --git a/Tiles/FurnitureExo/ExoSinkTile.cs b/Tiles/FurnitureExo/ExoSinkTile.cs index f20935c0a2..9e6d293bf6 100644 --- a/Tiles/FurnitureExo/ExoSinkTile.cs +++ b/Tiles/FurnitureExo/ExoSinkTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoSinkGlow").Value; diff --git a/Tiles/FurnitureExo/ExoSofaTile.cs b/Tiles/FurnitureExo/ExoSofaTile.cs index 5236a75055..a89b2721e2 100644 --- a/Tiles/FurnitureExo/ExoSofaTile.cs +++ b/Tiles/FurnitureExo/ExoSofaTile.cs @@ -40,6 +40,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoSofaGlow").Value; diff --git a/Tiles/FurnitureExo/ExoTableTile.cs b/Tiles/FurnitureExo/ExoTableTile.cs index 4b2240b6fe..922949b560 100644 --- a/Tiles/FurnitureExo/ExoTableTile.cs +++ b/Tiles/FurnitureExo/ExoTableTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoTableGlow").Value; diff --git a/Tiles/FurnitureExo/ExoTerminalTile.cs b/Tiles/FurnitureExo/ExoTerminalTile.cs index fa0aa1edd5..d180bf0769 100644 --- a/Tiles/FurnitureExo/ExoTerminalTile.cs +++ b/Tiles/FurnitureExo/ExoTerminalTile.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoTerminalGlow").Value; diff --git a/Tiles/FurnitureExo/ExoToiletTile.cs b/Tiles/FurnitureExo/ExoToiletTile.cs index 0dc1d46bc5..253033f2ca 100644 --- a/Tiles/FurnitureExo/ExoToiletTile.cs +++ b/Tiles/FurnitureExo/ExoToiletTile.cs @@ -18,8 +18,6 @@ namespace CalamityMod.Tiles.FurnitureExo public const int NextStyleHeight = 40; public override void SetStaticDefaults() { - RegisterItemDrop(ModContent.ItemType()); - Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; @@ -30,6 +28,7 @@ namespace CalamityMod.Tiles.FurnitureExo TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.Origin = new Point16(1, 1); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); @@ -63,6 +62,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoToiletGlow").Value; diff --git a/Tiles/FurnitureExo/ExoWorkBenchTile.cs b/Tiles/FurnitureExo/ExoWorkBenchTile.cs index 9347c89993..1696283777 100644 --- a/Tiles/FurnitureExo/ExoWorkBenchTile.cs +++ b/Tiles/FurnitureExo/ExoWorkBenchTile.cs @@ -33,6 +33,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request(Texture + "Glow").Value; diff --git a/Tiles/FurnitureMarnite/MarniteChandelier.cs b/Tiles/FurnitureMarnite/MarniteChandelier.cs index 7277e2ead7..1e979e48c4 100644 --- a/Tiles/FurnitureMarnite/MarniteChandelier.cs +++ b/Tiles/FurnitureMarnite/MarniteChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureMarnite { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Granite, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureMarnite/MarniteLantern.cs b/Tiles/FurnitureMarnite/MarniteLantern.cs index 53e82d7535..808673bd37 100644 --- a/Tiles/FurnitureMarnite/MarniteLantern.cs +++ b/Tiles/FurnitureMarnite/MarniteLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public class MarniteLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureMarnite/MarniteToilet.cs b/Tiles/FurnitureMarnite/MarniteToilet.cs index 115d102068..2a4a9510f6 100644 --- a/Tiles/FurnitureMarnite/MarniteToilet.cs +++ b/Tiles/FurnitureMarnite/MarniteToilet.cs @@ -16,8 +16,6 @@ namespace CalamityMod.Tiles.FurnitureMarnite { public override void SetStaticDefaults() { - RegisterItemDrop(ModContent.ItemType()); - Main.tileFrameImportant[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); @@ -25,6 +23,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; TileObjectData.addAlternate(1); diff --git a/Tiles/FurnitureMonolith/MonolithBathtub.cs b/Tiles/FurnitureMonolith/MonolithBathtub.cs index 5aae1e2385..b73e969cec 100644 --- a/Tiles/FurnitureMonolith/MonolithBathtub.cs +++ b/Tiles/FurnitureMonolith/MonolithBathtub.cs @@ -22,26 +22,16 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBathtubGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - 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; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithBed.cs b/Tiles/FurnitureMonolith/MonolithBed.cs index 6ae7cbfc5e..12feb19543 100644 --- a/Tiles/FurnitureMonolith/MonolithBed.cs +++ b/Tiles/FurnitureMonolith/MonolithBed.cs @@ -24,28 +24,18 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBedGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); diff --git a/Tiles/FurnitureMonolith/MonolithBench.cs b/Tiles/FurnitureMonolith/MonolithBench.cs index 0400bf17ab..ed8dfb3702 100644 --- a/Tiles/FurnitureMonolith/MonolithBench.cs +++ b/Tiles/FurnitureMonolith/MonolithBench.cs @@ -25,28 +25,18 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBenchGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 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); diff --git a/Tiles/FurnitureMonolith/MonolithBookcase.cs b/Tiles/FurnitureMonolith/MonolithBookcase.cs index 60e6ef752a..f0f2539b8a 100644 --- a/Tiles/FurnitureMonolith/MonolithBookcase.cs +++ b/Tiles/FurnitureMonolith/MonolithBookcase.cs @@ -23,26 +23,16 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBookcaseGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - 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; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithCandelabra.cs b/Tiles/FurnitureMonolith/MonolithCandelabra.cs index 19f60bb71e..f473367d54 100644 --- a/Tiles/FurnitureMonolith/MonolithCandelabra.cs +++ b/Tiles/FurnitureMonolith/MonolithCandelabra.cs @@ -23,10 +23,13 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithCandelabraGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -35,19 +38,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithCandle.cs b/Tiles/FurnitureMonolith/MonolithCandle.cs index 33fdb3f075..de740ac133 100644 --- a/Tiles/FurnitureMonolith/MonolithCandle.cs +++ b/Tiles/FurnitureMonolith/MonolithCandle.cs @@ -23,10 +23,13 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithCandleGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y - 4) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 20)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -35,19 +38,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 20)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithChair.cs b/Tiles/FurnitureMonolith/MonolithChair.cs index 408a20c2e3..db53d4f6a4 100644 --- a/Tiles/FurnitureMonolith/MonolithChair.cs +++ b/Tiles/FurnitureMonolith/MonolithChair.cs @@ -26,28 +26,18 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChairGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); diff --git a/Tiles/FurnitureMonolith/MonolithChandelier.cs b/Tiles/FurnitureMonolith/MonolithChandelier.cs index 8ff78595b1..45753af8b7 100644 --- a/Tiles/FurnitureMonolith/MonolithChandelier.cs +++ b/Tiles/FurnitureMonolith/MonolithChandelier.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureMonolith { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + 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); @@ -23,10 +25,13 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChandelierGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -35,19 +40,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithChest.cs b/Tiles/FurnitureMonolith/MonolithChest.cs index 435852091e..1f294cf3d9 100644 --- a/Tiles/FurnitureMonolith/MonolithChest.cs +++ b/Tiles/FurnitureMonolith/MonolithChest.cs @@ -7,6 +7,7 @@ using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureMonolith { @@ -63,26 +64,22 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChestGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); - 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; - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } + Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; - 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; + int xPos = tile.TileFrameX; + int yPos = tile.TileFrameY; + int chestIndex = Chest.FindChest(i - (xPos / 18), j - (yPos / 18)); + if (chestIndex == -1) + return; + + int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChestGlow").Value; + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)); + Rectangle frame = new Rectangle(xPos, yPos + Main.chest[chestIndex].frame * 38, 18, 18); + Main.spriteBatch.Draw(glowmask, drawOffset, frame, drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } } diff --git a/Tiles/FurnitureMonolith/MonolithClock.cs b/Tiles/FurnitureMonolith/MonolithClock.cs index bbb8bcad8a..6dae46ac7d 100644 --- a/Tiles/FurnitureMonolith/MonolithClock.cs +++ b/Tiles/FurnitureMonolith/MonolithClock.cs @@ -26,28 +26,18 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithClockGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); diff --git a/Tiles/FurnitureMonolith/MonolithDoorClosed.cs b/Tiles/FurnitureMonolith/MonolithDoorClosed.cs index 2303eff699..52b85d4d81 100644 --- a/Tiles/FurnitureMonolith/MonolithDoorClosed.cs +++ b/Tiles/FurnitureMonolith/MonolithDoorClosed.cs @@ -29,28 +29,18 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithDoorClosedGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureMonolith/MonolithDoorOpen.cs b/Tiles/FurnitureMonolith/MonolithDoorOpen.cs index d2c66a4142..782985f901 100644 --- a/Tiles/FurnitureMonolith/MonolithDoorOpen.cs +++ b/Tiles/FurnitureMonolith/MonolithDoorOpen.cs @@ -30,28 +30,18 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithDoorOpenGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureMonolith/MonolithDresser.cs b/Tiles/FurnitureMonolith/MonolithDresser.cs index 605738a453..fb8af48ee6 100644 --- a/Tiles/FurnitureMonolith/MonolithDresser.cs +++ b/Tiles/FurnitureMonolith/MonolithDresser.cs @@ -32,26 +32,16 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithDresserGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - 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; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithLamp.cs b/Tiles/FurnitureMonolith/MonolithLamp.cs index 7f89e56e52..eb49dc8399 100644 --- a/Tiles/FurnitureMonolith/MonolithLamp.cs +++ b/Tiles/FurnitureMonolith/MonolithLamp.cs @@ -23,10 +23,13 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithLampGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -35,19 +38,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithLantern.cs b/Tiles/FurnitureMonolith/MonolithLantern.cs index 4b4e8d8d3f..c5a2cc2c2e 100644 --- a/Tiles/FurnitureMonolith/MonolithLantern.cs +++ b/Tiles/FurnitureMonolith/MonolithLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public class MonolithLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { @@ -24,10 +24,13 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithLanternGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -36,19 +39,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - 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 void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithPiano.cs b/Tiles/FurnitureMonolith/MonolithPiano.cs index d32029c9ba..707a910882 100644 --- a/Tiles/FurnitureMonolith/MonolithPiano.cs +++ b/Tiles/FurnitureMonolith/MonolithPiano.cs @@ -25,26 +25,16 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithPianoGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - 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; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithSink.cs b/Tiles/FurnitureMonolith/MonolithSink.cs index bd5897d062..3af8655a3e 100644 --- a/Tiles/FurnitureMonolith/MonolithSink.cs +++ b/Tiles/FurnitureMonolith/MonolithSink.cs @@ -23,26 +23,16 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithSinkGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - 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; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithTable.cs b/Tiles/FurnitureMonolith/MonolithTable.cs index 484b6f4ec1..183aa97e60 100644 --- a/Tiles/FurnitureMonolith/MonolithTable.cs +++ b/Tiles/FurnitureMonolith/MonolithTable.cs @@ -23,26 +23,16 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithTableGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - 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; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithWorkbench.cs b/Tiles/FurnitureMonolith/MonolithWorkbench.cs index 2734e9dbbf..4e27709e66 100644 --- a/Tiles/FurnitureMonolith/MonolithWorkbench.cs +++ b/Tiles/FurnitureMonolith/MonolithWorkbench.cs @@ -23,26 +23,16 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithWorkBenchGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); 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; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - 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; - } } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs b/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs index aa79b1dacc..7180331195 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,8 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + 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(125, 94, 128), 1f); diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs b/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs index 4b710c4096..919c12d846 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public class OtherworldlyLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs index 7c3049f1ed..3948395809 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs @@ -51,9 +51,12 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + 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 drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); Texture2D cloth = ModContent.Request("CalamityMod/Tiles/FurnitureOtherworldly/OtherworldlyStone_Cloth").Value; DrawExtraTop(i, j, cloth, drawOffset, drawColour); @@ -183,27 +186,6 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly return Main.tile[i + x, j - y].TileType == type == equal; } - private Color GetDrawColour(int i, int j) - { - int colType = Main.tile[i, j].TileColor; - 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; - } - private int GetExtraState(string type) { switch (type) diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs index 1cebc94b13..be6084f4d0 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs @@ -3,14 +3,17 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate { - public class PlaguedPlate : ModTile + public class PlaguedPlate : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/FurniturePlaguedPlate/PlaguedPlateGlow"; + + public override void SetupStatic() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -30,34 +33,14 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate num = fail ? 1 : 3; } + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) + { + return new Color(128, 128, 128); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { return TileFramingSystem.BrimstoneFraming(i, j, resetFrame); } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurniturePlaguedPlate/PlaguedPlateGlow").Value; - 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, new Color(128, 128, 128, 128)); - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, 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; - } } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index 65721061b7..6e6dc45c34 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -16,14 +16,16 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; + TileID.Sets.InteractibleByNPCs[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.IsValidSpawnPoint[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); //This bed has different dimensions to conventional beds, using bookcase dimentions instead TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; TileObjectData.addTile(Type); - AddMapEntry(new Color(191, 142, 111), CreateMapEntryName()); - TileID.Sets.DisableSmartCursor[Type] = true; - AdjTiles = new int[] { TileID.Beds }; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + AddMapEntry(new Color(191, 142, 111), CreateMapEntryName()); + AdjTiles = new int[] { TileID.Beds }; } public override bool CreateDust(int i, int j, ref int type) @@ -51,12 +53,12 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate if (player.SpawnX == spawnX && player.SpawnY == spawnY) { player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20); + Main.NewText(Language.GetTextValue("Game.SpawnPointRemoved"), 255, 240, 20); } else if (Player.CheckSpawn(spawnX, spawnY)) { player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20); + Main.NewText(Language.GetTextValue("Game.SpawnPointSet"), 255, 240, 20); } return true; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index 469a785fbf..ff026cfb60 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 1917926843..98a049ecd6 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public class PlaguedPlateLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.cs b/Tiles/FurnitureProfaned/ProfanedChandelier.cs index 770ca87660..c832c859ce 100644 --- a/Tiles/FurnitureProfaned/ProfanedChandelier.cs +++ b/Tiles/FurnitureProfaned/ProfanedChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.cs b/Tiles/FurnitureProfaned/ProfanedLantern.cs index 229ad1e00d..7435eaccba 100644 --- a/Tiles/FurnitureProfaned/ProfanedLantern.cs +++ b/Tiles/FurnitureProfaned/ProfanedLantern.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public class ProfanedLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureProfaned/ProfanedRock.cs b/Tiles/FurnitureProfaned/ProfanedRock.cs index 609d66f9b3..8aaa7b04f4 100644 --- a/Tiles/FurnitureProfaned/ProfanedRock.cs +++ b/Tiles/FurnitureProfaned/ProfanedRock.cs @@ -4,14 +4,19 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedRock : ModTile + public class ProfanedRock : GlowMaskTile { - public override void SetStaticDefaults() + public const int AnimationFrameWidth = 288; + + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureProfaned/ProfanedRockGlow"; + + public override void SetupStatic() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -26,7 +31,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned MinPick = 225; AddMapEntry(new Color(84, 38, 33)); } - int animationFrameWidth = 288; + + public override bool CreateDust(int i, int j, ref int type) { @@ -37,207 +43,12 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 2; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = AnimationFrameWidth * TileFramingSystem.GetVariation4x4_012_Low0(i, j); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - int xOffset = 0; - int relativeXPos = i % 4; - int relativeYPos = j % 4; - switch (relativeXPos) - { - case 0: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 1: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 2; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 2: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 3: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 0; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - } - xOffset *= 288; - xPos += xOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/ProfanedRockGlow").Value; - 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, new Color(25, 25, 25, 25)); - Tile trackTile = Main.tile[i, j]; - - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, 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; + return Color.White * 0.098f; } } } diff --git a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs index d734338fe6..059beaa28e 100644 --- a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs @@ -4,14 +4,19 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned { - public class RunicProfanedBrick : ModTile + public class RunicProfanedBrick : GlowMaskTile { - public override void SetStaticDefaults() + public const int AnimationFrameWidth = 234; + + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureProfaned/RunicProfanedBrickGlow"; + + public override void SetupStatic() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -25,7 +30,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned AddMapEntry(new Color(122, 66, 59)); AnimationFrameHeight = 90; } - int animationFrameWidth = 234; public override bool CreateDust(int i, int j, ref int type) { @@ -36,40 +40,13 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - frameXOffset = i % 2 * animationFrameWidth; + frameXOffset = i % 2 * AnimationFrameWidth; frameYOffset = j % 2 * AnimationFrameHeight; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - int xOffset = i % 2; - int yOffset = j % 2; - xOffset *= animationFrameWidth; - yOffset *= AnimationFrameHeight; - xPos += xOffset; - yPos += yOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/RunicProfanedBrickGlow").Value; - 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, new Color(128, 128, 128, 128)); - Tile trackTile = Main.tile[i, j]; - - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, 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; + return Color.White * 0.5f; } } } diff --git a/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs index dff5f15e7c..91f7ed6e09 100644 --- a/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs +++ b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; + TileID.Sets.MultiTileSway[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.LavaDeath = false; @@ -37,6 +38,6 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Banner")); } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); } } diff --git a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs index 2632347f0f..8f5c54035c 100644 --- a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs +++ b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs @@ -14,8 +14,10 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { public override void SetStaticDefaults() { + // Due to how Ritual Candles are implemented (right click to swap styles), item drop for the alternate style will never register normally. RegisterItemDrop(ModContent.ItemType()); + Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; @@ -33,11 +35,13 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.StyleLineSkip = 4; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.addTile(Type); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(43, 19, 42), Language.GetText("Large Ritual Candle")); + AddMapEntry(new Color(43, 19, 42), CalamityUtils.GetItemName()); TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Lamps }; @@ -57,7 +61,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].TileFrameX < 54) + if (Main.tile[i, j].TileFrameX < 36) { r = 3f; g = 0.6f; @@ -73,7 +77,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 4, 6); + CalamityUtils.LightHitWire(Type, i, j, 2, 6); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.png b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.png index c308ab6c18..c23f99a9cb 100644 Binary files a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.png and b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.png differ diff --git a/Tiles/FurnitureSacrilegious/LargeRitualCandleTileFlame.png b/Tiles/FurnitureSacrilegious/LargeRitualCandleTileFlame.png index a2af2ce410..298e9fc578 100644 Binary files a/Tiles/FurnitureSacrilegious/LargeRitualCandleTileFlame.png and b/Tiles/FurnitureSacrilegious/LargeRitualCandleTileFlame.png differ diff --git a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs index 2a52e46a60..84314f6124 100644 --- a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs +++ b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { public override void SetStaticDefaults() { - RegisterItemDrop(ModContent.ItemType()); Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -33,6 +32,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious TileObjectData.newTile.Origin = new Point16(0, 1); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 3; TileObjectData.addTile(Type); TileID.Sets.HasOutlines[Type] = true; @@ -99,6 +100,9 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious } } } + + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendTileSquare(-1, x, y, tileX, tileY); } public override bool RightClick(int i, int j) @@ -135,7 +139,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious // For drawing the floating icon public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - if (Main.tile[i, j].TileFrameX < 36) + if (Main.tile[i, j].TileFrameX < 36 || Main.tile[i, j].IsTileActuallyInvisible()) return; Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_IconRight").Value; diff --git a/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs index 30ad06d0e1..ec3269d7c3 100644 --- a/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs +++ b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; + TileID.Sets.MultiTileSway[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.LavaDeath = false; @@ -37,6 +38,6 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Banner")); } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); } } diff --git a/Tiles/FurnitureSacrilegious/RitualCandleTile.cs b/Tiles/FurnitureSacrilegious/RitualCandleTile.cs index 1803f16fbd..4ee27065e2 100644 --- a/Tiles/FurnitureSacrilegious/RitualCandleTile.cs +++ b/Tiles/FurnitureSacrilegious/RitualCandleTile.cs @@ -15,8 +15,10 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { public override void SetStaticDefaults() { + // Due to how Ritual Candles are implemented (right click to swap styles), item drop for the alternate style will never register normally. RegisterItemDrop(ModContent.ItemType()); + Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; @@ -31,11 +33,13 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.StyleLineSkip = 4; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.addTile(Type); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(43, 19, 42), Language.GetText("Ritual Candle")); + AddMapEntry(new Color(43, 19, 42), CalamityUtils.GetItemName()); TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Candles }; @@ -54,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].TileFrameX < 54) + if (Main.tile[i, j].TileFrameX < 36) { r = 3f; g = 0.6f; @@ -70,7 +74,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 4, 2); + CalamityUtils.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureSacrilegious/RitualCandleTile.png b/Tiles/FurnitureSacrilegious/RitualCandleTile.png index 79a1010eeb..9bff0eb18f 100644 Binary files a/Tiles/FurnitureSacrilegious/RitualCandleTile.png and b/Tiles/FurnitureSacrilegious/RitualCandleTile.png differ diff --git a/Tiles/FurnitureSacrilegious/RitualCandleTileFlame.png b/Tiles/FurnitureSacrilegious/RitualCandleTileFlame.png index 2136a81be0..56e38aadc4 100644 Binary files a/Tiles/FurnitureSacrilegious/RitualCandleTileFlame.png and b/Tiles/FurnitureSacrilegious/RitualCandleTileFlame.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs index 1c45c5d278..07e16cb3d6 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs index ec62598f02..6623d83277 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs @@ -42,6 +42,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious itemAmt = CountItems(Main.chest[index]); Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousChestTileGlow").Value; int x = i; diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs index 94b8795431..baf4ba6e2e 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs @@ -58,6 +58,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousClockTile_Icon").Value; Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; int xPos = tile.TileFrameX; int yPos = tile.TileFrameY; diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs index ce4ead0866..3b46b8500e 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public class SacrilegiousLanternTile : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureSilva/SilvaChandelier.cs b/Tiles/FurnitureSilva/SilvaChandelier.cs index ad6a0e8867..effeefc0c4 100644 --- a/Tiles/FurnitureSilva/SilvaChandelier.cs +++ b/Tiles/FurnitureSilva/SilvaChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + 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); diff --git a/Tiles/FurnitureSilva/SilvaLantern.cs b/Tiles/FurnitureSilva/SilvaLantern.cs index e0b314a458..50b226b3fd 100644 --- a/Tiles/FurnitureSilva/SilvaLantern.cs +++ b/Tiles/FurnitureSilva/SilvaLantern.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public class SilvaLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureStatigel/StatigelChandelier.cs b/Tiles/FurnitureStatigel/StatigelChandelier.cs index 06f8b15c1c..affdc54698 100644 --- a/Tiles/FurnitureStatigel/StatigelChandelier.cs +++ b/Tiles/FurnitureStatigel/StatigelChandelier.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType()); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureStatigel/StatigelLantern.cs b/Tiles/FurnitureStatigel/StatigelLantern.cs index 7beb0067ee..5d09bb13e9 100644 --- a/Tiles/FurnitureStatigel/StatigelLantern.cs +++ b/Tiles/FurnitureStatigel/StatigelLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public class StatigelLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureStratus/StratusBricks.cs b/Tiles/FurnitureStratus/StratusBricks.cs index 5f124a73a4..74a2e92c79 100644 --- a/Tiles/FurnitureStratus/StratusBricks.cs +++ b/Tiles/FurnitureStratus/StratusBricks.cs @@ -3,14 +3,17 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus { - public class StratusBricks : ModTile + public class StratusBricks : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureStratus/StratusBricksGlow"; + + public override void SetupStatic() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -30,35 +33,14 @@ namespace CalamityMod.Tiles.FurnitureStratus return false; } + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) + { + return new Color(100, 100, 100); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusBricksGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); - 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; - Tile trackTile = Main.tile[i, j]; - - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, 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; - } } } diff --git a/Tiles/FurnitureStratus/StratusChandelier.cs b/Tiles/FurnitureStratus/StratusChandelier.cs index 28a737cc49..c8b6e76bca 100644 --- a/Tiles/FurnitureStratus/StratusChandelier.cs +++ b/Tiles/FurnitureStratus/StratusChandelier.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + 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(100, 130, 150), 1f); diff --git a/Tiles/FurnitureStratus/StratusLantern.cs b/Tiles/FurnitureStratus/StratusLantern.cs index 1d1d371aef..be68e423d0 100644 --- a/Tiles/FurnitureStratus/StratusLantern.cs +++ b/Tiles/FurnitureStratus/StratusLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public class StratusLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureStratus/StratusPlatform.cs b/Tiles/FurnitureStratus/StratusPlatform.cs index 30d7e3c11e..fbe4bab57c 100644 --- a/Tiles/FurnitureStratus/StratusPlatform.cs +++ b/Tiles/FurnitureStratus/StratusPlatform.cs @@ -24,6 +24,9 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusPlatformGlow").Value; diff --git a/Tiles/FurnitureStratus/StratusStarPlatform.cs b/Tiles/FurnitureStratus/StratusStarPlatform.cs index ba79bc569f..ff5228198c 100644 --- a/Tiles/FurnitureStratus/StratusStarPlatform.cs +++ b/Tiles/FurnitureStratus/StratusStarPlatform.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusStarPlatformGlow").Value; diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index cc0cf79aa6..530df2f4ff 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -4,14 +4,17 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid { - public class SmoothVoidstone : ModTile + public class SmoothVoidstone : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureVoid/SmoothVoidstoneGlow"; + + public override void SetupStatic() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -26,6 +29,7 @@ namespace CalamityMod.Tiles.FurnitureVoid MineResist = 2.1f; AddMapEntry(new Color(27, 24, 31)); } + int animationFrameWidth = 288; public override bool CreateDust(int i, int j, ref int type) @@ -36,214 +40,18 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 1; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 1; - break; - default: - uniqueAnimationFrameX = 0; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = animationFrameWidth * TileFramingSystem.GetVariation4x4_01_Low0(i, j); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - int xOffset = 0; - int relativeXPos = i % 4; - int relativeYPos = j % 4; - switch (relativeXPos) - { - case 0: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 1; - break; - default: - xOffset = 0; - break; - } - break; - case 1: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 1; - break; - default: - xOffset = 0; - break; - } - break; - case 2: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 0; - break; - case 3: - xOffset = 1; - break; - default: - xOffset = 0; - break; - } - break; - case 3: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 1; - break; - case 2: - xOffset = 0; - break; - case 3: - xOffset = 1; - break; - default: - xOffset = 0; - break; - } - break; - } - xOffset *= 288; - xPos += xOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureVoid/SmoothVoidstoneGlow").Value; - 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, new Color(255, 255, 255, 255)); - Tile trackTile = Main.tile[i, j]; float brightness = 1f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; - brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawColour *= brightness; - - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, 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; + float timeFactor = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + timeFactor); + brightness *= (float)MathF.Sin(j / 18f + timeFactor); + brightness *= (float)MathF.Sin(i * 18f + timeFactor); + brightness *= (float)MathF.Sin(j * 18f + timeFactor); + return Color.White * brightness; } } } diff --git a/Tiles/FurnitureVoid/VoidChandelier.cs b/Tiles/FurnitureVoid/VoidChandelier.cs index 46887dfd37..eb73bf5328 100644 --- a/Tiles/FurnitureVoid/VoidChandelier.cs +++ b/Tiles/FurnitureVoid/VoidChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureVoid/VoidLantern.cs b/Tiles/FurnitureVoid/VoidLantern.cs index 0d0c1d666b..64c198cd39 100644 --- a/Tiles/FurnitureVoid/VoidLantern.cs +++ b/Tiles/FurnitureVoid/VoidLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public class VoidLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureVoid/VoidstoneSlab.cs b/Tiles/FurnitureVoid/VoidstoneSlab.cs index 1acda50480..eb5b1e2f82 100644 --- a/Tiles/FurnitureVoid/VoidstoneSlab.cs +++ b/Tiles/FurnitureVoid/VoidstoneSlab.cs @@ -1,14 +1,18 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid { - public class VoidstoneSlab : ModTile + public class VoidstoneSlab : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/FurnitureVoid/VoidstoneSlabGlow"; + + public override void SetupStatic() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -28,159 +32,12 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrame = Main.tileFrame[Type] + i; - int xPos = i % 3; - int yPos = j % 3; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrame = 0; - break; - case 1: - uniqueAnimationFrame = 1; - break; - case 2: - uniqueAnimationFrame = 2; - break; - default: - uniqueAnimationFrame = 0; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrame = 2; - break; - case 1: - uniqueAnimationFrame = 3; - break; - case 2: - uniqueAnimationFrame = 4; - break; - default: - uniqueAnimationFrame = 0; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrame = 4; - break; - case 1: - uniqueAnimationFrame = 0; - break; - case 2: - uniqueAnimationFrame = 1; - break; - default: - uniqueAnimationFrame = 0; - break; - } - break; - } - - frameYOffset = uniqueAnimationFrame * AnimationFrameHeight; + frameYOffset = AnimationFrameHeight * TileFramingSystem.GetVariation3x3_01234_Low3(i, j); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - if (Main.tile[i, j].TileType == ModContent.TileType()) - { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - int yOffset = 0; - int relavtiveXPos = i % 3; - int relavtiveYPos = j % 3; - switch (relavtiveXPos) - { - case 0: - switch (relavtiveYPos) - { - case 0: - yOffset = 0; - break; - case 1: - yOffset = 1; - break; - case 2: - yOffset = 2; - break; - default: - yOffset = 0; - break; - } - break; - case 1: - switch (relavtiveYPos) - { - case 0: - yOffset = 2; - break; - case 1: - yOffset = 3; - break; - case 2: - yOffset = 4; - break; - default: - yOffset = 0; - break; - } - break; - case 2: - switch (relavtiveYPos) - { - case 0: - yOffset = 4; - break; - case 1: - yOffset = 0; - break; - case 2: - yOffset = 1; - break; - default: - yOffset = 0; - break; - } - break; - } - yOffset *= 270; - yPos += yOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureVoid/VoidstoneSlabGlow").Value; - 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, new Color(75, 75, 75, 75)); - Tile trackTile = Main.tile[i, j]; - if (!trackTile.IsHalfBlock && trackTile.Slope == 0) - { - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - else if (trackTile.IsHalfBlock) - { - 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); - } - } - } - - 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; + return new Color(75, 75, 75); } } } diff --git a/Tiles/FurnitureWulfrum/WulfrumBathtub.cs b/Tiles/FurnitureWulfrum/WulfrumBathtub.cs index 269e53f673..b3c983a646 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBathtub.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBathtub.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumBathtubGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumBed.cs b/Tiles/FurnitureWulfrum/WulfrumBed.cs index 76db64317d..9c10c99de0 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBed.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBed.cs @@ -32,6 +32,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumBedGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumBookcase.cs b/Tiles/FurnitureWulfrum/WulfrumBookcase.cs index 236092fa3f..e54e9c83a4 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBookcase.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBookcase.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumBookcaseGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumChair.cs b/Tiles/FurnitureWulfrum/WulfrumChair.cs index a61c5bc2d6..107952e5a7 100644 --- a/Tiles/FurnitureWulfrum/WulfrumChair.cs +++ b/Tiles/FurnitureWulfrum/WulfrumChair.cs @@ -16,8 +16,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { public override void SetStaticDefaults() { - RegisterItemDrop(ModContent.ItemType()); - Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; @@ -28,6 +26,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.Origin = new Point16(1, 1); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); @@ -61,6 +60,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumChairGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumChandelier.cs b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs index b215a6ebce..24089c07cd 100644 --- a/Tiles/FurnitureWulfrum/WulfrumChandelier.cs +++ b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; + TileID.Sets.MultiTileSway[Type] = true; TileObjectData.newTile.Width = 3; TileObjectData.newTile.Height = 2; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; @@ -32,6 +33,8 @@ namespace CalamityMod.Tiles.FurnitureWulfrum AdjTiles = new int[] { TileID.Chandeliers }; } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureWulfrum/WulfrumClock.cs b/Tiles/FurnitureWulfrum/WulfrumClock.cs index 208d0620c1..459a59ed7a 100644 --- a/Tiles/FurnitureWulfrum/WulfrumClock.cs +++ b/Tiles/FurnitureWulfrum/WulfrumClock.cs @@ -40,6 +40,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumClockGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumDresser.cs b/Tiles/FurnitureWulfrum/WulfrumDresser.cs index 32f7df8139..813b797955 100644 --- a/Tiles/FurnitureWulfrum/WulfrumDresser.cs +++ b/Tiles/FurnitureWulfrum/WulfrumDresser.cs @@ -33,6 +33,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumDresserGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumLantern.cs b/Tiles/FurnitureWulfrum/WulfrumLantern.cs index 1d01fa6eed..01b9749e60 100644 --- a/Tiles/FurnitureWulfrum/WulfrumLantern.cs +++ b/Tiles/FurnitureWulfrum/WulfrumLantern.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum AdjTiles = new int[] { TileID.HangingLanterns }; } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CanExplode(int i, int j) => false; diff --git a/Tiles/FurnitureWulfrum/WulfrumPiano.cs b/Tiles/FurnitureWulfrum/WulfrumPiano.cs index 0cc9b3b7aa..6c695135ba 100644 --- a/Tiles/FurnitureWulfrum/WulfrumPiano.cs +++ b/Tiles/FurnitureWulfrum/WulfrumPiano.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumPianoGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumSink.cs b/Tiles/FurnitureWulfrum/WulfrumSink.cs index fccf48585d..57bb0247c1 100644 --- a/Tiles/FurnitureWulfrum/WulfrumSink.cs +++ b/Tiles/FurnitureWulfrum/WulfrumSink.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumSinkGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumSofa.cs b/Tiles/FurnitureWulfrum/WulfrumSofa.cs index fd7f798acb..33bfbecd49 100644 --- a/Tiles/FurnitureWulfrum/WulfrumSofa.cs +++ b/Tiles/FurnitureWulfrum/WulfrumSofa.cs @@ -39,6 +39,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumSofaGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumTable.cs b/Tiles/FurnitureWulfrum/WulfrumTable.cs index cf8885358f..a24280edb6 100644 --- a/Tiles/FurnitureWulfrum/WulfrumTable.cs +++ b/Tiles/FurnitureWulfrum/WulfrumTable.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumTableGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumToilet.cs b/Tiles/FurnitureWulfrum/WulfrumToilet.cs index 01058b3270..81e68d00a2 100644 --- a/Tiles/FurnitureWulfrum/WulfrumToilet.cs +++ b/Tiles/FurnitureWulfrum/WulfrumToilet.cs @@ -17,8 +17,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public const int NextStyleHeight = 40; public override void SetStaticDefaults() { - RegisterItemDrop(ModContent.ItemType()); - Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; @@ -29,6 +27,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.Origin = new Point16(1, 1); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); @@ -62,6 +61,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumToiletGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs b/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs index 8a1c0f64e5..9d88b5b592 100644 --- a/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs +++ b/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs @@ -29,6 +29,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request(Texture + "Glow").Value; diff --git a/Tiles/GiantPlanteraBulb.cs b/Tiles/GiantPlanteraBulb.cs index f2c9e3c6d7..dfb8727821 100644 --- a/Tiles/GiantPlanteraBulb.cs +++ b/Tiles/GiantPlanteraBulb.cs @@ -13,20 +13,14 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles { - public class GiantPlanteraBulb : ModTile + public class GiantPlanteraBulb : GlowMaskTile { - public static Asset Glow { get; private set; } + public override string GlowMaskAsset => $"{Texture}Glow"; - public override void Load() + public override void SetupStatic() { - if (!Main.dedServ) - { - Glow = ModContent.Request($"{Texture}Glow"); - } - } + GlowMaskPaintInteraction = PaintColorTint.None; - public override void SetStaticDefaults() - { // Tile can provide light Main.tileLighted[Type] = true; @@ -65,12 +59,6 @@ namespace CalamityMod.Tiles HitSound = SoundID.Grass; } - public override void Unload() - { - // Textures are auto disposed by tModLoader, all we need to do is get rid of the asset wrapper reference - Glow = null; - } - // Use the second map entry in Hardmode public override ushort GetMapOption(int i, int j) { @@ -201,16 +189,9 @@ namespace CalamityMod.Tiles } } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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), - Color.Yellow - ); + return Color.Yellow; } } } diff --git a/Tiles/GlowMaskCactus.cs b/Tiles/GlowMaskCactus.cs new file mode 100644 index 0000000000..7232b67601 --- /dev/null +++ b/Tiles/GlowMaskCactus.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.GameContent.RGB; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public abstract class GlowMaskCactus : ModCactus + { + public abstract Asset GetFruitGlowTexture(); + public abstract Asset GetGlowTexture(); + + public abstract Color GetGlowColor(int i, int j); + } +} diff --git a/Tiles/GlowMaskPalmTree.cs b/Tiles/GlowMaskPalmTree.cs new file mode 100644 index 0000000000..ce30f5374c --- /dev/null +++ b/Tiles/GlowMaskPalmTree.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public abstract class GlowMaskPalmTree : ModPalmTree + { + public abstract Asset GetOasisTopGlowTextures(); + public abstract Asset GetGlowTexture(); + public abstract Asset GetTopGlowTextures(); + + public abstract Color GetGlowColor(int i, int j); + } +} diff --git a/Tiles/GlowMaskTile.cs b/Tiles/GlowMaskTile.cs new file mode 100644 index 0000000000..8cbef860ca --- /dev/null +++ b/Tiles/GlowMaskTile.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public abstract class GlowMaskTile : ModTile + { + public enum PaintColorTint + { + OnlyByDeepPaint, + ByEveryPaint, + None, + } + + public FramedMaskTexture GlowMask; + + internal static GlowMaskTile[] InstanceLookup; // This Lookup is Array for performances sake + internal static int LookupLength; + + public PaintColorTint GlowMaskPaintInteraction = PaintColorTint.OnlyByDeepPaint; + public bool GlowMaskAffectedByLight = true; + public bool GlowMaskCanBeCulled = true; + + public abstract string GlowMaskAsset { get; } + + public sealed override void SetStaticDefaults() + { + if (GlowMask != null) + { + CalamityMod.Instance.Logger.Error($"{Name} has called {nameof(SetStaticDefaults)} themselve! This is not allowed!"); + return; + } + + GlowMask = new(GlowMaskAsset, 18, 18); + + InstanceLookup ??= new GlowMaskTile[TileLoader.TileCount]; + LookupLength = InstanceLookup.Length; + + InstanceLookup[Type] = this; + + SetupStatic(); + } + + public sealed override void Unload() + { + GlowMask?.Unload(); + GlowMask = null; + + InstanceLookup = null; + + OnUnload(); + } + + public virtual void SetupStatic() { } + + public virtual void OnUnload() { } + + public abstract Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData); + } +} diff --git a/Tiles/GlowMaskTree.cs b/Tiles/GlowMaskTree.cs new file mode 100644 index 0000000000..8e252b39e2 --- /dev/null +++ b/Tiles/GlowMaskTree.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public struct GlowMaskPlantDrawInfo + { + public Texture2D Texture; + public Color Color; + } + + public abstract class GlowMaskTree : ModTree + { + public abstract Asset GetGlowTexture(); + public abstract Asset GetTopGlowTextures(); + public abstract Asset GetBranchGlowTextures(); + + public abstract Color GetGlowColor(int i, int j); + } +} diff --git a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs index d47571bd64..ddaee0e086 100644 --- a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs +++ b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs @@ -1,83 +1,25 @@ -using System.Collections.Generic; -using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.LivingFire; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ObjectData; + namespace CalamityMod.Tiles.LivingFire { public class LivingBrimstoneFireBlockTile : ModTile { - //Thank you to Seraph for getting living fire blocks to work properly. public override void SetStaticDefaults() { Main.tileLighted[Type] = true; - HitSound = SoundID.Dig; + TileID.Sets.CanPlaceNextToNonSolidTile[Type] = true; + DustType = (int)CalamityDusts.Brimstone; AddMapEntry(new Color(178, 34, 34)); AnimationFrameHeight = 90; - Main.tileSolid[Type] = false; - Main.tileNoAttach[Type] = false; - Main.tileFrameImportant[Type] = false; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 1; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); - - TileObjectData.addTile(Type); } - public int CanPlaceAlter(int i, int j, int type, int style, int direction, int alternate) => 1; + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; - public static int AfterPlacement(int i, int j, int type, int style, int direction, int alternate) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(Main.myPlayer, i, j, 1, 1); - } - return 1; - } - - public override bool CanPlace(int i, int j) - { - List> around = new List> - { - new List() {i, j-1 }, - new List() {i-1, j }, - new List() {i+1, j }, - new List() {i, j+1 } - }; - //if (Main.tile[i, j]) || tile.type == Type - - //return true; //temporary for testing purposes - - if (Main.tile[i, j].WallType != WallID.None) - { - return true; - } - - for (int k = 0; k < around.Count; ++k) - { - Tile tile = Main.tile[around[k][0], around[k][1]]; - if (tile.HasTile && (Main.tileSolid[tile.TileType] || CalamityLists.livingFireBlockList.Contains(tile.TileType))) - { - return true; - } - } - return false; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frame = Main.tileFrame[TileID.LivingFire]; - } + public override void AnimateTile(ref int frame, ref int frameCounter) => frame = Main.tileFrame[TileID.LivingFire]; public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { @@ -85,11 +27,5 @@ namespace CalamityMod.Tiles.LivingFire g = 0f; b = 0f; } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.Brimstone, 0f, 0f, 1, default, 1f); - return false; - } } } diff --git a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs index 688e1eef69..2ad8f0f689 100644 --- a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs +++ b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs @@ -1,12 +1,9 @@ -using System.Collections.Generic; -using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.LivingFire; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ObjectData; + namespace CalamityMod.Tiles.LivingFire { public class LivingGodSlayerFireBlockTile : ModTile @@ -14,69 +11,15 @@ namespace CalamityMod.Tiles.LivingFire public override void SetStaticDefaults() { Main.tileLighted[Type] = true; - HitSound = SoundID.Dig; + TileID.Sets.CanPlaceNextToNonSolidTile[Type] = true; + DustType = (int)CalamityDusts.PurpleCosmilite; AddMapEntry(new Color(186, 85, 211)); AnimationFrameHeight = 90; - Main.tileSolid[Type] = false; - Main.tileNoAttach[Type] = false; - Main.tileFrameImportant[Type] = false; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 1; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); - - TileObjectData.addTile(Type); } - public int CanPlaceAlter(int i, int j, int type, int style, int direction, int alternate) => 1; + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; - public static int AfterPlacement(int i, int j, int type, int style, int direction, int alternate) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(Main.myPlayer, i, j, 1, 1); - } - return 1; - } - - public override bool CanPlace(int i, int j) - { - List> around = new List> - { - new List() {i, j-1 }, - new List() {i-1, j }, - new List() {i+1, j }, - new List() {i, j+1 } - }; - //if (Main.tile[i, j]) || tile.type == Type - - //return true; //temporary for testing purposes - - if (Main.tile[i, j].WallType != WallID.None) - { - return true; - } - - for (int k = 0; k < around.Count; ++k) - { - Tile tile = Main.tile[around[k][0], around[k][1]]; - if (tile.HasTile && (Main.tileSolid[tile.TileType] || CalamityLists.livingFireBlockList.Contains(tile.TileType))) - { - return true; - } - } - return false; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frame = Main.tileFrame[TileID.LivingFire]; - } + public override void AnimateTile(ref int frame, ref int frameCounter) => frame = Main.tileFrame[TileID.LivingFire]; public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { @@ -84,11 +27,5 @@ namespace CalamityMod.Tiles.LivingFire g = 0f; b = 1f; } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 1, default, 1f); - return false; - } } } diff --git a/Tiles/LivingFire/LivingHolyFireBlockTile.cs b/Tiles/LivingFire/LivingHolyFireBlockTile.cs index 82a99923db..51d1319a34 100644 --- a/Tiles/LivingFire/LivingHolyFireBlockTile.cs +++ b/Tiles/LivingFire/LivingHolyFireBlockTile.cs @@ -1,12 +1,9 @@ -using System.Collections.Generic; -using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.LivingFire; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ObjectData; + namespace CalamityMod.Tiles.LivingFire { public class LivingHolyFireBlockTile : ModTile @@ -14,69 +11,15 @@ namespace CalamityMod.Tiles.LivingFire public override void SetStaticDefaults() { Main.tileLighted[Type] = true; - HitSound = SoundID.Dig; + TileID.Sets.CanPlaceNextToNonSolidTile[Type] = true; + DustType = (int)CalamityDusts.ProfanedFire; AddMapEntry(new Color(255, 215, 0)); AnimationFrameHeight = 90; - Main.tileSolid[Type] = false; - Main.tileNoAttach[Type] = false; - Main.tileFrameImportant[Type] = false; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 1; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); - - TileObjectData.addTile(Type); } - public int CanPlaceAlter(int i, int j, int type, int style, int direction, int alternate) => 1; + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; - public static int AfterPlacement(int i, int j, int type, int style, int direction, int alternate) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(Main.myPlayer, i, j, 1, 1); - } - return 1; - } - - public override bool CanPlace(int i, int j) - { - List> around = new List> - { - new List() {i, j-1 }, - new List() {i-1, j }, - new List() {i+1, j }, - new List() {i, j+1 } - }; - //if (Main.tile[i, j]) || tile.type == Type - - //return true; //temporary for testing purposes - - if (Main.tile[i, j].WallType != WallID.None) - { - return true; - } - - for (int k = 0; k < around.Count; ++k) - { - Tile tile = Main.tile[around[k][0], around[k][1]]; - if (tile.HasTile && (Main.tileSolid[tile.TileType] || CalamityLists.livingFireBlockList.Contains(tile.TileType))) - { - return true; - } - } - return false; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frame = Main.tileFrame[TileID.LivingFire]; - } + public override void AnimateTile(ref int frame, ref int frameCounter) => frame = Main.tileFrame[TileID.LivingFire]; public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { @@ -84,11 +27,5 @@ namespace CalamityMod.Tiles.LivingFire g = 1f; b = 0f; } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.ProfanedFire, 0f, 0f, 1, default, 1f); - return false; - } } } diff --git a/Tiles/LivingFire/LivingPlagueFireBlockTile.cs b/Tiles/LivingFire/LivingPlagueFireBlockTile.cs new file mode 100644 index 0000000000..7e30de8770 --- /dev/null +++ b/Tiles/LivingFire/LivingPlagueFireBlockTile.cs @@ -0,0 +1,32 @@ +using CalamityMod.Dusts; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.LivingFire +{ + public class LivingPlagueFireBlockTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + TileID.Sets.CanPlaceNextToNonSolidTile[Type] = true; + DustType = (int)CalamityDusts.Plague; + AddMapEntry(new Color(0, 171, 31)); + AnimationFrameHeight = 90; + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + + public override void AnimateTile(ref int frame, ref int frameCounter) => frame = Main.tileFrame[TileID.LivingFire]; + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0f; + g = 1f; + b = 0.2f; + } + } +} diff --git a/Tiles/LivingFire/LivingPlagueFireBlockTile.png b/Tiles/LivingFire/LivingPlagueFireBlockTile.png new file mode 100644 index 0000000000..2282b3ce0a Binary files /dev/null and b/Tiles/LivingFire/LivingPlagueFireBlockTile.png differ diff --git a/Tiles/Merges/AbyssGravelMerge.cs b/Tiles/Merges/AbyssGravelMerge.cs new file mode 100644 index 0000000000..30a16d02bd --- /dev/null +++ b/Tiles/Merges/AbyssGravelMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class AbyssGravelMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/AshMerge.cs b/Tiles/Merges/AshMerge.cs new file mode 100644 index 0000000000..0e40adacc3 --- /dev/null +++ b/Tiles/Merges/AshMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class AshMerge : TileBlendTexture + { + public override int TileType => TileID.Ash; + } +} diff --git a/Tiles/Merges/AstralDirtMerge.cs b/Tiles/Merges/AstralDirtMerge.cs new file mode 100644 index 0000000000..bd375f30ce --- /dev/null +++ b/Tiles/Merges/AstralDirtMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.Astral; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class AstralDirtMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/AstralSandMerge.cs b/Tiles/Merges/AstralSandMerge.cs new file mode 100644 index 0000000000..993c97bb4e --- /dev/null +++ b/Tiles/Merges/AstralSandMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.AstralDesert; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class AstralSandMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/AstralSandstoneMerge.cs b/Tiles/Merges/AstralSandstoneMerge.cs new file mode 100644 index 0000000000..83be67fd5b --- /dev/null +++ b/Tiles/Merges/AstralSandstoneMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.AstralDesert; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class AstralSandstoneMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/AstralSnowMerge.cs b/Tiles/Merges/AstralSnowMerge.cs new file mode 100644 index 0000000000..8b3719fbda --- /dev/null +++ b/Tiles/Merges/AstralSnowMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class AstralSnowMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/AstralSnowMerge.png b/Tiles/Merges/AstralSnowMerge.png index 405cb2e833..3ec74aa6a7 100644 Binary files a/Tiles/Merges/AstralSnowMerge.png and b/Tiles/Merges/AstralSnowMerge.png differ diff --git a/Tiles/Merges/BrimstoneSlagMerge.cs b/Tiles/Merges/BrimstoneSlagMerge.cs new file mode 100644 index 0000000000..e6839eab2c --- /dev/null +++ b/Tiles/Merges/BrimstoneSlagMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.Crags; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class BrimstoneSlagMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/CloudMerge.cs b/Tiles/Merges/CloudMerge.cs new file mode 100644 index 0000000000..486a71992f --- /dev/null +++ b/Tiles/Merges/CloudMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class CloudMerge : TileBlendTexture + { + public override int TileType => TileID.Cloud; + } +} diff --git a/Tiles/Merges/DirtMerge.cs b/Tiles/Merges/DirtMerge.cs new file mode 100644 index 0000000000..4b7fdf821f --- /dev/null +++ b/Tiles/Merges/DirtMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class DirtMerge : TileBlendTexture + { + public override int TileType => TileID.Dirt; + } +} diff --git a/Tiles/Merges/EutrophicSandMerge.cs b/Tiles/Merges/EutrophicSandMerge.cs new file mode 100644 index 0000000000..84f5014349 --- /dev/null +++ b/Tiles/Merges/EutrophicSandMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class EutrophicSandMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/HardenedSandMerge.cs b/Tiles/Merges/HardenedSandMerge.cs new file mode 100644 index 0000000000..d82124c471 --- /dev/null +++ b/Tiles/Merges/HardenedSandMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class HardenedSandMerge : TileBlendTexture + { + public override int TileType => TileID.HardenedSand; + } +} diff --git a/Tiles/Merges/HardenedSulphurousSandstoneMerge.cs b/Tiles/Merges/HardenedSulphurousSandstoneMerge.cs new file mode 100644 index 0000000000..11c38bb34b --- /dev/null +++ b/Tiles/Merges/HardenedSulphurousSandstoneMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class HardenedSulphurousSandstoneMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/LuminiteMerge.cs b/Tiles/Merges/LuminiteMerge.cs new file mode 100644 index 0000000000..b98f1566ac --- /dev/null +++ b/Tiles/Merges/LuminiteMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class LuminiteMerge : TileBlendTexture + { + public override int TileType => TileID.LunarOre; + } +} diff --git a/Tiles/Merges/MudMerge.cs b/Tiles/Merges/MudMerge.cs new file mode 100644 index 0000000000..85b2fcc6fa --- /dev/null +++ b/Tiles/Merges/MudMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class MudMerge : TileBlendTexture + { + public override int TileType => TileID.Mud; + } +} diff --git a/Tiles/Merges/NavystoneMerge.cs b/Tiles/Merges/NavystoneMerge.cs new file mode 100644 index 0000000000..fc4331fe19 --- /dev/null +++ b/Tiles/Merges/NavystoneMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class NavystoneMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/PearlstoneMerge.cs b/Tiles/Merges/PearlstoneMerge.cs new file mode 100644 index 0000000000..9e6a376cfd --- /dev/null +++ b/Tiles/Merges/PearlstoneMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class PearlstoneMerge : TileBlendTexture + { + public override int TileType => TileID.Pearlstone; + } +} diff --git a/Tiles/Merges/PyreMantleMerge.cs b/Tiles/Merges/PyreMantleMerge.cs new file mode 100644 index 0000000000..73458c5c7c --- /dev/null +++ b/Tiles/Merges/PyreMantleMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class PyreMantleMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/RainCloudMerge.cs b/Tiles/Merges/RainCloudMerge.cs new file mode 100644 index 0000000000..a741cf99cb --- /dev/null +++ b/Tiles/Merges/RainCloudMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class RainCloudMerge : TileBlendTexture + { + public override int TileType => TileID.RainCloud; + } +} diff --git a/Tiles/Merges/SandMerge.cs b/Tiles/Merges/SandMerge.cs new file mode 100644 index 0000000000..f52a18a8ff --- /dev/null +++ b/Tiles/Merges/SandMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class SandMerge : TileBlendTexture + { + public override int TileType => TileID.Sand; + } +} diff --git a/Tiles/Merges/SandstoneMerge.cs b/Tiles/Merges/SandstoneMerge.cs new file mode 100644 index 0000000000..3bf4d424f6 --- /dev/null +++ b/Tiles/Merges/SandstoneMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class SandstoneMerge : TileBlendTexture + { + public override int TileType => TileID.Sandstone; + } +} diff --git a/Tiles/Merges/SnowCloudMerge.cs b/Tiles/Merges/SnowCloudMerge.cs new file mode 100644 index 0000000000..be9736bf56 --- /dev/null +++ b/Tiles/Merges/SnowCloudMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class SnowCloudMerge : TileBlendTexture + { + public override int TileType => TileID.SnowCloud; + } +} diff --git a/Tiles/Merges/SnowMerge.cs b/Tiles/Merges/SnowMerge.cs new file mode 100644 index 0000000000..374ddd1d15 --- /dev/null +++ b/Tiles/Merges/SnowMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class SnowMerge : TileBlendTexture + { + public override int TileType => TileID.SnowBlock; + } +} diff --git a/Tiles/Merges/StoneMerge.cs b/Tiles/Merges/StoneMerge.cs new file mode 100644 index 0000000000..1ce0e06c10 --- /dev/null +++ b/Tiles/Merges/StoneMerge.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class StoneMerge : TileBlendTexture + { + public override int TileType => TileID.Stone; + } +} diff --git a/Tiles/Merges/SulphurousSandMerge.cs b/Tiles/Merges/SulphurousSandMerge.cs new file mode 100644 index 0000000000..ff3e1e2664 --- /dev/null +++ b/Tiles/Merges/SulphurousSandMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class SulphurousSandMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/SulphurousSandstoneMerge.cs b/Tiles/Merges/SulphurousSandstoneMerge.cs new file mode 100644 index 0000000000..ad3648857a --- /dev/null +++ b/Tiles/Merges/SulphurousSandstoneMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class SulphurousSandstoneMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/SulphurousShaleMerge.cs b/Tiles/Merges/SulphurousShaleMerge.cs new file mode 100644 index 0000000000..9fc08075c5 --- /dev/null +++ b/Tiles/Merges/SulphurousShaleMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class SulphurousShaleMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/VoidstoneMerge.cs b/Tiles/Merges/VoidstoneMerge.cs new file mode 100644 index 0000000000..0f827eafc6 --- /dev/null +++ b/Tiles/Merges/VoidstoneMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class VoidstoneMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 75470b3984..f373478e23 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs.Abyss; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; @@ -29,6 +30,7 @@ namespace CalamityMod.Tiles Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; + TileID.Sets.MultiTileSway[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); TileObjectData.newTile.Height = 3; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; @@ -62,7 +64,7 @@ namespace CalamityMod.Tiles } } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public static int GetBannerNPC(int style) { @@ -99,9 +101,15 @@ namespace CalamityMod.Tiles case 9: npc = NPCType(); break; - case 12: - npc = NPCType(); + case 10: + npc = NPCType(); break; + case 11: + npc = NPCType(); // There's also the boss variant but I dont think we want banners to affect them? + break; + /*case 12: + npc = NPCType(); - Formerly Sea Urchin + break*/ case 13: npc = NPCType(); break; @@ -216,12 +224,18 @@ namespace CalamityMod.Tiles case 50: npc = NPCType(); break; + case 51: + npc = NPCType(); + break; case 52: npc = NPCType(); break; case 53: npc = NPCType(); break; + case 54: + npc = NPCType(); + break; case 55: npc = NPCType(); break; @@ -232,7 +246,7 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 58: - npc = NPCType(); + npc = NPCType(); break; case 59: npc = NPCType(); @@ -249,6 +263,12 @@ namespace CalamityMod.Tiles case 63: npc = NPCType(); break; + /*case 64: + npc = NPCType(); - Formerly Sand Tortoise + break*/ + /*case 65: + npc = NPCType(); - Formerly Great Sand Shark + break*/ case 66: npc = NPCType(); break; @@ -273,6 +293,12 @@ namespace CalamityMod.Tiles case 73: npc = NPCType(); break; + /*case 74: + npc = NPCType(); - Formerly Sun Bat + break*/ + /*case 75: + npc = NPCType(); - Formerly Cosmic Elemental + break*/ case 76: npc = NPCType(); break; @@ -303,6 +329,9 @@ namespace CalamityMod.Tiles case 85: npc = NPCType(); break; + /*case 86: + npc = NPCType(); - Formerly Phantom Debris + break*/ case 87: npc = NPCType(); break; @@ -354,15 +383,18 @@ namespace CalamityMod.Tiles case 103: npc = NPCType(); break; - case 104: - npc = NPCType(); - break; + /*case 104: + npc = NPCType(); - Formerly Blinded Angler + break*/ case 105: npc = NPCType(); break; case 106: - npc = NPCType(); + npc = NPCType(); break; + /*case 107: + npc = NPCType(); - Formerly Giant Clam + break*/ case 108: npc = NPCType(); break; @@ -381,6 +413,9 @@ namespace CalamityMod.Tiles case 113: npc = NPCType(); break; + /*case 114: + npc = NPCType(); - Formerly Water Leech + break*/ case 115: npc = NPCType(); break; @@ -423,6 +458,12 @@ namespace CalamityMod.Tiles case 128: npc = NPCType(); break; + case 129: + npc = NPCType(); + break; + case 130: + npc = NPCType(); + break; default: break; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index b1a264a1b7..139aa66e76 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Tiles/MusicBoxes/DraedonExoSelectMusicBox.cs b/Tiles/MusicBoxes/DraedonExoSelectMusicBox.cs index 9651be0290..eacbb9681a 100644 --- a/Tiles/MusicBoxes/DraedonExoSelectMusicBox.cs +++ b/Tiles/MusicBoxes/DraedonExoSelectMusicBox.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Tiles.MusicBoxes AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(ItemID.MusicBox)); } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; @@ -38,7 +40,6 @@ namespace CalamityMod.Tiles.MusicBoxes player.cursorItemIconID = ModContent.ItemType(); } - public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override bool CreateDust(int i, int j, ref int type) => false; public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/MusicBoxes/DraedonExoSelectMusicBox.png b/Tiles/MusicBoxes/DraedonExoSelectMusicBox.png index 1ea5e6e61f..59ce9e9547 100644 Binary files a/Tiles/MusicBoxes/DraedonExoSelectMusicBox.png and b/Tiles/MusicBoxes/DraedonExoSelectMusicBox.png differ diff --git a/Tiles/MusicBoxes/DraedonTalkMusicBox.cs b/Tiles/MusicBoxes/DraedonTalkMusicBox.cs index fdb32a490e..1376c00026 100644 --- a/Tiles/MusicBoxes/DraedonTalkMusicBox.cs +++ b/Tiles/MusicBoxes/DraedonTalkMusicBox.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Tiles.MusicBoxes AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(ItemID.MusicBox)); } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; @@ -37,7 +39,6 @@ namespace CalamityMod.Tiles.MusicBoxes player.cursorItemIconID = ModContent.ItemType(); } - public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override bool CreateDust(int i, int j, ref int type) => false; public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/MusicBoxes/DraedonTalkMusicBox.png b/Tiles/MusicBoxes/DraedonTalkMusicBox.png index a7efa72e7c..ad1113240c 100644 Binary files a/Tiles/MusicBoxes/DraedonTalkMusicBox.png and b/Tiles/MusicBoxes/DraedonTalkMusicBox.png differ diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index 4c0aeb9049..29a95d6be6 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -1,12 +1,10 @@ - -using System.Collections.Generic; +using CalamityMod.Systems; 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; namespace CalamityMod.Tiles.Ores @@ -70,214 +68,32 @@ namespace CalamityMod.Tiles.Ores } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 2; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = animationFrameWidth * TileFramingSystem.GetVariation4x4_012_Low0(i, j); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { if (GlowTexture is null) return; - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - int xOffset = 0; - int relativeXPos = i % 4; - int relativeYPos = j % 4; - switch (relativeXPos) - { - case 0: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 1: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 2; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 2: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 3: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 0; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - } - xOffset *= 234; + var tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; + + int xPos = tile.TileFrameX; + int yPos = tile.TileFrameY; + int xOffset = animationFrameWidth * TileFramingSystem.GetVariation4x4_012_Low0(i, j); xPos += xOffset; 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, new Color(100, 100, 100, 50)); - Tile trackTile = Main.tile[i, j]; - - if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 50)); + if (!tile.IsHalfBlock && tile.Slope == 0) { Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - else if (trackTile.IsHalfBlock) + else if (tile.IsHalfBlock) { 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); } } - 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; - } } } diff --git a/Tiles/Ores/AerialiteOreDisenchanted.cs b/Tiles/Ores/AerialiteOreDisenchanted.cs index bd6f41dac4..9e067e8c91 100644 --- a/Tiles/Ores/AerialiteOreDisenchanted.cs +++ b/Tiles/Ores/AerialiteOreDisenchanted.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -59,93 +60,7 @@ namespace CalamityMod.Tiles.Ores public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 2; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * AnimationFrameWidth; + frameXOffset = AnimationFrameWidth * TileFramingSystem.GetVariation4x4_012_Low0(i, j); } } } diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 0b1f23af65..15fb17f402 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -45,6 +45,8 @@ namespace CalamityMod.Tiles.Ores } public override void NearbyEffects(int i, int j, bool closer) { + if (j < 2) + return; Tile tile = Main.tile[i, j]; Tile up = Main.tile[i, j - 1]; Tile up2 = Main.tile[i, j - 2]; @@ -74,7 +76,12 @@ namespace CalamityMod.Tiles.Ores public override IEnumerable GetItemDrops(int i, int j) { if (!DownedBossSystem.downedAstrumDeus) - yield return new Item(ModContent.ItemType(), Main.rand.Next(1, 2 + 1)); + { + if (Main.rand.NextBool()) + yield return new Item(ModContent.ItemType()); + else + yield return new Item(0); + } else yield return new Item(ModContent.ItemType()); } diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index 8ae1f84b8b..db314ce609 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -15,17 +15,15 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Ores { - public class AuricOre : ModTile + public class AuricOre : GlowMaskTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AuricMine", 3); public static bool Animate; - internal static Texture2D GlowTexture; + public override string GlowMaskAsset => "CalamityMod/Tiles/Ores/AuricOreGlow"; - public override void SetStaticDefaults() + public override void SetupStatic() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/AuricOreGlow", AssetRequestMode.ImmediateLoad).Value; AnimationFrameHeight = 90; Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; @@ -85,30 +83,9 @@ namespace CalamityMod.Tiles.Ores } } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY + AnimationFrameHeight * Main.tileFrame[Type]; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Ores/AuricOreGlow").Value; - 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, new Color(225, 255, 255, 255)); - Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, 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; + return Color.White; } } } diff --git a/Tiles/Ores/CryonicOre.cs b/Tiles/Ores/CryonicOre.cs index 81dbf7d117..da361b8567 100644 --- a/Tiles/Ores/CryonicOre.cs +++ b/Tiles/Ores/CryonicOre.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.Ores @@ -28,10 +27,7 @@ namespace CalamityMod.Tiles.Ores Main.tileSpelunker[Type] = true; } - public override bool CanExplode(int i, int j) - { - return false; - } + public override bool CanExplode(int i, int j) => false; public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index ab3dcf4236..36f4363de3 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -7,20 +7,21 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.Ores { - public class PerennialOre : ModTile + public class PerennialOre : GlowMaskTile { - internal static Texture2D GlowTexture; + public const int AnimationFrameWidth = 234; - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Ores/PerennialOreGlow"; + + public override void SetupStatic() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/PerennialOreGlow", AssetRequestMode.ImmediateLoad).Value; Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -35,7 +36,7 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.OreMergesWithMud[Type] = true; - AddMapEntry(new Color(200, 250, 100), CreateMapEntryName()); + AddMapEntry(new Color(64, 207, 97), CreateMapEntryName()); MineResist = 2f; MinPick = 200; HitSound = SoundID.Tink; @@ -46,7 +47,9 @@ namespace CalamityMod.Tiles.Ores this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } - int animationFrameWidth = 234; + + + public override bool CanExplode(int i, int j) { @@ -107,209 +110,12 @@ namespace CalamityMod.Tiles.Ores public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 2; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = AnimationFrameWidth * TileFramingSystem.GetVariation4x4_012_Low0(i, j); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - if (GlowTexture is null) - return; - - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - int xOffset = 0; - int relativeXPos = i % 4; - int relativeYPos = j % 4; - switch (relativeXPos) - { - case 0: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 1: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 2; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 2: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 3: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 0; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - } - - xOffset *= 234; - xPos += xOffset; - 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, new Color(175, 175, 175, 175)); - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.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; + return Color.White * 0.686f; } } } diff --git a/Tiles/Ores/ScoriaOre.cs b/Tiles/Ores/ScoriaOre.cs index 7ae960e3d9..d29d32726f 100644 --- a/Tiles/Ores/ScoriaOre.cs +++ b/Tiles/Ores/ScoriaOre.cs @@ -13,9 +13,11 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Ores { [LegacyName("ChaoticOre")] - public class ScoriaOre : ModTile + public class ScoriaOre : GlowMaskTile { - public override void SetStaticDefaults() + public override string GlowMaskAsset => "CalamityMod/Tiles/Ores/ScoriaOreGlow"; + + public override void SetupStatic() { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; @@ -87,31 +89,10 @@ namespace CalamityMod.Tiles.Ores g = 0.00f; b = 0.00f; } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Ores/ScoriaOreGlow").Value; - 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, new Color(50, 50, 50, 50)); - Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); - } - private Color GetDrawColour(int i, int j, Color colour) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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; + return Color.White * 0.195f; } } } diff --git a/Tiles/Ores/UelibloomOre.cs b/Tiles/Ores/UelibloomOre.cs index b213b57d7b..4390cf8fd6 100644 --- a/Tiles/Ores/UelibloomOre.cs +++ b/Tiles/Ores/UelibloomOre.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.OreMergesWithMud[Type] = true; - AddMapEntry(new Color(0, 255, 0), CreateMapEntryName()); + AddMapEntry(new Color(255, 170, 51), CreateMapEntryName()); MineResist = 3f; MinPick = 225; HitSound = SoundID.Tink; diff --git a/Tiles/Plates/Cinderplate.cs b/Tiles/Plates/Cinderplate.cs index d9f596d9da..f59526667e 100644 --- a/Tiles/Plates/Cinderplate.cs +++ b/Tiles/Plates/Cinderplate.cs @@ -1,30 +1,26 @@  -using CalamityMod.Systems; 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.ModLoader; namespace CalamityMod.Tiles.Plates { - public class Cinderplate : ModTile + public class Cinderplate : GlowMaskTile { + public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/CinderplateGlow"; + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - internal static Texture2D GlowTexture; - internal static Texture2D PulseTexture; - internal static Color[] PulseColors; - public override void SetStaticDefaults() + internal static GrayscaleTexture1D PulseGradient; + + public override void SetupStatic() { - if (!Main.dedServ) - { - PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/CinderplatePulse", AssetRequestMode.ImmediateLoad).Value; - PulseColors = new Color[PulseTexture.Width]; - Main.QueueMainThreadAction(() => PulseTexture.GetData(PulseColors)); - GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/CinderplateGlow", AssetRequestMode.ImmediateLoad).Value; - } + PulseGradient = new("CalamityMod/Tiles/Plates/CinderplatePulse"); + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -36,6 +32,12 @@ namespace CalamityMod.Tiles.Plates AddMapEntry(new Color(242, 216, 131)); } + public override void OnUnload() + { + PulseGradient?.Unload(); + PulseGradient = null; + } + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Torch, 0f, 0f, 1, new Color(255, 255, 255), 1f); @@ -48,41 +50,11 @@ namespace CalamityMod.Tiles.Plates 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) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - // If the cached textures don't exist for some reason, don't bother using them. - if (GlowTexture is null || PulseTexture is null) - return; - - 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; - - // Glowmask 'pulse' effect - int factor = (int)Main.GameUpdateCount % PulseTexture.Width; - float brightness = PulseColors[factor].R / 255f; - int drawBrightness = (int)(40 * brightness) + 10; - Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); - - // If these tiles cause lag, comment out the pulse effect code and uncomment this: - //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.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; + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = 0.04f + (brightness * 0.156f); + return Color.White * brightness; } } } diff --git a/Tiles/Plates/Elumplate.cs b/Tiles/Plates/Elumplate.cs index 251e42818b..9578aae8e5 100644 --- a/Tiles/Plates/Elumplate.cs +++ b/Tiles/Plates/Elumplate.cs @@ -1,30 +1,26 @@  -using CalamityMod.Systems; 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.ModLoader; namespace CalamityMod.Tiles.Plates { - public class Elumplate : ModTile + public class Elumplate : GlowMaskTile { + public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/ElumplateGlow"; + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - internal static Texture2D GlowTexture; - internal static Texture2D PulseTexture; - internal static Color[] PulseColors; - public override void SetStaticDefaults() + internal static GrayscaleTexture1D PulseGradient; + + public override void SetupStatic() { - if (!Main.dedServ) - { - PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/ElumplatePulse", AssetRequestMode.ImmediateLoad).Value; - PulseColors = new Color[PulseTexture.Width]; - Main.QueueMainThreadAction(() => PulseTexture.GetData(PulseColors)); - GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/ElumplateGlow", AssetRequestMode.ImmediateLoad).Value; - } + PulseGradient = new("CalamityMod/Tiles/Plates/ElumplatePulse"); + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -35,6 +31,12 @@ namespace CalamityMod.Tiles.Plates MineResist = 1f; AddMapEntry(new Color(121, 180, 212)); } + public override void OnUnload() + { + PulseGradient?.Unload(); + PulseGradient = null; + } + public override bool CreateDust(int i, int j, ref int type) { @@ -48,41 +50,11 @@ namespace CalamityMod.Tiles.Plates 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) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - // If the cached textures don't exist for some reason, don't bother using them. - if (GlowTexture is null || PulseTexture is null) - return; - - 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; - - // Glowmask 'pulse' effect - int factor = (int)Main.GameUpdateCount % PulseTexture.Width; - float brightness = PulseColors[factor].R / 255f; - int drawBrightness = (int)(40 * brightness) + 10; - Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); - - // If these tiles cause lag, comment out the pulse effect code and uncomment this: - //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.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; + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = 0.04f + (brightness * 0.156f); + return Color.White * brightness; } } } diff --git a/Tiles/Plates/Havocplate.cs b/Tiles/Plates/Havocplate.cs index 5893e6765a..92040fd0a1 100644 --- a/Tiles/Plates/Havocplate.cs +++ b/Tiles/Plates/Havocplate.cs @@ -1,32 +1,28 @@  -using CalamityMod.Systems; 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.ModLoader; namespace CalamityMod.Tiles.Plates { [LegacyName("Chaosplate")] - public class Havocplate : ModTile + public class Havocplate : GlowMaskTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - internal static Texture2D GlowTexture; - internal static Texture2D PulseTexture; - internal static Color[] PulseColors; + public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/HavocplateGlow"; - public override void SetStaticDefaults() + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + internal static GrayscaleTexture1D PulseGradient; + + public override void SetupStatic() { - if (!Main.dedServ) - { - PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/HavocplatePulse", AssetRequestMode.ImmediateLoad).Value; - PulseColors = new Color[PulseTexture.Width]; - Main.QueueMainThreadAction(() => PulseTexture.GetData(PulseColors)); - GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/HavocplateGlow", AssetRequestMode.ImmediateLoad).Value; - } + PulseGradient = new("CalamityMod/Tiles/Plates/HavocplatePulse"); + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -38,6 +34,12 @@ namespace CalamityMod.Tiles.Plates AddMapEntry(new Color(235, 108, 108)); } + public override void OnUnload() + { + PulseGradient?.Unload(); + PulseGradient = null; + } + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); @@ -50,41 +52,11 @@ namespace CalamityMod.Tiles.Plates 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) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - // If the cached textures don't exist for some reason, don't bother using them. - if (GlowTexture is null || PulseTexture is null) - return; - - 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; - - // Glowmask 'pulse' effect - int factor = (int)Main.GameUpdateCount % PulseTexture.Width; - float brightness = PulseColors[factor].R / 255f; - int drawBrightness = (int)(40 * brightness) + 10; - Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); - - // If these tiles cause lag, comment out the pulse effect code and uncomment this: - //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.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; + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = 0.04f + (brightness * 0.156f); + return Color.White * brightness; } } } diff --git a/Tiles/Plates/Navyplate.cs b/Tiles/Plates/Navyplate.cs index a297c08941..af79386386 100644 --- a/Tiles/Plates/Navyplate.cs +++ b/Tiles/Plates/Navyplate.cs @@ -1,30 +1,26 @@  -using CalamityMod.Systems; 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.ModLoader; namespace CalamityMod.Tiles.Plates { - public class Navyplate : ModTile + public class Navyplate : GlowMaskTile { + public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/NavyplateGlow"; + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - internal static Texture2D GlowTexture; - internal static Texture2D PulseTexture; - internal static Color[] PulseColors; - public override void SetStaticDefaults() + internal static GrayscaleTexture1D PulseGradient; + + public override void SetupStatic() { - if (!Main.dedServ) - { - PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/NavyplatePulse", AssetRequestMode.ImmediateLoad).Value; - PulseColors = new Color[PulseTexture.Width]; - Main.QueueMainThreadAction(() => PulseTexture.GetData(PulseColors)); - GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/NavyplateGlow", AssetRequestMode.ImmediateLoad).Value; - } + PulseGradient = new("CalamityMod/Tiles/Plates/NavyplatePulse"); + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -36,6 +32,12 @@ namespace CalamityMod.Tiles.Plates AddMapEntry(new Color(85, 151, 196)); } + public override void OnUnload() + { + PulseGradient?.Unload(); + PulseGradient = null; + } + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Flare_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); @@ -48,41 +50,11 @@ namespace CalamityMod.Tiles.Plates 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) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - // If the cached textures don't exist for some reason, don't bother using them. - if (GlowTexture is null || PulseTexture is null) - return; - - 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; - - // Glowmask 'pulse' effect - int factor = (int)Main.GameUpdateCount % PulseTexture.Width; - float brightness = PulseColors[factor].R / 255f; - int drawBrightness = (int)(40 * brightness) + 10; - Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); - - // If these tiles cause lag, comment out the pulse effect code and uncomment this: - //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.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; + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = 0.04f + (brightness * 0.156f); + return Color.White * brightness; } } } diff --git a/Tiles/Plates/Onyxplate.cs b/Tiles/Plates/Onyxplate.cs index 4fd164dd66..35af4fe794 100644 --- a/Tiles/Plates/Onyxplate.cs +++ b/Tiles/Plates/Onyxplate.cs @@ -4,26 +4,22 @@ using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { - public class Onyxplate : ModTile + public class Onyxplate : GlowMaskTile { + public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/OnyxplateGlow"; + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - internal static Texture2D GlowTexture; - internal static Texture2D PulseTexture; - internal static Color[] PulseColors; - public override void SetStaticDefaults() + internal static GrayscaleTexture1D PulseGradient; + public override void SetupStatic() { - if (!Main.dedServ) - { - PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/OnyxplatePulse", AssetRequestMode.ImmediateLoad).Value; - PulseColors = new Color[PulseTexture.Width]; - Main.QueueMainThreadAction(() => PulseTexture.GetData(PulseColors)); - GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/OnyxplateGlow", AssetRequestMode.ImmediateLoad).Value; - } + PulseGradient = new("CalamityMod/Tiles/Plates/OnyxplatePulse"); + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -36,41 +32,17 @@ namespace CalamityMod.Tiles.Plates AddMapEntry(new Color(182, 28, 232)); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override void OnUnload() { - // If the cached textures don't exist for some reason, don't bother using them. - if (GlowTexture is null || PulseTexture is null) - return; - - 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; - - // Glowmask 'pulse' effect - int factor = (int)Main.GameUpdateCount % PulseTexture.Width; - float brightness = PulseColors[factor].R / 255f; - int drawBrightness = (int)(80 * brightness) + 10; - Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); - - // If these tiles cause lag, comment out the pulse effect code and uncomment this: - //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + PulseGradient?.Unload(); + PulseGradient = null; } - private Color GetDrawColour(int i, int j, Color colour) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - 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; + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = 0.04f + (brightness * 0.31f); + return Color.White * brightness; } } } diff --git a/Tiles/Plates/PlagueContainmentCells.cs b/Tiles/Plates/PlagueContainmentCells.cs index e022ee4dc3..f06f934d1c 100644 --- a/Tiles/Plates/PlagueContainmentCells.cs +++ b/Tiles/Plates/PlagueContainmentCells.cs @@ -4,26 +4,22 @@ using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { - public class PlagueContainmentCells : ModTile + public class PlagueContainmentCells : GlowMaskTile { + public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/PlagueContainmentCellsGlow"; + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - internal static Texture2D GlowTexture; - internal static Texture2D PulseTexture; - internal static Color[] PulseColors; - public override void SetStaticDefaults() + internal static GrayscaleTexture1D PulseGradient; + public override void SetupStatic() { - if (!Main.dedServ) - { - PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/PlagueContainmentCellsPulse", AssetRequestMode.ImmediateLoad).Value; - PulseColors = new Color[PulseTexture.Width]; - Main.QueueMainThreadAction(() => PulseTexture.GetData(PulseColors)); - GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/PlagueContainmentCellsGlow", AssetRequestMode.ImmediateLoad).Value; - } + PulseGradient = new("CalamityMod/Tiles/Plates/PlagueContainmentCellsPulse"); + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -35,6 +31,12 @@ namespace CalamityMod.Tiles.Plates AddMapEntry(new Color(128, 188, 67)); } + public override void OnUnload() + { + PulseGradient?.Unload(); + PulseGradient = null; + } + public override bool CreateDust(int i, int j, ref int type) { int dust = Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GemEmerald, 0f, 0f, 100, default, 2f); @@ -52,41 +54,11 @@ namespace CalamityMod.Tiles.Plates Main.dust[dust].velocity.Y = -0.15f; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) { - // If the cached textures don't exist for some reason, don't bother using them. - if (GlowTexture is null || PulseTexture is null) - return; - - 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; - - // Glowmask 'pulse' effect - int factor = (int)Main.GameUpdateCount % PulseTexture.Width; - float brightness = PulseColors[factor].R / 255f; - int drawBrightness = (int)(40 * brightness) + 10; - Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); - - // If these tiles cause lag, comment out the pulse effect code and uncomment this: - //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.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; + float brightness = PulseGradient.GetRepeat((int)Main.GameUpdateCount); + brightness = 0.04f + (brightness * 0.156f); + return Color.White * brightness; } } } diff --git a/Tiles/PlayerTurrets/PlayerFireTurret .cs b/Tiles/PlayerTurrets/PlayerFireTurret .cs index 96f89dbf1e..06db0d1d71 100644 --- a/Tiles/PlayerTurrets/PlayerFireTurret .cs +++ b/Tiles/PlayerTurrets/PlayerFireTurret .cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerFireTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerIceTurret .cs b/Tiles/PlayerTurrets/PlayerIceTurret .cs index f8923b34cb..07d2742c46 100644 --- a/Tiles/PlayerTurrets/PlayerIceTurret .cs +++ b/Tiles/PlayerTurrets/PlayerIceTurret .cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerIceTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerLabTurret.cs b/Tiles/PlayerTurrets/PlayerLabTurret.cs index 3948900ebf..b2d28deb5b 100644 --- a/Tiles/PlayerTurrets/PlayerLabTurret.cs +++ b/Tiles/PlayerTurrets/PlayerLabTurret.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerLaserTurret .cs b/Tiles/PlayerTurrets/PlayerLaserTurret .cs index 314a27c5e1..6c6421a2eb 100644 --- a/Tiles/PlayerTurrets/PlayerLaserTurret .cs +++ b/Tiles/PlayerTurrets/PlayerLaserTurret .cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerLaserTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerOnyxTurret.cs b/Tiles/PlayerTurrets/PlayerOnyxTurret.cs index 80c5af3026..03a6c2cb93 100644 --- a/Tiles/PlayerTurrets/PlayerOnyxTurret.cs +++ b/Tiles/PlayerTurrets/PlayerOnyxTurret.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerOnyxTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerPlagueTurret.cs b/Tiles/PlayerTurrets/PlayerPlagueTurret.cs index 011130a5ea..0094c5557a 100644 --- a/Tiles/PlayerTurrets/PlayerPlagueTurret.cs +++ b/Tiles/PlayerTurrets/PlayerPlagueTurret.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerPlagueTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerWaterTurret.cs b/Tiles/PlayerTurrets/PlayerWaterTurret.cs index e9da005ea0..0c1c8cbfa1 100644 --- a/Tiles/PlayerTurrets/PlayerWaterTurret.cs +++ b/Tiles/PlayerTurrets/PlayerWaterTurret.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerWaterTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/RoxTile.cs b/Tiles/RoxTile.cs index b24038b021..49d259e5af 100644 --- a/Tiles/RoxTile.cs +++ b/Tiles/RoxTile.cs @@ -1,10 +1,10 @@ using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -17,8 +17,19 @@ namespace CalamityMod.Tiles Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileSpelunker[Type] = true; + Main.tileLighted[Type] = true; + + //Explicitly declared that its immune to liquids and obsidian + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + Main.tileObsidianKill[Type] = false; + + Main.tileOreFinderPriority[Type] = 910; + //Astral Ore is 900, the main reason Im using it as a reference is due to being the highest HM ore and since Catalyst generates Astral ore deeper. + //Wont conflict with Metanova (Catalyst), Uelibloom, or any other higher tier ores - Shade + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 18 }; TileObjectData.addTile(Type); @@ -26,6 +37,33 @@ namespace CalamityMod.Tiles TileID.Sets.DisableSmartCursor[Type] = true; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); + + DustType = DustID.Lava; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 1.64f; + g = 0.25f; + b = 1.89f; + } + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + Tile tile = Main.tile[i, j]; + if (tile.TileFrameY == 18 && tile.TileFrameX < 54) + { + CalamityUtils.DrawFlameSparks(DustID.ShadowbeamStaff, 5, i, j); + } + } + + public override bool CreateDust(int i, int j, ref int type) + { + type = !WorldGen.genRand.NextBool(3) ? DustID.ShadowbeamStaff : DustID.Lava; + return true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 5 : 50; } } } diff --git a/Tiles/RoxTile.png b/Tiles/RoxTile.png index 3ae91b6fe5..592519a83b 100644 Binary files a/Tiles/RoxTile.png and b/Tiles/RoxTile.png differ diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs index ce14798b14..4dc342e39b 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -70,6 +70,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -84,6 +87,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs index 89c2eee98d..fe0ed10bd6 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -70,6 +70,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs index 3ef26c8964..685953dfa9 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -70,6 +70,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs b/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs index 5c15350845..c3f55cd174 100644 --- a/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs +++ b/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -54,6 +54,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -67,6 +70,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -80,6 +86,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/GravelPileEcho.cs b/Tiles/Rubblemaker/Abyss/GravelPileEcho.cs index e7fe4bee22..a9583003bd 100644 --- a/Tiles/Rubblemaker/Abyss/GravelPileEcho.cs +++ b/Tiles/Rubblemaker/Abyss/GravelPileEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Tiles/Rubblemaker/Abyss/PlantyMushPileEcho.cs b/Tiles/Rubblemaker/Abyss/PlantyMushPileEcho.cs index 59b7e44cfb..1bfa8f1d57 100644 --- a/Tiles/Rubblemaker/Abyss/PlantyMushPileEcho.cs +++ b/Tiles/Rubblemaker/Abyss/PlantyMushPileEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; diff --git a/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs b/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs index 57b86fcbbc..23fffb7d2b 100644 --- a/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs +++ b/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void KillMultiTile(int i, int j, int frameX, int frameY) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Rubblemaker/Abyss/ShalePileEcho.cs b/Tiles/Rubblemaker/Abyss/ShalePileEcho.cs index 99a873c1fa..c167fde74d 100644 --- a/Tiles/Rubblemaker/Abyss/ShalePileEcho.cs +++ b/Tiles/Rubblemaker/Abyss/ShalePileEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs b/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs index af0777adcf..d4d7463c16 100644 --- a/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs +++ b/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -37,6 +37,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -50,6 +53,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -63,6 +69,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -76,6 +85,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -89,6 +101,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs b/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs index b4ba9566c8..615e7b74e0 100644 --- a/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs +++ b/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -66,6 +69,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -79,6 +85,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/SulphurTubeCoralEcho.cs b/Tiles/Rubblemaker/Abyss/SulphurTubeCoralEcho.cs index e7a066e4af..760b8d08c3 100644 --- a/Tiles/Rubblemaker/Abyss/SulphurTubeCoralEcho.cs +++ b/Tiles/Rubblemaker/Abyss/SulphurTubeCoralEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Tiles/Rubblemaker/Astral/AstralDesertLargePilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralDesertLargePilesEcho.cs index 606b0eaec4..f9c243dd11 100644 --- a/Tiles/Rubblemaker/Astral/AstralDesertLargePilesEcho.cs +++ b/Tiles/Rubblemaker/Astral/AstralDesertLargePilesEcho.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/Rubblemaker/Astral/AstralDesertMediumPilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralDesertMediumPilesEcho.cs index d4dfbc4607..62d53452e4 100644 --- a/Tiles/Rubblemaker/Astral/AstralDesertMediumPilesEcho.cs +++ b/Tiles/Rubblemaker/Astral/AstralDesertMediumPilesEcho.cs @@ -1,6 +1,6 @@  using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/Rubblemaker/Astral/AstralDesertSmallPilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralDesertSmallPilesEcho.cs index 5ee77beaec..8d5acdb8bf 100644 --- a/Tiles/Rubblemaker/Astral/AstralDesertSmallPilesEcho.cs +++ b/Tiles/Rubblemaker/Astral/AstralDesertSmallPilesEcho.cs @@ -1,6 +1,6 @@  using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/Rubblemaker/Astral/AstralIceLargePilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralIceLargePilesEcho.cs index c987086466..b77e7d5ae4 100644 --- a/Tiles/Rubblemaker/Astral/AstralIceLargePilesEcho.cs +++ b/Tiles/Rubblemaker/Astral/AstralIceLargePilesEcho.cs @@ -1,6 +1,6 @@  using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/Rubblemaker/Astral/AstralIceMediumPilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralIceMediumPilesEcho.cs index 80a6cf10a7..649f5e4a1a 100644 --- a/Tiles/Rubblemaker/Astral/AstralIceMediumPilesEcho.cs +++ b/Tiles/Rubblemaker/Astral/AstralIceMediumPilesEcho.cs @@ -1,6 +1,6 @@  using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/Rubblemaker/Astral/AstralIceSmallPilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralIceSmallPilesEcho.cs index 0103e9dac0..dab0b83dd6 100644 --- a/Tiles/Rubblemaker/Astral/AstralIceSmallPilesEcho.cs +++ b/Tiles/Rubblemaker/Astral/AstralIceSmallPilesEcho.cs @@ -1,6 +1,6 @@  using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/Rubblemaker/Astral/AstralNormalLargePilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralNormalLargePilesEcho.cs index 5876bc6594..caec037f36 100644 --- a/Tiles/Rubblemaker/Astral/AstralNormalLargePilesEcho.cs +++ b/Tiles/Rubblemaker/Astral/AstralNormalLargePilesEcho.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Tiles/Rubblemaker/Astral/AstralNormalMediumPilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralNormalMediumPilesEcho.cs index 7f1f7a2cb2..d6632afec2 100644 --- a/Tiles/Rubblemaker/Astral/AstralNormalMediumPilesEcho.cs +++ b/Tiles/Rubblemaker/Astral/AstralNormalMediumPilesEcho.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Tiles/Rubblemaker/Astral/AstralNormalSmallPilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralNormalSmallPilesEcho.cs index e401c4e2ac..7303eac489 100644 --- a/Tiles/Rubblemaker/Astral/AstralNormalSmallPilesEcho.cs +++ b/Tiles/Rubblemaker/Astral/AstralNormalSmallPilesEcho.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Tiles/Rubblemaker/Astral/AstralStoneLargePilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralStoneLargePilesEcho.cs new file mode 100644 index 0000000000..8f206eb760 --- /dev/null +++ b/Tiles/Rubblemaker/Astral/AstralStoneLargePilesEcho.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Astral; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Rubblemake.Astral +{ + public class AstralStoneLargePilesEcho : ModTile + { + public override string Texture => "CalamityMod/Tiles/Astral/AstralStoneLargePiles"; + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + + DustType = ModContent.DustType(); + + AddMapEntry(new Color(79, 61, 97)); + + RegisterItemDrop(ModContent.ItemType()); + FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0, 1, 2, 3, 4, 5); + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/Rubblemaker/Astral/AstralStoneMediumPilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralStoneMediumPilesEcho.cs new file mode 100644 index 0000000000..70e04a1460 --- /dev/null +++ b/Tiles/Rubblemaker/Astral/AstralStoneMediumPilesEcho.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Astral; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Rubblemake.Astral +{ + public class AstralStoneMediumPilesEcho : ModTile + { + public override string Texture => "CalamityMod/Tiles/Astral/AstralStoneMediumPiles"; + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.addTile(Type); + + DustType = ModContent.DustType(); + + AddMapEntry(new Color(79, 61, 97)); + + RegisterItemDrop(ModContent.ItemType()); + FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0, 1, 2, 3, 4, 5); + + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/Rubblemaker/Astral/AstralStoneSmallPilesEcho.cs b/Tiles/Rubblemaker/Astral/AstralStoneSmallPilesEcho.cs new file mode 100644 index 0000000000..9930a15562 --- /dev/null +++ b/Tiles/Rubblemaker/Astral/AstralStoneSmallPilesEcho.cs @@ -0,0 +1,41 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Astral; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Rubblemake.Astral +{ + public class AstralStoneSmallPilesEcho : ModTile + { + public override string Texture => "CalamityMod/Tiles/Astral/AstralStoneSmallPiles"; + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + DustType = ModContent.DustType(); + AddMapEntry(new Color(79, 61, 97)); + + RegisterItemDrop(ModContent.ItemType()); + FlexibleTileWand.RubblePlacementSmall.AddVariations(ModContent.ItemType(), Type, 0, 1, 2, 3, 4, 5); + + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs b/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs index 013c4246f6..1fbefd2843 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea public override void KillMultiTile(int i, int j, int frameX, int frameY) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Explode into a bunch of rocks when broken. diff --git a/Tiles/Rubblemaker/SunkenSea/BrainCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/BrainCoralEcho.cs index 9de2a1b76e..b3da12ec94 100644 --- a/Tiles/Rubblemaker/SunkenSea/BrainCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/BrainCoralEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs index 621d2a1ccd..85dd31c031 100644 --- a/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Waters; using Microsoft.Xna.Framework; using Terraria; using Terraria.Enums; @@ -31,7 +32,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea public override void NearbyEffects(int i, int j, bool closer) { if (!Main.dedServ) - Main.SceneMetrics.ActiveFountainColor = ModContent.Find("CalamityMod/SunkenSeaWater").Slot; + Main.SceneMetrics.ActiveFountainColor = BasaltGullyWater.Type; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs b/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs index 11948f22aa..119a1db8b2 100644 --- a/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/Rubblemaker/SunkenSea/SmallBrainCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/SmallBrainCoralEcho.cs index 8eae4a37e7..11c4770866 100644 --- a/Tiles/Rubblemaker/SunkenSea/SmallBrainCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SmallBrainCoralEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Tiles/Rubblemaker/SunkenSea/SmallTubeCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/SmallTubeCoralEcho.cs index 74b3418a4f..2924b84bd4 100644 --- a/Tiles/Rubblemaker/SunkenSea/SmallTubeCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SmallTubeCoralEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs index d210666410..b4875bdc62 100644 --- a/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -24,8 +24,10 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; TileObjectData.addAlternate(1); TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addTile(Type); DustType = 253; AddMapEntry(new Color(54, 69, 72)); diff --git a/Tiles/Rubblemaker/SunkenSea/TubeCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/TubeCoralEcho.cs index 1ca9b428a7..36538fa9f1 100644 --- a/Tiles/Rubblemaker/SunkenSea/TubeCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/TubeCoralEcho.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; diff --git a/Tiles/ChaoticBarPlaced.cs b/Tiles/ScoriaBarPlaced.cs similarity index 77% rename from Tiles/ChaoticBarPlaced.cs rename to Tiles/ScoriaBarPlaced.cs index e1741bd4ac..ae80b18e5d 100644 --- a/Tiles/ChaoticBarPlaced.cs +++ b/Tiles/ScoriaBarPlaced.cs @@ -5,8 +5,8 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles { - // TODO -- this name is inconsistent with all other placed bars, and needs to be updated for Scoria - public class ChaoticBarPlaced : ModTile + [LegacyName("ChaoticBarPlaced")] + public class ScoriaBarPlaced : ModTile { public override void SetStaticDefaults() { diff --git a/Tiles/ChaoticBarPlaced.png b/Tiles/ScoriaBarPlaced.png similarity index 100% rename from Tiles/ChaoticBarPlaced.png rename to Tiles/ScoriaBarPlaced.png diff --git a/Tiles/ScoriaBrick.cs b/Tiles/ScoriaBrick.cs index 0db0749b05..5cb0edfa21 100644 --- a/Tiles/ScoriaBrick.cs +++ b/Tiles/ScoriaBrick.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -11,18 +12,14 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles { [LegacyName("ChaoticBrick")] - public class ScoriaBrick : ModTile + public class ScoriaBrick : GlowMaskTile { + public override string GlowMaskAsset => "CalamityMod/Tiles/ScoriaBrickGlow"; + int subsheetHeight = 72; - internal static Texture2D GlowTexture; - - public override void SetStaticDefaults() + public override void SetupStatic() { - if (!Main.dedServ) - { - GlowTexture = ModContent.Request("CalamityMod/Tiles/ScoriaBrickGlow", AssetRequestMode.ImmediateLoad).Value; - } Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -52,38 +49,15 @@ namespace CalamityMod.Tiles frameYOffset = yPos * subsheetHeight; } + public override Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData) + { + return Color.White; + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { TileFramingSystem.CompactFraming(i, j, resetFrame); return false; } - - 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 frameOffset = j % 2 * 72; - int yPos = tile.TileFrameY + frameOffset; - Color drawColour = GetDrawColour(i, j, Color.White); - 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; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), 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; - } } } diff --git a/Tiles/Stohne.cs b/Tiles/Stohne.cs new file mode 100644 index 0000000000..64bf509eda --- /dev/null +++ b/Tiles/Stohne.cs @@ -0,0 +1,38 @@ +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class Stohne : ModTile + { + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + HitSound = SoundID.Tink; + AddMapEntry(new Color(117, 42, 14)); + DustType = DustID.Lihzahrd; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithOres(Type); + + TileID.Sets.Stone[Type] = true; + TileID.Sets.Conversion.Stone[Type] = true; + TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; + TileID.Sets.HasSlopeFrames[Type] = true; + + 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 TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/Stohne.png b/Tiles/Stohne.png new file mode 100644 index 0000000000..d053c4c58d Binary files /dev/null and b/Tiles/Stohne.png differ diff --git a/Tiles/SunkenSea/Ambient/DepthVines.cs b/Tiles/SunkenSea/Ambient/DepthVines.cs index faf1b14f81..7c5f36445d 100644 --- a/Tiles/SunkenSea/Ambient/DepthVines.cs +++ b/Tiles/SunkenSea/Ambient/DepthVines.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient tileBelow.TileType = Type; tileBelow.HasTile = true; WorldGen.SquareTileFrame(i, j + 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); } diff --git a/Tiles/SunkenSea/Ambient/FanCoral.cs b/Tiles/SunkenSea/Ambient/FanCoral.cs index 26e5feed73..ecf774185d 100644 --- a/Tiles/SunkenSea/Ambient/FanCoral.cs +++ b/Tiles/SunkenSea/Ambient/FanCoral.cs @@ -1,4 +1,4 @@ -using System; +using CalamityMod.Waters; using Microsoft.Xna.Framework; using Terraria; using Terraria.Enums; @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void NearbyEffects(int i, int j, bool closer) { if (!Main.dedServ) - Main.SceneMetrics.ActiveFountainColor = ModContent.Find("CalamityMod/SunkenSeaBurrowsWater").Slot; + Main.SceneMetrics.ActiveFountainColor = SunkenSeaBurrowsWater.Type; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/SunkenSea/Ambient/TableCoral.cs b/Tiles/SunkenSea/Ambient/TableCoral.cs index 7cf5773531..8d2c9bd58d 100644 --- a/Tiles/SunkenSea/Ambient/TableCoral.cs +++ b/Tiles/SunkenSea/Ambient/TableCoral.cs @@ -16,11 +16,14 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoAttach[Type] = true; Main.tileSolidTop[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; TileObjectData.addAlternate(1); TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addTile(Type); DustType = 253; AddMapEntry(new Color(54, 69, 72)); diff --git a/Tiles/SunkenSea/Basalt.cs b/Tiles/SunkenSea/Basalt.cs index 0b109e18f4..66801b9ce7 100644 --- a/Tiles/SunkenSea/Basalt.cs +++ b/Tiles/SunkenSea/Basalt.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.SunkenSea AddMapEntry(new Color(58, 55, 70)); - MinPick = 100; + MinPick = 110; // 02JUN2024: Ozzatron: RuneSand has no merge // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); diff --git a/Tiles/SunkenSea/EutrophicGlass.cs b/Tiles/SunkenSea/EutrophicGlass.cs index 4b2d2cdf0e..77f47816d1 100644 --- a/Tiles/SunkenSea/EutrophicGlass.cs +++ b/Tiles/SunkenSea/EutrophicGlass.cs @@ -14,8 +14,12 @@ namespace CalamityMod.Tiles.SunkenSea private static int sheetWidth = 216; private static int sheetHeight = 72; + public static int TypeCache; + public override void SetStaticDefaults() { + TypeCache = Type; + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = false; CalamityUtils.MergeWithGeneral(Type); @@ -38,6 +42,9 @@ namespace CalamityMod.Tiles.SunkenSea public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float transparency = 0.6f; // Must be set here @@ -54,22 +61,7 @@ namespace CalamityMod.Tiles.SunkenSea Rectangle frame = new Rectangle(tile.TileFrameX + frameXOffset, tile.TileFrameY + frameYOffset, 16, 16); Color color = Lighting.GetColor(i, j) * transparency; - Vector2 offScreenRange = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - Vector2 drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreenRange; - TileFramingSystem.SlopedGlowmask(i, j, tile.TileType, tex, drawPos, frame, GetDrawColour(i, j, color), default); - } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 0 && colType <= 30) - { - 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; + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, color, false), default); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index b4feea3854..9638735706 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -9,6 +9,7 @@ using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.UI.ModBrowser; namespace CalamityMod.Tiles.SunkenSea { @@ -41,80 +42,91 @@ namespace CalamityMod.Tiles.SunkenSea public override void RandomUpdate(int i, int j) { + if (!WorldGen.genRand.NextBool(8)) + return; + Tile tile = Main.tile[i, j]; + if (tile.HasTile || tile.LiquidAmount <= 0) + return; + + if (tile.LeftSlope || tile.RightSlope || tile.IsHalfBlock) + return; + Tile up = Main.tile[i, j - 1]; + if (up.HasTile || up.LiquidAmount <= 0) + return; + Tile up2 = Main.tile[i, j - 2]; + if (up2.HasTile || up2.LiquidAmount <= 0) + return; - if (!up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + // Place corals + if (WorldGen.genRand.NextBool(3)) { - // Place corals - if (WorldGen.genRand.NextBool(3)) + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + // 15 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(15) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.dedServ) { - up.TileType = (ushort)ModContent.TileType(); - up.HasTile = true; - up.TileFrameY = 0; - - // 15 different frames, choose a random one - up.TileFrameX = (short)(WorldGen.genRand.Next(15) * 18); - WorldGen.SquareTileFrame(i, j - 1, true); - - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); - } + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } + } - //multi-colored corals - if (WorldGen.genRand.NextBool(3)) - { - ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), + //multi-colored corals + if (WorldGen.genRand.NextBool(3)) + { + ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - ushort newObject = Main.rand.Next(ColoredCorals); + ushort newObject = Main.rand.Next(ColoredCorals); - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } - //blue coral trees - if (WorldGen.genRand.NextBool(6)) - { - ushort[] BlueCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + //blue coral trees + if (WorldGen.genRand.NextBool(6)) + { + ushort[] BlueCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - ushort newObject = Main.rand.Next(BlueCorals); + ushort newObject = Main.rand.Next(BlueCorals); - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } - //brown coral trees - if (WorldGen.genRand.NextBool(6)) - { - ushort[] BrownCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + //brown coral trees + if (WorldGen.genRand.NextBool(6)) + { + ushort[] BrownCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - ushort newObject = Main.rand.Next(BrownCorals); + ushort newObject = Main.rand.Next(BrownCorals); - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } - //fan coral - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceObject(i, j - 1, (ushort)ModContent.TileType()); - } + //fan coral + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceObject(i, j - 1, (ushort)ModContent.TileType()); + } - //misc corals - if (WorldGen.genRand.NextBool()) - { - ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), + //misc corals + if (WorldGen.genRand.NextBool()) + { + ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - ushort newObject = Main.rand.Next(MiscCorals); + ushort newObject = Main.rand.Next(MiscCorals); - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); } } diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 445a4ae2a2..d982d24e92 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Tiles.SunkenSea Below.TileType = (ushort)ModContent.TileType(); Below.HasTile = true; WorldGen.SquareTileFrame(i, j + 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); } diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 0b597c77f7..e588164a13 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -40,8 +40,9 @@ namespace CalamityMod.Tiles.SunkenSea public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - frameXOffset = i % 2 * subsheetWidth; - frameYOffset = j % 2 * subsheetHeight; + // (i & 0b0001) = (i % 2) + frameXOffset = (i & 0b0001) * subsheetWidth; + frameYOffset = (j & 0b0001) * subsheetHeight; } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index 45cd6ba00b..dd064e88e7 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -1,5 +1,5 @@ using System; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Tiles/SunkenSea/Shellstone.cs b/Tiles/SunkenSea/Shellstone.cs index eea56209a5..fc65591926 100644 --- a/Tiles/SunkenSea/Shellstone.cs +++ b/Tiles/SunkenSea/Shellstone.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - TileID.Sets.HasSlopeFrames[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index ebfa300dfd..88a30f67fb 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -57,9 +57,12 @@ namespace CalamityMod.Tiles public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + 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 drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); Texture2D leaves = ModContent.Request("CalamityMod/Tiles/UelibloomBrick_Leaves").Value; DrawExtraTop(i, j, leaves, drawOffset, drawColour); @@ -194,27 +197,6 @@ namespace CalamityMod.Tiles return Main.tile[i + x, j - y].TileType == type == equal; } - private Color GetDrawColour(int i, int j) - { - int colType = Main.tile[i, j].TileColor; - 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; - } - private int GetExtraState(string type) { switch (type) diff --git a/Tiles/WulfrumPipes.cs b/Tiles/WulfrumPipes.cs index d2c6485691..70dd1b9f4a 100644 --- a/Tiles/WulfrumPipes.cs +++ b/Tiles/WulfrumPipes.cs @@ -59,6 +59,8 @@ namespace CalamityMod.Tiles { Point pos = new Point(i, j); Tile tile = Main.tile[pos]; + if (tile.IsTileActuallyInvisible()) + return; float timeToGo = pos.GetTileRNG(2) * 22; float animProgress = (float)Math.Pow(MathHelper.Clamp((TempTilesManagerSystem.GetTemporaryTileTime(pos) - (WulfrumScaffoldKit.TileTime - timeToGo)) / timeToGo, 0, 1), 2); diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index a7a0ad791c..5d523812fc 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -25,6 +25,7 @@ using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using MonoMod.Utils; using ReLogic.Content; using ReLogic.Graphics; using Terraria; @@ -93,7 +94,15 @@ namespace CalamityMod.UI public delegate bool NPCSpecialHPGetRequirement(NPC npc); public delegate long NPCSpecialHPGetFunction(NPC npc, bool checkingForMaxLife); - internal static void Load(Mod mod) + public override void Load() + { + BossExclusionList = []; + MinibossHPBarList = []; + EntityExtensionHandler = []; + SpecialHPRequirements = []; + } + + public override void SetStaticDefaults() { Bars = new List(); @@ -175,10 +184,23 @@ namespace CalamityMod.UI SetupRequirementsList(); } + public override void Unload() + { + BossMainHPBar = null; + BossComboHPBar = null; + BossSeperatorBar = null; + HPBarFont = null; + Bars = null; + BossExclusionList = null; + MinibossHPBarList = null; + OneToMany = null; + EntityExtensionHandler = null; + SpecialHPRequirements = null; + } + public static void SetupBossExclusionList() { - BossExclusionList = new List - { + BossExclusionList.AddRange([ NPCID.None, NPCID.MoonLordFreeEye, NPCID.MoonLordHead, @@ -206,14 +228,13 @@ namespace CalamityMod.UI NPCType(), NPCType(), NPCType(), - NPCType(), - }; + NPCType() + ]); } public static void SetupMinibossHPBarList() { - MinibossHPBarList = new List - { + MinibossHPBarList.AddRange([ // DD2 Event. NPCID.DD2Betsy, NPCID.DD2OgreT2, @@ -255,7 +276,7 @@ namespace CalamityMod.UI NPCType(), // Hardmode Modded. - NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), @@ -271,12 +292,12 @@ namespace CalamityMod.UI NPCType(), NPCType(), NPCType() - }; + ]); } public static void SetupExtensionHandlerList() { - EntityExtensionHandler = new Dictionary() + EntityExtensionHandler.AddRange(new Dictionary() { [NPCID.EaterofWorldsHead] = new BossEntityExtension(CalamityUtils.GetText("UI.ExtensionName.Segments"), NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail), [NPCID.BrainofCthulhu] = new BossEntityExtension(CalamityUtils.GetText("UI.ExtensionName.Creepers"), NPCID.Creeper), @@ -286,7 +307,7 @@ namespace CalamityMod.UI [NPCID.PirateShip] = new BossEntityExtension(CalamityUtils.GetText("UI.ExtensionName.Cannons"), NPCID.PirateShipCannon), [NPCType()] = new BossEntityExtension(CalamityUtils.GetText("UI.ExtensionName.DarkEnergy"), NPCType()), [NPCType()] = new BossEntityExtension(CalamityUtils.GetText("UI.ExtensionName.BodyParts"), NPCType(), NPCType(), NPCType(), NPCType()), - }; + }); } // Collection simplification looks horrendous in the context of delegate creation. @@ -294,7 +315,6 @@ namespace CalamityMod.UI #pragma warning disable IDE0028 // Simplify collection initialization public static void SetupRequirementsList() { - SpecialHPRequirements = new Dictionary(); SpecialHPRequirements.Add(npc => npc.Calamity().SplittingWorm, (npc, checkingForMaxLife) => { // Go across the entire worm and accumulate life. The expectation is that the boss follows the linked-list-esque standard @@ -348,20 +368,6 @@ namespace CalamityMod.UI } #pragma warning restore IDE0028 // Simplify collection initialization - public override void Unload() - { - BossMainHPBar = null; - BossComboHPBar = null; - BossSeperatorBar = null; - HPBarFont = null; - Bars = null; - BossExclusionList = null; - MinibossHPBarList = null; - OneToMany = null; - EntityExtensionHandler = null; - SpecialHPRequirements = null; - } - public override void Update(IBigProgressBar currentBar, ref BigProgressBarInfo info) { foreach (NPC n in Main.ActiveNPCs) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index d4aa053294..7eb231b5e6 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -172,11 +172,19 @@ namespace CalamityMod.UI.CalamitasEnchants if (CurrentlyHeldItem.IsAir) return 0; - int cost = CurrentlyHeldItem.value * 4; + int cost = CurrentlyHeldItem.value * 2; // Increase the cost of enchanting significantly if doing so would upgrade the item directly. if (SelectedEnchantment.HasValue && SelectedEnchantment.Value.Name == CalamityUtils.GetText(EnchantmentManager.ExhumedNamePath)) - cost = (int)MathHelper.Min(cost, Item.buyPrice(5)) * 5; + { + cost = (int)MathHelper.Min(cost, Item.buyPrice(5)) * 2; + + // 29SEP2024: Ozzatron: exhuming stackable items scales the cost with the stack size + cost *= CurrentlyHeldItem.stack; + } + + // Calamitas' happiness also affects the cost + cost = (int)(cost * Main.LocalPlayer.currentShoppingSettings.PriceAdjustment); // Make it 20% cheaper if the player has the Discount Card or Greedy Ring if (Main.LocalPlayer.discountAvailable) @@ -374,7 +382,9 @@ namespace CalamityMod.UI.CalamitasEnchants bool IsExhuming = SelectedEnchantment.Value.Name == CalamityUtils.GetText(EnchantmentManager.ExhumedNamePath); + // 29SEP2024: Ozzatron: exhuming stackable items produces a stack of the same size int oldPrefix = CurrentlyHeldItem.prefix; + int oldStack = CurrentlyHeldItem.stack; CurrentlyHeldItem.SetDefaults(CurrentlyHeldItem.type); CurrentlyHeldItem.Prefix(oldPrefix); CurrentlyHeldItem = CurrentlyHeldItem.Clone(); @@ -383,6 +393,7 @@ namespace CalamityMod.UI.CalamitasEnchants { CurrentlyHeldItem.SetDefaults(EnchantmentManager.ItemUpgradeRelationship[CurrentlyHeldItem.type]); CurrentlyHeldItem.Prefix(oldPrefix); + CurrentlyHeldItem.stack = oldStack; } else { diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index afbb994bc5..391c334539 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -16,8 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.UI.CalamitasEnchants { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class EnchantmentManager + public sealed class EnchantmentManager : ModSystem { internal const int ClearEnchantmentID = -18591774; internal const string ExhumedNamePath = "UI.Exhumed.DisplayName"; @@ -145,7 +144,7 @@ namespace CalamityMod.UI.CalamitasEnchants EnchantmentList.Add(new Enchantment(name, description, id, iconTexturePathElement, creationEffect, holdEffect, requirement)); } - internal static void LoadAllEnchantments() + public override void OnModLoad() { EnchantmentList = new List { @@ -213,7 +212,7 @@ namespace CalamityMod.UI.CalamitasEnchants new Enchantment(CalamityUtils.GetText("UI.Tainted.DisplayName"), CalamityUtils.GetText("UI.Tainted.Description"), 800, "CalamityMod/UI/CalamitasEnchantments/CurseIcon_Tainted", - item => item.useTime = item.useAnimation = 25, + item => item.useAnimation = item.useTime = 25, (Player player) => { if (Main.gameMenu) @@ -236,14 +235,18 @@ namespace CalamityMod.UI.CalamitasEnchants // Yes, this is a LOT of damage but given the limited range of this thing it needs to be extremely powerful when it does actually hit. var source = player.GetSource_ItemUse(player.ActiveItem()); float taintedRatio = 5f; - int damage = (int)player.GetTotalDamage().ApplyTo(player.ActiveItem().damage * taintedRatio); - int blade = Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, player.ActiveItem().type); - if (Main.projectile.IndexInRange(blade)) - Main.projectile[blade].localAI[0] = 0f; + int damage = (int)(player.ActiveItem().damage * taintedRatio); + Projectile blade = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, player.ActiveItem().type); + blade.localAI[0] = 0f; + blade.originalDamage = damage; + blade.OriginalArmorPenetration = player.ActiveItem().ArmorPenetration; + blade.OriginalCritChance = player.ActiveItem().crit; - blade = Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1f, player.ActiveItem().type); - if (Main.projectile.IndexInRange(blade)) - Main.projectile[blade].localAI[0] = -80f; + blade = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1f, player.ActiveItem().type); + blade.localAI[0] = -80f; + blade.originalDamage = damage; + blade.OriginalArmorPenetration = player.ActiveItem().ArmorPenetration; + blade.OriginalCritChance = player.ActiveItem().crit; } }, item => item.IsEnchantable() && item.damage > 0 && item.CountsAsClass() && !item.noUseGraphic && item.shoot > ProjectileID.None), @@ -322,7 +325,7 @@ namespace CalamityMod.UI.CalamitasEnchants }; } - internal static void UnloadAllEnchantments() + public override void Unload() { EnchantmentList = null; ItemUpgradeRelationship = null; diff --git a/UI/CanvasPaintingUI.cs b/UI/CanvasPaintingUI.cs new file mode 100644 index 0000000000..30119f2d8d --- /dev/null +++ b/UI/CanvasPaintingUI.cs @@ -0,0 +1,244 @@ +using CalamityMod.CalPlayer; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class CanvasPaintingUIState + { + public static float scrollOld = 0; + public static float scrollNew = 0; + public static bool moving = false; + public static bool justClicked = false; + + public static void DrawCanvasUI(SpriteBatch spriteBatch) + { + CalamityPlayer p = Main.LocalPlayer.Calamity(); + // The UI only draws if the player is viewing a painting. + if (p.CurrentlyViewedCanvasID == -1) + return; + if (p.CurrentlyViewedCanvasType == -1) + return; + + // Check if this tile entity ID is actually a painting. If it's not, immediately destroy this UI. + TECanvasPainting painting; + bool validPainting = TileEntity.ByID.TryGetValue(p.CurrentlyViewedCanvasID, out TileEntity te); + if (validPainting && te is TECanvasPainting cast) + painting = cast; + else + { + p.CurrentlyViewedCanvasID = -1; + p.CurrentlyViewedCanvasType = -1; + ResetVars(); + return; + } + + // 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 || Main.LocalPlayer.chest != -1 || Main.LocalPlayer.channel) + { + ClosePainting(ref p, painting); + return; + } + + // If the player is too far away from their viewed canvas, immediately destroy this UI and play the menu close sound. + // Currently commented out as moving away lets player's see adjacent paintings + /*Vector2 paintingPosition = painting.Position.ToWorldCoordinates() + new Vector2(20, 20); + if (Main.LocalPlayer.DistanceSQ(paintingPosition) > 160f * 160f) + { + ClosePainting(ref p, painting); + return; + }*/ + + int paintingTileSize = 80; + + // The zoom modifier of the painting + float paintingFrameScale = painting.scale; + Vector2 paintingFramePosition = painting.framePosition; + + bool hideUI = Main.keyState.IsKeyDown(Keys.LeftShift); + + Texture2D tex = TextureAssets.Tile[ModContent.TileType()].Value; + if (p.CurrentlyViewedCanvasType == 1) + tex = TextureAssets.Tile[ModContent.TileType()].Value; + + // This is the length and width of the UI box, which is a square + float dimension = Main.screenHeight * 0.66f; + + // How large the base texture is compared to the UI box + float sizeRatio = dimension / tex.Height; + + // The positions for both the square UI box and the painting + Vector2 baseDrawPos = new Vector2(Main.screenWidth * 0.5f - dimension * 0.5f, Main.screenHeight * 0.5f - dimension * 0.5f); + Vector2 posterDrawPos = baseDrawPos + Vector2.UnitX * ((dimension - tex.Width * sizeRatio) * 0.5f); + + // Draw a background square panel, then draw the actual painting + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null); + if (!hideUI) + { + //spriteBatch.Draw(TextureAssets.MagicPixel.Value, baseDrawPos, new Rectangle(0, 0, (int)dimension, (int)dimension), Color.Gray, 0, new Vector2(0, 0), 1f, 0, 0); + spriteBatch.Draw(tex, posterDrawPos, null, Color.White, 0, new Vector2(0, 0), sizeRatio, 0, 0); + } + + // How large one pixel is on the painting + float pixelRatio = paintingTileSize * sizeRatio; + + MouseState state = Microsoft.Xna.Framework.Input.Mouse.GetState(); + // Handle size scrolling. Scrolling is more precise at smaller values + float scrollAmount = painting.scale >= 1 ? 1f : 0.25f; + // If the player scrolls down, the box grows + if (scrollOld > scrollNew) + { + float increasedScale = MathHelper.Clamp(painting.scale + scrollAmount, 0.25f, 10); + painting.scale = increasedScale; + painting.SendSyncPacket(); + } + // If the player scrolls up, the box shrinks + else if (scrollNew > scrollOld) + { + // Needs to be gate at 2 when going down + scrollAmount = painting.scale >= 2 ? 1f : 0.25f; + float decreasedScale = MathHelper.Clamp(painting.scale - scrollAmount, 0.25f, 10); + painting.scale = decreasedScale; + painting.SendSyncPacket(); + } + + // Border buffer size + int borderSize = 4; + // The size of the cursor box + Vector2 cursorDimension = tex.Size() * sizeRatio * painting.scale * 0.1f; + + // The position of the cursor box. Clamped to be inside of the painting + // Moving + Vector2 movingCursorPos = Vector2.Clamp(Main.MouseScreen - cursorDimension * 0.5f + new Vector2(10, 10), posterDrawPos, posterDrawPos + tex.Size() * sizeRatio - cursorDimension); + // Static + Vector2 currentPos = Vector2.Clamp(paintingFramePosition / (float)(tex.Height / (float)dimension) + posterDrawPos, posterDrawPos, posterDrawPos + tex.Size() * sizeRatio - cursorDimension); + // Decide whether the cursor should be following the mouse or not + Vector2 cursorPosition = moving ? movingCursorPos : currentPos; + + bool clicked = Main.mouseLeft && Main.mouseLeftRelease; + if (moving) + { + // Set the variables for the painting's frame position and zoom scale + painting.framePosition = (cursorPosition - posterDrawPos) * (tex.Height / dimension); + // Deactivate if the player left clicks + if (clicked) + { + moving = false; + SoundEngine.PlaySound(SoundID.MenuTick); + painting.SendSyncPacket(); + } + } + else + { + // Activate if the player left clicks or scrolls + if (clicked || scrollOld != scrollNew) + { + moving = true; + SoundEngine.PlaySound(SoundID.MenuTick); + } + // Allow precise pixel increments with arrow keys + else + { + if (Main.keyState.IsKeyDown(Keys.Left) && Main.oldKeyState.IsKeyUp(Keys.Left)) + { + painting.framePosition.X = MathHelper.Clamp(painting.framePosition.X - 1, 0, tex.Width); + painting.SendSyncPacket(); + } + if (Main.keyState.IsKeyDown(Keys.Right) && Main.oldKeyState.IsKeyUp(Keys.Right)) + { + painting.framePosition.X = MathHelper.Clamp(painting.framePosition.X + 1, 0, tex.Width); + painting.SendSyncPacket(); + } + if (Main.keyState.IsKeyDown(Keys.Up) && Main.oldKeyState.IsKeyUp(Keys.Up)) + { + painting.framePosition.Y = MathHelper.Clamp(painting.framePosition.Y - 1, 0, tex.Height); + painting.SendSyncPacket(); + } + if (Main.keyState.IsKeyDown(Keys.Down) && Main.oldKeyState.IsKeyUp(Keys.Down)) + { + painting.framePosition.Y = MathHelper.Clamp(painting.framePosition.Y + 1, 0, tex.Height); + painting.SendSyncPacket(); + } + } + } + + // Draw the cursor + if (!hideUI) + { + // Top row + DrawRectangle(spriteBatch, cursorPosition - new Vector2(borderSize), new Vector2(cursorDimension.X + borderSize * 2, borderSize)); + // Bottom row + DrawRectangle(spriteBatch, cursorPosition + new Vector2(-borderSize, cursorDimension.Y), new Vector2(cursorDimension.X + borderSize * 2, borderSize)); + // Left column + DrawRectangle(spriteBatch, cursorPosition - new Vector2(borderSize, 0), new Vector2(borderSize, cursorDimension.Y + borderSize)); + // Right column + DrawRectangle(spriteBatch, cursorPosition + new Vector2(cursorDimension.X, 0), new Vector2(borderSize, cursorDimension.Y + borderSize)); + } + + // Draw a preview of the painting on the side + float extraScale = 3f; + float halfDim = paintingTileSize * sizeRatio * extraScale / 2; + int previewSliceSize = (int)(paintingFrameScale * 0.1f * tex.Width); + float previewScale = sizeRatio / paintingFrameScale * extraScale; + int previewDimension = (int)(previewSliceSize * previewScale); + Vector2 demoPosition = posterDrawPos + new Vector2(dimension + halfDim, dimension / 2 - halfDim); + if (!hideUI) + spriteBatch.Draw(tex, demoPosition, new Rectangle((int)paintingFramePosition.X, (int)paintingFramePosition.Y, previewSliceSize, previewSliceSize), Color.White, 0, new Vector2(0, 0), previewScale, 0, 0); + + // Block the mouse if intersecting with the painting area + bool intersectingMain = Mouse().Intersects(new Rectangle((int)baseDrawPos.X, (int)baseDrawPos.Y, (int)dimension, (int)dimension)); + bool intersectingPrev = Mouse().Intersects(new Rectangle((int)demoPosition.X, (int)demoPosition.Y, previewDimension, previewDimension)); + if (intersectingMain || intersectingPrev) + { + Main.blockMouse = Main.LocalPlayer.mouseInterface = true; + } + + // Set both scroll states to the mouse's current scroll value + if (scrollOld == 0 && scrollNew == 0) + { + scrollOld = state.ScrollWheelValue; + scrollNew = state.ScrollWheelValue; + } + // Update scroll values + else + { + scrollOld = scrollNew; + scrollNew = state.ScrollWheelValue; + } + spriteBatch.ExitShaderRegion(); + } + + public static void ClosePainting(ref CalamityPlayer clam, TECanvasPainting te) + { + clam.CurrentlyViewedCanvasID = -1; + ResetVars(); + te.SendSyncPacket(); + } + + public static void ResetVars() + { + scrollOld = 0; + scrollNew = 0; + moving = false; + } + + public static void DrawRectangle(SpriteBatch spriteBatch, Vector2 position, Vector2 dimensions) + { + spriteBatch.Draw(TextureAssets.MagicPixel.Value, position, new Rectangle(0, 0, (int)dimensions.X, (int)dimensions.Y), Main.DiscoColor, 0, new Vector2(0, 0), 1f, 0, 0); + } + + private static Rectangle Mouse() + { + return new Rectangle((int)(Main.MouseWorld.X - Main.screenPosition.X), (int)(Main.MouseWorld.Y - Main.screenPosition.Y), 10, 10); + } + } +} diff --git a/UI/CooldownRackUI.cs b/UI/CooldownRackUI.cs index acd23acbd4..8c0469ba29 100644 --- a/UI/CooldownRackUI.cs +++ b/UI/CooldownRackUI.cs @@ -19,7 +19,7 @@ namespace CalamityMod.UI get { // Option 1: Always use compact icons if configured to do so. - if (CalamityConfig.Instance.CooldownDisplay == 1) + if (CalamityClientConfig.Instance.CooldownDisplay == 1) return true; // Option 2: If there are too many cooldowns, auto switch to compact mode. @@ -43,7 +43,7 @@ namespace CalamityMod.UI // 1 - The game isn't even on the game screen yet. // 2 - The player's inventory is open. // 3 - Cooldown display is completely disabled. - if (Main.gameMenu || Main.playerInventory || CalamityConfig.Instance.CooldownDisplay < 1) + if (Main.gameMenu || Main.playerInventory || CalamityClientConfig.Instance.CooldownDisplay < 1) return; IList cooldownsToDraw = Main.LocalPlayer.GetDisplayedCooldowns(); diff --git a/UI/DebuffSystem/BestiaryDebuffInfo.cs b/UI/DebuffSystem/BestiaryDebuffInfo.cs index 1a08b81c3f..811012d588 100644 --- a/UI/DebuffSystem/BestiaryDebuffInfo.cs +++ b/UI/DebuffSystem/BestiaryDebuffInfo.cs @@ -56,17 +56,17 @@ namespace CalamityMod.UI.DebuffSystem switch (i) { case 0: - path += "Heat"; - break; - case 1: - path += "Sickness"; - break; - case 2: path += "Cold"; break; - case 3: + case 1: path += "Electricity"; break; + case 2: + path += "Heat"; + break; + case 3: + path += "Sickness"; + break; case 4: path += "Water"; break; diff --git a/UI/DraedonSummoning/CodebreakerUI.cs b/UI/DraedonSummoning/CodebreakerUI.cs index 5468ec11de..b50d05d200 100644 --- a/UI/DraedonSummoning/CodebreakerUI.cs +++ b/UI/DraedonSummoning/CodebreakerUI.cs @@ -1,9 +1,10 @@ using System; -using System.Linq; using System.Text; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.NPCs.ExoMechs; +using CalamityMod.Packets; +using CalamityMod.Systems.Collections; using CalamityMod.TileEntities; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -227,7 +228,7 @@ namespace CalamityMod.UI.DraedonSummoning int schematicType = 0; if (codebreakerTileEntity.HeldSchematicID > 0) - schematicType = CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]; + schematicType = EncryptedSchematicIDRelationshipDict.Dict[codebreakerTileEntity.HeldSchematicID]; if (schematicType == ModContent.ItemType()) schematicIconTexture = ModContent.Request("CalamityMod/Items/DraedonMisc/EncryptedSchematicPlanetoid").Value; @@ -421,9 +422,16 @@ namespace CalamityMod.UI.DraedonSummoning { // If the player's hand item is empty and the codebreaker has a schematic, grab it. // This doesn't work if the Codebreaker is busy decrypting the schematic in question. - if (playerHandItem.IsAir && CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(codebreakerTileEntity.HeldSchematicID) && codebreakerTileEntity.DecryptionCountdown <= 0) + + bool isAir = playerHandItem.IsAir; + bool countdownDone = codebreakerTileEntity.DecryptionCountdown <= 0; + bool hasValidSchematicID = EncryptedSchematicIDRelationshipDict.TryGet(codebreakerTileEntity.HeldSchematicID, out var schematicItemType); + bool hasHandHoldingValidSchematicItem = EncryptedSchematicIDRelationshipDict.TryGetKey(playerHandItem.type, out var handHoldSchematicID); + bool hasMouseHoldingValidSchematicItem = EncryptedSchematicIDRelationshipDict.TryGetKey(Main.mouseItem.type, out var mouseHoldSchematicID); + + if (isAir && countdownDone && hasValidSchematicID) { - playerHandItem.SetDefaults(CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]); + playerHandItem.SetDefaults(schematicItemType); codebreakerTileEntity.HeldSchematicID = 0; codebreakerTileEntity.DecryptionCountdown = 0; codebreakerTileEntity.SyncContainedStuff(); @@ -433,9 +441,9 @@ namespace CalamityMod.UI.DraedonSummoning } // Otherwise, if the player has an encrypted schematic and the Codebreaker doesn't, insert it into the machine. - else if (CalamityLists.EncryptedSchematicIDRelationship.ContainsValue(playerHandItem.type) && codebreakerTileEntity.HeldSchematicID == 0) + else if (hasHandHoldingValidSchematicItem && hasMouseHoldingValidSchematicItem && codebreakerTileEntity.HeldSchematicID == 0) { - codebreakerTileEntity.HeldSchematicID = CalamityLists.EncryptedSchematicIDRelationship.First(i => i.Value == Main.mouseItem.type).Key; + codebreakerTileEntity.HeldSchematicID = mouseHoldSchematicID; playerHandItem.TurnToAir(); codebreakerTileEntity.SyncContainedStuff(); SoundEngine.PlaySound(SoundID.Grab); @@ -444,15 +452,15 @@ namespace CalamityMod.UI.DraedonSummoning } // Lastly, if the player has an encrypted schematic but so does the Codebreaker, swap the two. - else if (CalamityLists.EncryptedSchematicIDRelationship.ContainsValue(playerHandItem.type) && codebreakerTileEntity.HeldSchematicID != 0) + else if (hasHandHoldingValidSchematicItem && hasValidSchematicID) { - int previouslyHeldSchematic = CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]; + int previouslyHeldSchematic = schematicItemType; // If the schematics are the same, don't actually do anything, just play the sound as an illusion, to prevent having to send a packet. SoundEngine.PlaySound(SoundID.Grab); - if (playerHandItem.type != previouslyHeldSchematic) + if (playerHandItem.type != previouslyHeldSchematic && hasMouseHoldingValidSchematicItem) { - codebreakerTileEntity.HeldSchematicID = CalamityLists.EncryptedSchematicIDRelationship.First(i => i.Value == Main.mouseItem.type).Key; + codebreakerTileEntity.HeldSchematicID = mouseHoldSchematicID; playerHandItem.SetDefaults(previouslyHeldSchematic); codebreakerTileEntity.SyncContainedStuff(); AwaitingDecryptionTextClose = false; @@ -652,12 +660,7 @@ namespace CalamityMod.UI.DraedonSummoning if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.CodebreakerSummonStuff); - netMessage.Write(CalamityWorld.DraedonSummonCountdown); - netMessage.WriteVector2(CalamityWorld.DraedonSummonPosition); - netMessage.Write(CalamityWorld.DraedonMechdusa); - netMessage.Send(); + CodebreakerSummonStuffPacket.Send(); } } } diff --git a/UI/DraedonSummoning/ExoMechSelectionUI.cs b/UI/DraedonSummoning/ExoMechSelectionUI.cs index 464adb2175..2ffc7b2b12 100644 --- a/UI/DraedonSummoning/ExoMechSelectionUI.cs +++ b/UI/DraedonSummoning/ExoMechSelectionUI.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs.ExoMechs; +using CalamityMod.Packets; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -103,10 +104,7 @@ namespace CalamityMod.UI.DraedonSummoning if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ExoMechSelection); - netMessage.Write((int)CalamityWorld.DraedonMechToSummon); - netMessage.Send(); + ExoMechSelectionPacket.Send(); } } Main.blockMouse = Main.LocalPlayer.mouseInterface = true; diff --git a/UI/DraedonsArsenal/ChargeMeterUI.cs b/UI/DraedonsArsenal/ChargeMeterUI.cs index 709f36a8dd..af52bdb329 100644 --- a/UI/DraedonsArsenal/ChargeMeterUI.cs +++ b/UI/DraedonsArsenal/ChargeMeterUI.cs @@ -9,8 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.UI.DraedonsArsenal { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public class ChargeMeterUI + [Autoload(Side = ModSide.Client)] + public sealed class ChargeMeterUI : ModSystem { // These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision. internal const float DefaultChargePosX = 50.104603f; @@ -20,14 +20,14 @@ namespace CalamityMod.UI.DraedonsArsenal private static Vector2? dragOffset = null; private static Texture2D edgeTexture, barTexture; - internal static void Load() + public override void OnModLoad() { edgeTexture = ModContent.Request("CalamityMod/UI/DraedonsArsenal/ChargeMeterBorder", AssetRequestMode.ImmediateLoad).Value; barTexture = ModContent.Request("CalamityMod/UI/DraedonsArsenal/ChargeMeter", AssetRequestMode.ImmediateLoad).Value; Reset(); } - internal static void Unload() + public override void Unload() { Reset(); edgeTexture = barTexture = null; @@ -38,7 +38,7 @@ namespace CalamityMod.UI.DraedonsArsenal public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.ChargeMeterPosX, CalamityConfig.Instance.ChargeMeterPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.ChargeMeterPosX, CalamityClientConfig.Instance.ChargeMeterPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultChargePosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) @@ -54,23 +54,23 @@ namespace CalamityMod.UI.DraedonsArsenal void SavePosition() { bool changed = false; - if (CalamityConfig.Instance.ChargeMeterPosX != screenRatioPosition.X) + if (CalamityClientConfig.Instance.ChargeMeterPosX != screenRatioPosition.X) { - CalamityConfig.Instance.ChargeMeterPosX = screenRatioPosition.X; + CalamityClientConfig.Instance.ChargeMeterPosX = screenRatioPosition.X; changed = true; } - if (CalamityConfig.Instance.ChargeMeterPosY != screenRatioPosition.Y) + if (CalamityClientConfig.Instance.ChargeMeterPosY != screenRatioPosition.Y) { - CalamityConfig.Instance.ChargeMeterPosY = screenRatioPosition.Y; + CalamityClientConfig.Instance.ChargeMeterPosY = screenRatioPosition.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityClientConfig.SaveConfig(); } // If the Charge Meter is turned off or the player is not holding an item, stop. Item heldItem = player.ActiveItem(); - if (!CalamityConfig.Instance.ChargeMeter || heldItem is null || heldItem.IsAir) + if (!CalamityClientConfig.Instance.ChargeMeter || heldItem is null || heldItem.IsAir) { Reset(); SavePosition(); @@ -96,7 +96,7 @@ namespace CalamityMod.UI.DraedonsArsenal if (chargeBar.Intersects(mouseHitbox)) { - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // If the mouse is on top of the meter, show the exact numeric charge. @@ -106,7 +106,7 @@ namespace CalamityMod.UI.DraedonsArsenal Vector2 newScreenRatioPosition = screenRatioPosition; // Handle mouse dragging - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!dragOffset.HasValue) @@ -124,15 +124,15 @@ namespace CalamityMod.UI.DraedonsArsenal 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; + CalamityClientConfig.Instance.ChargeMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.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); + CalamityClientConfig.SaveConfig(); } } } diff --git a/UI/FlightBar/FlightBar.cs b/UI/FlightBar/FlightBar.cs index 60ec028cfb..f344bc517c 100644 --- a/UI/FlightBar/FlightBar.cs +++ b/UI/FlightBar/FlightBar.cs @@ -12,8 +12,8 @@ using Terraria.ModLoader; namespace CalamityMod.UI { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public class FlightBar + [Autoload(Side = ModSide.Client)] + public sealed class FlightBar : ModSystem { // These values were handpicked on a 1080p screen by Amber. Please disregard the bizarre precision. internal const float DefaultFlightPosX = 40.9375f; @@ -35,7 +35,7 @@ namespace CalamityMod.UI return disabledBarTexture; if ((modPlayer.infiniteFlight || RidingInfiniteFlightMount(modPlayer.Player)) && completedAnimation) return infiniteBarTexture; - if (modPlayer.weakPetrification || modPlayer.vHex || modPlayer.icarusFolly || modPlayer.DoGExtremeGravity) + if (modPlayer.weakPetrification || modPlayer.icarusFolly || modPlayer.DoGExtremeGravity) return limitedBarTexture; return borderTexture; } @@ -63,7 +63,7 @@ namespace CalamityMod.UI return result; } - internal static void Load() + public override void OnModLoad() { borderTexture = ModContent.Request("CalamityMod/UI/FlightBar/FlightBarBorder", AssetRequestMode.ImmediateLoad).Value; flightBarAnimTexture = ModContent.Request("CalamityMod/UI/FlightBar/FlightBarAnim", AssetRequestMode.ImmediateLoad).Value; @@ -74,7 +74,7 @@ namespace CalamityMod.UI Reset(); } - internal static void Unload() + public override void Unload() { Reset(); borderTexture = flightBarAnimTexture = barTexture = disabledBarTexture = infiniteBarTexture = limitedBarTexture = null; @@ -90,7 +90,7 @@ namespace CalamityMod.UI public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.FlightBarPosX, CalamityConfig.Instance.FlightBarPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.FlightBarPosX, CalamityClientConfig.Instance.FlightBarPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultFlightPosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) @@ -106,26 +106,26 @@ 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 && player.wingTimeMax > 0) || (player.mount.Active && player.mount._data.flightTimeMax > 0) || player.carpet && !player.canCarpet)) + if (CalamityClientConfig.Instance.FlightBar && ((player.wingsLogic > 0 && player.wingTimeMax > 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) + if (CalamityClientConfig.Instance.FlightBarPosX != screenRatioPosition.X) { - CalamityConfig.Instance.FlightBarPosX = screenRatioPosition.X; + CalamityClientConfig.Instance.FlightBarPosX = screenRatioPosition.X; changed = true; } - if (CalamityConfig.Instance.FlightBarPosY != screenRatioPosition.Y) + if (CalamityClientConfig.Instance.FlightBarPosY != screenRatioPosition.Y) { - CalamityConfig.Instance.FlightBarPosY = screenRatioPosition.Y; + CalamityClientConfig.Instance.FlightBarPosY = screenRatioPosition.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityClientConfig.SaveConfig(); return; } @@ -138,7 +138,7 @@ namespace CalamityMod.UI // Handle mouse dragging if (flightBar.Intersects(mouseHitbox)) { - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.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) @@ -149,7 +149,7 @@ namespace CalamityMod.UI Vector2 newScreenRatioPosition = screenRatioPosition; // 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 (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!dragOffset.HasValue) @@ -167,15 +167,15 @@ namespace CalamityMod.UI 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; + CalamityClientConfig.Instance.FlightBarPosX = newScreenRatioPosition.X; + CalamityClientConfig.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); + CalamityClientConfig.SaveConfig(); } } } @@ -201,7 +201,7 @@ namespace CalamityMod.UI FlightAnimTimer++; if (FlightAnimTimer >= FlightAnimFrameDelay) { - if (FlightAnimFrame >= FlightAnimFrames) + if (FlightAnimFrame >= FlightAnimFrames - 1) // Must be # of frames - 1 or else there is 1 frame of normal border before it cuts to infinite border { FlightAnimFrame = -1; FlightAnimTimer = 0; @@ -237,8 +237,7 @@ namespace CalamityMod.UI Vector2 origin = new Vector2(correctBorder.Width * 0.5f, (correctBorder.Height / FlightAnimFrames) * 0.5f); float xOffset = (correctBorder.Width - flightBarAnimTexture.Width) / 2f; int frameHeight = (flightBarAnimTexture.Height / FlightAnimFrames) - 1; - float yOffset = FlightAnimFrame == 0 ? 0 : ((correctBorder.Height / FlightAnimFrame) - frameHeight) / 2f; - Vector2 sizeDiffOffset = new Vector2(xOffset, yOffset); + Vector2 sizeDiffOffset = new Vector2(xOffset, -37f); 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); } diff --git a/UI/FlightBar/FlightBarAnim.png b/UI/FlightBar/FlightBarAnim.png index 30f87ea581..82b5ce3a82 100644 Binary files a/UI/FlightBar/FlightBarAnim.png and b/UI/FlightBar/FlightBarAnim.png differ diff --git a/UI/InvasionProgressUIManager.cs b/UI/InvasionProgressUIManager.cs index 4c037c5a74..c349471eb3 100644 --- a/UI/InvasionProgressUIManager.cs +++ b/UI/InvasionProgressUIManager.cs @@ -2,14 +2,15 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; using Terraria.ModLoader.Core; namespace CalamityMod.UI { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class InvasionProgressUIManager + [Autoload(Side = ModSide.Client)] + public sealed class InvasionProgressUIManager : ModSystem { - private static readonly List gUIs = new List(); + private static readonly List gUIs = []; public static int TotalGUIsActive => gUIs.Count(gui => gui.IsActive); public static bool AnyGUIsActive => TotalGUIsActive > 0; public static InvasionProgressUI GetActiveGUI => gUIs.FirstOrDefault(gui => gui.IsActive); @@ -23,19 +24,18 @@ namespace CalamityMod.UI } } - public static void LoadGUIs() + public override void OnModLoad() { // 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. - Type[] types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); - foreach (Type type in types) + ReflectionHelper.IterateCalamityTypes(action: type => { - // Don't load abstract classes since they cannot have instances. - if (type.IsAbstract) - continue; - if (type.IsSubclassOf(typeof(InvasionProgressUI))) - gUIs.Add(Activator.CreateInstance(type) as InvasionProgressUI); - } + gUIs.Add(Activator.CreateInstance(type) as InvasionProgressUI); + }); + } + + public override void Unload() + { + gUIs?.Clear(); } - public static void UnloadGUIs() => gUIs.Clear(); } } diff --git a/UI/MiscTextures/PunchCardPopup.png b/UI/MiscTextures/PunchCardPopup.png new file mode 100644 index 0000000000..f293a646f9 Binary files /dev/null and b/UI/MiscTextures/PunchCardPopup.png differ diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index 6c09b3d4c1..fd25bce7b1 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -184,8 +184,8 @@ namespace CalamityMod.UI.ModeIndicator if (!Main.mouseItem.IsAir) textboxStart.X += 34; - if (textboxStart.X + boxSize.X + 4f > (float)Main.screenWidth) - textboxStart.X = Main.screenWidth - boxSize.X - 4f; + if (textboxStart.X + regexedBoxSize.X + 4f > (float)Main.screenWidth) + textboxStart.X = Main.screenWidth - regexedBoxSize.X - 4f; if (textboxStart.Y + regexedBoxSize.Y + 4f > (float)Main.screenHeight) textboxStart.Y = Main.screenHeight - regexedBoxSize.Y - 4f; @@ -354,7 +354,12 @@ namespace CalamityMod.UI.ModeIndicator modeHovered = true; text = GetDifficultyText(mode); - if (ClickingMouse) + + // Cannot switch to Death Mode if Master Mode isn't active. + // Cannot switch to Revengeance Mode if Master Mode is active. + // I hate how this is coded, it makes me want to smash my head through a wall. - Fabsol + bool cannotSwitchTo = (!Main.masterMode && mode == Difficulties[2]) || (Main.masterMode && mode == Difficulties[1]); + if (ClickingMouse && !cannotSwitchTo) SwitchToDifficulty(mode); } } diff --git a/UI/PopupGUIManager.cs b/UI/PopupGUIManager.cs index 0f472693a9..0e37676da0 100644 --- a/UI/PopupGUIManager.cs +++ b/UI/PopupGUIManager.cs @@ -8,10 +8,10 @@ using Terraria.ModLoader.Core; namespace CalamityMod.UI { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class PopupGUIManager + [Autoload(Side = ModSide.Client)] + public sealed class PopupGUIManager : ModSystem { - private static readonly List gUIs = new List(); + private static readonly List gUIs = []; public static bool GUIActive(PopupGUI gui) => gui.Active || gui.FadeTime > 0; public static bool AnyGUIsActive => gUIs.Any(GUIActive); public static PopupGUI GetActiveGUI => gUIs.FirstOrDefault(GUIActive); @@ -57,21 +57,18 @@ namespace CalamityMod.UI gUIs.First(gui => gui.GetType() == type).Active = !gUIs.First(gui => gui.GetType() == type).Active; } - public static void LoadGUIs() + public override void OnModLoad() { // 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 (Mod mod in ModLoader.Mods) + ReflectionHelper.IterateEveryModsTypes(action: type => { - 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); - } - } + gUIs.Add(Activator.CreateInstance(type) as PopupGUI); + }); + } + + public override void Unload() + { + gUIs?.Clear(); } - public static void UnloadGUIs() => gUIs.Clear(); } } diff --git a/UI/PunchCardGUI.cs b/UI/PunchCardGUI.cs new file mode 100644 index 0000000000..3dbe2fac1a --- /dev/null +++ b/UI/PunchCardGUI.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class PunchCardGUI : PopupGUI + { + public bool HoveringOverBook = false; + + public override void Update() + { + if (Active) + { + if (FadeTime < FadeTimeMax) + FadeTime++; + } + else if (FadeTime > 0) + { + FadeTime--; + } + + if (Main.mouseLeft && !HoveringOverBook && FadeTime >= 30) + { + Active = false; + } + + HoveringOverBook = false; + } + + public override void Draw(SpriteBatch spriteBatch) + { + Texture2D pageTexture = ModContent.Request("CalamityMod/UI/MiscTextures/PunchCardPopup").Value; + float xScale = MathHelper.Lerp(0.004f, 1f, FadeTime / (float)FadeTimeMax); + Vector2 scale = new Vector2(xScale, 1f) * new Vector2(Main.screenWidth, Main.screenHeight) / pageTexture.Size(); + scale.Y *= 1.5f; + scale *= 0.5f; + + float bookScale = 0.5f; + scale *= bookScale; + + float yPageTop = MathHelper.Lerp(Main.screenHeight * 2, Main.screenHeight * 0.5f, FadeTime / (float)FadeTimeMax); + + Rectangle mouseRectangle = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 2, 2); + float drawPositionX = Main.screenWidth * 0.5f; + Vector2 drawPosition = new Vector2(drawPositionX, yPageTop); + Rectangle pageRectangle = new Rectangle((int)drawPosition.X - (int)(pageTexture.Width * 0.5f * scale.X), (int)drawPosition.Y - (int)(pageTexture.Height * 0.5f * scale.Y), (int)(pageTexture.Width * scale.X), (int)(pageTexture.Height * scale.Y)); + + spriteBatch.Draw(pageTexture, drawPosition, null, Color.White, 0f, pageTexture.Size() / 2, scale, SpriteEffects.None, 0f); + + if (!HoveringOverBook) + HoveringOverBook = mouseRectangle.Intersects(pageRectangle); + } + } +} diff --git a/UI/ResourceSets/CalamityResourceOverlay.cs b/UI/ResourceSets/CalamityResourceOverlay.cs index a65bba7297..e4fb0c820a 100644 --- a/UI/ResourceSets/CalamityResourceOverlay.cs +++ b/UI/ResourceSets/CalamityResourceOverlay.cs @@ -1,10 +1,12 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.GameContent; +using Terraria.GameContent.UI.ResourceSets; using Terraria.ModLoader; namespace CalamityMod.UI.ResourceSets @@ -20,6 +22,8 @@ namespace CalamityMod.UI.ResourceSets { string folder = $"{baseFolder}HP"; CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + if (modPlayer.chaliceOfTheBloodGod) // dozezoze - Chalice gets it's own heart color to make bleed indicator contrast consistent, and also because it looks cool + return folder + "Chalice"; if (modPlayer.sStrawberry) return folder + "SacredStrawberry"; if (modPlayer.tCloudberry) @@ -85,6 +89,117 @@ namespace CalamityMod.UI.ResourceSets } } + // dozezoze - this method is where Chalice's bleed overlay is drawn. This can almost certainly be optimized, but it shouldn't cause problems. + public override void PostDrawResourceDisplay(PlayerStatsSnapshot snapshot, IPlayerResourcesDisplaySet displaySet, bool drawingLife, Color textColor, bool drawText) + { + + + var CalPlayer = Main.LocalPlayer.Calamity(); + if (!CalPlayer.chaliceOfTheBloodGod) return; + var Player = Main.LocalPlayer; + var bleed = CalPlayer.chaliceBleedoutBuffer; + var hearts = snapshot.AmountOfLifeHearts; + + if (drawingLife) + { + var height = 0; + int drawType = -1; //0 - bars 1- regular heart 2 - fancy heart + Vector2 position = new Vector2(Main.screenWidth - 60, 28); + + // This sets which bleed overlay draw style to use, as well as the position needed for the selected stat display + switch (displaySet.NameKey) + { + case "HorizontalBarsWithText": + height = 12; + drawType = 0; + break; + case "HorizontalBarsWithFullText": + height = 12; + position.Y -= 2; + drawType = 0; + break; + case "HorizontalBars": + height = 12; + position.Y -= 4; + drawType = 0; + break; + case "Default": + drawType = 1; + position = new Vector2(Main.screenWidth - 289, 43); + break; + case "New": + drawType = 2; + position = new Vector2(Main.screenWidth - 281, 30); + break; + case "NewWithText": + drawType = 2; + position = new Vector2(Main.screenWidth - 281, 36); + break; + } + if (drawType == -1) + { + return; // Loaded HP style doesn't match any of the vanilla ones, so we won't draw the overlay. + } + if (drawType == 0) //bars + { + + // This works by dynamically creating a texture that it then draws over the life bar. + int width = 12 * snapshot.AmountOfLifeHearts; + GraphicsDevice _graphicsDevice = Main.graphics.GraphicsDevice; + var barOverlay = new Texture2D(_graphicsDevice, width, 12); + Color[] barTextureData = new Color[12*12]; + ModContent.Request("CalamityMod/UI/ResourceSets/HPChaliceBleedBar").Value.GetData(barTextureData); + var pixelsPerLife = 12f / snapshot.LifePerSegment; + int deadPixels = (int)Math.Floor((snapshot.LifeMax - snapshot.Life) * pixelsPerLife); + var bleedPixels = Math.Round(bleed * pixelsPerLife); + + Color[] textureData = new Color[width * 12]; + + + for (int i = 0; i < textureData.Length; i++) + { + var bleedCol = new Color(0, 0, 0, 0); + if ((i % width < bleedPixels + deadPixels) && !(i % width < deadPixels)) + { + bleedCol = barTextureData[((i % 12)+(i/width)*12)]; + //bleedCol = new Color(0f, 0.3f, 0.75f, 0.5f); + } + textureData[i] = bleedCol; + + } + + barOverlay.SetData(textureData); + Main.spriteBatch.Draw(barOverlay, position, null, Color.White, 0, new Vector2(width, 0), 1, SpriteEffects.None, 1); + } + else if (drawType == 1) //default heart + { + Texture2D heartTexture = ModContent.Request("CalamityMod/UI/ResourceSets/HPChaliceBleedHeart").Value; + for (int i = 0; i < hearts; i++) + { + Vector2 PosOffset = new Vector2((i >= 10 ? i - 10 : i) * 26, Math.Min(MathF.Floor(i / 10), 1) * 26); + var opacity = Math.Clamp(-(i * snapshot.LifePerSegment - snapshot.Life) / snapshot.LifePerSegment, 0, 1); + if ((i) * snapshot.LifePerSegment > snapshot.Life) opacity = 0f; + opacity = Math.Clamp(-((i * snapshot.LifePerSegment - (float)bleed) / snapshot.LifePerSegment), 0, 1); + Main.spriteBatch.Draw(heartTexture, position + PosOffset, null, Color.White, 0, heartTexture.Size() / 2, 1 * opacity, SpriteEffects.None, 1); + } + } + else if (drawType == 2) //fancy heart. this is the same as default but with different distances between hearts + { + Texture2D heartTexture = ModContent.Request("CalamityMod/UI/ResourceSets/HPChaliceBleedHeart").Value; + for (int i = 0; i < hearts; i++) + { + Vector2 PosOffset = new Vector2((i >= 10 ? i - 10 : i) * 24, Math.Min(MathF.Floor(i / 10), 1) * 28); + var opacity = Math.Clamp(-(i * snapshot.LifePerSegment - snapshot.Life) / snapshot.LifePerSegment, 0, 1); + if ((i) * snapshot.LifePerSegment > snapshot.Life) opacity = 0f; + opacity = Math.Clamp(-((i * snapshot.LifePerSegment - (float)bleed) / snapshot.LifePerSegment), 0, 1); + Main.spriteBatch.Draw(heartTexture, position + PosOffset, null, Color.White, 0, heartTexture.Size() / 2, 1 * opacity, SpriteEffects.None, 1); + } + } + } + + + } + private bool CompareAssets(Asset currentAsset, string compareAssetPath) { if (!vanillaAssetCache.TryGetValue(compareAssetPath, out var asset)) diff --git a/UI/ResourceSets/HPChaliceBar.png b/UI/ResourceSets/HPChaliceBar.png new file mode 100644 index 0000000000..10bbe917b7 Binary files /dev/null and b/UI/ResourceSets/HPChaliceBar.png differ diff --git a/UI/ResourceSets/HPChaliceBleedBar.png b/UI/ResourceSets/HPChaliceBleedBar.png new file mode 100644 index 0000000000..5b09168cd8 Binary files /dev/null and b/UI/ResourceSets/HPChaliceBleedBar.png differ diff --git a/UI/ResourceSets/HPChaliceBleedHeart.png b/UI/ResourceSets/HPChaliceBleedHeart.png new file mode 100644 index 0000000000..c8b310ef6b Binary files /dev/null and b/UI/ResourceSets/HPChaliceBleedHeart.png differ diff --git a/UI/ResourceSets/HPChaliceHeart.png b/UI/ResourceSets/HPChaliceHeart.png new file mode 100644 index 0000000000..b0eefe38dc Binary files /dev/null and b/UI/ResourceSets/HPChaliceHeart.png differ diff --git a/UI/Rippers/RipperUI.cs b/UI/Rippers/RipperUI.cs index 6c8a3cde57..424310e6ec 100644 --- a/UI/Rippers/RipperUI.cs +++ b/UI/Rippers/RipperUI.cs @@ -11,8 +11,8 @@ using Terraria.ModLoader; namespace CalamityMod.UI.Rippers { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class RipperUI + [Autoload(Side = ModSide.Client)] + public sealed class RipperUI : ModSystem { // These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision. public const float DefaultRagePosX = 35.77406f; @@ -51,7 +51,7 @@ namespace CalamityMod.UI.Rippers private static Texture2D adrenBarTex, adrenBorderTex, adrenBorderTexFull, adrenAnimTex, draedonBarTex, draedonAnimTex; private static Texture2D electrolyteGelTex, starlightFuelTex, ectoheartTex; - internal static void Load() + public override void OnModLoad() { rageBarTex = ModContent.Request("CalamityMod/UI/Rippers/RageBar", AssetRequestMode.ImmediateLoad).Value; rageBorderTex = ModContent.Request("CalamityMod/UI/Rippers/RageBarBorder", AssetRequestMode.ImmediateLoad).Value; @@ -79,7 +79,7 @@ namespace CalamityMod.UI.Rippers Reset(); } - internal static void Unload() + public override void Unload() { Reset(); rageBarTex = rageBorderTex = rageAnimTex = null; @@ -105,14 +105,14 @@ namespace CalamityMod.UI.Rippers public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned Rage Meter position - Vector2 rageScreenRatioPos = new Vector2(CalamityConfig.Instance.RageMeterPosX, CalamityConfig.Instance.RageMeterPosY); + Vector2 rageScreenRatioPos = new Vector2(CalamityClientConfig.Instance.RageMeterPosX, CalamityClientConfig.Instance.RageMeterPosY); if (rageScreenRatioPos.X < 0f || rageScreenRatioPos.X > 100f) rageScreenRatioPos.X = DefaultRagePosX; if (rageScreenRatioPos.Y < 0f || rageScreenRatioPos.Y > 100f) rageScreenRatioPos.Y = DefaultRagePosY; // Sanity check the planned Adrenaline Meter position - Vector2 adrenScreenRatioPos = new Vector2(CalamityConfig.Instance.AdrenalineMeterPosX, CalamityConfig.Instance.AdrenalineMeterPosY); + Vector2 adrenScreenRatioPos = new Vector2(CalamityClientConfig.Instance.AdrenalineMeterPosX, CalamityClientConfig.Instance.AdrenalineMeterPosY); if (adrenScreenRatioPos.X < 0f || adrenScreenRatioPos.X > 100f) adrenScreenRatioPos.X = DefaultAdrenPosX; if (adrenScreenRatioPos.Y < 0f || adrenScreenRatioPos.Y > 100f) @@ -135,18 +135,18 @@ namespace CalamityMod.UI.Rippers else { bool changed = false; - if (CalamityConfig.Instance.RageMeterPosX != rageScreenRatioPos.X) + if (CalamityClientConfig.Instance.RageMeterPosX != rageScreenRatioPos.X) { - CalamityConfig.Instance.RageMeterPosX = rageScreenRatioPos.X; + CalamityClientConfig.Instance.RageMeterPosX = rageScreenRatioPos.X; changed = true; } - if (CalamityConfig.Instance.RageMeterPosY != rageScreenRatioPos.Y) + if (CalamityClientConfig.Instance.RageMeterPosY != rageScreenRatioPos.Y) { - CalamityConfig.Instance.RageMeterPosY = rageScreenRatioPos.Y; + CalamityClientConfig.Instance.RageMeterPosY = rageScreenRatioPos.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityClientConfig.SaveConfig(); } if (modPlayer.AdrenalineEnabled) @@ -154,18 +154,18 @@ namespace CalamityMod.UI.Rippers else { bool changed = false; - if (CalamityConfig.Instance.AdrenalineMeterPosX != adrenScreenRatioPos.X) + if (CalamityClientConfig.Instance.AdrenalineMeterPosX != adrenScreenRatioPos.X) { - CalamityConfig.Instance.AdrenalineMeterPosX = adrenScreenRatioPos.X; + CalamityClientConfig.Instance.AdrenalineMeterPosX = adrenScreenRatioPos.X; changed = true; } - if (CalamityConfig.Instance.AdrenalineMeterPosY != adrenScreenRatioPos.Y) + if (CalamityClientConfig.Instance.AdrenalineMeterPosY != adrenScreenRatioPos.Y) { - CalamityConfig.Instance.AdrenalineMeterPosY = adrenScreenRatioPos.Y; + CalamityClientConfig.Instance.AdrenalineMeterPosY = adrenScreenRatioPos.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityClientConfig.SaveConfig(); } #region Mouse Interaction @@ -190,7 +190,7 @@ namespace CalamityMod.UI.Rippers if (rageHover && !adrenHover) { // If the meter isn't locked, then the player's mouse counts as being over interface - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // Add hover text if the mouse is over Rage bar @@ -199,7 +199,7 @@ namespace CalamityMod.UI.Rippers // The bar is draggable if enabled in config. Vector2 newScreenRatioPosition = rageScreenRatioPos; - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!rageDragOffset.HasValue) @@ -217,21 +217,21 @@ namespace CalamityMod.UI.Rippers Vector2 delta = newScreenRatioPosition - rageScreenRatioPos; if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) { - CalamityConfig.Instance.RageMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.RageMeterPosY = newScreenRatioPosition.Y; + CalamityClientConfig.Instance.RageMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.Instance.RageMeterPosY = newScreenRatioPosition.Y; } // When the mouse is released, save the config and destroy the drag offset. if (ms.LeftButton == ButtonState.Released) { rageDragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityClientConfig.SaveConfig(); } } else if (adrenHover) { // If the meter isn't locked, then the player's mouse counts as being over interface - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // Add hover text if the mouse is over the bar @@ -241,7 +241,7 @@ namespace CalamityMod.UI.Rippers // The bar is draggable if enabled in config. Vector2 newScreenRatioPosition = adrenScreenRatioPos; - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!adrenDragOffset.HasValue) @@ -259,15 +259,15 @@ namespace CalamityMod.UI.Rippers Vector2 delta = newScreenRatioPosition - adrenScreenRatioPos; if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) { - CalamityConfig.Instance.AdrenalineMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.AdrenalineMeterPosY = newScreenRatioPosition.Y; + CalamityClientConfig.Instance.AdrenalineMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.Instance.AdrenalineMeterPosY = newScreenRatioPosition.Y; } // When the mouse is released, save the config and destroy the drag offset. if (ms.LeftButton == ButtonState.Released) { adrenDragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityClientConfig.SaveConfig(); } } #endregion @@ -446,7 +446,7 @@ namespace CalamityMod.UI.Rippers #endregion private static Vector2 GetShakeOffset() { - float shake = CalamityConfig.Instance.RipperMeterShake; + float shake = CalamityClientConfig.Instance.RipperMeterShake; float shakeX = Main.rand.NextFloat(-shake, shake); float shakeY = Main.rand.NextFloat(-shake, shake); return new Vector2(shakeX, shakeY); diff --git a/UI/SpeedrunTimerUI.cs b/UI/SpeedrunTimerUI.cs index 6f340be742..19eb113455 100644 --- a/UI/SpeedrunTimerUI.cs +++ b/UI/SpeedrunTimerUI.cs @@ -23,6 +23,7 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.Yharon; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -32,7 +33,6 @@ using Terraria.ModLoader; namespace CalamityMod.UI { - // TODO -- Combine with SpeedrunTimerStoppingSystem, which should be renamed and call the UI draw code in this file. public class SpeedrunTimerUI { // These values put the Speedrun Timer roughly at the top center of a 1080p screen. @@ -44,11 +44,11 @@ namespace CalamityMod.UI public static void Draw(Player player) { - if (Main.gameMenu || !CalamityConfig.Instance.SpeedrunTimer) + if (Main.gameMenu || !CalamityClientConfig.Instance.SpeedrunTimer) return; // Sanity check the planned position before drawing - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.SpeedrunTimerPosX, CalamityConfig.Instance.SpeedrunTimerPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.SpeedrunTimerPosX, CalamityClientConfig.Instance.SpeedrunTimerPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultTimerPosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) @@ -63,10 +63,7 @@ namespace CalamityMod.UI CalamityPlayer calamityPlayer = player.Calamity(); // Main timer - string formatStr = @"hh\:mm\:ss\.ff"; - string formatStrDays = @"d\:hh\:mm\:ss\.ff"; - TimeSpan totalTime = CalamityMod.SpeedrunTimer.Elapsed.Add(calamityPlayer.previousSessionTotal); - string text = totalTime.ToString(totalTime.Days > 0 ? formatStrDays : formatStr); + string text = SpeedrunTimerSystem.GetTimerText(calamityPlayer); float scale = 2f; Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, text, screenPos.X, screenPos.Y, Color.White, Color.Black, default, scale); @@ -74,8 +71,7 @@ namespace CalamityMod.UI return; // Latest split - TimeSpan split = calamityPlayer.lastSplit; - text = split.ToString(split.Days > 0 ? formatStrDays : formatStr); + text = SpeedrunTimerSystem.GetSplitText(calamityPlayer); scale = 1f; float lineTwoX = screenPos.X + SplitHorizontalOffset; float lineTwoY = screenPos.Y + SplitVerticalOffset; diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index 4562d8a1fe..42c9269e04 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -10,8 +10,8 @@ using static Microsoft.Xna.Framework.Input.Keys; namespace CalamityMod.UI { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public class StealthUI + [Autoload(Side = ModSide.Client)] + public sealed class StealthUI : ModSystem { // These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision. internal const float DefaultStealthPosX = 50.104603f; @@ -21,7 +21,7 @@ namespace CalamityMod.UI private static Vector2? dragOffset = null; private static Texture2D edgeTexture, indicatorTexture, barTexture, fullBarTexture; - internal static void Load() + public override void OnModLoad() { edgeTexture = ModContent.Request("CalamityMod/UI/MiscTextures/StealthMeter", AssetRequestMode.ImmediateLoad).Value; indicatorTexture = ModContent.Request("CalamityMod/UI/MiscTextures/StealthMeterStrikeIndicator", AssetRequestMode.ImmediateLoad).Value; @@ -30,7 +30,7 @@ namespace CalamityMod.UI Reset(); } - internal static void Unload() + public override void Unload() { Reset(); edgeTexture = indicatorTexture = barTexture = fullBarTexture = null; @@ -41,7 +41,7 @@ namespace CalamityMod.UI public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.StealthMeterPosX, CalamityConfig.Instance.StealthMeterPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.StealthMeterPosX, CalamityClientConfig.Instance.StealthMeterPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultStealthPosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) @@ -57,26 +57,26 @@ namespace CalamityMod.UI CalamityPlayer modPlayer = player.Calamity(); // 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) + if (modPlayer.stealthUIAlpha > 0f && CalamityClientConfig.Instance.StealthMeter && modPlayer.rogueStealthMax > 0f && modPlayer.wearingRogueArmor) { DrawStealthBar(spriteBatch, modPlayer, screenPos); } else { bool changed = false; - if (CalamityConfig.Instance.StealthMeterPosX != screenRatioPosition.X) + if (CalamityClientConfig.Instance.StealthMeterPosX != screenRatioPosition.X) { - CalamityConfig.Instance.StealthMeterPosX = screenRatioPosition.X; + CalamityClientConfig.Instance.StealthMeterPosX = screenRatioPosition.X; changed = true; } - if (CalamityConfig.Instance.StealthMeterPosY != screenRatioPosition.Y) + if (CalamityClientConfig.Instance.StealthMeterPosY != screenRatioPosition.Y) { - CalamityConfig.Instance.StealthMeterPosY = screenRatioPosition.Y; + CalamityClientConfig.Instance.StealthMeterPosY = screenRatioPosition.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityClientConfig.SaveConfig(); } Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); @@ -88,7 +88,7 @@ namespace CalamityMod.UI // Handle mouse dragging if (stealthBar.Intersects(mouseHitbox)) { - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // If the mouse is on top of the meter, show the player's exact numeric stealth. @@ -113,7 +113,7 @@ namespace CalamityMod.UI Vector2 newScreenRatioPosition = screenRatioPosition; // 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 (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!dragOffset.HasValue) @@ -131,15 +131,15 @@ namespace CalamityMod.UI 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; + CalamityClientConfig.Instance.StealthMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.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); + CalamityClientConfig.SaveConfig(); } } } diff --git a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs index a1a4899dab..04b5b562da 100644 --- a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs +++ b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs @@ -37,7 +37,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing. This is done relative. - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.SulphuricWaterMeterPosX, CalamityConfig.Instance.SulphuricWaterMeterPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.SulphuricWaterMeterPosX, CalamityClientConfig.Instance.SulphuricWaterMeterPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultPosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) @@ -58,19 +58,19 @@ namespace CalamityMod.UI.SulphurousWaterMeter else { bool changed = false; - if (CalamityConfig.Instance.SulphuricWaterMeterPosX != screenRatioPosition.X) + if (CalamityClientConfig.Instance.SulphuricWaterMeterPosX != screenRatioPosition.X) { - CalamityConfig.Instance.SulphuricWaterMeterPosX = screenRatioPosition.X; + CalamityClientConfig.Instance.SulphuricWaterMeterPosX = screenRatioPosition.X; changed = true; } - if (CalamityConfig.Instance.SulphuricWaterMeterPosY != screenRatioPosition.Y) + if (CalamityClientConfig.Instance.SulphuricWaterMeterPosY != screenRatioPosition.Y) { - CalamityConfig.Instance.SulphuricWaterMeterPosY = screenRatioPosition.Y; + CalamityClientConfig.Instance.SulphuricWaterMeterPosY = screenRatioPosition.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityClientConfig.SaveConfig(); } Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); @@ -82,7 +82,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter // Handle mouse dragging if (waterBarArea.Intersects(mouseHitbox)) { - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // If the mouse is on top of the meter, show the player's accumulated sulphuric poisoning. @@ -97,7 +97,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter Vector2 newScreenRatioPosition = screenRatioPosition; // 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 (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!dragOffset.HasValue) @@ -115,15 +115,15 @@ namespace CalamityMod.UI.SulphurousWaterMeter Vector2 delta = newScreenRatioPosition - screenRatioPosition; if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) { - CalamityConfig.Instance.SulphuricWaterMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.SulphuricWaterMeterPosY = newScreenRatioPosition.Y; + CalamityClientConfig.Instance.SulphuricWaterMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.Instance.SulphuricWaterMeterPosY = 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); + CalamityClientConfig.SaveConfig(); } } else diff --git a/Utilities/CollisionUtils.cs b/Utilities/CollisionUtils.cs index 83f827a4c7..bcd80a65c7 100644 --- a/Utilities/CollisionUtils.cs +++ b/Utilities/CollisionUtils.cs @@ -25,6 +25,13 @@ namespace CalamityMod return Collision.CheckAABBvLineCollision(targetTopLeft, targetHitboxDimensions, start, end, entity.width * scale, ref _); } + /// + /// Shortcut used to make projectiles have rotating hitbox collision. + /// + /// The projectile. + /// The rectangle for the target hitbox. + public static bool RotatingHitboxCollision(this Projectile proj, Rectangle targetHitbox) => RotatingHitboxCollision(proj, targetHitbox.TopLeft(), targetHitbox.Size(), (proj.rotation + MathHelper.PiOver2).ToRotationVector2(), proj.scale); + /// /// Determines if a typical hitbox rectangle is intersecting a circular hitbox. /// diff --git a/Utilities/DrawingUtils.BatchSetting.cs b/Utilities/DrawingUtils.BatchSetting.cs new file mode 100644 index 0000000000..ee5b26cbe9 --- /dev/null +++ b/Utilities/DrawingUtils.BatchSetting.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace CalamityMod +{ + public class BatchSetting(BlendState blend, SamplerState sampler, DepthStencilState depthStencil, RasterizerState rasterizer) + { + public readonly BlendState blendState = blend; + public readonly SamplerState samplerState = sampler; + public readonly DepthStencilState depthStencilState = depthStencil; + public readonly RasterizerState rasterizerState = rasterizer; + + public static readonly BatchSetting AlphaBlend = new( + BlendState.AlphaBlend, + SamplerState.PointClamp, + DepthStencilState.None, + rasterizer: null + ); + + public static readonly BatchSetting Additive = new( + BlendState.Additive, + SamplerState.PointClamp, + DepthStencilState.None, + rasterizer: null + ); + + public static readonly BatchSetting NonPremultiplied = new( + BlendState.NonPremultiplied, + SamplerState.PointClamp, + DepthStencilState.None, + rasterizer: null + ); + + public static readonly BatchSetting Opaque = new( + BlendState.Opaque, + SamplerState.PointClamp, + DepthStencilState.None, + rasterizer: null + ); + } +} diff --git a/Utilities/DrawingUtils.SpriteBatch.cs b/Utilities/DrawingUtils.SpriteBatch.cs new file mode 100644 index 0000000000..87de0a98d5 --- /dev/null +++ b/Utilities/DrawingUtils.SpriteBatch.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + // Cached for efficiency purposes. + private const BindingFlags Bind_Private_Instance = BindingFlags.NonPublic | BindingFlags.Instance; + private static readonly FastField Fld_BeginCalled = new("beginCalled", Bind_Private_Instance); + private static readonly FastField Fld_SortMode = new("sortMode", Bind_Private_Instance); + private static readonly FastField Fld_BlendState = new("blendState", Bind_Private_Instance); + private static readonly FastField Fld_SamplerState = new("samplerState", Bind_Private_Instance); + private static readonly FastField Fld_DepthStencilState = new("depthStencilState", Bind_Private_Instance); + private static readonly FastField Fld_RasterizerState = new("rasterizerState", Bind_Private_Instance); + private static readonly FastField Fld_TransformMatrix = new("transformMatrix", Bind_Private_Instance); + private static readonly FastField Fld_CustomEffect = new("customEffect", Bind_Private_Instance); + + /// + /// Sets a 's arbitrarily. + /// + /// The sprite batch. + /// The blend state to use. + public static void SetBlendState(this SpriteBatch spriteBatch, BlendState blendState) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, blendState, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); + } + + /// + /// Determines if a is in a lock due to a call. + /// + /// The sprite batch to check. + public static bool HasBeginBeenCalled(this SpriteBatch spriteBatch) + { + return Fld_BeginCalled.Get(spriteBatch); + } + + public static void SafeAction(this SpriteBatch spriteBatch, Action action) + { + if (spriteBatch is null) + return; + + if (spriteBatch.HasBeginBeenCalled()) + { + var oldSort = Fld_SortMode.Get(spriteBatch); + var oldBlend = Fld_BlendState.Get(spriteBatch); + var oldSampler = Fld_SamplerState.Get(spriteBatch); + var oldDepths = Fld_DepthStencilState.Get(spriteBatch); + var oldRaster = Fld_RasterizerState.Get(spriteBatch); + var oldEffect = Fld_CustomEffect.Get(spriteBatch); + var oldMtx = Fld_TransformMatrix.Get(spriteBatch); + try + { + action?.Invoke(); + } + finally + { + // If something has started in this block, restore the state to previous one + spriteBatch.TryEnd(); + spriteBatch.TryBegin(oldSort, oldBlend, oldSampler, oldDepths, oldRaster, oldEffect, oldMtx); + } + } + else + { + try + { + action?.Invoke(); + } + finally + { + // Initial State was off, turn off the batching + spriteBatch.TryEnd(); + } + } + } + + /// + /// Starts SpriteBatch then Re-Begin batch with old settings when it's all done + /// + /// + /// + /// + /// + /// + /// + public static void SafeBegin(this SpriteBatch spriteBatch, SpriteSortMode sortMode, + BatchSetting settings, + Effect effect, + Matrix transformMatrix, + Action batchCallback + ) + { + if (spriteBatch is null) + return; + + spriteBatch.SafeAction(() => + { + spriteBatch.TryEnd(); + var rasterizer = settings.rasterizerState ?? Main.Rasterizer; + spriteBatch.TryBegin(sortMode, settings.blendState, settings.samplerState, settings.depthStencilState, rasterizer, effect, transformMatrix); + batchCallback?.Invoke(); + }); + } + + public static bool TryBegin(this SpriteBatch spriteBatch, SpriteSortMode sortMode, + BlendState blendState, + SamplerState samplerState, + DepthStencilState depthStencilState, + RasterizerState rasterizerState, + Effect effect, + Matrix transformMatrix) + { + if (spriteBatch.HasBeginBeenCalled()) + { + return false; + } + else + { + spriteBatch.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, transformMatrix); + return true; + } + } + + public static bool TryEnd(this SpriteBatch spriteBatch) + { + if (!spriteBatch.HasBeginBeenCalled()) + { + return false; + } + else + { + spriteBatch.End(); + return true; + } + } + } +} diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 0b541aa8ec..9ed32533e5 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -52,7 +52,7 @@ namespace CalamityMod /// If mode 1 is used, this controls the loop increment. Set it to more than 1 to skip afterimages. /// The texture to draw. Set to null to draw the projectile's own loaded texture. /// If false, the afterimages will be centered on the projectile's position instead of its own center. - public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true) + public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true, bool shrink = false, int armorShaderToUse = 0) { if (texture is null) texture = TextureAssets.Projectile[proj.type].Value; @@ -72,7 +72,7 @@ namespace CalamityMod // If no afterimages are drawn due to an invalid mode being specified, ensure the projectile itself is drawn anyway. bool failedToDrawAfterimages = false; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { Vector2 centerOffset = drawCentered ? proj.Size / 2f : Vector2.Zero; Color alphaColor = proj.GetAlpha(lightColor); @@ -81,12 +81,24 @@ namespace CalamityMod // Standard afterimages. No customizable features other than total afterimage count. // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. case 0: + + for (int i = 0; i < proj.oldPos.Length; ++i) { Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = alphaColor * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, scale, spriteEffects, 0f); + float interpolant = ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Color color = alphaColor * interpolant; + + var drawData = new DrawData(texture, drawPos, rectangle, color) + { + rotation = rotation, + origin = origin, + effect = spriteEffects + }; + + GameShaders.Armor.Apply(armorShaderToUse, proj, drawData); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, shrink ? scale * interpolant : scale, spriteEffects, 0f); } break; @@ -102,13 +114,23 @@ namespace CalamityMod while (k < afterimageCount) { Vector2 drawPos = proj.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + float interpolant = ((float)(proj.oldPos.Length - k) / (float)proj.oldPos.Length); // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS EITHER. if (k > 0) { float colorMult = (float)(afterimageCount - k); drawColor *= colorMult / afterimageColorCount; } - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, scale, spriteEffects, 0f); + + var drawData = new DrawData(texture, drawPos, rectangle, drawColor) + { + rotation = rotation, + origin = origin, + effect = spriteEffects + }; + + GameShaders.Armor.Apply(armorShaderToUse, proj, drawData); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, shrink ? scale * interpolant : scale, spriteEffects, 0f); k += increment; } break; @@ -123,8 +145,18 @@ namespace CalamityMod Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = alphaColor * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, scale, sfxForThisAfterimage, 0f); + float interpolant = ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Color color = alphaColor * interpolant; + + var drawData = new DrawData(texture, drawPos, rectangle, color) + { + rotation = rotation, + origin = origin, + effect = spriteEffects + }; + + GameShaders.Armor.Apply(armorShaderToUse, proj, drawData); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, shrink ? scale * interpolant : scale, sfxForThisAfterimage, 0f); } break; @@ -135,10 +167,13 @@ namespace CalamityMod } // Draw the projectile itself. Only do this if no afterimages are drawn because afterimage 0 is the projectile itself. - if (!CalamityConfig.Instance.Afterimages || ProjectileID.Sets.TrailCacheLength[proj.type] <= 0 || failedToDrawAfterimages) + if (!CalamityClientConfig.Instance.Afterimages || ProjectileID.Sets.TrailCacheLength[proj.type] <= 0 || failedToDrawAfterimages) { Vector2 startPos = drawCentered ? proj.Center : proj.position; - Main.spriteBatch.Draw(texture, startPos - Main.screenPosition + new Vector2(0f, proj.gfxOffY), rectangle, proj.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); + Vector2 drawPos = startPos - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + var drawData = new DrawData(texture, drawPos, rectangle, proj.GetAlpha(lightColor)); + GameShaders.Armor.Apply(armorShaderToUse, proj, drawData); + Main.spriteBatch.Draw(texture, drawPos, rectangle, proj.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); } } @@ -323,29 +358,6 @@ namespace CalamityMod projectionMatrix = Matrix.CreateOrthographicOffCenter(0f, width * zoom.X, 0f, height * zoom.Y, 0f, 1f) * zoomScaleMatrix; } - /// - /// Sets a 's arbitrarily. - /// - /// The sprite batch. - /// The blend state to use. - public static void SetBlendState(this SpriteBatch spriteBatch, BlendState blendState) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, blendState, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); - } - - // Cached for efficiency purposes. - internal static readonly FieldInfo BeginEndPairField = typeof(SpriteBatch).GetField("inBeginEndPair", BindingFlags.NonPublic | BindingFlags.Instance); - - /// - /// Determines if a is in a lock due to a call. - /// - /// The sprite batch to check. - public static bool HasBeginBeenCalled(this SpriteBatch spriteBatch) - { - return (bool)BeginEndPairField.GetValue(spriteBatch); - } - /// /// Draws a line significantly more efficiently than using just one scaled line texture. Positions are automatically converted to screen coordinates. /// @@ -402,7 +414,7 @@ namespace CalamityMod 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); + color = Color.White; spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, color, rotation, origin, 1f, SpriteEffects.None, 0f); } @@ -446,7 +458,7 @@ namespace CalamityMod return new Rectangle(0, item.height * frame, item.width, item.height); } - public static void DrawHook(this Projectile projectile, Texture2D hookTexture, float angleAdditive = 0f) + public static bool DrawHook(this Projectile projectile, Texture2D hookTexture, float angleAdditive = 0f) { Player player = Main.player[projectile.owner]; Vector2 center = projectile.Center; @@ -473,6 +485,7 @@ namespace CalamityMod hookTexture.Size() / 2, 1f, SpriteEffects.None, 0f); } } + return true; } internal static void IterateDisco(ref Color c, ref float aiParam, in byte discoIter = 7) @@ -578,6 +591,16 @@ namespace CalamityMod return Color.Lerp(currentColor, nextColor, increment * colors.Length % 1f); } + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] + public static bool IsAnyChannelGreaterThan(this Color a, Color b, bool includeAlpha = false) + { + if (a.R > b.R) return true; + if (a.G > b.G) return true; + if (a.B > b.B) return true; + if (includeAlpha && a.A > b.A) return true; + return false; + } + // Cached for efficiency purposes. internal static readonly FieldInfo UImageFieldMisc0 = typeof(MiscShaderData).GetField("_uImage0", BindingFlags.NonPublic | BindingFlags.Instance); internal static readonly FieldInfo UImageFieldMisc1 = typeof(MiscShaderData).GetField("_uImage1", BindingFlags.NonPublic | BindingFlags.Instance); diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 43b46b9065..6b19c38c64 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions; using CalamityMod.NPCs.SulphurousSea; @@ -118,9 +119,7 @@ namespace CalamityMod public static string CatastropheKilledLast = CalamityUtils.GetTextValue("Condition.Drops.CatastropheKilledLast"); public static string CynosureText = CalamityUtils.GetTextValue("Condition.Drops.Cynosure"); - public static string ProvidenceHallowText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceHallow"); - public static string ProvidenceUnderworldText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceUnderworld"); - public static string ProvidenceNightText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceNight"); + public static string ProvidenceEnragedText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceEnraged"); public static string ProvidenceChallengeText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceChallenge"); #endregion @@ -284,51 +283,323 @@ namespace CalamityMod } /// - /// Adds all the common potions for fishing crates, alongside scaling mana and regen potions + /// Adds all the common drops for Biome Crates. /// /// The ILoot interface for the loot table. /// Whether or not the crate is considered a hardmode crate. - public static void AddCratePotionRules(this ILoot loot, bool hardMode = true) + public static void AddBiomeCrateLootRules(this ILoot loot, bool hardMode = true) { - loot.Add(ItemID.ObsidianSkinPotion, 10, 1, 3); - loot.Add(ItemID.SwiftnessPotion, 10, 1, 3); - loot.Add(ItemID.IronskinPotion, 10, 1, 3); - loot.Add(ItemID.NightOwlPotion, 10, 1, 3); - loot.Add(ItemID.ShinePotion, 10, 1, 3); - loot.Add(ItemID.MiningPotion, 10, 1, 3); - loot.Add(ItemID.HeartreachPotion, 10, 1, 3); - loot.Add(ItemID.TrapsightPotion, 10, 1, 3); // Dangersense Potion - - // Define all the loot rules for the potion types - var supremePots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ModContent.ItemType(), ModContent.ItemType()); - var superPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.SuperHealingPotion, ItemID.SuperManaPotion); - var greaterPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.GreaterHealingPotion, ItemID.GreaterManaPotion); - var regularPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.HealingPotion, ItemID.ManaPotion); - var lesserPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.LesserHealingPotion, ItemID.LesserManaPotion); - - // Chained LeadingConditionRules achieve the equivalent of "if killed X, else if killed Y, else if killed Z, else..." - var lcrSupremePotion = loot.DefineConditionalDropSet(() => DownedBossSystem.downedDoG); - var lcrSuperPotion = new LeadingConditionRule(If(() => DownedBossSystem.downedProvidence)); - var lcrGreaterPotion = new LeadingConditionRule(If(() => NPC.downedMechBossAny)); - var lcrRegularPotion = new LeadingConditionRule(If(() => NPC.downedBoss3)); - - // Actually chain all the LCRs together - // Greater potions upwards are only chained if the crate is marked as Hardmode if (hardMode) + loot.AddHardmodeOresToCrates(HardmodeCrateType.Biome); + else { - lcrSupremePotion.Add(supremePots); - lcrSupremePotion.OnFailedConditions(lcrSuperPotion); - lcrSuperPotion.Add(superPots); - lcrSuperPotion.OnFailedConditions(lcrGreaterPotion); - lcrGreaterPotion.Add(greaterPots); - lcrGreaterPotion.OnFailedConditions(lcrRegularPotion); + // Pre-Hardmode Ore/Bar loot pools + // 20-35 Ores @ 14.29%; Individually 1.79% + IItemDropRule[] phmOres = new IItemDropRule[8] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TinOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.IronOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.LeadOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.GoldOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumOre, 1, 20, 35) + }; + loot.Add(new OneFromRulesRule(7, phmOres)); + + // 6-16 Bars @ 25%; Individually 4.17% + IItemDropRule[] phmBars = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.IronBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.LeadBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.GoldBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumBar, 1, 6, 16) + }; + loot.Add(new OneFromRulesRule(4, phmBars)); } - lcrRegularPotion.Add(regularPots); - lcrRegularPotion.OnFailedConditions(lesserPots); - // Add the chain starting from regular potions if marked as a Pre-Hardmode crate - if (!hardMode) + + // 2-4 Buff Potions @ 25%; Individually 4.17% + loot.Add(new OneFromRulesRule(4, new IItemDropRule[6] { - loot.Add(lcrRegularPotion); + ItemDropRule.NotScalingWithLuck(ItemID.ObsidianSkinPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.SpelunkerPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.HunterPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.GravitationPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.MiningPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.HeartreachPotion, 1, 2, 4) + })); + + // 5-17 (Regular) Recovery Potions @ 50%; 25% Healing 25% Mana + loot.Add(new OneFromRulesRule(2, new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.HealingPotion, 1, 5, 17), + ItemDropRule.NotScalingWithLuck(ItemID.ManaPotion, 1, 5, 17) + })); + + // 2-6 Bait @ 50%; 25% Master 25% Apprentice + loot.Add(new OneFromRulesRule(2, new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.MasterBait, 1, 2, 6), + ItemDropRule.NotScalingWithLuck(ItemID.ApprenticeBait, 1, 2, 6) + })); + + // 5-12 Gold Coin @ 25% + loot.Add(ItemID.GoldCoin, 4, 5, 12); + } + + /// + /// Adds (or re-adds) Hardmode Ores to crates with respect to Hardmode Progression rework
+ /// Drop rules replicate vanilla's rules. + ///
+ /// The ILoot interface for the loot table. + /// Type of crate: Mythril, Titanium, Biome + public static void AddHardmodeOresToCrates(this ILoot loot, HardmodeCrateType type) + { + var adamantiteLCR = loot.DefineConditionalDropSet(AdamantiteCondition); + var mythrilLCR = new LeadingConditionRule(MythrilCondition); + if (type == HardmodeCrateType.Biome) + { + // Pre-Hardmode loot pools + // 20-35 Ores @ 7.14%; Individually 0.89% + IItemDropRule[] phmOres = new IItemDropRule[8] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TinOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.IronOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.LeadOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.GoldOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumOre, 1, 20, 35) + }; + // 6-16 Bars @ 8.33%; Individually 1.39% + IItemDropRule[] phmBars = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.IronBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.LeadBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.GoldBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumBar, 1, 6, 16) + }; + + // Tier 3 loot pools + // 20-35 Ores @ 7.14%; Individually 1.19% + IItemDropRule[] hmOresThree = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumOre, 1, 20, 35) + }; + // 5-16 Bars @ 16.67%; Individually 2.78% + IItemDropRule[] hmBarsThree = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumBar, 1, 5, 16) + }; + var adamantiteDropsOres = new SequentialRulesNotScalingWithLuckRule(7, new OneFromRulesRule(2, hmOresThree), new OneFromRulesRule(1, phmOres)); + var adamantiteDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsThree), new OneFromRulesRule(1, phmBars)); + + // Tier 2 loot pools + // 20-35 Ores @ 7.14%; Individually 1.79% + IItemDropRule[] hmOresTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 20, 35) + }; + // 5-16 Bars @ 16.67%; Individually 4.17% + IItemDropRule[] hmBarsTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 5, 16) + }; + var mythrilDropsOres = new SequentialRulesNotScalingWithLuckRule(7, new OneFromRulesRule(2, hmOresTwo), new OneFromRulesRule(1, phmOres)); + var mythrilDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsTwo), new OneFromRulesRule(1, phmBars)); + + // Tier 1 loot pools + // 20-35 Ores @ 7.14%; Individually 3.57% + IItemDropRule[] hmOresOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 20, 35) + }; + // 5-16 Bars @ 16.67%; Individually 8.33% + IItemDropRule[] hmBarsOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 5, 16) + }; + var cobaltDropsOres = new SequentialRulesNotScalingWithLuckRule(7, new OneFromRulesRule(2, hmOresOne), new OneFromRulesRule(1, phmOres)); + var cobaltDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsOne), new OneFromRulesRule(1, phmBars)); + + adamantiteLCR.Add(adamantiteDropsOres); + adamantiteLCR.Add(adamantiteDropsBars); + adamantiteLCR.OnFailedConditions(mythrilLCR); + mythrilLCR.Add(mythrilDropsOres); + mythrilLCR.Add(mythrilDropsBars); + mythrilLCR.OnFailedConditions(cobaltDropsOres); + mythrilLCR.OnFailedConditions(cobaltDropsBars); + } + else if (type == HardmodeCrateType.Mythril) + { + // Pre-Hardmode loot pools + // 12-21 Ores @ 8.33%; Individually 1.39% + IItemDropRule[] phmOres = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.TinOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.IronOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.LeadOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 12, 21), + }; + // 4-7 Bars @ 6.94%; Individually 1.16% + IItemDropRule[] phmBars = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.TinBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.IronBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.LeadBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 4, 7), + }; + + // Tier 2 loot pools + // 12-21 Ores @ 8.33%; Individually 2.08% + IItemDropRule[] hmOresTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 12, 21) + }; + // 3-7 Bars @ 13.89%; Individually 3.47% + IItemDropRule[] hmBarsTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 3, 7) + }; + var mythrilDropsOres = new SequentialRulesNotScalingWithLuckRule(6, new OneFromRulesRule(2, hmOresTwo), new OneFromRulesRule(1, phmOres)); + var mythrilDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsTwo), new OneFromRulesRule(1, phmBars)); + var mythrilDrops = new SequentialRulesNotScalingWithLuckRule(1, mythrilDropsOres, mythrilDropsBars); + + // Tier 1 loot pools + // 12-21 Ores @ 8.33%; Individually 4.17% + IItemDropRule[] hmOresOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 12, 21) + }; + // 3-7 Bars @ 13.89%; Individually 6.94% + IItemDropRule[] hmBarsOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 3, 7) + }; + var cobaltDropsOres = new SequentialRulesNotScalingWithLuckRule(6, new OneFromRulesRule(2, hmOresOne), new OneFromRulesRule(1, phmOres)); + var cobaltDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsOne), new OneFromRulesRule(1, phmBars)); + var cobaltDrops = new SequentialRulesNotScalingWithLuckRule(1, cobaltDropsOres, cobaltDropsBars); + + mythrilLCR.Add(mythrilDrops); + mythrilLCR.OnFailedConditions(cobaltDrops); + loot.Add(mythrilLCR); // No Adamantite LCR here so we need to add this in + } + else if (type == HardmodeCrateType.Titanium) + { + // Pre-Hardmode loot pools + // 25-34 Ores @ 10%; Individually 2.5% + IItemDropRule[] phmOres = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.GoldOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumOre, 1, 25, 34) + }; + // 8-11 Bars @ 8.89%; Individually 2.22% + IItemDropRule[] phmBars = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.GoldBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumBar, 1, 8, 11) + }; + + // Tier 3 loot pools + // 25-34 Ores @ 10%; Individually 2.5% + IItemDropRule[] hmOresThree = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumOre, 1, 25, 34) + }; + // 8-11 Bars @ 17.78%; Individually 4.44% + IItemDropRule[] hmBarsThree = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumBar, 1, 8, 11) + }; + var adamantiteDropsOres = new SequentialRulesNotScalingWithLuckRule(5, new OneFromRulesRule(2, hmOresThree), new OneFromRulesRule(1, phmOres)); + var adamantiteDropsBars = new SequentialRulesNotScalingWithLuckRule(3, new OneFromRulesRule(3, 2, hmBarsThree), new OneFromRulesRule(1, phmBars)); + var adamantiteDrops = new SequentialRulesNotScalingWithLuckRule(1, adamantiteDropsOres, adamantiteDropsBars); + + // Tier 2 loot pools + // 25-34 Ores @ 10%; Individually 5% + IItemDropRule[] hmOresTwo = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 25, 34) + }; + // 8-11 Bars @ 17.78%; Individually 8.89% + IItemDropRule[] hmBarsTwo = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 8, 11) + }; + var mythrilDropsOres = new SequentialRulesNotScalingWithLuckRule(5, new OneFromRulesRule(2, hmOresTwo), new OneFromRulesRule(1, phmOres)); + var mythrilDropsBars = new SequentialRulesNotScalingWithLuckRule(3, new OneFromRulesRule(3, 2, hmBarsTwo), new OneFromRulesRule(1, phmBars)); + var mythrilDrops = new SequentialRulesNotScalingWithLuckRule(1, mythrilDropsOres, mythrilDropsBars); + + // Tier 1 loot pools + // EXCEPTION: Titanium Crates do not drop Cobalt. This is added to make it not entirely useless to get early. + // 25-34 Ores @ 10%; Individually 5% + IItemDropRule[] hmOresOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 25, 34) + }; + // 8-11 Bars @ 17.78%; Individually 8.89% + IItemDropRule[] hmBarsOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 8, 11) + }; + var cobaltDropsOres = new SequentialRulesNotScalingWithLuckRule(5, new OneFromRulesRule(2, hmOresOne), new OneFromRulesRule(1, phmOres)); + var cobaltDropsBars = new SequentialRulesNotScalingWithLuckRule(3, new OneFromRulesRule(3, 2, hmBarsOne), new OneFromRulesRule(1, phmBars)); + var cobaltDrops = new SequentialRulesNotScalingWithLuckRule(1, cobaltDropsOres, cobaltDropsBars); + + adamantiteLCR.Add(adamantiteDrops); + adamantiteLCR.OnFailedConditions(mythrilLCR); + mythrilLCR.Add(mythrilDrops); + mythrilLCR.OnFailedConditions(cobaltDrops); } } #endregion @@ -486,10 +757,29 @@ namespace CalamityMod #endregion #region Drop Rule Conditions + public static IItemDropRuleCondition MythrilCondition = If((info) => + { + // If the Early Hardmode Progression Rework is not enabled, then Mythril/Orichalcum can always drop. + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) + return true; + + // If the Early Hardmode Progression Rework is enabled, then any Mechanical Boss must be defeated for Mythril/Orichalcum to drop. + return NPC.downedMechBossAny; + }); + public static IItemDropRuleCondition AdamantiteCondition = If((info) => + { + // If the Early Hardmode Progression Rework is not enabled, then Adamantite/Titanium can always drop. + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) + return true; + + // If the Early Hardmode Progression Rework is enabled, then 2 of the Mechanical Bosses must be defeated for Adamantite/Titanium to drop. + return (NPC.downedMechBoss1 && NPC.downedMechBoss2) || (NPC.downedMechBoss2 && NPC.downedMechBoss3) || (NPC.downedMechBoss1 && NPC.downedMechBoss3); + }); + public static IItemDropRuleCondition HallowedBarsCondition = If((info) => { // If the Early Hardmode Progression Rework is not enabled, then Hallowed Bars can always drop from Mechanical Bosses. - if (!CalamityConfig.Instance.EarlyHardmodeProgressionRework) + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) return true; // If the Early Hardmode Progression Rework is enabled, then all 3 Mechanical Bosses must be defeated for Hallowed Bars to drop. @@ -561,6 +851,10 @@ namespace CalamityMod // The text is a separate rule so it doesn't show up on the non-Trasher Fishing Rod drop which only occurs if the Angler is not fed to a Trasher public static IItemDropRuleCondition TrasherText => CalamityConditions.TrasherTextCondition.ToDropCondition(ShowItemDropInUI.Always); + // Remix seed drop rules + public static IItemDropRuleCondition Remix => Condition.RemixWorld.ToDropCondition(ShowItemDropInUI.WhenConditionSatisfied); + public static IItemDropRuleCondition NotRemix => Condition.NotRemixWorld.ToDropCondition(ShowItemDropInUI.WhenConditionSatisfied); + // Get Fixed Boi seed drop rule public static IItemDropRuleCondition GFB => Condition.ZenithWorld.ToDropCondition(ShowItemDropInUI.WhenConditionSatisfied); @@ -1156,14 +1450,17 @@ namespace CalamityMod return; // If server-side, then the item must be spawned for each client individually. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NPC npc = info.npc; int idx = Item.NewItem(npc.GetSource_Loot(), npc.Center, itemId, stack, true, -1); - Main.timeItemSlotCannotBeReusedFor[idx] = protectionTime; - foreach (Player player in Main.ActivePlayers) - NetMessage.SendData(MessageID.InstancedItem, player.whoAmI, -1, null, idx); - Main.item[idx].active = false; + if (idx < Main.maxItems) + { + Main.timeItemSlotCannotBeReusedFor[idx] = protectionTime; + foreach (Player player in Main.ActivePlayers) + NetMessage.SendData(MessageID.InstancedItem, player.whoAmI, -1, null, idx); + Main.item[idx].active = false; + } } // Otherwise just drop the item. diff --git a/Utilities/EntityUtils.cs b/Utilities/EntityUtils.cs index 96d60c9900..7899a51477 100644 --- a/Utilities/EntityUtils.cs +++ b/Utilities/EntityUtils.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using System; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod @@ -20,5 +22,96 @@ namespace CalamityMod return (destination - entity.Center).SafeNormalize(fallback.Value); } + + /// + /// Adds screenshake to the local player, using the given position and range to determine whether the player is able to see the screenshake. + /// + /// The center of the screenshake, where it is most intense. + /// The maximum intensity of the screenshake. + /// The distance from which the screenshake's power becomes zero. + public static void AddScreenshakeAt(Vector2 position, float intensity, float range = 1000) + { + float dist = 1; + dist -= position.Distance(Main.LocalPlayer.Center) / range; + + dist = Math.Max(dist, 0); + + Main.LocalPlayer.GetModPlayer().GeneralScreenShakePower += (intensity * dist); + } + + /// + /// Check if Entity is null or Inactive (!active) + /// + /// Entity to check + /// true if entity is null or inactive, otherwise false + public static bool IsNullOrInactive(this Entity entity) + { + if (entity is null) return true; + if (!entity.active) return true; + + return false; + } + + #region Fallback Method for IndexInRange + /// + /// Fallback method for Main.npc.IndexInRange which provide accurate range check (0 <= index < Main.maxNPCs) + /// + /// whoAmI index to check + /// true if index is in valid range [0 <= index < Main.maxNPCs] + public static bool IndexInRange(this NPC[] _, int index) + { + if (index >= 0) + return index < Main.maxNPCs; + return false; + } + + /// + /// Fallback method for Main.player.IndexInRange which provide accurate range check (0 <= index < Main.maxPlayers) + /// + /// whoAmI index to check + /// true if index is in valid range [0 <= index < Main.maxPlayers] + public static bool IndexInRange(this Player[] _, int index) + { + if (index >= 0) + return index < Main.maxPlayers; + return false; + } + + /// + /// Fallback method for Main.projectile.IndexInRange which provide accurate range check (0 <= index < Main.maxProjectiles) + /// + /// whoAmI index to check + /// true if index is in valid range [0 <= index < Main.maxProjectiles] + public static bool IndexInRange(this Projectile[] _, int index) + { + if (index >= 0) + return index < Main.maxProjectiles; + return false; + } + + /// + /// Fallback method for Main.gore.IndexInRange which provide accurate range check (0 <= index < Main.maxGore) + /// + /// whoAmI index to check + /// true if index is in valid range [0 <= index < Main.maxGore] + public static bool IndexInRange(this Gore[] _, int index) + { + if (index >= 0) + return index < Main.maxGore; + return false; + } + + /// + /// Fallback method for Main.npc.IndexInRange which provide accurate range check (0 <= index < Main.maxDust) + /// + /// whoAmI index to check + /// true if index is in valid range [0 <= index < Main.maxDust] + public static bool IndexInRange(this Dust[] _, int index) + { + if (index >= 0) + return index < Main.maxDust; + return false; + } + #endregion } } diff --git a/Utilities/ExtraArmAnimations.cs b/Utilities/ExtraArmAnimations.cs index 4556398e2d..64a657db85 100644 --- a/Utilities/ExtraArmAnimations.cs +++ b/Utilities/ExtraArmAnimations.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Utilities { player.Calamity().mouseWorldListener = true; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 mW = player.Calamity().mouseWorld; float value1 = player.direction * -90; @@ -36,6 +37,7 @@ namespace CalamityMod.Utilities { player.Calamity().mouseWorldListener = true; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 mW = player.Calamity().mouseWorld; float value1 = player.direction * -90; diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs index 61898018c4..c5cb3cd6d2 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Utilities/FurnitureSetupUtils.cs @@ -934,6 +934,7 @@ namespace CalamityMod Main.tileNoAttach[mt.Type] = true; Main.tileLavaDeath[mt.Type] = !lavaImmune; Main.tileWaterDeath[mt.Type] = false; + TileID.Sets.MultiTileSway[mt.Type] = true; TileObjectData.newTile.Width = 3; TileObjectData.newTile.Height = 3; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; @@ -1251,6 +1252,7 @@ namespace CalamityMod Main.tileLavaDeath[mt.Type] = !lavaImmune; Main.tileWaterDeath[mt.Type] = false; TileID.Sets.DisableSmartCursor[mt.Type] = true; + TileID.Sets.MultiTileSway[mt.Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); TileObjectData.newTile.LavaDeath = !lavaImmune; TileObjectData.newTile.LavaPlacement = lavaImmune ? LiquidPlacement.Allowed : LiquidPlacement.NotAllowed; @@ -1270,19 +1272,6 @@ namespace CalamityMod mt.AdjTiles = new int[] { TileID.HangingLanterns }; } - // Allow hanging lanterns to move up when hung on platforms - internal static void PlatformHangOffset(int i, int j, ref int offsetY) - { - Tile tile = Main.tile[i, j]; - TileObjectData data = TileObjectData.GetTileData(tile); - int topLeftX = i - tile.TileFrameX / 18 % data.Width; - int topLeftY = j - tile.TileFrameY / 18 % data.Height; - if (WorldGen.IsBelowANonHammeredPlatform(topLeftX, topLeftY)) - { - offsetY -= 8; - } - } - /// /// Extension which initializes a ModTile to be a piano. /// diff --git a/Utilities/GenericAIUtils.cs b/Utilities/GenericAIUtils.cs index 769978d9bb..49fbf5fa78 100644 --- a/Utilities/GenericAIUtils.cs +++ b/Utilities/GenericAIUtils.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.CalPlayer; +using CalamityMod.Enums; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -29,7 +30,10 @@ namespace CalamityMod projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.extraUpdates = initialUpdates; - projectile.numUpdates = 0; + // CIT 2OCT2024: This line was breaking how the game counted minions, + // which resulted in minions being counted extra times and despawning other minions, most notoriously with Resurrection Butterfly. + // As such, I have commented it out. + // projectile.numUpdates = 0; projectile.netUpdate = true; } else @@ -214,6 +218,33 @@ namespace CalamityMod } } + public static void MinionAntiClump(this Projectile projectile, float pushForce = 0.05f) + { + 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 || otherProj.owner != projectile.owner || !otherProj.minion || 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 = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); + if (sameProjType && taxicabDist < projectile.width) + { + 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; + } + } + } + public static void FloatingPetAI(this Projectile projectile, bool faceRight, float tiltFloat, bool lightPet = false) { Player player = Main.player[projectile.owner]; @@ -357,15 +388,10 @@ namespace CalamityMod 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) { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + if (projectile.owner == Main.myPlayer && !Main.LocalPlayer.moonLeech) { int healAmt = healing; - player.HealEffect(healAmt, false); - player.statLife += healAmt; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } + player.HealPlayer(healAmt, HealTextType.Local); NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); } projectile.Kill(); diff --git a/Utilities/GlobalEntityUtils.cs b/Utilities/GlobalEntityUtils.cs new file mode 100644 index 0000000000..5376de2c92 --- /dev/null +++ b/Utilities/GlobalEntityUtils.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; +using Terraria; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + /// + /// Actual "Thread-Safe" version of TryGetGlobalNPC + /// + /// GlobalNPC type to get + /// Input NPC + /// GlobalNPC output + /// true If we successfully get GlobalNPC. otherwise false + public static bool TryGetGlobalNPCSafer(this NPC npc, out T globalNPC) where T : GlobalNPC + { + try + { + if (npc is null) + { + globalNPC = null; + return false; + } + + int slot = ModContent.GetInstance()?.PerEntityIndex ?? -1; + int length = npc.EntityGlobals.Length; + if (slot < 0 || slot >= length) + { + globalNPC = null; + return false; + } + + npc.TryGetGlobalNPC(out globalNPC); + return globalNPC != null; + } + catch + { + globalNPC = null; + return false; + } + } + } +} diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index ac3d171e1d..286212804b 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -112,6 +112,7 @@ namespace CalamityMod // This is the hardcoded value to "do nothing", and is thus the default choice. int prefix = -1; + bool supportsLegendary = PrefixLegacy.ItemSets.SwordsHammersAxesPicks[item.type] || (item.ModItem != null && item.ModItem.MeleePrefix()); // ACCESSORIES if (item.accessory) @@ -139,7 +140,8 @@ namespace CalamityMod } // MELEE (includes tools and whips) - else if (item.CountsAsClass() || item.CountsAsClass() || item.CountsAsClass()) + // Melee-ranged hybrid weapons prioritize Legendary if available, otherwise go for Unreal + else if ((item.CountsAsClass() || item.CountsAsClass()) && !(item.CountsAsClass() && !supportsLegendary)) { // Terrarian (has its own special "Legendary" for marketing reasons) // Other items that want to use Legendary2 are also compatible @@ -156,7 +158,7 @@ namespace CalamityMod } // Swords, Whips, Tools, other items that support the Legendary modifier - else if (PrefixLegacy.ItemSets.SwordsHammersAxesPicks[item.type] || (item.ModItem != null && item.ModItem.MeleePrefix())) + else if (supportsLegendary) { int[][] meleeReforgeTiers = new int[][] { @@ -185,12 +187,15 @@ namespace CalamityMod // Spears actually work fine with Legendary, but vanilla doesn't give it to them, so we won't either. else { + // 14MAR2025: Ozzatron: Add support for allowing Ruthless over Godly if the player has more than 100% crit chance of the appropriate class + bool has100Crit = Main.LocalPlayer.GetTotalCritChance(item.DamageType) >= 100; + int[][] meleeNoSpeedReforgeTiers = new int[][] { /* 0 */ new int[] { PrefixID.Keen, PrefixID.Forceful, PrefixID.Strong }, /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous }, /* 2 */ new int[] { PrefixID.Superior, PrefixID.Demonic }, - /* 3 */ new int[] { PrefixID.Godly } + /* 3 */ has100Crit ? new int[] { PrefixID.Godly, PrefixID.Ruthless } : new int[] { PrefixID.Godly } }; prefix = IteratePrefix(rand, meleeNoSpeedReforgeTiers, currentPrefix); } @@ -433,7 +438,7 @@ namespace CalamityMod public static Rectangle FixSwingHitbox(float hitboxWidth, float hitboxHeight) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; Item item = player.ActiveItem(); float hitbox_X, hitbox_Y; float mountOffsetY = player.mount.PlayerOffsetHitbox; @@ -652,7 +657,7 @@ namespace CalamityMod healAmt = 0; } - player.statLife += healAmt; + player.HealPlayer(healAmt, healAmt > 0 ? Enums.HealTextType.Broadcast : Enums.HealTextType.None); player.statMana += item.healMana; if (player.statMana > player.statManaMax2) { @@ -666,8 +671,6 @@ namespace CalamityMod player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); if (Main.myPlayer == player.whoAmI) { - if (healAmt > 0) - player.HealEffect(healAmt, true); if (item.healMana > 0) player.ManaEffect(item.healMana); } @@ -711,6 +714,15 @@ namespace CalamityMod } } + public static void RestoreConsumedItemByRightClick(this Item item) + { + bool favorited = item.favorited; + item.SetDefaults(item.type); + item.stack++; + item.favorited = favorited; + item.NetStateChanged(); + } + #region Rogue Prefixes public static int RandomRoguePrefix() { diff --git a/Utilities/LightingUtils.cs b/Utilities/LightingUtils.cs new file mode 100644 index 0000000000..fd7f9d330e --- /dev/null +++ b/Utilities/LightingUtils.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Waters; +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + public static void SunkenSeaWaterLighting(int x, int y, Vector3 waterColor, ref float r, ref float g, ref float b) + { + float tick = (float)Main.timeForVisualEffects; + float brightness = MathHelper.Clamp(0.07f, 0f, 0.07f); + float waveScale1 = tick * 0.028f; + float waveScale2 = tick * 0.1f; + int yScale = -y / 2; + int xScale = x / 15; + float wave1 = tick * 0.024f * -50 + ((-x / 30) + (y / 30)) * 25; + float wave2 = waveScale2 * -10 + ((-xScale) + yScale) * 45; + float wave3 = waveScale1 * -100 + ((x / 7) + (y / 50)) * 25; + float wave4 = tick * 0.15f * 10 + ((x / 3) + yScale) * 45; + float wave5 = waveScale1 * -70 + ((-x / 25) + (-y / 25)) * 20; + float wave6 = waveScale2 * -10 + (xScale + yScale) * 45; + float bigwave = tick * 0.01f * -70 + ((-x / 2) + (-y / 40)) * 5; + float wave1angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave1)); + float wave2angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave2)); + float wave3angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave3)); + float wave4angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave4)); + float wave5angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave5)); + float wave6angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave6)); + float bigwaveangle = 0.55f + 0.80f * MathF.Sin(MathHelper.ToRadians(bigwave)); + float sumofwave = 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle; + + r = MathHelper.Lerp(r, waterColor.X, sumofwave) * brightness; + g = MathHelper.Lerp(g, waterColor.Y, sumofwave) * brightness; + b = MathHelper.Lerp(b, waterColor.Z, sumofwave) * brightness; + } + } +} diff --git a/Utilities/LocalizationUtils.cs b/Utilities/LocalizationUtils.cs index 6ec6e5d93a..07d6a8c75f 100644 --- a/Utilities/LocalizationUtils.cs +++ b/Utilities/LocalizationUtils.cs @@ -79,5 +79,22 @@ namespace CalamityMod /// NOTE: Modded translations are not loaded until after PostSetupContent.Caching the result is suggested. /// public static string GetTextValueFromModItem(string suffix) where T : ModItem => GetTextFromModItem(ModContent.ItemType(), suffix).ToString(); + + #region Tooltip Format Helper + public static string FramesToSeconds(this int frame) => Round(frame / 60f, "N2"); + + public static string ToMph(this float velocity) => Round(velocity * 216000f / 42240f, "N0"); + public static string ToMphps(this float velocity) => Round(velocity * 60f * 216000f / 42240f, "N2"); + public static string ToTiles(this float pixel) => Round(pixel / 16f); + + public static string ToRegenPerSecond(this int regen) => Round(regen * 0.5f, "N2"); + public static string ToJumpSpeedPercent(this float boost) => Round(boost * 20f, "N2"); + + public static string ToPercent(this float percent, string precision = "N1") => Round(percent * 100f, precision); + public static string ToPercent(this double percent, string precision = "N1") => Round(percent * 100D, precision); + // Double-rounded for proper digit cutoffs + public static string Round(this float number, string precision = "N4") => float.Parse((number).ToString(precision)).ToString(); + public static string Round(this double number, string precision = "N4") => float.Parse((number).ToString(precision)).ToString(); + #endregion } } diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index 1813494294..371d956ac7 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -1,6 +1,9 @@ using System; using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.Xml; using Microsoft.Xna.Framework; +using ReLogic.Threading; using Terraria; namespace CalamityMod @@ -88,6 +91,8 @@ namespace CalamityMod /// The second point. public static float ManhattanDistance(this Vector2 a, Vector2 b) => Math.Abs(a.X - b.X) + Math.Abs(a.Y - b.Y); + public static int ManhattanDistance(this Point a, Point b) => Math.Abs(a.X - b.X) + Math.Abs(a.Y - b.Y); + /// /// Wraps an angle between -90 and 90 degrees. If an angle goes past this range it'll go back to the other end. /// @@ -220,6 +225,43 @@ namespace CalamityMod /// The input value. public static int DirectionalSign(this float x) => (x > 0f).ToDirectionInt(); + public static List GetIntersectingPointsInLine(Point start, Point end) + { + List intersectingCells = []; + + int dx = Math.Abs(end.X - start.X); + int dy = Math.Abs(end.Y - start.Y); + int sx = start.X < end.X ? 1 : -1; + int sy = start.Y < end.Y ? 1 : -1; + int err = dx - dy; + + while (true) + { + // Add the current cell to the list + intersectingCells.Add(start); + + // Check if we've reached the end point + if (start == end) + break; + + int e2 = 2 * err; + if (e2 > -dy) + { + err -= dy; + start.X += sx; + } + if (e2 < dx) + { + err += dx; + start.Y += sy; + } + } + + return intersectingCells; + } + + public static List GetIntersectingPointsInLine(Vector2 start, Vector2 end) => GetIntersectingPointsInLine(start.ToTileCoordinates(), end.ToTileCoordinates()); + #region Easings /// /// Gets a value from 0 to 1 and returns an eased value. diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 3654c3679a..89973967e4 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Tools.ClimateChange; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; @@ -25,7 +27,7 @@ namespace CalamityMod if (Main.netMode == NetmodeID.SinglePlayer) Main.NewText(Language.GetTextValue(key), textColor.Value); - else if (Main.netMode == NetmodeID.Server || Main.netMode == NetmodeID.MultiplayerClient) + else if (Main.dedServ || Main.netMode == NetmodeID.MultiplayerClient) ChatHelper.BroadcastChatMessage(NetworkText.FromKey(key), textColor.Value); } @@ -137,7 +139,7 @@ namespace CalamityMod if (soundPos.X == -1f || soundPos.Y == -1f) volume = 1f; - else if (WorldGen.gen || Main.dedServ || Main.netMode == NetmodeID.Server) + else if (WorldGen.gen || Main.dedServ || Main.dedServ) volume = 0f; else { @@ -195,91 +197,6 @@ namespace CalamityMod sfx.Volume = MathHelper.Clamp(sfx.Volume * volumeMultiplier, 0f, 1f); } - public static void StartRain(bool torrentialTear = false, bool maxSeverity = false) - { - int framesInDay = 86400; - int framesInHour = framesInDay / 24; - Main.rainTime = Main.rand.Next(framesInHour * 8, framesInDay); - if (Main.rand.NextBool(3)) - { - Main.rainTime += Main.rand.Next(0, framesInHour); - } - if (Main.rand.NextBool(4)) - { - Main.rainTime += Main.rand.Next(0, framesInHour * 2); - } - if (Main.rand.NextBool(5)) - { - Main.rainTime += Main.rand.Next(0, framesInHour * 2); - } - if (Main.rand.NextBool(6)) - { - Main.rainTime += Main.rand.Next(0, framesInHour * 3); - } - if (Main.rand.NextBool(7)) - { - Main.rainTime += Main.rand.Next(0, framesInHour * 4); - } - if (Main.rand.NextBool(8)) - { - Main.rainTime += Main.rand.Next(0, framesInHour * 5); - } - float randRainExtender = 1f; - if (Main.rand.NextBool()) - { - randRainExtender += 0.05f; - } - if (Main.rand.NextBool(3)) - { - randRainExtender += 0.1f; - } - if (Main.rand.NextBool(4)) - { - randRainExtender += 0.15f; - } - if (Main.rand.NextBool(5)) - { - randRainExtender += 0.2f; - } - Main.rainTime = (int)(Main.rainTime * randRainExtender); - Main.raining = true; - if (torrentialTear) - TorrentialTear.AdjustRainSeverity(maxSeverity); - CalamityNetcode.SyncWorld(); - } - - 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 < 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) - { - Main.windSpeedCurrent = windSpeed < 0f ? -0.2f : 0.2f; - Main.windSpeedTarget = windSpeed; - } - Sandstorm.StartSandstorm(); - } - - public static void StopSandstorm() - { - Terraria.GameContent.Events.Sandstorm.Happening = false; - } - public static void AddWithCondition(this List list, T type, bool condition) { if (condition) @@ -288,6 +205,7 @@ namespace CalamityMod public static int SecondsToFrames(int seconds) => seconds * 60; public static int SecondsToFrames(float seconds) => (int)(seconds * 60); + public static int MinutesToFrames(int minutes) => minutes * 3600; public static bool WithinBounds(this int index, int cap) => index >= 0 && index < cap; diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index d147204c86..cdea134597 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -35,6 +35,7 @@ using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -98,14 +99,10 @@ namespace CalamityMod // PART 2: Specific other cases that can't be neatly fit into the database // - // All bosses and several enemies are automatically immune to Pearl Aura. - if (CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) - NPCID.Sets.SpecificDebuffImmunity[npc.type][ModContent.BuffType()] = true; - // Make all Cal NPCs immune to confused unless otherwise specified // Extra note: Clams are not in this list as they initially immune to Confused, but are no longer immune once aggro'd. This is set in their AI(). bool cal = npc.ModNPC != null && npc.ModNPC.Mod.Name.Equals(ModContent.GetInstance().Name); - if (!CalamityLists.confusionEnemyList.Contains(npc.type) && cal) + if (!ConfusionDebuffImmunitiesList.Includes(npc.type) && cal) NPCID.Sets.SpecificDebuffImmunity[npc.type][BuffID.Confused] = true; // Sets certain vanilla NPCs and all town NPCs to be immune to most debuffs. @@ -144,9 +141,10 @@ namespace CalamityMod private static readonly int[] sunkenSeaEnemyImmunities = new int[2] { ModContent.BuffType(), ModContent.BuffType() }; private static readonly int[] abyssEnemyImmunities = new int[2] { ModContent.BuffType(), ModContent.BuffType() }; private static readonly int[] cragEnemyImmunities = new int[3] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType() }; + private static readonly int[] scalImmunities = new int[5] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType() }; private static readonly int[] astralEnemyImmunities = new int[2] { BuffID.Poisoned, ModContent.BuffType() }; private static readonly int[] plagueEnemyImmunities = new int[3] { BuffID.Poisoned, BuffID.Venom, ModContent.BuffType() }; - private static readonly int[] holyEnemyImmunities = new int[4] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType(), ModContent.BuffType() }; + private static readonly int[] holyEnemyImmunities = new int[4] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType(), BuffID.Daybreak }; #endregion #region Load/Unload @@ -164,6 +162,7 @@ namespace CalamityMod Tuple sunkenSea = new(GeneralImmunityStatus.None, sunkenSeaEnemyImmunities); Tuple abyss = new(GeneralImmunityStatus.None, abyssEnemyImmunities); Tuple crags = new(GeneralImmunityStatus.None, cragEnemyImmunities); + Tuple scal = new(GeneralImmunityStatus.None, scalImmunities); Tuple astral = new(GeneralImmunityStatus.None, astralEnemyImmunities); Tuple plague = new(GeneralImmunityStatus.None, plagueEnemyImmunities); Tuple holy = new(GeneralImmunityStatus.None, holyEnemyImmunities); @@ -252,6 +251,7 @@ namespace CalamityMod { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, { ModContent.NPCType(), holy }, { ModContent.NPCType(), holy }, @@ -269,7 +269,7 @@ namespace CalamityMod { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType(), ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType() }) }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, @@ -292,11 +292,11 @@ namespace CalamityMod { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), crags }, - { ModContent.NPCType(), crags }, - { ModContent.NPCType(), crags }, - { ModContent.NPCType(), crags }, - { ModContent.NPCType(), crags }, + { ModContent.NPCType(), scal }, + { ModContent.NPCType(), scal }, + { ModContent.NPCType(), scal }, + { ModContent.NPCType(), scal }, + { ModContent.NPCType(), scal }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, @@ -332,17 +332,13 @@ namespace CalamityMod { ModContent.NPCType(), sulphur }, { ModContent.NPCType(), sulphur }, - { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, @@ -418,10 +414,9 @@ namespace CalamityMod { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.Poisoned, BuffID.Venom }) }, { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.Poisoned, BuffID.Venom }) }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.Electrified, ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.Electrified, ModContent.BuffType() }) }, { ModContent.NPCType(), slime }, { ModContent.NPCType(), slime }, diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index 303e492a5d..c1626cd92a 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -6,18 +6,22 @@ using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Enums; using CalamityMod.Events; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.Yharon; +using CalamityMod.Packets; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.Chat; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -173,7 +177,7 @@ namespace CalamityMod return true; } } - return FindFirstProjectile(ProjectileType()) != -1; + return false; } #endregion @@ -298,14 +302,7 @@ namespace CalamityMod if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = CalamityMod.Instance.GetPacket(); - packet.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); - packet.Write((byte)npc.whoAmI); - - for (int i = 0; i < npc.Calamity().newAI.Length; i++) - packet.Write(npc.Calamity().newAI[i]); - - packet.Send(); + SyncCalamityNPCAIArrayPacket.Send(npc); } /// @@ -318,14 +315,19 @@ namespace CalamityMod if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = CalamityMod.Instance.GetPacket(); - packet.Write((byte)CalamityModMessageType.SyncVanillaNPCLocalAIArray); - packet.Write((byte)npc.whoAmI); + SyncVanillaNPCLocalAIArrayPacket.Send(npc); + } - for (int i = 0; i < NPC.maxAI; i++) - packet.Write(npc.localAI[i]); - - packet.Send(); + /// + /// Helper method which both sets and resets to 0 to prevent the net update from being blocked. + /// + /// + /// If set to false, the method will only reset if it is greater than or equal to 10. + public static void ForceNetUpdate(this NPC npc, bool ignoreCurrentNetSpam = true) + { + npc.netUpdate = true; + if (npc.netSpam >= 10 || ignoreCurrentNetSpam) + npc.netSpam = 0; } /// @@ -337,12 +339,12 @@ namespace CalamityMod if (Main.netMode != NetmodeID.MultiplayerClient) return; - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncNPCMotionDataToServer); - netMessage.Write(npc.whoAmI); - netMessage.WriteVector2(npc.Center); - netMessage.WriteVector2(npc.velocity); - netMessage.Send(); + SyncNPCMotionDataToServerPacket.Send(npc); + } + + public static void SyncNPCPosAndRotOnly(this NPC npc) + { + SyncNPCPosAndRotOnlyPacket.Send(npc); } /// @@ -355,11 +357,7 @@ namespace CalamityMod 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(); + SyncDestroyerLaserColorPacket.Send(npc); } #endregion @@ -750,11 +748,25 @@ namespace CalamityMod if (CalamityPlayer.areThereAnyDamnBosses) ignoreKBImmune = false; 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, false) && (ignoreKBImmune ? true : target.knockBackResist > 0)) + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && (ignoreKBImmune || target.knockBackResist > 0)) return true; return false; } - + /// + /// Moves an NPC, usually used as custom knockback + /// + /// The NPC being moved. + /// Whether or not NPC's that normally have knockback immunity can be moved around. + public static void MoveNPC(this NPC target, Vector2 direction, float strength, bool ignoreKBImmune = false) + { + if (target.CanBeMoved(ignoreKBImmune)) + { + Vector2 launchVel = direction.SafeNormalize(Vector2.UnitX) * strength; + float knockbackMult = Utils.Remap(target.knockBackResist, 0, 1, 0.5f, 1f, false); + target.velocity = launchVel * (knockbackMult > 1 ? (float)Math.Pow(knockbackMult, 10) : knockbackMult); + } + target.SyncMotionToServer(); + } public static void Inflict246DebuffsNPC(NPC target, int buff, float timeBase = 2f) { if (Main.rand.NextBool(4)) @@ -771,6 +783,44 @@ namespace CalamityMod } } + /// + /// Spawns a indicating the amount of damage manually dealt to the NPC, such as from self-damage. Automatically syncs it in multiplayer. + /// + public static void DamageEffect(this NPC npc, int damageAmount) + { + Rectangle r = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + Color textColor = new Color(255, 30, 100); + if (Main.dedServ) + NetMessage.SendData(MessageID.CombatTextInt, -1, -1, null, (int)textColor.PackedValue, r.Center.X, r.Center.Y, damageAmount); + else + CombatText.NewText(r, textColor, damageAmount); + } + + public static void ProduceGoldCritterDust(this NPC npc) + { + npc.position += npc.netOffset; + Color color = Lighting.GetColor((int)npc.Center.X / 16, (int)npc.Center.Y / 16); + if (color.R > 20 || color.B > 20 || color.G > 20) + { + int colorVal = color.R; + if (color.G > colorVal) + { + colorVal = color.G; + } + if (color.B > colorVal) + { + colorVal = color.B; + } + colorVal /= 30; + if (Main.rand.Next(300) < colorVal) + { + int golddust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TintableDustLighted, 0f, 0f, 254, new Color(255, 255, 0), 0.5f); + Main.dust[golddust].velocity *= 0f; + } + } + npc.position -= npc.netOffset; + } + public static NPCShop AddWithCustomValue(this NPCShop shop, int itemType, int customValue, params Condition[] conditions) { var item = new Item(itemType) @@ -798,6 +848,65 @@ namespace CalamityMod } } + public static bool DrawAnimatedBestiaryWorm(SpriteBatch spriteBatch, NPC npc, Color drawColor, Texture2D headTexture, Texture2D bodyTexture, int segmentCount, int segmentSpacing, float rotationStrength, Vector2 baseOffset, int animationSpeed, float range, float headOffset = 0, float headSpeedOffset = 0, bool flip = false) + { + DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, headTexture, [bodyTexture], segmentCount, segmentSpacing, rotationStrength, baseOffset, animationSpeed, range, headOffset, headSpeedOffset, flip); + return false; + } + + public static bool DrawAnimatedBestiaryWorm(SpriteBatch spriteBatch, NPC npc, Color drawColor, Texture2D headTexture, Texture2D bodyTexture, Texture2D bodyTextureAlt, int segmentCount, int segmentSpacing, float rotationStrength, Vector2 baseOffset, int animationSpeed, float range, float headOffset = 0, float headSpeedOffset = 0, bool flip = false) + { + DrawAnimatedBestiaryWorm(spriteBatch, npc, drawColor, headTexture, [bodyTexture, bodyTextureAlt], segmentCount, segmentSpacing, rotationStrength, baseOffset, animationSpeed, range, headOffset, headSpeedOffset, flip); + return false; + } + + /// + /// Draws animated wiggly worms for the Bestiary + /// + /// The PreDraw's SpriteBatch + /// The NPC to draw + /// The NPC's drawColor + /// The worm's head texture + /// The worm's body textures + /// The amount of segments that should be added + /// The spacing between segments + /// How strongly the worm rotates. Higher values cause it to make sharper turns + /// Moves around the position of the worm + /// How fast the worm moves + /// How far up and down the worm moves + /// How far to bash (move) the head horizontally in case the automated math is too off or the worm's head extends past its neck joint + /// Offsets the animation progression for the head. Meant to pair with headOffset + /// If the sprites should be flipped. Used for worms viewed from the side like Wyverns + /// + public static bool DrawAnimatedBestiaryWorm(SpriteBatch spriteBatch, NPC npc, Color drawColor, Texture2D headTexture, Texture2D[] bodyTextures, int segmentCount, int segmentSpacing, float rotationStrength, Vector2 baseOffset, int animationSpeed, float range, float headOffset = 0, float headSpeedOffset = 0, bool flip = false) + { + npc.frame = headTexture.Frame(); + // Buffers the segment position and rotations + float offset = -0.2f; + float startX = baseOffset.X; + float startY = baseOffset.Y; + SpriteEffects fx = flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + float wormTimer = npc.Calamity().bestiaryWormTimer; + // Draw the body segments + for (int i = segmentCount; i > 0; i--) + { + // The first segment is slightly closer to keep up with the head + float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; + + // If there's only one texture passed in, use it for all segments + // If two are passed in, alternate between them + // If more are passed in, each iteration must correspond to a texture + Texture2D toUse = bodyTextures.Length == 1 ? bodyTextures[0] : bodyTextures.Length == 2 ? (i % 2 == 0 ? bodyTextures[0] : bodyTextures[1]) : bodyTextures[i - 1]; + spriteBatch.Draw(toUse, npc.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * range + startY), toUse.Frame(1, 1, 0, 0), npc.GetAlpha(drawColor), npc.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * rotationStrength, toUse.Size () / 2, npc.scale, fx, 0f); + } + // Draw the head + spriteBatch.Draw(headTexture, npc.position + new Vector2(startX + headOffset, MathF.Sin((wormTimer - headSpeedOffset) * animationSpeed) * range + startY), npc.frame, npc.GetAlpha(drawColor), npc.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer - headSpeedOffset) * animationSpeed) * MathHelper.PiOver4 * rotationStrength, new Vector2(headTexture.Width * 0.5f, headTexture.Height), npc.scale, fx, 0f); + + return false; + } + + public static bool HasSight(this NPC npc, Vector2 target) => Collision.CanHit(npc.Center, 1, 1, target, 1, 1); + #region Boss Spawning /// /// Shortcut for the generic boss summon message. @@ -811,9 +920,9 @@ namespace CalamityMod { Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), new Color(175, 75, 255)); } - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) { - ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[] { Main.npc[npcIndex].GetTypeNetName() }), new Color(175, 75, 255)); + ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", [Main.npc[npcIndex].GetTypeNetName()]), new Color(175, 75, 255)); } } @@ -850,6 +959,103 @@ namespace CalamityMod return null; } + /// + /// Spawn Boss Method for Using Spawn Items + /// NOTE: This method use vanilla's spawn position behaviour! + /// + /// Player who used Item + /// Boss's NPCType to spawn + /// Sound to play when spawn, it play on used player's position + public static void SpawnBossUsingItem(Player player, int npcType, in SoundStyle? spawnSound = null) + { + SoundEngine.PlaySound(spawnSound, player.Center); + + if (player.whoAmI != Main.myPlayer) + return; + + // NOTE: MP netcode can be simplified by directly spawn npc like SpawnBossOnPosUsingItem does + // but leaving this as vanilla's standard now + switch (Main.netMode) + { + // SP: Spawn Boss Immediately + case NetmodeID.SinglePlayer: + NPC.SpawnOnPlayer(player.whoAmI, npcType); + break; + + // MP: Ask server to spawn one + case NetmodeID.MultiplayerClient: + NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, npcType); + break; + } + } + + /// + /// Spawn Boss Method for Using Spawn Items + /// NOTE: This method use vanilla's spawn position behaviour! + /// + /// Boss's NPCType to spawn + /// Player who used Item + /// Sound to play when spawn, it play on used player's position + public static void SpawnBossUsingItem(Player player, in SoundStyle? spawnSound = null) where BossType : ModNPC + { + SpawnBossUsingItem(player, NPCType(), spawnSound); + } + + /// + /// Spawn Boss Method for Using Spawn Items + /// NOTE: This method can override spawn position to anywhere you want + /// + /// Player who used Item + /// Boss's NPCType to spawn + /// Spawn Position X + /// Spawn Position Y + /// Sound to play when spawn, it play on used player's position + /// Spawned NPC Instance, null on MultiplayerClient + public static NPC SpawnBossOnPosUsingItem(Player player, int npcType, int worldX, int worldY, in SoundStyle? spawnSound = null) + { + SoundEngine.PlaySound(spawnSound, player.Center); + + // SP or SERVER: Spawn Boss Immediately + // This will ensure NPC to be spawned only once on Item.UseItem + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spawnedNPCIdx = NPC.NewNPC(new EntitySource_BossSpawn(target: player), worldX, worldY, npcType, Start: 1); + + // 200 is invalid Index + if (spawnedNPCIdx >= 200) + return null; + + BossAwakenMessage(spawnedNPCIdx); + NPC npc = Main.npc[spawnedNPCIdx]; + npc.timeLeft *= 20; + + // Server Exclusive: Sync NPC Data + if (Main.dedServ) + { + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, spawnedNPCIdx); + } + + return npc; + } + + return null; + } + + /// + /// Spawn Boss Method for Using Spawn Items + /// NOTE: This method can override spawn position to anywhere you want + /// + /// + /// Player who used Item + /// Spawn Position X + /// Spawn Position Y + /// Sound to play when spawn, it play on used player's position + /// Spawned NPC Instance, null on MultiplayerClient + public static NPC SpawnBossOnPosUsingItem(Player player, int worldX, int worldY, in SoundStyle? spawnSound = null) where BossType : ModNPC + { + return SpawnBossOnPosUsingItem(player, NPCType(), worldX, worldY, spawnSound); + } + /// /// Spawns Old Duke on a player. Only works server side, and only works if the player owns a fishing bobber.
/// Old Duke will spawn above the fishing bobber if one is found. @@ -857,7 +1063,7 @@ namespace CalamityMod /// The index of the player who will spawn Old Duke. internal static void SpawnOldDuke(int playerIndex) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) return; Player player = Main.player[playerIndex]; diff --git a/Utilities/NetcodeUtils.cs b/Utilities/NetcodeUtils.cs new file mode 100644 index 0000000000..1d39b336ec --- /dev/null +++ b/Utilities/NetcodeUtils.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using CalamityMod.Enums; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + #region TileEntity RW + public static void WriteTileEntityID(this BinaryWriter writer, TileEntity tileEntity) + { + if (tileEntity is null) + { + writer.Write(int.MaxValue); + return; + } + + if (!TileEntity.ByID.ContainsKey(tileEntity.ID)) + { + writer.Write(int.MaxValue); + return; + } + + writer.Write(tileEntity.ID); + } + + public static TileEntityType ReadTileEntity(this BinaryReader reader) where TileEntityType : TileEntity + => ReadTileEntity(reader) as TileEntityType; + + public static TileEntity ReadTileEntity(this BinaryReader reader) + { + var id = reader.ReadInt32(); + bool exists = TileEntity.ByID.TryGetValue(id, out TileEntity tileEntity); + + return exists ? tileEntity : null; + } + #endregion TileEntity RW + + #region Entity RW + public static void WriteWhoAmI(this BinaryWriter writer, ModPlayer player) => WriteWhoAmI(writer, player?.Player); + public static void WriteWhoAmI(this BinaryWriter writer, Player player) + { + byte whoAmI = (byte)(player?.whoAmI ?? Main.maxPlayers); + writer.Write(whoAmI); + } + + public static void WriteWhoAmI(this BinaryWriter writer, ModNPC npc) => WriteWhoAmI(writer, npc?.NPC); + public static void WriteWhoAmI(this BinaryWriter writer, NPC npc) + { + byte whoAmI = (byte)(npc?.whoAmI ?? Main.maxNPCs); + writer.Write(whoAmI); + } + + public static CalamityPlayer ReadCalamityPlayer(this BinaryReader reader, bool nullOnInactive = true) => ReadPlayer(reader, nullOnInactive)?.Calamity() ?? null; + public static Player ReadPlayer(this BinaryReader reader, bool nullOnInactive = true) + { + int index = reader.ReadByte(); + + if (index >= Main.maxPlayers) + return null; + + var player = Main.player[index]; + + if (nullOnInactive && player.IsNullOrInactive()) + return null; + + return player; + } + + public static NPCType ReadModNPC(this BinaryReader reader, bool nullOnInactive = true) where NPCType : ModNPC => ReadNPC(reader, nullOnInactive)?.ModNPC as NPCType; + public static ModNPC ReadModNPC(this BinaryReader reader, bool nullOnInactive = true) => ReadNPC(reader, nullOnInactive)?.ModNPC ?? null; + public static NPC ReadNPC(this BinaryReader reader, bool nullOnInactive = true) + { + int index = reader.ReadByte(); + + if (index >= Main.maxNPCs) + return null; + + var npc = Main.npc[index]; + + if (nullOnInactive && npc.IsNullOrInactive()) + return null; + + return npc; + } + #endregion Entity RW + } +} diff --git a/Utilities/PathfindingUtils.cs b/Utilities/PathfindingUtils.cs new file mode 100644 index 0000000000..f8af93a82c --- /dev/null +++ b/Utilities/PathfindingUtils.cs @@ -0,0 +1,526 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Terraria; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod +{ + #region Pathfinding Parameters + public readonly struct PathfindingParameters + { + internal static readonly Func DefaultTileValidity = point => true; + internal static readonly Func DefaultDistanceFunction = OctileDistance; + internal static readonly Func DefaultHeuristic = OctileDistance; + + internal readonly Vector2 Start; + internal readonly Vector2 End; + internal readonly Func TileValidity; + internal readonly Func DistanceFunction; + internal readonly Func Heuristic; + + public PathfindingParameters( + Vector2 start, + Vector2 end, + Func tileValidity = null, + Func distanceFunction = null, + Func heuristic = null) + { + Start = start; + End = end; + TileValidity = tileValidity; + DistanceFunction = distanceFunction; + Heuristic = heuristic; + } + } + #endregion + + #region Pathfinding Manager + /// + /// Creates a new PathfindingManager for the selected entity.
+ /// Entities should only ever need one PathfindingManager for their lifetime, but more can be created. + ///
+ /// The entity to pathfind for. + public class PathfindingManager(Entity e) + { + public List Path { get => lastSuccessfulTask?.Result ?? []; } + + /// + /// The entity which this PathfindingManager manages. This cannot be changed after creation. + /// + internal readonly Entity entity = e; + + /// + /// The acceleration this PathfindingManager will impart to its Entity when making it follow a found path.
+ /// This has no impact on the Entity's other behaviors, AI, etc. + ///
+ internal float Acceleration { get; set; } = 0.2f; + + /// + /// The maximum speed this PathfindingManager allow its Entity to move at when making it follow a found path.
+ /// This has no impact on the Entity's other behaviors, AI, etc. + ///
+ internal float MaxSpeed { get; set; } = 4f; + + /// + /// The minimum distance this PathdingManager requires its Entity to reach from its target point before the point is marked as "reached".
+ /// This has no impact on the Entity's other behaviors, AI, etc. + ///
+ internal float MinimumPointDistance { get; set; } = 48f; + + /// + /// The last completed pathfinding task that this manager has performed.
+ /// This is kept in place so that the entity may continue to follow its last successful path while calculating a new one.
+ ///
+ /// This task will always be in a Completed state with a valid Result. + ///
+ private PathfindingTask lastSuccessfulTask; + + /// + /// Represents the working task for calculating this entity's complex path.
+ ///
+ /// Accessing before execution has completed will result in the calling thread being blocked until execution is complete. + ///
+ private PathfindingTask currentTask; + + /// + /// You may override the path-following behavior imposed on the Entity by the PathfindingManager by providing a Func here. + ///

+ /// This Func should return when the entity has reached its target point, and otherwise.
+ ///
+ public Func CustomFollowPath { get; set; } + + /// + /// You may override the idling behavior imposed on the Entity by the PathfindingManager by providing an Action here. + ///

+ /// This Action has no parameters and no return value, and can do basically anything you want. + ///
+ /// It will usually only run for a frame or two while the PathfindingManager is finding the next path to take. + ///
+ public Action CustomIdleBehavior { get; set; } + + /// + /// Finds a path based on the specified parameters and assigns it to this manager's entity.
+ /// This method does not force the entity to begin following the path - it only locates a new path. + ///
+ public void FindPath(PathfindingParameters parameters, bool forceNewTask = true) + { + var potentialNewTask = new PathfindingTask(parameters); + + // Case 1: No current pathfinding task. + // Set the current task to be the potential new task. + if (currentTask is null) + { + currentTask = potentialNewTask; + currentTask.Run(); + } + + // Case 2: Current task exists and is currently running. + // Make the Entity idle and continue to await results. + if (currentTask.Running) + { + // Case 2A: We don't care about the previous pathfinding task. We have changed our goals. + // In order to trigger this behavior, you must set forceNewTask to true, and provide a different end goal position. + bool sameEndPosition = parameters.End.ToTileCoordinates() == currentTask.work.End.Position; + bool forceNewPathAttempt = forceNewTask && !sameEndPosition; + + if (forceNewPathAttempt) + { + currentTask = potentialNewTask; + currentTask.Run(); + } + + // Regardles of whether a new pathing execution is forced, the entity will continue to behave based on any previous successful pathing. + // Its calculations have not finished. + return; + } + + // Case 3: Current task exists, but is not currently running. + // There are two reasons why this can be the case. + bool previousTaskHadNoResult = currentTask.Result is null; + bool previousTaskPathFollowed = (currentTask.Result?.Count ?? -1) == 0; + // The third case is that you are forcing it to start a new task, either to the same or a new destination. + + // Regardless of which reason the pathfinding has ended, start the new task. + if (previousTaskHadNoResult || previousTaskPathFollowed || forceNewTask) + { + currentTask = potentialNewTask; + currentTask.Run(); + return; + } + + // Case 4: "Your paths found." + // The pathfinding task has completed its execution and a valid path has been found. + // Lock in that successful pathfinding task so the entity may consume its results. + lastSuccessfulTask = currentTask; + } + + /// + /// Glue code to cause the Entity to either follow its last successful path, or idle. + /// + public void PathfindingBehavior() + { + if (lastSuccessfulTask is null) + { + IdleBehavior(); + return; + } + + Vector2 nextPoint = lastSuccessfulTask.Result[0]; + + // If that point is reached, it is removed from the list of points to follow. + bool nextPointReached = FollowPath(nextPoint); + if (nextPointReached) + lastSuccessfulTask.Result.RemoveAt(0); + + // If the previous successful found path has been followed to its endpoint, delete the task. + if (lastSuccessfulTask.Result.Count == 0) + lastSuccessfulTask = null; + } + + /// + /// Performs appropriate "path-finding behavior" for the Entity this PathfindingManager is attached to.
+ /// This method is intended to be called every frame that you want the Entity to obey its pathfinding logic. + ///
+ public void DoPathfinding(PathfindingParameters parameters, bool forceNewTask = false) + { + FindPath(parameters, forceNewTask); + PathfindingBehavior(); + } + + private bool DefaultFollowPath(Vector2 nextPoint) + { + // Accelerate to the target point. + entity.velocity += (nextPoint - entity.Center).SafeNormalize(Vector2.Zero) * Acceleration; + + // Cap the speed if MaxSpeed has been surpassed. + if (entity.velocity.LengthSquared() > MaxSpeed * MaxSpeed) + entity.velocity = entity.velocity.SafeNormalize(Vector2.UnitY) * MaxSpeed; + + // If the entity is within 48 pixels of its target point, consider the point reached. + if (Vector2.DistanceSquared(entity.Center, nextPoint) < MinimumPointDistance * MinimumPointDistance) + return true; + + // Otherwise, continue following. + return false; + } + + /// + /// Defines how this entity should move to the next point. Contains a default implementation with basic acceleration towards the next point.
+ /// This method should return when the entity has reached its target point, and otherwise.
+ ///
+ /// The target point is specified by - usually index 0 in the task result. + ///

+ /// The behavior of this function can be completely overridden by providing a CustomFollowPath Func. + ///
+ /// The next point in the path that this PathfindingManager has made. + /// Whether or not the destination has been reached. + public bool FollowPath(Vector2 nextPoint) => CustomFollowPath?.Invoke(nextPoint) ?? DefaultFollowPath(nextPoint); + + private static readonly float DefaultSlowdown = 0.95f; + private void DefaultIdleBehavior() => entity.velocity *= DefaultSlowdown; + + /// + /// Defines how this entity should behave while there is no current path to follow.
+ /// By default, decelerates to a stop using the DefaultSlowdown value.
+ /// This behavior will usually only run for a frame or two while the PathfindingManager is finding the next path to take. + ///
+ public void IdleBehavior() + { + if (CustomIdleBehavior is not null) + CustomIdleBehavior(); + else + DefaultIdleBehavior(); + } + + public void ClearResults() + { + currentTask = null; + lastSuccessfulTask = null; + } + + #region Pathfinding Task + /// + /// Represents a task for calculating a complex path.
+ /// Allows for synchronous access to an asynchronous execution state, while still providing blocking access where needed. + ///
+ private class PathfindingTask(PathfindingParameters parameters) + { + /// + /// The result of this pathfinding task. + /// + internal List Result { get => _task.Task.Result; } + + /// + /// Whether this pathfinding task has completed running. + /// + internal bool Ready { get; private set; } = false; + + /// + /// Whether this pathfinding task is still currently running. + /// + internal bool Running { get; private set; } = false; + + // Interal task representation of the work. + internal readonly TaskCompletionSource> _task = new(); + + // Internal containing object for the actual work. + internal readonly PathfindingWork work = new(parameters); + + /// + /// Begins execution of this pathfinding task on a background thread. + /// + internal void Run() + { + Running = true; + + ThreadPool.QueueUserWorkItem((pathfindingTask) => + { + var task = pathfindingTask as PathfindingTask; + task._task.TrySetResult(task.work.CalculatePath()); + + task.Ready = true; + task.Running = false; + }, + this); + } + } + #endregion + + #region Pathfinding Work Record + /// + /// Represents the working computation for a . + /// + /// + /// + /// Has 2 constructors. One option provides the start and end positions as , and the other one as . + /// + /// + /// This record contains the start and end nodes, along with functions for tile validity, distance calculation, and heuristic estimation. + /// + /// + /// - : A function that checks if a tile at a given point is valid for traversal. If not provided, all non-solid tiles are considered valid.
+ /// - : A function that calculates the distance between two points. Defaults to .
+ /// - : A function that estimates the cost from a given point to the end point. Defaults to .
+ ///
+ ///
+ private record PathfindingWork(PathfindingNode Start, PathfindingNode End, Func TileValidity, Func DistanceFunction, Func Heuristic) + { + public PathfindingWork( + Point start, + Point end, + float minimalPointDistance, + Func tileValidity = null, + Func distanceFunction = null, + Func heuristic = null) : this( + new PathfindingNode(start), + new PathfindingNode(end), + tileValidity ?? PathfindingParameters.DefaultTileValidity, + distanceFunction ?? PathfindingParameters.DefaultDistanceFunction, + heuristic ?? PathfindingParameters.DefaultHeuristic + ) + { + } + + public PathfindingWork( + PathfindingParameters p) : this( + new PathfindingNode(p.Start.ToTileCoordinates()), + new PathfindingNode(p.End.ToTileCoordinates()), + p.TileValidity ?? PathfindingParameters.DefaultTileValidity, + p.DistanceFunction ?? PathfindingParameters.DefaultDistanceFunction, + p.Heuristic ?? PathfindingParameters.DefaultHeuristic + ) + { + } + + /// + /// Calculates a path from the start to the end position using the A* pathfinding algorithm. + /// + /// + /// + /// A list of positions representing the path from start to end, or if no path is found. + /// + internal List CalculatePath() + { + if (Main.tile[End.Position].IsTileSolid()) + return null; + + var openSet = new List(); + var closedSet = new HashSet(); + openSet.Add(Start); + + while (openSet.Count > 0) + { + // Get the node with the lowest F value. + var current = openSet[0]; + for (int i = 1; i < openSet.Count; i++) + { + if (openSet[i].F < current.F || (openSet[i].F == current.F && openSet[i].H < current.H)) + current = openSet[i]; + } + + openSet.Remove(current); + closedSet.Add(current); + + // Check if we've reached the goal. + if (current.Position == End.Position) + return current.ReconstructPath(); + + // Generate neighbors. + foreach (var neighbor in current.GetNeighbors()) + { + if (closedSet.Contains(neighbor) || Main.tile[neighbor.Position].IsTileSolid() || !TileValidity.Invoke(neighbor.Position)) + continue; + + float tentativeG = current.G + DistanceFunction.Invoke(current.Position, neighbor.Position); + + if (!openSet.Contains(neighbor) || tentativeG < neighbor.G) + { + neighbor.Parent = current; + neighbor.G = tentativeG; + neighbor.H = Heuristic.Invoke(neighbor.Position, End.Position); + + if (!openSet.Contains(neighbor)) + openSet.Add(neighbor); + } + } + } + + return null; // No path found. + } + } + #endregion + + #region Pathfinding Node + /// + /// Represents a node in a pathfinding algorithm, containing position, cost, and parent information. + /// + private class PathfindingNode(Point position) + { + internal Point Position { get; set; } = position; + internal float G { get; set; } // Cost from start to this node. + internal float H { get; set; } // Heuristic cost to goal. + internal float F => G + H; // Total cost. + internal PathfindingNode Parent { get; set; } + + public override bool Equals(object obj) + { + if (obj is PathfindingNode other) + return Position == other.Position; + return false; + } + + public override int GetHashCode() => Position.GetHashCode(); + + internal List GetNeighbors() + { + var neighbors = new List(Directions.Count); + + int nodeX = Position.X; + int nodeY = Position.Y; + + foreach (var direction in Directions) + { + int newX = nodeX + (int)direction.X; + int newY = nodeY + (int)direction.Y; + + if (WorldGen.InWorld(newX, newY)) + neighbors.Add(new PathfindingNode(new Point(newX, newY))); + } + + return neighbors; + } + + internal List ReconstructPath() + { + var pathStack = new Stack(); + var node = this; + + while (node != null) + { + pathStack.Push(node.Position.ToWorldCoordinates()); + node = node.Parent; + } + + var path = new List(pathStack.Count); + path.AddRange(pathStack); + + return path; + } + } + #endregion + } + #endregion + + public static partial class CalamityUtils + { + #region Heuristic Functions + public static float TaxicabDistance(Point a, Point b) => MathF.Abs(a.X - b.X) + MathF.Abs(a.Y - b.Y); + + public static float EuclideanDistance(Point a, Point b) + { + float dx = MathF.Abs(a.X - b.X); + float dy = MathF.Abs(a.Y - b.Y); + return MathF.Sqrt(dx * dx + dy * dy); + } + + public static float ChebyshevDistance(Point a, Point b) => MathF.Max(MathF.Abs(a.X - b.X), MathF.Abs(a.Y - b.Y)); + + public static float OctileDistance(Point a, Point b) + { + float dx = MathF.Abs(a.X - b.X); + float dy = MathF.Abs(a.Y - b.Y); + return dx + dy - 0.586f * MathF.Min(dx, dy); + } + #endregion + + /// + /// A quick method to see if an enemy fits in a path on the grid. + /// + public static bool DoesEntityFitInPath(this Entity entity, Point point, int fluffX = 0, int fluffY = 0) + { + Rectangle hitbox = entity.Hitbox; + Vector2 worldCoordinatePoint = point.ToWorldCoordinates(); + hitbox.Inflate(fluffX, fluffY); + + bool doesFit = true; + for (int coordX = (int)(worldCoordinatePoint.X - hitbox.Width / 2); coordX < worldCoordinatePoint.X + hitbox.Width / 2; coordX++) + { + for (int coordY = (int)(worldCoordinatePoint.Y - hitbox.Height / 2); coordY < worldCoordinatePoint.Y + hitbox.Height / 2; coordY++) + { + Point p = new Vector2(coordX, coordY).ToTileCoordinates(); + if (Main.tile[p].IsTileSolid()) + { + doesFit = false; + break; + } + } + } + + return doesFit; + } + + public static List GetIntersectingHitboxPoints(this Entity entity, Point position, int fluffX = 0, int fluffY = 0) + { + Rectangle hitbox = entity.Hitbox; + hitbox.Location = new Point(position.X - hitbox.Width / 2, position.Y - hitbox.Height / 2); + hitbox.Inflate(fluffX, fluffY); + + int startX = (int)MathF.Floor(hitbox.Left / 16); + int endX = (int)Math.Floor((hitbox.Right - float.Epsilon) / 16); + int startY = (int)MathF.Floor(hitbox.Top / 16); + int endY = (int)Math.Floor((hitbox.Bottom - float.Epsilon) / 16); + + List intersectingPoints = []; + for (int i = startX; i <= endX; i++) + { + for (int j = startY; j <= endY; j++) + intersectingPoints.Add(new Point(i, j)); + } + + return intersectingPoints; + } + } +} diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 08128135fb..f241eb3142 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -1,12 +1,16 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Reflection; using CalamityMod.Balancing; using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; +using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -88,7 +92,8 @@ namespace CalamityMod } // We intentionally don't check whip class, because it inherits 100% from Summon - float rogue = player.GetTotalDamage().Additive; + // CIT 28FEB2025: Damage boosts from stealth are now subtracted from total damage when considering best class, to prevent all-class damage from being skewed by it. + float rogue = player.GetTotalDamage().Additive - player.Calamity().stealthDamage; if (rogue > bestDamage) { bestClass = RogueDamageClass.Instance; @@ -122,7 +127,8 @@ namespace CalamityMod if (summon > best) best = summon; // We intentionally don't check whip class, because it inherits 100% from Summon - float rogue = player.GetTotalDamage().Additive; + // CIT 28FEB2025: Damage boosts from stealth are now subtracted from total damage when considering best class, to prevent all-class damage from being skewed by it. + float rogue = player.GetTotalDamage().Additive - player.Calamity().stealthDamage; if (rogue > best) best = rogue; // Add the best typical damage stat, then return the full modifier. @@ -130,20 +136,6 @@ namespace CalamityMod return ret; } - /// - /// Extension method which calculates the player's current multiplicative boost to armor set bonus and accessory damage.
- /// This is currently only used by the Old Fashioned drink. - ///
- /// The player whose armor / accessory damage bonus should be applied. - /// The damage to apply the bonus to. - /// Boosted damage. If no boosts are applicable, returns the damage parameter that was passed in. - public static int ApplyArmorAccDamageBonusesTo(this Player player, float damage) - { - if (!player.Calamity().oldFashioned) - return (int)damage; - return (int)(damage * OldFashioned.AccessoryAndSetBonusDamageMultiplier); - } - public static float GetRangedAmmoCostReduction(this Player player) { // Tally up all possible vanilla effects. @@ -330,11 +322,11 @@ namespace CalamityMod #region Location and Biomes public static bool IsUnderwater(this Player player) => Collision.DrownCollision(player.position, player.width, player.height, player.gravDir); - public static bool InSpace(this Player player) + public static bool ReducedSpaceGravity(this Player player) { float x = Main.maxTilesX / 4200f; x *= x; - float spaceGravityMult = (float)((player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / 6.0)); + float spaceGravityMult = (float)((player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / (Main.remixWorld ? 1.0 : 6.0))); return spaceGravityMult < 1f; } @@ -444,7 +436,7 @@ namespace CalamityMod public static int GetExtraHitIFrames(this Player player, HurtInfo hurtInfo) { CalamityPlayer modPlayer = player.Calamity(); - + int extraIFrames = 0; if (modPlayer.godSlayerThrowing && hurtInfo.Damage > 80) extraIFrames += 30; @@ -472,7 +464,7 @@ namespace CalamityMod if (modPlayer.rampartOfDeities && hurtInfo.Damage > 200) extraIFrames += 30; - if (modPlayer.fabsolVodka) + if (modPlayer.cirrusVodka) { if (hurtInfo.Damage == 1) extraIFrames += 5; @@ -708,7 +700,7 @@ namespace CalamityMod { CalamityPlayer mp = p.Calamity(); mp.cooldowns[id] = instance; - mp.SyncCooldownAddition(Main.netMode == NetmodeID.Server, instance); + mp.SyncCooldownAddition(Main.dedServ, instance); } return instance; @@ -887,13 +879,28 @@ namespace CalamityMod } #endregion + /// + /// Used to limit the cursor up to a 1080p monitor. A similar method is used for items such as Zenith in vanilla. + /// + /// The player to check. + /// The current position of the player's mouse, clamped to a 1920x1080 screen. + public static Vector2 ClampedMouseWorld(this Player player) + { + Vector2 mouseWorld = player.Calamity().mouseWorld; + + // Clamp each axis + mouseWorld.X = mouseWorld.X >= player.MountedCenter.X ? MathF.Min(mouseWorld.X, player.MountedCenter.X + 960f) : MathF.Max(mouseWorld.X, player.MountedCenter.X - 960f); + mouseWorld.Y = mouseWorld.Y >= player.MountedCenter.Y ? MathF.Min(mouseWorld.Y, player.MountedCenter.Y + 540f) : MathF.Max(mouseWorld.Y, player.MountedCenter.Y - 540f); + return mouseWorld; + } + /// /// 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, bool needsToHold = true) => player == null || !player.active || player.dead || (!player.channel && needsToHold) || player.CCed || player.noItems; - + /// /// A shorthand bool to check if the held item should trigger Calamity's summon damage penalty. /// @@ -905,9 +912,10 @@ namespace CalamityMod var modPlayer = player.Calamity(); bool forbiddenWithMagicWeapon = player.armor[0].type == ItemID.AncientBattleArmorHat && player.armor[1].type == ItemID.AncientBattleArmorShirt && player.armor[2].type == ItemID.AncientBattleArmorPants && item.CountsAsClass(); + bool circletWithRogueWeapon = player.armor[0].type == ModContent.ItemType() && player.armor[1].type == ItemID.AncientBattleArmorShirt && player.armor[2].type == ItemID.AncientBattleArmorPants && item.CountsAsClass(); bool gemTechBlueGem = modPlayer.GemTechSet && modPlayer.GemTechState.IsBlueGemActive; - bool crossClassNerfDisabled = forbiddenWithMagicWeapon || modPlayer.fearmongerSet || gemTechBlueGem || modPlayer.profanedCrystalBuffs || DD2Event.Ongoing; + bool crossClassNerfDisabled = forbiddenWithMagicWeapon || circletWithRogueWeapon || modPlayer.fearmongerSet || gemTechBlueGem || modPlayer.profanedCrystalBuffs || DD2Event.Ongoing; if (item.type > ItemID.None && !crossClassNerfDisabled) { @@ -918,10 +926,10 @@ namespace CalamityMod item.CountsAsClass() ); - bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !CalamityLists.BlacklistedWeaponsWithToolPower.Contains(item.type); + bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !BlacklistedWeaponsWithToolPowerList.Includes(item.type); bool heldItemCanBeUsed = item.useStyle != ItemUseStyleID.None; bool heldItemIsAccessoryOrAmmo = item.accessory || item.ammo != AmmoID.None; - bool heldItemIsExcludedByModCall = CalamityLists.DisabledSummonerNerfItems.Contains(item.type); + bool heldItemIsExcludedByModCall = DisabledSummonerNerfItemList.Includes(item.type); if (heldItemIsClassedWeapon && heldItemCanBeUsed && !heldItemIsTool && !heldItemIsAccessoryOrAmmo && !heldItemIsExcludedByModCall) return true; @@ -930,6 +938,22 @@ namespace CalamityMod } + /// + /// A short method that heals the player. + /// All direct heals in Calamity should use this. + /// + /// The player being healed. + /// The amount of life being healed. + /// Whether the heal CombatText should be displayed, and whether it should be synced. Displays and syncs by default. + public static void HealPlayer(this Player player, int amount, HealTextType healTextType = HealTextType.Broadcast) + { + player.statLife += amount; + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; + if (healTextType != HealTextType.None) + player.HealEffect(amount, healTextType == HealTextType.Broadcast); + } + /// /// 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 5979a32adb..5d09f8fb37 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -18,6 +18,12 @@ namespace CalamityMod { public static partial class CalamityUtils { + #region Projectile Identification/Counting Utilities + public static T ModProjectile(this Projectile projectile) where T : ModProjectile + { + return projectile.ModProjectile as T; + } + public static bool AnyProjectiles(int projectileID) { // Efficiently loop through all projectiles, using a specially designed continue continue that attempts to minimize the amount of OR @@ -34,23 +40,10 @@ namespace CalamityMod } public static int CountProjectiles(int projectileID) => Main.projectile.Count(proj => proj.type == projectileID && proj.active); + public static int CountOwnedProjectiles(int projectileID, int ownerID) => Main.projectile.Count(proj => proj.active && proj.type == projectileID && proj.owner == ownerID); public static int CountHookProj() => Main.projectile.Count(proj => Main.projHook[proj.type] && proj.ai[0] == 2f && proj.active && proj.owner == Main.myPlayer); - public static bool FinalExtraUpdate(this Projectile proj) => proj.numUpdates == -1; - - public static bool IsTrueMelee(this Projectile proj) - { - if (proj is null || !proj.active) - return false; - return proj.CountsAsClass() || proj.CountsAsClass(); - } - - public static T ModProjectile(this Projectile projectile) where T : ModProjectile - { - return projectile.ModProjectile as T; - } - public static Projectile FindProjectileByIdentity(int identity, int ownerIndex) { // If in singleplayer, simply return the projectile at the designated index, as singleplayer will never have mismatching indices. @@ -67,6 +60,41 @@ namespace CalamityMod return null; } + public static int FindFirstProjectile(int Type) + { + int index = -1; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.type == Type) + { + index = x; + break; + } + } + return index; + } + + public static void OnlyOneSentry(Player player, int Type) + { + int existingTurrets = player.ownedProjectileCounts[Type]; + if (existingTurrets > 0) + { + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == Type && + p.owner == player.whoAmI) + { + p.Kill(); + existingTurrets--; + if (existingTurrets <= 0) + break; + } + } + } + } + #endregion + #region Projectile AI Utilities public static void ExpandHitboxBy(this Projectile projectile, int width, int height) { @@ -131,6 +159,31 @@ namespace CalamityMod } } + /// + /// Xyk's version of homing code
+ /// Gives a projectile homing on a selected npc. It is recommended to use to get a target. + ///
+ /// The multiplier applied to the movement towards the target. + /// The cap on velocity for the projectile. + /// The inertia of the homing. Generally you want to keep this anywhere from 1 (high inertia), to 0.9f (low inertia). + /// The speed reduction applied to the projectile if it goes above max speed. + /// If the projectile should accelerate to max speed when there is no target. Good for projectiles with small homing range. + public static void HomeInOnSelectedNPC(Projectile projectile, NPC target, bool ignoreTiles = true, float homingVelocity = 0.5f, float maxSpeed = 10, float inertia = 0.985f, float overspeedReduction = 0.95f, bool accelerate = false) + { + NPC targetedNPC = target; + if (targetedNPC != null && (ignoreTiles || Collision.CanHit(projectile.Center, 1, 1, targetedNPC.Center, 1, 1))) + { + Vector2 position = targetedNPC.Center; + Vector2 moveToNPC = (position - projectile.Center).SafeNormalize(Vector2.UnitX); + if (projectile.velocity.Length() < maxSpeed) + projectile.velocity = projectile.velocity * inertia + moveToNPC * homingVelocity; + else + projectile.velocity *= overspeedReduction; + } + if (targetedNPC == null && projectile.velocity.Length() < maxSpeed && accelerate) + projectile.velocity *= 1.0055f; + } + // NOTE - Do not under any circumstance use these predictive methods for enemies or bosses. It is intended for minions and player-created projectiles. // Due to its extremely precise nature, it will have little openings that allow players to react without dashing through the enemy. // The results will be neither fun nor fair. @@ -534,97 +587,7 @@ namespace CalamityMod } #endregion - public static int FindFirstProjectile(int Type) - { - int index = -1; - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile proj = Main.projectile[x]; - if (proj.active && proj.type == Type) - { - index = x; - break; - } - } - return index; - } - - public static void OnlyOneSentry(Player player, int Type) - { - int existingTurrets = player.ownedProjectileCounts[Type]; - if (existingTurrets > 0) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == Type && - p.owner == player.whoAmI) - { - p.Kill(); - existingTurrets--; - if (existingTurrets <= 0) - break; - } - } - } - } - - public static int DamageSoftCap(double dmgInput, int cap) - { - // If the incoming damage is less than the cap, don't do anything. - if (dmgInput < cap) - return (int)dmgInput; - - // Ratio of how far over the cap you are. - // This is a value from 1.0 upwards to theoretically infinity. - double overpoweredRatio = dmgInput / cap; - - // Formula which reduces how "overpowered" you are to a reasonable level. - double cappedRatio = Math.Pow(overpoweredRatio, 0.5) / 1.25 + 0.2; - - // Take the reduced ratio and multiply the cap by it to get the final capped damage. - return (int)(cap * cappedRatio); - } - - public static Vector2 RandomVelocity(float directionMult, float speedLowerLimit, float speedCap, float speedMult = 0.1f) - { - Vector2 velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); - //Rerolling to avoid dividing by zero - while (velocity.X == 0f && velocity.Y == 0f) - { - velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); - } - velocity.Normalize(); - velocity *= Main.rand.NextFloat(speedLowerLimit, speedCap) * speedMult; - return velocity; - } - - public static void MinionAntiClump(this Projectile projectile, float pushForce = 0.05f) - { - 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 || otherProj.owner != projectile.owner || !otherProj.minion || 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 = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); - if (sameProjType && taxicabDist < projectile.width) - { - 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; - } - } - } - + #region Projectile Drawing Utilities public static bool DrawBeam(this Projectile projectile, float length, float spacer, Color lightColor, Texture2D texture = null, bool curve = false) { if (texture is null) @@ -674,7 +637,24 @@ namespace CalamityMod return false; } - public static void DrawBackglow(this Projectile projectile, Color backglowColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null) + public static void DrawBackglow(this Projectile projectile, Color backglowColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null, SpriteEffects effects = SpriteEffects.None, float xPos = 0, float yPos = 0) + { + texture ??= TextureAssets.Projectile[projectile.type].Value; + + // Use a fallback for the frame. + frame ??= texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + + Vector2 drawPosition = ((xPos == 0 && yPos == 0) ? projectile.Center : new Vector2(xPos, yPos)) - Main.screenPosition; + Vector2 origin = frame.Value.Size() * 0.5f; + Color backAfterimageColor = backglowColor * projectile.Opacity; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, projectile.rotation, origin, projectile.scale, effects, 0f); + } + } + + public static void DrawBackglow(this Projectile projectile, Color backglowColor, float backglowArea, Vector2 scale, Texture2D? texture = null, Rectangle? frame = null, Vector2? offset = null) { texture ??= TextureAssets.Projectile[projectile.type].Value; @@ -686,28 +666,30 @@ namespace CalamityMod Color backAfterimageColor = backglowColor * projectile.Opacity; for (int i = 0; i < 10; i++) { + Vector2 off = Vector2.Zero; + if (offset != null) off += offset.Value; Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea; - Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, projectile.rotation, origin, projectile.scale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition + drawOffset + off, frame, backAfterimageColor, projectile.rotation, origin, scale, 0, 0f); } } - public static void DrawProjectileWithBackglow(this Projectile projectile, Color backglowColor, Color lightColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null) + public static void DrawProjectileWithBackglow(this Projectile projectile, Color backglowColor, Color lightColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null, SpriteEffects effects = SpriteEffects.None, float xPos = 0, float yPos = 0) { texture ??= TextureAssets.Projectile[projectile.type].Value; // Use a fallback for the frame. frame ??= texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = ((xPos == 0 && yPos == 0) ? projectile.Center : new Vector2(xPos, yPos)) - Main.screenPosition; Vector2 origin = frame.Value.Size() * 0.5f; - projectile.DrawBackglow(backglowColor, backglowArea, texture, frame); - Main.spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, 0, 0f); + projectile.DrawBackglow(backglowColor, backglowArea, texture, frame, effects, xPos, yPos); + Main.spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, effects, 0f); } public static void DrawStarTrail(this Projectile projectile, Color outer, Color inner, float auraHeight = 10f) { - Texture2D aura = ModContent.Request("CalamityMod/Projectiles/StarTrail").Value; + Texture2D aura = Request("CalamityMod/Projectiles/StarTrail").Value; Vector2 offsets = new Vector2(0f, projectile.gfxOffY) - Main.screenPosition; Rectangle auraRec = aura.Frame(); float auraRotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -742,6 +724,53 @@ namespace CalamityMod Main.EntitySpriteDraw(aura, drawStartInner, auraRec, innerColor * colorMult, auraRotation, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); } } + #endregion + + public static bool FinalExtraUpdate(this Projectile proj) => proj.numUpdates == -1; + + public static bool IsTrueMelee(this Projectile proj) + { + if (proj is null || !proj.active) + return false; + return proj.CountsAsClass() || proj.CountsAsClass(); + } + + public static int DamageSoftCap(double dmgInput, int cap) + { + // If the incoming damage is less than the cap, don't do anything. + if (dmgInput < cap) + return (int)dmgInput; + + // Ratio of how far over the cap you are. + // This is a value from 1.0 upwards to theoretically infinity. + double overpoweredRatio = dmgInput / cap; + + // Formula which reduces how "overpowered" you are to a reasonable level. + double cappedRatio = Math.Pow(overpoweredRatio, 0.5) / 1.25 + 0.2; + + // Take the reduced ratio and multiply the cap by it to get the final capped damage. + return (int)(cap * cappedRatio); + } + + public static Vector2 RandomVelocity(float directionMult, float speedLowerLimit, float speedCap, float speedMult = 0.1f) + { + Vector2 velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); + //Rerolling to avoid dividing by zero + while (velocity.X == 0f && velocity.Y == 0f) + { + velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); + } + velocity.Normalize(); + velocity *= Main.rand.NextFloat(speedLowerLimit, speedCap) * speedMult; + return velocity; + } + + public static void ForceNetUpdate(this Projectile proj, bool ignoreCurrentNetSpam = true) + { + proj.netUpdate = true; + if (proj.netSpam >= 10 || ignoreCurrentNetSpam) + proj.netSpam = 0; + } private static readonly List vanillaBlastImmuneTiles = new List() { @@ -940,7 +969,7 @@ PostWallBlastLoop:; } // Smoke, which counts as a Gore - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = projectile.Center; int goreAmt = 3; diff --git a/Utilities/ReflectionHelper.cs b/Utilities/ReflectionHelper.cs new file mode 100644 index 0000000000..e1aff58a66 --- /dev/null +++ b/Utilities/ReflectionHelper.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Text; +using System.Threading.Tasks; +using Terraria.GameContent; +using Terraria.ModLoader.Core; +using Terraria.ModLoader; +using System.Collections; +using CalamityMod.Particles; + +namespace CalamityMod +{ + public class FastField(FieldInfo fieldInfo) + { + private Action _Setter = ReflectionHelper.CreateFieldSetter(fieldInfo); + private Func _Getter = ReflectionHelper.CreateFieldGetter(fieldInfo); + + public FastField(string fieldName, BindingFlags flags) : this(typeof(T).GetField(fieldName, flags)) + { + + } + + public ValueType Get(T instance) + { + return _Getter(instance); + } + + public void Set(T instance, ValueType newValue) + { + _Setter(instance, newValue); + } + } + + public static class ReflectionHelper + { + public static Action CreateFieldSetter(FieldInfo fieldInfo) + { + string methodName = fieldInfo.ReflectedType.FullName + ".set_" + fieldInfo.Name; + DynamicMethod setterMethod = new DynamicMethod(methodName, null, [typeof(T), typeof(ValueType)], true); + ILGenerator gen = setterMethod.GetILGenerator(); + + gen.Emit(OpCodes.Ldarg_0); + gen.Emit(OpCodes.Ldarg_1); + gen.Emit(OpCodes.Stfld, fieldInfo); + gen.Emit(OpCodes.Ret); + + return (Action)setterMethod.CreateDelegate(typeof(Action)); + } + + public static Func CreateFieldGetter(FieldInfo fieldInfo) + { + string methodName = fieldInfo.ReflectedType.FullName + ".get_" + fieldInfo.Name; + DynamicMethod getterMethod = new DynamicMethod(methodName, typeof(ValueType), [typeof(T)], true); + ILGenerator gen = getterMethod.GetILGenerator(); + + gen.Emit(OpCodes.Ldarg_0); + gen.Emit(OpCodes.Ldfld, fieldInfo); + gen.Emit(OpCodes.Ret); + + return (Func)getterMethod.CreateDelegate(typeof(Func)); + } + + public static IEnumerable GetEveryModsTypes() + { + return ModLoader.Mods.SelectMany(mod => AssemblyManager.GetLoadableTypes(mod.Code)); + } + + public static void IterateEveryModsTypes(bool includeBaseType = false, Action action = null) + { + // WHY???? + if (action is null) + return; + + Type baseType = typeof(T); + var types = GetEveryModsTypes(); + foreach (var type in types) + { + if (type.IsSubclassOf(baseType) && !type.IsAbstract && (!includeBaseType && type != baseType)) + { + action.Invoke(type); + } + } + } + + public static IEnumerable GetCalamityTypes() + { + return AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); + } + + public static void IterateCalamityTypes(bool includeBaseType = false, Action action = null) + { + // WHY???? + if (action is null) + return; + + Type baseType = typeof(T); + var types = GetCalamityTypes(); + foreach (var type in types) + { + if (type.IsSubclassOf(baseType) && !type.IsAbstract && (!includeBaseType && type != baseType)) + { + action.Invoke(type); + } + } + } + } +} diff --git a/Utilities/RicoshotUtils.cs b/Utilities/RicoshotUtils.cs index 697fba3fc1..1f54d392cb 100644 --- a/Utilities/RicoshotUtils.cs +++ b/Utilities/RicoshotUtils.cs @@ -62,6 +62,8 @@ namespace CalamityMod { // As 0,0 in world coordinates is the top left of the world (+Y = down instead of up), // we have to flip the Y here to do valid trigonometry. + // + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 vectorToMouse = player.Calamity().mouseWorld - player.MountedCenter; vectorToMouse.Y *= -1f; diff --git a/Utilities/TextureUtils/FramedMaskTexture.cs b/Utilities/TextureUtils/FramedMaskTexture.cs new file mode 100644 index 0000000000..39e8e5e55e --- /dev/null +++ b/Utilities/TextureUtils/FramedMaskTexture.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public sealed class FramedMaskTexture + { + /// + /// Cached Texture2D reference, null on server + /// + public Texture2D Texture; // Leave this as field for performances sake + + /// + /// X axis's frame count, 0 on server + /// + public int FrameXCount => _FrameXCount; + + /// + /// Y axis's frame count, 0 on server + /// + public int FrameYCount => _FrameYCount; + + /// + /// Pixel width for each frame + /// + public int FrameWidth => _FrameWidth; + + /// + /// Pixel height for each frame + /// + public int FrameHeight => _FrameHeight; + + /// + /// Pixel Width of Texture, 0 on server + /// + public int TextureWidth => _TextureWidth; + + /// + /// Pixel Height of Texture, 0 on server + /// + public int TextureHeight => _TextureHeight; + + private int _FrameWidth = 0, _FrameHeight = 0; + private int _FrameXCount = 0, _FrameYCount = 0; + private int _TextureWidth = 0, _TextureHeight = 0; + private readonly bool[] _HasMaskContent; + + public FramedMaskTexture(string asset, int frameWidth, int frameHeight, bool pretendEveryFrameHaveGlow = false) + { + _FrameWidth = frameWidth; + _FrameHeight = frameHeight; + + FramedGlowMaskSystem.OnUnload += Unload; + + // Don't do anything further on server + if (Main.dedServ) + return; + + Texture = ModContent.Request(asset, AssetRequestMode.ImmediateLoad).Value; + if (Texture is null) + return; + + _TextureWidth = Texture.Width; + _TextureHeight = Texture.Height; + _FrameXCount = _TextureWidth / frameWidth; + _FrameYCount = _TextureHeight / frameHeight; + + _HasMaskContent = new bool[FrameXCount * FrameYCount]; + + + if (pretendEveryFrameHaveGlow) + { + for(int x = 0; x + { + var colData = Texture.GetColorsFromTexture(); + + // Interesting case, not sure if this will even happens + if (colData is null) + return; + + Parallel.For(0, FrameXCount * FrameYCount, (i) => + { + int xFrame = i % FrameXCount; + int yFrame = i / FrameXCount; + + int xStart = xFrame * frameWidth; + int xEnd = Math.Min(xStart + frameWidth, _TextureWidth); + + int yStart = yFrame * frameHeight; + int yEnd = Math.Min(yStart + frameHeight, _TextureHeight); + + bool frameHasData = false; + for (int x = xStart; x < xEnd; x++) + { + if (frameHasData) + { + break; + } + + for (int y = yStart; y < yEnd; y++) + { + Color col = colData[x, y]; + if (col.A >= 1) + { + frameHasData = true; + break; + } + } + } + + _HasMaskContent[xFrame + (yFrame * _FrameXCount)] = frameHasData; + }); + }); + } + } + + public void Unload() + { + Texture = null; + _FrameWidth = 0; + _FrameHeight = 0; + _FrameXCount = 0; + _FrameYCount = 0; + } + + public bool HasContentInFrameIndex(int xFrame, int yFrame) + { + if (Texture is null) + return false; + + if (xFrame < 0 || xFrame >= _FrameXCount) + return false; + + if (yFrame < 0 || yFrame >= _FrameYCount) + return false; + + return _HasMaskContent[xFrame + (yFrame * _FrameXCount)]; + } + + public bool HasContentInFramePos(int xPos, int yPos) + { + int xFrame = xPos / _FrameWidth; + int yFrame = yPos / _FrameHeight; + + if (xFrame < 0 || xFrame >= _FrameXCount) + return false; + + if (yFrame < 0 || yFrame >= _FrameYCount) + return false; + + return _HasMaskContent[xFrame + (yFrame * _FrameXCount)]; + } + + private sealed class FramedGlowMaskSystem : ModSystem + { + public static event Action OnUnload; + + public override void Unload() + { + OnUnload?.Invoke(); + OnUnload = null; // Clear cache completly + } + } + } +} diff --git a/Utilities/TextureUtils/GrayscaleTexture1D.cs b/Utilities/TextureUtils/GrayscaleTexture1D.cs new file mode 100644 index 0000000000..96c92c435b --- /dev/null +++ b/Utilities/TextureUtils/GrayscaleTexture1D.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.ModLoader; +using Terraria; +using Microsoft.Xna.Framework; + +namespace CalamityMod +{ + /// + /// Utility Class for using 1D Grayscale Texture as gradient + /// + public sealed class GrayscaleTexture1D + { + private int _Width = 0; + private float[] _Scales; + + public GrayscaleTexture1D(string assetName) + { + if (Main.dedServ) + return; + + var texture = ModContent.Request(assetName, AssetRequestMode.ImmediateLoad).Value; + if (texture is null) + return; + + Main.QueueMainThreadAction(() => + { + _Width = texture.Width; + _Scales = new float[texture.Width]; + + var colorScheme = new Color[_Width]; + texture.GetData(colorScheme); + for (int i = 0; i<_Width; i++) + { + _Scales[i] = colorScheme[i].R / 255.0f; + } + }); + } + + public void Unload() + { + _Width = 0; + _Scales = null; + } + + public float GetClamp(int x) + { + if (_Width == 0) + return default; + + x = Math.Clamp(x, 0, _Width - 1); + return _Scales[x]; + } + + public float GetRepeat(int x) + { + if (_Width == 0) + return default; + + x %= _Width; + return _Scales[x]; + } + } +} diff --git a/Utilities/TextureUtils/GrayscaleTexture2D.cs b/Utilities/TextureUtils/GrayscaleTexture2D.cs new file mode 100644 index 0000000000..d369a3b709 --- /dev/null +++ b/Utilities/TextureUtils/GrayscaleTexture2D.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod +{ + /// + /// Utility Class for using 2D Grayscale Texture as gradient + /// + public sealed class GrayscaleTexture2D + { + private int _Width = 0; + private int _Height = 0; + private float[] _Scales; // 2D array is not thread-safe + + public GrayscaleTexture2D(string assetName) + { + if (Main.dedServ) + return; + + var texture = ModContent.Request(assetName, AssetRequestMode.ImmediateLoad).Value; + if (texture is null) + return; + + Main.QueueMainThreadAction(() => + { + _Width = texture.Width; + _Height = texture.Height; + _Scales = new float[_Width * _Height]; + + var colorScheme = texture.GetColorsFromTexture(); + for (int i = 0; i < _Width; i++) + { + for (int j = 0; j < _Height; j++) + { + _Scales[(j * _Width) + i] = colorScheme[i, j].R / 255.0f; + } + } + }); + } + + public void Unload() + { + _Width = 0; + _Height = 0; + _Scales = null; + } + + public float GetClamp(int x, int y) + { + if (_Width == 0 || _Height == 0) + return default; + + x = Math.Clamp(x, 0, _Width - 1); + y = Math.Clamp(x, 0, _Height - 1); + return _Scales[x + (y * _Height)]; + } + + public float GetRepeat(int x, int y) + { + if (_Width == 0 || _Height == 0) + return default; + + x %= _Width; + y %= _Height; + return _Scales[x + (y * _Height)]; + } + } +} diff --git a/Utilities/TileEntityUtils.cs b/Utilities/TileEntityUtils.cs index 4508e9c84c..3e5fae0989 100644 --- a/Utilities/TileEntityUtils.cs +++ b/Utilities/TileEntityUtils.cs @@ -77,7 +77,7 @@ namespace CalamityMod // This check is done twice because the draw order matters. We want to draw the background icon before any text. if (item.stack > 0) { - if (item.type == ModContent.ItemType()) + if (item.type == ItemType()) { slotBackgroundTex = Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Blood").Value; } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 7f9f60001e..64ca80e336 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; +using System.Runtime.CompilerServices; using CalamityMod.Systems; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; @@ -20,6 +20,7 @@ using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -110,9 +111,20 @@ namespace CalamityMod NetMessage.SendTileSquare(-1, x, y, tileX, tileY); } + public static bool DrawSwayingMultiTile(int i, int j) + { + Tile tile = Main.tile[i, j]; + if (TileObjectData.IsTopLeft(tile)) + Main.instance.TilesRenderer.AddSpecialPoint(i, j, TileDrawing.TileCounterType.MultiTileVine); + return false; + } + public static void DrawFlameEffect(Texture2D flameTexture, int i, int j, int offsetX = 0, int offsetY = 0) { Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); int width = 16; @@ -132,6 +144,9 @@ namespace CalamityMod public static void DrawStaticFlameEffect(Texture2D flameTexture, int i, int j, int offsetX = 0, int offsetY = 0) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Color drawColour = new Color(100, 100, 100, 0); @@ -150,7 +165,7 @@ namespace CalamityMod public static void DrawFlameSparks(int dustType, int rarity, int i, int j) { - if (!Main.gamePaused && Main.instance.IsActive && (!Lighting.UpdateEveryFrame || Main.rand.NextBool(4))) + if (!Main.gamePaused && Main.instance.IsActive && !Main.tile[i, j].IsTileActuallyInvisible() && (!Lighting.UpdateEveryFrame || Main.rand.NextBool(4))) { if (Main.rand.NextBool(rarity)) { @@ -225,6 +240,51 @@ namespace CalamityMod return uniqueAnimationFrame * animationFrameLength; } + /// + /// Checks whether or not the tile is actually able to be seen. + /// + /// The tile being checked. + /// Whether + public static bool IsTileActuallyInvisible(this Tile tile) => tile.IsTileInvisible && !Main.ShouldShowInvisibleWalls(); + + /// + /// Gets the color of a tile/wall after paint is applied + /// + /// The ID of the paint, this can be received from the tile's TileColor or WallColor + /// The base color to apply the paint to + /// Whether or not only deep paints should be included. Typically this should be set to false if this isn't being used for a glowmask + /// The original color with paint applied + public static Color ApplyPaint(int paintType, Color color, bool deepPaintOnly = true) + { + if (paintType == PaintID.None) + return color; + + bool isDeep = IsDeepPaint(paintType); + if (deepPaintOnly && !isDeep) + return color; + + Color paintCol = WorldGen.paintColor(paintType); + + if (paintType < PaintID.DeepRedPaint) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (paintType == PaintID.ShadowPaint) + { + paintCol = Color.Black; + } + color = color.MultiplyRGB(paintCol); + + return color; + } + + private static bool IsDeepPaint(int paintType) + { + return PaintID.DeepRedPaint >= paintType && paintType <= PaintID.DeepPinkPaint; + } + public static Tile ParanoidTileRetrieval(int x, int y) { if (!WorldGen.InWorld(x, y)) @@ -280,6 +340,34 @@ namespace CalamityMod } return true; } + public static bool IsTileExposedToAir(int x, int y) => IsTileExposedToAir(x, y, out _); + + public static bool IsTileExposedToAir(int x, int y, out float? angleToOpenAir) + { + angleToOpenAir = null; + if (!ParanoidTileRetrieval(x - 1, y).HasTile) + { + angleToOpenAir = MathHelper.Pi; + return true; + } + if (!ParanoidTileRetrieval(x + 1, y).HasTile) + { + angleToOpenAir = 0f; + return true; + } + if (!ParanoidTileRetrieval(x, y - 1).HasTile) + { + angleToOpenAir = MathHelper.PiOver2; + return true; + } + if (!ParanoidTileRetrieval(x, y + 1).HasTile) + { + angleToOpenAir = -MathHelper.PiOver2; + return true; + } + + return false; + } public static bool TileActiveAndOfType(int x, int y, int type) { @@ -288,9 +376,12 @@ namespace CalamityMod // Extension shorthand for the Tile Framing System Universal Merges. // As this must be defined in a static class, it's out here in CalamityUtils. + // Flow, 2024/OCT/31 Removing Obsolete in here as tModLoader doesn't like this + //[Obsolete("Use TileBlendMergeSystem.RegisterMerge Instead")] public static void RegisterUniversalMerge(this ModTile tile, int mergeType, string blendSheetPath) { - TileFramingSystem.RegisterUniversalMerge(tile.Type, mergeType, blendSheetPath); + //TileFramingSystem.RegisterUniversalMerge(tile.Type, mergeType, blendSheetPath); + TileBlendMergeSystem.RegisterMerge(tile.Type, mergeType); } /// @@ -358,6 +449,7 @@ namespace CalamityMod TileType(), TileType(), TileType(), + TileType(), }); /// @@ -530,6 +622,7 @@ namespace CalamityMod SetMerge(type, TileID.MarbleBlock); SetMerge(type, TileID.GraniteBlock); //Calam + SetMerge(type, TileType()); SetMerge(type, TileType()); SetMerge(type, TileType()); SetMerge(type, TileType()); @@ -555,6 +648,41 @@ namespace CalamityMod SetMerge(type, TileType()); } + /// + /// The X position of the Tile + /// + /// + /// + public static int X(this Tile tile) + { + TilePos(tile, out int x, out _); + return x; + } + + /// + /// The Y position of the Tile + /// + /// + /// + public static int Y(this Tile tile) + { + TilePos(tile, out _, out int y); + return y; + } + + /// + /// Gets the Position of the tile, the same values that would be inputted in Main.tile to get this Tile + /// + /// + /// The outputted X value, if you want the X by itself use Tile.X + /// The outputted Y value, if you want the Y by itself use Tile.Y + public static void TilePos(this Tile tile, out int x, out int y) + { + uint tileId = Unsafe.BitCast(tile); + x = Math.DivRem((int)tileId, Main.tile.Height, out y); //Thanks to FoxXD_ for the help with this + } + + /// /// Determines if a tile is solid ground based on whether it's active and not actuated or if the tile is solid in any way, including just the top. /// @@ -696,13 +824,17 @@ namespace CalamityMod if (ignoreAbyss) { - tileExcludeList.Add(ModContent.TileType()); - tileExcludeList.Add(ModContent.TileType()); - tileExcludeList.Add(ModContent.TileType()); - tileExcludeList.Add(ModContent.TileType()); + tileExcludeList.Add(TileType()); + tileExcludeList.Add(TileType()); + tileExcludeList.Add(TileType()); + tileExcludeList.Add(TileType()); } return !Main.tileContainer[tile.TileType] && !tileExcludeList.Contains(tile.TileType); } + + public static int PixelsToTiles(this int pixels) => pixels / 16; + + public static int TilesToPixels(this int tiles) => tiles * 16; } } diff --git a/Utilities/WorldgenUtils.cs b/Utilities/WorldgenUtils.cs index 9d3bac0ce1..3730a6265f 100644 --- a/Utilities/WorldgenUtils.cs +++ b/Utilities/WorldgenUtils.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Schematics; using Microsoft.Xna.Framework; @@ -40,6 +41,24 @@ namespace CalamityMod } } + /// + /// Generates clusters of ore across the world based on various requirements and with various strengths/frequencies. + /// This overload takes a list of tile IDs instead of an array. + /// + /// + /// + /// + /// + /// + /// + /// + public static void SpawnOre(int type, double frequency, float verticalStartFactor, float verticalEndFactor, int strengthMin, int strengthMax, List convertibleTiles) + { + int[] convertedArray = new int[convertibleTiles.Count]; + convertibleTiles.CopyTo(convertedArray); + SpawnOre(type, frequency, verticalStartFactor, verticalEndFactor, strengthMin, strengthMax, convertedArray); + } + /// /// Counts the amount of "cells" near a given range in a 2D boolean array. This is specifically used in conjunction with the

/// utility. @@ -116,10 +135,19 @@ namespace CalamityMod /// /// Settles all liquids in the world. /// - public static void SettleWater() + public static void SettleWater(bool convertToLava = true) { Liquid.worldGenTilesIgnoreWater(true); - Liquid.QuickWater(3); + if (convertToLava) + Liquid.QuickWater(3); + else + { + int storedWaterLine = GenVars.waterLine; + GenVars.waterLine = Main.maxTilesY; + Liquid.QuickWater(3); + GenVars.waterLine = storedWaterLine; + } + WorldGen.WaterCheck(); Liquid.quickSettle = true; @@ -207,7 +235,11 @@ namespace CalamityMod paddedArea.Inflate(padding, padding); // If Fargo's Mutant Mod is loaded, add to their Indestructible Rectangle list, which prevents structures from being trashed by Fargo's terrain tools. - Mod fargos = CalamityMod.Instance.fargos; + Mod fargos = ExternalMods.fargos; + paddedArea.X *= 16; + paddedArea.Y *= 16; + paddedArea.Width *= 16; + paddedArea.Height *= 16; fargos?.Call("AddIndestructibleRectangle", paddedArea); } } diff --git a/Walls/AbyssGravelWall.cs b/Walls/AbyssGravelWall.cs index 6f1e832c06..44e781e3a0 100644 --- a/Walls/AbyssGravelWall.cs +++ b/Walls/AbyssGravelWall.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Walls Main.tile[i, j].Get().LiquidType = LiquidID.Water; Main.tile[i, j].LiquidAmount = byte.MaxValue; WorldGen.SquareTileFrame(i, j); - if (Main.netMode == NetmodeID.MultiplayerClient) + if (Main.dedServ) NetMessage.sendWater(i, j); } } diff --git a/Walls/AbyssGravelWallSafe.cs b/Walls/AbyssGravelWallSafe.cs index 10228dad73..47910b7661 100644 --- a/Walls/AbyssGravelWallSafe.cs +++ b/Walls/AbyssGravelWallSafe.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Walls { public class AbyssGravelWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/AbyssGravelWall"; public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/AbyssGravelWallSafe.png b/Walls/AbyssGravelWallSafe.png deleted file mode 100644 index b01e323001..0000000000 Binary files a/Walls/AbyssGravelWallSafe.png and /dev/null differ diff --git a/Walls/AshenSlabWall.cs b/Walls/AshenSlabWall.cs index aa4d569161..2a162b2771 100644 --- a/Walls/AshenSlabWall.cs +++ b/Walls/AshenSlabWall.cs @@ -1,12 +1,10 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class AshenSlabWall : ModWall + public class AshenSlabWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -23,56 +21,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/AshenSlabWall").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 % 5 }; - 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; + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 5) * 180; } } } diff --git a/Walls/AstralDirtWall.cs b/Walls/AstralDirtWall.cs index 96a302952f..ae80a7a4dd 100644 --- a/Walls/AstralDirtWall.cs +++ b/Walls/AstralDirtWall.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Walls { // TODO -- Change this dust to be one more befitting Astral Dirt. DustType = DustID.Shadowflame; + WallID.Sets.Conversion.Dirt[Type] = true; AddMapEntry(new Color(26, 22, 32)); } diff --git a/Walls/AstralDirtWallSafe.cs b/Walls/AstralDirtWallSafe.cs index 90f3544a23..8305333479 100644 --- a/Walls/AstralDirtWallSafe.cs +++ b/Walls/AstralDirtWallSafe.cs @@ -7,12 +7,14 @@ namespace CalamityMod.Walls { public class AstralDirtWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/AstralDirtWall"; public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Dirt. DustType = DustID.Shadowflame; Main.wallHouse[Type] = true; + WallID.Sets.Conversion.Dirt[Type] = true; AddMapEntry(new Color(26, 22, 32)); } diff --git a/Walls/AstralDirtWallSafe.png b/Walls/AstralDirtWallSafe.png deleted file mode 100644 index efaa5a75e8..0000000000 Binary files a/Walls/AstralDirtWallSafe.png and /dev/null differ diff --git a/Walls/AstralGrassWall.cs b/Walls/AstralGrassWall.cs index 07d8da7393..95ff468205 100644 --- a/Walls/AstralGrassWall.cs +++ b/Walls/AstralGrassWall.cs @@ -2,6 +2,7 @@ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Walls { public class AstralGrassWall : ModWall { + public static Asset leafTexture = null; + public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; /*public override bool Autoload(ref string name, ref string texture) { @@ -24,12 +27,17 @@ namespace CalamityMod.Walls WallID.Sets.Conversion.Grass[Type] = true; AddMapEntry(new Color(60, 48, 64)); + + if (!Main.dedServ) + { + leafTexture = ModContent.Request("CalamityMod/Walls/AstralGrassWallLeaves"); + } } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) { - Texture2D tex = ModContent.Request("CalamityMod/Walls/AstralGrassWallLeaves").Value; + Texture2D tex = leafTexture.Value; var rand = new Random(i + (j * 100000)); float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; diff --git a/Walls/AstralGrassWallSafe.cs b/Walls/AstralGrassWallSafe.cs new file mode 100644 index 0000000000..b7f0877466 --- /dev/null +++ b/Walls/AstralGrassWallSafe.cs @@ -0,0 +1,44 @@ + +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Walls +{ + public class AstralGrassWallSafe : ModWall + { + public override string Texture => "CalamityMod/Walls/AstralGrassWall"; + + public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; + + public override void SetStaticDefaults() + { + // TODO -- Change this dust to be one more befitting Astral Grass. + DustType = DustID.Shadowflame; + + WallID.Sets.Conversion.Grass[Type] = true; + + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(60, 48, 64)); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) + { + Texture2D tex = AstralGrassWall.leafTexture.Value; + var rand = new Random(i + (j * 100000)); + + float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; + float sin = (float)Math.Sin(Main.GameUpdateCount / 45f + offset); + + spriteBatch.Draw(tex, (new Vector2(i + 0.5f, j + 0.5f) + TileAdj) * 16 + new Vector2(1, 0.5f) * sin * 2.2f - Main.screenPosition, + new Rectangle(rand.Next(4) * 26, 0, 24, 24), Lighting.GetColor(i, j), offset + sin * 0.09f, new Vector2(12, 12), 1 + sin / 14f, 0, 0); + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/AstralIceWall.cs b/Walls/AstralIceWall.cs index 400e8a51af..4c0802f5a5 100644 --- a/Walls/AstralIceWall.cs +++ b/Walls/AstralIceWall.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Walls { // TODO -- Change this dust to be one more befitting Astral Ice. DustType = DustID.Shadowflame; + WallID.Sets.Conversion.Ice[Type] = true; AddMapEntry(new Color(83, 76, 92)); } diff --git a/Walls/AstralIceWallSafe.cs b/Walls/AstralIceWallSafe.cs index 7edf50c851..0b93d98546 100644 --- a/Walls/AstralIceWallSafe.cs +++ b/Walls/AstralIceWallSafe.cs @@ -6,13 +6,14 @@ namespace CalamityMod.Walls { public class AstralIceWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/AstralIceWall"; public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Ice. Main.wallHouse[Type] = true; DustType = DustID.Shadowflame; - + WallID.Sets.Conversion.Ice[Type] = true; AddMapEntry(new Color(83, 76, 92)); } diff --git a/Walls/AstralIceWallSafe.png b/Walls/AstralIceWallSafe.png deleted file mode 100644 index 408b4bfa26..0000000000 Binary files a/Walls/AstralIceWallSafe.png and /dev/null differ diff --git a/Walls/AstralMonolithWall.cs b/Walls/AstralMonolithWall.cs index eb46a57ce3..ec5ff71989 100644 --- a/Walls/AstralMonolithWall.cs +++ b/Walls/AstralMonolithWall.cs @@ -1,12 +1,11 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls { - public class AstralMonolithWall : ModWall + public class AstralMonolithWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -22,56 +21,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/AstralMonolithWall").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 % 4, j % 4 }; - 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; + frameXOffset = (i % 4) * 468; + frameYOffset = (j % 4) * 180; } } } diff --git a/Walls/AstralSandstoneWallSafe.cs b/Walls/AstralSandstoneWallSafe.cs index 6c099909dc..af458c22e4 100644 --- a/Walls/AstralSandstoneWallSafe.cs +++ b/Walls/AstralSandstoneWallSafe.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Walls { public class AstralSandstoneWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/AstralSandstoneWall"; public override void SetStaticDefaults() { diff --git a/Walls/AstralSandstoneWallSafe.png b/Walls/AstralSandstoneWallSafe.png deleted file mode 100644 index bb50346ccc..0000000000 Binary files a/Walls/AstralSandstoneWallSafe.png and /dev/null differ diff --git a/Walls/AstralSnowWall.cs b/Walls/AstralSnowWall.cs index 0b0d852f7f..586060389a 100644 --- a/Walls/AstralSnowWall.cs +++ b/Walls/AstralSnowWall.cs @@ -1,5 +1,6 @@  using Microsoft.Xna.Framework; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { @@ -8,7 +9,7 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { DustType = ModContent.DustType(); - + WallID.Sets.Conversion.Snow[Type] = true; AddMapEntry(new Color(135, 145, 149)); } diff --git a/Walls/AstralSnowWallSafe.cs b/Walls/AstralSnowWallSafe.cs index 5089358e68..fe7d6b8b19 100644 --- a/Walls/AstralSnowWallSafe.cs +++ b/Walls/AstralSnowWallSafe.cs @@ -1,16 +1,18 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { public class AstralSnowWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/AstralSnowWall"; public override void SetStaticDefaults() { DustType = ModContent.DustType(); Main.wallHouse[Type] = true; - + WallID.Sets.Conversion.Snow[Type] = true; AddMapEntry(new Color(135, 145, 149)); } diff --git a/Walls/AstralSnowWallSafe.png b/Walls/AstralSnowWallSafe.png deleted file mode 100644 index 0f07f2758a..0000000000 Binary files a/Walls/AstralSnowWallSafe.png and /dev/null differ diff --git a/Walls/AstralStoneWallSafe.cs b/Walls/AstralStoneWallSafe.cs index e4a849832d..80b21ac42d 100644 --- a/Walls/AstralStoneWallSafe.cs +++ b/Walls/AstralStoneWallSafe.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Walls { public class AstralStoneWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/AstralStoneWall"; public override void SetStaticDefaults() { diff --git a/Walls/AstralStoneWallSafe.png b/Walls/AstralStoneWallSafe.png deleted file mode 100644 index d48d698189..0000000000 Binary files a/Walls/AstralStoneWallSafe.png and /dev/null differ diff --git a/Walls/BrimstoneSlabWall.cs b/Walls/BrimstoneSlabWall.cs index 169c77f725..e48413ea6c 100644 --- a/Walls/BrimstoneSlabWall.cs +++ b/Walls/BrimstoneSlabWall.cs @@ -1,12 +1,10 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class BrimstoneSlabWall : ModWall + public class BrimstoneSlabWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -28,56 +26,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/BrimstoneSlabWall").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; + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; } } } diff --git a/Walls/BrimstoneSlagWall.cs b/Walls/BrimstoneSlagWall.cs index 9c899dffdd..98214c33ba 100644 --- a/Walls/BrimstoneSlagWall.cs +++ b/Walls/BrimstoneSlagWall.cs @@ -1,12 +1,10 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class BrimstoneSlagWall : ModWall + public class BrimstoneSlagWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -23,56 +21,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/BrimstoneSlagWall").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; + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; } } } diff --git a/Walls/BrimstoneSlagWallUnsafe.cs b/Walls/BrimstoneSlagWallUnsafe.cs index 7c8d98a4d7..4485858ca2 100644 --- a/Walls/BrimstoneSlagWallUnsafe.cs +++ b/Walls/BrimstoneSlagWallUnsafe.cs @@ -1,13 +1,12 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class BrimstoneSlagWallUnsafe : ModWall + public class BrimstoneSlagWallUnsafe : MultiVariantModWall { + public override string Texture => "CalamityMod/Walls/BrimstoneSlagWall"; public override void SetStaticDefaults() { AddMapEntry(new Color(24, 16, 29)); @@ -22,56 +21,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/BrimstoneSlagWall").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; + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; } } } diff --git a/Walls/BrimstoneSlagWallUnsafe.png b/Walls/BrimstoneSlagWallUnsafe.png deleted file mode 100644 index f789f6969b..0000000000 Binary files a/Walls/BrimstoneSlagWallUnsafe.png and /dev/null differ diff --git a/Walls/CryonicBrickWall.cs b/Walls/CryonicBrickWall.cs index 41d0bceb49..7a9620f61a 100644 --- a/Walls/CryonicBrickWall.cs +++ b/Walls/CryonicBrickWall.cs @@ -1,12 +1,10 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class CryonicBrickWall : ModWall + public class CryonicBrickWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -23,32 +21,8 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/CryonicBrickWall").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 % 4 }; int xPos = i % 2; int yPos = j % 4; switch (xPos) @@ -57,16 +31,20 @@ namespace CalamityMod.Walls switch (yPos) { case 0: - sheetOffset = new int[2] { 0, 0 }; + frameXOffset = 0; + frameYOffset = 0; break; case 1: - sheetOffset = new int[2] { 0, 1 }; + frameXOffset = 0; + frameYOffset = 1; break; case 2: - sheetOffset = new int[2] { 1, 0 }; + frameXOffset = 1; + frameYOffset = 0; break; case 3: - sheetOffset = new int[2] { 1, 1 }; + frameXOffset = 1; + frameYOffset = 1; break; } break; @@ -74,44 +52,27 @@ namespace CalamityMod.Walls switch (yPos) { case 0: - sheetOffset = new int[2] { 1, 0 }; + frameXOffset = 1; + frameYOffset = 0; break; case 1: - sheetOffset = new int[2] { 1, 1 }; + frameXOffset = 1; + frameYOffset = 1; break; case 2: - sheetOffset = new int[2] { 0, 0 }; + frameXOffset = 0; + frameYOffset = 0; break; case 3: - sheetOffset = new int[2] { 0, 1 }; + frameXOffset = 0; + frameYOffset = 1; break; } break; } - 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; + frameXOffset *= 468; + frameYOffset *= 180; } } } diff --git a/Walls/EutrophicSandWall.cs b/Walls/EutrophicSandWall.cs index b00ae2284b..d6b6bb71c2 100644 --- a/Walls/EutrophicSandWall.cs +++ b/Walls/EutrophicSandWall.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Walls Main.tile[i, j].Get().LiquidType = LiquidID.Water; Main.tile[i, j].LiquidAmount = byte.MaxValue; WorldGen.SquareTileFrame(i, j); - if (Main.netMode == NetmodeID.MultiplayerClient) + if (Main.dedServ) NetMessage.sendWater(i, j); } } diff --git a/Walls/EutrophicSandWallSafe.cs b/Walls/EutrophicSandWallSafe.cs index fb6aa79ae1..3bfe9329d3 100644 --- a/Walls/EutrophicSandWallSafe.cs +++ b/Walls/EutrophicSandWallSafe.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Walls { public class EutrophicSandWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/EutrophicSandWall"; public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/EutrophicSandWallSafe.png b/Walls/EutrophicSandWallSafe.png deleted file mode 100644 index b884b458fe..0000000000 Binary files a/Walls/EutrophicSandWallSafe.png and /dev/null differ diff --git a/Walls/ExoPrismPanelWall.cs b/Walls/ExoPrismPanelWall.cs index fe15711a5e..44bb551287 100644 --- a/Walls/ExoPrismPanelWall.cs +++ b/Walls/ExoPrismPanelWall.cs @@ -1,14 +1,10 @@ -using CalamityMod.Items.Placeables.Walls; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameContent; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class ExoPrismPanelWall : ModWall + public class ExoPrismPanelWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -24,55 +20,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - 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] { 0, (i + j) % 6 }; - 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; + frameXOffset = 0; + frameYOffset = ((i + j) % 6) * 180; } } } diff --git a/Walls/FloralWall.cs b/Walls/FloralWall.cs index b015ce17d2..402390fcfc 100644 --- a/Walls/FloralWall.cs +++ b/Walls/FloralWall.cs @@ -1,12 +1,10 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class FloralWall : ModWall + public class FloralWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -24,32 +22,8 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/FloralWall").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 % 3 }; int xPos = i % 2; int yPos = j % 3; switch (xPos) @@ -58,13 +32,16 @@ namespace CalamityMod.Walls switch (yPos) { case 0: - sheetOffset = new int[2] { 0, 0 }; + frameXOffset = 0; + frameYOffset = 0; break; case 1: - sheetOffset = new int[2] { 0, 1 }; + frameXOffset = 0; + frameYOffset = 1; break; case 2: - sheetOffset = new int[2] { 0, 2 }; + frameXOffset = 0; + frameYOffset = 2; break; } break; @@ -72,41 +49,23 @@ namespace CalamityMod.Walls switch (yPos) { case 0: - sheetOffset = new int[2] { 1, 0 }; + frameXOffset = 1; + frameYOffset = 0; break; case 1: - sheetOffset = new int[2] { 1, 1 }; + frameXOffset = 1; + frameYOffset = 1; break; case 2: - sheetOffset = new int[2] { 1, 2 }; + frameXOffset = 1; + frameYOffset = 2; break; } break; } - 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; + frameXOffset *= 468; + frameYOffset *= 180; } } } diff --git a/Walls/HardenedAstralSandWallSafe.cs b/Walls/HardenedAstralSandWallSafe.cs index 9698fd7664..f95658aff1 100644 --- a/Walls/HardenedAstralSandWallSafe.cs +++ b/Walls/HardenedAstralSandWallSafe.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Walls { public class HardenedAstralSandWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/HardenedAstralSandWall"; public override void SetStaticDefaults() { diff --git a/Walls/HardenedAstralSandWallSafe.png b/Walls/HardenedAstralSandWallSafe.png deleted file mode 100644 index d69aec2968..0000000000 Binary files a/Walls/HardenedAstralSandWallSafe.png and /dev/null differ diff --git a/Walls/MultiVariantModWall.cs b/Walls/MultiVariantModWall.cs new file mode 100644 index 0000000000..bfc39416ba --- /dev/null +++ b/Walls/MultiVariantModWall.cs @@ -0,0 +1,9 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public abstract class MultiVariantModWall : ModWall + { + public virtual void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { } + } +} diff --git a/Walls/NavystoneWallSafe.cs b/Walls/NavystoneWallSafe.cs index ef276c3a45..b2dd4387ad 100644 --- a/Walls/NavystoneWallSafe.cs +++ b/Walls/NavystoneWallSafe.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Walls { public class NavystoneWallSafe : ModWall, IVisibleThroughWater { + public override string Texture => "CalamityMod/Walls/NavystoneWall"; int IVisibleThroughWater.WaterMapEntry { get; set; } public override void SetStaticDefaults() diff --git a/Walls/NavystoneWallSafe.png b/Walls/NavystoneWallSafe.png deleted file mode 100644 index 3c3de52f96..0000000000 Binary files a/Walls/NavystoneWallSafe.png and /dev/null differ diff --git a/Walls/PerennialBrickWall.cs b/Walls/PerennialBrickWall.cs index 813183c73c..2c0e3c5b5a 100644 --- a/Walls/PerennialBrickWall.cs +++ b/Walls/PerennialBrickWall.cs @@ -1,12 +1,10 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class PerennialBrickWall : ModWall + public class PerennialBrickWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -24,56 +22,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/PerennialBrickWall").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 % 4, j % 4 }; - 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; + frameXOffset = (i % 4) * 468; + frameYOffset = (j % 4) * 180; } } } diff --git a/Walls/ProfanedSlabWall.cs b/Walls/ProfanedSlabWall.cs index 9f69d63516..fb1bd81048 100644 --- a/Walls/ProfanedSlabWall.cs +++ b/Walls/ProfanedSlabWall.cs @@ -1,12 +1,11 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls { - public class ProfanedSlabWall : ModWall + public class ProfanedSlabWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -23,56 +22,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/ProfanedSlabWall").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 % 4, j % 4 }; - 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; + frameXOffset = (i % 4) * 468; + frameYOffset = (j % 4) * 180; } } } diff --git a/Walls/PyreMantleWall.cs b/Walls/PyreMantleWall.cs index 69621281e9..444c1ce81d 100644 --- a/Walls/PyreMantleWall.cs +++ b/Walls/PyreMantleWall.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { DustType = 33; - AddMapEntry(new Color(6, 10, 54)); + AddMapEntry(new Color(33, 30, 30)); } public override void RandomUpdate(int i, int j) @@ -20,7 +20,7 @@ namespace CalamityMod.Walls Main.tile[i, j].Get().LiquidType = LiquidID.Water; Main.tile[i, j].LiquidAmount = byte.MaxValue; WorldGen.SquareTileFrame(i, j); - if (Main.netMode == NetmodeID.MultiplayerClient) + if (Main.dedServ) NetMessage.sendWater(i, j); } } diff --git a/Walls/PyreMantleWallSafe.cs b/Walls/PyreMantleWallSafe.cs new file mode 100644 index 0000000000..59dc08ee04 --- /dev/null +++ b/Walls/PyreMantleWallSafe.cs @@ -0,0 +1,20 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class PyreMantleWallSafe : ModWall + { + public override string Texture => "CalamityMod/Walls/PyreMantleWall"; + + public override void SetStaticDefaults() + { + DustType = 33; + Main.wallHouse[Type] = true; + AddMapEntry(new Color(33, 30, 30)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/RunicProfanedBrickWall.cs b/Walls/RunicProfanedBrickWall.cs index 61199ab06f..2703d51746 100644 --- a/Walls/RunicProfanedBrickWall.cs +++ b/Walls/RunicProfanedBrickWall.cs @@ -1,13 +1,12 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { - public class RunicProfanedBrickWall : ModWall + public class RunicProfanedBrickWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -25,56 +24,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/RunicProfanedBrickWall").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; + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; } } } diff --git a/Walls/ScorchedBoneWall.cs b/Walls/ScorchedBoneWall.cs index 8ccbd7fcc1..925b226a67 100644 --- a/Walls/ScorchedBoneWall.cs +++ b/Walls/ScorchedBoneWall.cs @@ -1,12 +1,9 @@ -using CalamityMod.Dusts.Furniture; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class ScorchedBoneWall : ModWall + public class ScorchedBoneWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -17,56 +14,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/ScorchedBoneWall").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 % 3, j % 3 }; - 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; + frameXOffset = (i % 3) * 468; + frameYOffset = (j % 3) * 180; } } } diff --git a/Walls/SulphurousSandWallSafe.cs b/Walls/SulphurousSandWallSafe.cs index b929dec342..e757dc2851 100644 --- a/Walls/SulphurousSandWallSafe.cs +++ b/Walls/SulphurousSandWallSafe.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Walls { public class SulphurousSandWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/SulphurousSandWall"; public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/SulphurousSandWallSafe.png b/Walls/SulphurousSandWallSafe.png deleted file mode 100644 index e8e9ea87e6..0000000000 Binary files a/Walls/SulphurousSandWallSafe.png and /dev/null differ diff --git a/Walls/SulphurousSandstoneWallSafe.cs b/Walls/SulphurousSandstoneWallSafe.cs index 71b50be7b3..8a7091113c 100644 --- a/Walls/SulphurousSandstoneWallSafe.cs +++ b/Walls/SulphurousSandstoneWallSafe.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Walls { public class SulphurousSandstoneWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/SulphurousSandstoneWall"; public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/SulphurousSandstoneWallSafe.png b/Walls/SulphurousSandstoneWallSafe.png deleted file mode 100644 index aab99881fb..0000000000 Binary files a/Walls/SulphurousSandstoneWallSafe.png and /dev/null differ diff --git a/Walls/SulphurousShaleWallSafe.cs b/Walls/SulphurousShaleWallSafe.cs index 92e41b56c4..d0e37e5a12 100644 --- a/Walls/SulphurousShaleWallSafe.cs +++ b/Walls/SulphurousShaleWallSafe.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Walls { public class SulphurousShaleWallSafe : ModWall { + public override string Texture => "CalamityMod/Walls/SulphurousShaleWall"; public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/SulphurousShaleWallSafe.png b/Walls/SulphurousShaleWallSafe.png deleted file mode 100644 index 31dfbfc2b5..0000000000 Binary files a/Walls/SulphurousShaleWallSafe.png and /dev/null differ diff --git a/Walls/VoidstoneSlabWall.cs b/Walls/VoidstoneSlabWall.cs index 096d2e209a..f7e57a9f80 100644 --- a/Walls/VoidstoneSlabWall.cs +++ b/Walls/VoidstoneSlabWall.cs @@ -1,12 +1,10 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Walls { - public class VoidstoneSlabWall : ModWall + public class VoidstoneSlabWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -23,103 +21,13 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - Texture2D sprite = ModContent.Request("CalamityMod/Walls/VoidstoneSlabWall").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 % 3, j % 3 }; int xPos = i % 3; int yPos = j % 3; - switch (yPos) - { - case 0: - switch (xPos) - { - case 0: - sheetOffset = new int[2] { 0, 0 }; - break; - case 1: - sheetOffset = new int[2] { 0, 1 }; - break; - case 2: - sheetOffset = new int[2] { 0, 2 }; - break; - } - break; - case 1: - switch (xPos) - { - case 0: - sheetOffset = new int[2] { 0, 3 }; - break; - case 1: - sheetOffset = new int[2] { 0, 4 }; - break; - case 2: - sheetOffset = new int[2] { 0, 0 }; - break; - } - break; - case 2: - switch (xPos) - { - case 0: - sheetOffset = new int[2] { 0, 1 }; - break; - case 1: - sheetOffset = new int[2] { 0, 2 }; - break; - case 2: - sheetOffset = new int[2] { 0, 3 }; - break; - } - break; - } - 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; + int rel = (xPos + yPos * 3) % 5; + frameXOffset = 0; + frameYOffset = rel * 180; } } } diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index f4881eb777..a239873c54 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -11,16 +11,22 @@ namespace CalamityMod.Walls { public class VoidstoneWall : ModWall { - internal static Texture2D GlowTexture; + internal static FramedMaskTexture GlowMask; public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; - GlowTexture = ModContent.Request("CalamityMod/Walls/VoidstoneWall_Glowmask", AssetRequestMode.ImmediateLoad).Value; + GlowMask = new("CalamityMod/Walls/VoidstoneWall_Glowmask", 36, 36); + Main.wallHouse[Type] = true; AddMapEntry(new Color(0, 0, 0)); } + public override void Unload() + { + GlowMask?.Unload(); + GlowMask = null; + } + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); @@ -29,37 +35,53 @@ namespace CalamityMod.Walls public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) { - if (GlowTexture is null) + if (GlowMask.Texture is null) return; Tile tile = Main.tile[i, j]; int xLength = 32; int xOff = 0; - Rectangle frame = new Rectangle(tile.WallFrameX + xOff, tile.WallFrameY, xLength, 32); + int xPos = tile.WallFrameX + xOff; + int yPos = tile.WallFrameY; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); Color drawcolor; drawcolor = WorldGen.paintColor(tile.WallColor); drawcolor.A = 255; Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - float brightness = 1f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; - brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawcolor *= brightness; - if (Main.drawToScreen) zero = Vector2.Zero; Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; - Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - Color glowColor = drawcolor * 0.4f; - for (int k = 0; k < 3; k++) + Color lightColor = Lighting.GetColor(i, j, Color.White); + + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) { - Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; - Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawcolor *= brightness; + Color glowColor = drawcolor * 0.4f; + + if (lightColor.R > glowColor.R) glowColor.R = lightColor.R; + if (lightColor.G > glowColor.G) glowColor.G = lightColor.G; + if (lightColor.B > glowColor.B) glowColor.B = lightColor.B; + + if (glowColor.R <= 0 && glowColor.G <= 0 && glowColor.B <= 0) + return; + + for (int k = 0; k < 3; k++) + { + Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; + spriteBatch.Draw(GlowMask.Texture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } } } diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index 5f7348b9ee..6469477f7c 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -11,15 +11,25 @@ namespace CalamityMod.Walls { public class VoidstoneWallUnsafe : ModWall { - internal static Texture2D GlowTexture; + internal static FramedMaskTexture GlowMask; + public override string Texture => "CalamityMod/Walls/VoidstoneWall"; public override void SetStaticDefaults() { - GlowTexture = ModContent.Request("CalamityMod/Walls/VoidstoneWall_Glowmask", AssetRequestMode.ImmediateLoad).Value; + // We basically have same copy in VoidstoneWall + // But leaving this in case of changing to Unsafe variant specific glowmask + GlowMask = new("CalamityMod/Walls/VoidstoneWall_Glowmask", 36, 36); + DustType = 187; AddMapEntry(new Color(0, 0, 0)); } + public override void Unload() + { + GlowMask?.Unload(); + GlowMask = null; + } + public override void RandomUpdate(int i, int j) { if (Main.tile[i, j].LiquidAmount == 0 && j < Main.maxTilesY - 205) @@ -27,44 +37,62 @@ namespace CalamityMod.Walls Main.tile[i, j].Get().LiquidType = LiquidID.Water; Main.tile[i, j].LiquidAmount = byte.MaxValue; WorldGen.SquareTileFrame(i, j); - if (Main.netMode == NetmodeID.MultiplayerClient) + if (Main.dedServ) NetMessage.sendWater(i, j); } } public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) { - if (GlowTexture is null) + if (GlowMask.Texture is null) return; Tile tile = Main.tile[i, j]; int xLength = 32; int xOff = 0; - Rectangle frame = new Rectangle(tile.WallFrameX + xOff, tile.WallFrameY, xLength, 32); + int xPos = tile.WallFrameX + xOff; + int yPos = tile.WallFrameY; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); Color drawcolor; drawcolor = WorldGen.paintColor(tile.WallColor); drawcolor.A = 255; Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - float brightness = 1f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; - brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawcolor *= brightness; - if (Main.drawToScreen) zero = Vector2.Zero; Vector2 pos = new Vector2((i * 16 - (int)Main.screenPosition.X), (j * 16 - (int)Main.screenPosition.Y)) + zero; - Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - Color glowColor = drawcolor * 0.4f; - for (int k = 0; k < 3; k++) + Color lightColor = Lighting.GetColor(i, j, Color.White); + + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) { - Vector2 offset = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)) * 0.2f * k; - Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawcolor *= brightness; + Color glowColor = drawcolor * 0.4f; + + if (lightColor.R > glowColor.R) glowColor.R = lightColor.R; + if (lightColor.G > glowColor.G) glowColor.G = lightColor.G; + if (lightColor.B > glowColor.B) glowColor.B = lightColor.B; + + if (glowColor.R <= 0 && glowColor.G <= 0 && glowColor.B <= 0) + return; + + // For now checking for glowing frames greatly reducing the bottleneck + // But maybe we could squeeze bit more by removing the loop + for (int k = 0; k < 3; k++) + { + Vector2 offset = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)) * 0.2f * k; + spriteBatch.Draw(GlowMask.Texture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } } } diff --git a/Walls/VoidstoneWallUnsafe.png b/Walls/VoidstoneWallUnsafe.png deleted file mode 100644 index 721e7e72f1..0000000000 Binary files a/Walls/VoidstoneWallUnsafe.png and /dev/null differ diff --git a/Walls/WulfrumPlatingWall.cs b/Walls/WulfrumPlatingWall.cs index 39fcfcc9cd..039b0f6198 100644 --- a/Walls/WulfrumPlatingWall.cs +++ b/Walls/WulfrumPlatingWall.cs @@ -1,13 +1,10 @@ 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 class WulfrumPlatingWall : MultiVariantModWall { public override void SetStaticDefaults() { @@ -23,56 +20,10 @@ namespace CalamityMod.Walls 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) + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) { - 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; + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; } } } diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index 7064c4fadf..1696e5a7c5 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -1,4 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; @@ -6,13 +9,38 @@ using Terraria.ModLoader; namespace CalamityMod.Waters { - public class AstralWater : ModWaterStyle + public class AstralWaterflow : ModWaterfallStyle { } + + public class AstralWater : CalamityModWaterStyle { - public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/AstralWaterflow").Slot; - 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 static CalamityModWaterStyle Instance { get; private set; } + public static ModWaterfallStyle WaterfallStyle { get; private set; } + public static int SplashDust { get; private set; } + public static int DropletGore { get; private set; } + public static Asset RainTexture { get; private set; } + + public override void SetStaticDefaults() + { + Instance = this; + WaterfallStyle = ModContent.Find("CalamityMod/AstralWaterflow"); + SplashDust = ModContent.DustType(); + DropletGore = ModContent.GoreType(); + } + + public override void Unload() + { + Instance = null; + WaterfallStyle = null; + SplashDust = 0; + DropletGore = 0; + } + + public override int ChooseWaterfallStyle() => WaterfallStyle.Slot; + public override int GetSplashDust() => SplashDust; + public override int GetDropletGore() => DropletGore; + public override Asset GetRainTexture() => RainTexture ??= ModContent.Request("CalamityMod/Waters/AstralRain"); + public override byte GetRainVariant() => (byte)Main.rand.Next(3); - public override Color BiomeHairColor() => Color.MediumPurple; + public override Color BiomeHairColor() => new Color(93, 78, 107); } } diff --git a/Waters/AstralWaterflow.cs b/Waters/AstralWaterflow.cs deleted file mode 100644 index 76e3fc81d6..0000000000 --- a/Waters/AstralWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Waters -{ - public class AstralWaterflow : ModWaterfallStyle - { - - } -} diff --git a/Waters/BasaltGullyWater.cs b/Waters/BasaltGullyWater.cs index 6aa26ea180..ffa6cf1762 100644 --- a/Waters/BasaltGullyWater.cs +++ b/Waters/BasaltGullyWater.cs @@ -1,33 +1,45 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Graphics; using Terraria.ModLoader; namespace CalamityMod.Waters { - public class BasaltGullyWater : ModWaterStyle + public class BasaltGullyWaterflow : ModWaterfallStyle { } + + public class BasaltGullyWater : CalamityModWaterStyle { public static int Type; - public override void SetStaticDefaults() + + private readonly Vector3 WaterGlowColor = new Color(144, 174, 200).ToVector3(); + + public override void SetStaticDefaults() => Type = Slot; + + public override void ModifyLight(ref readonly Tile tile, int i, int j, ref float r, ref float g, ref float b) { - Type = Slot; - } - public override int ChooseWaterfallStyle() - { - return ModContent.Find("CalamityMod/BasaltGullyWaterflow").Slot; + Vector3 outputColor = new Vector3(r, g, b); + if (outputColor == Vector3.One || outputColor == new Vector3(0.25f, 0.25f, 0.25f) || outputColor == new Vector3(0.5f, 0.5f, 0.5f)) + return; + + if (tile.TileType != RustyChestTile.Type) + { + CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + } + + r = outputColor.X; + g = outputColor.Y; + b = outputColor.Z; } - public override int GetSplashDust() - { - return 33; - } + public override void DrawColor(int x, int y, ref VertexColors liquidColor, bool isSlope) => ILEditing.ILChanges.SelectSulphuricWaterColor(x, y, ref liquidColor, isSlope); - public override int GetDropletGore() - { - return 713; - } - - public override Color BiomeHairColor() - { - return Color.DarkGray; - } + public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/BasaltGullyWaterflow").Slot; + public override int GetSplashDust() => ModContent.DustType(); + public override int GetDropletGore() => ModContent.GoreType(); + public override Color BiomeHairColor() => Color.WhiteSmoke; } } diff --git a/Waters/BasaltGullyWaterflow.cs b/Waters/BasaltGullyWaterflow.cs deleted file mode 100644 index 545ff8daaf..0000000000 --- a/Waters/BasaltGullyWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class BasaltGullyWaterflow : ModWaterfallStyle - { - } -} diff --git a/Waters/CragsLava.cs b/Waters/CragsLava.cs new file mode 100644 index 0000000000..3654038bbd --- /dev/null +++ b/Waters/CragsLava.cs @@ -0,0 +1,38 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Accessories; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; + +namespace CalamityMod.Waters +{ + public class CragsLava : ModLavaStyle + { + public override string WaterfallTexture => "CalamityMod/Waters/CragsLavaflow"; + + public override int GetSplashDust() => ModContent.DustType(); + + public override int GetDropletGore() => ModContent.GoreType(); + + public override bool IsLavaActive() => Main.LocalPlayer.Calamity().ZoneCalamity || Main.LocalPlayer.Calamity().BrimstoneLavaFountainCounter > 0; + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 2.48f / 4; + g = 1.05f / 4; + b = 0.98f / 4; + } + + public override void InflictDebuff(Player player, int onfireDuration) + { + // Extra DoT in the lava of the crags. Negated by Flame-licked Shell. + if (!player.Calamity().flameLickedShell) + player.AddBuff(ModContent.BuffType(), 2, false); + } + } +} diff --git a/Waters/CragsLavaStyle.cs b/Waters/CragsLavaStyle.cs deleted file mode 100644 index 6ffe68bed0..0000000000 --- a/Waters/CragsLavaStyle.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class CragsLavaflow : ModWaterfallStyle { } - - public class CragsLavaStyle : CustomLavaStyle - { - public override string LavaTexturePath => "CalamityMod/Waters/CragsLava"; - - public override string BlockTexturePath => LavaTexturePath + "_Block"; - - public override string SlopeTexturePath => LavaTexturePath + "_Slope"; - - public override bool ChooseLavaStyle() => Main.LocalPlayer.Calamity().ZoneCalamity || Main.LocalPlayer.Calamity().BrimstoneLavaFountainCounter > 0; - - public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/CragsLavaflow").Slot; - - public override int GetSplashDust() => 0; - - public override int GetDropletGore() => 0; - - public override void SelectLightColor(ref Color initialLightColor) - { - initialLightColor = Color.Lerp(initialLightColor, Color.White, 0.5f); - initialLightColor.A = 255; - } - } -} diff --git a/Waters/CustomLavaManagement.cs b/Waters/CustomLavaManagement.cs deleted file mode 100644 index e4018ddb5d..0000000000 --- a/Waters/CustomLavaManagement.cs +++ /dev/null @@ -1,92 +0,0 @@ -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 -{ - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static class CustomLavaManagement - { - internal static List CustomLavaStyles; - internal static Texture2D LavaBlockTexture; - internal static Texture2D LavaTexture; - internal static Texture2D LavaSlopeTexture; - - // The IL Edits are loaded separately. - internal static void Load() - { - CustomLavaStyles = new List(); - - 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. - if (!type.IsSubclassOf(typeof(CustomLavaStyle)) || type.IsAbstract) - continue; - - CustomLavaStyles.Add(Activator.CreateInstance(type) as CustomLavaStyle); - CustomLavaStyles.Last().Load(); - } - - if (Main.netMode != NetmodeID.Server) - { - LavaBlockTexture = ModContent.Request("Terraria/Images/Liquid_1", AssetRequestMode.ImmediateLoad).Value; - LavaTexture = ModContent.Request("Terraria/Images/Misc/water_1", AssetRequestMode.ImmediateLoad).Value; - LavaSlopeTexture = ModContent.Request("Terraria/Images/LiquidSlope_1", AssetRequestMode.ImmediateLoad).Value; - } - } - - internal static void Unload() - { - if (CustomLavaStyles != null) - foreach (CustomLavaStyle lavaStyle in CustomLavaStyles) - lavaStyle?.Unload(); - - CustomLavaStyles = null; - LavaBlockTexture = null; - LavaTexture = null; - } - - internal static int SelectLavafallStyle(int initialLavafallStyle) - { - // Lava waterfall. - if (initialLavafallStyle != 1) - return initialLavafallStyle; - - foreach (CustomLavaStyle lavaStyle in CustomLavaStyles) - { - int waterfallStyle = lavaStyle.ChooseWaterfallStyle(); - if (lavaStyle.ChooseLavaStyle() && waterfallStyle >= 0) - return waterfallStyle; - } - - return initialLavafallStyle; - } - - internal static Color SelectLavafallColor(int initialLavafallStyle, Color initialLavafallColor) - { - // Lava waterfall. - if (initialLavafallStyle != 1) - return initialLavafallColor; - - foreach (CustomLavaStyle lavaStyle in CustomLavaStyles) - { - if (lavaStyle.ChooseLavaStyle()) - { - lavaStyle.SelectLightColor(ref initialLavafallColor); - return initialLavafallColor; - } - } - - return initialLavafallColor; - } - } -} diff --git a/Waters/CustomLavaStyle.cs b/Waters/CustomLavaStyle.cs deleted file mode 100644 index 5059a1134d..0000000000 --- a/Waters/CustomLavaStyle.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public abstract class CustomLavaStyle - { - internal Texture2D LavaTexture; - internal Texture2D BlockTexture; - internal Texture2D SlopeTexture; - - internal void Load() - { - // Don't load textures serverside. - if (Main.netMode == NetmodeID.Server) - return; - - LavaTexture = ModContent.Request(LavaTexturePath, AssetRequestMode.ImmediateLoad).Value; - BlockTexture = ModContent.Request(BlockTexturePath, AssetRequestMode.ImmediateLoad).Value; - SlopeTexture = ModContent.Request(SlopeTexturePath, AssetRequestMode.ImmediateLoad).Value; - } - - internal void Unload() - { - LavaTexture = null; - BlockTexture = null; - } - - public abstract string LavaTexturePath { get; } - - public abstract string BlockTexturePath { get; } - - public abstract string SlopeTexturePath { get; } - - public virtual bool ChooseLavaStyle() => false; - - public abstract int ChooseWaterfallStyle(); - - public abstract int GetSplashDust(); - - public abstract int GetDropletGore(); - - public virtual void SelectLightColor(ref Color initialLightColor) - { - } - } -} diff --git a/Waters/FloralParadiseWater.cs b/Waters/FloralParadiseWater.cs index 9d67d11a46..55c3c06ba0 100644 --- a/Waters/FloralParadiseWater.cs +++ b/Waters/FloralParadiseWater.cs @@ -1,28 +1,38 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Waters { - public class FloralParadiseWater : ModWaterStyle + public class FloralParadiseWaterflow : ModWaterfallStyle { } + + public class FloralParadiseWater : CalamityModWaterStyle { + public static int Type { get; private set; } + public static CalamityModWaterStyle Instance { get; private set; } + + public override void SetStaticDefaults() + { + Type = Slot; + Instance = this; + } + + public override void Unload() + { + Type = -1; + Instance = null; + } + public override int ChooseWaterfallStyle() { return ModContent.Find("CalamityMod/FloralParadiseWaterflow").Slot; } - public override int GetSplashDust() - { - return 33; - } - - public override int GetDropletGore() - { - return 713; - } - - public override Color BiomeHairColor() - { - return Color.PaleTurquoise; - } + public override int GetSplashDust() => DustID.Water; + public override int GetDropletGore() => GoreID.WaterDripCavern; + public override Color BiomeHairColor() => Color.PaleTurquoise; } } diff --git a/Waters/FloralParadiseWater.png b/Waters/FloralParadiseWater.png index d8a0958b63..050b018ea8 100644 Binary files a/Waters/FloralParadiseWater.png and b/Waters/FloralParadiseWater.png differ diff --git a/Waters/FloralParadiseWaterWaterflow.cs b/Waters/FloralParadiseWaterWaterflow.cs deleted file mode 100644 index 64a6ce4344..0000000000 --- a/Waters/FloralParadiseWaterWaterflow.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class FloralParadiseWaterflow : ModWaterfallStyle - { - - } -} diff --git a/Waters/FloralParadiseWater_Block.png b/Waters/FloralParadiseWater_Block.png index 5fe701ea91..0294eb4b3c 100644 Binary files a/Waters/FloralParadiseWater_Block.png and b/Waters/FloralParadiseWater_Block.png differ diff --git a/Waters/FloralParadiseWater_Slope.png b/Waters/FloralParadiseWater_Slope.png index a8a6fde86a..2bd68c8094 100644 Binary files a/Waters/FloralParadiseWater_Slope.png and b/Waters/FloralParadiseWater_Slope.png differ diff --git a/Waters/FloralParadiseWaterflow.png b/Waters/FloralParadiseWaterflow.png index aa0d689eb7..6ac360d4b4 100644 Binary files a/Waters/FloralParadiseWaterflow.png and b/Waters/FloralParadiseWaterflow.png differ diff --git a/Waters/LiquidTileType.cs b/Waters/LiquidTileType.cs deleted file mode 100644 index 594a74731d..0000000000 --- a/Waters/LiquidTileType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace CalamityMod.Waters -{ - public enum LiquidTileType - { - Block, - Waterflow, - Slope - } -} diff --git a/Waters/MiddleAbyssWater.cs b/Waters/MiddleAbyssWater.cs index 1c7f8250f8..b44b3c1556 100644 --- a/Waters/MiddleAbyssWater.cs +++ b/Waters/MiddleAbyssWater.cs @@ -1,28 +1,41 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria.Graphics; using Terraria.ModLoader; namespace CalamityMod.Waters { - public class MiddleAbyssWater : ModWaterStyle + public class MiddleAbyssWaterflow : ModWaterfallStyle { } + + public class MiddleAbyssWater : CalamityModWaterStyle { - public override int ChooseWaterfallStyle() + public static CalamityModWaterStyle Instance { get; private set; } + public static ModWaterfallStyle WaterfallStyle { get; private set; } + public static int SplashDust { get; private set; } + public static int DropletGore { get; private set; } + + public override void SetStaticDefaults() { - return ModContent.Find("CalamityMod/MiddleAbyssWaterflow").Slot; + Instance = this; + WaterfallStyle = ModContent.Find("CalamityMod/MiddleAbyssWaterflow"); + SplashDust = ModContent.DustType(); + DropletGore = ModContent.GoreType(); } - public override int GetSplashDust() + public override void Unload() { - return 33; + Instance = null; + WaterfallStyle = null; + SplashDust = 0; + DropletGore = 0; } - public override int GetDropletGore() - { - return 713; - } - - public override Color BiomeHairColor() - { - return Color.Blue; - } + public override int ChooseWaterfallStyle() => WaterfallStyle.Slot; + public override int GetSplashDust() => SplashDust; + public override int GetDropletGore() => DropletGore; + public override Color BiomeHairColor() => new Color(36, 23, 19); + public override void DrawColor(int x, int y, ref VertexColors liquidColor, bool isSlope) => ILEditing.ILChanges.SelectSulphuricWaterColor(x, y, ref liquidColor, isSlope); } } diff --git a/Waters/MiddleAbyssWaterflow.cs b/Waters/MiddleAbyssWaterflow.cs deleted file mode 100644 index 0105e3024f..0000000000 --- a/Waters/MiddleAbyssWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Waters -{ - public class MiddleAbyssWaterflow : ModWaterfallStyle - { - - } -} diff --git a/Waters/PissWater.cs b/Waters/PissWater.cs index 0b315df535..7fe16643f5 100644 --- a/Waters/PissWater.cs +++ b/Waters/PissWater.cs @@ -1,28 +1,40 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Waters { + public class PissWaterflow : ModWaterfallStyle { } + public class PissWater : ModWaterStyle { - public override int ChooseWaterfallStyle() + public static ModWaterStyle Instance { get; private set; } + public static ModWaterfallStyle WaterfallStyle { get; private set; } + public static int SplashDust { get; private set; } + public static int DropletGore { get; private set; } + + public override void SetStaticDefaults() { - return ModContent.Find("CalamityMod/PissWaterflow").Slot; + Instance = this; + WaterfallStyle = ModContent.Find("CalamityMod/PissWaterflow"); + SplashDust = DustID.Water_Desert; + DropletGore = GoreID.WaterDripDesert; } - public override int GetSplashDust() + public override void Unload() { - return 102; + Instance = null; + WaterfallStyle = null; + SplashDust = 0; + DropletGore = 0; } - public override int GetDropletGore() - { - return 711; - } - - public override Color BiomeHairColor() - { - return Color.Yellow; - } + public override int ChooseWaterfallStyle() => WaterfallStyle.Slot; + public override int GetSplashDust() => DustID.Water_Desert; + public override int GetDropletGore() => GoreID.WaterDripDesert; + public override Color BiomeHairColor() => Color.Yellow; } } diff --git a/Waters/PissWaterflow.cs b/Waters/PissWaterflow.cs deleted file mode 100644 index a5189ea521..0000000000 --- a/Waters/PissWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Waters -{ - public class PissWaterflow : ModWaterfallStyle - { - - } -} diff --git a/Waters/SulphuricDepthsWater.cs b/Waters/SulphuricDepthsWater.cs index 64aa588c33..4642b32461 100644 --- a/Waters/SulphuricDepthsWater.cs +++ b/Waters/SulphuricDepthsWater.cs @@ -1,33 +1,60 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using System; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; +using Terraria.Graphics; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; namespace CalamityMod.Waters { - public class SulphuricDepthsWater : ModWaterStyle + public class SulphuricDepthsWaterflow : ModWaterfallStyle { } + + public class SulphuricDepthsWater : CalamityModWaterStyle { - public static int Type; + public static int Type { get; private set; } + public static CalamityModWaterStyle Instance { get; private set; } + public static ModWaterfallStyle WaterfallStyle { get; private set; } + public static int SplashDust { get; private set; } + public static int DropletGore { get; private set; } + public override void SetStaticDefaults() { Type = Slot; - } - public override int ChooseWaterfallStyle() - { - return ModContent.Find("CalamityMod/SulphuricDepthsWaterflow").Slot; + Instance = this; + WaterfallStyle = ModContent.Find("CalamityMod/SulphuricDepthsWaterflow"); + SplashDust = ModContent.DustType(); + DropletGore = ModContent.GoreType(); } - public override int GetSplashDust() + public override void Unload() { - return 33; + Type = -1; + Instance = null; + WaterfallStyle = null; + SplashDust = 0; + DropletGore = 0; } - public override int GetDropletGore() + public override int ChooseWaterfallStyle() => WaterfallStyle.Slot; + public override int GetSplashDust() => SplashDust; + public override int GetDropletGore() => DropletGore; + public override Color BiomeHairColor() => new Color(35, 117, 89); + public override void DrawColor(int x, int y, ref VertexColors liquidColor, bool isSlope) => ILEditing.ILChanges.SelectSulphuricWaterColor(x, y, ref liquidColor, isSlope); + public override void ModifyLight(ref readonly Tile tile, int i, int j, ref float r, ref float g, ref float b) { - return 713; - } + Vector3 outputColor = new Vector3(r, g, b); - public override Color BiomeHairColor() - { - return Color.Teal; + if (tile.TileType != RustyChestTile.Type) + { + outputColor = Vector3.Lerp(outputColor, Color.MediumSeaGreen.ToVector3(), 0.18f); + } + r = outputColor.X; + g = outputColor.Y; + b = outputColor.Z; } } } diff --git a/Waters/SulphuricDepthsWaterflow.cs b/Waters/SulphuricDepthsWaterflow.cs deleted file mode 100644 index 5cf86274ff..0000000000 --- a/Waters/SulphuricDepthsWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Waters -{ - public class SulphuricDepthsWaterflow : ModWaterfallStyle - { - - } -} diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index ef9ce540ea..72135efa68 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -1,23 +1,127 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using System; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.ModLoader; +using Terraria.Graphics; +using Terraria.ID; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; namespace CalamityMod.Waters { - public class SulphuricWater : ModWaterStyle + public class SulphuricWaterflow : ModWaterfallStyle { } + + public class SulphuricWater : CalamityModWaterStyle { - public static int Type; + public static CalamityModWaterStyle Instance { get; private set; } + public static ModWaterfallStyle WaterfallStyle { get; private set; } + public static int SplashDust { get; private set; } + public static int DropletGore { get; private set; } + public static Asset RainTexture { get; private set; } + public override void SetStaticDefaults() { - Type = Slot; + Instance = this; + WaterfallStyle = ModContent.Find("CalamityMod/SulphuricWaterflow"); + SplashDust = ModContent.DustType(); + DropletGore = ModContent.GoreType(); } - public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/SulphuricWaterflow").Slot; - public override int GetSplashDust() => 101; - public override int GetDropletGore() => 708; - public override Asset GetRainTexture() => ModContent.Request("CalamityMod/Waters/SulphuricRain"); + + public override void Unload() + { + Instance = null; + WaterfallStyle = null; + SplashDust = 0; + DropletGore = 0; + RainTexture = null; + } + + public override int ChooseWaterfallStyle() => WaterfallStyle.Slot; + public override int GetSplashDust() => SplashDust; + public override int GetDropletGore() => DropletGore; + public override Asset GetRainTexture() => RainTexture ??= ModContent.Request("CalamityMod/Waters/SulphuricRain"); + public override byte GetRainVariant() => (byte)Main.rand.Next(3); - public override Color BiomeHairColor() => Color.Turquoise; + public override Color BiomeHairColor() => new Color(43, 168, 110); + public override void DrawColor(int x, int y, ref VertexColors liquidColor, bool isSlope) => ILEditing.ILChanges.SelectSulphuricWaterColor(x, y, ref liquidColor, isSlope); + public override void ModifyLight(ref readonly Tile tile, int i, int j, ref float r, ref float g, ref float b) + { + Vector3 outputColor = new Vector3(r, g, b); + + Tile above = CalamityUtils.ParanoidTileRetrieval(i, j - 1); + if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9)) + { + MediumMistParticle acidFoam = new(new(i * 16f + Main.rand.NextFloat(16f), j * 16f + 8f), -Vector2.UnitY.RotatedByRandom(0.67f) * Main.rand.NextFloat(1f, 2.4f), Color.LightSeaGreen, Color.White, 0.16f, 128f, 0.02f); + GeneralParticleHandler.SpawnParticle(acidFoam); + } + + if (tile.TileType != RustyChestTile.Type) + { + if (Main.dayTime && !Main.raining) + { + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + if (j > 580) + brightness *= 1f - (j - 580) / 100f; + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.014f; + float waveScale2 = time * 0.1f; + int scalar = i + (-j / 2); + float wave1 = waveScale1 * -50 + scalar * 15; + float wave2 = waveScale2 * -10 + scalar * 14; + float wave3 = waveScale1 * -100 + scalar * 13; + float wave4 = waveScale2 * 10 + scalar * 25; + float wave5 = waveScale1 * -70 + scalar * 5; + float wave1angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave1)); + float wave2angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave2)); + float wave3angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave3)); + float wave4angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave4)); + float wave5angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave5)); + outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle); + outputColor *= brightness; + } + + if (!Main.dayTime && !Main.raining) + { + float brightness = MathHelper.Clamp(0.17f - (j / 680), 0f, 0.17f); + if (j > 580) + brightness *= 1f - (j - 580) / 100f; + + float waveScale1 = Main.GameUpdateCount * 0.014f; + float waveScale2 = Main.GameUpdateCount * 0.1f; + int scalar = i + (-j / 2); + float wave1 = waveScale1 * -50 + scalar * 15; + float wave2 = waveScale2 * -10 + scalar * 14; + float wave3 = waveScale1 * -100 + scalar * 13; + float wave4 = waveScale2 * 10 + scalar * 25; + float wave5 = waveScale1 * -70 + scalar * 5; + float wave1angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave1)); + float wave2angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave2)); + float wave3angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave3)); + float wave4angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave4)); + float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); + outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle); + outputColor *= brightness; + } + + if (Main.raining) + { + float brightness = MathHelper.Clamp(1f - (j / 680), 0f, 1f); + if (j > 580) + brightness *= 1f - (j - 580) / 100f; + + outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f); + outputColor *= brightness; + } + } + r = outputColor.X; + g = outputColor.Y; + b = outputColor.Z; + } } } diff --git a/Waters/SulphuricWaterflow.cs b/Waters/SulphuricWaterflow.cs deleted file mode 100644 index f9ed907df3..0000000000 --- a/Waters/SulphuricWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Waters -{ - public class SulphuricWaterflow : ModWaterfallStyle - { - - } -} diff --git a/Waters/SulphuricWaterflow.png b/Waters/SulphuricWaterflow.png index cd519bf721..a7fc32ffbb 100644 Binary files a/Waters/SulphuricWaterflow.png and b/Waters/SulphuricWaterflow.png differ diff --git a/Waters/SunkenSeaBurrowsWater.cs b/Waters/SunkenSeaBurrowsWater.cs index c7bd8974e5..25be900b27 100644 --- a/Waters/SunkenSeaBurrowsWater.cs +++ b/Waters/SunkenSeaBurrowsWater.cs @@ -1,33 +1,57 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Waters { - public class SunkenSeaBurrowsWater : ModWaterStyle + public class SunkenSeaBurrowsWaterflow : ModWaterfallStyle { } + + public class SunkenSeaBurrowsWater : CalamityModWaterStyle { - public static int Type; + private readonly Vector3 WaterGlowColor = new Color(76, 211, 231).ToVector3(); + + public static int Type { get; private set; } + public static CalamityModWaterStyle Instance { get; private set; } + public override void SetStaticDefaults() { Type = Slot; - } - public override int ChooseWaterfallStyle() - { - return ModContent.Find("CalamityMod/SunkenSeaBurrowsWaterflow").Slot; + Instance = this; } - public override int GetSplashDust() + public override void Unload() { - return 33; + Type = -1; + Instance = null; } - public override int GetDropletGore() + public override void LightColorMultiplier(ref float r, ref float g, ref float b) { - return 713; + r = 1.02f; + g = 1.03f; + b = 1.075f; } - public override Color BiomeHairColor() + public override void ModifyLight(ref readonly Tile tile, int i, int j, ref float r, ref float g, ref float b) { - return Color.Blue; + Vector3 outputColor = new Vector3(r, g, b); + + if (tile.TileType != RustyChestTile.Type) + { + CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + } + + r = outputColor.X; + g = outputColor.Y; + b = outputColor.Z; } + public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/SunkenSeaBurrowsWaterflow").Slot; + public override int GetSplashDust() => ModContent.DustType(); + public override int GetDropletGore() => ModContent.GoreType(); + public override Color BiomeHairColor() => Color.Blue; } } diff --git a/Waters/SunkenSeaBurrowsWaterflow.cs b/Waters/SunkenSeaBurrowsWaterflow.cs deleted file mode 100644 index 79974dca2a..0000000000 --- a/Waters/SunkenSeaBurrowsWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class SunkenSeaBurrowsWaterflow : ModWaterfallStyle - { - } -} diff --git a/Waters/SunkenSeaPolypWater.cs b/Waters/SunkenSeaPolypWater.cs index 11a8967142..7967539d7f 100644 --- a/Waters/SunkenSeaPolypWater.cs +++ b/Waters/SunkenSeaPolypWater.cs @@ -1,33 +1,51 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Waters { - public class SunkenSeaPolypWater : ModWaterStyle + public class SunkenSeaPolypWaterflow : ModWaterfallStyle { } + + public class SunkenSeaPolypWater : CalamityModWaterStyle { - public static int Type; + private readonly Vector3 WaterGlowColor = new Color(213, 185, 178).ToVector3(); + + public static int Type { get; private set; } + public static CalamityModWaterStyle Instance { get; private set; } + public override void SetStaticDefaults() { Type = Slot; - } - public override int ChooseWaterfallStyle() - { - return ModContent.Find("CalamityMod/SunkenSeaPolypWaterflow").Slot; + Instance = this; } - public override int GetSplashDust() + public override void Unload() { - return 33; + Type = -1; + Instance = null; } - public override int GetDropletGore() + public override void ModifyLight(ref readonly Tile tile, int i, int j, ref float r, ref float g, ref float b) { - return 713; + Vector3 outputColor = new Vector3(r, g, b); + + if (tile.TileType != RustyChestTile.Type) + { + CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + } + + r = outputColor.X; + g = outputColor.Y; + b = outputColor.Z; } - public override Color BiomeHairColor() - { - return Color.Coral; - } + public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/SunkenSeaPolypWaterflow").Slot; + public override int GetSplashDust() => ModContent.DustType(); + public override int GetDropletGore() => ModContent.GoreType(); + public override Color BiomeHairColor() => Color.Coral; } } diff --git a/Waters/SunkenSeaPolypWaterflow.cs b/Waters/SunkenSeaPolypWaterflow.cs deleted file mode 100644 index 13c68fbe0b..0000000000 --- a/Waters/SunkenSeaPolypWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class SunkenSeaPolypWaterflow : ModWaterfallStyle - { - } -} diff --git a/Waters/SunkenSeaReefsWater.cs b/Waters/SunkenSeaReefsWater.cs index b83f7f4b57..e0db74851a 100644 --- a/Waters/SunkenSeaReefsWater.cs +++ b/Waters/SunkenSeaReefsWater.cs @@ -1,33 +1,51 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Waters { - public class SunkenSeaReefsWater : ModWaterStyle + public class SunkenSeaReefsWaterflow : ModWaterfallStyle { } + + public class SunkenSeaReefsWater : CalamityModWaterStyle { - public static int Type; + private readonly Vector3 WaterGlowColor = new Color(140, 222, 240).ToVector3(); + + public static int Type { get; private set; } + public static CalamityModWaterStyle Instance { get; private set; } + public override void SetStaticDefaults() { Type = Slot; - } - public override int ChooseWaterfallStyle() - { - return ModContent.Find("CalamityMod/SunkenSeaReefsWaterflow").Slot; + Instance = this; } - public override int GetSplashDust() + public override void Unload() { - return 33; + Type = -1; + Instance = null; } - public override int GetDropletGore() + public override void ModifyLight(ref readonly Tile tile, int i, int j, ref float r, ref float g, ref float b) { - return 713; + Vector3 outputColor = new Vector3(r, g, b); + + if (tile.TileType != RustyChestTile.Type) + { + CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + } + + r = outputColor.X; + g = outputColor.Y; + b = outputColor.Z; } - public override Color BiomeHairColor() - { - return Color.SkyBlue; - } + public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/SunkenSeaReefsWaterflow").Slot; + public override int GetSplashDust() => ModContent.DustType(); + public override int GetDropletGore() => ModContent.GoreType(); + public override Color BiomeHairColor() => Color.SkyBlue; } } diff --git a/Waters/SunkenSeaReefsWater.png b/Waters/SunkenSeaReefsWater.png index fb72da6384..f698094ba2 100644 Binary files a/Waters/SunkenSeaReefsWater.png and b/Waters/SunkenSeaReefsWater.png differ diff --git a/Waters/SunkenSeaReefsWater_Block.png b/Waters/SunkenSeaReefsWater_Block.png index e7ec1e6847..e2a973a704 100644 Binary files a/Waters/SunkenSeaReefsWater_Block.png and b/Waters/SunkenSeaReefsWater_Block.png differ diff --git a/Waters/SunkenSeaReefsWater_Slope.png b/Waters/SunkenSeaReefsWater_Slope.png index f817e2c784..694bd626c7 100644 Binary files a/Waters/SunkenSeaReefsWater_Slope.png and b/Waters/SunkenSeaReefsWater_Slope.png differ diff --git a/Waters/SunkenSeaReefsWaterflow.cs b/Waters/SunkenSeaReefsWaterflow.cs deleted file mode 100644 index 353e3e372e..0000000000 --- a/Waters/SunkenSeaReefsWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class SunkenSeaReefsWaterflow : ModWaterfallStyle - { - } -} diff --git a/Waters/SunkenSeaReefsWaterflow.png b/Waters/SunkenSeaReefsWaterflow.png index d2fe204180..6e894d833c 100644 Binary files a/Waters/SunkenSeaReefsWaterflow.png and b/Waters/SunkenSeaReefsWaterflow.png differ diff --git a/Waters/SunkenSeaShoresWater.cs b/Waters/SunkenSeaShoresWater.cs index 5dd4c5e590..032e3322b9 100644 --- a/Waters/SunkenSeaShoresWater.cs +++ b/Waters/SunkenSeaShoresWater.cs @@ -1,33 +1,51 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Waters { - public class SunkenSeaShoresWater : ModWaterStyle + public class SunkenSeaShoresWaterflow : ModWaterfallStyle { } + + public class SunkenSeaShoresWater : CalamityModWaterStyle { - public static int Type; + private readonly Vector3 WaterGlowColor = new Color(140, 222, 239).ToVector3(); + + public static int Type { get; private set; } + public static CalamityModWaterStyle Instance { get; private set; } + public override void SetStaticDefaults() { Type = Slot; - } - public override int ChooseWaterfallStyle() - { - return ModContent.Find("CalamityMod/SunkenSeaShoresWaterflow").Slot; + Instance = this; } - public override int GetSplashDust() + public override void Unload() { - return 33; + Type = -1; + Instance = null; } - public override int GetDropletGore() + public override void ModifyLight(ref readonly Tile tile, int i, int j, ref float r, ref float g, ref float b) { - return 713; + Vector3 outputColor = new Vector3(r, g, b); + + if (tile.TileType != RustyChestTile.Type) + { + CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + } + + r = outputColor.X; + g = outputColor.Y; + b = outputColor.Z; } - public override Color BiomeHairColor() - { - return Color.OrangeRed; - } + public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/SunkenSeaShoresWaterflow").Slot; + public override int GetSplashDust() => ModContent.DustType(); + public override int GetDropletGore() => ModContent.GoreType(); + public override Color BiomeHairColor() => Color.OrangeRed; } } diff --git a/Waters/SunkenSeaShoresWaterflow.cs b/Waters/SunkenSeaShoresWaterflow.cs deleted file mode 100644 index 67620e943c..0000000000 --- a/Waters/SunkenSeaShoresWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class SunkenSeaShoresWaterflow : ModWaterfallStyle - { - } -} diff --git a/Waters/UpperAbyssWater.cs b/Waters/UpperAbyssWater.cs index 965861fdf7..1b0de8f5fe 100644 --- a/Waters/UpperAbyssWater.cs +++ b/Waters/UpperAbyssWater.cs @@ -1,28 +1,41 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria.Graphics; using Terraria.ModLoader; namespace CalamityMod.Waters { - public class UpperAbyssWater : ModWaterStyle + public class UpperAbyssWaterflow : ModWaterfallStyle { } + + public class UpperAbyssWater : CalamityModWaterStyle { - public override int ChooseWaterfallStyle() + public static CalamityModWaterStyle Instance { get; private set; } + public static ModWaterfallStyle WaterfallStyle { get; private set; } + public static int SplashDust { get; private set; } + public static int DropletGore { get; private set; } + + public override void SetStaticDefaults() { - return ModContent.Find("CalamityMod/UpperAbyssWaterflow").Slot; + Instance = this; + WaterfallStyle = ModContent.Find("CalamityMod/UpperAbyssWaterflow"); + SplashDust = ModContent.DustType(); + DropletGore = ModContent.GoreType(); } - public override int GetSplashDust() + public override void Unload() { - return 33; + Instance = null; + WaterfallStyle = null; + SplashDust = 0; + DropletGore = 0; } - public override int GetDropletGore() - { - return 713; - } - - public override Color BiomeHairColor() - { - return Color.Blue; - } + public override int ChooseWaterfallStyle() => WaterfallStyle.Slot; + public override int GetSplashDust() => SplashDust; + public override int GetDropletGore() => DropletGore; + public override Color BiomeHairColor() => new Color(9, 69, 82); + public override void DrawColor(int x, int y, ref VertexColors liquidColor, bool isSlope) => ILEditing.ILChanges.SelectSulphuricWaterColor(x, y, ref liquidColor, isSlope); } } diff --git a/Waters/UpperAbyssWaterflow.cs b/Waters/UpperAbyssWaterflow.cs deleted file mode 100644 index e61de17827..0000000000 --- a/Waters/UpperAbyssWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Waters -{ - public class UpperAbyssWaterflow : ModWaterfallStyle - { - - } -} diff --git a/Waters/VoidWater.cs b/Waters/VoidWater.cs index bff3e0bf78..153151825a 100644 --- a/Waters/VoidWater.cs +++ b/Waters/VoidWater.cs @@ -1,28 +1,41 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria.Graphics; using Terraria.ModLoader; namespace CalamityMod.Waters { - public class VoidWater : ModWaterStyle + public class VoidWaterflow : ModWaterfallStyle { } + + public class VoidWater : CalamityModWaterStyle { - public override int ChooseWaterfallStyle() + public static CalamityModWaterStyle Instance { get; private set; } + public static ModWaterfallStyle WaterfallStyle { get; private set; } + public static int SplashDust { get; private set; } + public static int DropletGore { get; private set; } + + public override void SetStaticDefaults() { - return ModContent.Find("CalamityMod/VoidWaterflow").Slot; + Instance = this; + WaterfallStyle = ModContent.Find("CalamityMod/VoidWaterflow"); + SplashDust = ModContent.DustType(); + DropletGore = ModContent.GoreType(); } - public override int GetSplashDust() + public override void Unload() { - return 33; + Instance = null; + WaterfallStyle = null; + SplashDust = 0; + DropletGore = 0; } - public override int GetDropletGore() - { - return 713; - } - - public override Color BiomeHairColor() - { - return Color.Blue; - } + public override int ChooseWaterfallStyle() => WaterfallStyle.Slot; + public override int GetSplashDust() => SplashDust; + public override int GetDropletGore() => DropletGore; + public override Color BiomeHairColor() => new Color(16, 8, 30); + public override void DrawColor(int x, int y, ref VertexColors liquidColor, bool isSlope) => ILEditing.ILChanges.SelectSulphuricWaterColor(x, y, ref liquidColor, isSlope); } } diff --git a/Waters/VoidWaterflow.cs b/Waters/VoidWaterflow.cs deleted file mode 100644 index bb408bd108..0000000000 --- a/Waters/VoidWaterflow.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Waters -{ - public class VoidWaterflow : ModWaterfallStyle - { - - } -} diff --git a/World/Abyss.cs b/World/Abyss.cs index 54b16021f0..9bb6d96d14 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -11,6 +11,8 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Packets; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureVoid; @@ -67,7 +69,13 @@ namespace CalamityMod.World tile.LiquidAmount = byte.MaxValue; } - bool canConvert = tile.HasTile && tile.TileType < TileID.Count && tile.TileType != ModContent.TileType(); + bool canConvert = false; + if (tile.HasTile) + { + bool vanillaTile = tile.TileType < TileID.Count; + bool validModdedTile = tile.TileType != ModContent.TileType() && AbyssValidTileReplacementList.Includes(tile.TileType); + canConvert = vanillaTile || validModdedTile; + } //normally i would organize each layer of blocks by the order of how they are placed in the abyss //but i cannot be bothered, and when i do it, it keeps messing up or making certain parts like transitions not gen right @@ -1177,18 +1185,27 @@ namespace CalamityMod.World /// /// Unlocks all abyss chests, automatically synced across the server. - /// Only run initally on the server. + /// It SHOULD only run initally on the server. /// public static void UnlockAllAbyssChests() { - UnlockChests = true; - - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.UnlockAbyssChests); - netMessage.Send(); + UnlockAbyssChestsPacket.Send(); + DoUnlockAllAbyssChests(); } + else if (Main.netMode == NetmodeID.SinglePlayer) + { + DoUnlockAllAbyssChests(); + } + } + + /// + /// Actually Unlocks all abyss chests, This is NOT synced between clients. Call instead unless you know what you doing. + /// + internal static void DoUnlockAllAbyssChests() + { + UnlockChests = true; for (int c = 0; c < Main.maxChests; c++) { diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs index 497e2d6017..9a487be65a 100644 --- a/World/AerialiteOreGen.cs +++ b/World/AerialiteOreGen.cs @@ -30,11 +30,11 @@ namespace CalamityMod.World Tile tile = Main.tile[x, y]; // The following conditions must happen in order for aerialite to generate: - // 1. The original tile ID must be that of a cloud. + // 1. The original tile ID must be that of a Cloud, Lesion Block, or Flesh Block. // 2. The original tile must not be empty air. // 3. A random dice-roll must land correctly, to ensure that patches of ore are occasional. // If any of these conditions are not met, this loop iteration is skipped. - if (tile.TileType != TileID.Cloud || !tile.HasTile || !WorldGen.genRand.NextBool(CloudOreConversionChance)) + if (!(tile.TileType == TileID.Cloud || tile.TileType == TileID.LesionBlock || tile.TileType == TileID.FleshBlock) || !tile.HasTile || !WorldGen.genRand.NextBool(CloudOreConversionChance)) continue; int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); @@ -51,7 +51,7 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(x, y), new ModShapes.All(biggerCircle), Actions.Chain(new GenAction[] { new Actions.ClearTile(), - new Actions.PlaceTile((ushort)TileID.Cloud) + new Actions.PlaceTile(tile.TileType) })); // Circle of ore. @@ -90,7 +90,7 @@ namespace CalamityMod.World WorldGen.SquareTileFrame(x, y); // Inform all clients of the tile change. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, x, y); } } diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index b38c4b12b4..0a9c2e8a49 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -75,7 +75,7 @@ namespace CalamityMod.World public static void PlaceAstralMeteor() { - Mod ancientsAwakened = CalamityMod.Instance.ancientsAwakened; + Mod ancientsAwakened = ExternalMods.ancientsAwakened; // This flag is also used to determine whether players are nearby. bool meteorDropped = true; @@ -222,7 +222,7 @@ namespace CalamityMod.World // Pre-cache a list of Magic Storage tiles to avoid, for performance reasons // It is plausible that only StorageComponent and StorageConnector are needed, but I aint gonna risk corrupting worlds // or crashes as containers can do some serious shit as seen with the Abyss chests - Shade - Mod magicStorage = CalamityMod.Instance.magicStorage; + Mod magicStorage = ExternalMods.magicStorage; IList MSTilesToAvoid = new List(16); if (magicStorage is not null) { @@ -443,8 +443,8 @@ namespace CalamityMod.World NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); if (CanAstralBiomeSpawn()) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(MeteorSound, Main.player[Main.myPlayer].position); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(MeteorSound, Main.LocalPlayer.position); // Immediately prior to mass-converting blocks to Astral, write down the Y position of this event. YStart = j; @@ -455,7 +455,7 @@ namespace CalamityMod.World if (j < 181) j = 181; - int xOffset = GenVars.dungeonX < Main.maxTilesX / 2 ? WorldGen.genRand.Next(-80, -40) : WorldGen.genRand.Next(40, 80); + int xOffset = GenVars.dungeonX < Main.maxTilesX / 2 ? WorldGen.genRand.Next(-100, -50) : WorldGen.genRand.Next(50, 100); bool altarPlaced = false; while (!altarPlaced) @@ -473,6 +473,7 @@ namespace CalamityMod.World 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); @@ -631,12 +632,14 @@ namespace CalamityMod.World type != ModContent.TileType() && type != ModContent.TileType() && type != ModContent.TileType() && type != ModContent.TileType() && type != ModContent.TileType() && type != ModContent.TileType() && - type != ModContent.TileType() && type != ModContent.TileType() && - type != ModContent.TileType() && type != ModContent.TileType() && + type != ModContent.TileType() && type != ModContent.TileType() && + type != ModContent.TileType() && type != ModContent.TileType() && + type != ModContent.TileType() && type != ModContent.TileType() && type != ModContent.TileType() && type != ModContent.TileType() && - type != ModContent.TileType() && type != ModContent.TileType() && - type != ModContent.TileType() && type != ModContent.TileType() && - type != ModContent.TileType()) + type != ModContent.TileType() && type != ModContent.TileType() && + type != ModContent.TileType() && type != ModContent.TileType() && + type != ModContent.TileType() && type != ModContent.TileType() && + type != ModContent.TileType()) { if (TileID.Sets.Conversion.Grass[type] && !TileID.Sets.GrassSpecial[type]) { @@ -742,8 +745,9 @@ namespace CalamityMod.World case TileID.LargePiles: if (tile.TileFrameX <= 1170) { - RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 0, 1170, 0, 18); + RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 0, 1170, 0, 18); } + // TODO: Mushroom, replace when Astral Undergrowth is being worked on again if (tile.TileFrameX >= 1728) { RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 1728, 1872, 0, 18); @@ -771,10 +775,14 @@ namespace CalamityMod.World { newType = (ushort)ModContent.TileType(); } - else if (tile.TileFrameX <= 558 || (tile.TileFrameX >= 1368 && tile.TileFrameX <= 1458)) + else if (tile.TileFrameX >= 1368 && tile.TileFrameX <= 1458) { newType = (ushort)ModContent.TileType(); } + else if (tile.TileFrameX <= 558) + { + newType = (ushort)ModContent.TileType(); + } else if (tile.TileFrameX >= 900 && tile.TileFrameX <= 1098) { newType = (ushort)ModContent.TileType(); @@ -815,10 +823,15 @@ namespace CalamityMod.World { newType3 = (ushort)ModContent.TileType(); } - else if (tile.TileFrameX <= 486) + else if (tile.TileFrameX >= 110 && tile.TileFrameX <= 198) { newType3 = (ushort)ModContent.TileType(); } + // Intentionally encapsulates everything EXCEPT the above range + else if (tile.TileFrameX <= 486) + { + newType3 = (ushort)ModContent.TileType(); + } else if (tile.TileFrameX >= 648 && tile.TileFrameX <= 846) { newType3 = (ushort)ModContent.TileType(); @@ -847,7 +860,7 @@ namespace CalamityMod.World } else if ((tile.TileFrameX >= 54 && tile.TileFrameX <= 90) || (tile.TileFrameX >= 216 && tile.TileFrameX <= 360)) { - newType2 = (ushort)ModContent.TileType(); + newType2 = (ushort)ModContent.TileType(); } else if (tile.TileFrameX <= 36) { @@ -1063,15 +1076,28 @@ namespace CalamityMod.World { SetTileFromConvert(x, y, convert, ushort.MaxValue, ushort.MaxValue, TileID.HallowedPlants2, TileID.Plants2); } + // TODO: All astral medium pile conversions break said tiles. Large and small piles work fine. else if (type == ModContent.TileType()) { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 378, 0); + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles2, x, y, 540, 0); } else if (type == ModContent.TileType()) { RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 18); } else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 110, 0); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 378, 0); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 1368, 18); + } + else if (type == ModContent.TileType()) { RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 0); } @@ -1099,7 +1125,8 @@ namespace CalamityMod.World { RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 648, 0); } - else if (type == ModContent.TileType()) + // TODO: All astral stalactite conversions break said tiles + else if (type == ModContent.TileType() || type == ModContent.TileType()) { ushort originType = TileID.Stone; switch (convert) @@ -1151,7 +1178,7 @@ namespace CalamityMod.World { WorldGen.SquareTileFrame(x, y, true); } - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) { NetMessage.SendTileSquare(-1, x, y, 1); } diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 10573d76b6..11024b1055 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -57,7 +57,7 @@ namespace CalamityMod.World for (int y = Main.maxTilesY - 90; y <= Main.maxTilesY - 5; y++) { WorldGen.PlaceTile(x, y, (ushort)ModContent.TileType()); - Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); } } @@ -311,8 +311,7 @@ namespace CalamityMod.World } } - //settle all liquids - CalamityUtils.SettleWater(); + CalamityUtils.SettleWater(false); //spread grass on all scorched remains with no lava above them for (int x = biomeStart; x <= biomeEdge; x++) @@ -517,7 +516,6 @@ namespace CalamityMod.World List contents = new List() { new ChestItem(ItemID.HellstoneBar, WorldGen.genRand.Next(4, 6)), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(4, 15)), new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(2, 5)), new ChestItem(ItemID.HellfireArrow, WorldGen.genRand.Next(25, 50)), new ChestItem(potionType, WorldGen.genRand.Next(1, 3)), @@ -526,14 +524,11 @@ namespace CalamityMod.World if (!firstItem) { - contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(0, new ChestItem(ItemID.ObsidianWaterWalkingBoots, 1)); } else { - contents.RemoveAt(0); - contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - //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))); + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); } for (int i = 0; i < contents.Count; i++) diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index ae21089ff5..6439becdb8 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1,4 +1,5 @@ using System.Reflection; +using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.NPCs.ExoMechs; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; @@ -7,7 +8,10 @@ using CalamityMod.NPCs.ExoMechs.Thanatos; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Events; +using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities; namespace CalamityMod.World { @@ -16,18 +20,36 @@ namespace CalamityMod.World public static class CalamityWorld { #region Vars - public static int ArmoredDiggerSpawnCooldown = 0; + /// Tracks the amount of money stolen by the Bandit in this world, in Copper Coins. public static int MoneyStolenByBandit = 0; + /// + /// Tracks the number of reforges which have been performed since the Bandit last refunded the player.
+ /// Used to allow the refund feature to work, and for allowing special Goblin Tinkerer and Bandit dialogue. + ///
public static int Reforges; + /// + /// If false, this world was created before the Draedon Update (1.5.0.001).
+ /// Worlds created before the Draedon Update will not lock specific Draedon's Arsenal recipes behind Schematics. + ///
public static bool IsWorldAfterDraedonUpdate = false; + /// + /// Stores the pre-Hardmode ore types that this world generated with.
+ /// Is not actually used for any world gen tasks, and is only used to change the item sprite of the Suspicious Scrap item. + ///
public static ushort[] OreTypes = new ushort[4]; // Modes - public static bool revenge = false; // Revengeance Mode - public static bool death = false; // Death Mode - public static bool armageddon = false; // Armageddon Mode + /// If true, the world is in Revengeance Mode. + public static bool revenge = false; + /// If true, the world is in Death Mode. + public static bool death = false; + /// + /// If true, taking damage while a boss is alive will instantly kill the player.
+ /// Unused by Calamity and can only be set externally. + ///
+ public static bool armageddon = false; - // Evaluates to whether vanilla's "Legendary Mode" is enabled (Master Mode on For the Worthy) + /// Evaluates to whether vanilla's "Legendary Mode" is enabled (Master Mode on For the Worthy). public static bool LegendaryMode => Main.getGoodWorld && ReflectMasterMode(); // FTW automatically bumps difficulties up and has no proper check for Master since a world generated in Expert Mode will be classified as Master @@ -45,26 +67,31 @@ namespace CalamityMod.World // Shrines public static int[] SChestX = new int[10]; public static int[] SChestY = new int[10]; - public static bool roxShrinePlaced = false; - // Planetoids + /// Used to check if the world has generated Luminite planetoids from Moon Lord's defeat. public static bool HasGeneratedLuminitePlanetoids = false; - // Town NPC spawn/home bools + /// If true, the Bandit has lived in this world. Used to ensure their spawn condition is not required on subsequent respawns. public static bool spawnedBandit = false; + /// If true, the Drunk Princess has lived in this world. Used to ensure her spawn condition is not required on subsequent respawns. public static bool spawnedCirrus = false; + /// If true, the Archmage has lived in a house in this world. Solely used as a condition for dialogue. public static bool foundHomePermafrost = false; - // Town Pet name chosen bools + /// Used for allowing custom Town Cat patreon names. public static bool catName = false; + /// Used for allowing custom Town Dog patreon names. public static bool dogName = false; + /// Used for allowing custom Town Bunny patreon names. public static bool bunnyName = false; // Draedon Summoning stuff. public static int DraedonSummonCountdown = 0; public static ExoMech DraedonMechToSummon; public static Vector2 DraedonSummonPosition = Vector2.Zero; + /// Used to track whether or not Draedon has given their initial monologue when summoned before the Exo Mechs fight for the first time. public static bool TalkedToDraedon = false; + /// If true, Draedon will immediately spawn Exo Mechdusa after being summoned. public static bool DraedonMechdusa = false; public static bool AbleToSummonDraedon { @@ -99,5 +126,121 @@ namespace CalamityMod.World public static Vector2 CavernLabCenter; #endregion + + #region Rain Utils + public static void StartRain(bool adjustSeverity = false, bool maxSeverity = false, bool worldSync = true) + { + int framesInDay = 86400; + int framesInHour = framesInDay / 24; + Main.rainTime = Main.rand.Next(framesInHour * 8, framesInDay); + if (Main.rand.NextBool(3)) + { + Main.rainTime += Main.rand.Next(0, framesInHour); + } + if (Main.rand.NextBool(4)) + { + Main.rainTime += Main.rand.Next(0, framesInHour * 2); + } + if (Main.rand.NextBool(5)) + { + Main.rainTime += Main.rand.Next(0, framesInHour * 2); + } + if (Main.rand.NextBool(6)) + { + Main.rainTime += Main.rand.Next(0, framesInHour * 3); + } + if (Main.rand.NextBool(7)) + { + Main.rainTime += Main.rand.Next(0, framesInHour * 4); + } + if (Main.rand.NextBool(8)) + { + Main.rainTime += Main.rand.Next(0, framesInHour * 5); + } + float randRainExtender = 1f; + if (Main.rand.NextBool()) + { + randRainExtender += 0.05f; + } + if (Main.rand.NextBool(3)) + { + randRainExtender += 0.1f; + } + if (Main.rand.NextBool(4)) + { + randRainExtender += 0.15f; + } + if (Main.rand.NextBool(5)) + { + randRainExtender += 0.2f; + } + Main.rainTime = (int)(Main.rainTime * randRainExtender); + Main.raining = true; + if (adjustSeverity) + TorrentialTear.AdjustRainSeverity(maxSeverity); + + if (worldSync) + CalamityNetcode.SyncWorld(); + } + + public static void StopRain(bool clearWeather = false, bool worldSync = true) + { + if (clearWeather) + Main.StopRain(); + else + Main.raining = false; + + if (worldSync) + CalamityNetcode.SyncWorld(); + } + #endregion + + #region Sandstorm Utils + public static void StartSandstorm() + { + if (Main.netMode != NetmodeID.MultiplayerClient && !Sandstorm.Happening) + { + // 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) + { + windSpeed = Main.rand.NextFloat(0.3f, 0.4f) * (Main.rand.Next(0, 2) * 2 - 1); + } + else if (Main.windSpeedCurrent < 0.3f && Main.windSpeedCurrent > 0f) + { + windSpeed = Main.rand.NextFloat(0.3f, 0.4f); + } + else if (Main.windSpeedCurrent > -0.3f && Main.windSpeedCurrent < 0f) + { + windSpeed = Main.rand.NextFloat(-0.4f, -0.3f); + } + if (windSpeed != 0f) + { + Main.windSpeedCurrent = windSpeed < 0f ? -0.3f : 0.3f; + Main.windSpeedTarget = windSpeed; + } + Sandstorm.StartSandstorm(); + } + } + + public static void StopSandstorm() + { + if (Main.netMode != NetmodeID.MultiplayerClient && Sandstorm.Happening) + { + Sandstorm.StopSandstorm(); + } + } + #endregion + + #region Time Utils + public static void ResetTime(bool changeToDay) + { + Main.time = 0D; + Main.dayTime = changeToDay; + CalamityNetcode.SyncWorld(); + } + #endregion } } diff --git a/World/CustomTemple.cs b/World/CustomTemple.cs index 007f9721cc..80be98c84b 100644 --- a/World/CustomTemple.cs +++ b/World/CustomTemple.cs @@ -26,18 +26,35 @@ namespace CalamityMod.World int y = WorldGen.genRand.Next((int)Main.rockLayer, Main.maxTilesY - 500); - if (Main.tile[x, y].HasTile && Main.tile[x, y].TileType == 60) + if (Main.remixWorld) { - Rectangle ugDesert = GenVars.UndergroundDesertLocation; - Rectangle InflatedSunkenSeaLocation = new Rectangle(ugDesert.Left - 160, ugDesert.Center.Y - 160, ugDesert.Width + 320, ugDesert.Height / 2 + 320); - Rectangle TempleLocation = new Rectangle(x - 80, y - 80, 160, 160); + while (Main.tile[x, y].HasTile || Main.tile[x, y].WallType > 0 || y > (int)(Main.worldSurface - 5.0)) + { + y--; + } - if (!TempleLocation.Intersects(InflatedSunkenSeaLocation)) + y++; + if (Main.tile[x, y].HasTile && (Main.tile[x, y].TileType == TileID.JungleGrass || Main.tile[x, y].TileType == TileID.Mud)) { success = true; GenNewTemple(x, y); } } + else + { + if (Main.tile[x, y].HasTile && Main.tile[x, y].TileType == TileID.JungleGrass) + { + Rectangle ugDesert = GenVars.UndergroundDesertLocation; + Rectangle InflatedSunkenSeaLocation = new Rectangle(ugDesert.Left - 160, ugDesert.Center.Y - 160, ugDesert.Width + 320, ugDesert.Height / 2 + 320); + Rectangle TempleLocation = new Rectangle(x - 80, y - 80, 160, 160); + + if (!TempleLocation.Intersects(InflatedSunkenSeaLocation)) + { + success = true; + GenNewTemple(x, y); + } + } + } } } diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index c6c1f1601c..5bb14468dc 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -255,8 +255,15 @@ namespace CalamityMod.World do { 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)); + // Generates opposite to the Brimstone Crags + // Has more wiggle room in Remix seed due to modified hell gen + bool dungeonRight = Main.dungeonX > Main.maxTilesX / 2; + int midLeft = Main.remixWorld ? 6 : 9; + float midRight = Main.remixWorld ? 0.6f : 0.82f; + int placementPositionX = dungeonRight ? WorldGen.genRand.Next((int)(Main.maxTilesX / 12), (int)(Main.maxTilesX / midLeft)) : WorldGen.genRand.Next((int)(Main.maxTilesX * midRight), (int)(Main.maxTilesX * 0.925)); + // If in Drunk world but not GFB, Hell lab spawns in the center of the world (Hell gets swapped around) + if (Main.drunkWorld && !Main.remixWorld) + placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.4f), (int)(Main.maxTilesX * 0.6f)); int placementPositionY = WorldGen.genRand.Next(Main.maxTilesY - 150, Main.maxTilesY - 125); placementPoint = new Point(placementPositionX, placementPositionY); @@ -288,7 +295,7 @@ namespace CalamityMod.World break; } } - while (tries <= 20000); + while (tries <= 50000); } #endregion @@ -428,6 +435,11 @@ namespace CalamityMod.World canGenerateInLocation = false; } } + // Snow overlaps a lot with jungle on drunk/gfb worlds so it needs a bit of extra help + if (Main.drunkWorld) + { + iceTilesInArea *= 3; + } if (!canGenerateInLocation || nearbyOtherWorkshop || iceTilesInArea < totalTiles * 0.35f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) tries++; else @@ -514,6 +526,11 @@ namespace CalamityMod.World } } } + // Jungle overlaps a lot with snow on drunk/gfb worlds so it needs a bit of extra help + if (Main.drunkWorld) + { + jungleTilesInArea *= 3; + } if (!canGenerateInLocation || nearbyOtherWorkshop || jungleTilesInArea < totalTiles * 0.4f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) { tries++; @@ -559,7 +576,7 @@ namespace CalamityMod.World contents.Insert(8, new ChestItem(ItemID.CrimsonPlanterBox, WorldGen.genRand.Next(5, 9 + 1))); // Add Thorium Marine Kelp if Thorium is loaded. - Mod thorium = CalamityMod.Instance.thorium; + Mod thorium = ExternalMods.thorium; if (thorium is not null) { var marineKelpPlanterBox = thorium.Find("MarineKelpPlanterBox"); diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index f413f99e1e..474cf6d647 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -10,6 +10,7 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.FurnitureAncient; +using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; using Microsoft.Xna.Framework; @@ -143,41 +144,6 @@ namespace CalamityMod.World } #endregion - #region Place Rox Shrine - public static void PlaceRoxShrine() - { - while (!CalamityWorld.roxShrinePlaced) - { - CalamityWorld.roxShrinePlaced = true; - for (int x = 0; x < Main.maxTilesX; x++) - { - for (int y = 0; y < Main.maxTilesY; y++) - { - if (Main.tile[x, y] != null && Main.tile[x, y].TileType == TileID.LargePiles) - { - if ((Main.tile[x, y].TileFrameX == 18 && Main.tile[x, y].TileFrameY == 0) || (Main.tile[x, y].TileFrameX == 45 && Main.tile[x, y].TileFrameY == 0)) - { - if (WorldGen.genRand.NextBool(3)) - { - for (int dx = -1; dx < 2; dx++) - { - for (int dy = -1; dy < 2; dy++) - Main.tile[x + dx, y + dy].Get().HasTile = false; - } - - WorldGen.PlaceTile(x, y + 1, ModContent.TileType()); - return; - } - else - CalamityWorld.roxShrinePlaced = false; - } - } - } - } - } - } - #endregion - #region Chasm Generator public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) { @@ -489,5 +455,37 @@ namespace CalamityMod.World } } #endregion + + #region Auric Land Mines + public static void GenerateAuricLandMines() + { + int landMineID = ModContent.TileType(); + int landMineChance = Main.zenithWorld ? 150 : 300; + float maxDepth = Main.maxTilesY * (Main.zenithWorld ? 0.75f : 0.5f); // depth increased in gfb due to the evil columns that extend further downward + for (int x = 0; x < Main.maxTilesX; x++) + { + for (int y = 0; y < maxDepth; y++) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); + Tile above = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + if (t != null) + { + if (above != null) + { + // Yharim killed the gods with auric land mines obviously + if ((t.TileType == TileID.Ebonstone || t.TileType == TileID.Crimstone) && !above.HasTile) + { + if (WorldGen.genRand.NextBool(landMineChance)) + { + WorldGen.SlopeTile(x, y); + WorldGen.PlaceTile(x, y - 1, landMineID); + } + } + } + } + } + } + } + #endregion } } diff --git a/World/Planets/GrassPlanet.cs b/World/Planets/GrassPlanet.cs index 9272f44e89..b232dce244 100644 --- a/World/Planets/GrassPlanet.cs +++ b/World/Planets/GrassPlanet.cs @@ -20,8 +20,8 @@ namespace CalamityMod.World.Planets { private ushort[] oreTypes = new ushort[] { - GenVars.copperBar == TileID.Copper ? (Main.getGoodWorld ? TileID.Palladium : TileID.Tin) : (Main.getGoodWorld ? TileID.Cobalt : TileID.Copper), - GenVars.ironBar == TileID.Iron ? (Main.getGoodWorld ? TileID.Palladium : TileID.Lead) : (Main.getGoodWorld ? TileID.Cobalt : TileID.Iron) + GenVars.copper == TileID.Copper ? (Main.getGoodWorld ? TileID.Palladium : TileID.Tin) : (Main.getGoodWorld ? TileID.Cobalt : TileID.Copper), + GenVars.iron == TileID.Iron ? (Main.getGoodWorld ? TileID.Palladium : TileID.Lead) : (Main.getGoodWorld ? TileID.Cobalt : TileID.Iron) }; public override bool Place(Point origin, StructureMap structures) diff --git a/World/Planets/LuminitePlanet.cs b/World/Planets/LuminitePlanet.cs index 01a92face5..fccaf54011 100644 --- a/World/Planets/LuminitePlanet.cs +++ b/World/Planets/LuminitePlanet.cs @@ -88,7 +88,7 @@ namespace CalamityMod.World.Planets })); // And sync the entire thing. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, origin.X - radius - 16, origin.Y - radius - 16, radius * 2 + 16, radius * 2 + 16); } } diff --git a/World/Planets/LuminitePlanet2.cs b/World/Planets/LuminitePlanet2.cs index e1aaa76bfd..e9cd5f9204 100644 --- a/World/Planets/LuminitePlanet2.cs +++ b/World/Planets/LuminitePlanet2.cs @@ -94,7 +94,7 @@ namespace CalamityMod.World.Planets })); // And sync the entire thing. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, origin.X - radius - 36, origin.Y - radius - 36, radius * 2 + 36, radius * 2 + 36); } } diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index 90d5bcd15f..22ac59402b 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -103,19 +103,12 @@ namespace CalamityMod.World.Planets public static bool InvalidSkyPlacementArea(Rectangle area) { - Mod varia = CalamityMod.Instance.varia; for (int i = area.Left; i < area.Right; i++) { for (int j = area.Top; j < area.Bottom; j++) { if (Main.tile[i, j].TileType == TileID.Cloud || Main.tile[i, j].TileType == TileID.RainCloud || Main.tile[i, j].TileType == TileID.Sunplate) return false; - - if (varia != null && - (Main.tile[i, j].TileType == varia.Find("StarplateBrick").Type || Main.tile[i, j].TileType == varia.Find("ForgottenCloud").Type)) - { - return false; - } } } return true; diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index 361adf0026..c396017248 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -1196,7 +1196,7 @@ namespace CalamityMod.World public static void GenerateChests(List scrapPilePositions) { GenerateTreasureChest(); - CalamityUtils.SettleWater(); + CalamityUtils.SettleWater(false); GenerateOpenAirChestChest(); GenerateScrapPileChest(scrapPilePositions); GenerateDeepWaterChest(); diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 9459d720a1..b8a0091c89 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -1,12 +1,13 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; +using System.Threading.Tasks; using CalamityMod.Tiles.SunkenSea; using CalamityMod.Tiles.SunkenSea.Ambient; using CalamityMod.Walls; using Microsoft.Xna.Framework; +using ReLogic.Threading; using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -25,105 +26,270 @@ namespace CalamityMod.World -Make sunken sea walls produce water */ + /* + ena todo + + fix the fucking forest being shaved + cut a half oval out of the top of forest in anticipation of structure placement + change the type of noise both reefs and forest use (reefs more jagged, forest more flat) + cut a curve out of the top of shores (the desert part) + extend basalt to hell - DONE + convert normal terrain blocks below basalt into basalt + BLOTCHES EVERYWHERE + */ + + public static void NormalForLoop(int fromInclusive, int toExclusive, int step, Action action) + { + for (int i = fromInclusive; i < toExclusive; i += step) + action.Invoke(i); + } + + public static void ReLogicParallelFor(int fromInclusive, int toExclusive, int step, Action action) + { + FastParallel.For(fromInclusive, toExclusive, (start, end, _) => + { + for (int i = start; i < end; i += step) + action.Invoke(i); + }); + } + + public static void CSharpParallelFor(int fromInclusive, int toExclusive, int step, Action action) + { + var partitioner = Partitioner.Create(fromInclusive, toExclusive, step); + Parallel.ForEach(partitioner, (range, _) => + { + for (int i = range.Item1; i < range.Item2; i += step) + action.Invoke(i); + }); + } + + /// + /// The delegate that describes the method of a type of for loop. + /// + public delegate void ForLoopMethod(int fromInclusive, int toExclusive, int step, Action action); + + /// + /// The current type of for loop used to generate the Sunken Sea. + /// + public static ForLoopMethod ForLoop; + public static void PlaceTimelessShores(int startPosX, int startPosY) { int biomeSize = 250 + (Main.maxTilesX / 180); - //place a box of circles to serve as the main "area" for the biome - for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X += 25) + // + // Places a trapezoid of circles to serve as the main area for the biome. + // + const float steepness = 15f; + static float trapezoidLateralSteep(float x) { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y += 20) + if (x <= 1f / steepness) + return steepness * x; + else if (x > 1f / steepness && x < 1f - 1f / steepness) + return 1f; + else + return -steepness * x + steepness; + } + ForLoop.Invoke(startPosX - biomeSize - 20, startPosX + biomeSize + 20, 15, (X) => + { + float height = MathHelper.Lerp( + startPosY + 50, + startPosY - 35, + trapezoidLateralSteep(Utils.GetLerpValue(startPosX - biomeSize - 20, startPosX + biomeSize + 20, X))); + + for (int Y = startPosY + 50; Y >= height; Y -= 10) { ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(25), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(30), Actions.Chain(new GenAction[] { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) + //new Modifiers.RadialDither(1, 30).Output(circle), + new Modifiers.Blotches().Output(circle), })); + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); } - } + }); + + // + // Makes the bottom borders of the Timeless Shores curved downwards. + // + const int totalCuveDepth = 40; + ForLoop.Invoke(startPosX - biomeSize - 20, startPosX - biomeSize + 200, 10, (x) => + { + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, x, true))); + + for (int y = startPosY + 50; y <= startPosY + 50 + curveDepth; y += 5) + { + ShapeData circle = new(); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + { + //new Modifiers.RadialDither(1, 30).Output(circle), + new Modifiers.Blotches().Output(circle), + })); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + } + }); + ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize + 20, 5, (x) => + { + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, x, true))); + + for (int y = startPosY + 50; y <= startPosY + 50 + curveDepth; y += 5) + { + ShapeData circle = new(); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + { + //new Modifiers.RadialDither(1, 30).Output(circle), + new Modifiers.Blotches().Output(circle), + })); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + } + }); //clear a smaller square out of the center where the biomes stuff will be - for (int X = startPosX - biomeSize + 35; X <= startPosX + biomeSize - 35; X++) + ForLoop.Invoke(startPosX - biomeSize + 35, startPosX + biomeSize - 35, 1, (X) => { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) + for (int Y = startPosY - 65; Y <= startPosY + 50; Y++) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(2, 5)), Actions.Chain(new GenAction[] { - blotchMod.Output(circle) + blotchMod.Output(circle) })); WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] { - new Actions.Clear() + new Actions.Clear() })); } - } + }); - //place little islands - for (int MoundX = startPosX - biomeSize + 35; MoundX <= startPosX + biomeSize - 35; MoundX += WorldGen.genRand.Next(60, 120)) + // + // Places slopes at the sides of the shores to actually make shores. + // + ForLoop.Invoke(startPosX - biomeSize + 20, startPosX - biomeSize + 200, 20, (moundX) => { - int MoundY = startPosY + 60; + ShapeData mound = new(); + GenAction blotchMod = new Modifiers.Blotches().Output(mound); + int moundY = startPosY + 60; + int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize + 27, startPosX - biomeSize + 200, moundX))); - ShapeData mound = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(MoundX, MoundY), new Shapes.Mound(30, 45), Actions.Chain(new GenAction[] - { - blotchMod.Output(mound) - })); - WorldUtils.Gen(new Point(MoundX, MoundY), new ModShapes.All(mound), Actions.Chain(new GenAction[] - { - new Actions.Clear(), new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - - //place a wall pillar above an island - PlaceShoresWallPillar(startPosY, MoundX); - } - - //clear the tops off of the mounds so they have flat surfaces the player can walk on - for (int MoundClearX = startPosX - biomeSize + 37; MoundClearX <= startPosX + biomeSize - 37; MoundClearX++) + WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + }); + ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize - 20, 20, (moundX) => { - for (int MoundClearY = startPosY - 35; MoundClearY <= startPosY + 35; MoundClearY++) + ShapeData mound = new(); + GenAction blotchMod = new Modifiers.Blotches().Output(mound); + int moundY = startPosY + 60; + int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize - 27, startPosX + biomeSize - 200, moundX))); + + WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + }); + + // + // Makes a large platform in the middle of the Timeless Shores. + // + const int platformSize = 130; + const int platformHeight = 35; // Remember that because of Terraria's coordinate system, making it lower actually makes it higher. + const int platformDepth = 35; // How deep it goes. Like above, the higher it is, the lower it goes. + ForLoop.Invoke(startPosX - platformSize / 2, startPosX + platformSize / 2, 5, (platformX) => + { + // This makes the "stem" of the platform be thinner towards the base and then expand on the top. + int thickness = (int)(MathF.Pow(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, platformX)), 3f) * platformDepth) + platformHeight; + + for (int platformY = startPosY + platformHeight; platformY <= startPosY + thickness; platformY++) { - WorldGen.KillTile(MoundClearX, MoundClearY); + WorldUtils.Gen(new Point(platformX, platformY), new Shapes.Circle(5), Actions.Chain(new GenAction[] + { + new Actions.Clear(), // Clears all tiles and walls. + new Actions.PlaceTile((ushort)ModContent.TileType()) // Places tiles. + })); } - } + }); + ForLoop.Invoke(startPosX - platformSize / 2, startPosX + platformSize / 2, 1, (x) => + { + float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, x, true)); + int elevation = (int)MathHelper.Lerp(4f, 1f, interpolator); + WorldUtils.Gen(new Point(x, startPosY + platformHeight - 7), new Shapes.Circle(elevation), Actions.Chain(new GenAction[] { new Actions.Clear(), })); + }); + + // + // Makes a hole into the actual Sunken Sea at the botoom-left and bottom-right of the middle platform of the Timeless Shores. + // + const int furthestDistanceFromCenter = 55; + const int shortestDistanceFromCenter = 35; + const int holeStart = 50; + const int holeDepth = 35; + ForLoop.Invoke(startPosX - furthestDistanceFromCenter, startPosX - shortestDistanceFromCenter, 1, (holeX) => + { + for (int holeY = startPosY + holeStart; holeY <= startPosY + holeStart + holeDepth; holeY += 3) + { + ShapeData circle = new(); + + // As the hole gets deeper, we want the holes to be bigger and more blurry, so it's not so monotonous. + int sizeIncrement = (int)Utils.Remap(holeY, startPosY + holeStart, startPosY + holeStart + holeDepth, 1, 20); + + // may or may not be useful later + //GenAction dither = new Modifiers.RadialDither(2 * sizeIncrement, 5 * sizeIncrement); + + WorldUtils.Gen(new Point(holeX, holeY), new Shapes.Circle(sizeIncrement), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), // The shape removes tiles. + new Actions.SetLiquid() // The shape adds liquid (Default to max water). + })); + } + }); + ForLoop.Invoke(startPosX + shortestDistanceFromCenter, startPosX + furthestDistanceFromCenter, 1, (holeX) => + { + for (int holeY = startPosY + holeStart; holeY <= startPosY + holeStart + holeDepth; holeY += 3) + { + ShapeData circle = new(); + + // As the hole gets deeper, we want the holes to be bigger and more blurry, so it's not so monotonous. + int sizeIncrement = (int)Utils.Remap(holeY, startPosY + holeStart, startPosY + holeStart + holeDepth, 1, 20); + + WorldUtils.Gen(new Point(holeX, holeY), new Shapes.Circle(sizeIncrement), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), // The shape removes tiles. + new Actions.SetLiquid() // The shape adds liquid (Default to max water). + })); + } + }); //place water below the clear barrier for the islands so that theres water inbetween them - for (int WaterX = startPosX - biomeSize + 35; WaterX <= startPosX + biomeSize - 35; WaterX++) + ForLoop.Invoke(startPosX - biomeSize + 35, startPosX + biomeSize - 35, 1, (WaterX) => { - for (int WaterY = startPosY + 37; WaterY <= startPosY + 50; WaterY++) + for (int WaterY = startPosY + 37; WaterY <= startPosY + 60; WaterY++) { Main.tile[WaterX, WaterY].Get().LiquidType = LiquidID.Water; Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; } - } + }); //slope tiles - for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X++) + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => { for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) { Tile.SmoothSlope(X, Y); } - } + }); //place layer of sand on valid runestone blocks - for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X++) + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => { for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) { bool canPlaceSand = false; - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) { canPlaceSand = true; @@ -134,27 +300,91 @@ namespace CalamityMod.World PlaceSand(X, Y, 5, ModContent.TileType()); } } - } - } + }); - //places a pillar of walls along the height of the timeless shores biome - public static void PlaceShoresWallPillar(int startPosY, int XPosition) - { - for (int Y = startPosY - 55; Y <= startPosY + 50; Y++) + // + // Generates pillars made out of walls at random points in the Timeless Shores. + // + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 100, (wallPillarX) => { - int RandomX = + WorldGen.genRand.Next(-8, 8); + int randomDisplacementX = WorldGen.genRand.Next(-10, 30); - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(XPosition + RandomX, Y), new Shapes.Circle(WorldGen.genRand.Next(3, 7)), Actions.Chain(new GenAction[] + for (int wallPillarY = startPosY - 75; wallPillarY <= startPosY + 70; wallPillarY += 10) { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(XPosition + RandomX, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + // Along the height of the pillar, it becomes shorter the more closer to the center we get. + int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosY - 75, startPosY + 50, wallPillarY)) * 25); + + ShapeData rectangle = new ShapeData(); + GenAction blotchFilter = new Modifiers.Blotches(2, 0.4); + GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startPosY + 40, startPosY + 70, wallPillarY) + 0.25, 1)); + + WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 12), Actions.Chain(new GenAction[] + { + ditherFilter.Output(rectangle), // Applies a dithering filter to the rectangle. + blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. + })); + + WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] + { + new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. + })); + } + }); + + // + // Makes the transition area to the Timeless Shores. + // Replaces tiles, walls, and places some water spots. + // + ForLoop.Invoke(startPosX - biomeSize - 25, startPosX + biomeSize + 25, 20, (x) => + { + for (int y = startPosY - 70; y >= startPosY - 200; y -= 15) { - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - } + float interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); + float ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); + + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(TileID.Sand, TileID.HardenedSand), + new Modifiers.Dither(ditherStrength + 0.2f), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + // changing these makes the walls dither higher up than tiles, to prevent the biome from changing earlier than expected. still looks nice imo :) + interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 200, y, true); + ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); + + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyWalls(WallID.Sandstone, WallID.HardenedSand), + new Modifiers.Dither(ditherStrength), + new Actions.ClearWall(), + new Actions.PlaceWall((ushort)ModContent.WallType()), + })); + + // i forgot to change this one. :peepotired: + interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); + ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(TileID.Sandstone), + new Modifiers.Dither(ditherStrength), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + + if (Main.tile[x, y].Get().LiquidType == LiquidID.Lava) + WorldUtils.Gen(new Point(x, y), new Shapes.Rectangle(5, 5), new Actions.SetLiquid(LiquidID.Lava, 0)); + + if (WorldGen.genRand.NextBool(5) && y < startPosY - 100) + { + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(WorldGen.genRand.Next(5, 7)), Actions.Chain(new GenAction[] + { + new Modifiers.IsNotSolid().Output(new()), + new Actions.SetLiquid(), + })); + } + } + }); } //sides of the sunken sea (radiant reefs) @@ -182,7 +412,7 @@ namespace CalamityMod.World Vector2 bottomFoci = center + fociOffset; //first, place a basalt barrier on the left and right of the biome - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -197,37 +427,37 @@ namespace CalamityMod.World { if (LeftSideBarrier) { - if (X <= origin.X && Main.tile[X - 40, Y].TileType != ModContent.TileType()) + if (X <= origin.X && Main.tile[X - 40, Y - 25].TileType != ModContent.TileType()) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X - 40, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X - 40, Y - 25), new Shapes.Circle(60), Actions.Chain(new GenAction[] { - blotchMod.Output(circle) + blotchMod.Output(circle) })); - WorldUtils.Gen(new Point(X - 40, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X - 40, Y - 25), new ModShapes.All(circle), Actions.Chain(new GenAction[] { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) })); } } else { - if (X >= origin.X && Main.tile[X + 40, Y].TileType != ModContent.TileType()) + if (X >= origin.X && Main.tile[X + 40, Y - 25].TileType != ModContent.TileType()) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X + 40, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[] + + WorldUtils.Gen(new Point(X + 40, Y - 25), new Shapes.Circle(60), Actions.Chain(new GenAction[] { - blotchMod.Output(circle) + blotchMod.Output(circle) })); - WorldUtils.Gen(new Point(X + 40, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X + 40, Y - 25), new ModShapes.All(circle), Actions.Chain(new GenAction[] { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) })); } } @@ -235,7 +465,7 @@ namespace CalamityMod.World } } } - } + }); //generate the actual caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) @@ -295,7 +525,7 @@ namespace CalamityMod.World } //cleanup - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -319,10 +549,10 @@ namespace CalamityMod.World } } } - } + }); //place layer of sand blocks on valid surfaces - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -331,7 +561,7 @@ namespace CalamityMod.World bool canPlaceSand = false; //place sand clumps on top of exposed shellstone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) { canPlaceSand = true; @@ -343,10 +573,10 @@ namespace CalamityMod.World } } } - } + }); //cleanup again - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -379,7 +609,7 @@ namespace CalamityMod.World Tile.SmoothSlope(X, Y); } } - } + }); } //middle of the sunken sea (polyp forest) @@ -410,7 +640,7 @@ namespace CalamityMod.World { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) { float percent = dist / constant; float blurPercent = 0.98f; @@ -477,11 +707,11 @@ namespace CalamityMod.World } //cleanup - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) { //clean tiles that are sticking out (aka tiles only attached to one tile on one side) bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; @@ -501,19 +731,19 @@ namespace CalamityMod.World } } } - } + }); //place extra tiles - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 20; Y <= origin.Y + verticalRadius + 20; Y++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) { bool canPlaceSand = false; //place sand clumps on top of exposed limestone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) { canPlaceSand = true; @@ -525,14 +755,14 @@ namespace CalamityMod.World } } } - } - + }); + //cleanup again - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) { //clean tiles that are sticking out (aka tiles only attached to one tile on one side) bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; @@ -561,7 +791,7 @@ namespace CalamityMod.World Tile.SmoothSlope(X, Y); } } - } + }); } //bottom of the biome (gleaming burrows) @@ -588,7 +818,7 @@ namespace CalamityMod.World Vector2 bottomFoci = center + fociOffset; //place another barrier so the gleaming burrows doesnt just burst into the gully - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X += 10) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 10, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y += 2) { @@ -599,25 +829,25 @@ namespace CalamityMod.World if (percent > blurPercent) { - if (Y > origin.Y + 20) + if (Y > origin.Y - 10) { ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y + 10), new Shapes.Circle(20), Actions.Chain(new GenAction[] + GenAction blotchMod = new Modifiers.Blotches(10, 0.4); + + WorldUtils.Gen(new Point(X, Y - 10), new Shapes.Circle(20), Actions.Chain(new GenAction[] { - blotchMod.Output(circle) + blotchMod.Output(circle) })); - WorldUtils.Gen(new Point(X, Y + 10), new ModShapes.All(circle), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y - 10), new ModShapes.All(circle), Actions.Chain(new GenAction[] { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) })); } } } } - } + }); //place the gleaming burrows caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) @@ -696,7 +926,7 @@ namespace CalamityMod.World } //cleanup the perlin caves - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -720,10 +950,10 @@ namespace CalamityMod.World } } } - } + }); //place extra tiles - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -743,7 +973,7 @@ namespace CalamityMod.World } } } - } + }); //cleanup again, also place geodes for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) @@ -791,20 +1021,20 @@ namespace CalamityMod.World //basalt biome underneath the sunken sea public static void PlaceBasaltGully(int startPosX, int startPosY) { - int biomeSize = 230 + (Main.maxTilesX / 180); + int biomeSize = 200 + (Main.maxTilesX / 180); - int XLeft = GenVars.UndergroundDesertLocation.Left; - int XRight = GenVars.UndergroundDesertLocation.Right; + int XLeft = GenVars.UndergroundDesertLocation.Left + 30; + int XRight = GenVars.UndergroundDesertLocation.Right - 30; //place circles of basalt along the 2 edges of the area - for (int Y = startPosY - 30; Y <= Main.maxTilesY - 260; Y += 20) + for (int Y = startPosY - 60; Y <= Main.maxTilesY - 230; Y += 20) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); int radius = WorldGen.genRand.Next(30, 45); int RandomX = Main.rand.Next(-25, 25); - + WorldUtils.Gen(new Point(XLeft, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] { blotchMod.Output(circle) @@ -831,36 +1061,36 @@ namespace CalamityMod.World } //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance - for (int X = startPosX - biomeSize - 25; X <= startPosX + biomeSize + 25; X++) + ForLoop.Invoke(startPosX - biomeSize - 25, startPosX + biomeSize + 25, 1, (X) => { - for (int Y = startPosY - 30; Y <= Main.maxTilesY - 250; Y++) + for (int Y = startPosY - 30; Y <= Main.maxTilesY - 200; Y++) { Main.tile[X, Y].ClearEverything(); WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); WorldGen.PlaceWall(X, Y, WallID.LavaUnsafe1); } - } + }); //place another wall of circles along the bottom of the biome so it doesnt just end unnaturally - for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X += 20) + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 20, (X) => { int Y = Main.maxTilesY - 250; ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(25), Actions.Chain(new GenAction[] { - blotchMod.Output(circle) + blotchMod.Output(circle) })); WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall(WallID.LavaUnsafe1) + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall(WallID.LavaUnsafe1) })); - } + }); //place caverns and lava for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) @@ -887,7 +1117,7 @@ namespace CalamityMod.World } //place sand blocks - for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + ForLoop.Invoke(startPosX - biomeSize - (Main.maxTilesX / 25), startPosX + biomeSize + (Main.maxTilesX / 25), 1, (X) => { for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) { @@ -904,10 +1134,10 @@ namespace CalamityMod.World PlaceSand(X, Y, 3, ModContent.TileType()); } } - } + }); //cleanup - for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + ForLoop.Invoke(startPosX - biomeSize - (Main.maxTilesX / 25), startPosX + biomeSize + (Main.maxTilesX / 25), 1, (X) => { for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) { @@ -935,7 +1165,7 @@ namespace CalamityMod.World Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); } } - } + }); } //cleanup is done separately because for whatever reason it keeps placing water inside of the gully if the cleanup is done before it @@ -1038,7 +1268,7 @@ namespace CalamityMod.World //small navystone piles if (WorldGen.genRand.NextBool(5)) { - ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), + ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); @@ -1085,7 +1315,7 @@ namespace CalamityMod.World //small navystone piles if (WorldGen.genRand.NextBool()) { - ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), + ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); @@ -1098,7 +1328,7 @@ namespace CalamityMod.World //multi-colored corals if (WorldGen.genRand.NextBool(3)) { - ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), + ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(ColoredCorals)); @@ -1129,7 +1359,7 @@ namespace CalamityMod.World //misc corals if (WorldGen.genRand.NextBool()) { - ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), + ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(MiscCorals)); @@ -1151,11 +1381,11 @@ namespace CalamityMod.World //wall corals if (Main.tile[X, Y].TileType == ModContent.TileType()) - { + { if (WorldGen.genRand.NextBool(5) && !Main.tile[X + 1, Y].HasTile) { - ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceTile(X + 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); @@ -1163,8 +1393,8 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(5) && !Main.tile[X - 1, Y].HasTile) { - ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceTile(X - 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); @@ -1273,12 +1503,12 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), }; - + void getAttachedPoints(int x, int y, List points) { Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); Point p = new(x, y); - + if (!blockTileTypes.Contains(t.TileType) || !t.HasTile || points.Count > 75 || points.Contains(p)) { return; @@ -1292,7 +1522,7 @@ namespace CalamityMod.World getAttachedPoints(x, y - 1, points); } - for (int x = 20; x < Main.maxTilesX - 20; x++) + ForLoop.Invoke(20, Main.maxTilesX - 20, 1, (x) => { for (int y = 20; y < Main.maxTilesY - 20; y++) { @@ -1312,11 +1542,11 @@ namespace CalamityMod.World } } } - } + }); } //method to make sure things only generate in each biome circle - public static bool CheckInBiomeArea(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) + public static bool CheckInBiomeArea(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false, bool collapseBottom = false) { Vector2 point = tile.ToWorldCoordinates(); @@ -1325,7 +1555,11 @@ namespace CalamityMod.World float distY = center.Y - point.Y; point.Y -= distY * 4f; } - + if (collapseBottom) + { + float distY = center.Y - point.Y; + point.Y += distY * 4f; + } float distance1 = Vector2.Distance(point, focus1); float distance2 = Vector2.Distance(point, focus2); distance = distance1 + distance2; diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index adda47c705..409cacaa03 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -1,15 +1,19 @@ using System; using System.Collections.Generic; +using System.Linq; using CalamityMod.Items.Accessories; using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Placeables.FurnitureAbyss; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Schematics; +using CalamityMod.Tiles; +using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Tiles.SunkenSea; @@ -42,8 +46,8 @@ namespace CalamityMod.World { return true; } - if (tile.TileType == TileType() || - tile.TileType == TileType() || + if (tile.TileType == TileType() || + tile.TileType == TileType() || tile.WallType == WallType() || tile.WallType == WallType()) { @@ -243,7 +247,7 @@ namespace CalamityMod.World List contents = new List() { new ChestItem(ItemType(), 1), - new ChestItem(ItemType(), WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.DungeonDesertKey, 1), new ChestItem(ItemID.DesertTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -256,7 +260,7 @@ namespace CalamityMod.World contents = new List() { new ChestItem(ItemType(), 1), - new ChestItem(ItemType(), WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.DungeonDesertKey, 1), new ChestItem(ItemID.DesertTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -875,6 +879,69 @@ namespace CalamityMod.World } #endregion + #region Roxcalibur Shrine + public static void PlaceRoxShrine(StructureMap structures) + { + int tries = 0; + string mapKey = Main.rand.NextBool() ? RoxcaliburShrineKey1 : RoxcaliburShrineKey2; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15f), (int)(Main.maxTilesX * 0.85f)); + // Ensure that the shrine doesn't generate too close to the center of the world + do + { + placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15f), (int)(Main.maxTilesX * 0.85f)); + } + while (placementPositionX > (int)(Main.maxTilesX * 0.4f) && placementPositionX < (int)(Main.maxTilesX * 0.6f)); + + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.75f), Main.UnderworldLayer-50); //Lava layer + + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int extraArea = 0; + int yExtraArea = 10; + bool canGenerateInLocation = true; + + for (int x = placementPoint.X - extraArea; x < placementPoint.X + schematicSize.X + extraArea; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y + yExtraArea; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + + //Avoid shacks, jungle and mushroom biomes + if (tile.TileType == TileID.WoodBlock || tile.TileType == TileID.Mud || tile.TileType == ModContent.TileType()) + canGenerateInLocation = false; + + //Try to not be in a place with lava on the top half or above the shrine + if (ShouldAvoidLocation(new Point(x, y-20), true)) + canGenerateInLocation = false; + + //Check for the rest of the structure + if (ShouldAvoidLocation(new Point(x, y), false)) + canGenerateInLocation = false; + + } + } + if ((!canGenerateInLocation || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) && !Main.remixWorld) + { + tries++; + } + else + { + bool _ = false; + //added those first things so it stops complaining, there's no easter bunny, there's no tooth fairy and there is no chest + PlaceSchematic>(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _); + //Do not get eaten by other structures or Fargo's instabridge + CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; + } + } while (tries <= 100000); + CalamityMod.Instance.Logger.Debug("Rox Shrine failed to generate"); + } + #endregion + #region Abyss Shrine public static void PlaceAbyssShrine(int chestLeftX, int chestTopY) { diff --git a/World/VernalPass.cs b/World/VernalPass.cs index f1c6aa9875..cea45e5153 100644 --- a/World/VernalPass.cs +++ b/World/VernalPass.cs @@ -58,7 +58,7 @@ namespace CalamityMod.World public static void FillVernalPassChests(Chest chest, int Type, bool firstItem) { - int mainItem = Utils.SelectRandom(WorldGen.genRand, ItemID.StaffofRegrowth, ItemID.AnkletoftheWind, ItemID.FeralClaws); + int mainItem = Utils.SelectRandom(WorldGen.genRand, ItemID.StaffofRegrowth, ItemID.AnkletoftheWind, ItemID.FeralClaws, ModContent.ItemType()); int bars = Utils.SelectRandom(WorldGen.genRand, ItemID.GoldBar, ItemID.PlatinumBar); int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.ThornsPotion, ItemID.BattlePotion, ItemID.ShinePotion, ItemID.HunterPotion); diff --git a/build.txt b/build.txt index cf9028fcf7..b2de9aca5b 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 2.0.4.003 +version = 2.0.4.006 displayName = Calamity Mod modReferences = CalamityModMusic homepage = https://discord.gg/calamity diff --git a/description.txt b/description.txt index e3ebef4e0b..2d245627a8 100644 --- a/description.txt +++ b/description.txt @@ -2,24 +2,28 @@ The Calamity Mod is a vast content mod for Terraria. It adds two new difficulty modes, multiple entire biomes, thousands of items, hundreds of weapons, and dozens of bosses. The mod also makes hundreds of adjustments to vanilla items, features and mechanics to improve balance, quality of life and overall gameplay consistency. +Calamity adds significant progression to the game after defeating the Moon Lord, including many new tiers of equipment. + A more detailed breakdown of the content available in Calamity: - 27 bosses and 12 minibosses -- 100+ enemies +- 200+ enemies - 5 town NPCs - 5 biomes and many new structures - 1 event - 1 new playable class (based on Throwing from Terraria 1.3) -- 1800+ items +- 2400+ items - 700+ weapons -- 100+ blocks +- Almost 100 blocks - 200+ pieces of furniture - 11 ores -- 2 full difficulty settings above Expert, separate from Master +- 2 full difficulty settings above Expert which can be combined with Master - Significant improvements and changes to Master difficulty - 50+ changes to vanilla mechanics - 30+ new recipes for vanilla items -- 450+ tweaks and improvements to vanilla items +- 500+ tweaks and improvements to vanilla items - Minor cross-mod support for the Thorium Mod PLEASE NOTE THAT THIS MOD REQUIRES THE CALAMITY MUSIC MOD. You will need to install "Calamity Mod Music" from the Mod Browser or the Steam Workshop. + +Optionally, you can also install "Vanilla Calamity Mod Music" if you want to replace the vanilla soundtrack with Calamity-themed tracks. \ No newline at end of file diff --git a/description_workshop.txt b/description_workshop.txt index 337aa56b9e..3cdb56ca5b 100644 --- a/description_workshop.txt +++ b/description_workshop.txt @@ -3,7 +3,7 @@ The Calamity Mod is a vast content mod that creates a new and refreshing experience for Terraria! -With this mod comes a slew of new bosses, unique and challenging difficulty modes, over a thousand new items, new NPCs, and entire new biomes to explore! Calamity also massively expands the endgame of Terraria, creating an entirely original, intense experience for players to enjoy. +With this mod comes a slew of new bosses, unique and challenging difficulty modes, over two thousand new items, new NPCs, and entire new biomes to explore! Calamity also massively expands the endgame of Terraria, creating an entirely original, intense experience for players to enjoy. The mod additionally tweaks tons of vanilla features whilst adding new ones to aid the player's experience and heavily expand on the base game, including but not limited to: [olist] @@ -16,6 +16,9 @@ The mod additionally tweaks tons of vanilla features whilst adding new ones to a [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 +[i]For even more Calamity music, subscribe to Vanilla Calamity Mod Music![/i] +https://steamcommunity.com/sharedfiles/filedetails/?id=2816188633 + [b]Be sure to join our Discord server linked above to keep up with the latest news about upcoming updates and features.[/b] [hr] @@ -23,20 +26,20 @@ https://steamcommunity.com/sharedfiles/filedetails/?id=2824688266 A more detailed breakdown of the content available in Calamity: [olist] [*] 27 bosses and 12 minibosses -[*] 100+ enemies +[*] 200+ enemies [*] 5 town NPCs [*] 5 biomes and many new structures [*] 1 event [*] 1 new playable class (based on Throwing from Terraria 1.3) -[*] 1800+ items +[*] 2400+ items [*] 700+ weapons -[*] 100+ blocks -[*] 200+ pieces of furniture +[*] Almost 100 blocks +[*] 600+ pieces of furniture [*] 11 ores -[*] 2 full difficulty settings above Expert, separate from Master +[*] 2 full difficulty settings above Expert which can be combined with Master [*] Significant improvements and changes to Master difficulty [*] 50+ changes to vanilla mechanics [*] 30+ new recipes for vanilla items -[*] 450+ tweaks and improvements to vanilla items +[*] 500+ tweaks and improvements to vanilla items [*] Minor cross-mod support for the Thorium Mod -[/olist] \ No newline at end of file +[/olist]